Debian Codegraph @

texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-circle.tex

raw
1 \newpage
2 \section{Class \tkzClass{circle}}
3
4 The \tkzVar{circle}{C} variable is a table reserved for storing circle objects. Although its use is optional and any valid variable name may be used (e.g., \code{Circles}), it is strongly recommended to adopt the standard name \texttt{C} to ensure consistency and readability. If a custom variable is used, it must be initialized manually. The \tkzFct{tkz-elements}{init\_elements()} function will reset the \texttt{circle}{C} table if it has already been defined.
5
6
7 \subsubsection{Creating a circle}
8 \label{ssub:creating_a_circle}
9 A circle is defined by two points:
10 \begin{itemize}
11 \item the center of the circle,
12 \item a point lying on the circle.
13 \end{itemize}
14 \vspace{0.5em}
15
16 To create a circle, use the following syntax:
17 \begin{mybox}
18 \code{C.OA = circle(z.O, z.A)}
19 \end{mybox}
20
21 The newly created circle object stores various geometric attributes such as its radius, diameter, and notable points on the circumference (e.g., north, east, south, and west poles).
22
23 \subsection{Attributes of a circle}
24
25 A circle object stores various geometric attributes that can be accessed for further computation or drawing. These attributes are automatically computed at creation.
26
27 \vspace{1em}
28
29 \bgroup
30 \catcode`_=12
31 \small
32 \captionof{table}{Circle attributes.}\label{circle:attributes}
33 \begin{tabular}{ll}
34 \toprule
35 \texttt{Attributes} & \texttt{Reference} \\
36 \midrule
37 \tkzAttr{circle}{type} & Type of circle, always "circle" \\
38 \tkzAttr{circle}{center} & Center of the circle \\
39 \tkzAttr{circle}{through} & Point through which the circle passes \\
40 \tkzAttr{circle}{radius} & [\ref{ssub:example_circle_attributes}] \\
41 \tkzAttr{circle}{north} & [\ref{ssub:example_circle_attributes}] \\
42 \tkzAttr{circle}{south} & [\ref{ssub:example_circle_attributes}] \\
43 \tkzAttr{circle}{east} & [\ref{ssub:example_circle_attributes}] \\
44 \tkzAttr{circle}{west} & [\ref{ssub:example_circle_attributes}] \\
45 \tkzAttr{circle}{opp} & [\ref{ssub:example_circle_attributes}] \\
46 \tkzAttr{circle}{ct} & [\ref{ssub:example_circle_attributes}] \\
47 \tkzAttr{circle}{perimeter} & [\ref{ssub:attributes_perimeter_and_area}] \\
48 \tkzAttr{circle}{area} & [\ref{ssub:attributes_perimeter_and_area}] \\
49 \bottomrule %
50 \end{tabular}
51 \egroup
52
53
54
55 \subsubsection{Example: circle attributes}
56 \label{ssub:example_circle_attributes}
57
58 Several attributes of the \tkzNameObj{circle} class are illustrated in the following example.
59
60 \medskip
61
62 The point diametrically opposite a given point on the circle can be obtained using the method:
63
64 \begin{center}
65 \code{z.Mp = C.OA:antipode(z.M)}
66 \end{center}
67
68
69 When a circle object is created using \code{circle}, the point diametrically opposite the defining point (the one through which the circle passes) is automatically generated and stored in the attribute \code{opp}.
70
71 \medskip
72
73 In addition, the line passing through the center and that point is also created and accessible via the attribute \code{ct} (center-to-through). This is particularly useful when dealing with a circle returned by a function, and you don't know in advance which points were used to construct it.
74
75 \vspace{1em}
76
77 \begin{tkzexample}[latex=7cm]
78 \directlua{
79 init_elements()
80 z.a = point(1, 1)
81 z.b = point(5, 4)
82 C.ab = circle(z.a, z.b)
83 z.s = C.ab.south
84 z.w = C.ab.west
85 r = C.ab.radius
86 z.c = C.ab.opp
87 z.r,
88 z.t = C.ab.ct:ortho_from(z.b):get()}
89 \begin{center}
90 \begin{tikzpicture}[scale=.5]
91 \tkzGetNodes
92 \tkzDrawPoints(a,b,c,s,w)
93 \tkzLabelPoints(a,b,c,s,w)
94 \tkzDrawCircle(a,b)
95 \tkzDrawSegments(a,b r,t b,c)
96 \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}}
97 \end{tikzpicture}
98 \end{center}
99 \end{tkzexample}
100
101
102 \subsubsection{Attributes perimeter and area}
103 \label{ssub:attributes_perimeter_and_area}
104
105 \pgfkeys{/pgf/number format/.cd,std,precision=4}
106 \let\pmpn\pgfmathprintnumber
107
108 \begin{mybox}
109 \begin{verbatim}
110 \directlua{
111 z.A = point(1, 2)
112 z.B = point(4, 3)
113 C.AB = circle(z.A, z.B)
114 p = C.AB.perimeter
115 a = C.AB.area}
116
117 Let be two points $A$ and $B$. The circle of center $A$ passing
118 through $B$ has perimeter \pmpn{\tkzUseLua{p}} $cm$
119 and area \pmpn{\tkzUseLua{a} }$cm^2$.
120 \end{verbatim}
121 \end{mybox}
122
123 \directlua{
124 z.A = point(1, 2)
125 z.B = point(4, 3)
126 C.AB = circle(z.A, z.B)
127 p = C.AB.perimeter
128 a = C.AB.area}
129
130 Let be two points $A$ and $B$.
131 The circle of center $A$ passing through $B$ has perimeter \pmpn{\tkzUseLua{p}} $cm$ and area \pmpn{\tkzUseLua{a} }$cm^2$.
132
133
134 \newpage
135 \subsection{Methods of the class circle}
136 The circle class offers a wide range of methods, which can be grouped according to the type of value they return: numbers, booleans, strings, points, lines, or circles. These methods allow for computations such as checking inclusion, finding tangents, computing inversions, and more.
137
138 \vspace{1em}
139
140 \bgroup
141 \catcode`_=12
142 \small
143 \captionof{table}{Circle methods.}\label{circle:methods}
144 \begin{tabular}{ll}
145 \toprule
146 \texttt{Methods} & \texttt{Reference} \\
147 \midrule
148 \texttt{Constructor} & \\
149 \midrule
150 \tkzFct{circle}{new(O,A)} & [\ref{ssub:method_circle_new}; \ref{ssub:creating_a_circle}]\\
151 \tkzFct{circle}{radius(O,r)} & Deprecated; See [\ref{ssub:method_circle_radius}]\\
152 \tkzFct{circle}{diameter(A,B)} & Deprecated; See [\ref{ssub:method_circle_diameter}]\\
153 \midrule
154 \texttt{Methods Returning a Real Number} & \\
155 \midrule
156 \tkzMeth{circle}{power(pt)}& \ref{ssub:power}] \\
157 \midrule
158 \texttt{Methods Returning a String} & \\
159 \midrule
160 \tkzMeth{circle}{circles\_position(C1)} & [\ref{ssub:circles_position}] \\
161 \tkzMeth{circle}{position(obj)} & [\ref{ssub:circle_position}]\\
162 \tkzMeth{circle}{lines\_position(L)} & [\ref{ssub:method_circle_lines_position}]\\
163 \midrule
164 \texttt{Methods Returning a Boolean} & \\
165 \midrule
166 \tkzMeth{circle}{is\_tangent(L)} & [\ref{ssub:method_circle_is_tangent}] \\
167 \tkzMeth{circle}{is\_secant(L)} & [\ref{ssub:method_circle_is_secant}] \\
168 \tkzMeth{circle}{is\_disjoint(L)} & [\ref{ssub:method_circle_is_disjoint}] \\
169 \midrule
170 \texttt{Methods Returning a Point} & \\
171 \midrule
172 \tkzMeth{circle}{get(i)} & [\ref{ssub:method_circle_get}] \\
173 \tkzMeth{circle}{antipode(pt)} & [\ref{ssub:method_circle_antipode}] \\
174 \tkzMeth{circle}{midarc(pt,pt)} & [\ref{ssub:method_circle_midarc}]\\
175 \tkzMeth{circle}{point(r,<pt>)} & [\ref{ssub:method_circle_point}]\\
176 \tkzMeth{circle}{random\_pt(<'inside'>)} & [\ref{ssub:method_imeth_circle_random_inside}]\\
177 \tkzMeth{circle}{inversion(obj)} & [\ref{ssub:inversion}; \ref{par:inversion_circle} \ref{par:inversion_line}]\\
178 \tkzMeth{circle}{inversion\_neg(obj)} & [\ref{ssub:inversion_neg}]\\
179 \tkzMeth{circle}{internal\_similitude(C)} & [\ref{ssub:method_circle_internal__similitude}]\\
180 \tkzMeth{circle}{external\_similitude(C)} & [\ref{ssub:method_circle_external__similitude}] \\
181 \tkzMeth{circle}{similitude(mode, C)} & [\ref{ssub:similitude}] \\
182
183 \tkzMeth{circle}{radical\_center(C1<,C2>)} & [\ref{ssub:radical_center}] \\
184 \tkzMeth{circle}{pole(L)} & [\ref{ssub:method_circle_pole}]\\
185 \midrule
186 \texttt{Methods Returning a Line} & \\
187 \midrule
188 \tkzMeth{circle}{radical\_axis(C)} & [ \ref{ssub:method_circle_radical__axis_c} ; \ref{par:radical_axis_v1}; \ref{par:radical_axis_v2}; \ref{par:radical_axis_v3}; \ref{par:radical_axis_v4}] \\
189 \tkzMeth{circle}{tangent\_at(pt)} & [\ref{ssub:method_circle_tangent__at_pt}] \\
190 \tkzMeth{circle}{tangent\_from(pt)}& [\ref{ssub:method_circle_tangent__from_pt}] \\
191 \tkzMeth{circle}{tangent\_parallel(L)}& [\ref{ssub:method_circle_tangent_parallel}] \\
192 \tkzMeth{circle}{common\_tangent(C)}& [\ref{ssub:common_tangent}] \\
193 \tkzMeth{circle}{polar()} & [\ref{ssub:method_circle_polar_pt}] \\
194 \bottomrule
195 \end{tabular}
196 \egroup
197
198 \newpage
199 \bgroup
200 \catcode`_=12
201 \small
202 \captionof{table}{Circle methods}\label{circle:methods 2}
203 \begin{tabular}{ll}
204 \toprule
205 \texttt{Methods Returning a Circle}&\\
206 \midrule
207 \tkzMeth{circle}{orthogonal\_from(pt)} & [\ref{ssub:method_circle_orthogonal_from_pt}]\\
208 \tkzMeth{circle}{orthogonal\_through(pta,ptb)}& [\ref{ssub:method_circle_orthogonal_through}]\\
209 \tkzMeth{circle}{midcircle(C)} & [\ref{ssub:midcircle}; \ref{midcircle_diameter}] \\
210 \tkzMeth{circle}{radical\_circle(C1<,C2>)} & [\ref{ssub:radical_circle}] \\
211 \tkzMeth{circle}{CPP(pt,pt)} & [\ref{ssub:method_c__c__pp}] \\
212 \tkzMeth{circle}{CCP(C,pt)} &[\ref{ssub:method_c_cc_p}] \\
213 \tkzMeth{circle}{CLP(L,pt,<'inside'>)} & [\ref{ssub:method_c_lc_p}] \\
214 \tkzMeth{circle}{CLL}& \ref{ssub:method_c_cll}\\
215 \tkzMeth{circle}{CCL}(C2, L) & \ref{ssub:CCL}\\
216 \tkzMeth{circle}{CCC(C2, C3[, opts])} & \ref{ssub:CCC}\\
217 \tkzMeth{circle}{CCC\_gergonne}(C2, C3) & \ref{ssub:CCC_gergonne}\\
218 \texttt{Methods Returning a Path} & \\
219 \tkzMeth{circle}{path(pt,pt,nb)} &[\ref{ssub:circle_path}] \\
220 \bottomrule
221 \end{tabular}
222 \egroup
223
224 \bgroup
225 \catcode`_=12
226 \small
227 \captionof{table}{Auxiliary functions for circle construction.}\label{circle:functions}
228 \begin{tabular}{ll}
229 \toprule
230 \texttt{Functions Returning two Points} & \\
231 \midrule
232 \tkzFct{circle}{through(pt,r,<angle>)} & See [\ref{ssub:function_code_through_and_code_diameter}] \\
233
234 \tkzFct{circle}{diameter(pt,pt,<'swap'> or <angle>)}& See [\ref{ssub:function_code_through_and_code_diameter}] \\
235
236 \bottomrule
237 \end{tabular}
238 \egroup
239
240
241
242 Each method can be called using the dot syntax, such as \code{C.OA:antipode(z.P)} or \code{C.OA:radical\_axis(C1)}. Deprecated methods are retained for compatibility but should be avoided in new code.
243
244 \subsubsection{Method \tkzMeth{circle}{new}(pt, pt)}
245 \label{ssub:method_circle_new}
246
247 This method creates a new circle object defined by two points:
248 \begin{itemize}
249 \item the \emph{center} of the circle,
250 \item a \emph{point on the circumference}, referred to as \code{through}.
251 \end{itemize}
252 The radius is computed as the Euclidean distance between the two points. Internally, the circle object stores both the center and the defining point, and computes several useful attributes for further geometric constructions.
253
254 \vspace{1em}
255 \texttt{Short form: }
256
257 The function \code{circle(center, through)} is equivalent to \code{circle:new(center, through)} and is recommended for ease of use.
258 \begin{mybox}
259 \begin{verbatim}
260 C.OA = circle(z.O, z.A)
261 -- same as:
262 C.OA = circle:new(z.O, z.A)
263 \end{verbatim}
264 \end{mybox}
265
266 \texttt{Derived attributes: }
267
268
269 Once created, the circle object contains:
270 \begin{itemize}
271 \item \code{radius} — the distance from the center to the point,
272 \item \code{diameter} — twice the radius,
273 \item \code{opp} — the point diametrically opposite to \code{through},
274 \item \code{ct} — the directed segment from center to through point.
275 \end{itemize}
276 These attributes are computed automatically and accessible via dot notation (e.g., \code{C.OA.radius}, \code{C.OA.opp}).
277
278
279 \vspace{1em}
280
281 \begin{tkzexample}[latex=.5\textwidth]
282 \directlua{
283 init_elements()
284 z.O = point(0, 0)
285 z.A = point(2, 1)
286 C.OA = circle(z.O, z.A)}
287 \begin{center}
288 \begin{tikzpicture}[gridded]
289 \tkzGetNodes
290 \tkzDrawCircle(O,A)
291 \tkzDrawPoints(A,O)
292 \tkzLabelPoints[right](A,O)
293 \end{tikzpicture}
294 \end{center}
295 \end{tkzexample}
296
297
298 \subsubsection{Functions \tkzFct{circle}{through} and \tkzFct{circle}{diameter}}
299 \label{ssub:function_code_through_and_code_diameter}
300
301 These two utility functions assist in defining circles based on minimal data. They do not return a circle object themselves but instead return a pair of points: the \emph{center} and a \emph{point through which the circle passes}. These can be directly passed to \code{circle(...)}, as shown below.
302
303 \begin{mybox}
304 \begin{verbatim}
305 C.OT = circle(through(z.O, 5)) -- default angle = 0
306 C.OT = circle(through(z.O, 5, math.pi / 3)) -- point at 60°
307 C.OT = circle(diameter(z.A, z.B)) -- through = B
308 C.OT = circle(diameter(z.A, z.B, "swap")) -- through = A
309 \end{verbatim}
310 \end{mybox}
311
312 \textbf{1. Function \code{through(center, radius, <angle>])}}
313
314 Constructs a circle based on:
315 \begin{itemize}
316 \item a center point,
317 \item a radius (positive real),
318 \item an optional angle (in radians) specifying the position of the point on the circumference.
319 \end{itemize}
320 If the angle is omitted, the point lies on the positive \(x\)-axis from the center (i.e., angle = 0).
321
322 \textbf{2. Function \code{diameter(A, B, <'swap'> or <angle>)}}
323
324 Constructs a circle using two diametrically opposed points. The function returns:
325
326 \begin{itemize}
327 \item the midpoint of \([AB]\) as the center,
328 \item one of the two points as the \code{through} point.
329 \end{itemize}
330
331 By default, the second argument (\code{B}) is returned as the \code{through} point. If the optional third argument \code{"swap"} is provided, the first point (\code{A}) is used instead. The optional angle (in radians) specifying the position of the point "through" on the circumference.
332
333 \vspace{1em}
334
335 \begin{tkzexample}[latex=6cm]
336 \directlua{
337 z.A = point(0, 0)
338 z.B = point(2, 1)
339 C.T = circle(through(z.A, math.sqrt(5), math.pi / 2))
340 C.a = circle(diameter(z.A, z.B))
341 z.T = C.T.through
342 C.b = circle(diameter(z.A, z.T, "swap"))
343 z.w = C.a.center
344 z.t = C.a.through
345 z.u = C.b.center
346 z.v = C.b.through}
347 \begin{tikzpicture}[gridded]
348 \tkzGetNodes
349 \tkzDrawCircles(A,T w,t u,v)
350 \tkzDrawPoints(A,B,T)
351 \tkzLabelPoints[right](A,B,T)
352 \end{tikzpicture}
353 \end{tkzexample}
354
355 \subsubsection{Method \tkzMeth{circle}{radius(pt,r)}}
356 \label{ssub:method_circle_radius}
357
358 (Deprecated see above [\ref{ssub:function_code_through_and_code_diameter}])
359
360 This method has been retained for backward compatibility but is no longer recommended. It has been replaced by a more flexible and construction-oriented approach.
361
362 We define a circle with its centre and radius.
363
364 \vspace{1em}
365 \begin{tkzexample}[latex=.5\textwidth]
366 \directlua{
367 init_elements()
368 z.O = point(0, 0)
369 z.A = point(2, 1)
370 C.T = circle:radius(z.A, math.sqrt(5))
371 % better
372 % C.T = circle(from_radius(z.A, math.sqrt(5)))
373 z.T = C.T.through }
374 \begin{center}
375 \begin{tikzpicture}[gridded]
376 \tkzGetNodes
377 \tkzDrawCircles(A,T)
378 \tkzDrawPoints(A,O,T)
379 \tkzLabelPoints[right](A,O,T)
380 \end{tikzpicture}
381 \end{center}
382 \end{tkzexample}
383
384
385 \subsubsection{Method \tkzMeth{circle}{diameter(pt,pt)}}
386 \label{ssub:method_circle_diameter}
387
388 (Deprecated see above [\ref{ssub:function_code_through_and_code_diameter}])
389
390 This method has been retained for backward compatibility but is no longer recommended. It has been replaced by a more flexible and construction-oriented approach.
391
392 A circle is defined by two points at the ends of one of its diameters.
393
394 \vspace{1em}
395 \begin{tkzexample}[latex=.5\textwidth]
396 \directlua{
397 init_elements()
398 z.A = point(0, 0)
399 z.B = point(2, 1)
400 C.T = circle:diameter(z.A, z.B)
401 % better C.T = from_diameter(z.A, z.B)
402 z.O = C.T.center
403 z.T = C.T.through}
404 \begin{center}
405 \begin{tikzpicture}[gridded]
406 \tkzGetNodes
407 \tkzDrawCircles(O,T)
408 \tkzDrawPoints(A,B,O,T)
409 \tkzLabelPoints[right](A,B,O,T)
410 \end{tikzpicture}
411 \end{center}
412 \end{tkzexample}
413
414 \subsection{Returns a boolean value}
415
416 \subsubsection{Method \tkzMeth{circle}{is\_tangent(L)}}
417 \label{ssub:method_circle_is_tangent}
418
419 This method checks whether a given line is tangent to the circle. It returns a boolean value: \code{true} if the line is tangent, and \code{false} otherwise.
420
421 \medskip
422
423 This is useful for logical tests and conditional constructions in Lua. The method uses geometric distance and precision tolerance to determine tangency.
424
425 \medskip
426
427 Example:
428
429 \begin{tkzexample}[latex=.5\textwidth]
430 \directlua{
431 z.A = point(0, 0)
432 z.B = point(0, 2)
433 C.AB = circle(z.A, z.B)
434 z.C = point(2, -2)
435 z.D = point(2, 3)
436 L.CD = line(z.C, z.D)
437 if C.AB:is_tangent(L.CD) then
438 tex.print("L.CD tangent to C.AB")
439 else
440 tex.print("L.CD no tangent to C.AB")
441 end}
442 \begin{tikzpicture}
443 \tkzGetNodes
444 \tkzDrawCircle(A,B)
445 \tkzDrawLines(C,D)
446 \tkzDrawPoints(A,B,C,D)
447 \tkzLabelPoints[below left](A,C)
448 \tkzLabelPoints[above right](B,D)
449 \end{tikzpicture}
450 \end{tkzexample}
451
452 \subsubsection{Method \tkzMeth{circle}{is\_secant(L)}}
453 \label{ssub:method_circle_is_secant}
454 see the example above
455
456 \subsubsection{Method \tkzMeth{circle}{is\_disjoint(L)}}
457 \label{ssub:method_circle_is_disjoint}
458 see the example above
459
460 \subsubsection{Method \tkzMeth{circle}{power(pt)}}
461 \label{ssub:power}
462
463 The \code{power} method computes the \emph{power of a point} with respect to the given circle. It is defined as:
464
465 \[
466 \text{power}(P) = |OP|^2 - r^2
467 \]
468
469 where $O$ is the center of the circle and $r$ its radius.
470
471 \medskip
472
473 The sign of the result allows us to determine the relative position of the point $P$:
474 \begin{itemize}
475 \item positive: the point lies outside the circle,
476 \item zero: the point lies on the circle,
477 \item negative: the point lies inside the circle.
478 \end{itemize}
479
480 \medskip
481
482 Here is an example using a function to print this information:
483
484 \vspace{1em}
485 \begin{minipage}{.65\textwidth}
486 \begin{verbatim}
487 \directlua{
488 init_elements()
489 z.O = point(0, 0)
490 z.R = point(2, 0)
491 z.A = point(1, 1)
492 z.B = point(2, -1)
493 C.OR = circle(z.O, z.R)
494 function position(pt)
495 if C.OR:power(pt) > 0
496 then
497 return tex.print("out")
498 else
499 return tex.print("in")
500 end
501 end}
502 \begin{tikzpicture}
503 \tkzGetNodes
504 \tkzDrawCircle(O,R)
505 \tkzDrawPoints(A,O,B)
506 \tkzLabelPoint(A){\tkzUseLua{position(z.A)}}
507 \tkzLabelPoint(B){\tkzUseLua{position(z.B)}}
508 \end{tikzpicture}
509 \end{verbatim}
510 \end{minipage}
511 \begin{minipage}{.35\textwidth}
512 \directlua{
513 init_elements()
514 z.O = point(0, 0)
515 z.R = point(2, 0)
516 z.A = point(1, 1)
517 z.B = point(2, -1)
518 C.OR = circle(z.O, z.R)
519 function position(pt)
520 if C.OR:power(pt)>0
521 then
522 return tex.print("out")
523 else
524 return tex.print("in")
525 end
526 end}
527 \begin{center}
528 \begin{tikzpicture}
529 \tkzGetNodes
530 \tkzDrawCircle(O,R)
531 \tkzDrawPoints(A,O,B)
532 \tkzLabelPoint(A){\tkzUseLua{position(z.A)}}
533 \tkzLabelPoint(B){\tkzUseLua{position(z.B)}}
534 \end{tikzpicture}
535 \end{center}
536 \end{minipage}
537
538 %--------------------------------------------------------------------
539 \subsubsection{Method \tkzMeth{circle}{position(obj)}}
540 \label{ssub:circle_position}
541
542 This method determines the geometric relation between a circle and another object.
543 An optional argument \code{EPS} may be provided to adjust the numerical tolerance.
544 By default, \code{EPS} is the global value \tkzVar{tkz}{tkz.epsilon}.
545
546 \medskip
547 \texttt{Syntax:}
548
549 \verb|result = C:position(obj [, EPS])|
550
551 \medskip
552 \texttt{Supported object types and return values}
553
554 \begin{itemize}
555
556 \item \textbf{Point}
557
558 Returns one of:
559 \begin{itemize}
560 \item \code{"IN"} — point strictly inside the disk,
561 \item \code{"ON"} — point on the circumference,
562 \item \code{"OUT"} — point outside the disk.
563 \end{itemize}
564
565 \item \textbf{Line}
566
567 Returns one of:
568 \begin{itemize}
569 \item \code{"DISJOINT"} — no intersection,
570 \item \code{"TANGENT"} — exactly one common point,
571 \item \code{"SECANT"} — two intersection points.
572 \end{itemize}
573
574 \item \textbf{Circle}
575
576 Returns one of:
577 \begin{itemize}
578 \item \code{"DISJOINT\_EXT"} — exterior disjoint circles,
579 \item \code{"TANGENT\_EXT"} — exterior tangency,
580 \item \code{"SECANT"} — two intersections,
581 \item \code{"TANGENT\_INT"} — interior tangency,
582 \item \code{"DISJOINT\_INT"} — one circle strictly inside the other,
583 \item \code{"CONCENTRIC"} — same center, different radii,
584 \item \code{"COINCIDENT"} — identical circles.
585 \end{itemize}
586
587 \end{itemize}
588
589 \medskip
590 \texttt{Remarks}
591
592 \begin{itemize}
593 \item Returned values are symbolic uppercase strings.
594 \item Results are tolerance-aware.
595 \item Unsupported object types raise an error.
596 \end{itemize}
597
598 \vspace{1em}
599
600 \begin{tkzexample}[latex=.5\textwidth]
601 \directlua{
602 init_elements()
603 z.O = point(0, 0)
604 z.A = point(1 ,2)
605 C.OA = circle(z.O, z.A)
606 z.N = point(-2, 2)
607 z.M = point(1, 0)
608 z.P = point(2, 1)
609
610 PCm = C.OA:position(z.M)
611 PDm = C.OA:position_disk(z.M)
612 PCn = C.OA:position(z.N)
613 PDn = C.OA:position_disk(z.N)
614 PCp = C.OA:position(z.P)
615 PDp = C.OA:position_disk(z.P)
616 }
617
618 \def\tkzPosPoint#1#2#3#4{%
619 \tkzLabelPoints(O,M,N,P)
620 \tkzLabelPoint[below=#4pt,
621 font=\scriptsize](#2){%
622 \tkzUseLua{#1} on the #3}%
623 }
624
625 \begin{center}
626 \begin{tikzpicture}
627 \tkzGetNodes
628 \tkzDrawSegments[dashed](O,M O,N O,P)
629 \tkzDrawCircle(O,A)
630 \tkzDrawPoints(O,M,N,P)
631
632 \tkzPosPoint{PCm}{M}{circle}{8}
633 \tkzPosPoint{PCn}{N}{circle}{8}
634 \tkzPosPoint{PCp}{P}{circle}{8}
635
636 \tkzPosPoint{PDm}{M}{disk}{14}
637 \tkzPosPoint{PDn}{N}{disk}{14}
638 \tkzPosPoint{PDp}{P}{disk}{14}
639 \end{tikzpicture}
640 \end{center}
641 \end{tkzexample}
642
643
644 \subsubsection{Method \tkzMeth{circle}{in\_out} for circle and disk; Deprecated}
645 \label{ssub:in_out_for_circle_and_disk}
646
647 The following methods
648 \code{in\_out()}, \code{in\_out\_disk()},
649 \code{in\_disk(p)}, \code{in\_out\_disk(p)},
650 \code{in\_disk\_strict(p)} and
651 \code{out\_disk\_strict(p)} have been replaced by \code{position} and \code{position\_disk}. See [\ref{ssub:circle_position}]
652
653 \texttt{Note: } They still exist, but it is preferable to use \code{position}.
654
655 \subsubsection{Method \tkzMeth{circle}{line\_position(L)}}
656 \label{ssub:method_circle_line_position}
657
658 \texttt{Purpose: }
659
660 This method classifies the position of a line relative to a circle.
661
662 It returns whether the line is \texttt{disjoint}, \texttt{tangent} or \texttt{secant}.
663
664 \medskip
665 \texttt{Syntax: } \verb|pos = C.AB:line_position(L.CD)|
666
667 \medskip
668 \texttt{Arguments: }
669
670 \texttt{L} — a \tkzname{line} object to be tested against the circle.
671
672 \medskip
673 \texttt{Return value: }
674
675 A string describing the relative position of the line:
676 \begin{itemize}
677 \item \texttt{"DISJOINT"} — no intersection between line and circle,
678 \item \texttt{"TANGENT"} — line tangent to the circle (one point of contact),
679 \item \texttt{"SECANT"} — line intersecting the circle at two points.
680 \end{itemize}
681
682 \medskip
683 \texttt{Remarks: }
684
685 \begin{itemize}
686 \item The radius is computed from the center and the defining point (\texttt{self.through})
687 to ensure numerical stability.
688 \item The tolerance \tkzVar{tkz}{tkz.epsilon} is used to handle rounding errors near tangency.
689 \end{itemize}
690
691 \medskip
692 \texttt{Example usage: }
693
694 \begin{tkzexample}[latex=.5\textwidth]
695 \directlua{
696 z.A = point(0, 0)
697 z.B = point(4, -2)
698 L.AB = line (z.A, z.B )
699 z.O = point(2, 2)
700 z.X = z.O + point(0,-2)
701 C.OX = circle(z.O, z.X)
702 tex.print(C.OX:line_position(L.AB))}
703 \begin{tikzpicture}[gridded]
704 \tkzGetNodes
705 \tkzDrawLines[blue](A,B)
706 \tkzDrawCircle(O,X)
707 \end{tikzpicture}
708 \end{tkzexample}
709
710 \subsubsection{Method \tkzMeth{circle}{lines\_position(L1, L2, mode)}}
711 \label{ssub:method_circle_lines_position}
712
713 \texttt{Purpose: }
714
715 This method determines the relative position of a circle with respect to two lines.
716 It analyzes which angular or strip sectors are touched by the circle depending on whether the lines are parallel or secant.
717 The result is returned as a list of integers corresponding to the sectors intersected by the circle.
718
719 \texttt{Syntax: } \verb|sectors = C:lines_position(L1, L2 [, mode])|
720
721 \texttt{Arguments: }
722
723 \begin{itemize}
724 \item \texttt{L1}, \texttt{L2} — two \tkzname{line} objects.
725 \item \texttt{mode} — an optional string:
726 \begin{itemize}
727 \item \texttt{"parallel"} — if the lines are known to be parallel;
728 \item any other value (or omitted) — default, for secant lines.
729 \end{itemize}
730 \end{itemize}
731
732 \texttt{Return value: }
733
734 A Lua table (list of integers) representing the indices of the sectors touched by the circle.
735
736 \medskip
737 For secant lines:
738 \begin{itemize}
739 \item sectors are numbered counterclockwise from the first line to the second:
740 \texttt{1, 2, 3, 4};
741 \item for example, \texttt{\{1\}} means the circle is entirely inside the first sector,
742 and \texttt{\{4, 1, 2\}} means the circle touches three adjacent sectors.
743 \end{itemize}
744
745 For parallel lines:
746 \begin{itemize}
747 \item sectors are numbered as:
748 \texttt{1} – between the lines,
749 \texttt{2} – outside on the side of \texttt{L1},
750 \texttt{3} – outside on the side of \texttt{L2};
751 \item examples:
752 \texttt{\{1\}} → circle entirely between the lines;
753 \texttt{\{1,2\}} → tangent to \texttt{L1};
754 \texttt{\{1,2,3\}} → circle large enough to cross both lines.
755 \end{itemize}
756
757 \texttt{Remarks: }
758
759 \begin{itemize}
760 \item The classification is purely geometric and does not compute intersection points.
761 \item The tolerance \tkzVar{tkz}{tkz.epsilon} is used to handle numerical approximations in tangency detection.
762 \end{itemize}
763
764 \texttt{Example (secant lines)}
765
766 \begin{tkzexample}[latex=.48\textwidth]
767 \directlua{
768 z.A = point(0, 0)
769 z.B = point(3, -2)
770 L.AB = line (z.A, z.B)
771 z.C = point(-2, 3)
772 z.D = point(3, 1)
773 L.CD = line (z.C, z.D)
774 z.O = point(2, 4)
775 z.X = z.O + point(0, -1)
776 C.OX = circle(z.O, z.X)
777 tex.print(C.OX:lines_position(L.AB, L.CD))}
778 \begin{tikzpicture}
779 \tkzGetNodes
780 \tkzDrawLines[blue](A,B)
781 \tkzDrawLines[red](C,D)
782 \tkzDrawCircle(O,X)
783 \tkzDrawPoints[red,size=4](A,B,C,D)
784 \tkzLabelPoints(A,B,C,D)
785 \end{tikzpicture}
786 \end{tkzexample}
787
788 \texttt{Example (parallel lines)}
789
790 \begin{tkzexample}[latex=.48\textwidth]
791 \directlua{
792 z.A = point(0,0)
793 z.B = point(4,0)
794 L.AB = line(z.A, z.B)
795 z.C = point(0,3)
796 z.D = point(4,3)
797 L.CD = line(z.C, z.D)
798 z.O = point(2,1.5)
799 z.T = z.O + point(0,1)
800 C.OT = circle(z.O, z.T)
801 local s = C.OT:lines_position(L.AB,
802 L.CD, "parallel")
803 tex.print(s)}
804 \begin{tikzpicture}
805 \tkzGetNodes
806 \tkzDrawLines[blue](A,B C,D)
807 \tkzDrawCircle(O,T)
808 \end{tikzpicture}
809 \end{tkzexample}
810
811
812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
813 \subsection{Returns a real number}
814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
815
816 \subsubsection{Method \tkzMeth{circle}{power(pt)}}
817 \label{ssub:method_circle_power_pt}
818
819 The \emph{power of a point} $A$ with respect to a circle of radius~$r$ and center~$O$ is a classical notion in Euclidean geometry.
820
821 \medskip
822
823 It is defined as the scalar quantity:
824
825 \[
826 p = \overline{AP} \cdot \overline{AQ} = AM^2 - r^2
827 \]
828
829 where:
830 \begin{itemize}
831 \item $P$ and $Q$ are the points of intersection of the circle with a line passing through $A$,
832 \item $M$ is the center $O$ of the circle (so $AM^2 = |AO|^2$),
833 \item and $AT$ is a tangent from $A$ to the circle, satisfying $AT^2 = AM^2 - r^2$.
834 \end{itemize}
835
836
837 Geometrically:
838 \begin{itemize}
839 \item If $A$ lies outside the circle, the power is positive.
840 \item If $A$ lies on the circle, the power is zero.
841 \item If $A$ lies inside the circle, the power is negative.
842 \end{itemize}
843
844 \medskip
845
846 In Lua, this is evaluated by calling:
847
848 \begin{center}
849 \code{p = C.XY:power(z.A)}
850 \end{center}
851
852
853 This value can be used for algebraic computations or to test point inclusion via its sign.
854
855 \vspace{1em}
856
857 \begin{minipage}{.5\textwidth}
858 \begin{verbatim}
859 \directlua{
860 init_elements()
861 z.O = point(5, 0)
862 z.A = point(0, 0)
863 z.R = point(7, 0)
864 C.OR = circle(z.O, z.R)
865 z.Q = C.OR:point(0.15)
866 L.AQ = line(z.A, z.Q)
867 _, z.P = intersection(C.OR,L.AQ)
868 L.T = C.OR:tangent_from(z.A)
869 z.T = L.T.pb}
870 \begin{tikzpicture}
871 \tkzGetNodes
872 \tkzDrawCircle(O,T)
873 \tkzDrawPoints(A,O,P,Q,T)
874 \tkzDrawSegments(A,O A,Q A,T)
875 \tkzLabelPoints(A,O,P,Q,T)
876 \tkzText(2,2){$p =\tkzUseLua{%
877 C.OR:power(z.A)} =AT^2=AP * AQ$}
878 \end{tikzpicture}
879 \end{verbatim}
880
881 \end{minipage}
882 \begin{minipage}{.5\textwidth}
883 \directlua{
884 init_elements()
885 z.O = point(5,0)
886 z.A = point(0,0)
887 z.R = point(7,0)
888 C.OR = circle(z.O, z.R)
889 z.Q = C.OR:point(0.15)
890 L.AQ = line(z.A, z.Q)
891 _, z.P = intersection(C.OR,L.AQ)
892 L.T = C.OR:tangent_from(z.A)
893 z.T = L.T.pb}
894
895 \begin{center}
896 \begin{tikzpicture}
897 \tkzGetNodes
898 \tkzDrawCircle(O,T)
899 \tkzDrawPoints(A,O,P,Q,T)
900 \tkzDrawSegments(A,O A,Q A,T)
901 \tkzLabelPoints(A,O,P,Q,T)
902 \tkzText(2,2){$p =\tkzUseLua{%
903 C.OR:power(z.A)} =AT^2=AP * AQ$}
904 \end{tikzpicture}
905 \end{center}
906 \end{minipage}
907
908
909 \subsection{Returns a string}
910
911 \subsubsection{Method \tkzMeth{circle}{circles\_position}}
912 \label{ssub:circles_position}
913
914 This function returns a string indicating the position of the circle in relation to another. Useful for creating a function. Cases are:
915
916 \begin{itemize}
917 \item \code{outside}
918 \item \code{outside tangent}
919 \item \code{inside tangent}
920 \item \code{inside}
921 \item \code{intersect}
922 \end{itemize}
923
924 \begin{minipage}{.55\textwidth}
925 \begin{verbatim}
926 \directlua{
927 init_elements()
928 z.A = point(0, 0)
929 z.a = point(3, 0)
930 z.B = point(2, 0)
931 z.b = point(3, 0)
932 C.Aa = circle(z.A, z.a)
933 C.Bb = circle(z.B, z.b)
934 position = C.Aa:circles_position(C.Bb)
935 if position == "inside tangent"
936 then color = "orange"
937 else color = "blue" end}
938 \begin{tikzpicture}
939 \tkzGetNodes
940 \tkzDrawCircle(A,a)
941 \tkzDrawCircle[color=\tkzUseLua{color}](B,b)
942 \end{tikzpicture}
943 \end{verbatim}
944 \end{minipage}
945 \begin{minipage}{.45\textwidth}
946 \directlua{
947 init_elements()
948 z.A = point(1, 0)
949 z.a = point(3, 0)
950 z.B = point(2, 0)
951 z.b = point(3, 0)
952 C.Aa = circle(z.A, z.a)
953 C.Bb = circle(z.B, z.b)
954 position = C.Aa:circles_position(C.Bb)
955 if position == "inside tangent" then color = "orange" else color = "blue" end}
956
957
958 \begin{center}
959 \begin{tikzpicture}
960 \tkzGetNodes
961 \tkzDrawCircle(A,a)
962 \tkzDrawCircle[color=\tkzUseLua{color}](B,b)
963 \end{tikzpicture}
964 \end{center}
965
966 \end{minipage}
967
968
969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
970
971 %%%%%% Points %%%%%%%
972
973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
974
975 \subsection{Returns a point}
976
977 \subsubsection{Method \tkzMeth{circle}{get()}}
978 \label{ssub:method_circle_get}
979
980 This method retrieves the defining points of a circle.
981 A circle is determined by its center and one point on its circumference.
982
983 \begin{itemize}
984 \item \code{C:get()} returns the center and a point through which the circle passes.
985 \item \code{C:get(1)} returns the center of the circle.
986 \item \code{C:get(2)} returns the point on the circumference.
987 \end{itemize}
988
989 This method is useful whenever the geometric definition of a circle needs to be reused, for instance when constructing tangents, radical axes, or when passing circle data to other constructions.
990 It provides a simple and consistent way to access the fundamental points that define a circle.
991
992
993
994 \subsubsection{Method \tkzMeth{circle}{antipode}}
995 \label{ssub:method_circle_antipode}
996 This method is used to define a point that is diametrically opposed to a point on a given circle.
997
998 \vspace{1em}
999 \begin{tkzexample}[latex=.5\textwidth]
1000 \directlua{
1001 init_elements()
1002 z.A = point(0, 0)
1003 z.O = point(2, 1)
1004 C.OA = circle(z.O, z.A)
1005 z.B = C.OA:antipode(z.A)}
1006 \begin{center}
1007 \begin{tikzpicture}[gridded]
1008 \tkzGetNodes
1009 \tkzDrawCircles(O,A)
1010 \tkzDrawPoints(A,B,O)
1011 \tkzLabelPoints[right](A,B,O)
1012 \end{tikzpicture}
1013 \end{center}
1014 \end{tkzexample}
1015
1016 \subsubsection{Method \tkzMeth{circle}{midarc}}
1017 \label{ssub:method_circle_midarc}
1018
1019 The classical definition, as found in \href{https://mathworld.wolfram.com/Mid-ArcPoints.html}{MathWorld}, is the following:
1020
1021 \medskip
1022 \begin{quote}
1023 The mid-arc points of a triangle, as defined by Johnson (1929), are the points on the circumcircle of the triangle that lie halfway along each of the three arcs determined by the triangle's vertices. These points arise in the definitions of the Fuhrmann circle and Fuhrmann triangle, and they lie on the extensions of the perpendicular bisectors of the triangle sides drawn from the circumcenter.
1024 \end{quote}
1025
1026 \medskip
1027
1028 In the present context, the definition is generalized. The method returns the point on a circle that divides a given arc into two equal arcs in terms of angular measure. In other words, it computes the midpoint (in angle) of the arc defined by two points on the circle.
1029
1030 \medskip
1031
1032 This method is applicable to any pair of points on a circle, not just those associated with triangle vertices or circumcircles.
1033
1034 \vspace{1em}
1035 \begin{tkzexample}[latex=.5\textwidth]
1036 \directlua{
1037 init_elements()
1038 z.A = point(0, 0)
1039 z.O = point(2, 1)
1040 C.OA = circle(z.O, z.A)
1041 z.B = C.OA:point(0.25)
1042 z.M = C.OA:midarc(z.A, z.B)}
1043 \begin{center}
1044 \begin{tikzpicture}[gridded]
1045 \tkzGetNodes
1046 \tkzDrawCircles(O,A)
1047 \tkzDrawPoints(A,B,O,M)
1048 \tkzLabelPoints[right](A,B,O,M)
1049 \end{tikzpicture}
1050 \end{center}
1051 \end{tkzexample}
1052
1053 \subsubsection{Method \tkzMeth{circle}{point(r,<pt>)}}
1054 \label{ssub:method_circle_point}
1055
1056 Let $C$ be a circle with centre $O$ and passing through $A$ such that $z.A = C.through$.
1057
1058 This method defines a point $M$ on the circle such that the ratio of the length of the arc to the circumference of the circle is equal to $r$.
1059
1060 By default, the arc is measured from the reference point $A$.
1061 An optional parameter \texttt{pt} allows the user to specify another starting point on the circle.
1062
1063 Thus, if \texttt{pt} is provided, the point $M$ is defined such that
1064 the ratio of the length of the arc $\widearc{(\texttt{pt})M}$ to the circumference is equal to $r$.
1065
1066 In the next example, $r=\dfrac{1}{6}$ corresponds to $\dfrac{\pi/3}{2\pi}$, so the angle $\widehat{AOB}$ has measure $\pi/3$.
1067
1068 If $r=0.5$, the defined point is diametrically opposite to the reference point.
1069
1070 \vspace{1em}
1071 \begin{tkzexample}[latex=.5\textwidth]
1072 \directlua{
1073 init_elements()
1074 z.O = point(0, 0)
1075 z.A = point(1, 2)
1076 z.E = point(-1, 2)
1077 C.OA = circle(z.O, z.A)
1078 z.B = C.OA:point(1 / 6)
1079 % from A (default)
1080 z.C = C.OA:point(0.25)
1081 z.D = C.OA:point(0.5)
1082 z.F = C.OA:point(1 / 6, z.E)
1083 % from E (custom origin)
1084 }
1085 \begin{center}
1086 \begin{tikzpicture}
1087 \tkzGetNodes
1088 \tkzDrawCircle(O,A)
1089 \tkzDrawPoints(A,...,F,O)
1090 \tkzLabelPoints(A,...,F,O)
1091 \end{tikzpicture}
1092 \end{center}
1093 \end{tkzexample}
1094
1095
1096
1097 \subsubsection{Method \tkzMeth{circle}{random(<'inside'>)}}
1098 \label{ssub:method_imeth_circle_random_inside}
1099 Produces a point on the circle or inside the disc with the 'inside' option.
1100
1101 \begin{minipage}{.5\textwidth}
1102 \directlua{
1103 init_elements()
1104 z.O = point(0, 2)
1105 z.A = point(2, 1)
1106 C.OA = circle(z.O, z.A)
1107 z.M = C.OA:random()
1108 z.N = C.OA:random('inside')}
1109 \begin{center}
1110 \begin{tikzpicture}
1111 \tkzGetNodes
1112 \tkzDrawCircle(O,A)
1113 \tkzDrawPoints(O,A,M,N)
1114 \tkzLabelPoints(O,A,M,N)
1115 \end{tikzpicture}
1116 \end{center}
1117 \end{minipage}
1118 \begin{minipage}{.5\textwidth}
1119 \begin{tkzexample}[code only]
1120 \directlua{
1121 init_elements()
1122 z.O = point(0, 2)
1123 z.A = point(2, 1)
1124 C.OA = circle(z.O, z.A)
1125 z.M = C.OA:random()
1126 z.N = C.OA:random('inside')}
1127 \end{tkzexample}
1128 \end{minipage}
1129
1130 \subsubsection{Method \tkzMeth{circle}{internal\_similitude(C)}}
1131 \label{ssub:method_circle_internal__similitude}
1132
1133 This method computes the \textbf{internal center of similitude} of two given circles.
1134
1135 \medskip
1136
1137 Two circles (in general position) always admit two homothetic centers:
1138 \begin{itemize}
1139 \item the \textbf{internal center of similitude}, which lies between the two centers and divides the segment joining them internally in the ratio of their radii,
1140 \item the \textbf{external center of similitude}, which lies outside the segment and divides it externally in the same ratio.
1141 \end{itemize}
1142
1143
1144 These centers lie on the line joining the centers of the two circles, called the \emph{line of centers}.
1145
1146 \medskip
1147
1148 This method returns the internal homothetic center — the point from which the two circles appear in the same direction and proportion, as though one were scaled into the other internally.
1149
1150 \medskip
1151
1152 \emph{Note:} Degenerate cases (e.g., equal centers, equal or zero radii) are handled separately.
1153 \begin{flushright}
1154 \small
1155 \href{https://en.wikipedia.org/wiki/Homothetic_center}{\textit{(See also: Wikipedia — Homothetic center)}}
1156 \end{flushright}
1157
1158 \vspace{1em}
1159
1160
1161 \begin{tkzexample}[latex=.5\textwidth]
1162 \directlua{
1163 init_elements()
1164 z.A = point(0, 0)
1165 z.a = point(2, 2)
1166 z.B = point(5 , 2)
1167 z.b = point(6 , 1)
1168 C.Aa = circle(z.A, z.a)
1169 C.Bb = circle(z.B, z.b)
1170 z.I = C.Aa:internal_similitude(C.Bb)
1171 L.TA1, L.TA2 = C.Aa:tangent_from(z.I)
1172 z.A1 = L.TA1.pb
1173 z.A2 = L.TA2.pb}
1174 \begin{center}
1175 \begin{tikzpicture}[ scale =.6]
1176 \tkzGetNodes
1177 \tkzDrawCircles(A,a B,b)
1178 \tkzDrawPoints(A,a,B,b,I,A1,A2)
1179 \tkzDrawLines[add = 1 and 2](A1,I A2,I)
1180 \end{tikzpicture}
1181 \end{center}
1182 \end{tkzexample}
1183
1184 \subsubsection{Method \tkzMeth{circle}{external\_similitude(C)}}
1185 \label{ssub:method_circle_external__similitude}
1186
1187
1188 This method computes the \textbf{external center of similitude} of two given circles.
1189
1190 \medskip
1191
1192 As with the internal case, two circles in general position admit two homothetic centers. The external center of similitude lies on the \emph{line of centers}, but outside the segment joining the two centers.
1193
1194 \medskip
1195
1196 It divides this line \emph{externally} in a ratio equal to that of the radii of the circles. This center is the unique point from which the two circles appear as scaled images of each other in opposite orientations.
1197
1198 \medskip
1199
1200 This construction is essential in many geometric transformations (e.g., inversion, similarity, coaxal systems) and in the theory of midcircles and Apollonius circles.
1201
1202 \medskip
1203
1204 \emph{Note:} As with the internal center, degenerate cases such as identical centers or zero radius are handled separately.
1205
1206 \vspace{1em}
1207
1208 \begin{tkzexample}[latex=.5\textwidth]
1209 \directlua{
1210 init_elements()
1211 z.A = point (0 , 0 )
1212 z.a = point (2 , 2)
1213 z.B = point (3 , 2 )
1214 z.b = point(3.5, 1 )
1215 C.Aa = circle(z.A, z.a)
1216 C.Bb = circle(z.B, z.b)
1217 z.I = C.Aa:external_similitude(C.Bb)
1218 L.TA1,L.TA2 = C.Aa:tangent_from(z.I)
1219 z.A1 = L.TA1.pb
1220 z.A2 = L.TA2.pb}
1221 \begin{center}
1222 \begin{tikzpicture}[scale = .75]
1223 \tkzGetNodes
1224 \tkzDrawCircles(A,a B,b)
1225 \tkzDrawPoints(A,a,B,b,I,A1,A2)
1226 \tkzDrawLines[add = .25 and .1](A1,I A2,I)
1227 \end{tikzpicture}
1228 \end{center}
1229 \end{tkzexample}
1230
1231 \subsubsection{Method \tkzMeth{circle}{similitude(C,mode)}}
1232 \label{ssub:similitude}
1233
1234 This method unifies the two similitude-center functions.
1235
1236 \begin{itemize}
1237 \item \code{mode = "internal"} returns the internal center of similitude.
1238 \item \code{mode = "external"} returns the external center of similitude.
1239 \end{itemize}
1240
1241 \medskip
1242 \noindent\texttt{Example: }
1243 \begin{verbatim}
1244 S = C1:similitude(C2, "internal")
1245 Se = C1:similitude(C2, "external")
1246 \end{verbatim}
1247
1248
1249 \subsubsection{Method \tkzMeth{circle}{radical\_center(C1, C2)}}
1250 \label{ssub:radical_center}
1251
1252 In classical geometry, the \textbf{radical center} (also called the \emph{power center}) of three circles is the unique point of concurrency of their pairwise radical axes.
1253
1254 \medskip
1255
1256 This fundamental result, attributed to Gaspard Monge (see Dörrie 1965, p.153), states that:
1257 \begin{quote}
1258 The radical axes of any three circles (no two of which have the same center) intersect in a single point — the radical center.
1259 \end{quote}
1260
1261
1262 (See also: \href{https://mathworld.wolfram.com/RadicalCenter.html}{MathWorld — Radical Center})
1263
1264 \medskip
1265
1266 In this implementation, the method \code{radical\_center(C1, C2)} also has a
1267 well-defined meaning when applied to only two circles.
1268 The point returned by
1269 \[
1270 \code{z.P = C1:radical\_center(C2)}
1271 \]
1272 is the intersection of the \emph{radical axis} of the two circles with the line
1273 joining their centres.
1274
1275 This point may be regarded as an \emph{extended radical center}.
1276 It is the centre of a distinguished circle orthogonal to both given circles.
1277 This circle belongs to the coaxial pencil of circles orthogonal to
1278 \code{C1} and \code{C2}; its intersections with the line joining the centres
1279 coincide with the two fixed base points of this pencil.
1280
1281 The construction naturally extends to the case of a circle and a point.
1282 A point $P$ is interpreted as a \emph{circle-point}, that is, a circle of zero
1283 radius:
1284 \[
1285 \code{z.P = point(a,b)}, \qquad \code{C.P = circle(z.P,z.P)}.
1286 \]
1287 In this setting, the radical center is the centre of the unique circle
1288 orthogonal to the given circle and passing through the point $P$.
1289
1290
1291 \medskip
1292
1293 This point is useful for constructions involving inversion, coaxal systems, and special configurations such as the Apollonius circle.
1294
1295 \texttt{Example, with three circles, two circles and one circle and a point}
1296
1297 \begin{tkzexample}[vbox]
1298 \directlua{
1299 z.A = point(0, 0)
1300 z.a = z.A + point (1, 0)
1301 z.B = point (4, 1)
1302 z.b = z.B + point (2, 0)
1303 z.C = point (2, 6)
1304 z.c = z.C + point (3, 0)
1305 C.Aa = circle(z.A, z.a)
1306 C.Bb = circle(z.B, z.b)
1307 C.Cc = circle(z.C, z.c)
1308 L.rAB = C.Aa:radical_axis(C.Bb)
1309 L.rAC = C.Aa:radical_axis(C.Cc)
1310 L.rBC = C.Bb:radical_axis(C.Cc)
1311 z.w = C.Aa:radical_center(C.Bb, C.Cc)
1312 z.x1, z.y1 = L.rAB:get()
1313 z.x2, z.y2 = L.rAC:get()
1314 z.x3, z.y3 = L.rBC:get()
1315 z.t = C.Aa:radical_circle(C.Bb, C.Cc).through
1316 z.w1, z.t1 = C.Aa:radical_circle(C.Bb):get()
1317 C.B = circle(z.B, z.B)
1318 z.w2, z.t2 = C.Aa:radical_circle(C.B):get()}
1319 \begin{center}
1320 \begin{tikzpicture}
1321 \tkzGetNodes
1322 \tkzDrawCircles[blue](A,a B,b C,c)
1323 \tkzDrawCircles[red](w,t)
1324 \tkzDrawCircles[orange](w1,t1)
1325 \tkzDrawCircles[purple](w2,t2)
1326 \tkzDrawLines[red](x1,y1 x2,y2 x3,y3)
1327 \tkzDrawPoints(A,B,C,w,w1,w2)
1328 \tkzLabelPoints[below right](A,B,C,w,w1,w2)
1329 \end{tikzpicture}
1330 \end{center}
1331 \end{tkzexample}
1332
1333
1334 \subsubsection{Method \tkzMeth{circle}{pole(L)}}
1335 \label{ssub:method_circle_pole}
1336
1337 \texttt{Syntax:}
1338 \begin{verbatim}
1339 P = circle:pole(L)
1340 \end{verbatim}
1341
1342 \texttt{Purpose:}
1343 Compute the \emph{pole} of a line \(L\) with respect to the current circle.
1344 The pole is the point whose polar is exactly the line \(L\).
1345
1346 \medskip
1347 \texttt{Arguments:}
1348 \begin{itemize}
1349 \item \code{L} --- a line object.
1350 \end{itemize}
1351
1352 \medskip
1353 \texttt{Returns:}
1354 \begin{itemize}
1355 \item the point \(P\) such that the polar of \(P\) w.r.t.\ the circle is \(L\);
1356 \item or \code{nil,"INFINITE"} if the line passes through the circle’s center.
1357 \end{itemize}
1358
1359 \medskip
1360 \texttt{Geometric principle:}
1361 Let \(O\) be the center of the circle and \(R\) its radius.
1362 Denote by \(H\) the orthogonal projection of \(O\) onto the line \(L\).
1363 If \(H \neq O\), the inversion of \(H\) in the circle,
1364 satisfying \(OH \cdot OP = R^2\),
1365 is the pole \(P\) of line \(L\).
1366
1367 \[
1368 P = \mathrm{Inv}_{(O,R)}(H),
1369 \qquad \text{with } H = \mathrm{proj}_L(O)
1370 \]
1371
1372 If \(H = O\) (i.e.\ the line passes through the center),
1373 the pole is an \emph{ideal point} on the perpendicular to \(L\) through \(O\).
1374
1375
1376
1377 \medskip
1378 \texttt{Example:}
1379
1380 \directlua{
1381 init_elements()
1382 z.A = point(0, 0)
1383 z.B = point(-1, 2)
1384 C.AB = circle(z.A, z.B)
1385 z.C = point(0, -4)
1386 z.D = point(5, 0)
1387 L.CD = line(z.C, z.D)
1388 z.P = C.AB:pole(L.CD)}
1389 \begin{center}
1390 \begin{tikzpicture}
1391 \tkzGetNodes
1392 \tkzDrawCircles(A,B)
1393 \tkzDrawLines(C,D)
1394 \tkzDrawPoints(A,...,D,P)
1395 \tkzLabelPoints(A,...,D,P)
1396 \end{tikzpicture}
1397 \end{center}
1398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1399
1400 %%%%%% Lines %%%%%%%
1401
1402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1403
1404 \subsection{Returns a line}
1405
1406 \subsubsection{Method \tkzMeth{circle}{tangent\_at(pt)}}
1407 \label{ssub:method_circle_tangent__at_pt}
1408
1409 This method constructs the tangent to a circle at a given point on its circumference.
1410
1411 \medskip
1412
1413 The result is a straight line segment centered at the point of contact. Its two endpoints are placed symmetrically at equal distances from the contact point, which facilitates drawing and labeling.
1414
1415 \medskip
1416
1417 In the example below, the points \code{Tx} and \code{Ty} are the two endpoints of the tangent segment at the point of contact.
1418
1419 \medskip
1420
1421 This method is useful for highlighting tangency in diagrams, constructing tangent directions, or defining orthogonal projections.
1422
1423 \vspace{1em}
1424
1425
1426 \begin{minipage}{.5\textwidth}
1427 \directlua{
1428 init_elements()
1429 z.A = point(0,0)
1430 z.B = point(1,2)
1431 C.AB = circle(z.A, z.B)
1432 L.T = C.AB:tangent_at(z.B)
1433 z.Tx, z.Ty = L.T:get()}
1434 \begin{tikzpicture}
1435 \tkzGetNodes
1436 \tkzDrawCircle(A,B)
1437 \tkzDrawLines[add =.25 and .25](Tx,Ty)
1438 \tkzDrawSegments[dashed](A,B)
1439 \tkzDrawPoints(A,B)
1440 \tkzLabelPoints[below left](A)
1441 \tkzLabelPoints[above right](B)
1442 \tkzMarkRightAngles(A,B,Tx)
1443 \end{tikzpicture}
1444 \end{minipage}
1445 \begin{minipage}{.5\textwidth}
1446 \begin{tkzexample}[code only]
1447 \directlua{
1448 init_elements()
1449 z.A = point(0,0)
1450 z.B = point(1,2)
1451 C.AB = circle(z.A, z.B)
1452 L.T = C.AB:tangent_at(z.B)
1453 z.Tx, z.Ty = L.T:get()}
1454 \end{tkzexample}
1455 \end{minipage}
1456
1457 \subsubsection{Method \tkzMeth{circle}{tangent\_from(pt)}}
1458 \label{ssub:method_circle_tangent__from_pt}
1459
1460 This method computes the two tangents from a point external to a given circle.
1461
1462 \medskip
1463
1464 Given a point $P$ lying outside the circle, there exist exactly two lines passing through $P$ and tangent to the circle. This method returns these two tangent lines, each defined by $P$ and the point of contact with the circle.
1465
1466 \medskip
1467
1468 The points of contact are also accessible as the endpoints of these lines. These are the unique points where the tangents touch the circle and are orthogonal to the radius.
1469
1470 \medskip
1471
1472 This construction is useful in many classical geometric configurations (radical axis, triangle incircle tangents, etc.).
1473
1474 \vspace{1em}
1475
1476
1477 \begin{minipage}{.5\textwidth}
1478 \directlua{
1479 init_elements()
1480 z.A = point(0,0)
1481 z.B = point(1,2)
1482 C.AB = circle(z.A, z.B)
1483 z.C = point(3,-2)
1484 L.T1,L.T2 = C.AB:tangent_from(z.C)
1485 z.T1 = L.T1.pb
1486 z.T2 = L.T2.pb}
1487 \begin{center}
1488 \begin{tikzpicture}
1489 \tkzGetNodes
1490 \tkzDrawCircle(A,B)
1491 \tkzDrawLines[add =.5 and .5](C,T1 C,T2)
1492 \tkzDrawSegments[dashed](A,T1 A,T2)
1493 \tkzDrawPoints(A,...,C,T1,T2)
1494 \tkzLabelPoints[below left](A,T2,C)
1495 \tkzLabelPoints[above right](B,T1)
1496 \tkzMarkRightAngles(A,T1,C A,T2,C)
1497 \end{tikzpicture}
1498 \end{center}
1499
1500 \end{minipage}
1501 \begin{minipage}{.5\textwidth}
1502 \begin{tkzexample}[code only]
1503 \directlua{
1504 init_elements()
1505 z.A = point(0,0)
1506 z.B = point(1,2)
1507 C.AB = circle(z.A, z.B)
1508 z.C = point(3,-2)
1509 L.T1,L.T2 = C.AB:tangent_from(z.C)
1510 z.T1 = L.T1.pb
1511 z.T2 = L.T2.pb}
1512 \end{tkzexample}
1513 \end{minipage}
1514
1515 \subsubsection{Method \tkzMeth{circle}{tangent\_parallel(line)}}
1516 \label{ssub:method_circle_tangent_parallel}
1517 This method constructs the two tangents to a circle that are \emph{parallel} to a given direction (provided as a line).
1518 \medskip
1519
1520 Each tangent is returned as a straight line segment centered at its point of contact with the circle. For convenience of drawing and labeling, the two endpoints of every tangent segment are placed symmetrically at equal distances from the contact point.
1521 \medskip
1522
1523
1524 \begin{verbatim}
1525 L1, L2 = C:tangent_parallel(Ldir)
1526 \end{verbatim}
1527
1528 \begin{tkzexample}[latex = .5\textwidth]
1529 \directlua{
1530 init_elements()
1531 z.A = point(0, 0)
1532 z.B = point(4, 4)
1533 L.AB = line(z.A, z.B)
1534 z.O = point(3, -2)
1535 z.T = point(3, 0)
1536 C.OT = circle(z.O, z.T)
1537 L.T1, L.T2 = C.OT:tangent_parallel(L.AB)
1538 z.x, z.y = L.T1:get()
1539 z.u, z.v = L.T2:get()
1540 z.M = L.T1.mid
1541 z.N = L.T2.mid}
1542 \begin{center}
1543 \begin{tikzpicture}[scale=.5]
1544 \tkzGetNodes
1545 \tkzDrawCircle(O,T)
1546 \tkzDrawLines(A,B x,y u,v)
1547 \tkzDrawPoints(O,A,B,M,N)
1548 \tkzLabelPoints(O,A,B,M,N)
1549 \end{tikzpicture}
1550 \end{center}
1551 \end{tkzexample}
1552
1553
1554 \subsubsection{Method \tkzMeth{circle}{commun\_tangent(C)}}
1555 \label{ssub:common_tangent}
1556
1557 This method constructs a \textbf{common tangent} to two circles.
1558 It used to return only external tangents; the new version supports three options for \verb|mode|:
1559 \verb|"external"| (default), \verb|"internal"|, and \verb|"both"|.
1560 The number of solutions depends on the relative position of the circles and ranges from 0 to 4.
1561 \medskip
1562
1563 Typical cases:
1564 \begin{itemize}
1565 \small
1566 \item \textbf{Disjoint (separate) circles:} 4 tangents (2 external, 2 internal).
1567 \item \textbf{Externally tangent circles (touch at one point):} 3 tangents (2 external, 1 internal).
1568 \item \textbf{Intersecting circles (two crossings):} 2 tangents (both external).
1569 \item \textbf{Internally tangent circles (one inside, touching):} 1 tangent (external).
1570 \item \textbf{One circle strictly contained in the other (no contact):} 0 tangents.
1571 \end{itemize}
1572
1573 Notes and conventions:
1574 \begin{itemize}
1575 \item \verb|mode="external"| returns the external common tangents; \verb|mode="internal"| returns the internal ones.
1576 \item Degenerate cases are handled explicitly: coincident circles yield infinitely many common tangents (undefined), concentric circles with distinct radii yield none.
1577 \item When radii are equal and circles are disjoint, there are still 4 tangents; the external homothety center is at infinity, which may influence the construction method but not the result.
1578 \end{itemize}
1579
1580 \medskip
1581
1582
1583 \begin{tkzexample}[latex=.45\textwidth]
1584 \directlua{
1585 init_elements()
1586 z.A = point(0, 0)
1587 z.a = point(4, 0)
1588 z.B = point(6, 0)
1589 z.b = point(5, 0)
1590 C.Aa = circle(z.A, z.a)
1591 C.Bb = circle(z.B, z.b)
1592 L.Tx, L.Ty = C.Aa:
1593 common_tangent(C.Bb,"external")
1594 z.x, z.y = L.Tx:get()
1595 z.xp, z.yp = L.Ty:get()
1596 L.Tu, L.Tv = C.Aa:
1597 common_tangent(C.Bb,"internal")
1598 z.u, z.v = L.Tu:get()
1599 z.up, z.vp = L.Tv:get()}
1600 \begin{center}
1601 \begin{tikzpicture}[scale =.5]
1602 \tkzGetNodes
1603 \tkzDrawCircles(A,a B,b)
1604 \tkzDrawLines[red](x,y x',y' u,v u',v')
1605 \tkzDrawPoints(x,y,x',y',u,v,u',v')
1606 \end{tikzpicture}
1607 \end{center}
1608 \end{tkzexample}
1609
1610
1611 \texttt{Application: }
1612 \medskip
1613
1614 Let $T$ and $T'$ be the points of tangency of a common external tangent to two circles, chosen such that $T$ lies on the first circle and $T'$ on the second, both on the same side. Consider a secant parallel to this tangent passing through a fixed point $C$ (typically the center of one of the circles).
1615
1616 \medskip
1617
1618 In this configuration, the segment $[TT']$ is seen from the other intersection point $D$ (of the secant with the second circle) under an angle equal to \emph{half the angle between the two given circles}.
1619
1620 \medskip
1621
1622 This elegant geometric relationship is used in the construction of tangents and angle bisectors associated with pairs of circles.
1623
1624 \vspace{1em}
1625
1626
1627 \begin{minipage}{.55\textwidth}
1628 \directlua{
1629 init_elements()
1630 z.A = point(0 , 0 )
1631 z.B = point(5 , 2 )
1632 L.AB = line(z.A, z.B)
1633 z.C = point(1, 2)
1634 C.AC = circle(z.A, z.C)
1635 C.BC = circle(z.B, z.C)
1636 L.TTp = C.AC:common_tangent(C.BC)
1637 z.T, z.Tp = L.TTp:get()
1638 z.M = C.AC:point(0.45)
1639 L.MC =line(z.M, z.C)
1640 z.Mp = intersection(L.MC, C.BC)
1641 L.mm = L.TTp:ll_from(z.C)
1642 _, z.M = intersection(L.mm, C.AC)
1643 z.Mp = intersection(L.mm, C.BC)
1644 _, z.D = intersection(C.AC,C.BC)}
1645 \begin{center}
1646 \begin{tikzpicture}[scale =.75]
1647 \tkzGetNodes
1648 \tkzDrawCircles(A,C B,C)
1649 \tkzDrawSegments(M,M' A,D B,D A,B C,D
1650 T,C T',C)
1651 \tkzDrawSegments[gray](D,M D,M' T,T'
1652 D,T D,T')
1653 \tkzDrawPoints(A,B,C,D,M,M',T,T')
1654 \tkzLabelPoints(A,B,D,M)
1655 \tkzLabelPoints[above](C,M',T,T')
1656 \tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T'
1657 C,D,T T,D,M)
1658 \tkzMarkAngles[mark=||,size=.75](M',C,T'
1659 T,T',C T',D,C M',D,T')
1660 \end{tikzpicture}
1661 \end{center}
1662 \end{minipage}
1663 \begin{minipage}{.4\textwidth}
1664 \begin{tkzexample}[code only]
1665 \directlua{
1666 init_elements()
1667 z.A = point(0 , 0 )
1668 z.B = point(5 , 2 )
1669 L.AB = line(z.A, z.B)
1670 z.C = point(1, 2)
1671 C.AC = circle(z.A, z.C)
1672 C.BC = circle(z.B, z.C)
1673 L.TTp = C.AC:common_tangent(C.BC)
1674 z.T, z.Tp = L.TTp:get()
1675 z.M = C.AC:point(0.45)
1676 L.MC =line(z.M, z.C)
1677 z.Mp = intersection(L.MC, C.BC)
1678 L.mm = L.TTp:ll_from(z.C)
1679 _, z.M = intersection(L.mm, C.AC)
1680 z.Mp = intersection(L.mm, C.BC)
1681 _, z.D = intersection(C.AC,C.BC)}
1682 \end{tkzexample}
1683 \end{minipage}
1684
1685 \subsubsection{Method \tkzMeth{circle}{polar(pt)}}
1686 \label{ssub:method_circle_polar_pt}
1687
1688 In projective geometry, the notions of \emph{pole} and \emph{polar} see a duality between points and lines with respect to a conic section.
1689
1690 \medskip
1691
1692 In the special case of a circle, this duality becomes particularly elegant. The method \code{polar(pt)} computes the \textbf{polar line} of a given point with respect to the circle.
1693
1694 \medskip
1695
1696 This construction is based on \textbf{inversion} in the circle:
1697 \begin{itemize}
1698 \item The \textbf{polar line} of a point $Q$ (not at the center) is defined as the line orthogonal to the radius through $Q$, passing through the \emph{inverse} of $Q$ with respect to the circle.
1699 \item Conversely, the \textbf{pole} of a line $L$ (not passing through the center) is the inverse (in the circle) of the foot of the perpendicular from the center to the line.
1700 \end{itemize}
1701
1702
1703 This method currently only supports the case where a \emph{point} is provided as argument. The result is a line — the polar of that point.
1704
1705 \medskip
1706
1707 (See also: \href{https://en.wikipedia.org/wiki/Pole_and_polar}{Wikipedia — Pole and polar})
1708
1709 \vspace{1em}
1710
1711
1712 \begin{tkzexample}[latex = .5\textwidth]
1713 \directlua{
1714 init_elements()
1715 z.o = point(-1,1)
1716 z.t = point(1,3)
1717 z.P = point(3.2,0)
1718 C.o = circle(z.o, z.t)
1719 L.P = C.o:polar(z.P)
1720 z.a, z.b = L.P:get()
1721 z.u, z.v = intersection(C.o,L.P)
1722 z.K = L.P:projection(z.P)
1723 L.K = C.o:polar(z.K)
1724 z.ka, z.kb = L.K:get()
1725 C.wH = C.o:inversion(L.P)
1726 z.w, z.H = C.wH:get()
1727 z.ap, z.bp = C.o:inversion(z.a, z.b)
1728 L.oa = line(z.o, z.a)
1729 z.cp = intersection(L.K,L.oa)
1730 z.c = C.o:inversion(z.cp)}
1731 \begin{center}
1732 \begin{tikzpicture}
1733 \tkzGetNodes
1734 \tkzDrawCircles[red,thick](o,t)
1735 \tkzDrawCircles(w,H)
1736 \tkzDrawLines[red](P,u P,v)
1737 \tkzDrawLines[blue,thick](u,v)
1738 \tkzDrawLines[add = 1 and 1,
1739 green!50!black,thick](ka,kb)
1740 \tkzDrawSegments[dashed](o,P o,c' o,b' K,c)
1741 \tkzMarkRightAngle[size=.1,
1742 fill=lightgray!15](o,c,K)
1743 \tkzDrawPoints(o,w,K,P,a,b,u,v,a',b',c',c)
1744 \tkzLabelPoints(o,w,b')
1745 \tkzLabelPoints[above right,blue](a,b,u,v)
1746 \tkzLabelPoints[above](c,a',c')
1747 \tkzLabelPoints[right,blue](P)
1748 \tkzLabelPoints[green!50!black,left](K)
1749 \end{tikzpicture}
1750 \end{center}
1751 \end{tkzexample}
1752
1753 \subsubsection{Method \tkzMeth{circle}{radical\_axis}(C)}
1754 \label{ssub:method_circle_radical__axis_c}
1755
1756 The radical line, also called the radical axis, is the locus of points of equal circle power with respect to two nonconcentric circles. By the chordal theorem, it is perpendicular to the line of centers (Dörrie 1965).
1757 \begin{flushright}
1758 \small
1759 \href{https://mathworld.wolfram.com/RadicalLine.html}{Weisstein, Eric W. "Radical Line." From MathWorld--A Wolfram Web Resource.}
1760 \end{flushright}
1761
1762 \vspace{1em}
1763 Radical axis v1
1764 \label{par:radical_axis_v1}
1765
1766 \vspace{1em}
1767
1768 \begin{minipage}{.5\textwidth}
1769 \directlua{
1770 init_elements()
1771 z.X = point(0,0)
1772 z.B = point(2,2)
1773 z.Y = point(7,1)
1774 z.Ap = point(8,-1)
1775 L.XY = line(z.X, z.Y)
1776 C.XB = circle(z.X, z.B)
1777 C.YAp = circle(z.Y, z.Ap)
1778 z.E, z.F = C.XB:radical_axis(C.YAp):get()
1779 z.A = C.XB:point(0.4)
1780 T.ABAp = triangle(z.A, z.B, z.Ap)
1781 z.O = T.ABAp.circumcenter
1782 C.OAp = circle(z.O, z.Ap)
1783 _, z.Bp = intersection(C.OAp,C.YAp)
1784 L.AB = line(z.A, z.B)
1785 L.ApBp = line(z.Ap, z.Bp)
1786 z.M = intersection(L.AB,L.ApBp)
1787 z.H = L.XY:projection(z.M)}
1788 \begin{center}
1789 \begin{tikzpicture}[scale = .4]
1790 \tkzGetNodes
1791 \tkzDrawCircles(X,B Y,A')
1792 \tkzDrawArc[dashed,delta=30](O,A')(A)
1793 \tkzDrawPoints(A,B,A',B',M,H,X,Y,O,E,F)
1794 \tkzDrawLines[red](A,M A',M X,Y E,F)
1795 \tkzDrawLines[red,add=1 and 3](M,H)
1796 \end{tikzpicture}
1797 \end{center}
1798 \end{minipage}
1799 \begin{minipage}{.5\textwidth}
1800 \begin{tkzexample}[code only]
1801 \directlua{
1802 init_elements()
1803 z.X = point(0,0)
1804 z.B = point(2,2)
1805 z.Y = point(7,1)
1806 z.Ap = point(8,-1)
1807 L.XY = line(z.X, z.Y)
1808 C.XB = circle(z.X, z.B)
1809 C.YAp = circle(z.Y, z.Ap)
1810 z.E,
1811 z.F = C.XB:radical_axis(C.YAp):get()
1812 z.A = C.XB:point(0.4)
1813 T.ABAp = triangle(z.A, z.B, z.Ap)
1814 z.O = T.ABAp.circumcenter
1815 C.OAp = circle(z.O, z.Ap)
1816 _, z.Bp = intersection(C.OAp,C.YAp)
1817 L.AB = line(z.A, z.B)
1818 L.ApBp = line(z.Ap, z.Bp)
1819 z.M = intersection(L.AB,L.ApBp)
1820 z.H = L.XY:projection(z.M)}
1821 \end{tkzexample}
1822 \end{minipage}
1823
1824
1825 \vspace{1em}
1826 Radical axis v2
1827 \label{par:radical_axis_v2}
1828
1829 \vspace{1em}
1830 \begin{minipage}{.5\textwidth}
1831 \directlua{
1832 init_elements()
1833 z.O = point(-1,0)
1834 z.Op = point(4,-1)
1835 z.B = point(0,2)
1836 z.D = point(4,0)
1837 C.OB = circle(z.O, z.B)
1838 C.OpD = circle(z.Op, z.D)
1839 L.EF = C.OB:radical_axis(C.OpD)
1840 z.E, z.F = L.EF:get()
1841 z.M = L.EF:point(.75)
1842 L.MT,L.MTp = C.OB:tangent_from(z.M)
1843 _, z.T = L.MT:get()
1844 _, z.Tp = L.MTp:get()
1845 L.MK,L.MKp = C.OpD:tangent_from(z.M)
1846 _, z.K = L.MK:get()
1847 _, z.Kp = L.MKp:get()}
1848 \begin{center}
1849 \begin{tikzpicture}[scale = .75]
1850 \tkzGetNodes
1851 \tkzDrawCircles(O,B O',D)
1852 \tkzDrawLine(E,F)
1853 \tkzDrawLine[add=.25 and .25](O,O')
1854 \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K')
1855 \tkzDrawCircle(M,T)
1856 \tkzDrawPoints(O,O',T,M,T',K,K')
1857 \tkzLabelPoints(O,O',T,T',K,K',M)
1858 \end{tikzpicture}
1859 \end{center}
1860 \end{minipage}
1861 \begin{minipage}{.5\textwidth}
1862 \begin{tkzexample}[code only]
1863 \directlua{
1864 init_elements()
1865 z.O = point(-1,0)
1866 z.Op = point(4,-1)
1867 z.B = point(0,2)
1868 z.D = point(4,0)
1869 C.OB = circle(z.O, z.B)
1870 C.OpD = circle(z.Op, z.D)
1871 L.EF = C.OB:radical_axis(C.OpD)
1872 z.E, z.F = L.EF:get()
1873 z.M = L.EF:point(.75)
1874 L.MT,L.MTp = C.OB:tangent_from(z.M)
1875 _, z.T = L.MT:get()
1876 _, z.Tp = L.MTp:get()
1877 L.MK,L.MKp = C.OpD:tangent_from(z.M)
1878 _, z.K = L.MK:get()
1879 _, z.Kp = L.MKp:get()}
1880
1881 \end{tkzexample}
1882 \end{minipage}
1883
1884
1885 Radical axis v3
1886 \label{par:radical_axis_v3}
1887
1888 \begin{minipage}{.5\textwidth}
1889 \directlua{
1890 init_elements()
1891 z.O = point(0,0)
1892 z.B = point(4,0)
1893 z.Op = point(6,0)
1894 C.OB = circle(z.O, z.B)
1895 C.OpB = circle(z.Op, z.B)
1896 L.EF = C.OB:radical_axis(C.OpB)
1897 z.E, z.F = L.EF:get()
1898 z.M = L.EF:point(0.2)
1899 L.tgt = C.OB:tangent_from(z.M)
1900 _, z.T = L.tgt:get()
1901 L.tgtp = C.OpB:tangent_from(z.M)
1902 _, z.Tp =L.tgtp:get()}
1903 \begin{center}
1904 \begin{tikzpicture}[scale =.5]
1905 \tkzGetNodes
1906 \tkzDrawCircles(O,B O',B)
1907 \tkzDrawSegments(M,T M,T')
1908 \tkzDrawSegments(E,F)
1909 \tkzDrawLine[add=.5 and .5](O,O')
1910 \tkzDrawPoints(O,B,O',E,F,M,T,T')
1911 \tkzLabelPoints(O,O',B,E,F,T,T')
1912 \tkzDrawArc(M,T')(T)
1913 \end{tikzpicture}
1914 \end{center}
1915 \end{minipage}
1916 \begin{minipage}{.5\textwidth}
1917 \begin{tkzexample}[code only]
1918 \directlua{
1919 init_elements()
1920 z.O = point(0,0)
1921 z.B = point(4,0)
1922 z.Op = point(6,0)
1923 C.OB = circle(z.O, z.B)
1924 C.OpB = circle(z.Op, z.B)
1925 L.EF = C.OB:radical_axis(C.OpB)
1926 z.E, z.F = L.EF:get()
1927 z.M = L.EF:point(0.2)
1928 L.tgt = C.OB:tangent_from(z.M)
1929 _, z.T = L.tgt:get()
1930 L.tgtp = C.OpB:tangent_from(z.M)
1931 _, z.Tp =L.tgtp:get()}
1932 \end{tkzexample}
1933 \end{minipage}
1934
1935 % paragraph radical_axis_v3 (end)
1936
1937 Radical axis v4
1938 \label{par:radical_axis_v4}
1939
1940 \begin{minipage}{.5\textwidth}
1941 \directlua{
1942 init_elements()
1943 z.O = point(0,0)
1944 z.B = point(5,0)
1945 z.Op = point(3,0)
1946 C.OB = circle(z.O, z.B)
1947 C.OpB = circle(z.Op, z.B)
1948 L.EF = C.OB:radical_axis(C.OpB)
1949 z.E, z.F = L.EF:get()
1950 z.H = L.EF.mid
1951 z.M = L.EF:point(.8)
1952 _,L.t = C.OB:tangent_from(z.M)
1953 _, z.T = L.t:get()
1954 _,L.tp = C.OpB:tangent_from(z.M)
1955 _, z.Tp = L.tp:get()}
1956 \begin{center}
1957 \begin{tikzpicture}[scale =.5]
1958 \tkzGetNodes
1959 \tkzDrawCircles(O,B O',B)
1960 \tkzDrawSegments(M,T M,T')
1961 \tkzDrawSegments(E,F)
1962 \tkzDrawLine[add=.3 and .3](O,H)
1963 \tkzDrawPoints(O,O',B,E,H,M)
1964 \tkzLabelPoints[below right](O,O',E,F,M,T,T')
1965 \tkzDrawArc(M,B)(T)
1966 \end{tikzpicture}
1967 \end{center}
1968 \end{minipage}
1969 \begin{minipage}{.5\textwidth}
1970 \begin{tkzexample}[code only]
1971 \directlua{
1972 init_elements()
1973 z.O = point(0,0)
1974 z.B = point(5,0)
1975 z.Op = point(3,0)
1976 C.OB = circle(z.O, z.B)
1977 C.OpB = circle(z.Op, z.B)
1978 L.EF = C.OB:radical_axis(C.OpB)
1979 z.E, z.F = L.EF:get()
1980 z.H = L.EF.mid
1981 z.M = L.EF:point(.8)
1982 _,L.t = C.OB:tangent_from(z.M)
1983 _, z.T = L.t:get()
1984 _,L.tp = C.OpB:tangent_from(z.M)
1985 _, z.Tp = L.tp:get()}
1986 \end{tkzexample}
1987 \end{minipage}
1988
1989
1990 % paragraph radical_axis_v4 (end)
1991
1992
1993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1994
1995 %%%%%% Circles %%%%%%%
1996
1997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1998
1999
2000 \subsection{Returns a circle}
2001
2002 \subsubsection{Method \tkzMeth{circle}{orthogonal\_from(pt)}}
2003 \label{ssub:method_circle_orthogonal_from_pt}
2004
2005 In geometry, two circles are said to be \emph{orthogonal} if their tangent lines at each point of intersection meet at a right angle.
2006 (See also: \href{https://en.wikipedia.org/wiki/Orthogonal_circles}{Wikipedia — Orthogonal circles}).
2007
2008 \medskip
2009
2010 This method constructs a circle:
2011 \begin{itemize}
2012 \item centered at a given point,
2013 \item and orthogonal to a given circle.
2014 \end{itemize}
2015
2016
2017 The result is a circle that intersects the original one at right angles. The construction ensures that the condition of orthogonality is satisfied at all points of intersection.
2018
2019 \vspace{1em}
2020
2021 \begin{minipage}{.5\textwidth}
2022 \directlua{
2023 init_elements()
2024 z.C_1 = point(0,0)
2025 z.C_2 = point(8,0)
2026 z.A = point(5,0)
2027 C.C1A = circle(z.C_1, z.A)
2028 z.S,
2029 z.T = C.C1A:orthogonal_from(z.C_2):get()}
2030 \begin{center}
2031 \begin{tikzpicture}[scale = .35]
2032 \tkzGetNodes
2033 \tkzDrawCircles(C_1,T C_2,T)
2034 \tkzDrawSegments(C_1,T C_2,T)
2035 \tkzDrawLine(C_1,C_2)
2036 \tkzMarkRightAngle[fill=teal,
2037 opacity=.2,size=.5](C_1,T,C_2)
2038 \tkzDrawPoints(C_1,C_2,T)
2039 \tkzLabelPoints(C_1,C_2)
2040 \tkzLabelPoints[above](T)
2041 \tkzLabelSegment[left](C_1,T){r}
2042 \tkzLabelSegments[right](C_2,T){$\gamma$}
2043 \tkzLabelSegment[below](C_1,C_2){d}
2044 \tkzLabelCircle[left=10pt](C_1,T)(180){%
2045 Circle 1}
2046 \tkzLabelCircle[below=10pt](C_2,T)(180){%
2047 Circle 2}
2048 \end{tikzpicture}
2049 \end{center}
2050 \end{minipage}
2051 \begin{minipage}{.5\textwidth}
2052 \begin{tkzexample}[code only]
2053 \directlua{
2054 init_elements()
2055 z.C_1 = point(0,0)
2056 z.C_2 = point(8,0)
2057 z.A = point(5,0)
2058 C = circle(z.C_1, z.A)
2059 z.S,
2060 z.T = C:orthogonal_from(z.C_2):get()}
2061 \end{tkzexample}
2062 \end{minipage}
2063
2064 \subsubsection{Method \tkzMeth{circle}{orthogonal\_through(pt,pt)}}
2065 \label{ssub:method_circle_orthogonal_through}
2066
2067 This method constructs a circle that is orthogonal to a given circle and passes through two specified points.
2068
2069 \medskip
2070
2071 Geometrically, the resulting circle satisfies:
2072 \begin{itemize}
2073 \item it intersects the given circle orthogonally (i.e., the tangents at their intersection points are perpendicular),
2074 \item it passes through the two given points.
2075 \end{itemize}
2076
2077 \medskip
2078
2079 Special cases:
2080 \begin{itemize}
2081 \item Inverse points:
2082 If the two points are inverse with respect to the given circle, there is an infinite number of solutions, all with their centers lying on the perpendicular bisector of the segment joining the two points.
2083 The chosen solution is the one whose center is the midpoint of the two points.
2084
2085 \item Collinear with center (non-inverse):
2086 If the two points are collinear with the center of the given circle but are not inverse points, no orthogonal circle exists.
2087
2088 \item General case:
2089 In all other situations, there is a unique solution.
2090 \end{itemize}
2091
2092 \vspace{1em}
2093 \begin{minipage}{.5\textwidth}
2094 \directlua{
2095 init_elements()
2096 z.O = point(0,1)
2097 z.A = point(1,0)
2098 z.z1 = point(-1.5,-1.5)
2099 z.z2 = point(2.5,-1.25)
2100 C.OA = circle(z.O, z.A)
2101 C.z1 = C.OA:orthogonal_through(z.z1, z.z2)
2102 z.c = C.z1.center}
2103 \begin{center}
2104 \begin{tikzpicture}
2105 \tkzGetNodes
2106 \tkzDrawCircle(O,A)
2107 \tkzDrawCircle[orange](c, z1)
2108 \tkzDrawPoints[orange](O,A, z1, z2,c)
2109 \tkzLabelPoints[right](O,A)
2110 \tkzLabelPoints[left](z1, z2,c)
2111 \end{tikzpicture}
2112 \end{center}
2113 \end{minipage}
2114 \begin{minipage}{.5\textwidth}
2115 \begin{tkzexample}[code only]
2116 \directlua{
2117 init_elements()
2118 z.O = point(0,1)
2119 z.A = point(1,0)
2120 z.z1 = point(-1.5,-1.5)
2121 z.z2 = point(2.5,-1.25)
2122 C.OA = circle(z.O, z.A)
2123 C.z1 = C.OA:orthogonal_through(z.z1, z.z2)
2124 z.c = C.z1.center}
2125 \end{tkzexample}
2126 \end{minipage}
2127
2128 \subsubsection{Method \tkzMeth{circle}{radical\_circle(C,C)}}
2129 \label{ssub:radical_circle}
2130
2131 \texttt{Radical circle of three given circles.}
2132
2133 \medskip
2134
2135 This method constructs the \emph{radical circle} associated with three given circles. It is defined as the circle:
2136
2137 \begin{itemize}
2138 \item centered at the \textbf{radical center} (the common intersection point of the three radical axes),
2139 \item and orthogonal to all three given circles.
2140 \end{itemize}
2141
2142
2143 An important geometric property is that a circle centered at the radical center and orthogonal to one of the original circles is necessarily orthogonal to the other two as well.
2144
2145 \medskip
2146
2147 This construction plays a key role in advanced configurations such as coaxal systems, power of a point geometry, and triangle centers.
2148 \begin{flushright}
2149 \small
2150 \href{https://mathworld.wolfram.com/RadicalCircle.html}{\textit{(Reference: Weisstein, Eric W. "Radical Circle." MathWorld)}}
2151 \end{flushright}
2152
2153 \vspace{1em}
2154
2155
2156
2157 \begin{minipage}[t]{.5\textwidth}\vspace{0pt}%
2158 \begin{verbatim}
2159 \directlua{
2160 init_elements()
2161 z.A = point(0,0)
2162 z.B = point(6,0)
2163 z.C = point(0.8,4)
2164 T.ABC = triangle(z.A, z.B, z.C)
2165 C.exa = T.ABC:ex_circle()
2166 z.I_a, z.Xa = C.exa:get()
2167 C.exb = T.ABC:ex_circle(1)
2168 z.I_b, z.Xb = C.exb:get()
2169 C.exc = T.ABC:ex_circle(2)
2170 z.I_c, z.Xc = C.exc:get()
2171 C.ortho = C.exa:radical_circle(C.exb,C.exc)
2172 z.w, z.a = C.ortho:get()}
2173 \begin{tikzpicture}[scale = .5]
2174 \tkzGetNodes
2175 \tkzDrawPolygon(A,B,C)
2176 \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc)
2177 \tkzDrawCircles[red,thick](w,a)
2178 \tkzDrawPoints(A,B,C)
2179 \tkzLabelPoints(A,B,C)
2180 \end{tikzpicture}
2181 \end{verbatim}
2182 \end{minipage}
2183
2184 \directlua{
2185 init_elements()
2186 z.A = point(0,0)
2187 z.B = point(6,0)
2188 z.C = point(0.8,4)
2189 T.ABC = triangle(z.A, z.B, z.C)
2190 C.exa = T.ABC:ex_circle()
2191 z.I_a, z.Xa = C.exa:get()
2192 C.exb = T.ABC:ex_circle(1)
2193 z.I_b, z.Xb = C.exb:get()
2194 C.exc = T.ABC:ex_circle(2)
2195 z.I_c, z.Xc = C.exc:get()
2196 C.ortho = C.exa:radical_circle(C.exb,C.exc)
2197 z.w, z.a = C.ortho:get()}
2198
2199 \begin{center}
2200 \begin{tikzpicture}[ scale = .5]
2201 \tkzGetNodes
2202 \tkzDrawPolygon(A,B,C)
2203 \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc)
2204 \tkzDrawCircles[red,thick](w,a)
2205 \tkzDrawPoints(A,B,C)
2206 \tkzLabelPoints(A,B,C)
2207 \end{tikzpicture}
2208 \end{center}
2209
2210 \subsubsection{Method \tkzMeth{circle}{CPP}}
2211 \label{ssub:method_c__c__pp}
2212
2213 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2214
2215
2216 \vspace{1em}
2217 \begin{minipage}{.6\textwidth}
2218 \directlua{
2219 init_elements()
2220 z.A = point(5,4)
2221 z.B = point(3,0)
2222 z.O = point(0,0)
2223 z.C = point(1,0)
2224 C.OC = circle(z.O, z.C)
2225 PA.center, PA.through,
2226 n = C.OC:CPP(z.A, z.B)
2227 }
2228 \begin{center}
2229 \begin{tikzpicture}[scale=.6]
2230 \tkzGetNodes
2231 \tkzDrawCircle[blue](O,C)
2232 \tkzDrawPoints(A,B,C,O)
2233 \tkzDrawCirclesFromPaths[draw,
2234 red](PA.center,PA.through)
2235 \tkzLabelPoints(O,C,A,B)
2236 \end{tikzpicture}
2237 \end{center}
2238 \end{minipage}
2239 \begin{minipage}{.4\textwidth}
2240 \begin{tkzexample}[code only]
2241 \directlua{
2242 init_elements()
2243 z.A = point(5,4)
2244 z.B = point(3,0)
2245 z.O = point(0,0)
2246 z.C = point(1,0)
2247 C.OC = circle(z.O, z.C)
2248 PA.center,
2249 PA.through,
2250 n = C.OC:CPP(z.A, z.B)
2251 }
2252 \begin{tikzpicture}
2253 \tkzGetNodes
2254 \tkzDrawCircle[blue](O,C)
2255 \tkzDrawPoints(A,B,C,O)
2256 \tkzDrawCirclesFromPaths[draw,
2257 red](PA.center,PA.through)
2258 \end{tikzpicture}
2259 \end{tkzexample}
2260 \end{minipage}
2261
2262
2263 \subsubsection{Method \tkzMeth{circle}{CCP(C,p[,mode])}}
2264 \label{ssub:method_c_cc_p}
2265
2266 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2267
2268 \begin{tkzexample}[latex=.5\textwidth]
2269 \directlua{
2270 init_elements()
2271 z.A = point(0, 0)
2272 z.TA = point(3, 0)
2273 z.B = point(6, 2)
2274 z.TB = point(6, 1)
2275 z.P = point(3, 6)
2276 C.A = circle(z.A, z.TA)
2277 C.B = circle(z.B, z.TB)
2278 PA.center, PA.through = C.A:CCP(C.B,
2279 z.P,"external")
2280 z.O1 = PA.center:get(1)
2281 z.O2 = PA.center:get(2)
2282 z.T1 = PA.through:get(1)
2283 z.T2 = PA.through:get(2)
2284 PA.center, PA.through = C.A:CCP(C.B,
2285 z.P,"internal")
2286 z.O3 = PA.center:get(1)
2287 z.O4 = PA.center:get(2)
2288 z.T3 = PA.through:get(1)
2289 z.T4 = PA.through:get(2)}
2290 \begin{center}
2291 \begin{tikzpicture}[scale =.5]
2292 \tkzGetNodes
2293 \tkzDrawCircles[thick](A,TA B,TB)
2294 \tkzDrawCircles[red](O1,T1 O2,T2)
2295 \tkzDrawCircles[blue](O3,T3 O4,T4)
2296 \tkzDrawPoints[size=3](P)
2297 \tkzLabelPoints[above](P)
2298 \end{tikzpicture}
2299 \end{center}
2300 \end{tkzexample}
2301
2302
2303
2304
2305 \subsubsection{Method \tkzMeth{circle}{CLP}(L,p)}
2306 \label{ssub:method_c_lc_p}
2307
2308 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2309
2310 \begin{tkzexample}[latex=.5\textwidth]
2311 \directlua{
2312 init_elements()
2313 z.A = point(0, 0)
2314 z.B = point(4, 0)
2315 L.AB = line (z.A, z.B)
2316 z.O = point(3, 3)
2317 z.T = point(3, 2)
2318 z.P = point(2, .25)
2319 C.OT = circle(z.O, z.T)
2320 PA.center, PA.through = C.OT:CLP(L.AB, z.P)
2321 z.O1 = PA.center:get(1)
2322 z.O2 = PA.center:get(2)
2323 PA.center,
2324 PA.through = C.OT:CLP(L.AB, z.P,'internal')
2325 z.O3 = PA.center:get(1)
2326 z.O4 = PA.center:get(2)}
2327 \begin{tikzpicture}
2328 \tkzGetNodes
2329 \tkzDrawCircles[thick](O,T)
2330 \tkzDrawCircles[red](O1,P O2,P)
2331 \tkzDrawCircles[cyan](O3,P O4,P)
2332 \tkzDrawLines[thick](A,B)
2333 \tkzDrawPoints[size = 2](P)
2334 \tkzDrawPoints(A,B,O,O1,O2,O3,O4)
2335 \end{tikzpicture}
2336 \end{tkzexample}
2337
2338
2339 \subsubsection{Method \tkzMeth{circle}{CLL}(L,L,<choice,inside>)}
2340 \label{ssub:method_c_cll}
2341
2342 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2343
2344 \vspace{1em}
2345 \begin{tkzexample}[vbox]
2346 \directlua{
2347 init_elements()
2348 z.A = point(0, 0)
2349 z.B = point(6, -2)
2350 L.AB = line(z.A, z.B)
2351 z.C = point(-3, -4)
2352 z.D = point(3, 1)
2353 L.CD = line(z.C, z.D)
2354 z.O = z.D + point(-3,1)
2355 z.X = z.O + point(0,1)
2356 C.OX = circle(z.O, z.X)
2357 PA.center, PA.through = C.OX:CLL(L.AB, L.CD,"all")
2358 tkz.nodes_from_paths(PA.center, PA.through)}
2359 \begin{center}
2360 \begin{tikzpicture}[scale=.75]
2361 \tkzGetNodes
2362 \tkzInit[xmin=-5,xmax=10,ymin=-1,ymax=5]
2363 \tkzClip
2364 \tkzDrawLines[blue,add =1 and .25](A,B)
2365 \tkzDrawLines[blue,add =.25 and 1](C,D)
2366 \tkzDrawPoints[blue,size=3](O)
2367 \tkzDrawCirclesFromPaths[draw,red,thick](PA.center,PA.through)
2368 \tkzDrawCircles[thick,blue](O,X)
2369 \tkzDrawPoints[red,size=3](w1)
2370 \tkzLabelPoints[red](O)
2371 \end{tikzpicture}
2372 \end{center}
2373 \end{tkzexample}
2374
2375 \subsection{Case: \tkzMeth{circle}{CCL}(C2, L)}
2376 \label{ssub:CCL}
2377
2378 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2379
2380 \vspace{1em}
2381
2382 \begin{tkzexample}[vbox]
2383 \directlua{
2384 init_elements()
2385 z.A = point(-4, 4)
2386 z.B = z.A + point(3, 0)
2387 C.AB = circle(z.A, z.B)
2388 z.C = point(3,2)
2389 z.D = z.C + point(1,0)
2390 C.CD = circle(z.C, z.D)
2391 z.E = point(-3, 0)
2392 z.F = point(5, 0)
2393 L.EF = line(z.E, z.F)
2394 PA.center, PA.through,n = C.AB:CCL(C.CD, L.EF)
2395 tkz.nodes_from_paths(PA.center, PA.through)
2396 }
2397 \begin{center}
2398 \begin{tikzpicture}[scale=.5]
2399 \tkzGetNodes
2400 \tkzInit[xmin=-8,xmax=8,ymin=-8,ymax=8]
2401 \tkzClip
2402 \tkzDrawLines[thick,blue](E,F)
2403 \tkzDrawCircles[thick,blue](A,B C,D)
2404 \tkzDrawCirclesFromPaths[draw,purple,thick](PA.center, PA.through)
2405 \end{tikzpicture}
2406 \end{center}
2407 \end{tkzexample}
2408
2409 \subsubsection{Case: \tkzMeth{circle}{CCC}(C2, C3 [, opts])}
2410 \label{ssub:CCC}
2411
2412 This method is presented in the document \tkzname{Euclidean Geometry} presented in \href{http://altermundus.fr}{altermundus.fr}.
2413
2414 \vspace{1em}
2415
2416 \begin{tkzexample}[vbox]
2417 \directlua{
2418 init_elements()
2419 z.A = point(0, 0)
2420 z.B = point(6, 0)
2421 z.C = point(2, 5)
2422 z.a = z.A + point(3, 0)
2423 z.b = z.B + point(2, 0)
2424 z.c = z.C + point(1, 0)
2425 C.Aa = circle(z.A, z.a)
2426 C.Bb = circle(z.B, z.b)
2427 C.Cc = circle(z.C, z.c)
2428 PA.center, PA.through, n = C.Aa:CCC(C.Bb, C.Cc)
2429 }
2430 \begin{center}
2431 \begin{tikzpicture}[ scale = .5,gridded]
2432 \tkzInit[xmin=-8,xmax=12,ymin=-8,ymax=10]
2433 \tkzClip
2434 \tkzGetNodes
2435 \tkzDrawCircles[thick,blue](A,a B,b C,c)
2436 \tkzDrawCirclesFromPaths[draw,
2437 purple,thick](PA.center, PA.through)
2438 \end{tikzpicture}
2439 \end{center}
2440 \end{tkzexample}
2441
2442 \subsubsection{Case: \tkzMeth{circle}{CCC\_gergonne}(C\_2, C\_3)}
2443 \label{ssub:CCC_gergonne}
2444
2445
2446 \begin{tkzexample}[vbox]
2447 \directlua{
2448 z.A = point(0, 0)
2449 z.a = z.A + point (1, 0)
2450 z.B = point (4, 1)
2451 z.b = z.B + point (2, 0)
2452 z.C = point (2, 6)
2453 z.c = z.C + point (3, 0)
2454 C.Aa = circle(z.A, z.a)
2455 C.Bb = circle(z.B, z.b)
2456 C.Cc = circle(z.C,z.c)
2457 PA.center, PA.through = C.Aa:CCC_gergonne(C.Bb, C.Cc)
2458 }
2459 \begin{center}
2460 \begin{tikzpicture}[scale = 0.7]
2461 \tkzInit[xmin=-8,xmax=12,ymin=-8,ymax=10]
2462 \tkzClip
2463 \tkzGetNodes
2464 \tkzDrawCircles[fill=blue!15](A,a B,b C,c)
2465 \tkzDrawCirclesFromPaths[draw,purple,thick](PA.center, PA.through)
2466 \end{tikzpicture}
2467 \end{center}
2468 \end{tkzexample}
2469
2470 \subsubsection{Method \tkzMeth{circle}{midcircle}}
2471 \label{ssub:midcircle}
2472
2473 \medskip
2474
2475 \emph{According to Eric Danneels and Floor van Lamoen:}
2476
2477 \begin{quote}
2478 A \textbf{midcircle} of two given circles is a circle that maps one to the other via an \textbf{inversion}. Midcircles belong to the same pencil of circles as the two originals. The center(s) of the midcircle(s) correspond to the \emph{centers of similitude} of the given circles.
2479 \end{quote}
2480
2481 I have adopted the term \textbf{midcircle} used by \tkzimp{Eric Danneels} and \tkzimp{Floor van Lamoen}, as well as by \tkzimp{Eric W. Weisstein}, but many other names exist, such as \textbf{mid-circle} or \textbf{circle of antisimilitude} [Wikipedia]. The latter name can be found in Advanced Euclidean Geometry by \tkzimp{Roger A. Johnson} (2007). On the website \textit{cut-the-knot.org}, reference is made to the \textbf{bisectal circle}, translated from French as \textbf{cercle bissecteur} and used by \tkzimp{Hadamard}, but this refers to the case where the two given circles intersect.
2482
2483
2484 Four cases can be distinguished:
2485
2486 \begin{enumerate}[label=(\roman*)]
2487 \item \textbf{The two circles intersect}: There are two midcircles, centered at the internal and external centers of similitude;
2488 \item \textbf{One circle lies entirely inside the other}: There is a unique midcircle centered at the \emph{internal} center of similitude;
2489 \item \textbf{One circle lies entirely outside the other}: There is a unique midcircle centered at the \emph{external} center of similitude;
2490 \item \textbf{Tangency or single-point intersection}: These are limiting cases of the configurations above.
2491 \end{enumerate}
2492
2493
2494 \vspace{1em}
2495 Let’s examine at each of these cases in more detail:
2496
2497 \begin{enumerate}[label=(\roman*)]
2498 \item If the two given circles intersect, then there are two circles of inversion through their common points, with centers at the centers of similitudes. The two midcircles bisect their angles and are orthogonal to each other. The centers of the midcircles are the internal center of similitude and the external center of similitude $I$ and $J$.
2499
2500 \begin{itemize}
2501 \item Suppose $(\mathcal{A})$ and $(\mathcal{B})$ are two intersecting circles.
2502 \item Their common points define two inversion circles (midcircles), orthogonal to each other.
2503 \item The centers of these midcircles are the internal and external centers of similitude, denoted $I$ and $J$.
2504 \end{itemize}
2505
2506
2507 To construct these centers:
2508 \begin{itemize}
2509 \item Take two diameters $EH$ of $(\mathcal{A})$ and $FG$ of $(\mathcal{B})$, such that the segments $EH$ and $FG$ are parallel.
2510 \item The intersection of lines $(GE)$ and $(AB)$ gives point $J$, the \emph{external} center of similitude.
2511 \item The intersection of lines $(EF)$ and $(AB)$ gives point $I$, the \emph{internal} center of similitude.
2512 \end{itemize}
2513
2514
2515 The circles $(\mathcal{I})$ and $(\mathcal{J})$, centered respectively at $I$ and $J$, are orthogonal and form the midcircles of $(\mathcal{A})$ and $(\mathcal{B})$. The division $(A,B;I,J)$ is harmonic.
2516
2517 \vspace{1em}
2518
2519 \begin{minipage}{.45\textwidth}
2520 \directlua{
2521 init_elements()
2522 z.A = point(1, 0)
2523 z.B = point(3, 0)
2524 z.O = point(2.1, 0)
2525 z.P = point(1,0)
2526 C.AO = circle(z.A, z.O)
2527 C.BP = circle(z.B, z.P)
2528 z.E = C.AO.south
2529 z.H = C.AO.north
2530 z.F = C.BP.north
2531 z.G = C.BP.south
2532 C.IT,C.JV = C.AO:midcircle(C.BP)
2533 z.I, z.T = C.IT:get()
2534 z.J, z.V = C.JV:get()
2535 z.X, z.Y = intersection(C.AO,C.BP)}
2536 \begin{center}
2537 \begin{tikzpicture}[scale = .75]
2538 \tkzGetNodes
2539 \tkzDrawCircles[teal,thick](A,O B,P)
2540 \tkzDrawSegments[dashed,red](E,F I,B I,G I,F)
2541 \tkzDrawLines[gray](I,T J,V)
2542 \tkzDrawCircles[teal,thick](A,O B,P)
2543 \tkzDrawCircles[red,thick](I,X J,X)
2544 \tkzDrawPoints(A,B,I,J,E,F,G,H,X,Y)
2545 \tkzDrawPoints[red](I,J)
2546 \begin{scope}[font = \scriptsize]
2547 \tkzLabelPoints(A,I,J,G)
2548 \tkzLabelPoints[below left](E)
2549 \tkzLabelPoints[right](B)
2550 \tkzLabelPoints[above](F,H,X)
2551 \tkzLabelPoints[above right](Y)
2552 \end{scope}
2553 \end{tikzpicture}
2554 \end{center}
2555 \end{minipage}
2556 \begin{minipage}{.45\textwidth}
2557 \begin{tkzexample}[code only]
2558 \directlua{
2559 init_elements()
2560 z.A = point(1, 0)
2561 z.B = point(3, 0)
2562 z.O = point(2.1, 0)
2563 z.P = point(1,0)
2564 C.AO = circle(z.A, z.O)
2565 C.BP = circle(z.B, z.P)
2566 z.E = C.AO.south
2567 z.H = C.AO.north
2568 z.F = C.BP.north
2569 z.G = C.BP.south
2570 C.IT,C.JV = C.AO:midcircle(C.BP)
2571 z.I, z.T = C.IT:get()
2572 z.J, z.V = C.JV:get()
2573 z.X, z.Y = intersection(C.AO,C.BP)}
2574 \end{tkzexample}
2575 \end{minipage}
2576
2577 \item \textbf{One given circle lies entirely within the other.}
2578 \label{midcircle_diameter}
2579
2580 This configuration is slightly more delicate to handle. To construct the midcircle, we proceed as follows:
2581
2582 \begin{itemize}
2583 \item First, construct two auxiliary circles $(\alpha)$ and $(\beta)$, each tangent to both of the given circles — one internally, one externally.
2584 \item Then, construct the \emph{radical circle} orthogonal to both $(\alpha)$ and $(\beta)$.
2585 \item The center of this radical circle is the \textbf{radical center}, which coincides with the \emph{internal center of similitude} of the original circles.
2586 \end{itemize}
2587
2588
2589 This radical circle is the unique midcircle in this case: it swaps the two original circles via inversion and lies in the same pencil of circles.
2590
2591 \vspace{1em}
2592 \begin{minipage}{.45\textwidth}
2593 \directlua{
2594 init_elements()
2595 z.A = point(3, 0)
2596 z.B = point(5, 0)
2597 z.O = point(2, 0)
2598 z.P = point(1, 0)
2599 L.AB = line(z.A, z.B)
2600 C.AO = circle(z.A, z.O)
2601 C.BP = circle(z.B, z.P)
2602 z.R, z.S = intersection(L.AB,C.BP)
2603 z.U, z.V = intersection(L.AB,C.AO)
2604 C.SV = circle:diameter(z.S, z.V)
2605 C.UR = circle:diameter(z.U, z.R)
2606 z.x = C.SV.center
2607 z.y = C.UR.center
2608 C.IT = C.AO:midcircle(C.BP)
2609 z.I, z.T = C.IT:get()}
2610 \begin{center}
2611 \begin{tikzpicture}[scale =.6]
2612 \tkzGetNodes
2613 \tkzDrawCircles[teal,thick](A,O B,P)
2614 \tkzDrawCircles[green!20!black](x,S y,R)
2615 \tkzDrawPoints(A,B)
2616 \tkzDrawPoints[red](I)
2617 \tkzLabelPoints(A,B,I)
2618 \tkzDrawCircles[red,thick](I,T)
2619 \tkzLabelCircle[below](x,V)(270){$(\alpha)$}
2620 \tkzLabelCircle[below](y,R)(270){$(\beta)$}
2621 \tkzLabelCircle[below](I,T)(250){$\textcolor{red}{(\gamma)}$}
2622 \end{tikzpicture}
2623 \end{center}
2624 \end{minipage}
2625 \begin{minipage}{.45\textwidth}
2626 \begin{tkzexample}[code only]
2627 \directlua{
2628 init_elements()
2629 z.A = point(3, 0)
2630 z.B = point(5, 0)
2631 z.O = point(2, 0)
2632 z.P = point(1, 0)
2633 L.AB = line(z.A, z.B)
2634 C.AO = circle(z.A, z.O)
2635 C.BP = circle(z.B, z.P)
2636 z.R, z.S = intersection(L.AB,C.BP)
2637 z.U, z.V = intersection(L.AB,C.AO)
2638 C.SV = circle:diameter(z.S, z.V)
2639 C.UR = circle:diameter(z.U, z.R)
2640 z.x = C.SV.center
2641 z.y = C.UR.center
2642 C.IT = C.AO:midcircle(C.BP)
2643 z.I, z.T = C.IT:get()}
2644 \end{tkzexample}
2645 \end{minipage}
2646
2647 \item \textbf{The two given circles are external to each other.}
2648
2649 In this configuration, there exists a unique midcircle whose center is the \textbf{external center of similitude} of the two given circles.
2650
2651 \medskip
2652
2653 Let $I$ denote this external center of similitude. To construct the corresponding inversion circle (the midcircle), we proceed as follows:
2654
2655 \begin{itemize}
2656 \item Construct the external center $I$ based on the line joining the centers of the two given circles and their respective radii.
2657 \item Let $E$ and $F$ be the points of tangency (or auxiliary points) such that $IE \cdot IF = IH^2$.
2658 \item The point $H$ lies on the desired midcircle, and the circle centered at $I$ and passing through $H$ is the unique \textbf{external midcircle}.
2659 \end{itemize}
2660
2661
2662 This circle performs an inversion that maps one circle onto the other and lies in the same pencil of circles.
2663
2664 \item \textbf{The two given circles are external to each other.}
2665
2666 In this configuration, there exists a unique midcircle whose center is the \textbf{external center of similitude} of the two given circles.
2667
2668 \medskip
2669
2670 Let $I$ denote this external center of similitude. To construct the corresponding inversion circle (the midcircle), we proceed as follows:
2671
2672 \begin{itemize}
2673 \item Construct the external center $I$ based on the line joining the centers of the two given circles and their respective radii.
2674 \item Let $E$ and $F$ be the points of tangency (or auxiliary points) such that $IE \cdot IF = IH^2$.
2675 \item The point $H$ lies on the desired midcircle, and the circle centered at $I$ and passing through $H$ is the unique \textbf{external midcircle}.
2676 \end{itemize}
2677
2678
2679 This circle performs an inversion that maps one circle onto the other and lies in the same pencil of circles.
2680
2681
2682 \begin{minipage}{.45\textwidth}
2683 \directlua{
2684 init_elements()
2685 z.A = point(0, 0)
2686 z.B = point(4, 0)
2687 z.a = point(.5, 0)
2688 z.b = point(1, 0)
2689 C.Aa = circle (z.A, z.a)
2690 C.Bb = circle (z.B, z.b)
2691 L.AB = line(z.A, z.B)
2692 z.E = C.Aa.north
2693 z.F = C.Bb.north
2694 L.EF = line(z.E, z.F)
2695 C.IT = C.Aa:midcircle(C.Bb)
2696 z.I, z.T = C.IT:get()
2697 L.TF = C.Bb:tangent_from(z.I)
2698 z.H = intersection(L.TF,C.IT)
2699 z.E = intersection(L.TF,C.Aa)
2700 z.F=L.TF.pb}
2701 \begin{center}
2702 \begin{tikzpicture}[scale=.75]
2703 \tkzGetNodes
2704 \tkzDrawCircles[teal,thick](A,a B,b)
2705 \tkzDrawCircles[red,thick](I,T)
2706 \tkzDrawSegments[gray](I,F)
2707 \tkzDrawPoints(A,B,E,F)
2708 \tkzDrawPoints[red](I,H)
2709 \tkzDrawLine(I,B)
2710 \tkzLabelPoints(A,B)
2711 \tkzLabelPoints[above](E,F)
2712 \tkzLabelPoints[above left,red](I)
2713 \tkzLabelPoints[above right,red](H)
2714 \end{tikzpicture}
2715 \end{center}
2716 \end{minipage}
2717 \begin{minipage}{.45\textwidth}
2718 \begin{tkzexample}[code only]
2719 \directlua{
2720 init_elements()
2721 z.A = point(0, 0)
2722 z.B = point(4, 0)
2723 z.a = point(.5, 0)
2724 z.b = point(1, 0)
2725 C.Aa = circle (z.A, z.a)
2726 C.Bb = circle (z.B, z.b)
2727 L.AB = line(z.A, z.B)
2728 z.E = C.Aa.north
2729 z.F = C.Bb.north
2730 L.EF = line(z.E, z.F)
2731 C.IT = C.Aa:midcircle(C.Bb)
2732 z.I, z.T = C.IT:get()
2733 L.TF = C.Bb:tangent_from(z.I)
2734 z.H = intersection(L.TF,C.IT)
2735 z.E = intersection(L.TF,C.Aa)
2736 z.F=L.TF.pb}
2737 \end{tkzexample}
2738 \end{minipage}
2739
2740 \item \textbf{The two circles are tangent.}
2741
2742 \begin{itemize}
2743 \item If circle $(\mathcal{B})$ is \emph{externally tangent} to circle $(\mathcal{A})$, the construction of the midcircle is identical to the case of two disjoint circles. The external center of similitude still exists, and the inversion circle centered at this point transforms one circle into the other.
2744
2745 \item If one of the circles lies \emph{inside} the other and they are \emph{internally tangent}, the construction simplifies. The center of the midcircle is the internal center of similitude, which coincides with the point of tangency. The inversion circle is then centered at this point and passes through any auxiliary point satisfying the inversion relation.
2746 \end{itemize}
2747
2748
2749 \begin{minipage}{.45\textwidth}
2750 \directlua{
2751 init_elements()
2752 local a,b,c,d
2753 z.A = point(0, 0)
2754 z.B = point(4, 0)
2755 z.a = point(1, 0)
2756 z.b = point(1, 0)
2757 C.Aa = circle (z.A, z.a)
2758 C.Bb = circle (z.B, z.b)
2759 L.AB = line(z.A, z.B)
2760 z.E = C.Aa.north
2761 z.F = C.Bb.north
2762 L.EF = line(z.E, z.F)
2763 C.IT = C.Aa:midcircle(C.Bb)
2764 z.I, z.T = C.IT:get()
2765 L.TF = C.Bb:tangent_from(z.I)
2766 z.H = intersection(L.TF,C.IT)
2767 z.E = intersection(L.TF,C.Aa)
2768 z.F=L.TF.pb}
2769 \begin{center}
2770 \begin{tikzpicture}[scale=.5]
2771 \tkzGetNodes
2772 \tkzDrawCircles[teal,thick](A,a B,b)
2773 \tkzDrawCircles[red,thick](I,T)
2774 \tkzDrawSegments[gray](I,F)
2775 \tkzDrawPoints(A,B,E,F)
2776 \tkzDrawPoints[red](I,H)
2777 \tkzDrawLine(I,B)
2778 \tkzLabelPoints(A,B)
2779 \tkzLabelPoints[above](E,F)
2780 \tkzLabelPoints[above left,red](I)
2781 \tkzLabelPoints[above right,red](H)
2782 \end{tikzpicture}
2783 \end{center}
2784 \end{minipage}
2785 \begin{minipage}{.45\textwidth}
2786 \begin{tkzexample}[code only]
2787 \directlua{
2788 init_elements()
2789 local a,b,c,d
2790 z.A = point(0, 0)
2791 z.B = point(4, 0)
2792 z.a = point(1, 0)
2793 z.b = point(1, 0)
2794 C.Aa = circle (z.A, z.a)
2795 C.Bb = circle (z.B, z.b)
2796 L.AB = line(z.A, z.B)
2797 z.E = C.Aa.north
2798 z.F = C.Bb.north
2799 L.EF = line(z.E, z.F)
2800 C.IT = C.Aa:midcircle(C.Bb)
2801 z.I, z.T = C.IT:get()
2802 L.TF = C.Bb:tangent_from(z.I)
2803 z.H = intersection(L.TF,C.IT)
2804 z.E = intersection(L.TF,C.Aa)
2805 z.F=L.TF.pb}
2806 \end{tkzexample}
2807 \end{minipage}
2808
2809
2810 \begin{minipage}{.45\textwidth}
2811 \directlua{
2812 init_elements()
2813 z.A = point(2, 0)
2814 z.B = point(4, 0)
2815 z.a = point(1, 0)
2816 z.b = point(1, 0)
2817 C.Aa = circle(z.A, z.a)
2818 C.Bb = circle(z.B, z.b)
2819 C.IT = C.Aa:midcircle(C.Bb)
2820 z.I,
2821 z.T = C.IT:get()}
2822 \begin{center}
2823 \begin{tikzpicture}
2824 \tkzGetNodes
2825 \tkzDrawCircles[teal,thick](A,a B,b)
2826 \tkzDrawCircles[red,thick](I,T)
2827 \tkzDrawPoints(A,B)
2828 \tkzDrawPoints[red](I)
2829 \tkzLabelPoints(A,B)
2830 \tkzLabelPoints[above left,red](I)
2831 \end{tikzpicture}
2832 \end{center}
2833 \end{minipage}
2834 \begin{minipage}{.45\textwidth}
2835 \begin{tkzexample}[code only]
2836 \directlua{
2837 init_elements()
2838 z.A = point(2, 0)
2839 z.B = point(4, 0)
2840 z.a = point(1, 0)
2841 z.b = point(1, 0)
2842 C.Aa = circle(z.A, z.a)
2843 C.Bb = circle(z.B, z.b)
2844 C.IT = C.Aa:midcircle(C.Bb)
2845 z.I,
2846 z.T = C.IT:get()}
2847 \end{tkzexample}
2848 \end{minipage}
2849
2850 \end{enumerate}
2851
2852 \textbf{Midcircle between a circle and a line}
2853
2854 It is possible to generalize the notion of midcircle to the case of a circle and a line.
2855 A midcircle of a circle and a straight line is defined as a circle with respect to which the given circle and line are mutually inverse.
2856
2857
2858 In this situation, there are only three possible cases, but they share several common features.
2859 The center of the midcircle lies on the line passing through the center of the given circle and perpendicular to the given line.
2860 Moreover, the center is also one of the intersection points of the circle and the line.
2861
2862 Three cases can be distinguished:
2863
2864 \begin{enumerate}[label=(\roman*)]
2865 \item \texttt{The circle and the line intersect};
2866 \item \texttt{The circle and the line are disjoint};
2867 \item \texttt{The circle and the line are tangent}.
2868 \end{enumerate}
2869
2870 Let's look at each case:
2871
2872 \texttt{Note: } It should be noted that in each case, inversion allows us to verify that the two objects are inverses of each other.
2873
2874
2875 \begin{enumerate}
2876 \item \texttt{The circle and the line are disjoint.}
2877
2878 \begin{tkzexample}[latex=.5\textwidth]
2879 \directlua{
2880 init_elements()
2881 z.o = point(-1,1)
2882 z.a = point(1,2)
2883 C.oa = circle(z.o, z.a)
2884 z.c = point(3,2)
2885 z.d = point(0,4)
2886 L.cd = line(z.c, z.d)
2887 C.OH = C.oa:inversion(L.cd)
2888 z.O, z.H = C.OH:get()
2889 L.inv = C.oa:inversion(C.OH)
2890 z.x, z.y = L.inv:get()
2891 C.inv = C.OH:midcircle(L.cd)
2892 z.w, z.t = C.inv:get()
2893 z.P = L.cd:projection(z.o)
2894 z.T = intersection(C.inv,line(z.o,z.P))}
2895 \begin{center}
2896 \begin{tikzpicture}[scale=.75]
2897 \tkzGetNodes
2898 \tkzDrawCircles[blue](O,H)
2899 \tkzDrawCircles[red](w,t)
2900 \tkzDrawLines[blue](c,d)
2901 \tkzDrawLines[lightgray](o,P)
2902 \tkzDrawPoint(w)
2903 \tkzMarkRightAngle(w,P,c)
2904 \end{tikzpicture}
2905 \end{center}
2906 \end{tkzexample}
2907
2908 \item \texttt{The circle and the line intersect}
2909
2910 \begin{tkzexample}[latex=.5\textwidth]
2911 \directlua{
2912 init_elements()
2913 z.o = point(0,1)
2914 z.a = point(1,3)
2915 C.oa = circle(z.o, z.a)
2916 z.c = point(-1,2)
2917 z.d = point(1,3)
2918 L.cd = line(z.c, z.d)
2919 C.OH = C.oa:inversion(L.cd)
2920 z.O, z.H = C.OH:get()
2921 L.inv = C.oa:inversion(C.OH)
2922 z.x, z.y = L.inv:get()
2923 C.inv = C.OH:midcircle(L.cd)
2924 z.w, z.t = C.inv:get()
2925 z.P = L.cd:projection(z.o)
2926 z.T = intersection(C.inv,line(z.o,z.P))}
2927 \begin{center}
2928 \begin{tikzpicture}[scale=.75]
2929 \tkzGetNodes
2930 \tkzDrawCircles[blue](O,H)
2931 \tkzDrawCircles[red](w,t)
2932 \tkzDrawLines[blue,add = 2 and 1](c,d)
2933 \tkzDrawLines[lightgray](o,T)
2934 \tkzDrawPoint(w)
2935 \tkzMarkRightAngle(w,P,c)
2936 \end{tikzpicture}
2937 \end{center}
2938 \end{tkzexample}
2939
2940 \item \texttt{The circle and the line are tangent}
2941
2942 \begin{tkzexample}[latex=.5\textwidth]
2943 \directlua{
2944 init_elements()
2945 z.o = point(-1,1)
2946 z.a = point(1,3)
2947 C.oa = circle(z.o, z.a)
2948 z.c = point(3,2)
2949 z.d = point(0,4)
2950 L.cd = C.oa:tangent_at(z.a)
2951 C.OH = C.oa:inversion(L.cd)
2952 C.wt = C.OH:midcircle(L.cd)
2953 z.O, z.H = C.OH:get()
2954 z.w, z.t = C.wt:get()
2955 z.c, z.d = L.cd:get()}
2956 \begin{center}
2957 \begin{tikzpicture}
2958 \tkzGetNodes
2959 \tkzDrawCircles[red](w,t)
2960 \tkzDrawCircles[blue](O,H)
2961 \tkzDrawLines[blue](c,d)
2962 \tkzDrawLines[lightgray](o,H)
2963 \tkzDrawPoint(w)
2964 \tkzMarkRightAngle(w,a,c)
2965 \end{tikzpicture}
2966 \end{center}
2967 \end{tkzexample}
2968
2969 \end{enumerate}
2970
2971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972
2973 %%%%%%% Inversion
2974
2975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2976
2977 \subsection{Transformations: the result is an object}
2978
2979 \subsubsection{Method \tkzMeth{circle}{inversion(obj)}:point, line and circle} %(fold)
2980 \label{ssub:inversion}
2981
2982 The \code{inversion} method can be used on a point, a group of points, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use.
2983
2984
2985 \textbf{Inversion:point} %(fold)
2986 \label{par:inversion_point}
2987
2988 Returns a point.
2989
2990 \begin{tkzexample}[latex=.5\textwidth]
2991 \directlua{
2992 init_elements()
2993 z.o = point(-1,2)
2994 z.a = point(2,1)
2995 C.oa = circle(z.o, z.a)
2996 z.c = point(3,4)
2997 z.d = C.oa:inversion(z.c)
2998 p = C.oa:power(z.c)}
2999
3000 \begin{center}
3001 \begin{tikzpicture}[scale =.75]
3002 \tkzGetNodes
3003 \tkzDrawCircle(o,a)
3004 \tkzDrawSegments(o,a o,c)
3005 \tkzDrawPoints(a,o,c,d)
3006 \tkzLabelPoints(a,o,c,d)
3007 \tkzLabelSegment[sloped,above=1em](c,d){%
3008 The power of c is \tkzUseLua{p}}
3009 \end{tikzpicture}
3010 \end{center}
3011 \end{tkzexample}
3012
3013 \textbf{Inversion:line}
3014 \label{par:inversion_line}
3015
3016 The result is either a straight line or a circle.
3017
3018 \begin{tkzexample}[latex=.5\textwidth]
3019 \directlua{
3020 init_elements()
3021 z.o = point(-1,1)
3022 z.a = point(1,3)
3023 C.oa = circle(z.o, z.a)
3024 z.c = point(3,2)
3025 z.d = point(0,4)
3026 L.cd = line(z.c, z.d)
3027 C.OH = C.oa:inversion(L.cd)
3028 z.O, z.H = C.OH:get()}
3029
3030 \begin{center}
3031 \begin{tikzpicture}
3032 \tkzGetNodes
3033 \tkzDrawCircles(o,a)
3034 \tkzDrawCircles[new](O,H)
3035 \tkzDrawLines(c,d o,H)
3036 \tkzDrawPoints(a,o,c,d,H)
3037 \tkzLabelPoints(a,o,c,d,H)
3038 \end{tikzpicture}
3039 \end{center}
3040 \end{tkzexample}
3041
3042 \textbf{Inversion:circle}
3043 \label{par:inversion_circle}
3044
3045 The result is either a straight line or a circle.
3046
3047 \begin{tkzexample}[latex=.5\textwidth]
3048 \directlua{
3049 init_elements()
3050 z.o, z.a = point(-1,3),point(2,3)
3051 z.c = point(-2,1)
3052 z.e, z.d = point(-2,7),point(-3,5)
3053 C.oa = circle(z.o, z.a)
3054 C.ed = circle(z.e, z.d)
3055 C.co = circle(z.c, z.o)
3056 obj = C.oa:inversion(C.co)
3057 if obj.type == "line" then
3058 z.p, z.q = obj:get()
3059 else
3060 z.f, z.b = obj:get()
3061 end
3062 obj = C.oa:inversion(C.ed)
3063 if obj.type == "line" then
3064 z.p, z.q = obj:get()
3065 else
3066 z.f, z.b = obj:get()
3067 end
3068 color = "orange"}
3069 \begin{center}
3070 \begin{tikzpicture}[scale =.75]
3071 \tkzGetNodes
3072 \tkzDrawCircles[black](o,a)
3073 \tkzDrawCircles[teal](c,o e,d)
3074 \tkzDrawCircles[\tkzUseLua{color}](f,b)
3075 \tkzDrawSegments[\tkzUseLua{color}](p,q)
3076 \tkzDrawPoints(a,...,f,o,p,q)
3077 \tkzLabelPoints(a,...,f,o,p,q)
3078 \end{tikzpicture}
3079 \end{center}
3080 \end{tkzexample}
3081
3082 \subsubsection{Method \tkzMeth{circle}{inversion\_neg(obj)}}
3083 \label{ssub:inversion_neg}
3084
3085
3086 \texttt{Syntax: }
3087
3088 \verb|local Q = C:inversion_neg(obj)|
3089
3090 \texttt{Purpose: }
3091
3092 This method performs the inversion with respect to the circle \(C\) but with a
3093 \emph{negative power}.
3094 For a point \(P \neq O\), this means that
3095 \[
3096 \overrightarrow{OP'} \cdot \overrightarrow{OP} = -R^2,
3097 \]
3098 that is, \(P'\) is the inverse of \(P\) on the opposite half–line of \(OP\).
3099 From a geometric point of view, the image set (line or circle) is the same as
3100 with the ordinary inversion, but the points are taken with reversed orientation
3101 along that set.
3102
3103 \texttt{Arguments: }
3104 \begin{itemize}
3105 \item \verb|obj| – a \tkzname{point}, a \tkzname{line} (possibly not passing through \(O\)),
3106 or a \tkzname{circle}.
3107 \end{itemize}
3108
3109 \texttt{Returns: }
3110 \begin{itemize}
3111 \item If \verb|obj| is a point \(P\neq O\): the point \(P'=\texttt{inversion\_neg}(P)\).
3112 \item If \verb|obj| is a line not passing through \(O\): the same circle image
3113 as with \verb|C:inversion(line)| (it passes through \(O\)), but the orientation of the
3114 points on it is reversed.
3115 \item If \verb|obj| is a line passing through \(O\): the image is the same
3116 line.
3117 \item If \verb|obj| is a circle not passing through \(O\): the image is the same
3118 circle as with \verb|inversion|, but with reversed orientation.
3119 \item If \verb|obj| is a circle passing through \(O\): the image is the same line.
3120 \end{itemize}
3121
3122 \texttt{Details: }
3123
3124 For a point \(P\),
3125 \[
3126 \vec{OP'} = -\frac{R^2}{\|OP\|^2}\,\vec{OP}.
3127 \]
3128 This is equivalent to performing the ordinary inversion followed by a
3129 central symmetry with respect to \(O\) (taking the antipode).
3130
3131 For lines and circles, \verb|inversion_neg| produces the same geometric image as
3132 \verb|inversion|; the negative sign only affects the parametrization along that
3133 image.
3134
3135 \texttt{About the next example: }
3136
3137 The aim is to find the circles passing through a point $P$ tangent to a line $L$ and a circle.
3138
3139
3140 In the example given above, the point
3141 \verb|P2 = C.inv2:inversion_neg(P)| lies on the required circle because
3142 the negative inversion places the image of \(P\) on the same geometric locus as
3143 the standard inversion, but on the opposite direction relative to \(O\).
3144 When combined with \verb|CPP(P,P2)|, this choice selects the correct circle among
3145 the possible tangent ones, ensuring that \(P_2\) lies exactly on the desired
3146 solution circle.
3147
3148
3149
3150 \begin{tkzexample}[vbox]
3151 \directlua{
3152 init_elements()
3153 z.A = point(0, -5)
3154 z.B = point(5, -3)
3155 z.O = point(0, 0)
3156 z.C = point(2, 0)
3157 L.AB = line(z.A, z.B)
3158 C.OC = circle(z.O, z.C)
3159 L.main = L.AB:orthogonal_from(z.O)
3160 z.P = point(-4, -5)
3161 C.inv, C.inv2 = C.OC:midcircle(L.AB)
3162 z.P1 = C.inv:inversion(z.P)
3163 local center,
3164 through = C.OC:CPP(z.P,z.P1)
3165 z.w1 = center:get(1)
3166 z.t1 = through:get(1)
3167 z.w2 = center:get(2)
3168 z.t2 = through:get(2)
3169 z.P2 = C.inv2:inversion_neg(z.P)
3170 PA.c, PA.t = C.OC:CPP(z.P,z.P2)
3171 tkz.nodes_from_paths(PA.c, PA.t,"w","t",3)
3172 }
3173 \begin{center}
3174 \begin{tikzpicture}[scale=.5]
3175 \tkzInit[xmin=-8,xmax=12,ymin=-8,ymax=10]
3176 \tkzClip
3177 \tkzGetNodes
3178 \tkzDrawLines[thick,blue, add = 1 and 1](A,B)
3179 \tkzDrawCircle[thick,blue](O,C)
3180 \tkzDrawCircles[thick,purple](w1,t1 w2,t2)
3181 \tkzDrawCircles[orange,thick](w3,t3)
3182 \tkzDrawArc[delta=10,orange,thick](w4,P)(P2)
3183 \tkzDrawPoints(P,P1,P2)
3184 \tkzLabelPoints(P,P1,P2)
3185 \tkzLabelLine[below,pos=1.25](A,B){$L$}
3186 \end{tikzpicture}
3187 \end{center}
3188 \end{tkzexample}
3189
3190
3191
3192
3193 \subsubsection{Method \tkzMeth{circle}{path(p1, p2, N)}}
3194 \label{ssub:circle_path}
3195
3196 \texttt{Purpose: } The \tkzClass{circle} class includes a method \code{path} to create a \tkzClass{path} object representing a circular arc between two points on the circle.
3197
3198 \medskip
3199 \texttt{Syntax: }
3200 This method samples the arc between two points \code{za} and \code{zb} lying on the circle, using a specified number of subdivisions.
3201
3202 \begin{mybox}
3203 \begin{verbatim}
3204 C = circle(z.O, z.A)
3205 PA.arc = C:path(z.B, z.C, 100)
3206 \end{verbatim}
3207 \end{mybox}
3208
3209 The arc begins at \code{z.B} and ends at \code{z.C}, and is divided into 100 steps.
3210
3211 You can draw the resulting path in \TIKZ{} using:
3212
3213 \begin{mybox}
3214 \begin{verbatim}
3215 \tkzDrawCoordinates[smooth](PA.arc)
3216 \end{verbatim}
3217 \end{mybox}
3218
3219 \texttt{Example usage: }
3220
3221
3222 \begin{tkzexample}[latex = .5\textwidth]
3223 \directlua{
3224 z.O = point(0, 0)
3225 z.A = point(5, 0)
3226 C.OA = circle(z.O, z.A)
3227 z.S = C.OA.south
3228 C.SO = circle(z.S, z.O)
3229 z.B,z.C = intersection(C.OA, C.SO)
3230 C.BC = circle(z.B, z.C)
3231 L.BC = line(z.B, z.C)
3232 z.D = intersection(C.OA, C.BC)
3233 C.CD = circle(z.C, z.D)
3234 PA.p1 = C.SO:path(z.C, z.B, 20)
3235 PA.p2 = C.BC:path(z.C, z.D, 20)
3236 PA.p3 = C.CD:path(z.D, z.B, 20)
3237 PA.path = (-PA.p1) + PA.p2 + PA.p3
3238 }
3239 \begin{tikzpicture}[scale = .5]
3240 \tkzGetNodes
3241 \tkzDrawCircles(O,A S,O)
3242 \tkzDrawArc(B,C)(D)
3243 \tkzDrawArc(C,D)(B)
3244 \tkzDrawCoordinates[fill = purple!20,
3245 opacity=.4](PA.path)
3246 \tkzDrawCoordinates[smooth,red,
3247 thick](PA.path)
3248 \tkzDrawPoints(A,O,B,C,S,D)
3249 \tkzLabelPoints(A,B,C)
3250 \end{tikzpicture}
3251 \end{tkzexample}
3252 \endinput