runggu

08-08-2002, 09:19 AM

Hello!

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

View Full Version : How to triangulate.

runggu

08-08-2002, 09:19 AM

Hello!

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

nickels

08-08-2002, 09:26 AM

I have had great luck with the GPC (Generic Polygon Clipping) library. I believe it also does triangulation. Why code something like this when you can just use the code?

http://www.cs.man.ac.uk/aig/staff/alan/software//index.html

http://www.cs.man.ac.uk/aig/staff/alan/software//index.html

nexusone

08-08-2002, 11:45 AM

You need help drawning more then one triangle?

Not sure what you are asking for.

Originally posted by runggu:

Hello!

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

Not sure what you are asking for.

Originally posted by runggu:

Hello!

I'm having polygon with > 3 vertexes, How could i make it bunch of triangles?

edotorpedo

08-08-2002, 12:39 PM

One (not optimal) way which always works:

Create a new vertex in the middle of all vertices. Draw all triangles using 2 neighbouring vertices and the middle vertex.

What you can also do is choose one vertex of the polygon as the *central* vertex, and draw using 2 adjacent vertices and the chosen vertex

Create a new vertex in the middle of all vertices. Draw all triangles using 2 neighbouring vertices and the middle vertex.

What you can also do is choose one vertex of the polygon as the *central* vertex, and draw using 2 adjacent vertices and the chosen vertex

runggu

08-09-2002, 01:30 AM

I know how to draw more than one triangle, i just want to know how to complex polygon to bunch of simple ones.

edotorpedo: That doesn't work with reaally complex polygons(like shape of G)

edotorpedo: That doesn't work with reaally complex polygons(like shape of G)

Niftybitz

08-09-2002, 03:31 AM

Use a tesselation object. It's made for just that cause: tesselation is triangulation.

Go look for gluNewTess() in the SDK

Ciao,

Niftybitz.

Go look for gluNewTess() in the SDK

Ciao,

Niftybitz.

rixed

08-09-2002, 05:10 AM

this is a classical computational geometry problem. look for "polygon triangulation" on google.

The basic idea of the common algorithm is to make trapezoids with your polygon, then cuting trapezoids accordingly (cut it in half anywhere if all its vertices are convex, otherwise cut it at the non-convex vertex). This works, providing your polygon is "simple" enougth (the G shape is).

The basic idea of the common algorithm is to make trapezoids with your polygon, then cuting trapezoids accordingly (cut it in half anywhere if all its vertices are convex, otherwise cut it at the non-convex vertex). This works, providing your polygon is "simple" enougth (the G shape is).

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.