+ filter out invalid points

This commit is contained in:
wmayer
2016-03-02 18:04:45 +01:00
parent 03dfc03c18
commit bed7af9158
5 changed files with 78 additions and 10 deletions

View File

@@ -26,6 +26,7 @@
#include "SampleConsensus.h"
#include <Mod/Points/App/Points.h>
#include <Base/Exception.h>
#include <boost/math/special_functions/fpclassify.hpp>
#if defined(HAVE_PCL_SAMPLE_CONSENSUS)
#include <pcl/point_types.h>
@@ -48,7 +49,8 @@ double SampleConsensus::perform(std::vector<float>& parameters)
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
cloud->reserve(myPoints.size());
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
cloud->push_back(pcl::PointXYZ(it->x, it->y, it->z));
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z))
cloud->push_back(pcl::PointXYZ(it->x, it->y, it->z));
}
cloud->width = int (cloud->points.size ());