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.
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.
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}
pstricks solution to the above-mentioned link, taking as a model the image you refer to in your post.
– Bernard
Jul 02 '15 at 09:41