Function coefficient_of_restitution
pub fn coefficient_of_restitution(
approach_speed: f64,
separation_speed: f64,
) -> Option<f64>Expand description
Computes the coefficient of restitution from approach and separation speeds.
Formula: e = separation_speed / approach_speed
Returns None when approach_speed is less than or equal to zero, when
separation_speed is negative, when any input is not finite, when the computed value is not
finite, or when the result is greater than 1.0.
ยงExamples
use use_collision::coefficient_of_restitution;
assert_eq!(coefficient_of_restitution(10.0, 8.0), Some(0.8));
assert_eq!(coefficient_of_restitution(10.0, 0.0), Some(0.0));