Ear-clip one simple planar polygon into triangle index triples.
Each pass clips the best-scoring remaining corner: a reflex or straight
corner scores below a convex corner whose triangle still covers another
remaining corner, which scores below a true ear, and among ears the one with
the largest turn, the fattest, wins, with ties going to the earliest
position. Scoring rather than searching for an ear means some corner is
always best, so every pass makes progress.
Throws an Error for fewer than three corners, and with the
autoMoviePlanarRegionFailure message for a ring that is not one
unambiguous region, because a triangle of undefined or crossing corners
would put a face of nothing into a drawing.
The ring is walked counter-clockwise whichever way it was authored, so a
clockwise outline triangulates as its own region rather than clipping its
reflex corners as ears.
Ear-clip one simple planar polygon into triangle index triples.
Each pass clips the best-scoring remaining corner: a reflex or straight corner scores below a convex corner whose triangle still covers another remaining corner, which scores below a true ear, and among ears the one with the largest turn, the fattest, wins, with ties going to the earliest position. Scoring rather than searching for an ear means some corner is always best, so every pass makes progress.
Throws an
Errorfor fewer than three corners, and with the autoMoviePlanarRegionFailure message for a ring that is not one unambiguous region, because a triangle of undefined or crossing corners would put a face of nothing into a drawing.The ring is walked counter-clockwise whichever way it was authored, so a clockwise outline triangulates as its own region rather than clipping its reflex corners as ears.