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?

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

1 Answer 1

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .