5 #ifndef __pinocchio_spatial_skew_hpp__
6 #define __pinocchio_spatial_skew_hpp__
21 template<
typename Vector3,
typename Matrix3>
22 inline void skew(
const Eigen::MatrixBase<Vector3> &
v,
const Eigen::MatrixBase<Matrix3> & M)
24 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Vector3, 3);
25 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix3, 3, 3);
28 typedef typename Matrix3::RealScalar
Scalar;
66 template<
typename Vector3Like,
typename Matrix3Like>
68 addSkew(
const Eigen::MatrixBase<Vector3Like> &
v,
const Eigen::MatrixBase<Matrix3Like> & M)
70 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like, 3);
92 template<
typename Matrix3,
typename Vector3>
93 inline void unSkew(
const Eigen::MatrixBase<Matrix3> & M,
const Eigen::MatrixBase<Vector3> &
v)
95 typedef typename Vector3::RealScalar
Scalar;
96 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Vector3, 3);
97 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix3, 3, 3);
101 v_[0] =
Scalar(0.5) * (
M(2, 1) -
M(1, 2));
102 v_[1] =
Scalar(0.5) * (
M(0, 2) -
M(2, 0));
103 v_[2] =
Scalar(0.5) * (
M(1, 0) -
M(0, 1));
115 template<
typename Matrix3>
133 template<
typename Scalar,
typename Vector3,
typename Matrix3>
135 const Scalar alpha,
const Eigen::MatrixBase<Vector3> &
v,
const Eigen::MatrixBase<Matrix3> & M)
137 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Vector3, 3);
138 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix3, 3, 3);
141 typedef typename Matrix3::RealScalar RealScalar;
143 M_(0, 0) = RealScalar(0);
146 M_(1, 0) = -M_(0, 1);
147 M_(1, 1) = RealScalar(0);
149 M_(2, 0) = -M_(0, 2);
150 M_(2, 1) = -M_(1, 2);
151 M_(2, 2) = RealScalar(0);
164 template<
typename Scalar,
typename Vector3>
181 template<
typename V1,
typename V2,
typename Matrix3>
183 const Eigen::MatrixBase<V1> &
u,
184 const Eigen::MatrixBase<V2> &
v,
185 const Eigen::MatrixBase<Matrix3> &
C)
187 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
V1, 3);
188 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V2, 3);
189 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix3, 3, 3);
192 typedef typename Matrix3::RealScalar
Scalar;
194 C_.noalias() =
v *
u.transpose();
196 C_.diagonal().array() -= udotv;
208 template<
typename V1,
typename V2>
227 template<
typename Vector3,
typename Matrix3xIn,
typename Matrix3xOut>
229 const Eigen::MatrixBase<Vector3> &
v,
230 const Eigen::MatrixBase<Matrix3xIn> & Min,
231 const Eigen::MatrixBase<Matrix3xOut> & Mout)
233 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Vector3, 3);
235 Matrix3xIn::RowsAtCompileTime == 3, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE);
237 Matrix3xOut::RowsAtCompileTime == 3, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE);
241 Mout_.row(0) =
v[1] * Min.row(2) -
v[2] * Min.row(1);
242 Mout_.row(1) =
v[2] * Min.row(0) -
v[0] * Min.row(2);
243 Mout_.row(2) =
v[0] * Min.row(1) -
v[1] * Min.row(0);
254 template<
typename Vector3,
typename Matrix3x>
256 cross(
const Eigen::MatrixBase<Vector3> &
v,
const Eigen::MatrixBase<Matrix3x> & M)
265 #endif // ifndef __pinocchio_spatial_skew_hpp__