Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Exact_predicates_exact_constructions_kernel_with_sqrt and Nef_polyhedron_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Exact_predicates_exact_constructions_kernel_with_sqrt and Nef_polyhedron_3


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Exact_predicates_exact_constructions_kernel_with_sqrt and Nef_polyhedron_3
  • Date: Thu, 15 May 2008 17:45:13 +0200

Hi Joe,

The exceptions get catched right, that is it is not up to you to
catch them. They are used in filtered predicates. The idea
is to first try to compute the result of a predicate with
interval arithmetic on doubles, and if that fails an exception
is thrown and in the catch clause the predicate is run with
an arbitrary precision number type like Gmpq.

Now, when you switch to Gmpq you compute all predicates
exactly, and that's why there are no exceptions being thrown,
but at the price of performance.

andreas


Joe C wrote:
Michael and Peter, Thank you for your help!

As Michael mentioned in his email, I do have some reason to use sqrt kernel. I tried to convert a sphere polyhedron (see attached Sphere.txt) to Nef_polyhedron_3. The generation and the conversion were done by using Exact_predicates_exact_constructions_kernel. Both were successful except that I got some exception: CCGAL::Uncertain_conversion_exception when converting polyhedron to Nef_polyhedron_3. If I ignore all the exceptions, I am still able to do boolean operations (like union) using the converted Nef_polyhedron_3. It seems that the exceptions do not affect the results at all, but just annoying. Then I try using sqrt kernel in Release mode, surprisingly, all the exceptions are gone, but compiling failed when in Debug mode.

I guess this is more like Kernel Selection problem. I searched the forum and also tried Simple_cartesian<Gmpq>. It is much slower than Exact_predicate_exact_constructions_kernel, but NO exceptions thrown.

If I still want to have good performance by using Exact_predicates_exact_constructions_kernel, it there any way that I can suppress exceptions thrown (or is it a bad idea to do so)?

Cheers,

Joe



On Thu, May 15, 2008 at 5:16 AM, Peter Hachenberger < <mailto:>> wrote:

Hi,

that's a correct analysis of Michael. Try the
Exact_predicates_exact_constructions_kernel; it should work. If you
really need the kernel with sqrt, you might need to wait for the next
release. The Nef_3 package has some functions that I intended as
features, but actually limit the number of applicable kernels. I will
try to make some of these features optional.

Peter

On Thu, 2008-05-15 at 09:55 +0200, Michael Hemmer wrote:
> Hi,
>
> I am not an expert for Nef but AFAIK it does not need the kernel
with sqrt.
> It seems that the code is trying to decompose the Field type into
> Numerator and Denominator (for some reason),
> but this is not possible for CORE::Expr.
>
> Have you tried another kernel, i.e., one that is not using
CORE::Expr as
> FT.
>
> best,
> Michael
>
>
> Joe C wrote:
>
> > Hi, all
> >
> > I run into some issue when using Nef_polyhedron_3 with
> > Exact_predicates_exact_constructions_kernel_with_sqrt Kernel.
> >
> > To be specific, here is the simple program I was testing:
> >
> > #include
<CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
> > #include <CGAL/Polyhedron_3.h>
> > #include <CGAL/Nef_polyhedron_3.h>
> >
> > typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt
> > Kernel;
> > typedef Kernel::Point_3 Point_3;
> > typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
> > typedef CGAL::SNC_indexed_items Items;
> > typedef CGAL::Nef_polyhedron_3<Kernel, Items> Nef_polyhedron;
> >
> >
> > int main() {
> > Point_3 p( 1.0, 0.0, 0.0);
> > Point_3 q( 0.0, 1.0, 0.0);
> > Point_3 r( 0.0, 0.0, 1.0);
> > Point_3 s( 0.0, 0.0, 0.0);
> >
> > Polyhedron P;
> > P.make_tetrahedron( p, q, r, s);
> > Nef_polyhedron N2(P);
> >
> > return 0;
> > }
> >
> >
> > I am using Visual Studio 2003 and Visual Studio 2005 with CGAL
3.3.1. <http://3.3.1.>
> > <http://3.3.1.> When runing in Release mode, everything runs
fine. But
> > when running in Debug mode, I got the following errors:
> >
> > Is this a bug in CGAL or did I do something wrong? I can not figure
> > this out, can anybody help me out?
> >
> > Joe
> >
> >
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(300):
> > error C2064: term does not evaluate to a function taking 3
arguments
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(305):
> > error C2064: term does not evaluate to a function taking 3
arguments
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(310):
> > error C2064: term does not evaluate to a function taking 3
arguments
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(315):
> > error C2064: term does not evaluate to a function taking 3
arguments
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(323):
> > error C2440: 'type cast' : cannot convert from
> > 'std::allocator<_Ty>::value_type' to
> > 'CGAL::Cartesian_base_no_ref_count<FT_,Kernel_>::FT'
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > and
> > [
> > FT_=CORE::Expr,
> > Kernel_=CGAL::Simple_cartesian<CORE::Expr>
> > ]
> > No constructor could take the source type, or constructor
> > overload resolution was ambiguous
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(323):
> > error C2440: 'type cast' : cannot convert from
> > 'std::allocator<_Ty>::value_type' to
> > 'CGAL::Cartesian_base_no_ref_count<FT_,Kernel_>::FT'
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > and
> > [
> > FT_=CORE::Expr,
> > Kernel_=CGAL::Simple_cartesian<CORE::Expr>
> > ]
> > No constructor could take the source type, or constructor
> > overload resolution was ambiguous
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(324):
> > error C2440: 'type cast' : cannot convert from
> > 'std::allocator<_Ty>::value_type' to
> > 'CGAL::Cartesian_base_no_ref_count<FT_,Kernel_>::FT'
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > and
> > [
> > FT_=CORE::Expr,
> > Kernel_=CGAL::Simple_cartesian<CORE::Expr>
> > ]
> > No constructor could take the source type, or constructor
> > overload resolution was ambiguous
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(324):
> > error C2440: 'type cast' : cannot convert from
> > 'std::allocator<_Ty>::value_type' to
> > 'CGAL::Cartesian_base_no_ref_count<FT_,Kernel_>::FT'
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > and
> > [
> > FT_=CORE::Expr,
> > Kernel_=CGAL::Simple_cartesian<CORE::Expr>
> > ]
> > No constructor could take the source type, or constructor
> > overload resolution was ambiguous
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(306):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(307):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(308):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(309):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(311):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(312):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(313):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(314):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(316):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(317):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(318):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Nef_S2\Normalizing.h(319):
> > error C2676: binary '*=' : 'std::allocator<_Ty>::value_type'
does not
> > define this operator or a conversion to a type acceptable to the
> > predefined operator
> > with
> > [
> > _Ty=CGAL::Fraction_traits<FT>::Numerator_type
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\float.h(133): warning
C4244:
> > 'return' : conversion from 'double' to
> > 'CGAL::Algebraic_structure_traits_base<Type,Algebra_type>::Type',
> > possible loss of data
> > with
> > [
> > Type=float,
> > Algebra_type=CGAL::Field_with_kth_root_tag
> > ]
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Handle.h(85): warning
C4311:
> > 'reinterpret_cast' : pointer truncation from 'CGAL::Rep *const ' to
> > 'unsigned long'
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Handle.h(90): warning
C4311:
> > 'reinterpret_cast' : pointer truncation from 'CGAL::Rep *const ' to
> > 'unsigned long'
> > C:\Program Files\CGAL-3.3.1\include\CGAL\Handle.h(91): warning
C4311:
> > 'reinterpret_cast' : pointer truncation from 'CGAL::Rep *const ' to
> > 'unsigned long'
> > C:\Program Files\Microsoft Visual Studio .NET
> > 2003\Vc7\include\xtree(484): warning C4800: 'int' : forcing
value to
> > bool 'true' or 'false' (performance warning)
> > C:\Program Files\Microsoft Visual Studio .NET
> > 2003\Vc7\include\xtree(484): warning C4800: 'int' : forcing
value to
> > bool 'true' or 'false' (performance warning)
> >
> >
> >
> >
>

--
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