Click here to Skip to main content
Click here to Skip to main content

Tesselation of Mono Connected Non Convex Polygon

By , 6 Feb 2002
 

Sample Image - PolyTry.jpg

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

License

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
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralProblem in CPolyTri::ComputeNormal PinmemberTorsten B8 Jun '04 - 1:43 
GeneralRe: Problem in CPolyTri::ComputeNormal PinmemberSebastien Maraux13 Dec '04 - 3:52 
GeneralRe: Problem in CPolyTri::ComputeNormal PinmemberSébastien Maraux13 Dec '04 - 23:45 
Area computation is bugged :
 
you should add in CPolyTriView::OnDraw()
 
existing :
//
for( int i=0 ; i < m_nPoints ; i++ ){
points[i][0] = m_points[i].x;
points[i][1] = m_points[i].y;
if( i ) Area+= ( m_points[i].x * m_points[i-1].y - m_points[i-1].x * m_points[i].y) * 0.5f;
}
//
// added after for loop :
Area += ( m_points[0].x * m_points[i-1].y - m_points[i-1].x * m_points[0].y) * 0.5f;
 
Also, if area computation is only used for normal deduction, you can avoid *0.5f as it will not change area sign.
 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web03 | 2.6.130516.1 | Last Updated 7 Feb 2002
Article Copyright 2002 by Peppino Sbargzeguti
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid