complex conversion stuff
authorClaus Gittinger <cg@exept.de>
Thu, 09 Jul 1998 10:21:23 +0200
changeset 3636 cba3cd259b32
parent 3635 3fcccef48db3
child 3637 2b4d733c9a01
complex conversion stuff (used to be in goodies/Complex.st)
Point.st
--- a/Point.st	Thu Jul 09 10:20:04 1998 +0200
+++ b/Point.st	Thu Jul 09 10:21:23 1998 +0200
@@ -361,6 +361,15 @@
 
 !Point methodsFor:'converting'!
 
+asComplex
+    "Return a complex number whose real and imaginary components are the x and y
+     coordinates of the receiver."
+
+    ^ x % y
+
+    "Modified: / 9.7.1998 / 10:21:10 / cg"
+!
+
 asFractionalLayout
     "return a LayoutOrigin from the receiver,
      treating the receiver coordinates as fractional parts 
@@ -620,12 +629,6 @@
      "
 !
 
-rounded
-    "return a new point with my coordinates rounded to the next integer."
-
-    ^ (x rounded) @ (y rounded)
-!
-
 roundTo:aNumber
     "return a new point with my coordinates rounded towards the next
      multiple of aNumber."
@@ -633,10 +636,10 @@
     ^ (self / aNumber) rounded * aNumber
 !
 
-truncated
-    "return a new point with my coordinates truncated as integer."
+rounded
+    "return a new point with my coordinates rounded to the next integer."
 
-    ^ (x truncated) @ (y truncated)
+    ^ (x rounded) @ (y rounded)
 !
 
 truncateTo:aNumber
@@ -644,6 +647,12 @@
      multiple of aNumber."
 
     ^ (self quo:aNumber) rounded * aNumber
+!
+
+truncated
+    "return a new point with my coordinates truncated as integer."
+
+    ^ (x truncated) @ (y truncated)
 ! !
 
 !Point methodsFor:'point functions'!
@@ -977,6 +986,6 @@
 !Point class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Point.st,v 1.46 1998-06-12 15:53:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Point.st,v 1.47 1998-07-09 08:21:23 cg Exp $'
 ! !
 Point initialize!