Subject: CGAL users discussion list
List archive
- From: Gereon Kremer <>
- To:
- Cc: "Sebastien Loriot (GeometryFactory)" <>
- Subject: Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE)
- Date: Thu, 08 Dec 2011 09:50:43 +0100
Hi,
thanks for the hint, I'll try that...
What I want to do:
My Input is a polygon (a list of Segments that form a cycle).
The first step is to shrink the polygon, such that the result is a new
polygon where every edge is moved to the inner of the polygon by a
certain delta. To achieve this, I look at every two consecutive lines at
once and moving there common intersection point:
For both edges, I take the perpendicular line and create a tranformation
along this line of length delta to use this transformation on the edge
itself afterwards.
The intersections of these moved lines is my result.
To create a transformation of length delta, I have to normalize the
vector that gives me the direction. This is, where sqrt comes into play.
If there is some other way to achieve the above, I would happily remove
sqrt from my project :-)
In the meantime, I'll poke around wir this sqrt-extension a bit...
Thanks,
Gereon
On 12/08/2011 07:27 AM, Sebastien Loriot (GeometryFactory) wrote:
> 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.
>>
>
>
- [cgal-discuss] CGAL::to_double incredibly slow (using CORE), gereon, 12/07/2011
- Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE), Sebastien Loriot (GeometryFactory), 12/08/2011
- Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE), Gereon Kremer, 12/08/2011
- Re: [cgal-discuss] CGAL::to_double incredibly slow (using CORE), Sebastien Loriot (GeometryFactory), 12/08/2011
Archive powered by MHonArc 2.6.16.