Rectangle.st
changeset 4890 fa9abaa225ef
parent 4869 45bae3b31eef
child 4894 e017cd6402bb
--- a/Rectangle.st	Sat Oct 09 15:17:13 1999 +0200
+++ b/Rectangle.st	Sat Oct 09 17:31:41 1999 +0200
@@ -67,6 +67,15 @@
 
 !Rectangle class methodsFor:'instance creation'!
 
+center:centerPoint extent:extentPoint 
+    "return an instance of me whose center is centerPoint and width 
+     by height is extentPoint."
+
+    ^ self 
+        origin:centerPoint - (extentPoint//2) 
+        extent:extentPoint
+!
+
 decodeFromLiteralArray:anArray
     "create & return a new instance from information encoded in anArray.
      Redefined for faster creation."
@@ -1016,6 +1025,18 @@
     "Created: 12.2.1997 / 11:44:45 / cg"
 !
 
+corners
+    "Return an array of corner points"
+
+    ^ Array
+        with: self topLeft
+        with: self bottomLeft
+        with: self bottomRight
+        with: self topRight
+
+
+!
+
 isRectangle
     "return true, if the receiver is some kind of rectangle"
 
@@ -1652,5 +1673,5 @@
 !Rectangle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.65 1999-10-07 10:57:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.66 1999-10-09 15:31:41 cg Exp $'
 ! !