1

This question already has an answer here:

i want to draw a spiral around cylinder. Can you help me?

something like that http://www.unitmath.com/um/p/Examples/GeometricSolids/Spiral.gif

Thank you very much.

marked as duplicate by Andrew Swann, user13907, Maarten Dhondt, Jesse, Martin Schröder Jul 1 '15 at 11:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Astrinus Jul 1 '15 at 8:52
  • this is the problem. I dont know how i could start. I know the question is very rarely. Sry. – Goldstone Jul 1 '15 at 8:59
  • 1
    @Goldstone You could read TikZ manual, or (if you read simple French or know a neolatin language) TikZ pour l'impatient, a very well written guide. – Astrinus Jul 1 '15 at 9:07
10

The spiral can be drawn by a parameterized plot coordinate. The example uses a 3D coordinate system, the z axis is tilted 30° down.

The origin is the center point of the bottom circle.

The curves are drawn via plot and variable \t, which specifies the angle. The x coordinate is calculated by cos(\t)*\cylrad with \cylrad as cylinder radius. The z coordinate is calculated by -sin(\t)*\cylrad.The negative sign is due to the fact that the z axis points in the other direction.

The height of a point at the spiral curve grows proportionally with the angle.

Full example:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[
  x=10mm,
  y=cos(30)*10mm,
  z={(0, -sin(30)*10mm)},
]
  \def\cylrad{1}% radius
  \def\cylht{4}
  \draw
    (-\cylrad, \cylht) -- (-\cylrad, 0) --
    plot[smooth, samples=25, variable=\t, domain=180:360]
      ({cos(\t)*\cylrad}, 0, {-sin(\t)*\cylrad}) --
    (\cylrad, \cylht)
    plot[smooth cycle, samples=51, variable=\t, domain=0:360]
      ({cos(\t)*\cylrad}, \cylht, {-sin(\t)*\cylrad})
  ;
  \draw[densely dashed]
    plot[smooth, samples=9, variable=\t, domain=0:180]
      ({cos(\t)*\cylrad}, 0, {-sin(\t)*\cylrad})
  ;
  \draw[semithick]
    \foreach \y in {0, \cylht/2} {
      plot[smooth, samples=25, variable=\t, domain=180:360]
        ({cos(\t)*\cylrad}, {\y + (\t-180)*\cylht/720}, {-sin(\t)*\cylrad})
    }
  ;  
  \draw[semithick, densely dashed]
    \foreach \y in {\cylht/4, 3*\cylht/4} {
      plot[smooth, samples=25, variable=\t, domain=0:180]
        ({cos(\t)*\cylrad}, {\y + \t*\cylht/720}, {-sin(\t)*\cylrad})
    }
  ;  
\end{tikzpicture}
\end{document}

Result

  • @Goldstone: I added a pstricks solution to the above-mentioned link, taking as a model the image you refer to in your post. – Bernard Jul 2 '15 at 9:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.