Subject: CGAL users discussion list
List archive
- From: xoru <>
- To: "" <>
- Subject: [cgal-discuss] Union one (or more) Polygon with holes (or not )
- Date: Mon, 13 Nov 2017 17:25:17 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:3HrXERGROMT18wL8JMDYpJ1GYnF86YWxBRYc798ds5kLTJ76oMywAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TXhpQIVT1/0OgNxY+j0AYXPlN+f1uao+pSVbR8CzG62brp2aRm3tg7MrdI+gI14K693xAGf8VVSfOED1WRyOBrHjxHm+++3+pN/tTxU7aFyv/VcWLn3KvxrBYdTCy4rZjg4
I'm beginer with cgal. I need add 2 boxes and get one rectangles (created from 4 points).
My objects 2d are polygons with holes or not. I dont know how setting 'empty' holes list.
How I must writing this code correctly?
My objects 2d are polygons with holes or not. I dont know how setting 'empty' holes list.
How I must writing this code correctly?
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
typedef std::list<Polygon_with_holes_2> Pwh_list_2;
#include "print_utils.h"
int main ()
{
Polygon_2 outP;
Polygon_2 holesP[1];
outP.push_back (Point_2 (0, 0));
outP.push_back (Point_2 (1, 0));
outP.push_back (Point_2 (1, 1));
outP.push_back (Point_2 (0, 1));
Polygon_with_holes_2 P (outP, holesP, holesP + 1);
Polygon_2 outQ;
Polygon_2 holesQ[1];
outQ.push_back (Point_2 (1, 0));
outQ.push_back (Point_2 (2, 0));
outQ.push_back (Point_2 (2, 1));
outQ.push_back (Point_2 (1, 1));
/* without holes */
Polygon_with_holes_2 Q (outQ, holesQ, holesQ + 1);
std::cout << "Q = "; print_polygon_with_holes (Q);
// How check orientation, simple etc. I dont know the orientation is good
// if(P.is_simple){ std::cout << "P is simple.\n"; }
Polygon_with_holes_2 unionR;
if (CGAL::join (P, Q, unionR))
{
print_polygon_with_holes (unionR);
}
else
{
/* how add P and Q (union P and Q) */
}
return 0;
}
Thanks
Marek
- [cgal-discuss] Union one (or more) Polygon with holes (or not ), xoru, 11/13/2017
- Re: [cgal-discuss] Union one (or more) Polygon with holes (or not ), Efi Fogel, 11/14/2017
Archive powered by MHonArc 2.6.18.