# Area of Irregular Polygon

Roger Guay irog at mac.com
Sun Nov 15 11:25:24 EST 2015

```Ah, now I get it!!

> On Nov 15, 2015, at 12:32 AM, Jim Hurley <jhurley0305 at sbcglobal.net> wrote:
>
> Hi Roger,
>
> Actually, the answer to that question I raised follows in the next paragraph. All those terms cancel in pairs.
>
> As someone pointed out, that paragraph is a proof of the validity 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 <irog at mac.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Area of Irregular Polygon
>> Message-ID: <868CEDF8-5E56-46DC-B88C-BB6A68CD4E8F at mac.com>
>> Content-Type: text/plain;	charset=utf-8
>>
>> 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 Nov 11, 2015, at 2:35 PM, Jim Hurley <jhurley0305 at sbcglobal.net> wrote:
>>>
>>> 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 (perhaps a polygon) the i'th  term in the sum would be:
>>>
>>> [x(i+1) - x(i)] * [y(i+1) + y(i)] / 2
>>>
>>> That is, the base times the average height. This was the original method employed by many--the non-centroid method
>>>
>>> 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 terms in the sum cancel out, leaving just the end terms:  x(n)y(n) - x(1)* y(1)
>>> But if the figure is closed, they too cancel each other.
>>> For example:  (x3 * y3 - x2*y2) + (x4*y4 - x3*y3)... Notice that the x3 * y3 terms cancel.
>>>
>>> Curiously, if one were attempting to calculate the area under a curve (non-polygon) using this method, the principle contribution could come from just these end point terms. As an extreme example, if the curve began at the origin (x(0) = y(0) = 0),. there would be a substantial contribution from the end point x(n) * y(n), where n is the last point. If it were a straight line, ALL the contribution would come from the end point: x(n) y(n) . Divided  by 2 of course.
>>>
>>> Jim
>>>
>>> P.S. the centroid of a closed curve might be liken eo the center of gravity in physics.
>>> Two closed curves could have the same centroid but very different areas (masses)
>>> The center of mass bears no relation to the mass, and the centroid of a closed curved bears no relation to the area.
>>> _______________________________________________
>>> 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
>>
>
>
>
>
> _______________________________________________
> 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

```