[][src]Function fart_2d_geom::sort_around

pub fn sort_around<T, U>(
    pivot: TypedPoint2D<T, U>,
    points: &mut [TypedPoint2D<T, U>]
) where
    T: Copy + NumAssign + PartialOrd + Signed

Sort the given points around the given pivot point in counter-clockwise order, starting from 12 o'clock.

Example

use euclid::{point2, TypedPoint2D, UnknownUnit};
use fart_2d_geom::{center, sort_around};

let mut points: Vec<TypedPoint2D<i32, UnknownUnit>> = vec![
    point2(0, 2), point2(2, 2),
    point2(0, 0), point2(2, 0),
];

let pivot = center(&points);
sort_around(pivot, &mut points);

assert_eq!(points, vec![
    point2(0, 2),
    point2(0, 0),
    point2(2, 0),
    point2(2, 2),
]);