summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-27 03:02:20 +0000
committerNorbert Preining <norbert@preining.info>2024-03-27 03:02:20 +0000
commit31fa8cd73bab8480d38dae3a89ca578f337d6bbd (patch)
treeba550e99e0cb15dbf5405369d536b12b051c5155 /macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex
parent904f56f2c26edc7eb11d5a27579bccbeca29c618 (diff)
CTAN sync 202403270302
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex')
-rw-r--r--macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex89
1 files changed, 46 insertions, 43 deletions
diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex
index aa3c23d7d8..6ab030ee2f 100644
--- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex
+++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex
@@ -8,14 +8,14 @@
\subsubsection{Calculation accuracy in \TIKZ} % (fold)
\label{ssub:calculation_accuracy_in_tikz}
-With \TIKZ, \tkzimp{|veclen(x,y)|} calculates the expression $\sqrt{x^2+y^2}$.
-This calculation is obtained using a polynomial approximation, based on ideas from \tkzimp{Rouben Rostamian}.
+With \TIKZ, the expression \tkzimp{|veclen(x,y)|} calculates the expression $\sqrt{x^2+y^2}$.
+This calculation is achieved through a polynomial approximation, drawing inspiration from the ideas of \tkzimp{Rouben Rostamian}.
\pgfkeys{/pgf/number format/.cd,std,precision=5} \pgfmathparse{veclen(65,72)}
\begin{mybox}{}
-\begin{verbatim}
+\begin{Verbatim}
pgfmathparse{veclen(65,72)} \pgfmathresult
-\end{verbatim}
+\end{Verbatim}
\end{mybox}
\tkzHand $\sqrt{65^2+72^2} \approx \pmpn{\pgfmathresult} $ \tkzRBomb.
@@ -27,56 +27,55 @@ This calculation is obtained using a polynomial approximation, based on ideas fr
A |luaveclen| macro can be defined as follows:
\begin{mybox}{}
-\begin{verbatim}
+\begin{Verbatim}
\def\luaveclen#1#2{\directlua{tex.print(string.format(
'\percentchar.5f',math.sqrt((#1)*(#1)+(#2)*(#2))))}}
-\end{verbatim}
+\end{Verbatim}
\end{mybox}
and
\begin{mybox}
-\begin{verbatim}
+\begin{Verbatim}
\luaveclen{65}{72}
-\end{verbatim}
+\end{Verbatim}
\end{mybox}
gives
\tkzHand $\sqrt{65^2+72^2} = \pmpn{\luaveclen{65}{72}} $ {\color{red}!!}
-The error isn't important if it's a hundredth of a \tkzimp{pt} for the placement of an object on a page, but it's unpleasant for the result of a calculation in a mathematical demonstration. What's more, these inaccuracies can combine to produce erroneous constructions.
+The error, though insignificant when it comes to the placement of an object on a page by a hundredth of a point, becomes problematic for the results of mathematical demonstrations. Moreover, these inaccuracies can accumulate and lead to erroneous constructions.
\vspace{.5em}
-To remedy this lack of precision, I first introduced the package \pkg{fp}, then the package \pkg{xfp}. Lately, with the arrival of lua\LATEX{}, I have been able to add a \tkzname{Lua} option whose goal was to perform some calculations with \tkzname{Lua}.
+To address this lack of precision, I initially introduced the \pkg{fp}, followed by the package \pkg{xfp}. More recently, with the emergence of Lua\LATEX{}, I incorporated a \tkzname{Lua} option aimed at performing calculations with \tkzname{Lua}.
-This was the primary reason for creating the package, the second being the introduction of object-oriented programming and easier programming with Lua. Object-oriented programming (oop) convinced me to further develop all the possibilities this method offered.
+This was the primary motivation behind creating the package, with the secondary goal being the introduction of object-oriented programming (OOP) and simplifying programming with Lua. The concept of OOP persuaded me to explore its various possibilities further.
-At that moment, I had received some examples of programming with \tkzname{Lua} from {\tkzimpbf{Nicolas Kisselhoff}}, but I didn't understand its code, so I had to patiently study Lua. Finally, I was able to build tkz-elements, I took many of his ideas I've adapted.
+At that time, I had received some Lua programming examples from {\tkzimpbf{Nicolas Kisselhoff}}, but I struggled to understand the code initially, so I dedicated time to studying Lua patiently. Eventually, I was able to develop \tkzname{\tkznameofpack}, incorporating many of his ideas that I adapted for the package.
% subsubsection calculation_accuracy_in_lua (end)
\subsubsection{Using objects} % (fold)
\label{ssub:using_objects}
-Then, I read an article\footnote{\href{https://www.guitex.org/home/images/meeting2012/slides/presentazione_giacomell_guitmeeting_2012.pdf}{Grafica ad oggetti con LuaTEX}} by \tkzimpbf{Roberto Giacomelli} on object programming based on the \tkzname{Lua} and \TIKZ\ tools. This was my second source of inspiration. Not only could the programming be done step-by-step, but the introduction of objects allowed the link between the code and the geometry. The code becomes more readable, more explicit and better structured.
+Subsequently, I came across an article by \tkzimpbf{Roberto Giacomelli}\footnote{\href{https://www.guitex.org/home/images/meeting2012/slides/presentazione_giacomell_guitmeeting_2012.pdf}{Grafica ad oggetti con LuaTEX}} on object-oriented programming using \tkzname{Lua} and \TIKZ\ tools. This served as my second source of inspiration. Not only did this approach enable programming to be executed step-by-step, but the introduction of objects facilitated a direct link between the code and geometry. As a result, the code became more readable, explicit, and better structured.
\subsubsection{Example: Apollonius circle} % (fold)
\label{ssub:example_apollonius_circle}
-\begin{mybox}{Problem}
-The goal is to determine an inner tangent circle to the three exinscribed circles of a triangle.
-\end{mybox}
+\begin{mybox}{Problem:}
+The objective is to identify an inner tangent circle to the three exinscribed circles of a triangle.\end{mybox}
-See \href{https://mathworld.wolfram.com/ApolloniusCircle.html}{MathWorld} for more details.
+ For additional details, refer to \href{https://mathworld.wolfram.com/ApolloniusCircle.html}{MathWorld} for more details.
-This example was my reference for testing the \pkg{tkz-euclide} package. With my first methods and the tools at my disposition, the results lacked precision. Now, with tkz-elements, I can use tools that are more powerful, more precise and easier to create.
+This example served as my reference for testing the \pkg{tkz-euclide} package. Initially, with my first methods and the tools available to me, the results lacked precision. However, with tkz-elements, I now have access to more powerful and precise tools that are also easier to use.
-The essential principles of figure construction with \tkzname{tkz-euclide} are kept: definitions, calculations, tracings, labels as well as the step-by-step programmation, corresponding to a construction with a ruler and a compass.
+The fundamental principles of figure construction with \tkzname{tkz-euclide} remain intact: definitions, calculations, tracings, labels, as well as the step-by-step programming, mirroring the process of construction with a ruler and compass.
-This is the version that uses the simplest construction method, made possible by Lua.
+This version utilizes the simplest construction method made possible by Lua.
\begin{mybox}
-\begin{verbatim}
+\begin{Verbatim}
\begin{tkzelements}
scale = .4
z.A = point: new (0,0)
@@ -97,48 +96,52 @@ This is the version that uses the simplest construction method, made possible by
z.O = C.apo.center
z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec)
\end{tkzelements}
-\end{verbatim}
+\end{Verbatim}
\end{mybox}
-The creation of an object encapsulates its attributes (its characteristics) and methods (i.e. the actions that are specific to it). It is then assigned a reference (a name), which is linked to the object using a table. The table is an associative array that links the reference called \tkzimp{key} to a \tkzimp{value}, in this case the object. These notions will be developed later.
+The creation of an object encapsulates its attributes (its characteristics) and methods (i.e. the actions that are specific to it). Subsequently, it is assigned a reference (a name) which is linked to the object using a table. This table functions as an associative array that links the reference, called a \tkzimp{key}, to a \tkzimp{value}, in this case, the object. Further elaboration on these notions will be provided later.
-\tkzimp{T} is a table that associates the object \tkzimp{triangle} with the key \tkzimp{ABC}. \tkzimp{T.ABC} is also a table, and its elements are accessed using keys that are attributes of the triangle. These attributes have been defined in the package.
+For instance, let \tkzimp{T} be a table associating the object \tkzimp{triangle} with the key \tkzimp{ABC}. \tkzimp{T.ABC} is also a table, and its elements are accessed using keys that correspond to attributes of the triangle. These attributes have been defined within the package.
\vspace{1em}
\begin{mybox}
-\begin{verbatim}
- z.N = T.ABC.eulercenter \end{verbatim}
+\begin{Verbatim}
+ z.N = T.ABC.eulercenter
+\end{Verbatim}
\end{mybox}
|N| is the name of the point, |eulercenter| is an attribute of the triangle.
\footnote{ The center of the Euler circle, or center of the nine-point circle, is a characteristic of every triangle.}
\begin{mybox}
-\begin{verbatim}
- T.excentral = T.ABC : excentral () \end{verbatim}
+\begin{Verbatim}
+ T.excentral = T.ABC : excentral ()
+\end{Verbatim}
\end{mybox}
-Here, \tkzimp{excentral} is a method linked to the \tkzimp{T.ABC }object. It defines the triangle formed by the centers of the exinscribed circles.
+In this context, \tkzimp{excentral} is a method associated with the \tkzimp{T.ABC }object. It defines the triangle formed by the centers of the exinscribed circles.
-Two lines are important. The first below shows that the excellent precision provided by Lua makes it possible to define a radius with a complex calculation. The radius of the radical circle is given by $\sqrt{\Pi(S,\mathcal{C}(Ja,Ea))}$ (square root of the power of point $S$ with respect to the exinscribed circle with center |Ja| passing through |Ea|).
+Of particular importance are two lines of code. The first one below demonstrates that the exceptional precision provided by Lua allows for the definition of a radius through a complex calculation. The radius of the radical circle is determined by $\sqrt{\Pi(S,\mathcal{C}(Ja,Ea))}$ (square root of the power of point $S$ with respect to the exinscribed circle with center |Ja| passing through |Ea|).
-\begin{mybox}
-\begin{verbatim}
- C.ortho = circle: radius (z.S,math.sqrt(C.JaEa: power(z.S)))\end{verbatim}
+\begin{mybox}{}
+\begin{Verbatim}
+ C.ortho = circle: radius (z.S,math.sqrt(C.JaEa: power(z.S)))
+\end{Verbatim}
\end{mybox}
-Finally, the inversion of the Euler circle with respect to the radical circle is the Apollonius circle\footnote{The nine-point circle, or Euler circle, is externally tangent to the three circles. The points of tangency form Feuerbach's triangle.}. The transformation has an object as parameter, which is recognized by its type (all objects are typed in the package), and the method determines which algorithm to use according to this type.
+Lastly, it's worth noting that the inversion of the Euler circle with respect to the radical circle yields the Apollonius circle\footnote{The nine-point circle, or Euler circle, is externally tangent to the three circles. The points of tangency form Feuerbach's triangle.}. This transformation requires an object as a parameter, which is recognized by its type (all objects are typed in the package), and the method determines which algorithm to use according to this type.
-\begin{mybox}
-\begin{verbatim}
- C.apo = C.ortho : inversion (C.euler) \end{verbatim}
+\begin{mybox}{}
+\begin{Verbatim}
+ C.apo = C.ortho : inversion (C.euler)
+\end{Verbatim}
\end{mybox}
-Now that all the points have been defined, it's time to start drawing the paths. To do this, you need to create the nodes. This is the role of the macro \Imacro{tkzGetNodes}. See \ref{ssub:points_transfer}
+Now that all the points have been defined, it's time to start drawing the paths. To accomplish this, nodes need to be created. This is the role of the macro \Imacro{tkzGetNodes}. Refer to \ref{ssub:points_transfer}
-The following section concerns only drawings, and is handled by \pkg{tkz-euclide}.
+The subsequent section exclusively deals with drawings, and is managed by \pkg{tkz-euclide}.
-\begin{verbatim}
+\begin{Verbatim}
\begin{tikzpicture}
\tkzGetNodes
\tkzFillCircles[green!30](O,xa)
@@ -146,15 +149,15 @@ The following section concerns only drawings, and is handled by \pkg{tkz-euclide
\tkzFillCircles[lightgray](S,a)
\tkzFillCircles[green!30](N,Ea)
\tkzDrawPoints(xa,xb,xc)
+ \tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec S,a O,xa N,Ea)
\tkzClipCircle(O,xa)
\tkzDrawLines[add=3 and 3](A,B A,C B,C)
- \tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec S,a O,xa N,Ea)
\tkzDrawPoints(O,A,B,C,S,Ea,Eb,Ec,N)
\tkzDrawSegments[dashed](S,xa S,xb S,xc)
\tkzLabelPoints(O,N,A,B)
\tkzLabelPoints[right](S,C)
\end{tikzpicture}
-\end{verbatim}
+\end{Verbatim}
\vspace{1em}
\begin{tkzelements}
@@ -186,9 +189,9 @@ The following section concerns only drawings, and is handled by \pkg{tkz-euclide
\tkzFillCircles[lightgray](S,a)
\tkzFillCircles[green!30](N,Ea)
\tkzDrawPoints(xa,xb,xc)
+ \tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec S,a O,xa N,Ea)
\tkzClipCircle(O,xa)
\tkzDrawLines[add=3 and 3](A,B A,C B,C)
- \tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec S,a O,xa N,Ea)
\tkzDrawPoints(O,A,B,C,S,Ea,Eb,Ec,N)
\tkzDrawSegments[dashed](S,xa S,xb S,xc)
\tkzLabelPoints(O,N,A,B)