Debian Codegraph @

texmf-dist/tex/latex/tkz-euclide/tkz-draw-eu-angles.tex

raw
1 % tkz-tool-eu-angles.tex
2 % Copyright 2011-2026 Alain Matthes
3 % SPDX-License-Identifier: LPPL-1.3c
4 % Maintainer: Alain Matthes
5
6 \typeout{2026/01/25 5.13c tkz-tool-eu-angles.tex}
7 \makeatletter
8 %<--------------------------------------------------------------------------->
9 % Mark an angle modi 3.03 suppression de \tkz@mksize,
10 %<--------------------------------------------------------------------------->
11 % \tkzMarkAngle(B, A, C)
12 %
13 % Marque d'angle
14 % arc de cercle (simple/double/triple) et marque d'églité.
15 %
16 % Par défaut:
17 % arc = simple
18 % size = 1 (rayon de l'arc)
19 % style traits pleins
20 % mkpos ? position: 0.5 (position de la marque)
21 % mark rien du tout (ignoré si type est utilisé)
22 %
23 % Paramètres (optionnels)
24 % arc : l, ll, lll
25 % mksize : 1
26 % gap : 3pt
27 % dist ?
28 % style : type de traits
29 % position: 0.5
30 % mark : none , |, ||,|||, z, s, x, o, oo mais tous les
31 % % symboles de tikz sont permis
32 %<------------------------- Label on angle -------------------------------->
33 \def\tkz@arcsimple{l}
34 \def\tkz@arcdouble{ll}
35 \def\tkz@arctriple{lll}
36
37 %\tikzset{lbstyle/.style = {color=\tkz@mainlinecolor}}
38
39 \pgfkeys{/tkzmkangle/.cd,
40 arc/.code = \def\tkz@arc{#1},
41 size/.code = \def\tkz@size{#1},
42 mark/.code = \def\tkz@markang{#1},
43 mkpos/.code = \def\tkz@mkpos{#1},
44 mksize/.code = \def\tkz@mksize{#1},
45 mkcolor/.code = \def\tkz@mkcolor{#1},
46 arc = l,
47 size = 1,
48 mark = none,
49 mksize = 4pt,
50 mkcolor = black,
51 mkpos = 0.5,
52 /tkzmkangle/.search also={/tikz}
53 }
54 % utils
55
56 %-----------------------------------------------------------------------
57
58 \def\tkzMarkAngle{\pgfutil@ifnextchar[{\tkz@MarkAngle}{\tkz@MarkAngle[]}}
59 \def\tkz@MarkAngle[#1](#2,#3,#4){%
60 \begingroup
61 \pgfqkeys{/tkzmkangle}{#1}
62 \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
63 \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
64 \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
65
66 \def\tkz@mymark{\pgfsetplotmarksize{\tkz@mksize}\pgfuseplotmark{\tkz@markang}}
67 % draw the arcs
68 \begin{scope}[veclen]
69 \begin{scope}[decoration = {markings, mark=at position \tkz@mkpos with {\tkz@mymark}}]
70 \ifx\tkz@arc\tkz@arcsimple
71 \tkzDrawArcRAN[#1,fill=none]%
72 (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
73 \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
74 (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)
75 \else
76 \ifx\tkz@arc\tkz@arcdouble
77 \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm-2.5\pgflinewidth)%
78 (\tkz@FirstAngle,\tkz@SecondAngle)
79 \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
80 (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
81 \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm+2.5\pgflinewidth)%
82 (\tkz@FirstAngle,\tkz@SecondAngle)%
83 \else
84 \ifx\tkz@arc\tkz@arctriple
85 \tkzDrawArcRAN[#1,fill=none]%
86 (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
87 \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
88 (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
89 \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm-2.5\pgflinewidth)%
90 (\tkz@FirstAngle,\tkz@SecondAngle)%
91 \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm+2.5\pgflinewidth)%
92 (\tkz@FirstAngle,\tkz@SecondAngle)%
93 \fi
94 \fi
95 \fi
96 \end{scope}
97 \end{scope}
98
99 \endgroup
100 }
101 %<--------------------------------------------------------------------------->
102 % multiple
103 \def\tkz@multiMA#1 #2\@nil{%
104 \protected@edef\tkz@temp{
105 \noexpand \tkzMarkAngle[\tkz@optma](#1)}\tkz@temp%
106 \def\tkz@nextArg{#2}%
107 \ifx\tkzutil@empty\tkz@nextArg
108 \let\next\@gobble
109 \fi
110 \next#2\@nil
111 }
112 %<--------------------------------------------------------------------------->
113 \def\tkzMarkAngles{\pgfutil@ifnextchar[{\tkz@MarkAngles}{\tkz@MarkAngles[]}}
114 \def\tkz@MarkAngles[#1](#2){%
115 \xdef\tkz@optma{#1}
116 \begingroup
117 \let\next\tkz@multiMA
118 \next#2 \@nil %
119 \endgroup
120 }
121 % fin de \tkzMarkAngle
122 %<--------------------------------------------------------------------------->
123 % Pic Angle
124 %<--------------------------------------------------------------------------->
125 \def\tkzPicAngle{\pgfutil@ifnextchar[{\tkz@PicAngle}{\tkz@PicAngle[]}}
126 \def\tkz@PicAngle[#1](#2,#3,#4){%
127 \begingroup
128 \draw pic [#1]{angle=#2--#3--#4};
129 \endgroup
130 }
131 \def\tkzPicRightAngle{\pgfutil@ifnextchar[{\tkz@PicRightAngle}{\tkz@PicRightAngle[]}}
132 \def\tkz@PicRightAngle[#1](#2,#3,#4){%
133 \begingroup
134 \draw pic [#1]{right angle=#2--#3--#4};
135 \endgroup
136 }
137 %<--------------------------------------------------------------------------->
138 % FillAngle
139 %<--------------------------------------------------------------------------->
140 \pgfkeys{/tkzFill/.cd,
141 size/.store in = \tkz@size,
142 size = 1,
143 /tkzFill/.search also = {/tikz}
144 }
145
146 \def\tkzFillAngle{\pgfutil@ifnextchar[{\tkz@FillAngle}{\tkz@FillAngle[]}}
147 \def\tkz@FillAngle[#1](#2,#3,#4){%
148 \begingroup
149 \pgfqkeys{/tkzFill}{#1}
150 \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
151 \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
152 \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
153 \path[shift = {(#3)},fill=\tkz@euc@linecolor!10,/tkzFill/.cd,#1]%
154 (#3) -- (\tkz@FirstAngle:\tkz@size) arc%
155 (\tkz@FirstAngle:\tkz@SecondAngle:\tkz@size)--cycle;
156 \endgroup
157 }
158 %<--------------------------------------------------------------------------->
159 % multiple
160 \def\tkz@multiFA#1 #2\@nil{\protected@edef\tkz@temp{%
161 \noexpand \tkzFillAngle[\tkz@optfa](#1)}%
162 \tkz@temp%
163 \def\tkz@nextArg{#2}%
164 \ifx\tkzutil@empty\tkz@nextArg
165 \let\next\@gobble
166 \fi
167 \next#2\@nil
168 }
169 %<--------------------------------------------------------------------------->
170 \def\tkzFillAngles{\pgfutil@ifnextchar[{\tkz@MFillAngles}{\tkz@MFillAngles[]}}
171 \def\tkz@MFillAngles[#1](#2){%
172 \xdef\tkz@optfa{#1}
173 \begingroup
174 \let\next\tkz@multiFA
175 \next#2 \@nil %
176 \endgroup
177 }
178 %<------------------------- Label on angle -------------------------------->
179 \pgfkeys{/tkzlabelangle/.cd,
180 dist/.store in = \tkzlabeldist,
181 angle/.store in = \tkzlabelangle,
182 dist = 1,
183 angle = {},
184 /tkzlabelangle/.search also={/tikz}
185 }
186 \def\tkzLabelAngle{\pgfutil@ifnextchar[{\tkz@LabelAngle}{\tkz@LabelAngle[]}}
187 \def\tkz@LabelAngle[#1](#2,#3,#4)#5{%2016 added normalize from karu's code
188 \begingroup
189 \pgfqkeys{/tkzlabelangle}{#1}
190 \ifx\tkzutil@empty\tkzlabelangle% no value so calc angle of bisector
191 \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
192 \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
193 \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
194 \edef\tkzlabelangle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
195 \fi
196 \path (#3) --+(\tkzlabelangle:\tkzlabeldist) node[label angle style,%
197 /tkzlabelangle/.cd,#1] {#5};
198 \endgroup
199 }
200 %<--------------------------------------------------------------------------->
201 %<--------------------------------------------------------------------------->
202 % multiple labels
203 \def\tkz@multiLBA#1 #2\@nil{%
204 \protected@edef\tkz@temp{
205 \noexpand \tkzLabelAngle[\tkz@optlba](#1){\tkz@labelangle}}\tkz@temp%
206 \def\tkz@nextArg{#2}%
207 \ifx\tkzutil@empty\tkz@nextArg
208 \let\next\@gobble
209 \fi
210 \next#2\@nil
211 }
212 % %<---------------------------------------------------------------------
213 \def\tkzLabelAngles{\pgfutil@ifnextchar[{\tkz@LabelAngles}{%
214 \tkz@LabelAngles[]}}
215 \def\tkz@LabelAngles[#1](#2)#3{%
216 \def\tkz@optlba{#1}
217 \def\tkz@labelangle{#3}
218 \begingroup
219 \let\next\tkz@multiLBA
220 \next#2 \@nil %
221 \endgroup
222 }
223 %<-----------------------------------------------------------------------
224 % Symbole droites perpendiculaires
225 %<----------------------------------------------------------------------
226 \pgfkeys{/tkzrightangle/.cd,
227 norm tkz code/.is if = normtkzcode@execute,
228 german/.code = \normtkzcode@executefalse,
229 size/.store in = \tkz@ra@size,
230 dotsize/.store in = \tkz@dotsize,
231 size = .25,
232 dotsize = 3 pt,
233 /tkzrightangle/.search also={/tikz},
234 }
235 \newcommand*{\tkzMarkRightAngle}[1][]{\tkz@MarkRightAngle[#1]}
236 \def\tkz@MarkRightAngle[#1](#2,#3,#4){%
237 \begingroup
238 \normtkzcode@executetrue
239 \pgfqkeys{/tkzrightangle}{#1}
240 \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{%
241 \pgfpointanchor{#2}{center}}}
242 \tkz@ax=\pgf@x\relax%
243 \tkz@ay=\pgf@y\relax%
244 \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{%
245 \pgfpointanchor{#4}{center}}}
246 \tkz@bx=\pgf@x\relax%
247 \tkz@by=\pgf@y\relax%
248 \ifnormtkzcode@execute%
249 \draw[/tkzrightangle/.cd,#1]
250 (#3) --++( 28.45274*\tkz@ra@size\tkz@ax , 28.45274*\tkz@ra@size\tkz@ay)
251 --++( 28.45274*\tkz@ra@size\tkz@bx , 28.45274*\tkz@ra@size\tkz@by)
252 --++(-28.45274*\tkz@ra@size\tkz@ax ,-28.45274*\tkz@ra@size\tkz@ay)
253 -- (#3);
254 \else%
255 % find angles
256 \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
257 \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
258 \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
259 \edef\tkzCircleAngle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
260 \tkzDrawArcRAN[/tkzrightangle/.cd,#1](#3,\tkz@ra@size)%
261 (\tkz@FirstAngle,\tkz@SecondAngle)
262 \path (#3) --+ (\tkzCircleAngle:\tkz@ra@size/2)
263 node[fill,circle,minimum size=\tkz@dotsize,
264 inner sep=0 pt,/tkzrightangle/.cd,#1] {};
265 \fi%
266 \endgroup
267 }
268 %<--------------------------------------------------------------------------->
269 \def\tkz@multiRA#1 #2\@nil{%
270 \protected@edef\tkz@temp{
271 \noexpand \tkzMarkRightAngle[\tkz@optRA](#1)}\tkz@temp%
272 \def\tkz@nextArg{#2}%
273 \ifx\tkzutil@empty\tkz@nextArg
274 \let\next\@gobble
275 \fi
276 \next#2\@nil
277 }
278 %<--------------------------------------------------------------------------->
279 \def\tkzMarkRightAngles{\pgfutil@ifnextchar[{\tkz@RightAngles}{%
280 \tkz@RightAngles[]}}
281 \def\tkz@RightAngles[#1](#2){%
282 \xdef\tkz@optRA{#1}
283 \begingroup
284 \let\next\tkz@multiRA
285 \next#2 \@nil %
286 \endgroup
287 }
288 %<--------------------------------------------------------------------------->
289 \makeatother
290
291 \endinput