Matrices

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::SqrMat2 based matrix classes are:

## 3D Matrices

maxon::Mat3 based matrices contains these members:

maxon::Mat3 based matrix classes are:

maxon::SqrMat3 based matrix classes are:

## 4D Matrices

maxon::SqrMat4 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);
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
constexpr void SetIdentity()
Sets this matrix to an identity matrix.
Definition: matrix.h:306
V off
The translation vector.
Definition: matrix.h:279
SqrMat3< V > sqmat
The 3×3 matrix for rotation, scale and shear.
Definition: matrix.h:282

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::SqrMat2, maxon::SqrMat3 and maxon::SqrMat4 are:

Special functions of maxon::SqrMat3 and maxon::SqrMat4 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);
SqrMat3< Vec3< FLOAT > > GetScaleMatrix(const Vec3< FLOAT > &scale)
Calculates a matrix to scale.