Function veloren_common::util::dir::slerp_to_unnormalized

source ·
fn slerp_to_unnormalized(
    from: Vec3<f32>,
    to: Vec3<f32>,
    factor: f32,
) -> Result<Vec3<f32>, Vec3<f32>>
Expand description

Begone ye NaN’s Slerp two Vec3s skipping the slerp if their directions are very close This avoids a case where veks slerp produces NaN’s Additionally, it avoids unnecessary calculations if they are near identical Assumes from is normalized and returns a normalized vector, but to doesn’t need to be normalized Returns Err(from)`` if to` is unnormalizable