@@ -61,6 +61,36 @@ PointCloud<PointNormal>::Ptr cloud_with_normals1 (new PointCloud<PointNormal>);
6161search::KdTree<PointXYZ>::Ptr tree3;
6262search::KdTree<PointNormal>::Ptr tree4;
6363
64+ TEST (PCL, MovingLeastSquares_almost_on_line)
65+ {
66+ PointCloud<PointXYZ>::Ptr cloud_almost_on_line (new PointCloud<PointXYZ>);
67+ cloud_almost_on_line->push_back (pcl::PointXYZ (-89.546 , 4.03964 , 450.883 ));
68+ cloud_almost_on_line->push_back (pcl::PointXYZ (-88.8728 , 4.03964 , 450.883 ));
69+ cloud_almost_on_line->push_back (pcl::PointXYZ (-86.8529 , 4.03964 , 450.883 ));
70+ cloud_almost_on_line->push_back (pcl::PointXYZ (-85.5064 , 4.03964 , 450.883 ));
71+
72+ // Init objects
73+ PointCloud<PointXYZ> mls_points;
74+ MovingLeastSquares<PointXYZ, PointXYZ> mls;
75+
76+ // Set parameters
77+ mls.setInputCloud (cloud_almost_on_line);
78+ mls.setSearchRadius (4.65032 );
79+ mls.setUpsamplingMethod (MovingLeastSquares<PointXYZ, PointXYZ>::SAMPLE_LOCAL_PLANE);
80+ mls.setUpsamplingRadius (0.8 );
81+ mls.setUpsamplingStepSize (0.4 );
82+
83+ // Reconstruct
84+ mls.process (mls_points);
85+ ASSERT_FALSE (mls_points.empty ());
86+
87+ for (const auto & mls_point : mls_points)
88+ {
89+ // Check for NaNs in output
90+ EXPECT_TRUE (pcl::isFinite (mls_point));
91+ }
92+ }
93+
6494// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6595TEST (PCL, MovingLeastSquares)
6696{
0 commit comments