Subject: CGAL users discussion list
List archive
- From: gilou_66 <>
- To:
- Subject: Re: [cgal-discuss] Problem with boolean operations on Polygons.
- Date: Wed, 14 Jan 2015 02:36:22 -0800 (PST)
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.
- [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.