Friday, July 17, 2009

CGAL: Curves, Faces and Caution

In CGAL, the general polygon set code, which lets you do boolean operations on polygons (e.g. cut this polygon out of that polygon) has an arrangement (a planar map) inside it doing the real work.

You can get access to this arrangement and manipulate it directly, or do other "clever" things.

But one thing you might not want to do is to build the arrangement out of curves, and then attempt to pull the polygons out.

It seems like it should be a good idea...but it's not. The problem is that the "exporter" - the code that gives you back your polygons from the underlying arrangement (after you have processed the arrangement) assumes that each inserted curve runs in the direction of the contour of the polygon that created it.

If you don't do this (for example, you insert intersecting curves) the exporter will return hosed polygon contours.

No comments:

Post a Comment