Skip to main content

Function: unitPerpendicularTo()

unitPerpendicularTo(n, eps): Vector3Tuple

Defined in: utils/vectors.ts:131

Return a unit vector perpendicular to n.

Picked by Gram–Schmidt against whichever world basis vector has the smallest |dot(n, e_i)|, then normalized. This is coordinate-free in spirit — it never uses a hard "is the input close to Z?" branch — but it does pick from the world basis, so the result can change discontinuously very near a tie. Treat as "give me some perpendicular unit vector" rather than a temporally-stable frame.

Parameters

n

Vector3Tuple

eps

number = 1e-12

Returns

Vector3Tuple