Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/gmath/src/matrix4.ts>Matrix4

🎮 A wasm accelerated game and graphics maths library for deno
Latest
class Matrix4
import { Matrix4 } from "https://deno.land/x/gmath@0.1.12/src/matrix4.ts";

Constructors

new
Matrix4()
new
Matrix4(ptr: number)
new
Matrix4()
new
Matrix4(
x?: Vector4 | number,
y?: Vector4,
z?: Vector4,
w?: Vector4,
)

Properties

readonly
ptr: number
[0]:
[
number,
number,
number,
number,
]
[1]:
[
number,
number,
number,
number,
]
[2]:
[
number,
number,
number,
number,
]
[3]:
[
number,
number,
number,
number,
]

Methods

add(other: Matrix4 | number): Matrix4

Creates a new Matrix4 with the same values

col(n:
| 0
| 1
| 2
| 3
):
[
number,
number,
number,
number,
]
determinant(): number
diag():
[
number,
number,
number,
number,
]
eq(other: Matrix4): boolean
invert(): Matrix4 | undefined
isFinite(): boolean
mul(other: Matrix4 | number): Matrix4
row(n:
| 0
| 1
| 2
| 3
):
[
number,
number,
number,
number,
]
sub(other: Matrix4 | number): Matrix4
toArray():
[
[
number,
number,
number,
number,
]
,
[
number,
number,
number,
number,
]
,
[
number,
number,
number,
number,
]
,
[
number,
number,
number,
number,
]
,
]
toFloat32Array(): Float32Array
trace(): number

Static Methods

from(
c0r0: number,
c0r1: number,
c0r2: number,
c0r3: number,
c1r0: number,
c1r1: number,
c1r2: number,
c1r3: number,
c2r0: number,
c2r1: number,
c2r2: number,
c2r3: number,
c3r0: number,
c3r1: number,
c3r2: number,
c3r3: number,
)

Constructs a Matrix4 from individual elements

fromNonuniformScale(
x: number,
y: number,
z: number,
): Matrix4
fromScale(scale: number): Matrix4
lookAtLh(
eye: Vector3,
center: Vector3,
up: Vector3,
): Matrix4
lookAtRh(
eye: Vector3,
center: Vector3,
up: Vector3,
): Matrix4