iTriangle
A fast and efficient library for Delaunay triangulation and converting complex polygons into convex shapes, including advanced self-intersection resolution.
Delaunay triangulation
Breaking into convex polygons
Features
- Delaunay Triangulation: Efficient and robust implementation for generating Delaunay triangulations.
- Convex Polygons: Break complex polygons into simpler convex polygons.
- Self-Intersection: Smart intersection resolution with Even-Odd or Non-Zero rules.
Documentation
Getting Started
Add the following to your Cargo.toml:
[dependencies]
i_triangle = "^0.25.0"
After that, represent your polygon as an array of vertices. Here's an example of a cheese polygon:
let shape = .to_vec;
let triangulation = shape.to_triangulation;
println!;
println!;
Output Triangulation: triangles indices and vertices, where all triangles oriented in a clockwise direction.