Skip to content

Commit

Permalink
Fix row/column calculation.
Browse files Browse the repository at this point in the history
Close #3069
  • Loading branch information
abellgithub committed May 14, 2020
1 parent 06cfd4c commit 9a2d14c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions filters/SMRFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,8 @@ void SMRFilter::classifyGround(PointViewPtr view, std::vector<double>& ZIpro)
double y = view->getFieldAs<double>(Id::Y, i);
double z = view->getFieldAs<double>(Id::Z, i);

size_t c =
static_cast<size_t>(std::floor(x - m_bounds.minx) / m_args->m_cell);
size_t r =
static_cast<size_t>(std::floor(y - m_bounds.miny) / m_args->m_cell);
int c = static_cast<int>(floor((x - m_bounds.minx) / m_args->m_cell));
int r = static_cast<int>(floor((y - m_bounds.miny) / m_args->m_cell));

// TODO(chambbj): We don't quite do this by the book and yet it seems to
// work reasonably well:
Expand Down Expand Up @@ -469,8 +467,8 @@ std::vector<double> SMRFilter::createZImin(PointViewPtr view)
double y = view->getFieldAs<double>(Id::Y, i);
double z = view->getFieldAs<double>(Id::Z, i);

int c = static_cast<int>(floor(x - m_bounds.minx) / m_args->m_cell);
int r = static_cast<int>(floor(y - m_bounds.miny) / m_args->m_cell);
int c = static_cast<int>(floor((x - m_bounds.minx) / m_args->m_cell));
int r = static_cast<int>(floor((y - m_bounds.miny) / m_args->m_cell));

if (z < ZIminV[c * m_rows + r] || std::isnan(ZIminV[c * m_rows + r]))
ZIminV[c * m_rows + r] = z;
Expand Down

0 comments on commit 9a2d14c

Please sign in to comment.