5

I want to draw the following picture using tikz, but i don't know how to color it as 3d object and how to place upper arrow overlay other arrow?

The following, is my try:

 \documentclass{article}
 \usepackage{tikz}
 \begin{document}
 \begin{tikzpicture}[scale=.3,xscale=.8]
 \draw  (-1,8) arc (90:-82.8:8 and 3);
 \draw  (-1,8)-- (-1,7);
 \draw  (7,4)-- (7,5);
 \draw  (-1,7) arc (90:10:8 and 3);
 \draw  (7,4) arc (0:-82.8:8 and 3);
 \draw  (0,1.02) --(0,.5)--(-1.5,1.54) node[left]{cc}--(0,2.5) --(0,2);
 %----------------------------------
 \draw  (-1,1) arc (90:-82.8:8 and 3);
 \draw  (-1,0)-- (-1,1);
 \draw  (7,-3)-- (7,-2);
 \draw  (-1,0) arc (90:10:8 and 3);
 \draw  (7,-3) arc (0:-82.8:8 and 3);
 \draw  (0,-5.98) --(0,-6.5)--(-1.5,-5.48) node[left]{cc}--(0,-4.5) --(0,-5);
 %----------------------------------
 \end{tikzpicture}
 \end{document}

enter image description here

8

The 3d effect and the overlay can both be implemented by the fill option for \draw. There could be nicer solutions. Below I did a minimum modification from your example:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=.3,xscale=.8]
\draw[fill=gray] (-1,7) -- (-1,8) arc (90:-7:8 and 3);
\draw  (-1,8) arc (90:-82.8:8 and 3);
\draw  (7,4)-- (7,5);
\draw[fill=white]  (-1,7) arc (90:10:8 and 3);
\draw  (7,4) arc (0:-82.8:8 and 3);
\draw  (0,1.02) --(0,.5)--(-1.5,1.54) node[left]{cc}--(0,2.5) --(0,2);
%----------------------------------
\draw[fill=gray] (-1,0)-- (-1,1) arc (90:-7.8:8 and 3);
\draw  (-1,1) arc (90:-82.8:8 and 3);
\draw  (7,-3)-- (7,-2);
\draw[fill=white]  (-1,0) arc (90:10:8 and 3);
\draw  (7,-3) arc (0:-82.8:8 and 3);
\draw  (0,-5.98) --(0,-6.5)--(-1.5,-5.48) node[left]{cc}--(0,-4.5) --(0,-5);
%----------------------------------
\end{tikzpicture}
\end{document}

enter image description here

Edit: For gradient coloring, it can be done by setting shading = axis.

enter image description here

You may also set shading angle=x for some angle x for different visual effects.

  • Thanks for your answer, but I want a gradient coloring. – C.F.G Jun 14 '17 at 4:16
  • @C.F.G I thought that was a bad scanning... I think shading is what you need. See above. – Chun-Ju Lai Jun 14 '17 at 9:34

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.