#include #include #include #include #include #include using ggl::assign; using ggl::correct; using ggl::dsv; using ggl::polygon_2d; using ggl::multi_polygon; using ggl::union_inserter; using std::cout; typedef multi_polygon polygon_set; int main() { polygon_2d poly1; { const double coor[][2] = { {0.0, 0.0}, {0.0, 2.0}, {2.0, 2.0}, {2.0, 0.0}, {0.0, 0.0} }; assign(poly1, coor); } polygon_2d poly2; { const double coor[][2] = { {0.5, 1.5}, {0.5, 2.5}, {1.5, 2.5}, {1.5, 1.5}, {0.5, 1.5} }; assign(poly2, coor); } cout << "poly1: " << dsv(poly1) << "\n"; cout << "poly2: " << dsv(poly2) << "\n"; polygon_set ps1; union_inserter(poly1, poly2, std::back_inserter(ps1)); cout << "poly1|poly2:\n"; for (polygon_set::const_iterator it = ps1.begin(); it != ps1.end(); ++it) cout << dsv(*it) << "\n"; return EXIT_SUCCESS; }