Function geometry::wrap_angle

source ·
pub fn wrap_angle(angle: f64) -> f64
Expand description

Wraps the given angle to the interval [0, 360) degrees.

§Examples

use geometry::wrap_angle;

assert_eq!(wrap_angle(10.), 10.);
assert_eq!(wrap_angle(-10.), 350.);
assert_eq!(wrap_angle(-740.), 340.);
assert_eq!(wrap_angle(-359.), 1.);
assert_eq!(wrap_angle(-1.), 359.);
assert_eq!(wrap_angle(725.), 5.);
assert_eq!(wrap_angle(360.), 0.);
assert_eq!(wrap_angle(-360.), 0.);