Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calculating coordinates of vertices of regular convex polygon given number of sides and the radius of circumscribing circle

975 views
Skip to first unread message

glevik

unread,
May 5, 2009, 1:03:09 AM5/5/09
to geometry...@moderators.isc.org
Hello,

I am working on a program where I need to draw a shape which is a
regular convex polygon. The parameters I am given is the number of
sides and the radius of the of the circumscribing circle. Let's say
the bottom side of the polygon is to be horizontal, I am trying to
calculate coordinates of its vertices so that I can draw it. I can
calculate many of polygon's properties like the length of its side or
its area, but I am a little stuck calculating the coordinates of its
vertices. Any advice is highly appreciated.

Leo

Avni Pllana

unread,
May 5, 2009, 8:39:00 AM5/5/09
to app...@support1.mathforum.org

Hi Leo,

the vertices of a regular n-gon with circumradius R are:

for n even:

Xn(k)=R*[-sin(k*2*pi/n-pi/n) cos(k*2*pi/n-pi/n)] ,

and for n odd:

Xn(k)=R*[-sin(k*2*pi/n-2*pi/n) cos(k*2*pi/n-2*pi/n)];

where k = 0, 1, ..., n-1 .


Best regards,
Avni

Ben Saucer

unread,
May 7, 2009, 1:30:43 AM5/7/09
to geometry...@moderators.isc.org
Let n be the number of sides, and r be the circumradius. Then solve in
the complex plane all of the nth roots of r^n (there will be n such
roots). One of the points will be at r + 0i. The rest of the roots will
also be on the circle centered about 0 + 0i, and having radius r. The
roots are r * cos (2pi * k / n) + i * r * sin (2pi * k / n) where k is
integer from 0 to n-1.

Ben

mark

unread,
May 7, 2009, 11:34:16 AM5/7/09
to app...@support1.mathforum.org

While Avni and Ben both gave what I'm sure are excellent answers, I'm a little dumber than that mathematically. When I read the above I pictured x and y coordinates as needed in the form: (x,y) for the center and (x+a, y+b) for the vertices.
I'm not sure Leo is as helpless as me, but could someone get me from Avni or Ben's formulae to xy coordinates?

Philippe 92

unread,
May 8, 2009, 7:59:54 AM5/8/09
to geometry...@moderators.isc.org
mark wrote :
>> ...regular convex polygon. ...
>> calculate coordinates of its vertices...
>> Leo

>
> could someone get me from Avni or Ben's formulae to xy coordinates?

Hi,

They do give the coordinates, although not explicitely for you.

The key is that the coordinates x, y of points on a unit circle
centered at origin are x = cos(t), y = sin(t)
That is for any circle centered in (a, b) with radius r :
x = a + r*cos(t), y = b + r*sin(t).
I'll generally discard the r factor and the offset (a, b) for
the sequel.

For vertices of a regular n-gon inscribed in the circle, the angles
are 2pi/n apart from each other (2pi is in radian, that is 360 degree
all further angles are in radian).

That is x[k] = cos(t0 + k*2pi/n) , y[k] = sin(t0 + k*2pi/n)
the t0 being the angle of some [given] vertex.

Ben has choosen t0 = 0, and has written the coordinates (x, y) as
a complex number z = x + i*y, a usual way to represent points on
a plane, but totally equivallent to (x, y), just easing some
calculations. For instance writing cos(t) + i*sin(t) as exp(i*t)
and using rules for exponentiation gives "at once" the formulas
for cos(n*t), cos(a+b) etc...

However the requirement was :


"the bottom side of the polygon is to be horizontal"

Hence Ben formulas is false, as it has choosen its first vertex (t0)
at (1, 0) or introducing r at (r, 0), written as z0 = r + 0*i.
The bottom side is then not always horizontal, depending on n.

Avni has choosen an other t0, introducing two separate cases
n odd : then a vertex is at (0, R), angle t0 = pi/2
n even : then the upper side is also horizontal and a vertex is at
angle t0 = pi/2 - pi/n
As cos(pi/2 + t) = - sin(t) and sin(pi/2 - t) = cos(t),
this results into his set of formulas.
Coordinates of a point X being written as [x y] (the space to
separate coordinates is not a so good choice however)

I would prefer choosing the initial vertex at one end of this
bottom side ! this results into a formula which doesn't depend
on the parity of n.
That is t0 = -pi/2 + pi/n whatever n.
Then apply cos(-pi/2 + t) = sin(t) and sin(-pi/2 + t) = -cos(t),
this results into the coordinates of the k-th vertex :

x[k] = a + r*sin(pi/n + k*2pi/n)
y[k] = b - r*cos(pi/n + k*2pi/n)

Best Regards.

--
Philippe Ch., mail : chephi...@free.fr
site : http://mathafou.free.fr/ (recreational mathematics)

mark

unread,
May 8, 2009, 1:53:45 PM5/8/09
to app...@support1.mathforum.org
Thanks Philippe 92, That's better.

Mark

gudi

unread,
May 9, 2009, 6:46:56 PM5/9/09
to geometry...@moderators.isc.org

You can conveniently use polar coordinate form of equation of circle

passing through origin to obtain the vertices. a is length of a
polygon side,

R is Circum-radius. Using Law of Sines for each triangle in the
polygon,

where al is angle contained in the circle segment looking at origin,

al = 2 Pi/n = t step for polygon of n sides to get coordinates of
vertices.

r/ sin(t + al) = a/ sin(al) = 2R, sin(al) = a / 2R,

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

t = 0,2 Pi, with step al.

Narasimham

0 new messages