Expand description
The crate’s shared 3-component vector math. Every module that needs a dot, cross, or component-wise op reaches for these rather than redeclaring them.
Normalisation deliberately stays with its caller: the degenerate-input rule
differs by site (a fallback axis vs None vs a clamped length), and folding
those together would change behavior at grazing inputs.
Functions§
- add
- Component-wise sum,
a + b. - cross
- Cross product.
- dot
- Dot product.
- length
- Euclidean length.
- lerp
- Component-wise linear interpolation from
atob. - scale
- Every component scaled by
s. - sub
- Component-wise difference,
a - b. - vec3_
add - Accumulate
srcintodstin place. Used by the smooth-normal passes, which sum every incident face normal per vertex before normalising once. - vec3_
face_ normal - Newell-style face normal from three CCW positions. Shared with the cook generators’ smooth-normal pass.
- vec3_
normalise - Unit-length
n, falling back to+Ywhen it is too short to have a direction.