8 #ifndef _LIBALMATH_ALMATH_SCENEGRAPH_ALMATHEIGEN_H_
9 #define _LIBALMATH_ALMATH_SCENEGRAPH_ALMATHEIGEN_H_
14 #include <Eigen/Dense>
20 typedef Eigen::Matrix<float, 3, 4, Eigen::RowMajor>
Matrix34frm;
24 return Matrix34f(Eigen::Map<const Matrix34frm>(&tr.r1_c1));
28 return Eigen::Matrix3f(
29 Eigen::Map<const Matrix34frm>(&tr.r1_c1).block<3, 3>(0, 0));
33 return Eigen::Vector3f(Eigen::Map<const Eigen::Vector3f>(&v.
x));
38 return Eigen::AffineCompact3f(Eigen::Map<const Matrix34frm>(&tr.r1_c1));
41 template <
typename Derived0>
44 (Eigen::internal::is_same<float, typename Derived0::Scalar>::value),
45 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
47 Eigen::Map<Matrix34frm>(&out.r1_c1) = in;
50 template <
typename Derived0>
57 template <
int _Mode,
int _Options>
60 Eigen::Map<Matrix34frm>(&out.r1_c1) = in.affine();
63 template <
int _Mode,
int _Options>
65 const Eigen::Transform<float, 3, _Mode, _Options> &tr) {
71 template <
typename Derived0>
74 (Eigen::internal::is_same<float, typename Derived0::Scalar>::value),
75 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
76 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived0, 3, 1)
80 template <
typename Derived0>
84 (Eigen::internal::is_same<float, typename Derived0::Scalar>::value),
85 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
86 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived0, 6, 1)
87 assert((in.rows() == 6) && (in.cols() == 1));
88 Eigen::Map<Vector6f>(&out.
xd) = in;
91 template <
typename Derived0>
94 (Eigen::internal::is_same<float, typename Derived0::Scalar>::value),
95 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
96 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived0, 6, 1)
97 return Velocity6D(in[0], in[1], in[2], in[3], in[4], in[5]);
Create and play with a Velocity6D.
Eigen::Matrix< float, 3, 4, Eigen::RowMajor > Matrix34frm
void toALMathTransform(const Eigen::MatrixBase< Derived0 > &in, Transform &out)
Eigen::AffineCompact3f toEigenAffineCompact3(const AL::Math::Transform &tr)
Eigen::Vector3f toEigenVector3(const AL::Math::Position3D &v)
Eigen::Matrix3f toEigenMatrix3(const AL::Math::Transform &tr)
void toALMathVelocity6D(const Eigen::MatrixBase< Derived0 > &in, Velocity6D &out)
Create and play with a Position3D.
Eigen::Matrix< float, 3, 4 > Matrix34f
Position3D toALMathPosition3D(const Eigen::MatrixBase< Derived0 > &in)
Matrix34f toEigenMatrix34(const AL::Math::Transform &tr)
Eigen::Matrix< float, 6, 1 > Vector6f