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


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

  • 1
    $\begingroup$ If you mean a regular polygon then you can use Pythagorus theorem and trigonometry, divide the polygon up into triangles and cut them in half to get a right triangle, $\endgroup$ – anon Aug 16 '10 at 13:15
  • $\begingroup$ "sidelength, number of vertices, vertex angle and coordinates of each point in the polygon" — if it is a regular polygon, then 2 sets of these information are redundant. $\endgroup$ – kennytm Aug 16 '10 at 13:18
  • $\begingroup$ Thanks Kenny, I realised that. Also see my edit- i don't actually have the coordinates yet (I put that in by mistake) - thats what I'm calculating using the radius. For example double tempX = circumcircleRadius * Math.Sin(i * vertexAngle); double tempY = circumcircleRadius * Math.Cos(i * vertexAngle); for each point. $\endgroup$ – Nobody Aug 16 '10 at 13:22
  • 1
    $\begingroup$ Actually, once you know the side length and the number of sides of the regular polygon, the circumradius is immediately known. There is no need to have the coordinates. $\endgroup$ – kennytm Aug 16 '10 at 13:29
  • $\begingroup$ Actually, earlier version of the question was interesting! $\endgroup$ – Pratik Deoghare Aug 16 '10 at 13:41

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
    $\begingroup$ It works! Thanks falagar $\endgroup$ – Nobody Aug 16 '10 at 13:35

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


def get_circumradius(L,N):
    return L/(2 * math.sin(180/N))
  • $\begingroup$ 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. $\endgroup$ – Nobody Aug 16 '10 at 13:25

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.