我有一个圆柱体(实心),它有点倾斜。我想绕 Y 轴旋转它。以下是代码-
\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}
以下是输出图像-
我想让圆柱体绕红线旋转。红线穿过底部圆的中心。
是否可以添加嵌套范围来实现它?