Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: [Nef_polyhedron_3] Crash during boolean operations execution --- from old thread
  • Date: Fri, 29 Oct 2010 08:49:42 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=AZtOJq6fyaY5zjBY/8Y72X4dWz97zvRDIe/g6CFA6IXkujhzZVnsqBdbCdY5CyuDis dHWNz+cqalwgCETBf/nHGgcSC1lJhWcnqq4oi6i2creBIFsk3WkrQLP+hNbR0y8R3pnS xPvhjF9lRdh5Y2LEGS1VtsL95i0H8IJgVU2HM=

Joe C wrote:
someone from CGAL can help on this thread? The old thread has been there for more than two years still waiting for an answer.
I do not now this package. However I add a look yesterday. I understood
why this does crash but finding why would have took me a lot of time ( that I don't have right now).
If you can simply your models to come with smaller size examples
it will be easier to find out what is going on.

S.


On Wed, Oct 27, 2010 at 3:50 PM, Joe C < <mailto:>> wrote:

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 ) ;
}






Archive powered by MHonArc 2.6.16.

Top of Page