[Tex/LaTex] Curved cylinders in Tikz

tikz-pgf

I would like to draw this figure here using tikz. However I do not know how to draw curved cylinders in Tikz.
enter image description here

Can someone give a hint with it? Thanks

Best Answer

It can be nicer if you remove the middle points of the two curves and adjust the angles slightly as follows:

\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[xscale=0.9]
\shadedraw[shading=axis] (0,0) to[out=20,in=160] (10,0)--(10,0.5) to[out=160,in=20] (0,0.5)--cycle;
\draw(5,1.25) circle[x radius=1.5mm, y radius=2.5mm];
\end{tikzpicture}
\end{document}

enter image description here

Also, for the part of the curved cylinders you can integrate the following part of code (I ignored the shading though):

\documentclass[12pt,border=0.125cm]{standalone}
\usepackage{tikz,pgfplots}
\usepackage{xifthen}
\begin{document}
\def\sp{4mm}% adjust to scale
\begin{tikzpicture}[>=latex,line width=0.7pt,line cap=round]
\foreach \yshft in {0,7,-7}{
    \begin{scope}[yshift=\yshft*\sp]
    \node(e)[draw,xscale=1.8,yscale=3,circle,minimum size=2*\sp,outer sep=0pt,inner sep=0pt]at(3*\sp,0){};
    \coordinate (A) at ([xshift=-7*\sp]e.north);
    \coordinate (B) at ([xshift=-7*\sp]e.south);
    \draw (e.north)--(e.south);
    \draw (A)--(e.north);
    \draw (B)--(e.south);
    \draw (-4*\sp, 3*\sp).. controls (-4.5*\sp,3*\sp) and(-5*\sp, 2*\sp)..(-4*\sp,0*\sp);
    \draw (-4*\sp,-3*\sp).. controls (-4.5*\sp,-3*\sp)and(-5*\sp,-2*\sp)..(-4*\sp,0*\sp);
    \draw (-4*\sp, 3*\sp).. controls (-3.5*\sp,3*\sp) and(-3*\sp, 2*\sp)..(-4*\sp,0*\sp);
    \ifthenelse{\yshft=0} {}{
    \foreach \y in {-9,-8,...,-1,1,2,...,9}{
        \draw [->](3*\sp, \y/3)-- ++(\y/21*\yshft, 0);}};
    \end{scope}
}
\end{tikzpicture}
\end{document}

With the following output:

enter image description here

Related Question