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

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

Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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());
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top