C4 Engine
C4 Engine API Documentation

class Matrix3D

Defined in:  TSMatrix3D.h
The Matrix3D class encapsulates a 3 × 3 matrix.
Definition

class Matrix3D : public Mat3D<TypeMatrix3D>

Member Functions
Matrix3D::Set Sets all nine entries of a matrix.
Matrix3D::SetIdentity Sets a matrix to the 3 × 3 identity matrix.
Matrix3D::Orthogonalize Orthogonalizes the columns of a matrix.
Matrix3D::MakeRotationX Returns a matrix that represents a rotation about the x axis.
Matrix3D::MakeRotationY Returns a matrix that represents a rotation about the y axis.
Matrix3D::MakeRotationZ Returns a matrix that represents a rotation about the z axis.
Matrix3D::MakeRotation Returns a matrix that represents a rotation about a given axis.
Matrix3D::MakeScale Returns a matrix that represents a scale.
Constructor

Matrix3D();

Matrix3D(float n00, float n01, float n02, float n10, float n11, float n12, float n20, float n21, float n22);

Matrix3D(const Vector3D& a, const Vector3D& b, const Vector3D& c);

Parameters
nij The value of the entry residing in row i and column j.
a The values of the entries residing in first column.
b The values of the entries residing in second column.
c The values of the entries residing in third column.
Description
The Matrix3D class is used to store a 3 × 3 matrix. The entries of the matrix are accessed using the () operator with two indexes specifying the row and column of an entry.

The default constructor leaves the entries of the matrix undefined. If the nine entries are supplied, then the nij parameter specifies the entry in the i-th row and j-th column. If the matrix is constructed using the three vectors a, b, and c, then these vectors initialize the three columns of the matrix.
Overloaded Operators
floatoperator ()(machine i, machine j); Returns a reference to the entry in the i-th row and j-th column. Both i and j must be 0, 1, or 2.
const floatoperator ()(machine i, machine j) const; Returns a constant reference to the entry in the i-th row and j-th column. Both i and j must be 0, 1, or 2.
Vector3D& operator [](machine j); Returns a reference to the j-th column of a matrix. j must be 0, 1, or 2.
const Vector3D& operator [](machine j) const; Returns a constant reference to the j-th column of a matrix. j must be 0, 1, or 2.
Matrix3D& operator *=(const Matrix3D& m); Multiplies by the matrix m.
Matrix3D& operator *=(float s); Multiplies by the scalar s.
Matrix3D& operator /=(float s); Multiplies by the inverse of the scalar s.
Nonmember Operations
Matrix3D operator *(const Matrix3D& m1, const Matrix3D& m2); Returns the product of the matrices m1 and m2.
Matrix3D operator *(const Matrix3D& m, float s); Returns the product of the matrix m and the scalar s.
Matrix3D operator /(const Matrix3D& m, float s); Returns the product of the matrix m and the inverse of the scalar s.
Vector3D operator *(const Matrix3D& m, const Vector3D& v); Returns the product of the matrix m and the column vector v.
Point3D operator *(const Matrix3D& m, const Point3D& p); Returns the product of the matrix m and the column vector p.
Vector3D operator *(const Vector3D& v, const Matrix3D& m); Returns the product of the row vector v and the matrix m.
Bivector3D operator *(const Bivector3D& v, const Matrix3D& m); Returns the product of the row bivector v and the matrix m.
float Determinant(const Matrix3D& m); Returns the determinant of the matrix m.
Matrix3D Inverse(const Matrix3D& m); Returns the inverse of the matrix m. If m is singular, then the result is undefined.
Matrix3D Adjugate(const Matrix3D& m); Returns the adjugate of the matrix m.
Base Classes
Mat3D Matrices use a generic base class to store their components.
See Also

Vector3D

Matrix4D

Transform4D