Subject: CGAL users discussion list
List archive
- From: Efi Fogel <>
- To:
- Subject: Re: [cgal-discuss] Problem with boolean operations on Polygons.
- Date: Thu, 15 Jan 2015 10:36:51 +0200
Hi gilou_66,
It compiles and runs without a flaw.
You haven't added the complete code in your message!
You haven't mentioned which version of CGAL, os, and compiler you are using.
You haven't even mentioned your name.
Efi
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
On Wed, Jan 14, 2015 at 12:36 PM, gilou_66 <> wrote:
Sebastien,
I did change to Epeck, but it did not resolve the problem.
Here is the complete code :
*.h :*
/#ifndef POLYGON_ESSAI_H
#define POLYGON_ESSAI_H
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_traits_2.h>
#include "formvirtual.h"
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
#include "print_utils.h"
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;
typedef CGAL::Polygon_traits_2<Kernel> Gp;
class Polygon_essai :public CGAL::Polygon_2<Gp>
{
//Q_OBJECT
public:
Polygon_essai();
void essai();
};
#endif // POLYGON_ESSAI_H/
*.cpp :*
/#include "polygon_essai.h"
Polygon_essai::Polygon_essai()
{
}
void Polygon_essai::essai(){
// Construct the two input polygons.
Polygon_2 P;
P.push_back (Point_2 (0, 0));
P.push_back (Point_2 (5, 0));
P.push_back (Point_2 (3.5, 1.5));
P.push_back (Point_2 (2.5, 0.5));
P.push_back (Point_2 (1.5, 1.5));
std::cout << "P = "; print_polygon (P);
Polygon_2 Q;
Q.push_back (Point_2 (0, 2));
Q.push_back (Point_2 (1.5, 0.5));
Q.push_back (Point_2 (2.5, 1.5));
Q.push_back (Point_2 (3.5, 0.5));
Q.push_back (Point_2 (5, 2));
std::cout << "Q = "; print_polygon (Q);
// Compute the difference of P and Q.
Pwh_list_2 intR;
Pwh_list_2::const_iterator it;
CGAL::difference (P, Q, std::back_inserter(intR)); //HERE, THE PROBLEM
std::cout << "The difference:" << std::endl;
for (it = intR.begin(); it != intR.end(); ++it) {
std::cout << "--> ";
print_polygon_with_holes (*it);
}
}/
--
View this message in context: http://cgal-discuss.949826.n4.nabble.com/Problem-with-boolean-operations-on-Polygons-tp4660305p4660307.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
#include <list> #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Polygon_2.h> #include <CGAL/Polygon_traits_2.h> #include <CGAL/Boolean_set_operations_2.h> #include "print_utils.h" 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; typedef CGAL::Polygon_traits_2<Kernel> Gp; int main() { // Construct the two input polygons. Polygon_2 P; P.push_back (Point_2 (0, 0)); P.push_back (Point_2 (5, 0)); P.push_back (Point_2 (3.5, 1.5)); P.push_back (Point_2 (2.5, 0.5)); P.push_back (Point_2 (1.5, 1.5)); std::cout << "P = "; print_polygon (P); Polygon_2 Q; Q.push_back (Point_2 (0, 2)); Q.push_back (Point_2 (1.5, 0.5)); Q.push_back (Point_2 (2.5, 1.5)); Q.push_back (Point_2 (3.5, 0.5)); Q.push_back (Point_2 (5, 2)); std::cout << "Q = "; print_polygon (Q); // Compute the difference of P and Q. Pwh_list_2 intR; Pwh_list_2::const_iterator it; CGAL::difference (P, Q, std::back_inserter(intR)); //HERE, THE PROBLEM std::cout << "The difference:" << std::endl; for (it = intR.begin(); it != intR.end(); ++it) { std::cout << "--> "; print_polygon_with_holes (*it); } return 0; }
- [cgal-discuss] Problem with boolean operations on Polygons., gilou_66, 01/14/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., Sebastien Loriot (GeometryFactory), 01/14/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., gilou_66, 01/14/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., Efi Fogel, 01/15/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., gilou_66, 01/15/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., Efi Fogel, 01/20/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., gilou_66, 01/15/2015
- Re: [cgal-discuss] Problem with boolean operations on Polygons., Efi Fogel, 01/15/2015
Archive powered by MHonArc 2.6.18.