Maths · function

boxInFrustum

Whether an axis-aligned box is anywhere inside the frustum, by the same question the sphere test asks: outside only when wholly beyond one plane.

Explained in Coordinates and units.

function boxInFrustum(frustum: FrustumPlanes, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): boolean
import { boxInFrustum } from '@driftengine/core';

Parameters

ParameterTypeDescription
frustumFrustumPlanes
minXnumber
minYnumber
minZnumber
maxXnumber
maxYnumber
maxZnumber

In depth

The corner that decides it is chosen per plane — the one furthest along that plane's normal. A fixed corner answers correctly for the planes whose normals happen to point its way and culls a box straddling any of the others. Conservative at the edges, as the sphere test is: a box near a corner of the frustum can be outside it and still kept.