User Tools

Site Tools


DzMatrix4

A 4 x 4 transformation matrix.

More...

Inherits :

Properties

Constructors

DAZ Script
DzMatrix4 ( Boolean initIdentity=false )
DzMatrix4 ( String mtx )
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 ( Number scale, DzVec3 direction )
voidscale ( DzVec3 vec )
voidscale ( Number scale )
voidsetRow ( Number i, DzVec3 vec )
voidsetTrans ( DzVec3 vec )
voidshearXY ( Number xShear, Number yShear )
voidshearXZ ( Number xShear, Number zShear )
voidshearYZ ( Number yShear, Number zShear )
StringtoString ()
Numbertrace ()
voidtranslate ( DzVec3 vec )
DzMatrix4transpose ()

Detailed Description

A transformation matrix consisting of 4 rows and 4 columns.

Properties


Boolean : isIdentity

Whether or not this matrix is identity


Number : m11

The value of this matrix at [1, 1]


Number : m12

The value of this matrix at [1, 2]


Number : m13

The value of this matrix at [1, 3]


Number : m14

The value of this matrix at [1, 4]


Number : m21

The value of this matrix at [2, 1]


Number : m22

The value of this matrix at [2, 2]


Number : m23

The value of this matrix at [2, 3]


Number : m24

The value of this matrix at [2, 4]


Number : m31

The value of this matrix at [3, 1]


Number : m32

The value of this matrix at [3, 2]


Number : m33

The value of this matrix at [3, 3]


Number : m34

The value of this matrix at [3, 4]


Number : m41

The value of this matrix at [4, 1]


Number : m42

The value of this matrix at [4, 2]


Number : m43

The value of this matrix at [4, 3]


Number : m44

The value of this matrix at [4, 4]

Constructors


DzMatrix4( Boolean initIdentity=false )

Default Constructor.

Parameter(s):

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

DzMatrix4( String mtx )

Creates a 4×4 matrix by parsing a string.

Parameter(s):

  • mtx - A string representation of the 4×4 matrix in the form "[ m11, m21, m31, m41, m12, m22, m32, m42, m13, m23, m33, m43, m14, m24, m34, m44 ]"

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 this matrix at [1, 1]
  • m21 - The value of this matrix at [2, 1]
  • m31 - The value of this matrix at [3, 1]
  • m41 - The value of this matrix at [4, 1]
  • m12 - The value of this matrix at [1, 2]
  • m22 - The value of this matrix at [2, 2]
  • m32 - The value of this matrix at [3, 2]
  • m42 - The value of this matrix at [4, 2]
  • m13 - The value of this matrix at [1, 3]
  • m23 - The value of this matrix at [2, 3]
  • m33 - The value of this matrix at [3, 3]
  • m43 - The value of this matrix at [4, 3]
  • m14 - The value of this matrix at [1, 4]
  • m24 - The value of this matrix at [2, 4]
  • m34 - The value of this matrix at [3, 4]
  • m44 - The value of this 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.

Parameter(s):

  • rot - The rotation to initialize this 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 this matrix.

void : invert()

Test and choose the best inverse for this matrix.

Since:

  • 4.9.2.18

void : makeIdentity()

Sets this 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.

Since:

  • 4.14.1.36

DzVec3 : multMatrixVec( DzVec3 vec )

Multiplies matrix by given column vector, giving column vector result.

Parameter(s):

  • vec - The vector to multiply 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):

  • vec - The vector to multiply 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.

Parameter(s):

  • scale - The scale to apply.

void : preScale( DzVec3 vec )

Accumulates a general scale by pre-multiplying.

Parameter(s):

  • scale - The scale to apply.

void : preScale( Number scale, DzVec3 direction )

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

Parameter(s):

  • scale - The scale to apply.
  • direction - The direction to scale.

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).

Parameter(s):

  • rot - The quaternion at which to rotate.

void : rotateX( Number radians )

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

Parameter(s):

  • radians - The radians at which to rotate.

void : rotateY( Number radians )

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

Parameter(s):

  • radians - The radians at which to rotate.

void : rotateZ( Number radians )

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

Parameter(s):

  • radians - The radians at which to rotate.

DzVec3 : row( Number i )

Return Value:

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

Since:

  • 4.9.2.18

void : scale( Number scale, DzVec3 direction )

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

Parameter(s):

  • scale - The scale to apply.
  • direction - The direction to scale.

Since:

  • 4.9.2.18

void : scale( DzVec3 vec )

Accumulates a general scale (by post-multiplying).

Parameter(s):

  • vec - The scale to apply.

void : scale( Number scale )

Accumulates a uniform scale (by post-multiplying).

Parameter(s):

  • scale - The scale to apply.

void : setRow( Number i, DzVec3 vec )

Sets the first three elements of the i'th row of this matrix.

Parameter(s):

  • i - The row to set.
  • vec - The values for the first three elements.

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 this 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 this 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 this 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

String : toString()

Return Value:

  • A string representation of this matrix in the form "[ m11, m21, m31, m41, m12, m22, m32, m42, m13, m23, m33, m43, m14, m24, m34, m44 ]".

Number : trace()

Return Value:

  • The trace of this 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 this matrix.

Since:

  • 4.9.2.18