我对黄金矩形中的黄金螺旋线几乎很满意:
\documentclass[a4paper,class=article,border=5pt,tikz]{standalone}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\begin{document}
\begin{tikzpicture}[thick, scale=4]
\pgfmathsetmacro{\w}{1}
\pgfmathsetmacro{\h}{\w*(2/(1+sqrt(5)))}
\pgfmathsetmacro{\dx}{(-(\h/(\h-\w))*\w)/((\h/\w)-(\h/(\h-\w)))}
\pgfmathsetmacro{\dy}{(\h/\w)*\dx}
\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{\a}{(-2/pi)*ln((1+sqrt(5))/2)}
\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))});
\end{tikzpicture}
\end{document}
但即使有 5000 个样本和非常细的线条,也存在一个小问题:
对数螺旋线应该留在盒子里面,但它没有。螺旋线这里和我遇到同样的问题。有办法解决这个问题吗?
线宽不是问题。相同宽度的线越细,情况就越糟: