Re: Area of Irregular Polygon

2015-11-15 Thread Roger Guay
Thank you, Hermann. Your game is very clever!! > On Nov 15, 2015, at 12:49 AM, [-hh] wrote: > >> Roger G. wrote: >> Jim, I'm just now trying to catch up on this discussion and I see that no >> one has answered your question. I can’t answer either and wonder what’s >> going on??? >> BTW, I bel

Re: Area of Irregular Polygon

2015-11-15 Thread Roger Guay
ity of the > method for calculating the area of a polygon. > > You’re probably right about the minus sign. > > Jim > >> >> Message: 23 >> Date: Sat, 14 Nov 2015 18:37:13 -0800 >> From: Roger Guay >> To: How to use LiveCode >> Subject: R

Re: Area of Irregular Polygon

2015-11-15 Thread [-hh]
> Roger G. wrote: > Jim, I'm just now trying to catch up on this discussion and I see that no one > has answered your question. I can’t answer either and wonder what’s going > on??? > BTW, I believe you should have a negative sign in front of the square bracket > . . . not that that helps at all

Re: Area of Irregular Polygon

2015-11-15 Thread Jim Hurley
> > Message: 23 > Date: Sat, 14 Nov 2015 18:37:13 -0800 > From: Roger Guay > To: How to use LiveCode > Subject: Re: Area of Irregular Polygon > Message-ID: <868cedf8-5e56-46dc-b88c-bb6a68cd4...@mac.com> > Content-Type: text/plain; charset=utf-8 > > Jim, >

Re: Area of Irregular Polygon

2015-11-14 Thread Roger Guay
Jim, I'm just now trying to catch up on this discussion and I see that no one has answered your question. I can’t answer either and wonder what’s going on??? BTW, I believe you should have a negative sign in front of the square bracket . . . not that that helps at all! Cheers, Roger > On

Re: Area of Irregular Polygon

2015-11-11 Thread BNig
for those on the list like me who can only iteratively add 1 to a variable and that have 10 seconds to spare to get at the area of a polygon: here is what the screen thinks it is: --- on mouseUp put "poly" into pName if not (there is a graphic

Re: Area of Irregular Polygon

2015-11-11 Thread [-hh]
> James H. wrote: > Multiplying this out you get: > > x(i)*y(i+1) - x(i+1)y(i) + [x(i+1)* y(i+1) - x(i)* y(i)] > > So THE SAME EXPRESSION as in the centroid method EXCEPT for the added term in > square brackets. So, WHY THE DIFFERENCE? > > In calculating this sum all of the intermediate t

Re: Area of Irregular Polygon

2015-11-11 Thread Jim Hurley
Very interesting discussion. However, I was puzzled by the following term in the sum used to calculate the area of a polygon--labeled the centroid method. x(i)*y(i+1) - x(i+1)y(i) Where does this come from? If one were using the traditional method of calculating the area under a curve (per

Re: Area of Irregular Polygon

2015-11-11 Thread [-hh]
> Alex T. wrote: > For the area calculation, it is actually marginally faster without the > "delete line 1 of p" - i.e. as Geoff Canyon suggested. > ... > So omitting the "delete line 1 of p" is more efficient - as well as > being one line fewer of code. You are right, of course. I read the thre

Re: Area of Irregular Polygon

2015-11-10 Thread Alex Tweedly
r of code. Geoff C strikes again ! -- Alex. On 10/11/2015 21:37, [-hh] wrote: In the thread ("Area of irregular Polygon") I've seen a very fast technique. I tested this technique and found it extremely fast. Thus I would like to summarize and contribute also the centroid formulas,

Re: Area of Irregular Polygon

2015-11-10 Thread [-hh]
In the thread ("Area of irregular Polygon") I've seen a very fast technique. I tested this technique and found it extremely fast. Thus I would like to summarize and contribute also the centroid formulas, for our collections. Look at non-selfintersecting (simple) polygons. The cen

Re: Area of Irregular Polygon

2015-11-09 Thread Alex Tweedly
Hi Peter, No, it doesn't assume convexity - what it does assume is non-self-overlapping, (loosely aka non-self-intersecting). A simple but non-convex shape, like (excuse the lack of line-drawing in email :-) B C D A E For simplicity, pretend the shape is all in th

Re: Area of Irregular Polygon

2015-11-09 Thread Peter TB Brett
On 08/11/2015 00:43, Alex Tweedly wrote: Actually, you should shorten the maths - makes it a bit more efficient function getArea pPts if line 1 of pPts <> line -1 of pPts then return 0 put 0 into tArea put empty into oldL repeat for each line L in pPts if oldL is not empt

Re: Area of Irregular Polygon

2015-11-08 Thread Roger Guay
Thank you. I just might work on this…. > On Nov 8, 2015, at 3:38 AM, [-hh] wrote: > >> Roger Guay wrote: >> Can anyone think of an easy way of getting the area of an Irregular polygon? > > This goes nearly one-to-one into LC scripts: > https://en.wikipedia.org/wiki/Polygon#Area_and_centroid >

Re: Area of Irregular Polygon

2015-11-08 Thread [-hh]
> Roger Guay wrote: > Can anyone think of an easy way of getting the area of an Irregular polygon? This goes nearly one-to-one into LC scripts: https://en.wikipedia.org/wiki/Polygon#Area_and_centroid There are also considerations for self-intersecting polygons. = I donated to Wikipedia.

Re: Area of Irregular Polygon

2015-11-07 Thread Geoff Canyon
Important to note that this method of calculating the area of a polygon will fail if the polygon crosses itself. As long as the polygon is simple, it works. On Sat, Nov 7, 2015 at 8:30 PM, Roger Guay wrote: > This is great . . . Thanks, guys!!! > > > > On Nov 7, 2015, at 4:56 PM, Geoff Canyon w

Re: Area of Irregular Polygon

2015-11-07 Thread Geoff Canyon
You could speed it up a bit more and simplify a bit like so: put line 1 of pPts into oldL repeat for each line L in line 2 to -1 of pPts add (item 1 of L - item 1 of oldL) * ( item 2 of oldL + item 2 of L) / 2 to tArea put L into oldL end repeat On Sat, Nov 7,

Re: Area of Irregular Polygon

2015-11-07 Thread Roger Guay
Beautiful, Alex. I was working on this idea myself, but your scripts is so much more elegant! Thanks, Roger > On Nov 7, 2015, at 4:43 PM, Alex Tweedly wrote: > > Actually, you should shorten the maths - makes it a bit more efficient > > > function getArea pPts > if line 1 of pPts <> lin

Re: Area of Irregular Polygon

2015-11-07 Thread Alex Tweedly
Actually, you should shorten the maths - makes it a bit more efficient function getArea pPts if line 1 of pPts <> line -1 of pPts then return 0 put 0 into tArea put empty into oldL repeat for each line L in pPts if oldL is not empty then -- put item 1 of L - it

Re: Area of Irregular Polygon

2015-11-07 Thread Alex Tweedly
Roger, try this (I've done some minimal testing, so do please check it ...) it assumes the polygon is closed function getArea pPts if line 1 of pPts <> line -1 of pPts then return 0 put 0 into tArea put empty into oldL repeat for each line L in pPts if oldL is not empty then

Re: Area of Irregular Polygon

2015-11-07 Thread Roger Guay
Thanks very much, Scott. I do have a long points list that I would have to manipulate even before apply this technique. I’m not looking forward to that, but I may have to go this route. Cheers, Roger > On Nov 7, 2015, at 12:05 PM, Scott Rossi wrote: > > It looks like this could translate to

Re: Area of Irregular Polygon

2015-11-07 Thread Scott Rossi
It looks like this could translate to LC if you have the point locations of your polygon: https://www.mathsisfun.com/geometry/area-irregular-polygons.html Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 11/7/15, 2:01 PM, "use-livecode on behalf of Roger Guay" wrote:

Area of Irregular Polygon

2015-11-07 Thread Roger Guay
Can anyone think of an easy way of getting the area of an Irregular polygon? Thanks, Roger ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://list