4

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

  • 1
    You mean the left hand side for curved cylinders is that right? The right hand side is not relevant? – percusse Jul 29 '14 at 9:43
  • 1
    Both sides are relevant! – JPV Jul 29 '14 at 10:52
  • 2
    I don't see any bent cylinders on the right side though. – percusse Jul 29 '14 at 10:55
9

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

  • Could you put some comment si order to understand all the steps?? Thanks for you help! – JPV Jul 30 '14 at 10:12
4

You can start with something like this.

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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