A little help for building the Fibonacci spiral in a particular reference system

163 Views Asked by At

In the following picture, the numbers represent the building steps of the Fibonacci spiral (or Golden spiral).

enter image description here

I would like to find the coordinates of the upper-left corner of the squares (black dots) in the highlighted reference system (red, the origin has to be in the upper-left corner of the first square), at a given step.

Can you suggest me a compact formula/algorithm to perform such task?

So far I tried to focus on the rotation of the axis connecting the corners with the origin, but I cannot get any simple expression. But probably this approach is wrong, and inefficient.

I apologize in case this is a trivial question!

But thanks in advance for your help or suggestions!

1

There are 1 best solutions below

1
On BEST ANSWER

Let $(x_n,y_n)$ be the coordinates of the upper-left corner of the $n$-th square.

We know that the side length of the $n$-th square is $F_n$.

We want to solve

$$x_{n+1}=\begin{cases}x_n&\text{if $n\equiv 0\pmod 4$} \\x_n+F_n&\text{if $n\equiv 1\pmod 4$} \\ x_n-F_{n-1}&\text{if $n\equiv 2\pmod 4$} \\ x_n-F_{n+1}&\text{if $n\equiv 3\pmod 4$}\end{cases}$$ and

$$y_{n+1}=\begin{cases}y_n-F_n&\text{if $n\equiv 0\pmod 4$} \\y_n+F_{n-1}&\text{if $n\equiv 1\pmod 4$} \\ y_n+F_{n+1}&\text{if $n\equiv 2\pmod 4$} \\ y_n&\text{if $n\equiv 3\pmod 4$}\end{cases}$$

We have $$x_{4(k+1)}-x_{4k}=-F_{4k+4}$$ It follows that $$x_{4k}=x_4+F_4-\sum_{i=1}^{k}F_{4i}\color{red}{=}-(F_{2k+1}^2-1)=-F_{2k+1}^2+1$$ (the equality in red can be proven by induction) from which we have $$\begin{cases}x_{4k}=x_{4k+1}=x_{4k+3}=-F_{2k+1}^2+1 \\\\ x_{4k+2}=-F_{2k+1}^2+F_{4k+1}+1\end{cases}$$

Similarly, we get $$y_{4(k+1)}=y_{4k}+F_{4k-3}$$ It follows that $$y_{4k}=y_4-F_3+\sum_{i=1}^{k}F_{4i-1}=2-2+\sum_{i=1}^{k}F_{4i-1}\color{red}{=}\frac 15(F_{4k+2}+F_{4k}-1)$$(the equality in red can be proven by induction) from which we have $$\begin{cases}y_{4k}=y_{4k+2}=\frac 15(F_{4k+2}+F_{4k}-1) \\\\ y_{4k+1}=\frac 15(F_{4k+2}+F_{4k}-1)-F_{4k} \\\\ y_{4k+3}=\frac 15(F_{4k+2}+F_{4k}-1)+F_{4k+3}\end{cases}$$


Conclusion :

Let $(x_n,y_n)$ be the coordinates of the upper-left corner of the $n$-th square.

Then, in mod $4$, $$\color{red}{x_n=\begin{cases}-F_{2\lfloor n/4\rfloor+1}^2+1&\text{if $n\equiv 0,1,3$}\\\\ -F_{n/2}^2+F_{n-1}+1&\text{if $n\equiv 2$}\end{cases}}$$ and $$\color{red}{y_n=\begin{cases}\frac 15(F_{4\lfloor n/4\rfloor+2}+F_{4\lfloor n/4\rfloor}-1)&\text{if $n\equiv 0,2$} \\\\\frac 15(-4F_{n-1}+F_{n+1}-1)&\text{if $n\equiv 1$} \\\\\frac 15(F_{n-3}+F_{n-1}-1)+F_n&\text{if $n\equiv 3$}\end{cases}}$$