superahoy
07-07-2004, 08:29 AM
I am trying to merge overlapping polygons into a single polygon to be rendered as a GL_LINE_LOOP, so really an outline of the merged polygons.
The polygons are simple, may be convex or concave, and are 2D.
I am currently using the glu tesselator to try and do this. I have set the glu properties and rules to
glu.gluTessProperty(tesselator,
glu.GLU_TESS_BOUNDARY_ONLY,
1.0);
glu.gluTessProperty(tesselator,
glu.GLU_TESS_WINDING_RULE,
glu.GLU_TESS_WINDING_NONZERO);
I start the polygon, render the first polygon as a contour, then render the second polygon as another contour, then end the polygon.
The glu tesselator gives a close answer, but some vertices will randomly go way off in either the x or y direction. If anyone has any ideas how to fix this or knows of a general polygon merging algorithm, I would greatly appreciate it.
This link shows what I am trying to do.
http://www.linkcad.com/site/tools/merge
The polygons are simple, may be convex or concave, and are 2D.
I am currently using the glu tesselator to try and do this. I have set the glu properties and rules to
glu.gluTessProperty(tesselator,
glu.GLU_TESS_BOUNDARY_ONLY,
1.0);
glu.gluTessProperty(tesselator,
glu.GLU_TESS_WINDING_RULE,
glu.GLU_TESS_WINDING_NONZERO);
I start the polygon, render the first polygon as a contour, then render the second polygon as another contour, then end the polygon.
The glu tesselator gives a close answer, but some vertices will randomly go way off in either the x or y direction. If anyone has any ideas how to fix this or knows of a general polygon merging algorithm, I would greatly appreciate it.
This link shows what I am trying to do.
http://www.linkcad.com/site/tools/merge