First, I mean boost::polygon library, not boost::geometry library. My code is:
namespace gtl = boost::polygon;
using namespace boost::polygon::operators;
typedef gtl::polygon_90_data<int> Polygon;
typedef gtl::polygon_traits<Polygon>::point_type Point;
typedef gtl::polygon_90_set_data<int> PolygonSet;
Point pts1[] = { Point(10000, 20000), Point(12000, 20000), Point(12000, 14000), Point(10000, 14000)};
Polygon poly1;
gtl::set_points(poly1, pts1, pts1 + 4);
Point pts2[] = { Point(11500, 18000), Point(11500, 25000), Point(14000, 25000), Point(14000, 18000)};
Polygon poly2;
gtl::set_points(poly2, pts2, pts2 + 4);
PolygonSet polyset;
assign(polyset, poly1 + poly2);
I want to use the union of poly1 and poly2, it will be a polygon with 8 points. Now I have to convert the result polyset to Polygon type, but I did not find a way to do this. Anyone can tell me how can I do this?