diff options
author | Norbert Preining <norbert@preining.info> | 2022-08-17 03:00:52 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-08-17 03:00:52 +0000 |
commit | c384cf2662c6574dc248ae20a9276cacf20320f6 (patch) | |
tree | 2a719b425428d6e7de07bde420534be13ea788a2 /graphics/pgf/contrib/tikz-ext | |
parent | deb51d400db4c69df1cef442643a6b94428a2211 (diff) |
CTAN sync 202208170300
Diffstat (limited to 'graphics/pgf/contrib/tikz-ext')
23 files changed, 2841 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikz-ext/README.md b/graphics/pgf/contrib/tikz-ext/README.md new file mode 100644 index 0000000000..23910ccef1 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/README.md @@ -0,0 +1,26 @@ +# TikZ-Extensions + +## License + +This material is subject to the LaTeX Project Public License and the GNU Free Documentation License. + +## About the Author + +Name: Qrrbrbirlbel + +## Introduction + +This is not a LaTeX package but a collection of libraries for PGF and TikZ. + +These are + + * `transformations.mirror`, + * `paths.arcto`, + * `paths.ortho`, + * `paths.timer`, + * `patterns.images`, + * `topaths.arcthrough` and + * `misc`. + + These were developed in response to questions on tex.stackexchange.com. + Some of these can be find by searching for my [user id](https://tex.stackexchange.com/search?q=user%3A16595+%22my+library%22).
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex new file mode 100644 index 0000000000..5c90d0f5bf --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex @@ -0,0 +1,19 @@ +\part{Introduction} +\begin{multicols}{2} +\section{Usage} +This package is called |tikz-ext|, however, one can't load it via |\usepackage|. +Instead, this package consists of multiple PGF and \tikzname\space libraries +which are loaded by either |\usepgflibrary| or |\usetikzlibrary|. + +\section{Why do we need it?} +Since I have been answering questions on \hyperlink{https://tex.stackexchange.com}{TeX.sx} +I've noticed that some questions come up again and again, +every time with a slightly different approach on how to solve them. + +I don't like reinventing the wheel which is why I've gathered the code of my answers in this package. + +And, yes, I am using them myself, too. + +\section{Should these libraries be part of \tikzname?} +I guess. +\end{multicols}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex new file mode 100644 index 0000000000..dc9103b699 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex @@ -0,0 +1,267 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\begin{tikzlibrary}{misc} + This library adds miscelleaneos utilities to PGFmath, PGF or \tikzname. +\end{tikzlibrary} + +\section{PGFmath} + +\subsection{Postfix operator \texttt{R}} + +Similar to |\segments[<num>]| in PSTricks, the postfix operator |R| allows the user +to use an arbitrary number of segments of a circle to be used instead of an angle. + +\begin{key}{/tikz/full arc=\meta{num} (default |{}|)} + The number \meta{num} of segments will be set up. + Using |full arc| with an empty value disables the segmentation and |1R| equals $1^\circ$. + + The given value \meta{num} is evaluated when the key is used and doesn't change when + \meta{num} contains variables that change. +\end{key} +The |R| operator can then be used. +\begin{math-operator}{R}{postfix}{fullarc} + Multiplies \mvar{x} with $\frac{360}{\meta{num}}$. +\end{math-operator} + +\subsection{Functions} + +\begin{math-function}{strrepeat("\mvar{Text}", \mvar{x})} +\mathcommand + Returns a string with \mvar{Text} repeated \mvar{x} times. + +\begin{codeexample}[] +\pgfmathparse{strrepeat("foo", 5)} \pgfmathresult +\end{codeexample} +\end{math-function} + +\begin{math-function}{isInString("\mvar{String}", "\mvar{Text}")} +\mathcommand + Returns |1| (true) if \mvar{Text} contains \mvar{String}, + otherwise |0| (false). + +\begin{codeexample}[] +\pgfmathparse{isInString("foo", "bar")} \pgfmathresult +\ and\ +\pgfmathparse{isInString("foo", "foobar")} \pgfmathresult +\end{codeexample} +\end{math-function} + +\begin{math-function}{strcat("\mvar{Text A}", "\mvar{Text B}", …)} +\mathcommand + Returns the concatenation of all given parameters. + +\begin{codeexample}[] +\pgfmathparse{strcat("blue!", int(7*3), "!green")} \pgfmathresult +\end{codeexample} +\end{math-function} + + +\begin{math-function}{isEmpty("\mvar{Text}")} +\mathcommand + Returns |1| (true) if \mvar{Text} is empty, otherwise |0| (false). + % +\begin{codeexample}[] +\pgfmathparse{isEmpty("foo")} \pgfmathresult\ and\ +\pgfmathparse{isEmpty("")} \pgfmathresult\ and\ +\def\emptyText{} +\pgfmathparse{isEmpty("\emptyText")} \pgfmathresult +\end{codeexample} +\end{math-function} + +\begin{math-function}{atanXY(\mvar{x},\mvar{y})} +\mathcommand + Arctangent of $\mvar y\div \mvar x$ in degrees. This also takes into account the quadrant. + This is just a argument-swapped version of |atan2| which makes it easier to use + the |\p| commands of the |calc| library. + \index{atan2@\protect\texttt{atan2} math function}% + \index{Math functions!atan2@\protect\texttt{atan2}}% + % +\begin{codeexample}[] +\pgfmathparse{atanXY(3,4)} \pgfmathresult +\end{codeexample} +\end{math-function} +\begin{math-function}{atanYX(\mvar{y},\mvar{x})} +\mathcommand + Arctangent of $y\div x$ in degrees. This also takes into account the quadrant. +\begin{codeexample}[] +\pgfmathparse{atanYX(4,3)} \pgfmathresult +\end{codeexample} +\end{math-function} + +\subsection{Functions: using coordinates} +The following functions can only be used with PGF and/or \tikzname. +Since the arguments are usually plain text (and not numbers) one has to wrap +them in |"|. +\begin{math-function}{anglebetween("\mvar{p1}", "\mvar{p2}")}\mathcommand + Return the angle between the centers of the nodes \mvar{p1} and \mvar{p2}. +\end{math-function} +\begin{math-function}{qanglebetween("\mvar{p}")}\mathcommand + Return the angle between the origin and the center of the node \mvar{p}. +\end{math-function} +\begin{math-function}{distancebetween("\mvar{p1}", "\mvar{p2}")}\mathcommand + Return the distance (in pt) between the centers of the nodes \mvar{p1} and \mvar{p2}. +\end{math-function} +\begin{math-function}{qdistancebetween("\mvar{p}")}\mathcommand + Return the distance (in pt) between the origin and the center of the node \mvar{p}. +\end{math-function} +\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{calc,misc,through}] +\begin{tikzpicture} +\path (0,0) coordinate (A) + (0:4) coordinate (B) +(75:4) coordinate (C); +\draw (A) -- (B) -- (C) -- cycle; +\foreach \cnt in {1,...,4}{ + \pgfmathsetmacro\triA{distancebetween("B","C")} + \pgfmathsetmacro\triB{distancebetween("C","A")} + \pgfmathsetmacro\triC{distancebetween("A","B")} + \path (barycentric cs:A=\triA,B=\triB,C=\triC) coordinate (M) + node [draw, circle through=($(A)!(M)!(C)$)] (M) {}; + \draw ($(C)-(A)$) coordinate (vecB) + (M.75-90) coordinate (@) + (intersection of @--[shift=(vecB)]@ and B--C) coordinate (C) -- + (intersection of @--[shift=(vecB)]@ and B--A) coordinate (A);} +\end{tikzpicture} +\end{codeexample} +\section{PGFkeys} + +\subsection{Conditionals} + +\begin{key}{/utils/if=\meta{cond}\meta{true}\opt{\meta{false}}} + This key checks the conditional \meta{cond} and applies the styles \meta{true} + if \meta{cond} is true, otherwise \meta{false}. + \meta{cond} can be anything that PGFmath understands. + + As a side effect on how PGFkeys parses argument, the \meta{false} argument is + actually optional. +\end{key} + +The following keys use \TeX' macros |\if|, |\ifx|, |\ifnum| and |\ifdim| for faster +executions. + +\begin{key}{/utils/TeX/if=\meta{token A}\meta{token B}\meta{true}\opt{\meta{false}}} + This key checks via |\if| if \meta{token A} matches \meta{token B} + and applies the styles \meta{true} if it does, otherwise \meta{false}. + + As a side effect on how PGFkeys parses argument, the \meta{false} argument is + actually optional. +\end{key} + +\begin{key}{/utils/TeX/ifx=\meta{token A}\meta{token B}\meta{true}\opt{\meta{false}}} + As above. +\end{key} + +\begin{key}{/utils/TeX/ifnum=\meta{num cond}\meta{true}\\opt{\meta{false}}} + This key checks |\ifnum|\meta{num cond} + and applies the styles \meta{true} if true, otherwise \meta{false}. + A delimiting |\relax| will be inserted after \meta{num cond}. + + As a side effect on how PGFkeys parses argument, the \meta{false} argument is + actually optional. +\end{key} + +\begin{key}{/utils/TeX/ifdim=\meta{dim cond}\meta{true}\opt{\meta{false}}} + As above. +\end{key} + +\begin{key}{/utils/TeX/ifempty=\meta{Text}\meta{true}\opt{\meta{false}}} + This checks whether \meta{Text} is empty and applies styles \meta{true} if true, + otherwise \meta{false}. +\end{key} + + +\subsection{Handlers} + +While already a lot of values given to keys are evaluated by PGFmath at some point, +not all of them are. + +\begin{handler}{{.pgfmath}|=|\meta{eval}} + This handler evaluates \meta{eval} before it is handed to the key. +\end{handler} + +\begin{handler}{{.pgfmath int}|=|\meta{eval}} + As above but truncates the result. +\end{handler} + +\begin{handler}{{.pgfmath strcat}|=|\meta{eval}} + As above but uses the |strcat| function. + + In the example below, one could have used the |/pgf/foreach/evaluate| key from |\foreach|. +\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{misc}] +\tikz\foreach \i in {0,10,...,100} + \draw[line width=+.2cm, color/.pgfmath strcat={"red!",sqrt(\i)*10,"!blue"}] + (0,\i/50) -- +(right:3); +\end{codeexample} +\end{handler} + +\begin{handler}{{.List}|=|\meta{\meta{e1}, \meta{e2}, \dots, \meta{en}}} + This handler evaluates the given list with |\foreach| and concatenates the element and + the result is then given to the used key. +\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{fit,misc}] +\begin{tikzpicture}[nodes={draw, dashed, inner sep=+10pt}] + \foreach \point [count=\cnt] in {(0,0), (0,2), (2,0), (2,2), (3,3), (-1,-1)} + \fill \point circle[radius=.1] coordinate (point-\cnt); + \node[gray, fit/.List={(point-1),(point-...),(point-4)}] {}; + \node[red, fit/.List={(point-1),(point-...),(point-5)}] {}; + \node[blue, fit/.List={(point-1),(point-...),(point-6)}] {}; +\end{tikzpicture} +\end{codeexample} +\end{handler} +\begin{center} +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}] +\tikzset{ + mynode/.style={ + circle, minimum size=10mm, draw, densely dashdotted, thick, + decide color/.expand once=#1}, + decide color/.style 2 args={ + /utils/TeX/if=c#1 + {/utils/TeX/ifnum={#2<5}{bluelight}{bluedark}} + {/utils/TeX/ifnum={#2<8}{light}{dark}}}, + light/.style={fill=gray!20}, bluelight/.style={fill=blue!10}, + dark/.style ={fill=gray!60}, bluedark/.style ={fill=blue!30}} +\tikz\graph[ + spring electrical layout, vertical=c2 to p13, + node distance=1.5cm, typeset=$n_{\tikzgraphnodetext}$, + nodes={mynode=\tikzgraphnodetext}] { + % outer ring + c2 -- {p1, p11, p6}; + p1 -- {p8, c6, p11}; + p8 -- {p3, p10, c6}; + p3 -- {p13, p15, p10}; + p13 -- {p15, c7}; + c7 -- {c3, c4, p15}; + c3 -- {p14, c4}; + p14 -- {p7, c4}; + p7 -- {p9, p2, c4}; + p9 -- {c5, p12, p2}; + c5 -- {c1, p4, p12}; + c1 -- {p6, p4}; + p6 -- {p11, p4}; + % inner ring + p11 -- {c6, p12, p4}; + p5 -- {c6 -- {p10, p12}, p10 -- p15, p15 -- c4, c4 -- p2, p2 -- p12, p12 -- p4}; +}; +\end{codeexample} +\end{center} + +\section{PGFfor} + +Instead of |\foreach \var in {start, start + delta, ..., end}| one can use +|\foreach \var[use int=start to end step delta]|. + +\begin{key}{/pgf/foreach/use int=\meta{start}|to|\meta{end}\opt{|step|\meta{delta}}} +The values \meta{start}, \meta{end} and \meta{delta} are evaluates by PGFmath at initialization. +The part |step |\meta{delta} is optional (\meta{delta} = 1). +\end{key} + +\begin{key}{/pgf/foreach/use float=\meta{start}| o|\meta{end}opt{|step|\meta{delta}}} +Same as above, however the results are not truncated. +\end{key} + +%TODO: edges to and edges through +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex new file mode 100644 index 0000000000..f219f34691 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex @@ -0,0 +1,107 @@ +% !TeX root = tikz-ext-manual.tex +% !TeX spellcheck = en_US +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\section{Arc \emph{to} a point} +\label{library:paths.arcto} + +\begin{tikzlibrary}{paths.arcto} + This library adds new path specifications |arc to| that specifies an arc \emph{to} a point~-- + without the user having to specify any angles. +\end{tikzlibrary} + +\begin{codeexample}[width=.5\linewidth,preamble=\usetikzlibrary{paths.arcto}] +\begin{tikzpicture}[ultra thick,dot/.style={label={#1}}] +\coordinate[dot=below left:$a$] (a) at (0,0); +\coordinate[dot=above right:$b$] (b) at (2,3); +\begin{scope}[ + radius=3, + nodes={ + shape=circle, + fill=white, + fill opacity=.9, + text opacity=1, + inner sep=+0pt, + sloped, + allow upside down + }] +\draw[blue] (a) arc to[] + node[near start] {.25} node {.5} node[near end] {.75} (b); +\draw[red] (a) arc to[clockwise] + node[near start] {.25} node {.5} node[near end] {.75} (b); +\draw[blue!50] (a) arc to[large] + node[near start] {.25} node {.5} node[near end] {.75} (b); +\draw[red!50] (a) arc to[large, clockwise] + node[near start] {.25} node {.5} node[near end] {.75} (b); +\end{scope} + +\fill[radius=2pt] (a) circle[] (b) circle[]; +\end{tikzpicture} +\end{codeexample} + +\begin{pathoperation}{arc to}{\opt{\oarg{options}}\meta{coordinate or cycle}} +When this operation is used, the path gets extended by an arc that goes through +the current point and \meta{coordinate}. + +For two points there exist two circles or four arcs that go through or connect +these two points. Which one of these is constructed is determined by the following +options that can be used inside of \meta{options}. + +\begin{stylekey}{/tikz/arc to/clockwise} + This constructs an arc that goes clockwise. +\end{stylekey} + +\begin{stylekey}{/tikz/arc to/counter clockwise} + This constructs an arc that goes counter clockwise. + + This is the default. +\end{stylekey} + +\begin{stylekey}{/tikz/arc to/large} + This constructs an arc whose angle is larger than $180^\circ$. +\end{stylekey} + +\begin{stylekey}{/tikz/arc to/small} + This constructs an arc whose angle is smaller than $180^\circ$. +\end{stylekey} + +\begin{key}{/tikz/arc to/rotate=\meta{degree}} + Rotates the arc by \meta{degree}. + This only takes effect when |x radius| and |y radius| is different. +\end{key} + +\begin{key}{/tikz/arc to/x radius=\meta{value}} + This forwards the \meta{value} to |/tikz/x radius|. +\end{key} + +\begin{key}{/tikz/arc to/y radius=\meta{value}} + This forwards the \meta{value} to |/tikz/y radius|. +\end{key} + +\begin{key}{/tikz/arc to/radius=\meta{value}} + This forwards the \meta{value} to both |/tikz/x radius| and |/tikz/y radius|. +\end{key} + +\begin{stylekey}{/tikz/every arc to} + After |/tikz/every arc| this will also be applied before any \meta{options} are set. +\end{stylekey} + +It should be noted that this uses |\pgfpatharcto| where the \tikzname\space manual warns of: +\begin{quote}\itshape + The internal computations necessary for this command are numerically very unstable. + In particular, the arc will not always really end at the \meta{target coordinate}, + but may be off by up to several points. + A more precise positioning is currently infeasible due to \TeX's numerical weaknesses. + The only case it works quite nicely is when the resulting angle is a multiple of $90^\circ$. +\end{quote} + +The |arc to| path operation will also work only in the |canvas| coordinate system. +The lengths of the vectors $(1, 0)$ and $(0, 1)$ will be used for the calculation of the radii +but no further consideration is done. +\end{pathoperation}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex new file mode 100644 index 0000000000..32adea7af0 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex @@ -0,0 +1,138 @@ +% !TeX root = tikz-ext-manual.tex +% !TeX spellcheck = en_US +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\section{More Horizontal and Vertical Lines} +\label{library:paths.ortho} + +\begin{tikzlibrary}{paths.ortho} + This library adds new path specifications \verb!|-|!, \verb!-|-! as well as + |r-ud|, |r-du|, |r-lr| and |r-rl|. +\end{tikzlibrary} + +\subsection{Zig-Zag} +Similar to the path operations \verb!|-! and \verb!-|! this library adds +the path operations \verb!|-|! and \verb!-|-!. +{\catcode`\|=12 +\begin{pathoperation}[noindex]{|-|}{\opt{\oarg{options}}\meta{coordinate or cycle}} + \index{---1@\protect\texttt{\protect\pgfmanualbar-\protect\pgfmanualbar} path operation}% + \index{Path operations!---1@\protect\texttt{\protect\pgfmanualbar-\protect\pgfmanualbar}}% + \pgfmanualpdflabel[\catcode`\|=12 ]{|-|}{}% + This operation means ``first vertical, then horizontal and then vertical again''. +\end{pathoperation} +\begin{pathoperation}[noindex]{-|-}{\opt{\oarg{options}}\meta{coordinate or cycle}} + \index{--1@\protect\texttt{-\protect\pgfmanualbar-} path operation}% + \index{Path operations!--1@\protect\texttt{-\protect\pgfmanualbar-}}% + \pgfmanualpdflabel[\catcode`\|=12 ]{-|-}{}% + This operation means ``first horizontal, then vertical and then horizontal again''. +\end{pathoperation} +} +\begin{key}{/tikz/hvvh/ratio=\meta{ratio} (initially 0.5)} + This sets the ratio for the middle part of the Zig-Zag connection. + + For values $\meta{ratio} < 0$ and $\meta{ratio} > 1$ the Zig-Zag lines will + look more like Zig-Zig lines. + \begin{codeexample}[preamble=\usetikzlibrary{paths.ortho}] +\begin{tikzpicture}[very thick] +\draw[help lines] (-.25, -1.25) grid (2.25, 1.25); +\draw (0, 0) -|- (2, 1) -- + (2, 0) -|-[ratio=.25] (0,-1) -- cycle; +\end{tikzpicture} + \end{codeexample} +\end{key} +%TODO: hvvh/distance needs fixing. +\begin{key}{/tikz/hvvh/distance=\meta{distance}} + This sets the distance between the start point + and the middle part of the Zig-Zag connection. + + For values $\meta{distance} < 0$ the distance will be used for the target coordinate. +\begin{codeexample}[width=8cm,preamble=\usetikzlibrary{paths.ortho}] +\begin{tikzpicture}[very thick,-latex] +\draw[help lines,-] (-.25, -.25) grid (5.25, 3.25); +\draw (0, 0) -|-[distance= .5cm] ++(2, 1); +\draw (0, 1.5) -|-[distance=-.5cm] ++(2, 1); + +\tikzset{xshift=3cm} +\draw (2, 1) -|-[distance= .5cm] ++(-2, -1); +\draw (2, 2.5) -|-[distance=-.5cm] ++(-2, -1); +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/tikz/hvvh/from center=\opt{\meta{true or false}} (initially false, default true)} + When nodes get connected the placement of the middle part of the Zig-Zag + and the Zig-Zig (see below) connections will be calculated from the border + of these nodes. + The middle part of the connections can be calculated from the nodes' center + if this key is set to |true|. +\end{key} + +New timers are setup for both the Zig-Zag and the Zig-Zig connections, +these can be configured through the following keys. +\begin{codeexample}[width=8cm,preamble=\usetikzlibrary{paths.ortho}] +\tikz \draw (0,0) -|- (2,3) + foreach \p in {0.0, 0.25, 0.5, 0.75, 1.0}{ + node [pos=\p] {\p}}; +\end{codeexample} +\begin{key}{/tikz/hvvh/spacing=\meta{number} (initially 4)} + Unless $\meta{number} = 0$ is set + \begin{itemize} + \item |pos = 0| will be at the start, + \item |pos = 1| will be at the end, + \item |pos = |$\frac{1}{\meta{number}}$ will be at the first kink, + \item |pos = |$\frac{\meta{number}-1}{\meta{number}}$ will be at the second kink and + \item |pos = .5| will be in the middle of the middle part of the connection. + \end{itemize} + + If $\meta{number} = 0$ then + \begin{itemize} + \item |pos = -1| will be at the start, + \item |pos = 2| will be at the end, + \item |pos = 0| will be at the first kink, + \item |pos = 1| will be at the second kink and + \item |pos = .5| will still be in the middle of the middle part of the connection. + \end{itemize} +\end{key} +\begin{key}{/tikz/hvvh/middle 0 to 1} + This is an alias for |spacing = 0|. +\end{key} + +\subsection{Zig-Zig} +\begin{pathoperation}{r-ud}{\opt{\oarg{options}}\meta{coordinate or cycle}} + This operation means ``first up, then horizontal and then down''. + \begin{key}{/tikz/udlr/ud distance=\meta{length} (initially .5cm)} + This sets the distance between the start and the horizontal line to \meta{length}. + \end{key} +\end{pathoperation} +\begin{pathoperation}{r-du}{\opt{\oarg{options}}\meta{coordinate or cycle}} + This operation means ``first down, then horizontal and then up''. + \begin{key}{/tikz/udlr/du distance=\meta{length} (initially .5cm)} + This sets the distance between the start and the horizontal line to \meta{length}. + \end{key} +\end{pathoperation} +\begin{pathoperation}{r-lr}{\opt{\oarg{options}}\meta{coordinate or cycle}} + This operation means ``left down, then vertical and then right''. + \begin{key}{/tikz/udlr/lr distance=\meta{length} (initially .5cm)} + This sets the distance between the start and the vertical line to \meta{length}. + \end{key} +\end{pathoperation} +\begin{pathoperation}{r-rl}{\opt{\oarg{options}}\meta{coordinate or cycle}} + This operation means ``first right, then vertical and then down''. + \begin{key}{/tikz/udlr/rl distance=\meta{length} (initially .5cm)} + This sets the distance between the start and the vertical line to \meta{length}. + \end{key} +\end{pathoperation} + +All distances can be set with on key. +\begin{key}{/tikz/udlr/distance=\meta{length}} + Sets all distances in the |/tikz/udlr| namespace. +\end{key} + +\begin{key}{/tikz/udlr/from center=\opt{\meta{true or false}} (initially false, default true)} + This is an alias for |/tikz/hvvh/from center|. +\end{key}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex new file mode 100644 index 0000000000..d3670726d7 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex @@ -0,0 +1,116 @@ +% !TeX root = tikz-ext-manual.tex +% !TeX spellcheck = en_US +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\makeatletter +\newenvironment{pathoperation'}[3][]{ + \begin{pgfmanualentry} + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + %\textcolor{gray}{{\ttfamily\char`\\path}\ \ \dots} + %\declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}} + }% + \ifx\pgfmanualtest\@empty% + \index{#2@\protect\texttt{#2} path operation}% + \index{Path operations!#2@\protect\texttt{#2}}% + \fi% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\makeatother +\section{Extending the Path Timers} +\label{library:timer} + +\begin{tikzlibrary}{paths.timer} + This library adds timers to the path specifications |rectangle|, |parabola|, |sin| and |cos|. +\end{tikzlibrary} + +In \tikzname, the path specification |rectangle|, |parabola|, |sin| and |cos| do not provide +their own timer, i.\,e. a node placing algorithm that is dependent on the actual path. +For |rectangle| the timer of the straight line between the rectangle's corners is used, for +the other paths, nodes, coordinates, pics, etc. are placed on the last coordinate. + +This library allows this. + +\subsection{Rectangle} +%\index{Path operations!\protect\texttt{rectangle}}% +%\index{\texttt{rectangle} path operation}% +\begin{pathoperation'}{rectangle}{}\end{pathoperation'} + +For the |rectangle| path operator, the timer starts with |pos = 0| (= |at start|) from +the starting coordinate in a counter-clockwise direction along the rectangle. +The corners will be at positions 0.0, 0.25, 0.5, 0.75 and 1.0. + +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{paths.timer}] +\begin{tikzpicture}[scale=2, every pin edge/.style={latex-, gray}] +\coordinate [label=above right:Target] (A) at (0,0); +\coordinate [label=below left:Start] (B) at (1,2); +\draw[->, help lines] ([shift=(50:.3 and .75)] .5,1) + arc[start angle=50, delta angle=340, x radius=.3, y radius=.75]; +\draw (B) rectangle (A) + foreach \pos/\ang in {at start/60, very near start/90, near start/180, pos=.375/180, + midway/180, pos=.625/270, near end/0, very near end/0, at end/0}{ + node[pin=\ang:\pos, style/.expanded=\pos]{}}; +\end{tikzpicture} +\end{codeexample} + +\subsection{Parabola} +\index{Path operations!\protect\texttt{parabola}}% +\index{\texttt{parabola} path operation}% + +For the |parabola| path operator the timer is similar to the |.. controls ..| operator. + +The position 0.5 will lie at the |bend|. +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{tikzpicture} +\draw[help lines] (-2.25, -1.25) grid (2.25, 3.25); +\draw ( 2,-1) parabola bend (0,0) (-1,3); +\draw[ultra thick] (-2,-1) parabola bend (0,0) ( 1,3) + foreach \pos in {1,...,4,6,7,...,9}{ + node[ + pos=.\pos, sloped, fill=white, font=\small, inner sep=+0pt + ] {\pos} + }; +\end{tikzpicture} +\end{codeexample} + +If no |bend| is specified half the positions will collapse into one end of the curve. + +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{tikzpicture}[every pin edge/.style={latex-, shorten <=1pt, gray}] +\draw (-2,-2) parabola (1,0) + foreach \pos in {0, 1, ..., 10} { + node [pos=\pos/10, pin={[anchor=-18*\pos+90]-18*\pos+270:\pos}]{} + }; +\end{tikzpicture} +\end{codeexample} + +\subsection{Sine/Cosine} +\index{Path operations!\protect\texttt{sin}}% +\index{Path operations!\protect\texttt{cos}}% +\index{\texttt{sin} path operation}% +\index{\texttt{cos} path operation}% + +The |sin| and |cos| path operators also allow placing of nodes along their paths. + +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{tikzpicture}[mark nodes on line/.style={insert path={ + foreach \pos in {1, ..., 9} {node[ + sloped, fill=white, font=\small, inner sep=+0pt, pos=\pos/10] {\pos}}}}] +\draw[help lines] (-2.1,-2.1) grid (2.1,0.1); +\draw (-2,-2) sin (1,0) [mark nodes on line]; +\draw[shift=(0:1)](-2,-2) cos (1,0) [mark nodes on line]; +\end{tikzpicture} +\end{codeexample} + +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex new file mode 100644 index 0000000000..2c02b157a9 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex @@ -0,0 +1,50 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\clearpage +\section{Using Images as a Pattern} +\label{library:patterns.images} + +\begin{tikzlibrary}{patterns.images} + This library allows to use an image to be used as a repeating pattern for a path. +\end{tikzlibrary} + +With this library arbitrary images (or indeed PDF documents) can be used as +a repeating pattern for the background of a path. + +This is a two-step process: +\begin{enumerate} +\item Declaring an image as an ``image-pattern''. +\item Using the ``image-pattern''. +\end{enumerate} + +\begin{command}{\pgfsetupimageaspattern\oarg{options}\marg{name}\marg{image}} +\end{command} + +\begin{key}{/tikz/image as pattern=\meta{options} (default |\{\}|)} + +\begin{codeexample}[preamble=\usetikzlibrary{patterns.images}] +\pgfsetupimageaspattern[width=.5cm]{grid}{example-image-1x1} +\tikz \node[star, minimum size=3cm, draw, + image as pattern={name=grid,options={left, bottom, y=-.5cm, rotate=45}}] {}; +\end{codeexample} +\end{key} + +\begin{key}{/tikz/image as pattern/name=\meta{name}} +Specifies the name of the ``image-pattern'' to be used. +\end{key} + +\begin{stylekey}{/tikz/image as pattern/option} +Options that's be used by the internal |\pgftext|, +only keys from |/pgf/text| should be used. +\end{stylekey} + +\begin{stylekey}{/tikz/image as pattern/options=\meta{style}} +Appends style |/tikz/image as pattern/option|. +\end{stylekey}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex new file mode 100644 index 0000000000..10b125a39b --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex @@ -0,0 +1,60 @@ +% !TeX root = tikz-ext-manual.tex +% !TeX spellcheck = en_US +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\section{Arcs through Three Points} +\label{library:topaths.arcthrough} +\begin{tikzlibrary}{topaths.arcthrough} + This library allows to use an arc defined by three points. +\end{tikzlibrary} + +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{topaths.arcthrough}] +\begin{tikzpicture} +\coordinate[label=above right:$A$] (A) at ( 3, 1); +\coordinate[label=above:$B$] (B) at ( 1, 2); +\coordinate[label=below left:$C$] (C) at (-2,-2); + +\draw[ultra thick, draw=green, fill=green!50] + (B) to[arc through={clockwise,(A)}] (C) + -- (arc through center) -- cycle; +\draw[ultra thick, draw=blue, fill=blue!50] + (B) to[arc through=(A)] (C) + -- (arc through center) -- cycle; + +\foreach \p in {A,B,C, arc through center} \fill[red] (\p) circle[radius=2pt]; +\end{tikzpicture} +\end{codeexample} + +This can only by used for circles in the |canvas| coordinate system. + +\begin{key}{/tikz/arc through/through=\meta{coordinate} (initially {(0,0)})} + The coordinate on the circle that defines~-- together with the + starting and target point~-- a circle. +\end{key} + +\begin{key}{/tikz/arc through/center suffix=\meta{suffix} (initially {})} + The |arc through| will define a coordinate named |arc through center|\meta{suffix} + so that it can referenced later. +\end{key} + +\begin{key}{/tikz/arc through/clockwise} + The resulting arc will go clockwise from the starting point to the target point. + This will not necessarily go through the |through| point. +\end{key} + +\begin{key}{/tikz/arc through/counter clockwise} + The resulting arc will go counter clockwise from the starting point to the target point. + This will not necessarily go through the |through| point. +\end{key} + +\begin{key}{/tikz/arc through=\meta{key-value}} + This key should be used with |to| or |edge|. + A parameter other than |center suffix|, |clockwise| or |counter clockwise| will + be assumed to be the |through| coordinate. +\end{key} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex new file mode 100644 index 0000000000..ef1fb70ac2 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex @@ -0,0 +1,134 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\clearpage +\section{Mirror, Mirror on the Wall} +\label{library:mirror} + +\begin{tikzlibrary}{transformations.mirror} + This library adds more transformations to \tikzname. +\end{tikzlibrary} + +As explained in section~\ref{pgflibrary:transformations}, they are two approaches to setting a mirror transformation. +As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsmatrix'' and uppercase |M| for the built-in approach. + +\subsection{Using the ``Spiegelungsmatrix''} + +\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,transformations.mirror}] +\begin{tikzpicture}[line join=round, thick, reg poly/.style={ + shape=regular polygon, regular polygon sides={#1}}] +\node[reg poly=5, minimum size=+2cm, draw, very thick] (a) {}; +\foreach \i[evaluate={\col=(\i-1)/.04}] in {1,...,5} + \node [mirror=(a.corner \i)--(a.side \i), transform shape, + reg poly=5, minimum size=+2cm, draw=red!\col!blue] {}; +\end{tikzpicture} +\end{codeexample} + +\begin{key}{/tikz/xmirror=\meta{value or coordinate}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(\text{\meta{value}}, 0)$ or \meta{coordinate}. + +\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) coordinate (m) -- (1.5, 1.25); +\draw[xmirror=(m),-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{key} + +\begin{key}{/tikz/ymirror=\meta{value or coordinate}} + Sets up a transformation that mirrors along a vertical line that goes through point $(0, \text{\meta{value}})$ or \meta{coordinate}. +\end{key} + + +\begin{key}{/tikz/mirror x=\meta{coordinate}} + Similar to |/tikz/xmirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. +\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{tikzpicture}[x=.5cm, y=(45:1cm)] + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) coordinate (m) -- (1.5, 1.25); + +\draw[ xmirror=(m), -latex, red, dotted] (0,0) .. controls (.5,1) .. (1,1); +\draw[mirror x=(m), -latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{key} + +\begin{key}{/tikz/mirror y=\meta{coordinate}} + Similar to |/tikz/ymirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. +\end{key} + + +\begin{key}{/tikz/mirror=\meta{point A}|--|\meta{point B}} + Sets up a transformation that mirrors along a line that goes through \meta{point A} and \meta{point B}. + + When only \meta{point A} is given that line goes through \meta{point A} and the origin. +\end{key} + +\subsection{Using built-in transformations} + +\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,transformations.mirror}] +\begin{tikzpicture}[line join=round, thick, reg poly/.style={ + shape=regular polygon, regular polygon sides={#1}}] +\node[reg poly=5, minimum size=+2cm, draw, very thick] (a) {}; +\foreach \i[evaluate={\col=(\i-1)/.04}] in {1,...,5} + \node [Mirror=(a.corner \i)--(a.side \i), transform shape, + reg poly=5, minimum size=+2cm, draw=red!\col!blue] {}; +\end{tikzpicture} +\end{codeexample} + +\begin{key}{/tikz/xMirror=\meta{value or coordinate}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(\text{\meta{value}}, 0)$ or \meta{coordinate}. + +\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) coordinate (m) -- (1.5, 1.25); +\draw[xMirror=(m),-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{key} + +\begin{key}{/tikz/yMirror=\meta{value or coordinate}} + Sets up a transformation that mirrors along a vertical line that goes through point $(0, \text{\meta{value}})$ or \meta{coordinate}. +\end{key} + + +\begin{key}{/tikz/Mirror x=\meta{coordinate}} + Similar to |/tikz/xMirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. +\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{tikzpicture}[x=.5cm, y=(45:1cm)] + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) coordinate (m) -- (1.5, 1.25); + +\draw[ xMirror=(m), -latex, red, dotted] (0,0) .. controls (.5,1) .. (1,1); +\draw[Mirror x=(m), -latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{key} + +\begin{key}{/tikz/Mirror y=\meta{coordinate}} + Similar to |/tikz/yMirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. +\end{key} + + +\begin{key}{/tikz/Mirror=\meta{point A}\opt{|--|\meta{point B}}} + Sets up a transformation that mirrors along a line that goes through \meta{point A} and \meta{point B}. + + When only \meta{point A} is given that line goes through \meta{point A} and the origin. +\end{key} + +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex new file mode 100644 index 0000000000..10deb02792 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex @@ -0,0 +1,127 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\newcommand*\tikzextname{Ti\textit kZ-Extensions} +\newcommand*\tikzextversion{0.1} + +%\includeonly{ +% tikz-ext-manual-en-library-paths.arcto, +% tikz-ext-manual-en-library-paths.ortho, +% tikz-ext-manual-en-library-paths.timer, +% tikz-ext-manual-en-library-patterns.images, +% tikz-ext-manual-en-library-topaths.arcthrough, +% tikz-ext-manual-en-library-trans, +% tikz-ext-manual-en-pgf-trans, +% tikz-ext-manual-en-library-misc, +%} +\begin{document} + +\title{\bfseries The \tikzextname\space Package\\ + \large Manual for version \tikzextversion\\[1mm] +\large\href{https://github.com/Qrrbrbirlbel/tikz-extensions}{\texttt{https://github.com/Qrrbrbirlbel/tikz-extensions}} +\author{Qrrbrbirlbel}} + +\maketitle +\label{table-of-contents} + +\tableofcontents + + +\include{tikz-ext-manual-en-intro} + +\part{\tikzname\space Libraries} +\label{part:tikz} + +These libraries only work with \tikzname. +\vspace{1em} +\begin{center} +\begin{tikzpicture}[ + very thick, + scale=2.7, + grow cyclic, + level distance=1cm, + level/.style={ + level distance/.expanded=\ifnum#1>1 \tikzleveldistance/1.5\else\tikzleveldistance\fi, + nodes/.expanded={\ifodd#1 fill\else fill=none\fi} + }, + level 1/.style={sibling angle=120}, + level 2/.style={sibling angle=90}, + level 3/.style={sibling angle=90}, + level 4/.style={sibling angle=45}, + nodes={circle,draw,inner sep=+0pt, minimum size=+5pt}, + ] +\path[rotate=30] + node {} + child foreach \cntI in {1,...,3} { + node {} + child foreach \cntII in {1,...,2} { + node {} + child foreach \cntIII in {1,...,2} { + node {} + child foreach \cntIV in {1,...,2} { + node {} + child foreach \cntV in {1,...,2} {} + } + } + } + }; +\end{tikzpicture} +\end{center} + +\include{tikz-ext-manual-en-library-paths.arcto} +\include{tikz-ext-manual-en-library-paths.ortho} +\include{tikz-ext-manual-en-library-paths.timer} +\include{tikz-ext-manual-en-library-patterns.images} +\include{tikz-ext-manual-en-library-topaths.arcthrough} +\include{tikz-ext-manual-en-library-trans} + +\part{PGF Libraries} +\label{part:pgf} +These libraries (should) work with both PGF and \tikzname. + +\include{tikz-ext-manual-en-pgf-trans} + +\part{Miscellaneous} + +\label{part:misc} +\vfill +\begin{codeexample}[width=6cm, preamble=\usetikzlibrary{misc}] +\begin{tikzpicture}[ + declare function={bigR(\n)=smallR+.05*\n;}, + declare constant={smallR=1; segments=20;}, + full arc=segments] +\foreach \iN[evaluate={\endRadius=bigR(\iN+1);}, use int=0 to segments-1] + \filldraw[fill=gray!50] (\iN R:\endRadius) + arc [radius=\endRadius, start angle=\iN R, delta angle=+1R] -- (\iN R+1R:smallR) + arc [radius=smallR, end angle=\iN R, delta angle=-1R] -- cycle; + +\node {$\phi^2$}; +\node at (north west:{sqrt 2 * bigR(segments/2)}) {$\{\Omega\}_{i=1}^n$}; +\node[rotate=-.5R, right] at (-.5R: bigR segments) {$\partial \varphi$}; + +\tikzset{yshift=-5cm, declare constant={segments=25;}, full arc=segments} +\filldraw[fill=gray!50] (right:smallR) + \foreach \iN[evaluate={\endRadius=bigR(\iN+1);}, use int=0 to segments-1] { + -- (\iN R:\endRadius) arc[radius=\endRadius, start angle=\iN R, delta angle=1R]} + -- (right:smallR) arc[radius=smallR, start angle=0, delta angle=-360]; + +\node {$\phi^2$}; +\node at (north west:{sqrt 2 * bigR(segments/2)}) {$\{\Omega\}_{i=1}^n$}; +\node[rotate=-.5R, right] at (-.5R: bigR segments) {$\partial \varphi$}; +\end{tikzpicture} +\end{codeexample} +\vfill + +\include{tikz-ext-manual-en-library-misc} + +%%% END +\printindex + +%\typeout{Examples: \the\codeexamplecount}% +\end{document}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex new file mode 100644 index 0000000000..a1897bbf70 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex @@ -0,0 +1,105 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\usepackage[version=latest]{pgf} + +\usepackage{xkeyval,calc,listings,tikz,fp} + +\usepackage{imakeidx} +\makeindex +\usepackage{hyperref} +\hypersetup{% + colorlinks=false, % use true to enable colors below: + linkcolor=blue,%red, + filecolor=blue,%magenta, + urlcolor=blue,%cyan, + citecolor=blue, + pdfborder=0 0 0, +} + +\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead,columnsep=1cm]{geometry} +\usepackage{amsmath,amssymb} +\usepackage{xxcolor} +\usepackage{pifont} + +\usepackage[T1]{fontenc} +% Promote `Missing character` reports to full errors +% require texlive 2021 or above +\tracinglostchars=3 + +\input{pgfmanual-en-macros} + +\usepackage{unicode-math} +\setmathfont[Scale=MatchUppercase]{libertinusmath-regular.otf} +\usepackage[ttscale=.85]{libertine} +\setmonofont[Scale=0.8]{Bitstream Vera Sans Mono} + +\makeatletter +\renewcommand*\l@section[2]{% + \ifnum \c@tocdepth >\z@ + \addpenalty\@secpenalty + \addvspace{1.0em \@plus\p@}% + \setlength\@tempdima{2.5em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode \bfseries + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par + \endgroup + \fi} +\renewcommand*\l@subsection{\@dottedtocline{2}{2.5em}{3.3em}} +\renewcommand*\l@subsubsection{\@dottedtocline{3}{5.8em}{4.2em}} +\def\@pnumwidth{2.2em} +\makeatother + +% Global styles: +\tikzset{ + every plot/.style={prefix=plots/pgf-}, + shape example/.style={ + color=black!30, + draw, + fill=yellow!30, + line width=.5cm, + inner xsep=2.5cm, + inner ysep=0.5cm} +} + +% Detect changed labels +% by David Carlisle https://tex.stackexchange.com/a/169245 +\makeatletter +\def\@testdef#1#2#3{% + \def\reserved@a{#3}% + \expandafter\ifx\csname #1@#2\endcsname\reserved@a\else + \typeout{^^JLabel `#2' changed:^^J\meaning\reserved@a^^J\expandafter\meaning\csname #1@#2\endcsname^^J}% + \@tempswatrue + \fi} +\makeatother + +\usetikzlibrary{ + misc, + paths.arcto, + paths.ortho, + paths.timer, + patterns.images, + topaths.arcthrough, + transformations.mirror, + % + calc, + fit, + shapes.geometric, + through, + trees, +} + +%% needs Lua! +\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{force} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex new file mode 100644 index 0000000000..3788e0c9a4 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex @@ -0,0 +1,157 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\section{Transformations: Mirroring} +\label{pgflibrary:transformations} + +\begin{pgflibrary}{transformations.mirror} + This library adds mirror transformations to PGF. +\end{pgflibrary} + +Two approaches to mirror transformation exist: +\begin{enumerate} +\item Using the ``Spiegelmatrix`` (see section~\ref{pgflibrary:transformations:spiegelungsmatrix}). + + This depends on |\pgfpointnormalised| which involves the sine and the cosine functions of PGFmath. + +\item Using built-in transformations (see section~\ref{pgflibrary:transformations:builtin}). + + This depends on |\pgfmathanglebetween| which involves the arctangent (|atan2|) function of PGFmath. +\end{enumerate} + +Which one is better? I don't know. +Choose one you're comfortable with. + +\subsection{Using the ``Spiegelungsmatrix''} +\label{pgflibrary:transformations:spiegelungsmatrix} + +The following commands use the ``Spiegelungsmatrix'' that sets the transformation matrix following +\begin{equation*} + A = \frac{1}{\Vert\vec l\Vert^2} \begin{bmatrix} + l_x^2-l_y^2 & 2l_xl_y \\ + 2l_xl_y & l_y^2-l_x^2\\ + \end{bmatrix}. +\end{equation*} + + +\begin{command}{\pgftransformxmirror\marg{value}} + Sets up a transformation that mirrors along a vertical line that goes through point $(\text{\meta{value}}, 0)$. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) -- (1.5, 1.25); +\pgftransformxmirror{1.5} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + +\begin{command}{\pgftransformymirror\marg{value}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. +\end{command} + +\begin{command}{\pgftransformmirror\marg{point A}\marg{point B}} + Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (0, -1) -- (2, 0); +\pgftransformmirror{\pgfpointxy{0}{-1}}{\pgfpointxy{2}{0}} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + +\begin{command}{\pgfqtransformmirror\marg{point A}} + Sets up a transformation that mirrors along the line that goes through the origin and \meta{point A}. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-.25, -.25) grid (2.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (0, 0) -- (2, 1); +\pgfqtransformmirror{\pgfpointxy{2}{1}} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + + +\subsection{Using built-in transformations} +\label{pgflibrary:transformations:builtin} + +The following commands use a combination of shifting, rotating, $-1$ scaling, rotating back and shifting back to reach the mirror transformation. + +The commands are named the same as above, only the |m| in |mirror| is capitalized. + + +\begin{command}{\pgftransformxMirror\marg{value}} + Sets up a transformation that mirrors along a vertical line that goes through point $(\text{\meta{value}}, 0)$. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (1.5, -.25) -- (1.5, 1.25); +\pgftransformxMirror{1.5} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + +\begin{command}{\pgftransformyMirror\marg{value}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. +\end{command} + +\begin{command}{\pgftransformMirror\marg{point A}\marg{point B}} + Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (0, -1) -- (2, 0); +\pgftransformMirror{\pgfpointxy{0}{-1}}{\pgfpointxy{2}{0}} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + +\begin{command}{\pgfqtransformMirror\marg{point A}} + Sets up a transformation that mirrors along the line that goes through the origin and \meta{point A}. + +\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] +\begin{tikzpicture} +\draw[help lines] (-.25, -.25) grid (2.25, 1.25); +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); + +\draw[dashed] (0, 0) -- (2, 1); +\pgfqtransformMirror{\pgfpointxy{2}{1}} + +\draw[-latex] (0,0) .. controls (.5,1) .. (1,1); +\end{tikzpicture} +\end{codeexample} +\end{command} + +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf Binary files differnew file mode 100644 index 0000000000..57ce1debf8 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex new file mode 100644 index 0000000000..1b9754d629 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex @@ -0,0 +1,31 @@ +% !TeX TS-program = lualatex +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% arara: lualatex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\documentclass[a4paper,doc2,landscape]{ltxdoc} + +\input{tikz-ext-manual-en-main-preamble.tex} +\usetikzlibrary{external} +\newif\iftikzextmanualexternalize +\tikzextmanualexternalizetrue +\iftikzextmanualexternalize + \tikzexternalize[ + prefix=doc/tikz/, + mode=graphics if exists, + %mode=list and make, + %mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text. + ] + \tikzifexternalizing{% + \pgfkeys{/pdflinks/codeexample links=false}% + }{}% +\fi + +\input{tikz-ext-manual-en-main-body.tex} diff --git a/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex new file mode 100644 index 0000000000..4d962ccb1c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex @@ -0,0 +1,96 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\pgftransformxmirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformmirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformymirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformmirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} +\def\pgftransformmirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfpointnormalised{\pgfpointdiff{\pgf@tempa}{#2}}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgf@tempa}% + \pgftransformshift{\pgfpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformmirror#1{% + \pgfpointnormalised{#1}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgfpointorigin}% +} + +% Using existant transformation (shift, rotate, yscale=-1, rotate back, shift back) +\def\pgftransformxMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformMirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformyMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformMirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} + +\def\pgftransformMirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfmathanglebetweenpoints{\pgf@tempa}{#2}% + \let\pgf@temp\pgfmathresult + \pgftransformshift{\pgf@tempa}% + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% + \pgftransformshift{\pgfqpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformMirror#1{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{#1}% + \let\pgf@temp\pgfmathresult + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% +} +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex new file mode 100644 index 0000000000..b68520081c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex @@ -0,0 +1,251 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +%% full arc +%% https://tex.stackexchange.com/a/144297/16595 +%% The postfix operator R is added to PGFmath, +%% it allows the use of angular segments. +%% full arc = 10 makes it so that +%% 1R = 36° +%% 2R = 72° +%% … +%% 10R = 360° +%% Calling the full arc key with an empty value +%% makes 1R = 1° +\pgfset{full arc/.code=% + \def\pgf@temp{#1}% + \ifx\pgfutil@empty\pgf@temp + \let\pgfmath@fullarc@factor\pgfutil@empty + \else + \pgfmathsetmacro\pgfmath@fullarc@factor{360/(#1)}% + \fi,full arc=} +\pgfmathdeclareoperator{R}{full arc}{1}{postfix}{950} +\pgfmathdeclarefunction{full arc}{1}{% + \begingroup + \pgfmath@x=#1pt\relax + \ifx\pgfmath@fullarc@factor\pgfutil@empty\else + \pgfmath@x\pgfmath@fullarc@factor\pgfmath@x + \fi + \pgfmath@returnone\pgfmath@x + \endgroup} + +%% foreach +%% http://tex.stackexchange.com/a/126418/16595 +%% instead of \foreach \var in {start, start + delta, ..., end} +%% this allows to use \foreach[use int={start to end step delta}] without(!) a list in {} +%% the values start, end and delta are evaluated by PGFmath at the start of the loop. +%% In addition to use int, there's also use float. +\newif\ifqrr@pgf@foreach@no@list +\pgfqkeys{/pgf/foreach}{ + use int/.code={% + \qrr@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop + }, + use float/.code={% + \qrr@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop + } +} + +\def\qrr@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% + \qrr@pgf@foreach@no@listtrue + #1\foreachStart{#2}% + \pgfutil@in@{step}{#3} + \ifpgfutil@in@ + \qrr@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop + \else + \qrr@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop + \fi + \edef\qrr@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% +} +\def\qrr@pgf@foreach@no@list@parse@step#1#2step#3\pgffor@stop{% + #1\foreachEnd{#2}% + #1\foreachSecond{\foreachStart+#3}% +} +\def\pgffor@vars{% manually extended, better etoolbox + \pgfutil@ifnextchar i{\pgffor@@vars@end}{% + \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] + \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% + \ifqrr@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else + \expandafter\pgfutil@secondoftwo\fi + {\qrr@pgf@foreach@no@listfalse\pgffor@macro@list\qrr@pgf@foreach@no@list@list} + {\pgffor@@vars}}}}}% + +%% Handlers +%% .pgfmath evaluates values given to keys in PGFmath before handing them over. +%% .pgfmath int truncates the result +%% .pgfmath strcat concatenates the given values +\pgfkeys{/handlers/.pgfmath/.code=\pgfmathparse{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} +\pgfkeys{/handlers/.pgfmath int/.code=\pgfmathint{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} +\pgfkeys{/handlers/.pgfmath strcat/.code=\pgfmathstrcat{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} + +%% http://tex.stackexchange.com/a/144187/16595 +%% key/.List={(point-1),(point-2),(point-...),(point-6)} will call +%% key=(point-1)(point-2)(point-3)(point-4)(point-5),(point-6) +\pgfkeys{/handlers/.List/.code={% + \let\pgfkeys@global@temp\pgfutil@empty + \foreach \pgfkeys@temp in{#1}{ + \ifx\pgfkeys@global@temp\pgfutil@empty + \global\let\pgfkeys@global@temp\pgfkeys@temp + \else + \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter + {\pgfkeys@temp}% + \fi}% + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}}} + +%% PGFmath +%% strrepeat("x", 5) = "xxxxx" +\pgfmathdeclarefunction{strrepeat}{2}{% + \begingroup\pgfmathint{#2}\pgfmath@count\pgfmathresult + \let\pgfmathresult\pgfutil@empty + \pgfutil@loop\ifnum\pgfmath@count>0\relax + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \advance\pgfmath@count-1\relax + \pgfutil@repeat\pgfmath@smuggleone\pgfmathresult\endgroup} + +%% isInString("foo", "foobar") = true (= 1) +%% isInString("boo", "foobar") = false (= 0) +\pgfmathdeclarefunction{isInString}{2}{% + \pgfutil@in@{#1}{#2}% + \ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi} + +%% strcat("foo", "bar") = "foobar" (can have more than two parameters) +\pgfutil@IfUndefined{pgfmathstrcat@}{ + \pgfmathdeclarefunction{strcat}{...}{% + \begingroup + \let\pgfmathresult\pgfutil@empty + \pgfmathstrcat@@#1\pgfmath@stop} + \def\pgfmathstrcat@@#1{% + \ifx\pgfmath@stop#1% + \def\pgfmath@next{\pgfmath@smuggleone\pgfmathresult\endgroup} + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \let\pgfmath@next\pgfmathstrcat@@ + \fi + \pgfmath@next} +}{} + +% http://tex.stackexchange.com/questions/244569/bounding-lines-around-tax-nodes/244619#244619 +\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}} +\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}} + +%% http://tex.stackexchange.com/a/132939/16595 +\tikzset{ + @edges through/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges through/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges through/.@cmd}[]}#1\pgfeov}}}, + @@edges through/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2) (#2)}}, + edges through/.style={/tikz/@edges through/.list={#1}}} +\tikzset{ + @edges to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges to/.@cmd}[]}#1\pgfeov}}}, + @@edges to/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2)}}, + edges to/.style={/tikz/@edges to/.list={#1}}} +\tikzset{ + @tos to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@tos to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@tos to/.@cmd}[]}#1\pgfeov}}}, + @@tos to/.style args={[#1]#2}{/tikz/insert path={to[#1] (#2)}}, + tos to/.style={/tikz/@tos to/.list={#1}}} + + +\pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} +\pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfmathdeclarefunction{qanglebetween}{1}{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} + +\pgfmathdeclarefunction{anglebetween}{2}{% + \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} + +\pgfmathdeclarefunction{isEmpty}{1}{% + \begingroup + \edef\pgfmath@temp{#1}% + \pgfutil@ifxempty\pgfmath@temp{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfqkeys{/utils}{ + if/.code n args=3{% + \pgfmathparse{#1}% + \ifdim\pgfmathresult pt=0pt + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeysalso{#3}}% + {\pgfkeysalso{#2}}}, + IF/.code args={(#1)#2}{% + \pgfmathparse{#1}% + \pgfutil@in@{else}{#2}% + \ifpgfutil@in@ + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\qrr@misc@handle@else#2\pgf@stop}{\qrr@misc@handle@else#2else\pgf@stop}% + }, + TeX/if/.code n args={4}{% + \if#1#2\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifnum/.code n args={3}{% + \ifnum#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifdim/.code n args={3}{% + \ifdim#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifx/.code n args={4}{% + \ifx#1#2\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifempty/.code n args={3}{% + \edef\pgfkeys@temp{#1}% + \pgfutil@ifxempty\pgfkeys@temp{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + tex/.search also=/utils/TeX, +} +\def\qrr@misc@handle@else#1else#2\pgf@stop{% + \ifdim\pgfmathresult pt=0pt + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeysalso{#2}}% + {\pgfkeysalso{#1}}} + +\pgfset{ + declare constant/.code={% + \let\pgfmathdeclareconstant@@@\pgfutil@empty + \pgfkeysvalueof{/pgf/declare function/execute at begin function}% + \pgfmathdeclareconstant@#1@=@;\pgf@stop + \pgfkeysvalueof{/pgf/declare function/execute at end function}% + \pgfmathdeclareconstant@@@ + }} +\def\pgfmathdeclareconstant@{% + \pgfutil@ifnextchar x\pgfmathdeclareconstant@@\pgfmathdeclareconstant@@ +} +\def\pgfmathdeclareconstant@@#1=#2;#3\pgf@stop{% + \edef\pgfmath@local@temp{#1}% + \pgfutil@ifx\pgfmath@local@temp\pgfmath@local@at{}{% + \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% + \pgfmathdeclareconstant@#3\pgf@stop + }% +}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex new file mode 100644 index 0000000000..213fc1b74a --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex @@ -0,0 +1,104 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\tikzset{ + arc to/.code=\pgfqkeys{/tikz/arc to}{#1}, + arc to={ + counter clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{1}, + clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{0}, + x radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}, + y radius/.code=\pgfkeyssetvalue{/tikz/y radius}{#1}, + radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}\pgfkeyssetvalue{/tikz/y radius}{#1}, + large/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{1}, + small/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{0}, + % defaults + rotate/.initial=0, counter clockwise, small, + counter clockwise/.value forbidden, + clockwise/.value forbidden, + large/.value forbidden, + small/.value forbidden}} +\def\tikz@arcA rc{\pgfutil@ifnextchar t% + {\tikz@flush@moveto\expandafter\expandafter\expandafter\tikz@arcB@cont\expandafter\pgfutil@gobble\pgfutil@gobble} + {\tikz@flush@moveto\tikz@arc@cont}} +\def\tikz@arcB@cont{% + \pgfutil@ifnextchar[\tikz@@do@arcB{ + \advance\tikz@expandcount by -10\relax% go down quickly + \ifnum\tikz@expandcount<0\relax% + \def\@next{\tikz@@do@arcB[]}% + \else% + \def\@next{\expandafter\tikz@arcB@cont}% + \fi% + \@next}}% +\def\tikz@@do@arcB[#1]{% + \def\tikz@arcB@options{#1}% + \tikz@do@@arcB} +\def\tikz@do@@arcB{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@do@@arcB} + {\tikz@scan@one@point\tikz@do@arcB}}}} + +\def\tikz@do@arcB#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \iftikz@shapeborder + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \fi + \begingroup + \tikzset{every arc/.try,every arc to/.try,arc to/.expand once=\tikz@arcB@options}% + \pgfmathsetmacro\tikz@arc@x{\pgfkeysvalueof{/tikz/x radius}}% + \ifpgfmathunitsdeclared + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \pgfpatharcto{\tikz@arc@x pt}{\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \else + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \fi + \else + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \else + \pgf@process{\pgfpointxy{\tikz@arc@x}{0}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@x\pgfmathresult + \pgf@process{\pgfpointxy{0}{\tikz@arc@y}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@y\pgfmathresult + \pgfpatharcto{+\tikz@arc@x pt}{+\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \fi + \fi + \endgroup + % check whether \pgf@marshall starts with \pgfpathlineto + \pgfutil@ifxempty\pgf@marshal{}{% + \edef\tikz@temp{\expandafter\expandafter\expandafter\noexpand\expandafter\pgfutil@firstgobblerest\pgf@marshal\relax}% + \expandafter\let\expandafter\tikz@temp\tikz@temp + \pgfutil@ifx\tikz@temp\pgfpathlineto{}{% + % getting rid of \pgfpatharcaxes inside \pgf@marshal + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@marshal + \expandafter\expandafter\expandafter{\expandafter\pgfutil@gobble\pgf@marshal}% + % extracting the other four values needed for the timer + \edef\tikz@timer@start@angle{\expandafter\pgfutil@firstoffour\pgf@marshal}% + \edef\tikz@timer@end@angle{\expandafter\pgfutil@secondoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@zero@axis{\expandafter\pgfutil@thirdoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@ninety@axis{\expandafter\pgfutil@fourthoffour\pgf@marshal}% + % + \let\tikz@timer=\tikz@timer@arc + }% + }% + \tikz@scan@next@command +} +\def\pgfutil@firstoffour#1#2#3#4{#1} +\def\pgfutil@secondoffour#1#2#3#4{#2} +\def\pgfutil@thirdoffour#1#2#3#4{#3} +\def\pgfutil@fourthoffour#1#2#3#4{#4} +\def\pgfutil@firstgobblerest#1#2\relax{#1}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex new file mode 100644 index 0000000000..8f322fbd35 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex @@ -0,0 +1,183 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +%% For the operators r-lr, r-rl, r-ud and r-du we need to check after TikZ found r +\let\tikz@orig@rect\tikz@rect +\def\tikz@rect{\pgfutil@ifnextchar e\tikz@orig@rect\qrr@tikz@r} +\def\qrr@tikz@r -{% + \pgfutil@ifnextchar l\qrr@tikz@lr@lineto{% + \pgfutil@ifnextchar r\qrr@tikz@rl@lineto{% + \pgfutil@ifnextchar u\qrr@tikz@ud@lineto{% + \pgfutil@ifnextchar d\qrr@tikz@du@lineto\tikz@expand + }% + }% + }% +} +%% For the operator |-| we need to check after TikZ found |- +\let\tikz@orig@vh@lineto@next\tikz@vh@lineto@next +\def\tikz@vh@lineto@next{% + \pgfutil@ifnextchar|{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% + {\pgfutil@ifnextchar\tikz@activebar{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% + {\tikz@orig@vh@lineto@next}}} +%% For the operator -|- we need to check after TikZ found -| +\let\tikz@orig@hv@lineto\tikz@hv@lineto +\def\tikz@hv@lineto{% + \pgfutil@ifnextchar-{\expandafter\qrr@tikz@hvh@lineto\pgfutil@gobble}% + {\tikz@orig@hv@lineto}} + +%% |-|[<opts>] and -|-[<opts>] are allowed +\def\qrr@tikz@vhv@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next[]}} +\def\qrr@tikz@hvh@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next[]}} + +%% r-rl[<opts>], r-lr[<opts>], etc. +\def\qrr@tikz@rl@lineto rl{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next[]}} +\def\qrr@tikz@lr@lineto lr{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next[]}} +\def\qrr@tikz@du@lineto du{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next[]}} +\def\qrr@tikz@ud@lineto ud{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next[]}} + +%% TikZ interjects are done, the rest is independent: +\input tikzlibrarypaths.ortho.tex + +%% a few nice to haves, use with to or edge operator +\let\tikz@origtotarget\pgfutil@empty +\tikzset{ + node as new start/.is if=tikz@ortho@preflush, + node as new start, + horizontal vertical/.style={to path={-| (\tikztotarget) \tikztonodes}}, + vertical horizontal/.style={to path={|- (\tikztotarget) \tikztonodes}}, + horizontal vertical horizontal/.style={to path={-|- (\tikztotarget) \tikztonodes}}, + vertical horizontal vertical/.style={to path={|-| (\tikztotarget) \tikztonodes}}, + only vertical second/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@y>\tikz@lasty\relax + \edef\tikztostart{\tikztostart.north}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi + \else + \edef\tikztostart{\tikztostart.south}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikz@origtotarget\tikztotarget + \edef\tikztotarget{[xshift={#1}]\tikztotarget\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only vertical second/.default=, + only horizontal second/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@x>\tikz@lastx\relax + \edef\tikztostart{\tikztostart.east}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi + \else + \edef\tikztostart{\tikztostart.west}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikz@origtotarget\tikztotarget + \edef\tikztotarget{[yshift={#1}]\tikztotarget\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only horizontal second/.default=, + only vertical first/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \iftikz@shapeborder + \let\tikz@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@y>\tikz@lasty\relax + \edef\tikztotarget{\tikztotarget.south}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi + \else + \edef\tikztotarget{\tikztotarget.north}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[xshift={#1}]\tikztostart\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: vertical line through/.expanded={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only vertical first/.default=, + only horizontal first/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \iftikz@shapeborder + \let\tikz@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@x>\tikz@lastx\relax + \edef\tikztotarget{\tikztotarget.west}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi + \else + \edef\tikztotarget{\tikztotarget.east}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[yshift={#1}]\tikztostart\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: horizontal line through/.expanded={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only horizontal first/.default=, + only vertical first to center/.style={to path={ + \pgfextra + \let\tikz@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}, + only horizontal first to center/.style={to path={ + \pgfextra + \let\tikz@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}% +} +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex new file mode 100644 index 0000000000..2c4aae04c2 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex @@ -0,0 +1,509 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\newlength\qrr@tikz@udlr@distance +\newlength\qrr@tikz@hvvh@distance +\newif\ifqrr@tikz@hvvh@middle % checks whether spacing = 0 was selected +\newif\ifqrr@tikz@hvvh@fromcenter +\newif\iftikz@ortho@preflush +\tikz@ortho@preflushtrue +\let\tikz@origtotarget\pgfutil@empty + +%%% HVVH/UDLR +\tikzset{% + hvvh/.code={\pgfqkeys{/tikz/hvvh}{#1}},% + udlr/.code={\pgfqkeys{/tikz/udlr}{#1}},% + hvvh/.search also=/tikz,% + udlr/.search also=/tikz,% + hvvh/middle 0 to 1/.style={hvvh/spacing=0},% + hvvh/from center/.is if=qrr@tikz@hvvh@fromcenter,% + udlr/from center/.style={/tikz/hvvh/from center={#1}}, + hvvh/spacing/.code=% spacing = 0 means that the middle part are the pos-itions 0 to 1, + % the first part is -1 to 0, the last part is to 2 + \pgfmathint{#1}\let\qrr@tikz@hvvh@timing@parts\pgfmathresult% in case they are calculations to be done + \ifcase\qrr@tikz@hvvh@timing@parts\relax + \qrr@tikz@hvvh@middletrue + \def\qrr@tikz@hvvh@timing@parts{1}% + \def\qrr@tikz@hvvh@timing@first{0}% + \def\qrr@tikz@hvvh@timing@last{1}% + \def\qrr@tikz@hvvh@timing@subtr{0}% + \def\qrr@tikz@hvvh@timing@factor{1}% + \else % in all other cases n > 0 the kinks are at pos = 1/n and (n - 1)/n + \qrr@tikz@hvvh@middlefalse + \pgfmathreciprocal{#1}\let\qrr@tikz@hvvh@timing@first\pgfmathresult + \pgfmathsetmacro\qrr@tikz@hvvh@timing@last{1-\pgfmathresult}% + \pgfmathreciprocal{#1-2}% + \let\qrr@tikz@hvvh@timing@subtr\pgfmathresult + \pgfmathsetmacro\qrr@tikz@hvvh@timing@factor{1+2*\pgfmathresult}% + \fi,% + hvvh/ratio/.code=\pgfmathsetmacro\qrr@tikz@hvvh@ratio{#1},% + % TODO: not possible to do distance in TikZ coordinate system + hvvh/distance/.code=\pgfmathsetlength\qrr@tikz@hvvh@distance{#1}\let\qrr@tikz@hvvh@ratio\pgfutil@empty,% + udlr/distance/.style={% + /tikz/udlr/ud distance={#1},% + /tikz/udlr/du distance={#1},% + /tikz/udlr/lr distance={#1},% + /tikz/udlr/rl distance={#1}},% + udlr/ud distance/.initial=+.5cm,% + udlr/du distance/.initial=+.5cm,% + udlr/lr distance/.initial=+.5cm,% + udlr/rl distance/.initial=+.5cm,% + hvvh/ratio=.5,% default value + hvvh/spacing=4,% default value +}% + +%BEGIN_FOLD Timer +\def\tikz@timer@hvhline{% + \pgf@process{\tikz@timer@start}\pgf@ya\pgf@y + \pgf@process{\tikz@timer@end}\pgf@yc\pgf@y + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% + \else + \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@yc}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb\qrr@tikz@hvvh@timing@factor\pgf@xb% + \advance\pgf@xb-\qrr@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal} +\def\tikz@timer@vhvline{% + \pgf@process{\tikz@timer@start}\pgf@xa\pgf@x + \pgf@process{\tikz@timer@end}\pgf@xc\pgf@x + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% + \else + \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb by\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb=\qrr@tikz@hvvh@timing@factor\pgf@xb + \advance\pgf@xb by-\qrr@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal}% + +%% collect options and nodes, coordinates and pics onpath +\let\tikz@hvvh@currentoption\pgfutil@empty +\def\qrr@tikz@collect@hvvh@options#1[#2]{\edef\tikz@hvvh@currentoption{#2}#1} +\def\qrr@tikz@hvh@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@hvh@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@hvh@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@hvh@lineto@next}{\tikz@scan@one@point\qrr@tikz@@hvh@lineto}}}}% +\def\qrr@tikz@vhv@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@vhv@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@vhv@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@vhv@lineto@next}{\tikz@scan@one@point\qrr@tikz@@vhv@lineto}}}}% +\def\qrr@tikz@ud@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@ud@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@ud@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@ud@lineto@next}{\tikz@scan@one@point\qrr@tikz@@ud@lineto}}}}% +\def\qrr@tikz@du@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@du@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@du@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@du@lineto@next}{\tikz@scan@one@point\qrr@tikz@@du@lineto}}}}% +\def\qrr@tikz@lr@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@lr@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@lr@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@lr@lineto@next}{\tikz@scan@one@point\qrr@tikz@@lr@lineto}}}}% +\def\qrr@tikz@rl@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@rl@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@rl@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@rl@lineto@next}{\tikz@scan@one@point\qrr@tikz@@rl@lineto}}}}% + +\def\tikz@do@hvvh#1#2#3#4#5{% +% #1 = first kink +% #2 = second kink +% #3 = end +% #4 = timer +% #5 = tikz@shapeborder@name + \pgfpathlineto{#1}% + \pgfpathlineto{#2}% + \pgfpathlineto{#3}% + \def\tikz@timer@middle{#2}% + \def\tikz@timer@end{#3}% + \let\tikz@timer#4 + \edef\pgf@temp{#5}% + \ifx\pgf@temp\pgfutil@empty + \let\tikz@moveto@waiting\relax + \else + \let\tikz@moveto@waiting\pgf@temp + \fi + \tikz@scan@next@command}% + +%% -|- operator +\def\qrr@tikz@@hvh@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb=\tikz@lastx + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xb}{\tikz@lasty}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\tikz@lastx + \else + \pgf@xc\pgf@x + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + }{% + \ifqrr@tikz@hvvh@fromcenter + \qrr@tikz@hvvh@distance\tikz@lastx + \else + \qrr@tikz@hvvh@distance\pgf@x + \fi + \advance\qrr@tikz@hvvh@distance-\pgf@xc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + }% + \advance\pgf@xc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \pgf@xc\tikz@lastx + \fi + \ifdim\pgf@xb>\tikz@lastx + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + }{% + \qrr@tikz@hvvh@distance\tikz@lastx + \advance\qrr@tikz@hvvh@distance-\pgf@xc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + }% + \advance\pgf@xc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% |-| operator +\def\qrr@tikz@@vhv@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc=\tikz@lastx + \pgf@yb=\tikz@lasty + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yb}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\tikz@lasty + \else + \pgf@yc\pgf@y + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + \else + \ifqrr@tikz@hvvh@fromcenter + \qrr@tikz@hvvh@distance\tikz@lasty + \else + \qrr@tikz@hvvh@distance\pgf@y + \fi + \advance\qrr@tikz@hvvh@distance-\pgf@yc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + \fi + \advance\pgf@yc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \pgf@yc\tikz@lasty + \fi + \ifdim\pgf@yb>\tikz@lasty + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + \else + \qrr@tikz@hvvh@distance\tikz@lasty + \advance\qrr@tikz@hvvh@distance-\pgf@yc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + \fi + \advance\pgf@yc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-ud operator +\def\qrr@tikz@@ud@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/ud distance}}% + \iftikz@shapeborder + \advance\pgf@y1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc<\pgf@y + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb<\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb\qrr@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-du operator +\def\qrr@tikz@@du@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/du distance}}% + \iftikz@shapeborder + \advance\pgf@y-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc>\pgf@y + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc-\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb-\qrr@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-lr operator +\def\qrr@tikz@@lr@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/lr distance}}% + \iftikz@shapeborder + \advance\pgf@x-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc>\pgf@x + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc-\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb-\qrr@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-rl operator +\def\qrr@tikz@@rl@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/rl distance}}% + \iftikz@shapeborder% + \advance\pgf@x1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc<\pgf@x + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty% + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb<\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb\qrr@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex new file mode 100644 index 0000000000..3a4d30e68f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex @@ -0,0 +1,188 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\tikz@rectB#1{% originally from tikz.code.tex + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \let\tikz@timer\tikz@timer@rectangle% %% Timer: new timer + \tikz@@movetosave{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% + \iftikz@snaked + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \fi + \pgfpathclose + \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \def\pgfstrokehook{}% + \let\tikz@tangent\relax + \tikz@scan@next@command +}% + +\def\tikz@@sine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: saver target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@sine% %% Timer: new timer + \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@@cosine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: save target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@cosine% %% Timer: new timer + \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@timer@rectangle{% + \pgfutil@tempdima\tikz@time pt + \ifdim\pgfutil@tempdima<.5pt\else % if we're at the return pos-ition we switch start and end + \advance\pgfutil@tempdima-.5pt + \let\pgf@tempa\tikz@timer@start + \let\tikz@timer@start\tikz@timer@end + \let\tikz@timer@end\pgf@tempa + \fi + \multiply\pgfutil@tempdima2 + \edef\tikz@time{\strip@pt\pgfutil@tempdima}% + \tikz@timer@hvline}% + +\def\tikz@parabola@semifinal#1{% + \tikz@flush@moveto + % Save original start: + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@xb=\tikz@lastx + \pgf@yb=\tikz@lasty + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save target position + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \begingroup% now calculate bend: + \let\tikz@after@path\pgfutil@empty + \expandafter\tikzset\expandafter{\tikz@parabola@option}% + \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx + \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty + \advance\tikz@lastxsaved by\pgf@xb + \advance\tikz@lastysaved by\pgf@yb + \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb + \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb + \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% + \edef\tikz@timer@middle{{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save bend postion + % Calculate delta from bend + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + % Ok, now calculate delta to bend + \advance\tikz@lastx by-\pgf@xb + \advance\tikz@lasty by-\pgf@yb + \edef\tikz@marshall{% + \noexpand\let\noexpand\tikz@timer\noexpand\tikz@timer@parabola + \noexpand\edef\noexpand\tikz@timer@middle{\noexpand\pgfqpoint\tikz@timer@middle}% + \noexpand\pgfpathparabola{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \expandafter\endgroup% + \tikz@marshall + \expandafter\tikz@scan@next@command\tikz@after@path% +}% + +\def\tikz@timer@parabola{% following calculations, see \def of \pgfpathparabola in pgfcorepathconstruct.code.tex (l. 1261) + \ifdim\tikz@time pt<.5pt\relax % first part + \pgf@process{\tikz@timer@middle}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.1125\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .1125 (middle_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.225\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .225 (middle_y - start_y) + \advance\pgf@xb\pgf@x\pgf@xb.5\pgf@xb % = .5 (middle_x + start_x) = start_x + .5 (middle_x - start_x) + \pgf@xa=\tikz@time pt% + \pgf@xa=2\pgf@xa % = 2 * \tikz@time + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@middle}}% + \else % second part + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x + \pgf@xb\pgf@x + \pgf@yb\pgf@y + \pgf@process{\tikz@timer@middle}% + \advance\pgf@xc\pgf@x\pgf@xc.5\pgf@xc % = .5 (end_x + middle_x) = middle_x + .5 (end_x - middle_x) + \advance\pgf@xb-\pgf@x\pgf@xb.8875\pgf@xb + \advance\pgf@xb\pgf@x % = middle_x + .8875 (end_x - middle_x) + \advance\pgf@yb-\pgf@y\pgf@yb.775\pgf@yb + \advance\pgf@yb\pgf@y % = middle_y + .775 (end_y - middle_y) + \pgf@xa=\tikz@time pt% + \advance\pgf@xa-.5pt% + \pgf@xa=2\pgf@xa % = 2 (\tikz@zime - .5) + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@middle}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \fi + \tikz@marshall +} + +\def\tikz@timer@sine{% following calculations, see \def of \pgfpathsine in pgfcorepathconstruct.code.tex (l. 1315) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.3260\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .3260 (end_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.5120\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .5120 (end_y - start_y) + \advance\pgf@xb-\pgf@x\pgf@xb.6380\pgf@xb % = start_x + .6380 (end_x - start_x) + \advance\pgf@xb\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\def\tikz@timer@cosine{% following calculations, see \def of \pgfpathcosine in pgfcorepathconstruct.code.tex (l. 1345) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xb-\pgf@x\pgf@xb.6740\pgf@xb + \advance\pgf@xb\pgf@x % = start_x + .6740 (end_x - start_x) + \advance\pgf@yb-\pgf@y\pgf@yb.4880\pgf@yb + \advance\pgf@yb\pgf@y % = start_y + .4880 (end_y - start_y) + \advance\pgf@xc-\pgf@x\pgf@xc.3620\pgf@xc % = start_x + .3620 (end_x - start_x) + \advance\pgf@xc\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex new file mode 100644 index 0000000000..7cad25e42b --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex @@ -0,0 +1,53 @@ +% This is the TikZ library patterns.images +% Load with \usetikzlibrary{patterns.images} +% +% Macro: +% - \pgfSetupImageAsPattern[<opt arguments for \pgfdeclareimage>]{<name>}{<path/file>} +% +% Keys are: +% - use image as pattern=<name> +% - image as pattern=<opt arguments for \pgftext> + +\def\pgfsetupimageaspattern{\pgfutil@ifnextchar[\qrr@pgfsetupimageaspattern{\qrr@pgfsetupimageaspattern[]}} +\def\qrr@pgfsetupimageaspattern[#1]#2#3{% #1 = options + % #2 = image name + % #3 = file name + \pgfdeclareimage[#1]{qrr@pgf@iap@#2}{#3}% + \sbox\pgfutil@tempboxa{\pgfuseimage{qrr@pgf@iap@#2}}% + \expandafter\edef\csname qrr@pgf@iap@#2@\endcsname{{\the\wd\pgfutil@tempboxa}{\the\ht\pgfutil@tempboxa}}% +} +\tikzset{ + image as pattern/name/.initial=, + image as pattern/option/.style=, + image as pattern/options/.style={/tikz/image as pattern/option/.append style={#1}}, + image as pattern/.default=, + image as pattern/.code={ + \tikzset{image as pattern/.cd,#1} + \pgfkeysgetvalue{/tikz/image as pattern/name}\tikz@temp + \pgfutil@ifxempty\tikz@temp{% + \tikzerror{You need to specify a name for the ``image-pattern'' to be used.}% + }{% + \edef\tikz@tempa{\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% + \edef\tikz@tempb{\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% + \pgfkeysalso{/tikz/path picture={% + \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}% + \pgf@xa\pgf@x\pgf@ya\pgf@y + \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}% + \pgf@xb\pgf@x\pgf@yb\pgf@y\pgf@yc\pgf@yb + \pgfutil@loop + {% + \pgfutil@loop + \expandafter\pgftext\expandafter[/tikz/image as pattern/option,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\pgfuseimage{qrr@pgf@iap@\tikz@temp}}% + \ifdim\pgf@yb<\pgf@ya + \advance\pgf@yb\tikz@tempb + \pgfutil@repeat + }% + \ifdim\pgf@xb<\pgf@xa + \advance\pgf@xb\tikz@tempa + \pgf@yb\pgf@yc + \pgfutil@repeat + }}% + } + } +} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex new file mode 100644 index 0000000000..d90a2edc78 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex @@ -0,0 +1,50 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\pgfqkeys{/tikz/arc through}{ + .unknown/.code=\pgfkeyssetevalue{/tikz/arc through/through}{\pgfkeyscurrentname}, + through/.initial={(0,0)}, + center suffix/.initial=, + clockwise/.code=% + \def\tikz@arcthrough@clockwise{% + \pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, + counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, + clockwise/.value forbidden, counter clockwise/.value forbidden, counter clockwise} +\tikzset{ + arc through/.code={% + \tikzset{every arc through/.try}% + \pgfqkeys{/tikz/arc through}{#1}% + \pgfkeysgetvalue{/tikz/arc through/through}\tikz@temp + \pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% + \expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter + {\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% + \pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% + \pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% + \pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% + \pgfextract@process\pgf@tocenter{% + \pgfpointintersectionoflines + {\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% + {\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% + \pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/arc through/center suffix}}{\pgf@tocenter}% + \pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% + \pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% + \pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% + \pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% + \ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax + \pgfmathsubtract@{\pgfmathresult}{360}% + \fi + \pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% + \tikz@arcthrough@clockwise + \pgfkeyslet{/tikz/delta angle}\pgfutil@empty + \def\tikz@to@path{arc[]\tikztonodes}% + }% +} diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex new file mode 100644 index 0000000000..7b5b02f722 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex @@ -0,0 +1,70 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{transformations.mirror} +\tikzset{ + mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikz@trans@mirror#1\@nil + \else + \tikz@scan@one@point\pgfqtransformmirror#1\relax + \fi}, + ymirror/.code={\pgfutil@ifnextchar(\tikz@trans@ymirror@coordinate\tikz@trans@ymirror@simple#1\@nil}, + xmirror/.code={\pgfutil@ifnextchar(\tikz@trans@xmirror@coordinate\tikz@trans@xmirror@simple#1\@nil}, + mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, + mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, + mirror/.value required, + ymirror/.value required, + xmirror/.value required, + mirror x/.value required, + mirror y/.value required} +\def\tikz@trans@mirror#1--#2\@nil{% + \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} +\def\tikz@trans@xmirror@simple#1\@nil{\pgftransformxmirror{#1}} +\def\tikz@trans@ymirror@simple#1\@nil{\pgftransformymirror{#1}} +\def\tikz@trans@xmirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxmirror{+\the\pgf@x}} +\def\tikz@trans@ymirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformymirror{+\the\pgf@y}} + +\tikzset{ + Mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikz@trans@Mirror#1\@nil + \else + \tikz@scan@one@point\pgfqtransformMirror#1\relax + \fi}, + yMirror/.code={\pgfutil@ifnextchar(\tikz@trans@yMirror@coordinate\tikz@trans@yMirror@simple#1\@nil}, + xMirror/.code={\pgfutil@ifnextchar(\tikz@trans@xMirror@coordinate\tikz@trans@xMirror@simple#1\@nil}, + Mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, + Mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, + Mirror/.value required, + yMirror/.value required, + xMirror/.value required, + Mirror x/.value required, + Mirror y/.value required} +\def\tikz@trans@Mirror#1--#2\@nil{% + \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} +\def\tikz@trans@xMirror@simple#1\@nil{\pgftransformxMirror{#1}} +\def\tikz@trans@yMirror@simple#1\@nil{\pgftransformyMirror{#1}} +\def\tikz@trans@xMirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxMirror{+\the\pgf@x}} +\def\tikz@trans@yMirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformyMirror{+\the\pgf@y}} +\endinput |