My Project
Public Member Functions | Public Attributes | Friends | List of all members
ParaEngine::Matrix3x3 Class Reference

3x3 matrix. More...

#include <Matrix3x3.h>

Public Member Functions

 Matrix3x3 (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
 Empty constructor Constructor from 9 values.
 
 Matrix3x3 (const D3DXMATRIX &mat4x4)
 
 Matrix3x3 (const Matrix3x3 &mat)
 Copy constructor.
 
void Set (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
 Assign values.
 
void SetScale (const D3DXVECTOR3 &p)
 Sets the scale from a D3DXVECTOR3. The point is put on the diagonal.
 
void SetScale (float sx, float sy, float sz)
 Sets the scale from floats. Values are put on the diagonal.
 
void Scale (const D3DXVECTOR3 &p)
 Scales from a D3DXVECTOR3. Each row is multiplied by a component.
 
void Scale (float sx, float sy, float sz)
 Scales from floats. Each row is multiplied by a value.
 
void Copy (const Matrix3x3 &source)
 Copy from a Matrix3x3.
 
void GetRow (const DWORD r, D3DXVECTOR3 &p) const
 Returns a row.
 
const D3DXVECTOR3 & GetRow (const DWORD r) const
 Returns a row.
 
D3DXVECTOR3 & GetRow (const DWORD r)
 Returns a row.
 
void SetRow (const DWORD r, const D3DXVECTOR3 &p)
 Sets a row.
 
void GetCol (const DWORD c, D3DXVECTOR3 &p) const
 Returns a column.
 
void SetCol (const DWORD c, const D3DXVECTOR3 &p)
 Sets a column.
 
float Trace () const
 Computes the trace. The trace is the sum of the 3 diagonal components.
 
void Zero ()
 Clears the matrix.
 
void Identity ()
 Sets the identity matrix.
 
bool IsIdentity () const
 Checks for identity.
 
void SkewSymmetric (const D3DXVECTOR3 &a)
 Makes a skew-symmetric matrix (a.k.a. More...
 
void Neg ()
 Negates the matrix.
 
void Neg (const Matrix3x3 &mat)
 Neg from another matrix.
 
void Add (const Matrix3x3 &mat)
 Add another matrix.
 
void Sub (const Matrix3x3 &mat)
 Sub another matrix.
 
void Mac (const Matrix3x3 &a, const Matrix3x3 &b, float s)
 Mac.
 
void Mac (const Matrix3x3 &a, float s)
 Mac.
 
void Mult (const Matrix3x3 &a, float s)
 this = A * s
 
void Add (const Matrix3x3 &a, const Matrix3x3 &b)
 
void Sub (const Matrix3x3 &a, const Matrix3x3 &b)
 
void Mult (const Matrix3x3 &a, const Matrix3x3 &b)
 this = a * b
 
void MultAtB (const Matrix3x3 &a, const Matrix3x3 &b)
 this = transpose(a) * b
 
void MultABt (const Matrix3x3 &a, const Matrix3x3 &b)
 this = a * transpose(b)
 
Matrix3x3FromTo (const D3DXVECTOR3 &from, const D3DXVECTOR3 &to)
 Makes a rotation matrix mapping vector "from" to vector "to".
 
void RotX (float angle)
 Set a rotation matrix around the X axis. More...
 
void RotY (float angle)
 Set a rotation matrix around the Y axis. More...
 
void RotZ (float angle)
 Set a rotation matrix around the Z axis. More...
 
void RotYX (float y, float x)
 cy sx.sy -sy.cx RY.RX 0 cx sx sy -sx.cy cx.cy
 
Matrix3x3Rot (float angle, const D3DXVECTOR3 &axis)
 Make a rotation matrix about an arbitrary axis.
 
void Transpose ()
 Transpose the matrix.
 
void Transpose (const Matrix3x3 &a)
 this = Transpose(a)
 
float Determinant () const
 Compute the determinant of the matrix. We use the rule of Sarrus.
 
Matrix3x3Invert ()
 Invert the matrix. Determinant must be different from zero, else matrix can't be inverted.
 
Matrix3x3Normalize ()
 
Matrix3x3Exp (const Matrix3x3 &a)
 this = exp(a)
 
void FromQuat (const D3DXQUATERNION &q)
 
void FromQuatL2 (const D3DXQUATERNION &q, float l2)
 
Matrix3x3 operator+ (const Matrix3x3 &mat) const
 Operator for Matrix3x3 Plus = Matrix3x3 + Matrix3x3;.
 
Matrix3x3 operator- (const Matrix3x3 &mat) const
 Operator for Matrix3x3 Minus = Matrix3x3 - Matrix3x3;.
 
Matrix3x3 operator* (const Matrix3x3 &mat) const
 Operator for Matrix3x3 Mul = Matrix3x3 * Matrix3x3;.
 
D3DXVECTOR3 operator* (const D3DXVECTOR3 &v) const
 Operator for D3DXVECTOR3 Mul = Matrix3x3 * D3DXVECTOR3;.
 
Matrix3x3 operator* (float s) const
 Operator for Matrix3x3 Mul = Matrix3x3 * float;.
 
Matrix3x3 operator/ (float s) const
 Operator for Matrix3x3 Div = Matrix3x3 / float;.
 
Matrix3x3operator+= (const Matrix3x3 &mat)
 Operator for Matrix3x3 += Matrix3x3.
 
Matrix3x3operator-= (const Matrix3x3 &mat)
 Operator for Matrix3x3 -= Matrix3x3.
 
Matrix3x3operator*= (const Matrix3x3 &mat)
 Operator for Matrix3x3 *= Matrix3x3.
 
Matrix3x3operator*= (float s)
 Operator for Matrix3x3 *= float.
 
Matrix3x3operator/= (float s)
 Operator for Matrix3x3 /= float.
 
 operator D3DXMATRIX () const
 Cast a Matrix3x3 to a Matrix4x4.
 
 operator D3DXQUATERNION () const
 Cast a Matrix3x3 to a Quat.
 
const D3DXVECTOR3 & operator[] (int row) const
 
D3DXVECTOR3 & operator[] (int row)
 

Public Attributes

float m [3][3]
 

Friends

Matrix3x3 operator* (float s, const Matrix3x3 &mat)
 Operator for Matrix3x3 Mul = float * Matrix3x3;.
 
Matrix3x3 operator/ (float s, const Matrix3x3 &mat)
 Operator for Matrix3x3 Div = float / Matrix3x3;.
 

Detailed Description

3x3 matrix.

DirectX-compliant, ie row-column order, ie m[Row][Col]. Same as: m11 m12 m13 first row. m21 m22 m23 second row. m31 m32 m33 third row. Stored in memory as m11 m12 m13 m21...

Multiplication rules:

[x'y'z'] = [xyz][M]

x' = x*m11 + y*m21 + z*m31 y' = x*m12 + y*m22 + z*m32 z' = x*m13 + y*m23 + z*m33

Member Function Documentation

§ RotX()

void ParaEngine::Matrix3x3::RotX ( float  angle)
inline

Set a rotation matrix around the X axis.

1 0 0 RX = 0 cx sx 0 -sx cx

§ RotY()

void ParaEngine::Matrix3x3::RotY ( float  angle)
inline

Set a rotation matrix around the Y axis.

cy 0 -sy RY = 0 1 0 sy 0 cy

§ RotZ()

void ParaEngine::Matrix3x3::RotZ ( float  angle)
inline

Set a rotation matrix around the Z axis.

cz sz 0 RZ = -sz cz 0 0 0 1

§ SkewSymmetric()

void ParaEngine::Matrix3x3::SkewSymmetric ( const D3DXVECTOR3 &  a)
inline

Makes a skew-symmetric matrix (a.k.a.

Star(*) Matrix) [ 0.0 -a.z a.y ] [ a.z 0.0 -a.x ] [ -a.y a.x 0.0 ] This is also called a "cross matrix" since for any vectors A and B, A^B = Skew(A) * B = - B * Skew(A);


The documentation for this class was generated from the following files: