// 判断两个点是否相等 bool isEqual(const Point& point1, const Point& point2) { return (point1.x == point2.x && point1.y == point2.y && point1.z == point2.z); }

// 判断点是否在点云中 bool isPointInPointCloud(const std::vector& pointCloud, const Point& point) { // 遍历点云中的每个点 for (const auto& point9 : pointCloud) { // 判断当前点是否与给定点相等 if (isEqual(point9, point)) { // 如果相等,则打印提示信息并返回true std::cout << "点p与点云文件内的点相同" << std::endl; return true; } } // 遍历完所有点后仍未找到相等的点,则返回false return false;

注释代码bool isEqualconst Point& point1 const Point& point2 return point1x == point2x && point1y == point2y && point1z == point2z;bool isPointInPointCloudconst stdvectorPoint& pointCloud const Point&

原文地址: https://www.cveoy.top/t/topic/hQOK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录