osgEarth 2.1.1
Functions

anonymous_namespace{ObjectLocator.cpp} Namespace Reference

Functions

void getHPRFromQuat (const osg::Quat &q, double &h, double &p, double &r)

Function Documentation

void anonymous_namespace{ObjectLocator.cpp}::getHPRFromQuat ( const osg::Quat &  q,
double &  h,
double &  p,
double &  r 
)

Definition at line 12 of file ObjectLocator.cpp.

    {
        osg::Matrixd rot(q);
        p = asin(rot(1,2));
        if( osg::equivalent(osg::absolute(p), osg::PI_2) )
        {
            r = 0.0;
            h = atan2( rot(0,1), rot(0,0) );
        }
        else
        {
            r = atan2( rot(0,2), rot(2,2) );
            h = atan2( rot(1,0), rot(1,1) );
        }
        h = osg::RadiansToDegrees(h);
        p = osg::RadiansToDegrees(p);
        r = osg::RadiansToDegrees(r);
    }

Here is the call graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines