我想画一个散射实验。为此,我需要画一个球体的带。这看起来相当复杂,而我的基本 tikz 技能很遗憾不够。如果有人能给我一些建议,请告诉我。
编辑: 我使用纬度绘制了球形带,并将图片旋转了 90 度。但是我怎样才能像在草图中一样在两个纬度之间进行填充呢?
\begin{tikzpicture}
\newcommand\latitude[1]{%
\draw[dashed] (#1:2) arc (0:-180:{2*cos(#1)} and {0.25*cos(#1)});
\draw (#1:2) arc (0:180:{2*cos(#1)} and {0.25*cos(#1)});
}
\begin{scope}[rotate around={90:(8,0)},shift={(8,0)}]
\draw[fill=black] (0,0) circle (0.1);
\draw[dashed] (0,0) circle (2);
\latitude{-20}
\latitude{-30}
\end{scope}
%
\end{tikzpicture}
答案1
或者,您可以使用http://www.ctan.org/pkg/pst-solides3d
\documentclass{article}
\usepackage{tikz}
\usepackage{pst-solides3d}
\begin{document}
\begin{pspicture}
\psSolid[
object=calottesphere,
r=3,ngrid=16 18,
phi=20,theta=30,
hollow,RotY=-80]%
\end{pspicture}
\end{document}
答案2
这是根据您的建议提出的:只需将您的弧组合成一条路径并填充。
\newcommand\latitudes[3][]{%
\draw[dashed] (#2:2) arc (0:-180:{2*cos(#2)} and {0.25*cos(#2)});
\draw[dashed] (#3:2) arc (0:-180:{2*cos(#3)} and {0.25*cos(#3)});
\draw[#1] (#2:2) arc (0:180:{2*cos(#2)} and {0.25*cos(#2)})
arc (180-#2:180-#3:2)
arc (180:0:{2*cos(#3)} and {0.25*cos(#3)})
arc (#3:#2:2);}
\begin{tikzpicture}
\begin{scope}[rotate around={90:(8,0)},shift={(8,0)}]
\draw[fill=black] (0,0) circle (0.1);
\draw[dashed] (0,0) circle (2);
\latitudes[fill=yellow]{-20}{-30}
\end{scope}
%
\end{tikzpicture}