"ear" triangles are cut of the polygon until a convex polygon is achived. those remains are not decomposed further as convex polygons can be rendered directly to triangles.
dirty: as the operation relies on clockwise vertex ordering, the given 3d polygon verticies are projected onto an abitrary chosen 2d skew plane. so on rare occassion the polygon is perpendicular to this plane thus resulting in an useless collapsed 1d projection, which means the whole polygon is returned untouched. however, the plane is chosen to ensure safe operation for polys in base axes aligned planes.