CQrot quaternion class.
More...
#include <Quat.h>
List of all members.
Detailed Description
CQrot quaternion class.
Definition at line 23 of file Quat.h.
Constructor & Destructor Documentation
MeshLib::CQrot::CQrot |
( |
|
) |
[inline] |
MeshLib::CQrot::CQrot |
( |
double |
w, |
|
|
double |
x, |
|
|
double |
y, |
|
|
double |
z | |
|
) |
| | [inline] |
CQrot default constructor
- Parameters:
-
| w | w-value |
| x | x-value |
| y | y-value |
| z | z-value |
Definition at line 39 of file Quat.h.
MeshLib::CQrot::CQrot |
( |
const CQrot & |
q |
) |
[inline] |
Copy operator of CQrot
- Parameters:
-
Definition at line 50 of file Quat.h.
MeshLib::CQrot::~CQrot |
( |
|
) |
[inline] |
Member Function Documentation
void CQrot::convert |
( |
double * |
m |
) |
|
Convert quoternion to OpenGL matrix
- Parameters:
-
convert the current quoternion to OpenGL matrix
- Parameters:
-
Definition at line 97 of file Quat.cpp.
{
CQrot q = *this;
double l = q^q;
double s = 2.0 / l;
double xs = q.m_x*s;
double ys = q.m_y*s;
double zs = q.m_z*s;
double wx = q.m_w*xs;
double wy = q.m_w*ys;
double wz = q.m_w*zs;
double xx = q.m_x*xs;
double xy = q.m_x*ys;
double xz = q.m_x*zs;
double yy = q.m_y*ys;
double yz = q.m_y*zs;
double zz = q.m_z*zs;
m[0*4+0] = 1.0 - (yy + zz);
m[1*4+0] = xy - wz;
m[2*4+0] = xz + wy;
m[0*4+1] = xy + wz;
m[1*4+1] = 1.0 - (xx + zz);
m[2*4+1] = yz - wx;
m[0*4+2] = xz - wy;
m[1*4+2] = yz + wx;
m[2*4+2] = 1.0 - (xx + yy);
m[0*4+3] = 0.0;
m[1*4+3] = 0.0;
m[2*4+3] = 0.0;
m[3*4+0] = m[3*4+1] = m[3*4+2] = 0.0;
m[3*4+3] = 1.0;
}
void CQrot::normalize |
( |
|
) |
|
normalization
Definition at line 15 of file Quat.cpp.
Multiply a point with the current quoternion
- Parameters:
-
- Returns:
- product of the current quoternion with v
Product of a quoternion with a point
- Parameters:
-
- Returns:
- the product of the quoternion and the point
Definition at line 58 of file Quat.cpp.
product of two quoternions
- Parameters:
-
- Returns:
- product of the current quoternion and q
Definition at line 144 of file Quat.cpp.
CQrot& MeshLib::CQrot::operator= |
( |
const CQrot & |
q |
) |
[inline] |
Copy operator of CQrot
- Parameters:
-
Definition at line 61 of file Quat.h.
{
m_w = q.m_w;
m_x = q.m_x;
m_y = q.m_y;
m_z = q.m_z;
return *this;
}
double CQrot::operator^ |
( |
const CQrot & |
q |
) |
const |
inner product of two quoternions
- Parameters:
-
- Returns:
- inner product of the current quoternion and q
Definition at line 171 of file Quat.cpp.
CQrot & CQrot::operator^ |
( |
double |
p |
) |
|
power of quaternion
- Parameters:
-
- Returns:
- quoternion power p
Definition at line 35 of file Quat.cpp.
{
normalize();
double theta = 2 * acos( m_w );
if( theta < 1e-10 ) return (*this);
CPoint axis( m_x,m_y,m_z );
axis /= axis.norm();
theta *= p;
m_w = cos( theta * 0.5 );
axis *= sin( theta * 0.5 );
m_x = axis[0];
m_y = axis[1];
m_z = axis[2];
return (*this);
}
Member Data Documentation
(x,y,z,w) value of the current quoternion
Definition at line 96 of file Quat.h.
The documentation for this class was generated from the following files: