3ds Max C++ API Reference
decomp.h File Reference
#include "maxheap.h"
#include "point3.h"
#include "quat.h"

Classes

struct  AffineParts
 

Functions

CoreExport void SpectralDecomp (Matrix3 m, Point3 &s, Quat &q)
 
CoreExport void decomp_affine (Matrix3 A, AffineParts *parts)
 
CoreExport void invert_affine (AffineParts *parts, AffineParts *inverse)
 

Function Documentation

◆ SpectralDecomp()

CoreExport void SpectralDecomp ( Matrix3  m,
Point3 s,
Quat q 
)
Remarks
This is another way to decompose a matrix into the scale and rotation parts (the position part can be retrieved from the bottom row of the matrix). This does not return correct results for off axis scale.
Parameters:
Matrix3 m
The input matrix to decompose.

Point3 &s
The scale from the matrix.

Quat& q
The rotation of the matrix.

◆ decomp_affine()

CoreExport void decomp_affine ( Matrix3  A,
AffineParts parts 
)
Remarks
This will decompose a matrix into the translation, rotation and scale components and store the results in the AffineParts structure passed. This will return correct results for off axis scale. This is a fairly computationally intensive iterative solution operation.
Parameters:
Matrix3 A
The input matrix to decompose.

AffineParts *parts
The result. See above.

Sample Code:
Note: If you want to rebuild a Matrix3 from the decomposed parts you get back from decomp_affine() the important thing is the order the parts are combined.

Consider the following matrices constructed from the various affine parts:
ptm = position component (t)
rtm = "essential" rotation (q)
srtm = "stretch" rotation (u)
stm = scale component (k)
ftm = the flip tm -> ScaleMatrix(Point3(ap.f,ap.f,ap.f));

Here's the correct way of reassembling the decomposed matrix:
Matrix3 srtm, rtm, ptm, stm, ftm;
ptm.SetTrans(ap.t);
ap.q.MakeMatrix(rtm);
ap.u.MakeMatrix(srtm);
stm = ScaleMatrix(ap.k);
mat = Inverse(srtm) * stm * srtm * rtm * ftm * ptm;
Definition: matrix3.h:98
void SetTrans(const Point3 &p)
void IdentityMatrix()
DMatrix3 Inverse(const DMatrix3 &m)
Return the inverse of the matrix.
DMatrix3 ScaleMatrix(const DPoint3 &s)
Builds a new matrix for use as a scale transformation.

◆ invert_affine()

CoreExport void invert_affine ( AffineParts parts,
AffineParts inverse 
)
Remarks
This is used to take the AffineParts and inverts them. This gives you the equivalent parts for the inverse matrix.
Parameters:
AffineParts *parts
The input AffineParts pointer.

AffineParts *inverse
The inverse of parts.