Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
pst-solides3d was developed to solve your problem. Just wait for a couple of hours as someone might be preparing the answer for you with it. –  Who is crazy first May 3 at 5:37
    
Thank you for this encouraging comment which makes me hopeful. –  Frode Bjørdal May 3 at 6:04
    
Have a look on this example at mirrors.ctan.org/info/examples/PSTricks_6_de/36-00-2.ltx -- it is from Herbert Voss' book 'PSTricks', there are also English versions of those examples/book but I did not figure out how example numbers changed. –  Christian Hupfer May 3 at 6:09
    
I get the error exaarticle.cls not found. –  Frode Bjørdal May 3 at 6:58
    
@user24406: exaarticle can be replaced with standalone. –  Who is crazy first May 3 at 7:09

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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 Bjørdal May 3 at 6: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 –  Herbert May 3 at 7: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 Bjørdal May 3 at 7: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. –  Herbert May 3 at 7:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.