[squeak-dev] What it is the expected behavior of Rectangle (class) #intersect: if there is no interesection?

LawsonEnglish LEnglish5 at cox.net
Tue Nov 29 00:50:26 UTC 2022

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. 



More information about the Squeak-dev mailing list