Geometry · function

transformSolid

solid moved by a column-major 4×4 model matrix.

Explained in Hello world, Meshes and geometry.

function transformSolid(solid: Solid, model: ArrayLike<number>): Solid
import { transformSolid } from '@driftengine/core';

Parameters

ParameterTypeDescription
solidSolid
modelArrayLike<number>

In depth

Normals go through the inverse transpose of the upper 3×3, then are renormalised. Rotating them by the matrix itself is right only for rotations and uniform scales; under a non-uniform one — a unit cylinder scaled to a post, a sphere to an ellipsoid — it leaves every normal leaning toward the stretched axis, and the surface is lit as if it faced somewhere else, which reads as a shading bug rather than a maths one.

A mirror reverses the winding, because a negative determinant turns every triangle inside out; without the reversal a mirrored solid is culled from outside and its volume goes negative.