TikZ — 阿基米德螺旋精度问题?

TikZ — 阿基米德螺旋精度问题?

这是我的代码:

\begin{tikzpicture}[x=1mm, y=1mm]
    \clip[] (-26, -26) rectangle (26, 26);

    \foreach \a in {0, 30,..., 330} {
        \foreach \r in {4,8,...,24} {
            \draw[line width=0.05mm] ({\r*cos(-5+\a)}, {\r*sin(-5+\a)}) arc ({-5+\a}:{5+\a}:{\r});
        }
    }

    \foreach \a in {0, 30,..., 330} {
        \foreach \r in {0,4,...,24} {
            \draw[line width=0.05mm] ({(\r-1)*cos(\a)}, {(\r-1)*sin(\a)}) -- ({(\r+1)*cos(\a)}, {(\r+1)*sin(\a)});
        }
    }       

    % Spiral
    \draw[blue, line cap=round, line width=0.25mm, domain=0:pi, variable=\t, samples=5000]
        plot ({-\t r}:{(8*\t)});    

    % Dots
    \foreach \x in {0,...,6} {
        \fill[red] ({(\x*4)*cos(-\x*30)}, {(\x*4)*sin(-\x*30)}) circle (0.4mm); 
    }
\end{tikzpicture}

蓝色阿基米德螺旋线应该访问每个红点,但实际上没有。我仔细检查了计算结果,但找不到错误。

阿基米德螺线 错误

答案1

只需 plot ({-\t r}:{(8*\t)})替换plot ({-\t r}:{(24/pi*\t)})

您的代码

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x=1mm, y=1mm]
    \clip[] (-26, -26) rectangle (26, 26);

    \foreach \a in {0, 30,..., 330} {
        \foreach \r in {4,8,...,24} {
            \draw[line width=0.05mm] ({\r*cos(-5+\a)}, {\r*sin(-5+\a)}) arc ({-5+\a}:{5+\a}:{\r});
        }
    }

    \foreach \a in {0, 30,..., 330} {
        \foreach \r in {0,4,...,24} {
            \draw[line width=0.05mm] ({(\r-1)*cos(\a)}, {(\r-1)*sin(\a)}) -- ({(\r+1)*cos(\a)}, {(\r+1)*sin(\a)});
        }
    }       

    % Spiral
    \draw[blue, line cap=round, line width=0.25mm, domain=0:pi, variable=\t, samples=5000]
        plot ({-\t r}:{(24/pi*\t)});    

    % Dots
    \foreach \x in {0,...,6} {
        \fill[red] ({(\x*4)*cos(-\x*30)}, {(\x*4)*sin(-\x*30)}) circle (0.4mm); 
    }
\end{tikzpicture}


\end{document}

在此处输入图片描述

相关内容