#include //CGAL definitions that need to be before anything else #include #include #include #include #include //#include //#include #include #include #include #include //#include //used for visualization. typedef CGAL::Quotient NT; //typedef leda_rational NT; typedef CGAL::Cartesian K; typedef K::Point_2 Point; typedef CGAL::Polygon_2 Polygon; typedef Polygon::Segment_2 Segment_2; typedef CGAL::Arr_segment_exact_traits Traits; using std::cin; using std::cout; using std::endl; void read_polygon(const char* filename, Polygon& polygon) { std::ifstream file(filename); unsigned int n; file >> n; int x, y; while (n--) { file >> x >> y; polygon.push_back(Point(x,y)); } file.close(); } int main(int argc, char* argv[]) { if (argc != 3) { std::cout << "usage: Segment_sweep_ovl_from_file filename\n"; exit(1); } Polygon poly1, poly2; read_polygon(argv[1],poly1); read_polygon(argv[2],poly2); Traits traits; std::list polygons; std::list curves; std::list points; CGAL::Union(poly1,poly2,traits, std::back_inserter(polygons), std::back_inserter(curves), std::back_inserter(points)); cout<<"The number of resulting polygons: "<