Skip to content

Commit

Permalink
Always use std::distance in lmeds
Browse files Browse the repository at this point in the history
Co-Authored-By: Kunal Tyagi <tyagi.kunal@live.com>
  • Loading branch information
mvieth and kunaltyagi authored Mar 7, 2020
1 parent 0ad9e94 commit 8bc774a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sample_consensus/include/pcl/sample_consensus/impl/lmeds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pcl::LeastMedianSquares<PointT>::computeModel (int debug_verbosity_level)
}
// Move all NaNs in distances to the end
const auto new_end = (sac_model_->getInputCloud()->is_dense ? distances.end() : std::partition (distances.begin(), distances.end(), [](double d){return !std::isnan (d);}));
const auto nr_valid_dists = (sac_model_->getInputCloud()->is_dense ? distances.size() : std::distance (distances.begin (), new_end));
const auto nr_valid_dists = std::distance (distances.begin (), new_end);

// d_cur_penalty = median (distances)
const std::size_t mid = nr_valid_dists / 2;
Expand Down Expand Up @@ -202,4 +202,3 @@ pcl::LeastMedianSquares<PointT>::computeModel (int debug_verbosity_level)
#define PCL_INSTANTIATE_LeastMedianSquares(T) template class PCL_EXPORTS pcl::LeastMedianSquares<T>;

#endif // PCL_SAMPLE_CONSENSUS_IMPL_LMEDS_H_

0 comments on commit 8bc774a

Please sign in to comment.