[Math] The coordinates of vertices of regular polygon

geometry

For a regular polygon: given the circumscribed circle radius $r$, and the count of edges $n$, and the coordinate of one of the vertices $(x_0, y_0)$, is there a relation to calculate the coordinates of the other $n-1$ vertices? (note that the polygon may have not any edge parallel to the coordinate axes)

Best Answer

I assume you are familiar with some basic trigonometry. If you have a circle of center $C=(x_C,y_C)$ and radius $r$, then every point of the circle can be written as $P=(x_C+r\cos\theta, y_C+r\sin\theta)$, where $\theta$ is the angle formed by line $CP$ with the $x$-axis.

Your first vertex $P_0=(x_0,y_0)$ can be written in that form too, thus it corresponds to some angle $\theta_0$. As the central angle between two consecutive vertices is $2\pi/n$, the other vertices will then correspond to angles $\theta_1=\theta_0+2\pi/n$, $\theta_2=\theta_0+4\pi/n$, $\theta_3=\theta_0+6\pi/n$, and so on. Once you know $\theta_0$ it is easy to write down the coordinates of the other vertices.

Finally, to get $\theta_0$ notice that $x_0=x_C+r\cos\theta_0$ and $y_0=y_C+r\sin\theta_0$, so that: $$ \tan\theta_0={y_0-y_C\over x_0-x_C}. $$

EDIT

To check that two points $A$ and $B$ on the circle are the vertices of a $n$-polygon, one can compute $$ \cos(\theta_A-\theta_B)=\cos\theta_A\cos\theta_B+\sin\theta_A\sin\theta_B ={x_A-x_C\over r}{x_B-x_C\over r}+{y_A-y_C\over r}{y_B-y_C\over r} $$ and $$ \sin(\theta_A-\theta_B)=\sin\theta_A\cos\theta_B-\cos\theta_A\sin\theta_B ={y_A-y_C\over r}{x_B-x_C\over r}-{x_A-x_C\over r}{y_B-y_C\over r}. $$ From these you can get $\theta_A-\theta_B$ and check if it is a multiple of $2\pi/n$.