Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] [Nef_polyhedron_3] Crash during boolean operations execution --- from old thread

Subject: CGAL users discussion list

List archive

[cgal-discuss] [Nef_polyhedron_3] Crash during boolean operations execution --- from old thread


Chronological Thread 
  • From: Joe C <>
  • To:
  • Cc: Joe C <>
  • Subject: [cgal-discuss] [Nef_polyhedron_3] Crash during boolean operations execution --- from old thread
  • Date: Wed, 27 Oct 2010 15:50:19 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=i612/ZqpRtiUiWnQjmD5wGaaotaji9dvc8cEB150T7tx0qgMUj9V2C2v6sznmi8tGj roumLWp3dmh927a8BKPmR9Zdpd5I/wjoWWKoqzeIkh3LlVypQD0VOnOyq3ZrSwejKTku j1gAhbR4dxS5KFvGORB2J7SX6xpV97TcZGxtE=

Hi,

I am getting crash while performing 3D difference. When I searched for the forum, I found this old thread which I copied below. It seems that this issue still exists (I'm using fairly recent release CGAL 3.6.1). Any solution to this?

Joe


*****************************************************************
The following is the contents from the old thread:



Hi there,

 

I have encountered a crash during execution of boolean operations on a data set.  The assertion is below.

 

CGAL error: assertion violation!

Expr: itl != it->second.end()

File: $(CGALROOT)\include\CGAL/Nef_3/SNC_external

_structure.h

Line: 567

 

If the assertion is ignored, a null-pointer reference occurs in make_twins() a few lines below that code.  I have attached the offending files, and a modification of the example “interface_polyhedron” program that demonstrates this error.  The kernels I have used are Cartesian<Gmpq> and Exact_predicates_exact_constructions_kernel.  I know the input files are ugly (a.off is pretty ugly), but they pass is_valid() and is_closed()/is_simple() tests both in Polyhedron_3 and Nef_polyhedron_3.

 

If anyone can provide any more details regarding how to avoid this kind of error, or why this is happening, I am glad to hear it!

 

Thanks,

 

Stephen

//#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <iostream>
#include <fstream>

typedef CGAL::Cartesian<CGAL::Gmpq> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Aff_transformation_3 Aff_transformation_3;

Polyhedron* loadPolyFromFile( const char* file )
{
std::ifstream fin( file ) ;
if ( !fin.is_open() ) return NULL ;

Polyhedron* p = new Polyhedron() ;
fin >> *p ;

if ( p->is_closed() && p->is_valid() )
{
// Only return when closed and valid.
return p ;
}
else
{
delete p ;
return NULL ;
}
}

void savePolyToFile( const Polyhedron& p )
{
std::ofstream fout( "out.off" ) ;
fout << p ;
fout.close() ;
}

int main()
{
Polyhedron* p1 = loadPolyFromFile( "a.off" ) ;
Polyhedron* p2 = loadPolyFromFile( "a2.off" ) ;
Polyhedron* p3 = loadPolyFromFile( "b.off" ) ;

if ( !p1 || !p2 || !p3 )
{
std::cerr << "Error loading files..." << std::endl ;
exit( 1 ) ;
}

Nef_polyhedron n1( *p1 ) ;
if ( !n1.is_simple() || !n1.is_valid() )
{
std::cerr << "n1 is not a 2-manifold." << std::endl ;
exit( 1 ) ;
}
Nef_polyhedron n2( *p2 ) ;
if ( !n2.is_simple() || !n2.is_valid() )
{
std::cerr << "n2 is not a 2-manifold." << std::endl ;
exit( 1 ) ;
}
Nef_polyhedron n3( *p3 ) ;
if ( !n3.is_simple() || !n3.is_valid() )
{
std::cerr << "n3 is not a 2-manifold." << std::endl ;
exit( 1 ) ;
}
Nef_polyhedron n = n1 - n2 - n3 ; // <-- Crashes here...

if ( n.is_simple() )
{
Polyhedron p ;
n.convert_to_Polyhedron( p ) ;
savePolyToFile( p ) ;
}
else
{
std::cerr << "N1 is not a 2-manifold." << std::endl;
}

// Clean up.
delete p1 ;
delete p2 ;
delete p3 ;
exit( 0 ) ;
}

Attachment: b.off
Description: Binary data

Attachment: a2.off
Description: Binary data

Attachment: a.off
Description: Binary data




Archive powered by MHonArc 2.6.16.

Top of Page