MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / TEST

Function TEST

test/features/test_boundary_estimation.cpp:56–129  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

54
55//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56TEST (PCL, BoundaryEstimation)
57{
58 Eigen::Vector4f u = Eigen::Vector4f::Zero ();
59 Eigen::Vector4f v = Eigen::Vector4f::Zero ();
60
61 // Estimate normals first
62 NormalEstimation<PointXYZ, Normal> n;
63 PointCloud<Normal>::Ptr normals (new PointCloud<Normal> ());
64 // set parameters
65 n.setInputCloud (cloud.makeShared ());
66 pcl::IndicesPtr indicesptr (new pcl::Indices (indices));
67 n.setIndices (indicesptr);
68 n.setSearchMethod (tree);
69 n.setKSearch (static_cast<int> (indices.size ()));
70 // estimate
71 n.compute (*normals);
72
73 BoundaryEstimation<PointXYZ, Normal, Boundary> b;
74 b.setInputNormals (normals);
75 EXPECT_EQ (b.getInputNormals (), normals);
76
77 // getCoordinateSystemOnPlane
78 for (const auto &point : normals->points)
79 {
80 b.getCoordinateSystemOnPlane (point, u, v);
81 Vector4fMapConst n4uv = point.getNormalVector4fMap ();
82 EXPECT_NEAR (n4uv.dot(u), 0, 1e-4);
83 EXPECT_NEAR (n4uv.dot(v), 0, 1e-4);
84 EXPECT_NEAR (u.dot(v), 0, 1e-4);
85 }
86
87 // isBoundaryPoint (indices)
88 bool pt = false;
89 pt = b.isBoundaryPoint (cloud, 0, indices, u, v, static_cast<float>(M_PI) / 2.0);
90 EXPECT_FALSE (pt);
91 pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) / 3, indices, u, v, static_cast<float>(M_PI) / 2.0);
92 EXPECT_FALSE (pt);
93 pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) / 2, indices, u, v, static_cast<float>(M_PI) / 2.0);
94 EXPECT_FALSE (pt);
95 pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) - 1, indices, u, v, static_cast<float>(M_PI) / 2.0);
96 EXPECT_TRUE (pt);
97
98 // isBoundaryPoint (points)
99 pt = b.isBoundaryPoint (cloud, cloud[0], indices, u, v, static_cast<float>(M_PI) / 2.0);
100 EXPECT_FALSE (pt);
101 pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 3], indices, u, v, static_cast<float>(M_PI) / 2.0);
102 EXPECT_FALSE (pt);
103 pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 2], indices, u, v, static_cast<float>(M_PI) / 2.0);
104 EXPECT_FALSE (pt);
105 pt = b.isBoundaryPoint (cloud, cloud[indices.size () - 1], indices, u, v, static_cast<float>(M_PI) / 2.0);
106 EXPECT_TRUE (pt);
107
108 // Object
109 PointCloud<Boundary>::Ptr bps (new PointCloud<Boundary> ());
110
111 // set parameters
112 b.setInputCloud (cloud.makeShared ());
113 b.setIndices (indicesptr);

Callers

nothing calls this directly

Calls 12

dotMethod · 0.80
isBoundaryPointMethod · 0.80
setInputCloudMethod · 0.45
makeSharedMethod · 0.45
setIndicesMethod · 0.45
setSearchMethodMethod · 0.45
setKSearchMethod · 0.45
sizeMethod · 0.45
computeMethod · 0.45
setInputNormalsMethod · 0.45
getInputNormalsMethod · 0.45

Tested by

no test coverage detected