我有一张 3d tikz 图片,其中包含一个用于在内部 2d 平面上放置绘图的范围画布。我想要做的是,在画布上的任意 xz 坐标处放置一个小螺旋。我可以制作螺旋,但只能在原点处。也许我不理解参数方程,但我如何在任何 x,z 位置放置更多螺旋?
\documentclass{article}
\usepackage{tikz,tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{60}
\begin{tikzpicture}[tdplot_main_coords,scale=8,thick]
\draw (0,-.389/2,0) -- (0,.389/2,0) -- (0,.389/2,.1952) --
(0,-.389/2,.1952) -- cycle;
\begin{scope}[canvas is xz plane at y=0]
\draw [domain=0:15,variable=\t,smooth,samples=75]
plot ({\t r}: {0.00012*\t*\t});
\end{scope}
\end{tikzpicture}
\end{document}
答案1
像这样吗?
\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{60}
\begin{tikzpicture}[tdplot_main_coords,scale=8,thick]
\draw (0,-.389/2,0) -- (0,.389/2,0) -- (0,.389/2,.1952) -- (0,-.389/2,.1952) -- cycle;
\begin{scope}[canvas is xz plane at y=0]
\foreach \i/\j in {0/black,1.5/red,3/blue,4.5/green}
\draw [domain=0:15,variable=\t,smooth,samples=75, yshift=\i, \j] plot ({\t r}: {0.00012*\t*\t});
\end{scope}
\end{tikzpicture}
\end{document}
答案2
在笛卡尔坐标中移动图片比在极坐标中更容易:
\documentclass{article}
\usepackage{tikz,tikz-3dplot}
\newcommand{\spiral}[2]{%
\draw [domain=0:15,variable=\t,smooth,samples=75]
plot ({#1 + 0.00012*\t*\t * cos(\t r)}, {#2 + 0.00012*\t*\t * sin(\t r)})}
\begin{document}
\tdplotsetmaincoords{75}{60}
\begin{tikzpicture}[tdplot_main_coords,scale=8,thick]
\draw (0,-.389/2,0) -- (0,.389/2,0) -- (0,.389/2,.1952) -- (0,-.389/2,.1952) -- cycle;
\begin{scope}[canvas is xz plane at y=0]
\spiral00;
\spiral{0}{0.1};
\spiral{0.1}{0.2};
\end{scope}
\end{tikzpicture}
\end{document}