Define an ear to be a corner of a polygon that sticks out. More rigorously, three adjacent vertices form an ear if the angle they form is convex and the triangle they form does not contain any of the polygon's other points. It can be shown that any polygon with more than three points has at least two ears.
The method used by this program is:
Do While (# vertices > 3)
Find an ear.
Add the ear to the triangle list.
Remove the ear's middle vertex from the polygon.
Loop
Make a triangle from the 3 remaining vertices.
For a nice, detailed explanation of this method, see Ian Garton's Web page
For more information on graphics in Visual Basic, see my book Visual Basic Graphics Programming.
|