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

quddusaliquddus
Messages
353
Reaction score
3

Homework Statement



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.

Homework Equations



x^2 + y^2 = r^2

http://en.wikipedia.org/wiki/Polygon"

The Attempt at a Solution



Im afraid I am 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:
Physics news on Phys.org
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 doesn't look it.
 
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.
 
Thanks. Thats exactly what I needed.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top