+ add support to PointKernel to get valid points

This commit is contained in:
wmayer
2015-12-30 15:18:05 +01:00
parent 4e3856acc8
commit 1274967208
2 changed files with 35 additions and 7 deletions

View File

@@ -27,6 +27,8 @@
# include <iostream>
#endif
#include <boost/math/special_functions/fpclassify.hpp>
#include <Base/Exception.h>
#include <Base/Matrix.h>
#include <Base/Persistence.h>
@@ -97,6 +99,31 @@ unsigned int PointKernel::getMemSize (void) const
return _Points.size() * sizeof(value_type);
}
PointKernel::size_type PointKernel::countValid(void) const
{
size_type num = 0;
for (const_point_iterator it = begin(); it != end(); ++it) {
if (!(boost::math::isnan(it->x) ||
boost::math::isnan(it->y) ||
boost::math::isnan(it->z)))
num++;
}
return num;
}
std::vector<PointKernel::value_type> PointKernel::getValidPoints() const
{
std::vector<PointKernel::value_type> valid;
valid.reserve(countValid());
for (const_point_iterator it = begin(); it != end(); ++it) {
if (!(boost::math::isnan(it->x) ||
boost::math::isnan(it->y) ||
boost::math::isnan(it->z)))
valid.push_back(value_type(it->x, it->y, it->z));
}
return valid;
}
void PointKernel::Save (Base::Writer &writer) const
{
if (!writer.isForceXML()) {