Skip to main content

Module polygon_triangulate

Module polygon_triangulate 

Source
Expand description

2-D ear-clipping triangulation of a simple polygon with holes.

Used to rasterize trimmed faces (faces with more than one edge_loop): such faces are planar/affine in this codebase, so triangulating the (u, v) outer-loop-minus-holes polygon and mapping each triangle through surface.eval_at gives an exact 3-D triangulation.

Functionsยง

polygon_signed_area
Signed area of poly (positive for CCW, negative for CW).
triangulate_with_holes
Triangulate outer (a simple polygon) minus holes (simple polygons strictly inside outer and disjoint from each other), returning triangles as (a, b, c) vertex triples.