# How to Plot a Polygon on X-Y Graph Knowing the Radius

1. May 31, 2009

### quddusaliquddus

1. The problem statement, all variables and given/known data

I want to plot a Regular Polygon of many sides on a X-Y graph where I know the number of sides and the radius.

I would like a method to calculate the position of the corners of this shape without using compass/ruler.

If there was an algorithm that goes all the way around the shape then that'd be better.

2. Relevant equations

x^2 + y^2 = r^2

http://en.wikipedia.org/wiki/Polygon" [Broken]

3. The attempt at a solution

Im afraid Im completely stuck on this. I keep going from calculating all the angles and length of sides of each triangle segment of the polygon to a x-y graph where I am trying to calculate the x-y coordinates of the corners.

Last edited by a moderator: May 4, 2017
2. May 31, 2009

3. Jun 1, 2009

### quddusaliquddus

Hi. At the link I provided there is a formula:

(x,y) = 2R(cos(t), sin(t) )*sin ( t + arcsin ( a / 2R ) )

I just wanted to get ot confrmed that it is correct. It doesnt look it.

4. Jun 1, 2009

### HallsofIvy

That formula will give a "smooth" curve, not a "broken line" as you need for a polygon.

If you want to construct a regular polygon with n sides, radius r, center at $(x_0,y_0)$, the line from the center to one vertex making angle $\theta$ with the x-axis, the coordinates of the vertices are given by

$$x= x_0+ r cos(\left(\frac{2\pi}{n}\right)i+ \theta)$$

$$y= y_0+ r sin(\left(\frac{2\pi}{n}\right)i+ \theta)$$

Where i runs from 0 to n-1.

5. Jun 4, 2009

### quddusaliquddus

Thanks. Thats exactly what I needed.