class: WindowingTransformation
added: #isIdentityTransformation
comment/format in: #transformPoint:
--- a/WindowingTransformation.st Sat Mar 22 10:26:53 2014 +0100
+++ b/WindowingTransformation.st Mon Mar 24 20:18:28 2014 +0100
@@ -515,18 +515,16 @@
!
transformPoint:p
- "Apply the receiver to a point.
- This is destructive in that the point is being modified,
- not a copy."
+ "Apply the receiver to a point."
scale isNil ifTrue:[
- translation isNil ifTrue:[
- ^ p
- ].
- ^ p + translation
+ translation isNil ifTrue:[
+ ^ p
+ ].
+ ^ p + translation
].
translation isNil ifTrue:[
- ^ p * scale
+ ^ p * scale
].
^ (p * scale + translation)
! !
@@ -580,6 +578,14 @@
!WindowingTransformation methodsFor:'testing'!
+isIdentityTransformation
+ "return true if this is an identity transformation;
+ return false, otherwise."
+
+ ^ (scale isNil or:[scale x = 1 and:[scale y = 1]])
+ and:[translation isNil or:[translation x = 0 and:[translation y = 0]]]
+!
+
noScale
"return true if the identity scale is in effect;
return false, otherwise."
@@ -667,5 +673,6 @@
!WindowingTransformation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.23 2011-09-29 11:18:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.24 2014-03-24 19:18:28 stefan Exp $'
! !
+