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.

Was it helpful?

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.

OTHER TIPS

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());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top