10 #ifndef EIGEN_EULERSYSTEM_H 11 #define EIGEN_EULERSYSTEM_H 16 template <
typename _Scalar,
class _System>
22 template <
int Num,
bool IsPositive = (Num > 0)>
29 struct Abs<Num, false>
42 int OtherRows=Other::RowsAtCompileTime,
43 int OtherCols=Other::ColsAtCompileTime>
47 #define EIGEN_EULER_ANGLES_CLASS_STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(COND)?1:-1] 125 template <
int _AlphaAxis,
int _BetaAxis,
int _GammaAxis>
133 static const int AlphaAxis = _AlphaAxis;
136 static const int BetaAxis = _BetaAxis;
139 static const int GammaAxis = _GammaAxis;
147 IsAlphaOpposite = (AlphaAxis < 0) ? 1 : 0,
148 IsBetaOpposite = (BetaAxis < 0) ? 1 : 0,
149 IsGammaOpposite = (GammaAxis < 0) ? 1 : 0,
153 IsOdd = ((AlphaAxisAbs)%3 == (BetaAxisAbs - 1)%3) ? 0 : 1,
154 IsEven = IsOdd ? 0 : 1,
156 IsTaitBryan = ((unsigned)AlphaAxisAbs != (
unsigned)GammaAxisAbs) ? 1 : 0
162 ALPHA_AXIS_IS_INVALID);
165 BETA_AXIS_IS_INVALID);
168 GAMMA_AXIS_IS_INVALID);
171 ALPHA_AXIS_CANT_BE_EQUAL_TO_BETA_AXIS);
174 BETA_AXIS_CANT_BE_EQUAL_TO_GAMMA_AXIS);
180 I_ = AlphaAxisAbs - 1,
181 J_ = (AlphaAxisAbs - 1 + 1 + IsOdd)%3,
182 K_ = (AlphaAxisAbs - 1 + 2 - IsOdd)%3
186 template <
typename Derived>
194 const Scalar plusMinus = IsEven? 1 : -1;
195 const Scalar minusPlus = IsOdd? 1 : -1;
205 else if(plusMinus *
mat(I_, K_) > 0) {
206 Scalar spos =
mat(J_, I_) + plusMinus *
mat(K_, J_);
207 Scalar cpos =
mat(J_, J_) + minusPlus *
mat(K_, I_);
208 Scalar alphaPlusMinusGamma =
atan2(spos, cpos);
209 res[0] = alphaPlusMinusGamma;
213 Scalar sneg = plusMinus * (
mat(K_, J_) + minusPlus *
mat(J_, I_));
214 Scalar cneg =
mat(J_, J_) + plusMinus *
mat(K_, I_);
215 Scalar alphaMinusPlusBeta =
atan2(sneg, cneg);
216 res[0] = alphaMinusPlusBeta;
221 template <
typename Derived>
230 const Scalar plusMinus = IsEven? 1 : -1;
231 const Scalar minusPlus = IsOdd? 1 : -1;
233 const Scalar Rsum =
sqrt((
mat(I_, J_) *
mat(I_, J_) +
mat(I_, K_) *
mat(I_, K_) +
mat(J_, I_) *
mat(J_, I_) +
mat(K_, I_) *
mat(K_, I_)) / 2);
242 else if(
mat(I_, I_) > 0) {
243 Scalar spos = plusMinus *
mat(K_, J_) + minusPlus *
mat(J_, K_);
244 Scalar cpos =
mat(J_, J_) +
mat(K_, K_);
249 Scalar sneg = plusMinus *
mat(K_, J_) + plusMinus *
mat(J_, K_);
250 Scalar cneg =
mat(J_, J_) -
mat(K_, K_);
256 template<
typename Scalar>
275 template <
typename _Scalar,
class _System>
285 #define EIGEN_EULER_SYSTEM_TYPEDEF(A, B, C) \ 287 typedef EulerSystem<EULER_##A, EULER_##B, EULER_##C> EulerSystem##A##B##C; 305 #endif // EIGEN_EULERSYSTEM_H
Represents a fixed Euler rotation system.
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
internal::traits< Derived >::Scalar Scalar
static void CalcEulerAngles(EulerAngles< Scalar, EulerSystem > &res, const typename EulerAngles< Scalar, EulerSystem >::Matrix3 &mat)
static void CalcEulerAngles_imp(Matrix< typename MatrixBase< Derived >::Scalar, 3, 1 > &res, const MatrixBase< Derived > &mat, internal::true_type)
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
#define EIGEN_EULER_ANGLES_CLASS_STATIC_ASSERT(COND, MSG)
Represents a rotation in a 3 dimensional space as three Euler angles.
#define EIGEN_EULER_SYSTEM_TYPEDEF(A, B, C)
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
static void CalcEulerAngles_imp(Matrix< typename MatrixBase< Derived >::Scalar, 3, 1 > &res, const MatrixBase< Derived > &mat, internal::false_type)
const AutoDiffScalar< Matrix< typename internal::traits< typename internal::remove_all< DerTypeA >::type >::Scalar, Dynamic, 1 > > atan2(const AutoDiffScalar< DerTypeA > &a, const AutoDiffScalar< DerTypeB > &b)
Jet< T, N > sqrt(const Jet< T, N > &f)
The matrix class, also used for vectors and row-vectors.
Base class for all dense matrices, vectors, and expressions.
EulerAxis
Representation of a fixed signed rotation axis for EulerSystem.
const Vector3 & angles() const