cf_orthonormal_basis¶
Category: math
GitHub: cute_math3d.h
Builds two unit vectors perpendicular to n and to each other.
| Parameters | Description |
|---|---|
n |
The third axis of the basis. Should be unit length. |
x_out |
Written with the first perpendicular axis. |
y_out |
Written with the second perpendicular axis. |
Remarks¶
(x, y, n) form a right-handed orthonormal basis: cross(x, y) == n. Branchless
and stable for every unit n (the Duff et al. method). The tangents are arbitrary
but deterministic -- right for sampling disks and cones around a normal, spawning
particles off a surface, or framing a camera ribbon; wrong for mesh tangent spaces,
which must come from UVs.