pub fn align_vectors(
a: &[[f64; 3]],
b: &[[f64; 3]],
weights: Option<&[f64]>,
) -> Result<Alignment, ErrorsJSL>Expand description
The rotation C minimising Σ wᵢ ‖aᵢ − C bᵢ‖² (SciPy’s Rotation.align_vectors; Wahba’s
problem). With B = Σ wᵢ aᵢ bᵢᵀ = U S Vᵀ, the answer is C = U diag(1, 1, det(UVᵀ)) Vᵀ (Kabsch’s
algorithm); the determinant correction keeps it a rotation rather than a reflection. With a
single pair, or one infinite weight, that pair (the primary) is aligned exactly by the
smallest rotation, and the remaining freedom — a rotation about the primary — best aligns
the others.