Function recoil_velocity
pub fn recoil_velocity(
projectile_mass: f64,
projectile_velocity: f64,
body_mass: f64,
) -> Option<f64>Expand description
Computes recoil velocity assuming the initial total momentum is zero.
Uses v_recoil = -(projectile_mass * projectile_velocity) / body_mass.
Returns None when projectile_mass is negative, when body_mass is less than or equal to
zero, when any input is not finite, or when the computed recoil velocity is not finite.
ยงExamples
use use_momentum::recoil_velocity;
assert_eq!(recoil_velocity(1.0, 10.0, 5.0), Some(-2.0));