Implementation of Quaternion class. More...
#include "Quat.h"
Go to the source code of this file.
Functions | |
CQrot | operator^ (const CQrot &r, double p) |
Implementation of Quaternion class.
Definition in file Quat.cpp.
power of quaternion
r | input quaternion | |
p | power |
Definition at line 73 of file Quat.cpp.
{ CQrot q = r; q.normalize(); double theta = 2 * acos( q.m_w ); if( theta < 1e-10 ) return q; CPoint axis( q.m_x, q.m_y, q.m_z ); axis /= axis.norm(); theta *= p; q.m_w = cos( theta * 0.5 ); axis *= sin( theta * 0.5 ); q.m_x = axis[0]; q.m_y = axis[1]; q.m_z = axis[2]; return q; }