Debian Codegraph @

texmf-dist/doc/generic/pgf/pgfmanual-en-library-angles.tex

raw
1 % Copyright 2019 by Till Tantau
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 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10
11 \section{Angle Library}
12 \label{section-angle}
13
14 \begin{tikzlibrary}{angles}
15 This library defines pic types for drawing angles.
16 \end{tikzlibrary}
17
18 \begin{pictype}{angle}{\opt{|=|\meta{A}|--|\meta{B}|--|\meta{C}}}
19 This pic adds a drawing of an angle to the current path. This ``drawing of
20 an angle'' consist of a ``sector'' or ``wedge'' or ``slice'' whose pointed
21 end is at point \meta{B} and whose straight sides lie on the lines form
22 \meta{B} to \meta{A} and from \meta{B} to \meta{C}. The length of these
23 lines is governed by the following key:
24 %
25 \begin{key}{/tikz/angle radius=\meta{dimension} (initially 5mm)}
26 The length of the sides of the angle's wedge:
27 %
28 \begin{codeexample}[preamble={\usetikzlibrary{angles}}]
29 \tikz \draw (2,0) coordinate (A) -- (0,0) coordinate (B)
30 -- (-1,-1) coordinate (C)
31 pic [fill=black!50] {angle = A--B--C}
32 pic [draw,->,red,thick,angle radius=1cm] {angle = C--B--A};
33 \end{codeexample}
34 \end{key}
35
36 The three points \meta{A}, \meta{B}, and \meta{C} \emph{must} be the names
37 of nodes or coordinates; you cannot use direct coordinates like ``|(1,1)|''
38 here.
39
40 You can leave out the three points, in this case the text |A--B--C| is
41 used; so in the above examples we could just have written |{angle}| in the
42 first pic.
43
44 Concerning the sector that makes up the drawing of the angle, the angular
45 part of this sector is drawn in front of the path if the |draw| option is
46 given to the |pic|, while filled sector is drawn behind the |pic|, provided
47 an option like |fill| or |shade| is passed to the pic. The following
48 example shows the difference:
49 %
50 \begin{codeexample}[preamble={\usetikzlibrary{angles}}]
51 \tikz \draw [line width=2mm]
52 (2,0) coordinate (A) -- (0,0) coordinate (B)
53 -- (1,1) coordinate (C)
54 pic [draw=blue, fill=blue!50, angle radius=1cm] {angle};
55 \end{codeexample}
56
57 When |pic text| is set (which you typically do by using the quotes syntax),
58 a node will be created whose name is empty (and, thus, inherits the pic's
59 name) and which will be at the half-way angle between the lines to \meta{A}
60 and \meta{C} and whose distance from \meta{B} is |angle radius| times the
61 following factor:
62 %
63 \begin{key}{/tikz/angle eccentricity=\meta{factor} (initially 0.6)}
64 \begin{codeexample}[preamble={\usetikzlibrary{angles,quotes}}]
65 \tikz \draw (2,0) coordinate (A) -- (0,0) coordinate (B)
66 -- (1,1) coordinate (C)
67 pic ["$\alpha$", draw, ->] {angle};
68 \end{codeexample}
69 %
70 \begin{codeexample}[preamble={\usetikzlibrary{angles,quotes}}]
71 \tikz \draw (2,0) coordinate (A) -- (0,0) coordinate (B)
72 -- (1,1) coordinate (C)
73 pic ["$\alpha$", draw, angle eccentricity=1] {angle};
74 \end{codeexample}
75 %
76 \begin{codeexample}[preamble={\usetikzlibrary{angles,quotes}}]
77 \tikz {
78 \draw (2,0) coordinate (A) -- (0,0) coordinate (B)
79 -- (1,1) coordinate (C)
80 pic (alpha) ["$\alpha$", draw] {angle};
81
82 \draw (alpha) circle [radius=5pt];
83 }
84 \end{codeexample}
85 \end{key}
86 \end{pictype}
87
88 \begin{pictype}{right angle}{\opt{|=|\meta{A}|--|\meta{B}|--|\meta{C}}}
89 This pic adds a drawing of a right angle to the current path. It works in
90 the same way as |angle| pic.
91 %
92 \begin{codeexample}[preamble={\usetikzlibrary{angles}}]
93 \tikz
94 \draw (0,0,0) coordinate (O)
95 (1,0,0) coordinate (A) -- (O)
96 (0,0,1) coordinate (B) -- (O)
97 (0,1,0) coordinate (C) -- (O)
98 pic [fill=gray,angle radius=4mm] {right angle = A--O--B}
99 pic [draw,red,thick,angle eccentricity=.5,pic text=.]
100 {right angle = A--O--C};
101 \end{codeexample}
102 %
103 \end{pictype}
104
105
106 %%% Local Variables:
107 %%% mode: latex
108 %%% TeX-master: "pgfmanual-pdftex-version"
109 %%% End: