# Tesselation of Mono Connected Non Convex Polygon

, 6 Feb 2002 CPOL
 Rate this:
Tesselation of mono connected non convex polygon

## Introduction

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.

## History

• 6th February, 2002: Initial post

## Share

United States
No Biography provided

 First Prev Next
 cut object in slicing joy_nim 24-Feb-06 7:01
 Possible error and fix GregDude 21-Jul-05 16:34
 Robust tesselation Skavenger 1-Jul-05 23:04
 Re: Robust tesselation [modified] Liu Guoping 9-Aug-06 16:51
 Re: Robust tesselation Skavenger3 10-Aug-06 2:42
 Problem in CPolyTri::ComputeNormal Torsten B 8-Jun-04 2:43
 Re: Problem in CPolyTri::ComputeNormal Sebastien Maraux 13-Dec-04 4:52
 Re: Problem in CPolyTri::ComputeNormal Sébastien Maraux 14-Dec-04 0:45
 Good Article mchapman1234 22-May-04 12:50
 Found an index range error in code TruePyroman 23-Feb-03 15:38
 Thank you very much for this example! It's the simple and best tesselation algorithm I found over the internet!   I found a special case that pop-up an index range error (very hard to find!!! ) in the Triangulate function.   The "k" index missed 2 hits because it starts at k=2... So I did a little patch!   New loop: `for( int i=0 , j=1 , k=2 ; k < nVertex+3 ; )` New indexes: ```int ib = i % nVertex; int jb = j % nVertex; int kb = k % nVertex;```   Here is the modified function:   ```// BEGIN int nTriangle= 0; int nVertex = nCount; // AllocIndex(nCount); // bool bNoErrors = true; // while( nVertex > 3 && bNoErrors ) { // // tri to remove one vertex... // bNoErrors = false; // for( int i=0 , j=1 , k=2 ; k < nVertex+3 ; ) { if( nVertex == 0 ) break;   int ib = i % nVertex; int jb = j % nVertex; int kb = k % nVertex;   // switch( TriangleArea(points, m_nIndex[ib], m_nIndex[jb], m_nIndex[kb], normal) ) { // // ok. flush face && remove vertex j // case convex : // // Testing containement // if( IsAnyPointInside(points,ib,jb,kb,nVertex) ){ // // go ahead.. // i = j; j = k; k++; } else { nTriangle++; AddFace(points,m_nIndex[ib],m_nIndex[jb],m_nIndex[kb]); // // remove vertex j // nVertex = RemoveVertex(jb, nVertex); bNoErrors= true; } break; case concave : // // go ahead.. // i = j; j = k; k++; break; case degenerate : // // remove vertex j // nVertex = RemoveVertex(jb, nVertex); bNoErrors= true; break; } } } return nTriangle;   // END```   TruePyroman
 Re: Found an index range error in code topus 10-Apr-03 3:46
 Better tesselation jeckle 8-Feb-02 10:00
 Re: Better tesselation pepito 10-Feb-02 23:05
 Re: Better tesselation jeckle 11-Feb-02 11:46
 Re: Better tesselation Rick York 11-Feb-02 11:53
 Better tesselation Tim Aidley 8-Feb-02 3:45
 Re: Better tesselation kilowatt 8-Feb-02 9:21
 Re: Better tesselation pepito sbarzeguti 10-Feb-02 23:03
 Guareschiano anche tu? Anonymous 7-Feb-02 22:19
 Re: Guareschiano anche tu? Dieter Hammer 8-Feb-02 1:04
 Re: Guareschiano anche tu? pepito 8-Feb-02 2:38
 Re: Guareschiano anche tu? Anonymous 10-Feb-02 23:37
 Very poor article on very interesting subject... George 7-Feb-02 15:25
 Re: Very poor article on very interesting subject... Pepito Sbarzeguti 7-Feb-02 22:46
 Re: Very poor article on very interesting subject... Anonymous 7-Feb-02 22:47
 Re: Very poor article on very interesting subject... Anonymous 10-Feb-02 0:26
 Re: Very poor article on very interesting subject... George 10-Feb-02 0:53
 Re: Very poor article on very interesting subject... Mazdak 10-Feb-02 2:02
 Re: Very poor article on very interesting subject... Anonymous 10-Feb-02 16:33
 Re: Very poor article on very interesting subject... Nish [BusterBoy] 10-Feb-02 17:32
 Is the artical "fill in the blank"? Jason De Arte 7-Feb-02 14:57
 Re: Is the artical "fill in the blank"? Nish [BusterBoy] 8-Feb-02 0:13
 Why? Anonymous 7-Feb-02 12:24
 Re: Why? asim_u 7-Feb-02 12:57
 Re: Why? Josh Knox 8-Feb-02 6:48
 Re: Why? Anonymous 8-Aug-02 8:55
 Re: Why? Gernot 20-Aug-02 3:09
 Last Visit: 31-Dec-99 19:00     Last Update: 30-Mar-15 10:17 Refresh 1