Given a line segment AB.

For simplicity, let it be (-1,0) and (1,0).

and n = number of sides, how can you calculate the vertices of a regular polygon which contains AB?

I'm trying to find an equation for it with no luck, where if one feeds in a value for n, and a vertex number, the equation returns (x,y) for the vertex.

So far, I've been trying this way: 1) find the center of the polygon by the intersection of angle bisectors at A, B. 2) Trying to find the equation relative to the center.

enter image description here

  • $\begingroup$ Whoops, changed. $\endgroup$
    – Neo
    Nov 15, 2018 at 19:52
  • 1
    $\begingroup$ Try the rotation matrix applied (n-1) times. $\endgroup$
    – Phil H
    Nov 15, 2018 at 20:34

3 Answers 3


Denote the number of sides with $n$. The central angle is:






Denote points $A,B,C...$ with $P_0(x_0,y_0),P_1(x_1,y_1),P_2(x_2,y_2)...$



$$i=0,1,\dots n-1$$

Replace (1-4) into (5) and (6) and you are done:



...for $i=0,1,\dots n-1$


For simplicity don't put the side on the $x$ axis; put the center at the origin $(0,0)$.

The polygon is enscribed in a circle. For simplicity we can assume the circle has radius $1$ and each of the vertices will be $(\cos \theta, \sin \theta)$ for some angle $\theta$.

Assuming the polygon is an $n$-gon, The $n$ radii connected to the center create $n$ central angles of $\frac {2\pi}{n}$ radians or $\frac {360^{\circ}}{n}$ degrees.

If we assume vertex $v_0$ is at $(1,0)$ then the remaining vertices $v_k$ will be $(\cos k\frac {2\pi}{n}, \sin k\frac {2\pi}{n})$ for $k = 0,.... , n-1$.


If we scale the $n$-gon by a scale of $R$ then the vertices will be $(R\cos k\frac {2\pi}{n}, R\sin k\frac {2\pi}{n})$.

If we rotate the $n$-gon by an angle of $A$ then the vertices will be $(R\cos (k\frac {2\pi}{n}+A), R\sin (k\frac {2\pi}{n}+A))$

If we move the center of the $n$-gon to point $(X,Y)$ then the vertices will be $(X + R\cos (k\frac {2\pi}{n}+A), Y+R\sin (k\frac {2\pi}{n}+A))$


So you instead you are given that one vertex is $(x_1,y_1)$ and the (counter-clockwise) adjacent vertex is $(x_2,y_2)$

The you need to solve $X,Y, R, A$ from:

$(x_1,y_1) = (X + R\cos (0\frac {2\pi}{n}+A), Y+R\sin (0\frac {2\pi}{n}+A))= (X + R\cos A, Y + R\sin A)$

and $(x_2, y_2) = (X + R\cos (\frac {2\pi}{n}+A), Y+R\sin (\frac {2\pi}{n}+A))$


Some things that may help: The side of a unit $n$-gon is $2\sin \frac {\pi}{n}$ so $R = \frac {\sqrt{(x_2-x_1)^2 - (y_2-y_1)^2}}{2\sin \frac {\pi}{n}}$.

The angle of the side of a unit $n-$gon from $(1,0)$ to $(\cos \frac {2\pi}n, \sin \frac {2\pi}n)$ is $\pi - \frac {\pi - \frac {2\pi}n}2=\frac \pi 2 + \frac \pi n$. So $A=\arctan \frac{y_2-y_1}{x_2-x_1} - \frac \pi 2 -\frac \pi n$.


Locate the center at the origin and apply the rotation matrix in sequence such that the next point's coordinates are determined from the previous point and where $\theta = \frac{360}{n}$.

$$\begin{bmatrix} x_2\\ y_2\\ \end{bmatrix} = \begin{bmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \\ \end{bmatrix} \begin{bmatrix} x_1\\ y_1\\ \end{bmatrix} $$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .