\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} & \textbf{Application} & \\ \Iattr{rectangle}{pa} & |z.A = R.ABCD.pa| & \\ \Iattr{rectangle}{pb} & |z.B = R.ABCD.pb| & \\ \Iattr{rectangle}{pc} & |z.C = R.ABCD.pc| & \\ \Iattr{rectangle}{pd} & |z.D = R.ABCD.pd| & \\ \Iattr{rectangle}{type} & |R.ABCD.type= 'rectangle'| &\\ \Iattr{rectangle}{center} & |z.I = R.ABCD.center| & center of the rectangle\\ \Iattr{rectangle}{length} & |R.ABCD.length| & the length \\ \Iattr{rectangle}{width} & |R.ABCD.width| & the width \\ \Iattr{rectangle}{diagonal} & |R.ABCD.diagonal| & diagonal length\\ \Iattr{rectangle}{ab} & |R.ABCD.ab| & line passing through two vertices \\ \Iattr{rectangle}{ac} & |R.ABCD.ca| & idem. \\ \Iattr{rectangle}{ad} & |R.ABCD.ad| & idem. \\ \Iattr{rectangle}{bc} & |R.ABCD.bc| & idem. \\ \Iattr{rectangle}{bd} & |R.ABCD.bd| & idem. \\ \Iattr{rectangle}{cd} & |R.ABCD.cd| & idem. \\ \bottomrule \end{tabular} \egroup \subsubsection{Example} % (fold) \label{ssub:example} \begin{minipage}{.5\textwidth} \begin{Verbatim} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} scale =1.5 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 \end{tkzelements} \begin{tikzpicture} \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} & \textbf{Comments} & \\ \midrule \Imeth{rectangle}{angle (zi,za,angle)} &|R.ang = rectangle : angle (z.I,z.A)| ; |z.A | &vertex ; ang angle between 2 vertices\\ \midrule \Imeth{rectangle}{gold (za,zb)} & |R.gold = rectangle : gold (z.A,z.B)| &length/width = $\phi$\\ \midrule \Imeth{rectangle}{diagonal (za,zc)} &|R.diag = rectangle : diagonal (z.I,z.A)| &$I$ square center $A$ first vertex\\ \midrule \Imeth{rectangle}{side (za,zb,d)} &|S.IA = rectangle : side (z.I,z.A)|& $I$ square center $A$ first vertex\\ \midrule \Imeth{rectangle}{get\_lengths ()} &|S.IA = rectangle : get_lengths ()|& $I$ square center $A$ first vertex\\ \bottomrule % \end{tabular} \egroup \subsubsection{Angle method} % (fold) \label{ssub:angle_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} \begin{tkzelements} scale = .5 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 \end{tkzelements} \begin{tikzpicture} \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} \begin{tkzelements} scale = .5 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 \end{tkzelements} \begin{tikzpicture} \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} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} 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 \end{tkzelements} \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} \begin{tkzelements} 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 \end{tkzelements} \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)