3x3 Matrix class.
Note that columns and rows are 0-indexed.
Static variables
Constructor
inlinenew(e00:Float = 1, e01:Float = 0, e02:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1)
Creates a new matrix. The matrix is identity by default.
Variables
Methods
inlineappendRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3
Returns this
* rotation matrix.
Where rotation matrix is a matrix which rotates rad
in radians around the normalized
vector (axisX
, axisY
, axisZ
).
inlineappendRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3
Sets this matrix to this
* rotation matrix, and returns this
.
Where rotation matrix is a matrix which rotates rad
in radians around the normalized
vector (axisX
, axisY
, axisZ
).
inlineappendScale(sx:Float, sy:Float, sz:Float):Mat3
Returns this
* scaling matrix.
Where scaling matrix is a matrix which scales sx
times, sy
times and
sz
times along the x-axis, y-axis and z-axis respectively.
inlineappendScaleEq(sx:Float, sy:Float, sz:Float):Mat3
Sets this matrix to this
* scaling matrix, and returns this
.
Where scaling matrix is a matrix which scales sx
times, sy
times and
sz
times along the x-axis, y-axis and z-axis respectively.
inlinefromCols(col0:Vec3, col1:Vec3, col2:Vec3):Mat3
Sets this matrix by column vectors and returns this
.
inlinefromEulerXyz(eulerAngles:Vec3):Mat3
Sets this matrix to the rotation matrix represented by Euler angles eulerAngles
, and returns this
.
Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.
inlinefromQuat(q:Quat):Mat3
Sets this matrix to the representation of the quaternion q
, and returns this
.
inlinefromRows(row0:Vec3, row1:Vec3, row2:Vec3):Mat3
Sets this matrix by row vectors and returns this
.
inlinegetCol(index:Int):Vec3
Returns the index
th column vector of the matrix.
If index
is less than 0
or greater than 2
, null
will be returned.
inlinegetColTo(index:Int, dst:Vec3):Void
Sets dst
to the index
th column vector of the matrix.
If index
is less than 0
or greater than 2
, dst
will be set to the zero vector.
inlinegetRow(index:Int):Vec3
Returns the index
th row vector of the matrix.
If index
is less than 0
or greater than 2
, null
will be returned.
inlinegetRowTo(index:Int, dst:Vec3):Void
Sets dst
to the index
th row vector of the matrix.
If index
is less than 0
or greater than 2
, dst
will be set to the zero vector.
inlineinit(e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float):Mat3
Sets all elements at once and returns this
.
inlineinverse():Mat3
Returns the inverse matrix.
If the determinant is zero, zero matrix is returned.
inlineinverseEq():Mat3
Sets this matrix to the inverse matrix and returns this
.
If the determinant is zero, this matrix is set to zero matrix.
inlineprependRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3
Returns rotation matrix * this
.
Where rotation matrix is a matrix which rotates rad
in radians around the normalized
vector (axisX
, axisY
, axisZ
).
inlineprependRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3
Sets this matrix to rotation matrix * this
, and returns this
.
Where rotation matrix is a matrix which rotates rad
in radians around the normalized
vector (axisX
, axisY
, axisZ
).
inlineprependScale(sx:Float, sy:Float, sz:Float):Mat3
Returns scaling matrix * this
.
Where scaling matrix is a matrix which scales sx
times, sy
times and
sz
times along the x-axis, y-axis and z-axis respectively.
inlineprependScaleEq(sx:Float, sy:Float, sz:Float):Mat3
Sets this matrix to scaling matrix * this
, and returns this
.
Where scaling matrix is a matrix which scales sx
times, sy
times and
sz
times along the x-axis, y-axis and z-axis respectively.
inlinetoArray(columnMajor:Bool = false):Array<Float>
Returns an array of the elements of this matrix.
If columnMajor
is true, the array is arranged in column-major order.
Otherwise, the array is arranged in row-major order.
inlinetoEulerXyz():Vec3
Returns a vector (angleX, angleY, angleZ)
represents the Euler angles of this matrix.
Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.
Note that angleX
, angleY
, and angleZ
are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.