I'm almost happy with my golden spiral in golden rectangles:


    \begin{tikzpicture}[thick, scale=4]

        \draw (0,0) rectangle (\w,\h);
        \draw (\h,0) -- (\h,\h); 
        \draw (\h,{\w-\h}) -- (\w,{\w-\h});        
        \draw ({2*\w-2*\h)},{\w-\h}) -- ({2*\w-2*\h},\h);      
        \draw (\h,{4*\h-2*\w}) -- ({2*\w-2*\h)},{4*\h-2*\w});
        \draw ({6*\h-3*\w},{4*\h-2*\w}) -- ({6*\h-3*\w},{\w-\h});
        \draw ({6*\h-3*\w},{6*\w-9*\h}) -- ({2*\w-2*\h},{6*\w-9*\h});
        \draw ({2*\w-2*\h-13*\h+8*\w},{4*\h-2*\w}) -- ({2*\w-2*\h-13*\h+8*\w},{4*\h-2*\w-13*\h+8*\w});

        \pgfmathsetmacro{\d}{sqrt(pow(\dx,2) + pow((\dy-\h), 2))}

        \draw[red, rotate around={{-atan((2*\h-\w)/\w)}:(\dx,\dy)}, domain=0:6*pi, variable=\t, samples=300] plot[fixed point arithmetic] ({\dx-\d*exp(\a*\t)*cos(deg(\t))}, {\dy-\d*exp(\a*\t)*sin(deg(\t))});


enter image description here

But even with 5000 samples and very thin lines there is a small problem:

enter image description here

The logarithmic spiral should stay inside the box, but it doesn't. The spirals here have the same problem as mine. Is there a way to fix this?

The line width is not the problem. It's getting even worse with thinner lines of same width:

enter image description here

  • 3
    Is that from the double line width (0.2mm spiral, 0.1mm grid)? Does it vanish if you set the spiral to 0.1mm? Nov 27, 2015 at 1:20
  • 1
    Please post complete code! Completing your code in the most obvious way, I just get gazillions of errors.
    – cfr
    Nov 27, 2015 at 3:03
  • No, the line width is not the problem. Nov 27, 2015 at 5:45
  • 4
    I believe this is the correct result: The golden spiral passes through the points that divide the golden rectangles, but it's not tangent to the rectangle borders at these points. Take a look at Fig. 34 in Spirals and the Golden Section or see Golden Rectangle on Wolfram MathWorld
    – Jake
    Nov 27, 2015 at 9:41
  • @Jake An answer? (Or is this off-topic as it's about maths, or ...?
    – Joseph Wright
    Dec 17, 2015 at 11:12


Browse other questions tagged .