使用PCL PointXYZ结构进行数学运算吗? [英] Doing math with PCL PointXYZ structs?

查看:940
本文介绍了使用PCL PointXYZ结构进行数学运算吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对PCL(点云库)数据类型(即PointXYZ)进行数学,加法,减法的通常方法是什么?似乎甚至没有为基础定义的运算符.

What is the usual way to do math, addition, subtraction, on PCL (Point Cloud Library) data types, i.e. PointXYZ? There don't seem to be operators defined even for the basics.

我以为PCL方式可能是转换为特征向量,但似乎也没有构造函数.

I thought maybe the PCL way was to convert to Eigen vectors, but there doesn't seem to be a constructor for that either.

推荐答案

对于任何想使用PointXYZ进行基本数学运算的人,下面是一个简单的示例:

For anyone who wants to do basic math with PointXYZ, here a quick example:

  pcl::PointXYZ a(0, 1, 2), b(10, 20, 30), c;
  c.getArray3fMap() = a.getArray3fMap() + b.getArray3fMap();
  std::cout << "c=" << c << std::endl;
  //c=(10,21,32)

  c.getArray3fMap() = a.getArray3fMap() * b.getArray3fMap();
  std::cout << "c=" << c << std::endl;
  //c=(0,20,60)

也许有更好的方法,但至少可以奏效.

Maybe there is a better way but at least it works.

这篇关于使用PCL PointXYZ结构进行数学运算吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆