\documentclass[pstricks, border=0pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{unit=1}
\psset{viewpoint=30 7 6}
\psset{action=draw*,incolor=green!20!white, fillcolor=green!20!white, linewidth=0.5pt, opacity=1}
\multido{\iB=2+2}{1}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+0.5,\iC=0+1}{3}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}
\multido{\iB=2+2}{2}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+0.25,\iC=0+1}{5}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}
\multido{\iB=2+2}{4}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+0.125,\iC=0+1}{9}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}
\multido{\iB=2+2}{8}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+0.0625,\iC=0+1}{17}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}
\end{document}
现在我想把这四个放到multido
另一个中multido
:
\documentclass[pstricks, border=0pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{unit=1}
\psset{viewpoint=30 7 6}
\psset{action=draw*,incolor=green!20!white, fillcolor=green!20!white, linewidth=0.5pt, opacity=1}
\multido{\iA=1+1}{4}{
\multido{\iB=2+2}{2^(\iA-1)}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+2^(-\iA),\iC=0+1}{2^(\iA)+1}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}
}
\end{document}
我怎样才能让乳胶计算2^(\iA-1)
,2^(-\iA)
以及2^(\iA)+1
?
答案1
\documentclass[pstricks, border=0pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{viewpoint=30 7 6, action=draw*,incolor=green!20!white,
fillcolor=green!20!white,
linewidth=0.5pt, opacity=1}
\newcount\cntA \cntA=1
\newcount\cntB \cntB=2
\pstFPdiv\rcntB{1}{\the\cntB}
\multido{\iA=1+1}{4}{%
\multido{\iB=2+2}{\the\cntA}{%
\begin{pspicture}(-0.8,-0.8)(2,2)
\multido{\r=0.0+\rcntB,\iC=0+1}{\numexpr\the\cntB+1\relax}{%
\ifodd\iC
\ifnum\iC<\iB
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi
\else
\psSolid[object=plan,definition=equation, args={[0 0 1 -\r]},base=0 1 0 1]
\fi}
\end{pspicture}%
}%
\multiply\cntA by 2
\multiply\cntB by 2
\pstFPdiv\rcntB{1}{\the\cntB}
}
\end{document}