# Drawing a parallelopiped in TikZ [duplicate]

I need to draw a parallelopiped like this in TikZ:

I want to draw in 3D using views and not in 2D.

• Since your question is not clear enough to me (what do you exactly mean by draw in 3D? Do you want to be able to change perspective of this sole cuboid?), I strongly recommend to learn from this very comprehensive tutorial. And you can also find useful informations from this post on TeX-SX. Aug 19, 2022 at 10:11
• Perhaps this is a duplicate of that Aug 21, 2022 at 8:12

TikZ is internally 2D, so you can only draw one 2D projection on the screen plane of the oblique cuboid; some packages like tikz3d-plot, 3dtool or the library perspective may be used.

In case of real 3D Asymptote, you can copy the following code to http://asymptote.ualberta.ca/ click Run, then use the computer mouse to rotate the output figure. You can guess the meaning of the numbers in the 3-dim transform ty for slanting along y-axis; the last column in the matrix is always $(0,0,0,1)^T$.

// http://asymptote.ualberta.ca/
size(4cm);
import three;

// slanting along y-axis
transform3 ty={
{ 1, 0,  0, 0},
{ 0, 1, .4, 0},
{ 0, 0,  1, 0},
{ 0, 0,  0, 1}
};

draw(ty*unitcube,yellow+opacity(.5));
draw(ty*unitbox,purple+opacity(1));


Try this:

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}

\draw[fill=cyan] (0,0)--(4,0)--(5,3)--(1,3)--(0,0);
\draw[fill=green] (5,3)--(1,3)--(2,4)--(6,4)--(5,3);
\draw[fill=yellow] (4,0)--(5,3)--(6,4)--(5,1)--(4,0);
\draw[dashed] (2,4)--(1,1);
\draw[dashed] (0,0)--(1,1);
\draw[dashed] (1,1)--(5,1);

\end{tikzpicture}
\end{document}


Output: