David T. Lewis uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-wiz.141.mcz==================== Summary ====================
Name: Graphics-wiz.141
Author: wiz
Time: 2 July 2010, 11:35:34.95 pm
UUID: 2cd07aae-7f08-47d5-a6ef-7366058d70f2
Ancestors: Graphics-nice.140
>From Mantis #6596. Marked as added to 3.10 by Edgar. Apparently lost in history when others took over. Resubmitted here.
"Change Set: PointEnh1-wiz
Date: 6 August 2007
Author: (wiz) Jerome Peace
wiz 8/6/2007 21:52
Enhancements to point needed to run morePointTests-wiz
Repairs and enhancements to Point
normal -- now has a default for the zero point.
sign -- extended to include point
rightRotated
leftRotated -- basic shortcuts added to point
fourDirections -- easy way to get a square shape from a point."
=============== Diff against Graphics-nice.140 ===============
Item was changed:
----- Method: Point>>normal (in category 'point functions') -----
normal
+ "Answer a Point representing the unit vector rotated 90 deg clockwise.
+ For the zero point return a normal of -1@0 ."
- "Answer a Point representing the unit vector rotated 90 deg clockwise."
+ | n d |
+
+ n _ y negated @ x.
+ (d := (n x * n x + (n y * n y))) = 0 ifTrue: [ ^ -1 @0 ] .
+ ^n / d sqrt!
- | n |
- n := y negated @ x.
- ^n / (n x * n x + (n y * n y)) sqrt!
Item was added:
+ ----- Method: Point>>basicType (in category 'printing') -----
+ basicType
+ "Answer a symbol representing the inherent type of the receiver"
+
+ ^ #Point!
Item was added:
+ ----- Method: Point>>fourDirections (in category 'point functions') -----
+ fourDirections
+ "Return vertices for a square centered at 0 asPoint with the receiver as first corner.
+ Returns the four rotation of the reciever in counter clockwise order with the reciever appearing last. "
+ ^ Array with: self leftRotated
+ with: self negated
+ with: self rightRotated
+ with: self
+
+ !
Item was added:
+ ----- Method: Point>>rightRotated (in category 'point functions') -----
+ rightRotated
+ "Return the reciever rotated 90 degrees.
+ i.e. self rotateBy: #right centerAt: 0 asPoint .
+ Compare to transposed and normal. "
+ ^y negated @x!
Item was added:
+ ----- Method: Point>>sign (in category 'point functions') -----
+ sign
+
+
+ ^ (x sign @ y sign) .!
Item was added:
+ ----- Method: Point>>leftRotated (in category 'point functions') -----
+ leftRotated
+ "Return the reciever rotated 90 degrees.
+ i.e. self rotateBy: #left centerAt: 0 asPoint .
+ Compare to transposed and normal. "
+ ^y @x negated!