Point Cloud Library: How to use pcl::addCoordinateSystem(double scale, const Eigen::Affine3f & t, int viewport = 0))

StackOverflow https://stackoverflow.com/questions/18443129

سؤال

I cannot understand how to set the transformation t in the function:

pcl::addCoordinateSystem(double scale, const Eigen::Affine3f & t, int viewport = 0))

So the question is: how can I define an Eigen::Affine3f?

I have the rotation matrix and the translation vector.

هل كانت مفيدة؟

المحلول

Having known the rotation and translation matrix, one can combine them to Affine3f.

Eigen::Affine3f tt;
tt = Eigen::Translation3f(100.,300.,0.) * Eigen::AngleAxis<float>(theta,axis);

Note that Eigen::Translation3f and Eigen::AngleAxis3f are not matrices here but of the abstract type Transform.

نصائح أخرى

If you have the rotation and translation in separate objects you can either do:

Affine3f t;
t.linear() = ...;
t.translation() = ...;

or:

t.fromPositionRotationScale(pos, rot, Vector3f::Ones());
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top