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?

Your Answer

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

Browse other questions tagged or ask your own question.