This reference page is linked to from the following overview topics: Matrix Representations of 3D Transformations, Matrix Fundamentals, Translation (Moving), Rotation, Lesson 5: Geometric Objects, Lesson 4: Animation Controllers, Rotation Concepts, Scaling, Lesson 6: Parameter Blocks, A Matrix3 as an Axis System, Node Transformations, Node Transformation Matrix, Local Transformation Matrix, Object Offset Transformation, Using the Node and Object Offset Transformations, Transform Controller Coordinate Systems, Emulating Reset Transform and Reset Scale, Displaying the Object in the Viewport, Capping a Shape with a Mesh, Capping a Shape with a Patch, Ring Array Slave and Master Controllers, Creating Primitive NURBS Objects, World Space Modifiers and Object Transformations, How Objects are Drawn in the Viewport, Parameter Types, Using the API to Create and Modify 3ds Max NURBS Models, Transform Controllers and Nodes, Snapping, Controllers, Selection Modifiers, Procedural Controller Data Access, Simple Modifiers, Mapping Coordinate Modifiers, Validity Intervals, Handling Mouse Procedures, Gizmo Hit Testing using PolyLines, Dialog Based Creation of Objects, About RenderItem.
#include <matrix3.h>
Public Member Functions |
|
const Point3 & | operator[] (int i) const |
void | SetNotIdent () |
void | SetIdentFlags (DWORD f) |
DWORD | GetIdentFlags () const |
void | ClearIdentFlag (DWORD f) |
BOOL | IsIdentity () const |
void | ValidateFlags () |
MRow * | GetAddr () |
const MRow * | GetAddr () const |
Matrix3 () | |
Matrix3 (BOOL) | |
Matrix3 (float(*fp)[3]) | |
Matrix3 (const Point3 &U, const Point3 &V, const Point3 &N, const Point3 &T) | |
Matrix3 & | Set (const Point3 &U, const Point3 &V, const Point3 &N, const Point3 &T) |
int | operator== (const Matrix3 &M) const |
int | Equals (const Matrix3 &M, float epsilon=1E-6f) const |
Matrix3 & | operator-= (const Matrix3 &M) |
Matrix3 & | operator+= (const Matrix3 &M) |
Matrix3 & | operator*= (const Matrix3 &M) |
Multiply this matrix on the right by Matrix
m. |
|
Matrix3 & | operator*= (float a) |
void | IdentityMatrix () |
void | Zero () |
Point3 | GetRow (int i) const |
void | SetRow (int i, Point3 p) |
Point4 | GetColumn (int i) const |
void | SetColumn (int i, Point4 col) |
Point3 | GetColumn3 (int i) const |
void | NoTrans () |
void | NoRot () |
void | NoScale () |
void | Orthogonalize () |
Ortho-normalize the matrix. |
|
void | SetTrans (const Point3 p) |
void | SetTrans (int i, float v) |
const Point3 & | GetTrans () const |
void | Translate (const Point3 &p) |
void | RotateX (float angle) |
void | RotateY (float angle) |
void | RotateZ (float angle) |
void | Scale (const Point3 &s, BOOL trans=FALSE) |
void | PreTranslate (const Point3 &p) |
void | PreRotateX (float angle) |
void | PreRotateY (float angle) |
void | PreRotateZ (float angle) |
void | PreScale (const Point3 &s, BOOL trans=FALSE) |
void | SetTranslate (const Point3 &p) |
void | SetRotateX (float angle) |
void | SetRotateY (float angle) |
void | SetRotateZ (float angle) |
void | SetRotate (const Quat &q) |
void | SetRotate (const AngAxis &aa) |
void | SetRotate (float yaw, float pitch, float roll) |
void | SetAngleAxis (const Point3 &axis, float angle) |
void | SetScale (const Point3 &s) |
void | SetFromToUp (const Point3 &from, const Point3 &to, const Point3 &up) |
void | Invert () |
Matrix3 | operator* (const Matrix3 &) const |
Matrix3 | operator+ (const Matrix3 &) const |
Matrix3 | operator- (const Matrix3 &) const |
Point3 | PointTransform (const Point3 &p) const |
Point3 | VectorTransform (const Point3 &p) const |
void | TransformPoints (Point3 *array, int n, int stride=sizeof(Point3)) |
void | TransformPoints (const Point3 *array, Point3 *to, int n, int stride=sizeof(Point3), int strideTo=sizeof(Point3)) |
void | TransformVectors (Point3 *array, int n, int stride=sizeof(Point3)) |
void | TransformVectors (const Point3 *array, Point3 *to, int n, int stride=sizeof(Point3), int strideTo=sizeof(Point3)) |
void | GetYawPitchRoll (float *yaw, float *pitch, float *roll) |
IOResult | Save (ISave *isave) |
Save this Matrix3 to disk. |
|
IOResult | Load (ILoad *iload) |
Load the data for this Matrix3. |
|
BOOL | Parity () const |
Static Public Attributes |
|
static const Matrix3 | Identity |
An global instance of Matrix3 set to the identity. |
|
Friends |
|
class | Quat |
Matrix3 | RotateXMatrix (float angle) |
Matrix3 | RotateYMatrix (float angle) |
Matrix3 | RotateZMatrix (float angle) |
Matrix3 | TransMatrix (const Point3 &p) |
Matrix3 | ScaleMatrix (const Point3 &s) |
Matrix3 | RotateYPRMatrix (float Yaw, float Pitch, float Roll) |
Matrix3 | RotAngleAxisMatrix (Point3 &axis, float angle) |
Matrix3 | Inverse (const Matrix3 &M) |
Matrix3 | InverseHighPrecision (const Matrix3 &M) |
Point3 | operator* (const Matrix3 &A, const Point3 &V) |
Point3 | operator* (const Point3 &V, const Matrix3 &A) |
Point3 | VectorTransform (const Matrix3 &M, const Point3 &V) |
Matrix3 | XFormMat (const Matrix3 &xm, const Matrix3 &m) |
Point3 | VectorTransform (const Point3 &V, const Matrix3 &M) |
void | MatrixMultiply (Matrix3 &outMatrix, const Matrix3 &matrixA, const Matrix3 &matrixB) |
void | Inverse (Matrix3 &outMatrix, const Matrix3 &M) |
Matrix3 | ( | ) | [inline] |
{ flags = 0; }
Matrix3 | ( | BOOL | ) | [inline] |
init | Specifies if the Matrix3 should be initialized to the identity. |
{flags=0; IdentityMatrix();}
Matrix3 | ( | float(*) | fp[3] | ) |
fp | Specifies the initial values for the matrix. |
U | The data for row 0. |
V | The data for row 1. |
N | The data for row 2. |
T | The data for row 3. |
{ Set(U, V, N, T); }
const Point3& operator[] | ( | int | i | ) | const [inline] |
void SetNotIdent | ( | ) | [inline] |
void SetIdentFlags | ( | DWORD | f | ) | [inline] |
f | Specifies the identity flag bit(s) to set. See Matrix Identity Flags above. |
{ flags &= ~MAT_IDENT; flags |= f; }
DWORD GetIdentFlags | ( | ) | const [inline] |
void ClearIdentFlag | ( | DWORD | f | ) | [inline] |
f | Specifies the identity flag bit(s) to clear. |
{ flags &= ~f; }
BOOL IsIdentity | ( | ) | const [inline] |
{ return ((flags&MAT_IDENT)==MAT_IDENT); }
void ValidateFlags | ( | ) |
MRow* GetAddr | ( | ) | [inline] |
{ return (MRow *)(m); }
const MRow* GetAddr | ( | ) | const [inline] |
{ return (MRow *)(m); }
U | The data for row 0. |
V | The data for row 1. |
N | The data for row 2. |
T | The data for row 3. |
int operator== | ( | const Matrix3 & | M | ) | const |
M | The matrix to compare against. |
int Equals | ( | const Matrix3 & | M, |
float | epsilon =
1E-6f |
||
) | const |
M | The matrix to compare against. |
epsilon | The tolerance for comparison. If the values in the matrix are within this value (+ epsilon or - epsilon) they are considered equal. |
Matrix3& operator*= | ( | float | a | ) |
a | The scale to apply to each element of this matrix |
void IdentityMatrix | ( | ) |
void Zero | ( | ) |
Point3 GetRow | ( | int | i | ) | const [inline] |
i | Specifies the row to retrieve. |
{ return (*this)[i]; }
void SetRow | ( | int | i, |
Point3 | p | ||
) |
i | Specifies the row to set. |
p | The values to set. |
Point4 GetColumn | ( | int | i | ) | const |
i | Specifies the column to get (0-2). |
void SetColumn | ( | int | i, |
Point4 | col | ||
) |
i | Specifies the column to set (0-2). |
col | The values to set. |
Point3 GetColumn3 | ( | int | i | ) | const |
i | Specifies the partial column to get (0-2). |
void NoTrans | ( | ) |
void NoRot | ( | ) |
void NoScale | ( | ) |
void Orthogonalize | ( | ) |
Ortho-normalize the matrix.
This ensures that each axis of the basis is of length 1 and at
right angles to the other. This is an "unbiased" orthogonalization,
which means that no single axis is used as the basis for the other
axis, and all axis will be modified equally.
void SetTrans | ( | const Point3 | p | ) | [inline] |
p | Specifies the values for the translation row. |
void SetTrans | ( | int | i, |
float | v | ||
) | [inline] |
i | Specifies the component of the translation row of this matrix to set. |
v | The value to set. |
const Point3& GetTrans | ( | ) | const [inline] |
{ return (*this)[kTrans]; }
void Translate | ( | const Point3 & | p | ) |
p | Specifies the translation. |
void RotateX | ( | float | angle | ) |
angle | Specifies the X rotation in radians. |
void RotateY | ( | float | angle | ) |
angle | Specifies the Y rotation in radians. |
void RotateZ | ( | float | angle | ) |
angle | Specifies the Z rotation in radians. |
void Scale | ( | const Point3 & | s, |
BOOL | trans =
FALSE |
||
) |
s | The scale values. |
trans | If set to TRUE, the translation component is scaled. If trans = FALSE the translation component is unaffected. When 3ds Max was originally written there was a bug in the code for this method where the translation portion of the matrix was not being scaled. This meant that when a matrix was scaled the bottom row was not scaled. Thus it would always scale about the local origin of the object, but it would scale the world axes. When this bug was discovered, dependencies existed in the code upon this bug. Thus it could not simply be fixed because it would break the existing code that depended upon it working the incorrect way. To correct this the trans parameter was added. If this is set to TRUE, the translation component will be scaled correctly. The existing plug-ins don't use this parameter, it defaults to FALSE, and the code behaves the old way. |
void PreTranslate | ( | const Point3 & | p | ) |
void PreRotateX | ( | float | angle | ) |
angle | Specifies the X rotation in radians. |
void PreRotateY | ( | float | angle | ) |
angle | Specifies the Y rotation in radians. |
void PreRotateZ | ( | float | angle | ) |
angle | Specifies the Z rotation in radians. |
void PreScale | ( | const Point3 & | s, |
BOOL | trans =
FALSE |
||
) |
s | The scale values. |
trans | = FALSE If trans = FALSE the translation component is unaffected. |
void SetTranslate | ( | const Point3 & | p | ) |
p | The translation values to store. |
void SetRotateX | ( | float | angle | ) |
angle | The angle for X rotation (in radians). |
void SetRotateY | ( | float | angle | ) |
angle | The angle for Y rotation (in radians). |
void SetRotateZ | ( | float | angle | ) |
angle | The angle for Z rotation (in radians). |
void SetRotate | ( | const Quat & | q | ) |
q | Specifies the rotation to use for the matrix. |
void SetRotate | ( | const AngAxis & | aa | ) |
aa | Specifies the rotation to use for the matrix. |
void SetRotate | ( | float | yaw, |
float | pitch, | ||
float | roll | ||
) |
yaw | The yaw angle in radians. |
pitch | The pitch angle in radians. |
roll | The roll angle in radians. |
void SetAngleAxis | ( | const Point3 & | axis, |
float | angle | ||
) |
axis | The axis of rotation. |
angle | The angle of rotation about the axis in radians. |
void SetScale | ( | const Point3 & | s | ) |
s | The scale factors for the matrix. |
from | This specifies the viewpoint source location. |
to | This vector specifies the direction of view. |
up | This vector points to the top of the view. |
void Invert | ( | ) |
p | The point to transform by this matrix. |
p | The vector to transform by this matrix. |
array | The array of points to transform with this matrix. |
n | The number of points in the array. |
stride | The size of the increment used when moving to the next point. If you wish to transform an array of data objects which contain x, y, and z coordinates in order (such as a Point4, or a structure containing a Point3 as a member) you can specify a 'stride' value (for instance sizeof(data_object)). |
void TransformPoints | ( | const Point3 * | array, |
Point3 * | to, | ||
int | n, | ||
int | stride = sizeof(Point3) , |
||
int | strideTo = sizeof(Point3) |
||
) |
array | The array of points to transform (the source). |
to | The array to store the transformed points (the destination). |
n | The number of points in the source array. |
stride | The size increment used when moving to the next source location. |
strideTo | The size increment used when moving to the next storage location. |
array | The array of vectors to transform with this matrix. |
n | The number of vectors in the array. |
stride | The size of the increment used when moving to the next vector. If you wish to transform an array of data objects which contain x, y, and z coordinates in order (such as a Point4, or a structure containing a Point3 as a member) you can specify a 'stride' value (for instance sizeof(data_object)). |
void TransformVectors | ( | const Point3 * | array, |
Point3 * | to, | ||
int | n, | ||
int | stride = sizeof(Point3) , |
||
int | strideTo = sizeof(Point3) |
||
) |
Point3 | *array The array of vectors to transform (the source). |
to | The array to store the transformed vectors (the destination). |
n | The number of vectors in the source array. |
stride | The size increment used when moving to the next source location. |
strideTo | The size increment used when moving to the next storage location. |
void GetYawPitchRoll | ( | float * | yaw, |
float * | pitch, | ||
float * | roll | ||
) |
yaw | The yaw rotation angle is stored here (in radians). |
pitch | The pitch rotation angle is stored here (in radians). |
roll | The roll rotation angle is stored here (in radians). |
Save this Matrix3 to disk.
isave | The interface responsible for actually saving the data |
Load the data for this Matrix3.
iload | The interface responsible for actually loading the data |
BOOL Parity | ( | ) | const |
friend class Quat [friend] |
Matrix3 RotateXMatrix | ( | float | angle | ) | [friend] |
angle | Specifies the angle of rotation in radians. |
Matrix3 RotateYMatrix | ( | float | angle | ) | [friend] |
angle | Specifies the angle of rotation in radians. |
Matrix3 RotateZMatrix | ( | float | angle | ) | [friend] |
angle | Specifies the angle of rotation in radians. |
p | Specifies the translation values. |
s | Specifies the scale values. |
Matrix3 RotateYPRMatrix | ( | float | Yaw, |
float | Pitch, | ||
float | Roll | ||
) | [friend] |
Yaw | Specifies the yaw angle in radians. |
Pitch | Specifies the pitch angle in radians. |
Roll | Specifies the roll angle in radians. |
axis | Specifies the axis of rotation. Note that this angle is expected to be normalized. |
angle | Specifies the angle of rotation. Note: The direction of the angle in this method is opposite of that in AngAxisFromQ(). |
M | The matrix to compute the inverse of. |
M | The matrix to compute the inverse of. |
A | The matrix to transform the point with. |
V | The point to transform. |
V | The point to transform. |
A | The matrix to transform the point with. |
xm | Specifies the coordinate system you want to work in. |
m | Specifies the transformation matrix. |
void MatrixMultiply | ( | Matrix3 & | outMatrix, |
const Matrix3 & | matrixA, | ||
const Matrix3 & | matrixB | ||
) | [friend] |
outMatrix | The result of matrixA * matrixB |
matrixA | First matrix to multiply |
matrixB | Second matrix to multiply |
outMatrix | The inversed matrix. |
M | The matrix to compute the inverse of. |
An global instance of Matrix3 set to the identity.
An identity matrix has no rotation, scale or translation on it.
In other words, it is a matrix that has no effect when multiplied
with another matrix.
the structure of the Matrix is as follows:
[1, 0, 0]
[0, 1, 0]
[0, 0, 1]
[0, 0, 0]