1

I have a cyclinder (solid) which is little tilted. I want to rotate it about Y-axis. Below is the code-

\begin{tikzpicture}
  \begin{scope}[shift={(0,0)},rotate=30]
    \coordinate (ll) at (-2,0); %lower left
    \coordinate (lr) at ( 2,0); %lower right
    \coordinate (ul) at (-2,4); %upper left
    \coordinate (ur) at ( 2,4); %upper right
    \shade [shading angle=90] (ll) arc (-180:-60:2 cm and .75cm) -- +(0,4) arc (-60:-180:2 cm and .75cm) -- cycle;
    \shade [shading angle=270] (lr) arc (0:-60:2 cm and .75cm) -- +(0,4) arc (-60:0:2 cm and .75cm) -- cycle;
    \draw [thick] (ll) arc (-180:0:2 cm and .75cm) -- (ur) arc (0:-180:2 cm and .75cm) -- cycle;
    \draw [thick, shade, shading angle=30] (ul) arc (-180:180:2 cm and .75cm);
  \end{scope}
\end{tikzpicture}

Below is the output image-

enter image description here

I want to rotate the cylinder about red line. The red line is passing through the centre of bottom circle.

Is it possible to add nested scope which can achieve it?

ravi
  • 1,618
  • You would need to have created it in 3 dimensions in order to rotate it in 3 dimensions. – John Kormylo Nov 04 '15 at 15:36
  • @JohnKormylo: How to do that? Can you please provide an example? Thank you very much. – ravi Nov 04 '15 at 16:17
  • See http://tex.stackexchange.com/questions/63370/drawing-3d-cylinder (first answer, the second is 2d). – John Kormylo Nov 04 '15 at 18:12
  • @JohnKormylo: I have checked the above link. But I don't see any option to change the angles. Can you help me a bit more? – ravi Nov 05 '15 at 01:10
  • 1
    Here is a useful exercise in rotating views with tikz-3d http://tex.stackexchange.com/questions/254820/tikz-pair-of-compasse-rendering-contest/254866#254866 – John Kormylo Nov 05 '15 at 04:29

0 Answers0