combination of two transformations of the same type result in this type again

This commit is contained in:
Johannes Schönberger
2012-07-22 16:38:25 +02:00
parent 87c57770ba
commit be6bb0c809
+7 -1
View File
@@ -176,7 +176,13 @@ class ProjectiveTransform(GeometricTransform):
"""
if isinstance(other, ProjectiveTransform):
return ProjectiveTransform(np.dot(other._matrix, self._matrix))
# combination of the same types result in a transformation of this
# type again, otherwise use general projective transformation
if type(self) == type(other):
tform = self.__class__
else:
tform = ProjectiveTransform
return tform(other._matrix.dot(self._matrix))
else:
raise TypeError("Cannot combine transformations of differing "
"types.")