Math question: How to compute the area of polygons

Jim Hurley jhurley at infostations.com
Thu Mar 20 07:13:01 EST 2003


>
>
>On Wednesday, March 19, 2003, at 10:47 AM, Jim Hurley wrote:
>
>>  But you have to do this for each line segment pair. If there are n
>>  line segments in one sprite and m in the other, there will be n*m
>>  potential intersections. Heavy!!!
>>
>>  If it were me, I would just fake it by calling it a collision if the
>>  distances between their centers (locs) are less than a specified
>>  number. But I am a person of loose morals.
>Dar Scott wrote:
>And I tend to legalistic.
>
>There may be a way to mix styles.  If we limit our attention to the
>intersection of the bounding rectangles of the two polygons, then we
>can eliminate those line segments that do not intersect or are
>otherwise not "near" the intersection rectangle.  In the worse case
>this is more work, but on the average it should be less "heavy".  Use
>your "loose morals" to come up with "near".
>

(snip)

Dar,

You have obviously given this a lot of thought! And I'm sure you  are 
right about a two pronged approach  being the right  one: First check 
to see if the locs are close enough that it is *possible* for the two 
polygon boundaries to intersect, and, if so, then check to  see if 
any of  the line segments do indeed intersect; this would define a 
collision.

Jim



More information about the use-livecode mailing list