Crate delaunator

source ·
Expand description

A very fast 2D Delaunay Triangulation library for Rust. A port of Delaunator.

§Example

use delaunator::{Point, triangulate};

let points = vec![
    Point { x: 0., y: 0. },
    Point { x: 1., y: 0. },
    Point { x: 1., y: 1. },
    Point { x: 0., y: 1. },
];

let result = triangulate(&points).expect("No triangulation exists.");
println!("{:?}", result.triangles); // [0, 2, 1, 0, 3, 2]

Structs§

  • Represents a 2D point in the input vector.
  • Result of the Delaunay triangulation.

Constants§

  • Represents the area outside of the triangulation. Halfedges on the convex hull (which don’t have an adjacent halfedge) will have this value.
  • Near-duplicate points (where both x and y only differ within this value) will not be included in the triangulation for robustness.

Functions§

  • Next halfedge in a triangle.
  • Previous halfedge in a triangle.
  • Triangulate a set of 2D points. Returns None if no triangulation exists for the input (e.g. all points are collinear).