PolygonMorph intersection
Hi Sudheendra Hangal,
You can work with the morphs shadows.
First pass, check if the boundries intersect. If they don't then your done.
Else get a form the size of the boundry intersection. In it draw the shadows of each morph s.t. only the double shadow shows. Then check to see if the form is all white. If it is not then the morphs intersect. Obviously if one morph is a rectangle you just have to see if the others shadow falls on the boundry.
To track down how to do this in a workspace type shadowForm
select it and type Cmd-m (for implementers) This will give you a browser with all the definitions of the method in the system.
You might be interested in looking at the code I wrote for puzzleboards: http://209.143.91.36/super/634 Puzzleboards
The index to that and other pieces of code are at: http://209.143.91.36/super/637 Goodies from Jerome Peace
The site is bob's superswiki.
I haven't look at that code recently so let me know if it works or if you have problems. I am pretty sure the project won't be loadable. Too much has changed and projects are very sensitive. The changeset is what I think I was claiming would work in 3.8 and 3.9.
Let me know how you get on.
Yours in curiosity and service, --Jerome Peace
***
Thanks, Jerome - have filed the issue in Mantis.
I'm looking for the easiest way to figure out if polygon A is contained inside polygon B.
One way to do this is by checking if polygon A intersects any segments of B and any one of A's vertices lies inside B. is there a better way ?
Thanks,
-sgh
***
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
beginners@lists.squeakfoundation.org