aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Geometry
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-05-30 16:00:58 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-05-30 16:00:58 -0400
commitaaaade4b3d66d67d2c08af3372c3965e7255b2e8 (patch)
tree76dfaefb014333b2f98c6db660454771655ea8b7 /Eigen/src/Geometry
parentfaa3ff3be6a02b57c6cb05edc87375e54ab96606 (diff)
the Index types change.
As discussed on the list (too long to explain here).
Diffstat (limited to 'Eigen/src/Geometry')
-rw-r--r--Eigen/src/Geometry/AlignedBox.h15
-rw-r--r--Eigen/src/Geometry/EulerAngles.h10
-rw-r--r--Eigen/src/Geometry/Homogeneous.h16
-rw-r--r--Eigen/src/Geometry/Hyperplane.h9
-rw-r--r--Eigen/src/Geometry/OrthoMethods.h5
-rw-r--r--Eigen/src/Geometry/ParametrizedLine.h5
-rw-r--r--Eigen/src/Geometry/Quaternion.h7
-rw-r--r--Eigen/src/Geometry/Transform.h11
-rw-r--r--Eigen/src/Geometry/Umeyama.h7
9 files changed, 47 insertions, 38 deletions
diff --git a/Eigen/src/Geometry/AlignedBox.h b/Eigen/src/Geometry/AlignedBox.h
index f3bee6f7d..9d9d96f62 100644
--- a/Eigen/src/Geometry/AlignedBox.h
+++ b/Eigen/src/Geometry/AlignedBox.h
@@ -45,6 +45,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
enum { AmbientDimAtCompileTime = _AmbientDim };
typedef _Scalar Scalar;
typedef NumTraits<Scalar> ScalarTraits;
+ typedef DenseIndex Index;
typedef typename ScalarTraits::Real RealScalar;
typedef typename ScalarTraits::NonInteger NonInteger;
typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
@@ -72,7 +73,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
{ if (AmbientDimAtCompileTime!=Dynamic) setEmpty(); }
/** Constructs a null box with \a _dim the dimension of the ambient space. */
- inline explicit AlignedBox(int _dim) : m_min(_dim), m_max(_dim)
+ inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim)
{ setEmpty(); }
/** Constructs a box with extremities \a _min and \a _max. */
@@ -91,7 +92,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
~AlignedBox() {}
/** \returns the dimension in which the box holds */
- inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : AmbientDimAtCompileTime; }
+ inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : Index(AmbientDimAtCompileTime); }
/** \deprecated use isEmpty */
inline bool isNull() const { return isEmpty(); }
@@ -157,8 +158,8 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
VectorType res;
- int mult = 1;
- for(int d=0; d<dim(); ++d)
+ Index mult = 1;
+ for(Index d=0; d<dim(); ++d)
{
if( mult & corner ) res[d] = m_max[d];
else res[d] = m_min[d];
@@ -172,7 +173,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
inline VectorType sample() const
{
VectorType r;
- for(int d=0; d<dim(); ++d)
+ for(Index d=0; d<dim(); ++d)
{
if(!ScalarTraits::IsInteger)
{
@@ -311,7 +312,7 @@ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const Matri
const typename ei_nested<Derived,2*AmbientDim>::type p(a_p.derived());
Scalar dist2 = 0.;
Scalar aux;
- for (int k=0; k<dim(); ++k)
+ for (Index k=0; k<dim(); ++k)
{
if( m_min[k] > p[k] )
{
@@ -332,7 +333,7 @@ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const Align
{
Scalar dist2 = 0.;
Scalar aux;
- for (int k=0; k<dim(); ++k)
+ for (Index k=0; k<dim(); ++k)
{
if( m_min[k] > b.m_max[k] )
{
diff --git a/Eigen/src/Geometry/EulerAngles.h b/Eigen/src/Geometry/EulerAngles.h
index 13d23761a..d910cbc92 100644
--- a/Eigen/src/Geometry/EulerAngles.h
+++ b/Eigen/src/Geometry/EulerAngles.h
@@ -43,7 +43,7 @@
*/
template<typename Derived>
inline Matrix<typename MatrixBase<Derived>::Scalar,3,1>
-MatrixBase<Derived>::eulerAngles(int a0, int a1, int a2) const
+MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
{
/* Implemented from Graphics Gems IV */
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3)
@@ -52,10 +52,10 @@ MatrixBase<Derived>::eulerAngles(int a0, int a1, int a2) const
typedef Matrix<typename Derived::Scalar,2,1> Vector2;
const Scalar epsilon = NumTraits<Scalar>::dummy_precision();
- const int odd = ((a0+1)%3 == a1) ? 0 : 1;
- const int i = a0;
- const int j = (a0 + 1 + odd)%3;
- const int k = (a0 + 2 - odd)%3;
+ const Index odd = ((a0+1)%3 == a1) ? 0 : 1;
+ const Index i = a0;
+ const Index j = (a0 + 1 + odd)%3;
+ const Index k = (a0 + 2 - odd)%3;
if (a0==a2)
{
diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h
index caea1db41..3077f0921 100644
--- a/Eigen/src/Geometry/Homogeneous.h
+++ b/Eigen/src/Geometry/Homogeneous.h
@@ -77,10 +77,10 @@ template<typename MatrixType,int _Direction> class Homogeneous
: m_matrix(matrix)
{}
- inline int rows() const { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); }
- inline int cols() const { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
+ inline Index rows() const { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); }
+ inline Index cols() const { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
- inline Scalar coeff(int row, int col) const
+ inline Scalar coeff(Index row, Index col) const
{
if( (int(Direction)==Vertical && row==m_matrix.rows())
|| (int(Direction)==Horizontal && col==m_matrix.cols()))
@@ -223,12 +223,13 @@ struct ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
: public ReturnByValue<ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
{
typedef typename ei_cleantype<typename Lhs::Nested>::type LhsNested;
+ typedef typename MatrixType::Index Index;
ei_homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs)
: m_lhs(lhs), m_rhs(rhs)
{}
- inline int rows() const { return m_lhs.rows(); }
- inline int cols() const { return m_rhs.cols(); }
+ inline Index rows() const { return m_lhs.rows(); }
+ inline Index cols() const { return m_rhs.cols(); }
template<typename Dest> void evalTo(Dest& dst) const
{
@@ -261,12 +262,13 @@ struct ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
: public ReturnByValue<ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
{
typedef typename ei_cleantype<typename Rhs::Nested>::type RhsNested;
+ typedef typename MatrixType::Index Index;
ei_homogeneous_right_product_impl(const MatrixType& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{}
- inline int rows() const { return m_lhs.rows(); }
- inline int cols() const { return m_rhs.cols(); }
+ inline Index rows() const { return m_lhs.rows(); }
+ inline Index cols() const { return m_rhs.cols(); }
template<typename Dest> void evalTo(Dest& dst) const
{
diff --git a/Eigen/src/Geometry/Hyperplane.h b/Eigen/src/Geometry/Hyperplane.h
index 1d0b299ba..8450c9d26 100644
--- a/Eigen/src/Geometry/Hyperplane.h
+++ b/Eigen/src/Geometry/Hyperplane.h
@@ -51,10 +51,11 @@ public:
enum { AmbientDimAtCompileTime = _AmbientDim };
typedef _Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
+ typedef DenseIndex Index;
typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
- typedef Matrix<Scalar,int(AmbientDimAtCompileTime)==Dynamic
+ typedef Matrix<Scalar,Index(AmbientDimAtCompileTime)==Dynamic
? Dynamic
- : int(AmbientDimAtCompileTime)+1,1> Coefficients;
+ : Index(AmbientDimAtCompileTime)+1,1> Coefficients;
typedef Block<Coefficients,AmbientDimAtCompileTime,1> NormalReturnType;
/** Default constructor without initialization */
@@ -62,7 +63,7 @@ public:
/** Constructs a dynamic-size hyperplane with \a _dim the dimension
* of the ambient space */
- inline explicit Hyperplane(int _dim) : m_coeffs(_dim+1) {}
+ inline explicit Hyperplane(Index _dim) : m_coeffs(_dim+1) {}
/** Construct a plane from its normal \a n and a point \a e onto the plane.
* \warning the vector normal is assumed to be normalized.
@@ -122,7 +123,7 @@ public:
~Hyperplane() {}
/** \returns the dimension in which the plane holds */
- inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : AmbientDimAtCompileTime; }
+ inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : Index(AmbientDimAtCompileTime); }
/** normalizes \c *this */
void normalize(void)
diff --git a/Eigen/src/Geometry/OrthoMethods.h b/Eigen/src/Geometry/OrthoMethods.h
index 265507eb9..ed790cc05 100644
--- a/Eigen/src/Geometry/OrthoMethods.h
+++ b/Eigen/src/Geometry/OrthoMethods.h
@@ -137,12 +137,13 @@ struct ei_unitOrthogonal_selector
typedef typename ei_plain_matrix_type<Derived>::type VectorType;
typedef typename ei_traits<Derived>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
+ typedef typename Derived::Index Index;
typedef Matrix<Scalar,2,1> Vector2;
inline static VectorType run(const Derived& src)
{
VectorType perp = VectorType::Zero(src.size());
- int maxi = 0;
- int sndi = 0;
+ Index maxi = 0;
+ Index sndi = 0;
src.cwiseAbs().maxCoeff(&maxi);
if (maxi==0)
sndi = 1;
diff --git a/Eigen/src/Geometry/ParametrizedLine.h b/Eigen/src/Geometry/ParametrizedLine.h
index 1846a440a..45c23385d 100644
--- a/Eigen/src/Geometry/ParametrizedLine.h
+++ b/Eigen/src/Geometry/ParametrizedLine.h
@@ -47,6 +47,7 @@ public:
enum { AmbientDimAtCompileTime = _AmbientDim };
typedef _Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
+ typedef DenseIndex Index;
typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
/** Default constructor without initialization */
@@ -54,7 +55,7 @@ public:
/** Constructs a dynamic-size line with \a _dim the dimension
* of the ambient space */
- inline explicit ParametrizedLine(int _dim) : m_origin(_dim), m_direction(_dim) {}
+ inline explicit ParametrizedLine(Index _dim) : m_origin(_dim), m_direction(_dim) {}
/** Initializes a parametrized line of direction \a direction and origin \a origin.
* \warning the vector direction is assumed to be normalized.
@@ -71,7 +72,7 @@ public:
~ParametrizedLine() {}
/** \returns the dimension in which the line holds */
- inline int dim() const { return m_direction.size(); }
+ inline Index dim() const { return m_direction.size(); }
const VectorType& origin() const { return m_origin; }
VectorType& origin() { return m_origin; }
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h
index 4e054d98a..7d52ebf71 100644
--- a/Eigen/src/Geometry/Quaternion.h
+++ b/Eigen/src/Geometry/Quaternion.h
@@ -617,6 +617,7 @@ template<typename Other>
struct ei_quaternionbase_assign_impl<Other,3,3>
{
typedef typename Other::Scalar Scalar;
+ typedef DenseIndex Index;
template<class Derived> inline static void run(QuaternionBase<Derived>& q, const Other& mat)
{
// This algorithm comes from "Quaternion Calculus and Fast Animation",
@@ -633,13 +634,13 @@ struct ei_quaternionbase_assign_impl<Other,3,3>
}
else
{
- int i = 0;
+ DenseIndex i = 0;
if (mat.coeff(1,1) > mat.coeff(0,0))
i = 1;
if (mat.coeff(2,2) > mat.coeff(i,i))
i = 2;
- int j = (i+1)%3;
- int k = (j+1)%3;
+ DenseIndex j = (i+1)%3;
+ DenseIndex k = (j+1)%3;
t = ei_sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
q.coeffs().coeffRef(i) = Scalar(0.5) * t;
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h
index 6a7bb9ac9..207497fc9 100644
--- a/Eigen/src/Geometry/Transform.h
+++ b/Eigen/src/Geometry/Transform.h
@@ -174,6 +174,7 @@ public:
};
/** the scalar type of the coefficients */
typedef _Scalar Scalar;
+ typedef DenseIndex Index;
/** type of the matrix used to represent the transformation */
typedef Matrix<Scalar,Rows,HDim> MatrixType;
/** type of the matrix used to represent the linear part of the transformation */
@@ -270,11 +271,11 @@ public:
#endif
/** shortcut for m_matrix(row,col);
- * \sa MatrixBase::operaror(int,int) const */
- inline Scalar operator() (int row, int col) const { return m_matrix(row,col); }
+ * \sa MatrixBase::operaror(Index,Index) const */
+ inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
/** shortcut for m_matrix(row,col);
- * \sa MatrixBase::operaror(int,int) */
- inline Scalar& operator() (int row, int col) { return m_matrix(row,col); }
+ * \sa MatrixBase::operaror(Index,Index) */
+ inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
/** \returns a read-only expression of the transformation matrix */
inline const MatrixType& matrix() const { return m_matrix; }
@@ -1141,7 +1142,7 @@ struct ei_transform_right_product_impl<Other,Mode, Dim,HDim, Dim,HDim>
static ResultType run(const TransformType& tr, const Other& other)
{
TransformType res;
- const int Rows = Mode==Projective ? HDim : Dim;
+ enum { Rows = Mode==Projective ? HDim : Dim };
res.matrix().template block<Rows,HDim>(0,0).noalias() = (tr.linearExt() * other);
res.translationExt() += tr.translationExt();
if(Mode!=Affine)
diff --git a/Eigen/src/Geometry/Umeyama.h b/Eigen/src/Geometry/Umeyama.h
index 262d27aa3..5b9fd7725 100644
--- a/Eigen/src/Geometry/Umeyama.h
+++ b/Eigen/src/Geometry/Umeyama.h
@@ -109,6 +109,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
typedef typename ei_umeyama_transform_matrix_type<Derived, OtherDerived>::type TransformationMatrixType;
typedef typename ei_traits<TransformationMatrixType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
+ typedef typename Derived::Index Index;
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL)
EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename ei_traits<OtherDerived>::Scalar>::ret),
@@ -120,8 +121,8 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
typedef Matrix<Scalar, Dimension, Dimension> MatrixType;
typedef typename ei_plain_matrix_type_row_major<Derived>::type RowMajorMatrixType;
- const int m = src.rows(); // dimension
- const int n = src.cols(); // number of measurements
+ const Index m = src.rows(); // dimension
+ const Index n = src.cols(); // number of measurements
// required for demeaning ...
const RealScalar one_over_n = 1 / static_cast<RealScalar>(n);
@@ -151,7 +152,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
// Eq. (40) and (43)
const VectorType& d = svd.singularValues();
- int rank = 0; for (int i=0; i<m; ++i) if (!ei_isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
+ Index rank = 0; for (Index i=0; i<m; ++i) if (!ei_isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
if (rank == m-1) {
if ( svd.matrixU().determinant() * svd.matrixV().determinant() > 0 ) {
Rt.block(0,0,m,m).noalias() = svd.matrixU()*svd.matrixV().transpose();