Function ang::mean_angle [] [src]

pub fn mean_angle<'a, T, I>(angles: I) -> Angle<T> where
    T: 'a + Float,
    I: IntoIterator<Item = &'a Angle<T>>, 

Compute the approximate mean of a list of angles by averaging the Cartesian coordinates of the angles on the unit circle. Return the normalized angle.

Examples

let angles = [Degrees(270.0f64), Degrees(360.0), Degrees(90.0)];

let mu = mean_angle(&angles);
assert!(mu.min_dist(Radians(0.0)).in_radians() < 1.0e-10);