PDA

View Full Version : Does anyone know how to draw concave polygons quickly?



Andyxia
06-27-2002, 06:43 PM
Does anyone know how to draw concave polygons quickly? I mean that I just have a list of vertexes, but I don't know if it is a simple polygon or not. And perhaps there are one or more holes in it. You know, OpenGL could not do it automatically. Could you tell me what shall I do? GlUT or other ways?

V-man
06-27-2002, 07:07 PM
There is the GLU tesselator, unless you have something against that.

It is slow, just like many tesselators.

Do you have a dynamic object?

V-man

Andyxia
06-27-2002, 07:31 PM
Yes. The vertex can be added or remove dynamic

ChrisBond
06-28-2002, 07:02 AM
A method for managing concave polygons with holes is given in:

Ferguson, Stuart "Practical Algorithms for 3D Computer Graphics"
Chapter 7.2 (p 254): "Triangulating Polygons With Holes"

BTW, am I wrong in thinking that that the glu tesselator only handles convex polygons?

-Chris Bond

Michael Steinberg
06-28-2002, 07:26 AM
Remarks
The gluTessBeginPolygon and gluTessEndPolygon functions delimit the definition of a nonconvex polygon. Within each gluTessBeginPolygon/gluTessEndPolygon pair, include one or more calls to gluTessBeginContour/gluTessEndContour. Within each contour, there are zero or more calls to gluTessVertex. The vertices specify a closed contour (the last vertex of each contour is automatically linked to the first).

chief
06-28-2002, 08:52 AM
Try this (the example is 2D but work fine in 3D also...) http://www.codeproject.com/useritems/polygon_tesselation.asp