Skip to content

Commit

Permalink
Add voxel debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Aug 17, 2018
1 parent 3f6acaf commit 01ca0c3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions filters/VoxelCenterNearestNeighborFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ PointViewSet VoxelCenterNearestNeighborFilter::run(PointViewPtr view)
double z = bounds.minz + (d + 0.5) * m_cell;
std::vector<PointId> neighbors = kdi.neighbors(x, y, z, 1);
output->appendPoint(*view, neighbors[0]);

PointId id = neighbors[0];
y = view->getFieldAs<double>(Dimension::Id::Y, id);
x = view->getFieldAs<double>(Dimension::Id::X, id);
z = view->getFieldAs<double>(Dimension::Id::Z, id);
size_t r2 = static_cast<size_t>((y - bounds.miny) / m_cell);
size_t c2 = static_cast<size_t>((x - bounds.minx) / m_cell);
size_t d2 = static_cast<size_t>((z - bounds.minz) / m_cell);

if (r2 != r || c2 != c || d2 != d)
std::cerr << "Voxel - Point voxel = " << r << "/" << c << "/" << d <<
" - " << r2 << "/" << c2 << "/" << d2 << "!\n";
}

PointViewSet viewSet;
Expand Down

0 comments on commit 01ca0c3

Please sign in to comment.