Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "main.h"
00011 #include <unsupported/Eigen/AlignedVector3>
00012
00013 template<typename Scalar>
00014 void alignedvector3()
00015 {
00016 Scalar s1 = internal::random<Scalar>();
00017 Scalar s2 = internal::random<Scalar>();
00018 typedef Matrix<Scalar,3,1> RefType;
00019 typedef Matrix<Scalar,3,3> Mat33;
00020 typedef AlignedVector3<Scalar> FastType;
00021 RefType r1(RefType::Random()), r2(RefType::Random()), r3(RefType::Random()),
00022 r4(RefType::Random()), r5(RefType::Random()), r6(RefType::Random());
00023 FastType f1(r1), f2(r2), f3(r3), f4(r4), f5(r5), f6(r6);
00024 Mat33 m1(Mat33::Random());
00025
00026 VERIFY_IS_APPROX(f1,r1);
00027 VERIFY_IS_APPROX(f4,r4);
00028
00029 VERIFY_IS_APPROX(f4+f1,r4+r1);
00030 VERIFY_IS_APPROX(f4-f1,r4-r1);
00031 VERIFY_IS_APPROX(f4+f1-f2,r4+r1-r2);
00032 VERIFY_IS_APPROX(f4+=f3,r4+=r3);
00033 VERIFY_IS_APPROX(f4-=f5,r4-=r5);
00034 VERIFY_IS_APPROX(f4-=f5+f1,r4-=r5+r1);
00035 VERIFY_IS_APPROX(f5+f1-s1*f2,r5+r1-s1*r2);
00036 VERIFY_IS_APPROX(f5+f1/s2-s1*f2,r5+r1/s2-s1*r2);
00037
00038 VERIFY_IS_APPROX(m1*f4,m1*r4);
00039 VERIFY_IS_APPROX(f4.transpose()*m1,r4.transpose()*m1);
00040
00041 VERIFY_IS_APPROX(f2.dot(f3),r2.dot(r3));
00042 VERIFY_IS_APPROX(f2.cross(f3),r2.cross(r3));
00043 VERIFY_IS_APPROX(f2.norm(),r2.norm());
00044
00045 VERIFY_IS_APPROX(f2.normalized(),r2.normalized());
00046
00047 VERIFY_IS_APPROX((f2+f1).normalized(),(r2+r1).normalized());
00048
00049 f2.normalize();
00050 r2.normalize();
00051 VERIFY_IS_APPROX(f2,r2);
00052 }
00053
00054 void test_alignedvector3()
00055 {
00056 for(int i = 0; i < g_repeat; i++) {
00057 CALL_SUBTEST( alignedvector3<float>() );
00058 }
00059 }