Crate delaunator[][src]

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

Point

Represents a 2D point in the input vector.

Triangulation

Result of the Delaunay triangulation.

Constants

EMPTY

Represents the area outside of the triangulation. Halfedges on the convex hull (which don't have an adjacent halfedge) will have this value.

EPSILON

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

Next halfedge in a triangle.

prev_halfedge

Previous halfedge in a triangle.

triangulate

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