<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\newpage
\section{Class \Iclass{rectangle}} % (fold)

\subsection{Rectangle attributes} % (fold)
\label{sub:rectangle_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 | R.ABCD = rectangle : new (z.A,z.B,z.C,z.D)|
\end{mybox}

\bgroup
\catcode`_=12
\small
\captionof{table}{rectangle attributes.}\label{rectangle:att}
\begin{tabular}{lll}
\toprule
\textbf{Attributes}       &amp; \textbf{Application} &amp; \\
\Iattr{rectangle}{pa}     &amp; |z.A = R.ABCD.pa| &amp; \\
\Iattr{rectangle}{pb}     &amp; |z.B = R.ABCD.pb| &amp; \\
\Iattr{rectangle}{pc}     &amp; |z.C = R.ABCD.pc| &amp; \\
\Iattr{rectangle}{pd}     &amp; |z.D = R.ABCD.pd| &amp; \\
\Iattr{rectangle}{type}   &amp;  |R.ABCD.type= 'rectangle'|  &amp;\\
\Iattr{rectangle}{center} &amp; |z.I = R.ABCD.center| &amp; center of the rectangle\\
\Iattr{rectangle}{length} &amp;  |R.ABCD.length| &amp; the length \\
\Iattr{rectangle}{width}  &amp;  |R.ABCD.width| &amp; the width \\
\Iattr{rectangle}{diagonal}  &amp;  |R.ABCD.diagonal| &amp; diagonal length\\
\Iattr{rectangle}{ab}     &amp;  |R.ABCD.ab|   &amp;  line passing through two vertices   \\
\Iattr{rectangle}{ac}     &amp;  |R.ABCD.ca|   &amp;  idem. \\
\Iattr{rectangle}{ad}     &amp;  |R.ABCD.ad|   &amp;  idem. \\
\Iattr{rectangle}{bc}     &amp;  |R.ABCD.bc|   &amp;  idem. \\
\Iattr{rectangle}{bd}     &amp;  |R.ABCD.bd|   &amp;  idem. \\
\Iattr{rectangle}{cd}     &amp;  |R.ABCD.cd|   &amp;  idem. \\
\bottomrule
\end{tabular}
\egroup

\subsubsection{Example} % (fold)
\label{ssub:example}
\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)
R.new = rectangle : new (z.A,z.B,z.C,z.D)
z.I   = R.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}
\hspace{\fill}\begin{minipage}{.5\textwidth}
\directlua{%
   init_elements()
   z.A   = point : new ( 0 , 0 )
   z.B   = point : new ( 4 , 0 )
   z.C   = point  : new ( 4 , 2)
   z.D   = point  : new ( 0 , 2)
   R.new = rectangle : new (z.A,z.B,z.C,z.D)
   z.I   = R.new.center
}

   \begin{tikzpicture}[scale =1.5]
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C,D)
   \tkzDrawSegment[dashed](A,C)
   \tkzDrawPoints(A,B,C,D)
   \tkzLabelPoints(A,B)
   \tkzLabelPoints[above](C,D)
   \tkzDrawPoints[red](I)
   \tkzLabelPoint[right = 10pt](I){$I$\\ |R.new.center|}
   \tkzLabelSegment[sloped,above](C,D){|R.new.length| = \pmpn{\tkzUseLua{R.new.length}}}
   \tkzLabelSegment[sloped,above](A,C){|R.new.diagonal| = \pmpn{\tkzUseLua{R.new.diagonal}}}
   % \tkzUseLua{R.new.length} and \tkzUseLua{R.new.diagonal} to get the values.
\end{tikzpicture}
\end{minipage}
% subsubsection example (end)
% subsection rectangle_attributes (end)

\newpage
\subsection{Rectangle methods} % (fold)
\label{sub:rectangle_methods}

\bgroup
\catcode`_=12
\small
\captionof{table}{Rectangle methods.}\label{rectangle:met}
\begin{tabular}{lll}
\toprule
\textbf{Methods} &amp; \textbf{Comments}  &amp;  \\
\midrule  
\Imeth{rectangle}{angle (zi,za,angle)} &amp;|R.ang = rectangle : angle (z.I,z.A)| ; |z.A | &amp;vertex ; ang angle between 2 vertices\\
\midrule 
\Imeth{rectangle}{gold (za,zb)} &amp; |R.gold = rectangle : gold (z.A,z.B)| &amp;length/width = $\phi$\\
\midrule  
\Imeth{rectangle}{diagonal (za,zc)} &amp;|R.diag = rectangle : diagonal (z.I,z.A)| &amp;$I$ square center $A$ first vertex\\
\midrule  
\Imeth{rectangle}{side (za,zb,d)} &amp;|S.IA = rectangle : side (z.I,z.A)|&amp; $I$ square center $A$ first vertex\\
\midrule  
\Imeth{rectangle}{get\_lengths ()} &amp;|S.IA = rectangle : get_lengths ()|&amp; $I$ square center $A$ first vertex\\
\bottomrule %
\end{tabular}
\egroup

\subsubsection{Angle method} % (fold)
\label{ssub:angle_method}

\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.A     = point : new ( 0 , 0 )
z.B     = point : new ( 4 , 0 )
z.I     = point : new ( 4 , 3 )
P.ABCD  = rectangle : angle ( z.I , z.A , math.pi/6)
z.B     = P.ABCD.pb
z.C     = P.ABCD.pc
z.D     = P.ABCD.pd
}

\begin{tikzpicture}[scale   = .5]
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B,C,D)
\tkzDrawPoints[new](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 , 0 )
z.I     = point : new ( 4 , 3 )
P.ABCD  = rectangle : angle ( z.I , z.A , math.pi/6)
z.B     = P.ABCD.pb
z.C     = P.ABCD.pc
z.D     = P.ABCD.pd
}
\begin{tikzpicture}[scale  = .5]
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B)
\tkzLabelPoints[above](C,D)
\tkzDrawPoints[new](I)
\tkzLabelSegment[sloped,above](A,B){|rectangle: angle (z.C,z.A,math.pi/6)|}
\end{tikzpicture}
\end{minipage}
% subsubsection angle_method (end)

\subsubsection{Side method} % (fold)
\label{ssub:side_method}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.A    = point : new ( 0 , 0 )
z.B    = point : new ( 4 , 3 )
R.side = rectangle : side (z.A,z.B,3)
z.C    = R.side.pc
z.D    = R.side.pd
z.I    = R.side.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 , 3 )
R.side = rectangle : side (z.A,z.B,3)
z.C    = R.side.pc
z.D    = R.side.pd
z.I    = R.side.center
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B)
\tkzLabelPoints[above](C,D)
\tkzDrawPoints[red](I)
\tkzLabelSegment[sloped,above](A,B){|rectangle : side (z.A,z.B,3)|}
\end{tikzpicture}
\end{minipage}
% subsubsection side_method (end)

\subsubsection{Diagonal method} % (fold)
\label{ssub:diagonal_method}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.A         = point : new ( 0 , 0 )
z.C         = point : new ( 4 , 3 )
R.diag      = rectangle : diagonal (z.A,z.C)
z.B         = R.diag.pb
z.D         = R.diag.pd
z.I         = R.diag.center
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B)
\tkzLabelPoints[above](C,D)
\tkzDrawPoints[red](I)
\tkzLabelSegment[sloped,above](A,B){|rectangle : diagonal (z.A,z.C)|}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements()
z.A         = point : new ( 0 , 0 )
z.C         = point : new ( 4 , 3 )
R.diag      = rectangle : diagonal (z.A,z.C)
z.B         = R.diag.pb
z.D         = R.diag.pd
z.I         = R.diag.center
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B)
\tkzLabelPoints[above](C,D)
\tkzDrawPoints[red](I)
\tkzLabelSegment[sloped,above](A,B){|rectangle : diagonal (z.A,z.C)|}
\end{tikzpicture}
\end{minipage}
% subsubsection diagonal_method (end)

\subsubsection{Gold method} % (fold)
\label{ssub:gold_method}
\begin{minipage}{.5\textwidth}
\begin{Verbatim}
\directlua{%
init_elements()
z.X    = point : new ( 0 , 0 )
z.Y    = point : new ( 4 , 2 )
R.gold = rectangle : gold (z.X,z.Y)
z.Z    = R.gold.pc
z.W    = R.gold.pd
z.I    = R.gold.center
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(X,Y,Z,W)
\tkzDrawPoints(X,Y,Z,W)
\tkzLabelPoints(X,Y)
\tkzLabelPoints[above](Z,W)
\tkzDrawPoints[red](I)
\tkzLabelSegment[sloped,above](X,Y){rectangle :  gold (z.X,z.Y)}
\end{tikzpicture}
\end{Verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\directlua{%
init_elements()
z.X    = point : new ( 0 , 0 )
z.Y    = point : new ( 4 , 2 )
R.gold = rectangle : gold (z.X,z.Y)
z.Z    = R.gold.pc
z.W    = R.gold.pd
z.I    = R.gold.center
}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(X,Y,Z,W)
\tkzDrawPoints(X,Y,Z,W)
\tkzLabelPoints(X,Y)
\tkzLabelPoints[above](Z,W)
\tkzDrawPoints[red](I)
\tkzLabelSegment[sloped,above](X,Y){rectangle :  gold (z.X,z.Y)}
\end{tikzpicture}
\end{minipage}
% subsubsection gold_method (end)
% subsection rectangle_methods (end)</pre></body></html>