Skip to main content

lerp_angle

Function lerp_angle 

Source
pub fn lerp_angle<T: Real + Rem<Output = T>>(a: T, b: T, t: T) -> T
Expand description

Shortest-path angular interpolation between a and b in radians.

t = 0 returns a, t = 1 returns b. Takes the shorter arc.

ยงExamples

use mathverse_core::ops::lerp_angle;

let result = lerp_angle(0.0, core::f64::consts::PI, 0.5);
assert!((result - core::f64::consts::FRAC_PI_2).abs() < 1e-12);