5 #ifndef __pinocchio_cartesian_axis_hpp__ 6 #define __pinocchio_cartesian_axis_hpp__ 8 #include "pinocchio/fwd.hpp" 16 enum { axis = _axis, dim = 3 };
18 template<
typename V3_in,
typename V3_out>
19 inline static void cross(
const Eigen::MatrixBase<V3_in> & vin,
20 const Eigen::MatrixBase<V3_out> & vout);
23 static typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) cross(
const Eigen::MatrixBase<V3> & vin)
25 typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) res;
30 template<
typename Scalar,
typename V3_in,
typename V3_out>
31 inline static void alphaCross(
const Scalar & s,
32 const Eigen::MatrixBase<V3_in> & vin,
33 const Eigen::MatrixBase<V3_out> & vout);
35 template<
typename Scalar,
typename V3>
36 static typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) alphaCross(
const Scalar & s,
37 const Eigen::MatrixBase<V3> & vin)
39 typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) res;
40 alphaCross(s,vin,res);
44 template<
typename Scalar>
45 Eigen::Matrix<Scalar,dim,1> operator*(
const Scalar & s)
const 47 typedef Eigen::Matrix<Scalar,dim,1> ReturnType;
49 for(Eigen::DenseIndex i = 0; i < dim; ++i)
50 res[i] = i == axis ? s : Scalar(0);
55 template<
typename Scalar>
56 friend inline Eigen::Matrix<Scalar,dim,1>
62 template<
typename Vector3Like>
63 static void setTo(
const Eigen::MatrixBase<Vector3Like> v3)
65 Vector3Like & v3_ = PINOCCHIO_EIGEN_CONST_CAST(Vector3Like,v3);
66 typedef typename Vector3Like::Scalar Scalar;
68 for(Eigen::DenseIndex i = 0; i < dim; ++i)
69 v3_[i] = i == axis ? Scalar(1) : Scalar(0);
75 template<
typename V3_in,
typename V3_out>
77 const Eigen::MatrixBase<V3_out> & vout)
79 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
80 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
81 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
82 vout_[0] = 0.; vout_[1] = -vin[2]; vout_[2] = vin[1];
86 template<
typename V3_in,
typename V3_out>
88 const Eigen::MatrixBase<V3_out> & vout)
90 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
91 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
92 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
93 vout_[0] = vin[2]; vout_[1] = 0.; vout_[2] = -vin[0];
97 template<
typename V3_in,
typename V3_out>
99 const Eigen::MatrixBase<V3_out> & vout)
101 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
102 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
103 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
104 vout_[0] = -vin[1]; vout_[1] = vin[0]; vout_[2] = 0.;
108 template<
typename Scalar,
typename V3_in,
typename V3_out>
110 const Eigen::MatrixBase<V3_in> & vin,
111 const Eigen::MatrixBase<V3_out> & vout)
113 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
114 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
115 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
116 vout_[0] = 0.; vout_[1] = -s*vin[2]; vout_[2] = s*vin[1];
120 template<
typename Scalar,
typename V3_in,
typename V3_out>
122 const Eigen::MatrixBase<V3_in> & vin,
123 const Eigen::MatrixBase<V3_out> & vout)
125 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
126 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
127 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
128 vout_[0] = s*vin[2]; vout_[1] = 0.; vout_[2] = -s*vin[0];
132 template<
typename Scalar,
typename V3_in,
typename V3_out>
134 const Eigen::MatrixBase<V3_in> & vin,
135 const Eigen::MatrixBase<V3_out> & vout)
137 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in,3)
138 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out,3)
139 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out,vout);
140 vout_[0] = -s*vin[1]; vout_[1] = s*vin[0]; vout_[2] = 0.;
149 #endif // __pinocchio_cartesian_axis_hpp__
Main pinocchio namespace.