def triangulate(poly):
    triangles = []
    remaining = poly[:]
    # while the poly still needs clipping
    while len(remaining) > 2:
        # rotate the list:
        # this stops the starting point from getting stale which sometimes 
        # a "fan" of polys, which often leads to poor convexisation
        remaining = remaining[1:]+remaining[:1]
        # clip the ear, store it
        ear, remaining = _get_ear(remaining)
        if ear != []:
            triangles.append(ear)
    # return stored triangles
    return triangles
Triangulates poly and returns a list of triangles
dataset/ETHPy150Open estevaofon/angry-birds-python/pymunk-4.0.0/pymunk/util.py/triangulate