这是一张圆盘的图片,圆盘由一层薄薄的熔融塑料制成,然后我们将其拉伸并弯曲以使其与自身重叠,这就是变形圆盘。我想让观众清楚地知道原始圆盘的哪一部分在变形圆盘中的位置。我认为如果圆盘和变形圆盘都稍微褪色一下,这张图片会更容易理解,但我似乎无法让变形圆盘褪色,可能是因为它与自身重叠了。
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\newcommand*{\NNN}{300}
\newcommand*{\XXX}{.9}
\newcommand*{\YYY}{4}
\newcommand*{\x}{cos(2*pi*\i/\NNN r)}
\newcommand*{\y}{sin(2*pi*\i/\NNN r)}
\newcommand*{\xp}{cos(2*pi*(\i+1)/\NNN r)}
\newcommand*{\yp}{sin(2*pi*(\i+1)/\NNN r)}
\fill[gray!20,draw=gray!30,ultra thick] (-4,0) circle (1cm);
\node at (-2.5,0) {\({}\to{}\)};
\fill[gray!40,draw=gray!30,ultra thick] ({exp(\XXX)},0)
\foreach \i in {0,...,\NNN}
{
-- ({exp(\XXX*\xp)*cos(\YYY*\yp r)},{exp(\XXX*\xp)*sin(\YYY*\yp r)})
} -- cycle;
\fill[gray!20,draw=gray!30,ultra thick,even odd rule] ({exp(\XXX)},0)
\foreach \i in {0,...,\NNN}
{
-- ({exp(\XXX*\xp)*cos(\YYY*\yp r)},{exp(\XXX*\xp)*sin(\YYY*\yp r)})
} -- cycle;
\end{tikzpicture}
\end{document}
答案1
您可以使用该preaction
选项来避免重复计算。您可以declare function
简化公式。
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\def\NNN{200}
\def\XXX{.9}
\def\YYY{4}
\tikzset{
declare function={
x(\i) = cos(2*pi*\i/\NNN r);
y(\i) = sin(2*pi*\i/\NNN r);
},
}
\path[fill=gray!20,draw=gray,ultra thick] (-4,0) circle (1cm);
\draw[-latex] (-2.7,0) -- (-2.3,0);
\path[fill=gray!20,draw=gray,ultra thick,even odd rule,
preaction={fill=gray!40,nonzero rule}]
({exp(\XXX)},0) \foreach \i in {0,...,\NNN} {
-- ({exp(\XXX*x(\i+1))*cos(\YYY*y(\i+1) r)},
{exp(\XXX*x(\i+1))*sin(\YYY*y(\i+1) r)})
} -- cycle;
\end{tikzpicture}
\end{document}