Maths · type

Frustum

The six planes bounding what a camera can see, and whether a sphere is among them.

Explained in Coordinates and units.

type Frustum = Float32Array
import type { Frustum } from '@driftengine/core';

In depth

A Float32Array(24) rather than six objects, for the reason every hot path in this engine gives: a visibility test runs per draw per frame, and an array of plane objects is six dereferences a test and an allocation per rebuild.

Planes are stored as (nx, ny, nz, d) with the normal pointing inwards, so a point is inside the frustum when n · p + d >= 0 for all six.