%!TEX root = /Users/ego/Boulot/TKZ/tkz-euclide/doc_fr/TKZdoc-euclide-main.tex

\section{Gallery  : Some examples}

Some examples with explanations in english.
%–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>

\subsection{White on Black}
This example shows how to get a segment with a length equal at $\sqrt{a}$ from a segment of length $a$, only with a rule and a compass.


\begin{center}
\begin{tkzexample}[]
  \tikzset{background rectangle/.style={fill=black}} 
\begin{tikzpicture}[show background rectangle]
   \tkzInit[ymin=-1.5,ymax=7,xmin=-1,xmax=+11]
   \tkzClip 
   \tkzDefPoint(0,0){O}
   \tkzDefPoint(1,0){I}
   \tkzDefPoint(10,0){A}
   \tkzDefPointWith[orthogonal](I,A) \tkzGetPoint{H}
   \tkzDefMidPoint(O,A) \tkzGetPoint{M}
   \tkzInterLC(I,H)(M,A)\tkzGetPoints{C}{B}
   \tkzDrawSegments[color=white,line width=1pt](I,H O,A)
   \tkzDrawPoints[color=white](O,I,A,B,M) 
   \tkzMarkRightAngle[color=white,line width=1pt](A,I,B) 
   \tkzDrawArc[color=white,line width=1pt,style=dashed](M,A)(O) 
  \tkzLabelSegment[white,right=1ex,pos=.5](I,B){$\sqrt{a}$} 
  \tkzLabelSegment[white,below=1ex,pos=.5](O,I){$1$}   
  \tkzLabelSegment[pos=.6,white,below=1ex](I,A){$a$} 
\end{tikzpicture}
\end{tkzexample}
\end{center}

\vfill\newpage
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>

\subsection{ Square root of the integers }       
How to get $1$, $\sqrt{2}$, $\sqrt{3}$ with a rule and a compass.
\begin{center}
\begin{tkzexample}[]
\begin{tikzpicture}[scale=1.75]
   \tkzInit[xmin=-3,xmax=4,ymin=-2,ymax=4]
   \tkzGrid
   \tkzDefPoint(0,0){O}
   \tkzDefPoint(1,0){a0}
   \newcounter{tkzcounter}
   \setcounter{tkzcounter}{0}
   \newcounter{density}
   \setcounter{density}{20}
   \foreach \i in {0,...,15}{%
      \pgfmathsetcounter{density}{\thedensity+2}
      \setcounter{density}{\thedensity}    
      \stepcounter{tkzcounter}
      \tkzDefPointWith[orthogonal normed](a\i,O)
      \tkzGetPoint{a\thetkzcounter}
      \tkzDrawPolySeg[color=Maroon!\thedensity,%
         fill=Maroon!\thedensity,opacity=.5](a\i,a\thetkzcounter,O)}
 \end{tikzpicture}  
\end{tkzexample}
\end{center}

%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
 \vfill\newpage
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
% 
\subsection{How to construct the tangent lines from a point to a circle with a rule and a compass.}
\begin{center}
\begin{tkzexample}[] 
  \begin{tikzpicture}
    \tkzPoint(0,0){O}
    \tkzPoint(9,2){P}
    \tkzDefMidPoint(O,P) \tkzGetPoint{I}
    \tkzDrawCircle[R](O,4cm)
    \tkzDrawCircle[diameter](O,P)
    \tkzCalcLength(I,P)  \tkzGetLength{dIP}
    \tkzInterCC[R](O,4cm)(I,\dIP pt)\tkzGetPoints{Q1}{Q2}
    \tkzDrawPoint[color=red](Q1)
    \tkzDrawPoint[color=red](Q2)
    \tkzDrawLine(P,Q1) 
    \tkzDrawLine(P,Q2) 
    \tkzDrawSegments(O,Q1 O,Q2)
    \tkzDrawLine(P,O)
\end{tikzpicture}
\end{tkzexample}
\end{center} 
% 
% %<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
 \vfill\newpage
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>

\subsection{Circle and tangent}
We have a point A $(8,2)$, a circle with center A and radius=3cm and a line
  $\delta$ $y=4$. The line intercepts the circle at B. We want to draw the tangent at the circle in B.
   
\begin{center}
\begin{tkzexample}[]
\begin{tikzpicture}
  \tkzInit[xmax=14,ymin=-2,ymax=6]
  \tkzDrawX[noticks,label=$(d)$]
  \tkzPoint[pos=above right](8,2){A};
  \tkzPoint[color=red,pos=above right](0,0){O};
  \tkzDrawCircle[R,color=blue,line width=.8pt](A,3 cm)
  \tkzHLine[color=red,style=dashed]{4} 
  \tkzText[above](12,4){$\delta$}
  \FPeval\alphaR{arcsin(2/3)}% on a les bonnes valeurs
  \FPeval\xB{8-3*cos(\alphaR)}
  \tkzPoint[pos=above left](\xB,4){B};
  \tkzDrawSegment[line width=1pt](A,B)
  \tkzDefLine[orthogonal=through B](A,B) \tkzGetPoint{b}
  \tkzDefPoint(1,0){i}
  \tkzInterLL(B,b)(O,i) \tkzGetPoint{B'}
  \tkzDrawPoint(B')
  \tkzDrawLine(B,B')
 \end{tikzpicture}
\end{tkzexample}
\end{center}

 \vfill\newpage
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>

\subsection{About right triangle}

We have a segment $[AB]$ and we want to determine a point $C$ such as $AC=8 cm$ and $ABC$ is a right triangle in $B$.

\begin{center}
\begin{tkzexample}[]
\begin{tikzpicture}
  \tkzInit
  \tkzClip
  \tkzPoint[pos=left](2,1){A}
  \tkzPoint(6,4){B} 
  \tkzDrawSegment(A,B)
  \tkzDrawPoint[color=red](A)
  \tkzDrawPoint[color=red](B)
  \tkzDefPointWith[orthogonal,K=-1](B,A)    
  \tkzDrawLine[add = .5 and .5](B,tkzPointResult)
  \tkzInterLC[R](B,tkzPointResult)(A,8 cm) \tkzGetPoints{C}{J}
  \tkzDrawPoint[color=red](C)
  \tkzCompass(A,C)
  \tkzMarkRightAngle(A,B,C)
  \tkzDrawLine[color=gray,style=dashed](A,C)
\end{tikzpicture} 
\end{tkzexample}
\end{center}

 %<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
 \vfill\newpage %<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>

\subsection{Archimedes}

This is an ancient problem  proved by the great Greek mathematician Archimedes .
The figure below shows a semicircle, with diameter $AB$. A tangent line is drawn and  touches the semicircle at $B$.  An other tangent line at a point, $C$, on the semicircle is drawn. We project the point $C$ on the segment$[AB]$  on a point $D$ . The two tangent lines intersect at the point $T$.

Prove that the line $(AT)$ bisects $(CD)$

\begin{center}
\begin{tkzexample}[]  
\begin{tikzpicture}[scale=1.25] 
   \tkzInit[ymin=-1,ymax=7]
   \tkzClip
   \tkzDefPoint(0,0){A}\tkzDefPoint(6,0){D} 
   \tkzDefPoint(8,0){B}\tkzDefPoint(4,0){I}
   \tkzDefLine[orthogonal=through D](A,D)
   \tkzInterLC[R](D,tkzPointResult)(I,4 cm) \tkzGetFirstPoint{C}
   \tkzDefLine[orthogonal=through C](I,C)   \tkzGetPoint{c}
   \tkzDefLine[orthogonal=through B](A,B)   \tkzGetPoint{b}
   \tkzInterLL(C,c)(B,b) \tkzGetPoint{T} 
   \tkzInterLL(A,T)(C,D) \tkzGetPoint{P}
   \tkzDrawArc(I,B)(A) 
   \tkzDrawSegments(A,B A,T C,D I,C) \tkzDrawSegment[color=orange](I,C)
   \tkzDrawLine[add = 1 and 0](C,T)  \tkzDrawLine[add = 0 and 1](B,T)
   \tkzMarkRightAngle(I,C,T)
   \tkzDrawPoints(A,B,I,D,C,T)  
   \tkzLabelPoints(A,B,I,D)  \tkzLabelPoints[above right](C,T)
   \tkzMarkSegment[pos=.25,mark=s|](C,D) \tkzMarkSegment[pos=.75,mark=s|](C,D)
\end{tikzpicture}  
\end{tkzexample}
\end{center}  

\subsection{Example from Dimitris Kapeta}

You need in this example to use \tkzname{mkpos=.2} with \tkzcname{tkzMarkAngle} because the measure of $ \widehat{CAM}$ is too small.
Another possiblity is to use \tkzcname{tkzFillAngle}.

\begin{center}
\begin{tkzexample}[]
\begin{tikzpicture}[scale=1.25]
  \tkzInit[xmin=-5.2,xmax=3.2,ymin=-3.2,ymax=3.3]
  \tkzClip 
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(2.5,0){N}
  \tkzDefPoint(-4.2,0.5){M}
  \tkzDefPointBy[rotation=center O angle 30](N)
  \tkzGetPoint{B}
  \tkzDefPointBy[rotation=center O angle -50](N)
  \tkzGetPoint{A}
  \tkzInterLC(M,B)(O,N) \tkzGetFirstPoint{C}
  \tkzInterLC(M,A)(O,N) \tkzGetSecondPoint{A'} 
  \tkzMarkAngle[fill=blue!25,mkpos=.2, size=0.5](A,C,B) 
  \tkzMarkAngle[fill=green!25,mkpos=.2, size=0.5](A,M,C)
  \tkzDrawSegments(A,C M,A M,B)
  \tkzDrawCircle(O,N)
  \tkzLabelCircle[above left](O,N)(120){$\mathcal{C}$}
  \tkzMarkAngle[fill=red!25,mkpos=.2, size=0.5cm](C,A,M)
  \tkzDrawPoints(O, A, B, M, B, C)
  \tkzLabelPoints[right](O,A,B)
  \tkzLabelPoints[above left](M,C)
  \tkzLabelPoint[below left](A'){$A'$}
\end{tikzpicture}
\end{tkzexample}
\end{center}

\newpage
\subsection{Example 1 from John Kitzmiller }
This figure is the last of beamer document. You can find the document on  my site 

Prove $\bigtriangleup LKJ$ is equilateral
  
\begin{center}
\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=1.5]
  \tkzDefPoint[label=below left:A](0,0){A}
  \tkzDefPoint[label=below right:B](6,0){B}
  \tkzDefTriangle[equilateral](A,B) \tkzGetPoint{C}
  \tkzMarkSegments[mark=|](A,B A,C B,C)
  \tkzDefBarycentricPoint(A=1,B=2) \tkzGetPoint{C'}
  \tkzDefBarycentricPoint(A=2,C=1) \tkzGetPoint{B'}
  \tkzDefBarycentricPoint(C=2,B=1) \tkzGetPoint{A'}
  \tkzInterLL(A,A')(C,C') \tkzGetPoint{J}
  \tkzInterLL(C,C')(B,B') \tkzGetPoint{K}
  \tkzInterLL(B,B')(A,A') \tkzGetPoint{L}
  \tkzLabelPoint[above](C){C}
  \tkzDrawPolygon(A,B,C) \tkzDrawSegments(A,J B,L C,K)
  \tkzMarkAngles[fill= orange,size=1cm,opacity=.3](J,A,C K,C,B L,B,A)
  \tkzLabelPoint[right](J){J}
  \tkzLabelPoint[below](K){K}
  \tkzLabelPoint[above left](L){L}
  \tkzMarkAngles[fill=orange, opacity=.3,thick,size=1,](A,C,J C,B,K B,A,L)
  \tkzMarkAngles[fill=green, size=1, opacity=.5](A,C,J C,B,K B,A,L)
  \tkzFillPolygon[color=yellow, opacity=.2](J,A,C)
  \tkzFillPolygon[color=yellow, opacity=.2](K,B,C)
  \tkzFillPolygon[color=yellow, opacity=.2](L,A,B)
  \tkzDrawSegments[line width=3pt,color=cyan,opacity=0.4](A,J C,K B,L)
  \tkzDrawSegments[line width=3pt,color=red,opacity=0.4](A,L B,K C,J)
  \tkzMarkSegments[mark=o](J,K K,L L,J)
\end{tikzpicture}  
\end{tkzexample}  

\end{center} 

\newpage
\subsection{Example 2 from John Kitzmiller }    
Prove $\dfrac{AC}{CE}=\dfrac{BD}{DF} \qquad$

Another interesting example from John, you can see how to use some extra options like \tkzname{decoration} and \tkzname{postaction}  from \TIKZ\ with \tkzname{tkz-euclide}.

\begin{center}
\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=1.5,decoration={markings,
  mark=at position 3cm with {\arrow[scale=2]{>}};}]
  \tkzInit[xmin=-0.25,xmax=6.25, ymin=-0.5,ymax=4]
  \tkzClip
  \tkzDefPoints{0/0/E, 6/0/F, 0/1.8/P, 6/1.8/Q, 0/3/R, 6/3/S}
  \tkzDrawLines[postaction={decorate}](E,F P,Q R,S)
  \tkzDefPoints{3.5/3/A, 5/3/B}
  \tkzDrawSegments(E,A F,B)
  \tkzInterLL(E,A)(P,Q) \tkzGetPoint{C}
  \tkzInterLL(B,F)(P,Q) \tkzGetPoint{D}
  \tkzLabelPoints[above right](A,B)
  \tkzLabelPoints[below](E,F)
  \tkzLabelPoints[above left](C)
  \tkzDrawSegments[style=dashed](A,F)
  \tkzInterLL(A,F)(P,Q) \tkzGetPoint{G}
  \tkzLabelPoints[above right](D,G) 
  \tkzDrawSegments[color=teal, line width=3pt, opacity=0.4](A,C A,G)
  \tkzDrawSegments[color=magenta, line width=3pt, opacity=0.4](C,E G,F)
  \tkzDrawSegments[color=teal, line width=3pt, opacity=0.4](B,D)
  \tkzDrawSegments[color=magenta, line width=3pt, opacity=0.4](D,F)
\end{tikzpicture} 
\end{tkzexample}
\end{center}

\newpage
\subsection{Example 3 from John Kitzmiller }    
Prove $\dfrac{BC}{CD}=\dfrac{AB}{AD} \qquad$ (Angle Bisector)


\begin{center}
\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=1.5] 
  \tkzInit[xmin=-4,xmax=5,ymax=4.5]   \tkzClip[space=.5]
  \tkzDefPoints{0/0/B, 5/0/D}         \tkzDefPoint(70:3){A}
  \tkzDrawPolygon(B,D,A)
  \tkzDefLine[bisector](B,A,D)         \tkzGetPoint{a}
  \tkzInterLL(A,a)(B,D)                \tkzGetPoint{C}
  \tkzDefLine[parallel=through B](A,C) \tkzGetPoint{b}
  \tkzInterLL(A,D)(B,b)                \tkzGetPoint{P}
  \begin{scope}[decoration={markings,
    mark=at position .5 with {\arrow[scale=2]{>}};}]
    \tkzDrawSegments[postaction={decorate},dashed](C,A P,B) 
  \end{scope}
  \tkzDrawSegment(A,C) \tkzDrawSegment[style=dashed](A,P)  
  \tkzLabelPoints[below](B,C,D) \tkzLabelPoints[above](A,P)
  \tkzDrawSegments[color=magenta, line width=3pt, opacity=0.4](B,C P,A)
  \tkzDrawSegments[color=teal,     line width=3pt, opacity=0.4](C,D A,D)
  \tkzDrawSegments[color=magenta, line width=3pt, opacity=0.4](A,B)
  \tkzMarkAngles[size=0.7](B,A,C C,A,D)
  \tkzMarkAngles[size=0.7, fill=green,  opacity=0.5](B,A,C A,B,P)
  \tkzMarkAngles[size=0.7, fill=yellow, opacity=0.3](B,P,A C,A,D)
  \tkzMarkAngles[size=0.7, fill=green,  opacity=0.6](B,A,C A,B,P B,P,A C,A,D)
  \tkzLabelAngle[pos=1](B,A,C){1}     \tkzLabelAngle[pos=1](C,A,D){2}
  \tkzLabelAngle[pos=1](A,B,P){3})    \tkzLabelAngle[pos=1](B,P,A){4}
  \tkzMarkSegments[mark=|](A,B A,P) 
\end{tikzpicture}   
\end{tkzexample}
\end{center} 

\newpage
\subsection{Example 4 from John Kitzmiller }    
Prove $\overline{AG}\cong\overline{EF} \qquad$ (Detour)

\begin{center}
\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=2]
  \tkzInit[xmax=5, ymax=5]
  \tkzDefPoint(0,3){A}    \tkzDefPoint(6,3){E}  \tkzDefPoint(1.35,3){B}
  \tkzDefPoint(4.65,3){D} \tkzDefPoint(1,1){G}  \tkzDefPoint(5,5){F} 
  \tkzDefMidPoint(A,E)    \tkzGetPoint{C}       
  \tkzFillPolygon[yellow, opacity=0.4](B,G,C)
  \tkzFillPolygon[yellow, opacity=0.4](D,F,C)
  \tkzFillPolygon[blue, opacity=0.3](A,B,G)
  \tkzFillPolygon[blue, opacity=0.3](E,D,F)
  \tkzMarkAngles[size=0.6,fill=green](B,G,A D,F,E)
  \tkzMarkAngles[size=0.6,fill=orange](B,C,G D,C,F)
  \tkzMarkAngles[size=0.6,fill=yellow](G,B,C F,D,C)
  \tkzMarkAngles[size=0.6,fill=red](A,B,G E,D,F)
  \tkzMarkSegments[mark=|](B,C D,C)  \tkzMarkSegments[mark=s||](G,C F,C)
  \tkzMarkSegments[mark=o](A,G E,F)  \tkzMarkSegments[mark=s](B,G D,F)
  \tkzDrawSegment[color=red](A,E)
  \tkzDrawSegment[color=blue](F,G)
  \tkzDrawSegments(A,G G,B E,F F,D) 
  \tkzLabelPoints[below](C,D,E,G)    \tkzLabelPoints[above](A,B,F)  
\end{tikzpicture}
\end{tkzexample}
\end{center}   
\endinput