spatial-dyn
spatial_declarations.h
1 
10 #ifndef SPATIAL_DYN_EIGEN_SPATIAL_DECLARATIONS_H_
11 #define SPATIAL_DYN_EIGEN_SPATIAL_DECLARATIONS_H_
12 
13 #include <Eigen/Eigen>
14 
15 namespace spatial_dyn {
16 
17 template<typename _Scalar, int _Cols,
18  int _Options = ::Eigen::AutoAlign | ::Eigen::ColMajor, int _MaxCols = _Cols>
19 class SpatialMotion;
20 
21 template<typename _Scalar, int _Cols,
22  int _Options = ::Eigen::AutoAlign | ::Eigen::ColMajor, int _MaxCols = _Cols>
23 class SpatialForce;
24 
25 template<typename Derived>
26 class SpatialMotionBase;
27 
28 template<typename Derived>
29 class SpatialForceBase;
30 
31 template<typename Scalar>
32 class SpatialInertia;
33 
34 template<typename Scalar>
35 class SpatialInertiaMatrix;
36 
37 // From util/XprHelper.h
38 struct SpatialMotionXpr {};
39 struct SpatialForceXpr {};
40 
41 } // namespace spatial_dyn
42 
43 namespace Eigen {
44 namespace internal {
45 
46 template<typename Scalar, int Cols, int Options, int MaxCols>
47 struct traits<spatial_dyn::SpatialMotion<Scalar, Cols, Options, MaxCols>>
48  : traits<Matrix<Scalar, 6, Cols, Options, 6, MaxCols>> {
50 };
51 template<typename Scalar, int Cols, int Options, int MaxCols>
52 struct traits<spatial_dyn::SpatialForce<Scalar, Cols, Options, MaxCols>>
53  : traits<Matrix<Scalar, 6, Cols, Options, 6, MaxCols>> {
55 };
56 
57 // From util/XprHelper.h
58 template<typename Derived>
59 struct dense_xpr_base<Derived, spatial_dyn::SpatialMotionXpr> {
61 };
62 template<typename Derived>
63 struct dense_xpr_base<Derived, spatial_dyn::SpatialForceXpr> {
65 };
66 
67 // From util/XprHelper.h
68 template<typename T, int Flags>
69 struct plain_matrix_type_dense<T, spatial_dyn::SpatialMotionXpr, Flags> {
71  traits<T>::ColsAtCompileTime,
72  AutoAlign | (Flags & RowMajorBit ? RowMajor : ColMajor),
73  traits<T>::MaxColsAtCompileTime> type;
74 };
75 template<typename T, int Flags>
76 struct plain_matrix_type_dense<T, spatial_dyn::SpatialForceXpr, Flags> {
78  traits<T>::ColsAtCompileTime,
79  AutoAlign | (Flags & RowMajorBit ? RowMajor : ColMajor),
80  traits<T>::MaxColsAtCompileTime> type;
81 };
82 
83 // From util/XprHelper.h
84 // TODO: Fix
85 template<>
86 struct plain_constant_type<spatial_dyn::SpatialMotion<double,1,0,1>, double> {
87  typedef CwiseNullaryOp<scalar_constant_op<double>, const spatial_dyn::SpatialMotion<double,1,0,1>> type;
88 };
89 template<>
90 struct plain_constant_type<spatial_dyn::SpatialForce<double,1,0,1>, double> {
91  typedef CwiseNullaryOp<scalar_constant_op<double>, const spatial_dyn::SpatialForce<double,1,0,1>> type;
92 };
93 
94 // From CoreEvaluators.h
95 template<typename Scalar, int Cols, int Options, int MaxCols>
96 struct evaluator<spatial_dyn::SpatialMotion<Scalar, Cols, Options, MaxCols>>
97  : evaluator<PlainObjectBase<spatial_dyn::SpatialMotion<Scalar, Cols, Options, MaxCols>>> {
99  evaluator() {}
100  explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType> >(m) {}
101 };
102 template<typename Scalar, int Cols, int Options, int MaxCols>
103 struct evaluator<spatial_dyn::SpatialForce<Scalar, Cols, Options, MaxCols>>
104  : evaluator<PlainObjectBase<spatial_dyn::SpatialForce<Scalar, Cols, Options, MaxCols>>> {
106  evaluator() {}
107  explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType> >(m) {}
108 };
109 
110 } // namespace internal
111 } // namespace Eigen
112 
113 #endif // SPATIAL_DYN_EIGEN_SPATIAL_DECLARATIONS_H_
Definition: spatial_force_base.h:18
Definition: spatial_force.h:18
Definition: spatial_motion_base.h:18
Definition: spatial_motion.h:18
Definition: eigen.cc:16
Definition: discrete_dynamics.cc:21
Definition: spatial_declarations.h:39
Definition: spatial_declarations.h:38