about containsPoint:

stéphane ducasse ducasse at iam.unibe.ch
Sat Nov 5 17:28:25 UTC 2005


Hi

I was looking for example for tests for a lecture and I started to  
code some tests for rectangle.


I stumbled over

containsPoint: aPoint
     "Answer whether aPoint is within the receiver."

     ^origin <= aPoint and: [aPoint < corner]

and I was wondering was this is not symetric, ie:

containsPoint: aPoint
     "Answer whether aPoint is within the receiver."

     ^origin < aPoint and: [aPoint < corner]

or

containsPoint: aPoint
     "Answer whether aPoint is within the receiver."

     ^origin <= aPoint and: [aPoint <= corner]

does anybody knows why?

In visualWorks this is the same

This is strange since for rectangle containment we have a symmetric  
behavior.

containsRect: aRect
     "Answer whether aRect is within the receiver (OK to coincide)."

     ^ aRect origin >= origin and: [aRect corner <= corner]




Stef



More information about the Squeak-dev mailing list