Function simplicity::in_circle[][src]

pub fn in_circle<T: ?Sized, Idx: Ord + Copy>(
    list: &T,
    index_fn: impl Fn(&T, Idx) -> Vector2<f64> + Clone,
    i: Idx,
    j: Idx,
    k: Idx,
    l: Idx
) -> bool

Returns whether the last point is inside the oriented circle that goes through the first 3 points after perturbing them. The first 3 points should be oriented positive or the result will be flipped.

Takes a list of all the points in consideration, an indexing function, and 4 indexes to the points to calculate the in-circle of.

Example

let points = vec![
    Vector2::new(0.0, 2.0),
    Vector2::new(1.0, 1.0),
    Vector2::new(2.0, 1.0),
    Vector2::new(0.0, 0.0),
    Vector2::new(2.0, 3.0),
];
let inside = in_circle(&points, |l, i| l[i], 0, 3, 2, 1);
assert!(inside);
let inside = in_circle(&points, |l, i| l[i], 2, 1, 3, 4);
assert!(!inside);