\newpage \section{Writing Convention} % (fold) \label{sec:writing_convention} \subsection{Miscellaneous} % (fold) \label{sub:miscellanous} \begin{itemize} \item Numerical variable: the writing conventions for real numbers are the same as for \pkg{Lua}. \item Complex numbers: Similar to real numbers, but to define them, you must write |za = point (1,2)|. Mathematically, this corresponds to 1+2i, which you can find with |tex.print(tostring(za))|.(Refer \ref{sub:complex_numbers}) \item Boolean: you can write |bool = true| or |bool = false| then with Lua you can use the code :\\ \begin{mybox} |if bool == ... then ... else ... end| \end{mybox} and you can use the macro \begin{mybox} |\ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ ... }{ ... }| \end{mybox} after loading the \tkzNamePack{ifthen} package. \item String: if st = "Euler's formula" then \begin{mybox} |\tkzUseLua{st}| gives |Euler's formula| \end{mybox} \end{itemize} % subsection miscellanous (end) \subsection{Assigning a Name to a Point} % (fold) \label{sub:assigning_a_name_to_a_point} At present, the only obligation is to store the points in the table |z| \footnote{To place the point M in the table, simply write |z.M| = \ldots or |z["M"]|= \ldots} if you intend to use them in \TIKZ\ or \pkg{tkz-euclide}. f a point will not be used, you can designate it as you wish while adhering to Lua conventions. Points in the lua code must follow a convention in the form |z.name|, where |name| represents the name of the corresponding \tkzname{node}. As for the conventions for designating |name| you must adhere to Lua conventions in particular cases. \begin{enumerate} \item The use of prime can be problematic. If the point name contains more than one symbol and ends with |p| then when passing into \pkg{TikZ} or \pkg{tkz-euclide}, the letters |p| will be replaced by |'| using the macro \tkzcname{tkzGetNodes}; \index{prime} \item Alternatively, for a more explicit code, suppose you want to designate a point as "euler". You could, for example, write |euler = ...|, and at the end of the code for the transfer, |z.E = euler|. It is also possible to use a temporary name |euler| and to replace it in \TIKZ{}. Either at the time of placing the labels, or for example by using |pgfnodealias{E}{euler}|. This possibility also applies in other cases: prime, double prime, etc. \end{enumerate} Here are some different ways of naming a point: \begin{mybox} \begin{itemize} \item |z.A = point : new (1,2)| \item |z.Bp = point : new (3,4)| --> this gives |B'| in the \tkzNameEnv{tikzpicture} \item |z.H_a = T.ABC : altitude ()| --> this gives |H_a| in the \tkzNameEnv{tikzpicture} code and $H_a$ in the display. \end{itemize} \end{mybox} % subsection assigning_a_name_to_a_point (end) \subsection{Assigning a Name to Other Objects} % (fold) \label{sub:assigning_a_name_to_other_objects} You have the flexibility to assign names to objects other than points. However, it's advisable to adhere to certain conventions to enhance code readability. For my examples, I've chosen the following conventions: first of all, I store the objects in tables: |L| for lines and segments, |C| for circles, |T| for triangles, |E| for ellipses. \begin{itemize} \item For lines, I use the names of the two points they pass through. For example, if a line passes through points $A$ and $B$, I name the line |L.AB|. \item Circles are stored in table named |C|. For example, I name |C.AB| the circle of center $A$ passing through $B$. Other names like C.euler or C.external are also acceptable. \item Triangles are stored in table named |T|. For example, I name |T.ABC| the triangle whose vertices are $A$, $B$ and $C$. However, names like |T.feuerbach| are also acceptable. \item Ellipses are stored in table named |E|. For ellipses, I name |E.ABC| the ellipse with center $A$ through vertex $B$ and covertex $C$. \end{itemize} Adhering to these conventions can help improve the readability of the code. % subsection assigning_a_name_to_other_objects(end) \subsection{Writing conventions for attributes, methods.} % (fold) \label{sub:writing_conventions_for_attributes_methods_and_functions} You must use the conventions of Lua, so \begin{itemize} \item To obtain an \Amacro{attribute}, for all objects, the convention is identical: |object.attribute|. For example, for the point $A$ we access its abscissa with |z.A.re| and its ordinate with |z.A.im|; as for its type we obtain it with |z.A.type|. To get the south pole of the circle |C.OA| you need to write: |C.OA.south|. \item To use a method such as obtaining the incircle of a triangle ABC, just write |C.incircle = T.ABC : in_circle ()|. \item Some methods need a parameter. For example, to know the distance between a point $C$ to the line $(A,B)$ we will write |d = L.AB : distance (z.C)|. \item Use the \Amacro{underscore} to store a result you don't want to use. If you only need the second point of an intersection between a line and a circle, you would write |_,z.J = intersection (L.AB , C.OC)|. \end{itemize} % section writing_convention (end) \endinput