\newpage
\section{Class \Iclass{square}} % (fold)

\subsection{Square attributes} % (fold)
\label{sub:square_attributes}

% subsection square_attributes (end)
Points are created in the direct direction. A test is performed to check whether the points form a square. Otherwise, compilation is blocked."
\begin{mybox}
Creation | S.AB = square : new (z.A,z.B,z.C,z.D)|
\end{mybox}

\bgroup
\catcode`_=12
\small
\captionof{table}{Square attributes.}\label{square:att}
\begin{tabular}{lll}
\toprule
\textbf{Attributes}        & \textbf{Application}  &  \\
\Iattr{square}{pa}         & |z.A = S.AB.pa|       &  \\
\Iattr{square}{pb}         & |z.B = S.AB.pb|       &  \\
\Iattr{square}{pc}         & |z.C = S.AB.pc|       &  \\
\Iattr{square}{pd}         & |z.D = S.AB.pd|       &  \\
\Iattr{square}{type}       & |S.AB.type= 'square'| &  \\
\Iattr{square}{side}       & |s = S.AB.center|     & s = length of side   \\
\Iattr{square}{center}     & |z.I = S.AB.center|   & center of the square \\
\Iattr{square}{circumradius}   & |S.AB.circumradius|       & radius of the circumscribed circle \\
\Iattr{square}{inradius}   & |S.AB.inxradius|      & radius of the inscribed circle   \\
\Iattr{square}{proj}       & |S.AB.proj|           & projection of the center on one side \\
\Iattr{square}{ab}         & |S.AB.ab|             &  line passing through two vertices   \\
\Iattr{square}{ac}         & |S.AB.ca|             &  idem. \\
\Iattr{square}{ad}         & |S.AB.ad|             &  idem. \\
\Iattr{square}{bc}         & |S.AB.bc|             &  idem. \\
\Iattr{square}{bd}         & |S.AB.bd|             &  idem. \\
\Iattr{square}{cd}         & |S.AB.cd|             &  idem. \\
\bottomrule %
\end{tabular}
\egroup
\subsubsection{Example: square attributes } % (fold)
\label{ssub:example_square_attributes}

\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 ( 4 , 4)
z.D        = point  : new ( 0 , 4)
S.new      = square : new ( z.A , z.B ,z.C,z.D)
z.I        = S.new.center
z.H        = S.new.proj
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawCircles[orange](I,A I,H)
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C,D,H,I)
\tkzLabelPoints(A,B,H,I)
\tkzLabelPoints[above](C,D)
\tkzDrawSegments(I,B I,H)
\tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.circumradius}}}
\tkzLabelSegment[sloped](I,H){\pmpn{\tkzUseLua{S.new.inradius}}}
\tkzLabelSegment[sloped](D,C){\pmpn{\tkzUseLua{S.new.side}}}
\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 ( 4 , 4)
   z.D        = point  : new ( 0 , 4)
   S.new      = square : new ( z.A , z.B ,z.C,z.D)
   z.I        = S.new.center
   z.H        = S.new.proj
   }

   \begin{center}
     \begin{tikzpicture}
     \tkzGetNodes
     \tkzDrawCircles[orange](I,A I,H)
     \tkzDrawPolygon(A,B,C,D)
     \tkzDrawPoints(A,B,C,D,H,I)
     \tkzLabelPoints(A,B,H,I)
     \tkzLabelPoints[above](C,D)
     \tkzDrawSegments(I,B I,H)
     \tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.circumradius}}}
     \tkzLabelSegment[sloped](I,H){\pmpn{\tkzUseLua{S.new.inradius}}}
     \tkzLabelSegment[sloped](D,C){\pmpn{\tkzUseLua{S.new.side}}}
     \end{tikzpicture}
   \end{center}

\end{minipage}


\newpage

\subsection{Square methods} % (fold)
\label{sub:square_methods}

\bgroup
\catcode`_=12
\small
\captionof{table}{Square methods.}\label{square:met}
\begin{tabular}{lll}
\toprule
\textbf{Methods} & \textbf{Comments}&    \\
\midrule  
\Imeth{square}{rotation (zi,za)} &|S.IA = square : rotation (z.I,z.A)| &$I$ square center $A$ first vertex\\
\midrule 
\Imeth{square}{side (za,zb)} & |S.AB = square : side (z.A,z.B)|& AB is the first side (direct)\\
\bottomrule %
\end{tabular}
\egroup

\subsubsection{Square with side method} % (fold)
\label{ssub:square_with_side_method}
%
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
   init_elements ()
   z.A         = point : new ( 0 , 0 )
   z.B         = point : new ( 2 , 1 )
   S.side      = square : side (z.A,z.B)
   z.B         = S.side.pb
   z.C         = S.side.pc
   z.D         = S.side.pd
   z.I         = S.side.center
}

\begin{tikzpicture}[scale = 2]
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C,D)
   \tkzDrawPoints(A,B,C,D)
   \tkzLabelPoints(A,B)
   \tkzLabelPoints[above](C,D)
   \tkzDrawPoints[red](I)
\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 )
S.side      = square : side (z.A,z.B)
z.B         = S.side.pb
z.C         = S.side.pc
z.D         = S.side.pd
z.I         = S.side.center
}

\begin{center}
  \begin{tikzpicture}[scale = 2]
  \tkzGetNodes
  \tkzDrawPolygon(A,B,C,D)
  \tkzDrawPoints(A,B,C,D)
  \tkzLabelPoints(A,B)
  \tkzLabelPoints[above](C,D)
  \tkzDrawPoints[red](I)
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection square_with_side_method (end)

% subsubsection example_square_attributes (end)

% subsection square_methods (end)