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

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

Question

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.

Était-ce utile?

La solution

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.

Autres conseils

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());
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top