aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Geometry/Scaling.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-03-02 17:38:40 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-03-02 17:38:40 +0100
commitc7828ac45c151caad4afdbe6fc26ca989fef4337 (patch)
treef21a521bda32e5780133b20262067f23c1055472 /Eigen/src/Geometry/Scaling.h
parent2f3d685e0c687ae1121428dab6bc0ec868b14fe3 (diff)
add missing implementation of uniform scaling products
Diffstat (limited to 'Eigen/src/Geometry/Scaling.h')
-rw-r--r--Eigen/src/Geometry/Scaling.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/Eigen/src/Geometry/Scaling.h b/Eigen/src/Geometry/Scaling.h
index 2ff8eaba3..27bbec8cd 100644
--- a/Eigen/src/Geometry/Scaling.h
+++ b/Eigen/src/Geometry/Scaling.h
@@ -72,8 +72,8 @@ public:
inline Transform<Scalar,Dim> operator* (const Translation<Scalar,Dim>& t) const;
/** Concatenates a uniform scaling and an affine transformation */
- template<int Dim>
- inline Transform<Scalar,Dim> operator* (const Transform<Scalar,Dim>& t) const;
+ template<int Dim, int Mode>
+ inline Transform<Scalar,Dim,Mode> operator* (const Transform<Scalar,Dim, Mode>& t) const;
/** Concatenates a uniform scaling and a linear transformation matrix */
// TODO returns an expression
@@ -156,4 +156,27 @@ typedef DiagonalMatrix<float, 3> AlignedScaling3f;
typedef DiagonalMatrix<double,3> AlignedScaling3d;
//@}
+template<typename Scalar>
+template<int Dim>
+inline Transform<Scalar,Dim>
+UniformScaling<Scalar>::operator* (const Translation<Scalar,Dim>& t) const
+{
+ Transform<Scalar,Dim> res;
+ res.matrix().setZero();
+ res.linear().diagonal().fill(factor());
+ res.translation() = factor() * t.vector();
+ res(Dim,Dim) = Scalar(1);
+ return res;
+}
+
+template<typename Scalar>
+template<int Dim,int Mode>
+inline Transform<Scalar,Dim,Mode>
+UniformScaling<Scalar>::operator* (const Transform<Scalar,Dim, Mode>& t) const
+{
+ Transform<Scalar,Dim> res = t;
+ res.prescale(factor());
+ return res;
+}
+
#endif // EIGEN_SCALING_H