Debian Codegraph @

texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-topaths.autobend.tex

raw
1 % !TeX root = tikz-ext-manual.tex
2 % !TeX spellcheck = en_US
3 % Copyright 2023 by Qrrbrbirlbel
4 %
5 % This file may be distributed and/or modified
6 %
7 % 1. under the LaTeX Project Public License and/or
8 % 2. under the GNU Free Documentation License.
9 %
10
11 \section{Autobending}
12 \label{library:topaths.autobend}
13 \begin{tikzlibrary}{ext.topaths.autobend}
14 This library provides various bended |to| paths
15 that bend in the specified direction.
16
17 \inspiration{AutoBend-Q}{AutoBend-A}
18 \end{tikzlibrary}
19
20 The keys \referenceKeyandIndexO{bend left}
21 and \referenceKeyandIndexO{bend left} from \tikzname\
22 bend the requested curve in relation of the connecting
23 coordinates/nodes.
24
25 The keys provided by this library bend the curve in the direction relative
26 to the paper (north, south, west and east) or relative to the current
27 coordinate system (up, down, left and right).
28
29 \begin{key}{/\tikzext/autobend north=\meta{angle} (default \normalfont last value)}
30 Works like the |bend left| and |bend right| options
31 but bends the curve to the top of the page (i.\,e. it ignores the current transformation).
32 \end{key}
33 \begin{key}{/\tikzext/autobend south=\meta{angle} (default \normalfont last value)}
34 Works like |autobend north| but bends the curve to the bottom of the page.
35 \end{key}
36 \begin{key}{/\tikzext/autobend west=\meta{angle} (default \normalfont last value)}
37 Works like |autobend north| but bends the curve to the left of the page.
38 \end{key}
39 \begin{key}{/\tikzext/autobend east=\meta{angle} (default \normalfont last value)}
40 Works like |autobend north| but bends the curve to the right of the page.
41 \end{key}
42
43 \begin{key}{/\tikzext/autobend up=\meta{angle} (default \normalfont last value)}
44 Works like the |bend left| and |bend right| options
45 but bends the curve upwards (i.\,e. it observes the current transformation).
46 \end{key}
47 \begin{key}{/\tikzext/autobend down=\meta{angle} (default \normalfont last value)}
48 Works like |autobend up| but bends the curve downwards.
49 \end{key}
50 \begin{key}{/\tikzext/autobend left=\meta{angle} (default \normalfont last value)}
51 Works like |autobend up| but bends the curve leftwards.
52 \end{key}
53 \begin{key}{/\tikzext/autobend right=\meta{angle} (default \normalfont last value)}
54 Works like |autobend up| but bends the curve rightwards.
55 \end{key}
56
57 \begin{codeexample}[preamble=\usetikzlibrary{arrows.meta, ext.topaths.autobend},width=6cm]
58 \begin{tikzpicture}[
59 every path/.append style=-Latex,
60 pics/cs/.style={
61 /tikz/transform shape,
62 code={\draw[help lines, Latex-Latex] (up:1) |- (right:1);}
63 },
64 nodes={sloped, fill=white, inner ysep=+.1em, fill opacity=.8, text opacity=1, scale=.5}]
65 \foreach[count=\i] \c/\d in {black/north, red/south,
66 green!50!black/west, yellow!50!black/east}
67 \draw[\c] (0,0) pic {cs} to[ext/autobend \d=\i0] node{\d} +(45:3);
68 \foreach[count=\i] \c/\d in {black/north, red/south,
69 green!50!black/west, yellow!50!black/east}
70 \draw[shift=(right:2), rotate=180, \c]
71 (45:-3) pic {cs} to[ext/autobend \d=\i0] node{\d} (0,0);
72
73 \tikzset{shift=(down:2.5)}
74 \foreach[count=\i] \c/\d in {black/up, red/down,
75 green!50!black/left, yellow!50!black/right}
76 \draw[\c] (0,0) pic {cs} to[ext/autobend \d=\i0] node{\d} +(45:3);
77 \foreach[count=\i] \c/\d in {black/up, red/down,
78 green!50!black/left, yellow!50!black/right}
79 \draw[shift=(right:2), rotate=180, \c]
80 (45:-3) pic {cs} to[ext/autobend \d=\i0] node{\d} (0,0);
81 \end{tikzpicture}
82 \end{codeexample}