\newpage
\section{Circles}

Among the following macros, one will allow you to draw a circle, which is not a real feat. To do this, you will need to know the center of the circle and either the radius of the circle or a point on the circumference. It seemed to me that the most frequent use was to draw a circle with a given center passing through a given point. This will be the default method, otherwise you will have to use the \tkzname{R} option. There are a large number of special circles, for example the circle circumscribed by a triangle.

\begin{itemize}
  \item  I have created a first macro \tkzcname{tkzDefCircle} which allows, according to a particular circle, to retrieve its center and the measurement of the radius in cm. This recovery is done with the macros \tkzcname{tkzGetPoint} and \tkzcname{tkzGetLength};
 
 \item then a macro \tkzcname{tkzDrawCircle};
 
 \item then a macro that allows you to color in a disc, but without drawing the circle \tkzcname{tkzFillCircle};
 
 \item sometimes, it is necessary for a drawing to be contained in a disk, this is the role assigned to \tkzcname{tkzClipCircle};
  
 \item  it finally remains to be able to give a label to designate a circle and if several possibilities are offered, we will see here \tkzcname{tkzLabelCircle}.
\end{itemize} 

\subsection{Characteristics of a circle: \tkzcname{tkzDefCircle}}
 
This macro allows you to retrieve the characteristics (center and radius) of certain circles.

\begin{NewMacroBox}{tkzDefCircle}{\oarg{local options}\parg{A,B} or \parg{A,B,C}}%
\tkzHandBomb\ Attention the arguments are lists of two or three points. This macro is either used in partnership with \\ \tkzcname{tkzGetPoints} to obtain the center and a point on the circle, or by using \\ \tkzname{tkzFirstPointResult} and \tkzname{tkzSecondPointResult} if it is not necessary to keep the results. You can also use  \tkzcname{tkzGetLength} to get the radius.

\medskip
\begin{tabular}{lll}%
\toprule
arguments           & example & explanation                         \\
\midrule
\TAline{\parg{pt1,pt2} or \parg{pt1,pt2,pt3}}{\parg{A,B}} {$[AB]$ is radius $A$ is the center}
\bottomrule
\end{tabular} 

\medskip
\begin{tabular}{lll}%
\toprule
options             & default & definition                         \\ 
\midrule
\TOline{R}       {circum}{circle characterized by a center and a radius} 
\TOline{diameter}{circum}{circle characterized by two points defining a diameter}
\TOline{circum}       {circum}{circle circumscribed of a triangle} 
\TOline{in}           {circum}{incircle a triangle} 
\TOline{ex}           {circum}{excircle of a  triangle}
\TOline{euler or nine}{circum}{Euler's Circle}
\TOline{spieker}      {circum}{Spieker Circle}
\TOline{apollonius}   {circum}{circle of Apollonius}
\TOline{orthogonal from} {circum}{[orthogonal from = A ](O,M)}
\TOline{orthogonal through}{circum}{[orthogonal through = A and B](O,M)} 
\TOline{K} {1}{coefficient used for a circle of Apollonius} 
 \bottomrule
\end{tabular}

\medskip
\emph{In the following examples, I draw the circles with a macro not yet presented. You may only need the center and a point on the circle. }
\end{NewMacroBox} 

\subsubsection{Example with  option \tkzname{R}}  
We obtain with the macro \tkzcname{tkzGetPoint} a point of the circle which is the East pole.

\begin{tkzexample}[latex=7cm,small]  
\begin{tikzpicture}[scale=1]
  \tkzDefPoint(3,3){C}
  \tkzDefPoint(5,5){A}
   \tkzCalcLength(A,C) \tkzGetLength{rAC}
  \tkzDefCircle[R](C,\rAC) \tkzGetPoint{B}
  \tkzDrawCircle(C,B)
  \tkzDrawSegment(C,A)
  \tkzLabelSegment[above left](C,A){$2\sqrt{2}$}
  \tkzDrawPoints(A,B,C)
  \tkzLabelPoints(A,C,B)
\end{tikzpicture} 
\end{tkzexample}     


 \subsubsection{Example  with  option \tkzname{diameter}}  
 It is simpler here to search directly for the middle of $[AB]$. The result is the center and if necessary 
\begin{tkzexample}[latex=7cm,small]  
\begin{tikzpicture}
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(2,2){B}
  \tkzDefCircle[diameter](O,B) \tkzGetPoint{A}
  \tkzDrawCircle(A,B)
  \tkzDrawPoints(O,A,B)
  \tkzDrawSegment(O,B)
  \tkzLabelPoints(O,A,B)
  \tkzLabelSegment[above left](O,A){$\sqrt{2}$}
  \tkzLabelSegment[above left](A,B){$\sqrt{2}$}
  \tkzMarkSegments[mark=s||](O,A A,B)
\end{tikzpicture}
\end{tkzexample}    

\subsubsection{Circles inscribed and circumscribed for a given triangle} 
 
\begin{tkzexample}[latex=7cm,small]  
\begin{tikzpicture}[scale=.75]
 \tkzDefPoint(2,2){A}  \tkzDefPoint(5,-2){B}
 \tkzDefPoint(1,-2){C}
 \tkzDefCircle[in](A,B,C)
 \tkzGetPoints{I}{x}   
 \tkzDefCircle[circum](A,B,C)
 \tkzGetPoint{K}  
 \tkzDrawCircles[new](I,x K,A) 
 \tkzLabelPoints[below](B,C)
 \tkzLabelPoints[above left](A,I,K)
 \tkzDrawPolygon(A,B,C)
 \tkzDrawPoints(A,B,C,I,K) 
\end{tikzpicture} 
\end{tkzexample}

\subsubsection{Example with option \tkzname{ex}}
We want to define an excircle of a  triangle relatively to point $C$

\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}[scale=.75]
  \tkzDefPoints{ 0/0/A,4/0/B,0.8/4/C}
  \tkzDefCircle[ex](B,C,A)                   
  \tkzGetPoints{J_c}{h}
  \tkzDefPointBy[projection=onto A--C ](J_c)   
  \tkzGetPoint{X_c}
  \tkzDefPointBy[projection=onto A--B ](J_c)   
  \tkzGetPoint{Y_c}     
  \tkzDefCircle[in](A,B,C)    
  \tkzGetPoints{I}{y}
  \tkzDrawCircles[color=lightgray](J_c,h I,y)
  \tkzDefPointBy[projection=onto A--C ](I)
  \tkzGetPoint{F}
  \tkzDefPointBy[projection=onto A--B ](I)
  \tkzGetPoint{D}
  \tkzDrawPolygon(A,B,C)
  \tkzDrawLines[add=0 and 1.5](C,A C,B)
  \tkzDrawSegments(J_c,X_c I,D  I,F J_c,Y_c)
  \tkzMarkRightAngles(A,F,I B,D,I J_c,X_c,A J_c,Y_c,B)
  \tkzDrawPoints(B,C,A,I,D,F,X_c,J_c,Y_c)
  \tkzLabelPoints(B,A,J_c,I,D)
  \tkzLabelPoints[above](Y_c)
  \tkzLabelPoints[left](X_c)
  \tkzLabelPoints[above left](C)
  \tkzLabelPoints[left](F)
\end{tikzpicture}  
\end{tkzexample}

\subsubsection{Euler's circle for a given triangle with option \tkzname{euler}}
 
We verify that this circle passes through the middle of each side.
\begin{tkzexample}[latex=6cm,small]  
\begin{tikzpicture}[scale=.75]
   \tkzDefPoint(5,3.5){A} 
   \tkzDefPoint(0,0){B} \tkzDefPoint(7,0){C}
   \tkzDefCircle[euler](A,B,C)
   \tkzGetPoints{E}{e}
   \tkzDefSpcTriangle[medial](A,B,C){M_a,M_b,M_c}
   \tkzDrawCircle[new](E,e)
   \tkzDrawPoints(A,B,C,E,M_a,M_b,M_c)    
   \tkzDrawPolygon(A,B,C)    
   \tkzLabelPoints[below](B,C)  
   \tkzLabelPoints[left](A,E)   
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Apollonius circles for a given segment option \tkzname{apollonius}} 
 
\begin{tkzexample}[latex=9cm,small]    
\begin{tikzpicture}[scale=0.75]
  \tkzDefPoint(0,0){A} 
  \tkzDefPoint(4,0){B}
  \tkzDefCircle[apollonius,K=2](A,B)
  \tkzGetPoints{K1}{x}
  \tkzDrawCircle[color = teal!50!black,
      fill=teal!20,opacity=.4](K1,x)
  \tkzDefCircle[apollonius,K=3](A,B)
  \tkzGetPoints{K2}{y}
  \tkzDrawCircle[color=orange!50,
      fill=orange!20,opacity=.4](K2,y) 
  \tkzLabelPoints[below](A,B,K1,K2)
  \tkzDrawPoints(A,B,K1,K2) 
  \tkzDrawLine[add=.2 and 1](A,B)  
\end{tikzpicture}
\end{tkzexample}  

 \subsubsection{Circles exinscribed to a given triangle option \tkzname{ex}}
 You can also get the center and the projection of it on one side of the triangle. 
 
 with \tkzcname{tkzGetFirstPoint\{Jb\}} and \tkzcname{tkzGetSecondPoint\{Tb\}}.
 
\begin{tkzexample}[latex=8cm,small]  
\begin{tikzpicture}[scale=.6]
  \tkzDefPoint(0,0){A}
  \tkzDefPoint(3,0){B}
  \tkzDefPoint(1,2.5){C}
  \tkzDefCircle[ex](A,B,C) \tkzGetPoints{I}{i}
  \tkzDefCircle[ex](C,A,B) \tkzGetPoints{J}{j}
  \tkzDefCircle[ex](B,C,A) \tkzGetPoints{K}{k}
  \tkzDefCircle[in](B,C,A) \tkzGetPoints{O}{o}
  \tkzDrawCircles[new](J,j I,i K,k O,o) 
  \tkzDrawLines[add=1.5 and 1.5](A,B A,C B,C)
  \tkzDrawPolygon[purple](I,J,K)
  \tkzDrawSegments[new](A,K B,J C,I)
  \tkzDrawPoints(A,B,C)
  \tkzDrawPoints[new](I,J,K)   
  \tkzLabelPoints(A,B,C,I,J,K)
\end{tikzpicture}
\end{tkzexample}
 
\subsubsection{Spieker circle with option \tkzname{spieker}}   
The incircle of the medial triangle $M_aM_bM_c$ is the Spieker circle:

\begin{tkzexample}[latex=6cm, small]
\begin{tikzpicture}[scale=1]
  \tkzDefPoints{ 0/0/A,4/0/B,0.8/4/C}
   \tkzDefSpcTriangle[medial](A,B,C){M_a,M_b,M_c}
   \tkzDefTriangleCenter[spieker](A,B,C) 
   \tkzGetPoint{S_p}
   \tkzDrawPolygon(A,B,C)
   \tkzDrawPolygon[cyan](M_a,M_b,M_c)
   \tkzDrawPoints(B,C,A)
   \tkzDefCircle[spieker](A,B,C)
   \tkzDrawPoints[new](M_a,M_b,M_c,S_p)
   \tkzDrawCircle[new](tkzFirstPointResult,tkzSecondPointResult)
   \tkzLabelPoints[right](M_a)
   \tkzLabelPoints[left](M_b)
   \tkzLabelPoints[below](A,B,M_c,S_p)
   \tkzLabelPoints[above](C)
\end{tikzpicture}
\end{tkzexample}
 
\subsection{Projection of excenters}

\begin{NewMacroBox}{tkzDefProjExcenter}{\oarg{local options}\parg{A,B,C}\parg{a,b,c}\marg{X,Y,Z}}%
Each excenter has three projections on the sides of the triangle ABC. We can do this with one macro\\ \tkzcname{tkzDefProjExcenter[name=J](A,B,C)(a,b,c)\{Y,Z,X\}}.

\medskip
\begin{tabular}{lll}%
\toprule
options             & default & definition                        \\
\midrule
\TOline{name} {no defaut}{used to name the vertices}
\bottomrule
\end{tabular}

\begin{tabular}{lll}%
arguments & default & definition \\
\midrule
\TAline{(pt1=$\alpha_1$,pt2=$\alpha_2$,\dots)}{no default}{Each point has a assigned weight}
\end{tabular}

\medskip
\end{NewMacroBox}

\subsubsection{\tkzname{Excircles}}

\begin{tkzexample}[vbox,small]
\begin{tikzpicture}[scale=.6]
\tikzset{line style/.append style={line width=.2pt}}
\tikzset{label style/.append style={color=teal,font=\footnotesize}}
\tkzDefPoints{0/0/A,5/0/B,0.8/4/C}
\tkzDefSpcTriangle[excentral,name=J](A,B,C){a,b,c} 
\tkzDefSpcTriangle[intouch,name=I](A,B,C){a,b,c}
\tkzDefProjExcenter[name=J](A,B,C)(a,b,c){X,Y,Z}
\tkzDefCircle[in](A,B,C)   \tkzGetPoint{I} \tkzGetSecondPoint{T}  
\tkzDrawCircles[red](Ja,Xa Jb,Yb Jc,Zc)
\tkzDrawCircle(I,T) 
\tkzDrawPolygon[dashed,color=blue](Ja,Jb,Jc)
\tkzDrawLines[add=1.5 and 1.5](A,C A,B B,C)
\tkzDrawSegments(Ja,Xa Ja,Ya Ja,Za
                 Jb,Xb Jb,Yb Jb,Zb
                 Jc,Xc Jc,Yc Jc,Zc
                 I,Ia I,Ib I,Ic)
\tkzMarkRightAngles[size=.2,fill=gray!15](Ja,Za,B Ja,Xa,B Ja,Ya,C Jb,Yb,C)
\tkzMarkRightAngles[size=.2,fill=gray!15](Jb,Zb,B Jb,Xb,C Jc,Yc,A Jc,Zc,B Jc,Xc,C I,Ia,B I,Ib,C I,Ic,A)
\tkzDrawSegments[blue](Jc,C Ja,A Jb,B)
\tkzDrawPoints(A,B,C,Xa,Xb,Xc,Ja,Jb,Jc,Ia,Ib,Ic,Ya,Yb,Yc,Za,Zb,Zc)
\tkzLabelPoints(A,Ya,Yb,Ja,I)
\tkzLabelPoints[left](Jb,Ib,Yc)
\tkzLabelPoints[below](Zb,Ic,Jc,B,Za,Xa)
\tkzLabelPoints[above right](C,Zc,Yb)
\tkzLabelPoints[right](Xb,Ia,Xc)
\end{tikzpicture}
\end{tkzexample}
 
\subsubsection{\tkzname{Orthogonal from}}
Orthogonal circle of given center. \tkzcname{tkzGetPoints\{z1\}\{z2\}} gives two points of the circle.

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.75]
  \tkzDefPoints{0/0/O,1/0/A}
  \tkzDefPoints{1.5/1.25/B,-2/-3/C}
  \tkzDefCircle[orthogonal from=B](O,A)
  \tkzGetPoints{z1}{z2}
  \tkzDefCircle[orthogonal from=C](O,A)
  \tkzGetPoints{t1}{t2}
  \tkzDrawCircle(O,A)
  \tkzDrawCircles[new](B,z1 C,t1)
  \tkzDrawPoints(t1,t2,C)
  \tkzDrawPoints(z1,z2,O,A,B)
  \tkzLabelPoints[right](O,A,B,C)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{\tkzname{Orthogonal through}}
Orthogonal circle passing through two given points.
\begin{tkzexample}[latex=6cm,small]
\begin{tikzpicture}[scale=1]
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(1,0){A}
  \tkzDrawCircle(O,A)
  \tkzDefPoint(-1.5,-1.5){z1}
  \tkzDefPoint(1.5,-1.25){z2}
  \tkzDefCircle[orthogonal through=z1 and z2](O,A)
   \tkzGetPoint{c}
  \tkzDrawCircle[new](tkzPointResult,z1)
  \tkzDrawPoints[new](O,A,z1,z2,c)
  \tkzLabelPoints[right](O,A,z1,z2,c)
\end{tikzpicture}
\end{tkzexample}

\endinput