diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex | 100 |
1 files changed, 64 insertions, 36 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex index 61ed10179ec..3d5c9b127f4 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex @@ -1,3 +1,4 @@ + \section{Three Point Perspective Drawing Library} \noindent\emph{by Max Snippe} @@ -7,6 +8,7 @@ vanishing points. \end{tikzlibrary} + \subsection{Coordinate Systems} \begin{coordinatesystem}{three point perspective} @@ -32,6 +34,7 @@ coordinate system. \end{coordinatesystem} + \subsection{Setting the view} \begin{key}{/tikz/3d view=\marg{azimuth}\marg{elevation} @@ -74,7 +77,8 @@ For example, when both \meta{azimuth} and \meta{elevation} are 0$^\circ$, $+z$ will be pointing upward, and $+x$ will be pointing right. The default is as shown below. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[3d view] \draw[->] (-1,0,0) -- (1,0,0) node[pos=1.1]{x}; \draw[->] (0,-1,0) -- (0,1,0) node[pos=1.1]{y}; @@ -88,7 +92,8 @@ |isometric view| style. It simply sets |3d view={-45}{35.26}|. The value for \meta{elevation} is determined with $\arctan(1/\sqrt{2})$. In isometric projection the angle between any pair of axes is 120$^\circ$, as shown below. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[isometric view] \draw[->] (-1,0,0) -- (1,0,0) node[pos=1.1]{x}; \draw[->] (0,-1,0) -- (0,1,0) node[pos=1.1]{y}; @@ -97,8 +102,14 @@ \end{codeexample} \end{stylekey} + \subsection{Defining the perspective} +In this section, the following example cuboid will be used with various +scaling. As a reference, the axes will be shown too, without perspective +projection. +% +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \newcommand\simplecuboid[3]{% \fill[gray!80!white] (tpp cs:x=0,y=0,z=#3) -- (tpp cs:x=0,y=#2,z=#3) @@ -112,18 +123,18 @@ -- (tpp cs:x=0,y=0,z=#3) -- (tpp cs:x=#1,y=0,z=#3) -- (tpp cs:x=#1,y=0,z=0) -- cycle;} - \newcommand{\simpleaxes}[3]{% \draw[->] (-0.5,0,0) -- (#1,0,0) node[pos=1.1]{x}; \draw[->] (0,-0.5,0) -- (0,#2,0) node[pos=1.1]{y}; \draw[->] (0,0,-0.5) -- (0,0,#3) node[pos=1.1]{z};} -In this section, the following example cuboid will be used with various scaling. -As a reference, the axes will be shown too, without perspective projection. -\begingroup -\let\simplecuboid\relax -\let\simpleaxes\relax -\begin{codeexample}[] +\begin{tikzpicture}[3d view] + \simplecuboid{2}{2}{2} + \simpleaxes{2}{2}{2} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[setup code,hidden] \newcommand\simplecuboid[3]{% \fill[gray!80!white] (tpp cs:x=0,y=0,z=#3) -- (tpp cs:x=0,y=#2,z=#3) @@ -137,36 +148,34 @@ As a reference, the axes will be shown too, without perspective projection. -- (tpp cs:x=0,y=0,z=#3) -- (tpp cs:x=#1,y=0,z=#3) -- (tpp cs:x=#1,y=0,z=0) -- cycle;} + \newcommand{\simpleaxes}[3]{% \draw[->] (-0.5,0,0) -- (#1,0,0) node[pos=1.1]{x}; \draw[->] (0,-0.5,0) -- (0,#2,0) node[pos=1.1]{y}; \draw[->] (0,0,-0.5) -- (0,0,#3) node[pos=1.1]{z};} - -\begin{tikzpicture}[3d view] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} \end{codeexample} -\endgroup \begin{key}{/tikz/perspective=\meta{vanishing points} (default p=\{(10,0,0)\},q=\{(0,10,0)\},r=\{(0,0,20)\})} The `strength' of the perspective can be determined by setting the location of the vanishing points. The default values have a stronger perspective towards $x$ and $y$ than towards $z$, as shown below. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[3d view,perspective] \simplecuboid{2}{2}{2} \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} +% From this example it also shows that the maximum dimensions of the cuboid are no longer 2 by 2 by 2. This is inherent to the perspective projection. % \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. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -175,6 +184,7 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} + % Note also that when only |p| is provided, the perspective in $y$ and $z$ direction is turned off. @@ -185,7 +195,8 @@ As a reference, the axes will be shown too, without perspective projection. By changing the $y$ and $z$ components of |p|, one can achieve various effects. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -194,7 +205,8 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -203,7 +215,8 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -212,12 +225,14 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} + % \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 \texttt{0}. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -226,12 +241,14 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} + % \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 \texttt{0}. -\begin{codeexample}[] + % +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -240,29 +257,36 @@ As a reference, the axes will be shown too, without perspective projection. \simpleaxes{2}{2}{2} \end{tikzpicture} \end{codeexample} + % \end{key} \end{key} + \subsection{Shortcomings} - Currently a number of things are not working, mostly due to the fact that PGF - uses a 2D coordinate system underwater, and perspective projection is a - non-linear affine transformation which needs to be aware of all three - coordinates. These three coordinates are currently lost when processing a 3D - coordinate. - The issues include, but possibly are not limited to: - \begin{itemize} + +Currently a number of things are not working, mostly due to the fact that PGF +uses a 2D coordinate system underwater, and perspective projection is a +non-linear affine transformation which needs to be aware of all three +coordinates. These three coordinates are currently lost when processing a 3D +coordinate. +The issues include, but possibly are not limited to: +% +\begin{itemize} \item Keys like |shift|, |xshift|, |yshift| are not working \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 |canvas is .. plane| keys. - \end{itemize} +\end{itemize} + \subsection{Examples} + An |r| that lies `below' your drawing can mimic a macro effect. +% \nopagebreak -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ isometric view, perspective={ @@ -278,8 +302,9 @@ An |r| that lies `below' your drawing can mimic a macro effect. A peculiar phenomenon inherent to perspective drawing, is that however great your coordinate will become in the direction of the vanishing point, it will never reach it. +% \nopagebreak -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ isometric view, perspective={ @@ -300,8 +325,9 @@ never reach it. Even for simple examples, the added perspective might add another `dimension' to your drawing. In this case, two vanishing points give a more intuitive result then three would. +% \nopagebreak -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ scale=0.7, 3d view, @@ -327,8 +353,9 @@ then three would. With the vanishing points nearby, the distortion of parallel lines becomes very strong. This might lead to \texttt{Dimension too large} errors. +% \nopagebreak -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ 3d view, perspective={ @@ -363,8 +390,9 @@ strong. This might lead to \texttt{Dimension too large} errors. 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{codeexample}[preamble={\usetikzlibrary{perspective}}] \begin{tikzpicture}[ cycle of vertices/.style 2 args={ insert path={ @@ -415,4 +443,4 @@ become increasingly more complex. \end{scope} \end{tikzpicture} \end{codeexample} -\fi
\ No newline at end of file +\fi |