Skip to main content

try_normalize_and_get_length

Function try_normalize_and_get_length 

Source
pub fn try_normalize_and_get_length(
    v: Vector,
    threshold: f32,
) -> Option<(Vector, f32)>
Expand description

Try to normalize a vector and return both the normalized vector and the original length.

Returns None if the vector’s length is below the threshold. This is the glam equivalent of nalgebra’s Unit::try_new_and_get.