Debian Codegraph @

texmf-dist/tex/generic/tikz-ext/tikzlibraryext.topaths.autobend.code.tex

raw
1 % Copyright 2024 by Qrrbrbirlbel
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Free Documentation License.
7 %
8
9 \unless\ifcsname tikzextset\endcsname
10 \input tikzext-util.tex
11 \fi
12
13 \tikzextset{
14 autobend north/.default=\tikz@to@bend,
15 autobend south/.default=\tikz@to@bend,
16 autobend west/.default=\tikz@to@bend,
17 autobend east/.default=\tikz@to@bend,
18 autobend up/.default=\tikz@to@bend,
19 autobend down/.default=\tikz@to@bend,
20 autobend left/.default=\tikz@to@bend,
21 autobend right/.default=\tikz@to@bend,
22 autobend north/.style={
23 /tikz/to path={
24 \pgfextra{%
25 \pgf@process{%
26 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
27 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
28 \pgf@pos@transform@glob
29 }%
30 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@x>0pt right\else left\fi/.@cmd}#1\pgfeov}
31 \tikz@to@curve@path
32 }%
33 },
34 autobend south/.style={
35 /tikz/to path={
36 \pgfextra{%
37 \pgf@process{%
38 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
39 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
40 \pgf@pos@transform@glob
41 }%
42 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@x>0pt left\else right\fi/.@cmd}#1\pgfeov}
43 \tikz@to@curve@path
44 }%
45 },
46 autobend west/.style={
47 /tikz/to path={
48 \pgfextra{%
49 \pgf@process{%
50 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
51 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
52 \pgf@pos@transform@glob
53 }%
54 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@y>0pt right\else left\fi/.@cmd}#1\pgfeov}
55 \tikz@to@curve@path
56 }%
57 },
58 autobend east/.style={
59 /tikz/to path={
60 \pgfextra{%
61 \pgf@process{%
62 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
63 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
64 \pgf@pos@transform@glob
65 }%
66 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@y>0pt left\else right\fi/.@cmd}#1\pgfeov}
67 \tikz@to@curve@path
68 }%
69 },
70 autobend up/.style={
71 /tikz/to path={
72 \pgfextra{%
73 \pgf@process{%
74 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
75 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
76 }%
77 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@x>0pt right\else left\fi/.@cmd}#1\pgfeov}
78 \tikz@to@curve@path
79 }%
80 },
81 autobend down/.style={
82 /tikz/to path={
83 \pgfextra{%
84 \pgf@process{%
85 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
86 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
87 }%
88 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@x>0pt left\else right\fi/.@cmd}#1\pgfeov}
89 \tikz@to@curve@path
90 }%
91 },
92 autobend left/.style={
93 /tikz/to path={
94 \pgfextra{%
95 \pgf@process{%
96 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
97 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
98 }%
99 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@y>0pt right\else left\fi/.@cmd}#1\pgfeov}
100 \tikz@to@curve@path
101 }%
102 },
103 autobend right/.style={
104 /tikz/to path={
105 \pgfextra{%
106 \pgf@process{%
107 \pgfpointdiff{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)}
108 {\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)}%
109 }%
110 \pgfkeysvalueof{/tikz/bend \ifdim\pgf@y>0pt left\else right\fi/.@cmd}#1\pgfeov}
111 \tikz@to@curve@path
112 }%
113 }%
114 }