Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE)


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE)
  • Date: Thu, 08 Dec 2011 07:27:31 +0100

Depending on the configuration of your input using CORE might be
extremely slow. My advice would be to first see whether you can avoid
the usage of sqrt, or if you can use Sqrt_extension for example.

Maybe if you explain what you want to do, we might give you an
alternative solution.

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/NumberTypeSupport_ref/Class_Sqrt_extension.html

Sebastien.

gereon wrote:
Hi,

I'm using cgal to calculate some intersections of Segments in 2d using the
kernel CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt on a
64bit linux (ubuntu 11.10). cgal is installed via the repository
(libcgal7-dev, version 3.8-1).

As I wanted to do some normalization of vectors, I had to use CGAL::sqrt and
therefore use CORE.
Now, the code is incredibly slow for some inputs. Take this code, TRACEOUT
being a simple macro outputting the code and the current time.

TRACEOUT("+ GCode::printRatio")
CDouble c = this->printed / this->moved;
cerr << "number is " << c << endl;
// c = 5.34;
TRACEOUT("~ GCode::printRatio::division")
double r = CGAL::to_double(c);
TRACEOUT("- GCode::printRatio")

printed and moved are of type CDouble, the typedef for FT. The division in
line 2 is instantaneously. the output in line 3 is weird: "number is" shows
up immediately, output of c takes several seconds.
Conversion to double takes several seconds as well, but is immediate if c is
set to 5.34 before.

Depending on the input, the runtime of the whole code varies from under half
a second to more than two minutes. Both inputs are however similar with
regard to their complexity (botch polygons with max. 10 lines).
I'm quite new to cgal (this is my first project with cgal) and I have no
idea why this happens. I hope somebody can give me a hint...

Thanks,
Gereon

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-to-double-incredibly-slow-using-CORE-tp4168676p4168676.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.16.

Top of Page