Click here to Skip to main content
12,760,377 members (32,593 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 6 Feb 2002

Tesselation of Mono Connected Non Convex Polygon

, 6 Feb 2002 CPOL
Rate this:
Please Sign up or sign in to vote.
Tesselation of mono connected non convex polygon

Sample Image - PolyTry.jpg


A simple alternative to OpenGL polygon tesselation callback. You can focus on file triangle.h that contain the class to evaluate convexity of polygon and tesselate the polygon. No extra points are inserted. You can work only with planar polygon also in 3D.

Every suggestion in order to speed up the class and create better tesselation ('better' triangles) is appreciated.


  • 6th February, 2002: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Peppino Sbargzeguti
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralFound an index range error in code Pin
TruePyroman23-Feb-03 15:38
memberTruePyroman23-Feb-03 15:38 
GeneralRe: Found an index range error in code Pin
topus10-Apr-03 3:46
membertopus10-Apr-03 3:46 
Another litle improvement:
Use previus code and change the line
while( nVertex > 3 && bNoErrors )
with the line
while( nVertex >= 3 && bNoErrors )
Also to solve the problem with degenerate points (alligned or sub-alligned) replace the test in function Triangle Area (that work fine for planar 2D polygon's)
// j is alligned from i to k ?
if( (-FLT_EPSILON) < m_A && m_A < FLT_EPSILON )
return degenerate;
// j is alligned from i to k ?
if( (-FLT_EPSILON) < m_A && m_A < FLT_EPSILON &&
(-FLT_EPSILON) < m_N[0] && m_N[0] < FLT_EPSILON &&
(-FLT_EPSILON) < m_N[1] && m_N[1] < FLT_EPSILON &&
(-FLT_EPSILON) < m_N[2] && m_N[2] < FLT_EPSILON )
return degenerate;
Last (but not least) if some consecutive triangles as the same origin vertex you can optimizing opengl drawing code collecting the common side (from two consecutive triangles) and using triangle fan (example triangle vertex 0,1,2 && 0,2,3 etc.. can be collected in a triangle fan 0,1,2,3 etc..)
Thanks very much for this very speedy code

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 7 Feb 2002
Article Copyright 2002 by Peppino Sbargzeguti
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid