[][src]Function simplicity::in_sphere

pub fn in_sphere<T: ?Sized>(
    list: &T,
    index_fn: impl Fn(&T, usize) -> Vector3<f64> + Clone,
    i: usize,
    j: usize,
    k: usize,
    l: usize,
    m: usize
) -> bool

Returns whether the last point is inside the sphere that goes through the first 4 points after perturbing them.

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

Example

let points = vec![
    Vector3::new(0.0, 0.0, 0.0),
    Vector3::new(4.0, 0.0, 0.0),
    Vector3::new(0.0, 4.0, 0.0),
    Vector3::new(0.0, 0.0, 4.0),
    Vector3::new(1.0, 1.0, 1.0),
];
let inside = in_sphere(&points, |l, i| l[i], 0, 2, 3, 1, 4);
assert!(inside);
let inside = in_sphere(&points, |l, i| l[i], 2, 3, 1, 4, 0);
assert!(!inside);