Skip to main content

basis_for

Function basis_for 

Source
pub fn basis_for(dir: DVec3) -> (DVec3, DVec3)
Expand description

Two unit vectors completing an orthonormal frame with dir.

dir must be normalised. The helper axis is chosen by which component of dir is small, which keeps the cross product well conditioned — picking a fixed helper would give a near-zero cross product whenever dir happened to be parallel to it, and the resulting basis would be numerical noise.