Fix the testsuite of AABB tree

That is a followup to the following commit:
  | commit 3e93d0bfc6
  | Author: Laurent Rineau <laurent.rineau@cgal.org>
  | Date:   Tue Dec 31 15:15:24 2013 +0100
  |
  |     Fix test of AABB_tree (use of an epsilon)
  |
  |     The test 'aabb_naive_vs_tree_distance_triangle_test' failed
  |     something. It was due to a test using an epsilon, with a too-low epsilon
  |     value (1e-8). I managed to reproduce the bug, and the quantity compared
  |     to the epsilon value was about 1.8e-8. I increase the epsilon value to
  |     1e-7, and add a few lines that show the compared values, when the test
  |     fails.

1/ There was one more epsilon value with 1e-8 in the tests.
2/ There was a test that check the equality of two points, in a case,
   but the test cannot be fully correct with a non-exact kernel.
This commit is contained in:
Laurent Rineau 2014-02-05 12:04:11 +01:00
parent 32dd4ebc8d
commit afe06c0b69
1 changed files with 15 additions and 7 deletions

View File

@ -822,18 +822,26 @@ private:
Point_and_primitive_id point_tree = tree.closest_point_and_primitive(query);
tree_timer.stop();
if ( point_naive.second == point_tree.second )
{
// Points should be the same
assert(point_naive.first == point_tree.first);
}
else
// Laurent Rineau, 2014/02/05: With a non exact kernel, there is no
// reason that the points are equal!
// if ( point_naive.second == point_tree.second )
// {
// // Points should be the same
// assert(point_naive.first == point_tree.first);
// }
// else
{
// Compare distance
FT dist_naive = CGAL::squared_distance(query, point_naive.first);
FT dist_tree = CGAL::squared_distance(query, point_tree.first);
const FT epsilon = FT(1e-8);
const FT epsilon = FT(1e-7);
if (CGAL::abs(dist_naive - dist_tree) > epsilon) {
std::cerr.precision(17);
std::cerr << "dist_tree: " << dist_tree
<< "\ndist_naive: " << dist_naive
<< "\ndifference: " << (dist_naive - dist_tree) << std::endl;
}
assert( (dist_naive - dist_tree) <= epsilon );
assert( (dist_naive - dist_tree) >= (-1. * epsilon) );
}