Skip to content

Commit

Permalink
Remove drawSamplesFromCellContainingPoint from octree
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jul 29, 2020
1 parent d7dc5dc commit dda6b95
Showing 1 changed file with 0 additions and 50 deletions.
Expand Up @@ -444,56 +444,6 @@ class Octree : public PointAccessor {
}
}

// TODO: Can this be externalized?
bool drawSamplesFromCellContainingPoint(const Point_3 &p,
std::size_t level,
std::set<std::size_t> &indices,
const std::vector<int> &shapeIndex,
std::size_t requiredSamples) {

bool upperZ, upperY, upperX;
Cell *cur = m_root;

while (cur && cur->level < level) {
upperX = cur->center.x() <= p.x();
upperY = cur->center.y() <= p.y();
upperZ = cur->center.z() <= p.z();

if (upperZ) {
if (upperY)
cur = (upperX) ? cur->child[0] : cur->child[1];
else cur = (upperX) ? cur->child[2] : cur->child[3];
} else {
if (upperY)
cur = (upperX) ? cur->child[4] : cur->child[5];
else cur = (upperX) ? cur->child[6] : cur->child[7];
}
}

if (cur) {
std::size_t enough = 0;
for (std::size_t i = cur->first; i <= cur->last; i++) {
std::size_t j = this->index(i);
if (shapeIndex[j] == -1) {
enough++;
if (enough >= requiredSamples)
break;
}
}
if (enough >= requiredSamples) {
do {
std::size_t p = CGAL::get_default_random().
uniform_int<std::size_t>(0, cur->size() - 1);
std::size_t j = this->index(cur->first + p);
if (shapeIndex[j] == -1)
indices.insert(j);
} while (indices.size() < requiredSamples);

return true;
} else return false;
} else return false;
}

std::size_t maxLevel() {
return m_max_level;
}
Expand Down

0 comments on commit dda6b95

Please sign in to comment.