IDEigenInterface.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef INVDYNEIGENINTERFACE_HPP_
  2. #define INVDYNEIGENINTERFACE_HPP_
  3. #include "../IDConfig.hpp"
  4. namespace btInverseDynamics
  5. {
  6. #define BT_ID_HAVE_MAT3X
  7. #ifdef BT_USE_DOUBLE_PRECISION
  8. typedef Eigen::Matrix<double, Eigen::Dynamic, 1, Eigen::DontAlign> vecx;
  9. typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> vec3;
  10. typedef Eigen::Matrix<double, 3, 3, Eigen::DontAlign> mat33;
  11. typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> matxx;
  12. typedef Eigen::Matrix<double, 3, Eigen::Dynamic, Eigen::DontAlign> mat3x;
  13. #else
  14. typedef Eigen::Matrix<float, Eigen::Dynamic, 1, Eigen::DontAlign> vecx;
  15. typedef Eigen::Matrix<float, 3, 1, Eigen::DontAlign> vec3;
  16. typedef Eigen::Matrix<float, 3, 3, Eigen::DontAlign> mat33;
  17. typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> matxx;
  18. typedef Eigen::Matrix<float, 3, Eigen::Dynamic, Eigen::DontAlign> mat3x;
  19. #endif
  20. inline void resize(mat3x &m, Eigen::Index size)
  21. {
  22. m.resize(3, size);
  23. m.setZero();
  24. }
  25. inline void setMatxxElem(const idArrayIdx row, const idArrayIdx col, const idScalar val, matxx *m)
  26. {
  27. (*m)(row, col) = val;
  28. }
  29. inline void setMat3xElem(const idArrayIdx row, const idArrayIdx col, const idScalar val, mat3x *m)
  30. {
  31. (*m)(row, col) = val;
  32. }
  33. } // namespace btInverseDynamics
  34. #endif // INVDYNEIGENINTERFACE_HPP_