6
$\begingroup$

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..

  • 0
    Hey rmx, how did you calculate the vertex angles for the edges of the polygon?2016-12-09

3 Answers 3

8

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}}} $

  • 1
    It works! Thanks falagar2010-08-16
3

Each corner of a polygon must be at equal distance from the center of the circumscribing circle.

So, find equation for perpendicular bisectors of any to sides of the polygon.

Intersection of perpendicular bisectors will give you the center of the circle.

Then distance between center and any corner of the polygon is the radius of the circle.

EDIT(response to edited question):

If length of a side is $L$ and number of vertices is $N$ then Suppose points A and B defines a side and C is the center.

Then angle ACB is $360/N$ Suppose D is midpoint of a edge AB then angle DCA = angle DCB = 180/ N. This implies $sin(180/N) = L/(2R) $ where R is radius of the circle.

So, $ R = \frac{L}{2sin(180/N)}$

Pseudocode:

def get_circumradius(L,N):     return L/(2 * math.sin(180/N)) 
  • 0
    Hi, thanks for the answer. I have edited my question: all I have is the vertex count and sidelength to work with, not the coordinates, however the polygon is centered around the origin. So I already know where the center is. I just can't figure out how i the distance to one of the vertices, without their coordinates.2010-08-16
0

The circumscribed radius $R$ of any regular polygon having $n$ no. of sides each of the length $a$ is given by the generalized formula $\bbox[4pt, border: 1px solid blue;]{\color{red}{R=\frac{a}{2}\csc \frac{\pi}{n}} }$ and its each interior angle is $\color{blue}{\frac{(n-2)\pi}{n}}$.