Rotation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef BASE_ROTATION_H
00025 #define BASE_ROTATION_H
00026
00027 #include "Vector3D.h"
00028
00029 namespace Base {
00030
00031
00032 class Matrix4D;
00033
00034 class BaseExport Rotation
00035 {
00036 public:
00039 Rotation();
00040 Rotation(const Vector3d& axis, const double fAngle);
00041 Rotation(const Matrix4D& matrix);
00042 Rotation(const double q[4]);
00043 Rotation(const double q0, const double q1, const double q2, const double q3);
00044 Rotation(const Vector3d& rotateFrom, const Vector3d& rotateTo);
00045 Rotation(const Rotation& rot);
00047
00050 const double * getValue(void) const;
00051 void getValue(double & q0, double & q1, double & q2, double & q3) const;
00052 void setValue(const double q0, const double q1, const double q2, const double q3);
00053 void getValue(Vector3d & axis, double & rfAngle) const;
00054 void getValue(Matrix4D & matrix) const;
00055 void setValue(const double q[4]);
00056 void setValue(const Matrix4D& matrix);
00057 void setValue(const Vector3d & axis, const double fAngle);
00058 void setValue(const Vector3d & rotateFrom, const Vector3d & rotateTo);
00060 void setYawPitchRoll(double y, double p, double r);
00062 void getYawPitchRoll(double& y, double& p, double& r) const;
00064
00067 Rotation & invert(void);
00068 Rotation inverse(void) const;
00070
00073 Rotation & operator*=(const Rotation & q);
00074 Rotation operator *(const Rotation & q) const;
00075 bool operator==(const Rotation & q) const;
00076 bool operator!=(const Rotation & q) const;
00077 double & operator [] (unsigned short usIndex){return quat[usIndex];}
00078 const double & operator [] (unsigned short usIndex) const{return quat[usIndex];}
00079
00080 void multVec(const Vector3d & src, Vector3d & dst) const;
00081 void scaleAngle(const double scaleFactor);
00083
00084 static Rotation slerp(const Rotation & rot0, const Rotation & rot1, double t);
00085 static Rotation identity(void);
00086
00087 private:
00088 void normalize();
00089 double quat[4];
00090 };
00091
00092 }
00093
00094 #endif // BASE_ROTATION_H