mirror of https://github.com/CGAL/cgal
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:
parent
32dd4ebc8d
commit
afe06c0b69
|
|
@ -822,18 +822,26 @@ private:
|
||||||
Point_and_primitive_id point_tree = tree.closest_point_and_primitive(query);
|
Point_and_primitive_id point_tree = tree.closest_point_and_primitive(query);
|
||||||
tree_timer.stop();
|
tree_timer.stop();
|
||||||
|
|
||||||
if ( point_naive.second == point_tree.second )
|
// Laurent Rineau, 2014/02/05: With a non exact kernel, there is no
|
||||||
{
|
// reason that the points are equal!
|
||||||
// Points should be the same
|
// if ( point_naive.second == point_tree.second )
|
||||||
assert(point_naive.first == point_tree.first);
|
// {
|
||||||
}
|
// // Points should be the same
|
||||||
else
|
// assert(point_naive.first == point_tree.first);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
{
|
{
|
||||||
// Compare distance
|
// Compare distance
|
||||||
FT dist_naive = CGAL::squared_distance(query, point_naive.first);
|
FT dist_naive = CGAL::squared_distance(query, point_naive.first);
|
||||||
FT dist_tree = CGAL::squared_distance(query, point_tree.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) <= epsilon );
|
||||||
assert( (dist_naive - dist_tree) >= (-1. * epsilon) );
|
assert( (dist_naive - dist_tree) >= (-1. * epsilon) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue