User Tools

Site Tools


DzMatrix4

A 4 x 4 transformation matrix.

More...

Inherits :

Properties

Constructors

DAZ Script
DzMatrix4 ( Boolean initIdentity=false )
DzMatrix4 ( Number m11, Number m21, Number m31, Number m41, Number m12, Number m22, Number m32, Number m42, Number m13, Number m23, Number m33, Number m43, Number m14, Number m24, Number m34, Number m44 )
DzMatrix4 ( DzVec3 xAxis, DzVec3 yAxis, DzVec3 zAxis )
DzMatrix4 ( DzQuat rot )
DzMatrix4 ( DzMatrix4 mat )

Methods

DAZ Script
DzMatrix4inverse ()
voidinvert ()
voidmakeIdentity ()
DzMatrix3matrix3 ()
DzMatrix4multiply ( DzMatrix4 mat )
DzVec3multMatrixVec ( DzVec3 vec )
DzVec3multVecMatrix ( DzVec3 vec )
Booleanorthogonal ()
voidpreScale ( Number scale )
voidpreScale ( DzVec3 vec )
voidpreScale ( Number scale, DzVec3 direction )
voidpreShearXY ( Number xShear, Number yShear )
voidpreShearXZ ( Number xShear, Number zShear )
voidpreShearYZ ( Number yShear, Number zShear )
voidpreTranslate ( DzVec3 vec )
voidrotate ( DzQuat rot )
voidrotateX ( Number radians )
voidrotateY ( Number radians )
voidrotateZ ( Number radians )
DzVec3row ( Number i )
voidscale ( DzVec3 vec )
voidscale ( Number scale )
voidscale ( Number scale, DzVec3 direction )
voidsetRow ( Number i, DzVec3 vec )
voidsetTrans ( DzVec3 vec )
voidshearXY ( Number xShear, Number yShear )
voidshearXZ ( Number xShear, Number zShear )
voidshearYZ ( Number yShear, Number zShear )
Numbertrace ()
voidtranslate ( DzVec3 vec )
DzMatrix4transpose ()

Detailed Description

A transformation matrix consisting of 4 rows and 4 columns.

Properties


Boolean : isIdentity

Whether or not the matrix is identity


Number : m11

The value of the matrix at [1, 1]


Number : m12

The value of the matrix at [1, 2]


Number : m13

The value of the matrix at [1, 3]


Number : m14

The value of the matrix at [1, 4]


Number : m21

The value of the matrix at [2, 1]


Number : m22

The value of the matrix at [2, 2]


Number : m23

The value of the matrix at [2, 3]


Number : m24

The value of the matrix at [2, 4]


Number : m31

The value of the matrix at [3, 1]


Number : m32

The value of the matrix at [3, 2]


Number : m33

The value of the matrix at [3, 3]


Number : m34

The value of the matrix at [3, 4]


Number : m41

The value of the matrix at [4, 1]


Number : m42

The value of the matrix at [4, 2]


Number : m43

The value of the matrix at [4, 3]


Number : m44

The value of the matrix at [4, 4]

Constructors


DzMatrix4( Boolean initIdentity=false )

Default Constructor.

Parameter(s):

  • initIdentity - If true, the matrix will be set to the identity matrix, otherwise, the matrix values will be indeterminate.

DzMatrix4( Number m11, Number m21, Number m31, Number m41, Number m12, Number m22, Number m32, Number m42, Number m13, Number m23, Number m33, Number m43, Number m14, Number m24, Number m34, Number m44 )

Constructs a 4×4 matrix from 16 elements in “Column Major” order.

Parameter(s):

  • m11 - The value of the matrix at [1, 1]
  • m21 - The value of the matrix at [2, 1]
  • m31 - The value of the matrix at [3, 1]
  • m41 - The value of the matrix at [4, 1]
  • m12 - The value of the matrix at [1, 2]
  • m22 - The value of the matrix at [2, 2]
  • m32 - The value of the matrix at [3, 2]
  • m42 - The value of the matrix at [4, 2]
  • m13 - The value of the matrix at [1, 3]
  • m23 - The value of the matrix at [2, 3]
  • m33 - The value of the matrix at [3, 3]
  • m43 - The value of the matrix at [4, 3]
  • m14 - The value of the matrix at [1, 4]
  • m24 - The value of the matrix at [2, 4]
  • m34 - The value of the matrix at [3, 4]
  • m44 - The value of the matrix at [4, 4]

Example:

// Create a new 4x4 matrix
var mtx4 = new DzMatrix4( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 );
// Print the input sequence, for comparison
print( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 );
// Print elements of the matrix in column major order
print(
	mtx4.m11, mtx4.m21, mtx4.m31, mtx4.m41,
	mtx4.m12, mtx4.m22, mtx4.m32, mtx4.m42,
	mtx4.m13, mtx4.m23, mtx4.m33, mtx4.m43,
	mtx4.m14, mtx4.m24, mtx4.m34, mtx4.m44 );

DzMatrix4( DzVec3 xAxis, DzVec3 yAxis, DzVec3 zAxis )

Constructor from three axes of the rotation coord system. These are assumed to be (but do not have to be if a sheared or warped coord system is desired) to be orthogonal unit vectors.

Since:

  • 4.6.4.98

DzMatrix4( DzQuat rot )

Constructs a 4×4 matrix from a quaternion. Initializes the matrix to the given rotation.

Parameter(s):

  • rot - The rotation to initialize the matrix to.

Since:

  • 4.6.4.98

DzMatrix4( DzMatrix4 mat )

Copy Constructor.

Parameter(s):

  • mat - The matrix to copy.

Methods


DzMatrix4 : inverse()

Return Value:

  • The inverse of the matrix.

void : invert()

Test and choose best inverse for current matrix

Since:

  • 4.9.2.18

void : makeIdentity()

Sets the matrix to be identity


DzMatrix3 : matrix3()

Return Value:

Since:

  • 4.9.2.18

DzMatrix4 : multiply( DzMatrix4 mat )

Calculates the multiplication of this matrix by the given matrix.

Parameter(s):

  • mat - The matrix to multiply by

Return Value:

  • The result of the multiplication

DzVec3 : multMatrixVec( DzVec3 vec )

Multiplies matrix by given column vector, giving column vector result

Parameter(s):

  • vec - The vector to multiplying this matrix by

Return Value:

  • The result of multiplying the given vector through this matrix

DzVec3 : multVecMatrix( DzVec3 vec )

Multiplies given row vector by matrix, giving row vector result

Parameter(s):

  • src - The vector to multiplying this matrix by

Return Value:

  • The result of multiplying the given vector through this matrix

Boolean : orthogonal()

Test for orthogonal 3×3 sub-matrix (orthonormal rows)

Since:

  • 4.6.4.98

void : preScale( Number scale )

Accumulates a uniform scale by pre-multiplying.


void : preScale( DzVec3 vec )

Accumulates a general scale by pre-multiplying.

Parameter(s):

  • scale - The scale to use

void : preScale( Number scale, DzVec3 direction )

Accumulates a scale along an arbitrary axis by pre-multiplying.

Since:

  • 4.9.2.18

void : preShearXY( Number xShear, Number yShear )

Shears the matrix along the x and y axis (by pre-multiplying).

Parameter(s):

  • xShear - The value to shear along the x axis
  • yShear - The value to shear along the y axis

Since:

  • 4.9.2.18

void : preShearXZ( Number xShear, Number zShear )

Shears the matrix along the x and z axis (by pre-multiplying).

Parameter(s):

  • xShear - The value to shear along the x axis
  • zShear - The value to shear along the z axis

Since:

  • 4.9.2.18

void : preShearYZ( Number yShear, Number zShear )

Shears the matrix along the y and z axis (by pre-multiplying).

Parameter(s):

  • yShear - The value to shear along the y axis
  • zShear - The value to shear along the z axis

Since:

  • 4.9.2.18

void : preTranslate( DzVec3 vec )

Accumulate a translation by pre-multiplying.

Parameter(s):

  • vec - The point at which to translate

void : rotate( DzQuat rot )

Accumulate rotation (by post-multiplying).


void : rotateX( Number radians )

Accumulate rotation around the X axis (by post-multiplying).


void : rotateY( Number radians )

Accumulate rotation around the Y axis (by post-multiplying).


void : rotateZ( Number radians )

Accumulate rotation around the Z axis (by post-multiplying).


DzVec3 : row( Number i )

Return Value:

  • The first three elements of the i'th row of the matrix.

Since:

  • 4.9.2.18

void : scale( DzVec3 vec )

Accumulates a general scale (by post-multiplying).


void : scale( Number scale )

Accumulates a uniform scale (by post-multiplying).


void : scale( Number scale, DzVec3 direction )

Accumulates a scale along an arbitrary axis (by post-multiplying).

Since:

  • 4.9.2.18

void : setRow( Number i, DzVec3 vec )

TODO: Add description.


void : setTrans( DzVec3 vec )

Sets matrix to translate by given vector, leaving rotation as is

Parameter(s):

  • vec - The point at which to translate

void : shearXY( Number xShear, Number yShear )

Shears the matrix along the x and y axis (by post-multiplying).

Parameter(s):

  • xShear - The value to shear along the x axis
  • yShear - The value to shear along the y axis

Since:

  • 4.9.2.18

void : shearXZ( Number xShear, Number zShear )

Shears the matrix along the x and z axis (by post-multiplying).

Parameter(s):

  • xShear - The value to shear along the x axis
  • zShear - The value to shear along the z axis

Since:

  • 4.9.2.18

void : shearYZ( Number yShear, Number zShear )

Shears the matrix along the y and z axis (by post-multiplying).

Parameter(s):

  • yShear - The value to shear along the y axis
  • zShear - The value to shear along the z axis

Since:

  • 4.9.2.18

Number : trace()

Return Value:

  • The trace of the matrix

Since:

  • 4.9.2.18

void : translate( DzVec3 vec )

Accumulate a translation (by post-multiplying).

Parameter(s):

  • vec - The point at which to translate

DzMatrix4 : transpose()

Return Value:

  • The transpose of the matrix.

Since:

  • 4.9.2.18