## class MbRotation

### Public Methods

MbBool equals(const MbRotation &r, float tolerance)
Equality comparison within given tolerance - the square of the length of the maximum distance between the two quaternion vectors
const float* getValue()
Returns pointer to array of 4 components defining quaternion
void getValue(MbVec4f &rotation)
Returns corresponding 3D rotation axis vector and angle in radians
void getValue(float &q0, float &q1, float &q2, float &q3)
Returns 4 individual components of rotation quaternion
static MbRotation identity()
Null rotation
MbRotation inverse()
Returns the inverse of a rotation
MbRotation& invert()
Changes a rotation to be its inverse
MbRotation(const MbVec4f &rotation)
Constructor given 3D rotation axis vector (0-3) and angle in radians (4)
Constructor given 3D rotation axis vector and angle in radians
MbRotation(const MbVec3f &rotateFrom, const MbVec3f &rotateTo)
Constructor for rotation that rotates one direction vector to another
MbRotation(const float v[4])
Constructor given a quaternion as an array of 4 components
MbRotation(float q0, float q1, float q2, float q3)
Constructor given 4 individual components of a quaternion
void multVec(const MbVec3f &src, MbVec3f &dst)
Puts the given vector through this rotation (Multiplies the given vector by the matrix of this rotation),
friend int operator !=(const MbRotation &q1, const MbRotation &q2)
friend MbRotation operator *(const MbRotation &q1, const MbRotation &q2)
Multiplication of two rotations; results in product of rotations
MbRotation& operator *=(const MbRotation &q)
Multiplies by another rotation; results in product of rotations
friend int operator ==(const MbRotation &q1, const MbRotation &q2)
Equality comparison operator
float& operator [](int i)
Accesses indexed component of vector
const float& operator [](int i)
void scaleAngle( float scaleFactor )
Keep the axis the same
MbRotation& setValue(const MbVec3f &axis, float radians)
Sets value of vector from 3D rotation axis vector and angle in radians
MbRotation& setValue(const MbVec4f &rotation)
MbRotation& setValue(const MbVec3f &rotateFrom, const MbVec3f &rotateTo)
Sets rotation to rotate one direction vector to another
MbRotation& setValue(const float q[4])
Sets value of rotation from array of 4 components of a quaternion
MbRotation& setValue(float q0, float q1, float q2, float q3)
Sets value of rotation from 4 individual components of a quaternion
static MbRotation slerp(const MbRotation &rot0, const MbRotation &rot1, float t)
Spherical linear interpolation: as t goes from 0 to 1, returned value goes from rot0 to rot1

### Private Fields

float quat[4]
Storage for quaternion components

### Private Methods

float norm()
Returns the norm (square of the 4D length) of a rotation's quaterion
void normalize()
Normalizes a rotation quaternion to unit 4D length

## Documentation

MbRotation(const float v[4])
Constructor given a quaternion as an array of 4 components

MbRotation(float q0, float q1, float q2, float q3)
Constructor given 4 individual components of a quaternion

Constructor given 3D rotation axis vector and angle in radians

MbRotation(const MbVec4f &rotation)
Constructor given 3D rotation axis vector (0-3) and angle in radians (4)

MbRotation(const MbVec3f &rotateFrom, const MbVec3f &rotateTo)
Constructor for rotation that rotates one direction vector to another

const float* getValue()
Returns pointer to array of 4 components defining quaternion

void getValue(float &q0, float &q1, float &q2, float &q3)
Returns 4 individual components of rotation quaternion

Returns corresponding 3D rotation axis vector and angle in radians

void getValue(MbVec4f &rotation)

float& operator [](int i)
Accesses indexed component of vector

const float& operator [](int i)

MbRotation& invert()
Changes a rotation to be its inverse

MbRotation inverse()
Returns the inverse of a rotation

MbRotation& setValue(const float q[4])
Sets value of rotation from array of 4 components of a quaternion

MbRotation& setValue(float q0, float q1, float q2, float q3)
Sets value of rotation from 4 individual components of a quaternion

MbRotation& setValue(const MbVec3f &axis, float radians)
Sets value of vector from 3D rotation axis vector and angle in radians

MbRotation& setValue(const MbVec4f &rotation)

MbRotation& setValue(const MbVec3f &rotateFrom, const MbVec3f &rotateTo)
Sets rotation to rotate one direction vector to another

MbRotation& operator *=(const MbRotation &q)
Multiplies by another rotation; results in product of rotations

friend int operator ==(const MbRotation &q1, const MbRotation &q2)
Equality comparison operator

friend int operator !=(const MbRotation &q1, const MbRotation &q2)

MbBool equals(const MbRotation &r, float tolerance)
Equality comparison within given tolerance - the square of the length of the maximum distance between the two quaternion vectors

friend MbRotation operator *(const MbRotation &q1, const MbRotation &q2)
Multiplication of two rotations; results in product of rotations

void multVec(const MbVec3f &src, MbVec3f &dst)
Puts the given vector through this rotation (Multiplies the given vector by the matrix of this rotation),

void scaleAngle( float scaleFactor )
Keep the axis the same. Multiply the angle of rotation by the amount 'scaleFactor'

static MbRotation slerp(const MbRotation &rot0, const MbRotation &rot1, float t)
Spherical linear interpolation: as t goes from 0 to 1, returned value goes from rot0 to rot1

static MbRotation identity()
Null rotation

float quat[4]
Storage for quaternion components

float norm()
Returns the norm (square of the 4D length) of a rotation's quaterion

void normalize()
Normalizes a rotation quaternion to unit 4D length

This class has no child classes.