mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-05 04:35:46 +08:00
fix #1 : need to nest by value the affine part in homogeneous product
This commit is contained in:
parent
e0832d5d93
commit
e186728867
@ -102,11 +102,11 @@ template<typename MatrixType,int Direction> class Homogeneous
|
|||||||
|
|
||||||
template<typename Scalar, int Dim, int Mode> friend
|
template<typename Scalar, int Dim, int Mode> friend
|
||||||
inline const ei_homogeneous_left_product_impl<Homogeneous,
|
inline const ei_homogeneous_left_product_impl<Homogeneous,
|
||||||
typename Transform<Scalar,Dim,Mode>::AffinePart>
|
typename Transform<Scalar,Dim,Mode>::AffinePartNested>
|
||||||
operator* (const Transform<Scalar,Dim,Mode>& tr, const Homogeneous& rhs)
|
operator* (const Transform<Scalar,Dim,Mode>& tr, const Homogeneous& rhs)
|
||||||
{
|
{
|
||||||
ei_assert(Direction==Vertical);
|
ei_assert(Direction==Vertical);
|
||||||
return ei_homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Mode>::AffinePart>
|
return ei_homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Mode>::AffinePartNested >
|
||||||
(tr.affine(),rhs.m_matrix);
|
(tr.affine(),rhs.m_matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +184,10 @@ public:
|
|||||||
typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
|
typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
|
||||||
MatrixType&,
|
MatrixType&,
|
||||||
Block<MatrixType,Dim,HDim> >::ret AffinePart;
|
Block<MatrixType,Dim,HDim> >::ret AffinePart;
|
||||||
|
/** type of read/write reference to the affine part of the transformation */
|
||||||
|
typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
|
||||||
|
MatrixType&,
|
||||||
|
NestByValue<Block<MatrixType,Dim,HDim> > >::ret AffinePartNested;
|
||||||
/** type of a vector */
|
/** type of a vector */
|
||||||
typedef Matrix<Scalar,Dim,1> VectorType;
|
typedef Matrix<Scalar,Dim,1> VectorType;
|
||||||
/** type of a read/write reference to the translation part of the rotation */
|
/** type of a read/write reference to the translation part of the rotation */
|
||||||
|
@ -88,6 +88,17 @@ template<typename Scalar,int Size> void homogeneous(void)
|
|||||||
v0.transpose().rowwise().homogeneous() * t3);
|
v0.transpose().rowwise().homogeneous() * t3);
|
||||||
VERIFY_IS_APPROX((m0.transpose().rowwise().homogeneous().eval()) * t3,
|
VERIFY_IS_APPROX((m0.transpose().rowwise().homogeneous().eval()) * t3,
|
||||||
m0.transpose().rowwise().homogeneous() * t3);
|
m0.transpose().rowwise().homogeneous() * t3);
|
||||||
|
|
||||||
|
// test product with a Transform object
|
||||||
|
Transform<Scalar, Size, Affine> Rt;
|
||||||
|
Matrix<Scalar, Size, Dynamic> pts, Rt_pts1;
|
||||||
|
|
||||||
|
Rt.setIdentity();
|
||||||
|
pts.setRandom(Size,5);
|
||||||
|
|
||||||
|
Rt_pts1 = Rt * pts.colwise().homogeneous();
|
||||||
|
std::cerr << (Rt_pts1 - pts).sum() << "\n";
|
||||||
|
VERIFY_IS_MUCH_SMALLER_THAN( (Rt_pts1 - pts).sum(), Scalar(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_geo_homogeneous()
|
void test_geo_homogeneous()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user