# pgf-tikz/pgf

 @@ -1,5 +1,7 @@ \section{Three Point Perspective Drawing Library} \noindent\emph{by Max Snippe} \begin{tikzlibrary}{perspective} This library provides tools for perspective drawing with one, two, or three vanishing points. @@ -59,10 +61,10 @@ \subsection{Setting the view} \begin{scope}[rotate around z=\az] \pgfmathsetmacro\el{50} \begin{scope}[canvas is yz plane at x=0] \draw[->] (0,0) ++(-2.5,0) arc (180:180-\el:2.5) \draw[->] (0,0) ++(-2.5,0) arc (180:180-\el:2.5) coordinate[pos=0.5](el); \draw (el) -- ++(180-\el/2:1) node[above]{\meta{elevation}}; \draw[dashed] (0,0) -- \draw[dashed] (0,0) -- pic[solid,sloped,transform shape,pos=1.2]{viewpoint} ++(180-\el:3); \end{scope} \end{scope} @@ -163,7 +165,7 @@ \subsection{Defining the perspective} % \begin{key}{/tikz/perspective/p=\marg{x,y,z} (initially (0,0,0))} The location of the vanishing point that determines the strength' of the perspective in $x$-direction can be set with the |p| key. perspective in $x$-direction can be set with the |p| key. \begin{codeexample}[] \begin{tikzpicture}[ 3d view, @@ -180,7 +182,7 @@ \subsection{Defining the perspective} of |p| to \texttt{0} (e.g. |p={(0,a,b)}|, where \texttt{a} and \texttt{b} can be any number and will be ignored). Or one can provide |q| and |r| and omit |p|. By changing the $y$ and $z$ components of |p|, one can achieve various effects. \begin{codeexample}[] @@ -213,7 +215,7 @@ \subsection{Defining the perspective} \end{key} % \begin{key}{/tikz/perspective/q=\marg{x,y,z} (initially (0,0,0))} Similar to |p|, but can be turned off by setting its $y$ component to Similar to |p|, but can be turned off by setting its $y$ component to \texttt{0}. \begin{codeexample}[] \begin{tikzpicture}[ @@ -227,7 +229,7 @@ \subsection{Defining the perspective} \end{key} % \begin{key}{/tikz/perspective/r=\marg{x,y,z} (initially (0,0,0))} Similar to |p|, but can be turned off by setting its $z$ component to Similar to |p|, but can be turned off by setting its $z$ component to \texttt{0}. \begin{codeexample}[] \begin{tikzpicture}[ @@ -253,7 +255,7 @@ \subsection{Shortcomings} \item Keys like |rotate around x|, |rotate around y|, and |rotate around z| are not working \item Units are not working \item Most keys from the |3d| library are unsupported, e.g. all the \item Most keys from the |3d| library are unsupported, e.g. all the |canvas is .. plane| keys. \end{itemize} @@ -267,7 +269,7 @@ \subsection{Examples} p = {(8,0,0)}, q = {(0,8,0)}, r = {(0,0,-8)}}] \simplecuboid{2}{2}{2}] \end{tikzpicture} @@ -285,9 +287,9 @@ \subsection{Examples} q = {(0,4,0)}}] \node[fill=red,circle,inner sep=1.5pt,label=above:p] at (4,0,0){}; \foreach \i in {0,...,100}{ \filldraw[fill = gray] (tpp cs:x=\i,y=0,z=0) \filldraw[fill = gray] (tpp cs:x=\i,y=0,z=0) -- (tpp cs:x=\i+0.5,y=0,z=0) -- (tpp cs:x=\i+0.5,y=2,z=0) -- (tpp cs:x=\i,y=2,z=0) @@ -306,7 +308,7 @@ \subsection{Examples} perspective={ p = {(20,0,0)}, q = {(0,20,0)}}] \filldraw[fill=brown] (tpp cs:x=0,y=0,z=0) -- (tpp cs:x=0,y=4,z=0) -- (tpp cs:x=0,y=4,z=2) @@ -358,15 +360,15 @@ \subsection{Examples} % A more complex example. \iffalse Of course these examples can become as complex as desired, but as with any 3D drawing using Ti\textit{k}z, the order of drawing commands is important and can Of course these examples can become as complex as desired, but as with any 3D drawing using \tikzname, the order of drawing commands is important and can become increasingly more complex. \nopagebreak \begin{codeexample}[] \begin{tikzpicture}[ cycle of vertices/.style 2 args={ insert path={ foreach \i [count=\j,evaluate=\j as \k using foreach \i [count=\j,evaluate=\j as \k using {ifthenelse(\j==1,"","-- "}] in {#2}{\k (vert-#1-\i)} -- cycle}}, scale=0.7, line join=round,