wrap_to_360

Function wrap_to_360 

Source
pub fn wrap_to_360<T>(angle: T) -> T
Expand description

Wrap an angle to the range 0 to 360 degrees

This function is generic and can be used with any type that implements the necessary traits.

§Arguments

  • angle - The angle to be wrapped, which can be of any type that implements the necessary traits.

§Returns

  • The wrapped angle, which will be in the range 0 to 360 degrees.

§Example

use strapdown::wrap_to_360;
let angle = 370.0;
let wrapped_angle = wrap_to_360(angle);
assert_eq!(wrapped_angle, 10.0); // 370 degrees wrapped to 10 degrees