WindowingTransformation.st
changeset 7059 2cfbbee08eb4
parent 7038 94deb70cb1cd
child 8595 7f9b84978a2e
child 8717 b40981a26bbd
--- a/WindowingTransformation.st	Fri Nov 13 11:57:45 2015 +0100
+++ b/WindowingTransformation.st	Fri Nov 13 11:58:19 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -513,19 +515,10 @@
     ^ (p * scale + translation)
 !
 
-transformRectangle:rect 
-    "Apply the receiver to a point, returning a new point."
+transformRectangle:aRectangle 
+    "Apply the receiver to a rectangle, returning a new rectangle."
 
-    scale isNil ifTrue:[
-        translation isNil ifTrue:[
-            ^ rect.
-        ].
-        ^ rect + translation
-    ].
-    translation isNil ifTrue:[
-        ^ rect scaledBy: scale
-    ].
-    ^ (rect scaledBy: scale) + translation
+    ^ aRectangle scaledBy:scale translatedBy:translation.
 ! !
 
 !WindowingTransformation methodsFor:'printing & storing'!
@@ -544,13 +537,13 @@
 !WindowingTransformation methodsFor:'private'!
 
 inverseTranslation
-    "return with a Point representing the inverse of my
+    "return with a Point or Number representing the inverse of my
      translation."
 
-    |trans|
-
-    trans := translation asPoint.
-    ^ Point x:(trans x negated) y:(trans y negated)
+    translation isNil ifTrue:[
+        ^ nil.
+    ].
+    ^ translation negated.
 ! !
 
 !WindowingTransformation methodsFor:'testing'!