From a99ea69b327cf84cd70dc96b9f4da32c83dfeecb Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 27 Jun 2011 13:15:01 +0200 Subject: [PATCH] fix constness of intersection methods (bug #309) (transplanted from c98cd5e564f75be2edc7c5d18491058d025fa796 ) --- Eigen/src/Geometry/Hyperplane.h | 2 +- Eigen/src/Geometry/ParametrizedLine.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Geometry/Hyperplane.h b/Eigen/src/Geometry/Hyperplane.h index 00e027040..eb0a58771 100644 --- a/Eigen/src/Geometry/Hyperplane.h +++ b/Eigen/src/Geometry/Hyperplane.h @@ -189,7 +189,7 @@ public: * * \note If \a other is approximately parallel to *this, this method will return any point on *this. */ - VectorType intersection(const Hyperplane& other) + VectorType intersection(const Hyperplane& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2) Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0); diff --git a/Eigen/src/Geometry/ParametrizedLine.h b/Eigen/src/Geometry/ParametrizedLine.h index 1475802ab..b90f9c088 100644 --- a/Eigen/src/Geometry/ParametrizedLine.h +++ b/Eigen/src/Geometry/ParametrizedLine.h @@ -107,7 +107,7 @@ public: { return origin() + direction().dot(p-origin()) * direction(); } template - Scalar intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane); + Scalar intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const; /** \returns \c *this with scalar type casted to \a NewScalarType * @@ -159,7 +159,7 @@ inline ParametrizedLine<_Scalar, _AmbientDim,_Options>::ParametrizedLine(const H */ template template -inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) +inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const { return -(hyperplane.offset()+hyperplane.normal().dot(origin())) / hyperplane.normal().dot(direction());