Here's a riddle for you. You have a polygon composed of exactly 4 vertices, call them v1, v2, v3, v4. They are given in any random order. How would you split these vertices into two sets, each defining a triangle, such that both triangles make up the polygon without overlap.
The result should look like this:
Triangle 1: v1, v2, v3 Triangle 2: v2, v3, v4
... the trick is, the triangles can't overlap, and those points are given in any order, without any indication of their x,y coordinates. Is this even possible? If not, please suggest the best way to triangularize a 4-point polygon whose coordinates ARE known. I'm looking for an efficient loop.