Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Boolean performance

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Boolean performance


Chronological Thread 
  • From: Taus Møller <>
  • To:
  • Subject: Re: [cgal-discuss] Boolean performance
  • Date: Mon, 11 Jan 2016 11:42:17 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:T8fqaRVnpu0SKul/mgiH8EQKgs/V8LGtZVwlr6E/grcLSJyIuqrYZxeCt8tkgFKBZ4jH8fUM07OQ6PC+HzRYqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh770o8WbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/NGSrjwKqQkUaRDXnNhKHEw/MSttB/ZTALJ6GFbSXQTihMPAg7L61bxUZ719yf7reFgwzLJAMvtULphWSi+97w5D1jzmSIfPng49nvWg4p+luVAsRe5rlt+xYDTJ4qaPf47cqLGds4BXjl9WZNaWCVFR4+9dIASFPEpPOBCroC7qUFdgwG5AFyQDf70ghrYgnv7x+Vuz+kkOQje3Qs7GNwS9n/TqYOmZ+8pTempwfyQnn34ZPRM1GKl5Q==

I spent some time trying to figure out why I get so poor performance
from Boolean operations. I created at very simple example where two
sphere meshes are read from OFF files as Polyhedron_3. These are then
converted to Nef_polyhedron and used in a union. Here are the contents
of the main function:

std::ifstream stream1("Sphere1.OFF");
std::ifstream stream2("Sphere2.OFF");

Polyhedron P1 = Polyhedron();
Polyhedron P2 = Polyhedron();

stream1 >> P1;
stream2 >> P2;

Nef_polyhedron N1(P1);
Nef_polyhedron N2(P2);

Nef_polyhedron N3 = N1 + N2;


I have clocked each step of the process. As expected the bulk of the
time is spent on the union operation, with the mesh conversions a
distant second.

As you suggested previously, using Also using "typedef
CGAL::Simple_cartesian<CGAL::Lazy_exact_nt<CGAL::Gmpq> > Kernel;" cut
a few seconds.

I found that the largest culprit was the /clr switch. When building
with /clr the union took around 30 seconds. Removing clr support cut
this down to 10 seconds. Why there is such a huge overhead in clr i
don't know. It is quite a problem, since we need the CLR support as we
need to be able to call CGAL from C#.

Even so, removing CLR support still has the union at 10 seconds, which
is quite a bit off what you reported. I have included the meshes i am
using just in case. However, we really need a general solution and
unless i am missing something it really should work fine with these
meshes.

On 20 November 2015 at 16:45, Sebastien Loriot (GeometryFactory)
<>
wrote:
> I don't know what you did but I tried within the polyhedron demo
> and the union of 2 spheres made of 1280 triangles took 756 ms
> on my laptop using nef with EPEC.
>
> Sebastien.
>
>
> On 11/20/2015 04:35 PM, Taus Møller wrote:
>>
>> It did indeed cut about 3 seconds of the boolean operation with two
>> sphere. It is still very very slow though.
>>
>> On 20 November 2015 at 08:47, Sebastien Loriot (GeometryFactory)
>> <>
>> wrote:
>>>
>>> On 11/10/2015 10:49 AM, Taus Møller wrote:
>>>>
>>>>
>>>> I have implemented boolean operation using nef polyhedra. The
>>>> performance however leaves something to be desired. A simple union
>>>> between two spheres constructed from roughly 400 triangles each, take
>>>> almost 8 seconds to solve(in release mode). Is this expected or might
>>>> i be doing something to inhibit the performance. I am using an epec
>>>> kernel which i know might impact performance. I have however been
>>>> unable to get it working with other kernels. Even so, 8 seconds seems
>>>> excessive for a simple union.
>>>>
>>>> Are there any obvious caveats i might be missing, or is simply the
>>>> time it takes with CGAL?
>>>>
>>>
>>> In some case EPEC is slower that using directly
>>> CGAL::Simple_cartesian<CGAL::Lazy_exact_nt<CGAL:Gmpq> >.
>>> You might want to give it a try.
>>>
>>> Sebastien.
>>>
>>> --
>>> You are currently subscribed to cgal-discuss.
>>> To unsubscribe or access the archives, go to
>>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>>
>>>
>>
>>
>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>
>



--
Regards
Taus Møller
Software Developer, Apiosoft

Attachment: sphere1.OFF
Description: Binary data

Attachment: sphere2.OFF
Description: Binary data




Archive powered by MHonArc 2.6.18.

Top of Page