Construct Eigen :: Convert from Eigen :: Translation

I have the following code:

void mySetTransform(const Eigen::Affine3d& T);
...
mySetTransform(Eigen::Translation3d(1.0,2.0,3.0));

It is not compiled, it cannot convert Eigen::Translation3dto Eigen::Affine3d. The following line causes the same error:

Eigen::Affine3d test = Eigen::Translation3d(r);

But this is wonderful:

Eigen::Affine3d test;
test = Eigen::Translation3d(r);

So it looks like the statement =works fine, but the building constructor Eigen::Affine3dwith is Eigen::Translation3dnot defined.

The documentation has a note for the class Translation:

This class is not intended to be used to store the translation of a transformation, but rather to simplify the construction and updating of Transform objects.

, , Translation, Eigen/Geomerty ( )?

+4
1

, Transform from Translation . :

Translation3d t(1.0,2.0,3.0);
mySetTransform(Affine3f(t));

:

Affine3d test1(t);  // OK
Affine3d test2 = t; // NOT OK

, , ( =), . ++. , :

Affine3d test3 = Affine3d(t); // OK
+3

Source: https://habr.com/ru/post/1544760/


All Articles