为了创建 gif,我做了以下操作:
\documentclass[border=0pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\newcommand{\viewpoint}{25 15 5}
\newcommand{\axis}{\axesIIID(0,0,0)(4.5,4,4)}
\psset{unit=1}
\psset{viewpoint=\viewpoint}
\psset{action=draw*,incolor=green!20!white, linewidth=0.5pt}
\multido{\i=1+2}{3}{
\begin{pspicture}(-5.3,-2.5)(7,8)
\axis
\multido{\r=0+1.5}{3}{
\psSolid[object=face, base=3 3 3 0 0 0 0 3](0,0,\r)}
\multido{\r=0.75+1.5}{2}{
\psSolid[object=face, base=3 3 3 0 0 0 0 3](0,0,\r)}
\psset{incolor=red}
\multido{\r=0.375+0.75}{\i}{
\psSolid[object=face, base=3 3 3 0 0 0 0 3](0,0,\r)}
\end{pspicture}}
\end{document}
是否可以先画绿色方块,然后再画它们之间的红色方块?
答案1
这是你何时绘制平面的问题。也可以这样做pst-3dplot
:
\documentclass[border=10pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{viewpoint=25 15 5, linewidth=0.5pt}
\multido{\i=2+2}{4}{%
\begin{pspicture}(-5.3,-2.5)(7,8)
\axesIIID(0,0,0)(4.5,4,4)
\multido{\r=0.0+-0.375,\iA=0+1}{9}{%
\ifodd\iA
\ifnum\iA<\i
\psSolid[object=plan,definition=equation,
fillstyle=solid,fillcolor=red,
args={[0 0 1 \r]},base=-1.5 1.5 -1.5 1.5]
\fi
\else
\psSolid[object=plan,definition=equation,
fillstyle=solid,fillcolor=green!20!white,
args={[0 0 1 \r]},base=-1.5 1.5 -1.5 1.5]
\fi}
\end{pspicture}%
}
\end{document}