Debian Codegraph @

texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-paths.arcto.tex

raw
1 % !TeX root = tikz-ext-manual.tex
2 % !TeX spellcheck = en_US
3 % Copyright 2022 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{Arc \emph{to} a point}
12 \label{library:paths.arcto}
13
14 \begin{tikzlibrary}{ext.paths.arcto}
15 This library adds the new path operation |arc to| that specifies an arc \emph{to} a point~--
16 without the user having to specify any angles.
17 \end{tikzlibrary}%\currentLibrary{paths.arcto}
18
19 \begin{codeexample}[width=.5\linewidth,preamble=\usetikzlibrary{ext.paths.arcto}]
20 \begin{tikzpicture}[ultra thick,dot/.style={label={#1}}]
21 \coordinate[dot=below left:$a$] (a) at (0,0);
22 \coordinate[dot=above right:$b$] (b) at (2,3);
23 \begin{scope}[
24 radius=3,
25 nodes={
26 shape=circle,
27 fill=white,
28 fill opacity=.9,
29 text opacity=1,
30 inner sep=+0pt,
31 sloped,
32 allow upside down
33 }]
34 \draw[blue] (a) arc to[]
35 node[near start] {.25} node {.5} node[near end] {.75} (b);
36 \draw[red] (a) arc to[clockwise]
37 node[near start] {.25} node {.5} node[near end] {.75} (b);
38 \draw[blue!50] (a) arc to[large]
39 node[near start] {.25} node {.5} node[near end] {.75} (b);
40 \draw[red!50] (a) arc to[large, clockwise]
41 node[near start] {.25} node {.5} node[near end] {.75} (b);
42 \end{scope}
43
44 \fill[radius=2pt] (a) circle[] (b) circle[];
45 \end{tikzpicture}
46 \end{codeexample}
47
48 \begin{pathoperation}{arc to}{\opt{\oarg{options}}\meta{coordinate or cycle}}
49 \begin{multicols}{2}
50 When this operation is used, the path gets extended by an arc that goes through
51 the current point and \meta{coordinate}.
52
53 For two points there exist two circles or four arcs that go through or connect
54 these two points. Which one of these is constructed is determined by the following
55 options that can be used inside of \meta{options}.
56
57 \begin{stylekey}{/\tikzext/arc to/clockwise}
58 This constructs an arc that goes clockwise.
59 \end{stylekey}
60
61 \begin{stylekey}{/\tikzext/arc to/counter clockwise}
62 This constructs an arc that goes counter clockwise.
63
64 This is the default.
65 \end{stylekey}
66
67 \begin{stylekey}{/\tikzext/arc to/large}
68 This constructs an arc whose angle is larger than $180^\circ$.
69 \end{stylekey}
70
71 \begin{stylekey}{/\tikzext/arc to/small}
72 This constructs an arc whose angle is smaller than $180^\circ$.
73 \end{stylekey}
74
75 \begin{key}{/\tikzext/arc to/rotate=\meta{degree}}
76 Rotates the arc by \meta{degree}.
77 This is only noticeable when |x radius| and |y radius| are different.
78 \end{key}
79
80 \begin{key}{/\tikzext/arc to/x radius=\meta{value}}
81 This forwards the \meta{value} to \referenceKeyandIndexO{x radius}.
82 Its \meta{value} is used for the radius of the arc.
83 \end{key}
84
85 \begin{key}{/\tikzext/arc to/y radius=\meta{value}}
86 This forwards the \meta{value} to \referenceKeyandIndexO{y radius}.
87 Its \meta{value} is used for the radius of the arc.
88 \end{key}
89
90 \begin{key}{/\tikzext/arc to/radius=\meta{value}}
91 This forwards the \meta{value} to both |/tikz/x radius| and |/tikz/y radius|.
92 Its \meta{value} is used for radius of the arc.
93 \end{key}
94
95 \begin{stylekey}{/\tikzext/every arc to}
96 After |/tikz/every arc| this will also be applied before any \meta{options} are set.
97 \end{stylekey}
98
99 It should be noted that this uses |\pgfpatharcto| for which the \tikzname\space manual warns:\indexCommandO\pgfpatharcto
100 \begin{quote}\itshape
101 The internal computations necessary for this command are numerically very unstable.
102 In particular, the arc will not always really end at the \meta{target coordinate},
103 but may be off by up to several points.
104 A more precise positioning is currently infeasible due to \TeX's numerical weaknesses.
105 The only case it works quite nicely is when the resulting angle is a multiple of $90^\circ$.
106 \end{quote}
107
108 The |arc to| path operation will also work only in the |canvas| coordinate system.
109 The lengths of the vectors $(1, 0)$ and $(0, 1)$ will be used for the calculation of the radii
110 but no further consideration is done.
111 \end{multicols}
112 \end{pathoperation}
113 %\noLibrary