Feature: Add a way to set the polygon length from the star-toolbar
Had a great time adding this new feature:
Inspired by the code written by @doctormo for adding a way to set the polygon length from the star-toolbar, I updated that code to output the correct polygon length and fix the transformation issues.
Logic for pointy star:
For every vertex, compute two distances i.e outer to inner vertex distance and inner to next outer vertex distance (covering a whole spoke of the star).
After the above computation, we have total perimeter with us. Let's divide this with total number of sides (i.e 2*n) so that we get our average side length.
Logic for flattened polygon:
Compute total perimeter of the polygon by finding distance between consecutive vertices. Let's divide this with total number of sides (i.e n) so that we get our average polygon length.
Just to add on: There will be some minor precision inaccuracies(very very small) in length calculation as we are doing addition and division with floating point numbers.
Here is the video featuring how the new feature will look like: After_Fix