[][src]Function simplicity::in_circle

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 circle that goes through the first 3 points after perturbing them.

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

Warning

As this currently uses the cheap trick from the paper of perturbing the lifted point (p.x, p.y, p.x^2 + p.y^2) for each point p, this function is incompatible with orient_2d.

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, 2, 3, 1);
assert!(inside);
let inside = in_circle(&points, |l, i| l[i], 2, 3, 1, 4);
assert!(!inside);