fix furthest orthogonal incremental neighbor

previously the current distance was always larger than the initial
one. As a result no branch of the tree could be filtered out and
all the nodes were visited.
This commit is contained in:
Sébastien Loriot 2016-06-06 14:41:33 +02:00
parent ccaa1729ca
commit 6ec27d359e
1 changed files with 3 additions and 4 deletions

View File

@ -174,7 +174,7 @@ namespace CGAL {
else{ else{
distance_to_root= distance_to_root=
Orthogonal_distance_instance.max_distance_to_rectangle(q, Orthogonal_distance_instance.max_distance_to_rectangle(q,
tree.bounding_box()); tree.bounding_box(), dists);
Node_with_distance *The_Root = new Node_with_distance(tree.root(), Node_with_distance *The_Root = new Node_with_distance(tree.root(),
distance_to_root, dists); distance_to_root, dists);
PriorityQueue.push(The_Root); PriorityQueue.push(The_Root);
@ -372,10 +372,9 @@ namespace CGAL {
FT diff1 = val - node->upper_low_value(); FT diff1 = val - node->upper_low_value();
FT diff2 = val - node->lower_high_value(); FT diff2 = val - node->lower_high_value();
if (diff1 + diff2 < FT(0.0)) { if (diff1 + diff2 < FT(0.0)) {
diff1 = val - node->upper_high_value();
new_rd= new_rd=
Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim); Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim);
CGAL_assertion(new_rd >= copy_rd);
Node_with_distance *Lower_Child = Node_with_distance *Lower_Child =
new Node_with_distance(node->lower(), copy_rd, dists); new Node_with_distance(node->lower(), copy_rd, dists);
PriorityQueue.push(Lower_Child); PriorityQueue.push(Lower_Child);
@ -385,8 +384,8 @@ namespace CGAL {
} }
else { // compute new distance else { // compute new distance
diff2 = val - node->lower_low_value();
new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim); new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim);
CGAL_assertion(new_rd >= copy_rd);
Node_with_distance *Upper_Child = Node_with_distance *Upper_Child =
new Node_with_distance(node->upper(), copy_rd, dists); new Node_with_distance(node->upper(), copy_rd, dists);
PriorityQueue.push(Upper_Child); PriorityQueue.push(Upper_Child);