mirror of https://github.com/CGAL/cgal
distance_instance no longer created on the heap
This commit is contained in:
parent
0670679671
commit
cf62cd62c2
|
|
@ -78,7 +78,7 @@ int max_k;
|
||||||
int actual_k;
|
int actual_k;
|
||||||
|
|
||||||
|
|
||||||
Distance* distance_instance;
|
Distance distance_instance;
|
||||||
|
|
||||||
inline bool branch(FT distance) {
|
inline bool branch(FT distance) {
|
||||||
if (actual_k<max_k) return true;
|
if (actual_k<max_k) return true;
|
||||||
|
|
@ -137,9 +137,8 @@ Distance* distance_instance;
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
Orthogonal_k_neighbor_search(Tree& tree, const Query_item& q,
|
Orthogonal_k_neighbor_search(Tree& tree, const Query_item& q,
|
||||||
int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance()) {
|
int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance())
|
||||||
|
: distance_instance(d) {
|
||||||
distance_instance=new Distance(d);
|
|
||||||
|
|
||||||
multiplication_factor=
|
multiplication_factor=
|
||||||
d.transformed_distance(1.0+Eps);
|
d.transformed_distance(1.0+Eps);
|
||||||
|
|
@ -184,7 +183,6 @@ Distance* distance_instance;
|
||||||
// destructor
|
// destructor
|
||||||
~Orthogonal_k_neighbor_search() {
|
~Orthogonal_k_neighbor_search() {
|
||||||
l.clear();
|
l.clear();
|
||||||
delete distance_instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -215,8 +213,9 @@ Distance* distance_instance;
|
||||||
if (old_off<FT(0.0)) old_off=FT(0.0);
|
if (old_off<FT(0.0)) old_off=FT(0.0);
|
||||||
}
|
}
|
||||||
new_rd=
|
new_rd=
|
||||||
distance_instance->
|
distance_instance.new_distance(rd,old_off,
|
||||||
new_distance(rd,old_off,new_off,new_cut_dim);
|
new_off,
|
||||||
|
new_cut_dim);
|
||||||
if (branch(new_rd))
|
if (branch(new_rd))
|
||||||
compute_neighbors_orthogonally(N->upper(),
|
compute_neighbors_orthogonally(N->upper(),
|
||||||
new_rd);
|
new_rd);
|
||||||
|
|
@ -235,8 +234,9 @@ Distance* distance_instance;
|
||||||
if (old_off<FT(0.0)) old_off=FT(0.0);
|
if (old_off<FT(0.0)) old_off=FT(0.0);
|
||||||
}
|
}
|
||||||
new_rd=
|
new_rd=
|
||||||
distance_instance->
|
distance_instance. new_distance(rd,old_off,
|
||||||
new_distance(rd,old_off,new_off,new_cut_dim);
|
new_off,
|
||||||
|
new_cut_dim);
|
||||||
if (branch(new_rd))
|
if (branch(new_rd))
|
||||||
compute_neighbors_orthogonally(N->lower(),
|
compute_neighbors_orthogonally(N->lower(),
|
||||||
new_rd);
|
new_rd);
|
||||||
|
|
@ -250,8 +250,7 @@ Distance* distance_instance;
|
||||||
for (Point_d_iterator it=N->begin(); it != N->end(); it++) {
|
for (Point_d_iterator it=N->begin(); it != N->end(); it++) {
|
||||||
number_of_items_visited++;
|
number_of_items_visited++;
|
||||||
FT distance_to_query_object=
|
FT distance_to_query_object=
|
||||||
distance_instance->
|
distance_instance.transformed_distance(query_object,**it);
|
||||||
transformed_distance(query_object,**it);
|
|
||||||
insert(*it,distance_to_query_object);
|
insert(*it,distance_to_query_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue