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 am looking at an example from How to draw a cube with TikZ where all faces have a distinct color?

\documentclass{minimal}
\usepackage{tikz,tikz-3dplot}

\begin{document}
  \tdplotsetmaincoords{70}{115}

  \begin{tikzpicture}[scale=4,tdplot_main_coords]
    \coordinate (O) at (0,0,0);
    \tdplotsetcoord{P}{1.414213}{54.68636}{45}

    \draw[fill=gray!50,fill opacity=0.5] (O) -- (Py) -- (Pyz) -- (Pz) -- cycle;
    \draw[fill=blue,fill opacity=0.5] (O) -- (Px) -- (Pxy) -- (Py) -- cycle;
    \draw[fill=yellow,fill opacity=0.5] (O) -- (Px) -- (Pxz) -- (Pz) -- cycle;
    \draw[fill=green,fill opacity=0.5] (Pz) -- (Pyz) -- (P) -- (Pxz) -- cycle;
    \draw[fill=red,fill opacity=0.5] (Px) -- (Pxy) -- (P) -- (Pxz) -- cycle;
    \draw[fill=magenta,fill opacity=0.5] (Py) -- (Pxy) -- (P) -- (Pyz) -- cycle;
  \end{tikzpicture}
\end{document}

I want to draw many cubes like these, I wanted to know which line changes the position of the center of the cube, and the orientation?

I want all cubes to be of same size.

what are x, y and z? are they values? are they being multiplied with P?

--------edit-----------

is there a package for TikZ where I can simply draw cubes by providing their size, color and position and orientation?

share|improve this question
2  
For this kind of question it really is just best to try to change one parameter at a time and see the effect, especially since this is a small amount of code. Start with the \tdplotsetmaincoords setting and go from there. –  Peter Grill Feb 22 '13 at 7:08

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.