I want to create a regular polygon with a given side length, s, and an maximum radius, r1.
The radius value needs to be decreased (or increased if it simplifies things) to the closest length, r2, that will create a regular polygon, i.e. with the given side length s, and any integer number of sides, n.
So from s and r1 you need to calculate a new, nearby r2 and the associated n.
Is this possible? It seems like something that should be straight forward, but I'm not sure where to start.
[Edit: changed apothem to radius in the question, as radius would ultimately be more helpful.]