geometry-conversion.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2019, CNRS
3  * Copyright 2018-2019, INRIA
4  */
5 
6 #ifndef __eigenpy_geometry_conversion_hpp__
7 #define __eigenpy_geometry_conversion_hpp__
8 
9 #include "eigenpy/fwd.hpp"
10 #include <Eigen/Geometry>
11 
12 namespace eigenpy
13 {
14 
15  namespace bp = boost::python;
16 
17  template<typename Scalar,int Options=0>
19  {
20 
21  typedef typename Eigen::Matrix<Scalar,3,1,Options> Vector3;
22  typedef typename Eigen::Matrix<Scalar,3,3,Options> Matrix3;
23  typedef typename Vector3::Index Index;
24 
25  typedef typename Eigen::AngleAxis<Scalar> AngleAxis;
26 
27  static void expose()
28  {
29  bp::def("toEulerAngles",&EulerAnglesConvertor::toEulerAngles,
30  bp::args("mat (dim 3x3)","a0","a1","a2"),
31  "It returns the Euler-angles of the rotation matrix mat using the convention defined by the triplet (a0,a1,a2).");
32 
33  bp::def("fromEulerAngles",&EulerAnglesConvertor::fromEulerAngles,
34  bp::args("ea (vector of Euler angles)","a0","a1","a2"),
35  "It returns the rotation matrix associated to the Euler angles using the convention defined by the triplet (a0,a1,a2).");
36  }
37 
38  static Vector3 toEulerAngles(const Matrix3 & mat,
39  Index a0,
40  Index a1,
41  Index a2)
42  {
43  return mat.eulerAngles(a0,a1,a2);
44  }
45 
46  static Matrix3 fromEulerAngles(const Vector3 & ea,
47  Index a0,
48  Index a1,
49  Index a2)
50  {
51  Matrix3 mat;
52  mat = AngleAxis(ea[0], Vector3::Unit(a0))
53  * AngleAxis(ea[1], Vector3::Unit(a1))
54  * AngleAxis(ea[2], Vector3::Unit(a2));
55  return mat;
56  }
57  };
58 
59 
60 } // namespace eigenpy
61 
62 #endif // define __eigenpy_geometry_conversion_hpp__
static Matrix3 fromEulerAngles(const Vector3 &ea, Index a0, Index a1, Index a2)
Eigen::Matrix< Scalar, 3, 3, Options > Matrix3
static Vector3 toEulerAngles(const Matrix3 &mat, Index a0, Index a1, Index a2)
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Eigen::AngleAxis< Scalar > AngleAxis


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59