aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-08-30 23:10:46 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-08-30 23:10:46 +0000
commit5c8c09e02188ab4441a99bb07c5feb1308ab068f (patch)
tree6ebbc9028acbfce791ae0dcf4f44007403fe0186 /Eigen
parent9c450a52a28e10f4caf87a968612fa8d007ce4b1 (diff)
add uniform scale/prescale functions in Tranform
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Geometry/RotationBase.h4
-rw-r--r--Eigen/src/Geometry/Transform.h26
2 files changed, 28 insertions, 2 deletions
diff --git a/Eigen/src/Geometry/RotationBase.h b/Eigen/src/Geometry/RotationBase.h
index e436f8fe6..dff905528 100644
--- a/Eigen/src/Geometry/RotationBase.h
+++ b/Eigen/src/Geometry/RotationBase.h
@@ -77,7 +77,7 @@ template<typename OtherDerived>
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
::Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
{
- EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,OtherDerived::Dim,OtherDerived::Dim);
+ EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim));
*this = r.toRotationMatrix();
}
@@ -91,7 +91,7 @@ Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
::operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
{
- EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,OtherDerived::Dim,OtherDerived::Dim);
+ EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim));
return *this = r.toRotationMatrix();
}
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h
index da457fc38..7475b75df 100644
--- a/Eigen/src/Geometry/Transform.h
+++ b/Eigen/src/Geometry/Transform.h
@@ -188,6 +188,9 @@ public:
template<typename OtherDerived>
inline Transform& prescale(const MatrixBase<OtherDerived> &other);
+ inline Transform& scale(Scalar s);
+ inline Transform& prescale(Scalar s);
+
template<typename OtherDerived>
inline Transform& translate(const MatrixBase<OtherDerived> &other);
@@ -310,6 +313,17 @@ Transform<Scalar,Dim>::scale(const MatrixBase<OtherDerived> &other)
return *this;
}
+/** Applies on the right a uniform scale of a factor \a c to \c *this
+ * and returns a reference to \c *this.
+ * \sa prescale(Scalar)
+ */
+template<typename Scalar, int Dim>
+inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::scale(Scalar s)
+{
+ linear() *= s;
+ return *this;
+}
+
/** Applies on the left the non uniform scale transformation represented
* by the vector \a other to \c *this and returns a reference to \c *this.
* \sa scale()
@@ -324,6 +338,17 @@ Transform<Scalar,Dim>::prescale(const MatrixBase<OtherDerived> &other)
return *this;
}
+/** Applies on the left a uniform scale of a factor \a c to \c *this
+ * and returns a reference to \c *this.
+ * \sa scale(Scalar)
+ */
+template<typename Scalar, int Dim>
+inline Transform<Scalar,Dim>& Transform<Scalar,Dim>::prescale(Scalar s)
+{
+ m_matrix.template corner<Dim,HDim>(TopLeft) *= s;
+ return *this;
+}
+
/** Applies on the right the translation matrix represented by the vector \a other
* to \c *this and returns a reference to \c *this.
* \sa pretranslate()
@@ -516,6 +541,7 @@ Transform<Scalar,Dim>::extractRotation(TransformTraits traits) const
return linear();
else
ei_assert("invalid traits value in Transform::inverse()");
+ return LinearMatrixType();
}
/** Convenient method to set \c *this from a position, orientation and scale