about containsPoint:
Bert Freudenberg
bert at impara.de
Sat Nov 5 18:49:30 UTC 2005
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
|