pub fn split_triangle_at_side_corners(
t: [usize; 3],
sides: &[Vec<usize>; 3],
out: &mut Vec<usize>,
) -> boolExpand description
Triangulate a proper triangle t whose side i (from t[i] to
t[i+1]) carries the corners sides[i] in order, into proper triangles
with the same winding, appended to out as index triples.
The triangle plus its side corners is a convex polygon whose points all
lie on three lines. Collinearity is decided from which sides a point is
on, not from coordinates: t[i] is on sides i and i-1, a side
corner only on its own side, and three points are collinear exactly when
they share a side. Ears are clipped while one exists whose three points
are not collinear and whose removal leaves a polygon that is not
collinear either; clipping such an ear from a convex polygon leaves a
convex polygon, so the loop always finds the next one and ends at a
proper triangle. O(k^2) for k points, and k is small. With no
corner on any side, t itself is appended.
Returns false, leaving out as it was, when no ear exists. The side
masks this function builds itself never leave the loop without one, so it
never returns false for them: properness of t (three distinct,
non-collinear corners) is the caller’s precondition, and false reports
that it was violated. A caller then declines or keeps t unsplit; no
degenerate piece is ever emitted.