我可以模拟一组球(蓝色)。我还可以模拟一组椭圆体(黄色)。如何获得一组半椭圆体?
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz,pgffor}
\usetikzlibrary{shadows}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,2,3,4}
\shadedraw [ball color=blue] (\x,2.5,13)
circle (0.45cm);
\end{tikzpicture}
\begin{tikzpicture}[yscale=2]
\foreach \x in {1,2,3,4}
\shadedraw [ball color=yellow] (\x,2.5,13)
circle (0.45cm);
\end{tikzpicture}
\end{document}
答案1
您不需要缩放任何东西,但需要阴影化适当的形状,如下所示:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz,pgffor}
\usetikzlibrary{shadows}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,2,3,4}
\shadedraw [ball color=blue] (\x,2.5,13)
circle (0.45cm);
\end{tikzpicture}
\begin{tikzpicture}
\foreach \x in {1,2,3,4}
\shadedraw [ball color=yellow] (-0.45+\x,2.5,13) arc(-180:0:0.45 and 0.225) arc(0:180:0.45 and 0.9) -- cycle;
\end{tikzpicture}
\end{document}