rotation.H

00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 
00020 #ifndef ARCHON_MATH_ROTATION_H
00021 #define ARCHON_MATH_ROTATION_H
00022 
00023 #include <archon/math/vector.H>
00024 
00025 namespace Archon
00026 {
00027   namespace Math
00028   {
00147     struct Rotation3
00148     {
00149       static const Rotation3 &zero()
00150       {
00151         static Rotation3 r = makeZero();
00152         return r;
00153       }
00154 
00155       Vector3 axis; // The 1-D sub space around which we are rotating
00156       double angle;
00157 
00158       Rotation3() {}
00159       Rotation3(const Vector3 &axis, double angle):
00160         axis(axis), angle(angle) {}
00161 
00162       Rotation3 operator-() const { return Rotation3(axis, -angle); }
00163 
00164       bool operator==(const Rotation3 &r) const
00165       {
00166         return axis == r.axis && angle == r.angle;
00167       }
00168 
00169       bool operator!=(const Rotation3 &r) const
00170       {
00171         return axis != r.axis || angle != r.angle;
00172       }
00173 
00179       void combineWith(const Rotation3 &);
00180 
00181     private:
00182       static Rotation3 makeZero()
00183       {
00184         return Rotation3(Vector3::zero(), 0);
00185       }
00186     };
00187   }
00188 }
00189 
00190 #endif // ARCHON_MATH_ROTATION_H

Generated on Sun Jul 30 22:55:43 2006 for Archon by  doxygen 1.4.4