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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
\section{Intersections}
It is possible to determine the coordinates of the points of intersection between two straight lines, a straight line and a circle, and two circles.
The associated commands have no optional arguments and the user must determine the existence of the intersection points himself.
\subsection{Intersection of two straight lines}
\begin{NewMacroBox}{tkzInterLL}{\parg{$A,B$}\parg{$C,D$}}%
Defines the intersection point \tkzname{tkzPointResult} of the two lines $(AB)$ and $(CD)$. The known points are given in pairs (two per line) in brackets, and the resulting point can be retrieved with the macro \tkzcname{tkzDefPoint}.
\end{NewMacroBox}
\subsubsection{Example of intersection between two straight lines}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[rotate=-45,scale=.75]
\tkzDefPoint(2,1){A}
\tkzDefPoint(6,5){B}
\tkzDefPoint(3,6){C}
\tkzDefPoint(5,2){D}
\tkzDrawLines(A,B C,D)
\tkzInterLL(A,B)(C,D)
\tkzGetPoint{I}
\tkzDrawPoints[color=blue](A,B,C,D)
\tkzDrawPoint[color=red](I)
\end{tikzpicture}
\end{tkzexample}
\subsection{Intersection of a straight line and a circle}
As before, the line is defined by a couple of points. The circle
is also defined by a couple:
\begin{itemize}
\item $(O,C)$ which is a pair of points, the first is the centre and the second is any point on the circle.
\item $(O,r)$ The $r$ measure is the radius measure. The unit can be the \emph{cm} or \emph{pt}.
\end{itemize}
\begin{NewMacroBox}{tkzInterLC}{\oarg{options}\parg{$A,B$}\parg{$O,C$} or \parg{$O,r$} or \parg{$O,C,D$}}%
So the arguments are two couples.
\medskip
\begin{tabular}{lll}%
\toprule
options & default & definition \\
\midrule
\TOline{N} {N} { (O,C) determines the circle}
\TOline{R} {N} { (O, 1 ) unit 1 cm}
\TOline{with nodes}{N} { (O,C,D) CD is a radius}
\bottomrule
\end{tabular}
\medskip
The macro defines the intersection points $I$ and $J$ of the line $(AB)$ and the center circle $O$ with radius $r$ if they exist; otherwise, an error will be reported in the |.log| file. \tkzname{with nodes} vous évite de calculer le rayon qui est la longueur de $[CD]$.
\end{NewMacroBox}
\subsubsection{Line-circle intersection}
In the following example, the drawing of the circle uses two points and the intersection of the straight line and the circle uses two pairs of points:
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.75]
\tkzInit[xmax=5,ymax=4]
\tkzDefPoint(1,1){O}
\tkzDefPoint(0,4){A}
\tkzDefPoint(5,0){B}
\tkzDefPoint(3,3){C}
\tkzInterLC(A,B)(O,C) \tkzGetPoints{D}{E}
\tkzDrawCircle(O,C)
\tkzDrawPoints[color=blue](O,A,B,C)
\tkzDrawPoints[color=red](D,E)
\tkzDrawLine(A,B)
\tkzLabelPoints[above right](O,A,B,C,D,E)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Line-circle intersection in Sangaku}
\begin{tkzexample}[vbox,small]
\begin{tikzpicture}[scale=1]
\def\ORadius{6}
\def\OORadius{4}
\pgfmathparse{(2*(\ORadius-\OORadius))/(\ORadius/\OORadius+1)}%
\let\OOORadius\pgfmathresult%
\pgfmathparse{\ORadius-\OOORadius}%
\let\OOOORadius\pgfmathresult%
\pgfmathparse{2*\OORadius-\ORadius}%
\let\XA\pgfmathresult%
\tkzDefPoint["$O$" below left](0,0){O}
\ifdim\XA pt = 0pt\relax%
\tkzDefPoint["$A$" below right](\XA,0){A}
\else
\tkzDefPoint["$A$" below left](\XA,0){A}
\fi
\tkzDefPoint["$D$" below right](\OORadius,0){D}
\tkzDefPoint["$X$" below left](-\ORadius,0){X}
\tkzDefPoint["$B$" below right](\ORadius,0){B}
\tkzDefPoint["$O_2$" below left](\OORadius-\ORadius,0){O2}
\tkzDefLine[mediator](A,B) \tkzGetPoints{mr}{ml}
\tkzInterLC[R](D,mr)(O,\ORadius) \tkzGetPoints{C}{E}
\tkzDefLine[orthogonal=through A](X,A) \tkzGetPoint{pr}
\ifdim\XA pt < 0 pt\relax
\tkzInterLC[R](A,pr)(O,\OOOORadius) \tkzGetPoints{O4}{O3}
\else
\ifdim\XA pt = 0pt\relax
\tkzInterLC[R](A,pr)(O,\OOOORadius) \tkzGetPoints{O4}{O3}
\else
\tkzInterLC[R](A,pr)(O,\OOOORadius) \tkzGetPoints{O3}{O4}
\fi
\fi
\tkzDefPointBy[projection=onto A--C](O3) \tkzGetPoint{H}
\tkzDrawCircles[R](O,{\ORadius} O2,{\OORadius} O3,{\OOORadius})
\tkzDrawSegments[dashed](O,O3 C,D O3,A O3,H)
\tkzDrawSegments(X,B A,C B,C)
\tkzMarkSegments[mark=s|](D,B D,A)
\tkzLabelPoints[right](O3,H)
\tkzLabelPoint[above right](C){$C$}
\tkzMarkRightAngles[fill=gray!30](X,D,C X,A,O3 A,H,O3)
\tkzDrawPoints(A,B,C,D,X,O,O2,O3,H)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{More complex example of a line-circle intersection}
Figure from \url{http://gogeometry.com/problem/p190_tangent_circle}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.75]
\tkzDefPoint(0,0){A}
\tkzDefPoint(8,0){B}
\tkzDefMidPoint(A,B)
\tkzGetPoint{O}
\tkzDefMidPoint(O,B)
\tkzGetPoint{O'}
\tkzDefTangent[from=A](O',B)
\tkzGetSecondPoint{E}
\tkzInterLC(A,E)(O,B)
\tkzGetSecondPoint{D}
\tkzDefPointBy[projection=onto A--B](D)
\tkzGetPoint{F}
\tkzDrawCircles(O,B O',B)
\tkzDrawSegments(A,D A,B D,F)
\tkzDrawSegments[color=red,line width=1pt,
opacity=.4](A,O F,B)
\tkzDrawPoints(A,B,O,O',E,D)
\tkzMarkRightAngle(D,F,B)
\tkzLabelPoints(A,B,O,O',E,D)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Circle defined by a center and a measure, and special cases}
Let's look at some special cases like straight lines tangent to the circle.
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.5]
\tkzDefPoint(0,8){A} \tkzDefPoint(8,0){B}
\tkzDefPoint(8,8){C} \tkzDefPoint(4,4){I}
\tkzDefPoint(2,7){E} \tkzDefPoint(6,4){F}
\tkzInterLC[R](A,C)(I,4) \tkzGetPoints{I1}{I2}
\tkzInterLC[R](B,C)(I,4) \tkzGetPoints{J1}{J2}
\tkzInterLC[R](A,B)(I,4) \tkzGetPoints{K1}{K2}
\tkzInterLC[R](E,F)(I,4) \tkzGetPoints{I2}{J2}
\tkzDrawCircle[R](I,4)
\tkzDrawPoints[color=red](I1,J1,K1,K2)
\tkzDrawLines(A,B B,C A,C I2,J2)
\tkzDrawPoints[color=blue](E,F)
\tkzDrawPoints[color=red](I2,J2)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{More complex example}
\tkzHandBomb\ Be careful with the syntax. First of all, calculations for the points can be done during the passage of the arguments, but the syntax of \tkzname{xfp} must be respected. You can see that I use the term \tkzname{pi} because \NamePack{xfp} can work with radians. You can also work with degrees but in this case, you need to use specific commands like |sind| or |cosd|. Furthermore, when calculations require the use of parentheses, they must be inserted in a group... \TEX \{ \dots \}.
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=1.25]
\tkzDefPoint(0,1){J}
\tkzDefPoint(0,0){O}
\tkzDrawArc[R,line width=1pt,color=red](J,2.5)(180,0)
\foreach \i in {0,-5,-10,...,-85,-90}{
\tkzDefPoint({2.5*cosd(\i)},{1+2.5*sind(\i)}){P}
\tkzDrawSegment[color=orange](J,P)
\tkzInterLC[R](P,J)(O,1)
\tkzGetPoints{M}{N}
\tkzDrawPoints[red](N)
}
\foreach \i in {-90,-95,...,-175,-180}{
\tkzDefPoint({2.5*cosd(\i)},{1+2.5*sind(\i)}){P}
\tkzDrawSegment[color=orange](J,P)
\tkzInterLC[R](P,J)(O,1)
\tkzGetPoints{M}{N}
\tkzDrawPoints[red](M)
}
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Calculation of radius example 1}
With \tkzname{pgfmath} and \tkzcname{pgfmathsetmacro}
The radius measurement may be the result of a calculation that is not done within the intersection macro, but before.
A length can be calculated in several ways. It is possible of course,
to use the module \tkzname{pgfmath} and the macro \tkzcname{pgfmathsetmacro}. In some cases, the results obtained are not precise enough, so the following calculation $0.0002 \div 0.0001$ gives $1.98$ with pgfmath while xfp will give $2$.
\subsubsection{Calculation of radius example 2}
With \tkzname{xfp} and \tkzcname{fpeval}:
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
\tkzDefPoint(2,2){A}
\tkzDefPoint(5,4){B}
\tkzDefPoint(4,4){O}
\pgfmathsetmacro\tkzLen{\fpeval{0.0002/0.0001}}
% or \edef\tkzLen{\fpeval{0.0002/0.0001}}
\tkzInterLC[R](A,B)(O, \tkzLen)
\tkzGetPoints{I}{J}
\tkzDrawCircle[R](O,\tkzLen)
\tkzDrawPoints[color=blue](A,B)
\tkzDrawPoints[color=red](I,J)
\tkzDrawLine(I,J)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Option "with nodes"}
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}[scale=.75]
\tkzDefPoints{0/0/A,4/0/B,1/1/D,2/0/E}
\tkzDefTriangle[equilateral](A,B)
\tkzGetPoint{C}
\tkzInterLC[with nodes](D,E)(C,A,B)
\tkzGetPoints{F}{G}
\tkzDrawCircle(C,A)
\tkzDrawPolygon(A,B,C)
\tkzDrawPoints(A,...,G)
\tkzDrawLine(F,G)
\end{tikzpicture}
\end{tkzexample}
\subsection{Intersection of two circles}
The most frequent case is that of two circles defined by their center and a point, but as before the option \tkzname{R} allows to use the radius measurements.
\begin{NewMacroBox}{tkzInterCC}{\oarg{options}\parg{$O,A$}\parg{$O',A'$} or \parg{$O,r$}\parg{$O',r'$} or \parg{$O,A,B$} \parg{$O',C,D$}}%
\begin{tabular}{lll}%
options & default & definition \\
\midrule
\TOline{N} {N} {$OA$ and $O'A'$ are radii, $O$ and $O'$ are the centres}
\TOline{R} {N} {$r$ and $r'$ are dimensions and measure the radii}
\TOline{with nodes} {N} { in (A,A,C)(C,B,F) AC and BF give the radii. }
\bottomrule
\end{tabular}
\medskip
This macro defines the intersection point(s) $I$ and $J$ of the two center circles $O$ and $O'$. If the two circles do not have a common point then the macro ends with an error that is not handled. \\
It is also possible to use directly \tkzcname{tkzInterCCN} and \tkzcname{tkzInterCCR}.
\end{NewMacroBox}
\subsubsection{Construction of an equilateral triangle}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[trim left=-1cm,scale=.5]
\tkzDefPoint(1,1){A}
\tkzDefPoint(5,1){B}
\tkzInterCC(A,B)(B,A)\tkzGetPoints{C}{D}
\tkzDrawPoint[color=black](C)
\tkzDrawCircles(A,B B,A)
\tkzCompass[color=red](A,C)
\tkzCompass[color=red](B,C)
\tkzDrawPolygon(A,B,C)
\tkzMarkSegments[mark=s|](A,C B,C)
\tkzLabelPoints[](A,B)
\tkzLabelPoint[above](C){$C$}
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Example a mediator}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.5]
\tkzDefPoint(0,0){A}
\tkzDefPoint(2,2){B}
\tkzInterCC(B,A)(A,B)\tkzGetPoints{M}{N}
\tkzDrawCircles[color=teal](A,B B,A)
\tkzDrawCircle[color=teal](A,B)
\tkzDrawPoints(M,N)
\tkzDrawLine[new](M,N)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{An isosceles triangle.}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[rotate=120,scale=.75]
\tkzDefPoint(1,2){A}
\tkzDefPoint(4,0){B}
\tkzInterCC[R](A,4)(B,4)
\tkzGetPoints{C}{D}
\tkzDrawCircles[R,dashed](A,4 B,4)
\tkzCompass[new](A,C)
\tkzCompass[new](B,C)
\tkzDrawPolygon(A,B,C)
\tkzDrawPoints(A,B,C)
\tkzMarkSegments[mark=s|](A,C B,C)
\tkzLabelPoints[](A,B)
\tkzLabelPoint[above](C){$C$}
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Segment trisection}
The idea here is to divide a segment with a ruler and a compass into three segments of equal length.
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.5]
\tkzDefPoint(0,0){A}
\tkzDefPoint(3,2){B}
\tkzInterCC(A,B)(B,A) \tkzGetPoints{C}{D}
\tkzInterCC(D,B)(B,A) \tkzGetPoints{A}{E}
\tkzInterCC(D,B)(A,B) \tkzGetPoints{F}{B}
\tkzInterLC(E,F)(F,A) \tkzGetPoints{D}{G}
\tkzInterLL(A,G)(B,E) \tkzGetPoint{O}
\tkzInterLL(O,D)(A,B) \tkzGetPoint{J}
\tkzInterLL(O,F)(A,B) \tkzGetPoint{I}
\tkzDrawCircles(D,A A,B B,A F,A)
\tkzDrawSegments[new](O,G
O,B O,D O,F)
\tkzDrawPoints(A,B,D,E,F,G,I,J)
\tkzLabelPoints(A,B,D,E,F,G,I,J)
\tkzDrawSegments(A,B B,D A,D%
A,F F,G E,G B,E)
\tkzMarkSegments[mark=s|](A,I I,J J,B)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{With the option "\tkzimp{with nodes}"}
\begin{tkzexample}[latex=6cm,small]
\begin{tikzpicture}[scale=.5]
\tkzDefPoints{0/0/a,0/5/B,5/0/C}
\tkzDefPoint(54:5){F}
\tkzInterCC[with nodes](A,A,C)(C,B,F)
\tkzGetPoints{a}{e}
\tkzInterCC(A,C)(a,e) \tkzGetFirstPoint{b}
\tkzInterCC(A,C)(b,a) \tkzGetFirstPoint{c}
\tkzInterCC(A,C)(c,b) \tkzGetFirstPoint{d}
\tkzDrawCircle[new](A,C)
\tkzDrawPoints(a,b,c,d,e)
\tkzDrawPolygon(a,b,c,d,e)
\foreach \vertex/\num in {a/36,b/108,c/180,
d/252,e/324}{%
\tkzDrawPoint(\vertex)
\tkzLabelPoint[label=\num:$\vertex$](\vertex){}
\tkzDrawSegment(A,\vertex)
}
\end{tikzpicture}
\end{tkzexample}
\subsubsection{Mix of intersections}
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}[scale = .75]
\tkzDefPoint(2,2){A}
\tkzDefPoint(0,0){B}
\tkzDefPoint(-2,2){C}
\tkzDefPoint(0,4){D}
\tkzDefPoint(4,2){E}
\tkzCircumCenter(A,B,C)\tkzGetPoint{O}
\tkzInterCC[R](O,2)(D,2) \tkzGetPoints{M1}{M2}
\tkzInterCC(O,A)(D,O) \tkzGetPoints{1}{2}
\tkzInterLC(A,E)(B,M1) \tkzGetSecondPoint{M3}
\tkzInterLC(O,C)(M3,D) \tkzGetSecondPoint{L}
\tkzDrawSegments(C,L)
\tkzDrawPoints(A,B,C,D,E,M1,M2,M3,O,L)
\tkzDrawSegments(O,E)
\tkzDrawSegments[dashed](C,A D,B)
\tkzDrawPoint(O)
\tkzDrawCircles[dashed](M3,D B,M2 D,O)
\tkzDrawCircle(O,A)
\tkzLabelPoints(A,B,C,D,E,M1,M2,M3,O,L)
\end{tikzpicture}
\end{tkzexample}
\subsubsection{An oval}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=0.4]
\tkzDefPoint(-4,0){I}
\tkzDefPoint(4,0){J}
\tkzDefPoint(0,0){O}
\tkzInterCC(J,O)(O,J) \tkzGetPoints{L}{H}
\tkzInterCC(I,O)(O,I) \tkzGetPoints{K}{G}
\tkzInterLL(I,K)(J,H) \tkzGetPoint{M}
\tkzInterLL(I,G)(J,L) \tkzGetPoint{N}
\tkzDefPointsBy[symmetry=center J](L,H){D,E}
\tkzDefPointsBy[symmetry=center I](G,K){C,F}
\begin{scope}[line style/.style = {very thin,teal}]
\tkzDrawLines[add=1.5 and 1.5](I,K I,G J,H J,L)
\tkzDrawLines[add=.5 and .5](I,J)
\tkzDrawPoints(H,L,K,G,I,J,D,E,C,F,M,N)
\tkzDrawCircles[R](O,4 I,4 J,4)
\tkzDrawArc(N,D)(C)
\tkzDrawArc(M,F)(E)
\tkzDrawArc(J,E)(D)
\tkzDrawArc(I,C)(F)
\end{scope}
\tkzLabelPoints(H,L,K,G,I,J,D,E,C,F,M,N)
\end{tikzpicture}
\end{tkzexample}
\endinput
|