From 25b83ac051a8ec3bf79f47e3c3c66b3567a3216a Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 6 Feb 2024 03:00:37 +0000 Subject: CTAN sync 202402060300 --- macros/latex/contrib/tkz/tkz-elements/README.md | 16 +- .../doc/latex/TKZdoc-elements-classes-circle.tex | 14 +- .../doc/latex/TKZdoc-elements-classes-line.tex | 5 +- .../doc/latex/TKZdoc-elements-classes-point.tex | 89 +++- .../latex/TKZdoc-elements-classes-rectangle.tex | 4 +- .../doc/latex/TKZdoc-elements-classes-triangle.tex | 81 +++- .../doc/latex/TKZdoc-elements-classes-vectors.tex | 193 +++++++++ .../doc/latex/TKZdoc-elements-examples.tex | 480 +++++++++++---------- .../doc/latex/TKZdoc-elements-indepthstudy.tex | 20 +- .../doc/latex/TKZdoc-elements-main.tex | 52 ++- .../doc/latex/TKZdoc-elements-organization.tex | 11 +- .../doc/latex/TKZdoc-elements-presentation.tex | 12 +- .../contrib/tkz/tkz-elements/doc/tkz-elements.pdf | Bin 642250 -> 656453 bytes .../tkz/tkz-elements/latex/tkz-elements.sty | 21 +- .../tkz/tkz-elements/latex/tkz_elements_circle.lua | 41 +- .../tkz/tkz-elements/latex/tkz_elements_class.lua | 4 +- .../tkz-elements/latex/tkz_elements_ellipse.lua | 9 +- .../latex/tkz_elements_functions_circles.lua | 11 +- .../latex/tkz_elements_functions_intersections.lua | 21 +- .../latex/tkz_elements_functions_lines.lua | 13 +- .../latex/tkz_elements_functions_maths.lua | 41 +- .../latex/tkz_elements_functions_points.lua | 4 +- .../latex/tkz_elements_functions_regular.lua | 4 +- .../latex/tkz_elements_functions_triangles.lua | 9 +- .../tkz/tkz-elements/latex/tkz_elements_line.lua | 39 +- .../tkz/tkz-elements/latex/tkz_elements_main.lua | 4 +- .../tkz/tkz-elements/latex/tkz_elements_misc.lua | 4 +- .../latex/tkz_elements_parallelogram.lua | 9 +- .../tkz/tkz-elements/latex/tkz_elements_point.lua | 18 +- .../latex/tkz_elements_quadrilateral.lua | 9 +- .../tkz-elements/latex/tkz_elements_rectangle.lua | 11 +- .../tkz-elements/latex/tkz_elements_regular.lua | 4 +- .../tkz/tkz-elements/latex/tkz_elements_square.lua | 13 +- .../tkz-elements/latex/tkz_elements_triangle.lua | 11 +- .../tkz/tkz-elements/latex/tkz_elements_vector.lua | 72 +++- 35 files changed, 879 insertions(+), 470 deletions(-) create mode 100644 macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex (limited to 'macros/latex/contrib/tkz') diff --git a/macros/latex/contrib/tkz/tkz-elements/README.md b/macros/latex/contrib/tkz/tkz-elements/README.md index f5bfcebc80..bf33121af3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/README.md +++ b/macros/latex/contrib/tkz/tkz-elements/README.md @@ -1,10 +1,10 @@ # tkz-elements — for euclidean geometry -Release 1.82c 2024/01/16 +Release 2.00c 2024/02/04 ## Description -`tkz-elements v.1.82c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. +`tkz-elements v.2.00c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. The main possibility of programmation proposed is oriented "object programming" with object classes like point, line, triangle, circle and ellipse. For the moment, once the calculations are done, it is `tkz-euclide` or `TikZ` which allows the drawings. @@ -60,6 +60,18 @@ An important example `Golden Arbelos` using the package is on the site. All the are on the site. ## History + - version 2.00c + - class development “vector” + - added attribute “vec” + - added “at” and “orthogonal” methods to the class “point” + - rewriting the function angle\_normalize\_ + - modification of the slope attribute for the “line”, now the result is normalized. + - the angles of a triangle are also normalized + - added function format\_number(number,decimal) sets the number of digits in the decimal part. + - added \tkzDN a macro pour formater les nombres dans la partie TikZ + \tkzDN[nb_decimal]{number} + - added the macro \tkzDrawLuaEllipse draw an ellipse in tikz knowing its center, vertex and covertex. + - correction de la documentation - version 1.82c - Point object : name like z.App now gives a node with name A'' - Modification of methods north,south diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex index 4dd3b75b60..2395f5f045 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex @@ -270,12 +270,12 @@ z.Q = intersection (L.tB,T.ca) \subsubsection{Inversion: point, line and circle} % (fold) \label{ssub:inversion} -The "inversion" method can be used on a point, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. +The “inversion” method can be used on a point, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. \subsubsection{Inversion: point} % (fold) \label{ssub:inversion_point} -The "inversion" method can be used on a point, a group of points, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. +The “inversion” method can be used on a point, a group of points, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. \begin{minipage}{.5\textwidth} \begin{verbatim} @@ -756,11 +756,11 @@ z.I,z.T = get_points ( C.IT ) Cette fonction retourne une chaîne qui indique la position du cercle par rapport à un autre. Utile pour créer une fonction. Les cas sont: \begin{itemize} - \item "outside" - \item "outside tangent" - \item "inside tangent" - \item "inside" - \item "intersect" + \item “outside” + \item “outside tangent” + \item “inside tangent” + \item “inside” + \item “intersect” \end{itemize} \begin{minipage}{.5\textwidth} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex index feab38af27..2aa2ce6537 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex @@ -28,12 +28,13 @@ The attributes are : \Iattr{line}{mid} & Middle of the segment& |z.M = L.AB.mid|\\ \Iattr{line}{slope} & Slope of the line & see (\ref{ssub:example_class_line})\\ \Iattr{line}{length} &|l = L.AB.length|&see (\ref{sub:transfer_from_lua_to_tex} ; \ref{ssub:example_class_line})\\ -\Iattr{line}{north\_pa} & See (\ref{ssub:example_class_line}) & \\ +\Iattr{line}{north\_pa} & &See (\ref{ssub:example_class_line}) \\ \Iattr{line}{north\_pb} & &\\ \Iattr{line}{south\_pa} & &\\ \Iattr{line}{south\_pb} & &See (\ref{ssub:example_class_line}) \\ \Iattr{line}{east} & &\\ \Iattr{line}{west} & &\\ +\Iattr{line}{vec} & |V.AB = L.AB.vec|& defines $\overrightarrow{AB}$ See (\ref{sec:class_vector})\\ \bottomrule \end{tabular} \egroup @@ -410,7 +411,7 @@ The side lengths are proportional to the lengths given in the table. They depend z.E = T.ABE.pc T.ABF = L.AB : golden () z.F = T.ABF.pc - T.ABG = L.AB : devine () + T.ABG = L.AB : divine () z.G = T.ABG.pc T.ABH = L.AB : pythagoras () z.H = T.ABH.pc diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex index 45f7991c92..4efd21328f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex @@ -103,9 +103,9 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \textbf{Attributes} & \textbf{Application}& \textbf{Example}\\ \Iattr{point}{re} & |z.A.re = 1| & see (\ref{ssub:methods}) \\ \Iattr{point}{im} & |z.A.im = 2| &see (\ref{ssub:methods}) \\ -\Iattr{point}{type} & |z.A.type = 'point| & \\ +\Iattr{point}{type} & |z.A.type = 'point'| & \\ \Iattr{point}{argument} & |z.A.argument $\approx$ 0.78539816339745| & see (\ref{ssub:example_point_attributes})\\ -\Iattr{point}{module} & |z.A.module| $\approx$ |2.2360...| =$\sqrt{5}$ & see (\ref{ssub:example_point_attributes})\\ +\Iattr{point}{modulus} & |z.A.modulus| $\approx$ |2.2360...| =$\sqrt{5}$ & see (\ref{ssub:example_point_attributes})\\ \bottomrule \end{tabular} \egroup @@ -242,7 +242,7 @@ Attributes of \texttt{z.M} \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}. +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}. See section (\ref{sub:complex_numbers}) for the metamethods. \vspace{1em} \bgroup @@ -265,6 +265,8 @@ The methods described in the following table are standard. You'll find them in m \Imeth{point}{west(r)} & & \\ \Imeth{point}{normalize()} & |z.b = z.a: normalize ()| & see (\ref{ssub:method_normalize}) \\ \Imeth{point}{get\_points (obj)} & retrieves points from the object & \\ +\Imeth{point}{orthogonal (d)} & |z.B=z.A:orthogonal(d)| & $\overrightarrow{OB}\perp \overrightarrow{OA}$ and $OB=d$\\ +\Imeth{point}{at ()} & |z.X = z.B : at (z.A)| & $\overrightarrow{OB}= \overrightarrow{AX}$ and $OB=d$\\ \midrule \textbf{Transformations} &&\\ \midrule @@ -369,7 +371,6 @@ Use of |north and east| functions linked to points, to transfer lengths, see (\r \tkzLabelPoints[above right](C,D,F) \end{tikzpicture} \end{minipage} - % subsubsection report_de_distance (end) @@ -460,6 +461,86 @@ z.I = point : new (1,0) \end{minipage} % subsubsection method_normalize (end) +\subsubsection{\Imeth{point}{Orthogonal (d)} method} % (fold) +\label{ssub:orthogonal_method} + +Let $O$ be the origin of the plane. The "orthogonal (d)" method is used to obtain a point $B$ from a point $A$ such that $\overrightarrow{OB}\perp \overrightarrow{OA}$ with $OB=OA$ if $d$ is empty, otherwise $OB = d$. + +\begin{minipage}{.6\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 3 , 1 ) + z.B = z.A : orthogonal (1) + z.O = point : new ( 0,0 ) + z.C = z.A : orthogonal () +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments(O,A O,C) + \tkzDrawPoints(O,A,B,C) + \tkzLabelPoints[below right](O,A,B,C) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.4\textwidth} +\begin{tkzelements} + z.A = point : new ( 3 , 1 ) + z.B = z.A : orthogonal (1) + z.O = point : new ( 0,0 ) + z.C = z.A : orthogonal () +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments(O,A O,C) + \tkzDrawPoints(O,A,B,C) + \tkzLabelPoints[below right](O,A,B,C) +\end{tikzpicture} +\end{minipage} +% subsubsection orthogonal_method (end) + +\subsubsection{\Imeth{point}{at} method} % (fold) +\label{ssub:_imeth_point_at_method} + +Cette méthode est complémentaire de la précédente, ainsi on peut souhaiter non pas avoir $\overrightarrow{OB}\perp \overrightarrow{OA}$ mais $\overrightarrow{AB}\perp \overrightarrow{OA}$. + +\begin{minipage}{.6\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 3 , 1 ) + z.B = z.A : orthogonal (1) + z.O = point : new ( 0,0 ) + -- z.B = z.B : at (z.A) -- or + z.B = z.A : orthogonal (1) : at (z.A) + z.C = z.A+z.B + z.D =(z.C-z.A):orthogonal(2) : at (z.C) +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzLabelPoints[below right](O,A,B,C,D) + \tkzDrawSegments(O,A A,B A,C C,D) + \tkzDrawPoints(O,A,B,C,D) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.4\textwidth} +\begin{tkzelements} +z.A = point : new ( 3 , 1 ) +z.B = z.A : orthogonal (1) +z.O = point : new ( 0,0 ) +-- z.B = z.B : at (z.A) -- or +z.B = z.A : orthogonal (1) : at (z.A) +z.C = z.A+z.B +z.D =(z.C-z.A):orthogonal(2) : at (z.C) +\end{tkzelements} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzLabelPoints[below right](O,A,B,C,D) +\tkzDrawSegments(O,A A,B A,C C,D) +\tkzDrawPoints(O,A,B,C,D) +\end{tikzpicture} +\end{minipage} + +% subsubsection _imeth_point_at_method (end) \subsubsection{Example: \Imeth{point}{rotation of points}} % (fold) \label{ssub:example_rotation_of_points} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex index 8b591cc61e..e232980e64 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex @@ -258,8 +258,8 @@ z.I = R.diag.center z.X = point : new ( 0 , 0 ) z.Y = point : new ( 4 , 2 ) R.gold = rectangle : gold (z.X,z.Y) -z.C = R.gold.pc -z.D = R.gold.pd +z.Z = R.gold.pc +z.W = R.gold.pd z.I = R.gold.center \end{tkzelements} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex index a65899c0ef..9261d6fbe7 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex @@ -40,6 +40,46 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{tabular} \egroup +\subsection{Triangle attributes: angles} % (fold) +\label{sub:triangle_attributes_angles} + +\begin{minipage}{.6\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point: new(0,0) + z.B = point: new(5,0) + z.C = point: new(2,3) + T.ABC = triangle: new (z.A,z.B,z.C) +\end{tkzelements} +\def\wangle#1{\tkzDN[2]{% + \tkzUseLua{math.deg(T.ABC.#1)}}} +\begin{tikzpicture} +\tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzLabelAngle(B,A,C){$\wangle{alpha}^\circ$} + \tkzLabelAngle(C,B,A){$\wangle{beta}^\circ$} + \tkzLabelAngle(A,C,B){$\wangle{gamma}^\circ$} +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.4\textwidth} +\begin{tkzelements} + z.A = point: new(0,0) + z.B = point: new(5,0) + z.C = point: new(2,3) + T.ABC = triangle: new (z.A,z.B,z.C) +\end{tkzelements} +\def\wangle#1{\tkzDN[2]{\tkzUseLua{math.deg(T.ABC.#1)}}} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzLabelAngle(B,A,C){$\wangle{alpha}^\circ$} +\tkzLabelAngle(C,B,A){$\wangle{beta}^\circ$} +\tkzLabelAngle(A,C,B){$\wangle{gamma}^\circ$} +\end{tikzpicture} +\end{minipage} +% subsection triangle_attributes_angles (end) + \subsubsection{Example: triangle attributes} % (fold) \label{ssub:example_triangle_attributes} \begin{minipage}{.5\textwidth} @@ -149,6 +189,20 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \Imeth{triangle}{euler\_line () } & the line through $N$ ,$G$, $H$ and $O$ if the triangle is not equilateral \footnote{N center of nine points circle, G centroid, H orthocenter , O circum center } \\ \Imeth{triangle}{antiparallel(pt,n)} & n=0 antiparallel through pt to $(BC)$, n=1 to $(AC)$ etc.\\ +\midrule + \textbf{Circles} &\\ +\midrule +\Imeth{triangle}{euler\_circle ()} & C.|NP = T.ABC : euler_circle ()| \tkzar $N$ euler point + \footnote{ The midpoint of each side of the triangle, the foot of each altitude, the midpoint of the line segment from each vertex of the triangle to the orthocenter.} \\ +\Imeth{triangle}{circum\_circle ()} & |C.OA = T.ABC : circum ()| Triangle's circumscribed circle \\ +\Imeth{triangle}{in\_circle ()} & Inscribed circle of the triangle\\ +\Imeth{triangle}{ex\_circle (n)} & Circle tangent to the three sides of the triangle ; n =1 swap ; n=2 2 swap \\ +\Imeth{triangle}{first\_lemoine\_circle ()} & The center is the midpoint between Lemoine point and the circumcenter.\footnote{ +Through the Lemoine point draw lines parallel to the triangle's sides. The points where the parallel lines intersect the sides of ABC + then lie on a circle known as the first Lemoine circle. } \\ +\Imeth{triangle}{second\_lemoine\_circle ()} & see example \ref{sub:antiparallel_through_lemoine_point}\\ +\Imeth{triangle}{spieker\_circle ()} & The incircle of the medial triangle\\ + \bottomrule \end{tabular} \end{minipage} @@ -168,19 +222,6 @@ Remark: If you don't need to use the triangle object several times, you can obta \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Comments} \\ -\midrule - \textbf{Circles} &\\ -\midrule -\Imeth{triangle}{euler\_circle ()} & C.|NP = T.ABC : euler_circle ()| \tkzar $N$ euler point - \footnote{ The midpoint of each side of the triangle, the foot of each altitude, the midpoint of the line segment from each vertex of the triangle to the orthocenter.} \\ -\Imeth{triangle}{circum\_circle ()} & |C.OA = T.ABC : circum ()| Triangle's circumscribed circle \\ -\Imeth{triangle}{in\_circle ()} & Inscribed circle of the triangle\\ -\Imeth{triangle}{ex\_circle (n)} & Circle tangent to the three sides of the triangle ; n =1 swap ; n=2 2 swap \\ -\Imeth{triangle}{first\_lemoine\_circle ()} & The center is the midpoint between Lemoine point and the circumcenter.\footnote{ -Through the Lemoine point draw lines parallel to the triangle's sides. The points where the parallel lines intersect the sides of ABC - then lie on a circle known as the first Lemoine circle. } \\ -\Imeth{triangle}{second\_lemoine\_circle ()} & see example \ref{sub:antiparallel_through_lemoine_point}\\ -\Imeth{triangle}{spieker\_circle ()} & The incircle of the medial triangle\\ \midrule \textbf{Triangles} &\\ \midrule @@ -234,7 +275,7 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzDrawCircle[red](N,I) \tkzDrawCircles[teal](O,A) \tkzDrawSegments(A,P B,Q C,R) - \tkzDrawSegments[red](A,I B,J C,K)\include{TKZdoc-elements-classes-triangle.tex} + \tkzDrawSegments[red](A,I B,J C,K) \tkzDrawPolygons(A,B,C) \tkzDrawPoints(A,B,C,N,I,J,K,O,P,Q,R,H,G) \tkzLabelPoints(A,B,C,I,J,K,P,Q,R,H) @@ -331,11 +372,9 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzDrawPoints(A,B,M,C,D,E,F) \tkzLabelPoints[below right](A,B,C,D,E) \tkzLabelPoints[above](M,F) - \tkzFillAngles[opacity=.4,cyan!20](A,M,B B,E,M) - \tkzFillAngles[opacity=.4,purple!20](B,M,F M,F,B) \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) - \tkzMarkAngles[mark=||](A,M,E E,M,B B,E,M) - \tkzMarkAngles[mark=|](B,M,F M,F,B) + \tkzMarkAngles[mark=||,size=.5](A,M,E E,M,B B,E,M) + \tkzMarkAngles[mark=|,size=.5](B,M,F M,F,B) \tkzMarkSegments(B,E B,M B,F) \end{tikzpicture} \end{minipage} @@ -350,11 +389,9 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzDrawPoints(A,B,M,C,D,E,F) \tkzLabelPoints[below right](A,B,C,D,E) \tkzLabelPoints[above](M,F) - \tkzFillAngles[opacity=.4,cyan!20](A,M,B B,E,M) - \tkzFillAngles[opacity=.4,purple!20](B,M,F M,F,B) \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) - \tkzMarkAngles[mark=||](A,M,E E,M,B B,E,M) - \tkzMarkAngles[mark=|](B,M,F M,F,B) + \tkzMarkAngles[mark=||,size=.5](A,M,E E,M,B B,E,M) + \tkzMarkAngles[mark=|,size=.5](B,M,F M,F,B) \tkzMarkSegments(B,E B,M B,F) \end{tikzpicture} \end{verbatim} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex new file mode 100644 index 0000000000..00d924bb83 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex @@ -0,0 +1,193 @@ +\newpage + +\section{Class \Iclass{vector}} % (fold) +\label{sec:class_vector} + +In fact, they are more a class of oriented segments than vectors in the strict mathematical sense. + +A vector is defined by giving two points (i.e. two affixes). +|V.AB = vector : new (z.A,z.B)| creates the vector $\overrightarrow(AB)$, i.e. the oriented segment with origin $A$ representing a vector. A few rudimentary operations are defined, such as sum, subtraction and multiplication by a scalar. + +The sum is defined as follows: + +Let V.AB + V.CD result in a vector V.AE defined as follows + +If $\overrightarrow{CD} = \overrightarrow{BE} $ then $\overrightarrow{AB} + \overrightarrow{CD} = \overrightarrow{AB} + \overrightarrow{BE} =\overrightarrow(AE)$ + +\begin{mybox} + Creation |V.AB = vector: new (z.A,z.B)| +\end{mybox} + +\begin{verbatim} +z.A = ... +z.B = ... +z.C = ... +z.D = ... +V.AB = vector : new (z.A,z.B) +V.CD = vector : new (z.C,z.D) +V.AE = V.AB + V.CD -- possible V.AB : add (V.CD) +z.E = V.AE.h -- we recover the final point (h = head) +\end{verbatim} + +\subsection{Attributes of a vector} % (fold) +\label{sub:attributes_of_a_vector} + +% subsection attributes_of_a_vector (end) +\vspace{1em} +\bgroup +\small +\catcode`_=12 +\captionof{table}{Vector attributes.}\label{vector:att} +\begin{tabular}{lll} +\toprule +\textbf{Attributes} & \textbf{Application}& \textbf{Example}\\ +\Iattr{vector}{pa} & |V.AB.t = z.A| t for tail & see (\ref{ssub:methods}) \\ +\Iattr{vector}{pb} & |V.AB.h = z.B| h for head & see (\ref{ssub:methods}) \\ +\Iattr{vector}{type} & |V.AB.type = 'vector'| & \\ +\Iattr{vector}{slope} & |V.AB.slope| & see (\ref{ssub:example_vector_attributes})\\ +\Iattr{vector}{length} & |V.AB.norm|& see (\ref{ssub:example_vector_attributes})\\ +\bottomrule +\end{tabular} +\egroup + +\subsubsection{Example vector attributes} % (fold) +\label{ssub:example_vector_attributes} + +\begin{minipage}{.6\textwidth} + \begin{verbatim} + \begin{tkzelements} + z.O = point: new (0,0) + z.A = point: new (0,1) + z.B = point: new (3,4) + L.AB = line : new ( z.A , z.B ) + z.C = point: new (1,2) + z.D = point: new (2,1) + u = vector : new (z.A,z.B) + v = vector : new (z.C,z.D) + w =u+v + z.E = w.h + \end{tkzelements} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzLabelPoints(A,B,C,D,O,E) + \tkzDrawSegments[->,red](A,B C,D A,E) + \tkzLabelSegment(A,B){$\overrightarrow{u}$} + \tkzLabelSegment(C,D){$\overrightarrow{v}$} + \tkzLabelSegment(A,E){$\overrightarrow{w}$} + \end{tikzpicture} + $\overrightarrow{w}$ has slope : + $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ + \end{verbatim} +\end{minipage} +\begin{minipage}{.4\textwidth} +\begin{tkzelements} + z.O = point: new (0,0) + z.A = point: new (0,1) + z.B = point: new (3,4) + L.AB = line : new ( z.A , z.B ) + z.C = point: new (1,2) + z.D = point: new (2,1) + u = vector : new (z.A,z.B) + v = vector : new (z.C,z.D) + w = u+v + z.E = w.h +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzLabelPoints(A,B,C,D,O,E) + \tkzDrawSegments[->,red](A,B C,D A,E) + \tkzLabelSegment(A,B){$\overrightarrow{u}$} + \tkzLabelSegment(C,D){$\overrightarrow{v}$} + \tkzLabelSegment(A,E){$\overrightarrow{w}$} +\end{tikzpicture} + +$\overrightarrow{w}$ has slope : +$\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ +\end{minipage} +% subsubsection example_vector_attributes (end) + +\subsection{Methods of the class vector} % (fold) +\label{sub:methods_of_the_class_vector} + +\vspace{1em} +\bgroup +\catcode`_=12 +\small +\captionof{table}{Methods of the class vector.}\label{vector:met} +\begin{tabular}{lll} +\toprule + \textbf{Metamethods} & \textbf{Application}& \\ + \midrule +\Imeth{vector}{\_\_add (u,v)} & |V.AB + V.CD| & \\ +\Imeth{vector}{\_\_sub (u,v)} & |V.AB - V.CD| & \\ +\Imeth{vector}{\_\_unm (u)} & |V.CD = -V.AB| & \\ +\Imeth{vector}{\_\_mul (k,u)} & |V.CD = k*V.AB| & \\ + \midrule + \textbf{Methods} & \textbf{Application}& \\ +\Imeth{vector}{new(pt, pt)} & |V.AB = vector: new (z.A,z.B) | & \\ +\Imeth{vector}{normalize(V)} & |V.AB : normalize () | & \\ +\Imeth{vector}{orthogonal(d)} & |V.AB : orthogonal (d) | & \\ +\Imeth{vector}{scale(d)} & |V.CD = V.AB : scale (2) | & $\overrightarrow{CD} = 2\overrightarrow{AB} $ \\ +\Imeth{vector}{at (V)} & |V.DB = V.AC : at (z.D) | & $\overrightarrow{DB} = \overrightarrow{AC} $ \\ +\bottomrule +\end{tabular} +\egroup + +\subsubsection{Example of methods} % (fold) +\label{ssub:example_of_methods} + +\begin{minipage}{.5\textwidth} + \begin{verbatim} + \begin{tkzelements} + z.O = point: new (0,0) + z.A = point: new (0,1) + z.B = point: new (3,4) + V.AB = vector: new (z.A,z.B) + V.AC = V.AB : scale (.5) + z.C = V.AC.h + V.AD = V.AB : orthogonal () + z.D = V.AD.h + V.AN = V.AB : normalize () + z.N = V.AN.h + V.AR = V.AB : orthogonal (2*math.sqrt(2)) + z.R = V.AR.h + V.AX = 2*V.AC - V.AR + z.X = V.AX.h + V.OY = V.AX : at (z.O) + z.Y = V.OY.h + \end{tkzelements} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) + \tkzLabelPoints(A,B,C,D,O,N,R,X,Y) + \end{tikzpicture} + \end{verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \begin{tkzelements} + z.O = point: new (0,0) + z.A = point: new (0,1) + z.B = point: new (3,4) + V.AB = vector: new (z.A,z.B) + V.AC = V.AB : scale (.5) + z.C = V.AC.h + V.AD = V.AB : orthogonal () + z.D = V.AD.h + V.AN = V.AB : normalize () + z.N = V.AN.h + V.AR = V.AB : orthogonal (2*math.sqrt(2)) + z.R = V.AR.h + V.AX = 2*V.AC - V.AR + z.X = V.AX.h + V.OY = V.AX : at (z.O) + z.Y = V.OY.h + \end{tkzelements} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) + \tkzLabelPoints(A,B,C,D,O,N,R,X,Y) + \end{tikzpicture} +\end{minipage} +% subsubsection example_of_methods (end) +% section class_vector (end) +\endinput \ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex index 9e79877299..5efb52381f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex @@ -179,22 +179,23 @@ z.E = intersection (L.AI,L.LLC) \subsection{Apollonius circle} % (fold) \label{sub:apollonius_circle} -\begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} scale=.75 - z.A = point: new (0 , 0) - z.B = point: new (6 , 0) - z.M = point: new (5 , 3) + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.M = point: new (5 , 3) T.MAB = triangle : new (z.M,z.A,z.B) L.bis = T.MAB : bisector () - z.C = L.bis.pb + z.C = L.bis.pb L.bisext = T.MAB : bisector_ext () - z.D = intersection (T.MAB.bc, L.bisext) - L.CD = line: new (z.C,z.D) - z.O = L.CD.mid - L.AM = T.MAB.ab - z.E = z.M : symmetry (z.A) + z.D = intersection (T.MAB.bc, L.bisext) + L.CD = line: new (z.C,z.D) + z.O = L.CD.mid + L.AM = T.MAB.ab + z.E = z.M : symmetry (z.A) \end{tkzelements} + +\hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegment[add=0 and 1](A,M) @@ -210,26 +211,24 @@ scale=.75 \tkzMarkAngles[mark=|](A,M,C C,M,B) \tkzMarkAngles[mark=||](B,M,D D,M,E) \end{tikzpicture} -\end{tkzexample} - +\hspace*{\fill} +\begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} scale=.75 - z.A = point: new (0 , 0) - z.B = point: new (6 , 0) - z.M = point: new (5 , 3) + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.M = point: new (5 , 3) T.MAB = triangle : new (z.M,z.A,z.B) L.bis = T.MAB : bisector () - z.C = L.bis.pb + z.C = L.bis.pb L.bisext = T.MAB : bisector_ext () - z.D = intersection (T.MAB.bc, L.bisext) - L.CD = line: new (z.C,z.D) - z.O = L.CD.mid - L.AM = T.MAB.ab - z.E = z.M : symmetry (z.A) + z.D = intersection (T.MAB.bc, L.bisext) + L.CD = line: new (z.C,z.D) + z.O = L.CD.mid + L.AM = T.MAB.ab + z.E = z.M : symmetry (z.A) \end{tkzelements} - -\hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegment[add=0 and 1](A,M) @@ -245,7 +244,12 @@ scale=.75 \tkzMarkAngles[mark=|](A,M,C C,M,B) \tkzMarkAngles[mark=||](B,M,D D,M,E) \end{tikzpicture} -\hspace*{\fill} +\end{tkzexample} + +Remark : The circle can be obtained with: + +|C.AB = T.MAB.bc : apollonius (length(z.M,z.A)/length(z.M,z.B))| + %subsection apollonius_circle (end) @@ -428,8 +432,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.w1,z.t1 = get_points ( C.AB ) C.AC = T.ABC.ca : apollonius (length(z.B,z.C)/length(z.B,z.A)) z.w2,z.t2 = get_points ( C.AC ) - C.AC = T.ABC.bc : apollonius (length(z.A,z.B)/length(z.A,z.C)) - z.w3,z.t3 = get_points ( C.AC ) + C.BC = T.ABC.bc : apollonius (length(z.A,z.B)/length(z.A,z.C)) + z.w3,z.t3 = get_points ( C.BC ) \end{tkzelements} \end{verbatim} @@ -733,19 +737,19 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.c = C.center \end{tkzelements} - \hspace*{\fill} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle(O,A) - \tkzDrawCircle[orange](c,z1) - \tkzDrawPoints[orange](O,A,z1,z2,c) - \tkzLabelPoints[right](O,A,z1,z2,c) - \end{tikzpicture} - \hspace*{\fill} +\hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircle(O,A) +\tkzDrawCircle[orange](c,z1) +\tkzDrawPoints[orange](O,A,z1,z2,c) +\tkzLabelPoints[right](O,A,z1,z2,c) +\end{tikzpicture} +\hspace*{\fill} % subsection orthogonal_circle_through (end) -\subsection{Devine ratio} % (fold) -\label{sub:devine_ratio} +\subsection{Divine ratio} % (fold) +\label{sub:divine_ratio} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} @@ -809,52 +813,53 @@ L.BG = line: new (z.B,z.G) z.L = intersection (L.AR,L.BG) \end{tkzelements} - \hspace*{\fill} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygons(A,C,E,F A,B,G,H) - \tkzDrawCircles(O_1,C O_2,B O_0,B) - \tkzDrawSegments(H,C B,K A,L) - \tkzDrawPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) - \tkzLabelPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) - \end{tikzpicture} - \hspace*{\fill} -% subsection devine_ratio (end) +\hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,C,E,F A,B,G,H) +\tkzDrawCircles(O_1,C O_2,B O_0,B) +\tkzDrawSegments(H,C B,K A,L) +\tkzDrawPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) +\tkzLabelPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) +\end{tikzpicture} +\hspace*{\fill} +% subsection divine_ratio (end) \subsection{Director circle} % (fold) \label{sub:director_circle} % modif C: point (0.25) instead of 2 \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% - \begin{verbatim} - \begin{tkzelements} - scale = .5 - z.O = point: new (0 , 0) - z.F1 = point: new (4 , 0) - z.F2 = point: new (-4 , 0) - z.H = point: new (4*math.sqrt(2) , 0) - E = ellipse: foci (z.F2,z.F1,z.H) - a,b = E.Rx, E.Ry - z.A = E.covertex - T = triangle: new (z.H,z.O,z.A) - z.P = T: parallelogram () - C = circle: new (z.O,z.P) - z.L = C: point (0.25) - L.J,L.K = E: tangent_from (z.L) - z.J = L.J.pb - z.K = L.K.pb - \end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPoints(F1,F2,O) - \tkzDrawCircles[teal](O,P) - \tkzDrawPolygon(H,O,A,P) - \tkzDrawEllipse[red](O,\tkzUseLua{a},\tkzUseLua{b},0) - \tkzDrawSegments[orange](O,P O,L L,J L,K) - \tkzDrawPoints(F1,F2,O,H,A,P,L,J,K) - \tkzLabelPoints(F1,F2,O,H,A,P,L,J,K) - \tkzMarkRightAngles(A,P,H J,L,K) - \end{tikzpicture} - \end{verbatim} +\begin{verbatim} +\begin{tkzelements} + scale = .5 + z.O = point: new (0 , 0) + z.F1 = point: new (4 , 0) + z.F2 = point: new (-4 , 0) + z.H = point: new (4*math.sqrt(2) , 0) + E = ellipse: foci (z.F2,z.F1,z.H) + a,b = E.Rx, E.Ry + z.A = E.covertex + T = triangle: new (z.H,z.O,z.A) + z.P = T: parallelogram () + C = circle: new (z.O,z.P) + z.L = C: point (0.25) + L.J,L.K = E: tangent_from (z.L) + z.J = L.J.pb + z.K = L.K.pb +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(F1,F2,O) + \tkzDrawCircles[teal](O,P) + \tkzDrawPolygon(H,O,A,P) + \tkzDrawEllipse[red](O,\tkzUseLua{a},\tkzUseLua{b},0) + \tkzDrawSegments[orange](O,P O,L L,J L,K) + \tkzDrawPoints(F1,F2,O,H,A,P,L,J,K) + \tkzLabelPoints(F1,F2,O,H,A,P,L,J,K) + \tkzLabelPoints[above](L) + \tkzMarkRightAngles(A,P,H J,L,K) +\end{tikzpicture} +\end{verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{tkzelements} @@ -885,6 +890,7 @@ z.K = L.K.pb \tkzDrawSegments[orange](O,P O,L L,J L,K) \tkzDrawPoints(F1,F2,O,H,A,P,L,J,K) \tkzLabelPoints(F1,F2,O,H,A,P,L,J,K) +\tkzLabelPoints[above](L) \tkzMarkRightAngles(A,P,H J,L,K) \end{tikzpicture} \end{minipage} @@ -942,8 +948,8 @@ z.C = intersection (L.EG,L.AB) z.O = C.AB: antipode (z.B) \end{tkzelements} - \hspace*{\fill} - \begin{tikzpicture} +\hspace*{\fill} +\begin{tikzpicture} \tkzGetNodes \tkzDrawArc[delta=5](O,B)(G) \tkzDrawCircles(A,B B,A) @@ -952,13 +958,13 @@ z.O = C.AB: antipode (z.B) \tkzMarkSegments[mark=s||](A,E B,E O,A) \tkzDrawPoints(A,B,C,E,I,J,G,O,K) \tkzLabelPoints(A,B,C,E,I,J,G,O,K) - \end{tikzpicture} - \hspace*{\fill} +\end{tikzpicture} + \hspace*{\fill} % subsection gold_division (end) \subsection{Ellipse} % (fold) \label{sub:ellipse} - +\begin{minipage}{.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} z.C = point: new (3 , 2) @@ -971,7 +977,6 @@ z.O = C.AB: antipode (z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) - \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -981,7 +986,8 @@ z.O = C.AB: antipode (z.B) \tkzLabelPoints(C,A,B) \end{tikzpicture} \end{tkzexample} - +\end{minipage} +\begin{minipage}{.5\textwidth} \begin{tkzelements} z.C = point: new (3 , 2) z.A = point: new (5 , 1) @@ -1004,53 +1010,55 @@ slope = math.deg(E.slope) \tkzLabelPoints(C,A,B) \end{tikzpicture} \hspace*{\fill} +\end{minipage} % subsection ellipse (end) \subsection{Ellipse with radii} % (fold) \label{sub:ellipse_with_radii} - +\begin{minipage}{.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} -z.C = point: new (0 , 4) -z.B = point: new (4 , 0) -z.D = point: new (2 , 6) -b = math.sqrt(8) -a = math.sqrt(32) -ang = math.deg(math.pi/4) -E = ellipse: radii (z.C,a,b,math.pi/4) -z.V = E : point (0) -z.CoV = E : point (0.25) -\end{tkzelements} -\begin{tikzpicture} +scale=.5 +z.C = point: new (0 , 4) +b = value(math.sqrt(8)) +a = value(math.sqrt(32)) +ang = math.deg(math.pi/4) +E = ellipse: radii (z.C,a,b,math.pi/4) +z.V = E : point (0) +z.CoV = E : point (math.pi/2) +\end{tkzelements} +\begin{tikzpicture}[gridded] \tkzGetNodes -\tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) +\tkzDrawEllipse[blue](C,\tkzUseLua{a}, + \tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV) \end{tikzpicture} \end{tkzexample} - +\end{minipage} +\begin{minipage}{.5\textwidth} \begin{tkzelements} +scale=.5 z.C = point: new (0 , 4) -z.B = point: new (4 , 0) -z.D = point: new (2 , 6) -b = math.sqrt(8) -a = math.sqrt(32) +b = value(math.sqrt(8)) +a = value(math.sqrt(32)) ang = math.deg(math.pi/4) -E = ellipse: radii (z.C,a,b,math.pi/4) +E = ellipse: radii (z.C,a,b,math.pi/4) z.V = E : point (0) -z.CoV = E : point (0.25) -\end{tkzelements} +z.CoV = E : point (math.pi/2) +\end{tkzelements} \hspace*{\fill} -\begin{tikzpicture} +\begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV) \end{tikzpicture} +\end{minipage} % subsection ellipse_with_radii (end) \subsection{Ellipse\_with\_foci} % (fold) \label{sub:ellipse_with_foci} - +\begin{minipage}{.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} local e @@ -1079,7 +1087,8 @@ z.CoV = E : point (0.25) \tkzDrawLines(K,F K,G) \end{tikzpicture} \end{tkzexample} - +\end{minipage} +\begin{minipage}{.5\textwidth} \begin{tkzelements} local e e = .8 @@ -1109,27 +1118,28 @@ z.G = L.tb.pb \tkzDrawLines(K,F K,G) \end{tikzpicture} \hspace*{\fill} + \end{minipage} % subsection ellipse_with_foci (end) \subsection{Euler relation} % (fold) \label{sub:euler_relation} - +\begin{minipage}{.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} - scale = .75 - z.A = point: new (0 , 0) - z.B = point: new (5 , 0) - z.C = point: new (-.4 , 4) - T.ABC = triangle: new (z.A,z.B,z.C) - z.J,z.K = get_points(T.ABC: ex_circle (2)) - z.X ,z.Y,z.K = T.ABC : projection (z.J) - z.I,z.H = get_points(T.ABC : in_circle()) - z.O = T.ABC.circumcenter - C.OA = circle : new (z.O,z.A) - T.IBA = triangle: new (z.I,z.B,z.A) - z.w = T.IBA.circumcenter - L.Ow = line : new (z.O,z.w) - _,z.E = intersection (L.Ow, C.OA) + scale = .75 + z.A = point: new (0 , 0) + z.B = point: new (5 , 0) + z.C = point: new (-.4 , 4) + T.ABC = triangle: new (z.A,z.B,z.C) + z.J,z.K = get_points(T.ABC: ex_circle (2)) + z.X,z.Y,z.K= T.ABC : projection (z.J) + z.I,z.H = get_points(T.ABC : in_circle()) + z.O = T.ABC.circumcenter + C.OA = circle : new (z.O,z.A) + T.IBA = triangle: new (z.I,z.B,z.A) + z.w = T.IBA.circumcenter + L.Ow = line : new (z.O,z.w) + _,z.E = intersection (L.Ow, C.OA) \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -1143,7 +1153,8 @@ z.G = L.tb.pb \tkzMarkRightAngles[fill=gray!20,opacity=.4](C,H,I A,K,J) \end{tikzpicture} \end{tkzexample} - +\end{minipage} +\begin{minipage}{.5\textwidth} \begin{tkzelements} z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1173,6 +1184,7 @@ _,z.E = intersection (L.Ow, C.OA) \tkzMarkRightAngles[fill=gray!20,opacity=.4](C,H,I A,K,J) \end{tikzpicture} \hspace*{\fill} +\end{minipage} % subsection euler_relation (end) \subsection{External angle} % (fold) @@ -1180,33 +1192,33 @@ _,z.E = intersection (L.Ow, C.OA) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{verbatim} \begin{tkzelements} - scale =.8 - z.A = point: new (0 , 0) - z.B = point: new (5 , 0) - z.C = point: new (-2 , 4) - T.ABC = triangle: new (z.A,z.B,z.C) - T.ext = T.ABC: excentral () - z.O = T.ABC.circumcenter - z.D = intersection (T.ext.ab,T.ABC.ab) - z.E = z.C: symmetry (z.B) + scale = .75 + z.A = point: new (0 , 0) + z.B = point: new (5 , 0) + z.C = point: new (-2 , 4) + T.ABC = triangle: new (z.A,z.B,z.C) + T.ext = T.ABC: excentral () + z.O = T.ABC.circumcenter + z.D = intersection (T.ext.ab,T.ABC.ab) + z.E = z.C: symmetry (z.B) \end{tkzelements} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawLine[purple,add=0 and .5](B,C) - \tkzDrawSegment[purple](A,D) - \tkzDrawSegment[orange](C,D) - \tkzFillAngles[purple!30,opacity=.2](D,C,A E,C,D) - \tkzMarkAngles[mark=|](D,C,A E,C,D) - \tkzDrawPoints(A,...,D) - \tkzLabelPoints[above](C) - \tkzLabelPoints(A,B,D) + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawLine[purple,add=0 and .5](B,C) + \tkzDrawSegment[purple](A,D) + \tkzDrawSegment[orange](C,D) + \tkzFillAngles[purple!30,opacity=.2](D,C,A E,C,D) + \tkzMarkAngles[mark=|](D,C,A E,C,D) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints[above](C) + \tkzLabelPoints(A,B,D) \end{tikzpicture} \end{verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{tkzelements} -scale = .8 +scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-2 , 4) @@ -1230,6 +1242,7 @@ z.E = z.C: symmetry (z.B) \tkzLabelPoints[above](C) \tkzLabelPoints(A,B,D) \end{tikzpicture} +\hspace*{\fill} \end{minipage} % subsection external_angle (end) @@ -1488,7 +1501,7 @@ z.O_0 = L.AB.mid \subsection{Harmonic division v1} % (fold) \label{sub:harmonic_division_v1} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{minipage}[t]{.4\textwidth}\vspace{0pt}% \begin{verbatim} \begin{tkzelements} scale=.75 @@ -1523,7 +1536,7 @@ z.C = intersection (L.XG,L.AB) \end{tikzpicture} \end{verbatim} \end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{minipage}[t]{.6\textwidth}\vspace{0pt}% \begin{tkzelements} scale=.75 z.A = point: new (0 , 0) @@ -1556,6 +1569,7 @@ z.C = intersection (L.XG,L.AB) \tkzLabelPoints(A,B,G,E,F,C,D) \tkzMarkSegments(F,B B,E) \end{tikzpicture} +\hspace*{\fill} \end{minipage} % subsection harmonic_division_v1 (end) @@ -1621,7 +1635,7 @@ z.C = intersection (L.GX,L.AB) \subsection{Menelaus} % (fold) \label{sub:menelaus} -\begin{minipage}{.5\textwidth} +\begin{minipage}{.4\textwidth} \begin{verbatim} \begin{tkzelements} z.A = point: new (0 , 0) @@ -1645,7 +1659,7 @@ z.C = intersection (L.GX,L.AB) \end{tikzpicture} \end{verbatim} \end{minipage} -\begin{minipage}{.5\textwidth} +\begin{minipage}{.6\textwidth} \begin{tkzelements} z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1668,6 +1682,7 @@ z.R = intersection (L.BC,L.PX) \tkzDrawPoints(P,Q,R,A,B,C) \tkzLabelPoints(A,B,C,P,Q,R) \end{tikzpicture} +\hspace*{\fill} \end{minipage} % subsection menelaus (end) @@ -2041,7 +2056,7 @@ z.H = L.OOp : projection (z.X) \end{minipage} % subsection radical_circle (end) -\subsection{Hexagram} % (fold) +\subsection{Euler ellipse} % (fold) \label{sub:hexagram} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} @@ -2080,6 +2095,9 @@ z.H = L.OOp : projection (z.X) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) \end{tkzelements} + \end{tkzexample} + +\begin{tkzexample}[latex=0cm,small,code only] \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -2419,7 +2437,7 @@ z.O = C.DC : inversion (z.W) \end{tkzexample} \begin{tkzelements} -scale =.3 +scale =.5 z.A = point: new (0,0) z.B = point: new (6,0) z.C = point: new (0.8,4) @@ -2665,6 +2683,84 @@ z.Kp = L.Kp.pb \subsection{Midcircles} % (fold) \label{sub:midcircles} +\begin{tkzelements} +z.A = point: new (0 , 0) +z.B = point: new (10 , 0) +L.AB = line : new (z.A,z.B) +z.C = L.AB: gold_ratio () +L.AC = line : new (z.A,z.C) +L.CB = line : new (z.C,z.B) +z.O_0 = L.AB.mid +z.O_1 = L.AC.mid +z.O_2 = L.CB.mid +C.O0B = circle : new (z.O_0,z.B) +C.O1C = circle : new (z.O_1,z.C) +C.O2C = circle : new (z.O_2,z.B) +z.Q = C.O1C : midarc (z.C,z.A) +z.P = C.O2C : midarc (z.B,z.C) +L.O1O2 = line : new (z.O_1,z.O_2) +L.O0O1 = line : new (z.O_0,z.O_1) +L.O0O2 = line : new (z.O_0,z.O_2) +z.M_0 = L.O1O2 : harmonic_ext (z.C) +z.M_1 = L.O0O1 : harmonic_int (z.A) +z.M_2 = L.O0O2 : harmonic_int (z.B) +L.BQ = line : new (z.B,z.Q) +L.AP = line : new (z.A,z.P) +z.S = intersection (L.BQ,L.AP) +L.CS = line : new (z.C,z.S) +C.M1A = circle : new (z.M_1,z.A) +C.M2B = circle : new (z.M_2,z.B) +z.P_0 = intersection (L.CS,C.O0B) +z.P_1 = intersection (C.M2B,C.O1C) +z.P_2 = intersection (C.M1A,C.O2C) +T.P012 = triangle : new (z.P_0,z.P_1,z.P_2) +z.O_4 = T.P012.circumcenter +T.CP12 = triangle : new (z.C,z.P_1,z.P_2) +z.O_5 = T.CP12.circumcenter +z.BN = z.B : north () +L.BBN = line : new (z.B,z.BN) +L.M1P2 = line : new (z.M_1,z.P_2) +z.J = intersection (L.BBN,L.M1P2) +L.AP0 = line : new (z.A,z.P_0) +L.BP0 = line : new (z.B,z.P_0) +C.O4P0 = circle : new (z.O_4,z.P_0) +_,z.G = intersection (L.AP0,C.O4P0) +z.H = intersection (L.BP0,C.O4P0) +z.Ap = z.M_1: symmetry (z.A) +z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) +\end{tkzelements} + +\hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircle[thin,fill=green!10](O_4,P_0) +\tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) +\tkzDrawSemiCircles[teal](O_0,B) +\tkzDrawSemiCircles[thin,teal,fill=teal!20,opacity=.5](O_1,C O_2,B) +\tkzDrawSemiCircles[color = orange](M_2,B) +\tkzDrawSemiCircles[color = orange](M_1,A') +\tkzDrawArc[purple,delta=0](M_0,P_0)(C) +\tkzDrawSegments[very thin](A,B A,P B,Q) +\tkzDrawSegments[color=cyan](O_0,P_0 B,J G,J G,O_0 H,O_2) +\tkzDrawSegments[ultra thin,purple](M_1,P_0 M_2,P_0 M_1,M_0 M_0,P_1 M_0,P_0 M_1,J) +\tkzDrawPoints(A,B,C,P_0,P_2,P_1,M_0,M_1,M_2,J,P,Q,S) +\tkzDrawPoints(O_0,O_1,O_2,O_4,O_5,G,H) +\tkzMarkRightAngle[size=.2,fill=gray!20,opacity=.4](O_0,P_0,M_0) +\tkzLabelPoints[below](A,B,C,M_0,M_1,M_2,O_1,O_2,O_0) +\tkzLabelPoints[above](P_0,O_5,O_4) +\tkzLabelPoints[above](P_1,J) +\tkzLabelPoints[above](P_2,P,Q,S) +\tkzLabelPoints[above right](H,E) +\tkzLabelPoints[above left](F,G) +\tkzLabelPoints[below right](H_0) +\tkzLabelCircle[below=4pt,font=\scriptsize](O_1,C)(80){$(\beta)$} +\tkzLabelCircle[below=4pt,font=\scriptsize](O_2,B)(80){$(\gamma)$} +\tkzLabelCircle[below=4pt,font=\scriptsize](O_0,B)(110){$(\alpha)$} +\tkzLabelCircle[left,font=\scriptsize](O_4,P_2)(60){$(\delta)$} +\tkzLabelCircle[above left,font=\scriptsize](O_5,C)(40){$(\epsilon)$} +\end{tikzpicture} +\hspace*{\fill} + \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} z.A = point: new (0 , 0) @@ -2712,7 +2808,9 @@ z.Kp = L.Kp.pb z.Ap = z.M_1: symmetry (z.A) z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) \end{tkzelements} +\end{tkzexample} +\begin{tkzexample}[latex=0cm,small,code only] \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle[thin,fill=green!10](O_4,P_0) @@ -2743,83 +2841,7 @@ z.Kp = L.Kp.pb \end{tikzpicture} \end{tkzexample} -\begin{tkzelements} -z.A = point: new (0 , 0) -z.B = point: new (10 , 0) -L.AB = line : new (z.A,z.B) -z.C = L.AB: gold_ratio () -L.AC = line : new (z.A,z.C) -L.CB = line : new (z.C,z.B) -z.O_0 = L.AB.mid -z.O_1 = L.AC.mid -z.O_2 = L.CB.mid -C.O0B = circle : new (z.O_0,z.B) -C.O1C = circle : new (z.O_1,z.C) -C.O2C = circle : new (z.O_2,z.B) -z.Q = C.O1C : midarc (z.C,z.A) -z.P = C.O2C : midarc (z.B,z.C) -L.O1O2 = line : new (z.O_1,z.O_2) -L.O0O1 = line : new (z.O_0,z.O_1) -L.O0O2 = line : new (z.O_0,z.O_2) -z.M_0 = L.O1O2 : harmonic_ext (z.C) -z.M_1 = L.O0O1 : harmonic_int (z.A) -z.M_2 = L.O0O2 : harmonic_int (z.B) -L.BQ = line : new (z.B,z.Q) -L.AP = line : new (z.A,z.P) -z.S = intersection (L.BQ,L.AP) -L.CS = line : new (z.C,z.S) -C.M1A = circle : new (z.M_1,z.A) -C.M2B = circle : new (z.M_2,z.B) -z.P_0 = intersection (L.CS,C.O0B) -z.P_1 = intersection (C.M2B,C.O1C) -z.P_2 = intersection (C.M1A,C.O2C) -T.P012 = triangle : new (z.P_0,z.P_1,z.P_2) -z.O_4 = T.P012.circumcenter -T.CP12 = triangle : new (z.C,z.P_1,z.P_2) -z.O_5 = T.CP12.circumcenter -z.BN = z.B : north () -L.BBN = line : new (z.B,z.BN) -L.M1P2 = line : new (z.M_1,z.P_2) -z.J = intersection (L.BBN,L.M1P2) -L.AP0 = line : new (z.A,z.P_0) -L.BP0 = line : new (z.B,z.P_0) -C.O4P0 = circle : new (z.O_4,z.P_0) -_,z.G = intersection (L.AP0,C.O4P0) -z.H = intersection (L.BP0,C.O4P0) -z.Ap = z.M_1: symmetry (z.A) -z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle[thin,fill=green!10](O_4,P_0) -\tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) -\tkzDrawSemiCircles[teal](O_0,B) -\tkzDrawSemiCircles[thin,teal,fill=teal!20,opacity=.5](O_1,C O_2,B) -\tkzDrawSemiCircles[color = orange](M_2,B) -\tkzDrawSemiCircles[color = orange](M_1,A') -\tkzDrawArc[purple,delta=0](M_0,P_0)(C) -\tkzDrawSegments[very thin](A,B A,P B,Q) -\tkzDrawSegments[color=cyan](O_0,P_0 B,J G,J G,O_0 H,O_2) -\tkzDrawSegments[ultra thin,purple](M_1,P_0 M_2,P_0 M_1,M_0 M_0,P_1 M_0,P_0 M_1,J) -\tkzDrawPoints(A,B,C,P_0,P_2,P_1,M_0,M_1,M_2,J,P,Q,S) -\tkzDrawPoints(O_0,O_1,O_2,O_4,O_5,G,H) -\tkzMarkRightAngle[size=.2,fill=gray!20,opacity=.4](O_0,P_0,M_0) -\tkzLabelPoints[below](A,B,C,M_0,M_1,M_2,O_1,O_2,O_0) -\tkzLabelPoints[above](P_0,O_5,O_4) -\tkzLabelPoints[above](P_1,J) -\tkzLabelPoints[above](P_2,P,Q,S) -\tkzLabelPoints[above right](H,E) -\tkzLabelPoints[above left](F,G) -\tkzLabelPoints[below right](H_0) -\tkzLabelCircle[below=4pt,font=\scriptsize](O_1,C)(80){$(\beta)$} -\tkzLabelCircle[below=4pt,font=\scriptsize](O_2,B)(80){$(\gamma)$} -\tkzLabelCircle[below=4pt,font=\scriptsize](O_0,B)(110){$(\alpha)$} -\tkzLabelCircle[left,font=\scriptsize](O_4,P_2)(60){$(\delta)$} -\tkzLabelCircle[above left,font=\scriptsize](O_5,C)(40){$(\epsilon)$} -\end{tikzpicture} -\hspace*{\fill} % subsection midcircles (end) \subsection{Pencil v1} % (fold) @@ -4452,11 +4474,11 @@ z.L = T.golden.pc L.O0L = line:new(z.O_0,z.L) z.D = intersection (L.O0L,C.O0B) L.DB = line:new(z.D,z.B) -z.Z = intersection (L.DB,C.O2B) +_,z.Z = intersection (L.DB,C.O2B) L.DA = line:new(z.D,z.A) z.I = intersection (L.DA,C.O1C) L.O2Z = line:new(z.O_2,z.Z) -z.H = intersection (L.O2Z,C.O0B) +_,z.H = intersection (L.O2Z,C.O0B) C.BD = circle:new (z.B,z.D) C.DB = circle:new (z.D,z.B) _,z.G = intersection (C.BD,C.O0B) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex index 935c4fdeea..3bfc5fc4ea 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex @@ -172,16 +172,16 @@ The difference between |z.A = point : new (1,2)| and |za = point (1,2)| is that \toprule \textbf{Metamethods} & \textbf{Application} \\ \midrule -__add(z1,z2) & |z.a + z.b| & affix \\ -__sub(z1,z2) & |z.a - z.b| & affix\\ -__unm(z) & |- z.a| & affix\\ -__mul(z1,z2) & |z.a * z.b| & affix\\ -__concat(z1,z2)& |z.a .. z.b| & dot product = real number \footnote{If $O$ is the origin of the complex plan, then we get the dot product of the vectors $\overrightarrow{Oa}$ and $\overrightarrow{Ob}$} \\ -__pow(z1,z2) & |z.a ^ z.b| & determinant = real number\\ -__div(z1,z2) & |z.a / z.b| & affix \\ -__tostring(z) & tex.print(tostring(z)) & displays the affix \\ -__tonumber(z) & tonumber(z) & affix or nil\\ -__eq(z1,z2) & eq (z.a,z.b) & boolean\\ +\_\_add(z1,z2) & |z.a + z.b| & affix \\ +\_\_sub(z1,z2) & |z.a - z.b| & affix\\ +\_\_unm(z) & |- z.a| & affix\\ +\_\_mul(z1,z2) & |z.a * z.b| & affix\\ +\_\_concat(z1,z2)& |z.a .. z.b| & dot product = real number \footnote{If $O$ is the origin of the complex plan, then we get the dot product of the vectors $\overrightarrow{Oa}$ and $\overrightarrow{Ob}$} \\ +\_\_pow(z1,z2) & |z.a ^ z.b| & determinant = real number\\ +\_\_div(z1,z2) & |z.a / z.b| & affix \\ +\_\_tostring(z) & tex.print(tostring(z)) & displays the affix \\ +\_\_tonumber(z) & tonumber(z) & affix or nil\\ +\_\_eq(z1,z2) & eq (z.a,z.b) & boolean\\ \bottomrule \end{tabular} \end{minipage} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex index 862be86799..95ce56dbc3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex @@ -1,6 +1,6 @@ % !TEX TS-program = lualatex % encoding : utf8 -% Documentation of tkz-elements v1.82c +% Documentation of tkz-elements v2.00c % Copyright 2023 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-elements} -\gdef\tkzversionofpack{1.82c} +\gdef\tkzversionofpack{2.00c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{tkz-elements.pdf} -\gdef\tkzversionofdoc{1.82c} +\gdef\tkzversionofdoc{2.00c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} @@ -225,6 +225,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \input{TKZdoc-elements-classes-rectangle.tex} \input{TKZdoc-elements-classes-parallelogram.tex} \input{TKZdoc-elements-classes-regular.tex} +\input{TKZdoc-elements-classes-vectors.tex} \input{TKZdoc-elements-classes-misc.tex} \input{TKZdoc-elements-intersection.tex} \input{TKZdoc-elements-indepthstudy.tex} @@ -238,12 +239,12 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \label{sec:cheat_sheet} % section cheat_sheet (end) -|r| denotes a real number, |d| a positive real number, |n|an integer, |an| an angle, |b| a boolean, |s| a character string, |pt| a point, |v| variable, |L| a straight line, |C| a circle, |T| a triangle, |E| an ellipse, |Q| a quadrilateral, |P| a parallelogram, |R| a rectangle, |S| a square, |RP| a regular polygon, |O| an object (pt, L,C,T), . . a list of points or an object, < > optional argument. +|r| denotes a real number, |d| a positive real number, |n|an integer, |an| an angle, |b| a boolean, |s| a character string, |pt| a point, |v| variable, |L| a straight line, |C| a circle, |T| a triangle, |E| an ellipse, |V| a vector,|Q| a quadrilateral, |P| a parallelogram, |R| a rectangle, |S| a square, |RP| a regular polygon, |O| an object (pt, L,C,T), . . a list of points or an object, < > optional argument. \begin{multicols}{3} - -\fbox{\textbf{Point}}\\ -\textbf{Attributes} table(\ref{point:att}) \\ + +\fbox{\textbf{point}}\\ +\textbf{Attributes} table(\ref{point:att}) \\ |re -> r| \\ |im -> r| \\ |type -> s| \\ @@ -254,10 +255,10 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |.. -> r| \\ |^ -> r| \\ |conj -> pt| \\ -|abs -> | \\ -|mod -> | \\ -|norm -> | \\ -|arg -> r| \\ +|abs -> r| \\ +|mod -> d| \\ +|norm -> d| \\ +|arg -> d| \\ |get -> r,r| \\ |sqrt -> pt| \\ |new -> pt| \\ @@ -271,6 +272,8 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |symmetry (...) -> O| \\ |rotation (an , ...) -> O| \\ |homothety (r , ...) -> O| \\ +|orthogonal(d) -> pt| \\ +|at() -> pt| \\ \\ \fbox{\textbf{line}} \\ \textbf{Attributes} table(\ref{line:att}) \\ @@ -285,6 +288,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |west -> pt| \\ |slope -> r| \\ |length -> d| \\ +|vec -> V| \\ \textbf{Methods} table(\ref{line:met}) \\ |new (pt,pt) -> d| \\ |distance (pt) -> d| \\ @@ -327,7 +331,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |gold () -> T| \\ |euclide () -> T| \\ |golden () -> T| \\ -|devine () -> T| \\ +|divine () -> T| \\ |cheops () -> T| \\ |pythagoras () -> T| \\ |sublime () -> T| \\ @@ -406,6 +410,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |-> r,r,r| \\ |in_out (pt) -> pt| \\ |check_equilateral () -> b| \\ + \\ \fbox{\textbf{circle}} \\ \textbf{Attributes} table(\ref{circle:att}) \\ |center -> pt| \\ @@ -546,11 +551,27 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |incircle () -> C| \\ |name (s) -> ?| \\ \\ +\fbox{\textbf{vector}} \\ +\textbf{Attributes} table(\ref{vector:att}) \\ +|pa,pb -> pt| \\ +|type -> s| \\ +|norm -> d| \\ +|slope -> r| \\ +\textbf{Methods} table(\ref{vector:met})\\ +|new (pt,pt) -> V| \\ +|+ - * -> pt| \\ +|normalize (V) -> V| \\ +|orthogonal (d) -> V| \\ +|scale (r) -> V| \\ +|at (pt) -> V| \\ + \\ \fbox{\textbf{Misc.}} \\ - \textbf{Attributes} table(\ref{misc}) \\ + \textbf{Attributes} table(\ref{misc}) \\ +|scale (default =1) -> r| \\ |tkzphi -> r| \\ |tkzinvphi -> r | \\ |tkzsqrtphi -> r | \\ +|tkz_epsilon (default=1e-8)-> r | \\ |length -> d | \\ |islinear(pt,pt,pt) -> b | \\ |isortho(pt,pt,pt) -> b | \\ @@ -564,5 +585,10 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |altitude (pt,pt,pt) -> L| \\ |midpoint (pt,pt) -> pt| \\ |equilateral (pt,pt) -> T| \\ +|format_number(r,n) -> r| \\ + +\fbox{\textbf{Macros}} \\ +|\tkzDN[n]{r} -> r| \\ +|\tkzDrawLuaEllipse((pt,pt,pt))| \\ \end{multicols} \end{document} \ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex index f69e0a591d..0d59a2b80b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex @@ -3,9 +3,8 @@ Here's a sample organization. -The line |% !TEX TS-program = lualatex| ensures that you don't forget to compile with Lua\LATEX{}. The "standalone" class is useful, as all you need to do here is create a figure. +The line |% !TEX TS-program = lualatex| ensures that you don't forget to compile with Lua\LATEX{}. The “standalone” class is useful, as all you need to do here is create a figure. -The "mini" option in \pkg{tkz-euclide} allows you to load and use only plot-related macros. The package \pkg{ifthen} is useful if you need to use some Boolean. @@ -13,7 +12,7 @@ The macro \tkzcname{LuaCodeDebugOn} allows you to try and find errors in Lua cod It is of course possible to leave the Lua code in the \tkzNameEnv{tkzelements} environment, but externalizing this code has its advantages. -The first advantage, if you use a good editor, is to have a good presentation of the code. Styles are different between "Lua" and \LATEX{}. This makes the code clearer. This is how I proceeded, then reintegrated the code into the main code. +The first advantage, if you use a good editor, is to have a good presentation of the code. Styles are different between “Lua” and \LATEX{}. This makes the code clearer. This is how I proceeded, then reintegrated the code into the main code. Another advantage is that you don't have to comment the code incorrectly. For Lua code, you comment lines with |--| (double minus sign), whereas for \LATEX{}, you comment with |%|. @@ -26,7 +25,7 @@ Third advantage: the code can be reused. % Created by Alain Matthes on 2024-01-09. \documentclass[margin = 12pt]{standalone} -\usepackage[mini]{tkz-euclide} +\usepackage{tkz-euclide} \usepackage{tkz-elements,ifthen} \begin{document} @@ -46,7 +45,7 @@ Third advantage: the code can be reused. \end{document} \end{verbatim} -And here is the code for the "Lua" part: the file |ex_sangaku.lua| +And here is the code for the “Lua” part: the file |ex_sangaku.lua| \begin{verbatim} z.A = point : new ( 0,0 ) @@ -79,7 +78,7 @@ z.I = intersection (L.Cc,L.BF) \subsection{Scale problem} % (fold) \label{sub:scale_problem} -If necessary, it's better to do the scaling in the "Lua" section. The reason is that it will be more accurate. There is, however, a problem to be aware of. I've made it a point of honor to avoid using numerical values in my codes whenever possible. In principle, these values only appear in the definition of fixed points. If the "scale" option is used, scaling is applied when points are created. Let's imagine you want to organize your code as follows: +If necessary, it's better to do the scaling in the “Lua” section. The reason is that it will be more accurate. There is, however, a problem to be aware of. I've made it a point of honor to avoid using numerical values in my codes whenever possible. In principle, these values only appear in the definition of fixed points. If the “scale” option is used, scaling is applied when points are created. Let's imagine you want to organize your code as follows: |scale = 1.5|\\ |xB = 8|\\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex index 2dbc732666..86fcc479ab 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex @@ -132,23 +132,23 @@ When all the points necessary for the drawing are obtained, they must be transfo z.A = point: new (0 , 0) z.B = point: new (10 , 0) -- creation of two fixed points $A$ and $B$ L.AB = line: new ( z.A, z.B) -z.C = L.AB: gold_ratio () -- use of a method linked to "line" -z.O_0 = line: new ( z.A, z.B).mid -- midpoint of segment with an attribute of "line" +z.C = L.AB: gold_ratio () -- use of a method linked to “line” +z.O_0 = line: new ( z.A, z.B).mid -- midpoint of segment with an attribute of “line” z.O_1 = line: new ( z.A, z.C).mid -- objects are not stored and cannot be reused. z.O_2 = line: new ( z.C, z.B).mid -C.AB = circle: new ( z.O_0, z.B) -- new object "circle" stored and reused +C.AB = circle: new ( z.O_0, z.B) -- new object “circle” stored and reused C.AC = circle: new ( z.O_1, z.C) C.CB = circle: new ( z.O_2, z.B) -z.P = C.CB.north -- "north" atrributes of a circle +z.P = C.CB.north -- no“rth atrributes of a circle z.Q = C.AC.north z.O = C.AB.south -z.c = z.C : north (2) -- "north" method of a point (needs a parameter) +z.c = z.C : north (2) -- “north” method of a point (needs a parameter) C.PC = circle: new ( z.P, z.C) C.QA = circle: new ( z.Q, z.A) z.P_0 = intersection (C.PC,C.AB) -- search for intersections of two circles. z.P_1 = intersection (C.PC,C.AC) -- idem _,z.P_2 = intersection (C.QA,C.CB) -- idem -z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter -- circumcenter attribute of "triangle" +z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter -- circumcenter attribute of “triangle” \end{tkzelements} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf index d5b920c981..14426183c2 100644 Binary files a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf and b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf differ diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty index 2b388229e4..d3618f8e31 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty @@ -1,5 +1,5 @@ % encoding : utf8 -% tkz-elements.sty v1.82c +% tkz-elements.sty v2.00c % Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -11,12 +11,13 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[2024/01/16 v1.82c Graphic Object Library] +\ProvidesPackage{tkz-elements}[2024/02/04 v2.00c Graphic Object Library] \RequirePackage{luacode} \directlua{require "tkz_elements_main"} \newenvironment{tkzelements} { \directlua{scale=1} + \directlua{tkz_epsilon=1e-8} \directlua{indirect = true} \directlua{for k,v in pairs(z) do z[k] = nil end} \directlua{for k,v in pairs(C) do C[k] = nil end} @@ -45,4 +46,20 @@ end} } \def\tkzUseLua#1{\directlua{tex.print(tostring(#1))}} +\makeatletter +\def\tkzDrawLuaEllipse{\pgfutil@ifnextchar[{\tkz@DrawLuaEllipse}{\tkz@DrawLuaEllipse[]}} +\def\tkz@DrawLuaEllipse[#1](#2,#3,#4){% +\begingroup +\draw[#1](#2) ellipse [x radius=\tkzUseLua{length(z.#3,z.#2)}, y radius = \tkzUseLua{length(z.#4,z.#2)},rotate=\tkzUseLua{math.deg(slope_ (z.#3,z.#2))}]; +\endgroup +} +\def\tkzDN{\pgfutil@ifnextchar[{\tkz@DN}{\tkz@DN[2]}} +\def\tkz@DN[#1]#2{% +\begingroup +\pgfkeys{/pgf/number format/.cd,std,precision=#1} +\pgfmathprintnumber{#2} +\endgroup + } + +\makeatother \endinput diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua index ae257221f4..e22e3eefd0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua @@ -1,6 +1,6 @@ -- tkz_elements-circles.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -52,10 +52,9 @@ end -- boolean -- ----------------------- function circle: in_out (pt) - local d,epsilon - epsilon = 10^(-12) + local d d = point.abs (pt - self.center) - if math.abs(d-self.radius) < epsilon + if math.abs(d-self.radius) < tkz_epsilon then return true else @@ -129,20 +128,6 @@ function circle: external_similitude (C) return external_similitude_ (self.center,self.radius,C.center,C.radius) end -function circle : common_tangent(C) - local o,s1,s2,t1,t2 - o = external_similitude_ (self.center,self.radius,C.center,C.radius) - - if self.radius < C.radius then - t1,t2 = tangent_from_ (C.center,C.through,o) - s1,s2 = tangent_from_ (self.center,self.through,o) - return s1,t1,t2,s2 - else - s1,s2 = tangent_from_ (C.center,C.through,o) - t1,t2 = tangent_from_ (self.center,self.through,o) - return s1,t1,t2,s2 - end -end ----------------------- -- lines -- ----------------------- @@ -190,7 +175,6 @@ function circle : radical_circle (C1,C2) end end - -- version 1.60 new function circle : external_tangent(C) local i,t1,t2,k,T1,T2 i = barycenter_ ({C.center,self.radius},{self.center,-C.radius}) @@ -200,7 +184,7 @@ end T2 = homothety_(i,k,t2) return line : new (t1,T1),line : new (t2,T2) end - -- version 1.60 new + function circle : internal_tangent(C) local i,t1,t2,k,T1,T2 i = barycenter_ ({C.center,self.radius},{self.center,C.radius}) @@ -210,6 +194,21 @@ end T2 = homothety_(i,k,t2) return line : new (t1,T1),line : new (t2,T2) end + + function circle : common_tangent(C) + local o,s1,s2,t1,t2 + o = external_similitude_ (self.center,self.radius,C.center,C.radius) + + if self.radius < C.radius then + t1,t2 = tangent_from_ (C.center,C.through,o) + s1,s2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + else + s1,s2 = tangent_from_ (C.center,C.through,o) + t1,t2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + end + end ----------------------- -- circles -- ----------------------- diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua index 91b12ce31e..97bdc9449d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua @@ -1,6 +1,6 @@ -- tkz_elements_class.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- from class.lua (Simple Lua Classes from Lua-users wiki) -- Compatible with Lua 5.1 (not 5.0). -- http://lua-users.org/wiki/SimpleLuaClasses DavidManura diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua index f3fa0d173b..98800f791e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua @@ -1,6 +1,6 @@ -- tkz_elements-ellipses.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -105,13 +105,12 @@ function ellipse: tangent_from (pt) end function ellipse: in_out (pt) - local d,D,an,m,epsilon - epsilon = 10^(-12) + local d,D,an,m d = point.abs (pt - self.center) an = point.arg (pt - self.center) m = point(self.Rx*math.cos(an),self.Ry*math.sin(an)) D = point.abs (m - self.center) - if D-d > epsilon + if D-d > tkz_epsilon then return true else diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua index 33477340d3..fe72c68c27 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_circles.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -53,14 +53,13 @@ function inversion_ (c,p,pt) end function circles_position_ (c1,r1,c2,r2) - local d,max,min,epsilon - epsilon = 10^(-12) + local d,max,min d = point.mod(c1-c2) max = r1+r2 min = math.abs ( r1 - r2) if d > max then return "outside" - elseif math.abs(d - max) < epsilon then return "outside tangent" -- epsilon - elseif math.abs(d - min) < epsilon then return "inside tangent" -- epsilon + elseif math.abs(d - max) < tkz_epsilon then return "outside tangent" -- epsilon + elseif math.abs(d - min) < tkz_epsilon then return "inside tangent" -- epsilon elseif d < min then return "inside" else return "intersect" end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua index be7eea4461..7dd2c59c32 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua @@ -1,6 +1,6 @@ -- tkz_elements_intersections.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -33,10 +33,9 @@ end -- function -- line ellipse function intersection_le (L,E) - local a,b,c,d,t1,t2,z1,z2,A,B,Bx,By,Ax,Ay,Rx,Ry,epsilon,sd + local a,b,c,d,t1,t2,z1,z2,A,B,Bx,By,Ax,Ay,Rx,Ry,sd A = (L.pa - E.center)*(point(math.cos(E.slope),-math.sin(E.slope))) B = (L.pb - E.center)*(point(math.cos(E.slope),-math.sin(E.slope))) - epsilon = 10^(-6) Rx = E.Rx Ry = E.Ry Ax = A.re @@ -62,7 +61,7 @@ function intersection_le (L,E) return z2*(point(math.cos(E.slope),math.sin(E.slope))) + E.center, z1*(point(math.cos(E.slope),math.sin(E.slope))) + E.center end -- if - elseif math.abs(d) < epsilon + elseif math.abs(d) < tkz_epsilon then t1 = (-(b))/(2*a) z1 = point ( Ax + (Bx-Ax)*t1 , Ay + (By-Ay)*t1 ) @@ -74,8 +73,7 @@ function intersection_le (L,E) end function intersection_ll_ (a,b,c,d) - local x1,x2,x3,x4,y1,y2,y3,y4,DN,NX,NY,epsilon - epsilon = 10^(-12) + local x1,x2,x3,x4,y1,y2,y3,y4,DN,NX,NY x1 = a.re y1 = a.im x2 = b.re @@ -85,7 +83,7 @@ function intersection_ll_ (a,b,c,d) x4 = d.re y4 = d.im DN = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4) - if math.abs ( DN ) < epsilon then + if math.abs ( DN ) < tkz_epsilon then return false else NX = (x1*y2-y1*x2)*(x3-x4) - (x1-x2)*(x3*y4-y3*x4) @@ -95,18 +93,17 @@ function intersection_ll_ (a,b,c,d) end function intersection_lc_ (pa,pb,c,p) - local zh, dh, arg_ab, test, phi,epsilon,c1,c2,r + local zh, dh, arg_ab, test, phi,c1,c2,r r = point.mod (c-p) - epsilon = 10^(-12) zh = projection_ (pa,pb,c) dh = point.abs (c - zh) arg_ab = point.arg (pa - pb) - if dh < epsilon + if dh < tkz_epsilon then return c + polar_ (r , math.pi + arg_ab), -- through center c + polar_ (r , arg_ab) - elseif math.abs (r - dh) < epsilon + elseif math.abs (r - dh) < tkz_epsilon then return zh , zh -- tangent elseif dh > r diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua index 642d048809..c9d840d89c 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_lines.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -28,9 +28,7 @@ function ll_from_ ( p , a , b ) end function slope_ (a,b) - local z = b - a - angle = point.arg(z) - return angle + return angle_normalize_ (point.arg(b-a)) end function gold_segment_ (a,b) @@ -132,10 +130,9 @@ function square_ (a,b) end function in_segment_ (a,b,pt) - local sc,epsilon - epsilon = 10^(-12) + local sc sc = point.mod (pt-a) + point.mod (pt-b) - point.mod(b-a) - if sc <= epsilon + if sc <= tkz_epsilon then return true else diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua index 0702b0a568..63f5190f02 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -39,10 +39,9 @@ function Cramer22(a1,a2,b1,b2) end function aligned ( m,a,b ) - local z,epsilon - epsilon = 10^(-8) + local z z = (b-a)/(m-b) - if math.abs(z.im) < epsilon + if math.abs(z.im) < tkz_epsilon then return true else @@ -51,11 +50,9 @@ function aligned ( m,a,b ) end function islinear (z1,z2,z3) - local epsilon local dp - epsilon = 10^(-8) dp = (z2-z1) ^ (z3-z1) - if math.abs(dp) < epsilon + if math.abs(dp) < tkz_epsilon then return true else @@ -64,11 +61,9 @@ function islinear (z1,z2,z3) end function isortho (z1,z2,z3) - local epsilon local dp - epsilon = 10^(-8) dp = (z2-z1) .. (z3-z1) - if math.abs(dp) < epsilon + if math.abs(dp) < tkz_epsilon then return true else @@ -112,16 +107,13 @@ return angle_normalize_ (a) end function angle_normalize_ (a) -local dblpi - dblpi = 2 * math.pi - if a > dblpi - then - a = a - dblpi - end - if a < 0 then - a = a + dblpi - end - return a + while a < 0 do + a = a + 2*math.pi + end + while a >= 2*math.pi do + a = a - 2*math.pi + end + return a end function barycenter (...) @@ -133,4 +125,9 @@ function swap(a,b) a=b b=t return a,b -end \ No newline at end of file +end + +function format_number(number, decimal_places) + local format_string = string.format("%%.%df", decimal_places) + return string.format(format_string, number) +end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua index dfe86444df..cb91788424 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_points.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua index 4c0db75393..7f71760066 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_regular.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua index c574147912..d6a1cb1ecb 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_triangles.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -268,12 +268,11 @@ function area_ (a,b,c) end function check_equilateral_ (a,b,c) - local A,B,C,epsilon - epsilon = 10 ^(-8) + local A,B,C A = b - c B = a - c C = a - b - if (point.abs(A)-point.abs(B) < epsilon) and (point.abs(B)-point.abs(C) < epsilon) + if (point.abs(A)-point.abs(B) < tkz_epsilon) and (point.abs(B)-point.abs(C) < tkz_epsilon) then return true else return false end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua index 1e45a544db..d8c8944835 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua @@ -1,6 +1,6 @@ -- tkz_elements_lines.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -25,8 +25,9 @@ function line: new(za, zb) local south_pb = rotation_ (zb,math.pi/2,za) local west = rotation_ (za,math.pi/2,north_pa) local east = rotation_ (zb,math.pi/2,south_pb) - local slope = point.arg(zb-za) + local slope = angle_normalize_(point.arg(zb-za)) local length = point.mod(zb-za) + local vec = vector : new (za,zb) local o = {pa = za, pb = zb, north_pa = north_pa, @@ -38,6 +39,7 @@ function line: new(za, zb) slope = slope, mid = mid, type = type, + vec = vec, length = length} setmetatable(o, self) self.__index = self @@ -62,10 +64,9 @@ end -- Result -> boolean ------------------- function line: in_out (pt) - local sc,epsilon - epsilon = 10^(-12) + local sc sc = math.abs ((pt-self.pa)^(pt-self.pb)) - if sc <= epsilon + if sc <= tkz_epsilon then return true else @@ -74,10 +75,9 @@ function line: in_out (pt) end function line: in_out_segment (pt) - local sc,epsilon - epsilon = 10^(-12) + local sc sc = point.mod (pt-self.pa) + point.mod (pt-self.pb) - point.mod(self.pb-self.pa) - if sc <= epsilon + if sc <= tkz_epsilon then return true else @@ -430,14 +430,11 @@ end line.euclid = line.sublime function line: euclide (swap) - if swap == nil then - swap = false - end -if swap then + if swap == nil then + return triangle : new (self.pa,self.pb, rotation_ (self.pa,math.pi/5,self.pb)) + else return triangle : new (self.pa,self.pb, rotation_ (self.pa,-math.pi/5,self.pb)) -else - return triangle : new (self.pa,self.pb, rotation_ (self.pa,math.pi/5,self.pb)) - end + end end function line: divine () @@ -464,14 +461,8 @@ function line: egyptian () end line.pythagoras = line.egyptian line.isis = line.egyptian - -function line: golden () - local n,pt - n = rotation_ (self.pb,- math.pi/2,self.pa) - pt = self.pb + (n-self.pb)/tkzphi - return triangle : new (self.pa,self.pb,pt) -end - +line.golden = line.sublime +line.golden_gnomon = line.divine ------------------------------ -- Result -> couple of points diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua index 132f193667..92eab43a84 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua @@ -1,6 +1,6 @@ -- tkz_elements-main.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua index 23f088983f..f95877a844 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua index 386eb023e0..5ce1d2a9a4 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua @@ -1,6 +1,6 @@ -- tkz_elements_parallelogram.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -17,11 +17,10 @@ parallelogram = {} function parallelogram: new (za, zb, zc, zd) - local d,epsilon - epsilon = 10^(-8) + local d local zi = midpoint_ (za,zc) local zj = midpoint_ (zb,zd) - if point.abs (zj-zi) < epsilon then else error ("it's not a parallelogram") + if point.abs (zj-zi) < tkz_epsilon then else error ("it's not a parallelogram") end local type = 'parallelogram' local center = midpoint_ (za,zc) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua index 7530dfc96a..8837299966 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua @@ -1,6 +1,6 @@ -- tkz_elements_point.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -311,4 +311,18 @@ end function point: normalize() local d = point.abs(self) return point(self.re/d,self.im/d) +end + +function point: orthogonal(d) + local m + if d==nil then + return point(-self.im,self.re) +else + m = point.mod(self) + return point(-self.im*d/m,self.re*d/m) +end +end + +function point : at (z) + return point(self.re+z.re,self.im+z.im) end \ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua index e80065540b..e1882c67cb 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua @@ -1,6 +1,6 @@ -- tkz_elements_quadrilateral.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -50,11 +50,10 @@ function quadrilateral: new (za, zb, zc, zd) end ----------------------- function quadrilateral : iscyclic () - local d,epsilon - epsilon = 10^(-8) + local d local alpha = point.arg ((self.pd-self.pa) / (self.pb-self.pa)) local beta = point.arg ((self.pb-self.pc) / (self.pd-self.pc)) - if math.abs (alpha+beta-math.pi) < epsilon then return true + if math.abs (alpha+beta-math.pi) < tkz_epsilon then return true else return false end end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua index abb9c2f8e9..7c4f8f75ed 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua @@ -1,6 +1,6 @@ -- tkz_elements-rectangle.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -17,13 +17,12 @@ rectangle = {} function rectangle: new (za, zb,zc,zd) - local d,epsilon - epsilon = 10^(-8) + local d local zi = midpoint_ (za,zc) local zj = midpoint_ (zb,zd) - if point.abs (zj-zi) < epsilon then else error ("it's not a rectangle") + if point.abs (zj-zi) < tkz_epsilon then else error ("it's not a rectangle") end - if math.abs(point.abs (zc-za)-point.abs (zd-zb)) < epsilon then else error ("it's not a rectangle") + if math.abs(point.abs (zc-za)-point.abs (zd-zb)) < tkz_epsilon then else error ("it's not a rectangle") end local type = 'rectangle' local center = midpoint_ (za,zc) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua index dbd6273205..2e00ab9598 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_regular.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua index e9854efbe3..fe7b7a150b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua @@ -1,6 +1,6 @@ -- tkz_elements-square.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -17,15 +17,14 @@ square = {} function square: new (za, zb,zc,zd) - local d,epsilon - epsilon = 10^(-8) + local d local zi = midpoint_ (za,zc) local zj = midpoint_ (zb,zd) - if point.abs (zj-zi) < epsilon then else error ("it's not a square (center)") + if point.abs (zj-zi) < tkz_epsilon then else error ("it's not a square (center)") end - if math.abs(point.abs (zc-za) - point.abs (zd-zb)) < epsilon then else error ("it's not a square (diagonal)") + if math.abs(point.abs (zc-za) - point.abs (zd-zb)) < tkz_epsilon then else error ("it's not a square (diagonal)") end - if math.abs(point.abs (zb-za) - point.abs (zd-za)) < epsilon then else error ("it's not a square (side)") + if math.abs(point.abs (zb-za) - point.abs (zd-za)) < tkz_epsilon then else error ("it's not a square (side)") end local type = 'square' diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua index d68084d5f8..0d2699ac55 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua @@ -1,6 +1,6 @@ -- tkz_elements_triangles.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -24,9 +24,9 @@ function triangle: new (za, zb ,zc) local c = point.abs(zb-za) local a = point.abs(zc-zb) local b = point.abs(za-zc) - local alpha = point.arg ((zc-za) / (zb-za)) - local beta = point.arg ((za-zb) / (zc-zb)) - local gamma = point.arg ((zb-zc) / (za-zc)) + local alpha = angle_normalize_(point.arg ((zc-za) / (zb-za))) + local beta = angle_normalize_(point.arg ((za-zb) / (zc-zb))) + local gamma = angle_normalize_(point.arg ((zb-zc) / (za-zc))) local ab = line : new (za,zb) local ca = line : new (zc,za) local bc = line : new (zb,zc) @@ -139,7 +139,6 @@ function triangle : point (t) end function triangle : soddy_center () - local s,i,j,k return soddy_center_ (self.pa,self.pb,self.pc) end ------------------- diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua index c2802cd41f..310b522788 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua @@ -1,6 +1,6 @@ -- tkz_elements_vectors.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -14,33 +14,67 @@ -- ---------------------------------------------------------------------------- vector = {} -function vector: new(z1, z2) - local type = 'vector' - local norm = point.abs (z2-z1) - local arg = point.arg (z2-z1) - local o = {st = z1, - ed = z2, - norm = norm, - arg = arg, - type = type } +function vector: new(za, zb) + local type = 'vector' + local slope = angle_normalize_(point.arg(zb-za)) + local norm = point.mod(zb-za) + local o = {t = za, + h = zb, + norm = norm, + slope = slope, + type = type } setmetatable(o, self) self.__index = self return o end +function vector.__add(v1,v2) + return v1 : add (v2) +end + +function vector.__sub(v1,v2) + local v = v2 : scale(-1) + return v1 : add (v) +end + +function vector.__unm(v) + return v : scale(-1) +end + +function vector.__mul(r,v) + return v : scale(r) +end + function vector: normalize () - local z = self.ed-self.st + local z = self.h-self.t local d = point.abs(z) local nz = point(z.re/d,z.im/d) - return nz + self.st + return vector : new (self.t,nz + self.t) end - function vector: add (v) - return vector :new (self.st+v.st, self.ed,v.ed) - end + function vector: add (ve) + return vector :new (self.t,self.h+ve.h-ve.t) + end - function vector: ortho () - return vector : new (self.st, rotation_(self.st,math.pi/2,self.ed)) - end +function vector: orthogonal (d) +local z +if d == nil then + return vector : new (self.t, rotation_(self.t,math.pi/2,self.h)) +else + z = self.t+ point (d*math.cos(self.slope),d*math.sin(self.slope)) + return vector : new (self.t, rotation_(self.t,math.pi/2,z)) +end +end + +function vector: scale (d) + local l,z + l = self.norm + z = self.t+ point (d*l*math.cos(self.slope),d*l*math.sin(self.slope)) + return vector : new (self.t,z ) +end +function vector: at (zc) + return vector :new (zc,zc+self.h-self.t) +end + return vector -- cgit v1.2.3