Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] how to convert from General_Polygon to

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] how to convert from General_Polygon to


Chronological Thread 
  • From:
  • To:
  • Subject: Re: [cgal-discuss] how to convert from General_Polygon to
  • Date: Mon, 04 May 2009 14:13:44 +0300

Hi,
You have 2 options.
If you want to join the polygon's into a polygon set you can use the Gps Traits functor for constructing pwh:

GeneralPolygonSetTraits_2::Construct_general_polygon_with_holes_2

which constructs a general polygon with holes from a general polygon and, optionally, a range of holes. It uses the operator
General_polygon_with_holes_2 operator() (const General_polygon_2& pgn_boundary)
or
General_polygon_with_holes_2 operator() (const General_polygon_2& pgn_boundary, HolesInputIterator h_begin, HolesInputIterator h_end)
parameterized by the HolesInputIterator type.

for instance:
typedef Traits::Construct_general_polygon_with_holes_2
Construct_general_polygon_with_holes_2;
Polygon_Set Gps;
Traits tr;
Construct_general_polygon_with_holes_2 functor =
tr.construct_polygon_with_holes_2_object ();
Polygon_with_Holes_2 pwh = functor(your_pgn);

Otherwise, simply use the PWH constructor directly:
General_polygon_with_holes_2(const General_polygon_2& pgn_boundary);

Best,

Guy

Quoting
:

Hi

I have a list of General_Polygons I want to convert to
Polygon_with_holes ,, I have tried a lot of things without luck
,,,,how to ?



I just want to Join them using

Polygon_set pgnset;

pgnset.join(ph.begin(),ph.end());

typedef below.

Best regards
kim

typedef Traits::Curve_2 Curve;
typedef Traits::X_monotone_curve_2 XCurve;
typedef Traits::Point_2 Circular_point_2;
typedef Traits::Polygon_2 Polygon_2;
typedef CGAL::General_polygon_2<Traits> General_Polygon;
typedef CGAL::General_polygon_2<Traits> P2;
typedef CGAL::General_polygon_with_holes_2<Polygon_2> Polygon_with_holes;
typedef CGAL::General_polygon_set_2<Traits> Polygon_set;
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss






Archive powered by MHonArc 2.6.16.

Top of Page