summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-angles.tex
blob: 3ab43bd43e4358f679595cb0f986c3d9abe226ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
\section{Angles} 
\subsection{Definition and usage with \tkzname{tkz-euclide}}
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). 
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]. 
Let us agree that an angle measured counterclockwise is positive.

  \begin{center}
    \begin{tikzpicture}[scale=.75]
      \node {clockwise};
      \tkzDefPoint(0,0){O} \tkzDefPoint(90:2){A}\tkzDefPoint(180:2){B}   
      \tkzDrawArc[black,line width=2pt,arrows = {Stealth-}](O,B)(A)
    \end{tikzpicture}
    \begin{tikzpicture}[scale=.75]
          \node {counterclockwise};
      \tkzDefPoint(0,0){O} \tkzDefPoint(90:2){A}\tkzDefPoint(0:2){B}   
      \tkzDrawArc[black,line width=2pt,arrows = {-Stealth}](O,A)(B)
    \end{tikzpicture}  
  \end{center}
  
 \tkzname{Angles} are involved in several macros like \tkzcname{tkzDefPoint},\tkzcname{tkzDefPointBy[rotation = \dots]}, \tkzcname{tkzDrawArc}
 and the next one  \tkzcname{tkzGetAngle}. With the exception of the last one, all these macros accept negative angles.
 
 \begin{figure}[!ht]
 \centering
 \begin{tabular}{|c|c|}
 \hline
 \tkzsubf{\begin{tikzpicture}
 \tkzDefPoint(0,0){O}    \tkzDefPoint(0:2){A}
 \tkzDefPointBy[rotation=center O angle 80](A)  \tkzGetPoint{B}
 \tkzDrawSegments[-{Stealth}](O,A O,B)
 \tkzMarkAngles[size=2,-Stealth,teal](A,O,B)
 \tkzFindAngle(A,O,B)   \tkzGetAngle{an}
 \tkzLabelAngle[pos=1,teal](A,O,B){$ \pgfmathprintnumber{\an}^\circ$}
 \tkzLabelPoints(A)  \tkzLabelPoints[above](B)
 \end{tikzpicture}}
      {Rotation $80^\circ$ from $(O,A)$ to $(O,B)$\\ 
    {\textbackslash}tkzDefPointBy[rotation=center O angle 80]}
 &
 \tkzsubf{\begin{tikzpicture}
 \tkzDefPoint(0,0){O}    \tkzDefPoint(0:2){A}
 \tkzDefPointBy[rotation=center O angle -80](A)  \tkzGetPoint{B}
 \tkzDrawSegments[-{Stealth}](O,A O,B)
 \tkzMarkAngles[size=2,Stealth-,red](B,O,A)
 \tkzFindAngle(B,O,A)   \tkzGetAngle{an}
 \tkzLabelAngle[pos=1,red](B,O,A){$-\pgfmathprintnumber{\an}^\circ$}
\tkzLabelPoints[right](A)  \tkzLabelPoints[below](B)
 \end{tikzpicture}}
  {Rotation $-80^\circ$ from $(O,A)$ to $(O,B)$\\ 
     {\textbackslash}tkzDefPointBy[rotation=center O angle -80]}
 \\ \hline
 \tkzsubf{\begin{tikzpicture}
 \tkzDefPoint(0,0){O}    \tkzDefPoint(0:2){A}
 \tkzDefPointBy[rotation=center O angle 80](A)  \tkzGetPoint{B}
 \tkzDrawSegments[-{Stealth}](O,A O,B)
 \tkzMarkAngles[size=1.5,-Stealth,teal](A,O,B)
 \tkzFindAngle(A,O,B)   \tkzGetAngle{an}
 \tkzLabelAngle[pos=1,teal](A,O,B){$ \pgfmathprintnumber{\an}^\circ$}
\tkzLabelPoints(A)  \tkzLabelPoints[above](B)
 \end{tikzpicture}}
      { {\textbackslash}tkzFindAngle(A,O,B) gives $80$}
 &
 \tkzsubf{\begin{tikzpicture}
 \tkzDefPoint(0,0){O}    \tkzDefPoint(0:2){A}
 \tkzDefPointBy[rotation=center O angle -80](A)  \tkzGetPoint{B}
 \tkzDrawSegments[-{Stealth}](O,A O,B)
 \tkzMarkAngles[size=1,-Stealth,red](A,O,B)
 \tkzFindAngle(A,O,B)   \tkzGetAngle{an}
 \tkzLabelAngle[pos=.75,red](A,O,B){$\pgfmathprintnumber{\an}^\circ$}
\tkzLabelPoints[right](A)  \tkzLabelPoints[below](B)
 \end{tikzpicture}}
  {{\textbackslash}tkzFindAngle(A,O,B) gives $\pgfmathprintnumber{\an}^\circ$}
 \\\hline
 \end{tabular}
 \end{figure}

As we can see, the $-80^\circ$ rotation defines a clockwise angle but the macro 
\tkzcname{tkzFindAngle} recovers a counterclockwise angle.

\subsection{Recovering an angle \tkzcname{tkzGetAngle}}
\begin{NewMacroBox}{tkzGetAngle}{\parg{name of macro}}%
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.

\medskip

\begin{tabular}{lll}%
\toprule
arguments             & example & explanation             \\
\midrule
\TAline{name of macro} {\tkzcname{tkzGetAngle}\{ang\}}{\tkzcname{ang} contains the value of the angle.}
\end{tabular}
\end{NewMacroBox}

This is an auxiliary macro that allows you to retrieve the result of the following macro \tkzcname{tkzFindAngle}.

\subsection{Angle formed by three points}

\begin{NewMacroBox}{tkzFindAngle}{\parg{pt1,pt2,pt3}}%
The result is stored in a macro \tkzcname{tkzAngleResult}.

\medskip

\begin{tabular}{lll}%
\toprule
arguments     & example & explanation     \\
\midrule
\TAline{(pt1,pt2,pt3)} {\tkzcname{tkzFindAngle}(A,B,C)}{\tkzcname{tkzAngleResult} gives the angle ($\overrightarrow{BA},\overrightarrow{BC}$)}
\bottomrule
\end{tabular}

\medskip
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.
\end{NewMacroBox}
 
\subsubsection{Verification of angle measurement}
    
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.75]
  \tkzDefPoint(-1,1){A}
  \tkzDefPoint(5,2){B}
  \tkzDefEquilateral(A,B)
  \tkzGetPoint{C}
  \tkzDrawPolygon(A,B,C)
  \tkzFindAngle(B,A,C) \tkzGetAngle{angleBAC}
  \edef\angleBAC{\fpeval{round(\angleBAC)}}
  \tkzDrawPoints(A,B,C) 
  \tkzLabelPoints(A,B)
  \tkzLabelPoint[right](C){$C$}
  \tkzLabelAngle(B,A,C){\angleBAC$^\circ$}
  \tkzMarkAngle[size=1.5](B,A,C)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Determination of the three angles of a triangle}

\begin{tkzexample}[latex=6cm,small]
\begin{tikzpicture}
\tikzset{label angle style/.append style={pos=1.4}}
\tkzDefPoints{0/0/a,5/3/b,3/6/c}
\tkzDrawPolygon(a,b,c)
\tkzFindAngle(c,b,a)\tkzGetAngle{angleCBA}
\pgfmathparse{round(1+\angleCBA)}
\let\angleCBA\pgfmathresult
\tkzFindAngle(a,c,b)\tkzGetAngle{angleACB}
\pgfmathparse{round(\angleACB)}
\let\angleACB\pgfmathresult
\tkzFindAngle(b,a,c)\tkzGetAngle{angleBAC}
\pgfmathparse{round(\angleBAC)}
\let\angleBAC\pgfmathresult
\tkzMarkAngle(c,b,a)
\tkzLabelAngle(c,b,a){\tiny $\angleCBA^\circ$}
\tkzMarkAngle(a,c,b)
\tkzLabelAngle(a,c,b){\tiny $\angleACB^\circ$}
\tkzMarkAngle(b,a,c)
\tkzLabelAngle(b,a,c){\tiny $\angleBAC^\circ$}
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Angle between two circles}
We are looking for the angle formed by the tangents at a point of intersection

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.4]
\pgfkeys{/pgf/number format/.cd,%
          fixed,precision=1}
\tkzDefPoints{0/0/A,6/0/B,4/2/C}
\tkzDrawCircles(A,C B,C)
\tkzDefLine[tangent at=C](A) \tkzGetPoint{a}
\tkzDefPointsBy[symmetry = center C](a){d}
\tkzDefLine[tangent at=C](B) \tkzGetPoint{b}
\tkzDrawLines[add=1 and 4](a,C  C,b)
\tkzFillAngle[fill=teal,opacity=.2%
                        ,size=2](b,C,d)
\tkzFindAngle(b,C,d)\tkzGetAngle{bcd}
\tkzLabelAngle[pos=1.25](b,C,d){%
  \tiny $\pgfmathprintnumber{\bcd}^\circ$}
\end{tikzpicture}
\end{tkzexample}

\subsection{Angle formed by a straight line with the horizontal axis \tkzcname{tkzFindSlopeAngle}}
Much more interesting than the last one. The result is between -180 degrees and +180 degrees.

\begin{NewMacroBox}{tkzFindSlopeAngle}{\parg{A,B}}%
Determines the slope of the straight line (AB). The result is stored in a macro \tkzcname{tkzAngleResult}.

\medskip
\begin{tabular}{lll}%
\toprule
arguments  & example & explanation     \\
\midrule
\TAline{(pt1,pt2)} {\tkzcname{tkzFindSlopeAngle}(A,B)}{}
\bottomrule
\end{tabular}

\medskip
\tkzcname{tkzGetAngle} can retrieve the result. If retrieval is not necessary, you can use \tkzcname{tkzAngleResult}.
\end{NewMacroBox}

\subsubsection{How to use  \tkzcname{tkzFindSlopeAngle}}

 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.

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
 \tkzDefPoint(1,5){A} \tkzDefPoint(5,2){B}  
 \tkzFindSlopeAngle(A,B)\tkzGetAngle{tkzang}
 \tkzDefPointBy[rotation= center A angle \tkzang ](B)
 \tkzGetPoint{C}
 \tkzDefPointBy[rotation= center A angle -\tkzang ](B) 
 \tkzGetPoint{D}
 \tkzDrawSegment(A,B)
 \tkzDrawSegments[new](A,C A,D)
 \tkzDrawPoints(A,B,C,D)
 \tkzCompass[length=1](A,C)
 \tkzCompass[delta=10,brown](B,C)  
 \tkzLabelPoints(B,C,D)  
 \tkzLabelPoints[above left](A)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Use of \tkzcname{tkzFindSlopeAngle} and \tkzcname{tkzGetAngle}}
Here is another version of the construction of a mediator

\begin{tkzexample}[latex=6cm,small]
\begin{tikzpicture}
 \tkzInit
 \tkzDefPoint(0,0){A}        \tkzDefPoint(3,2){B}
 \tkzDefLine[mediator](A,B)  \tkzGetPoints{I}{J}
 \tkzCalcLength(A,B)         \tkzGetLength{dAB}
 \tkzFindSlopeAngle(A,B)     \tkzGetAngle{tkzangle}
 \begin{scope}[rotate=\tkzangle]
   \tkzSetUpArc[color=gray,line width=0.2pt,/tkzcompass/delta=10]
   \tkzDrawArc[R,arc](B,3/4*\dAB)(120,240)
   \tkzDrawArc[R,arc](A,3/4*\dAB)(-45,60)
   \tkzDrawLine(I,J)         \tkzDrawSegment(A,B)
  \end{scope}
  \tkzDrawPoints(A,B,I,J)    \tkzLabelPoints(A,B)
   \tkzLabelPoints[right](I,J)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Another use of \tkzcname{tkzFindSlopeAngle}}

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=1.5]
  \tkzDefPoint(1,2){A}    \tkzDefPoint(3,4){B}
  \tkzDefPoint(3,2){C}    \tkzDefPoint(3,1){D}
  \tkzDrawSegments(A,B A,C A,D)
  \tkzDrawPoints[color=red](A,B,C,D)  
  \tkzLabelPoints(A,B,C,D)
  \tkzFindSlopeAngle(A,B)\tkzGetAngle{SAB} 
  \tkzFindSlopeAngle(A,C)\tkzGetAngle{SAC}
  \tkzFindSlopeAngle(A,D)\tkzGetAngle{SAD}
  \pgfkeys{/pgf/number format/.cd,fixed,precision=2}
  \tkzText(1,5){The slope of (AB) is : 
     $\pgfmathprintnumber{\SAB}^\circ$}     
  \tkzText(1,4.5){The slope of (AC) is : 
     $\pgfmathprintnumber{\SAC}^\circ$}    
  \tkzText(1,4){The slope of (AD) is : 
     $\pgfmathprintnumber{\SAD}^\circ$}
\end{tikzpicture}
\end{tkzexample}

\endinput