ANN Testing for overlapping polygons

Jim Hurley jhurley at infostations.com
Mon Jun 27 06:11:31 EDT 2005


[Hope this isn't a repeat. According to my ISP this was not 
delivered. Perhaps the problems that Heather warned of over the 
weekend.]

Well, I said it was grubby, but here it is, a stack which test for 
overlap between polygons.

In the message box:

go stack url "http://home.infostations.net/jhurley/OverlapTest.rev"

I was wondering how RR tests for within(). One way would be to draw a 
line from the point in question to the edge of the screen. If there 
are an odd number of intersections with the lines of the polygon, 
then the point is inside, otherwise it is outside.

But how does RR paste a color into an opaque polygon, how does it 
know which pixels are inside and which outside the polygon? It 
doesn't test for all points, of which there are an infinite number, 
but it must know which pixels (integer points) are located 
inside--this generally would be sufficient to test for overlap--and 
collision. Maybe this would be a request feature RR might consider. 
The hard part of overlap and collision may already be in the engine.

Jim



More information about the use-livecode mailing list