I want to use tikz
to draw a golden spiral, growing clockwise, ideally (but not necessarily) superimposed over a set of golden rectangles (you all know the image I'm talking about). A little bit of searching led me to this code, which yields a counterclockwise spiral:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings,calc}
\tikzset{nctopath/.style={
to path=(\tikztostart) ..controls ($(\tikztostart)!1cm*#1!-90:(\tikztotarget)$) and
($(\tikztotarget)!($(\tikztostart)!1cm*#1!-50:(\tikztotarget)$)!70: (\tikztostart)$)..
(\tikztotarget)
},
}
\begin{document}
\begin{tikzpicture}
\def\totx{1}
\coordinate (n-1-1) at (0,0) {};
\foreach \x[count=\xi from 2, evaluate=\x as \temptotx using int(\x+\totx)] in {1,...,9}{
\draw[decoration={
markings,mark=between positions 0 and 1 step 0.249 with {
\coordinate (n-\x-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) ;
}
},postaction=decorate
]
(n-\x-1) arc (\x*90+180:(\x+1)*90+180:{(\temptotx)*3mm})
coordinate (n-\xi-1)
\pgfextra{\xdef\totx{\temptotx}};
}
\end{tikzpicture}
\end{document}
The thing is that I'm still new to tikz
and thus not sure what code here does what. My questions are:
How do I reverse the growth direction?
How do I set phi as the growth factor (which I don't think it is currently, just from looking at the resulting spiral)?
How cumbersome would it be to add in the golden rectangles (i.e., would I have to draw each one individually, or is there some way to define a pattern)?