*Bounty: 50*

*Bounty: 50*

Imagine you have a polygon defined by a set of coordinates $(x_1,y_1)…(x_n,y_n)$ and its centre of mass is at $(0,0)$. You can treat the polygon as a *uniform distribution* with a polygonal boundary.

**I’m after a method that will find the covariance matrix of a polygon**.

I suspect that the covariance matrix of a polygon is closely related to the *second moment of area*, but whether they are equivalent I’m not sure. The formulas found in the wikipedia article I linked seem (a guess here, it’s not especially clear to me from the article) to refer to the rotational inertia around the x, y and z axes rather than the principal axes of the polygon.

(Incidentally, if anyone can point me to how to calculate the principal axes of a polygon, that would also be useful to me)

It is tempting to just perform PCA on the coordinates, but doing so runs into the issue that the coordinates are not necessarily evenly spread around the polygon, and are therefore not representative of the density of the polygon. An extreme example is the outline of North Dakota, whose polygon is defined by a large number of points following the Red river, plus only two more points defining the western edge of the state.