Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] segmentation fault from Nef_polyhedron_2 boolean operation

Subject: CGAL users discussion list

List archive

[cgal-discuss] segmentation fault from Nef_polyhedron_2 boolean operation


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] segmentation fault from Nef_polyhedron_2 boolean operation
  • Date: Thu, 12 Feb 2009 04:29:23 +0100 (CET)

Hi,

Nef_polyhedron_2 boolean operation crushed for some polygons. However, it is
fine when trying General_polygon_set with same polygons. Should I use
General_polygon_set instead of Nef_polyhedron_2 even for simple rectilinear
polygon?

Thanks,
Hyungon Kim

#include <iostream>
#include <list>
using namespace std;

#include <CGAL/basic.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/connect_holes.h>
#include <CGAL/Bounded_kernel.h>
#include <CGAL/Nef_polyhedron_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <CGAL/Boolean_set_operations_2.h>

typedef CGAL::Simple_cartesian<double> cgalKernel;
typedef CGAL::Bounded_kernel<cgalKernel> cgalExtKernel;

typedef CGAL::Nef_polyhedron_2<cgalExtKernel> cgalNefPolyhedron;

typedef cgalNefPolyhedron::Point cgalPoint2;
typedef CGAL::Polygon_2<cgalKernel> cgalPolygon2;
typedef CGAL::Polygon_with_holes_2<cgalKernel> cgalPolygonWithHoles2;

typedef CGAL::Exact_predicates_inexact_constructions_kernel
cgalExtInextKernel;
typedef cgalExtInextKernel::Point_2
cgalExtPoint2;
typedef CGAL::Polygon_2<cgalExtInextKernel>
cgalExtPolygon2;
typedef CGAL::Polygon_with_holes_2<cgalExtInextKernel>
cgalExtPolygonWithHoles2;

main()
{
vector<cgalPoint2> P1;
P1.push_back(cgalPoint2(-48690,20167));
P1.push_back(cgalPoint2(-48690,1960));
P1.push_back(cgalPoint2(-42690,-4038));
P1.push_back(cgalPoint2(-42690,-17679));
P1.push_back(cgalPoint2(-17677,-42690));
P1.push_back(cgalPoint2(17679,-42690));
P1.push_back(cgalPoint2(42690,-17677));
P1.push_back(cgalPoint2(42690,-4460));
P1.push_back(cgalPoint2(37690,-4460));
P1.push_back(cgalPoint2(37690,-15613));
P1.push_back(cgalPoint2(15611,-37690));
P1.push_back(cgalPoint2(-15613,-37690));
P1.push_back(cgalPoint2(-37690,-15611));
P1.push_back(cgalPoint2(-37690,-1962));
P1.push_back(cgalPoint2(-43690,4040));
P1.push_back(cgalPoint2(-43690,18103));
P1.push_back(cgalPoint2(-18101,43690));
P1.push_back(cgalPoint2(18103,43690));
P1.push_back(cgalPoint2(43690,18101));
P1.push_back(cgalPoint2(43690,7500));
P1.push_back(cgalPoint2(78690,7500));
P1.push_back(cgalPoint2(78690,12500));
P1.push_back(cgalPoint2(48690,12500));
P1.push_back(cgalPoint2(48690,20169));
P1.push_back(cgalPoint2(20167,48690));
P1.push_back(cgalPoint2(-20169,48690));

vector<cgalPoint2> P2;
P2.push_back(cgalPoint2(-48690,-1960));
P2.push_back(cgalPoint2(-48690,-9460));
P2.push_back(cgalPoint2(-43690,-9460));
P2.push_back(cgalPoint2(-43690,-4040));
P2.push_back(cgalPoint2(-37690,1962));
P2.push_back(cgalPoint2(-37690,9460));
P2.push_back(cgalPoint2(-42690,9460));
P2.push_back(cgalPoint2(-42690,4038));

cgalNefPolyhedron N1(P1.begin(), P1.end(),
cgalNefPolyhedron::EXCLUDED);
cgalNefPolyhedron N2(P2.begin(), P2.end(),
cgalNefPolyhedron::EXCLUDED);
cgalNefPolyhedron N3 = N1+N2;

/*
cgalPolygon2 POLY1(P1.begin(), P1.end());
cgalPolygon2 POLY2(P2.begin(), P2.end());
cgalPolygonWithHoles2 unionR;
CGAL::join(POLY1, POLY2, unionR);
*/
}



Archive powered by MHonArc 2.6.16.

Top of Page