Skip to main content

gram_schmidt

Function gram_schmidt 

Source
pub fn gram_schmidt(
    v0: &Vec3,
    v1: &Vec3,
    v2: &Vec3,
) -> Option<(Vec3, Vec3, Vec3)>
Expand description

Gram-Schmidt orthogonalization of three linearly-independent vectors.

Returns an orthonormal basis (e0, e1, e2) where:

  • e0 is v0 normalized,
  • e1 is v1 minus its projection onto e0, normalized,
  • e2 is v2 minus its projections onto e0 and e1, normalized.

Returns None if any intermediate vector becomes near-zero.