diff options
author | Karl Berry <karl@freefriends.org> | 2023-11-10 21:41:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-11-10 21:41:33 +0000 |
commit | 558b3386c6394c9542a7a3baddaa343f607776cf (patch) | |
tree | 6978c026fcbad9736efd6edf1657a18e1bc00fe5 | |
parent | 4994a32e6461365ce9fc7db632993d6bc096f7d7 (diff) |
tkz-elements (10nov23)
git-svn-id: svn://tug.org/texlive/trunk@68806 c570f23f-e606-0410-a88d-b1316a301751
31 files changed, 760 insertions, 317 deletions
diff --git a/Master/texmf-dist/doc/latex/tkz-elements/README.md b/Master/texmf-dist/doc/latex/tkz-elements/README.md index 49f16ad785f..96f3746c6ef 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/README.md +++ b/Master/texmf-dist/doc/latex/tkz-elements/README.md @@ -1,6 +1,6 @@ # tkz-elements — for euclidean geometry -Release 1.00b 2023/10/25 +Release 1.20b 2023/11/10 ## Description @@ -66,7 +66,27 @@ Other examples, in French, are on my site. ## History -- First version 1.00b + - Version 1.20 Memory management: tables are emptied when the tkzelements environment is opened. + + + `set_lua_to_tex` has been replaced by `tkzUseLua` to transfer data between the `tkzelements` and `tikzpicture` environments. + + New version of `inversion` with respect to a circle method. It selects the correct algorithm based on the object passed as a parameter. + + Added an `in_out_disk` method for the `circle` object, which indicates whether or not a point is in the disk. `in_out` is for the circle. + + Added two methods: `radical_center (C1,C2,C3)` radical center of three circles. + `radical_circle (C1,C2,C3)` orthogonal circle of three circles. + + Added function `circle : radius` to define a circle with a centre and a radius. + + Added methods `normalize` and `normalize_inv` for `line`. + + Added methods `translation` and `set_translation` to the `line` object. + + Added an example to illustrate combinations of methods and attributes. + + - First version 1.00b ## Author diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-circle.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-circle.tex index a86fe1230bc..7c8c94aec44 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-circle.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-circle.tex @@ -31,7 +31,7 @@ This class is also defined by two points, on the one hand the center and on the \subsubsection{Example: circle attributes} % (fold) \label{ssub:example_circle_attributes} -Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\_lua\_to\_tex} (see \ref{ssub:transfer_from_lua_to_tex}) creates global macros. The |\r| macro must not already be defined. +Three attributes are used (south, west, radius). \begin{minipage}{0.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] @@ -43,7 +43,6 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ z.s = C.ab.south z.w = C.ab.west r = C.ab.radius - set_lua_to_tex{"r"} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -51,7 +50,7 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ \tkzLabelPoints(a,b,s,w) \tkzDrawCircle(a,b) \tkzDrawSegment(a,b) - \tkzLabelSegment[sloped](a,b){ab = \r} + \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} \end{tikzpicture} \end{tkzexample} \end{minipage} @@ -64,7 +63,6 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ z.s = C.ab.south z.w = C.ab.west r = C.ab.radius - set_lua_to_tex{"r"} \end{tkzelements} \hspace*{\fill} @@ -74,7 +72,7 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ \tkzLabelPoints(a,b,s,w) \tkzDrawCircle(a,b) \tkzDrawSegment(a,b) -\tkzLabelSegment[sloped](a,b){ab = \r} +\tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} \end{tikzpicture} \hspace*{\fill} \end{minipage} @@ -95,6 +93,7 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ \textbf{Methods} & \textbf{Comments} \\ \midrule \\ \Imeth{circle}{new(O,A)} & |C.OA = circle : new (z.O,z.A)| \tkzar circle center $O$ through $A$\\ +\Imeth{circle}{radius(O,r)} & |C.OA = circle : radius (z.O,2)| \tkzar circle center $O$ radius =2 cm\\ \midrule \textbf{Points} &\\ \midrule @@ -112,22 +111,29 @@ Three attributes are used (south, west, radius). Currently, \Igfct{package}{set\ \Imeth{circle}{radical\_axis (C)} & \\ \Imeth{circle}{tangent\_at (pt)} & |z.P = C.OA: tangent_at (z.M)| $((PM) \perp (OM))$\\ \Imeth{circle}{tangent\_from (pt)}& |z.M,z.N = C.OA: tangent_from (z.P)| \\ +\Imeth{circle}{inversion (line)} & |L or C = C.AC:inversion (L.EF)|\\ \midrule \textbf{Circles} &\\ \midrule \Imeth{circle}{orthogonal\_from (pt)} & |C= C.OA: orthogonal_from (z.P)| \\ \Imeth{circle}{orthogonal\_through (pta,ptb)} & |C = C.OA: orthogonal_through (z.z1,z.z2)|\\ +\Imeth{circle}{inversion (circle)} & |L or C = C.AC:inversion (C.EF)|\\ + \midrule \textbf{Miscellaneous} &\\ \midrule \Imeth{circle}{power (pt)} &| p = C.OA: power (z.M)| \tkzar power with respect to a circle \\ \Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| \tkzar boolean \\ +\Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| \tkzar boolean \\ \Imeth{circle}{draw ()} & for further use\\ \bottomrule % \end{tabular} \end{center} \egroup -% subsubsection methods_circle (end) +% subsection methods_circle (end) + + + \subsubsection{Altshiller} % (fold) \label{ssub:altshiller} @@ -252,6 +258,182 @@ z.R = intersection (L.tC,T.ab) \hspace*{\fill} %\caption{Lemoine line} % subsubsection lemoine (end) + + +\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. + +\subsubsection{Inversion: point} % (fold) +\label{ssub:inversion_point} + +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. +\begin{tkzexample}[latex=0cm,small,code only] +\begin{tkzelements} + scale = 1.5 + z.o = point: new (-1,2) + z.a = point: new (2,1) + C.oa = circle: new (z.o,z.a) + z.c = point: new (3,4) + z.d = C.oa: inversion (z.c) + p = C.oa: power (z.c) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(o,a) + \tkzDrawSegments(o,a o,c) + \tkzDrawPoints(a,o,c,d) + \tkzLabelPoints(a,o,c,d) + \tkzLabelSegment[sloped,above=1em](c,d){La puissance de c est \tkzUseLua{p}} + \end{tikzpicture} +\end{tkzexample} + +\begin{tkzelements} + scale = 1.5 + z.o = point: new (-1,2) + z.a = point: new (2,1) + C.oa = circle: new (z.o,z.a) + z.c = point: new (3,4) + z.d = C.oa: inversion (z.c) + p = C.oa: power (z.c) +\end{tkzelements} +\hspace*{\fill} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(o,a) + \tkzDrawSegments(o,a o,c) + \tkzDrawPoints(a,o,c,d) + \tkzLabelPoints(a,o,c,d) + \tkzLabelSegment[sloped,above=1em](c,d){La puissance de c est \tkzUseLua{p}} + \end{tikzpicture} +\hspace*{\fill} + +\subsubsection{Inversion: line} % (fold) +\label{ssub:inversion_line} + +The result is either a straight line or a circle. + +\begin{tkzexample}[latex=0cm,small,code only] +\begin{tkzelements} + scale = 1 + z.o = point: new (-1,1) + z.a = point: new (1,3) + C.oa = circle: new (z.o,z.a) + z.c = point: new (3,2) + z.d = point: new (0,4) + L.cd = line: new (z.c,z.d) + C.OH = C.oa: inversion (L.cd) + z.O,z.H = get_points(C.OH) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(o,a O,H) + \tkzDrawLines(c,d o,H) + \tkzDrawPoints(a,o,c,d,H) + \tkzLabelPoints(a,o,c,d,H) + \end{tikzpicture} +\end{tkzexample} + + +\begin{tkzelements} + scale = 1 + z.o = point: new (-1,1) + z.a = point: new (1,3) + C.oa = circle: new (z.o,z.a) + z.c = point: new (3,2) + z.d = point: new (0,4) + L.cd = line: new (z.c,z.d) + C.OH = C.oa: inversion (L.cd) + z.O,z.H = get_points(C.OH) +\end{tkzelements} + +\hspace*{\fill} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(o,a O,H) + \tkzDrawLines(c,d o,H) + \tkzDrawPoints(a,o,c,d,H) + \tkzLabelPoints(a,o,c,d,H) + \end{tikzpicture} + \hspace*{\fill} + + \subsubsection{Inversion: circle} % (fold) + \label{ssub:inversion_circle} + +The result is either a straight line or a circle. + +\begin{tkzexample}[latex=0cm,small,code only] + \begin{tkzelements} + scale = 1 + z.o = point: new (-1,1) + z.a = point: new (2,3) + C.oa = circle: new (z.o,z.a) + z.c = point: new (-2,1) + z.e = point: new (-2,8) + z.d = point: new (-2,5) + C.ed = circle: new (z.e,z.d) + C.co = circle: new (z.c,z.o) + obj = C.oa: inversion (C.co) + if obj.type == "line" + then + z.p,z.q = get_points(obj) + else + z.O,z.H = get_points(obj) + end + obj = C.oa: inversion(C.ed) + if obj.type == "line" + then + z.p,z.q = get_points(obj) + else + z.O,z.H = get_points(obj) + end + \end{tkzelements} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(o,a c,o e,d O,H) + \tkzDrawLines(p,q) + \tkzDrawPoints(a,o,c,d,e,p,q,O,H) + \tkzLabelPoints(a,o,c,d,e,p,q,O,H) + \end{tikzpicture} +\end{tkzexample} + + \begin{tkzelements} + scale = 1 + z.o = point: new (-1,1) + z.a = point: new (2,3) + C.oa = circle: new (z.o,z.a) + z.c = point: new (-2,1) + z.e = point: new (-2,8) + z.d = point: new (-2,5) + C.ed = circle: new (z.e,z.d) + C.co = circle: new (z.c,z.o) + obj = C.oa: inversion (C.co) + if obj.type == "line" + then + z.p,z.q = get_points(obj) + else + z.O,z.H = get_points(obj) + end + obj = C.oa: inversion(C.ed) + if obj.type == "line" + then + z.p,z.q = get_points(obj) + else + z.O,z.H = get_points(obj) + end + \end{tkzelements} + +\hspace*{\fill} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(o,a c,o e,d O,H) + \tkzDrawLines(p,q) + \tkzDrawPoints(a,o,c,d,e,p,q,O,H) + \tkzLabelPoints(a,o,c,d,e,p,q,O,H) + \end{tikzpicture} + \hspace*{\fill} +% subsubsection inversion (end) % subsection methods_of_the_class_circle (end) diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-ellipse.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-ellipse.tex index 4480417f08c..0d5c00b38cd 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-ellipse.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-ellipse.tex @@ -56,13 +56,12 @@ The first attributes are the three points that define the ellipse : \Iattr{ellip z.S = E.south z.Co = E.covertex z.Ve = E.vertex - set_lua_to_tex {'a','b','slope'} \end{tkzelements} \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,fixed,precision=2} \tkzGetNodes \tkzDrawCircles[teal](C,A) - \tkzDrawEllipse[red](C,\a,\b,\slope) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) \tkzDrawLine[add = .5 and .5](A,W) @@ -94,7 +93,6 @@ z.W = E.west z.S = E.south z.Co = E.covertex z.Ve = E.vertex -set_lua_to_tex {'a','b','slope'} \end{tkzelements} \hspace*{\fill} @@ -102,11 +100,11 @@ set_lua_to_tex {'a','b','slope'} \pgfkeys{/pgf/number format/.cd,fixed,precision=2} \tkzGetNodes \tkzDrawCircles[teal](C,A) -\tkzDrawEllipse[red](C,\a,\b,\slope) +\tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) \tkzDrawLine[add = .5 and .5](A,W) -\tkzLabelSegment[pos=1.5,above,sloped](A,W){slope = \pgfmathprintnumber{\slope}} +\tkzLabelSegment[pos=1.5,above,sloped](A,W){slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} \tkzLabelPoint[below left](F1){Focus 1} \tkzLabelPoint[below left](F2){Focus 2} @@ -165,12 +163,11 @@ For attributes see \ref{sec:classe_ellipse} a = E.Rx b = E.Ry slope = math.deg(E.Sl) - set_lua_to_tex {'a','b','slope'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) - \tkzDrawEllipse[red](C,\a,\b,\slope) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B) \tkzLabelPoints(C,A,B) \end{tikzpicture} @@ -186,12 +183,11 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -set_lua_to_tex {'a','b','slope'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) -\tkzDrawEllipse[red](C,\a,\b,\slope) +\tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B) \tkzLabelPoints(C,A,B) \end{tikzpicture} @@ -230,7 +226,6 @@ The first two points are the foci of the ellipse. The third one is the vertex. W z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) - set_lua_to_tex{'a','b','ang'} \end{tkzelements} \end{tkzexample} \begin{minipage}{0.6\textwidth} @@ -240,7 +235,7 @@ The first two points are the foci of the ellipse. The third one is the vertex. W \tkzDrawPolygon(A,B,C) \tkzDrawCircles[cyan](O,A N,I) \tkzDrawSegments(X,R A,X) - \tkzDrawEllipse[red](N,\a,\b,\ang) + \tkzDrawEllipse[red](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawLines[add=.2 and .5](I,H) \tkzDrawPoints(A,B,C,N,O,X,H,R,S,I) \tkzLabelPoints[above](C,X) @@ -275,14 +270,13 @@ The first two points are the foci of the ellipse. The third one is the vertex. W z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) - set_lua_to_tex{'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) \tkzDrawCircles[cyan](O,A N,I) \tkzDrawSegments(X,R A,X) -\tkzDrawEllipse[red](N,\a,\b,\ang) +\tkzDrawEllipse[red](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawLines[add=.2 and .5](I,H) \tkzDrawPoints(A,B,C,N,O,X,H,R,S,I) \tkzLabelPoints[above](C,X) @@ -321,7 +315,6 @@ The first two points are the foci of the ellipse. The third one is the vertex. W z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) - set_lua_to_tex {'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -329,7 +322,7 @@ The first two points are the foci of the ellipse. The third one is the vertex. W \tkzDrawLines(x,y A,M A,N ka,kb) \tkzLabelSegment(C,V){$a$} \tkzLabelSegment[right](C,CoV){$b$} - \tkzDrawEllipse[teal](C,\a,\b,\ang) + \tkzDrawEllipse[teal](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV,X,x,y,M,N,A,K) \tkzLabelPoints(C,V,A,M,N,K) \tkzLabelPoints[above left](CoV) @@ -356,7 +349,6 @@ z.M = L.ta.pb z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) -set_lua_to_tex {'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -364,7 +356,7 @@ set_lua_to_tex {'a','b','ang'} \tkzDrawLines(x,y A,M A,N ka,kb) \tkzLabelSegment(C,V){$a$} \tkzLabelSegment[right](C,CoV){$b$} -\tkzDrawEllipse[teal](C,\a,\b,\ang) +\tkzDrawEllipse[teal](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV,X,x,y,M,N,A,K) \tkzLabelPoints(C,V,A,M,N,K) \tkzLabelPoints[above left](CoV) diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-line.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-line.tex index de11a45a518..62ea40d1f37 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-line.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-line.tex @@ -50,7 +50,6 @@ The attributes are : z.s = L.ab.south_pb sl = L.ab.slope len = L.ab.length - set_lua_to_tex{"sl","len"} \end{tkzelements} \begin{tikzpicture} @@ -59,8 +58,8 @@ The attributes are : \tkzLabelPoints(a,b,e,r,s,w) \tkzLabelPoints[above](m) \tkzDrawLine(a,b) - \tkzLabelSegment[sloped](a,b){ab = \len} - \tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \sl} + \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{len}} + \tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \tkzUseLua{sl}} \end{tikzpicture} \end{tkzexample} @@ -76,7 +75,6 @@ z.r = L.ab.north_pa z.s = L.ab.south_pb sl = L.ab.slope len = L.ab.length -set_lua_to_tex{"sl","len"} \end{tkzelements} \hspace*{\fill} @@ -86,8 +84,8 @@ set_lua_to_tex{"sl","len"} \tkzLabelPoints(a,b,e,r,s,w) \tkzLabelPoints[above](m) \tkzDrawLine(a,b) -\tkzLabelSegment[sloped](a,b){ab = \len} -\tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \sl} +\tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{len}} +\tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \tkzUseLua{sl}} \end{tikzpicture} \hspace*{\fill} % \caption{Class Line} @@ -160,6 +158,8 @@ Here's the list of methods for the \tkzNameObj{line} object. The results are eit \textbf{Points} &\\ \midrule \Imeth{line}{gold\_ratio ()} & |z.C = L.AB : gold_ratio()| \tkzar gold ratio \\ +\Imeth{line}{normalize ()} & |z.C = L.AB : normalize()| \tkzar AC =1 and $C\in (AB)$ \\ +\Imeth{line}{normalize_inv ()} & |z.C = L.AB : normalize_inv()| \tkzar CB =1 and $C\in (AB)$ \\ \Imeth{line}{barycenter (ka,kb)} & |z.C = L.AB : barycenter (1,2)| $C$ --> barycenter of |{(A,1)(B,2)}|\\ \Imeth{line}{point (t)} & |z.C = L.AB : point (2)| \tkzar $\overrightarrow{AC} = 2\overrightarrow{AB}$\\ \Imeth{line}{midpoint ()} & |z.M = L.AB : midpoint ()| \tkzar better is |z.M = L.AB.mid| \\ @@ -170,6 +170,9 @@ Here's the list of methods for the \tkzNameObj{line} object. The results are eit \Imeth{line}{set\_projection (...)} & projection of a list of points \\ \Imeth{line}{symmetry\_axial ( pt )} & |z.Cp = L.AB : symmetry_axial (z.C)|\\ \Imeth{line}{set\_symmetry\_axial (...) }&symmetry_axial of a list of points \\ +\Imeth{line}{translation ( pt )} & |z.Cp = L.AB : translation (z.C)|\\ +\Imeth{line}{set\_translation(...) }&translation of a list of points \\ + \Imeth{line}{square ()} & |z.C,z.D = L.AB : square () | \tkzar creates 2 points to make a square.\\ \midrule \textbf{Lines} &\\ @@ -367,6 +370,50 @@ z.a,z.b = L.ab.pa,L.ab.pb % subsubsection example_combination_of_methods (end) +\subsubsection{Example: translation} % (fold) +\label{ssub:example_translation} + +\begin{minipage}{0.6\textwidth} +\begin{tkzexample}[small,code only] +\begin{tkzelements} + z.A = point: new (0,0) + z.B = point: new (1,2) + z.C = point: new (-3,2) + z.D = point: new (0,2) + L.AB = line : new (z.A,z.B) + -- z.E = L.AB : translation (z.C) + z.E,z.F = L.AB : set_translation (z.C,z.D) +\end{tkzelements} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPoints(A,...,F) +\tkzLabelPoints(A,...,F) +\tkzDrawSegments[->,red,> =latex](C,E D,F A,B) ) +\end{tikzpicture} +\end{tkzexample} +\end{minipage} +\begin{minipage}{0.4\textwidth} +\begin{tkzelements} + z.A = point: new (0,0) + z.B = point: new (1,2) + z.C = point: new (-3,2) + z.D = point: new (0,2) + L.AB = line : new (z.A,z.B) + -- z.E = L.AB : translation (z.C) + z.E,z.F = L.AB : set_translation (z.C,z.D) +\end{tkzelements} +\hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPoints(A,...,F) +\tkzLabelPoints(A,...,F) +\tkzDrawSegments[->,red,> =latex](C,E D,F A,B) ) +\end{tikzpicture} +\hspace*{\fill} +\end{minipage} + +% subsubsection example_translation (end) + \subsubsection{Example: distance and projection} % (fold) \label{ssub:example_distance_and_projection} @@ -379,7 +426,6 @@ z.a,z.b = L.ab.pa,L.ab.pb L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) z.H = L.AB : projection (z.C) - set_lua_to_tex{'d'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -387,7 +433,7 @@ z.a,z.b = L.ab.pa,L.ab.pb \tkzDrawPoints(A,B,C,H) \tkzLabelPoints(A,B,C,H) \tkzLabelSegment[above left, - draw](C,H){$CH = \d$} + draw](C,H){$CH = \tkzUseLua{d}$} \end{tikzpicture} \end{tkzexample} \end{minipage} @@ -399,7 +445,6 @@ z.a,z.b = L.ab.pa,L.ab.pb L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) z.H = L.AB : projection (z.C) - set_lua_to_tex{'d'} \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} @@ -407,7 +452,7 @@ z.a,z.b = L.ab.pa,L.ab.pb \tkzDrawLines(A,B C,H) \tkzDrawPoints(A,B,C,H) \tkzLabelPoints(A,B,C,H) -\tkzLabelSegment[above left,draw](C,H){$CH = \d$} +\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} \end{tikzpicture} \hspace*{\fill} \end{minipage} diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-misc.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-misc.tex index 9bb092ce562..65834bf78e8 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-misc.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-misc.tex @@ -21,9 +21,13 @@ \Igfct{math}{islinear (z1,z2,z3) } & Are the points aligned? (z2-z1) $\parallel$ (z3-z1) ? \\ \Igfct{math}{isortho (z1,z2,z3)} & (z2-z1) $\perp$ (z3-z1) ? boolean\\ \Igfct{package}{set\_lua\_to\_tex (list)} & set\_lua\_to\_tex('a','n') defines |\a| and |\n| \\ +\Igfct{package}{tkzUseLua (variable)} & |\textbackslash\tkzUseLua{a}| prints the value of a\\ %parabola (a,b,c) & to get \\ -\Igfct{math}{value (v) } & apply |scale| to the value \\ +\Igfct{math}{value (v) } & apply |scale * value | \\ +\Igfct{math}{real (v) } & apply | value /scale | \\ \Igfct{math}{angle\_normalize (a) } & to get a value between 0 and $2\pi$ \\ +\Igfct{math}{radical\_center (C1,C2,C3)} & see \ref{sub:radical_center} \\ +\Igfct{math}{radical\_circle (C1,C2,C3)} & see \ref{sub:radical_circle} \\ \bottomrule \end{tabular} \end{center} @@ -108,9 +112,6 @@ % subsubsection function_islinear (end) - - - \subsubsection{Function \tkzfname{value} }% (fold) \label{ssub:function_value} @@ -118,15 +119,59 @@ value to apply scaling if necessary If |scale = 1.2| with a = value(5) the actual value of |a| will be $5\times 1.2 = 6$. - % subsubsection function_value (end) +\subsubsection{Function \tkzfname{real} }% (fold) +\label{ssub:function_real} + +If |scale = 1.2| with a = 6 then real(a) = $6 / 1.2 = 5$ . + +% subsubsection function_real (end) + + \subsubsection{Transfer from lua to \TEX} % (fold) \label{ssub:transfer_from_lua_to_tex} +It's possible to transfer variable from Lua to \TEX{} with +\Igfct{package}{\textbackslash{tkzUseLua}} in the environment "tikzpicture". + - \Igfct{package}{set\_lua\_to\_tex (list)} +\begin{tkzexample}[latex=0cm,small,code only] +\begin{tkzelements} + z.A = point : new (0 , 0) + z.B = point : new (4 , 3) + z.C = point : new (2 , 5) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + l = L.AB.length + z.H = L.AB : projection (z.C) +\end{tkzelements} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B C,H) +\tkzDrawPoints(A,B,C,H) +\tkzLabelPoints(A,B,C,H) +\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} +\tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$} +\end{tikzpicture} +\end{tkzexample} -see examples \ref{ssub:get_angle}, \ref{ssub:dot_or_scalar_product} +\begin{tkzelements} + z.A = point : new (0 , 0) + z.B = point : new (4 , 3) + z.C = point : new (2 , 5) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + l = L.AB.length + z.H = L.AB : projection (z.C) +\end{tkzelements} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B C,H) +\tkzDrawPoints(A,B,C,H) +\tkzLabelPoints(A,B,C,H) +\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} +\tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$} +\end{tikzpicture} % subsubsection transfer_from_lua_to_tex (end) \subsubsection{Normalized angles : Slope of lines (ab), (ac) and (ad)} % (fold) @@ -197,7 +242,6 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) - set_lua_to_tex{"angcb","angbc"} \end{tkzelements} \begin{tikzpicture} @@ -206,9 +250,9 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \tkzDrawPoints(a,b,c) \tkzLabelPoints(a,b,c) \tkzMarkAngle[->](c,a,b) - \tkzLabelAngle(c,a,b){\angcb} + \tkzLabelAngle(c,a,b){\tkzUseLua{angcb}} \tkzMarkAngle[->](b,a,c) - \tkzLabelAngle(b,a,c){\angbc} + \tkzLabelAngle(b,a,c){\tkzUseLua{angbc}} \end{tikzpicture} \end{tkzexample} \end{minipage} @@ -220,7 +264,6 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) - set_lua_to_tex{"angcb","angbc"} \end{tkzelements} \hspace*{\fill} @@ -230,9 +273,9 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \tkzDrawPoints(a,b,c) \tkzLabelPoints(a,b,c) \tkzMarkAngle[->](c,a,b) -\tkzLabelAngle(c,a,b){\angcb} +\tkzLabelAngle(c,a,b){\tkzUseLua{angcb}} \tkzMarkAngle[->](b,a,c) -\tkzLabelAngle(b,a,c){\angbc} +\tkzLabelAngle(b,a,c){\tkzUseLua{angbc}} \end{tikzpicture} \hspace*{\fill} \end{minipage} @@ -254,7 +297,6 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) - set_lua_to_tex{"x"} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -262,6 +304,7 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \tkzDrawPoints(A,B,C,A_1,B_1,C_1) \tkzLabelPoints(A,B,C,A_1,B_1,C_1) \tkzDrawPolygon[blue](A_1,B_1,C_1) + \tkzText[right](0,-1){dot product =\tkzUseLua{x}} \end{tikzpicture} \end{tkzexample} \end{minipage} @@ -276,7 +319,6 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) - set_lua_to_tex{"x"} \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} @@ -285,14 +327,14 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \tkzDrawPoints(A,B,C,A_1,B_1,C_1) \tkzLabelPoints(A,B,C,A_1,B_1,C_1) \tkzDrawPolygon[blue](A_1,B_1,C_1) + \tkzText[right](0,-1){dot product =\tkzUseLua{x}} \end{tikzpicture} \hspace*{\fill} \end{minipage} %\caption{Dot or scalar product} - -The scalar product of the vectors $\overrightarrow{AC}$ and $\overrightarrow{AB}$ is equal to $\x$, so these vectors are orthogonal. +The scalar product of the vectors $\overrightarrow{AC}$ and $\overrightarrow{AB}$ is equal to $\tkzUseLua{x}$, so these vectors are orthogonal. % subsubsection dot_or_scalar_product (end) \subsubsection{Alignment or orthogonality} % (fold) diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-point.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-point.tex index 311debb4a6e..a9a1785ef10 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-point.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-point.tex @@ -47,7 +47,6 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name ty = z.a.type arg = z.a.argument m = z.a.modulus - set_lua_to_tex{"x","y","ty","arg","m"} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -57,7 +56,7 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \tkzLabelPoints[above](O,a) \tkzLabelPoint[below](a){ \begin{minipage} {5cm} - x=\x\\ y=\y\\ type =\ty\\ argument = \arg \\ module = \m + x=\tkzUseLua{x}\\ y=\tkzUseLua{y}\\ type =\tkzUseLua{ty}\\ argument = \tkzUseLua{arg} \\ module = \tkzUseLua{m} \end{minipage}} \end{tikzpicture} \end{tkzexample} @@ -70,7 +69,6 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name ty = z.a.type arg = z.a.argument m = z.a.modulus - set_lua_to_tex{"x","y","ty","arg","m"} \end{tkzelements} \hspace*{\fill} @@ -82,7 +80,9 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \tkzLabelPoints[above](O,a) \tkzLabelPoint[below right](a){ \begin{minipage} {5cm} - x=\x\\ y=\y\\ type =\ty\\ argument = \arg \\ module = \m + x=\tkzUseLua{x}\\ y=\tkzUseLua{y}\\ + type =\tkzUseLua{ty}\\ argument = \tkzUseLua{arg} \\ + module = \tkzUseLua{m} \end{minipage}} \end{tikzpicture} \hspace*{\fill} diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-triangle.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-triangle.tex index 2b3056ff924..45515c3b7ad 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-triangle.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-triangle.tex @@ -54,7 +54,6 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.abc.alpha beta = T.abc.beta gamma = T.abc.gamma - set_lua_to_tex{"a","b","c","alpha","beta","gamma"} \end{tkzelements} \begin{tikzpicture} @@ -64,8 +63,8 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \tkzLabelPoints(a,b,c,O,G,I) \tkzLabelPoints[above right](H) \tkzDrawCircles(O,a) - \tkzLabelSegment[sloped](a,b){\c} - \tkzLabelSegment[sloped,above](b,c){\a} + \tkzLabelSegment[sloped](a,b){\tkzUseLua{c}} + \tkzLabelSegment[sloped,above](b,c){\tkzUseLua{a}} \end{tikzpicture} \end{tkzexample} @@ -85,7 +84,6 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.abc.alpha beta = T.abc.beta gamma = T.abc.gamma - set_lua_to_tex{"a","b","c","alpha","beta","gamma"} \end{tkzelements} \hspace*{\fill} @@ -96,8 +94,8 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \tkzLabelPoints(a,b,c,O,G,I) \tkzLabelPoints[above right](H) \tkzDrawCircles(O,a) -\tkzLabelSegment[sloped](a,b){\c} -\tkzLabelSegment[sloped,above](b,c){\a} +\tkzLabelSegment[sloped](a,b){\tkzUseLua{c}} +\tkzLabelSegment[sloped,above](b,c){\tkzUseLua{a}} \end{tikzpicture} \hspace*{\fill} % \caption{Class Triangle} diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-convention.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-convention.tex index 916e6bd1fb3..444033e75bf 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-convention.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-convention.tex @@ -20,9 +20,9 @@ More generally, with |z.A = point: new (a,b)|, we define a complex number |z.A = There are two cases. Either you want to keep the point to use it with the package that will allow you to draw, or the point is intermediate and you can abandon it. \vspace{12pt} -In the second case, simply don't store the point in the |z| table. For example, |A = point : new (1,2)| defines a point $A$ that will not be transferred. Another way of avoiding a transfer is to assign |nil| to the point: |z.A = nil| before exiting the environment \tkzNameEnv{elements}. +In the second case, simply don't store the point in the |z| table. For example, |A = point : new (1,2)| defines a point $A$ that will not be transferred. Another way of avoiding a transfer is to assign |nil| to the point: |z.A = nil| before exiting the environment \tkzNameEnv{tkzelements}. - In the first case, you must store the point in the table |z|. The points which occur in the environment \tkzNameEnv{elements} must respect a convention which is |z.name| such that |name| will be the name of the corresponding \tkzname{node}. \footnote{ However, that a point can be deleted with |z.name = nil|.} + In the first case, you must store the point in the table |z|. The points which occur in the environment \tkzNameEnv{tkzelements} must respect a convention which is |z.name| such that |name| will be the name of the corresponding \tkzname{node}. \footnote{ However, that a point can be deleted with |z.name = nil|.} What are the conventions for designating |name|? You have to respect the Lua conventions in particular cases. \begin{enumerate} diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-examples.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-examples.tex index bcf0ccacce0..68c894037c0 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-examples.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-examples.tex @@ -828,7 +828,7 @@ z.O3 = L.Bpt.mid % % subsection excircle (end) -\subsection{In/Out of a circle} % (fold) +\subsection{In/Out of a circle or a disk} % (fold) \label{sub:in_out_of_a_circle} @@ -839,7 +839,7 @@ z.O3 = L.Bpt.mid z.B = point: new (1,2) z.X = point: new (-2,2) C = circle : new (z.A,z.B) - if C:in_out(z.X) + if C:in_out(z.X) -- in_out_disk then tex.print("In") else @@ -1024,14 +1024,13 @@ z.L = C: point (2) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -set_lua_to_tex {'a','b'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(F1,F2,O) \tkzDrawCircles[teal](O,P) \tkzDrawPolygon(H,O,A,P) -\tkzDrawEllipse[red](O,\a,\b,0) +\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) @@ -1055,7 +1054,6 @@ z.L = C: point (2) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -set_lua_to_tex {'a','b'} \end{tkzelements} @@ -1065,7 +1063,7 @@ set_lua_to_tex {'a','b'} \tkzDrawPoints(F1,F2,O) \tkzDrawCircles[teal](O,P) \tkzDrawPolygon(H,O,A,P) -\tkzDrawEllipse[red](O,\a,\b,0) +\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) @@ -1087,15 +1085,14 @@ set_lua_to_tex {'a','b'} d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) - set_lua_to_tex{'d','l'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,H) \tkzDrawPoints(A,B,C,H) \tkzLabelPoints(A,B,C,H) - \tkzLabelSegment[above left,draw](C,H){$CH = \d$} - \tkzLabelSegment[below left,draw](C,H){$AB = \l$} + \tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} + \tkzLabelSegment[below left,draw](C,H){$AB =\tkzUseLua{l}$} \end{tikzpicture} \end{tkzexample} @@ -1107,7 +1104,6 @@ L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) -set_lua_to_tex{'d','l'} \end{tkzelements} \hspace*{\fill} @@ -1116,8 +1112,8 @@ set_lua_to_tex{'d','l'} \tkzDrawLines(A,B C,H) \tkzDrawPoints(A,B,C,H) \tkzLabelPoints(A,B,C,H) -\tkzLabelSegment[above left,draw](C,H){$CH = \d$} -\tkzLabelSegment[below left,draw](C,H){$AB = \l$} +\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} +\tkzLabelSegment[below left,draw](C,H){$AB =\tkzUseLua{l}$} \end{tikzpicture} \hspace*{\fill} %\caption{Distance to a line} @@ -1212,12 +1208,12 @@ z.O = C.AB: antipode (z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) - set_lua_to_tex {'a','b','slope'} + \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) - \tkzDrawEllipse[red](C,\a,\b,\slope) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b) \tkzLabelPoints(C,A,B) \end{tikzpicture} @@ -1234,14 +1230,13 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -set_lua_to_tex {'a','b','slope'} \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) - \tkzDrawEllipse[red](C,\a,\b,\slope) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b) \tkzLabelPoints(C,A,B) \end{tikzpicture} @@ -1264,11 +1259,10 @@ 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) -set_lua_to_tex {'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes -\tkzDrawEllipse[blue](C,\a,\b,\ang) +\tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV) \end{tikzpicture} \end{tkzexample} @@ -1283,13 +1277,12 @@ 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) -set_lua_to_tex {'a','b','ang'} \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes -\tkzDrawEllipse[blue](C,\a,\b,\ang) +\tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawPoints(C,V,CoV) \end{tikzpicture} \hspace*{\fill} @@ -1318,13 +1311,12 @@ set_lua_to_tex {'a','b','ang'} L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb - set_lua_to_tex{'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C,K,F,G,V,cV) \tkzLabelPoints(A,B,C,K,F,G,V,cV) - \tkzDrawEllipse[teal](C,\a,\b,\ang) + \tkzDrawEllipse[teal](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawLines(K,F K,G) \end{tikzpicture} \end{tkzexample} @@ -1347,7 +1339,6 @@ ang = math.deg(E.slope) L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb -set_lua_to_tex{'a','b','ang'} \end{tkzelements} \hspace*{\fill} @@ -1355,7 +1346,7 @@ set_lua_to_tex{'a','b','ang'} \tkzGetNodes \tkzDrawPoints(A,B,C,K,F,G,V,cV) \tkzLabelPoints(A,B,C,K,F,G,V,cV) - \tkzDrawEllipse[teal](C,\a,\b,\ang) + \tkzDrawEllipse[teal](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawLines(K,F K,G) \end{tikzpicture} \hspace*{\fill} @@ -2268,6 +2259,7 @@ _,z.Tp = get_points (L) L.aap = line : new (z.a,z.ap) L.bbp = line : new (z.b,z.bp) z.X = intersection (L.aap,L.bbp) +-- or z.X = radical_center(C.Ox,C.Pz,C.Opy) L.OOp = line : new (z.O,z.Op) z.H = L.OOp : projection (z.X) \end{tkzelements} @@ -2311,6 +2303,64 @@ z.H = L.OOp : projection (z.X) \hspace*{\fill} %\caption{Radical center} % subsection radical_center (end) + +\subsection{Radical circle} % (fold) +\label{sub:radical_circle} + +\begin{tkzexample}[latex=0cm,small,code only] +\begin{tkzelements} + scale = .25 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + C.exa = T.ABC : ex_circle () + z.I_a,z.Xa = get_points (C.exa) + C.exb = T.ABC : ex_circle (1) + z.I_b,z.Xb = get_points (C.exb) + C.exc = T.ABC : ex_circle (2) + z.I_c,z.Xc = get_points (C.exc) + C.ortho = radical_circle (C.exa,C.exb,C.exc) + z.w,z.a = get_points (C.ortho) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) + \tkzDrawCircles[red,thick](w,a) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) +\end{tikzpicture} +\end{tkzexample} + +\begin{tkzelements} + scale = .25 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + C.exa = T.ABC : ex_circle () + z.I_a,z.Xa = get_points (C.exa) + C.exb = T.ABC : ex_circle (1) + z.I_b,z.Xb = get_points (C.exb) + C.exc = T.ABC : ex_circle (2) + z.I_c,z.Xc = get_points (C.exc) + C.ortho = radical_circle (C.exa,C.exb,C.exc) + z.w,z.a = get_points (C.ortho) +\end{tkzelements} + +\hspace*{\fill} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) + \tkzDrawCircles[red,thick](w,a) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) +\end{tikzpicture} +\hspace*{\fill} +%\caption{Radical circle} +% subsection radical_circle (end) \subsection{Hexagram} % (fold) \label{sub:hexagram} @@ -2350,7 +2400,6 @@ z.H = L.OOp : projection (z.X) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) - set_lua_to_tex {'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -2364,7 +2413,7 @@ z.H = L.OOp : projection (z.X) \tkzLabelPoints[blue,right](O,N,G,H,I,J) \tkzDrawPoints(I,J,U,V,W) \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) - \tkzDrawEllipse[blue](N,\a,\b,\ang) + \tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \end{tikzpicture} \end{tkzexample} @@ -2404,8 +2453,7 @@ L.ZO = line: new (z.Z,z.O) z.x = intersection (L.BC,L.XO) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) -_,z.W = intersection (L.ZO,E) -set_lua_to_tex {'a','b','ang'} +_,z.W = intersection (L.ZO,E) \end{tkzelements} \hspace*{\fill} @@ -2421,7 +2469,7 @@ set_lua_to_tex {'a','b','ang'} \tkzLabelPoints[blue,right](O,N,G,H,I,J) \tkzDrawPoints(I,J,U,V,W) \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) -\tkzDrawEllipse[blue](N,\a,\b,\ang) +\tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \end{tikzpicture} \hspace*{\fill} %\caption{Hexagram Lemoine,Pascal} @@ -2573,98 +2621,78 @@ z.O = C.DC : inversion (z.W) \label{sub:apollonius_circle_v1_with_inversion} \begin{tkzexample}[code only,small] \begin{tkzelements} -scale = .75 - z.A = point: new (0,0) - z.B = point: new (6,0) - z.C = point: new (0.8,4) - T.ABC = triangle : new (z.A,z.B,z.C) - C.euler = T.ABC: euler_circle () - z.N,z.Ma = get_points (C.euler) - z.I_a,z.I_b,z.I_c = get_points (T.ABC : excentral()) - z.Ea,z.Eb,z.Ec = get_points (T.ABC : feuerbach ()) - -- The Feuerbach triangle is the triangle formed by the three points - -- of tangency of the nine-point circle with the excircles - z.S,z.p = get_points (T.ABC: spieker_circle ()) - -- z.Xa,z.Xb,z.Xc = get_points (T.ABC : extouch()) - C.exa = T.ABC : ex_circle () - z.Ia,z.Xa = get_points (C.exa) - C.exb = T.ABC : ex_circle (1) - z.Ib,z.Xb = get_points (C.exb) - C.exc = T.ABC : ex_circle (2) - z.Ic,z.Xc = get_points (C.exc) - -- S spieker point is the radical center of the last three circles - L.fa = line : new (z.S,z.Ea) - L.fb = line : new (z.S,z.Eb) - L.fc = line : new (z.S,z.Ec) - z.f_a = intersection (L.fa,C.exa) - z.f_b = intersection (L.fb,C.exb) - _,z.f_c = intersection (L.fc,C.exc) - T = triangle : new ( z.f_a, z.f_b , z.f_c ) - z.o = T.circumcenter - _,z.l = get_points (C.exa : orthogonal_from (z.S)) - -- S center of inversion !! + scale = .7 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + z.N = T.ABC.eulercenter + z.Ea,z.Eb,z.Ec = get_points ( T.ABC : feuerbach () ) + z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) + z.S = T.ABC : spieker_center () + C.JaEa = circle : new (z.Ja,z.Ea) + C.ortho = circle : radius (z.S,math.sqrt(C.JaEa : power (z.S) )) + z.a = C.ortho.south + C.euler = T.ABC: euler_circle () + C.apo = C.ortho : inversion (C.euler) + z.O = C.apo.center + z.xa,z.xb,z.xc = C.ortho : set_inversion (z.Ea,z.Eb,z.Ec) \end{tkzelements} \begin{tikzpicture} \tkzGetNodes - \tkzDrawCircles[red](o,f_a N,Ma) - \tkzDrawPoints[red](f_a,f_b,f_c,Ea,Eb,Ec,o,N) - \tkzClipCircle(o,f_a) - \tkzDrawLines[add=3 and 3](A,B A,C B,C) - \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) - \tkzDrawCircles[cyan](S,l) - \tkzDrawPoints(A,B,C) - \tkzDrawPoints[cyan](S) - \tkzDrawSegments[dashed,red](S,f_a S,f_b S,f_c) - \tkzDrawSegments[dashed,teal](o,f_a o,f_b o,f_c) +\tkzDrawCircles[red](O,xa N,Ea) +\tkzFillCircles[green!30!black,opacity=.3](O,xa) +\tkzFillCircles[yellow!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) +\tkzFillCircles[teal!30!black,opacity=.3](S,a) +\tkzFillCircles[green!30,opacity=.3](N,Ea) +\tkzDrawPoints[red](Ea,Eb,Ec,xa,xb,xc,N) +\tkzClipCircle(O,xa) +\tkzDrawLines[add=3 and 3](A,B A,C B,C) +\tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec) +\tkzFillCircles[lightgray!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) +\tkzDrawCircles[teal](S,a) +\tkzDrawPoints(A,B,C,O) +\tkzDrawPoints[teal](S) +\tkzLabelPoints(A,B,C,O,S,N) \end{tikzpicture} \end{tkzexample} \begin{tkzelements} -scale = .5 -z.A = point: new (0,0) -z.B = point: new (6,0) -z.C = point: new (0.8,4) -T.ABC = triangle : new (z.A,z.B,z.C) -C.euler = T.ABC: euler_circle () -z.N,z.Ma = get_points (C.euler) -z.I_a,z.I_b,z.I_c = get_points (T.ABC : excentral()) -z.Ea,z.Eb,z.Ec = get_points (T.ABC : feuerbach ()) --- The Feuerbach triangle is the triangle formed by the three points of tangency of the nine-point circle with the excircles -z.S,z.p = get_points (T.ABC: spieker_circle ()) - -- z.Xa,z.Xb,z.Xc = get_points (T.ABC : extouch()) -C.exa = T.ABC : ex_circle () -z.Ia,z.Xa = get_points (C.exa) -C.exb = T.ABC : ex_circle (1) -z.Ib,z.Xb = get_points (C.exb) -C.exc = T.ABC : ex_circle (2) -z.Ic,z.Xc = get_points (C.exc) - --- S spieker point is the radical center of the last three circles -L.fa = line : new (z.S,z.Ea) -L.fb = line : new (z.S,z.Eb) -L.fc = line : new (z.S,z.Ec) -z.f_a = intersection (L.fa,C.exa) -z.f_b = intersection (L.fb,C.exb) -_,z.f_c = intersection (L.fc,C.exc) -T = triangle : new ( z.f_a, z.f_b , z.f_c ) -z.o = T.circumcenter -_,z.l = get_points (C.exa : orthogonal_from (z.S)) --- S center of inversion !! + scale = .5 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + z.N = T.ABC.eulercenter + z.Ea,z.Eb,z.Ec = get_points ( T.ABC : feuerbach () ) + z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) + z.S = T.ABC : spieker_center () + C.JaEa = circle : new (z.Ja,z.Ea) + C.ortho = circle : radius (z.S,math.sqrt(C.JaEa : power (z.S) )) + z.a = C.ortho.south + C.euler = T.ABC: euler_circle () + C.apo = C.ortho : inversion (C.euler) + z.O = C.apo.center + z.xa,z.xb,z.xc = C.ortho : set_inversion (z.Ea,z.Eb,z.Ec) \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles[red](o,f_a N,Ma) -\tkzDrawPoints[red](f_a,f_b,f_c,Ea,Eb,Ec,o,N) -\tkzClipCircle(o,f_a) + \tkzGetNodes +\tkzDrawCircles[red](O,xa N,Ea) +\tkzFillCircles[green!30!black,opacity=.3](O,xa) +\tkzFillCircles[yellow!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) +\tkzFillCircles[teal!30!black,opacity=.3](S,a) +\tkzFillCircles[green!30,opacity=.3](N,Ea) +\tkzDrawPoints[red](Ea,Eb,Ec,xa,xb,xc,N) +\tkzClipCircle(O,xa) \tkzDrawLines[add=3 and 3](A,B A,C B,C) -\tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) -\tkzDrawCircles[cyan](S,l) -\tkzDrawPoints(A,B,C) -\tkzDrawPoints[cyan](S) -\tkzDrawSegments[dashed,red](S,f_a S,f_b S,f_c) -\tkzDrawSegments[dashed,teal](o,f_a o,f_b o,f_c) +\tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec) +\tkzFillCircles[lightgray!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) +\tkzDrawCircles[teal](S,a) +\tkzDrawPoints(A,B,C,O) +\tkzDrawPoints[teal](S) +\tkzLabelPoints(A,B,C,O,S,N) \end{tikzpicture} \hspace*{\fill} %\caption{Apollonius circle V1} diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-howtouse.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-howtouse.tex index 0b945766336..5d47e005a77 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-howtouse.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-howtouse.tex @@ -117,7 +117,7 @@ All points are defined and stored in the |z| table. The macro \tkzcname{tkzGetNo \subsubsection{Points transfer} % (fold) \label{ssub:points_transfer} -We use an environment \tkzname{elements} outside an environment \tkzname{tikzpicture} which allows us to carry out all the necessary calculations, then we launch the macro \tkzcname{tkzGetNodes} which transforms the affixes of the table \tkzname{z} into a list of \tkzname{Nodes}. It only remains to draw. +We use an environment \tkzname{tkzelements} outside an environment \tkzname{tikzpicture} which allows us to carry out all the necessary calculations, then we launch the macro \tkzcname{tkzGetNodes} which transforms the affixes of the table \tkzname{z} into a list of \tkzname{Nodes}. It only remains to draw. Currently the drawing program is either \TIKZ\ or \pkg{tkz-euclide}. You have the possibility to use another package to trace but for that you have to create a macro similar to \tkzcname{tkzGetNodes}. Of course, this package must be able to store the points as does \TIKZ\ or \pkg{tkz-euclide}. @@ -138,7 +138,7 @@ end} } \end{tkzexample} -The environment \tkzNameEnv{elements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime}. (see the next example) +The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime}. (see the next example) \begin{minipage}{0.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-intersection.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-intersection.tex index db290e34477..cab5aa7aeb8 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-intersection.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-intersection.tex @@ -195,14 +195,13 @@ The designation of intersection points is a little more complicated than the pre a = E.Rx b = E.Ry ang = math.deg(E.slope) - set_lua_to_tex {'a','b','ang'} \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[red](a,b u,v) % p,s p,t \tkzDrawPoints(a,b,c,e,u,v) % \tkzLabelPoints(a,b,c,u,v) - \tkzDrawEllipse[teal](c,\a,\b,\ang) + \tkzDrawEllipse[teal](c,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzDrawSegments(c,u c,v) \tkzFillAngles[green!30,opacity=.4](e,c,v) \tkzFillAngles[green!80,opacity=.4](e,c,u) @@ -226,7 +225,6 @@ The designation of intersection points is a little more complicated than the pre a = E.Rx b = E.Ry ang = math.deg(E.slope) - set_lua_to_tex {'a','b','ang'} \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} @@ -234,7 +232,7 @@ The designation of intersection points is a little more complicated than the pre \tkzDrawLines[red](a,b u,v) % p,s p,t \tkzDrawPoints(a,b,c,e,u,v) % \tkzLabelPoints(a,b,c,u,v) - \tkzDrawEllipse[teal](c,\a,\b,\ang) + \tkzDrawEllipse[teal](c,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \tkzFillAngles[green!30,opacity=.4](e,c,v) \tkzFillAngles[green!80,opacity=.4](e,c,u) \tkzDrawSegments(c,u c,v) @@ -262,7 +260,6 @@ Other examples: \ref{ssub:function_tkzname_ellipse__foci}, \ref{sub:hexagram} % a = E.Rx % b = E.Ry % ang = math.deg(E.slope) -% set_lua_to_tex {'a','b','ang'} % \end{tkzelements} % % \begin{tikzpicture} @@ -270,7 +267,8 @@ Other examples: \ref{ssub:function_tkzname_ellipse__foci}, \ref{sub:hexagram} % \tkzDrawLines[red](a,b u,v) % p,s p,t % \tkzDrawPoints(a,b,c,e,u,v) % % \tkzLabelPoints(a,b,c,u,v) -% \tkzDrawEllipse[teal](c,\a,\b,\ang) +% \tkzDrawEllipse[teal](c,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) +% \tkzFillAngles[green!30,opacity=.4](e,c,v) % \tkzDrawSegments(c,u c,v) % \tkzFillAngles[green!30,opacity=.4,size=1.2](e,c,v) % \tkzFillAngles[green!80,opacity=.4](e,c,u) @@ -293,7 +291,6 @@ Other examples: \ref{ssub:function_tkzname_ellipse__foci}, \ref{sub:hexagram} % a = E.Rx % b = E.Ry % ang = math.deg(E.slope) -% set_lua_to_tex {'a','b','ang'} % \end{tkzelements} % % @@ -303,7 +300,8 @@ Other examples: \ref{ssub:function_tkzname_ellipse__foci}, \ref{sub:hexagram} % \tkzDrawLines[red](a,b u,v) % p,s p,t % \tkzDrawPoints(a,b,c,e,u,v) % % \tkzLabelPoints(a,b,c,u,v) -% \tkzDrawEllipse[teal](c,\a,\b,\ang) +% \tkzDrawEllipse[teal](c,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) +% \tkzFillAngles[green!30,opacity=.4](e,c,v) % \tkzDrawSegments(c,u c,v) % \tkzFillAngles[green!30,opacity=.4,size=1.2](e,c,v) % \tkzFillAngles[green!80,opacity=.4](e,c,u) diff --git a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-main.tex b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-main.tex index 6fa4bc6166b..202ff31ba7d 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-main.tex +++ b/Master/texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-main.tex @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-elements} -\gdef\tkzversionofpack{1.00b} +\gdef\tkzversionofpack{1.20b} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{tkz-elements.pdf} -\gdef\tkzversionofdoc{1.00b} +\gdef\tkzversionofdoc{1.20b} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} @@ -93,7 +93,7 @@ \usepackage[english]{babel} \usepackage[normalem]{ulem} \usepackage{multirow,multido,booktabs,cellspace} -\usepackage{shortvrb,fancyvrb,bookmark} +\usepackage{shortvrb,bookmark} \usepackage{makeidx} %\usepackage{float} \makeindex diff --git a/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo-1.pdf b/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo-1.pdf Binary files differdeleted file mode 100644 index 0c97b2e50b1..00000000000 --- a/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo-1.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.pdf b/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.pdf Binary files differnew file mode 100644 index 00000000000..5d703157aa0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.pdf diff --git a/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.tex b/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.tex new file mode 100644 index 00000000000..3242fea11a6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkz-elements/examples/tkz-elements-demo_4.tex @@ -0,0 +1,30 @@ +% !TEX TS-program = lualatex +% Created by Alain Matthes on 2023-02-25. +% Copyright (c) 2023 AlterMundus. + +\documentclass{standalone} +\usepackage{tkz-euclide} +\usepackage{tkz-elements} +\begin{document} + +\begin{tkzelements} + scale = 2 + z.A = point: new(0,0) + z.B = point: new(5,0) + z.C = point: new(1,4) + T.ABC = triangle: new (z.A,z.B,z.C) + T.EFG = T.ABC: medial () + z.E,z.F,z.G = get_points (T.EFG) + z.S = T.ABC: medial (): circum_circle ().south + z.O = T.ABC: medial ().circumcenter +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C E,F,G) + \tkzDrawCircle(O,E) + \tkzDrawPoints(A,B,C,O,S,E,F,G) + \tkzLabelPoints(A,B,O,S,E,F,G) + \tkzLabelPoints[above](C) +\end{tikzpicture} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/tkz-elements/tkz-elements.pdf b/Master/texmf-dist/doc/latex/tkz-elements/tkz-elements.pdf Binary files differindex 7c2839b3f4a..0684fccc1fe 100644 --- a/Master/texmf-dist/doc/latex/tkz-elements/tkz-elements.pdf +++ b/Master/texmf-dist/doc/latex/tkz-elements/tkz-elements.pdf diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty b/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty index a147a045aaf..80a39af0834 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty @@ -1,5 +1,5 @@ % encoding : utf8 -% tkz-elements v1.00b +% tkz-elements v1.20b % 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 @@ -11,13 +11,18 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[2023/10/20 v1.00b Graphic Object Library] +\ProvidesPackage{tkz-elements}[2023/11/10 v1.20b Graphic Object Library] \RequirePackage{luacode} \RequirePackage{filecontents} \directlua{require "tkz_elements_main"} \newenvironment{tkzelements} - {\directlua{scale=1} + { \directlua{scale=1} + \directlua{for k,v in pairs(z) do z[k] = nil end} + \directlua{for k,v in pairs(L) do L[k] = nil end} + \directlua{for k,v in pairs(C) do C[k] = nil end} + \directlua{for k,v in pairs(T) do T[k] = nil end} + \directlua{for k,v in pairs(E) do E[k] = nil end} \luacode} {\endluacode} \def\tkzGetNodes{\directlua{% @@ -32,4 +37,12 @@ tex.print("\\coordinate ("..K..") at ("..V.re..","..V.im..") ;\\\\") end} } +\def\tkzEraseTables{ + \directlua{for k,v in pairs(z) do z[k] = nil end} + \directlua{for k,v in pairs(L) do L[k] = nil end} + \directlua{for k,v in pairs(C) do C[k] = nil end} + \directlua{for k,v in pairs(T) do T[k] = nil end} + \directlua{for k,v in pairs(E) do E[k] = nil end} +} +\def\tkzUseLua#1{\directlua{tex.print(tostring(#1))}} \endinput diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circles.lua index 52da83fc252..7af14e473cb 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circles.lua @@ -1,6 +1,6 @@ -- tkz_elements-circles.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -27,18 +27,29 @@ function circle: new (c, t) -- c --> center t --> through setmetatable(new_circle, {__index = circle}) return new_circle end +-- other definition -function circle: antipode (pt) - return 2 * self.center - pt +function circle: radius (center, radius) -- c --> center r --> radius + local through + through = center + point( radius, 0 ) + return circle : new (center, through ) end - -function circle: power (pt) - local d - d = point.abs (self.center - pt) - return d * d - self.radius * self.radius +----------------------- +-- boolean -- +----------------------- +function circle: in_out (pt) + local d,epsilon + epsilon = 10^(-12) + d = point.abs (pt - self.center) + if math.abs(d-self.radius) < epsilon + then + return true + else + return false + end end -function circle: in_out (pt) +function circle: in_out_disk (pt) local d d = point.abs (pt - self.center) if d <= self.radius @@ -48,22 +59,78 @@ function circle: in_out (pt) return false end end +----------------------- +-- real -- +----------------------- --- function circle: tangent_at (pt) --- return tangent_at_ (self.center,self.through,pt) --- end +function circle: power (pt) + local d + d = point.abs (self.center - pt) + return d * d - self.radius * self.radius +end +----------------------- +-- points -- +----------------------- +function circle: antipode (pt) + return 2 * self.center - pt +end + +function circle: set_inversion (...) + local tp = table.pack(...) + local i + local t = {} + for i=1,tp.n do + table.insert( t , inversion_ ( self.center,self.through, tp[i] ) ) + end + return table.unpack ( t ) +end + +function circle: midarc (z1,z2) + local phi = 0.5 * get_angle_(self.center,z1,z2 ) + return rotation_ (self.center,phi,z1) +end + +function circle: point (phi) + return point (self.center.re+self.radius*math.cos(phi),self.center.im+self.radius*math.sin(phi) ) +end +function circle: random_pt(lower, upper) +local t + math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) ) + phi = lower + math.random() * (upper - lower) +return point (self.center.re+self.radius*math.cos(phi),self.center.im+self.radius*math.sin(phi) ) +end + +function circle: internal_similitude (C) + return barycenter_ ({self.center,C.radius},{C.center,self.radius}) +end + +function circle: external_similitude (C) + return barycenter_ ({C.center,self.radius},{self.center,-C.radius}) +end + + +----------------------- +-- lines -- +----------------------- function circle: tangent_at (pt) return line : new ( rotation_ (pt,math.pi/2,self.center),rotation_ (pt,-math.pi/2,self.center)) end - function circle: tangent_from (pt) local t1,t2 t1,t2 = tangent_from_ (self.center,self.through,pt) return line :new (pt,t1),line : new (pt,t2) end - + + function circle: radical_axis (C) + local t1,t2 + t1,t2 = radical_axis_ (self.center,self.through,C.center,C.through) + return line : new (t1,t2) + end + ----------------------- + -- circles -- + ----------------------- function circle: orthogonal_from (pt) local t1,t2 t1,t2 = tangent_from_ (self.center,self.through,pt) @@ -73,50 +140,44 @@ end function circle: orthogonal_through (pta,ptb) return circle : new (orthogonal_through_ (self.center,self.through,pta,ptb),pta) end - - function circle: inversion (pt) - return inversion_ (self.center,self.through,pt) - end - function circle: set_inversion (...) - local tp = table.pack(...) - local i - local t = {} - for i=1,tp.n do - table.insert( t , inversion_ ( self.center,self.through, tp[i] ) ) - end - return table.unpack ( t ) - end - - function circle: midarc (z1,z2) - local phi = 0.5 * get_angle_(self.center,z1,z2 ) - return rotation_ (self.center,phi,z1) + function circle: inversion_L (L) + local p,q + if L: in_out (self.center) then + return L + else + p = L: projection (self.center) + q = inversion_ (self.center,self.through,p) + return circle: new (midpoint_(self.center,q),q) + end end - - function circle: point (phi) - return point (self.center.re+self.radius*math.cos(phi),self.center.im+self.radius*math.sin(phi) ) + + function circle: inversion_C (C) + local p,q,x,y + if C: in_out (self.center) then + p = C : antipode (self.center) + q = inversion_ (self.center,self.through,p) + x = ortho_from_ ( q , self.center , p ) + y = ortho_from_ ( q , p, self.center) + return line : new (x,y) + else + x,y = intersection_lc_ (self.center,C.center,C.center,C.through) + X = inversion_ (self.center,self.through,x) + Y = inversion_ (self.center,self.through,y) + return circle : new (midpoint_(X,Y),X) + end end -function circle: random_pt(lower, upper) -local t - math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) ) - phi = lower + math.random() * (upper - lower) -return point (self.center.re+self.radius*math.cos(phi),self.center.im+self.radius*math.sin(phi) ) -end - -function circle: radical_axis (C) - local t1,t2 - t1,t2 = radical_axis_ (self.center,self.through,C.center,C.through) -return line : new (t1,t2) -end - -function circle: internal_similitude (C) - return barycenter_ ({self.center,C.radius},{C.center,self.radius}) -end - -function circle: external_similitude (C) - return barycenter_ ({C.center,self.radius},{self.center,-C.radius}) + function circle: inversion (obj) + if obj.type == "point" then + return inversion_ (self.center,self.through,obj) + elseif obj.type == "line" then + return self: inversion_L (obj) +else + return self: inversion_C (obj) end + end + function circle: draw () local x,y diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipses.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipses.lua index 0e15d5ab861..4bc34c61b70 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipses.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipses.lua @@ -1,6 +1,6 @@ -- tkz_elements-ellipses.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua index e1d6b4bd536..fe9c91d2f75 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_circles.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -14,23 +14,28 @@ -- define a circle by the center and a radius -function circle_cr ( c, r ) - return c + point(r,0) -end +-- function circle_cr ( c, r ) +-- return c + point(r,0) +-- end function midarc_ (o,a,b) -- a -> b local phi = 0.5 * get_angle_ ( a,o,b ) return rotation_ (o,phi,b) end ---------------------------------------------------------------------------- --- -- possible (C,p) with C.center and C.through --- function tangent_from (c,p) --- local m = midpoint_ (c.center,p) --- return intersection_cc_ (c.center,c.through,m,p) --- end ---------------------------------------------------------------------------- --- tangente à un cercle ---------------------------------------------------------------------------- + +function radical_center (C1,C2,C3) + local t1,t2,t3,t4 + t1,t2 = radical_axis_ (C3.center,C3.through,C1.center,C1.through) + t3,t4 = radical_axis_ (C3.center,C3.through,C2.center,C2.through) +return intersection_ll_ (t1,t2,t3,t4) +end + +function radical_circle (C1,C2,C3) + local rc + rc = radical_center (C1,C2,C3) + return C1 : orthogonal_from (rc) +end + function tangent_from_ (c,p,pt) local o o = midpoint_ ( c,pt ) @@ -38,7 +43,7 @@ function tangent_from_ (c,p,pt) end function tangent_at_ (a,b,p) - return rotation_ (p,math.pi/2,a),rotation_ (p,-math.pi/2,a) + return rotation_ (p,math.pi/2,a),rotation_ (p,-math.pi/2,a) end function orthogonal_from_ (a,b,p) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua index 8c5123129d0..f52c4bc2b1f 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua @@ -1,6 +1,6 @@ -- tkz_elements_intersections.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua index 87ea1de0439..c78004be6af 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_lines.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -15,6 +15,9 @@ --------------------------------------------------------------------------- -- Lines --------------------------------------------------------------------------- +function normalize_ (a,b) + return a+(b-a)/point.mod(b-a) +end function ortho_from_ ( p , a , b ) return p+(b-a)*point(0,1) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua index 866912468a0..f38458e1f18 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -101,6 +101,10 @@ function value (v) return scale * v end +function real (v) + return v/scale +end + function get_angle (a,b,c) return angle_normalize(get_angle_( a,b,c )) end diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua index fcd249d8916..ea468a9c6d9 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_points.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -34,9 +34,9 @@ end return sum/weight end -function rotation_ (center,alpha,pt) - local z = point( math.cos(alpha) , math.sin(alpha) ) - return z*(pt-center)+center +function rotation_ (c,a,pt) + local z = point( math.cos(a) , math.sin(a) ) + return z*(pt-c)+c end function symmetry_(c,pt) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua index b4e41104d14..166d3b7647a 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_triangles.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -200,7 +200,7 @@ function incentral_tr_ (a,b,c) r = intersection_ll_ ( a,i , b,c) s = intersection_ll_ ( b,i , a,c) t = intersection_ll_ ( c,i , a,b) -return i,r,s,t +return r,s,t end function excentral_tr_ (a,b,c) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_lines.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_lines.lua index 05d41969382..11d8f49d41e 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_lines.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_lines.lua @@ -1,6 +1,6 @@ -- tkz_elements_lines.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -34,9 +34,47 @@ function line: new(za, zb) setmetatable(new_line, {__index = line}) return new_line end + +------------------- +-- Result -> real +------------------- +function line: distance (pt) + return point.mod(projection(self,pt)-pt) +end + +function line: slope () + return slope_(self.pa,self.pb) +end +------------------- +-- Result -> boolean +------------------- +function line: in_out (pt) + local sc,epsilon + epsilon = 10^(-12) + sc = math.abs ((pt-self.pa)^(pt-self.pb)) + if sc <= epsilon + then + return true + else + return false + end +end + ------------------- -- Result -> point ------------------- +function line: translation ( pt ) + return translation_ ( self.pb-self.pa,pt ) +end + +function line: set_translation ( ...) + return set_translation_ ( self.pb-self.pa,... ) +end + +function line: projection ( pt ) + return projection_ ( self.pa,self.pb,pt ) +end + function line: set_projection (...) local tp = table.pack(...) local i @@ -60,7 +98,7 @@ function line: set_symmetry_axial (...) end return table.unpack ( t ) end --- k_div ig "gold" or "phi" then + function line: barycenter (ka,kb) return barycenter_({self.pa,ka},{self.pb,kb}) @@ -89,6 +127,14 @@ end function line: gold_ratio() return self.pa + (self.pb-self.pa)*tkzinvphi end + +function line: normalize () + return self.pa+(self.pb-self.pa)/point.mod(self.pb-self.pa) +end + +function line: normalize_inv () + return normalize_ (self.pb,self.pa) +end ------------------- -- Result -> line ------------------- @@ -100,10 +146,6 @@ function line: ortho_from ( pt ) return line : new (pt,pt+(self.pb-self.pa)*point(0,1)) end -function line: projection ( pt ) - return projection_ ( self.pa,self.pb,pt ) -end - function line: mediator () local m m = midpoint_ (self.pa,self.pb) @@ -119,30 +161,7 @@ end function line: circle_swap () return circle : new (self.pb,self.pa) end -------------------- --- Result -> real -------------------- -function line: distance (pt) - return point.mod(projection(self,pt)-pt) -end -------------------- --- Result -> boolean -------------------- -function line: in_out (pt) - local sc,epsilon - epsilon = 10^(-12) - sc = math.abs ((pt-self.pa)^(pt-self.pb)) - if sc <= epsilon - then - return true - else - return false - end -end - -function line: slope () - return slope_(self.pa,self.pb) -end + ---------------------- -- Result -> triangle ---------------------- diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua index 92e006fe78f..10b96d14309 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua @@ -1,6 +1,6 @@ -- tkz_elements-main.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -43,5 +43,7 @@ if obj.type == 'line' then return obj.pa,obj.pb obj.type == 'triangle' then return obj.pa,obj.pb,obj.pc elseif obj.type == 'circle' then return obj.center,obj.through + elseif + obj.type == 'ellipse' then return obj.pc,obj.pa,obj.pb end end
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua index 0b2e3dec4a8..5d459e3028d 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua @@ -1,6 +1,6 @@ -- tkz_elements_point.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_points.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_points.lua index bcaff010cc7..74ad16a1650 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_points.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_points.lua @@ -1,6 +1,6 @@ -- tkz_elements_points.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangles.lua index 1960248e502..6ea35c5b6ed 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangles.lua @@ -1,6 +1,6 @@ -- tkz_elements_triangles.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 @@ -20,6 +20,7 @@ function triangle: new (za, zb ,zc) local incenter = in_center_ (za , zb , zc) local orthocenter = ortho_center_ (za , zb , zc) local eulercenter = euler_center_ (za , zb , zc) + local spiekercenter = spieker_center_ (za , zb , zc) local c = point.abs(zb-za) local a = point.abs(zc-zb) local b = point.abs(za-zc) @@ -31,8 +32,8 @@ function triangle: new (za, zb ,zc) local bc =line : new (zb,zc) local new_triangle = {pa = za, pb = zb, pc = zc, type = type, circumcenter=circumcenter,centroid=centroid,incenter=incenter, - eulercenter=eulercenter, orthocenter=orthocenter,a=a,b=b,c=c,ab=ab,ac=ac,bc=bc, - alpha=alpha,beta=beta,gamma=gamma} + eulercenter=eulercenter, orthocenter=orthocenter,spiekercenter=spiekercenter, + a=a,b=b,c=c,ab=ab,ac=ac,bc=bc,alpha=alpha,beta=beta,gamma=gamma} setmetatable(new_triangle, {__index = triangle}) return new_triangle end diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vectors.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vectors.lua index 44ea2f7f2eb..26ec57e695a 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vectors.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vectors.lua @@ -1,6 +1,6 @@ -- tkz_elements_vectors.lua --- date 2023/10/20 --- version 1.00b +-- date 2023/11/10 +-- version 1.20b -- 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 |