Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug when using Delaunay_Triangulation_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug when using Delaunay_Triangulation_3


Chronological Thread 
  • From: Camille Wormser <>
  • To:
  • Subject: Re: [cgal-discuss] Bug when using Delaunay_Triangulation_3
  • Date: Sat, 11 Aug 2007 17:42:28 +0200

Bernhard Kornberger wrote:
If it is started by the command "./mat" it inserts the points
from the badPoints.txt file into the traingulation. However,
when it comes to the computation of the dual voronoi vertices,
it outputs one time "nan nan nan".

This is a printing issue: you are using an exact number type, and the conversion to double fails.
You can still recover the exact values by doing:

Point q = T.dual(c_it);
std::cout << "v="
<< q.x().exact().to_double() << " "
<< q.y().exact().to_double() << " "
<< q.z().exact().to_double() << " " << std::endl;

The root of the problem is that the to_double function of Lazy_exact_nt does not detect NaN or Infinity properly:

if (compare_relative_precision(app,
Lazy_exact_nt<ET>::get_relative_precision_of_to_double()) <= 0)
return CGAL_NTS to_double(app);


If you replace the "<=" by "<", everything works fine, because compare_relative_precision returns 0 in this case. I attach the corresponding diff.

By the way, I have a question: the comparison of two NaNs in CGAL returns CGAL::EQUAL. Is it the way it should be?
Index: Lazy_exact_nt.h
===================================================================
--- Lazy_exact_nt.h (revision 39817)
+++ Lazy_exact_nt.h (working copy)
@@ -1079,7 +1079,7 @@

// If it's precise enough, then OK.
if (compare_relative_precision(app,
- Lazy_exact_nt<ET>::get_relative_precision_of_to_double())
<= 0)
+ Lazy_exact_nt<ET>::get_relative_precision_of_to_double()) <
0)
return CGAL_NTS to_double(app);

CGAL_PROFILER(std::string("failures of : ") +
std::string(CGAL_PRETTY_FUNCTION));



Archive powered by MHonArc 2.6.16.

Top of Page