CGAL 6.0.1 - 2D Polygon Repair
Loading...
Searching...
No Matches
Polygon_repair/repair_polygon_2.cpp
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_repair/repair.h>
#include <CGAL/IO/WKT.h>
using Polygon_2 = CGAL::Polygon_2<Kernel>;
using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2<Kernel>;
using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2<Kernel>;
int main() {
std::ifstream in("data/bridge-edge.wkt");
Polygon_with_holes_2 pin;
Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin);
if (mp.number_of_polygons_with_holes() > 1) {
} else {
CGAL::IO::write_polygon_WKT(std::cout, mp.polygons_with_holes()[0]);
}
return 0;
}
Multipolygon_with_holes_2< Kernel, Container > repair(const Polygon_2< Kernel, Container > &p, Rule=Rule())
repairs polygon p using the given rule
Definition: repair.h:46
bool read_polygon_WKT(std::istream &in, Polygon &polygon)
std::ostream & write_polygon_WKT(std::ostream &out, const Polygon &poly)
std::ostream & write_multi_polygon_WKT(std::ostream &out, MultiPolygon &polygons)