Class Matrix3x3



Quaternions and Euler Angles store a rotation amount, but can't actually rotate any points. We can convert them into a Matrix3x3, and then rotate points using rotatePoint. Matrix3x3 is stricly for rotation, and translation should be handled seperately.

Internally, the matrix is laid out like so:

0 1 2
3 4 5
6 7 8

You can manually access the elements with the get and set functions.


Matrix3x3(void)

Default constructor, creates a matrix where every entry is zero.


Matrix3x3(const Matrix3x3 &source)

Copy constructor, creates a matrix that's a copy of source.


MHFloat determinant(void)

Returns the matrix's determinant.


void fromEuler(const EulerAngle &rotation)

void fromEuler(MHFloat pitch, MHFloat yaw, MHFloat roll)

Sets this matrix to represent the specified rotation, which should be in degrees.


MHFloat get(unsigned int index)

Returns the matrix element at the specified index. The indices are laid out like so:


bool inverse(Matrix3x3 &inverted)

Sets inverted to be the inverse of this matrix. Returns false if this matrix's determinant is near zero, and the inverse couldn't be computed.


Point3D rotatePoint(const Point3D &original)

Rotates the point around the origin, and returns its new position.


void set(unsigned int index, MHFloat newValue)

Set the matrix element at index to newValue.


EulerAngle toEuler(void)

Converts the rotation in this matrix to a Euler Angle.











Back to Contents