Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Triange/Triangle Intersection

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Triange/Triangle Intersection


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] Triange/Triangle Intersection
  • Date: Fri, 13 May 2011 09:36:14 +0200 (CEST)

On Thu, 12 May 2011, Marc Glisse wrote:

Indeed, I can't see anything in Lazy.h to interpret the std::vector<Approximate_kernel::Point_3> returned by the approximate kernel to output a std::vector<Lazy_kernel::Point_3> (both wrapped in an Object). And we had better hope that the order of the points in the vector will be the same with the exact kernel (but then I guess the same applies to segments and triangles and is safe enough as long as they use the same deterministic code).

Compiling with -DCGAL_DONT_USE_LAZY_KERNEL would work around this, at the price of a slowdown.

The attached patch partially fixes things when the intersection type is vector<Point_2> (replace Point_2 by Point_3 in the patch for your case) but it forces an exact evaluation in this case because I was too lazy to finish it properly.

--
Marc Glisse--- /usr/include/CGAL/Lazy.h 2010-12-15 21:00:40.000000000 +0100
+++ include/CGAL/Lazy.h 2011-05-13 09:23:02.578623203 +0200
@@ -1311,6 +1311,7 @@
typedef typename LK::Approximate_kernel AK;
typedef typename LK::Exact_kernel EK;
typedef typename LK::E2A E2A;
+ typedef Object result_type;

if (eto.is_empty())
return Object();
@@ -1321,6 +1322,13 @@

#include <CGAL/Kernel/interface_macros.h>

+ if(const std::vector<typename
EK::Point_2>*ptr=object_cast<std::vector<typename EK::Point_2> >(&eto)){
+ std::vector<typename LK::Point_2> ret; ret.reserve(ptr->size());
+ for(typename std::vector<typename EK::Point_2>::const_iterator
i=ptr->begin();i!=ptr->end();++i)
+ ret.push_back(typename LK::Point_2(new
Lazy_rep_0<typename AK::Point_2, typename EK::Point_2, E2A>(*i)));
+ return make_object(ret);
+ }
+
std::cerr << "object_cast inside Lazy_construction_rep::operator() failed.
It needs more else if's (#2)" << std::endl;
std::cerr << "dynamic type of the Object : " << eto.type().name() <<
std::endl;

@@ -1657,6 +1665,10 @@

#include <CGAL/Kernel/interface_macros.h>

+ if(const std::vector<typename
AK::Point_2>*ptr=object_cast<std::vector<typename AK::Point_2>
>(&(lo.approx()))){
+ throw Uncertain_conversion_exception("Quick workaround for
now");
+ }
+
std::cerr << "object_cast inside Lazy_construction_rep::operator()
failed. It needs more else if's (#1)" << std::endl;
std::cerr << "dynamic type of the Object : " <<
lo.approx().type().name() << std::endl;

@@ -1690,6 +1702,11 @@

#include <CGAL/Kernel/interface_macros.h>

+ if(const std::vector<typename
AK::Point_2>*ptr=object_cast<std::vector<typename AK::Point_2>
>(&(lo.approx()))){
+ throw Uncertain_conversion_exception("Quick workaround for
now");
+ }
+
+
std::cerr << "object_cast inside Lazy_construction_rep::operator()
failed. It needs more else if's (#1)" << std::endl;
std::cerr << "dynamic type of the Object : " <<
lo.approx().type().name() << std::endl;




Archive powered by MHonArc 2.6.16.

Top of Page