Polygon's share of its rectangle inconsistent?

Dar Scott dsc at swcp.com
Sun Jun 9 13:18:32 EDT 2013


Thanks!

You mentioned clockwise and counter-clockwise and I wondered if that was what was making within() return true of everywhere in the rect of the polygon (except the right and bottom edges) instead within the shape as others have seen.  I tried both and within() worked as expected; I was not getting the results as before.  I have no idea what the difference is.

Dar


On Jun 9, 2013, at 8:28 AM, Jim Hurley wrote:

>> 
>> 
>> Message: 1
>> Date: Sat, 8 Jun 2013 11:06:05 -0600
>> From: Dar Scott <dsc at swcp.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Polygon's share of its rectangle inconsistent?
>> Message-ID: <EB5D4974-E672-4AFD-9B5F-C353E4AA5B1B at swcp.com>
>> Content-Type: text/plain; charset=windows-1252
>> 
>> (Snip)
>> 
>> I'm not sure what "singly connected" means.  Does this mean a graphic can work like several graphics? 
>> 
>> Dar
>> 
> 
> Hi Dar,
> 
> The code I offered for obtaining  the area within a closed, singly connected polygon relied on the sum of the areas underneath a connected series of line segments equates to the area within those segments. The area under a single line segment defined by it's end points x1,y1 and x2,y2 is given by  (x2 - x1) * (y1 + y2)/2
> 
> The area under the "top" of the polygon (where x2 - x1) is positive) minus the area under the  "bottom" (where x1 - x2 is negative) is equal to the area within. 
> 
> This presumes one moves clockwise around the polygon. Going counter-clockwise the area calculated is negative. For a symmetric, doubly connected figure, such  as a figure 8, there is a clockwise segment and an equal and opposite counter-clockwise segment, resulting in zero net area.
> 
> A figure is singly connected if it is possible to move to every point within, without crossing a line. The figure "0" is singly connected; the figure "8" is doubly connected.
> 
> Jim
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list