CENTROIDS

You are looking for the CENTRE OF GRAVITY of an irregular polygon. Also known as the CENTROID. Suppose you cut the polygon out of cardboard or sheet metal. This is the point at which it will balance. My search for "center of gravity" NEAR formula on Alta Vista led me to:

The centroid (a.k.a. the center of mass, or center of gravity)
of a polygon can be computed as the weighted sum of the centroids
of a partition of the polygon into triangles. The centroid of a
triangle is simply the average of its three vertices, i.e., it
has coordinates (x1 + x2 + x3)/3 and (y1 + y2 + y3)/3. This
suggests first triangulating the polygon, then forming a sum
of the centroids of each triangle, weighted by the area of
each triangle, the whole sum normalized by the total polygon area.
This indeed works, but there is a simpler method: the triangulation
need not be a partition, but rather can use positively and
negatively oriented triangles (with positive and negative areas),
as is used when computing the area of a polygon. This leads to
a very simple algorithm for computing the centroid, based on a
sum of triangle centroids weighted with their signed area.
The triangles can be taken to be those formed by one fixed vertex
v0 of the polygon, and the two endpoints of consecutive edges of
the polygon: (v1,v2), (v2,v3), etc. The area of a triangle with
vertices a, b, c is half of this expression:
(b[X] - a[X]) * (c[Y] - a[Y]) -
(c[X] - a[X]) * (b[Y] - a[Y]);

Code available at ftp://grendel.csc.smith.edu/pub/code/centroid.c (3K).
Reference: [Gems IV] pp.3-6; also includes code.

 

My understanding of the "very simple algorithm" procedure as described is:

1. Select any vertex and use it as a vertex for the n-2 triangles that are produced when this vertex is connected to each of the other vertexes.

2. Calculate the coordinates of the centroid for each of the triangles produced using this formula:
XC = (X(1) + X(2) + X(3))/3
YC = (Y(1) + Y(2) + Y(3))/3

3. Calculate the area of each triangle produced using this formula:
[(X(2) - (X(1)) * (Y(3) - Y(1)] - [(X(3) - X(1)) * (Y(2) - Y(1))]/2
(areas may negative! ... for reasons I don't want to go into)

4. Calculate the area of the whole polygon .

5. Calculate the fraction of the total area that each triangle contributes.

6. Calculate the product of each ordinate from #2 and the result of #5.

7. Sum the results from #6.

This will yield the coordinates of the centroid of the whole.

Consider now an irregular pentagon with vertexes of coordinates:
A(0,0);B(6,13);C(15,11);D(16,6);E(14,2)

 

Take the first vertex as the common one for all the triangles, of which there are three:
I: A(0,0);B(6,13);C(15,11)
II: A(0,0);C(15,11);D(16,6)
III: A(0,0);D(16,6);E(14,2)

Triangle I has centroid coordinates XC1=(0+6+15)/3 and YC1 = (0+13+11)/3
ie (7,8)
Triangle I has area = {[(6-0) * (11-0)] - [(15 - 0) * (13-0)]}/2
ie {[6 * 11] - [15 * 13]}/2 = -64.5

Triangle II has centroid coordinates XC2=((0+15+16)/3 and YC2=(0+11+6)/3
ie: (31/3,17/3)
Triangle II has area = {[(15-0)*(6-0)] - [(16-0)*(11-0)]}/2
ie:{[15*6]-[16*11]}/2 = -43

Triangle III has centroid coordinates XC3=((0+16+14)/3 and YC3=(0+6+2)/3
ie: (10,8/3)
Triangle III has area = {[(16-0)*(2-0)] - [(14-0)*(6-0)]}/2
ie:{[16*2]-[14*6]}/2 = -26

Total area of triangles = -64.5 + -43 + -26 = -133.5

So: the fraction of the total area for each of the three triangles is:
Triangle I: -64.5/-133.5
Triangle II: -43/-133.5
Triangle III: -26/-133.5

The centroid of the polygon has Xcoordinate:
7*-64.5/-133.5 + 31/3*-43/-133.5 + 10*-26/-133.5= 8.6579
.... and Y coordinate:
8*-64.5/-133.5 + 17/3*-43/-133.5 + 8/3*-26/-133.5 = 6.2097

This is the procedure as I understand it from the description.