From 955e0962774188847c8f2883f7006efa9723571d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 27 Jan 2011 17:17:06 +0100 Subject: add an Options template parameter to Hyperplane and ParametrizedLine --- test/geo_hyperplane.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'test/geo_hyperplane.cpp') diff --git a/test/geo_hyperplane.cpp b/test/geo_hyperplane.cpp index 23027f38e..de3c6df0b 100644 --- a/test/geo_hyperplane.cpp +++ b/test/geo_hyperplane.cpp @@ -35,6 +35,7 @@ template void hyperplane(const HyperplaneType& _plane) */ typedef typename HyperplaneType::Index Index; const Index dim = _plane.dim(); + enum { Options = HyperplaneType::Options }; typedef typename HyperplaneType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; @@ -85,9 +86,9 @@ template void hyperplane(const HyperplaneType& _plane) // casting const int Dim = HyperplaneType::AmbientDimAtCompileTime; typedef typename GetDifferentType::type OtherScalar; - Hyperplane hp1f = pl1.template cast(); + Hyperplane hp1f = pl1.template cast(); VERIFY_IS_APPROX(hp1f.template cast(),pl1); - Hyperplane hp1d = pl1.template cast(); + Hyperplane hp1d = pl1.template cast(); VERIFY_IS_APPROX(hp1d.template cast(),pl1); } @@ -128,11 +129,40 @@ template void lines() } } +template void hyperplane_alignment() +{ + typedef Hyperplane Plane3a; + typedef Hyperplane Plane3u; + + EIGEN_ALIGN16 Scalar array1[4]; + EIGEN_ALIGN16 Scalar array2[4]; + EIGEN_ALIGN16 Scalar array3[4+1]; + Scalar* array3u = array3+1; + + Plane3a *p1 = ::new(reinterpret_cast(array1)) Plane3a; + Plane3u *p2 = ::new(reinterpret_cast(array2)) Plane3u; + Plane3u *p3 = ::new(reinterpret_cast(array3u)) Plane3u; + + p1->coeffs().setRandom(); + *p2 = *p1; + *p3 = *p1; + + VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs()); + VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs()); + + #ifdef EIGEN_VECTORIZE + VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Plane3a)); + #endif +} + + void test_geo_hyperplane() { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( hyperplane(Hyperplane()) ); CALL_SUBTEST_2( hyperplane(Hyperplane()) ); + CALL_SUBTEST_2( hyperplane(Hyperplane()) ); + CALL_SUBTEST_2( hyperplane_alignment() ); CALL_SUBTEST_3( hyperplane(Hyperplane()) ); CALL_SUBTEST_4( hyperplane(Hyperplane,5>()) ); CALL_SUBTEST_1( lines() ); -- cgit v1.2.3