[Math] Radius of the circumscribed circle of a regular polygon

geometry

I was going to ask this on SO but I think its more math than programming:

Given the sidelength, number of vertices and vertex angle in the polygon, how can I calculate the radius of its circumscribed circle.

The polygon may have any number of sides greater than or equal to 3.

The wikipedia entry only discusses circumscribed circle of a triangle…

Thanks!

edit:
Also, the polygon is centered around the point (0,0). So I guess I'm asking what is the distance from the origin to any of its points..

Best Answer

Let $s$ be sidelength and $\alpha$ be vertex angle. Then using simple trigonometry you can find that $$ \sin{\frac{\alpha}{2}} = \frac{s/2}{r} $$ Hence $$ r = \frac{s}{2 \sin{\frac{\alpha}{2}}} $$