mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-13 01:43:13 +08:00
fix Transform() constructor taking a Transform with other mode.
Not really tested as the geometry tests are currently busted.
This commit is contained in:
parent
19d9c835e0
commit
87aafc9169
@ -62,6 +62,7 @@
|
||||
THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE,
|
||||
THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE,
|
||||
YOU_MADE_A_PROGRAMMING_MISTAKE,
|
||||
EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT,
|
||||
EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE,
|
||||
YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR,
|
||||
YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR,
|
||||
@ -88,7 +89,8 @@
|
||||
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD,
|
||||
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1,
|
||||
THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS,
|
||||
YOU_CANNOT_MIX_ARRAYS_AND_MATRICES
|
||||
YOU_CANNOT_MIX_ARRAYS_AND_MATRICES,
|
||||
YOU_CANT_CONVERT_A_PROJECTIVE_TRANSFORM_INTO_AN_AFFINE_TRANSFORM
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -243,10 +243,31 @@ public:
|
||||
template<int OtherMode>
|
||||
inline Transform(const Transform<Scalar,Dim,OtherMode>& other)
|
||||
{
|
||||
ei_assert(OtherMode!=int(Projective) && "You cannot directly assign a projective transform to an affine one.");
|
||||
EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
|
||||
YOU_CANT_CONVERT_A_PROJECTIVE_TRANSFORM_INTO_AN_AFFINE_TRANSFORM)
|
||||
|
||||
enum { ModeIsAffineCompact = Mode == int(AffineCompact),
|
||||
OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
|
||||
};
|
||||
|
||||
if(ModeIsAffineCompact == OtherModeIsAffineCompact)
|
||||
{
|
||||
m_matrix = other.matrix();
|
||||
}
|
||||
else if(OtherModeIsAffineCompact)
|
||||
{
|
||||
typedef typename Transform<Scalar,Dim,OtherMode>::MatrixType OtherMatrixType;
|
||||
ei_transform_construct_from_matrix<OtherMatrixType,Mode,Dim,HDim>::run(this, other.matrix());
|
||||
}
|
||||
else
|
||||
{
|
||||
// here we know that Mode == AffineCompact and OtherMode != AffineCompact.
|
||||
// if OtherMode were Projective, the static assert above would already have caught it.
|
||||
// So the only possibility is that OtherMode == Affine
|
||||
linear() = other.linear();
|
||||
translation() = other.translation();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename OtherDerived>
|
||||
Transform(const ReturnByValue<OtherDerived>& other)
|
||||
|
Loading…
x
Reference in New Issue
Block a user