42 using namespace Eigen;
53 while (l < r && points[l](axis) < splitValue)
57 while (r > l && points[r](axis) >= splitValue)
87 if (max[axis] - min[axis] <= voxelSize)
91 double minDist = (points[closest] - center).squaredNorm();
92 for (
int i = 1; i < n; i++)
94 double dist = (points[i] - center).squaredNorm();
102 for (
int i = 0; i < n; i++)
104 flagged[i] = i != closest;
109 int l =
splitPoints(points, n, axis, center[axis]);
114 lMax[axis] = center[axis];
115 rMin[axis] = center[axis];
120 createOctree(points , l , flagged , lMin, lMax, level + 1, voxelSize, maxLeafSize);
123 if (n - l > maxLeafSize)
126 createOctree(points + l, n - l, flagged + l, rMin, rMax, level + 1, voxelSize, maxLeafSize);
132 bool* flagged =
new bool[n];
133 for (
int i = 0; i < n; i++)
140 #pragma omp parallel // allows "pragma omp task"
141 #pragma omp single // only execute every task once
142 createOctree(points, n, flagged, boundingBox.
min(), boundingBox.
max(), 0, voxelSize, maxLeafSize);
155 points[i] = points[n];
156 flagged[i] = flagged[n];