# [Pkg] The Trunk: Graphics-wiz.141.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jul 3 15:44:48 UTC 2010

```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 at 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!

+ ----- Method: Point>>basicType (in category 'printing') -----
+ basicType
+
+ 	^ #Point!

+ ----- 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
+
+ !

+ ----- 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!

+ ----- Method: Point>>sign (in category 'point functions') -----
+ sign
+
+
+ ^ (x sign @ y sign) .!