mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +08:00
test case for unaligned quaternion
This commit is contained in:
parent
0aa752fc4f
commit
e3306953ef
@ -28,7 +28,7 @@
|
|||||||
#include <Eigen/LU>
|
#include <Eigen/LU>
|
||||||
#include <Eigen/SVD>
|
#include <Eigen/SVD>
|
||||||
|
|
||||||
template<typename Scalar> void quaternion(void)
|
template<typename Scalar, int Options> void quaternion(void)
|
||||||
{
|
{
|
||||||
/* this test covers the following files:
|
/* this test covers the following files:
|
||||||
Quaternion.h
|
Quaternion.h
|
||||||
@ -36,7 +36,7 @@ template<typename Scalar> void quaternion(void)
|
|||||||
|
|
||||||
typedef Matrix<Scalar,3,3> Matrix3;
|
typedef Matrix<Scalar,3,3> Matrix3;
|
||||||
typedef Matrix<Scalar,3,1> Vector3;
|
typedef Matrix<Scalar,3,1> Vector3;
|
||||||
typedef Quaternion<Scalar> Quaternionx;
|
typedef Quaternion<Scalar,Options> Quaternionx;
|
||||||
typedef AngleAxis<Scalar> AngleAxisx;
|
typedef AngleAxis<Scalar> AngleAxisx;
|
||||||
|
|
||||||
Scalar largeEps = test_precision<Scalar>();
|
Scalar largeEps = test_precision<Scalar>();
|
||||||
@ -139,11 +139,39 @@ template<typename Scalar> void mapQuaternion(void){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Scalar> void quaternionAlignment(void){
|
||||||
|
typedef Quaternion<Scalar,AutoAlign> QuaternionA;
|
||||||
|
typedef Quaternion<Scalar,DontAlign> QuaternionUA;
|
||||||
|
|
||||||
|
EIGEN_ALIGN16 Scalar array1[4];
|
||||||
|
EIGEN_ALIGN16 Scalar array2[4];
|
||||||
|
EIGEN_ALIGN16 Scalar array3[4+1];
|
||||||
|
Scalar* arrayunaligned = array3+1;
|
||||||
|
|
||||||
|
QuaternionA *q1 = ::new(reinterpret_cast<void*>(array1)) QuaternionA;
|
||||||
|
QuaternionUA *q2 = ::new(reinterpret_cast<void*>(array2)) QuaternionUA;
|
||||||
|
QuaternionUA *q3 = ::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionUA;
|
||||||
|
|
||||||
|
q1->coeffs().setRandom();
|
||||||
|
*q2 = *q1;
|
||||||
|
*q3 = *q1;
|
||||||
|
|
||||||
|
VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs());
|
||||||
|
VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs());
|
||||||
|
#ifdef EIGEN_VECTORIZE
|
||||||
|
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionA));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void test_geo_quaternion()
|
void test_geo_quaternion()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < g_repeat; i++) {
|
for(int i = 0; i < g_repeat; i++) {
|
||||||
CALL_SUBTEST_1( quaternion<float>() );
|
CALL_SUBTEST_1(( quaternion<float,AutoAlign>() ));
|
||||||
CALL_SUBTEST_2( quaternion<double>() );
|
CALL_SUBTEST_2(( quaternion<double,AutoAlign>() ));
|
||||||
|
CALL_SUBTEST_3(( quaternion<float,DontAlign>() ));
|
||||||
|
CALL_SUBTEST_4(( quaternion<double,DontAlign>() ));
|
||||||
|
CALL_SUBTEST_5(( quaternionAlignment<float>() ));
|
||||||
|
CALL_SUBTEST_6(( quaternionAlignment<double>() ));
|
||||||
CALL_SUBTEST( mapQuaternion<float>() );
|
CALL_SUBTEST( mapQuaternion<float>() );
|
||||||
CALL_SUBTEST( mapQuaternion<double>() );
|
CALL_SUBTEST( mapQuaternion<double>() );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user