From e1867288672b7f8acff34fbdee59e7bb05ab9ead Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 18 May 2009 17:55:50 +0200 Subject: fix #1 : need to nest by value the affine part in homogeneous product --- test/geo_homogeneous.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'test/geo_homogeneous.cpp') diff --git a/test/geo_homogeneous.cpp b/test/geo_homogeneous.cpp index 5deb0d530..bf568bb03 100644 --- a/test/geo_homogeneous.cpp +++ b/test/geo_homogeneous.cpp @@ -33,10 +33,10 @@ template void homogeneous(void) typedef Matrix MatrixType; typedef Matrix VectorType; - + typedef Matrix HMatrixType; typedef Matrix HVectorType; - + typedef Matrix T1MatrixType; typedef Matrix T2MatrixType; typedef Matrix T3MatrixType; @@ -51,17 +51,17 @@ template void homogeneous(void) HVectorType hv0 = HVectorType::Random(), hv1 = HVectorType::Random(); - + MatrixType m0 = MatrixType::Random(), m1 = MatrixType::Random(); - + HMatrixType hm0 = HMatrixType::Random(), hm1 = HMatrixType::Random(); hv0 << v0, 1; VERIFY_IS_APPROX(v0.homogeneous(), hv0); VERIFY_IS_APPROX(v0, hv0.hnormalized()); - + hm0 << m0, ones.transpose(); VERIFY_IS_APPROX(m0.colwise().homogeneous(), hm0); VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized()); @@ -69,16 +69,16 @@ template void homogeneous(void) for(int j=0; j void homogeneous(void) v0.transpose().rowwise().homogeneous() * t3); VERIFY_IS_APPROX((m0.transpose().rowwise().homogeneous().eval()) * t3, m0.transpose().rowwise().homogeneous() * t3); + + // test product with a Transform object + Transform Rt; + Matrix pts, Rt_pts1; + + Rt.setIdentity(); + pts.setRandom(Size,5); + + Rt_pts1 = Rt * pts.colwise().homogeneous(); + std::cerr << (Rt_pts1 - pts).sum() << "\n"; + VERIFY_IS_MUCH_SMALLER_THAN( (Rt_pts1 - pts).sum(), Scalar(1)); } void test_geo_homogeneous() -- cgit v1.2.3