The example can also read in a polygon with 3D points

This commit is contained in:
Andreas Fabri 2025-09-17 15:27:23 +01:00
parent 4510260e36
commit a95bfa77c8
1 changed files with 8 additions and 4 deletions

View File

@ -1,15 +1,17 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/IO/WKT.h>
#include <iostream>
#include <fstream>
#include <vector>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K> Kernel;
int main(int argc, char* argv[])
{
typedef CGAL::Point_2<Kernel> Point;
typedef Kernel::Point_2 Point;
typedef std::vector<Point> MultiPoint;
typedef std::vector<Point> LineString;
@ -23,6 +25,7 @@ int main(int argc, char* argv[])
MultiPoint points;
MultiLineString polylines;
MultiPolygon polygons;
CGAL::IO::read_WKT(is, points,polylines,polygons);
for(Point p : points)
@ -30,8 +33,9 @@ int main(int argc, char* argv[])
for(LineString ls : polylines)
for(Point p : ls)
std::cout<<p<<std::endl;
for(Polygon p : polygons)
std::cout<<p<<std::endl;
for(Polygon p : polygons){
std::cout<<p<<std::endl;
}
}
return 0;