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

\subsection{Quadrilateral Attributes} % (fold)
\label{sub:quadrilateral_attributes}

Points are created in the direct direction. A test is performed to check whether the points form a rectangle, otherwise compilation is blocked.

\begin{mybox}
Creation | Q.new = rectangle : new (z.A,z.B,z.C,z.D)|
\end{mybox}

\bgroup
\catcode`_=12
\small
\captionof{table}{rectangle attributes.}\label{quadrilateral:att}
\begin{tabular}{lll}
\toprule
\textbf{Attributes}         & \textbf{Application} & \\
\Iattr{quadrilateral}{pa}   & |z.A = Q.new.pa| & \\
\Iattr{quadrilateral}{pb}   & |z.B = Q.new.pb| & \\
\Iattr{quadrilateral}{pc}   & |z.C = Q.new.pc| & \\
\Iattr{quadrilateral}{pd}   & |z.D = Q.new.pd| & \\
\Iattr{quadrilateral}{type} & |Q.new.type= 'quadrilateral'|  &\\
\Iattr{quadrilateral}{i}    & |z.I = Q.new.i| & intersection of diagonals\\
\Iattr{quadrilateral}{g}    & |z.G = Q.new.g| & barycenter\\
\Iattr{quadrilateral}{a}    & |AB = Q.new.a| & barycenter\\
\Iattr{quadrilateral}{b}    & |BC = Q.new.b| & barycenter\\
\Iattr{quadrilateral}{c}    & |CD = Q.new.c| & barycenter\\
\Iattr{quadrilateral}{d}    & |DA = Q.new.d| & barycenter\\
\Iattr{quadrilateral}{ab}   & |Q.new.ab|   &  line passing through two vertices   \\
\Iattr{quadrilateral}{ac}   & |Q.new.ca|   &  idem. \\
\Iattr{quadrilateral}{ad}   & |Q.new.ad|   &  idem. \\
\Iattr{quadrilateral}{bc}   & |Q.new.bc|   &  idem. \\
\Iattr{quadrilateral}{bd}   & |Q.new.bd|   &  idem. \\
\Iattr{quadrilateral}{cd}   & |Q.new.cd|   &  idem. \\
\bottomrule                      
\end{tabular}
\egroup

\subsubsection{Quadrilateral attributes} % (fold)
\label{ssub:quadrilateral_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 ( 5 , 1 )
z.D    = point : new ( 0 , 3 )
Q.ABCD = quadrilateral : new (z.A, z.B, z.C, z.D)
z.I    = Q.ABCD.i
z.G    = Q.ABCD.g
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawSegments(A,C B,D)
\tkzDrawPoints(A,B,C,D,I,G)
\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 ( 5 , 1 )
z.D      = point : new ( 0 , 3 )
Q.ABCD   = quadrilateral : new ( z.A , z.B , z.C , z.D )
z.I      = Q.ABCD.i
z.G      = Q.ABCD.g
}

\begin{center}
  \begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawPolygon(A,B,C,D)
  \tkzDrawSegments(A,C B,D)
  \tkzDrawPoints(A,B,C,D,I,G)
  \end{tikzpicture}
\end{center}

\end{minipage}

% subsubsection quadrilateral_attributes (end)
% subsection quadrilateral_attributes (end)

\subsection{Quadrilateral methods} % (fold)
\label{sub:quadrilateral_methods}

\bgroup
\catcode`_=12
\small
\captionof{table}{Quadrilateral methods.}\label{quadrilateral:met}
\begin{tabular}{ll}
\toprule
\textbf{Methods} & \textbf{Comments}    \\
\midrule   \\
\Imeth{quadrilateral}{iscyclic ()} & inscribed ? (Refer to next example)\\
\bottomrule %
\end{tabular}
\egroup

\subsubsection{Inscribed quadrilateral} % (fold)
\label{ssub:inscribed_quadrilateral}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements ()
z.A      = point : new ( 0 , 0 )
z.B      = point : new ( 4 , 0 )
z.D      = point : polar ( 4 , 2*math.pi/3 )
L.DB     = line : new (z.D,z.B)
T.equ    = L.DB : equilateral ()
z.C      = T.equ.pc
Q.new    = quadrilateral : new(z.A,z.B,z.C,z.D)
bool     = Q.new : iscyclic ()
if bool == true then 
C.cir    = triangle : new(z.A,z.B,z.C)
: circum_circle()
z.O      = C.cir.center
end
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B,C,D)
\tkzDrawCircle(O,A)
\ifthenelse{\equal{\tkzUseLua{bool}}{true}}{
\tkzDrawCircle(O,A)}{}
\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.D      = point : polar ( 4 , 2*math.pi/3 )
L.DB     = line : new (z.D,z.B)
T.equ    = L.DB : equilateral ()
z.C      = T.equ.pc
Q.new    = quadrilateral : new (z.A,z.B,z.C,z.D)
bool     = Q.new : iscyclic ()
if bool == true then 
C.cir    = triangle : new (z.A,z.B,z.C): circum_circle ()
z.O      = C.cir.center
end
}
\begin{center}
  \begin{tikzpicture}[scale = .75 ]
  \tkzGetNodes
  \tkzDrawPolygon(A,B,C,D)
  \tkzDrawPoints(A,B,C,D)
  \tkzLabelPoints(A,B,C,D)
  \tkzDrawCircle(O,A)
  \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{
  \tkzDrawCircle(O,A)}{}
  \end{tikzpicture}
\end{center}

\end{minipage}
% subsubsection inscribed_quadrilateral (end)


% subsection quadrilateral_methods (end)