我想画一个圆柱体、一个圆和一个平面。以下是我目前所得到的:
\begin{tikzpicture}
\fill[top color=blue!50!,bottom color=blue!20! ,middle color=red!20!,shading=axis,opacity=0.6] (0,0) circle (2cm and 0.5cm);
\fill[left color=blue!50!,right color=blue!20! ,middle color=red!20! ,shading=axis,opacity=0.6] (2,0) -- (2,6) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!50!,bottom color=blue!20,middle color=red!20! ,shading=axis,opacity=0.6] (0,6) circle (2cm and 0.5cm);
\draw (-2,6) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,6) ++ (-2,0) circle (2cm and 0.5cm);
\draw[densely dashed] (-2,0) arc (180:0:2cm and 0.5cm);
\draw (-2,4) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,4) ++ (-2,0) circle (2cm and 0.5cm);
\draw [densely dashed, thick] (-2,4) arc (180:0:2cm and 0.5cm);
\end{tikzpicture}
我设法画出圆柱体并对其进行了调整(为其上色等),并在圆柱体某处加了一个圆圈,但我无法绘制平面z=4
以捕捉我制作的额外圆圈。我还想用颜色绘制平面gray!20!
。我遵循了一些我找到的代码,但其中一些无法编译,而其他一些则“无法完成其工作”。
我也尝试过手动操作,但找不到正确的坐标。有什么帮助吗?
答案1
好吧,它比我最初想象的要复杂一些。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[top color=blue!50!,bottom color=blue!20! ,middle color=red!20!,shading=axis,opacity=0.6] (0,0) circle (2cm and 0.5cm);
\fill[left color=blue!50!,right color=blue!20! ,middle color=red!20! ,shading=axis,opacity=0.6] (2,0) -- (2,6) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!50!,bottom color=blue!20,middle color=red!20! ,shading=axis,opacity=0.6] (0,6) circle (2cm and 0.5cm);
\draw (-2,6) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,6) ++ (-2,0) circle (2cm and 0.5cm);
\draw[densely dashed] (-2,0) arc (180:0:2cm and 0.5cm);
\draw (-2,4) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,4) ++ (-2,0) circle (2cm and 0.5cm);
\draw [densely dashed, thick] (-2,4) arc (180:0:2cm and 0.5cm);
\draw (-2,5) -- (-3,5) --(-5,3) -- (3,3) -- (5,5) -- (2,5);
\draw[dashed] (-2,5) -- (2,5);
\fill[green,opacity=0.5]
(-2,4) -- (-2,5) -- (-3,5) -- (-5,3) -- (3,3) -- (5,5) -- (2,5) -- (2,4) arc (0:180:2cm and -0.5cm);
\end{tikzpicture}
\end{document}