Archon::Math::Quaternion Struct Reference

Collaboration diagram for Archon::Math::Quaternion:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Quaternion ()
 Quaternion (double w, const Vector3 &v)
double squareSum () const
double length () const
Quaternion operator+ (const Quaternion &q) const
Quaternion operator- (const Quaternion &q) const
Quaternion operator * (const Quaternion &q) const
Quaternion operator * (double f) const
Quaternion operator/ (double f) const
Quaternion operator- () const
Quaternionoperator+= (const Quaternion &q)
Quaternionoperator-= (const Quaternion &q)
Quaternionoperator *= (const Quaternion &q)
 For two quaternions q1 = (w1, V1) and q2 = (w1, V2) the product is defined as:.
Quaternionoperator/= (const Quaternion &q)
Quaternionoperator *= (double f)
Quaternionoperator/= (double f)
bool operator== (const Quaternion &q) const
bool operator!= (const Quaternion &q) const
void set (const Vector3 &v, double w)
void negate ()
void normalize ()
void conjugate ()
void inverse ()
void setRotation (const Rotation3 &r)
 Creates a normalized quaternion represention the specified rotation.
void setRotation (const Vector3 &axis, double cosineOfAngle)
 Creates a normalized quaternion represention the specified rotation.
void getRotation (Rotation3 &r) const
 This method may be optimized if we know that the quaternion is a unit quaternion.

Static Public Member Functions

static const Quaternion zero ()
static const Quaternion one ()

Public Attributes

double w
Vector3 v

Detailed Description

Definition at line 33 of file quaternion.H.


Member Function Documentation

void Archon::Math::Quaternion::getRotation Rotation3 r  )  const [inline]
 

This method may be optimized if we know that the quaternion is a unit quaternion.

Also it mat be more efficient to compute sin(a) as sqrt(1 - cos^2(a)).

Definition at line 143 of file quaternion.H.

References Archon::Math::Rotation3::angle, Archon::Math::Rotation3::axis, Archon::Math::sq(), Archon::Math::BasicVector< T, N >::squareSum(), v, and w.

Referenced by Archon::Math::Rotation3::combineWith(), and Archon::X3D::Viewer::renderFrame().

Quaternion& Archon::Math::Quaternion::operator *= const Quaternion q  )  [inline]
 

For two quaternions q1 = (w1, V1) and q2 = (w1, V2) the product is defined as:.

(w1 w2 - V1·V2, V1 × V2 + w2 V1 + w1 V2)

Note: The quaternion product is not commutative.

Note also that the product of two unit quaternions is again a unit quaternion.

The quaternion product may be used to combine rotations. That is: Applying rotation q1 and then q2 is the same as applying the rotation q2 * q1.

Definition at line 81 of file quaternion.H.

References Archon::Math::dot(), v, and w.

void Archon::Math::Quaternion::setRotation const Vector3 axis,
double  cosineOfAngle
[inline]
 

Creates a normalized quaternion represention the specified rotation.

NOTE: Make sure 'axis' is a normalized vector.

(cos(a/2), sin(a/2) V)

Definition at line 130 of file quaternion.H.

References v, and w.

void Archon::Math::Quaternion::setRotation const Rotation3 r  )  [inline]
 

Creates a normalized quaternion represention the specified rotation.

NOTE: Make sure 'r.axis' is a normalized vector.

(cos(a/2), sin(a/2) V)

Definition at line 116 of file quaternion.H.

References Archon::Math::Rotation3::angle, Archon::Math::Rotation3::axis, v, and w.

Referenced by Archon::Math::Rotation3::combineWith(), and Archon::X3D::Viewer::renderFrame().


The documentation for this struct was generated from the following file:
Generated on Sun Jul 30 22:56:57 2006 for Archon by  doxygen 1.4.4