This powerful function will break apart a convex or concave polygon into triangles. It depends on three other functions: is_clockwise(), lines_intersect() and point_in_triangle().