4

I want to present a cube to illustrate, and I want to color four of its sides. The colors will be blue, red, green and yellow; the two remaining sides should be clear or white or, perhaps, black. In part of this I want to show one color at a time, i.e. one side colored and the other sides clear or white or black. Thence I also want to show more sides colored, and if possible I also want to show overlap effects. How may I get this started?

lockstep
  • 250,273

1 Answers1

3

Run with xelatex or latex->dvips->ps2pdf:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}

\begin{document}

\psset{viewpoint=30 20 20 rtp2xyz,Decran=30}
\multido{\iA=-180+10}{50}{%
  \begin{pspicture}(-3.5,-3.5)(3.5,3.5)
    \psSolid[object=cube,a=4,
      fcol= 1 (red)
            2 (blue)
            3 (green)
            4 (yellow),
      RotX=\iA,RotY=\iA\space neg]%
  \end{pspicture}
}

\end{document}

enter image description here

  • Thank you, that is nice. The two blank sides should be adjacent according to my scheme, and the blue side shall oppose the red side. – Frode Alfson Bjørdal May 03 '14 at 06:59
  • insert numfaces=all as optional argument for the cube, then you'll understand the numbering of the sides and you can change the color –  May 03 '14 at 07:03
  • More importantly. (1) I want this in a beamer presentation; is the documentclass used here combinable with the beamer document class? (2) I am not so interested in the rotation, but want to see the cube from an angle from which the two white/transparent sides are visible and from which I see the blue side nearest me, the green side as bottom, the red side furthest and the yellow side to the right - as it were; as stated, one might have overlap effects if that is possible and helpful. – Frode Alfson Bjørdal May 03 '14 at 07:28
  • The standalone is only for demonstration. Use beamer instead and run it with xelatex. The viewpoint is given as "radius Theta Phi" and rtp2xyz converts it to "x y z" values which are expected. –  May 03 '14 at 07:48