As the title says, I'm trying to draw a sunflower pattern with TikZ. I base my experiment on information found on this tutorial written by Jim Bumgardner, mainly from examples 8 and 10.
His demonstration uses javascript, and I already adapted it to python for generating svg, but this time I need to produce a printable document in cmyk, so I'm trying to get my hands on TikZ.
I was doing OK with the code shown below, but my problem is that I can't draw the pattern with more circles. As soon as I try to compile it with a greater value for 'nbrcircles', I get the error 'Dimension too large'. After reading as most as possible, I understand that this error is linked to the computation limits of the TikZ system.
I'm very new in the TikZ world (even in the Tex one), and I'm looking for a way to draw bigger patterns, as shown on the page linked above..
Any help would be greatly appreciated.
Here is the working code that I have so far. Simply replace value for nbrcircles with a greater number to produce the error :
\documentclass[10pt]{minimal}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\def \nbrcircles {28}
\def \outerradius {15mm}
\def \dotradius {1.5mm}
\begin{tikzpicture}
\pgfmathsetmacro {\goldenAngle} {180 * (1+sqrt(5))}
\foreach \b in {1,...,\nbrcircles}{
\pgfmathsetmacro{\angle} {\goldenAngle * \b}
\pgfmathsetmacro{\sradius}{\b / \nbrcircles * \outerradius / 10}
\draw[] (\angle:\sradius) circle [radius=\dotradius] ;
}
\end{tikzpicture}
\end{document}
Here is the result I get with that code. Compare it with example #8 on Jim's page, you'll see that mine misses a few dots :-) :
Ideally, I'd like to be able to produce a pattern with 300 to 600 seeds, and be able to increase the size of the circle as the spiral develops (just like Jim's example 10).
\foreach \b in {1,...,\nbrcircles
, e.g. with{1,1.1,...,\nbrcircles
i get a nice spiral :)\nbrcircles
to 50 when increasing the angle in\goldenAngle
to 101: writelatex.com/1281146wbfkcz