summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex')
-rw-r--r--graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex683
1 files changed, 683 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex
new file mode 100644
index 0000000000..a84fae7150
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex
@@ -0,0 +1,683 @@
+% 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:
+
+\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}%
+
+%% 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