Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Matrix Class Reference

Inherits ScriptObject.

Public Types

enum  EulerConvention {
  EULER_XZX_S, EULER_YXY_S, EULER_ZYZ_S, EULER_XZX_R,
  EULER_YXY_R, EULER_ZYZ_R, EULER_XZY_S, EULER_YXZ_S,
  EULER_ZYX_S, EULER_YZX_R, EULER_ZXY_R, EULER_XYZ_R,
  EULER_XYX_S, EULER_YZY_S, EULER_ZXZ_S, EULER_XYX_R,
  EULER_YZY_R, EULER_ZXZ_R, EULER_XYZ_S, EULER_YZX_S,
  EULER_ZXY_S, EULER_ZYX_R, EULER_XZY_R, EULER_YXZ_R
}
 

Public Member Functions

 Matrix ()
 
 Matrix (Number scale)
 
 Matrix (Vector right, Vector up, Vector forward)
 
 Matrix (Number m[9])
 
 Matrix (Vector axis, Number angle)
 
 rotateX (Number angle)
 
 rotateY (Number angle)
 
 rotateZ (Number angle)
 
Number getElement (Integer row, Integer column)
 
 setElement (Integer row, Integer column, Number value)
 
Vector getRow (Integer row)
 
 setRow (Integer row, Vector value)
 
Vector getColumn (Integer column)
 
 setColumn (Integer column, Vector value)
 
Vector getForward ()
 
 setForward (Vector value)
 
Vector getUp ()
 
 setUp (Vector value)
 
Vector getRight ()
 
 setRight (Vector value)
 
Vector getTiltAndTilt (Integer primary, Integer secondary)
 
Vector getTurnAndTilt (Integer primary, Integer secondary)
 
Vector getEuler (Integer convention)
 
Vector getEuler2 (Integer convention)
 
Vector getEulerZXZ ()
 
Vector getEulerZYZ ()
 
Vector getEulerXYZ ()
 
Vector getEulerZYX ()
 
 clamp (Number epsilon)
 
Boolean isZero ()
 
Boolean isIdentity ()
 
Number getN1 ()
 
Number getN2 ()
 
 normalize ()
 
 add (Matrix right)
 
 subtract (Matrix right)
 
 negate ()
 
Matrix getNegated ()
 
 transpose ()
 
Matrix getTransposed ()
 
Matrix multiply (Number right)
 
Matrix multiply (Matrix right)
 
Vector multiply (Vector right)
 
String toString ()
 

Static Public Member Functions

static Matrix getAxisRotation (Vector axis, Number angle)
 
static Matrix getXRotation (Number angle)
 
static Matrix getYRotation (Number angle)
 
static Matrix getZRotation (Number angle)
 
static Matrix getXYZRotation (Vector abc)
 
static Matrix getEulerRotation (Integer convention, Vector angles)
 
static Matrix getEulerXZXRotation (Vector angles)
 
static Matrix getEulerYXYRotation (Vector angles)
 
static Matrix getEulerZYZRotation (Vector angles)
 
static Matrix getEulerXZYRotation (Vector angles)
 
static Matrix getEulerYXZRotation (Vector angles)
 
static Matrix getEulerZYXRotation (Vector angles)
 
static Matrix getEulerXYXRotation (Vector angles)
 
static Matrix getEulerYZYRotation (Vector angles)
 
static Matrix getEulerZXZRotation (Vector angles)
 
static Matrix getEulerXYZRotation (Vector angles)
 
static Matrix getEulerYZXRotation (Vector angles)
 
static Matrix getEulerZXYRotation (Vector angles)
 
static Matrix sum (Matrix left, Matrix right)
 
static Matrix diff (Matrix left, Matrix right)
 
static Matrix getOrientationFromDirection (Vector forward)
 

Public Attributes

Number n1
 The 1-norm.
 
Number n2
 The 2-norm.
 
Matrix negated
 The negated matrix.
 
Matrix transposed
 The transposed matrix (equal to the inverse for rotations).
 
Vector up
 The up vector.
 
Vector right
 The right vector.
 
Vector forward
 The forward vector.
 
Vector eulerXZX
 Euler angles in radians for XZX static/world convention.
 
Vector eulerYXY
 Euler angles in radians for YXY static/world convention.
 
Vector eulerZYZ
 Euler angles in radians for ZYZ static/world convention.
 
Vector eulerXZX_R
 Euler angles in radians for XZX body convention.
 
Vector eulerYXY_R
 Euler angles in radians for YXY body convention.
 
Vector eulerZYZ_R
 Euler angles in radians for ZYZ body convention.
 
Vector eulerXZY
 Euler angles in radians for XZY static/world convention.
 
Vector eulerYXZ
 Euler angles in radians for YXZ static/world convention.
 
Vector eulerZYX
 Euler angles in radians for ZYX static/world convention.
 
Vector eulerYZX_R
 Euler angles in radians for YZX body convention.
 
Vector eulerZXY_R
 Euler angles in radians for ZXY body convention.
 
Vector eulerXYZ_R
 Euler angles in radians for XYZ body convention.
 
Vector eulerXYX
 Euler angles in radians for XYX static/world convention.
 
Vector eulerYZY
 Euler angles in radians for YZY static/world convention.
 
Vector eulerZXZ
 Euler angles in radians for ZXZ static/world convention.
 
Vector eulerXYX_R
 Euler angles in radians for XYX body convention.
 
Vector eulerYZY_R
 Euler angles in radians for YZY body convention.
 
Vector eulerZXZ_R
 Euler angles in radians for ZXZ body convention.
 
Vector eulerXYZ
 Euler angles in radians for XYZ static/world convention.
 
Vector eulerYZX
 Euler angles in radians for YZX static/world convention.
 
Vector eulerZXY
 Euler angles in radians for ZXY static/world convention.
 
Vector eulerZYX_R
 Euler angles in radians for ZYX body convention.
 
Vector eulerXZY_R
 Euler angles in radians for XZY body convention.
 
Vector eulerYXZ_R
 Euler angles in radians for YXZ body convention.
 

Detailed Description

A 3 by 3 matrix.

Member Enumeration Documentation

◆ EulerConvention

Euler conventions.

Enumerator
EULER_XZX_S 

Euler XZX static/world convention.

EULER_YXY_S 

Euler YXY static/world convention.

EULER_ZYZ_S 

Euler ZYZ static/world convention.

EULER_XZX_R 

Euler XZX body convention.

EULER_YXY_R 

Euler YXY body convention.

EULER_ZYZ_R 

Euler ZYZ body convention.

EULER_XZY_S 

Euler XZY static/world convention.

EULER_YXZ_S 

Euler YXZ static/world convention.

EULER_ZYX_S 

Euler ZYX static/world convention.

EULER_YZX_R 

Euler YZX body convention.

EULER_ZXY_R 

Euler ZXY body convention.

EULER_XYZ_R 

Euler XYZ body convention.

EULER_XYX_S 

Euler XYX static/world convention.

EULER_YZY_S 

Euler YZY static/world convention.

EULER_ZXZ_S 

Euler ZXZ static/world convention.

EULER_XYX_R 

Euler XYX body convention.

EULER_YZY_R 

Euler YZY body convention.

EULER_ZXZ_R 

Euler ZXZ body convention.

EULER_XYZ_S 

Euler XYZ static/world convention.

EULER_YZX_S 

Euler YZX static/world convention.

EULER_ZXY_S 

Euler ZXY static/world convention.

EULER_ZYX_R 

Euler ZYX body convention.

EULER_XZY_R 

Euler XZY body convention.

EULER_YXZ_R 

Euler YXZ body convention.

Constructor & Destructor Documentation

◆ Matrix() [1/5]

Matrix ( )

Construct a matrix as the identity matrix.

◆ Matrix() [2/5]

Matrix ( Number  scale)

Construct a matrix as a scaling matrix.

◆ Matrix() [3/5]

Matrix ( Vector  right,
Vector  up,
Vector  forward 
)

Constructs the matrix with the specified right, up, and forward directions.

◆ Matrix() [4/5]

Matrix ( Number  m[9])

Constructs the matrix with the specified elements.

◆ Matrix() [5/5]

Matrix ( Vector  axis,
Number  angle 
)

Constructs the matrix as the specified axis rotation.

Parameters
axisThe axis of rotation.
angleThe angle of rotation (radians).
Precondition
axis.getLength() == 1

Member Function Documentation

◆ add()

add ( Matrix  right)

Adds the specified matrix to this matrix.

◆ clamp()

clamp ( Number  epsilon)

Clamps the matrix elements to -1, 0, and -1 with the specified epsilon value.

◆ diff()

static Matrix diff ( Matrix  left,
Matrix  right 
)
static

Returns the difference between the specified matrices.

◆ getAxisRotation()

static Matrix getAxisRotation ( Vector  axis,
Number  angle 
)
static

Returns the rotation matrix for the specified axis rotation.

Parameters
axisThe axis of rotation.
angleThe angle (in radians).
Precondition
axis.getLength() == 1

◆ getColumn()

Vector getColumn ( Integer  column)

Returns the specified column.

Parameters
columnThe column [0; 2].

◆ getElement()

Number getElement ( Integer  row,
Integer  column 
)

Returns the value of the specified element.

Parameters
rowThe row [0; 2].
columnThe column [0; 2].

◆ getEuler()

Vector getEuler ( Integer  convention)

Returns the Euler angle for the specified convention in radians. Use getEuler2() instead to get the standard Euler conventions.

Deprecated:

◆ getEuler2()

Vector getEuler2 ( Integer  convention)

Returns the Euler angle for the specified convention in radians.

Since
r41257

◆ getEulerRotation()

static Matrix getEulerRotation ( Integer  convention,
Vector  angles 
)
static

Returns the rotation for the specified Euler angles and convention.

◆ getEulerXYXRotation()

static Matrix getEulerXYXRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (XYX static convention). Angles are in radians.

◆ getEulerXYZ()

Vector getEulerXYZ ( )

Returns the Euler angles (XYZ convention) in radians. Use Matrix.getEuler2() instead.

Deprecated:

◆ getEulerXYZRotation()

static Matrix getEulerXYZRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (XYZ static convention). Angles are in radians.

◆ getEulerXZXRotation()

static Matrix getEulerXZXRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (XZX static convention). Angles are in radians.

◆ getEulerXZYRotation()

static Matrix getEulerXZYRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (XZY static convention). Angles are in radians.

◆ getEulerYXYRotation()

static Matrix getEulerYXYRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (YXY static convention). Angles are in radians.

◆ getEulerYXZRotation()

static Matrix getEulerYXZRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (YXZ static convention). Angles are in radians.

◆ getEulerYZXRotation()

static Matrix getEulerYZXRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (YZX static convention). Angles are in radians.

◆ getEulerYZYRotation()

static Matrix getEulerYZYRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (YZY static convention). Angles are in radians.

◆ getEulerZXYRotation()

static Matrix getEulerZXYRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (ZXY static convention). Angles are in radians.

◆ getEulerZXZ()

Vector getEulerZXZ ( )

Returns the Euler angles (ZXZ convention) in radians. Use Matrix.getEuler2() instead.

Deprecated:

◆ getEulerZXZRotation()

static Matrix getEulerZXZRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (ZXZ static convention). Angles are in radians.

◆ getEulerZYX()

Vector getEulerZYX ( )

Returns the Euler angles (ZYX convention) in radians. Use Matrix.getEuler2() instead.

Deprecated:

◆ getEulerZYXRotation()

static Matrix getEulerZYXRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (ZYX static convention). Angles are in radians.

◆ getEulerZYZ()

Vector getEulerZYZ ( )

Returns the Euler angles (ZYZ convention) in radians. Use Matrix.getEuler2() instead.

Deprecated:

◆ getEulerZYZRotation()

static Matrix getEulerZYZRotation ( Vector  angles)
static

Returns the rotation matrix for the specified Euler rotation (ZYZ static convention). Angles are in radians.

◆ getForward()

Vector getForward ( )

Returns the forward vector.

◆ getN1()

Number getN1 ( )

Return N1 of this matrix.

◆ getN2()

Number getN2 ( )

Return N2 of this matrix.

◆ getNegated()

Matrix getNegated ( )

Returns the negated matrix.

◆ getOrientationFromDirection()

static Matrix getOrientationFromDirection ( Vector  forward)
static

Returns a matrix that satisfies the supplied forward vector. Since only a single vector is supplied the resultant matrix can be rotated at any angle around the forward vector.

◆ getRight()

Vector getRight ( )

Returns the right vector.

◆ getRow()

Vector getRow ( Integer  row)

Returns the specified row.

Parameters
rowThe row [0; 2].

◆ getTiltAndTilt()

Vector getTiltAndTilt ( Integer  primary,
Integer  secondary 
)

Returns the X and Y rotations around the fixed frame to match the forward direction. Primary and secondary specifies the preferred rotations and must be different.

Parameters
primaryThe primary coordinate (0, or 1).
secondaryThe secondary coordinate (0 or 1).

◆ getTransposed()

Matrix getTransposed ( )

Returns the transposed matrix.

◆ getTurnAndTilt()

Vector getTurnAndTilt ( Integer  primary,
Integer  secondary 
)

Returns the X, Y, Z rotations around the fixed frame to match the forward direction. Primary and secondary specifies the preferred rotations and must be different.

Parameters
primaryThe primary coordinate (0, 1, or 2).
secondaryThe secondary coordinate (0, 1, or 2).

◆ getUp()

Vector getUp ( )

Returns the up vector.

◆ getXRotation()

static Matrix getXRotation ( Number  angle)
static

Returns the matrix for the specified X-axis rotation. The matrix will rotate the vector and not the frame.

Parameters
angleThe rotation angle in radians.

◆ getXYZRotation()

static Matrix getXYZRotation ( Vector  abc)
static

Returns the matrix for the specified X, Y, and Z rotations. The matrix will rotate the vector and not the frame. The order of the rotations are X, Y, and then Z.

Parameters
abcThe rotation XYZ angles in radians.

◆ getYRotation()

static Matrix getYRotation ( Number  angle)
static

Returns the matrix for the specified Y-axis rotation. The matrix will rotate the vector and not the frame.

Parameters
angleThe rotation angle in radians.

◆ getZRotation()

static Matrix getZRotation ( Number  angle)
static

Returns the matrix for the specified Z-axis rotation. The matrix will rotate the vector and not the frame.

Parameters
angleThe rotation angle in radians.

◆ isIdentity()

Boolean isIdentity ( )

Returns true if the matrix is the identity matrix.

◆ isZero()

Boolean isZero ( )

Returns true if the matrix is the zero matrix (i.e. all elements are set to 0).

◆ multiply() [1/3]

Matrix multiply ( Number  right)

Returns the multiple of this matrix (left) and the specified value (right).

◆ multiply() [2/3]

Matrix multiply ( Matrix  right)

Returns the multiple of this matrix (left) and the specified matrix (right).

◆ multiply() [3/3]

Vector multiply ( Vector  right)

Returns the multiple of this matrix (left) and the specified vector (right).

◆ negate()

negate ( )

Negates this matrix.

◆ normalize()

normalize ( )

Normalizes the orientation.

◆ rotateX()

rotateX ( Number  angle)

Rotates this matrix around the X-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ rotateY()

rotateY ( Number  angle)

Rotates this matrix around the Y-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ rotateZ()

rotateZ ( Number  angle)

Rotates this matrix around the Z-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ setColumn()

setColumn ( Integer  column,
Vector  value 
)

Sets the specified column.

Parameters
columnThe column [0; 2].
valueThe desired column vector.

◆ setElement()

setElement ( Integer  row,
Integer  column,
Number  value 
)

Sets the value of the specified element.

Parameters
rowThe row [0; 2].
columnThe column [0; 2].
valueThe desired value of the element.

◆ setForward()

setForward ( Vector  value)

Sets the forward vector.

Parameters
valueThe forward vector.

◆ setRight()

setRight ( Vector  value)

Sets the right vector.

Parameters
valueThe right vector.

◆ setRow()

setRow ( Integer  row,
Vector  value 
)

Sets the specified row.

Parameters
rowThe row [0; 2].
valueThe desired row vector.

◆ setUp()

setUp ( Vector  value)

Sets the up vector.

Parameters
valueThe up vector.

◆ subtract()

subtract ( Matrix  right)

Subtracts the specified matrix from this matrix.

◆ sum()

static Matrix sum ( Matrix  left,
Matrix  right 
)
static

Returns the difference between the specified matrices.

◆ toString()

String toString ( )

Converts the matrix to a string (e.g. [[1, 2, 3], [4, 5, 6], [7, 8, 9]]).

◆ transpose()

transpose ( )

Transposed this matrix.



Generated by Autodesk, Inc. 19 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.