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

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 9K views
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 [itex](x_0,y_0)[/itex], the line from the center to one vertex making angle [itex]\theta[/itex] with the x-axis, the coordinates of the vertices are given by

[tex]x= x_0+ r cos(\left(\frac{2\pi}{n}\right)i+ \theta)[/tex]

[tex]y= y_0+ r sin(\left(\frac{2\pi}{n}\right)i+ \theta)[/tex]

Where i runs from 0 to n-1.
 
Thanks. Thats exactly what I needed.