Fibonacci spiral

A Fibonacci spiral.


fibonacci-spiral

Edit and compile if you like:

% Fibonacci spiral
% Author: Andrew Mertz
\documentclass{minimal}
\usepackage{amsmath,tikz}
\usetikzlibrary{backgrounds,calc}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0pt}%
\begin{document}
% I have seen many beautiful depictions of Fibonacci spirals and
% golden spirals. So I thought it would be nice to make a Fibonacci
% spiral in TikZ. I like the look of white on black so here I define a
% black background rectangle.
\begin{tikzpicture}[background rectangle/.style={fill=black},
show background rectangle]
% Create some counters for holding the Fibonacci numbers
\newcounter{a}
\newcounter{b}
\newcounter{temp}
% Initialize the counters
\setcounter{a}{0}
\setcounter{b}{1}
% The spiral will start at the origin
\coordinate (0) at (0,0);
% This loop defines the number of turns in the spiral. Note that we
% will have to be careful not to overflow our counters or make the
% spiral too large for TeX to handle. This is easy to do as the
% Fibonacci sequence grows exponentially.
\foreach \i in {1,...,18}
{
% Get the "name" of the last point on the spiral
\pgfmathsetmacro{\lastpoint}{\i-1}
% Compute the angle for this turn of the spiral
\pgfmathsetmacro{\startangle}{mod(\i-1,4) * 90}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Click to download: fibonacci-spiral.texfibonacci-spiral.pdf
Open in Overleaf: fibonacci-spiral.tex