【发布时间】:2020-07-17 14:37:06
【问题描述】:
如何获得 PCL 中两点之间的距离?
我知道 PCL 中有一个函数 pcl::geometry::squaredDistance,但是当我调用这个函数时,我得到了这个错误
/usr/include/pcl-1.7/pcl/common/geometry.h: In instantiation of ‘float pcl::geometry::squaredDistance(const PointT&, const PointT&) [with PointT = pcl::PointXYZ]’:
error: no match for ‘operator-’ (operand types are ‘const pcl::PointXYZ’ and ‘const pcl::PointXYZ’)
Eigen::Vector3f diff = p1 -p2;
^
这是显示我如何使用该函数的代码
pcl::PointXYZ p1(3, 4, 5);
pcl::PointXYZ p2(0, 0, 0);
double d = pcl::geometry::squaredDistance(p1, p2);
std::cout << d << std::endl;
任何帮助将不胜感激。
【问题讨论】:
-
请努力将错误文本复制到您的问题中。
标签: point-cloud-library point-clouds