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