1

I would like to draw a rectangle in perspective which looks like this

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,1) -- (0,3) -- (2,5) -- (2,3) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

Is there an alternative way by declaring a rectangle

\tikzstyle{my_rectangle} = [rectangle, minimum width=2cm, minimum height=1cm]

and rotate it around the upward pointing axis? And if yes how would I do the rotation?

  • 1
    \tikzstyle is deprecated. – The old JouleV Apr 23 at 12:42
  • While TikZ itself supports 3d coordinates, they are not in gerneral orthogonal or normal. For that you should use tikz-3dplot. – John Kormylo Apr 23 at 13:56
3

Like this?

\documentclass[tikz,margin=1pt]{standalone}
\usetikzlibrary{3d}
\tikzset{my_rectangle/.style={draw,rectangle, minimum width=2cm, minimum height=1cm}}
\begin{document}
\begin{tikzpicture}
\node[my_rectangle,canvas is zy plane at x=0] {};
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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