Point A : The center of a side of a polygon inscribed in a circle

Point B : The point on the perimeter of that circle that is opposite Point A

I want to calculate the distance between Point A & Point B

I know the number of sides the polygon has and the radius of the circle it's inscribed in.

I believe this is the way to calculate the length of the side of a regular polygon with n sides (Please correct me if I'm wrong as I am not a mathematician and found this online) :

x = nrsin(π/n)

Now is the distance I'm looking for : distance = 2r - x ?

I'm trying to figure out a formula that I could use in a bit of code I'm writing

  • $\begingroup$ Do you mean an inscribed polygon? So that the vertices are on the circle itself? In that case the distance is 0 because the side is touching the circle. If you want to calculate the distance from the center of a side, draw a triangle with vertices at the center of the circle and at the ends of a side and subtract the altitude from the radius. $\endgroup$ – Matt Samuel Nov 1 '14 at 19:51
  • $\begingroup$ Ah yes, sorry for not being clear Matt. I want to calculate the distance between the center of a side of the polygon and the point on the perimeter of the circle right opposite that center. I want to use Math to do that as I will use it a bit of Javascript code I am writing. I will update the OP. $\endgroup$ – Sprout Coder Nov 1 '14 at 19:56

The length of a side is $2r sin(\frac{\pi}{n})$ by trigonometry.

The distance is $r(1-cos\frac{\pi}{n})$, which is the difference between the radius and the length of the line from the center of the circle to the center of the side.

  • $\begingroup$ That's perfect! Thanks! $\endgroup$ – Sprout Coder Nov 1 '14 at 20:14

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.