17 #include <mrpt/maps/CSimplePointsMap.h>
21 auto pts = mrpt::maps::CSimplePointsMap::Create();
24 for (
int ix = 0; ix < 10; ix++)
25 for (
int iy = 0; iy < 10; iy++)
26 pts->insertPoint(ix * 0.01f, 5.0f + iy * 0.01f, .0f);
29 for (
int iy = 0; iy < 10; iy++)
30 for (
int iz = 0; iz < 10; iz++)
31 pts->insertPoint(10.0f, iy * 0.01f, iz * 0.01f);
34 for (
int ix = 0; ix < 10; ix++)
35 for (
int iy = 0; iy < 10; iy++)
36 for (
int iz = 0; iz < 10; iz++)
37 pts->insertPoint(20.0f + ix * 0.01f, iy * 0.01f, iz * 0.01f);
44 auto pts = mrpt::maps::CSimplePointsMap::Create();
46 pts->insertPointFast(0.
f, 0.
f, 0.
f);
47 pts->insertPointFast(2.
f, 0.
f, 0.
f);
52 int main([[maybe_unused]]
int argc, [[maybe_unused]]
char** argv)
65 auto m = mp2p_icp::Matcher_Point2Plane::Create();
67 mrpt::containers::yaml p;
68 p[
"distanceThreshold"] = 0.1;
69 p[
"searchRadius"] = 0.1;
70 p[
"minimumPlanePoints"] = 5.0;
72 p[
"planeEigenThreshold"] = 0.1;
80 m->match(pcGlobal, pcLocal, {0, 0, 0, 0, 0, 0}, {}, ms, pairs);
81 ASSERT_(pairs.
empty());
88 m->match(pcGlobal, pcLocal, {0, 5, 0, 0, 0, 0}, {}, ms, pairs);
89 ASSERT_EQUAL_(pairs.
size(), 1U);
98 pcGlobal, pcLocal, {8.04, 0, 0.0, 0, 0, 0}, {}, ms, pairs);
99 ASSERT_EQUAL_(pairs.
size(), 1U);
104 ASSERT_NEAR_(p0.pt_local.x, 2.0, 1e-3);
105 ASSERT_NEAR_(p0.pt_local.y, 0.0, 1e-3);
106 ASSERT_NEAR_(p0.pt_local.z, 0.0, 1e-3);
108 ASSERT_NEAR_(p0.pl_global.centroid.x, 10.0, 0.01);
109 ASSERT_NEAR_(p0.pl_global.centroid.y, 0.0, 0.01);
110 ASSERT_NEAR_(p0.pl_global.centroid.z, 0.0, 0.01);
113 ASSERT_NEAR_(p0.pl_global.plane.coefs[0], 1.0, 1e-3);
114 ASSERT_NEAR_(p0.pl_global.plane.coefs[1], 0.0, 1e-3);
115 ASSERT_NEAR_(p0.pl_global.plane.coefs[2], 0.0, 1e-3);
116 ASSERT_NEAR_(p0.pl_global.plane.coefs[3], -10.0, 1e-3);
124 pcGlobal, pcLocal, {18.053, 0.05, 0.03, 0, 0, 0}, {}, ms,
133 mp2p_icp::Matcher_Points_DistanceThreshold::Create();
134 mrpt::containers::yaml p2;
135 p2[
"threshold"] = 0.1;
136 p2[
"thresholdAngularDeg"] = .0;
137 p2[
"allowMatchAlreadyMatchedPoints"] =
true;
138 mPt2Pt->initialize(p2);
141 {m, mPt2Pt}, pcGlobal, pcLocal, {8.04, 0, 0.0, 0, 0, 0},
145 ASSERT_EQUAL_(pairs.
size(), 2U);
154 mp2p_icp::Matcher_Points_DistanceThreshold::Create();
155 mrpt::containers::yaml p2;
156 p2[
"threshold"] = 0.1;
157 p2[
"thresholdAngularDeg"] = .0;
158 p2[
"allowMatchAlreadyMatchedPoints"] =
false;
159 mPt2Pt->initialize(p2);
162 {m, mPt2Pt}, pcGlobal, pcLocal, {8.04, 0, 0.0, 0, 0, 0},
166 ASSERT_EQUAL_(pairs.
size(), 1U);
171 catch (std::exception& e)
173 std::cerr << mrpt::exception_to_str(e) <<
"\n";