Matrices

About

The matrix classes of the MAXON API are based on these generic matrix templates:

Classes

2D Matrices

maxon::Mat2 based matrices contains these members:

maxon::Mat2 based matrix classes are:

maxon::SqMat2 based matrix classes are:

3D Matrices

maxon::Mat3 based matrices contains these members:

maxon::Mat3 based matrix classes are:

maxon::SqMat3 based matrix classes are:

4D Matrices

maxon::SqMat4 based matrix classes are:

Creation

A new matrix object is simply created using the above matrix classes. It is can easily be configured with SetIdentity():

// This example creates a matrix and prints its data to the debug console.
maxon::Matrix matrix;
matrix.SetIdentity();
DiagnosticOutput("V1: @", matrix.sqmat.v1);
DiagnosticOutput("V2: @", matrix.sqmat.v2);
DiagnosticOutput("V3: @", matrix.sqmat.v3);
DiagnosticOutput("Off: @", matrix.off);

The following operators can be applied to a matrix:

// This example uses the given matrix to transform a point.
maxon::Vector point(10, 10, 10);
// apply matrix
point = matrix * point;
DiagnosticOutput("New Point: @", point);

Further utility functions are:

Special functions of maxon::SqMat2, maxon::SqMat3 and maxon::SqMat4 are:

Special functions of maxon::SqMat3 and maxon::SqMat4 are:

Utility

These utility functions are used to create transformation matrices:

// This example creates a scale matrix and uses it to transform a given point.
const maxon::Vector scale(1.0, 10.0, 1.0);
maxon::Matrix matrix;
matrix.sqmat = maxon::GetScaleMatrix(scale);
// scale
point = matrix * point;
DiagnosticOutput("New Point: @", point);

Further Reading

maxon::Mat3< Vector >
maxon::GetScaleMatrix
SqMat3< Vec3< FLOAT > > GetScaleMatrix(const Vec3< FLOAT > &scale)
Calculates a matrix to scale.
maxon::Mat3::SetIdentity
void SetIdentity()
Sets this matrix to an identity matrix.
Definition: matrix.h:306
DiagnosticOutput
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:168
maxon::Mat3::sqmat
SqMat3< V > sqmat
The 3×3 matrix for rotation, scale and shear.
Definition: matrix.h:282
maxon::Vec3< Float, 1 >
maxon::SqMat3::v3
V v3
The Z axis.
Definition: matrix.h:31
maxon::Mat3::off
V off
The translation vector.
Definition: matrix.h:279
maxon::SqMat3::v1
V v1
The X axis.
Definition: matrix.h:25
maxon::SqMat3::v2
V v2
The Y axis.
Definition: matrix.h:28