当前位置: 首页>>代码示例>>C++>>正文


C++ Vec3d::y方法代码示例

本文整理汇总了C++中osg::Vec3d::y方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec3d::y方法的具体用法?C++ Vec3d::y怎么用?C++ Vec3d::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Vec3d的用法示例。


在下文中一共展示了Vec3d::y方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

bool
CubeFaceLocator::convertLocalToModel( const osg::Vec3d& local, osg::Vec3d& world ) const
{
#if ((OPENSCENEGRAPH_MAJOR_VERSION <= 2) && (OPENSCENEGRAPH_MINOR_VERSION < 8))
    // OSG 2.7 bug workaround: bug fix in Locator submitted by GW
    const_cast<CubeFaceLocator*>(this)->_inverse.invert( _transform );
#endif

    if ( _coordinateSystemType == GEOCENTRIC )
    {
        //Convert the NDC coordinate into face space
        osg::Vec3d faceCoord = local * _transform;

        double lat_deg, lon_deg;
        CubeUtils::faceCoordsToLatLon( faceCoord.x(), faceCoord.y(), _face, lat_deg, lon_deg );

        //OE_NOTICE << "LatLon=" << latLon <<  std::endl;

        // convert to geocentric:
        _ellipsoidModel->convertLatLongHeightToXYZ(
            osg::DegreesToRadians( lat_deg ),
            osg::DegreesToRadians( lon_deg ),
            local.z(),
            world.x(), world.y(), world.z() );

        return true;
    }    
    return true;
}
开发者ID:RealRui,项目名称:osgearth,代码行数:29,代码来源:Cube.cpp

示例2: printf

HUDHoverScaler::HUDHoverScaler(osgviz::Object* obj, const osg::Vec3d &size, const osg::Vec3d &scale, Type type, osg::Vec3d anchor_offset, HUD* hud):obj(obj),anchor_offset(anchor_offset),scale(scale),size(size),type(type),hud(hud){
    scaled = false;
    initial_scale = obj->getScale();
    if (scale.x() == 0 || scale.y() == 0 || scale.z() == 0){
        printf("%s scale cannot be 0\n",__PRETTY_FUNCTION__);
    }
}
开发者ID:arneboe,项目名称:gui-osgviz-osgviz,代码行数:7,代码来源:HUDHoverScaler.cpp

示例3:

bool
MapInfo::geocentricPointToMapPoint( const osg::Vec3d& input, osg::Vec3d& output ) const
{
    const SpatialReference* mapSRS = _profile->getSRS();
    if ( !mapSRS->isGeographic() )
        return false;

    mapSRS->getEllipsoid()->convertXYZToLatLongHeight(
        input.x(), input.y(), input.z(),
        output.y(), output.x(), output.z() );

    output.y() = osg::RadiansToDegrees(output.y());
    output.x() = osg::RadiansToDegrees(output.x());

    return true;
}
开发者ID:korash,项目名称:osgearth,代码行数:16,代码来源:Map.cpp

示例4: getRelativeWorld

static bool getRelativeWorld(double x, double y, double relativeHeight, MapNode* mapNode, osg::Vec3d& world )
{
    GeoPoint mapPoint(mapNode->getMapSRS(), x, y);
    osg::Vec3d pos;
    mapNode->getMap()->toWorldPoint(mapPoint, pos);

    osg::Vec3d up(0,0,1);
    const osg::EllipsoidModel* em = mapNode->getMap()->getProfile()->getSRS()->getEllipsoid();
    if (em)
    {
        up = em->computeLocalUpVector( world.x(), world.y(), world.z());
    }    
    up.normalize();

    double segOffset = 50000;

    osg::Vec3d start = pos + (up * segOffset);
    osg::Vec3d end = pos - (up * segOffset);
    
    osgUtil::LineSegmentIntersector* i = new osgUtil::LineSegmentIntersector( start, end );
    
    osgUtil::IntersectionVisitor iv;    
    iv.setIntersector( i );
    mapNode->getTerrainEngine()->accept( iv );

    osgUtil::LineSegmentIntersector::Intersections& results = i->getIntersections();
    if ( !results.empty() )
    {
        const osgUtil::LineSegmentIntersector::Intersection& result = *results.begin();
        world = result.getWorldIntersectPoint();
        world += up * relativeHeight;
        return true;
    }
    return false;    
}
开发者ID:airwzz999,项目名称:osgearth-for-android,代码行数:35,代码来源:LineOfSight.cpp

示例5: if

bool
SpatialReference::createLocalToWorld(const osg::Vec3d& xyz, osg::Matrixd& out_local2world ) const
{
    if ( (isProjected() || _is_plate_carre) && !isCube() )
    {
        osg::Vec3d world;
        if ( !transformToWorld( xyz, world ) )
            return false;
        out_local2world = osg::Matrix::translate(world);
    }
    else if ( isECEF() )
    {
        //out_local2world = ECEF::createLocalToWorld(xyz);
        _ellipsoid->computeLocalToWorldTransformFromXYZ(xyz.x(), xyz.y(), xyz.z(), out_local2world);
    }
    else
    {
        // convert MSL to HAE if necessary:
        osg::Vec3d geodetic;
        if ( !transform(xyz, getGeodeticSRS(), geodetic) )
            return false;

        // then to ECEF:
        osg::Vec3d ecef;
        if ( !transform(geodetic, getGeodeticSRS()->getECEF(), ecef) )
            return false;

        //out_local2world = ECEF::createLocalToWorld(ecef);        
        _ellipsoid->computeLocalToWorldTransformFromXYZ(ecef.x(), ecef.y(), ecef.z(), out_local2world);
    }
    return true;
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:32,代码来源:SpatialReference.cpp

示例6: spherical_to_cartesian_radians

osg::Vec3d spherical_to_cartesian (osg::Vec3d & spher, double scale)
{
    osg::Vec3d rads(spher.x (),
                    spher.y () * DEGS_TO_RADS,
                    spher.z () * DEGS_TO_RADS);
    return spherical_to_cartesian_radians(rads, scale);
}
开发者ID:robmyers,项目名称:surgical_strike,代码行数:7,代码来源:surgical_strike.cpp

示例7: computeDefaultViewProj

void ScreenBase::computeDefaultViewProj(osg::Vec3d eyePos, osg::Matrix & view,
        osg::Matrix & proj)
{
    //translate screen to origin
    osg::Matrix screenTrans;
    screenTrans.makeTranslate(-_myInfo->xyz);

    //rotate screen to xz
    osg::Matrix screenRot;
    screenRot.makeRotate(-_myInfo->h * M_PI / 180.0,osg::Vec3(0,0,1),
            -_myInfo->p * M_PI / 180.0,osg::Vec3(1,0,0),
            -_myInfo->r * M_PI / 180.0,osg::Vec3(0,1,0));

    eyePos = eyePos * screenTrans * screenRot;

    //make frustum
    float top, bottom, left, right;
    float screenDist = -eyePos.y();

    top = _near * (_myInfo->height / 2.0 - eyePos.z()) / screenDist;
    bottom = _near * (-_myInfo->height / 2.0 - eyePos.z()) / screenDist;
    right = _near * (_myInfo->width / 2.0 - eyePos.x()) / screenDist;
    left = _near * (-_myInfo->width / 2.0 - eyePos.x()) / screenDist;

    proj.makeFrustum(left,right,bottom,top,_near,_far);

    // move camera to origin
    osg::Matrix cameraTrans;
    cameraTrans.makeTranslate(-eyePos);

    //make view
    view = screenTrans * screenRot * cameraTrans
            * osg::Matrix::lookAt(osg::Vec3(0,0,0),osg::Vec3(0,1,0),
                    osg::Vec3(0,0,1));
}
开发者ID:CalVR,项目名称:calvr,代码行数:35,代码来源:ScreenBase.cpp

示例8: getDouble

osg::Vec3d ConfigManager::getVec3d(std::string attributeX,
        std::string attributeY, std::string attributeZ, std::string path,
        osg::Vec3d def, bool * found)
{
    bool hasEntry = false;
    bool isFound;

    osg::Vec3d result;
    result.x() = getDouble(attributeX,path,def.x(),&isFound);
    if(isFound)
    {
        hasEntry = true;
    }
    result.y() = getDouble(attributeY,path,def.y(),&isFound);
    if(isFound)
    {
        hasEntry = true;
    }
    result.z() = getDouble(attributeZ,path,def.z(),&isFound);
    if(isFound)
    {
        hasEntry = true;
    }

    if(found)
    {
        *found = hasEntry;
    }
    return result;
}
开发者ID:dacevedofeliz,项目名称:calvr,代码行数:30,代码来源:ConfigManager.cpp

示例9: transform

bool 
SpatialReference::transformToECEF(const osg::Vec3d& input,
                                  osg::Vec3d&       output ) const
{
    double lat = input.y(), lon = input.x(), alt = input.z();
    
    // first convert to lat/long if necessary:
    if ( !isGeographic() )
        transform( input.x(), input.y(), input.z(), getGeographicSRS(), lon, lat, alt );

    // then convert to ECEF.
    //double z = input.z();
    getGeographicSRS()->getEllipsoid()->convertLatLongHeightToXYZ(
        osg::DegreesToRadians( lat ), osg::DegreesToRadians( lon ), alt,
        output.x(), output.y(), output.z() );

    return true;
}
开发者ID:spencerg,项目名称:osgearth,代码行数:18,代码来源:SpatialReference.cpp

示例10:

osg::Vec3d LineAnalysis::getWorldCoord(osg::Vec3d pos)
{
	osg::Vec3d world;
	m_pMap3D->getSRS()->getEllipsoid()->convertLatLongHeightToXYZ(
		osg::DegreesToRadians(pos.y()),
		osg::DegreesToRadians(pos.x()),
		pos.z(), world.x(), world.y(), world.z());

	return world;
}
开发者ID:Ezio47,项目名称:OSGEarth,代码行数:10,代码来源:lineanalysis.cpp

示例11:

void 
TessellateOperator::tessellateGeo( const osg::Vec3d& p0, const osg::Vec3d& p1, unsigned parts, GeoInterpolation interp, Vec3dVector& out )
{
    double step = 1.0/double(parts);
    double zdelta = p1.z() - p0.z();

    out.push_back( p0 );

    for( unsigned i=1; i<parts; ++i )
    {
        double t = step*double(i);
        osg::Vec3d p;

        if ( interp == GEOINTERP_GREAT_CIRCLE )
        {
            double lat, lon;
            GeoMath::interpolate(
                osg::DegreesToRadians(p0.y()), osg::DegreesToRadians(p0.x()),
                osg::DegreesToRadians(p1.y()), osg::DegreesToRadians(p1.x()),
                t,
                lat, lon );
            p.set( osg::RadiansToDegrees(lon), osg::RadiansToDegrees(lat), p0.z() + t*zdelta );
        }
        else // GEOINTERP_RHUMB_LINE
        {
            double lat1 = osg::DegreesToRadians(p0.y()), lon1 = osg::DegreesToRadians(p0.x());
            double lat2 = osg::DegreesToRadians(p1.y()), lon2 = osg::DegreesToRadians(p1.x());

            double totalDistance = GeoMath::rhumbDistance( lat1, lon1, lat2, lon2 );
            double bearing  = GeoMath::rhumbBearing( lat1, lon1, lat2, lon2 );

            double interpDistance = t * totalDistance;

            double lat3, lon3;
            GeoMath::rhumbDestination(lat1, lon1, bearing, interpDistance, lat3, lon3);

            p.set( osg::RadiansToDegrees(lon3), osg::RadiansToDegrees(lat3), p0.z() + t*zdelta );
        }

        out.push_back(p);
    }
}
开发者ID:caishanli,项目名称:osgearth,代码行数:42,代码来源:TessellateOperator.cpp

示例12: switch

bool
CubeFaceLocator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const
{
#if ((OPENSCENEGRAPH_MAJOR_VERSION <= 2) && (OPENSCENEGRAPH_MINOR_VERSION < 8))
    // OSG 2.7 bug workaround: bug fix in Locator submitted by GW
    const_cast<CubeFaceLocator*>(this)->_inverse.invert( _transform );
#endif

    switch(_coordinateSystemType)
    {
    case(GEOCENTRIC):
        {         
            double longitude, latitude, height;

            _ellipsoidModel->convertXYZToLatLongHeight(world.x(), world.y(), world.z(), latitude, longitude, height );

            int face=-1;
            double x, y;

            double lat_deg = osg::RadiansToDegrees(latitude);
            double lon_deg = osg::RadiansToDegrees(longitude);

            bool success = CubeUtils::latLonToFaceCoords( lat_deg, lon_deg, x, y, face, _face );

            if (!success)
            {
                OE_WARN << LC << "Couldn't convert to face coords " << std::endl;
                return false;
            }
            if (face != _face)
            {
                OE_WARN << LC
                    << "Face should be " << _face << " but is " << face
                    << ", lat = " << lat_deg
                    << ", lon = " << lon_deg
                    << std::endl;
            }

            local = osg::Vec3d( x, y, height ) * _inverse;
            return true;
        }


    case(GEOGRAPHIC):
    case(PROJECTED):
        // Neither of these is supported for this locator..
        {        
            local = world * _inverse;
            return true;      
        }
    }    

    return false;
}
开发者ID:emminizer,项目名称:osgearth,代码行数:54,代码来源:Cube.cpp

示例13:

osg::Vec3d RadarMap::getLonLat(const osg::Vec3d& worldPos)
{
	osg::Vec3d vecPos = osg::Vec3d();
	if (m_pOSGViewer)
	{
		m_pOSGViewer->getSRS()->getEllipsoid()->convertXYZToLatLongHeight(
			worldPos.x(), worldPos.y(), worldPos.z(), vecPos.y(), vecPos.x(), vecPos.z());
		vecPos.x() = osg::RadiansToDegrees(vecPos.x());
		vecPos.y() = osg::RadiansToDegrees(vecPos.y());
	}
	return vecPos;
}
开发者ID:Ezio47,项目名称:OSGEarth,代码行数:12,代码来源:radarmap.cpp

示例14: navigate

void CameraFlight::navigate(osg::Matrix destMat, osg::Vec3 destVec)
{
    osg::Matrix objMat = SceneManager::instance()->getObjectTransform()->getMatrix();

    switch(_flightMode)
    {
	case INSTANT:{
	    cout<<"USING INSTANT"<<endl;
	    SceneManager::instance()->setObjectMatrix(destMat);
	    break;
	}
	case SATELLITE:
	    cout<<"USING SATELLITE"<<endl;

	    t = 0.0;
	    total = 0.0;
	
    	    objMat.decompose(trans2, rot2, scale2, so2);
	    a = (maxHeight - trans2[1])/25.0;

	    map->getProfile()->getSRS()->getEllipsoid()->convertLatLongHeightToXYZ(
					destVec.x(),destVec.y(),destVec.z(),toVec.x(),toVec.y(),toVec.z());

	    fromVec = origPlanetPoint;

	    fromVec.normalize();
	    toVec.normalize();

	    origAngle = acos((fromVec * toVec)/((fromVec.length() * toVec.length())));	
	    origAngle = RadiansToDegrees(origAngle);

	    angle = origAngle;

    	    if(origAngle <= 10) {
		maxHeight = 6.5e+9;
	    }

	    else {
		maxHeight = 2.0e+10;
	    }

	    flagRot = true;
	    break;
	case AIRPLANE:
	    cout<<"USING AIRPLANE"<<endl;
	    break;
	default:
	    cout<<"PICK THE ALGORYTHM!!!!"<<endl;
	    break;
    }
}
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:51,代码来源:CameraFlight.cpp

示例15: setLOSPoint

void LOSCreationDialog::setLOSPoint(LOSPoint point, const osg::Vec3d& value, bool updateUi)
{
  _updatingUi = !updateUi;
  switch(point)
  {
    case P2P_START:
      _ui.p1LatBox->setValue(value.y());
      _ui.p1LonBox->setValue(value.x());

      _p1BaseAlt = value.z();

      if (!isAltitudeRelative(point))
        _ui.p1AltBox->setValue(value.z());

      break;
    case P2P_END:
      _ui.p2LatBox->setValue(value.y());
      _ui.p2LonBox->setValue(value.x());

      _p2BaseAlt = value.z();

      if (!isAltitudeRelative(point))
        _ui.p2AltBox->setValue(value.z());

      break;
    case RADIAL_CENTER:
      _ui.radLatBox->setValue(value.y());
      _ui.radLonBox->setValue(value.x());

      _radBaseAlt = value.z();

      if (!isAltitudeRelative(point))
        _ui.radAltBox->setValue(value.z());

      break;
  }
  _updatingUi = false;
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:38,代码来源:LOSCreationDialog.cpp


注:本文中的osg::Vec3d::y方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。