1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. May 31, 2009 #1
    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. jcsd
  3. May 31, 2009 #2
  4. Jun 1, 2009 #3
    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.
     
  5. Jun 1, 2009 #4

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
     
  6. Jun 4, 2009 #5
    Thanks. Thats exactly what I needed.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to Plot a Polygon on X-Y Graph Knowing the Radius
Loading...