Skip to content

Commit

Permalink
Make supercluster.hpp v0.3.0 gcc compatible by renaming shadowed decl…
Browse files Browse the repository at this point in the history
…eration (#20)
  • Loading branch information
tobrun authored and mourner committed Sep 13, 2018
1 parent 8dd0068 commit 01ff6f2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions include/supercluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ class Supercluster {

zoom.tree.within(origin.pos.x, origin.pos.y, r, [&](const auto &id) {
assert(id < zoom.clusters.size());
const auto &c = zoom.clusters[id];
if (c.parent_id == cluster_id) {
visitor(c);
const auto &cluster_child = zoom.clusters[id];
if (cluster_child.parent_id == cluster_id) {
visitor(cluster_child);
hasChildren = true;
}
});
Expand All @@ -334,24 +334,24 @@ class Supercluster {
std::uint32_t &skipped,
const TVisitor &visitor) const {

eachChild(cluster_id, [&, this](const auto &c) {
eachChild(cluster_id, [&, this](const auto &cluster_leaf) {
if (limit == 0)
return;
if (c.num_points > 1) {
if (skipped + c.num_points <= offset) {
if (cluster_leaf.num_points > 1) {
if (skipped + cluster_leaf.num_points <= offset) {
// skip the whole cluster
skipped += c.num_points;
skipped += cluster_leaf.num_points;
} else {
// enter the cluster
this->eachLeaf(c.id, limit, offset, skipped, visitor);
this->eachLeaf(cluster_leaf.id, limit, offset, skipped, visitor);
// exit the cluster
}
} else if (skipped < offset) {
// skip a single point
skipped++;
} else {
// visit a single point
visitor(c);
visitor(cluster_leaf);
limit--;
}
});
Expand Down

0 comments on commit 01ff6f2

Please sign in to comment.