pub fn triangulate(points: Vec<SurfacePoint>) -> Vec<[SurfacePoint; 3]> {
    use spade::Triangulation as _;

    let triangulation = spade::DelaunayTriangulation::<_>::bulk_load(points)
        .expect("Inserted invalid values into triangulation");

    let mut triangles = Vec::new();
    for triangle in triangulation.inner_faces() {
        let [v0, v1, v2] = triangle.vertices().map(|vertex| *vertex.data());

        let triangle = match corner_direction(&v0, &v1, &v2) {
            Orientation::Ccw => [v0, v1, v2],
            Orientation::Cw => [v0, v2, v1],
            Orientation::None => {
                panic!(
                    "Triangle returned from triangulation isn't actually a\
                    triangle"
                );
            }
        };

        triangles.push(triangle);
    }

    triangles
}
/// Create a Delaunay triangulation of all points
Create a Delaunay triangulation of all points
Create a Delaunay triangulation of all points
pub fn triangulate(points: Vec<SurfacePoint>) -> Vec<[SurfacePoint; 3]> {
    use spade::Triangulation as _;
    let triangulation = spade::DelaunayTriangulation::<_>::bulk_load(points)
        .expect("Inserted invalid values into triangulation");
    let mut triangles = Vec::new();
    for triangle in triangulation.inner_faces() {
        let [v0, v1, v2] = triangle.vertices().map(|vertex| *vertex.data());
        let triangle = match corner_direction(&v0, &v1, &v2) {
            Orientation::Ccw => [v0, v1, v2],
            Orientation::Cw => [v0, v2, v1],
            Orientation::None => {
                panic!(
                    "Triangle returned from triangulation isn't actually a\
                    triangle"
                );
            }
        };
        triangles.push(triangle);
    }
    triangles
}
pub fn triangulate ( points : Vec < SurfacePoint > ) -> Vec < [ SurfacePoint ; 3 ] > { use spade :: Triangulation as _ ; let triangulation = spade :: DelaunayTriangulation :: < _ > :: bulk_load ( points ) . expect ( " " ) ; let mut triangles = Vec :: new ( ) ; for triangle in triangulation . inner_faces ( ) { let [ v0 , v1 , v2 ] = triangle . vertices ( ) . map ( | vertex | * vertex . data ( ) ) ; let triangle = match corner_direction ( & v0 , & v1 , & v2 ) { Orientation :: Ccw => [ v0 , v1 , v2 ] , Orientation :: Cw => [ v0 , v2 , v1 ] , Orientation :: None => { panic ! ( " \
 " ) ; } } ; triangles . push ( triangle ) ; } triangles }
Create a Delaunay triangulation of all points
Create a Delaunay triangulation of all points
points
Vec<SurfacePoint>