Skip to content

Commit

Permalink
Fix computation of voxel indices (#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
chambbj authored and abellgithub committed Apr 6, 2018
1 parent a7046ff commit ed68fb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions filters/VoxelCenterNearestNeighborFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ PointViewSet VoxelCenterNearestNeighborFilter::run(PointViewPtr view)
double y = view->getFieldAs<double>(Dimension::Id::Y, id);
double x = view->getFieldAs<double>(Dimension::Id::X, id);
double z = view->getFieldAs<double>(Dimension::Id::Z, id);
size_t r = static_cast<size_t>(floor(y - bounds.miny) / m_cell);
size_t c = static_cast<size_t>(floor(x - bounds.minx) / m_cell);
size_t d = static_cast<size_t>(floor(z - bounds.minz) / m_cell);
size_t r = static_cast<size_t>((y - bounds.miny) / m_cell);
size_t c = static_cast<size_t>((x - bounds.minx) / m_cell);
size_t d = static_cast<size_t>((z - bounds.minz) / m_cell);
populated_voxels.emplace(std::make_tuple(r, c, d));
}

Expand Down
6 changes: 3 additions & 3 deletions filters/VoxelCentroidNearestNeighborFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ PointViewSet VoxelCentroidNearestNeighborFilter::run(PointViewPtr view)
double y = view->getFieldAs<double>(Dimension::Id::Y, id);
double x = view->getFieldAs<double>(Dimension::Id::X, id);
double z = view->getFieldAs<double>(Dimension::Id::Z, id);
size_t r = static_cast<size_t>(floor(y - bounds.miny) / m_cell);
size_t c = static_cast<size_t>(floor(x - bounds.minx) / m_cell);
size_t d = static_cast<size_t>(floor(z - bounds.minz) / m_cell);
size_t r = static_cast<size_t>((y - bounds.miny) / m_cell);
size_t c = static_cast<size_t>((x - bounds.minx) / m_cell);
size_t d = static_cast<size_t>((z - bounds.minz) / m_cell);
populated_voxel_ids[std::make_tuple(r, c, d)].push_back(id);
}

Expand Down

0 comments on commit ed68fb5

Please sign in to comment.