Difference of Rectangles

Jim Rosenberg jr at amanue.com
Sun May 6 20:12:03 UTC 2007


Consider two rectangles, a and b. The only constraint I will put on them is 
that neither contains the other. I wish to create a PolygonMorph 
programmatically consisting of a merge: b with b removed but all of a 
retained in the case a and b overlap. I think I see my way to how to do 
this, but if anyone knows of any code I can look at where something like 
this is already implemented I'd be much obliged.

My idea for how to go about this is to use "turtle logic" more or less as 
follows: Start with the first vertex of a merge: b which is not inside of 
b. Proceed clockwise along the bounds of a merge: b; if you hit b turn 
left, if you hit a turn right. But this may be doing things the hard way.

-Thanks, Jim



More information about the Squeak-dev mailing list