5 #ifndef __pinocchio_cartesian_axis_hpp__
6 #define __pinocchio_cartesian_axis_hpp__
8 #include "pinocchio/fwd.hpp"
22 typedef Eigen::Matrix<double, 3, 1> Vector3;
24 template<
typename V3_in,
typename V3_out>
26 cross(
const Eigen::MatrixBase<V3_in> & vin,
const Eigen::MatrixBase<V3_out> & vout);
29 static typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3)
cross(
const Eigen::MatrixBase<V3> & vin)
31 typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) res;
36 template<
typename Scalar,
typename V3_in,
typename V3_out>
37 inline static void alphaCross(
39 const Eigen::MatrixBase<V3_in> & vin,
40 const Eigen::MatrixBase<V3_out> & vout);
42 template<
typename Scalar,
typename V3>
43 static typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3)
44 alphaCross(
const Scalar & s,
const Eigen::MatrixBase<V3> & vin)
46 typename PINOCCHIO_EIGEN_PLAIN_TYPE(V3) res;
47 alphaCross(s, vin, res);
51 template<
typename Scalar>
52 Eigen::Matrix<Scalar, dim, 1> operator*(
const Scalar & s)
const
54 typedef Eigen::Matrix<Scalar, dim, 1> ReturnType;
56 for (Eigen::DenseIndex i = 0; i < dim; ++i)
57 res[i] = i == axis ? s : Scalar(0);
62 template<
typename Scalar>
63 friend inline Eigen::Matrix<Scalar, dim, 1> operator*(
const Scalar & s,
const CartesianAxis &)
68 template<
typename Vector3Like>
69 static void setTo(
const Eigen::MatrixBase<Vector3Like> v3)
71 Vector3Like & v3_ = PINOCCHIO_EIGEN_CONST_CAST(Vector3Like, v3);
72 typedef typename Vector3Like::Scalar Scalar;
74 for (Eigen::DenseIndex i = 0; i < dim; ++i)
75 v3_[i] = i == axis ? Scalar(1) : Scalar(0);
78 template<
typename Scalar>
79 static Eigen::Matrix<Scalar, 3, 1> vector()
81 typedef Eigen::Matrix<Scalar, 3, 1> Vector3;
82 return Vector3::Unit(axis);
85 static Vector3 vector()
87 return vector<double>();
93 template<
typename V3_in,
typename V3_out>
95 const Eigen::MatrixBase<V3_in> & vin,
const Eigen::MatrixBase<V3_out> & vout)
97 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
98 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
99 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
106 template<typename V3_in, typename V3_out>
108 const Eigen::MatrixBase<V3_in> & vin, const Eigen::MatrixBase<V3_out> & vout)
110 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
111 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
112 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
119 template<typename V3_in, typename V3_out>
121 const Eigen::MatrixBase<V3_in> & vin, const Eigen::MatrixBase<V3_out> & vout)
123 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
124 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
125 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
132 template<typename Scalar, typename V3_in, typename V3_out>
134 const Scalar & s, const Eigen::MatrixBase<V3_in> & vin, const Eigen::MatrixBase<V3_out> & vout)
136 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
137 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
138 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
140 vout_[1] = -s * vin[2];
141 vout_[2] = s * vin[1];
145 template<typename Scalar, typename V3_in, typename V3_out>
147 const Scalar & s, const Eigen::MatrixBase<V3_in> & vin, const Eigen::MatrixBase<V3_out> & vout)
149 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
150 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
151 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
152 vout_[0] = s * vin[2];
154 vout_[2] = -s * vin[0];
158 template<typename Scalar, typename V3_in, typename V3_out>
160 const Scalar & s, const Eigen::MatrixBase<V3_in> & vin, const Eigen::MatrixBase<V3_out> & vout)
162 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_in, 3)
163 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3_out, 3)
164 V3_out & vout_ = PINOCCHIO_EIGEN_CONST_CAST(V3_out, vout);
165 vout_[0] = -s * vin[1];
166 vout_[1] = s * vin[0];
Main pinocchio namespace.
void cross(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3xIn > &Min, const Eigen::MatrixBase< Matrix3xOut > &Mout)
Applies the cross product onto the columns of M.