50 double val = point(this->
axis);
51 if (val < this->
split)
53 this->
lesser->nnInternal(point, neighbor, maxDist);
54 if (val + maxDist >= this->split)
56 this->
greater->nnInternal(point, neighbor, maxDist);
61 this->
greater->nnInternal(point, neighbor, maxDist);
62 if (val - maxDist <= this->
split)
64 this->
lesser->nnInternal(point, neighbor, maxDist);
86 double maxDistSq = maxDist * maxDist;
88 for (
int i = 0; i < this->
count; i++)
90 double dist = (point - this->
points[i]).squaredNorm();
93 neighbor = &this->
points[i];
100 maxDist = sqrt(maxDistSq);
111 if (n <= maxLeafSize)
119 double splitValue = boundingBox.
avg()(splitAxis);
130 int l =
splitPoints(points, n, splitAxis, splitValue);
134 if (n > 8 * maxLeafSize)
136 #pragma omp task shared(lesser)
139 #pragma omp task shared(greater)
157 size_t n = scan->numPoints();
158 auto points = boost::shared_array<Point>(
new Point[n]);
160 #pragma omp parallel for schedule(static)
161 for (
size_t i = 0; i < n; i++)
166 #pragma omp parallel // allows "pragma omp task"
167 #pragma omp single // only execute every task once
180 centroid_m = Vector3d::Zero();
181 centroid_d = Vector3d::Zero();
183 for (
size_t i = 0; i < scan->numPoints(); i++)
185 if (neighbors[i] !=
nullptr)
187 centroid_m += neighbors[i]->cast<
double>();
188 centroid_d += scan->point(i);
201 double distance = 0.0;
203 #pragma omp parallel for firstprivate(distance) reduction(+:found) schedule(dynamic,8)
204 for (
size_t i = 0; i < scan->numPoints(); i++)
206 if (tree->nearestNeighbor(scan->point(i), neighbors[i], distance, maxDistance))