Subject: CGAL users discussion list
List archive
- From: Jayesh Salvi <>
- To:
- Subject: Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild
- Date: Wed, 1 Jun 2011 21:34:20 +0530
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=dbjFbs7BncDBaZGYrPn545R73qP0BLY1e3L9QkXw5ff+TcHTaL4blSI4bcWGXGoBzq FIkcJrJ0Y/ng/LKAUsLd0+qpR5hWl391h7QAX9vZ5uWJDvmy+bdLBu4erzgIHPzvCuhg ZVHZPROGh97RymdbCFdz/4kqdfuQrSpjm7df0=
Ok, I have managed to put together a simple example that reproduces
the crash I reported earlier.
Attached is a simple .cpp program which reads two polyhedra from off
files and performs union operation on them. Also attached are the two
off files that you have to pass as argument to the program, in order
to make it crash.
I tested against CGAL 3.8.
--
Jayesh
On Wed, Jun 1, 2011 at 5:16 PM, Sebastien Loriot (GeometryFactory)
<>
wrote:
> Sorry cannot debug with just this.
>
>
> S.
>
> Jayesh Salvi wrote:
>>
>> Ok,
>>
>> I've made some progress on this.
>>
>> The wild behavior was probably due to our memory allocation bugs.
>> After replacing malloc, by calloc the erratic behavior went away and I
>> got a nice segmentation fault. Here is the stack trace:
>>
>> (gdb) bt
>> #0 0xb7796cf5 in
>> CGAL::SNC_FM_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool>
>>>
>>> ::create_facet_objects(CGAL::Plane_3<CGAL::Epeck> const&,
>>
>> std::_List_iterator<CGAL::Object>, std::_List_iterator<CGAL::Object>)
>> const
>> () from build/libcsgop.so
>> #1 0xb7783dc7 in
>> CGAL::SNC_external_structure<CGAL::SNC_indexed_items,
>> CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool>
>>>
>>> ::categorize_facet_cycles_and_create_facets() const () from
>>
>> build/libcsgop.so
>> #2 0xb7789fcb in void
>> CGAL::SNC_external_structure<CGAL::SNC_indexed_items,
>> CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool>
>>>
>>>
>>> ::build_after_binary_operation<CGAL::ID_support_handler<CGAL::SNC_indexed_items,
>>
>> CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> > >
>>>
>>> (CGAL::ID_support_handler<CGAL::SNC_indexed_items,
>>
>> CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> > >&) () from build/libcsgop.so
>> #3 0xb7775484 in void
>> CGAL::Binary_operation<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool>
>>>
>>> ::operator()<CGAL::Nef_polyhedron_3<CGAL::Epeck,
>>
>> CGAL::SNC_indexed_items,
>>
>> bool>::OR>(CGAL::SNC_point_locator<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> > >*, CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> const&,
>>
>> CGAL::SNC_point_locator<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> > > const*,
>> CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, ---Type
>> <return> to continue, or q <return> to quit---
>> bool> const&,
>>
>> CGAL::SNC_point_locator<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> > > const*,
>> CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool>::OR
>> const&) () from build/libcsgop.so
>> #4 0xb776e6a6 in CGAL::Nef_polyhedron_3<CGAL::Epeck,
>> CGAL::SNC_indexed_items,
>> bool>::join(CGAL::Nef_polyhedron_3<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> const&) const () from build/libcsgop.so
>> #5 0xb7769efc in CGAL::Nef_polyhedron_3<CGAL::Epeck,
>> CGAL::SNC_indexed_items,
>> bool>::operator+=(CGAL::Nef_polyhedron_3<CGAL::Epeck,
>> CGAL::SNC_indexed_items, bool> const&) () from build/libcsgop.so
>> #6 0xb7764308 in csgop () from build/libcsgop.so
>> ... application specific frames ...
>>
>> Does that give any clue?
>> --
>> Jayesh
>>
>>
>>
>> On Tue, May 31, 2011 at 7:15 PM, Jayesh Salvi
>> <>
>> wrote:
>>>
>>> Let me see if I can put together some minimal c++ code to demo this.
>>> --
>>> Jayesh
>>>
>>>
>>>
>>> On Tue, May 31, 2011 at 11:31 AM, Sebastien Loriot (GeometryFactory)
>>> <>
>>> wrote:
>>>>
>>>> Any complete minimal example showing the problem?
>>>>
>>>> S.
>>>>
>>>> Jayesh Salvi wrote:
>>>>>
>>>>> ^ Bump ^
>>>>>
>>>>> Any thoughts?
>>>>> --
>>>>> Jayesh
>>>>>
>>>>>
>>>>>
>>>>> On Sun, May 29, 2011 at 4:43 PM, Jayesh Salvi
>>>>> <>
>>>>> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> In my program I am creating two polyhedrons from two meshes (In this
>>>>>> case a cube and a sphere). Then I convert them to Nef Polyhedra and
>>>>>> apply union (+) operation on them. I then convert the returned Nef
>>>>>> Polyhedron into a Polyhedron_3, but before doing that I run
>>>>>> is_simple() check (just so that if it is not simple, I can generate an
>>>>>> error message, instead of assertion failure crash during the
>>>>>> conversion process).
>>>>>>
>>>>>> In this particular case - with a cube and sphere of specific
>>>>>> geometries - I observed that after some time the program starts
>>>>>> occupying a lot of memory and consumes most of the CPU. From the top
>>>>>> utility, I can see that the process is taking >90% memory and >90%
>>>>>> CPU. To see what's going on, I put cout statements at various places
>>>>>> to see during which part of the program does this start to happen. I
>>>>>> was surprised to find out that this happens when I call is_simple()
>>>>>> check on the nef polyhedron. At this point either I have to kill the
>>>>>> process or the system terminates it.
>>>>>>
>>>>>> I tried to run the program through valgrind, but as I read elsewhere
>>>>>> valgrind can't be used with CGAL programs because of floating point
>>>>>> issues.
>>>>>>
>>>>>> Do you have any suggestions how can I proceed to debug this?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> (My project is available at http://jayesh3.github.com/cadmium/ I can
>>>>>> provide instructions on how to reproduce the issue, if you need)
>>>>>> --
>>>>>> Jayesh
>>>>>>
>>>>
>>>> --
>>>> You are currently subscribed to cgal-discuss.
>>>> To unsubscribe or access the archives, go to
>>>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>>>>
>>>>
>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Gmpz.h> #include <CGAL/Homogeneous.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::Exact_predicates_exact_constructions_kernel 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; int main(int argc, char *argv[]) { std::ifstream off1(argv[1]); std::ifstream off2(argv[2]); Polyhedron p1, p2; off1 >> p1; off2 >> p2; Nef_polyhedron n1(p1); Nef_polyhedron n2(p2); n1 += n2; Polyhedron p; n1.convert_to_polyhedron(p); std::cout << p << std::endl; }
Attachment:
box0.off
Description: Binary data
Attachment:
sphere0.off
Description: Binary data
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Jayesh Salvi, 06/01/2011
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Sebastien Loriot (GeometryFactory), 06/01/2011
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Jayesh Salvi, 06/01/2011
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Sebastien Loriot (GeometryFactory), 06/29/2011
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Jayesh Salvi, 06/01/2011
- Re: [cgal-discuss] Re: Nef_Polyhedron is_simple() going wild, Sebastien Loriot (GeometryFactory), 06/01/2011
Archive powered by MHonArc 2.6.16.