cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

geo_alignedbox.cpp (18093B)


      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
      5 //
      6 // This Source Code Form is subject to the terms of the Mozilla
      7 // Public License v. 2.0. If a copy of the MPL was not distributed
      8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
      9 
     10 #include "main.h"
     11 #include <Eigen/Geometry>
     12 
     13 using namespace std;
     14 
     15 // NOTE the following workaround was needed on some 32 bits builds to kill extra precision of x87 registers.
     16 // It seems that it is not needed anymore, but let's keep it here, just in case...
     17 
     18 template<typename T> EIGEN_DONT_INLINE
     19 void kill_extra_precision(T& /* x */) {
     20   // This one worked but triggered a warning:
     21   /* eigen_assert((void*)(&x) != (void*)0); */
     22   // An alternative could be:
     23   /* volatile T tmp = x; */
     24   /* x = tmp; */
     25 }
     26 
     27 
     28 template<typename BoxType> void alignedbox(const BoxType& box)
     29 {
     30   /* this test covers the following files:
     31      AlignedBox.h
     32   */
     33   typedef typename BoxType::Scalar Scalar;
     34   typedef NumTraits<Scalar> ScalarTraits;
     35   typedef typename ScalarTraits::Real RealScalar;
     36   typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
     37 
     38   const Index dim = box.dim();
     39 
     40   VectorType p0 = VectorType::Random(dim);
     41   VectorType p1 = VectorType::Random(dim);
     42   while( p1 == p0 ){
     43       p1 =  VectorType::Random(dim); }
     44   RealScalar s1 = internal::random<RealScalar>(0,1);
     45 
     46   BoxType b0(dim);
     47   BoxType b1(VectorType::Random(dim),VectorType::Random(dim));
     48   BoxType b2;
     49 
     50   kill_extra_precision(b1);
     51   kill_extra_precision(p0);
     52   kill_extra_precision(p1);
     53 
     54   b0.extend(p0);
     55   b0.extend(p1);
     56   VERIFY(b0.contains(p0*s1+(Scalar(1)-s1)*p1));
     57   VERIFY(b0.contains(b0.center()));
     58   VERIFY_IS_APPROX(b0.center(),(p0+p1)/Scalar(2));
     59 
     60   (b2 = b0).extend(b1);
     61   VERIFY(b2.contains(b0));
     62   VERIFY(b2.contains(b1));
     63   VERIFY_IS_APPROX(b2.clamp(b0), b0);
     64 
     65   // intersection
     66   BoxType box1(VectorType::Random(dim));
     67   box1.extend(VectorType::Random(dim));
     68   BoxType box2(VectorType::Random(dim));
     69   box2.extend(VectorType::Random(dim));
     70 
     71   VERIFY(box1.intersects(box2) == !box1.intersection(box2).isEmpty());
     72 
     73   // alignment -- make sure there is no memory alignment assertion
     74   BoxType *bp0 = new BoxType(dim);
     75   BoxType *bp1 = new BoxType(dim);
     76   bp0->extend(*bp1);
     77   delete bp0;
     78   delete bp1;
     79 
     80   // sampling
     81   for( int i=0; i<10; ++i )
     82   {
     83       VectorType r = b0.sample();
     84       VERIFY(b0.contains(r));
     85   }
     86 
     87 }
     88 
     89 template<typename BoxType> void alignedboxTranslatable(const BoxType& box)
     90 {
     91   typedef typename BoxType::Scalar Scalar;
     92   typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
     93   typedef Transform<Scalar, BoxType::AmbientDimAtCompileTime, Isometry> IsometryTransform;
     94   typedef Transform<Scalar, BoxType::AmbientDimAtCompileTime, Affine> AffineTransform;
     95 
     96   alignedbox(box);
     97 
     98   const VectorType Ones = VectorType::Ones();
     99   const VectorType UnitX = VectorType::UnitX();
    100   const Index dim = box.dim();
    101 
    102   // box((-1, -1, -1), (1, 1, 1))
    103   BoxType a(-Ones, Ones);
    104 
    105   VERIFY_IS_APPROX(a.sizes(), Ones * Scalar(2));
    106 
    107   BoxType b = a;
    108   VectorType translate = Ones;
    109   translate[0] = Scalar(2);
    110   b.translate(translate);
    111   // translate by (2, 1, 1) -> box((1, 0, 0), (3, 2, 2))
    112 
    113   VERIFY_IS_APPROX(b.sizes(), Ones * Scalar(2));
    114   VERIFY_IS_APPROX((b.min)(), UnitX);
    115   VERIFY_IS_APPROX((b.max)(), Ones * Scalar(2) + UnitX);
    116 
    117   // Test transform
    118 
    119   IsometryTransform tf = IsometryTransform::Identity();
    120   tf.translation() = -translate;
    121 
    122   BoxType c = b.transformed(tf);
    123   // translate by (-2, -1, -1) -> box((-1, -1, -1), (1, 1, 1))
    124   VERIFY_IS_APPROX(c.sizes(), a.sizes());
    125   VERIFY_IS_APPROX((c.min)(), (a.min)());
    126   VERIFY_IS_APPROX((c.max)(), (a.max)());
    127 
    128   c.transform(tf);
    129   // translate by (-2, -1, -1) -> box((-3, -2, -2), (-1, 0, 0))
    130   VERIFY_IS_APPROX(c.sizes(), a.sizes());
    131   VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) - UnitX);
    132   VERIFY_IS_APPROX((c.max)(), -UnitX);
    133 
    134   // Scaling
    135 
    136   AffineTransform atf = AffineTransform::Identity();
    137   atf.scale(Scalar(3));
    138   c.transform(atf);
    139   // scale by 3 -> box((-9, -6, -6), (-3, 0, 0))
    140   VERIFY_IS_APPROX(c.sizes(), Scalar(3) * a.sizes());
    141   VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-6) - UnitX * Scalar(3));
    142   VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(-3));
    143 
    144   atf = AffineTransform::Identity();
    145   atf.scale(Scalar(-3));
    146   c.transform(atf);
    147   // scale by -3 -> box((27, 18, 18), (9, 0, 0))
    148   VERIFY_IS_APPROX(c.sizes(), Scalar(9) * a.sizes());
    149   VERIFY_IS_APPROX((c.min)(), UnitX * Scalar(9));
    150   VERIFY_IS_APPROX((c.max)(), Ones * Scalar(18) + UnitX * Scalar(9));
    151 
    152   // Check identity transform within numerical precision.
    153   BoxType transformedC = c.transformed(IsometryTransform::Identity());
    154   VERIFY_IS_APPROX(transformedC, c);
    155 
    156   for (size_t i = 0; i < 10; ++i)
    157   {
    158     VectorType minCorner;
    159     VectorType maxCorner;
    160     for (Index d = 0; d < dim; ++d)
    161     {
    162       minCorner[d] = internal::random<Scalar>(-10,10);
    163       maxCorner[d] = minCorner[d] + internal::random<Scalar>(0, 10);
    164     }
    165 
    166     c = BoxType(minCorner, maxCorner);
    167 
    168     translate = VectorType::Random();
    169     c.translate(translate);
    170 
    171     VERIFY_IS_APPROX((c.min)(), minCorner + translate);
    172     VERIFY_IS_APPROX((c.max)(), maxCorner + translate);
    173   }
    174 }
    175 
    176 template<typename Scalar, typename Rotation>
    177 Rotation rotate2D(Scalar angle) {
    178   return Rotation2D<Scalar>(angle);
    179 }
    180 
    181 template<typename Scalar, typename Rotation>
    182 Rotation rotate2DIntegral(typename NumTraits<Scalar>::NonInteger angle) {
    183   typedef typename NumTraits<Scalar>::NonInteger NonInteger;
    184   return Rotation2D<NonInteger>(angle).toRotationMatrix().
    185       template cast<Scalar>();
    186 }
    187 
    188 template<typename Scalar, typename Rotation>
    189 Rotation rotate3DZAxis(Scalar angle) {
    190   return AngleAxis<Scalar>(angle, Matrix<Scalar, 3, 1>(0, 0, 1));
    191 }
    192 
    193 template<typename Scalar, typename Rotation>
    194 Rotation rotate3DZAxisIntegral(typename NumTraits<Scalar>::NonInteger angle) {
    195   typedef typename NumTraits<Scalar>::NonInteger NonInteger;
    196   return AngleAxis<NonInteger>(angle, Matrix<NonInteger, 3, 1>(0, 0, 1)).
    197       toRotationMatrix().template cast<Scalar>();
    198 }
    199 
    200 template<typename Scalar, typename Rotation>
    201 Rotation rotate4DZWAxis(Scalar angle) {
    202   Rotation result = Matrix<Scalar, 4, 4>::Identity();
    203   result.block(0, 0, 3, 3) = rotate3DZAxis<Scalar, AngleAxisd>(angle).toRotationMatrix();
    204   return result;
    205 }
    206 
    207 template <typename MatrixType>
    208 MatrixType randomRotationMatrix()
    209 {
    210   // algorithm from
    211   // https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/III-7/103/2016/isprs-annals-III-7-103-2016.pdf
    212   const MatrixType rand = MatrixType::Random();
    213   const MatrixType q = rand.householderQr().householderQ();
    214   const JacobiSVD<MatrixType> svd = q.jacobiSvd(ComputeFullU | ComputeFullV);
    215   const typename MatrixType::Scalar det = (svd.matrixU() * svd.matrixV().transpose()).determinant();
    216   MatrixType diag = rand.Identity();
    217   diag(MatrixType::RowsAtCompileTime - 1, MatrixType::ColsAtCompileTime - 1) = det;
    218   const MatrixType rotation = svd.matrixU() * diag * svd.matrixV().transpose();
    219   return rotation;
    220 }
    221 
    222 template <typename Scalar, int Dim>
    223 Matrix<Scalar, Dim, (1<<Dim)> boxGetCorners(const Matrix<Scalar, Dim, 1>& min_, const Matrix<Scalar, Dim, 1>& max_)
    224 {
    225   Matrix<Scalar, Dim, (1<<Dim) > result;
    226   for(Index i=0; i<(1<<Dim); ++i)
    227   {
    228     for(Index j=0; j<Dim; ++j)
    229       result(j,i) = (i & (1<<j)) ? min_(j) : max_(j);
    230   }
    231   return result;
    232 }
    233 
    234 template<typename BoxType, typename Rotation> void alignedboxRotatable(
    235     const BoxType& box,
    236     Rotation (*rotate)(typename NumTraits<typename BoxType::Scalar>::NonInteger /*_angle*/))
    237 {
    238   alignedboxTranslatable(box);
    239 
    240   typedef typename BoxType::Scalar Scalar;
    241   typedef typename NumTraits<Scalar>::NonInteger NonInteger;
    242   typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
    243   typedef Transform<Scalar, BoxType::AmbientDimAtCompileTime, Isometry> IsometryTransform;
    244   typedef Transform<Scalar, BoxType::AmbientDimAtCompileTime, Affine> AffineTransform;
    245 
    246   const VectorType Zero = VectorType::Zero();
    247   const VectorType Ones = VectorType::Ones();
    248   const VectorType UnitX = VectorType::UnitX();
    249   const VectorType UnitY = VectorType::UnitY();
    250   // this is vector (0, 0, -1, -1, -1, ...), i.e. with zeros at first and second dimensions
    251   const VectorType UnitZ = Ones - UnitX - UnitY;
    252 
    253   // in this kind of comments the 3D case values will be illustrated
    254   // box((-1, -1, -1), (1, 1, 1))
    255   BoxType a(-Ones, Ones);
    256 
    257   // to allow templating this test for both 2D and 3D cases, we always set all
    258   // but the first coordinate to the same value; so basically 3D case works as
    259   // if you were looking at the scene from top
    260 
    261   VectorType minPoint = -2 * Ones;
    262   minPoint[0] = -3;
    263   VectorType maxPoint = Zero;
    264   maxPoint[0] = -1;
    265   BoxType c(minPoint, maxPoint);
    266   // box((-3, -2, -2), (-1, 0, 0))
    267 
    268   IsometryTransform tf2 = IsometryTransform::Identity();
    269   // for some weird reason the following statement has to be put separate from
    270   // the following rotate call, otherwise precision problems arise...
    271   Rotation rot = rotate(NonInteger(EIGEN_PI));
    272   tf2.rotate(rot);
    273 
    274   c.transform(tf2);
    275   // rotate by 180 deg around origin -> box((1, 0, -2), (3, 2, 0))
    276 
    277   VERIFY_IS_APPROX(c.sizes(), a.sizes());
    278   VERIFY_IS_APPROX((c.min)(), UnitX - UnitZ * Scalar(2));
    279   VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(3) + UnitY * Scalar(2));
    280 
    281   rot = rotate(NonInteger(EIGEN_PI / 2));
    282   tf2.setIdentity();
    283   tf2.rotate(rot);
    284 
    285   c.transform(tf2);
    286   // rotate by 90 deg around origin ->  box((-2, 1, -2), (0, 3, 0))
    287 
    288   VERIFY_IS_APPROX(c.sizes(), a.sizes());
    289   VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) + UnitY * Scalar(3));
    290   VERIFY_IS_APPROX((c.max)(), UnitY * Scalar(3));
    291 
    292   // box((-1, -1, -1), (1, 1, 1))
    293   AffineTransform atf = AffineTransform::Identity();
    294   atf.linearExt()(0, 1) = Scalar(1);
    295   c = BoxType(-Ones, Ones);
    296   c.transform(atf);
    297   // 45 deg shear in x direction -> box((-2, -1, -1), (2, 1, 1))
    298 
    299   VERIFY_IS_APPROX(c.sizes(), Ones * Scalar(2) + UnitX * Scalar(2));
    300   VERIFY_IS_APPROX((c.min)(), -Ones - UnitX);
    301   VERIFY_IS_APPROX((c.max)(), Ones + UnitX);
    302 }
    303 
    304 template<typename BoxType, typename Rotation> void alignedboxNonIntegralRotatable(
    305     const BoxType& box,
    306     Rotation (*rotate)(typename NumTraits<typename BoxType::Scalar>::NonInteger /*_angle*/))
    307 {
    308   alignedboxRotatable(box, rotate);
    309 
    310   typedef typename BoxType::Scalar Scalar;
    311   typedef typename NumTraits<Scalar>::NonInteger NonInteger;
    312   enum { Dim = BoxType::AmbientDimAtCompileTime };
    313   typedef Matrix<Scalar, Dim, 1> VectorType;
    314   typedef Matrix<Scalar, Dim, (1 << Dim)> CornersType;
    315   typedef Transform<Scalar, Dim, Isometry> IsometryTransform;
    316   typedef Transform<Scalar, Dim, Affine> AffineTransform;
    317 
    318   const Index dim = box.dim();
    319   const VectorType Zero = VectorType::Zero();
    320   const VectorType Ones = VectorType::Ones();
    321 
    322   VectorType minPoint = -2 * Ones;
    323   minPoint[1] = 1;
    324   VectorType maxPoint = Zero;
    325   maxPoint[1] = 3;
    326   BoxType c(minPoint, maxPoint);
    327   // ((-2, 1, -2), (0, 3, 0))
    328 
    329   VectorType cornerBL = (c.min)();
    330   VectorType cornerTR = (c.max)();
    331   VectorType cornerBR = (c.min)(); cornerBR[0] = cornerTR[0];
    332   VectorType cornerTL = (c.max)(); cornerTL[0] = cornerBL[0];
    333 
    334   NonInteger angle = NonInteger(EIGEN_PI/3);
    335   Rotation rot = rotate(angle);
    336   IsometryTransform tf2;
    337   tf2.setIdentity();
    338   tf2.rotate(rot);
    339 
    340   c.transform(tf2);
    341   // rotate by 60 deg ->  box((-3.59, -1.23, -2), (-0.86, 1.5, 0))
    342 
    343   cornerBL = tf2 * cornerBL;
    344   cornerBR = tf2 * cornerBR;
    345   cornerTL = tf2 * cornerTL;
    346   cornerTR = tf2 * cornerTR;
    347 
    348   VectorType minCorner = Ones * Scalar(-2);
    349   VectorType maxCorner = Zero;
    350   minCorner[0] = (min)((min)(cornerBL[0], cornerBR[0]), (min)(cornerTL[0], cornerTR[0]));
    351   maxCorner[0] = (max)((max)(cornerBL[0], cornerBR[0]), (max)(cornerTL[0], cornerTR[0]));
    352   minCorner[1] = (min)((min)(cornerBL[1], cornerBR[1]), (min)(cornerTL[1], cornerTR[1]));
    353   maxCorner[1] = (max)((max)(cornerBL[1], cornerBR[1]), (max)(cornerTL[1], cornerTR[1]));
    354 
    355   for (Index d = 2; d < dim; ++d)
    356     VERIFY_IS_APPROX(c.sizes()[d], Scalar(2));
    357 
    358   VERIFY_IS_APPROX((c.min)(), minCorner);
    359   VERIFY_IS_APPROX((c.max)(), maxCorner);
    360 
    361   VectorType minCornerValue = Ones * Scalar(-2);
    362   VectorType maxCornerValue = Zero;
    363   minCornerValue[0] = Scalar(Scalar(-sqrt(2*2 + 3*3)) * Scalar(cos(Scalar(atan(2.0/3.0)) - angle/2)));
    364   minCornerValue[1] = Scalar(Scalar(-sqrt(1*1 + 2*2)) * Scalar(sin(Scalar(atan(2.0/1.0)) - angle/2)));
    365   maxCornerValue[0] = Scalar(-sin(angle));
    366   maxCornerValue[1] = Scalar(3 * cos(angle));
    367   VERIFY_IS_APPROX((c.min)(), minCornerValue);
    368   VERIFY_IS_APPROX((c.max)(), maxCornerValue);
    369 
    370   // randomized test - translate and rotate the box and compare to a box made of transformed vertices
    371   for (size_t i = 0; i < 10; ++i)
    372   {
    373     for (Index d = 0; d < dim; ++d)
    374     {
    375       minCorner[d] = internal::random<Scalar>(-10,10);
    376       maxCorner[d] = minCorner[d] + internal::random<Scalar>(0, 10);
    377     }
    378 
    379     c = BoxType(minCorner, maxCorner);
    380 
    381     CornersType corners = boxGetCorners(minCorner, maxCorner);
    382 
    383     typename AffineTransform::LinearMatrixType rotation =
    384         randomRotationMatrix<typename AffineTransform::LinearMatrixType>();
    385 
    386     tf2.setIdentity();
    387     tf2.rotate(rotation);
    388     tf2.translate(VectorType::Random());
    389 
    390     c.transform(tf2);
    391     corners = tf2 * corners;
    392 
    393     minCorner = corners.rowwise().minCoeff();
    394     maxCorner = corners.rowwise().maxCoeff();
    395 
    396     VERIFY_IS_APPROX((c.min)(), minCorner);
    397     VERIFY_IS_APPROX((c.max)(), maxCorner);
    398   }
    399 
    400   // randomized test - transform the box with a random affine matrix and compare to a box made of transformed vertices
    401   for (size_t i = 0; i < 10; ++i)
    402   {
    403     for (Index d = 0; d < dim; ++d)
    404     {
    405       minCorner[d] = internal::random<Scalar>(-10,10);
    406       maxCorner[d] = minCorner[d] + internal::random<Scalar>(0, 10);
    407     }
    408 
    409     c = BoxType(minCorner, maxCorner);
    410 
    411     CornersType corners = boxGetCorners(minCorner, maxCorner);
    412 
    413     AffineTransform atf = AffineTransform::Identity();
    414     atf.linearExt() = AffineTransform::LinearPart::Random();
    415     atf.translate(VectorType::Random());
    416 
    417     c.transform(atf);
    418     corners = atf * corners;
    419 
    420     minCorner = corners.rowwise().minCoeff();
    421     maxCorner = corners.rowwise().maxCoeff();
    422 
    423     VERIFY_IS_APPROX((c.min)(), minCorner);
    424     VERIFY_IS_APPROX((c.max)(), maxCorner);
    425   }
    426 }
    427 
    428 template<typename BoxType>
    429 void alignedboxCastTests(const BoxType& box)
    430 {
    431   // casting
    432   typedef typename BoxType::Scalar Scalar;
    433   typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
    434 
    435   const Index dim = box.dim();
    436 
    437   VectorType p0 = VectorType::Random(dim);
    438   VectorType p1 = VectorType::Random(dim);
    439 
    440   BoxType b0(dim);
    441 
    442   b0.extend(p0);
    443   b0.extend(p1);
    444 
    445   const int Dim = BoxType::AmbientDimAtCompileTime;
    446   typedef typename GetDifferentType<Scalar>::type OtherScalar;
    447   AlignedBox<OtherScalar,Dim> hp1f = b0.template cast<OtherScalar>();
    448   VERIFY_IS_APPROX(hp1f.template cast<Scalar>(),b0);
    449   AlignedBox<Scalar,Dim> hp1d = b0.template cast<Scalar>();
    450   VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),b0);
    451 }
    452 
    453 
    454 void specificTest1()
    455 {
    456     Vector2f m; m << -1.0f, -2.0f;
    457     Vector2f M; M <<  1.0f,  5.0f;
    458 
    459     typedef AlignedBox2f  BoxType;
    460     BoxType box( m, M );
    461 
    462     Vector2f sides = M-m;
    463     VERIFY_IS_APPROX(sides, box.sizes() );
    464     VERIFY_IS_APPROX(sides[1], box.sizes()[1] );
    465     VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() );
    466     VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() );
    467 
    468     VERIFY_IS_APPROX( 14.0f, box.volume() );
    469     VERIFY_IS_APPROX( 53.0f, box.diagonal().squaredNorm() );
    470     VERIFY_IS_APPROX( std::sqrt( 53.0f ), box.diagonal().norm() );
    471 
    472     VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeft ) );
    473     VERIFY_IS_APPROX( M, box.corner( BoxType::TopRight ) );
    474     Vector2f bottomRight; bottomRight << M[0], m[1];
    475     Vector2f topLeft; topLeft << m[0], M[1];
    476     VERIFY_IS_APPROX( bottomRight, box.corner( BoxType::BottomRight ) );
    477     VERIFY_IS_APPROX( topLeft, box.corner( BoxType::TopLeft ) );
    478 }
    479 
    480 
    481 void specificTest2()
    482 {
    483     Vector3i m; m << -1, -2, 0;
    484     Vector3i M; M <<  1,  5, 3;
    485 
    486     typedef AlignedBox3i  BoxType;
    487     BoxType box( m, M );
    488 
    489     Vector3i sides = M-m;
    490     VERIFY_IS_APPROX(sides, box.sizes() );
    491     VERIFY_IS_APPROX(sides[1], box.sizes()[1] );
    492     VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() );
    493     VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() );
    494 
    495     VERIFY_IS_APPROX( 42, box.volume() );
    496     VERIFY_IS_APPROX( 62, box.diagonal().squaredNorm() );
    497 
    498     VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeftFloor ) );
    499     VERIFY_IS_APPROX( M, box.corner( BoxType::TopRightCeil ) );
    500     Vector3i bottomRightFloor; bottomRightFloor << M[0], m[1], m[2];
    501     Vector3i topLeftFloor; topLeftFloor << m[0], M[1], m[2];
    502     VERIFY_IS_APPROX( bottomRightFloor, box.corner( BoxType::BottomRightFloor ) );
    503     VERIFY_IS_APPROX( topLeftFloor, box.corner( BoxType::TopLeftFloor ) );
    504 }
    505 
    506 
    507 EIGEN_DECLARE_TEST(geo_alignedbox)
    508 {
    509   for(int i = 0; i < g_repeat; i++)
    510   {
    511     CALL_SUBTEST_1( (alignedboxNonIntegralRotatable<AlignedBox2f, Rotation2Df>(AlignedBox2f(), &rotate2D)) );
    512     CALL_SUBTEST_2( alignedboxCastTests(AlignedBox2f()) );
    513 
    514     CALL_SUBTEST_3( (alignedboxNonIntegralRotatable<AlignedBox3f, AngleAxisf>(AlignedBox3f(), &rotate3DZAxis)) );
    515     CALL_SUBTEST_4( alignedboxCastTests(AlignedBox3f()) );
    516 
    517     CALL_SUBTEST_5( (alignedboxNonIntegralRotatable<AlignedBox4d, Matrix4d>(AlignedBox4d(), &rotate4DZWAxis)) );
    518     CALL_SUBTEST_6( alignedboxCastTests(AlignedBox4d()) );
    519 
    520     CALL_SUBTEST_7( alignedboxTranslatable(AlignedBox1d()) );
    521     CALL_SUBTEST_8( alignedboxCastTests(AlignedBox1d()) );
    522 
    523     CALL_SUBTEST_9( alignedboxTranslatable(AlignedBox1i()) );
    524     CALL_SUBTEST_10( (alignedboxRotatable<AlignedBox2i, Matrix2i>(AlignedBox2i(), &rotate2DIntegral<int, Matrix2i>)) );
    525     CALL_SUBTEST_11( (alignedboxRotatable<AlignedBox3i, Matrix3i>(AlignedBox3i(), &rotate3DZAxisIntegral<int, Matrix3i>)) );
    526 
    527     CALL_SUBTEST_14( alignedbox(AlignedBox<double,Dynamic>(4)) );
    528   }
    529   CALL_SUBTEST_12( specificTest1() );
    530   CALL_SUBTEST_13( specificTest2() );
    531 }