diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-01-27 11:21:38 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-01-27 11:21:38 -0500 |
commit | 52fed69baa36afc6dba77bdb112f80da486c0b7e (patch) | |
tree | d2eb43db54f9d198123c1ef19082a62acbb2ca89 /Eigen | |
parent | 955e0962774188847c8f2883f7006efa9723571d (diff) |
add test for geometry with eigen2_ prefixes. fix that stuff.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/Matrix.h | 7 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 3 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/AlignedBox.h | 5 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/All.h | 8 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/AngleAxis.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Hyperplane.h | 17 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h | 14 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Quaternion.h | 15 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Rotation2D.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/RotationBase.h | 5 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Scaling.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Transform.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/Geometry/Translation.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/LeastSquares.h | 6 | ||||
-rw-r--r-- | Eigen/src/Eigen2Support/SVD.h | 12 |
16 files changed, 58 insertions, 66 deletions
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 70b7eb66c..f41d554ec 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -336,6 +336,13 @@ class Matrix template<typename OtherDerived> Matrix& operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r); + #ifdef EIGEN2_SUPPORT + template<typename OtherDerived> + explicit Matrix(const eigen2_RotationBase<OtherDerived,ColsAtCompileTime>& r); + template<typename OtherDerived> + Matrix& operator=(const eigen2_RotationBase<OtherDerived,ColsAtCompileTime>& r); + #endif + // allow to extend Matrix outside Eigen #ifdef EIGEN_MATRIX_PLUGIN #include EIGEN_MATRIX_PLUGIN diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 096438f96..5864cdbd6 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -204,7 +204,7 @@ template<typename Derived> class MatrixBase template<typename OtherDerived> typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType #if EIGEN2_SUPPORT_STAGE == STAGE15_RESOLVE_API_CONFLICTS_WARN - EIGEN_DEPRECATED Scalar + EIGEN_DEPRECATED #endif dot(const MatrixBase<OtherDerived>& other) const; #endif diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index e873f15cb..00742e4b1 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -220,7 +220,6 @@ template<typename Scalar> class JacobiRotation; template<typename Derived, int _Dim> class RotationBase; template<typename Lhs, typename Rhs> class Cross; template<typename Derived> class QuaternionBase; -template<typename Scalar, int Options = AutoAlign> class Quaternion; template<typename Scalar> class Rotation2D; template<typename Scalar> class AngleAxis; template<typename Scalar,int Dim> class Translation; @@ -239,6 +238,7 @@ template<typename Scalar,int Dim> class eigen2_Scaling; #endif #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS +template<typename Scalar> class Quaternion; template<typename Scalar,int Dim> class Transform; template <typename _Scalar, int _AmbientDim> class ParametrizedLine; template <typename _Scalar, int _AmbientDim> class Hyperplane; @@ -246,6 +246,7 @@ template<typename Scalar,int Dim> class Scaling; #endif #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS +template<typename Scalar, int Options = AutoAlign> class Quaternion; template<typename Scalar,int Dim,int Mode,int _Options=AutoAlign> class Transform; template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class ParametrizedLine; template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class Hyperplane; diff --git a/Eigen/src/Eigen2Support/Geometry/AlignedBox.h b/Eigen/src/Eigen2Support/Geometry/AlignedBox.h index cedce218c..1c915be22 100644 --- a/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +++ b/Eigen/src/Eigen2Support/Geometry/AlignedBox.h @@ -22,8 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_ALIGNEDBOX_H -#define EIGEN_ALIGNEDBOX_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway /** \geometry_module \ingroup Geometry_Module * \nonstableyet @@ -169,5 +168,3 @@ inline Scalar AlignedBox<Scalar,AmbiantDim>::squaredExteriorDistance(const Vecto } return dist2; } - -#endif // EIGEN_ALIGNEDBOX_H diff --git a/Eigen/src/Eigen2Support/Geometry/All.h b/Eigen/src/Eigen2Support/Geometry/All.h index a399549fe..7b076806b 100644 --- a/Eigen/src/Eigen2Support/Geometry/All.h +++ b/Eigen/src/Eigen2Support/Geometry/All.h @@ -58,6 +58,10 @@ #define Hyperplane eigen2_Hyperplane #define ParametrizedLine eigen2_ParametrizedLine +#define ei_toRotationMatrix eigen2_ei_toRotationMatrix +#define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl +#define ei_transform_product_impl eigen2_ei_transform_product_impl + #include "RotationBase.h" #include "Rotation2D.h" #include "Quaternion.h" @@ -69,6 +73,10 @@ #include "Hyperplane.h" #include "ParametrizedLine.h" +#undef ei_toRotationMatrix +#undef ei_quaternion_assign_impl +#undef ei_transform_product_impl + #undef RotationBase #undef Rotation2D #undef Rotation2Df diff --git a/Eigen/src/Eigen2Support/Geometry/AngleAxis.h b/Eigen/src/Eigen2Support/Geometry/AngleAxis.h index d1b784066..f7b2d51e3 100644 --- a/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +++ b/Eigen/src/Eigen2Support/Geometry/AngleAxis.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_ANGLEAXIS_H -#define EIGEN_ANGLEAXIS_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + /** \geometry_module \ingroup Geometry_Module * @@ -224,5 +224,3 @@ AngleAxis<Scalar>::toRotationMatrix(void) const return res; } - -#endif // EIGEN_ANGLEAXIS_H diff --git a/Eigen/src/Eigen2Support/Geometry/Hyperplane.h b/Eigen/src/Eigen2Support/Geometry/Hyperplane.h index 420b30fe9..81c4f55b1 100644 --- a/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +++ b/Eigen/src/Eigen2Support/Geometry/Hyperplane.h @@ -23,8 +23,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_HYPERPLANE_H -#define EIGEN_HYPERPLANE_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway /** \geometry_module \ingroup Geometry_Module * @@ -71,7 +70,7 @@ public: : m_coeffs(n.size()+1) { normal() = n; - offset() = -e.dot(n); + offset() = -e.eigen2_dot(n); } /** Constructs a plane from its normal \a n and distance to the origin \a d @@ -92,7 +91,7 @@ public: { Hyperplane result(p0.size()); result.normal() = (p1 - p0).unitOrthogonal(); - result.offset() = -result.normal().dot(p0); + result.offset() = -result.normal().eigen2_dot(p0); return result; } @@ -104,7 +103,7 @@ public: EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3) Hyperplane result(p0.size()); result.normal() = (p2 - p0).cross(p1 - p0).normalized(); - result.offset() = -result.normal().dot(p0); + result.offset() = -result.normal().eigen2_dot(p0); return result; } @@ -116,7 +115,7 @@ public: explicit Hyperplane(const ParametrizedLine<Scalar, AmbientDimAtCompileTime>& parametrized) { normal() = parametrized.direction().unitOrthogonal(); - offset() = -normal().dot(parametrized.origin()); + offset() = -normal().eigen2_dot(parametrized.origin()); } ~Hyperplane() {} @@ -133,7 +132,7 @@ public: /** \returns the signed distance between the plane \c *this and a point \a p. * \sa absDistance() */ - inline Scalar signedDistance(const VectorType& p) const { return p.dot(normal()) + offset(); } + inline Scalar signedDistance(const VectorType& p) const { return p.eigen2_dot(normal()) + offset(); } /** \returns the absolute distance between the plane \c *this and a point \a p. * \sa signedDistance() @@ -231,7 +230,7 @@ public: TransformTraits traits = Affine) { transform(t.linear(), traits); - offset() -= t.translation().dot(normal()); + offset() -= t.translation().eigen2_dot(normal()); return *this; } @@ -264,5 +263,3 @@ protected: Coefficients m_coeffs; }; - -#endif // EIGEN_HYPERPLANE_H diff --git a/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h b/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h index d48f44a79..411c4b570 100644 --- a/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +++ b/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h @@ -23,8 +23,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_PARAMETRIZEDLINE_H -#define EIGEN_PARAMETRIZEDLINE_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + /** \geometry_module \ingroup Geometry_Module * @@ -85,7 +85,7 @@ public: RealScalar squaredDistance(const VectorType& p) const { VectorType diff = p-origin(); - return (diff - diff.dot(direction())* direction()).squaredNorm(); + return (diff - diff.eigen2_dot(direction())* direction()).squaredNorm(); } /** \returns the distance of a point \a p to its projection onto the line \c *this. * \sa squaredDistance() @@ -94,7 +94,7 @@ public: /** \returns the projection of a point \a p onto the line \c *this. */ VectorType projection(const VectorType& p) const - { return origin() + (p-origin()).dot(direction()) * direction(); } + { return origin() + (p-origin()).eigen2_dot(direction()) * direction(); } Scalar intersection(const Hyperplane<_Scalar, _AmbientDim>& hyperplane); @@ -148,8 +148,6 @@ inline ParametrizedLine<_Scalar, _AmbientDim>::ParametrizedLine(const Hyperplane template <typename _Scalar, int _AmbientDim> inline _Scalar ParametrizedLine<_Scalar, _AmbientDim>::intersection(const Hyperplane<_Scalar, _AmbientDim>& hyperplane) { - return -(hyperplane.offset()+origin().dot(hyperplane.normal())) - /(direction().dot(hyperplane.normal())); + return -(hyperplane.offset()+origin().eigen2_dot(hyperplane.normal())) + /(direction().eigen2_dot(hyperplane.normal())); } - -#endif // EIGEN_PARAMETRIZEDLINE_H diff --git a/Eigen/src/Eigen2Support/Geometry/Quaternion.h b/Eigen/src/Eigen2Support/Geometry/Quaternion.h index c81a3f92a..a75fa42ae 100644 --- a/Eigen/src/Eigen2Support/Geometry/Quaternion.h +++ b/Eigen/src/Eigen2Support/Geometry/Quaternion.h @@ -22,8 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_QUATERNION_H -#define EIGEN_QUATERNION_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway template<typename Other, int OtherRows=Other::RowsAtCompileTime, @@ -172,7 +171,7 @@ public: * corresponds to the cosine of half the angle between the two rotations. * \sa angularDistance() */ - inline Scalar dot(const Quaternion& other) const { return m_coeffs.dot(other.m_coeffs); } + inline Scalar eigen2_dot(const Quaternion& other) const { return m_coeffs.eigen2_dot(other.m_coeffs); } inline Scalar angularDistance(const Quaternion& other) const; @@ -353,7 +352,7 @@ inline Quaternion<Scalar>& Quaternion<Scalar>::setFromTwoVectors(const MatrixBas { Vector3 v0 = a.normalized(); Vector3 v1 = b.normalized(); - Scalar c = v0.dot(v1); + Scalar c = v0.eigen2_dot(v1); // if dot == 1, vectors are the same if (ei_isApprox(c,Scalar(1))) @@ -412,12 +411,12 @@ inline Quaternion<Scalar> Quaternion<Scalar>::conjugate() const } /** \returns the angle (in radian) between two rotations - * \sa dot() + * \sa eigen2_dot() */ template <typename Scalar> inline Scalar Quaternion<Scalar>::angularDistance(const Quaternion& other) const { - double d = ei_abs(this->dot(other)); + double d = ei_abs(this->eigen2_dot(other)); if (d>=1.0) return 0; return Scalar(2) * std::acos(d); @@ -430,7 +429,7 @@ template <typename Scalar> Quaternion<Scalar> Quaternion<Scalar>::slerp(Scalar t, const Quaternion& other) const { static const Scalar one = Scalar(1) - machine_epsilon<Scalar>(); - Scalar d = this->dot(other); + Scalar d = this->eigen2_dot(other); Scalar absD = ei_abs(d); Scalar scale0; @@ -505,5 +504,3 @@ struct ei_quaternion_assign_impl<Other,4,1> q.coeffs() = vec; } }; - -#endif // EIGEN_QUATERNION_H diff --git a/Eigen/src/Eigen2Support/Geometry/Rotation2D.h b/Eigen/src/Eigen2Support/Geometry/Rotation2D.h index dfa60d0b3..ee7c80e7e 100644 --- a/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +++ b/Eigen/src/Eigen2Support/Geometry/Rotation2D.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_ROTATION2D_H -#define EIGEN_ROTATION2D_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + /** \geometry_module \ingroup Geometry_Module * @@ -155,5 +155,3 @@ Rotation2D<Scalar>::toRotationMatrix(void) const Scalar cosA = ei_cos(m_angle); return (Matrix2() << cosA, -sinA, sinA, cosA).finished(); } - -#endif // EIGEN_ROTATION2D_H diff --git a/Eigen/src/Eigen2Support/Geometry/RotationBase.h b/Eigen/src/Eigen2Support/Geometry/RotationBase.h index 5fec0f18d..2f494f198 100644 --- a/Eigen/src/Eigen2Support/Geometry/RotationBase.h +++ b/Eigen/src/Eigen2Support/Geometry/RotationBase.h @@ -22,8 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_ROTATIONBASE_H -#define EIGEN_ROTATIONBASE_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway // this file aims to contains the various representations of rotation/orientation // in 2D and 3D space excepted Matrix and Quaternion. @@ -133,5 +132,3 @@ inline static const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBa YOU_MADE_A_PROGRAMMING_MISTAKE) return mat; } - -#endif // EIGEN_ROTATIONBASE_H diff --git a/Eigen/src/Eigen2Support/Geometry/Scaling.h b/Eigen/src/Eigen2Support/Geometry/Scaling.h index 747ce1d97..108e6d7d5 100644 --- a/Eigen/src/Eigen2Support/Geometry/Scaling.h +++ b/Eigen/src/Eigen2Support/Geometry/Scaling.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_SCALING_H -#define EIGEN_SCALING_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + /** \geometry_module \ingroup Geometry_Module * @@ -177,5 +177,3 @@ Scaling<Scalar,Dim>::operator* (const TransformType& t) const res.prescale(m_coeffs); return res; } - -#endif // EIGEN_SCALING_H diff --git a/Eigen/src/Eigen2Support/Geometry/Transform.h b/Eigen/src/Eigen2Support/Geometry/Transform.h index 1374a77dd..88956c86c 100644 --- a/Eigen/src/Eigen2Support/Geometry/Transform.h +++ b/Eigen/src/Eigen2Support/Geometry/Transform.h @@ -23,8 +23,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_TRANSFORM_H -#define EIGEN_TRANSFORM_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + // Note that we have to pass Dim and HDim because it is not allowed to use a template // parameter to define a template specialization. To be more precise, in the following @@ -796,5 +796,3 @@ struct ei_transform_product_impl<Other,Dim,HDim, Dim,1> { return ((tr.linear() * other) + tr.translation()) * (Scalar(1) / ( (tr.matrix().template block<1,Dim>(Dim,0) * other).coeff(0) + tr.matrix().coeff(Dim,Dim))); } }; - -#endif // EIGEN_TRANSFORM_H diff --git a/Eigen/src/Eigen2Support/Geometry/Translation.h b/Eigen/src/Eigen2Support/Geometry/Translation.h index ca5a9115f..e651e3102 100644 --- a/Eigen/src/Eigen2Support/Geometry/Translation.h +++ b/Eigen/src/Eigen2Support/Geometry/Translation.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_TRANSLATION_H -#define EIGEN_TRANSLATION_H +// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway + /** \geometry_module \ingroup Geometry_Module * @@ -194,5 +194,3 @@ Translation<Scalar,Dim>::operator* (const TransformType& t) const res.pretranslate(m_coeffs); return res; } - -#endif // EIGEN_TRANSLATION_H diff --git a/Eigen/src/Eigen2Support/LeastSquares.h b/Eigen/src/Eigen2Support/LeastSquares.h index b2595ede1..4b62ffa92 100644 --- a/Eigen/src/Eigen2Support/LeastSquares.h +++ b/Eigen/src/Eigen2Support/LeastSquares.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_LEASTSQUARES_H -#define EIGEN_LEASTSQUARES_H +#ifndef EIGEN2_LEASTSQUARES_H +#define EIGEN2_LEASTSQUARES_H /** \ingroup LeastSquares_Module * @@ -179,4 +179,4 @@ void fitHyperplane(int numPoints, } -#endif // EIGEN_LEASTSQUARES_H +#endif // EIGEN2_LEASTSQUARES_H diff --git a/Eigen/src/Eigen2Support/SVD.h b/Eigen/src/Eigen2Support/SVD.h index dfb43ac7c..528a0dcd0 100644 --- a/Eigen/src/Eigen2Support/SVD.h +++ b/Eigen/src/Eigen2Support/SVD.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_SVD_H -#define EIGEN_SVD_H +#ifndef EIGEN2_SVD_H +#define EIGEN2_SVD_H /** \ingroup SVD_Module * \nonstableyet @@ -150,7 +150,7 @@ void SVD<MatrixType>::compute(const MatrixType& matrix) if ((k < nct) && (m_sigma[k] != 0.0)) { // Apply the transformation. - Scalar t = matA.col(k).end(m-k).dot(matA.col(j).end(m-k)); // FIXME dot product or cwise prod + .sum() ?? + Scalar t = matA.col(k).end(m-k).eigen2_dot(matA.col(j).end(m-k)); // FIXME dot product or cwise prod + .sum() ?? t = -t/matA(k,k); matA.col(j).end(m-k) += t * matA.col(k).end(m-k); } @@ -216,7 +216,7 @@ void SVD<MatrixType>::compute(const MatrixType& matrix) { for (j = k+1; j < nu; ++j) { - Scalar t = m_matU.col(k).end(m-k).dot(m_matU.col(j).end(m-k)); // FIXME is it really a dot product we want ? + Scalar t = m_matU.col(k).end(m-k).eigen2_dot(m_matU.col(j).end(m-k)); // FIXME is it really a dot product we want ? t = -t/m_matU(k,k); m_matU.col(j).end(m-k) += t * m_matU.col(k).end(m-k); } @@ -242,7 +242,7 @@ void SVD<MatrixType>::compute(const MatrixType& matrix) { for (j = k+1; j < nu; ++j) { - Scalar t = m_matV.col(k).end(n-k-1).dot(m_matV.col(j).end(n-k-1)); // FIXME is it really a dot product we want ? + Scalar t = m_matV.col(k).end(n-k-1).eigen2_dot(m_matV.col(j).end(n-k-1)); // FIXME is it really a dot product we want ? t = -t/m_matV(k+1,k); m_matV.col(j).end(n-k-1) += t * m_matV.col(k).end(n-k-1); } @@ -646,4 +646,4 @@ MatrixBase<Derived>::svd() const return SVD<PlainObject>(derived()); } -#endif // EIGEN_SVD_H +#endif // EIGEN2_SVD_H |