for const auto& edge resulta遍历所有生成树的边 pclPointXYZRGB p0 = cloud1-pointsedgesrc;在点云cloud里面找到该索引对应的点值 pclPointXYZRGB p00 = cloud1-pointsedgetgt; 判断叶尖点与找到边两点是否相同若相同则将该边加入yr1点云指针将该边加入容器yr1
for (auto it = resulta.begin(); it != resulta.end(); ) { const auto& edge = *it; pcl::PointXYZRGB p0 = cloud1->points[edge.src]; pcl::PointXYZRGB p00 = cloud1->points[edge.tgt];
if ((point56.x == p0.x) && (point56.y == p0.y) && (point56.z == p0.z))
{
yr1->push_back(p00);
distances = distances + euclideanDistance(point56, p00);
point56 = p00;
it = resulta.erase(it);
}
else if ((point56.x == p00.x) && (point56.y == p00.y) && (point56.z == p00.z))
{
yr1->push_back(p0);
distances = distances + euclideanDistance(point56, p0);
point56 = p0;
it = resulta.erase(it);
}
else
{
++it;
}
原文地址: https://www.cveoy.top/t/topic/iTU8 著作权归作者所有。请勿转载和采集!