#include <Quaternion.h>
Public Member Functions | |
| Quaternion (void) | |
| Quaternion (const Quaternion &q) | |
| Quaternion & | operator= (const Quaternion &q) |
| void | swap (Quaternion &q) |
| ~Quaternion (void) | |
| Quaternion (const float i, const float j, const float k, const float r) | |
| Quaternion (const Vector3 &v, const float phi) | |
| const Quaternion | inverted () const |
| const Quaternion | normalized () const |
| const Quaternion | conjugated () const |
| const float | operator[] (unsigned index) const |
| float & | operator[] (unsigned index) |
| const Quaternion | operator- () const |
| const Quaternion | operator+ (const Vector3 &v) const |
| const Quaternion | operator- (const Vector3 &v) const |
| const Quaternion | operator* (const Quaternion &q) const |
| Quaternion & | operator+= (const Vector3 &v) |
| Quaternion & | operator-= (const Vector3 &v) |
| Quaternion & | operator*= (const Quaternion &q) |
| Quaternion & | clear () |
| Quaternion & | invert () |
| Quaternion & | invert (const Quaternion &q) |
| Quaternion & | normalize () |
| Quaternion & | conjugate () |
| Quaternion & | add (const Vector3 &v, const float s) |
| Quaternion & | rotate (const Vector3 &v) |
| Quaternion & | rotation (const Vector3 &v, const float phi) |
| const bool | operator== (const Quaternion &q) const |
| const bool | operator!= (const Quaternion &q) const |
Public Attributes | |
| union { | |
| struct { | |
| float i | |
| float j | |
| float k | |
| float r | |
| } | |
| struct { | |
| Vector3 v | |
| float w | |
| } | |
| float data [4] | |
| }; | |
Represents a quaternion (a three degree of freedom orientation). Used for 3d-physics and -graphics.
| ml7::Quaternion::Quaternion | ( | void | ) | [inline] |
Default constructor. Creates a new quaternion with i = j = k = 0 and r = 1 representing a zero rotation.
| ml7::Quaternion::Quaternion | ( | const Quaternion & | q | ) | [inline] |
Copy constructor. Creates a new quaternion with i = q.i, ... , r = q.r.
| ml7::Quaternion::~Quaternion | ( | void | ) | [inline] |
Destructor.
| ml7::Quaternion::Quaternion | ( | const float | i, | |
| const float | j, | |||
| const float | k, | |||
| const float | r | |||
| ) | [inline] |
Explicit constructor with parameters for i, j, k and r. Use the function normalize to make the quarternion a legal orientation.
| ml7::Quaternion::Quaternion | ( | const Vector3 & | v, | |
| const float | phi | |||
| ) | [inline] |
Explicit constructor with parameters for an axis v and an angle phi.
| Quaternion & ml7::Quaternion::add | ( | const Vector3 & | v, | |
| const float | s | |||
| ) |
Adds a given vector v scaled by a given scalar s to this quaternion to update the orientation by a specific rotation over time.
| Quaternion & ml7::Quaternion::clear | ( | ) |
Sets i = j = k = 0 and r = 1 representing a zero rotation.
| Quaternion & ml7::Quaternion::conjugate | ( | ) |
Conjugates this quaternion by flipping the signs of i, j and k.
| const Quaternion ml7::Quaternion::conjugated | ( | ) | const [inline] |
Returns a copy of this quaternion conjugated.
| Quaternion & ml7::Quaternion::invert | ( | ) |
Inverts this quaternion.
| Quaternion & ml7::Quaternion::invert | ( | const Quaternion & | q | ) |
Replaces this quaternion by a given quaternion q inverted.
| const Quaternion ml7::Quaternion::inverted | ( | ) | const |
Returns the inverse of this quaternion.
| Quaternion & ml7::Quaternion::normalize | ( | ) |
Normalizes this quaternion to ensure a legal orientation.
| const Quaternion ml7::Quaternion::normalized | ( | ) | const |
Returns a copy of this quaternion normalized.
| const bool ml7::Quaternion::operator!= | ( | const Quaternion & | q | ) | const [inline] |
Checks if a given quaternion v and this have non-identical components.
| const Quaternion ml7::Quaternion::operator* | ( | const Quaternion & | q | ) | const |
Returns a copy of this quaternion multiplied by a given quaternion q.
| Quaternion & ml7::Quaternion::operator*= | ( | const Quaternion & | q | ) |
Multiplies this quaternion by a given quaternion q.
| const Quaternion ml7::Quaternion::operator+ | ( | const Vector3 & | v | ) | const |
Returns a copy of this quaternion and adds a given vector v to update the orientation by a specific rotation (represented by the vector v).
| Quaternion & ml7::Quaternion::operator+= | ( | const Vector3 & | v | ) |
Adds a given vector v to update this orientation by a specific rotation (represented by the vector v).
| const Quaternion ml7::Quaternion::operator- | ( | ) | const [inline] |
Returns a copy of this vector with the components having signs flipped.
| const Quaternion ml7::Quaternion::operator- | ( | const Vector3 & | v | ) | const |
Returns a copy of this quaternion and subtracts a given vector v to update the orientation by a specific rotation (represented by the vector v).
| Quaternion & ml7::Quaternion::operator-= | ( | const Vector3 & | v | ) |
Subtracts a given vector v to update this orientation by a specific rotation (represented by the vector v).
| Quaternion& ml7::Quaternion::operator= | ( | const Quaternion & | q | ) | [inline] |
Copy assignment operator. Sets i = q.i, ... , r = q.r.
| const bool ml7::Quaternion::operator== | ( | const Quaternion & | q | ) | const [inline] |
Checks if a given quaternion q and this have identical components.
| const float ml7::Quaternion::operator[] | ( | unsigned | index | ) | const [inline] |
Indexed component access.
| float& ml7::Quaternion::operator[] | ( | unsigned | index | ) | [inline] |
Indexed component access.
| Quaternion & ml7::Quaternion::rotate | ( | const Vector3 & | v | ) |
Rotates this quaternion by a given vector v.
| Quaternion & ml7::Quaternion::rotation | ( | const Vector3 & | v, | |
| const float | phi | |||
| ) |
Lets this quaternion represent a rotation defined by an axis v and an angle phi.
| void ml7::Quaternion::swap | ( | Quaternion & | q | ) | [inline] |
Swap operation. Swaps the elements of a given quaternion q with this.
| union { ... } |
| float ml7::Quaternion::data[4] |
Array of all four componets.
| float ml7::Quaternion::i |
The quaternion's first complex component.
| float ml7::Quaternion::j |
The quaternion's second complex component.
| float ml7::Quaternion::k |
The quaternion's third complex component.
| float ml7::Quaternion::r |
The quaternion's float component.
The three complex components as a vector (v = (i, j, k)).
| float ml7::Quaternion::w |
The float component (w = r).
1.7.1