aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/geo_transformations.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2012-03-30 23:22:29 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2012-03-30 23:22:29 +0200
commit48f0bbb58624e3a65dc989d6e4b24ed58c4465e4 (patch)
treed8f540a1c5b8382b231e158ec546227a088224f9 /test/geo_transformations.cpp
parent63ea667ed78b35a0b59be341dc23c1d09c2fa776 (diff)
fix bug #362 and add missing specialization for affine-compact * projective
Diffstat (limited to 'test/geo_transformations.cpp')
-rw-r--r--test/geo_transformations.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp
index 9156954a2..e9f05cfb6 100644
--- a/test/geo_transformations.cpp
+++ b/test/geo_transformations.cpp
@@ -446,6 +446,29 @@ template<typename Scalar> void transform_alignment()
#endif
}
+template<typename Scalar, int Dim, int Options> void transform_products()
+{
+ typedef Matrix<Scalar,Dim+1,Dim+1> Mat;
+ typedef Transform<Scalar,Dim,Projective,Options> Proj;
+ typedef Transform<Scalar,Dim,Affine,Options> Aff;
+ typedef Transform<Scalar,Dim,AffineCompact,Options> AffC;
+
+ Proj p; p.matrix().setRandom();
+ Aff a; a.linear().setRandom(); a.translation().setRandom();
+ AffC ac = a;
+
+ Mat p_m(p.matrix()), a_m(a.matrix());
+
+ VERIFY_IS_APPROX((p*p).matrix(), p_m*p_m);
+ VERIFY_IS_APPROX((a*a).matrix(), a_m*a_m);
+ VERIFY_IS_APPROX((p*a).matrix(), p_m*a_m);
+ VERIFY_IS_APPROX((a*p).matrix(), a_m*p_m);
+ VERIFY_IS_APPROX((ac*a).matrix(), a_m*a_m);
+ VERIFY_IS_APPROX((a*ac).matrix(), a_m*a_m);
+ VERIFY_IS_APPROX((p*ac).matrix(), p_m*a_m);
+ VERIFY_IS_APPROX((ac*p).matrix(), a_m*p_m);
+}
+
void test_geo_transformations()
{
for(int i = 0; i < g_repeat; i++) {
@@ -468,5 +491,9 @@ void test_geo_transformations()
CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|AutoAlign>() ));
CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|DontAlign>() ));
+
+
+ CALL_SUBTEST_7(( transform_products<double,3,RowMajor|AutoAlign>() ));
+ CALL_SUBTEST_7(( transform_products<float,2,AutoAlign>() ));
}
}