Demo

The final version of the rounding algorithm is available below; feel free to manipulate the number of vertices, the inclusion and position of the bug, and the orientation of the vertices. The roundness ratio and the matrix which records the accumulated transformations on this image are in the upper left. The bug itself is displayed as a white dot inside the image, and the center is displayed as the smaller red dot. One special case to note is that due to the random generation of the polygon, there are times when the bug will spawn outside of the image. When this occurs, the program will force all vertices on the far side of the image to wrap around the bug before beginning to center the bug. Thus, the resulting image’s roundness will still reach at least 0.5 as stated above as long as it is still convex; however, compared to the original polygon, the image will be flipped inside out.

Figure 1: special case where bug generates outside polygon
Figure 2: with more vertices, the minimum roundness can still be reached by using the bug to force multiple vertices together