mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-22 09:39:34 +08:00
add matrix * transform product
This commit is contained in:
parent
df4bd5e46f
commit
ebf906a23a
@ -184,6 +184,13 @@ public:
|
|||||||
operator * (const MatrixBase<OtherDerived> &other) const
|
operator * (const MatrixBase<OtherDerived> &other) const
|
||||||
{ return ei_transform_product_impl<OtherDerived,Dim,HDim>::run(*this,other.derived()); }
|
{ 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 */
|
/** Contatenates two transformations */
|
||||||
inline const Transform
|
inline const Transform
|
||||||
operator * (const Transform& other) const
|
operator * (const Transform& other) const
|
||||||
|
@ -180,7 +180,7 @@ template<typename Scalar> void geometry(void)
|
|||||||
VERIFY_IS_APPROX(t0.prescale(a).matrix(), t1.prescale(Vector3::Constant(a)).matrix());
|
VERIFY_IS_APPROX(t0.prescale(a).matrix(), t1.prescale(Vector3::Constant(a)).matrix());
|
||||||
|
|
||||||
// More transform constructors, operator=, operator*=
|
// More transform constructors, operator=, operator*=
|
||||||
|
|
||||||
Scalar a3 = ei_random<Scalar>(-M_PI, M_PI);
|
Scalar a3 = ei_random<Scalar>(-M_PI, M_PI);
|
||||||
Vector3 v3 = Vector3::Random().normalized();
|
Vector3 v3 = Vector3::Random().normalized();
|
||||||
AngleAxisx aa3(a3, v3);
|
AngleAxisx aa3(a3, v3);
|
||||||
@ -212,6 +212,9 @@ template<typename Scalar> void geometry(void)
|
|||||||
t4 *= sv3;
|
t4 *= sv3;
|
||||||
VERIFY_IS_APPROX(t6.matrix(), t4.matrix());
|
VERIFY_IS_APPROX(t6.matrix(), t4.matrix());
|
||||||
|
|
||||||
|
// matrix * transform
|
||||||
|
VERIFY_IS_APPROX(Transform3(t3.matrix()*t4).matrix(), Transform3(t3*t4).matrix());
|
||||||
|
|
||||||
// chained Transform product
|
// chained Transform product
|
||||||
VERIFY_IS_APPROX(((t3*t4)*t5).matrix(), (t3*(t4*t5)).matrix());
|
VERIFY_IS_APPROX(((t3*t4)*t5).matrix(), (t3*(t4*t5)).matrix());
|
||||||
|
|
||||||
@ -220,8 +223,6 @@ template<typename Scalar> void geometry(void)
|
|||||||
t5 = t5*t5;
|
t5 = t5*t5;
|
||||||
VERIFY_IS_APPROX(t5, t4*t4);
|
VERIFY_IS_APPROX(t5, t4*t4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 2D transformation
|
// 2D transformation
|
||||||
Transform2 t20, t21;
|
Transform2 t20, t21;
|
||||||
Vector2 v20 = Vector2::Random();
|
Vector2 v20 = Vector2::Random();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user