Does anyone know the formula for finding the circumscribed diameter of a polygon with an odd number of sides, given ONLY the distance from a flat side to the opposite vertex, and the number of sides?

I once wrote a little program in BASIC that finds all the needed info to mill polygons from bar stock (like boltheads) for polygons with an even number of sides -- pretty easy. But for the life of me can't make it work with an odd number. It can done --- math whiz Marv Klotz wrote a program on his website (polygon.exe) that does exactly this. He kindly posted the source code, but it's written in "C" and I have no clue how to read it.

I'd like to add this feature to my little program, but I need the formula, if anyone can assist, thanks!