Wednesday, 1 July 2009

Triangulation of complex polygons

The topographical data provided in the form of complex polygons, some of which have as many as two thousand vertices. Unfortunately OpenGL does not like this kind of data, preferring instead to display the closest possible convex polygon, so triangulation is necessary.

By starting at one end of a polygon and recursively clipping "ear" triangles (that is, triangles which have at least two edges on the outside of the polygon) we can convert a complex polygon into a set of triangles.


This also means that rendering will be much faster, submitting an array of triangles instead of one large polygon and expecting OpenGL to do all the work.

No comments:

Post a Comment