#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Default constructor, initializes all components to 0. | |
Quaternion (float w, float x, float y, float z) | |
Initializes the components to the specified values. | |
Quaternion (float angle, const Vector &axis) | |
Fills in the quaternion to represent the rotation determined by the specified angle around the specified axis. | |
float & | operator[] (int which) |
Mutable accessor for a Quaternion component. | |
float | operator[] (int which) const |
Immutable accessor for a Quaternion component. | |
const Quaternion | normalize () const |
Normalize the Quaternion: divide all components by the Quaternion length. | |
float | length () const |
Returns the length of the Quaternion. | |
const Matrix | toMatrix () const |
Returns the rotation matrix represented by this quaternion. | |
Static Public Attributes | |
const int | W = 0 |
The W coordinate index in the array representing this Quaternion. | |
const int | X = 1 |
The X coordinate index in the array representing this Quaternion. | |
const int | Y = 2 |
The Y coordinate index in the array representing this Quaternion. | |
const int | Z = 3 |
The Z coordinate index in the array representing this Quaternion. | |
Private Member Functions | |
void | initialize (float w, float x, float y, float z) |
Initialize the components to the specified values. | |
Private Attributes | |
float | m_data [4] |
The data array containing the W, X, Y and Z values. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Quaternion &quat) |
Insertion operator for this Quaternion into an output stream. |
|
Fills in the quaternion to represent the rotation determined by the specified angle around the specified axis.
The quaternion is initialized as follows: |
|
Returns the length of the Quaternion. The length is computed by taking the square root of the sum of the squares of the Quaternion components. |