equal
deleted
inserted
replaced
236 ! ! |
236 ! ! |
237 |
237 |
238 !Point methodsFor:'Compatibility-Squeak'! |
238 !Point methodsFor:'Compatibility-Squeak'! |
239 |
239 |
240 adhereTo: aRectangle |
240 adhereTo: aRectangle |
241 "If the receiver lies outside aRectangle, return the nearest point on the boundary of the rectangle, otherwise return self." |
241 "If the receiver lies outside aRectangle, return the nearest point on the boundary of the rectangle, |
|
242 otherwise return self." |
242 |
243 |
243 (aRectangle containsPoint: self) ifTrue: [^ self]. |
244 (aRectangle containsPoint: self) ifTrue: [^ self]. |
244 ^ ((x max: aRectangle left) min: aRectangle right) |
245 ^ ((x max: aRectangle left) min: aRectangle right) |
245 @ |
246 @ |
246 ((y max: aRectangle top) min: aRectangle bottom) |
247 ((y max: aRectangle top) min: aRectangle bottom) |
247 ! |
248 ! |
248 |
249 |
249 area |
250 area |
|
251 "compute the area of a rectangle with myself taken as extent" |
|
252 |
250 ^ x * y |
253 ^ x * y |
251 |
254 |
252 "Created: / 29-05-2007 / 09:57:57 / cg" |
255 "Created: / 29-05-2007 / 09:57:57 / cg" |
253 ! |
256 ! |
254 |
257 |