4

I have a 3d tikz picture that includes a scope canvas for placing drawings on a 2d plane inside. What I'd like to do, is place a small spiral at arbitrary xz coordinates on that canvas. I can produce a spiral, but only at the origin. Perhaps I don't understand the parametric equation, but how can I place more spirals at any x,z position?

\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}

enter image description here

2 Answers 2

5

Something like this?

shifted spirals

\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}
1
  • @James Oh, good - I wasn't quite sure what you wanted. You can change the position in the other direction using xshift, of course. But the spirals no longer look as if they are tacked to the board!
    – cfr
    Commented Oct 23, 2015 at 2:17
3

It is easier to shift pictures in Cartesian coordinates than in polar coordinates:

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .