Search code examples
cgal

Creating General_polygon_2 from a Polyline


Since CGAL 4.3, Arr_polyline_traits_2 has the ability to reverse the direction of X_monotone_curves. Does this mean I can break up a Polyline into X_montone_curves to generate a General_Polygon_2?

In the book CGAL Arragements and their applications. I've read that you needed to use Segments, not Polylines. Is this still the case? Is the book is out of date?


Solution

  • While the book provides information that does not exist in the manual, it is already a bit out of date, at least with respect to polylines, and will get even more so when CGAL 4.7 comes out.

    With CGAL 4.6 you can create a general polygon the boundary of which comprises x-monotone polylines. This is possible due to the flexibility you mention, that is, a polyline can be directed from left to right or vise versa

    With CGAL 4.7, the next coming release, you will be able create a general polygon the boundary of which comprises x-monotone polycurve, which are piecewise curves that are not necessarily linear, such as conic arcs, circular arcs, Bezier curves, line segments, or even other polycurves.