From e2775869588e1df2d19265eac5c167651168a414 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 28 Apr 2010 18:51:38 -0400 Subject: Complete rework of global math functions and NumTraits. * Now completely generic so all standard integer types (like char...) are supported. ** add unit test for that (integer_types). * NumTraits does no longer inherit numeric_limits * All math functions are now templated * Better guard (static asserts) against using certain math functions on integer types. --- Eigen/src/Geometry/AlignedBox.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'Eigen/src/Geometry') diff --git a/Eigen/src/Geometry/AlignedBox.h b/Eigen/src/Geometry/AlignedBox.h index b5b40a82d..f3bee6f7d 100644 --- a/Eigen/src/Geometry/AlignedBox.h +++ b/Eigen/src/Geometry/AlignedBox.h @@ -46,7 +46,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim) typedef _Scalar Scalar; typedef NumTraits ScalarTraits; typedef typename ScalarTraits::Real RealScalar; - typedef typename ScalarTraits::FloatingPoint FloatingPoint; + typedef typename ScalarTraits::NonInteger NonInteger; typedef Matrix VectorType; /** Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box */ @@ -174,11 +174,10 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim) VectorType r; for(int d=0; d() + ei_random_amplitude()) - / (Scalar(2)*ei_random_amplitude() ); + * ei_random(Scalar(0), Scalar(1)); } else r[d] = ei_random(m_min[d], m_max[d]); @@ -260,15 +259,15 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim) * \sa squaredExteriorDistance() */ template - inline FloatingPoint exteriorDistance(const MatrixBase& p) const - { return ei_sqrt(FloatingPoint(squaredExteriorDistance(p))); } + inline NonInteger exteriorDistance(const MatrixBase& p) const + { return ei_sqrt(NonInteger(squaredExteriorDistance(p))); } /** \returns the distance between the boxes \a b and \c *this, * and zero if the boxes intersect. * \sa squaredExteriorDistance() */ - inline FloatingPoint exteriorDistance(const AlignedBox& b) const - { return ei_sqrt(FloatingPoint(squaredExteriorDistance(b))); } + inline NonInteger exteriorDistance(const AlignedBox& b) const + { return ei_sqrt(NonInteger(squaredExteriorDistance(b))); } /** \returns \c *this with scalar type casted to \a NewScalarType * -- cgit v1.2.3