CGAL 6.2 - 2D Polygons

Loading...
Searching...
No Matches
Polygon/draw_multipolygon_with_holes.cpp
#include <iostream>
#include <sstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Multipolygon_with_holes_2.h>
#include <CGAL/draw_multipolygon_with_holes_2.h>
#include <CGAL/IO/WKT.h>
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2<Kernel>;
int main() {
std::string wkt = "MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0),(0.1 0.1,0.1 0.9,0.9 0.9,0.9 0.1,0.1 0.1)),((0.2 0.2,0.8 0.2,0.8 0.8,0.2 0.8,0.2 0.2),(0.3 0.3,0.3 0.7,0.7 0.7,0.7 0.3,0.3 0.3)))";
std::istringstream iss(wkt);
Multipolygon_with_holes_2 mp;
CGAL::IO::read_multi_polygon_WKT(iss, mp);
CGAL::draw(mp);
return 0;
}
CGAL::Exact_predicates_inexact_constructions_kernel
CGAL::Multipolygon_with_holes_2
The class Multipolygon_with_holes_2 models the concept MultipolygonWithHoles_2.
Definition: Multipolygon_with_holes_2.h:35
CGAL::draw
void draw(const MPH &aph)
opens a new window and draws aph, an instance of the CGAL::Multipolygon_with_holes_2 class.
CGAL::IO::read_multi_polygon_WKT
bool read_multi_polygon_WKT(std::istream &in, MultiPolygon &polygons)
Kernel