From c8271df0eca49696208e422c6e891f7a5cbcaff2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 4 Jun 2012 22:01:06 +0200 Subject: [PATCH] Fix kdBVH unit test (transplanted from cb64e587c559131047906e6b5da2093fa5946fda ) --- unsupported/Eigen/src/BVH/KdBVH.h | 6 +++--- unsupported/test/BVH.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/unsupported/Eigen/src/BVH/KdBVH.h b/unsupported/Eigen/src/BVH/KdBVH.h index 028b4811e..ea49775af 100644 --- a/unsupported/Eigen/src/BVH/KdBVH.h +++ b/unsupported/Eigen/src/BVH/KdBVH.h @@ -69,7 +69,7 @@ struct get_boxes_helper { * * \param _Scalar The underlying scalar type of the bounding boxes * \param _Dim The dimension of the space in which the hierarchy lives - * \param _Object The object type that lives in the hierarchy. It must have value semantics. Either internal::bounding_box(_Object) must + * \param _Object The object type that lives in the hierarchy. It must have value semantics. Either bounding_box(_Object) must * be defined and return an AlignedBox<_Scalar, _Dim> or bounding boxes must be provided to the tree initializer. * * This class provides a simple (as opposed to optimized) implementation of a bounding volume hierarchy analogous to a Kd-tree. @@ -92,14 +92,14 @@ public: KdBVH() {} - /** Given an iterator range over \a Object references, constructs the BVH. Requires that internal::bounding_box(Object) return a Volume. */ + /** Given an iterator range over \a Object references, constructs the BVH. Requires that bounding_box(Object) return a Volume. */ template KdBVH(Iter begin, Iter end) { init(begin, end, 0, 0); } //int is recognized by init as not being an iterator type /** Given an iterator range over \a Object references and an iterator range over their bounding boxes, constructs the BVH */ template KdBVH(OIter begin, OIter end, BIter boxBegin, BIter boxEnd) { init(begin, end, boxBegin, boxEnd); } /** Given an iterator range over \a Object references, constructs the BVH, overwriting whatever is in there currently. - * Requires that internal::bounding_box(Object) return a Volume. */ + * Requires that bounding_box(Object) return a Volume. */ template void init(Iter begin, Iter end) { init(begin, end, 0, 0); } /** Given an iterator range over \a Object references and an iterator range over their bounding boxes, diff --git a/unsupported/test/BVH.cpp b/unsupported/test/BVH.cpp index e77e84b6d..3f9d108de 100644 --- a/unsupported/test/BVH.cpp +++ b/unsupported/test/BVH.cpp @@ -24,9 +24,15 @@ #include "main.h" #include +#include #include -inline double SQR(double x) { return x * x; } +namespace Eigen { + +template AlignedBox bounding_box(const Matrix &v) { return AlignedBox(v); } + +} + template struct Ball @@ -41,16 +47,10 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim) VectorType center; double radius; }; - -namespace Eigen { -namespace internal { - -template AlignedBox bounding_box(const Matrix &v) { return AlignedBox(v); } template AlignedBox bounding_box(const Ball &b) { return AlignedBox(b.center.array() - b.radius, b.center.array() + b.radius); } -} // end namespace internal -} +inline double SQR(double x) { return x * x; } template struct BallPointStuff //this class provides functions to be both an intersector and a minimizer, both for a ball and a point and for two trees