about containsPoint:

stéphane ducasse ducasse at iam.unibe.ch
Sat Nov 5 19:19:16 UTC 2005


what about this comment

containsPoint: aPoint
     "Answer whether aPoint is within the receiver. For raster  
operation reason, in case of  rectangles sharing an edge, a point on  
the border is not belonging to the two rectangles but the one to the  
left (closer to the origin)"

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


If you have a better english version I accept it :)

Stef



On 5 nov. 05, at 19:49, Bert Freudenberg wrote:

>
> Am 05.11.2005 um 18:37 schrieb stéphane ducasse:
>
>
>> testContainsPoint
>>     "self run: #testContainsPoint"
>>
>>     self assert: ((0 at 0 extent: 300 at 200) containsPoint: 100 at 100).
>>     self deny: ((0 at 0 extent: 300 at 200) containsPoint: 0 at 299).
>>     self assert: ((0 at 0 extent: 300 at 200) containsPoint: 0 at 199).
>>
>>
>>     "strange behavior a rectangle includes a point that is equals to
>>     its origin but not its corner"
>>     self deny: ((0 at 0 extent: 300 at 200) containsPoint: 0 at 200).
>>     self assert: ((0 at 0 extent: 300 at 200) containsPoint: 0 at 0).
>>     self deny: ((0 at 0 extent: 300 at 200) containsPoint: 300 at 200).
>>
>> may be this is to make sure that a point cannot belongs to two  
>> rectangles that would be just
>> overlapping of one pixel?
>>
>
> Yes. Rasterizing two adjacent rectangles (e.g., "rect1 right =  
> rect2 left") should leave no gap and touch every pixel exactly  
> once. This is a basic property of all graphics packages (google for  
> "rasterization rules" if you want to learn more), but often comes  
> as a surprise to graphics newbies, because geometry in school does  
> not deal with rasterization.
>
> - Bert -
>
>
>
>




More information about the Squeak-dev mailing list