I'm not sure about writing an algorithm for this, but it's entirely possible to do this for any convex polygon on a piece of paper. For each vertex, project a line vertically or horizontally from that vertex until it meets the other of these vertical or horizontal lines. For vertices with small angle changes, where the adjacent sides move in the same direction in terms of x and y, you will need to add two lines from the vertex, one horizontal and one virtual. Once you do this, you should stay with the polygon in the center of the polygon, but with sides that are vertical or horizontal, because the sides were formed by lines made from the vertices of the original polygon. Since these sides are vertical or horizontal,this shape can be easily divided into several triangles with one horizontal side, one vertical side and one hypotenuse.