3ds Max C++ API Reference
dmatrix3.h File Reference
#include "matrix3.h"
#include "DPoint3.h"

Classes

class  DMatrix3
 

Macros

#define MAX_DEPRECATE_MATRIX_BOOL_CTOR(str)   [[deprecated(str)]]
 MAX_SILENCE_DEPRECATED_MATRIX_BOOL_CTOR Silences warning when using the Matrix(BOOL) constructor. More...
 

Typedefs

typedef double DMRow[3]
 

Functions

DMatrix3 RotateXMatrix (double angle)
 Builds a new matrix for use as a X rotation transformation. More...
 
DMatrix3 RotateYMatrix (double angle)
 Builds a new matrix for use as a Y rotation transformation. More...
 
DMatrix3 RotateZMatrix (double angle)
 Builds a new matrix for use as a Z rotation transformation. More...
 
DMatrix3 TransMatrix (const DPoint3 &p)
 Builds a new matrix for use as a translation transformation. More...
 
DMatrix3 ScaleMatrix (const DPoint3 &s)
 Builds a new matrix for use as a scale transformation. More...
 
DMatrix3 RotateYPRMatrix (double yaw, double pitch, double roll)
 Builds a new matrix for use as a rotation transformation by specifying yaw, pitch and roll angles. More...
 
DMatrix3 RotAngleAxisMatrix (const DPoint3 &axis, double angle)
 Builds a new matrix for use as a rotation transformation by specifying an angle and axis. More...
 
DMatrix3 Inverse (const DMatrix3 &m)
 Return the inverse of the matrix. More...
 
DPoint3 operator* (const DMatrix3 &a, const DPoint3 &v)
 These transform a DPoint3 with a DMatrix3. More...
 
DPoint3 operator* (const DPoint3 &v, const DMatrix3 &a)
 These transform a DPoint3 with a DMatrix3. More...
 
DPoint3 VectorTransform (const DMatrix3 &m, const DPoint3 &v)
 Transform the vector (DPoint3) with the specified matrix. More...
 
DPoint3 VectorTransform (const DPoint3 &v, const DMatrix3 &m)
 
Point4 TransformPlane (const DMatrix3 &m, const Point4 &plane)
 transform a plane. More...
 
DMatrix3 XFormMat (const DMatrix3 &xm, const DMatrix3 &m)
 This method is used to build a matrix that constructs a transformation in a particular space. More...
 
void MirrorMatrix (DMatrix3 &tm, Axis axis, bool scaleMatrix=false)
 Mirrors the input matrix against the X, Y, or Z axis. More...
 
void MatrixMultiply (DMatrix3 &outMatrix, const DMatrix3 &matrixA, const DMatrix3 &matrixB)
 Same as Maxtrix3::operator[]. More...
 
void Inverse (DMatrix3 &outMatrix, const DMatrix3 &m)
 Same as Maxtrix3::Inverse. More...
 

Macro Definition Documentation

◆ MAX_DEPRECATE_MATRIX_BOOL_CTOR

#define MAX_DEPRECATE_MATRIX_BOOL_CTOR (   str)    [[deprecated(str)]]

MAX_SILENCE_DEPRECATED_MATRIX_BOOL_CTOR Silences warning when using the Matrix(BOOL) constructor.

Matrix3 and DMatrix3 are now created as identity by default!

Typedef Documentation

◆ DMRow

typedef double DMRow[3]

Function Documentation

◆ RotateXMatrix()

DMatrix3 RotateXMatrix ( double  angle)

Builds a new matrix for use as a X rotation transformation.

Parameters
angleSpecifies the angle of rotation in radians.
Returns
A new X rotation DMatrix3.

◆ RotateYMatrix()

DMatrix3 RotateYMatrix ( double  angle)

Builds a new matrix for use as a Y rotation transformation.

Parameters
angleSpecifies the angle of rotation in radians.
Returns
A new Y rotation DMatrix3.

◆ RotateZMatrix()

DMatrix3 RotateZMatrix ( double  angle)

Builds a new matrix for use as a Z rotation transformation.

Parameters
angleSpecifies the angle of rotation in radians.
Returns
A new Z rotation DMatrix3.

◆ TransMatrix()

DMatrix3 TransMatrix ( const DPoint3 p)

Builds a new matrix for use as a translation transformation.

Parameters
pSpecifies the translation values.
Returns
A new translation DMatrix3.

◆ ScaleMatrix()

DMatrix3 ScaleMatrix ( const DPoint3 s)

Builds a new matrix for use as a scale transformation.

Parameters
sSpecifies the scale values.
Returns
A new scale DMatrix3.

◆ RotateYPRMatrix()

DMatrix3 RotateYPRMatrix ( double  yaw,
double  pitch,
double  roll 
)

Builds a new matrix for use as a rotation transformation by specifying yaw, pitch and roll angles.



This definition will depend on what our coordinate system is. This one is equivalent to:

M.IdentityMatrix();
M.RotateZ(roll);
M.RotateX(pitch);
M.RotateY(yaw);

Which presupposes Y is vertical, X is sideways, Z is forward

Parameters
yawSpecifies the yaw angle in radians.
pitchSpecifies the pitch angle in radians.
rollSpecifies the roll angle in radians.
Returns
A new rotation DMatrix3.

◆ RotAngleAxisMatrix()

DMatrix3 RotAngleAxisMatrix ( const DPoint3 axis,
double  angle 
)

Builds a new matrix for use as a rotation transformation by specifying an angle and axis.

Parameters
axisSpecifies the axis of rotation. Note that this angle is expected to be normalized.
angleSpecifies the angle of rotation. Note: The direction of the angle in this method is opposite of that in AngAxisFromQ().
Returns
A new rotation DMatrix3.

◆ Inverse() [1/2]

DMatrix3 Inverse ( const DMatrix3 m)

Return the inverse of the matrix.

Parameters
mThe matrix to compute the inverse of.

◆ operator*() [1/2]

DPoint3 operator* ( const DMatrix3 a,
const DPoint3 v 
)

These transform a DPoint3 with a DMatrix3.

These two versions of transforming a point with a matrix do the same thing, regardless of the order of operands (linear algebra rules notwithstanding).

Parameters
aThe matrix to transform the point with.
vThe point to transform.
Returns
The transformed DPoint3.

◆ operator*() [2/2]

DPoint3 operator* ( const DPoint3 v,
const DMatrix3 a 
)

These transform a DPoint3 with a DMatrix3.

These two versions of transforming a point with a matrix do the same thing, regardless of the order of operands (linear algebra rules notwithstanding).

Parameters
vThe point to transform.
aThe matrix to transform the point with.
Returns
The transformed DPoint3.

◆ VectorTransform() [1/2]

DPoint3 VectorTransform ( const DMatrix3 m,
const DPoint3 v 
)

Transform the vector (DPoint3) with the specified matrix.

Parameters
mThe matrix to transform the vector with.
vThe vector to transform.
Returns
The transformed vector (as a DPoint3).

◆ VectorTransform() [2/2]

DPoint3 VectorTransform ( const DPoint3 v,
const DMatrix3 m 
)

◆ TransformPlane()

Point4 TransformPlane ( const DMatrix3 m,
const Point4 plane 
)

transform a plane.

Note
this only works if M is orthogonal
Parameters
mThe transformation to apply to the plain
planethe plane to be transformed

◆ XFormMat()

DMatrix3 XFormMat ( const DMatrix3 xm,
const DMatrix3 m 
)

This method is used to build a matrix that constructs a transformation in a particular space.

For example, say you have a rotation you want to apply, but you want to perform the rotation in another coordinate system. To do this, you typically transform into the space of the coordinate system, then apply the transformation, and then transform out of that coordinate system. This method constructs a matrix that does just this. It transforms matrix m so it is applied in the space of matrix xm. It returns a DMatrix3 that is xm*m*Inverse(xm).

Parameters
xmSpecifies the coordinate system you want to work in.
mSpecifies the transformation matrix.
Returns
Returns a DMatrix3 that is xm*m*Inverse(xm).

◆ MirrorMatrix()

void MirrorMatrix ( DMatrix3 tm,
Axis  axis,
bool  scaleMatrix = false 
)

Mirrors the input matrix against the X, Y, or Z axis.

This function mirrors the input matrix such that if it transformed a DPoint3 p, the transform applied by the mirrored transform would place p in an equivalent position relative but with one of it's elements negated.

DPoint3 p = ...; // Some arbitrary point;
DMatrix3 tm = ...; // Some matrix
DMatrix3 tmMirror = tm;
MirrorMatrix(tm, kXAxis); // Mirror this matrix around the X Axis;
DPoint3 p3Result = tm.PointTransform(p); // Apply the original transformation
DPoint3 p3Mirrored = tmMirror.PointTransform(p); // Apply the mirrored transformation
p3Result[kXAxis] == -p3Mirrored[kXAxis]; // The point is mirrored around X
p3Result[kYAxis] == p3Mirrored[kYAxis]; // The point is unchanged around Y
p3Result[kZAxis] == p3Mirrored[kZAxis]; // The point is unchanged around Z
Definition: dmatrix3.h:65
DPoint3 PointTransform(const DPoint3 &p) const
Returns the specified point transformed by this matrix.
class DPoint3 Description: This class describes a 3D point using double precision x,...
Definition: dpoint3.h:25
void MirrorMatrix(DMatrix3 &tm, Axis axis, bool scaleMatrix=false)
Mirrors the input matrix against the X, Y, or Z axis.
@ kYAxis
Specifies the X Axis.
Definition: matrix3.h:54
@ kXAxis
Definition: matrix3.h:53
@ kZAxis
Specifies the Y Axis.
Definition: matrix3.h:55
Parameters
[in,out]tmThe Matrix to mirror
axisThe world plane to mirror around. The axis will be reflected against the plane formed by the point (0, 0, 0) and the normal where normal[axis] = 1;
scaleMatrixThe matrix can be mirrored either by pure rotation, or by pure scaling. If true, the matrix is mirrored by flipping one of its axis, changing the handedness of the matrix. This had the advantage that the mirroring will be passed onto all it's children. This is preferential when the system can handle it, but can cause issues in systems that do not compensate for scale, eg game pipelines and skinning. if false, the mirroring will be achieved using rotation only and will not affect child local positions. It is better to use non-scaling mirroring when dealing with tools or processes that do not well support scale, or when the matrix will be blended with non-scaled matrices. (eg, Point/Quat based pipelines and skinning)

◆ MatrixMultiply()

void MatrixMultiply ( DMatrix3 outMatrix,
const DMatrix3 matrixA,
const DMatrix3 matrixB 
)

Same as Maxtrix3::operator[].

Perform matrix multiplication without additional matrix copy

Parameters
outMatrixThe result of matrixA * matrixB
matrixAFirst matrix to multiply
matrixBSecond matrix to multiply

◆ Inverse() [2/2]

void Inverse ( DMatrix3 outMatrix,
const DMatrix3 m 
)

Same as Maxtrix3::Inverse.

Compute the inverse of the matrix without additional matrix copy

Parameters
outMatrixThe inversed matrix.
mThe matrix to compute the inverse of.