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