Crate rtriangulate

Source
Expand description

A Rust implementation of the Delaunay triangulation algorithm presented by Paul Bourke.

§Usage

Add the rtriangulate dependency to Cargo.toml:

[dependencies]
rtriangulate = "0.3"

And use the crate as such:

extern crate rtriangulate;

use rtriangulate::{TriangulationPoint, Triangle, triangulate};

// A list of points (which has to be sorted on x).
let points = [
    TriangulationPoint::new(10.0, 50.0),
    TriangulationPoint::new(25.0, 40.0),
    TriangulationPoint::new(30.0, 40.0)
];
let triangles = triangulate(&points).unwrap();

assert_eq!(triangles, [Triangle(1, 0, 2)]);

Structs§

Edge
An edge, represented by indexes into a list of points.
Triangle
A triangle, represented by indexes into a list of points.
TriangulationPoint
A two-dimensional point of generic precision, which implements the Point trait.

Enums§

TriangulateError
Possible triangulation errors.

Traits§

Point
A trait for two-dimensional points.

Functions§

sort_points
A utility function to sort points.
triangulate
Generate the Delaunay triangulation of given set of points.

Type Aliases§

Result