periodical

Function periodical 

Source
pub fn periodical(period: f32, x: f32) -> f32
Expand description

§Periodical

Returns value that is normalized into a given period. Allows you to easily clamp values with overflow.

The most common example would be normalizing degrees between 0 and 360.

§Examples

 let period = 360.0;
 assert_eq!(315.0, periodical(period, -45.0));
 assert_eq!(45.0, periodical(period, 45.0));
 assert_eq!(0.0, periodical(period, 360.0));
 assert_eq!(90.0, periodical(period, 450.0));