csQuaternion Class Reference
[Geometry utilities]
Class for a quaternion.
More...
#include <csgeom/quaternion.h>
Public Member Functions | |
void | Conjugate () |
Set this quaternion to its own conjugate. | |
csQuaternion (const csQuaternion &q) | |
Copy-constructor. | |
csQuaternion (const csVector3 &v, float w) | |
Construct from a vector and given w value. | |
csQuaternion (float x, float y, float z, float w) | |
Initialize with given values. Does not normalize. | |
csQuaternion () | |
Initialize with identity. | |
float | Dot (const csQuaternion &q) const |
Return euclidian inner-product (dot). | |
csQuaternion | Exp () const |
Get quaternion exp. | |
void | GetAxisAngle (csVector3 &axis, float &angle) const |
Get a quaternion as axis-angle representation. | |
csQuaternion | GetConjugate () const |
Get the conjugate quaternion. | |
csVector3 | GetEulerAngles () const |
Get quaternion as three Euler angles X, Y, Z, expressed in radians. | |
csMatrix3 | GetMatrix () const |
Get quaternion as a 3x3 rotation matrix. | |
csQuaternion | Log () const |
Get quaternion log. | |
csQuaternion | NLerp (const csQuaternion &q2, float t) const |
Interpolate this quaternion with another using normalized linear interpolation (nlerp) using given interpolation factor. | |
float | Norm () const |
Get the norm of this quaternion. | |
csQuaternion & | operator *= (const csQuaternion &q) |
Multiply this quaternion by another. | |
csQuaternion & | operator+= (const csQuaternion &q) |
Add quaternion to this one. | |
csQuaternion & | operator-= (const csQuaternion &q) |
Subtract quaternion from this one. | |
csVector3 | Rotate (const csVector3 &src) const |
Rotate vector by quaternion. | |
void | SetAxisAngle (const csVector3 &axis, float angle) |
Set a quaternion using axis-angle representation. | |
void | SetEulerAngles (const csVector3 &angles) |
Set quaternion using Euler angles X, Y, Z, expressed in radians. | |
void | SetIdentity () |
Set quaternion to identity rotation. | |
void | SetMatrix (const csMatrix3 &matrix) |
Set quaternion using 3x3 rotation matrix. | |
csQuaternion | SLerp (const csQuaternion &q2, float t) const |
Interpolate this quaternion with another using spherical linear interpolation (slerp) using given interpolation factor. | |
csQuaternion | Squad (const csQuaternion &t1, const csQuaternion &t2, const csQuaternion &q, float t) const |
Interpolate this quaternion with another (q) using cubic linear interpolation (squad) using given interpolation factor (t) and tangents (t1 and t2). | |
float | SquaredNorm () const |
Get the squared norm of this quaternion (equals dot with itself). | |
csQuaternion | Unit () const |
Return a unit-lenght version of this quaternion (also called sgn) Attempting to normalize a zero-length quaternion will result in a divide by zero error. | |
Public Attributes | |
csVector3 | v |
float | w |
Friends | |
csQuaternion | operator * (float f, const csQuaternion q) |
Multiply by scalar. | |
csQuaternion | operator * (const csQuaternion q, float f) |
Multiply by scalar. | |
csQuaternion | operator * (const csQuaternion &q1, const csQuaternion &q2) |
Multiply two quaternions, Grassmann product. | |
csQuaternion | operator+ (const csQuaternion &q1, const csQuaternion &q2) |
Add two quaternions. | |
csQuaternion | operator- (const csQuaternion &q) |
Get the negative quaternion (unary minus). | |
csQuaternion | operator- (const csQuaternion &q1, const csQuaternion &q2) |
Subtract two quaternions. | |
csQuaternion | operator/ (float f, const csQuaternion q) |
Divide by scalar. | |
csQuaternion | operator/ (const csQuaternion q, float f) |
Divide by scalar. |
Detailed Description
Class for a quaternion.A SE3 rotation represented as a normalized quaternion
Definition at line 41 of file quaternion.h.
Constructor & Destructor Documentation
csQuaternion::csQuaternion | ( | ) | [inline] |
csQuaternion::csQuaternion | ( | float | x, | |
float | y, | |||
float | z, | |||
float | w | |||
) | [inline] |
csQuaternion::csQuaternion | ( | const csVector3 & | v, | |
float | w | |||
) | [inline] |
csQuaternion::csQuaternion | ( | const csQuaternion & | q | ) | [inline] |
Member Function Documentation
void csQuaternion::Conjugate | ( | ) | [inline] |
float csQuaternion::Dot | ( | const csQuaternion & | q | ) | const [inline] |
csQuaternion csQuaternion::Exp | ( | ) | const |
Get quaternion exp.
void csQuaternion::GetAxisAngle | ( | csVector3 & | axis, | |
float & | angle | |||
) | const [inline] |
Get a quaternion as axis-angle representation.
- Parameters:
-
axis Rotation axis. angle Angle to rotate about axis (in radians)
Definition at line 220 of file quaternion.h.
References csVector3::Set(), and csVector3::Unit().
csQuaternion csQuaternion::GetConjugate | ( | ) | const [inline] |
csVector3 csQuaternion::GetEulerAngles | ( | ) | const |
Get quaternion as three Euler angles X, Y, Z, expressed in radians.
csMatrix3 csQuaternion::GetMatrix | ( | ) | const |
Get quaternion as a 3x3 rotation matrix.
csQuaternion csQuaternion::Log | ( | ) | const |
Get quaternion log.
csQuaternion csQuaternion::NLerp | ( | const csQuaternion & | q2, | |
float | t | |||
) | const |
Interpolate this quaternion with another using normalized linear interpolation (nlerp) using given interpolation factor.
float csQuaternion::Norm | ( | ) | const [inline] |
csQuaternion& csQuaternion::operator *= | ( | const csQuaternion & | q | ) | [inline] |
csQuaternion& csQuaternion::operator+= | ( | const csQuaternion & | q | ) | [inline] |
csQuaternion& csQuaternion::operator-= | ( | const csQuaternion & | q | ) | [inline] |
void csQuaternion::SetAxisAngle | ( | const csVector3 & | axis, | |
float | angle | |||
) | [inline] |
Set a quaternion using axis-angle representation.
- Parameters:
-
axis Rotation axis. Should be normalized before calling this function. angle Angle to rotate about axis (in radians)
Definition at line 207 of file quaternion.h.
void csQuaternion::SetEulerAngles | ( | const csVector3 & | angles | ) |
Set quaternion using Euler angles X, Y, Z, expressed in radians.
void csQuaternion::SetIdentity | ( | ) | [inline] |
void csQuaternion::SetMatrix | ( | const csMatrix3 & | matrix | ) |
Set quaternion using 3x3 rotation matrix.
csQuaternion csQuaternion::SLerp | ( | const csQuaternion & | q2, | |
float | t | |||
) | const |
Interpolate this quaternion with another using spherical linear interpolation (slerp) using given interpolation factor.
csQuaternion csQuaternion::Squad | ( | const csQuaternion & | t1, | |
const csQuaternion & | t2, | |||
const csQuaternion & | q, | |||
float | t | |||
) | const |
Interpolate this quaternion with another (q) using cubic linear interpolation (squad) using given interpolation factor (t) and tangents (t1 and t2).
float csQuaternion::SquaredNorm | ( | ) | const [inline] |
Get the squared norm of this quaternion (equals dot with itself).
Definition at line 168 of file quaternion.h.
csQuaternion csQuaternion::Unit | ( | ) | const [inline] |
Return a unit-lenght version of this quaternion (also called sgn) Attempting to normalize a zero-length quaternion will result in a divide by zero error.
This is as it should be... fix the calling code.
Definition at line 184 of file quaternion.h.
Friends And Related Function Documentation
csQuaternion operator * | ( | float | f, | |
const csQuaternion | q | |||
) | [friend] |
csQuaternion operator * | ( | const csQuaternion | q, | |
float | f | |||
) | [friend] |
csQuaternion operator * | ( | const csQuaternion & | q1, | |
const csQuaternion & | q2 | |||
) | [friend] |
csQuaternion operator+ | ( | const csQuaternion & | q1, | |
const csQuaternion & | q2 | |||
) | [friend] |
csQuaternion operator- | ( | const csQuaternion & | q | ) | [friend] |
csQuaternion operator- | ( | const csQuaternion & | q1, | |
const csQuaternion & | q2 | |||
) | [friend] |
csQuaternion operator/ | ( | float | f, | |
const csQuaternion | q | |||
) | [friend] |
csQuaternion operator/ | ( | const csQuaternion | q, | |
float | f | |||
) | [friend] |
The documentation for this class was generated from the following file:
- csgeom/quaternion.h
Generated for Crystal Space by doxygen 1.4.7