#ifndef ossimQuaternion_HEADER #define ossimQuaternion_HEADER 1 #include #include #include #include class ossimMatrix4x4; namespace ossim { /** A quaternion class. It can be used to represent an orientation in 3D space.*/ class OSSIM_DLL Quaternion { public: typedef ossim_float64 value_type; value_type theVector[4]; // a four-vector inline Quaternion() { theVector[0]=0.0; theVector[1]=0.0; theVector[2]=0.0; theVector[3]=1.0; } inline Quaternion( value_type x, value_type y, value_type z, value_type w ) { theVector[0]=x; theVector[1]=y; theVector[2]=z; theVector[3]=w; } /* inline Quaternion( const Vec4f& v ) */ /* { */ /* theVector[0]=v.x(); */ /* theVector[1]=v.y(); */ /* theVector[2]=v.z(); */ /* theVector[3]=v.w(); */ /* } */ /* inline Quaternion( const Vec4d& v ) */ /* { */ /* theVector[0]=v.x(); */ /* theVector[1]=v.y(); */ /* theVector[2]=v.z(); */ /* theVector[3]=v.w(); */ /* } */ inline Quaternion(ossim_float64 angle, const ossimDpt3d& axis) { makeRotate(angle,axis); } inline Quaternion(ossim_float64 angle, const ossimColumnVector3d& axis) { makeRotate(angle,axis); } /* inline Quaternion( value_type angle, const Vec3d& axis) */ /* { */ /* makeRotate(angle,axis); */ /* } */ /* inline Quaternion( value_type angle1, const Vec3f& axis1, */ /* value_type angle2, const Vec3f& axis2, */ /* value_type angle3, const Vec3f& axis3) */ /* { */ /* makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); */ /* } */ /* inline Quaternion( value_type angle1, const Vec3d& axis1, */ /* value_type angle2, const Vec3d& axis2, */ /* value_type angle3, const Vec3d& axis3) */ /* { */ /* makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); */ /* } */ inline Quaternion& operator = (const Quaternion& v) { theVector[0]=v.theVector[0]; theVector[1]=v.theVector[1]; theVector[2]=v.theVector[2]; theVector[3]=v.theVector[3]; return *this; } inline bool operator == (const Quaternion& v) const { return theVector[0]==v.theVector[0] && theVector[1]==v.theVector[1] && theVector[2]==v.theVector[2] && theVector[3]==v.theVector[3]; } inline bool operator != (const Quaternion& v) const { return theVector[0]!=v.theVector[0] || theVector[1]!=v.theVector[1] || theVector[2]!=v.theVector[2] || theVector[3]!=v.theVector[3]; } inline bool operator < (const Quaternion& v) const { if (theVector[0]v.theVector[0]) return false; else if (theVector[1]v.theVector[1]) return false; else if (theVector[2]v.theVector[2]) return false; else return (theVector[3]