Skip to content

Documentation / @ripl/3d / mat4TransformPoint

Function: mat4TransformPoint() ​

mat4TransformPoint(m, v): Vector3

Defined in: 3d/src/math/matrix.ts:384

Transforms a 3D point by a 4×4 matrix, performing the perspective divide.

There is deliberately no near-plane clipping: a point behind the eye has w < 0 and comes back mirrored through the origin, and a point on the eye plane (w === 0) is returned undivided. Clipping is a rasteriser's job — the GPU backend does it in hardware — and doing it here would mean returning something other than a point. The CPU painter's renderer therefore draws geometry straddling the camera inside-out; keep the near plane in front of the scene.

Parameters ​

ParameterType
mMatrix4
vVector3

Returns ​

Vector3