10 #ifndef EIGEN_LGSM_LIE_ALGEBRA_so3_H 11 #define EIGEN_LGSM_LIE_ALGEBRA_so3_H 19 return (Scalar(0.5) + (Scalar(-1.) + n2 / Scalar(30.)) * n2 / Scalar(24.) );
21 return (Scalar(1.0) - cos_n)/n2;
26 return ( (Scalar(-1.)+(Scalar(1.)/Scalar(15.)+(Scalar(-1.)/Scalar(560.)+n2/Scalar(37800.))*n2)*n2)/Scalar(12.) );
28 return ( Scalar(2.)*( Scalar(0.5)*(n2-Scalar(2.)+Scalar(2.)*cos_n )/(n2*n2) ) - (n - std::sin(n))/(n2*n) );
33 return (Scalar(20.)+(Scalar(-1.)+n2/Scalar(42.))*n2)/Scalar(120.);
35 return (n - sin_n)/(n2*n);
40 return (-Scalar(21.)+(Scalar(1.)+(-Scalar(1.)/Scalar(48.)+Scalar(1.)/Scalar(3960.)*n2)*n2)*n2)/Scalar(1260.) ;
42 return Scalar(3)*( (n*n2-Scalar(6)*n+Scalar(6)*sin_n)/(Scalar(6)*n*n2*n2) ) - ( Scalar(0.5)*(n2-Scalar(2)+Scalar(2)*cos_n )/(n2*n2) );
59 template<
class Derived>
61 public MatrixBase<Derived>
65 typedef MatrixBase<Derived>
Base;
90 template<class OtherDerived> EIGEN_STRONG_INLINE Derived& operator=(const
LieAlgebraBase<BaseType, OtherDerived>& other);
92 template<class OtherDerived> EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase<OtherDerived>& other) {
104 inline Group exp(Scalar precision = 1.e-5)
const;
108 inline Matrix<Scalar, 3, 3> dexp(Scalar precision = 1.e-6, Scalar precision2 = 1.e-2)
const;
112 template<
class OtherDerived> Matrix<Scalar, 3, 3>
inline d2exp(
const MatrixBase<OtherDerived>& v, Scalar precision = 1.e-6, Scalar precision2 = 1.e-2)
const;
126 template<
class Derived>
130 this->
get() = other.
get();
134 template<
class Derived>
135 template<
class OtherDerived>
139 this->
get() = other.
get();
144 template<
class Derived>
145 template<
class OtherDerived>
149 return this->cross(ang);
160 template<
class Derived>
164 const Scalar n2 = this->squaredNorm();
168 const Scalar w = Scalar(1.0) + (Scalar(-1.0) + n2 / Scalar(48.0)) * n2 / Scalar(8.0);
169 return Group(w, (Scalar(1.0) + (Scalar(-1.0) + Scalar(0.0125) * n2) * n2 / Scalar(24.0)) / Scalar(2.0) * *
this);
173 const Scalar n = std::sqrt(n2);
174 const Scalar w = std::cos(n * Scalar(0.5));
175 return Group(w, std::sin(n * Scalar(0.5)) / n * *
this);
180 template<
class Derived>
183 Scalar precision2)
const 185 Scalar n2 = this->squaredNorm();
186 Scalar n = std::sqrt(n2);
187 Scalar sin_n = std::sin(n);
188 Scalar cos_n = std::cos(n);
193 Matrix<Scalar, 3, 3> m;
195 m(0,0) = Scalar(1.0) - f3 * (n2 - this->coeff(0)*this->coeff(0));
196 m(1,1) = Scalar(1.0) - f3 * (n2 - this->coeff(1)*this->coeff(1));
197 m(2,2) = Scalar(1.0) - f3 * (n2 - this->coeff(2)*this->coeff(2));
199 m(1, 0) = f3 * this->coeff(0) * this->coeff(1) - f2 * this->coeff(2);
200 m(0, 1) = m(1,0) + 2 * f2 * this->coeff(2);
202 m(2, 0) = f3 * this->coeff(0) * this->coeff(2) + f2 * this->coeff(1);
203 m(0, 2) = m(2,0) - 2 * f2 * this->coeff(1);
205 m(2, 1) = f3 * this->coeff(1) * this->coeff(2) - f2 * this->coeff(0);
206 m(1, 2) = m(2,1) + 2 * f2 * this->coeff(0);
212 template<
class Derived>
213 template<
class OtherDerived>
217 Scalar precision2)
const 219 Scalar n2 = this->squaredNorm();
220 Scalar n = std::sqrt(n2);
221 Scalar cos_n = std::cos(n);
222 Scalar sin_n = std::sin(n);
229 Scalar vw = this->dot(vec);
233 Matrix<Scalar, 3, 3> m;
235 m(0,0) = - 2 * f3 * (this->coeff(2) * vec[2] + this->coeff(1) * vec[1]) - df3 * vw * (n2 - this->coeff(0)*this->coeff(0));
236 m(1,1) = - 2 * f3 * (this->coeff(2) * vec[2] + this->coeff(0) * vec[0]) - df3 * vw * (n2 - this->coeff(1)*this->coeff(1));
237 m(2,2) = - 2 * f3 * (this->coeff(1) * vec[1] + this->coeff(0) * vec[0]) - df3 * vw * (n2 - this->coeff(2)*this->coeff(2));
239 m(1, 0) = -vec[2] * f2 + f3 * (this->coeff(0)*vec[1] + this->coeff(1)*vec[0]) + vw * (df3 * this->coeff(0) * this->coeff(1) - df2 * this->coeff(2));
240 m(0, 1) = m(1,0) + 2 * vec[2] * f2 + 2 * vw * df2 * this->coeff(2);
242 m(2, 0) = vec[1] * f2 + f3 * (this->coeff(0)*vec[2] + this->coeff(2)*vec[0]) + vw * (df3 * this->coeff(0) * this->coeff(2) + df2 * this->coeff(1));
243 m(0, 2) = m(2,0) - 2 * vec[1] * f2 - 2 * vw * df2 * this->coeff(1);
245 m(2, 1) = -vec[0] * f2 + f3 * (this->coeff(2)*vec[1] + this->coeff(1)*vec[2]) + vw * (df3 * this->coeff(1) * this->coeff(2) - df2 * this->coeff(0));
246 m(1, 2) = m(2,1) + 2 * vec[0] * f2 + 2 * vw * df2 * this->coeff(0);
257 template<
typename Scalar>
258 struct traits<
LieAlgebraDual<Matrix<Scalar, 3, 1> > > :
public traits<Matrix<Scalar, 3, 1> >
264 template<
typename Scalar,
int MapOptions>
265 struct traits<Map<
LieAlgebraDual<Matrix<Scalar, 3, 1> >, MapOptions> > :
public traits<Map<Matrix<Scalar, 3, 1>, MapOptions> >
271 template<
typename Scalar,
int MapOptions>
272 struct traits<Map<const
LieAlgebraDual<Matrix<Scalar, 3, 1> >, MapOptions> > :
public traits<Map<const Matrix<Scalar, 3, 1>, MapOptions> >
297 template<
typename Scalar>
299 :
public traits<LieAlgebraBase<Matrix<Scalar, 3, 1>, LieAlgebra<Matrix<Scalar, 3, 1> > > >
305 template<
typename Scalar,
int Options>
306 struct traits<Map<
LieAlgebra<Matrix<Scalar, 3, 1> >, Options> >
307 :
public traits<LieAlgebraBase<Matrix<Scalar, 3, 1>, LieAlgebra<Matrix<Scalar, 3, 1> > > >
313 template<
typename Scalar,
int Options>
314 struct traits<Map<const
LieAlgebra<Matrix<Scalar, 3, 1> >, Options> >
315 :
public traits<LieAlgebraBase<Matrix<Scalar, 3, 1>, LieAlgebra<Matrix<Scalar, 3, 1> > > >
323 template<
typename _Scalar>
325 public LieAlgebraBase<Matrix<_Scalar, 3, 1>, LieAlgebra<Matrix<_Scalar, 3, 1> > >
334 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
LieAlgebra)
344 template<
class Derived>
349 inline LieAlgebra(Scalar x, Scalar y, Scalar z) : m_coeffs(x, y, z) {}
372 template<
typename _Scalar>
374 public LieAlgebraDualBase<Matrix<_Scalar, 3, 1>, LieAlgebraDual<Matrix<_Scalar, 3, 1> > >
internal::traits< Derived >::Group Group
LieAlgebra(const Coefficients &a)
LieAlgebraDual(const LieAlgebraDual &a)
LieAlgebraDual(const Coefficients &a)
LieGroup< Quaternion< Scalar > > Group
LieAlgebraBase< Matrix< _Scalar, 3, 1 >, LieAlgebra< Matrix< _Scalar, 3, 1 > > > Base
Class describing an element of a Lie Algebra.
Matrix< Scalar, 3, 3 > Matrix3
Matrix< Scalar, 3, 1 > BaseType
LieAlgebraDualBase< Matrix< _Scalar, 3, 1 >, LieAlgebraDual< Matrix< _Scalar, 3, 1 > > > Base
Scalar ei_lie_algebra_so3_derivative_f3(Scalar n, Scalar n2, Scalar sin_n, Scalar precision)
internal::traits< LieAlgebraDual< Matrix< Scalar, 3, 1 > > >::Coefficients Coefficients
const Derived & derived() const
LieAlgebra(Scalar x, Scalar y, Scalar z)
Map< Matrix< Scalar, 3, 1 >, Options > Coefficients
LieAlgebraDual(Scalar x, Scalar y, Scalar z)
LieAlgebra(const LieAlgebra &a)
Scalar ei_lie_algebra_so3_derivative_f2(Scalar n, Scalar n2, Scalar cos_n, Scalar precision)
Group exp(Scalar precision=1.e-6) const
Matrix< Scalar, 3, 1 > Coefficients
Map< const Matrix< Scalar, 3, 1 >, Options > Coefficients
LieGroup< Quaternion< Scalar > > Group
internal::traits< LieAlgebra< Matrix< Scalar, 3, 1 > > >::Coefficients Coefficients
#define LIE_INHERIT_MATRIX_BASE(r, c)
LieGroup< Quaternion< Scalar > > Group
LieGroup< Quaternion< Scalar > > Group
Base class for all Lie Algebra class.
internal::traits< Derived >::Coefficients Coefficients
EIGEN_STRONG_INLINE Scalar ei_lie_algebra_so3_derivative_df2(Scalar n, Scalar n2, Scalar cos_n, Scalar sin_n, Scalar precision)
Class describing an element of a Lie Group.
Map< const Matrix< Scalar, 3, 1 >, MapOptions > Coefficients
Class describing an element of a Lie algebra dual.
LieGroup< Quaternion< Scalar > > Group
EIGEN_STRONG_INLINE Scalar ei_lie_algebra_so3_derivative_df3(Scalar n, Scalar n2, Scalar cos_n, Scalar sin_n, Scalar precision)
Matrix< Scalar, 3, 1 > Coefficients
Map< Matrix< Scalar, 3, 1 >, MapOptions > Coefficients
LieGroup< Quaternion< Scalar > > Group
PlainObject bracket(const LieAlgebraBase< BaseType, OtherDerived > &a) const
MatrixBase< Derived > Base
LieAlgebra(const LieAlgebraBase< typename Base::BaseType, Derived > &a)