12 #include <unsupported/Eigen/EulerAngles> 14 using namespace Eigen;
17 template <
typename Scalar,
class System>
24 #define VERIFY_APPROXED_RANGE(a, x, b) \ 26 VERIFY_IS_APPROX_OR_LESS_THAN(a, x); \ 27 VERIFY_IS_APPROX_OR_LESS_THAN(x, b); \ 34 template<
typename Scalar,
class EulerSystem>
55 Scalar betaRangeStart, betaRangeEnd;
58 betaRangeStart = -HALF_PI;
59 betaRangeEnd = HALF_PI;
75 const Vector3 I_ = EulerAnglesType::AlphaAxisVector();
76 const Vector3 J_ = EulerAnglesType::BetaAxisVector();
77 const Vector3 K_ = EulerAnglesType::GammaAxisVector();
87 EulerAnglesType ebis(m);
93 precision = test_precision<Scalar>();
100 const Matrix3 mbis(AngleAxisType(ebis.alpha(), I_) * AngleAxisType(ebis.beta(), J_) * AngleAxisType(ebis.gamma(), K_));
110 VERIFY(m.isApprox(mbis, precision));
125 const QuaternionType
q(e);
127 const QuaternionType qbis(ebis);
128 VERIFY(internal::isApprox<Scalar>(
std::abs(q.dot(qbis)), ONE, precision));
137 template<
signed char A,
signed char B,
signed char C,
typename Scalar>
143 template<
signed char A,
signed char B,
signed char C,
typename Scalar>
146 verify_euler_vec<+A,+B,+C>(ea);
159 verify_euler_all_neg<X,Y,Z>(ea);
160 verify_euler_all_neg<X,Y,X>(ea);
161 verify_euler_all_neg<X,Z,Y>(ea);
162 verify_euler_all_neg<X,Z,X>(ea);
164 verify_euler_all_neg<Y,Z,X>(ea);
165 verify_euler_all_neg<Y,Z,Y>(ea);
166 verify_euler_all_neg<Y,X,Z>(ea);
167 verify_euler_all_neg<Y,X,Y>(ea);
169 verify_euler_all_neg<Z,X,Y>(ea);
170 verify_euler_all_neg<Z,X,Z>(ea);
171 verify_euler_all_neg<Z,Y,X>(ea);
172 verify_euler_all_neg<Z,Y,Z>(ea);
201 const Vector3 Zero = Vector3::Zero();
217 VectorX
alpha = VectorX::LinSpaced(20,
Scalar(-0.99) * PI, PI);
218 VectorX beta = VectorX::LinSpaced(20,
Scalar(-0.49) * PI,
Scalar(0.49) * PI);
219 VectorX gamma = VectorX::LinSpaced(20,
Scalar(-0.99) * PI, PI);
220 for (
int i = 0;
i < alpha.size(); ++
i) {
221 for (
int j = 0;
j < beta.size(); ++
j) {
222 for (
int k = 0; k < gamma.size(); ++k) {
239 q1 = AngleAxisType(a, Vector3::Random().normalized());
243 Vector3 ea = m.eulerAngles(0,1,2);
245 ea = m.eulerAngles(0,1,0);
249 q1.coeffs() = Quaternionx::Coefficients::Random().normalized();
251 ea = m.eulerAngles(0,1,2);
253 ea = m.eulerAngles(0,1,0);
257 ea = (Array3::Random() + Array3(1,0,0))*
Scalar(
EIGEN_PI)*Array3(0.5,1,1);
269 ea.head(2).setZero();
279 EulerAnglesXYZd onesEd(1, 1, 1);
280 EulerAnglesXYZf onesEf = onesEd.cast<
float>();
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
#define CALL_SUBTEST_4(FUNC)
Jet< T, N > cos(const Jet< T, N > &f)
Represents a fixed Euler rotation system.
bool isApprox(const EulerAngles &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
void check_singular_cases(const Scalar &singularBeta)
#define CALL_SUBTEST_3(FUNC)
Matrix< Scalar, Dynamic, 1 > VectorX
#define VERIFY_APPROXED_RANGE(a, x, b)
Jet< T, N > sin(const Jet< T, N > &f)
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
void verify_euler(const EulerAngles< Scalar, EulerSystem > &e)
void verify_euler_all_neg(const Matrix< Scalar, 3, 1 > &ea)
EIGEN_DECLARE_TEST(EulerAngles)
#define VERIFY_IS_APPROX(a, b)
#define CALL_SUBTEST_1(FUNC)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Represents a rotation in a 3 dimensional space as three Euler angles.
EIGEN_DEVICE_FUNC const Scalar & q
void eulerangles_manual()
void verify_euler_vec(const Matrix< Scalar, 3, 1 > &ea)
Matrix< Scalar, Dynamic, Dynamic > C
The quaternion class used to represent 3D orientations and rotations.
General-purpose arrays with easy API for coefficient-wise operations.
bool verifyIsApprox(const Type1 &a, const Type2 &b)
#define VERIFY_IS_NOT_APPROX(a, b)
#define CALL_SUBTEST_2(FUNC)
void check_all_var(const Matrix< Scalar, 3, 1 > &ea)
The matrix class, also used for vectors and row-vectors.
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
const Vector3 & angles() const