Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleBreak a polygon into triangles in Visual Basic .NET
DescriptionThis example shows how to break a polygon into triangles in Visual Basic .NET.
Keywordstriangulate, triangle, polygon, geometry, graphics, VB.NET
CategoriesGraphics, VB.NET
 
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.

 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated