doku
authorClaus Gittinger <cg@exept.de>
Wed, 08 May 1996 20:17:16 +0200
changeset 1354 0515d1ed37e4
parent 1353 cab0fdd4f08e
child 1355 ab14ef139343
doku
Geometric.st
Point.st
Rectangle.st
--- a/Geometric.st	Wed May 08 19:50:32 1996 +0200
+++ b/Geometric.st	Wed May 08 20:17:16 1996 +0200
@@ -199,9 +199,9 @@
     v := (View extent:100@100) openAndWait.
 
     p := Spline controlPoints:
-                (Array with:(10@10)
-                       with:(90@90)
-                       with:(10@90)).
+                (Array with:(20@20)
+                       with:(80@80)
+                       with:(20@80)).
 
     v paint:Color blue.
     p displayFilledOn:v.
@@ -217,10 +217,10 @@
     v := (View extent:100@100) openAndWait.
 
     p := Spline controlPoints:
-                (Array with:(30@30)
-                       with:(70@70)
-                       with:(30@70)
-                       with:(30@30)).
+                (Array with:(20@20)
+                       with:(80@80)
+                       with:(20@80)
+                       with:(20@20)).
 
     v paint:Color blue.
     p displayFilledOn:v.
@@ -302,5 +302,5 @@
 !Geometric class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Geometric.st,v 1.12 1996-05-08 17:50:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Geometric.st,v 1.13 1996-05-08 18:16:58 cg Exp $'
 ! !
--- 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!
--- a/Rectangle.st	Wed May 08 19:50:32 1996 +0200
+++ b/Rectangle.st	Wed May 08 20:17:16 1996 +0200
@@ -570,6 +570,18 @@
     "
 !
 
+asPolygon
+    "return a polygon from the receiver"
+
+    ^ Polygon vertices:self asPointArray
+
+    "
+     (10@10 corner:100@100) asPolygon
+    "
+
+    "Modified: 8.5.1996 / 20:14:44 / cg"
+!
+
 fromLiteralArrayEncoding:encoding
     "read my values from an encoding.
      The encoding is supposed to be of the form: (Rectangle orgX orgY cornX cornY)"
@@ -1333,5 +1345,5 @@
 !Rectangle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.39 1996-05-08 12:45:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.40 1996-05-08 18:17:16 cg Exp $'
 ! !