avoid calling arcTan too often
authorClaus Gittinger <cg@exept.de>
Sun, 12 May 1996 23:50:20 +0200
changeset 322 38c88d4b3976
parent 321 49c7fd30093c
child 323 125bc8f428a4
avoid calling arcTan too often
Arrow.st
--- a/Arrow.st	Sun May 12 23:41:46 1996 +0200
+++ b/Arrow.st	Sun May 12 23:50:20 1996 +0200
@@ -232,7 +232,7 @@
     "display the receiver in the graphicsContext, aGC"
 
     |arrowHeadPoint len pos angle point grad xDis yDis
-     savedLineStyle|
+     savedLineStyle atn|
 
     super displayStrokedOn:aGC.
 
@@ -262,8 +262,10 @@
     point x = 0
                 ifTrue: [grad := 9999999]
                 ifFalse: [grad := point y / point x].
-    xDis := len * (angle - grad arcTan) cos.
-    yDis := len * (angle - grad arcTan) sin.
+
+    atn := grad arcTan.
+    xDis := len * (angle - atn) cos.
+    yDis := len * (angle - atn) sin.
     point x = 0
                 ifTrue: [point y > 0
                         ifTrue: [pos := point x + xDis @ (point y - yDis)]
@@ -274,8 +276,8 @@
 
     aGC displayLineFrom:arrowHeadPoint to:startPoint + pos.
 
-    xDis := len * (angle + grad arcTan) cos.
-    yDis := len * (angle + grad arcTan) sin.
+    xDis := len * (angle + atn) cos.
+    yDis := len * (angle + atn) sin.
     point x = 0
             ifTrue: [point y > 0
                     ifTrue: [pos := point x + xDis @ (point y + yDis)]
@@ -297,12 +299,12 @@
     "
 
     "Created: 12.5.1996 / 22:54:11 / cg"
-    "Modified: 12.5.1996 / 23:39:02 / cg"
+    "Modified: 12.5.1996 / 23:49:47 / cg"
 ! !
 
 !Arrow class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Arrow.st,v 1.3 1996-05-12 21:41:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Arrow.st,v 1.4 1996-05-12 21:50:20 cg Exp $'
 ! !
 Arrow initialize!