Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Conforming triangulaions and kernels

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Conforming triangulaions and kernels


Chronological Thread 
  • From:
  • To:
  • Subject: Re: [cgal-discuss] Conforming triangulaions and kernels
  • Date: Wed, 8 Apr 2009 18:33:39 +0300

I use the babilonian method, which can approximate a square root in rational
numbers up to a certain precision. The best advantage of this method is that
two identical rational number would produce the same root. The drawback is
that
it complicates the rational number greatly; For this, I truncate the number to
the precision (i.e., numerator*=10^PRECISION, integer x=div(numerator,
denominator), truncated=x/10^PRECISION).

Amir.

Quoting Fernando Cacciola
<>:

> Hi Ben,
> Hu Sylvain,
>
> Sylvain Pion wrote:
> > Ben Supnik wrote:
> >> The docs for make_conforming_Delaunay_2 say that it requires
> >> ConformingDelaunayTriangulationTraits_2. traits.
> >>
> >> ConformingDelaunayTriangulationTraits_2 is labeled as having "Any
> >> model of Kernel concept. In particular, all CGAL kernels."
> >>
> >> But...this doesn't seem correct to me - am I right in thinking that
> >> some CGAL exact pred exact construction kernels do not have sqrt? The
> >> one I was using did not, and I get a compile failure due to being
> >> unable to tkae the sqrt of a number.
> >>
> >> If sqrt is indeed required and not in all kernels, is there a way to
> >> get an exact predicate/exact construction kernel without one of LEDA
> >> or GMP?
> >
> > Known issue (to me at least).
> >
> > One way to cheat is to define a sqrt() function for the number type
> > that you use, and make it approximate (convert to double, use std::sqrt,
> > and convert back). It might work for some/most rational number types,
> > and hopefully the algorithms won't break too much...
> >
>
> FWIW, the straight skeleton package uses such a cheat.
>
> If you look at the header:
>
> CGAL/constructions/Straight_skeleton_cons_ftC2.h
>
> There is the function:
>
> inexact_sqrt(num)
>
> which does what Sylvain said.
>
> You might wan't to base your version on that one.
>
> It works for arbitrary number types, it uses CORE::BigFloat instead of
> double
> if
> available, and if it uses double, it checks for overflow after the to_double
>
> conversion, and for Quotient<NT> it avoids the division.
>
>
> Best
>
> Fernando Cacciola
> www.geometryfactory.com
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>





Archive powered by MHonArc 2.6.16.

Top of Page