earcut

Function earcut 

Source
pub fn earcut(
    it: &Interner,
    ring: &[Vid],
    axis: DropAxis,
    w0: Sign,
) -> Vec<SubTri> ⓘ
Expand description

PHASE E — triangulate a simple polygon ring (oriented w0) by deterministic ear clipping. An ear is a strictly-convex corner whose triangle contains no other ring vertex; among all ears we always clip the one with the lexicographically-least APEX, so the output is a pure function of the ring (independent of where the ring starts). The two-ears theorem guarantees a simple polygon always has an ear → termination.