Function simplicity::in_sphere[][src]

pub fn in_sphere<T: ?Sized, Idx: Ord + Copy>(
    list: &T,
    index_fn: impl Fn(&T, Idx) -> Vector3<f64> + Clone,
    i: Idx,
    j: Idx,
    k: Idx,
    l: Idx,
    m: Idx
) -> 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, 1, 3, 4);
assert!(inside);
let inside = in_sphere(&points, |l, i| l[i], 2, 3, 1, 4, 0);
assert!(!inside);