0
$\begingroup$

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

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

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

$$\alpha=\frac{2\pi}{n}\tag{1}$$

Obviously:

$$x_G=0\tag{2}$$

$$y_G=1\times\cot\frac\alpha2=\cot\frac\alpha2=\cot\frac\pi{n}\tag{3}$$

$$AG=r=\frac1{\sin\frac\alpha2}=\frac{1}{\sin\frac\pi{n}}\tag{4}$$

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

$$x_{i}=x_G+r\sin((i-\frac12)\alpha)\tag{5}$$

$$y_{i}=y_G-r\cos((i-\frac12)\alpha)\tag{6}$$

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

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

$$x_i=\frac{\sin\frac{(2i-1)\pi}{n}}{\sin\frac\pi{n}}$$

$$y_i=\cot\frac\pi{n}-\frac{\cos\frac{(2i-1)\pi}{n}}{\sin\frac\pi{n}}$$

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

$\endgroup$
1
$\begingroup$

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$.

$\endgroup$
0
$\begingroup$

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} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.