\newpage

\section{Class \Iclass{point}} % (fold)
\label{sec:class_point}

The class on which the whole edifice rests,  it's the class \Iclass{point}. This class is hybrid in the sense that it is as much about points of a plane as complex numbers. The principle is the following: the plane is provided with an orthonormal basis which allows us to determine the placement of a point using its abscissa and ordinate coordinates; in the same way any complex number can simply be considered as a pair of real numbers (its real part and its imaginary part). We can then designate the plane as the complex plane, and the complex number $x+iy$ is represented by the point of the plane with coordinates $(x,y)$. Thus the point $A$ will have coordinates stored in the object $z.A$. Coordinates are attributes of the "point" object, like type, argument and modulus.



The creation of a point is done using the following method, but there are other possibilities. If a scaling factor has been given, the method takes it into account.

   \def\size{42mm}
\begin{tikzpicture}[remember picture]
\node[ draw, fill=red!10] (tbl) {%
 \centering
\begin{minipage}{\size}

   \hspace{\fill} \texttt{Arguments}\hspace{\fill}
       
       \tikz\node[minimum width=\size,font=\small,
    draw, fill=cyan!10,
    rectangle split, rectangle split parts=5
  ] {
    \texttt{re (real)}
    \nodepart{two}\texttt{im (real)}
    \nodepart{three}\texttt{type = 'point'}
    \nodepart{four}\texttt{argument (rad)}
     \nodepart{five}\texttt{modulus (cm)}
  };
  
    \hspace{\fill}  \texttt{Methods}\hspace{\fill}
    
        \tikz\node[minimum width=\size,font=\small,
    draw, fill=orange!20,sharp corners,
    rectangle split, rectangle split parts=4
  ] {
   \texttt{homothety(coeff,obj)}
    \nodepart{two}\texttt{rotation (angle,object)}
    \nodepart{three}\texttt{symmetry (object)}
    \nodepart{four}\texttt{\ldots}
  };
\end{minipage}};
 \node[ draw, fill=red!10,,minimum height = 2em,
  rounded corners,anchor=south] (tc) at (tbl.north){Class |Point|};
\end{tikzpicture}
\hspace{5cm}\begin{tikzpicture}[remember picture]
   \node[ draw, fill=red!10] (tbl) {%
 \centering
\begin{minipage}{\size}
   \hspace{\fill}    \texttt{Arguments}\hspace{\fill}
       
        \tikz\node[minimum width=\size,font=\small,
    draw, fill=cyan!10,
    rectangle split, rectangle split parts=5
  ] {
    \texttt{re = 1}
    \nodepart{two}\texttt{im = 2}
    \nodepart{three}\texttt{type = 'point'}
    \nodepart{four}\texttt{argument = atan(2)}
     \nodepart{five}\texttt{modulus = $\sqrt{5}$}
  };
  
    \hspace{\fill}  \texttt{Methods}\hspace{\fill}
    
        \tikz\node[minimum width=\size,font=\small,
    draw, fill=orange!20,sharp corners,
    rectangle split, rectangle split parts=4
  ] {
   \texttt{homothety(coeff,obj)}
    \nodepart{two}\texttt{rotation (angle,object)}
    \nodepart{three}\texttt{symmetry (object)}
    \nodepart{four}\texttt{\ldots}
  };
\end{minipage}
     };
 \node[ draw, fill=red!10,remember picture,minimum height = 2em,
  rounded corners,anchor=south] (to) at (tbl.north){object |z.A|};
\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
\draw [thick,->](tc.east) -- (to.west);
\end{tikzpicture}

\subsection{Attributes of a point} % (fold)
\label{sub:attributes_of_a_point}
% Method \Imeth{point}{new}

\begin{mybox}
   Creation |z.A = point: new (1,2) |
\end{mybox}
 The point $A$ has coordinates $x=1$ and $y=2$. If you use the notation |z.A| then $A$ will be the reference of a node in \TIKZ\ or in \pkg{tkz-euclide}.

This is the creation of a fixed point with coordinates 1 and 2 and which is named $A$. The notation |z.A| indicates that the coordinates will be stored in a table noted |z| (reference to the notation of the affixes of the complex numbers) that A is the name of the point and the key allowing access to the values. 


\vspace{1em}
\bgroup
\small
\catcode`_=12
\captionof{table}{Point attributes.}
\begin{tabular}{lll}
\toprule
\textbf{Attributes}  & \textbf{Application}\\
\Iattr{point}{re}    &  |z.A.re|   &\tkzar |z.A = point:new (1,2) x = z.A.re|=1\\
\Iattr{point}{im}    &  |z.A.im|   &\tkzar |z.A = point:new (1,2) y= z.A.im|=2\\
\Iattr{point}{type}  &  |z.A.type| &\tkzar |z.A.type = 'point'|\\  
\Iattr{point}{argument} &  |z.A.argument| &\tkzar |z.A.argument $\approx$ 0.78539816339745|\\
\Iattr{point}{module}   &  |z.A.module|   &\tkzar |z.A.module| $\approx$ |2.2360...| =$\sqrt{5}$\\
\bottomrule
\end{tabular}
\egroup

\newpage
\subsubsection{Example:point attributes} % (fold)
\label{ssub:example_point_attributes}

\begin{tkzelements}
   z.M = point: new (1,2)
\end{tkzelements}
\hspace*{\fill}


\begin{verbatim}
\begin{tkzelements}
   z.M = point: new (1,2)
\end{tkzelements}
\end{verbatim}
\pgfkeys{/pgf/number format/.cd,std,precision=2}
\let\pmpn\pgfmathprintnumber  
\DeleteShortVerb{\|}

\begin{verbatim}
\begin{tikzpicture}[scale = 1]
\pgfkeys{/pgf/number format/.cd,std,precision=2}
\let\pmpn\pgfmathprintnumber 
\tkzDefPoints{2/4/M,2/0/A,0/0/O,0/4/B}
\tkzLabelPoints(O)
\tkzMarkAngle[fill=gray!30,size=1](A,O,M)
\tkzLabelAngle[pos=1,right](A,O,M){%
$\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad}
\tkzDrawSegments(O,M)
\tkzLabelSegment[above,sloped](O,M){%
$|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm}
\tkzLabelPoint[right](M){$M : z_M = 1 + 2i$}
\tkzDrawPoints(M,A,O,B)
\tkzPointShowCoord(M)
\tkzLabelPoint[below,teal](A){$\tkzUseLua{z.M.re}$}
\tkzLabelPoint[left,teal](B){$\tkzUseLua{z.M.im}$}
\tkzDrawSegments[->,add = 0 and 0.25](O,B O,A)
\end{tikzpicture}
\end{verbatim}


\begin{center}
   \begin{tikzpicture}
   \pgfkeys{/pgf/number format/.cd,std,precision=2}
   \let\pmpn\pgfmathprintnumber 
   \tkzDefPoints{2/4/M,2/0/A,0/0/O,0/4/B}
   \tkzLabelPoints(O)
   \tkzMarkAngle[fill=gray!30,size=1](A,O,M)
   \tkzLabelAngle[pos=1,right](A,O,M){%
   $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad}
   \tkzDrawSegments(O,M)
   \tkzLabelSegment[above,sloped](O,M){%
   $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm}
   \tkzLabelPoint[right](M){$M : z_M = 1 + 2i$}
   \tkzDrawPoints(M,A,O,B)
   \tkzPointShowCoord(M)
   \tkzLabelPoint[below,teal](A){$\tkzUseLua{z.M.re}$}
   \tkzLabelPoint[left,teal](B){$\tkzUseLua{z.M.im}$}
   \tkzDrawSegments[->,add = 0 and 0.25](O,B O,A)
   \begin{scope}[every annotation/.style={fill=lightgray!15,anchor = east}]
   \node [annotation,font =\small,text width=6cm] at (current bounding box.west) {
Attributes of \texttt{z.M}
   \begin{itemize} 
   \item \texttt{z.M.re} = 1
   \item \texttt{z.M.im} = 2
   \item \texttt{z.M.type} = 'point'
   \item \texttt{z.M.argument} = $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad
   \item \texttt{z.M.modulus} = $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm
   \end{itemize}
       };
   \end{scope}
   \end{tikzpicture}
\end{center}

\MakeShortVerb{\|}
    \hspace*{\fill}
 %  \caption{Class Point}
% subsubsection example_point_attributes (end)
% subsection attributes_of_a_point (end)

\subsubsection{Argand diagram} % (fold)
\label{ssub:argand_diagram}
\normalsize	
\begin{minipage}{\textwidth}
   \begin{verbatim}
   \begin{tkzelements}
      z.A = point : new ( 2 , 3 )
      z.O = point : new ( 0 , 0 ) 
      z.I = point : new ( 1 , 0 ) 
   \end{tkzelements}
   \hspace{\fill}\begin{tikzpicture}
      \tkzGetNodes
      \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4]
      \tkzDrawCircle[dashed,red](O,A)
      \tkzPointShowCoord(A)
      \tkzDrawPoint(A)
      \tkzLabelPoint[above right](A){\normalsize $a+ib$}
      \tkzDrawX\tkzDrawY
      \tkzDrawSegment(O,A)
      \tkzLabelSegment[above,anchor=south,sloped](O,A){ OA = modulus of $z_A$}
     \tkzLabelAngle[anchor=west,pos=.5](I,O,A){$\theta$ = argument of $z_A$}
   \end{tikzpicture}
   \end{verbatim}
\end{minipage}

\begin{minipage}{\textwidth}
   \begin{tkzelements}
      z.A = point : new ( 2 , 3 )
      z.O = point : new ( 0 , 0 ) 
      z.I = point : new ( 1 , 0 ) 
   \end{tkzelements}
   \hspace{\fill}\begin{tikzpicture}
      \tkzGetNodes
      \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4]
      \tkzDrawCircle[dashed,red](O,A)
      \tkzPointShowCoord(A)
      \tkzDrawPoint(A)
      \tkzLabelPoint[above right](A){\normalsize $a+ib$}
      \tkzDrawX\tkzDrawY
      \tkzDrawSegment(O,A)
      \tkzLabelSegment[above,anchor=south,sloped](O,A){ OA = modulus of $z_A$}
     \tkzLabelAngle[anchor=west,pos=.5](I,O,A){$\theta$ = argument of $z_A$}
   \end{tikzpicture}
   \hspace{\fill}
\end{minipage}


% subsubsection argand_diagram (end)
\newpage
\subsection{Methods of the class point} % (fold)
\label{sub:methods_of_the_class_point}

The methods described in the following table are standard. You'll find them in most of the examples at the end of this documentation. The result of the different methods presented in the following table is a \tkzNameObj{point}. 

\vspace{1em}
\bgroup
\catcode`_=12
\small
\captionof{table}{Methods of the class point.}
\begin{tabular}{lll}   
\toprule   
\textbf{Methods} & \textbf{Application}& \\  
\midrule
 new (a,b)    & |z.a = point : new(1,2)| &\tkzar  affix z.a=1+2i \\
 polar (radius, phi)  & |z.a = point : polar(1,math.pi/3)| &\tkzar  affix $cos(\pi/3)+sin(\pi/3)i$ \\
 polar_deg (radius, phi) &    phi in deg    &\tkzar  polar coordinates phi deg \\
\midrule 
 \textbf{Points} &&\\
\midrule 
 north(d) & see \ref{sub:power_v2}    |d| distance to the point & d=1 1 if empty  \\
 south(d) &   \\
 east(d)  &   \\
 west(d)  &   \\
 normalize() &  |z.b = z.a: normalize ()| &\tkzar  |z.b| = 1  and z.a = k$\times$ z.b \\
 get_points (obj)     & retrieves points from the object &    \\ 
 \midrule 
  \textbf{Transformations} &&\\
 \midrule
  symmetry(obj) & obj : point,line,etc. &\tkzar z.a:symmetry (C.OH)  \\
 rotation(angle , obj)  & point,line,etc.  &\tkzar  rotation center a\\
  homothety(k,obj)     & |z.c = z.a : homothety (2,z.b)| &    \\
\bottomrule % 
\end{tabular}
\egroup

\subsubsection{Example: method \Imeth{point}{north (d)} } % (fold)
\label{ssub:example_method_imeth_point_north_d}

If |d| is absent then it is considered equal to 1.

\begin{minipage}{.5\textwidth}
\begin{verbatim}
\begin{tkzelements}
   z.O   = point : new ( 0, 0 ) 
   z.A   = z.O : east () 
   z.Ap   = z.O : east (2) : north (2)
   z.B   = z.O : north () 
   z.C   = z.O : west () 
   z.D   = z.O : south () 
\end{tkzelements}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C,D)
   \tkzDrawPoints(A,B,C,D,O,A')
\end{tikzpicture}
\end{verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\begin{tkzelements}
   scale = 1.5
   z.O = point : new ( 0, 0 ) 
   z.A = z.O : east () 
   z.Ap = z.O : east (2) : north (2)
   z.B = z.O : north () 
   z.C = z.O : west () 
   z.D = z.O : south () 
\end{tkzelements}
\hspace{\fill}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C,D)
   \tkzDrawPoints(A,B,C,D,O,A')
   \tkzLabelPoints(A,B,C,D,O,A')
\end{tikzpicture}
\end{minipage}
% subsubsection example_method_imeth_point_north_d (end)

\subsubsection{Example: method \Imeth{point}{polar} } % (fold)
\label{ssub:example_polar_method}
\begin{minipage}{0.6\textwidth}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   z.O     = point:   new  (0, 0)
   z.A     = point:   new  (3, 0)
   z.F     = point:   polar (3, math.pi/3)
\end{tkzelements}
\begin{tikzpicture}
   \tkzGetNodes 
   \tkzDrawCircle(O,A)
   \tkzDrawSegments[new](O,A)
   \tkzDrawSegments[purple](O,F)
   \tkzDrawPoints(A,O,F)
   \tkzLabelPoints[below right=6pt](A,O,F)
\end{tikzpicture}
\end{tkzexample}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{tkzelements}
    scale   = .75
    z.O     = point:   new  (0, 0)
    z.A     = point:   new  (3, 0)
    z.F     = point:   polar (3, math.pi/3)
\end{tkzelements}
\hspace*{\fill}
\begin{tikzpicture}
\tkzGetNodes 
\tkzDrawCircle(O,A)
\tkzDrawSegments[new](O,A)
\tkzDrawSegments[purple](O,F)
\tkzDrawPoints(A,O,F)
\tkzLabelPoints(A,O,F)
\end{tikzpicture}
\hspace*{\fill}
\end{minipage}
% subsubsection example_polar_method (end)

\subsubsection{Example: rotation of points} % (fold)
\label{ssub:example_rotation_of_points}
\begin{minipage}{.6\textwidth}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
  z.a       = point:  new(0, -1)
  z.b       = point:  new(4, 0)
  z.o       = point:  new(6, -2)
  z.ap,z.bp = z.o : rotation (math.pi/2,z.a,z.b)
\end{tkzelements}
       \begin{tikzpicture}
       \tkzGetNodes
       \tkzDrawLines(o,a o,a' o,b o,b')
       \tkzDrawPoints(a,a',b,b',o)
       \tkzLabelPoints(b,b',o)
       \tkzLabelPoints[below left](a,a')
       \tkzDrawArc(o,a)(a')
       \tkzDrawArc(o,b)(b')
       \end{tikzpicture}
\end{tkzexample}
\end{minipage}
\begin{minipage}{.4\textwidth}
\begin{tkzelements}
      scale = .5
    z.a = point:  new(0, -1)
    z.b = point:  new(4, 0)
    z.o = point:  new(6, -2)
    z.ap,z.bp =  z.o : rotation (math.pi/2,z.a,z.b)
\end{tkzelements}
\hspace*{\fill}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines(o,a o,a' o,b o,b')
   \tkzDrawPoints(a,a',b,b',o)
   \tkzLabelPoints(b,b',o)
   \tkzLabelPoints[below left](a,a')
   \tkzDrawArc(o,a)(a')
   \tkzDrawArc(o,b)(b')
\end{tikzpicture}
\end{minipage}
% subsubsection example_rotation_of_points (end)

\subsubsection{Object rotation} % (fold)
\label{ssub:object_rotation}
Rotate a triangle by an angle of $\pi/6$ around $O$.

\begin{minipage}{.5\textwidth}
   \begin{verbatim}
\begin{tkzelements}
z.O = point : new ( -1 , -1 ) 
z.A = point : new ( 2 , 0 ) 
z.B = point : new ( 5 , 0 ) 
L.AB = line : new (z.A,z.B)
T.ABC = L.AB : equilateral ()
S.fig = L.AB : square ()
_,_,z.E,z.F = get_points (	S.fig	) 
S.new = z.O : rotation (math.pi/3,S.fig)
_,_,z.Ep,z.Fp = get_points (	S.new	) 
z.C = T.ABC.pc
T.ApBpCp = z.O : rotation (math.pi/3,T.ABC)
z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) 
\end{tkzelements}

\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygons(A,B,C A',B',C' A,B,E,F A',B',E',F')
   \tkzDrawPoints (A,B,C,A',B',C',O)
    \tkzLabelPoints (A,B,C,A',B',C',O)
    \tkzDrawArc[delta=0,->](O,A)(A')
\end{tikzpicture}
   \end{verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\begin{tkzelements}
z.O = point : new ( -1 , -1 ) 
z.A = point : new ( 2 , 0 ) 
z.B = point : new ( 5 , 0 ) 
L.AB = line : new (z.A,z.B)
T.ABC = L.AB : equilateral ()
S.fig = L.AB : square ()
_,_,z.E,z.F = get_points (	S.fig	) 
S.new = z.O : rotation (math.pi/3,S.fig)
_,_,z.Ep,z.Fp = get_points (	S.new	) 
z.C = T.ABC.pc
T.ApBpCp = z.O : rotation (math.pi/3,T.ABC)
z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) 
\end{tkzelements}

\hspace{\fill}\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygons(A,B,C A',B',C' A,B,E,F A',B',E',F')
   \tkzDrawPoints (A,B,C,A',B',C',O)
    \tkzLabelPoints (A,B,C,A',B',C',O)
    \begin{scope}
       \tkzDrawArc[delta=0,->,dashed,red](O,A)(A')
       \tkzDrawSegments[dashed,red](O,A O,A')
    \end{scope}
 
\end{tikzpicture}
\end{minipage}
% subsubsection object_rotation (end)

\subsubsection{Object symmetry} % (fold)
\label{ssub:object_symmetry}
\begin{minipage}{.5\textwidth}
   \begin{verbatim}
   \begin{tkzelements}
       z.a = point:  new(0,-1)
       z.b = point:  new(2, 0)
       L.ab = line : new (z.a,z.b)
       C.ab = circle : new (z.a,z.b)
       z.o = point:  new(1,1)
       z.ap,z.bp =  get_points (z.o: symmetry (C.ab))
   \end{tkzelements}
       
   \begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawCircles(a,b a',b')
   \tkzDrawLines(a,a' b,b')
   \tkzDrawLines[red](a,b a',b')
   \tkzDrawPoints(a,a',b,b',o)
   \tkzLabelPoints(a,a',b,b',o)
   \end{tikzpicture}
   \end{verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\begin{tkzelements}
    z.a = point:  new(0, -1)
    z.b = point:  new(2, 0)
    L.ab = line : new (z.a,z.b)
    C.ab = circle : new (z.a,z.b)
    z.o = point:  new(1, 1)
    z.ap,z.bp =  get_points (z.o: symmetry (C.ab))
\end{tkzelements}
    
\hspace{\fill}\begin{tikzpicture}
\tkzGetNodes
\tkzDrawCircles(a,b a',b')
\tkzDrawLines(a,a' b,b')
\tkzDrawLines[red](a,b a',b')
\tkzDrawPoints(a,a',b,b',o)
\tkzLabelPoints(a,a',b,b',o)
\end{tikzpicture}
\end{minipage}
% subsubsection object_symmetry (end)
% subsection methods_of_the_class_point (end)
% section class_point (end)
\endinput