This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Map<Vector3d> and Translation3d (Geometry module) bug ?

Tags: None
(comma "," separated)
benlaug
Registered Member
Posts
2
Karma
0
Hi,

It seems that a mapped vector with Map<Vector3d> cannot be translated by the Geometry module unlike the others transformations. For instance:

Code: Select all

double data[] = {1, 2, 3};
Map<Vector3d> map(data);

Translation3d t(2,2,2);
AngleAxisd a(M_PI, Vector3d::UnitX());

map = t * map; // Compiler error
map = a * map; // OK


The compiler error is the following using clang++:

Code: Select all

eigentest.cc:14:7: error: no viable overloaded '='
  map = t * map;
  ~~~ ^ ~~~~~~~
/usr/include/eigen3/Eigen/src/Core/MatrixBase.h:163:14: note: candidate function not viable: no known conversion from 'AffineTransformType' (aka 'Transform<Scalar, Dim, Affine>') to 'const Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> > >' for 1st argument;
    Derived& operator=(const MatrixBase& other);
             ^
/usr/include/eigen3/Eigen/src/Core/MapBase.h:246:14: note: candidate function not viable: no known conversion from 'AffineTransformType' (aka 'Transform<Scalar, Dim, Affine>') to 'const Eigen::MapBase<Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> >, 1>' for 1st argument;
    Derived& operator=(const MapBase& other)
             ^
/usr/include/eigen3/Eigen/src/Core/Map.h:185:5: note: candidate function not viable: no known conversion from 'AffineTransformType' (aka 'Transform<Scalar, Dim, Affine>') to 'const Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> >' for 1st argument;
    EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
    ^
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:330:3: note: expanded from:
  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
  ^
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:322:32: note: expanded from:
  EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
                               ^
/usr/include/eigen3/Eigen/src/Core/MatrixBase.h:169:14: note: candidate template ignored: failed template argument deduction
    Derived& operator=(const DenseBase<OtherDerived>& other);
             ^
/usr/include/eigen3/Eigen/src/Core/MatrixBase.h:172:14: note: candidate template ignored: failed template argument deduction
    Derived& operator=(const EigenBase<OtherDerived>& other);
             ^
/usr/include/eigen3/Eigen/src/Core/MatrixBase.h:175:14: note: candidate template ignored: failed template argument deduction
    Derived& operator=(const ReturnByValue<OtherDerived>& other);
             ^
In file included from /usr/include/eigen3/Eigen/Dense:1:
In file included from /usr/include/eigen3/Eigen/Core:291:
/usr/include/eigen3/Eigen/src/Core/Assign.h:507:3: error: no member named 'YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES' in 'Eigen::internal::static_assertion<false>'
  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
  ^
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:198:5: note: expanded from:
    YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES)
    ^
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:126:65: note: expanded from:
        if (Eigen::internal::static_assertion<bool(CONDITION)>::MSG) {}
                                                                ^
/usr/include/eigen3/Eigen/src/Core/Assign.h:537:97: note: in instantiation of function template specialization 'Eigen::DenseBase<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4>, 3, 3, false, true> >::lazyAssign<Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> > >' requested here
  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
                                                                                                ^
/usr/include/eigen3/Eigen/src/Core/Assign.h:577:59: note: in instantiation of member function 'Eigen::internal::assign_selector<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4>, 3, 3, false, true>, Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> >, false, false>::run' requested here
  return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
                                                          ^
/usr/include/eigen3/Eigen/src/Geometry/Translation.h:212:16: note: in instantiation of function template specialization 'Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4>, 3, 3, false, true> >::operator=<Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> > >' requested here
  res.linear() = linear.derived();
               ^
eigentest.cc:14:11: note: in instantiation of function template specialization 'Eigen::Translation<double, 3>::operator*<Eigen::Map<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0, Eigen::Stride<0, 0> > >' requested here
  map = t * map;
          ^
2 errors generated.


What can I do to fix this?

Thanks
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This is a serious one: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=669

A workaround is to use Vector3f(map). The compiler should be able to remove this useless copy.
benlaug
Registered Member
Posts
2
Karma
0
Thank you very much for your answer !


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]