-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions
44 lines (40 loc) · 1.19 KB
/
functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*void rkd_tree::explore_best(std::shared_ptr<node> ¤t, const point &q, double &R, int &res, std::set<std::pair<double, int>> &pq, int m, int rp) {
if(current == nullptr) return;
if(current-> left == nullptr && current->right == nullptr && current->pts.size() != 0) {
double d = dist(points[current->pts[0]], q);
if(d < R) {
R = d;
res = current->pts[0];
double pmed = current->parent->median;
int index = current->parent->index;
point plane = q;
plane[index] = pmed;
double r = dist(plane, q);
pq.insert({r, m});
}
} else {
double med = current->median;
int index = current->index;
point plane = q;
plane[index] = med;
double r = dist(plane, q);
if(rp <= r) {
if(q[index] <= med)
explore_best(current->right, q, r, res, pq, m, rp);
else
explore_best(current->left, q, r, res, pq, m, rp);
} else {
if(q[index] <= med)
explore_best(current->right, q, r, res, pq, m, rp);
else
explore_best(current->left, q, r, res, pq, m, rp);
}
}
}
*/
// double pmed = current->parent->median;
// int index = current->parent->index;
// point plane = q;
// plane[index] = pmed;
// double r = dist(plane, q);
// pq.insert({r, m});