Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Nef Polyhedra take 2 (boolean ops)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Nef Polyhedra take 2 (boolean ops)


Chronological Thread 
  • From: Peter Hachenberger <>
  • To:
  • Subject: Re: [cgal-discuss] Nef Polyhedra take 2 (boolean ops)
  • Date: Tue, 08 Jan 2008 12:20:48 +0100

Hi Gilbert,

now here we seem to have a bug, but not a bad one. I looked at your
nef-files and the obvious reasons for the problem is, that the geometry
in this file uses floating-point coordinates. The nef file-format is
supposed to output the coordinates always as homogeneous integer
coordinates. My code should recognize the used kernel and convert the
coordinates for the output accordingly. This seems not to happen. When
Rob tested your files, he used the off files, which have no problem.
There may be two reasons for the problem:

1. CGAL::Exact_predicates_exact_constructions_kernel evaluates to
something unexpected and therefore the wrong specialization is used for
the coordinate output.

2. The kernel evaluates correctly, but somehow the compiler chooses the
wrong specialization.

Let's find out, whether it's the first option. Please use the program
below to convert any off-file to a nef-file and look up whether your
output still uses floating point arithmetic.

Peter

#include <CGAL/Lazy_kernel.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Nef_3/SNC_indexed_items.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>

typedef CGAL::Lazy_kernel<CGAL::Simple_cartesian<ET> > Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::SNC_indexed_items Items;
typedef CGAL::Nef_polyhedron_3<Kernel, Items> Nef_polyhedron;

int main() {

Polyhedron P;
std::cin >> P;
if(!P.is_closed())
{
std::cerr << "input polyhedron is not closed. "
<< "Cannot convert to Nef Polyhedron." << std::endl;
return 1;
}

Nef_polyhedron N(P);
std::cout << N;
}
CGAL::Lazy_kernel<CGAL::Simple_cartesian<ET> >



On Mon, 2008-01-07 at 17:18 -0600, Gilbert Bernstein wrote:
> Hello again,
>
> I've been trying to get boolean operations up and working now, and
> am running into a bit of trouble. I was able to get a union of two
> offset cubes to compute just fine, but when I tried to union a shark
> model with a reflected version of itself I got the following error dump:
>
> CGAL error: assertion violation!
> Expr: c.has_on(p1)&&c.has_on(p2)
> File: /usr/local/CGAL-3.3.1/include/CGAL/Nef_S2/Sphere_segment.h
> Line: 57
> Explanation:
> terminate called after throwing an instance of
> 'CGAL::Assertion_exception'
> what(): CGAL ERROR: assertion violation!
> Expr: c.has_on(p1)&&c.has_on(p2)
> File: /usr/local/CGAL-3.3.1/include/CGAL/Nef_S2/Sphere_segment.h
> Line: 57
> CGAL error: assertion violation!
> Expr: 0
> File: /usr/local/CGAL-3.3.1/include/CGAL/Nef_3/SNC_io_parser.h
> Line: 1277
> Explanation:SNC_io_parser::read: no SNC header.
> terminate called after throwing an instance of
> 'CGAL::Assertion_exception'
> what(): CGAL ERROR: assertion violation!
> Expr: 0
> File: /usr/local/CGAL-3.3.1/include/CGAL/Nef_3/SNC_io_parser.h
> Line: 1277
> Explanation: SNC_io_parser::read: no SNC header.
> Abort trap
>
> Following is a tarball of all relevant code and models. The program
> off2nef (included) was used to convert the shark into a Nef
> polyhedron. The reflection was performed before reading the shark
> into CGAL. (ie. with off2nef) The program "test" was then run on the
> two .nef files to produce the above error message.
>
> If anyone has the time to peek at all this, or just has the time for
> helpful suggestions, they would be much appreciated.
>
> -- Gilbert



Archive powered by MHonArc 2.6.16.

Top of Page