Expand description
The earclip module is a tool to convert 2D and 3D polygons into a triangle mesh designed to be
fast, efficient, and sphere capable.
Basic usage:
use earclip::earclip;
let polygon = vec![vec![vec![0.0, 0.0, 0.0], vec![1.0, 0.0, 0.0], vec![0.0, 1.0, 0.0]]];
let (vertices, indices) = earclip::<f64, usize>(&polygon, None, None);
assert_eq!(vertices, vec![0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0]);
assert_eq!(indices, vec![1, 2, 0]);Re-exports§
pub use earcut::earcut;pub use earcut::signed_area;
Modules§
- The
earcutmodule
Traits§
- Index of a vertex
- A trait that must be implemented by any type that wants to represent a 2D point
- A trait that must be implemented by any type that wants to represent a 3D point
Functions§
- Convert a structure into a 2d vector array
- Convert a structure into a 3d vector array
- Returns a percentage difference between the polygon area and its triangulation area; used to verify correctness of triangulation
- An earcut polygon generator with tesselation support
- Flattens a 2D or 3D array whether its a flat point ([x, y, z]) or object ({ x, y, z })
- Tesselates the flattened polygon