Subject: CGAL users discussion list
List archive
- From: ochyomdu <>
- To:
- Subject: [cgal-discuss] RE: Operator Overloading problem for Vector in Gmpzf Kernel
- Date: Wed, 11 Jan 2012 04:34:28 -0800 (PST)
Dear Bose,
Your small extracted code looks similar to my problem case. I also use
Polyhedron_3 and Nef_polyhedron_3.
And I have similar problems with using of traits/kernel.
I will be grateful when You can give me Your new small extracted code of
Your solution for this problem.
Much success to You in this new Year!
Bose wrote
>
> Dear Marc,
>
> Thanks, It works even with CGAL::Gmpq, after converting types in normal
> calculation.
>
> With regards,
>
> Bose
>
> -----Original Message-----
> From: Marc Glisse
> [mailto:marc.glisse@]
>
> Sent: Monday, October 04, 2010 2:46 PM
> To:
> cgal-discuss@.inria
> Subject: RE: [cgal-discuss] Operator Overloading problem for Vector in
> Gmpzf
> Kernel
>
> Wow, you seem to be out of luck.
>
> Nef_* looks very limited in the kernels it accepts (basically only those
> where the number type is a quotient), and because the
> Algebraic_structure_traits doesn't provide a default trivial gcd for field
> types, you can't even provide a Fraction_trait for CORE::Expr and pretend
> it is a quotient (or use a CGAL::Quotient<CORE::Expr>).
>
> typedef CGAL::Simple_cartesian<CGAL::Quotient<CGAL::Gmpz> >
> Kernel;
> may compile, though the square root will be far from accurate.
>
> An Sqrt_extension of Gmpq looks promizing, but it also seems to be missing
> required pieces.
>
> You may be able to convert back and forth between types, say:
> n = n / Kernel::FT(CGAL::sqrt(CGAL::to_double(n.squared_length())));
> if you don't mind the lack of accuracy.
>
> On Mon, 4 Oct 2010, S K BOSE wrote:
>
>> Dear All,
>>
>> Here is my small extracted code. I want to use both Polyhedron_3 and Nef
>> Polyhedra.
>>
>> #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 CGAL::Polyhedron_3<Kernel> Polyhedron;
>> typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
>> typedef Kernel::Point_3 Point_3;
>> typedef Polyhedron::Facet_iterator Facet_iterator;
>> typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;
>> typedef Kernel::Vector_3 Vector;
>>
>>
>>
>> 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 N(P);
>> //...........do some boolean operation
>> if(N.is_simple())
>> N.convert_to_Polyhedron(P);
>> Facet_iterator f;
>> for(f = P.facets_begin(); f != P.facets_end();f++)
>> {
>> HF_circulator he = f->facet_begin();
>> HF_circulator end = he;
>> CGAL_For_all(he,end)
>> {
>> const Point_3& prev = he->prev()->vertex()->point();
>> const Point_3& curr = he->vertex()->point();
>> const Point_3& next = he->next()->vertex()->point();
>> //Vector n = CGAL::cross_product(next-curr,prev-curr);
>> // n = n / CGAL::sqrt(n.squared_length());
>> Vector n = CGAL::unit_normal(prev,curr,next);
>> }
>> }
>> }
>>
>>
>> a) If I use "Exact_predicates_exact_constructions_kernel_with_sqrt", it
>> gives error in decomposer(h.b(),num,denom) from Nef_S2/Normalizing.h like
>> 1>G:\cgal\CGAL-3.7-beta1\include\CGAL/Nef_S2/Normalizing.h(306) : error
>> C2064: term does not evaluate to a function taking 3 arguments
>> 1>G:\cgal\CGAL-3.7-beta1\include\CGAL/Nef_S2/Normalizing.h(307) : error
>> C2676: binary '*=' : 'CGAL::Null_tag' does not define this operator or a
>> conversion to a type acceptable to the predefined operator
>> ....................
>> ...................
>>
>> b) If I use "Exact_predicates_exact_constructions_kernel", it gives the
> same
>> old problem as I was getting with homogeneous
>>
>> G:\cgal\CGAL-3.7-beta1\include\CGAL/Kernel/function_objects.h(1878) :
> error
>> C2678: binary '/' : no operator found which takes a left-hand operand of
>> type 'CGAL::Vector_3<R_>' (or there is no acceptable conversion) -----
>>
>> c) If I use "Exact_predicates_inexact_constructions_kernel", it gives
>>
>> G:\cgal\CGAL-3.7-beta1\include\CGAL/Nef_3/Bounding_box_3.h(89) : error
>> C2039: 'lo' : is not a member of
>> 'CGAL::Box_intersection_d::Box_d<NT_,N>'
>>
>> In this context what should be my kernel. My compiler is Microsoft Visual
>> Studio 2005
>>
>> With regards,
>>
>> Bose
>>
>> Original Message-----
>> From: Marc Glisse
>> [mailto:marc.glisse@]
>> Sent: Tuesday, September 21, 2010 7:01 PM
>> To:
>> cgal-discuss@.inria
>> Subject: RE: [cgal-discuss] Operator Overloading problem for Vector in
> Gmpzf
>> Kernel
>>
>> On Tue, 21 Sep 2010, S K BOSE wrote:
>>
>>> Thanks for reply. As Marc mentioned it is the problem for homogeneous
>>> Vector, But if I use Exact_predicates_exact_constructions_kernel (which
>>> I
>>> feel it is Cartesian) it gives same problem. Same problem for Gmpq
>>> kernel
>>> also (as what Bernd suggested).
>>
>> If you really need sqrt, you want either an approximate kernel
>> (Exact_predicates_inexact_constructions_kernel may work) or an exact
>> kernel that can handle it
>> (Exact_predicates_exact_constructions_kernel_with_sqrt).
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Operator-Overloading-problem-for-Vector-in-Gmpzf-Kernel-tp2548286p4285253.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] RE: Operator Overloading problem for Vector in Gmpzf Kernel, ochyomdu, 01/11/2012
- RE: [cgal-discuss] RE: Operator Overloading problem for Vector in Gmpzf Kernel, S K BOSE, 01/12/2012
Archive powered by MHonArc 2.6.16.