\newpage
\section{Class \Iclass{line}} % (fold)
\label{sec:class_line}

\subsection{Attributes of a line} % (fold)
\label{sub:attributes_of_a_line}

Writing |L.AB = line: new (z.A,z.B)| creates an object of the class \tkzname{line} (the notation is arbitrary for the moment). Geometrically, it represents both the line passing through the points $A$ and $B$ as the segment $[AB]$. Thus, we can use the midpoint of |L.AB|, which is, of course, the midpoint of the segment $[AB]$. This medium is obtained with |L.AB.mid|. Note that |L.AB.pa = z.A| and |L.AB.pb = z.B|. Finally, if a line $L$ is the result of a method, you can obtain the points with |z.A,z.B = get_points (L)| or with the previous remark.

\begin{mybox}
   Creation \\
   |L.AB = line : new ( z.A , z.B ) |
\end{mybox}


The attributes are :

\vspace{1em}
\bgroup
\catcode`_=12
\small
\captionof{table}{Line attributes.}\label{line:att}
\begin{tabular}{lll}
\toprule
\textbf{Attributes} & \textbf{Application} & \\
\Iattr{line}{pa}  & First point of the segment & |z.A = L.AB.pa| \\
\Iattr{line}{pb}  & Second point of the segment & \\
\Iattr{line}{type} & Type is 'line'    &  |L.AB.type = 'line'| \\  
\Iattr{line}{mid} & Middle of the segment& |z.M = L.AB.mid|\\
\Iattr{line}{slope} & Slope of the line & [\ref{ssub:example_class_line}] \\
\Iattr{line}{length} &|l = L.AB.length|& [\ref{sub:transfer_from_lua_to_tex} ; \ref{ssub:example_class_line}] \\  
\Iattr{line}{north\_pa}   & & [\ref{ssub:example_class_line}]  \\
\Iattr{line}{north\_pb}   & & \\
\Iattr{line}{south\_pa}   & & \\
\Iattr{line}{south\_pb}   & & \\
\Iattr{line}{east}        & & \\
\Iattr{line}{west}        & & \\
\Iattr{line}{vec}   & |V.AB = L.AB.vec|& defines $\overrightarrow{AB}$  [\ref{sec:class_vector}] \\
\bottomrule
\end{tabular}
\egroup

\subsubsection{Example: attributes of class line} % (fold)
\label{ssub:example_class_line}

\vspace{5pt}
\directlua{%
init_elements ()
z.a = point: new (1, 1)
z.b = point: new (5, 4)
L.ab = line : new (z.a,z.b)
z.m = L.ab.mid
z.w = L.ab.west
z.e = L.ab.east
z.r = L.ab.north_pa
z.s = L.ab.south_pb
sl  = L.ab.slope
len = L.ab.length
}

\begin{center}
  \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawPoints(a,b,m,e,r,s,w)
     \tkzLabelPoints(a,b)
     \tkzLabelPoint(r){north\_pa}
     \tkzLabelPoint(s){south\_pb}
     \tkzLabelPoint[below](m){mid}
     \tkzLabelPoint[right](w){west}
     \tkzLabelPoint[left](e){east}
     \tkzDrawLine(a,b)
     \tkzLabelSegment[above = 1em,sloped](a,b){ab = \pmpn{\tkzUseLua{len}}}
     \tkzLabelSegment[above=2em,sloped](a,b){slope of (ab) =  \pmpn{\tkzUseLua{sl}}}
  \end{tikzpicture}
\end{center}


\begin{Verbatim}
\directlua{%
init_elements ()
   z.a   = point: new (1, 1)
   z.b   = point: new (5, 4)
   L.ab  = line : new (z.a,z.b)
   z.m   = L.ab.mid
   z.w   = L.ab.west
   z.e   = L.ab.east
   z.r   = L.ab.north_pa
   z.s   = L.ab.south_pb
   sl    = L.ab.slope
   len   = L.ab.length
}

\begin{tikzpicture}[scale = .75 ]
   \tkzGetNodes
   \tkzDrawPoints(a,b,m,e,r,s,w)
   \tkzLabelPoints(a,b,e,r,s,w)
   \tkzLabelPoints[above](m)
   \tkzDrawLine(a,b)
   \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{len}}
   \tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \tkzUseLua{sl}}
\end{tikzpicture}
\end{Verbatim}


% subsubsection example_class_line (end)

\subsubsection{Method \Imeth{line}{new} and line attributes}
\label{ssub:example_line_attributes}

The notation can be |L| or |L.AB| or |L.euler|. The notation is actually free.
|L.AB| can also represent the segment. 

With | L.AB  = line : new (z.A,z.B)|, a line is defined.


\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A   = point : new (1,1)
   z.B   = point : new (3,2)
   L.AB  = line : new (z.A,z.B)
   z.C   = L.AB.north_pa
   z.D   = L.AB.south_pa
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines(A,B C,D)
   \tkzDrawPoints(A,...,D)
   \tkzLabelPoints(A,...,D)
   \tkzMarkRightAngle(B,A,C)
   \tkzMarkSegments(A,C A,B A,D)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{%
init_elements ()
   z.A   = point : new (1,1)
   z.B   = point : new (3,2)
   L.AB  = line : new (z.A,z.B)
   z.C   = L.AB.north_pa
   z.D   = L.AB.south_pa
}
\begin{center}
  \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawLines(A,B C,D)
     \tkzDrawPoints(A,...,D)
     \tkzLabelPoints(A,...,D)
     \tkzMarkRightAngle(B,A,C)
     \tkzMarkSegments(A,C A,B A,D)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection example_line_attributes (end)
% subsection attributes_of_a_line (end)

\newpage
\subsection{Methods of the class line} % (fold)
\label{sub:methods_from_class_line}
Here's the list of methods for the \tkzNameObj{line} object. The results can be real numbers, points, lines, circles or triangles. The triangles obtained are similar to the triangles defined below.

\begin{minipage}{\textwidth}
\bgroup
\catcode`_=12
\small
\captionof{table}{Methods of the class line.(part 1)}\label{line:methods1}
\begin{tabular}{lll}
\toprule

\textbf{Methods} & \textbf{Comments} & \\
\midrule 
\Igfct{line}{new(pt, pt)}      & |L.AB = line : new(z.A,z.B)| & Create line $(AB)$ ;  [\ref{sub:altshiller}] \\
\midrule 

\textbf{Real} &&\\
\midrule 
\Imeth{line}{distance (pt)}   & |d = L.AB : distance (z.C)|  &   [\ref{ssub:method_imeth_line_distance}; \ref{ssub:example_distance_and_projection}] \\
\Imeth{line}{slope ()} &   |a = L.AB : slope()| & better is L.AB.slope; [\ref{ssub:example_class_line}]\\ 


\textbf{Boolean} &&\\
\midrule 
\Imeth{line}{in\_out (pt)}  & |b = L.AB: in_out(z.C)|  & b=true if $C\in (AB)$ ;  [\ref{ssub:method_imeth};\ref{ssub:in_out_for_a_line}] \\
\Imeth{line}{in\_out\_segment(pt)} &   |b = L.AB:in_out_segment(z.C)| & b=true if $C\in [AB$] [\ref{ssub:method_imeth_line_in__in__out__segment}] \\ 
\Imeth{line}{is\_parallel(L)}  & &  \\
\Imeth{line}{is\_orthogonal(L)}  & &  \\
\Imeth{line}{is\_equidistant(pt)}  & &  \\\midrule 


\textbf{Points} &&\\
\midrule 

\Imeth{line}{gold\_ratio ()}  & |z.C=L.AB : gold_ratio()|   &  [\ref{sub:gold_ratio_with_segment} ; \ref{sub:the_figure_pappus_circle} ; \ref{sub:bankoff_circle} ]  \\

\Imeth{line}{normalize ()}  & |z.C=L.AB : normalize()| & AC =1 and $C\in (AB)$  [ \ref{ssub:normalize}]  \\

\Imeth{line}{normalize\_inv ()}  & |z.C=L.AB : normalize_inv()|   & CB=1 and $C\in (AB)$  \\

\Imeth{line}{barycenter (r,r)}    & |z.C=L.AB : barycenter (1,2)|  &   [\ref{ssub:barycenter_with_a_line}] \\

\Imeth{line}{point (r)} & |z.C=L.AB : point (2)|   & $\overrightarrow{AC} = 2\overrightarrow{AB}$  [\ref{sub:ellipse} ; \ref{ssub:method_point}] \\

\Imeth{line}{midpoint ()}    & |z.M=L.AB : midpoint ()| & better is |z.M = L.AB.mid|  \\

\Imeth{line}{harmonic\_int (pt)}  & |z.D=L.AB : harmonic_int (z.C)| &  [ \ref{sub:bankoff_circle}] \\

\Imeth{line}{harmonic\_ext (pt)}  & |z.D=L.AB : harmonic_ext (z.C)| & [ \ref{sub:bankoff_circle}] \\

\Imeth{line}{harmonic\_both (r)}  & |z.C,z.D=L.AB : harmonic_both|($\varphi$) & [\ref{sub:harmonic_division_with_tkzphi}] \\

\Imeth{line}{\_east(d)}    & |z.M=L.AB : _east(2)| & |BM = 2| $A,B,M$ aligned  \\

\Imeth{line}{\_west(d)}    & |z.M=L.AB : _east(2)| & |BM = 2| $A,B,M$ aligned  \\

\Imeth{line}{\_north\_pa(d)}  &|z.M=L.AB: _north_pa(2)| &|AM=2|; $AM\perp AB$ ;  \\
...&$\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise&  [\ref{ssub:new_line_from_a_defined_line}\\

\Imeth{line}{\_south\_pa(d)}  &|z.M=L.AB: _south_pa(2)| &|AM=2|; $AM\perp AB$ ; $\overrightarrow{AB},\overrightarrow{AM}$ clockwise   \\

\Imeth{line}{\_north\_pb(d)}  &|z.M=L.AB: _north_pb(2)| &|BM=2|; $BM\perp BA$ ; $\overrightarrow{BA},\overrightarrow{BM}$ clockwise   \\

\Imeth{line}{\_south\_pb(d)}  &|z.M=L.AB: _south_pb(2)| &|BM=2|; $BM\perp BA$ ;    \\
...&$\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise &  [\ref{ssub:new_line_from_a_defined_line}\\

\Imeth{line}{report(d,pt)}    &|z.M=L.AB: report(2,z.N)| &|MN=2|; $AB\parallel MN$ ;  [ex. \ref{ssub:method_report}]\\

\Imeth{line}{colinear\_at(pt,k)}    &|z.D=L.AB: colinear_at(z.C,2)| &|CD=2AB|; $AB\parallel CD$ ;  [ex. \ref{ssub:method_imeth_line_colinear__at}]\\
\midrule 

\textbf{Lines} &&\\
\midrule  

\Imeth{line}{ll\_from ( pt )}  &|L.CD=L.AB: ll_from(z.C)| &$(CD) \parallel (AB)$;  [\ref{ssub:new_line_from_a_defined_line}] \\

\Imeth{line}{ortho\_from ( pt )} &|L.CD=L.AB: ortho_from(z.C)|&$(CD) \perp (AB)$;  [\ref{ssub:newline_ortho_from}] \\
 
 \Imeth{line}{mediator ()} & |L.uv=L.AB: mediator()| & perpendicular bisector of $(A,B)$ \footnote{You can use |perpendicular_bisector| intead of \tkzname{mediator}.}; [\ref{ssub:method_imeth_line_mediator}]\\

\Imeth{line}{swap\_line ( )}  &|L.AB=L.AB: swap_line()| & [\ref{ssub:method_imeth_line_swap__line} ; \ref{ssub:intersection_line_parabola_explained}] \\
\bottomrule
\end{tabular}
\egroup
\end{minipage}


\begin{minipage}{\textwidth}
\bgroup
\catcode`_=12
\small
\captionof{table}{Methods of the class line.(part 2)}\label{line:methods2}
\begin{tabular}{lll}
\toprule
\textbf{Methods} & \textbf{Comments} & \\
\midrule 
\textbf{Triangles}&&\\
\midrule  
\Imeth{line}{equilateral (<swap>)}  & |T.ABC=L.AB:equilateral()|   & $(\overrightarrow{AB},\overrightarrow{AC})>0$ or $<0$ with swap \footnote{Triangles are defined in the direct sense of rotation, unless the "swap" option is present.}; [\ref{ssub:object_rotation}]  \\
\Imeth{line}{isosceles (an<,swap>)}&|T.ABC=L.AB:isosceles(math.pi/6)|& [\ref{ssub:method_imeth_line_isosceles}]\\
\Imeth{line}{isosceles\_a (an<,swap>)}& same as |isosceles| & \\
\Imeth{line}{isosceles\_s (an<,swap>)}&|T.ABC=L.AB:isosceles_s(4)| AC=BC& \\
\Imeth{line}{two\_angles (an,an)} &|T.ABC=L.AB:two_angles(an,an)|&note \footnote{The given side is between the two angles} [\ref{ssub:triangle_with_two__angles}] \\
\Imeth{line}{school ()}  & 30°,60°, 90°  & \\
\Imeth{line}{half (<swap>)}  & T.ABC = L.AB:half() $\widehat{B}$ = 90° and 2BC = AB& \\
\Imeth{line}{sss (r,r<,swap>)}  & $AC=r$ $BC=r$ & [\ref{ssub:triangle_with_three_given_sides}] \\
\Imeth{line}{sas (r,an<,swap>)}  & $AC =r$ $\widehat{BAC} = an$ & [\ref{ssub:triangle_with_three_given_sides}]  \\
\Imeth{line}{ssa (r,an<,swap>)}  & $AC =r$ $\widehat{ABC} = an$&  [\ref{ssub:triangle_with_three_given_sides}]\\
\midrule
\textbf{Squares}&&\\
\midrule  
\Imeth{line}{square ()} &|S.AB=L.AB : square () | &  create a square |S.AB|.\footnote{ |_,_,z.C,z.D = get_points(S.AB)|}; [\ref{ssub:object_rotation}] \\
\midrule 
\textbf{Sacred triangles}&&\\
\midrule  
\Imeth{line}{gold (<swap>)}    &|T.ABC=L.AB:gold()| & right in $B$ and $AC = \varphi \times AB $; [\ref{line:met}] \\
\Imeth{line}{euclide (<swap>)} &|T.ABC=L.AB:euclide()| &$AB=AC$ ; $(\overrightarrow{AB},\overrightarrow{AC}) = \pi/5$; [\ref{line:met}] \\
\Imeth{line}{golden (<swap>)}  &|T.ABC=L.AB:golden()|   &
    $(\overrightarrow{AB},\overrightarrow{AC}) = 2\times \pi/5$ ;  [\ref{line:met}] \\
\Imeth{line}{sublime (<swap>)} & = golden & [\ref{line:met}] \\
\Imeth{line}{divine (<swap>)}  & &   [\ref{line:met}] \\  
\Imeth{line}{golden\_gnomon (<swap>)}  & = devine &   [\ref{line:met}] \\  
\Imeth{line}{egyptian (<swap>)} & & [\ref{line:met}] \\
\Imeth{line}{pythagoras (<swap>)} & = egyptian & [\ref{line:met}] \\
\Imeth{line}{isis (<swap>)} & = egyptian & [\ref{line:met}] \\
\Imeth{line}{cheops (<swap>)}  &  & [\ref{line:met}] \\
\midrule 
\textbf{Circles} &&\\
\midrule 
\Imeth{line}{circle ()}  & |C.AB = L.AB : circle ()| &  center pa through pb \\
\Imeth{line}{apollonius (r)}  & |C.apo = L.AB : apollonius (2)|&  Set of points tq. |MA/MB = 2|; [\ref{ssub:apollonius_circle_ma_mb_k}] \\
\Imeth{line}{c\_l\_pp (pt,pt)} & |C1,C2 = L.AB: c_l_pp(z.M,z.N)|&[\ref{ssub:c_l_pp}]  \\ 
\Imeth{line}{c\_ll\_p (pt,pt)} & |C1,C2 = L.AB: c_ll_p(z.C,z.P)|&[\ref{ssub:method_c__ll__p}]  \\ 
\midrule 
\textbf{Transformations} &&\\
\midrule 
\Imeth{line}{reflection ( obj )}  & |new obj = L.AB : reflection (obj)|&  [\ref{ssub:reflection_of_object}] \\
\Imeth{line}{translation ( obj )} & |new obj = L.AB : translation (obj)|& [\ref{ssub:example_translation}] \\

\Imeth{line}{projection ( obj )}  & |z.H = L.AB : projection (z.C)| & $CH \perp (AB)$ and $H\in (AB)$; \\
...  & &  [\ref{ssub:example_projection_of_several_points}; \ref{ssub:example_combination_of_methods}; \ref{ssub:example_projection_of_several_points}; \ref{ssub:example_combination_of_methods}]\\

\Imeth{line}{projection\_ll(L,pts)}  & |z.Mp=L.AB:projection_ll(L.CD,z.M)|&  [\ref{ssub:method_imeth_line_projection__ll}] \\

\Imeth{line}{affinity\_ll(L,k,pts)}  & |z.Mp=L.AB:affinity(L.CD,2,z.M)|&  [\ref{ssub:method_imeth_line_affinity}] \\
\bottomrule
\end{tabular}
\egroup
\end{minipage}

\subsubsection{Method \Imeth{line}{distance}} % (fold)
\label{ssub:method_imeth_line_distance}

This method gives the distance from a point to a straight line.

\vspace{6pt}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{
function calc_distance (L,p)
 if L : in_out (p) 
 then
  return  point.abs(p-L.pa)/L.length
 else 
   return 0
 end 
end
z.A     = point: new (0,0)
z.B     = point: new (2,4)
z.X     = point: new (3,6)
z.Y     = point: new (2,0)
L.AB    = line :  new (z.A,z.B)
dx      = calc_distance (L.AB,z.X)
dy      = calc_distance (L.AB,z.Y)
}
\tkzUseLua{k}
\begin{tikzpicture}
 \tkzGetNodes
 \tkzDrawLine(A,B)
 \tkzDrawPoints(A,B,X,Y)
 \tkzLabelPoints(A,B)
 \tkzLabelPoint(X){X : \tkzUseLua{dx}}
 \tkzLabelPoint(Y){Y : \tkzUseLua{dy}}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{
   z.A            = point : new (0 , 0)
   z.B            = point : new (4 , 3)
   z.C            = point : new (1 , 5)
   L.AB           = line : new (z.A,z.B)
   d              = L.AB : distance (z.C)
   l              = L.AB.length
   z.H            = L.AB : projection (z.C)
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawLines(A,B C,H)
  \tkzDrawPoints(A,B,C,H)
  \tkzLabelPoints(A,B,C,H)
  \tkzLabelSegment[above right=2em,draw](C,H){$CH = \tkzUseLua{d}$}
  \tkzLabelSegment[below right=1em,draw](A,B){$AB = \tkzUseLua{l}$}
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection method_imeth_line_distance (end)

\subsubsection{Method \Imeth{line}{in\_out}} % (fold)
\label{ssub:method_imeth}

This method shows whether a point belongs to a straight line.

\vspace{6pt}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{
function calc_ratio (L,p)
 if L : in_out (p) 
 then
  return  point.abs(p-L.pa)/L.length
 else 
   return 0
 end 
end
z.A     = point: new (0,0)
z.B     = point: new (2,4)
z.X     = point: new (3,6)
z.Y     = point: new (2,0)
L.AB    = line :  new (z.A,z.B)
dx      = calc_ratio (L.AB,z.X)
dy      = calc_ratio (L.AB,z.Y)
}
\begin{tikzpicture}
 \tkzGetNodes
 \tkzDrawLine(A,B)
 \tkzDrawPoints(A,B,X,Y)
 \tkzLabelPoints(A,B)
 \tkzLabelPoint(X){X : \tkzUseLua{dx}}
 \tkzLabelPoint(Y){Y : \tkzUseLua{dy}}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{
function calc_distance (L,p)
 if L : in_out (p) 
 then
  return  point.abs(p-L.pa)/L.length
 else 
   return 0
 end 
end
z.A     = point: new (0,0)
z.B     = point: new (2,4)
z.X     = point: new (3,6)
z.Y     = point: new (2,0)
L.AB    = line :  new (z.A,z.B)
dx      = calc_distance (L.AB,z.X)
dy      = calc_distance (L.AB,z.Y)
}
\begin{center}
  \begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLine(A,B)
   \tkzDrawPoints(A,B,X,Y)
   \tkzLabelPoints(A,B)
   \tkzLabelPoint(X){X : \tkzUseLua{dx}}
   \tkzLabelPoint(Y){Y : \tkzUseLua{dy}}
  \end{tikzpicture}
\end{center}
\end{minipage}

% subsubsection method_imeth (end)

\subsubsection{Method \Imeth{line}{in\_in\_out\_segment}} % (fold)
\label{ssub:method_imeth_line_in__in__out__segment}

Variant of the previous method; indicates whether a point is on or off a segment.

\vspace{6pt}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
  \directlua{
  function foo (L,p)
   if L : in_out_segment (p) 
   then
    return  "in"
   else 
     return "out"
   end 
  end
  z.A     = point: new (0,0)
  z.B     = point: new (2,4)
  z.X     = point: new (-1,-2)
  z.Y     = point: new (1,2)
  L.AB    = line :  new (z.A,z.B)
  bx      = foo(L.AB,z.X)
  by      = foo(L.AB,z.Y)
  }
    \begin{tikzpicture}
        \tkzGetNodes
         \tkzDrawLine(A,B)
         \tkzDrawPoints(A,B,X,Y)
         \tkzLabelPoints(A,B)
         \tkzLabelPoint(X){X : \tkzUseLua{bx}}
         \tkzLabelPoint(Y){Y : \tkzUseLua{by}}
    \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
  \directlua{
  function foo (L,p)
   if L : in_out_segment (p) 
   then
    return  "in"
   else 
     return "out"
   end 
  end
  z.A     = point: new (0,0)
  z.B     = point: new (2,4)
  z.X     = point: new (-1,-2)
  z.Y     = point: new (1,2)
  L.AB    = line :  new (z.A,z.B)
  bx      = foo(L.AB,z.X)
  by      = foo(L.AB,z.Y)
  }
  \begin{center}
    \begin{tikzpicture}
        \tkzGetNodes
         \tkzDrawLine(A,B)
         \tkzDrawPoints(A,B,X,Y)
         \tkzLabelPoints(A,B)
         \tkzLabelPoint(X){X : \tkzUseLua{bx}}
         \tkzLabelPoint(Y){Y : \tkzUseLua{by}}
    \end{tikzpicture}
  \end{center}

\end{minipage}

% subsubsection method_imeth_line_in__in__out__segment (end)

\subsubsection{Method \Imeth{line}{is\_parallel}} % (fold)
\label{ssub:method_imeth_line_is__parallel}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{
z.A = point : new ( 0  , 0  )
z.B = point : new ( 4  , 2  )
L.AB = line : new (z.A,z.B)
z.C = point : new ( 1  , 2  )
z.D = point : new ( 5  , 4  )
L.CD = line : new (z.C,z.D)
if L.AB:is_parallel (L.CD) 
then tex.print("parallel") 
else tex.print("no parallel") 
end
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(A,B C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B,C,D)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
  \directlua{
  z.A = point : new ( 0  , 0  )
  z.B = point : new ( 4  , 2  )
  L.AB = line : new (z.A,z.B)
  z.C = point : new ( 1  , 2  )
  z.D = point : new ( 5  , 4  )
  L.CD = line : new (z.C,z.D)
  if L.AB:is_parallel (L.CD) then tex.print("parallel") else tex.print("no parallel") end
  }
  \begin{center}
    \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawLines(A,B C,D)
    \tkzDrawPoints(A,B,C,D)
    \tkzLabelPoints(A,B,C,D)
    \end{tikzpicture}
  \end{center}
\end{minipage}

% subsubsection method_imeth_line_is__parallel (end)

\subsubsection{Method \Imeth{line}{is\_orthogonal}} % (fold)
\label{ssub:method_imeth_line_is__orthogonal}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
  \directlua{
  z.A  = point : new (0 , 0 )
  z.B  = point : new (0 , 4 )
  L.AB = line : new (z.A,z.B)
  z.C  = point : new (3 , 4 )
  L.BC = line : new (z.B,z.C)
  if L.AB:is_orthogonal (L.BC)
   then tex.print("orthogonal") 
   else tex.print("no orthogonal")
    end
  }
    \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawLines(A,B B,C A,C)
    \tkzDrawPoints(A,B,C)
    \tkzLabelPoints(A,B,C)
    \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
  \directlua{
  z.A = point : new ( 0  , 0 )
  z.B = point : new ( 0  , 4 )
  L.AB = line : new (z.A,z.B)
  z.C = point : new ( 3  , 4 )
  L.BC = line : new (z.B,z.C)
  if L.AB:is_orthogonal (L.BC) then 
   tex.print("orthogonal") else 
   tex.print("no orthogonal") 
   end
  }
  \begin{center}
    \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawLines(A,B B,C A,C)
    \tkzDrawPoints(A,B,C)
    \tkzLabelPoints(A,B,C)
    \end{tikzpicture}
  \end{center}
\end{minipage}
% subsubsection method_imeth_line_is__orthogonal (end)

\subsubsection{Method \Imeth{line}{is\_equidistant}} % (fold)
\label{ssub:method_imeth_line_is__equidistant}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{
  z.A = point : new (0 , 0 )
  z.B = point : new (0 , 4 )
  z.C = point : new (4 , 4 )
  L.AC = line : new (z.A,z.C)
   if L.AC:is_equidistant (z.B) 
    then tex.print("equidistant")
    else tex.print("no equidistant")
    end
  }
    \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawLines(A,B B,C A,C)
    \tkzDrawPoints(A,B,C)
    \tkzLabelPoints(A,B,C)
    \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{
  z.A = point : new (0 , 0 )
  z.B = point : new (0 , 4 )
  z.C = point : new (4 , 4 )
  L.AC = line : new (z.A,z.C)
   if L.AC:is_equidistant (z.B) 
    then tex.print("equidistant")
    else tex.print("no equidistant")
    end
  }
  \begin{center}
      \begin{tikzpicture}
      \tkzGetNodes
      \tkzDrawLines(A,B B,C A,C)
      \tkzDrawPoints(A,B,C)
      \tkzLabelPoints(A,B,C)
      \end{tikzpicture}
  \end{center}
\end{minipage}

% subsubsection method_imeth_line_is__equidistant (end)

\subsubsection{Method \Imeth{line}{report}} % (fold)
\label{ssub:method_report}

|report (d,pt)| If the point is absent, the transfer is made from the first point that defines the line.

\vspace{6pt}
\begin{minipage}{.5\textwidth}
  \begin{Verbatim}
  \directlua{%
init_elements ()
z.A  = point : new (0,0)
z.B  = point : new (4,3)
L.AB = line : new ( z.A , z.B )
z.M  = point : new (0,2)
z.N  = L.AB :  report (2.5,z.M)
z.O  = L.AB :  report (2.5)
}
\begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments(A,B M,N)
  \tkzDrawPoints(A,B,M,N,O)
  \tkzLabelPoints(A,B,M,N,O)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
  \directlua{%
init_elements ()
z.A  = point : new (0,0)
z.B  = point : new (4,3)
L.AB = line : new ( z.A , z.B )
z.M  = point : new (0,2)
z.N  = L.AB :  report (2.5,z.M)
z.O  = L.AB :  report (2.5)
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments(A,B M,N)
  \tkzDrawPoints(A,B,M,N,O)
  \tkzLabelPoints(A,B,M,N,O)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection method_report (end)

\subsubsection{Method \Imeth{line}{two\_angles} } % (fold)
\label{ssub:triangle_with_two__angles}

The angles are on either side of the given segment

\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A   = point : new ( 0 , 0 )
   z.B   = point : new ( 4 , 0 )
   L.AB  = line : new ( z.A , z.B )
   T.ABC = L.AB : two_angles (math.pi/6,math.pi/2)
   z.C   = T.ABC.pc
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygons(A,B,C)
   \tkzDrawPoints(A,B,C)
   \tkzLabelPoints(A,B)
   \tkzLabelPoints[above](C)
   \tkzMarkAngle[red](C,B,A)
   \tkzMarkAngle[red](B,A,C)
   \tkzLabelAngle[red,pos=1.3](C,B,A){$\pi/2$}
   \tkzLabelAngle[red,pos=1.3](B,A,C){$\pi/6$}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
   \directlua{%
init_elements ()
      z.A = point : new ( 0 , 0 )
      z.B = point : new ( 4 , 0 )
      L.AB = line : new ( z.A , z.B )
      T.ABC= L.AB : two_angles (math.pi/6,math.pi/2)
      z.C = T.ABC.pc
   }

   \begin{center}
     \begin{tikzpicture}
        \tkzGetNodes
        \tkzDrawPolygons(A,B,C)
        \tkzDrawPoints(A,B,C)
        \tkzLabelPoints(A,B)
        \tkzLabelPoints[above](C)
        \tkzMarkAngle[red](C,B,A)
        \tkzMarkAngle[red](B,A,C)
        \tkzLabelAngle[red,pos=1.3](C,B,A){$\pi/2$}
        \tkzLabelAngle[red,pos=1.3](B,A,C){$\pi/6$}
     \end{tikzpicture}
   \end{center}

\end{minipage}
% subsubsection triangle_with_two__angles (end)

\subsubsection{Method \Imeth{line}{isosceles}} % (fold)
\label{ssub:method_imeth_line_isosceles}
\begin{minipage}{.5\textwidth}
  \begin{Verbatim}
\directlua{%
init_elements ()
   z.a    = point :   new (1,2)
   z.b    = point :   new (5,1)
   L.ab   = line :    new (z.a,z.b)
   T.abc  = L.ab :    isosceles (math.pi/6,indirect)
   z.c    = T.abc.pc
   z.L    = T.abc : lemoine_point ()
   T.SY   = T.abc : symmedian ()
   z.Ka,
   z.Kb,
   z.Kc   = get_points (T.SY)
   L.Kb   = T.abc : symmedian_line (1)
  _,z.Kb  = get_points(L.Kb)
}
\begin{tikzpicture}[scale= 2]
\tkzGetNodes
\tkzDrawPolygons(a,b,c Ka,Kb,Kc)
\tkzDrawPoints(a,b,c,L,Ka,Kb,Kc)
\tkzLabelPoints(c,L,Ka,Kb)
\tkzLabelPoints[above](a,b,Kc)
\tkzDrawSegments[cyan](a,Ka b,Kb c,Kc)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements ()
 z.a   = point: new (1,2)
 z.b   = point: new (5,1)
 L.ab  = line:  new (z.a,z.b)
 T.abc = L.ab:isosceles(math.pi/6,indirect)
 z.c   = T.abc.pc
 z.L   = T.abc: lemoine_point ()
 T.SY  = T.abc: symmedian ()
 z.Ka,
 z.Kb,
 z.Kc  = get_points (T.SY)
 L.Kb  = T.abc : symmedian_line (1)
  _,z.Kb = get_points(L.Kb)
}
\begin{center}
  \begin{tikzpicture}[scale= 1.5]
  \tkzGetNodes
  \tkzDrawPolygons(a,b,c Ka,Kb,Kc)
  \tkzDrawPoints(a,b,c,L,Ka,Kb,Kc)
  \tkzLabelPoints(c,L,Ka,Kb)
  \tkzLabelPoints[above](a,b,Kc)
  \tkzDrawSegments[cyan](a,Ka b,Kb c,Kc)
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection method_imeth_line_isosceles (end)

\subsubsection{Methods \Imeth{line}{sss}, \Imeth{line}{sas}, \Imeth{line}{ssa}} % (fold)
\label{ssub:triangle_with_three_given_sides}

In the following example, a small difficulty arises. The given lengths are not affected by scaling, so it's necessary to use the \Igfct{math}{value (r) } function, which will modify the lengths according to the scale.

\vspace{6pt}
\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
  z.A = point : new ( 0 , 0 )
  z.B = point : new ( 5 , 0 )
  L.AB = line : new ( z.A , z.B )
  T.ABC =  L.AB : sss (value(3),value(4))
  T.ABD =  L.AB : sas (value(3),math.pi/2)
  T.ABE =  L.AB : ssa (value(7),math.pi/2)
  z.C = T.ABC.pc
  z.D = T.ABD.pc
  z.E = T.ABE.pc
}
\begin{tikzpicture}[gridded]
  \tkzGetNodes
  \tkzDrawPolygons(A,B,C A,B,D A,B,E)
  \tkzDrawPoints(A,B,C,D,E)
  \tkzLabelPoints(A,B)
  \tkzLabelPoints[above](C,D,E)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
\directlua{%
init_elements ()
  z.A = point : new ( 0 , 0 )
  z.B = point : new ( 5 , 0 )
  L.AB = line : new ( z.A , z.B )
  T.ABC =  L.AB : sss (value(3),value(4))
  T.ABD =  L.AB : sas (value(3),math.pi/2)
  T.ABE =  L.AB : ssa (value(7),math.pi/2)
  z.C = T.ABC.pc
  z.D = T.ABD.pc
  z.E = T.ABE.pc
}

\begin{center}
  \begin{tikzpicture}[gridded]
    \tkzGetNodes
    \tkzDrawPolygons(A,B,C A,B,D A,B,E)
    \tkzDrawPoints(A,B,C,D,E)
    \tkzLabelPoints(A,B)
    \tkzLabelPoints[above](C,D,E)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection triangle_with_three_given_sides (end)

\subsubsection{Triangle with side between side and angle} % (fold)
\label{ssub:triangle_with_side_between_side_and_angle}


\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
 z.A  = point: new ( 0 , 0 )
 z.B  = point: new ( 5 , 0 )
 L.AB = line: new ( z.A , z.B )
 T.ABC= L.AB: ssa(value(3),math.pi/6)
 T.ABD= L.AB: ssa(value(3),math.pi/6,swap)
 z.C  = T.ABC.pc
 z.D  = T.ABD.pc
}
\begin{tikzpicture}[gridded]
  \tkzGetNodes
  \tkzDrawPolygons(A,B,C A,B,D)
  \tkzDrawPoints(A,B,C,D)
  \tkzLabelPoints(A,B)
  \tkzLabelPoints[above](C,D)
  \tkzLabelAngle[teal](C,B,A){$\pi/6$}
  \tkzLabelSegment[below left](A,C){$7$}
  \tkzLabelSegment[below left](A,D){$7$}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
   \directlua{%
init_elements ()
 z.A   = point : new ( 0 , 0 )
 z.B   = point : new ( 5 , 0 )
 L.AB  = line : new ( z.A , z.B )
 T.ABC = L.AB : ssa (value(3),math.pi/6)
 T.ABD = L.AB : ssa (value(3),math.pi/6,swap)
 z.C   = T.ABC.pc
 z.D   = T.ABD.pc
}  

\begin{center}
  \begin{tikzpicture}[gridded]
        \tkzGetNodes
        \tkzDrawPolygons(A,B,C A,B,D)
        \tkzDrawPoints(A,B,C,D)
        \tkzLabelPoints(A,B)
        \tkzLabelPoints[above](C,D)
        \tkzLabelAngle[teal](C,B,A){$\pi/6$}
        \tkzLabelSegment[below left](A,C){$7$}
        \tkzLabelSegment[below left](A,D){$7$}
     \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection triangle_with_side_between_side_and_angle (end)

\subsubsection{About sacred triangles} % (fold)
\label{ssub:about_triangles}
The side lengths are proportional to the lengths given in the table. They depend on the length of the initial segment.

\captionof{table}{Sacred triangles.}\label{line:met}
\begin{tabular}{ll}
\toprule
\textbf{Name} & \textbf{definition}  \\
\midrule
\Imeth{line}{gold (<swap>)}     & Right triangle with $a=\varphi$, $b=1$ and $c=\sqrt{\varphi}$\\
\Imeth{line}{golden (<swap>)}   & Right triangle $b=\varphi$, $c=1$ ; half of gold rectangle   \\
\Imeth{line}{divine ()}  & Isosceles $a=\varphi$, $b=c=1$ and $\beta = \gamma=\pi/5$ \\
\Imeth{line}{pythagoras ()}  & $a=5$, $b=4$, $c=3$ and other names: isis or egyptian\\
\Imeth{line}{sublime ()}  & Isosceles $a=1$, $b=c=\varphi$  and $\beta =\gamma=2\pi/5$ ; other name: euclid\\
\Imeth{line}{cheops ()}  &  Isosceles $a=2$, $b=c=\varphi$  and height = $\sqrt{\varphi}$ \\
\bottomrule
\end{tabular}

\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , 0 )
   z.B = point : new ( 4 , 0 )
   L.AB = line : new ( z.A , z.B )
   T.ABC = L.AB : cheops ()
   z.C = T.ABC.pc
   T.ABD = L.AB : gold ()
   z.D = T.ABD.pc
   T.ABE = L.AB : euclide ()
   z.E = T.ABE.pc
   T.ABF = L.AB : golden ()
   z.F = T.ABF.pc
   T.ABG = L.AB : divine ()
   z.G = T.ABG.pc
   T.ABH = L.AB : pythagoras ()
   z.H = T.ABH.pc
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H)
   \tkzDrawPoints(A,...,H)
   \tkzLabelPoints(A,...,H)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , 0 )
   z.B = point : new ( 4 , 0 )
   L.AB = line : new ( z.A , z.B )
   T.ABC = L.AB : cheops ()
   z.C = T.ABC.pc
   T.ABD = L.AB : gold ()
   z.D = T.ABD.pc
   T.ABE = L.AB : euclide ()
   z.E = T.ABE.pc
   T.ABF = L.AB : golden ()
   z.F = T.ABF.pc
   T.ABG = L.AB : divine ()
   z.G = T.ABG.pc
   T.ABH = L.AB : pythagoras ()
   z.H = T.ABH.pc
}
\begin{center}
  \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H)
     \tkzDrawPoints(A,...,H)
     \tkzLabelPoints(A,...,H)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection about_triangles (end)

\subsubsection{Method \Imeth{line}{point} }% (fold)
\label{ssub:method_point}
This method is very useful. It allows you to place a point on the line under consideration.
If |r = 0|  then the point is |pa|, if |r = 1| it's |pb|.

If |r = .5| the point obtained is the midpoint of the segment. |r| can be negative or greater than 1.

This method exists for all objects except quadrilaterals.


\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A  = point : new (-1,-1)
   z.B  = point : new (1,1)
   L.AB = line : new (z.A,z.B)
   z.I  = L.AB : point (0.5)
   z.J  = L.AB : point (-0.5)
   z.K  = L.AB : point (2)
}
\begin{tikzpicture}[gridded]
\tkzGetNodes
   \tkzDrawLine(J,K)
   \tkzDrawPoints(A,B,I,J,K)
   \tkzLabelPoints(A,B,I,J,K)
 \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
   \directlua{%
init_elements ()
   z.A = point : new (-1,-1)
   z.B = point : new (1,1)
   L.AB = line : new (z.A,z.B)
   z.I = L.AB : point (0.5)
   z.J = L.AB : point (-0.5)
   z.K = L.AB : point (2)
}
\begin{center}
  \begin{tikzpicture}[gridded]
  \tkzGetNodes
     \tkzDrawLine(J,K)
     \tkzDrawPoints(A,B,I,J,K)
     \tkzLabelPoints(A,B,I,J,K)
   \end{tikzpicture}
\end{center}

 \end{minipage}
% subsubsection method_point (end)

\subsubsection{Method \Imeth{line}{colinear\_at}} % (fold)
\label{ssub:method_imeth_line_colinear__at}
If the coefficient is missing then it defaults to $1$ and in the following example we obtain: $CE=AB$ and $(AB)\parallel (CE)$. For point $D$: $CD = .5AB$ and $(AB)\parallel (CD)$.

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
  z.A      = point: new (0 , 0)
  z.B      = point: new (4 , 0)
  z.C      = point: new (1 , 3)
  L.AB     = line : new (z.A,z.B)
  z.D      = L.AB : colinear_at (z.C,.5)
  z.E      = L.AB : colinear_at (z.C)
}
\begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments(A,B C,E)
  \tkzDrawPoints(A,B,C,D,E)
  \tkzLabelPoints(A,B,C,D,E)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements ()
  z.A      = point: new (0 , 0)
  z.B      = point: new (4 , 0)
  z.C      = point: new (1 , 3)
  L.AB     = line : new (z.A,z.B)
  z.D      = L.AB : colinear_at (z.C,.5)
  z.E      = L.AB : colinear_at (z.C)
}
\begin{center}
  \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawSegments(A,B C,E)
    \tkzDrawPoints(A,B,C,D,E)
    \tkzLabelPoints(A,B,C,D,E)
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection method_imeth_line_colinear__at (end)


\subsubsection{Method \Imeth{line}{normalize}} % (fold)
\label{ssub:normalize}

\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.a  = point: new (1, 1)
   z.b  = point: new (5, 4)
   L.ab = line : new (z.a,z.b)
   z.c  = L.ab : normalize ()
}

\begin{tikzpicture}[gridded]
\tkzGetNodes
\tkzDrawSegments(a,b)
\tkzDrawCircle(a,c)
\tkzDrawPoints(a,b,c)
\tkzLabelPoints(a,b,c)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
\directlua{%
init_elements ()
   z.a = point: new (1, 1)
   z.b = point: new (5, 4)
   L.ab = line : new (z.a,z.b)
   z.c   = L.ab : normalize ()
}

\begin{center}
  \begin{tikzpicture}[gridded]
  \tkzGetNodes
  \tkzDrawSegments(a,b)
  \tkzDrawCircle(a,c)
  \tkzDrawPoints(a,b,c)
  \tkzLabelPoints(a,b,c)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection normalize (end)


\subsubsection{Method \Imeth{line}{barycenter}} % (fold)
\label{ssub:barycenter_with_a_line}

\begin{minipage}{.4\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A  = point : new ( 0 , -1 )
   z.B  = point : new ( 4 , 2 )
   L.AB = line : new ( z.A , z.B )
   z.G  = L.AB : barycenter (1,2)
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLine(A,B)
   \tkzDrawPoints(A,B,G)
   \tkzLabelPoints(A,B,G)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.6\textwidth}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , -1 )
   z.B = point : new ( 4 , 2 )
   L.AB = line : new ( z.A , z.B )
   z.G = L.AB : barycenter (1,2)
}
\begin{center}
  \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawLine(A,B)
     \tkzDrawPoints(A,B,G)
     \tkzLabelPoints(A,B,G)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection barycenter_with_a_line (end)

\subsubsection{Method \Imeth{line}{ll\_from}} % (fold)
\label{ssub:new_line_from_a_defined_line}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
z.A   = point : new (1,1)
z.B   = point : new (3,2)
L.AB  = line : new (z.A,z.B)
z.C   = L.AB.north_pa
z.D   = L.AB.south_pa
L.CD  = line : new (z.C,z.D)
_,z.E = get_points ( L.CD: ll_from (z.B))
% z.E = L2.pb
}
\begin{tikzpicture}[scale = 1.25]
   \tkzGetNodes
   \tkzDrawLines(A,B C,D B,E)
   \tkzDrawPoints(A,...,E)
   \tkzLabelPoints(A,...,E)
   \tkzMarkRightAngle(B,A,C)
   \tkzMarkSegments(A,C A,B A,D)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{%
init_elements ()

z.A   = point : new (1,1)
z.B   = point : new (3,2)
L.AB  = line : new (z.A,z.B)
z.C   = L.AB.north_pa
z.D   = L.AB.south_pa
L.CD  = line : new (z.C,z.D)
_,z.E   = get_points ( L.CD: ll_from (z.B))
% or  z.E   = L2.pb with |L2 = L.CD: ll_from (z.B)|
}

\begin{center}
  \begin{tikzpicture}[scale = 1.25]
  \tkzGetNodes
  \tkzDrawLines(A,B C,D B,E)
  \tkzDrawPoints(A,...,E)
  \tkzLabelPoints(A,...,E)
  \tkzMarkRightAngle(B,A,C)
  \tkzMarkSegments(A,C A,B A,D)
  \end{tikzpicture}
\end{center}


\end{minipage}
 %  \caption{New line from defined line}
% subsubsection new_line_from_a_defined_line (end)

\subsubsection{Method \Imeth{line}{ortho\_from}} % (fold)
\label{ssub:newline_ortho_from}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A   = point : new (1,1)
   z.B   = point : new (3,2)
   L.AB  = line :  new (z.A,z.B)
   z.C   = point : new (1,3)
   L.CD  = L.AB :  ortho_from(z.C)
   z.D   = L.CD.pb
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines(A,B C,D)
   \tkzDrawPoints(A,...,D)
   \tkzLabelPoints(A,...,D)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{%
init_elements ()
   z.A   = point : new (1,1)
   z.B   = point : new (3,2)
   L.AB  = line :  new (z.A,z.B)
  z.C   = point : new (1,3)
   L.CD  = L.AB :  ortho_from(z.C)
   z.D   = L.CD.pb
}

\begin{center}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines(A,B C,D)
   \tkzDrawPoints(A,...,D)
   \tkzLabelPoints(A,...,D)
\end{tikzpicture}
\end{center}


\end{minipage}

% subsubsection new_line_from_a_defined_line (end)

\subsubsection{Method \Imeth{line}{mediator}} % (fold)
\label{ssub:method_imeth_line_mediator}

In Mathworld, the mediator is the plane through the midpoint of a line segment and perpendicular to that segment, also called a mediating plane. The term "mediator" was introduced by J. Neuberg (Altshiller-Court 1979, p. 298). Here, I have adopted the French term and the mediator or
the perpendicular bisector  of a line segment, is a line segment perpendicular to the segment and passing through the midpoint of this segment.
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
  z.A    = point: new(0,0)
  z.B    = point: new(5,0)
  L.AB   = line: new (z.A,z.B)
  L.med  = L.AB : mediator ()
  z.M    = L.AB.mid
  z.x,z.y= get_points(L.med)
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLine(A,B)
\tkzDrawSegments(x,y)
\tkzDrawPoints(A,B,M)
\tkzLabelPoints(A,B)
\tkzLabelPoints[below left](x,y,M)
\tkzMarkSegments(A,M M,B)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements ()
  z.A    = point: new(0,0)
  z.B    = point: new(5,0)
  L.AB   = line: new (z.A,z.B)
  L.med  = L.AB : mediator ()
  z.M    = L.AB.mid
  z.x,z.y= get_points(L.med)
}
\begin{center}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLine(A,B)
\tkzDrawSegments(x,y)
\tkzDrawPoints(A,B,M)
\tkzLabelPoints(A,B)
\tkzLabelPoints[below left](x,y,M)
\tkzMarkSegments(A,M M,B)
\end{tikzpicture}
\end{center}
\end{minipage}

% subsubsection method_imeth_line_mediator (end)

\subsubsection{Method \Imeth{line}{swap\_line}} % (fold)
\label{ssub:method_imeth_line_swap__line}

Sometimes it's useful to swap the two points that define a straight line. This allows you to change the orientation. A more important example is shown here [\ref{ssub:intersection_line_parabola_explained}].

\begin{minipage}{.5\textwidth}
  \begin{Verbatim}
    \directlua{
    init_elements ()
    z.A = point : new ( 0 , 0 )
    z.B = point : new ( 2 , -1 )
    L.dir = line : new (z.A,z.B)
    L.dir = L.dir: swap_line()
    z.a = L.dir.pa
    z.b = L.dir.pb
    }
    \begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawSegments[cyan,thick,->](a,b)
    \tkzLabelPoints(A,B)
    \end{tikzpicture}
  \end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{
init_elements ()
z.A = point : new ( 0 , 0 )
z.B = point : new ( 2 , -1 )
L.dir = line : new (z.A,z.B)
L.dir = L.dir: swap_line()
z.a = L.dir.pa
z.b = L.dir.pb
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments[cyan,thick,->](a,b)
  \tkzLabelPoints(A,B)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection method_imeth_line_swap__line (end)

\subsubsection{Method \Imeth{line}{equilateral}} % (fold)
\label{ssub:method_imeth_line_equilateral}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
  z.A    = point: new(0,0)
  z.B    = point: new(5,0)
  L.AB   = line: new (z.A,z.B)
  T.ABC  = L.AB : equilateral ()
  z.C    = T.ABC.pc
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLine(A,B)
\tkzDrawPolygon(A,B,C)
\tkzMarkSegments(A,B B,C C,A)
\tkzDrawPoints(A,B,C)
\tkzMarkAngles(B,A,C C,B,A A,C,B)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements ()
  z.A    = point: new(0,0)
  z.B    = point: new(5,0)
  L.AB   = line: new (z.A,z.B)
  T.ABC  = L.AB : equilateral ()
  z.C    = T.ABC.pc
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawLine(A,B)
  \tkzDrawPolygon(A,B,C)
  \tkzMarkSegments(A,B B,C C,A)
  \tkzDrawPoints(A,B,C)
  \tkzMarkAngles(B,A,C C,B,A A,C,B)
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection method_imeth_line_equilateral (end)

\subsubsection{Method \Imeth{line}{projection}} % (fold)
\label{ssub:example_projection_of_several_points}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.a       = point:  new (0, 0)
   z.b       = point:  new (4, 1)
   z.c       = point:  new (2, 5)
   z.d       = point:  new (5, 2)
   L.ab      = line:   new (z.a,z.b)
   z.cp,z.dp = L.ab:  projection(z.c,z.d)
}
 \begin{tikzpicture}[scale = .8]
   \tkzGetNodes
   \tkzDrawLines(a,b c,c' d,d')
   \tkzDrawPoints(a,...,d,c',d')
   \tkzLabelPoints(a,...,d,c',d')
 \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{%
init_elements ()
z.a    = point:  new (0, 0)
z.b    = point:  new (4, 1)
z.c    = point:  new (2, 5)
z.d    = point:  new (5, 2)
L.ab        = line:   new (z.a,z.b)
z.cp,z.dp   = L.ab :  projection(z.c,z.d)
}

\begin{center}
  \begin{tikzpicture}[scale  = .8]
  \tkzGetNodes
  \tkzDrawLines(a,b c,c' d,d')
  \tkzDrawPoints(a,...,d,c',d')
  \tkzLabelPoints(a,...,d,c',d')
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection example_projection_of_several_points (end)

\subsubsection{Method \Imeth{line}{projection\_ll}} % (fold)
\label{ssub:method_imeth_line_projection__ll}

We've just seen (orthogonal) projection, but this time we're talking about projecting a point onto a line parallel to a line. At present, this transformation only applies to a point or a group of points, but it will be extended to objects.

\vspace{6pt}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
  z.a = point: new (0, 0)
  z.b = point: new (4, 1)
  z.c = point: new (-1, 3)
  z.d = point: new (-2, -1)
  z.m = point: new (1,2)
  z.n = point: new (3,2)
  L.ab = line: new (z.a,z.b)
  L.cd = line: new (z.c,z.d) 
  z.e,z.f= L.ab:projection_ll(L.cd,z.m,z.n)
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(a,b c,d e,m f,n)
\tkzDrawPoints(a,...,f,m,n)
\tkzLabelPoints(a,...,f,m,n)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
  z.a = point: new (0, 0)
  z.b = point: new (4, 1)
  z.c = point: new (-1, 3)
  z.d = point: new (-2, -1)
  z.m = point: new (1,2)
  z.n = point: new (3,2)
  L.ab = line: new (z.a,z.b)
  L.cd = line: new (z.c,z.d) 
  z.e,z.f= L.ab:projection_ll(L.cd,z.m,z.n)
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(a,b c,d e,m f,n)
\tkzDrawPoints(a,...,f,m,n)
\tkzLabelPoints(a,...,f,m,n)
\end{tikzpicture}
\end{minipage}

% subsubsection method_imeth_line_projection__ll (end)

\subsubsection{Method \Imeth{line}{affinity}} % (fold)
\label{ssub:method_imeth_line_affinity}

The introduction of parrallel projection to an axis allows us to define a new transformation: affinity.

\vspace{6pt}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
  z.a = point: new (0, 0)
  z.b = point: new (4, 1)
  z.c = point: new (-1, 3)
  z.d = point: new (-2, -1)
  z.m = point: new (1,2)
  z.n = point: new (3,2)
  L.ab = line: new (z.a,z.b)
  L.cd = line: new (z.c,z.d) 
  z.e,z.f= L.ab:projection_ll(L.cd,z.m,z.n)
  z.g,z.h = L.ab : affinity(L.cd,2,z.m,z.n)}
\begin{tikzpicture}
 \tkzGetNodes
 \tkzDrawLines(a,b c,d e,m f,n)
 \tkzDrawPoints(a,...,h,m,n)
 \tkzLabelPoints(a,...,h,m,n)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
  z.a = point: new (0, 0)
  z.b = point: new (4, 1)
  z.c = point: new (-1, 3)
  z.d = point: new (-2, -1)
  z.m = point: new (1,2)
  z.n = point: new (3,2)
  L.ab = line: new (z.a,z.b)
  L.cd = line: new (z.c,z.d) 
  z.e,z.f= L.ab:projection_ll(L.cd,z.m,z.n)
  z.g,z.h = L.ab : affinity(L.cd,2,z.m,z.n)}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(a,b c,d e,m f,n)
\tkzDrawPoints(a,...,h,m,n)
\tkzLabelPoints(a,...,h,m,n)
\end{tikzpicture}
\end{minipage}


% subsubsection method_imeth_line_affinity (end)



\subsubsection{Example: combination of methods} % (fold)
\label{ssub:example_combination_of_methods}

\begin{minipage}{0.6\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A     = point: new (0 , 0)
   z.B     = point: new (6 , 0)
   z.C     = point: new (1 , 5)
   T.ABC   = triangle: new (z.A,z.B,z.C)
   L.AB    = T.ABC.ab
   z.O     = T.ABC.circumcenter
   C.OA    = circle: new (z.O,z.A)
   z.H     = L.AB: projection (z.O)
   L.ab    = C.OA: tangent_at (z.A)
   z.a,z.b = L.ab.pa,L.ab.pb
  % or z.a,z.b  = get_points (L.ab)
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C)
   \tkzDrawCircle(O,A)
   \tkzDrawSegments[purple](O,A O,B O,H)
   \tkzDrawArc[red](O,A)(B)
   \tkzDrawArc[blue](O,B)(A)
   \tkzDrawLine[add = 2 and 1](A,a)
   \tkzFillAngles[teal!30,opacity=.4](A,C,B b,A,B A,O,H)
   \tkzMarkAngles[mark=|](A,C,B b,A,B A,O,H H,O,B)
   \tkzDrawPoints(A,B,C,H,O)
   \tkzLabelPoints(B,H)
   \tkzLabelPoints[above](O,C)
   \tkzLabelPoints[left](A)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\directlua{%
init_elements ()
z.A     = point: new (0 , 0)
z.B     = point: new (6 , 0)
z.C     = point: new (1 , 5)
T.ABC   = triangle: new (z.A,z.B,z.C)
L.AB    = T.ABC.ab
z.O     = T.ABC.circumcenter
C.OA    = circle: new (z.O,z.A)
z.H     = L.AB : projection (z.O)
L.ab    = C.OA : tangent_at (z.A)
z.a,z.b = L.ab.pa,L.ab.pb
   % or z.a,z.b  = get_points (L.ab)
}

\begin{center}
  \begin{tikzpicture}[scale = .5]
  \tkzGetNodes
  \tkzDrawPolygon(A,B,C)
  \tkzDrawCircle(O,A)
  \tkzDrawSegments[purple](O,A O,B O,H)
  \tkzDrawArc[red](O,A)(B)
  \tkzDrawArc[blue](O,B)(A)
  \tkzDrawLine[add = 2 and 1](A,a)
  \tkzFillAngles[teal!30,opacity=.4,,size=.5](A,C,B b,A,B A,O,H)
  \tkzMarkAngles[mark=|,size=.5](A,C,B b,A,B A,O,H H,O,B)
  \tkzDrawPoints(A,B,C,H,O)
  \tkzLabelPoints(B,H)
  \tkzLabelPoints[above](O,C)
  \tkzLabelPoints[left](A)
  \end{tikzpicture}
\end{center}


\end{minipage}

% subsubsection example_combination_of_methods (end)

\subsubsection{Method \Imeth{line}{translation}} % (fold)
\label{ssub:example_translation}

\begin{minipage}{0.6\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A  = point:  new (0,0)
   z.B  = point:  new (1,2)
   z.C  = point:  new (-3,2)
   z.D  = point:  new (0,2)
   L.AB = line : new (z.A,z.B)
   z.E,z.F = L.AB : translation (z.C,z.D)
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPoints(A,...,F)
\tkzLabelPoints(A,...,F)
\tkzDrawSegments[->,red,> =latex](C,E D,F A,B)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\directlua{%
init_elements ()
   z.A  = point:  new (0,0)
   z.B  = point:  new (1,2)
   z.C  = point:  new (-3,2)
   z.D  = point:  new (0,2)
   L.AB = line : new (z.A,z.B)
   z.E,z.F = L.AB : translation (z.C,z.D)
}

\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawPoints(A,...,F)
  \tkzLabelPoints(A,...,F)
  \tkzDrawSegments[->,red,> =latex](C,E D,F A,B)
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection example_translation (end)


\subsubsection{Method \Imeth{line}{reflection} of an object} % (fold)
\label{ssub:reflection_of_object}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , 0 )
   z.B = point : new ( 4 , 1 )
   z.E = point : new ( 0 , 2 )
   z.F = point : new ( 3 , 3 )
   z.G = point : new ( 4 , 2 )
   L.AB = line : new ( z.A , z.B )
   T.EFG = triangle : new (z.E,z.F,z.G)
   T.new = L.AB : reflection (T.EFG)
   z.Ep,z.Fp,z.Gp = get_points(T.new)
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLine(A,B)
   \tkzDrawPolygon(E,F,G)
   \tkzDrawPolygon[new](E',F',G')
   \tkzDrawSegment[red,dashed](E,E')
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , 0 )
   z.B = point : new ( 4 , 1 )
   z.E = point : new ( 0 , 2 )
   z.F = point : new ( 3 , 3 )
   z.G = point : new ( 4 , 2 )
   L.AB = line : new ( z.A , z.B )
   T.EFG = triangle : new (z.E,z.F,z.G)
   T.new = L.AB : reflection (T.EFG)
   z.Ep,z.Fp,z.Gp = get_points(T.new)
}

\begin{center}
  \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawLine(A,B)
     \tkzDrawPolygon(E,F,G)
     \tkzDrawPolygon[new](E',F',G')
     \tkzDrawSegment[red,dashed](E,E')
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection reflection_of_object (end)

\subsubsection{Method \Imeth{line}{distance}} % (fold)
\label{ssub:example_distance_and_projection}

\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
   z.A    = point : new (0 , 0)
   z.B    = point : new (4 , -2)
   z.C    = point : new (3 , 3)
   L.AB   = line : new (z.A,z.B)
   d      = L.AB : distance (z.C)
   z.H    = L.AB : projection (z.C)
}
\begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawLines(A,B C,H)
  \tkzDrawPoints(A,B,C,H)
  \tkzLabelPoints(A,B,C,H)
  \tkzLabelSegment[above left,
  draw](C,H){$CH = \tkzUseLua{d}$}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{%
   init_elements ()
   z.A    = point : new (0 , 0)
   z.B    = point : new (4 , -2)
   z.C    = point : new (3 , 3)
   L.AB   = line : new (z.A,z.B)
   d      = L.AB : distance (z.C)
   z.H    = L.AB : projection (z.C)
}

\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawLines(A,B C,H)
  \tkzDrawPoints(A,B,C,H)
  \tkzLabelPoints(A,B,C,H)
  \tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$}
  \end{tikzpicture}
\end{center}
\end{minipage}

% \caption{Method distance with line object}
% subsubsection example_distance_and_projection (end)


\subsubsection{Method \Imeth{line}{apollonius} (Apollonius circle MA/MB = k)} % (fold)
\label{ssub:apollonius_circle_ma_mb_k}

\begin{Verbatim}
\directlua{%
init_elements ()
   z.A = point : new ( 0 , 0 )
   z.B = point : new ( 6 , 0 )
   L.AB =line: new (z.A,z.B)
   C.apo = L.AB : apollonius (2)
   z.O,z.C = get_points (   C.apo   )
   z.D = C.apo : antipode (z.C)
   z.P = C.apo : point  (0.30)
}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzFillCircle[blue!20,opacity=.2](O,C)
   \tkzDrawCircle[blue!50!black](O,C)
   \tkzDrawPoints(A,B,O,C,D,P)
   \tkzDrawSegments[orange](P,A P,B P,D B,D P,C)
   \tkzDrawSegments[red](A,C)
   \tkzDrawPoints(A,B)
   \tkzLabelCircle[draw,fill=green!10,%
      text width=3cm,text centered,left=24pt](O,D)(60)%
     {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$}
   \tkzLabelPoints[below right](A,B,O,C,D)
   \tkzLabelPoints[above](P)
   \tkzMarkRightAngle[opacity=.3,fill=lightgray](D,P,C)
   \tkzMarkAngles[mark=||](A,P,D D,P,B)
\end{tikzpicture}
\end{Verbatim}

\directlua{%
init_elements ()
z.A = point : new ( 0 , 0 )
z.B = point : new ( 6 , 0 )
L.AB =line: new (z.A,z.B)
C.apo = L.AB : apollonius (2)
z.O,z.C = get_points (  C.apo  )
z.D = C.apo : antipode (z.C)
z.P = C.apo : point  (0.30)
}

\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzFillCircle[blue!20,opacity=.2](O,C)
  \tkzDrawCircle[blue!50!black](O,C)
  \tkzDrawPoints(A,B,O,C,D,P)
  \tkzDrawSegments[orange](P,A P,B P,D B,D P,C)
  \tkzDrawSegments[red](A,C)
  \tkzDrawPoints(A,B)
  \tkzLabelCircle[draw,fill=green!10,%
      text width=3cm,text centered,left=24pt](O,D)(60)%
    {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$}
    \tkzLabelPoints[below right](A,B,O,C,D)
    \tkzLabelPoints[above](P)
  \tkzMarkRightAngle[opacity=.3,fill=lightgray](D,P,C)
  \tkzMarkAngles[mark=||](A,P,D D,P,B)
  \end{tikzpicture}
\end{center}


Remark: |\tkzUseLua{length(z.P,z.A)/length(z.P,z.B)}| = \tkzUseLua{length(z.P,z.A)/length(z.P,z.B)}
% subsubsection apollonius_circle_ma_mb_k (end)

\subsubsection{Method \Imeth{line}{c\_l\_pp}} % (fold)
\label{ssub:c_l_pp}
Circle tangent to a line passing through two points.

First, consider the general case: a straight line $(AB)$ and two points, $M$ and $N$. We are tasked with finding the circle that is tangent to the line and passes through the two points.

 We will focus on the straight line $(AB)$ and apply a specific method designed for such cases.
The method takes into account the following special cases:

\begin{itemize}
  \item line $(MN)$ is perpendicular to the line $(AB)$;
  \item line $(MN)$ is parallel to line $(AB)$;
  \item these points are on either side of the line $(AB)$;
  \item one of the points lies on the line $(AB)$.
\end{itemize}

\vspace{6pt}
\begin{minipage}{0.4\textwidth}
\begin{Verbatim}
  \directlua{
  init_elements ()
  z.A    = point : new ( 0  , 0  )
  z.B    = point : new ( 8  , 0  )
  z.M    = point : new ( 1  , 1 )
  z.N    = point : new ( 2  , 5 )
  L.AB   = line:new(z.A,z.B)
  C1,C2  = L.AB : c_l_pp (z.M,z.N)
  z.O1   = C1.center
  z.O2   = C2.center
  z.T1   = C1.through
  z.T2   = C2.through
  }
  \begin{tikzpicture}[scale = .75]
  \tkzGetNodes
  \tkzDrawLines(A,B M,N)
  \tkzDrawCircles(O1,T1 O2,T2)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N,O1,T1,O2,T2)
  \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\directlua{
init_elements ()
z.A    = point : new ( 0  , 0  )
z.B    = point : new ( 6  , 0  )
z.M    = point : new ( 1  , 1 )
z.N    = point : new ( 2  , 5 )
L.AB   = line:new(z.A,z.B)
C1,C2  = L.AB : c_l_pp(z.M,z.N)
z.O1   = C1.center
z.O2   = C2.center
z.T1   = C1.through
z.T2   = C2.through
}
\begin{center}
  \begin{tikzpicture}[scale =.6]
  \tkzGetNodes
  \tkzDrawLines(A,B M,N)
  \tkzDrawCircles(O1,T1 O2,T2)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N,O1,T1,O2,T2)
  \end{tikzpicture}
\end{center}

\end{minipage}

\vspace{6pt}
Let's look at the impossible case: the points are on either side of the line. 

The method returns \code{nil} and \code{nil}.

\vspace{6pt}
\begin{minipage}{0.4\textwidth}
\begin{Verbatim}
\directlua{
init_elements ()
z.A    = point :new (0, 0)
z.B    = point :new (6, 0)
z.M    = point :new (1, 1)
z.N    = point :new (3 ,-5)
L.AB   = line:new(z.A,z.B)
L.MN   = line:new(z.M,z.N)
z.I    = intersection(L.AB,L.MN)
C1,C2  =  L.AB : c_l_pp(z.M,z.N)
if C1 == nil
 then
else
   z.C    = C1.center
   z.Cp   = C2.center
   z.T    = C1.through
   z.Tp   = C2.through
end
}
\begin{tikzpicture}[scale =.6]
\tkzGetNodes
\tkzDrawLines(A,B M,N)
\tkzDrawPoints(A,B,M,N)
\tkzLabelPoints(A,B,M,N)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\directlua{
init_elements ()
z.A    = point : new ( 0  , 0  )
z.B    = point : new ( 6  , 0  )
z.M    = point : new ( 1 ,  1 )
z.N    = point : new ( 3  , -5 )
L.AB   = line:new(z.A,z.B)
L.MN   = line:new(z.M,z.N)
z.I    = intersection(L.AB,L.MN)
C1,C2  =  L.AB : c_l_pp(z.M,z.N)
if C1 == nil
then

else
   z.C    = C1.center
   z.Cp   = C2.center
   z.T    = C1.through
   z.Tp   = C2.through
end
}
\begin{center}
  \begin{tikzpicture}[scale =.6]
  \tkzGetNodes
  \tkzDrawLines(A,B M,N)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \end{tikzpicture}
\end{center}

\end{minipage}

\vspace{6pt}
Let's look at the case where the line $(MN)$ is parallel to the initial line.


\begin{minipage}{0.4\textwidth}
\begin{Verbatim}
  \directlua{
  init_elements ()
  z.A    = point : new ( 0  , 0  )
  z.B    = point : new ( 6  , 0  )
  z.M    = point : new ( 0  , 3 )
  z.N    = point : new ( 5  , 3 )
  L.AB   = line:new(z.A,z.B)
  C1,C2  = L.AB : c_l_pp(z.M,z.N)
  z.O1   = C1.center
  z.O2   = C2.center
  z.T1   = C1.through
  z.T2   = C2.through
  }
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments(A,B M,N)
  \tkzDrawCircles(O1,T1)
  \tkzDrawPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\directlua{
init_elements ()
z.A  = point : new (0 , 0 )
z.B  = point : new (6 , 0 )
z.M  = point : new (0 , 3 )
z.N  = point : new (5 , 3 )
L.AB = line:new(z.A,z.B)
C1,C2= L.AB : c_l_pp(z.M,z.N)
z.O1 = C1.center
z.O2 = C2.center
z.T1 = C1.through
z.T2 = C2.through
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawSegments(A,B M,N)
  \tkzDrawCircles(O1,T1)
  \tkzDrawPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \end{tikzpicture}
\end{center}

\end{minipage}


\vspace{6pt}
Where the line is perpendicular to the initial line.

\vspace{6pt}
\begin{minipage}{0.4\textwidth}
\begin{Verbatim}
\directlua{
init_elements ()
z.A   = point : new(0, 0 )
z.B   = point : new(6, 0 )
z.M   = point : new(1, 1 )
z.N   = point : new(1, 5 )
L.AB  = line:new(z.A,z.B)
C1,C2 = L.AB : c_l_pp(z.M,z.N)
z.O1  = C1.center
z.O2  = C2.center
z.T1  = C1.through
z.T2  = C2.through
}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\directlua{
init_elements ()
z.A    = point : new ( 0  , 0  )
z.B    = point : new ( 6  , 0  )
z.M    = point : new ( 1  , 1 )
z.N    = point : new ( 1  , 5 )
L.AB   = line:new(z.A,z.B)
C1,C2  = L.AB : c_l_pp(z.M,z.N)
z.O1   = C1.center
z.O2   = C2.center
z.T1   = C1.through
z.T2   = C2.through
}
\begin{center}
  \begin{tikzpicture}[scale = .75]
  \tkzGetNodes
  \tkzDrawLines(A,B M,N)
  \tkzDrawCircles(O1,T1 O2,T2)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N,O1,T1,O2,T2)
  \end{tikzpicture}
\end{center}

\end{minipage}

The last special case is when one of the points is on the initial line. In this case, there's only one solution.

\vspace{6pt}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
init_elements ()
z.A    = point : new ( 0  , 0  )
z.B    = point : new ( 5  , 0  )
z.M    = point : new ( 1 ,  0 )
z.N    = point : new ( 3  , 5 )
L.AB   = line:new(z.A,z.B)
L.MN   = line:new(z.M,z.N)
z.I    = intersection(L.AB,L.MN)
C1,C2  =  L.AB : c_l_pp(z.M,z.N)
z.O1   = C1.center
z.O2   = C2.center
z.T1   = C1.through
z.T2   = C2.through
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(A,B M,N)
\tkzDrawCircles(O1,T1 O2,T2)
\tkzDrawPoints(A,B,M,N)
\tkzLabelPoints(A,B,M,N)
\tkzDrawPoints(A,B,M,N,O1,T1,O2,T2)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
init_elements ()
z.A    = point : new ( 0  , 0  )
z.B    = point : new ( 5  , 0  )
z.M    = point : new ( 1 ,  0 )
z.N    = point : new ( 3  , 5 )
L.AB   = line:new(z.A,z.B)
L.MN   = line:new(z.M,z.N)
z.I    = intersection(L.AB,L.MN)
C1,C2  =  L.AB : c_l_pp(z.M,z.N)
z.O1   = C1.center
z.O2   = C2.center
z.T1   = C1.through
z.T2   = C2.through
}
\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawLines(A,B M,N)
  \tkzDrawCircles(O1,T1 O2,T2)
  \tkzDrawPoints(A,B,M,N)
  \tkzLabelPoints(A,B,M,N)
  \tkzDrawPoints(A,B,M,N,O1,T1,O2,T2)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection c_l_pp (end)

\subsubsection{Method \Imeth{line}{c\_ll\_p}} % (fold)
\label{ssub:method_c__ll__p}

Let's consider two straight lines $(AB)$ and $(AC)$ and a point $P$ not belonging to these lines.
Is there a circle through $P$ tangent to these two lines?

The following example shows that there are two solutions using the method linked to the line. A more natural method, linked to the $ABC$ triangle, can also be used.

\vspace{6pt}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
  init_elements()
  z.A   = point : new ( 0  , 0  )
  z.B   = point : new ( 6  , 0  )
  L.AB  = line : new ( z.A,z.B )
  z.C   = point : new ( 6 ,  4  )
  L.AC  = line : new ( z.A,z.C )
  T     = triangle : new (z.A,z.B,z.C)
  z.P = point : new ( 3 ,  1  )
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{tikzpicture}[scale =.75]
\tkzGetNodes
\tkzDrawLines[thick](A,B A,C)
 \tkzDrawCircles[red](O1,T1 O2,T2)
 \tkzDrawPoints(A,B,C,P)
 \tkzLabelPoints(A,B,C,P)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
init_elements()
  z.A   = point : new ( 0  , 0  )
  z.B   = point : new ( 6  , 0  )
  L.AB  = line : new ( z.A,z.B )
  z.C   = point : new ( 6 ,  4  )
  L.AC  = line : new ( z.A,z.C )
  T     = triangle : new (z.A,z.B,z.C)
  z.P = point : new ( 3 ,  1  )
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{center}
  \begin{tikzpicture}[ scale =.75]
  \tkzGetNodes
  \tkzDrawLines[thick](A,B A,C)
   \tkzDrawCircles[red](O1,T1 O2,T2)
   \tkzDrawPoints(A,B,C,P)
   \tkzLabelPoints(A,B,C,P)
  \end{tikzpicture}
\end{center}
\end{minipage}

\vspace{6pt}

The first special case is where the point $P$ lies on the bisector of $A$.

\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
init_elements()
  z.A   = point : new (0 , 0)
  z.B   = point : new (6 , 0)
  L.AB  = line : new ( z.A,z.B)
  z.C   = point : new ( 6 , 4)
  L.AC  = line : new ( z.A,z.C )
  T     = triangle : new (z.A,z.B,z.C)
  L.bi  = bisector(z.A,z.B,z.C)
  z.P   = L.bi :point (0.4)
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{tikzpicture}[scale =.75]
\tkzGetNodes
\tkzDrawLines(A,B A,C A,P)
 \tkzDrawCircles(O1,T1 O2,T2)
 \tkzDrawPoints(A,B,C,P)
 \tkzLabelPoints(A,B,C,P)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
init_elements()
  z.A   = point : new (0 , 0)
  z.B   = point : new (6 , 0)
  L.AB  = line : new ( z.A,z.B)
  z.C   = point : new ( 6 , 4)
  L.AC  = line : new ( z.A,z.C )
  T     = triangle : new (z.A,z.B,z.C)
  L.bi  = bisector(z.A,z.B,z.C)
  z.P   = L.bi :point (0.4)
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{center}
\begin{tikzpicture}[scale =.75]
 \tkzGetNodes
 \tkzDrawLines(A,B A,C A,P)
 \tkzDrawCircles(O1,T1 O2,T2)
 \tkzDrawPoints(A,B,C,P)
 \tkzLabelPoints(A,B,C,P)
\end{tikzpicture}
\end{center}
\end{minipage}


\vspace{6pt}
A first special case is when the point $P$ lies on one of the lines

\vspace{6pt}
\begin{minipage}{0.5\textwidth}
\begin{Verbatim}
\directlua{
init_elements()
  z.A   = point:new(0, 0)
  z.B   = point:new(6, 0)
  L.AB  = line:new(z.A,z.B)
  z.C   = point:new(6, 4)
  L.AC  = line:new(z.A,z.C)
  T     = triangle:new(z.A,z.B,z.C)
  z.P   = point:new(3, 2)
  L.bi  = bisector(z.A,z.B,z.C)
  z.I   = L.bi:point(0.4)
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{tikzpicture}[scale =.75]
\tkzGetNodes
\tkzDrawLines(A,B A,C A,I)
 \tkzDrawCircles(O1,T1 O2,T2)
 \tkzDrawPoints(A,B,C,P,I)
 \tkzLabelPoints(A,B,C,P,I)
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\directlua{
init_elements()
  z.A   = point : new ( 0  , 0  )
  z.B   = point : new ( 6  , 0  )
  L.AB  = line : new ( z.A,z.B )
  z.C   = point : new ( 6 ,  4  )
  L.AC  = line : new ( z.A,z.C )
  T     = triangle : new (z.A,z.B,z.C)
  z.P   = point : new ( 3 ,  2  )
  L.bi  = bisector(z.A,z.B,z.C)
  z.I   =   L.bi.pb
  C1,C2 = L.AB : c_ll_p (z.C,z.P)
  z.O1  = C1.center
  z.T1  = C1.through
  z.O2  = C2.center
  z.T2  = C2.through
}
\begin{center}
  \begin{tikzpicture}[scale = .75]
  \tkzGetNodes
  \tkzDrawLines(A,B A,C A,I)
   \tkzDrawCircles(O1,T1 O2,T2)
   \tkzDrawPoints(A,B,C,P,I)
   \tkzLabelPoints(A,B,C,P,I)
  \end{tikzpicture}
\end{center}
\end{minipage}

%subsubsection method_c__ll__p (end)
% subsection methods_from_class_line (end)
% section class_line (end)
\endinput
