Skip to Content.
Sympa Menu

cgal-discuss - bug in boolean operations

Subject: CGAL users discussion list

List archive

bug in boolean operations


Chronological Thread 
  • From: "Isabel" <>
  • To: <>
  • Subject: bug in boolean operations
  • Date: Fri, 20 Jul 2007 11:20:22 +0200

Hi all.
I think that I find a bug in boolean operation,  
the difference of a cube and a cylinder is not correct. There are facets in holes.  See 'cubemincylinder.off'   
I convert to Nef_Polyhedron_3 my two polyhedrons, a cube and a cylinder. This operation spend a lot of time.
 
this is the code:

typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;

typedef CGAL::Nef_polyhedron_3<Kernel> Nef_3;

typedef CGAL::Polyhedron_3<Kernel> Polyhedron;

typedef Kernel::Point_3 Point;

typedef Kernel::Vector_3 Vector;

typedef Polyhedron::Vertex_iterator Vertex_iterator;

typedef Polyhedron::Facet_iterator Facet_iterator;

typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;

 

int main( int argc, char **argv) {

Polyhedron P1, P2, P;

const char* name = "cin";

istream* p_in1 = &cin;

istream* p_in2 = &cin;

ifstream in1, in2;

in1.open( ".\\cube.off");

p_in1 = &in1;

Nef_3 N1;

std::size_t discarded = CGAL::OFF_to_nef_3 ( *p_in1, N1, true);

in2.open( ".\\cylinder.off");

p_in2 = &in2;

Nef_3 N2;

discarded = CGAL::OFF_to_nef_3 ( *p_in2, N2, true);

Nef_3 N3;

std::cout << "boolean operatioin NEF3..." << std::endl;

N3 = N1 - N2;

std::cout << "Convert to polyhedron..." << std::endl;

if(N3.is_simple()) {

N3.convert_to_Polyhedron(P);

std::cout << N3;

const char* ;

ostream* p_out = &cout;

ofstream out;

out.open( "cubemincylinder.off");

p_out = &out;

CGAL::set_ascii_mode( *p_out);

(*p_out) << P;

}

else {

std::cout << N3;

}

return 0;

}

Thanks Isabel

Attachment: cubemincylinder.off
Description: Binary data




Archive powered by MHonArc 2.6.16.

Top of Page