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


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

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


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

示例1: switch

bool
MercatorLocator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const
{
    bool result = false;

    // required becasue of an OSG bug
    if ( !_inverseCalculated )
    {
        const_cast<MercatorLocator*>(this)->_inverse.invert( _transform );
        const_cast<MercatorLocator*>(this)->_inverseCalculated = true;
    }

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

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

            local = osg::Vec3d(longitude, latitude, height) * _inverse;

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

            getUV( _geoDataExtent, lon_deg, lat_deg, xr, yr );

            local.x() = xr;
            local.y() = 1.0-yr;
            result = true;
        }
        break;


    case(GEOGRAPHIC):
        {        
            local = world * _inverse;

            osg::Vec3d w = world;
            double lon_deg = w.x();
            double lat_deg = w.y();

            double xr, yr;
            getUV( _geoDataExtent, lon_deg, lat_deg, xr, yr );

            local.x() = xr;
            local.y() = 1.0-yr;
            result = true;
        }
        break;

    case(PROJECTED):
        {        
            local = world * _inverse;
            result = true;      
        }
        break;
    }

    return result;
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:63,代码来源:Locators.cpp

示例2: printVec

void ArucoThread::printVec( const osg::Vec3d v, const QString name )const
{
	qDebug() << name << " " << v.x() << " " << v.y() << " " << v.z();
}
开发者ID:garajm,项目名称:RealityNotFound,代码行数:4,代码来源:arucothread.cpp

示例3: GetDistance

float OsgDrawableCullCallback::GetDistance (osg::Vec3d punto)
{
	return sqrt (	(eye.x()-punto.x()) * (eye.x()-punto.x())+
					(eye.y()-punto.y()) * (eye.y()-punto.y())+
					(eye.z()-punto.z()) * (eye.z()-punto.z()));
}
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:6,代码来源:OsgDrawableCullCallback.cpp

示例4:

LargeScaleCoord::LargeScaleCoord(const osg::Vec3d& realCoord)
{
    m_smallScale.set(0, 0, 0);
    m_largeScale.set(realCoord.x() / sizeFactor, realCoord.y() / sizeFactor, realCoord.z() / sizeFactor);
}
开发者ID:Jagholin,项目名称:Futurella,代码行数:5,代码来源:LargeScaleCoords.cpp

示例5: computeLocalBounds

bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const
{
    typedef std::list<osg::Vec3d> Corners;
    Corners corners;

    osg::Vec3d cornerNDC;
    if (convertLocalToModel(osg::Vec3d(0.0,0.0,0.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(1.0,0.0,0.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(0.0,1.0,0.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(1.0,1.0,0.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(0.0,0.0,1.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(1.0,0.0,1.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(0.0,1.0,1.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (convertLocalToModel(osg::Vec3d(1.0,1.0,1.0), cornerNDC))
    {
        corners.push_back(cornerNDC);
    }

    if (corners.empty()) return false;


    for(Corners::iterator itr = corners.begin();
        itr != corners.end();
        ++itr)
    {
        bottomLeft.x() = osg::minimum( bottomLeft.x(), itr->x());
        bottomLeft.y() = osg::minimum( bottomLeft.y(), itr->y());
        bottomLeft.z() = osg::minimum( bottomLeft.z(), itr->z());
        topRight.x() = osg::maximum( topRight.x(), itr->x());
        topRight.y() = osg::maximum( topRight.y(), itr->y());
        topRight.z() = osg::maximum( topRight.z(), itr->z());
    }
    
    return true;
}
开发者ID:aalex,项目名称:osg,代码行数:63,代码来源:Locator.cpp

示例6: intersectAndClip

bool LineSegmentIntersector::intersectAndClip(osg::Vec3d& s, osg::Vec3d& e,const osg::BoundingBox& bbInput)
{
    osg::Vec3d bb_min(bbInput._min);
    osg::Vec3d bb_max(bbInput._max);

#if 1
    double epsilon = 1e-4;
    bb_min.x() -= epsilon;
    bb_min.y() -= epsilon;
    bb_min.z() -= epsilon;
    bb_max.x() += epsilon;
    bb_max.y() += epsilon;
    bb_max.z() += epsilon;
#endif

    // compate s and e against the xMin to xMax range of bb.
    if (s.x()<=e.x())
    {

        // trivial reject of segment wholely outside.
        if (e.x()<bb_min.x()) return false;
        if (s.x()>bb_max.x()) return false;

        if (s.x()<bb_min.x())
        {
            // clip s to xMin.
            s = s+(e-s)*(bb_min.x()-s.x())/(e.x()-s.x());
        }

        if (e.x()>bb_max.x())
        {
            // clip e to xMax.
            e = s+(e-s)*(bb_max.x()-s.x())/(e.x()-s.x());
        }
    }
    else
    {
        if (s.x()<bb_min.x()) return false;
        if (e.x()>bb_max.x()) return false;

        if (e.x()<bb_min.x())
        {
            // clip s to xMin.
            e = s+(e-s)*(bb_min.x()-s.x())/(e.x()-s.x());
        }

        if (s.x()>bb_max.x())
        {
            // clip e to xMax.
            s = s+(e-s)*(bb_max.x()-s.x())/(e.x()-s.x());
        }
    }

    // compate s and e against the yMin to yMax range of bb.
    if (s.y()<=e.y())
    {

        // trivial reject of segment wholely outside.
        if (e.y()<bb_min.y()) return false;
        if (s.y()>bb_max.y()) return false;

        if (s.y()<bb_min.y())
        {
            // clip s to yMin.
            s = s+(e-s)*(bb_min.y()-s.y())/(e.y()-s.y());
        }

        if (e.y()>bb_max.y())
        {
            // clip e to yMax.
            e = s+(e-s)*(bb_max.y()-s.y())/(e.y()-s.y());
        }
    }
    else
    {
        if (s.y()<bb_min.y()) return false;
        if (e.y()>bb_max.y()) return false;

        if (e.y()<bb_min.y())
        {
            // clip s to yMin.
            e = s+(e-s)*(bb_min.y()-s.y())/(e.y()-s.y());
        }

        if (s.y()>bb_max.y())
        {
            // clip e to yMax.
            s = s+(e-s)*(bb_max.y()-s.y())/(e.y()-s.y());
        }
    }

    // compate s and e against the zMin to zMax range of bb.
    if (s.z()<=e.z())
    {

        // trivial reject of segment wholely outside.
        if (e.z()<bb_min.z()) return false;
        if (s.z()>bb_max.z()) return false;

        if (s.z()<bb_min.z())
//.........这里部分代码省略.........
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:101,代码来源:LineSegmentIntersector.cpp


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