I am trying to solve a programming challange on reddit and I want to understand how circumradius of a regular convex polygon relates to the side length.
I've found that polygons can be separated into n isosceles triangles with circumradius as its legs and side length as its base.
Using law of sines I've arrived at the following formula
$ s = 2r * sinS $
Where s is the side length, r is circumradius and S is vertex angle.
As there are $2\pi$ radians available in a circle and vertex angle is only nth part of it, S should be equal to $\frac{2\pi}{n}$.
So the final formula should be
$ s = 2r * sin \frac{2\pi}{n} $
Wikipedia provides a similar formula, but with $S=\frac{\pi}{n}$.
Why is that so? Why is the angle of an isosceles triangle in a circle of n isosceles triangles is $\frac{\pi}{n}$ and not $\frac{2\pi}{n}$?
Best Answer
Thanks to Jonas Granholm I was able to see that the angle of an isosceles triangle in a circle of n isosceles triangles is $\frac{2\pi}{n}$, but side length calculation on wikipedia was based on half that angle.
Drawing apothem(a) creates a right triangle with sides a, r, $\frac{s}{2}$. Using definition of sine we get $\sin{\frac{S}{2}} = \frac{s}{2r}$, $s=2r\sin{\frac{2\pi}{2n}}=2r\sin{\frac{\pi}{n}}$.