\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-solides3d}
\psset
{
object=parallelepiped,
lightsrc=20 60 60 rtp2xyz,
Decran=30,
solidmemory,
grid=false,
incolor=red,
}
\begin{document}
\multido{\i=0+30}{12}{%
\begin{pspicture}[viewpoint=20 \i\space 20 rtp2xyz](-7,-3)(7,8)
\psSolid[fillcolor=red,a=2,b=0.75,c=1.5,name=H2](0,-0.375,0.75)
\psSolid[fillcolor=red,a=2,b=4,c=0.5,name=H1](0,2,0.25)
\psSolid[fillcolor=green,a=2,b=0.75,c=1.5,name=H3](0,-0.375,2.25)
\psSolid[fillcolor=green,a=2,b=4,c=0.5,name=H4](0,2,2.75)
\end{pspicture}}
\end{document}
问题
什么原因导致旋转的块状 3D 对象意外位移?如何修复?
答案1
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-solides3d}
\psset
{
object=parallelepiped,
lightsrc=viewpoint,
Decran=30,
solidmemory,
grid=false,
incolor=red,
}
\begin{document}
\multido{\i=0+30}{12}{%
\begin{pspicture}[viewpoint=20 \i\space 20 rtp2xyz](-7,-3)(7,8)
\ifnum\i>180
\psSolid[fillcolor=red,a=2,b=4,c=0.5,name=H1](0,2,0.25)
\psSolid[fillcolor=red,a=2,b=0.75,c=1.5,name=H2](0,-0.375,0.75)
\psSolid[fillcolor=green,a=2,b=4,c=0.5,name=H4](0,2,2.75)
\psSolid[fillcolor=green,a=2,b=0.75,c=1.5,name=H3](0,-0.375,2.25)
\else
\psSolid[fillcolor=red,a=2,b=0.75,c=1.5,name=H2](0,-0.375,0.75)
\psSolid[fillcolor=red,a=2,b=4,c=0.5,name=H1](0,2,0.25)
\psSolid[fillcolor=green,a=2,b=0.75,c=1.5,name=H3](0,-0.375,2.25)
\psSolid[fillcolor=green,a=2,b=4,c=0.5,name=H4](0,2,2.75)
\fi
\end{pspicture}}
\end{document}