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

\subsection{Parallelogram attributes} % (fold)
\label{sub:parallelogram_attributes}

% subsection square_attributes (end)
Points are created in the direct direction. A test is performed to check whether the points form a parallelogram, otherwise compilation is blocked.

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

\bgroup
\catcode`_=12
\small
\captionof{table}{Parallelogram attributes.}\label{parallelogram:att}
\begin{tabular}{lll}
\toprule
\textbf{Attributes}        & \textbf{Application}  &  \\
\Iattr{parallelogram}{pa}   & |z.A = P.new.pa|     &  \\
\Iattr{parallelogram}{pb}   & |z.B = P.new.pb|     &  \\
\Iattr{parallelogram}{pc}   & |z.C = P.new.pc|     &  \\
\Iattr{parallelogram}{pd}   & |z.D = P.new.pd|     &  \\
\Iattr{parallelogram}{type} & |P.new.type= 'parallelogram'|&  \\
\Iattr{parallelogram}{i}    & |z.I = P.new.i|  & intersection of diagonals \\
\Iattr{parallelogram}{ab}   & |P.new.ab|    &  line passing through two vertices \\
\Iattr{parallelogram}{ac}   & |P.new.ca|           &  idem. \\
\Iattr{parallelogram}{ad}   & |P.new.ad|           &  idem. \\
\Iattr{parallelogram}{bc}   & |P.new.bc|           &  idem. \\
\Iattr{parallelogram}{bd}   & |P.new.bd|           &  idem. \\
\Iattr{parallelogram}{cd}   & |P.new.cd|           &  idem. \\
\bottomrule %
\end{tabular}
\egroup
\subsubsection{Example: attributes } % (fold)
\label{ssub:example_attributes}

% subsubsection example_attributes (end)
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.A         = point : new ( 0 , 0 )
z.B         = point : new ( 4 , 1 )
z.C         = point : new ( 7 , 5 )
z.D         = point : new ( 3 , 4 )
P.new       = parallelogram : new (z.A,z.B,z.C,z.D)
z.B         = P.new.pb
z.C         = P.new.pc
z.D         = P.new.pd
z.I         = P.new.center
}
\begin{tikzpicture}
\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 ( 4 , 1 )
z.C         = point : new ( 7 , 5 )
z.D         = point : new ( 3 , 4 )
P.new       = parallelogram : new (z.A,z.B,z.C,z.D)
z.B         = P.new.pb
z.C         = P.new.pc
z.D         = P.new.pd
z.I         = P.new.center
}

\begin{center}
  \begin{tikzpicture}
  \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}


\newpage

\subsection{Parallelogram methods} % (fold)
\label{sub:parallelogram_methods}

% subsection parallelogram_methods (end)
\bgroup
\catcode`_=12
\small
\captionof{table}{Parallelogram methods.}\label{parallelogram:met}
\begin{tabular}{ll}
\toprule
\textbf{Methods} & \textbf{Comments}    \\
\midrule   \\
\Imeth{parallelogram}{fourth (za,zb,zc)} & completes a triangle by parallelogram (Refer to next example)\\
\bottomrule %
\end{tabular}
\egroup

\subsubsection{Parallelogram with fourth method} % (fold)
\label{ssub:parallelogram_with_fourth_method}

% subsubsection parallelogram_with_fourth_method (end)
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.A      = point : new ( 0 , 0 )
z.B      = point : new ( 3 , 1 )
z.C      = point : new ( 4 , 3 )
P.four   = parallelogram : fourth (z.A,z.B,z.C)
z.D      = P.four.pd
z.I      = P.four.center
}
\begin{tikzpicture}[ scale = .75]
\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 ( 3 , 1 )
z.C      = point : new ( 4 , 3 )
P.four   = parallelogram : fourth (z.A,z.B,z.C)
z.D      = P.four.pd
z.I      = P.four.center
}

\begin{center}
  \begin{tikzpicture}[scale = .75]
  \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 parallelogram_with_side_method (end)
