In my research, I've recently started to play with Voronoi tessellations. I currently have a Python code that creates the tessellation and I am trying to color the polygonal regions according to their regularity. The best-case scenario would be to have a color scale (let's say from red to blue) where regions in red would be the "most irregular" (in some sense) and regions in blue would be the "most regular" (in some sense). It is not strictly necessary to have a scale; I would happily settle to color regions by range, e.g., if the region is "very irregular" I color it red, if it is "sort of regular" I color it yellow and if it is "regular" I color it green.


What I am looking for is a way to associate a number to say how regular a polygon is (for now, I am more interested in hexagons, but it wouldn't hurt to have something for a general polygon).


For example, the first idea that came to mind was taking the average of the angles and measuring the difference from this average to the expected internal angle of the hexagon (which is $2\pi/3$), but this does not work because the average is always $2\pi/3$ since the polygons I'm working with are always convex.


Some ideas that I have discussed with my advisor are


* looking at $\bar{D}/\sigma(D)$, where $D$ is the set of distances from the vertices of the polygon to it's center, $\bar{D}$ is the average of $D$ and $\sigma(D)$ is the standard deviation of $D$. This ratio ranges from 0 ("maximum" irregularity) to $\infty$ ("maximum" regularity);
* looking only at $\sigma(D)$, which ranges from 0 ("maximum" regularity) to $\infty$ ("maximum" irregularity).


If possible, I would like to work only with angles due to the way the code I have produces the Voronoi tessellation. However, my intuition says that either


1. I'll have to forget angles altogether and look only at distances;
2. I'll have to look at angles and at distances.


Therefore, my question is: is there such a metric for characterizing the regularity of a polygon that involves only the internal angles? If not, is there a more interesting metric that involves distances than the ones I listed above?


I would be more than happy to share more information about the problem if need be.


**Edit:** [this picture it a prototype to what I am trying to do.](https://i.stack.imgur.com/rv5mC.png)
The green regions are hexagons (regular or not), the white ones are the infinite regions of the tessellation and the red ones are the finite regions that are not hexagons.



How to characterize the regularity of a polygon?
Internal angles are not enough to determine the regularity of a polygon. E.g., angles of $2\pi/3$ between sides of length $1,1,4,1,1,4$ make an irregular hexagon.


For a metric of regularity, I suggest $$A \ / \ \sum d\_i^2$$ where $A$ is the area of the hexagon and the $d\_i$ are the side lengths.


Using this metric:


* regular hexagons have a regularity of $\sqrt{3}/4 \sim 0.433$;
* irregular hexagons have lower regularity;
* the hexagon with six unit lengths along a $1\times2$ rectangle has a regularity of $1/3$;
* the hexagon with six unit lengths along a $0\times 3$ rectangle has a regularity of $0$.


The area is easy to calculate as $\sum (x\_i y\_{i+1}-x\_{i+1}y\_i)/2$. So the metric should be good for getting a stable optimization, since the numerator and denominator are both simple quadratic functions of the coordinates, not requiring any square roots.


