A 3D "ell" Shape Or "L" Shape
Answer :
To give you a start.
\documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{perspective} \begin{document} \begin{tikzpicture}[3d view={30}{15},line cap=round, declare function={ax=2;ay=1.5;az=2.5;bx=0.5;bz=0.5;}] \draw (0,0,0) -- (ax,0,0) -- (ax,0,bz) -- (bx,0,bz) -- (bx,0,az) -- (0,0,az) -- cycle (0,0,az) -- (0,ay,az) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,0) -- (ax,0,0); \end{tikzpicture} \end{document}
The perspective
library allows us to change the view angles, and declare function
is used to define parameters that can be changed, too.
\documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{perspective} \begin{document} \begin{tikzpicture}[3d view={40}{35},line cap=round, declare function={ax=3;ay=2;az=2.5;bx=0.8;bz=0.8;}] \draw (0,0,0) -- (ax,0,0) -- (ax,0,bz) -- (bx,0,bz) -- (bx,0,az) -- (0,0,az) -- cycle (0,0,az) -- (0,ay,az) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,az) edge ++ (0,-ay,0) -- (bx,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,bz) edge ++ (0,-ay,0) -- (ax,ay,0) -- (ax,0,0); \end{tikzpicture} \end{document}
I would suggest something along the lines of the code below. This because I like the readability and also because it can be written fast...
\documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc,3d} \begin{document} \begin{tikzpicture}[x = {(0.95cm,-0.3cm)}, y = {(0.707cm,0.707cm)}, z = {(0cm,1cm)}] \begin{scope}[canvas is zx plane at y=0] \draw (0,0) -- ++(3,0) -- ++(0,1) --++(-2,0) -- ++(0,5) -- ++(-1,0) -- (0,0); \end{scope} \begin{scope}[canvas is zy plane at x=0] \draw (3,0) -- ++(0,3); \end{scope} \begin{scope}[canvas is zy plane at x=1] \draw (3,0) -- ++(0,3); \draw (1,0) -- ++(0,3); \end{scope} \begin{scope}[canvas is zy plane at x=6] \draw (0,0) -- ++(0,3); \draw (1,0) -- ++(0,3); \end{scope} \begin{scope}[canvas is zx plane at y=3] \draw (0,0) ++(3,0) -- ++(0,1) --++(-2,0) -- ++(0,5) -- ++(-1,0); \end{scope} \end{tikzpicture} \end{document}
Comments
Post a Comment