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.
- Triangulation
Point - A two-dimensional point of generic precision, which implements the
Point
trait.
Enums§
- Triangulate
Error - 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.