/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSG_QUAT #define OSG_QUAT 1 #include #include #include namespace osg { /** A quaternion class. It can be used to represent an orientation in 3D space.*/ class SG_EXPORT Quat { public: /* ---------------------------------------------------------- DATA MEMBERS The only data member is a Vec4 which holds the elements In other words, osg:Quat is composed of an osg::Vec4 The osg::Quat aggregates an osg::Vec4 These seem to be different jargon for the same thing :-) ---------------------------------------------------------- */ Vec4 _fv; // a four-vector inline Quat(): _fv(0.0f,0.0f,0.0f,1.0f) {} inline Quat( float x, float y, float z, float w ): _fv(x,y,z,w) {} inline Quat( const Vec4& v ): _fv(v) {} inline Quat( float angle, const Vec3& axis) { makeRotate(angle,axis); } inline Quat( float angle1, const Vec3& axis1, float angle2, const Vec3& axis2, float angle3, const Vec3& axis3) { makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); } inline bool operator == (const Quat& rhs) const { return _fv==rhs._fv; } inline bool operator != (const Quat& rhs) const { return _fv!=rhs._fv; } inline bool operator < (const Quat& rhs) const { return _fv