# Can you measure the degree of uniformity of a 2d shape?

Is there a calculation that could take the points that make of the outline of a 2 dimensional shape and provide a numeric evaluation representative of the uniformity or symmetry of the shape. Such as circle, square or even pointed star would have a 'high' score but a rectangle or odd pointed star would have a some what lower score and an completely bizarre random shape would have a very low score.

• The people who attempt to apply mathematical principles to drawing US Congressional districts have come up with various measures of regularity/bizarreness, maybe you'd enjoy going through their literature. – Gerry Myerson Sep 24 at 6:19

This problem is addressed in Estimating Complexity of 2D Shapes (2005). The notion of "complexity" seems to agree at least qualitatively with what the OP calls "uniformity". The complexity measure $$C$$ of a 2D shape is quantified by the combination of three criteria – (a) entropy of the global distance distribution, (b) entropy of local angle distribution, (c) shape randomness. The figure below shows results for 6 shapes, discretized by a set of points. Small $$C$$ means low complexity.

The Kolmogorov complexity of the shape would provide a measure of uniformity.

E.g., the first two shapes in Carlo Beenaker's answer could be programmed in Logo as:

• circle: repeat 30 [ fd 1 pu fd 9 pd rt 12 ]

• triangle: repeat 3 [ repeat 10[ fd 1 pu fd 9 pd ] rt 120 ]

The circle program is shorter than the triangle program, and both are shorter than programs for the other shapes. So the Kolmogorov measure is in rough agreement with the metric in that other answer and the intuition of the question.

Assuming that your shape has a nice enough description in polar coordinates, the Fourier-series might help you. Specifically, assume that the center of gravity of your shape is in $$0$$ and it can be written in the form

$$S := \{ (r\cos(\theta),r\sin(\theta)): \theta \in [0,2\pi], 0\leq r \leq f(\theta)\}$$

where $$f$$ can be considered a $$2\pi$$-periodic function. Now the more symmetrical your shape is, the more Fourier-coefficients of $$f$$ vanish. For example, if you have mirror-symmetry, it will be a (possibly phase-shifted) cosine-series, or if you have $$n$$-fold rotational symmetry, all non-zero coefficients will be at multiples of $$n$$ and so on.

The main problem would then be to convert this into a single number. I know that there are some ways to measure sparsity often used in numerics, but I know little about the details and how well they react to patterns (such as "precisely every $$n$$-th coefficient", i.e. symmetry, in contrast to "on average $$1$$ in $$n$$ coefficients").