add matrix * transform product

This commit is contained in:
Gael Guennebaud 2008-12-19 16:31:22 +00:00
parent df4bd5e46f
commit ebf906a23a
2 changed files with 11 additions and 3 deletions

View File

@ -184,6 +184,13 @@ public:
operator * (const MatrixBase<OtherDerived> &other) const
{ return ei_transform_product_impl<OtherDerived,Dim,HDim>::run(*this,other.derived()); }
/** \returns the product expression of a transformation matrix \a a times a transform \a b
* The transformation matrix \a a must have a Dim+1 x Dim+1 sizes. */
template<typename OtherDerived>
friend inline const typename ProductReturnType<OtherDerived,MatrixType>::Type
operator * (const MatrixBase<OtherDerived> &a, const Transform &b)
{ return a.derived() * b.matrix(); }
/** Contatenates two transformations */
inline const Transform
operator * (const Transform& other) const

View File

@ -180,7 +180,7 @@ template<typename Scalar> void geometry(void)
VERIFY_IS_APPROX(t0.prescale(a).matrix(), t1.prescale(Vector3::Constant(a)).matrix());
// More transform constructors, operator=, operator*=
Scalar a3 = ei_random<Scalar>(-M_PI, M_PI);
Vector3 v3 = Vector3::Random().normalized();
AngleAxisx aa3(a3, v3);
@ -212,6 +212,9 @@ template<typename Scalar> void geometry(void)
t4 *= sv3;
VERIFY_IS_APPROX(t6.matrix(), t4.matrix());
// matrix * transform
VERIFY_IS_APPROX(Transform3(t3.matrix()*t4).matrix(), Transform3(t3*t4).matrix());
// chained Transform product
VERIFY_IS_APPROX(((t3*t4)*t5).matrix(), (t3*(t4*t5)).matrix());
@ -220,8 +223,6 @@ template<typename Scalar> void geometry(void)
t5 = t5*t5;
VERIFY_IS_APPROX(t5, t4*t4);
// 2D transformation
Transform2 t20, t21;
Vector2 v20 = Vector2::Random();