Point.st
changeset 1354 0515d1ed37e4
parent 1339 e65288686de2
child 1701 80d13adb2e77
--- a/Point.st	Wed May 08 19:50:32 1996 +0200
+++ b/Point.st	Wed May 08 20:17:16 1996 +0200
@@ -67,6 +67,27 @@
 
 !Point class methodsFor:'instance creation'!
 
+r:distance angle:angle
+    "create and return a new point given polar coordinates.
+     The angle is given in degrees"
+
+    |x y rad|
+
+    rad := angle degreesToRadians.
+    x := distance * rad cos.
+    y := distance * rad sin.
+    ^ x @ y
+
+    "
+     Point r:100 angle:0  
+     Point r:100 angle:90  
+     Point r:100 angle:45  
+     Point r:100 angle:180  
+    "
+
+    "Modified: 8.5.1996 / 20:01:50 / cg"
+!
+
 readFrom:aStringOrStream onError:exceptionBlock
     "return the next Point from the (character-)stream aStream;
      skipping all whitespace first; return the value of exceptionBlock,
@@ -881,6 +902,6 @@
 !Point class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Point.st,v 1.37 1996-05-07 10:19:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Point.st,v 1.38 1996-05-08 18:16:47 cg Exp $'
 ! !
 Point initialize!