Class: matrix
Mutable 4x4 transform matrix.
Basis vectors are exposed as i, j, k; translation is exposed as c.
Source
C++ class matrix
Custom Constructor
matrix
Remarks
Script-exposed mutators return this matrix for chaining. Call identity() or set() before composing transforms when you need a known starting value.
Constructors
Constructor
new matrix(): matrix;Create an empty matrix.
Returns
matrix
Methods
div()
Call Signature
div(value: matrix, divisor: number): matrix;Set this matrix to value / divisor.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | matrix | Source matrix. |
divisor | number | Scalar divisor. |
Returns
matrix
This matrix.
Remarks
The binding performs raw scalar division. Pass a non-zero divisor.
Call Signature
div(divisor: number): matrix;Divide this matrix by a scalar.
Parameters
| Parameter | Type | Description |
|---|---|---|
divisor | number | Scalar divisor. |
Returns
matrix
This matrix.
Remarks
The binding performs raw scalar division. Pass a non-zero divisor.
getHPB()
getHPB(
value: matrix,
heading: number,
pitch: number,
bank: number): matrix;Get heading, pitch, and bank from this matrix.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | matrix | Placeholder kept for existing declaration compatibility. |
heading | number | Heading output placeholder. |
pitch | number | Pitch output placeholder. |
bank | number | Bank output placeholder. |
Returns
matrix
This matrix.
Remarks
Native Lua uses pointer-style output parameters for heading, pitch, and bank; the declaration keeps the legacy shape for compatibility.
identity()
identity(): matrix;Set this matrix to identity.
Returns
matrix
This matrix.
mk_xform()
mk_xform(rotation: Fquaternion, position: vector): matrix;Build transform from quaternion and translation.
Parameters
| Parameter | Type | Description |
|---|---|---|
rotation | Fquaternion | Quaternion value. |
position | vector | Translation vector. |
Returns
matrix
This matrix.
mul()
Call Signature
mul(left: matrix, right: matrix): matrix;Set this matrix to left * right.
Parameters
| Parameter | Type | Description |
|---|---|---|
left | matrix | Left matrix. |
right | matrix | Right matrix. |
Returns
matrix
This matrix.
Call Signature
mul(value: matrix, multiplier: number): matrix;Set this matrix to value * multiplier.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | matrix | Source matrix. |
multiplier | number | Scalar multiplier. |
Returns
matrix
This matrix.
Call Signature
mul(multiplier: number): matrix;Multiply this matrix by a scalar.
Parameters
| Parameter | Type | Description |
|---|---|---|
multiplier | number | Scalar multiplier. |
Returns
matrix
This matrix.
set()
Call Signature
set(value: matrix): matrix;Copy another matrix.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | matrix | Source matrix. |
Returns
matrix
This matrix.
Call Signature
set(
i: vector,
j: vector,
k: vector,
c: vector): matrix;Set basis and translation vectors.
Parameters
| Parameter | Type | Description |
|---|---|---|
i | vector | X basis vector. |
j | vector | Y basis vector. |
k | vector | Z basis vector. |
c | vector | Translation vector. |
Returns
matrix
This matrix.
setHPB()
setHPB(
heading: number,
pitch: number,
bank: number): matrix;Set rotation from heading, pitch, and bank angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
heading | number | Heading angle in radians. |
pitch | number | Pitch angle in radians. |
bank | number | Bank angle in radians. |
Returns
matrix
This matrix.
setXYZ()
setXYZ(
x: number,
y: number,
z: number): matrix;Set rotation from XYZ Euler angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | X rotation in radians. |
y | number | Y rotation in radians. |
z | number | Z rotation in radians. |
Returns
matrix
This matrix.
setXYZi()
setXYZi(
x: number,
y: number,
z: number): matrix;Set inverse XYZ rotation from Euler angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | X rotation in radians. |
y | number | Y rotation in radians. |
z | number | Z rotation in radians. |
Returns
matrix
This matrix.
Properties
_14_
_14_: number;First row fourth component.
_24_
_24_: number;Second row fourth component.
_34_
_34_: number;Third row fourth component.
_44_
_44_: number;Fourth row fourth component.
c
c: vector;Translation vector.
i
i: vector;X basis vector.
j
j: vector;Y basis vector.
k
k: vector;Z basis vector.