[squeak-dev] What it is the expected behavior of Rectangle (class) #intersect: if there is no interesection?
karlramberg at gmail.com
Tue Nov 29 06:01:26 UTC 2022
Doh, ignore my answer.
Its to early in the morning :-D
On Tue, Nov 29, 2022 at 6:50 AM karl ramberg <karlramberg at gmail.com> wrote:
> I think you must use this method with a very similar name
> intersects: aRectangle
> "Answer whether aRectangle intersects the receiver anywhere."
> "Optimized; old code answered:
> (origin max: aRectangle origin) < (corner min: aRectangle corner)"
> On Tue, Nov 29, 2022 at 1:50 AM LawsonEnglish <LEnglish5 at cox.net> wrote:
>> I did this and created 2 small rectangles quite far from each other
>> trying to figure out what the method returns when there is no intersection:
>> r1 := Rectangle fromUser.
>> r2 := Rectangle fromUser.
>> r2 3072 at 993 corner: 3203 at 1136
>> r1 2710 at 632 corner: 2835 at 752
>> r2 intersect: r1 3072 at 993 corner: 2835 at 752
>> r1 intersect: r2 3072 at 993 corner: 2835 at 752
>> Could someone explain these results?
>> Not in terms of the math involved (I assume that there’s no math bug as
>> the routine was last edited 22 years ago and it is used everywhere in
>> Morphic), but what the LOGIC is for returning what is returned and what it
>> means in the context of the comments:
>> intersect: aRectangle
>> "Answer a Rectangle that is the area in which the receiver
>> overlaps with
>> aRectangle…. “
>> I was trying to figure out how to look to identify when there is no
>> intersection, and that isn’t at all obvious here.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev