Skip to content

Commit

Permalink
Change to do-while loop to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
chambbj committed Dec 2, 2019
1 parent 69255ab commit ac2ac97
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions filters/SkewnessBalancingFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)
point_count_t n1(0);
double delta, delta_n, term1, M1, M2, M3;
M1 = M2 = M3 = 0.0;
std::vector<double> skewness;
std::vector<double> skewness(view->size());
for (PointId i = 0; i < view->size(); ++i)
{
double z = view->getFieldAs<double>(Dimension::Id::Z, i);
Expand All @@ -83,15 +83,15 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)
}

PointId j(0);
const auto size(view->size());
for (PointId i = size - 1; i < size; --i)
PointId i(view->size());
do
{
if (skewness[i] <= 0)
{
j = i;
break;
}
}
} while (--i != 0);

std::set<PointId> groundIdx;
for (PointId i = 0; i <= j; ++i)
Expand All @@ -106,13 +106,16 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)

PointViewSet SkewnessBalancingFilter::run(PointViewPtr input)
{
PointViewSet viewSet;
if (!input->size())
return viewSet;

bool logOutput = log()->getLevel() > LogLevel::Debug1;
if (logOutput)
log()->floatPrecision(8);

auto idx = processGround(input);

PointViewSet viewSet;
if (!idx.empty())
{
// set the classification label of ground returns as 2
Expand Down

0 comments on commit ac2ac97

Please sign in to comment.