Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
1  
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, –  anon Aug 16 '10 at 13:15
    
"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. –  KennyTM Aug 16 '10 at 13:18
    
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. –  rmx Aug 16 '10 at 13:22
1  
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. –  KennyTM Aug 16 '10 at 13:29
    
Actually, earlier version of the question was interesting! –  Pratik Deoghare Aug 16 '10 at 13:41
add comment

2 Answers

up vote 5 down vote accepted

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

share|improve this answer
1  
It works! Thanks falagar –  rmx Aug 16 '10 at 13:35
add comment

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))
share|improve this answer
    
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. –  rmx Aug 16 '10 at 13:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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