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_float;
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_float(&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§
- earcut
- The
earcut
module
Traits§
Functions§
- deviation
- Returns a percentage difference between the polygon area and its triangulation area; used to verify correctness of triangulation
- earclip
- An earcut polygon generator with tesselation support
- earclip_
float - An earcut polygon generator with tesselation support
- flatten
- Flattens a 2D or 3D array whether its a flat point ([x, y, z]) or object ({ x, y, z })
- flatten_
float - Flattens a 2D or 3D array whether its a flat point ([x, y, z]) or object ({ x, y, z })
- tesselate
- Tesselates the flattened polygon