Debian Codegraph @

texmf-dist/doc/latex/tkz-euclide/TKZdoc-euclide-angles.tex

raw
1 \section{Angles}
2 \subsection{Definition and usage with \tkzname{tkz-euclide}}
3 In Euclidean geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle.[Wikipedia]. A ray with \tkzname{tkz-euclide} is defined by two points also each angle is defined with three points like $\widehat{AOB}$. The vertex $O$ is the second point. Their order is important because it is assumed that the angle is specified in the direct order (counterclockwise).
4 In trigonometry and mathematics in general, plane angles are conventionally measured counterclockwise, starting with $0^\circ$ pointing directly to the right (or east), and $90^\circ$ pointing straight up (or north)[Wikipedia].
5 Let us agree that an angle measured counterclockwise is positive.
6
7 \begin{center}
8 \begin{tikzpicture}[scale=.75]
9 \node {clockwise};
10 \tkzDefPoint(0,0){O} \tkzDefPoint(90:2){A}\tkzDefPoint(180:2){B}
11 \tkzDrawArc[black,line width=2pt,arrows = {Stealth-}](O,B)(A)
12 \end{tikzpicture}
13 \begin{tikzpicture}[scale=.75]
14 \node {counterclockwise};
15 \tkzDefPoint(0,0){O} \tkzDefPoint(90:2){A}\tkzDefPoint(0:2){B}
16 \tkzDrawArc[black,line width=2pt,arrows = {-Stealth}](O,A)(B)
17 \end{tikzpicture}
18 \end{center}
19
20 \tkzname{Angles} are involved in several macros like \tkzcname{tkzDefPoint},\tkzcname{tkzDefPointBy[rotation = \dots]}, \tkzcname{tkzDrawArc}
21 and the next one \tkzcname{tkzGetAngle}. With the exception of the last one, all these macros accept negative angles.
22
23 \begin{figure}[!ht]
24 \centering
25 \begin{tabular}{|c|c|}
26 \hline
27 \tkzsubf{\begin{tikzpicture}
28 \tkzDefPoint(0,0){O} \tkzDefPoint(0:2){A}
29 \tkzDefPointBy[rotation=center O angle 80](A) \tkzGetPoint{B}
30 \tkzDrawSegments[-{Stealth}](O,A O,B)
31 \tkzMarkAngles[size=2,-Stealth,teal](A,O,B)
32 \tkzFindAngle(A,O,B) \tkzGetAngle{an}
33 \tkzLabelAngle[pos=1,teal](A,O,B){$ \pgfmathprintnumber{\an}^\circ$}
34 \tkzLabelPoints(A) \tkzLabelPoints[above](B)
35 \end{tikzpicture}}
36 {Rotation $80^\circ$ from $(O,A)$ to $(O,B)$\\
37 {\textbackslash}tkzDefPointBy[rotation=center O angle 80]}
38 &
39 \tkzsubf{\begin{tikzpicture}
40 \tkzDefPoint(0,0){O} \tkzDefPoint(0:2){A}
41 \tkzDefPointBy[rotation=center O angle -80](A) \tkzGetPoint{B}
42 \tkzDrawSegments[-{Stealth}](O,A O,B)
43 \tkzMarkAngles[size=2,Stealth-,red](B,O,A)
44 \tkzFindAngle(B,O,A) \tkzGetAngle{an}
45 \tkzLabelAngle[pos=1,red](B,O,A){$-\pgfmathprintnumber{\an}^\circ$}
46 \tkzLabelPoints[right](A) \tkzLabelPoints[below](B)
47 \end{tikzpicture}}
48 {Rotation $-80^\circ$ from $(O,A)$ to $(O,B)$\\
49 {\textbackslash}tkzDefPointBy[rotation=center O angle -80]}
50 \\ \hline
51 \tkzsubf{\begin{tikzpicture}
52 \tkzDefPoint(0,0){O} \tkzDefPoint(0:2){A}
53 \tkzDefPointBy[rotation=center O angle 80](A) \tkzGetPoint{B}
54 \tkzDrawSegments[-{Stealth}](O,A O,B)
55 \tkzMarkAngles[size=1.5,-Stealth,teal](A,O,B)
56 \tkzFindAngle(A,O,B) \tkzGetAngle{an}
57 \tkzLabelAngle[pos=1,teal](A,O,B){$ \pgfmathprintnumber{\an}^\circ$}
58 \tkzLabelPoints(A) \tkzLabelPoints[above](B)
59 \end{tikzpicture}}
60 { {\textbackslash}tkzFindAngle(A,O,B) gives $80$}
61 &
62 \tkzsubf{\begin{tikzpicture}
63 \tkzDefPoint(0,0){O} \tkzDefPoint(0:2){A}
64 \tkzDefPointBy[rotation=center O angle -80](A) \tkzGetPoint{B}
65 \tkzDrawSegments[-{Stealth}](O,A O,B)
66 \tkzMarkAngles[size=1,-Stealth,red](A,O,B)
67 \tkzFindAngle(A,O,B) \tkzGetAngle{an}
68 \tkzLabelAngle[pos=.75,red](A,O,B){$\pgfmathprintnumber{\an}^\circ$}
69 \tkzLabelPoints[right](A) \tkzLabelPoints[below](B)
70 \end{tikzpicture}}
71 {{\textbackslash}tkzFindAngle(A,O,B) gives $\pgfmathprintnumber{\an}^\circ$}
72 \\\hline
73 \end{tabular}
74 \end{figure}
75
76 As we can see, the $-80^\circ$ rotation defines a clockwise angle but the macro
77 \tkzcname{tkzFindAngle} recovers a counterclockwise angle.
78
79 \subsection{Recovering an angle \tkzcname{tkzGetAngle}}
80 \begin{NewMacroBox}{tkzGetAngle}{\parg{name of macro}}%
81 Assigns the value in degree of an angle to a macro. The value is positive and between $0^\circ$ and $360^\circ$. This macro retrieves \tkzcname{tkzAngleResult} and stores the result in a new macro.
82
83 \medskip
84
85 \begin{tabular}{lll}%
86 \toprule
87 arguments & example & explanation \\
88 \midrule
89 \TAline{name of macro} {\tkzcname{tkzGetAngle}\{ang\}}{\tkzcname{ang} contains the value of the angle.}
90 \end{tabular}
91 \end{NewMacroBox}
92
93 This is an auxiliary macro that allows you to retrieve the result of the following macro \tkzcname{tkzFindAngle}.
94
95 \subsection{Angle formed by three points}
96
97 \begin{NewMacroBox}{tkzFindAngle}{\parg{pt1,pt2,pt3}}%
98 The result is stored in a macro \tkzcname{tkzAngleResult}.
99
100 \medskip
101
102 \begin{tabular}{lll}%
103 \toprule
104 arguments & example & explanation \\
105 \midrule
106 \TAline{(pt1,pt2,pt3)} {\tkzcname{tkzFindAngle}(A,B,C)}{\tkzcname{tkzAngleResult} gives the angle ($\overrightarrow{BA},\overrightarrow{BC}$)}
107 \bottomrule
108 \end{tabular}
109
110 \medskip
111 The measure is always positive and between $0^\circ$ and $360^\circ$. With the usual conventions, a counterclockwise angle smaller than a straight angle has always a measure between $0^\circ$ and $180^\circ$, while a clockwise angle smaller than a straight angle will have a measurement greater than $180^\circ$. \tkzcname{tkzGetAngle} can retrieve the angle.
112 \end{NewMacroBox}
113
114 \subsubsection{Verification of angle measurement}
115
116 \begin{tkzexample}[latex=7cm,small]
117 \begin{tikzpicture}[scale=.75]
118 \tkzDefPoint(-1,1){A}
119 \tkzDefPoint(5,2){B}
120 \tkzDefEquilateral(A,B)
121 \tkzGetPoint{C}
122 \tkzDrawPolygon(A,B,C)
123 \tkzFindAngle(B,A,C) \tkzGetAngle{angleBAC}
124 \edef\angleBAC{\fpeval{round(\angleBAC)}}
125 \tkzDrawPoints(A,B,C)
126 \tkzLabelPoints(A,B)
127 \tkzLabelPoint[right](C){$C$}
128 \tkzLabelAngle(B,A,C){\angleBAC$^\circ$}
129 \tkzMarkAngle[size=1.5](B,A,C)
130 \end{tikzpicture}
131 \end{tkzexample}
132
133 \subsubsection{Determination of the three angles of a triangle}
134
135 \begin{tkzexample}[latex=6cm,small]
136 \begin{tikzpicture}
137 \tikzset{label angle style/.append style={pos=1.4}}
138 \tkzDefPoints{0/0/a,5/3/b,3/6/c}
139 \tkzDrawPolygon(a,b,c)
140 \tkzFindAngle(c,b,a)\tkzGetAngle{angleCBA}
141 \pgfmathparse{round(1+\angleCBA)}
142 \let\angleCBA\pgfmathresult
143 \tkzFindAngle(a,c,b)\tkzGetAngle{angleACB}
144 \pgfmathparse{round(\angleACB)}
145 \let\angleACB\pgfmathresult
146 \tkzFindAngle(b,a,c)\tkzGetAngle{angleBAC}
147 \pgfmathparse{round(\angleBAC)}
148 \let\angleBAC\pgfmathresult
149 \tkzMarkAngle(c,b,a)
150 \tkzLabelAngle(c,b,a){\tiny $\angleCBA^\circ$}
151 \tkzMarkAngle(a,c,b)
152 \tkzLabelAngle(a,c,b){\tiny $\angleACB^\circ$}
153 \tkzMarkAngle(b,a,c)
154 \tkzLabelAngle(b,a,c){\tiny $\angleBAC^\circ$}
155 \end{tikzpicture}
156 \end{tkzexample}
157
158 \subsubsection{Angle between two circles}
159 We are looking for the angle formed by the tangents at a point of intersection
160
161 \begin{tkzexample}[latex=7cm,small]
162 \begin{tikzpicture}[scale=.4]
163 \pgfkeys{/pgf/number format/.cd,%
164 fixed,precision=1}
165 \tkzDefPoints{0/0/A,6/0/B,4/2/C}
166 \tkzDrawCircles(A,C B,C)
167 \tkzDefLine[tangent at=C](A) \tkzGetPoint{a}
168 \tkzDefPointsBy[symmetry = center C](a){d}
169 \tkzDefLine[tangent at=C](B) \tkzGetPoint{b}
170 \tkzDrawLines[add=1 and 4](a,C C,b)
171 \tkzFillAngle[fill=teal,opacity=.2%
172 ,size=2](b,C,d)
173 \tkzFindAngle(b,C,d)\tkzGetAngle{bcd}
174 \tkzLabelAngle[pos=1.25](b,C,d){%
175 \tiny $\pgfmathprintnumber{\bcd}^\circ$}
176 \end{tikzpicture}
177 \end{tkzexample}
178
179 \subsection{Angle formed by a straight line with the horizontal axis \tkzcname{tkzFindSlopeAngle}}
180 Much more interesting than the last one. The result is between -180 degrees and +180 degrees.
181
182 \begin{NewMacroBox}{tkzFindSlopeAngle}{\parg{A,B}}%
183 Determines the slope of the straight line (AB). The result is stored in a macro \tkzcname{tkzAngleResult}.
184
185 \medskip
186 \begin{tabular}{lll}%
187 \toprule
188 arguments & example & explanation \\
189 \midrule
190 \TAline{(pt1,pt2)} {\tkzcname{tkzFindSlopeAngle}(A,B)}{}
191 \bottomrule
192 \end{tabular}
193
194 \medskip
195 \tkzcname{tkzGetAngle} can retrieve the result. If retrieval is not necessary, you can use \tkzcname{tkzAngleResult}.
196 \end{NewMacroBox}
197
198 \subsubsection{How to use \tkzcname{tkzFindSlopeAngle}}
199
200 The point here is that $(AB)$ is the bisector of $\widehat{CAD}$, such that the $AD$ slope is zero. We recover the slope of $(AB)$ and then rotate twice.
201
202 \begin{tkzexample}[latex=7cm,small]
203 \begin{tikzpicture}
204 \tkzDefPoint(1,5){A} \tkzDefPoint(5,2){B}
205 \tkzFindSlopeAngle(A,B)\tkzGetAngle{tkzang}
206 \tkzDefPointBy[rotation= center A angle \tkzang ](B)
207 \tkzGetPoint{C}
208 \tkzDefPointBy[rotation= center A angle -\tkzang ](B)
209 \tkzGetPoint{D}
210 \tkzDrawSegment(A,B)
211 \tkzDrawSegments[new](A,C A,D)
212 \tkzDrawPoints(A,B,C,D)
213 \tkzCompass[length=1](A,C)
214 \tkzCompass[delta=10,brown](B,C)
215 \tkzLabelPoints(B,C,D)
216 \tkzLabelPoints[above left](A)
217 \end{tikzpicture}
218 \end{tkzexample}
219
220 \subsubsection{Use of \tkzcname{tkzFindSlopeAngle} and \tkzcname{tkzGetAngle}}
221 Here is another version of the construction of a mediator
222
223 \begin{tkzexample}[latex=6cm,small]
224 \begin{tikzpicture}
225 \tkzInit
226 \tkzDefPoint(0,0){A} \tkzDefPoint(3,2){B}
227 \tkzDefLine[mediator](A,B) \tkzGetPoints{I}{J}
228 \tkzCalcLength(A,B) \tkzGetLength{dAB}
229 \tkzFindSlopeAngle(A,B) \tkzGetAngle{tkzangle}
230 \begin{scope}[rotate=\tkzangle]
231 \tkzSetUpArc[color=gray,line width=0.2pt,%
232 /tkzcompass/delta=10]
233 \tkzDrawArc[R,arc](B,3/4*\dAB)(120,240)
234 \tkzDrawArc[R,arc](A,3/4*\dAB)(-45,60)
235 \tkzDrawLine(I,J) \tkzDrawSegment(A,B)
236 \end{scope}
237 \tkzDrawPoints(A,B,I,J) \tkzLabelPoints(A,B)
238 \tkzLabelPoints[right](I,J)
239 \end{tikzpicture}
240 \end{tkzexample}
241
242 \subsubsection{Another use of \tkzcname{tkzFindSlopeAngle}}
243
244 \begin{tkzexample}[latex=7cm,small]
245 \begin{tikzpicture}[scale=1.5]
246 \tkzDefPoint(1,2){A} \tkzDefPoint(3,4){B}
247 \tkzDefPoint(3,2){C} \tkzDefPoint(3,1){D}
248 \tkzDrawSegments(A,B A,C A,D)
249 \tkzDrawPoints[color=red](A,B,C,D)
250 \tkzLabelPoints(A,B,C,D)
251 \tkzFindSlopeAngle(A,B)\tkzGetAngle{SAB}
252 \tkzFindSlopeAngle(A,C)\tkzGetAngle{SAC}
253 \tkzFindSlopeAngle(A,D)\tkzGetAngle{SAD}
254 \pgfkeys{/pgf/number format/.cd,fixed,precision=2}
255 \tkzText(1,5){The slope of (AB) is :
256 $\pgfmathprintnumber{\SAB}^\circ$}
257 \tkzText(1,4.5){The slope of (AC) is :
258 $\pgfmathprintnumber{\SAC}^\circ$}
259 \tkzText(1,4){The slope of (AD) is :
260 $\pgfmathprintnumber{\SAD}^\circ$}
261 \end{tikzpicture}
262 \end{tkzexample}
263
264 \endinput