dmatrix3.h File Reference

dmatrix3.h File Reference
+ Related help topics:
#include "DPoint3.h"
#include "Matrix3.h"

Classes

class  DMatrix3
 Class DPoint3, Matrix Representations of 3D Transformations, Class Quat, Class AngAxis, Structure AffineParts, Class BigMatrix. More...
 

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 (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...
 
DMatrix3 InverseHighPrecision (const DMatrix3 &m)
 Return the inverse of the matrix using doubles for the intermediary results. More...
 
DPoint3 operator* (const DMatrix3 &a, const DPoint3 &v)
 These transform a DPoint3 with a Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3. More...
 
DPoint3 operator* (const DPoint3 &v, const DMatrix3 &a)
 These transform a DPoint3 with a Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">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...
 

Function Documentation

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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
DMatrix3 TransMatrix ( const DPoint3 p)

Builds a new matrix for use as a translation transformation.

Parameters
pSpecifies the translation values.
Returns
A new translation Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
DMatrix3 ScaleMatrix ( const DPoint3 s)

Builds a new matrix for use as a scale transformation.

Parameters
sSpecifies the scale values.
Returns
A new scale Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
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:

1 M.IdentityMatrix();
2 M.RotateZ(roll);
3 M.RotateX(pitch);
4 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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
DMatrix3 RotAngleAxisMatrix ( 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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3.
DMatrix3 Inverse ( const DMatrix3 m)

Return the inverse of the matrix.

Parameters
mThe matrix to compute the inverse of.
DMatrix3 InverseHighPrecision ( const DMatrix3 m)

Return the inverse of the matrix using doubles for the intermediary results.

Parameters
mThe matrix to compute the inverse of.
DPoint3 operator* ( const DMatrix3 a,
const DPoint3 v 
)

These transform a DPoint3 with a Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">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.
DPoint3 operator* ( const DPoint3 v,
const DMatrix3 a 
)

These transform a DPoint3 with a Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">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.
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).
DPoint3 VectorTransform ( const DPoint3 v,
const DMatrix3 m 
)
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
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 Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3 that is xm*m*Inverse(xm).

Parameters
xmSpecifies the coordinate system you want to work in.
mSpecifies the transformation matrix.
Returns
Returns a Matrix Representations of 3D Transformations, Class Quat, Class AngAxis...">DMatrix3 that is xm*m*Inverse(xm).
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.

1 DPoint3 p = ...; // Some arbitrary point;
2 DMatrix3 tm = ...; // Some matrix
3 DMatrix3 tmMirror = tm;
4 MirrorMatrix(tm, kXAxis); // Mirror this matrix around the X Axis;
5 DPoint3 p3Result = tm.PointTransform(p); // Apply the original transformation
6 DPoint3 p3Mirrored = tmMirror.PointTransform(p); // Apply the mirrored transformation
7 p3Result[kXAxis] == -p3Mirrored[kXAxis]; // The point is mirrored around X
8 p3Result[kYAxis] == p3Mirrored[kYAxis]; // The point is unchanged around Y
9 p3Result[kZAxis] == p3Mirrored[kZAxis]; // The point is unchanged around Z
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)
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
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.