summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua')
-rw-r--r--macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-angles.tex102
-rw-r--r--macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-base.tex89
-rw-r--r--macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-intersections.tex525
-rw-r--r--macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-math.tex417
4 files changed, 1133 insertions, 0 deletions
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-angles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-angles.tex
new file mode 100644
index 0000000000..69fd1110ab
--- /dev/null
+++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-angles.tex
@@ -0,0 +1,102 @@
+% tkz-tools-lua-angles.tex
+% 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
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% This work has the LPPL maintenance status “maintained”.
+% The Current Maintainer of this work is Alain Matthes.
+
+\def\fileversion{5.00c}
+\def\filedate{2023/01/23}
+\typeout{2023/01/23 5.00c tkz-tools-lua-angles.tex}
+\makeatletter
+\def\tkzmathrotatepointaround#1#2#3{%
+ \pgf@process{%
+ \pgf@process{#1}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{#2}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@x=\pgf@xc%
+ \pgf@y=\pgf@yc%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ \pgfmathsetmacro\angle{#3}%
+ \edef\sineangle{\tkz@Dec{\tkz@Sin{\tkz@Rad{\angle}}}}%
+ \edef\cosineangle{\tkz@Dec{\tkz@Cos{\tkz@Rad{\angle}}}}%
+ \pgf@xa\cosineangle\pgf@x%
+ \advance\pgf@xa-\sineangle\pgf@y%
+ \pgf@ya\sineangle\pgf@x%
+ \advance\pgf@ya\cosineangle\pgf@y%
+ \pgf@x\pgf@xb%
+ \pgf@y\pgf@yb%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+}
+
+%<-------------------------------------------------------------------------->
+% Angles
+%<-------------------------------------------------------------------------->
+\def\tkzmathanglebetweenpoints#1#2{
+\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}}%
+\edef\tkzax{\strip@pt\pgf@x}%
+\edef\tkzay{\strip@pt\pgf@y}%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#2}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#2}{center}}%
+\edef\tkzbx{\strip@pt\pgf@x}%
+\edef\tkzby{\strip@pt\pgf@y}%
+\edef\tkz@tmp{\tkz@Angle{\tkzax}{\tkzay}{\tkzbx}{\tkzby}}
+\edef\pgfmathresult{\tkz@Dec{\tkz@Round{\tkz@tmp}{2}}}
+}
+%<--------------------------------------------------------------------------–>
+%<--------------------------------------------------------------------------–>
+% thanks karu : http://tex.stackexchange.com/questions/151667/tkzgetangle-strange-behavior/196224#196224
+% \tkzGetAngle strange behavior
+% defines \tkz@FirstAngle and \tkz@SecondAngle sens trigo
+%<--------------------------------------------------------------------------–>
+
+\def\tkzNormalizeAngle(#1,#2){%
+\directlua{angleA, angleB = normalize(#1,#2)
+token.set_macro("tkz@FirstAngle", angleA)
+token.set_macro("tkz@SecondAngle", angleB)
+}}
+%<--------------------------------------------------------------------------–>
+% Angle
+% Recherche l'angle formé par #1 et #2 par rapport à l'horizontale
+%<--------------------------------------------------------------------------–>
+\def\tkzFindSlopeAngle(#1,#2){%
+\begingroup
+ \tkzmathanglebetweenpoints{#1}{#2}
+ \global\let\tkzAngleResult\pgfmathresult
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% Angle avec trois nodes
+%<--------------------------------------------------------------------------–>
+\def\tkzFindAngle(#1,#2,#3){% new code 2016
+\begingroup
+ \tkzFindSlopeAngle(#2,#1)\tkzGetAngle{tkz@FirstAngle}
+ \tkzFindSlopeAngle(#2,#3)\tkzGetAngle{tkz@SecondAngle}
+ \tkzNormalizeAngle(\tkz@FirstAngle,\tkz@SecondAngle)
+ \edef\tkz@Angle{\fpeval{\tkz@SecondAngle-\tkz@FirstAngle}}
+ \global\let\tkzAngleResult\tkz@Angle
+\endgroup
+}
+
+%<--------------------------------------------------------------------------–>
+% Find angle
+%<--------------------------------------------------------------------------–>
+\def\tkzGetAngle#1{%
+ \global\expandafter\edef\csname #1\endcsname{\tkzAngleResult}
+}
+\makeatother
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-base.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-base.tex
new file mode 100644
index 0000000000..c31c925187
--- /dev/null
+++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-base.tex
@@ -0,0 +1,89 @@
+% tkz-tools-lua-base.tex
+% 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
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% This work has the LPPL maintenance status “maintained”.
+% The Current Maintainer of this work is Alain Matthes.
+
+\def\fileversion{5.00c}
+\def\filedate{2023/01/23}
+\typeout{2023/01/23 5.00c tkz-tools-lua-base.tex}
+\makeatletter
+%<--------------------------------------------------------------------------–>
+\global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016
+\global\let\tkz@tmp@xb\tkz@init@xmax% modif 2016
+\global\let\tkz@tmp@ya\tkz@init@ymin% modif 2016
+\global\let\tkz@tmp@yb\tkz@init@ymax% modif 2016
+%<--------------------------------------------------------------------------–>
+\pgfkeys{
+ /tkzInit/.cd,
+ xmin/.store in = \tkz@init@xmin,
+ xmax/.store in = \tkz@init@xmax,
+ xstep/.store in = \tkz@init@xstep,
+ ymin/.store in = \tkz@init@ymin,
+ ymax/.store in = \tkz@init@ymax,
+ ystep/.store in = \tkz@init@ystep,
+ NO/.is if = tkz@init@NO,
+ NO/.default = true,
+ xmin = 0,
+ xmax = 10,
+ xstep = 1,
+ ymin = 0,
+ ymax = 10,
+ ystep = 1,
+ NO = false
+ }
+
+\def\tkzInit{\pgfutil@ifnextchar[{\tkz@Init}{\tkz@Init[]}}
+\def\tkz@Init[#1]{%
+ \pgfqkeys{/tkzInit}{#1}
+ \ifx\tkzfctloaded\undefined
+ \else
+ \tkz@tkzf@fct=0 % only if tkz-fct loaded
+ \fi
+ \xdef\tkz@init@xorigine{0}
+ \xdef\tkz@init@yorigine{0}
+ \edef\@xsgmin{\fpeval{sign(\tkz@init@xmin)}}
+ \edef\@xsgmax{\fpeval{sign(\tkz@init@xmax)}}
+ \edef\@ysgmin{\fpeval{sign(\tkz@init@ymin)}}
+ \edef\@ysgmax{\fpeval{sign(\tkz@init@ymax)}}
+ \let\tkz@tmp@xa\tkz@init@xmin %modif 2016
+ \let\tkz@tmp@xb\tkz@init@xmax %modif 2016
+ \let\tkz@tmp@ya\tkz@init@ymin %modif 2016
+ \let\tkz@tmp@yb\tkz@init@ymax %modif 2016
+ \tkz@init@NOfalse
+ \ifx\@xsgmin\@xsgmax \tkz@init@NOtrue \fi
+ \ifx\@ysgmin\@ysgmax \tkz@init@NOtrue \fi
+ \iftkz@init@NO%
+ \ifx\@xsgmin\@xsgmax
+ \edef\tkz@init@xmax{\tkz@Dec{\tkz@init@xmax-(\tkz@init@xmin)}}
+ \edef\tkz@init@xorigine{\tkz@init@xmin}
+ \edef\tkz@init@xmin{0}
+ \fi
+ \ifx\@ysgmin\@ysgmax
+ \edef\tkz@init@ymax{\tkz@Dec{\tkz@init@ymax-(\tkz@init@ymin)}}
+ \edef\tkz@init@yorigine{\tkz@init@ymin}
+ \edef\tkz@init@ymin{0}
+ \fi
+ \fi
+ \edef\tkz@xa{\tkz@Dec{\tkz@init@xmin/\tkz@init@xstep}}
+ \edef\tkz@xb{\tkz@Dec{\tkz@init@xmax/\tkz@init@xstep}}
+ \edef\tkz@ya{\tkz@Dec{\tkz@init@ymin/\tkz@init@ystep}}
+ \edef\tkz@yb{\tkz@Dec{\tkz@init@ymax/\tkz@init@ystep}}
+ \tkz@getdecimal{\tkz@init@xstep} % amélioration nb dec et integer
+ \xdef\tkz@init@xdec{\number\c@pgfmath@countb}
+ \tkz@getdecimal{\tkz@init@ystep}
+ \xdef\tkz@init@ydec{\number\c@pgfmath@countb}
+}%
+\def\tkzAddName{\pgfutil@ifnextchar[{\tkz@AddName}{\tkz@AddName[]}}
+\def\tkz@AddName[#1]#2{%
+\node[above left,#1] at (\pgf@path@lastx,\pgf@path@lasty){#2};
+}%
+%<--------------------------------------------------------------------------–>
+\makeatother
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-intersections.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-intersections.tex
new file mode 100644
index 0000000000..050697a1bb
--- /dev/null
+++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-intersections.tex
@@ -0,0 +1,525 @@
+% tkz-tools-lua-intersections.tex
+% 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
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status “maintained”.
+%
+% The Current Maintainer of this work is Alain Matthes.
+% utf8 encoding
+
+\def\fileversion{5.00c}
+\def\filedate{2023/01/23}
+\typeout{2023/01/23 5.00c tkz-tools-lua-intersections.tex}
+\makeatletter
+%<--------------------------------------------------------------------------–>
+% intersection de deux lignes
+%<--------------------------------------------------------------------------–>
+\def\tkzInterLL(#1,#2)(#3,#4){% méthode avec xfp
+\tkz@InterLL(#1,#2)(#3,#4){tkzPointResult}
+}
+
+\def\tkz@InterLL(#1,#2)(#3,#4)#5{%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}}%
+\tkz@ax\pgf@x%
+\tkz@ay\pgf@y%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#2}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#2}{center}}
+\tkz@bx\pgf@x%
+\tkz@by\pgf@y%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#3}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#3}{center}}%
+\tkz@cx\pgf@x%
+\tkz@cy\pgf@y%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#4}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#4}{center}}%
+\tkz@dx\pgf@x%
+\tkz@dy\pgf@y%
+\edef\tkzax{\strip@pt\tkz@ax}%
+\edef\tkzay{\strip@pt\tkz@ay}%
+\edef\tkzbx{\strip@pt\tkz@bx}%
+\edef\tkzby{\strip@pt\tkz@by}%
+\edef\tkzcx{\strip@pt\tkz@cx}%
+\edef\tkzcy{\strip@pt\tkz@cy}%
+\edef\tkzdx{\strip@pt\tkz@dx}%
+\edef\tkzdy{\strip@pt\tkz@dy}%
+\edef\tkz@deltax{\tkz@Dec{(\tkzax-(\tkzbx))/(28.45274)}}
+\edef\tkz@deltaxx{\tkz@Dec{(\tkzcx-(\tkzdx))/(28.45274)}}
+\edef\tkz@deltay{\tkz@Dec{(\tkzay-(\tkzby))/(28.45274)}}
+\edef\tkz@deltayy{\tkz@Dec{(\tkzcy-(\tkzdy))/(28.45274)}}
+\edef\tkz@deltaxy{\tkz@Dec{((\tkzax*\tkzby)-(\tkzay*\tkzbx))/(809.55841)}}
+\edef\tkz@deltaxxyy{\tkz@Dec{((\tkzcx*\tkzdy)-(\tkzcy*\tkzdx))/(809.55841)}}
+\edef\tkz@div{\tkz@Dec{(\tkz@deltax*\tkz@deltayy)-(\tkz@deltay*\tkz@deltaxx)}}
+\edef\tkz@numx{\tkz@Dec{(\tkz@deltaxy*\tkz@deltaxx)-(\tkz@deltax*\tkz@deltaxxyy)}}
+\edef\tkz@numy{\tkz@Dec{(\tkz@deltaxy*\tkz@deltayy)-(\tkz@deltay*\tkz@deltaxxyy)}}
+\edef\tkz@xs{\tkz@Dec{\tkz@numx/\tkz@div}}
+\edef\tkz@ys{\tkz@Dec{\tkz@numy/\tkz@div}}
+\edef\tkz@xs{\tkz@Round{\tkz@xs}{5}}
+\edef\tkz@ys{\tkz@Round{\tkz@ys}{5}}
+\path[coordinate](\tkz@xs,\tkz@ys) coordinate (#5);
+}
+
+
+% méthode with coordinates
+\def\tkzInterLLxy(#1,#2,#3,#4)(#5,#6,#7,#8){%
+%\path (intersection of #1--#2 and #3--#4) coordinate(#5);%
+\tkz@ax#1%
+\tkz@ay#2%
+\tkz@bx#3%
+\tkz@by#4%
+\tkz@cx#5%
+\tkz@cy#6%
+\tkz@dx#7%
+\tkz@dy#8%
+\edef\tkzax{\strip@pt\tkz@ax}%
+\edef\tkzay{\strip@pt\tkz@ay}%
+\edef\tkzbx{\strip@pt\tkz@bx}%
+\edef\tkzby{\strip@pt\tkz@by}%
+\edef\tkzcx{\strip@pt\tkz@cx}%
+\edef\tkzcy{\strip@pt\tkz@cy}%
+\edef\tkzdx{\strip@pt\tkz@dx}%
+\edef\tkzdy{\strip@pt\tkz@dy}%
+\edef\tkz@deltax{\tkz@Dec{(\tkzax-(\tkzbx))/(28.45274)}}
+\edef\tkz@deltaxx{\tkz@Dec{(\tkzcx-(\tkzdx))/(28.45274)}}
+\edef\tkz@deltay{\tkz@Dec{(\tkzay-(\tkzby))/(28.45274)}}
+\edef\tkz@deltayy{\tkz@Dec{(\tkzcy-(\tkzdy))/(28.45274)}}
+\edef\tkz@deltaxy{\tkz@Dec{((\tkzax*\tkzby)-(\tkzay*\tkzbx))/(809.55841)}}
+\edef\tkz@deltaxxyy{\tkz@Dec{((\tkzcx*\tkzdy)-(\tkzcy*\tkzdx))/(809.55841)}}
+\edef\tkz@div{\tkz@Dec{(\tkz@deltax*\tkz@deltayy)-(\tkz@deltay*\tkz@deltaxx)}}
+\edef\tkz@numx{\tkz@Dec{(\tkz@deltaxy*\tkz@deltaxx)-(\tkz@deltax*\tkz@deltaxxyy)}}
+\edef\tkz@numy{\tkz@Dec{(\tkz@deltaxy*\tkz@deltayy)-(\tkz@deltay*\tkz@deltaxxyy)}}
+\edef\tkz@xs{\tkz@Dec{\tkz@numx/\tkz@div}}
+\edef\tkz@ys{\tkz@Dec{\tkz@numy/\tkz@div}}
+\edef\tkz@xs{\tkz@Round{\tkz@xs}{5}}
+\edef\tkz@ys{\tkz@Round{\tkz@ys}{5}}
+\path[coordinate](\tkz@xs,\tkz@ys) coordinate (tkzPointResult);
+}
+
+%<--------------------------------------------------------------------------–>
+% intersection de Ligne Cercle rayon connu
+%<--------------------------------------------------------------------------–>
+% /*
+% Calculate the intersection of a ray and a sphere
+% The line segment is defined from p1 to p2
+% The sphere is of radius r and centered at sc
+% There are potentially two points of intersection given by
+% p = p1 + mu1 (p2 - p1)
+% p = p1 + mu2 (p2 - p1)
+% Return FALSE if the ray doesn't intersect the sphere.
+% */
+% int RaySphere(XYZ p1,XYZ p2,XYZ sc,double r,double *mu1,double *mu2)
+% {
+% double a,b,c;
+% double bb4ac;
+% XYZ dp;
+%
+% dp.x = p2.x - p1.x;
+% dp.y = p2.y - p1.y;
+% dp.z = p2.z - p1.z;
+% a = dp.x * dp.x + dp.y * dp.y + dp.z * dp.z;
+% b = 2 * (dp.x * (p1.x - sc.x) + dp.y * (p1.y - sc.y) + dp.z * (p1.z - sc.z));
+% c = sc.x * sc.x + sc.y * sc.y + sc.z * sc.z;
+% c += p1.x * p1.x + p1.y * p1.y + p1.z * p1.z;
+% c -= 2 * (sc.x * p1.x + sc.y * p1.y + sc.z * p1.z);
+% c -= r * r;
+% bb4ac = b * b - 4 * a * c;
+% if (ABS(a) < EPS || bb4ac < 0) {
+% *mu1 = 0;
+% *mu2 = 0;
+% return(FALSE);
+% }
+%
+% *mu1 = (-b + sqrt(bb4ac)) / (2 * a);
+% *mu2 = (-b - sqrt(bb4ac)) / (2 * a);
+%
+% return(TRUE);
+% }
+%<---------- test ------------------------------------------------------–>
+\def\tkzTestInterLC(#1,#2)(#3,#4){%
+\begingroup
+\tkz@Projection(#1,#2)(#3){tkz@pth}% distance centre à la ligne
+\tkz@@CalcLength(#3,tkz@pth){tkz@mathLen}%
+\tkz@@CalcLength(#3,#4){tkzLengthResult}%calcul du rayon
+\ifdim\tkz@mathLen pt>\tkzLengthResult pt\relax%
+\global\tkzFlagLCfalse
+\else
+\global\tkzFlagLCtrue
+\fi
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+\def\tkz@numlc{0}
+\pgfkeys{/linecircle/.cd,
+ node/.code = \def\tkz@numlc{0},
+ R/.code = \def\tkz@numlc{1},
+ with nodes/.code = \def\tkz@numlc{2},
+ common/.store in = \tkz@common,
+ common = {},
+ near/.is if = tkz@near,
+ near/.default = true,
+ near = false,
+ next to/.store in = \tkz@nextto,
+ next to/.initial = {},
+ next/.default = {},
+ next to = {},
+ next to/.value required,
+ node
+ }
+%<--------------------------------------------------------------------------–>
+\def\tkzInterLC{\pgfutil@ifnextchar[{\tkz@InterLC}{\tkz@InterLC[]}}
+\def\tkz@InterLC[#1](#2,#3)(#4,#5){%
+\begingroup
+\pgfqkeys{/linecircle}{#1}
+ \pgfinterruptboundingbox
+\ifcase\tkz@numlc%
+ % first case 0
+ \tkz@@CalcLength(#4,#5){tkzLengthResult}
+ \tkzInterLCR(#2,#3)(#4,\tkzLengthResult pt){tkzFirstPointResult}%
+ {tkzSecondPointResult}
+\or% 1
+ \tkzInterLCR(#2,#3)(#4,#5 cm){tkzFirstPointResult}
+ {tkzSecondPointResult}%
+\or% 2
+ \tkzInterLCWithNodes(#2,#3)(#4,#5){tkzFirstPointResult}%
+ {tkzSecondPointResult}%
+\fi
+\iftkz@near
+ \tkz@@CalcLength(#2,tkzFirstPointResult){tkzLengthFirst}
+ \tkz@@CalcLength(#2,tkzSecondPointResult){tkzLengthSecond}
+ \ifdim \tkzLengthFirst pt < \tkzLengthSecond pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+\else
+ \ifx\tkz@common\tkzutil@empty
+ \ifx\tkz@nextto\tkzutil@empty
+ \tkzFindAngle(tkzSecondPointResult,tkzFirstPointResult,#4)
+ \tkzGetAngle{tkz@an}
+ \ifdim\tkz@an pt<180 pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+ \else
+ \tkz@@CalcLength(\tkz@nextto,tkzFirstPointResult){tkzLengthFirst}
+ \tkz@@CalcLength(\tkz@nextto,tkzSecondPointResult){tkzLengthSecond}
+ \ifdim \tkzLengthFirst pt < \tkzLengthSecond pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+ \fi
+ \else
+ \tkz@@CalcLength(\tkz@common,tkzSecondPointResult){tkz@mathLen}
+ \ifdim\tkz@mathLen pt<1pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+ \fi
+\fi%near
+\endpgfinterruptboundingbox
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+%<--------------------------------------------------------------------------–>
+\def\tkzInterLCR(#1,#2)(#3,#4)#5#6{%
+\begingroup
+\tkz@radi=#4%
+\tkz@@extractxy{#3}
+\tkz@bx =\pgf@x\relax%
+\tkz@by =\pgf@y\relax%
+\tkz@Projection(#1,#2)(#3){tkz@pth}
+\tkz@@CalcLength(#3,tkz@pth){tkz@mathLen}
+ \ifdim\tkz@mathLen pt<0.05pt\relax%
+ \pgfpointdiff{\pgfpointanchor{#1}{center}}%
+ {\pgfpointanchor{#2}{center}}%
+ \tkz@ax=\pgf@x%
+ \tkz@ay=\pgf@y%
+ \pgfpointborderellipse{\pgfpoint{\tkz@ax}{\tkz@ay}}%
+ {\pgfpoint{\tkz@radi}{\tkz@radi}}
+ \tkz@ax=\pgf@x\relax%
+ \tkz@ay=\pgf@y\relax%
+ \advance\tkz@bx by\tkz@ax\relax%
+ \advance\tkz@by by\tkz@ay\relax%
+ \pgfcoordinate{#6}{\pgfqpoint{\tkz@bx}{\tkz@by}}
+ \tkzCSym(#3)(#6){#5}
+ \else
+ \edef\pgfmathresult{\fpeval{\tkz@mathLen/\tkz@radi}}
+ % \edef\tkz@angle{\fpeval{acosd(\pgfmathresult)}}
+ \pgfmathacos@{\pgfmathresult}%
+ \let\tkz@angle\pgfmathresult%
+ \pgfpointdiff{\pgfpointanchor{#3}{center}}%
+ {\pgfpointanchor{tkz@pth}{center}}%
+ \tkz@ax=\pgf@x%
+ \tkz@ay=\pgf@y%
+ \pgfpointborderellipse{\pgfpoint{\tkz@ax}{\tkz@ay}}%
+ {\pgfpoint{\tkz@radi}{\tkz@radi}}
+ \tkz@ax =\pgf@x\relax%
+ \tkz@ay =\pgf@y\relax%
+ \advance\tkz@bx by\tkz@ax\relax%
+ \advance\tkz@by by\tkz@ay\relax%
+ \tkz@@extractxy{#3}
+ \tkz@ax =\pgf@x\relax%
+ \tkz@ay =\pgf@y\relax%
+ \tkz@@extractxy{tkz@pth}
+ \pgfmathrotatepointaround{\pgfpoint{\tkz@bx}{\tkz@by}}%
+ {\pgfpoint{\tkz@ax}{\tkz@ay}}%
+ {\tkz@angle}
+ \pgfcoordinate{#5}{\pgfqpoint{\pgf@x}{\pgf@y}}
+ \pgfmathrotatepointaround{\pgfpoint{\tkz@bx}{\tkz@by}}%
+ {\pgfpoint{\tkz@ax}{\tkz@ay}}%
+ {-\tkz@angle}
+ \pgfcoordinate{#6}{\pgfqpoint{\pgf@x}{\pgf@y}}
+
+\fi
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% intersection de Ligne Cercle
+% #4 center #5 point sur le cercle
+%<--------------------------------------------------------------------------–>
+% \def\tkzInterLC(#1,#2)(#3,#4)#5#6{%
+% \begingroup
+% \tkz@@CalcLength(#3,#4){tkz@rad}
+% \tkzInterLCR(#1,#2)(#3,\tkz@rad pt){#5}{#6}
+% \endgroup
+% }
+%<--------------------------------------------------------------------------–>
+% intersection de Ligne Cercle rayon inconnu
+%<--------------------------------------------------------------------------–>
+\def\tkzInterLCWithNodes(#1,#2)(#3,#4,#5)#6#7{%
+\begingroup
+ \tkz@@CalcLength(#4,#5){tkz@radius}
+ \tkzInterLCR(#1,#2)(#3,\tkz@radius pt){#6}{#7}
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% Intersection of 2 circles
+%<--------------------------------------------------------------------------–>
+%<--------------------------------------------------------------------------–>
+% méthode
+% /* circle_circle_intersection() *
+% * Determine the points where 2 circles in a common plane intersect.
+% *
+% * int circle_circle_intersection(
+% * // center and radius of 1st circle
+% * double x0, double y0, double r0,
+% * // center and radius of 2nd circle
+% * double x1, double y1, double r1,
+% * // 1st intersection point
+% * // 2nd intersection point
+% *
+% * This is a public domain work. 3/26/2005 Tim Voght
+% *
+% int circle_circle_intersection(double x0, double y0, double r0,
+% double x1, double y1, double r1,
+% double *xi, double *yi,
+% double *xi_prime, double *yi_prime)
+% {
+% double a, dx, dy, d, h, rx, ry;
+% double x2, y2;
+%
+% /* dx and dy are the vertical and horizontal distances between
+% * the circle centers.
+% */
+% dx = x1 - x0;
+% dy = y1 - y0;
+%
+% /* Determine the straight-line distance between the centers. */
+% //d = sqrt((dy*dy) + (dx*dx));
+% d = hypot(dx,dy); // Suggested by Keith Briggs
+%
+% /* Check for solvability. */
+% if (d > (r0 + r1))
+% {
+% /* no solution. circles do not intersect. */
+% return 0;
+% }
+% if (d < fabs(r0 - r1))
+% {
+% /* no solution. one circle is contained in the other */
+% return 0;
+% }
+%
+% /* 'point 2' is the point where the line through the circle
+% * intersection points crosses the line between the circle
+% * centers.
+% */
+%
+% /* Determine the distance from point 0 to point 2. */
+% a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;
+%
+% /* Determine the coordinates of point 2. */
+% x2 = x0 + (dx * a/d);
+% y2 = y0 + (dy * a/d);
+%
+% /* Determine the distance from point 2 to either of the
+% * intersection points.
+% */
+% h = sqrt((r0*r0) - (a*a));
+%
+% /* Now determine the offsets of the intersection points from
+% * point 2.
+% */
+% rx = -dy * (h/d);
+% ry = dx * (h/d);
+%
+% /* Determine the absolute intersection points. */
+% *xi = x2 + rx;
+% *xi_prime = x2 - rx;
+% *yi = y2 + ry;
+% *yi_prime = y2 - ry;
+%
+% return 1;
+% }
+%<--------------------------------------------------------------------------–>
+% Intersection de deux cercles
+%<--------------------------------------------------------------------------–>
+%<---------- test ------------------------------------------------------–>
+% test avec des nodes R-r <= d <= R+r
+\def\tkzTestInterCC(#1,#2)(#3,#4){%
+\begingroup
+\tkz@@CalcLength(#1,#3){tkz@mathLen}% distance entre les centres
+\tkz@@CalcLength(#2,#1){tkz@rA}%calcul du rayon
+\tkz@@CalcLength(#4,#3){tkz@rB}%calcul du rayon
+% test if d <= rA + rB ?
+\edef\tkz@rS{\fpeval{\tkz@rA+\tkz@rB}}
+\ifdim\tkz@mathLen pt > \tkz@rS pt\relax%
+\global\tkzFlagCCfalse
+\else
+% now test if d>= rA - rB or rB-rA
+ \ifdim \tkz@rA pt > \tkz@rB pt\relax%
+ \edef\tkz@rD{\fpeval{\tkz@rA-\tkz@rB}}
+ \else
+ \edef\tkz@rD{\fpeval{\tkz@rB-\tkz@rA}}
+ \fi
+\ifdim \tkz@rD pt > \tkz@mathLen pt\relax%
+ \global\tkzFlagCCfalse
+\else
+\global\tkzFlagCCtrue
+\fi
+\fi
+\endgroup
+}
+
+\def\tkz@numcc{0}
+\pgfkeys{
+/circlecircle/.cd,
+ node/.code = \def\tkz@numcc{0},
+ R/.code = \def\tkz@numcc{1},
+ with nodes/.code = \def\tkz@numcc{2},
+ common/.store in = \tkz@common,
+ common = {},
+ node
+}
+%<--------------------------------------------------------------------------–>
+\def\tkzInterCC{\pgfutil@ifnextchar[{\tkz@InterCC}{\tkz@InterCC[]}}
+\def\tkz@InterCC[#1](#2,#3)(#4,#5){%
+\begingroup
+\pgfqkeys{/circlecircle}{#1}
+\ifcase\tkz@numcc%
+ % first case 0
+ \tkz@save@length
+ \tkz@@CalcLengthcm(#2,#3){tkz@rayA}
+ \tkz@@CalcLengthcm(#4,#5){tkz@rayB}
+ \tkz@restore@length
+\tkzInterCCR(#2,\tkz@rayA)(#4,\tkz@rayB){tkzFirstPointResult}{tkzSecondPointResult}
+ \or% 1
+ \tkzInterCCR(#2,#3)(#4,#5){tkzFirstPointResult}{tkzSecondPointResult}%
+ \or%2
+ \tkzInterCCWithNodes(#2,#3)(#4,#5){tkzFirstPointResult}{tkzSecondPointResult}
+\fi
+ \ifx\tkz@common\tkzutil@empty
+ \tkzFindAngle(#2,tkzFirstPointResult,#4) \tkzGetAngle{tkz@an}
+ \ifdim\tkz@an pt<180 pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+ \else
+\tkz@@CalcLength(\tkz@common,tkzSecondPointResult){tkz@mathLen}
+ \ifdim\tkz@mathLen pt<0.05pt\relax%
+ \else
+ \pgfnodealias{tkzPointTmp}{tkzSecondPointResult}
+ \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult}
+ \pgfnodealias{tkzFirstPointResult}{tkzPointTmp}
+ \fi
+ \fi
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+
+\def\tkzInterCCR(#1,#2)(#3,#4)#5#6{%
+\begingroup
+\pgfinterruptboundingbox
+\tkz@save@length
+\tkz@@CalcLength(#1,#3){tkz@dd}
+\tkz@restore@length
+\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}}
+\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}}
+\tkz@ax\pgf@x %
+\tkz@ay\pgf@y %
+\edef\tkzcax{\strip@pt\tkz@ax}%
+\edef\tkzcay{\strip@pt\tkz@ay}%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#3}{center}}
+\pgfextracty{\pgf@y}{\pgfpointanchor{#3}{center}}
+\tkz@bx\pgf@x %
+\tkz@by\pgf@y %
+\edef\tkzcbx{\strip@pt\tkz@bx}%
+\edef\tkzcby{\strip@pt\tkz@by}%
+\tkz@cx#2cm %
+\tkz@cy#4cm %
+\edef\tkzccx{\strip@pt\tkz@cx}%
+\edef\tkzccy{\strip@pt\tkz@cy}%
+\edef\tkz@aa{\tkz@Dec{((\tkzccx+\tkzccy)/(2*\tkz@dd))*(\tkzccx-(\tkzccy))+\tkz@dd/2}}
+\edef\tkz@xx{\tkz@Dec{\tkzcax+\tkz@aa/\tkz@dd*(\tkzcbx - (\tkzcax))}}
+\edef\tkz@yy{\tkz@Dec{\tkzcay+\tkz@aa/\tkz@dd*(\tkzcby - (\tkzcay))}}
+\path[coordinate](\tkz@xx pt,\tkz@yy pt) coordinate (tkzRadialCenter);
+\edef\tkz@hh{\tkz@Abs{(\tkzccx+\tkz@aa)*(\tkzccx-(\tkz@aa))}}
+\edef\tkz@hh{\tkz@Dec{\tkz@Sqrt{\tkz@hh}}}
+ \edef\tkz@rx{\tkz@Dec{\tkz@hh / \tkz@dd * (\tkzcay - (\tkzcby))}}
+\edef\tkz@ry{\tkz@Dec{\tkz@hh / \tkz@dd * (\tkzcbx - (\tkzcax))}}
+\edef\tkz@xs{\tkz@Dec{\tkz@xx + \tkz@rx}}
+\edef\tkz@ys{\tkz@Dec{\tkz@yy + \tkz@ry}}
+\path[coordinate](\tkz@xs pt,\tkz@ys pt) coordinate (#5);
+\edef\tkz@xss{\tkz@Dec{\tkz@xx - \tkz@rx}}
+\edef\tkz@yss{\tkz@Dec{\tkz@yy - \tkz@ry}}
+\path[coordinate](\tkz@xss pt,\tkz@yss pt) coordinate (#6);
+\endpgfinterruptboundingbox
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% #2 node #3 node #4 node #5 node
+% \def\tkzInterCC(#1,#2)(#3,#4)#5#6{%
+% \begingroup
+% \tkz@@CalcLength(#1,#2){tkz@rayA}
+% \tkz@@CalcLength(#3,#4){tkz@rayB}
+% \tkzInterCCR(#1,\tkz@rayA pt)(#3,\tkz@rayB pt){#5}{#6}
+% \endgroup
+% }
+%<--------------------------------------------------------------------------–>
+% Intersection de deux cercles Avec deux points
+%<--------------------------------------------------------------------------–>
+% la première variante devrait être #2 #3 avec #4 #5
+\def\tkzInterCCWithNodes(#1,#2,#3)(#4,#5,#6)#7#8{%
+\begingroup
+ \tkz@@CalcLengthcm(#2,#3){tkz@rayA}
+ \tkz@@CalcLengthcm(#5,#6){tkz@rayB}
+ \tkzInterCCR(#1,\tkz@rayA)(#4,\tkz@rayB){#7}{#8}
+\endgroup
+}
+\makeatother
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-math.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-math.tex
new file mode 100644
index 0000000000..1a0491d599
--- /dev/null
+++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-lua-math.tex
@@ -0,0 +1,417 @@
+% tkz-tools-lua-math.tex
+% 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
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% This work has the LPPL maintenance status “maintained”.
+% The Current Maintainer of this work is Alain Matthes.
+
+\def\fileversion{5.00c}
+\def\filedate{2023/01/23}
+\typeout{2023/01/23 5.00c tkz-tools-lua-math.tex}
+\makeatletter
+%<-------------------------------------------------------------------------->
+%<-------------------------------------------------------------------------->
+% Lengths
+%<-------------------------------------------------------------------------->
+%<-------------------------------------------------------------------------->
+\begin{luacode*}
+complex = {} -- global complex numbers registry
+M = {} -- the module
+local mt = {} --metatable for complex numbers
+setmetatable(_ENV, {__index = complex})
+ function new (r, i)
+ local cp = {}
+ cp = {r=r, i=i}
+ return setmetatable(cp,mt)
+ end
+ M.new = new -- add 'new' to the module
+ -- create constant 'i'
+ M.i = new(0, 1)
+
+ function M.add (c1, c2)
+ return new(c1.r + c2.r, c1.i + c2.i)
+ end
+
+ function M.sub (c1, c2)
+ return new(c1.r - c2.r, c1.i - c2.i)
+ end
+
+ function M.mul (c1, c2)
+ return new(c1.r*c2.r - c1.i*c2.i, c1.r*c2.i + c1.i*c2.r)
+ end
+
+ function M.inv (c)
+ local n = c.r^2 + c.i^2
+ return new(c.r/n, -c.i/n)
+ end
+
+ function M.div (c1, c2)
+ return M.mul(c1, M.inv(c2))
+ end
+
+ function M.re (c)
+ return new(c.r,0)
+ end
+
+ function M.im (c)
+ return new(c.i,0)
+ end
+
+ function M.mod (c)
+ local n = c.r^2 + c.i^2
+ return new(n,0)
+ end
+
+ function M.prinarg(c)
+ local arg
+ if c.r > 0 then
+ arg = math.atan(c.i/c.r)
+ elseif c.r < 0 and c.i >= 0 then
+ arg = math.atan(c.i/c.r) + math.pi
+ elseif c.r < 0 and c.i < 0 then
+ arg = math.atan(c.i/c.r) - math.pi
+ elseif c.r == 0 and c.i > 0 then
+ arg = math.pi / 2
+ elseif c.r == 0 and c.i < 0 then
+ arg = - math.pi / 2
+ else
+ error("Principal argument not defined.")
+ end
+ return arg
+ end
+
+ function M.op (...)
+ return ...
+ end
+
+ function M.tostring (c)
+ if c.i ==0 then
+ return string.format("%g", c.r)
+ elseif c.i> 0 and c.i==1 then
+ return string.format("%g+i", c.r)
+ elseif c.i> 0 and c.i~=1 then
+ return string.format("%g+%gi", c.r, c.i)
+ else
+ return string.format("%g%gi", c.r, c.i) --to avoid +-
+ end
+ end
+
+ --Setting Metatable operations.
+ mt.__add = M.add
+ mt.__mul = M.mul
+ mt.__sub = M.sub
+ mt.__tostring = M.tostring
+\end{luacode*}
+
+
+
+\begin{luacode*}
+ function normalize(angleA,angleB)
+ if angleA > 0 then
+ if angleA > angleB then
+ angleA = angleA - 360
+ end
+ else
+ if angleA > angleB then
+ angleB = angleB + 360
+ end
+ end
+ return angleA, angleB
+ end
+
+ function math.angle(x1, y1, x2, y2)
+ local a = math.deg(math.atan(y2 - y1, x2 - x1))
+ if a < 0 then
+ return a + 360
+ else
+ return a
+ end
+ end
+
+ function tkzop(...)
+ inf = math.huge
+ return ...
+end
+
+function tkzround(nb, ND)
+ local p = 10^(ND or 0)
+ return math.floor(nb * p + 0.5) / p
+end
+\end{luacode*}
+
+\newcommand\cpxNew[2]{%
+\directlua{complex[\luastringN{#1}] = M.new(#2)}}
+\newcommand\cpxPrint[1]{%
+\directlua{tex.sprint(tostring(complex[\luastringN{#1}]))}}
+\newcommand\cpxAdd[3]{%
+\directlua{complex[\luastringN{#1}]%
+ =M.add(complex[\luastringN{#2}],complex[\luastringN{#3}])}}
+
+
+\def\tkz@Dec#1{%
+ \directlua{tex.print(string.format('\@percentchar.6f',#1))}
+ }
+\def\tkz@Op#1{\directlua{tex.sprint(tostring(tkzop(#1)))}}
+\def\tkz@Log#1{\directlua{tex.sprint(math.log(#1))}}
+\def\tkz@Exp#1{\directlua{tex.sprint(math.exp(#1))}}
+\def\tkz@Sqrt#1{\directlua{tex.sprint(math.sqrt(#1))}}
+\def\tkz@Abs#1{\directlua{tex.sprint(math.abs(#1))}}
+\def\tkz@Pi{\directlua{tex.sprint(math.pi)}}
+\def\tkz@Cos#1{\directlua{tex.sprint(math.cos(#1))}}
+\def\tkz@Sin#1{\directlua{tex.sprint(tostring(math.sin(#1)))}}
+\def\tkz@Tan#1{\directlua{tex.sprint(math.tan(#1))}}
+\def\tkz@Rad#1{\directlua{tex.sprint(math.rad(#1))}}
+\def\tkz@Acos#1{\directlua{tex.sprint(math.acos(#1))}}
+\def\tkz@Asin#1{\directlua{tex.sprint(math.asin(#1))}}
+\def\tkz@Atan#1{\directlua{tex.sprint(math.atan(#1))}}
+\def\tkz@Round#1#2{\directlua{tex.sprint(tostring(tkzround(#1,#2)))}}
+\def\tkz@Angle#1#2#3#4{\directlua{tex.sprint(math.angle(#1,#2,#3,#4))}}
+\def\tkz@Ceil#1{\directlua{tex.sprint(math.ceil(#1))}}
+\def\tkz@Floor#1{\directlua{tex.sprint(math.floor(#1))}}
+\def\tkz@Huge{\directlua{tex.sprint(math.huge)}}
+\def\tkz@Max#1{\directlua{tex.sprint(math.max(#1))}}
+\def\tkz@Min#1{\directlua{tex.sprint(math.min(#1))}}
+\def\tkz@Random#1{\directlua{tex.sprint(math.random(#1))}}
+\def\tkz@veclen#1#2{%
+ \directlua{%
+ tex.print(string.format('\@percentchar.6f',math.sqrt((#1)^2+(#2)^2)))%
+ }%
+}
+\let\tkzSqrt\tkz@Sqrt
+\let\tkzPi\tkz@Pi
+\let\tkzExp\tkz@Exp
+\let\tkzLog\tkz@Log
+\let\tkzSin\tkz@Sin
+\let\tkzCos\tkz@Cos
+% \tkzpointnormalised#
+% tkzCalcLength
+% \tkzGetLength
+% \tkzpttocm
+% \tkzcmtopt
+% \tkzFindSlope
+% option xfp
+
+% \tkzpointnormalised normalise un point A-->A' tq ||v(OA')=1||
+% équivalent de \pgfpointnormalised avec fp
+% example
+% \tkzpointnormalised{%
+% \pgfpointdiff{\pgfpointanchor{A}{center}}
+% {\pgfpointanchor{B}{center}}}
+
+% or
+% \pgf@x=1 cm
+% \pgf@y=12 cm
+% \tkzpointnormalised{}
+%<--------------------------------------------------------------------------
+\def\tkzpointnormalised#1{%
+\pgf@process{#1}%
+\pgf@xa=\pgf@x%
+\pgf@ya=\pgf@y%
+\edef\tkz@temp@xa{\strip@pt\pgf@xa}%
+\edef\tkz@temp@ya{\strip@pt\pgf@ya}%
+\edef\tkz@den{\tkz@veclen{\tkz@temp@xa}{\tkz@temp@ya}}
+\edef\tkz@coordx{\tkz@Op{\tkz@temp@xa/\tkz@den}}
+\edef\tkz@coordx{\tkz@Dec{\tkz@Round{\tkz@coordx}{5}}}
+\edef\tkz@coordy{\tkz@Op{\tkz@temp@ya/\tkz@den}}
+\edef\tkz@coordy{\tkz@Dec{\tkz@Round{\tkz@coordy}{5}}}
+\pgf@x = \tkz@coordx pt
+\pgf@y = \tkz@coordy pt
+}
+%\def\tkz@Dec#1{\directlua{tex.print(string.format('\@percentchar.12f',#1))}}
+%<-------------------------------------------------------------------------->
+% restaure and save length
+\def\tkz@save@length{\global\let\tkz@temp@length\tkzLengthResult}%
+\def\tkz@restore@length{\global\let\tkzLengthResult\tkz@temp@length }%
+%<-------------------------------------------------------------------------->
+% \tkzCalcLength Distance entre deux points en pt ou en cm avec xfp
+% \veclen mais avec fp
+% option cm le résultat est en cm sinon en pt with cm=false
+%<-------------------------------------------------------------------------->
+\pgfkeys{tkzcalclen/.cd,
+ cm/.is if = tkzLengthIncm,
+ cm/.default = true,
+ cm = true}
+
+\def\tkzCalcLength{\pgfutil@ifnextchar[{\tkz@CalcLength}{\tkz@CalcLength[]}}
+\def\tkz@CalcLength[#1](#2,#3){%
+\pgfqkeys{/tkzcalclen}{#1}%
+\begingroup
+\tkz@@CalcLength(#2,#3){tkzLengthResult}
+\iftkzLengthIncm
+ \edef\tkz@xfpMathLen{\tkz@Dec{\tkz@Round{\tkzLengthResult/28.45274}{6}}}
+ \global\let\tkzLengthResult\tkz@xfpMathLen
+\fi
+\endgroup
+}%
+
+\def\tkz@@CalcLength(#1,#2)#3{%
+\pgfpointdiff{\pgfpointanchor{#1}{center}}%
+ {\pgfpointanchor{#2}{center}}%
+\edef\tkz@xa{\strip@pt\pgf@x}%
+\edef\tkz@ya{\strip@pt\pgf@y}%
+\edef\tkz@xfpMathLen{\tkz@veclen{\tkz@xa}{\tkz@ya}}
+\global\expandafter\edef\csname #3\endcsname{\tkz@xfpMathLen}
+}
+
+\def\tkz@@CalcLengthcm(#1,#2)#3{%
+\pgfpointdiff{\pgfpointanchor{#1}{center}}%
+ {\pgfpointanchor{#2}{center}}%
+\edef\tkz@xa{\strip@pt\pgf@x}%
+\edef\tkz@ya{\strip@pt\pgf@y}%
+\edef\tkz@xfpMathLen{\tkz@veclen{\tkz@xa}{\tkz@ya}}
+\edef\tkz@xfpMathLen{\tkz@Dec{\tkz@Round{\tkz@xfpMathLen/28.45274}{6}}}
+\global\expandafter\edef\csname #3\endcsname{\tkz@xfpMathLen}
+}
+\def\tkz@@CalcLengthb(#1,#2)#3{%
+\pgfpointdiff{\pgfpointanchor{#1}{center}}%
+ {\pgfpointanchor{#2}{center}}%
+\edef\tkz@xfpMathLen{\fpeval{sqrt((\pgf@x)^2+(\pgf@y)^2)}}
+\edef\tkz@xfpMathLen{\fpeval{round(\tkz@xfpMathLen,6)}}
+\global\expandafter\edef\csname #3\endcsname{\tkz@xfpMathLen}
+}
+%<-------------------------------------------------------------------------->
+\def\tkzGetLength#1{%
+\global\expandafter\edef\csname #1\endcsname{\tkzLengthResult}}
+%<-------------------------------------------------------------------------->
+% \tkzpttocm passage de pt   cm div par 28.45274
+%<-------------------------------------------------------------------------->
+\def\tkzpttocm(#1)#2{%
+\begingroup
+ \edef\tkz@mathresult{\tkz@Round{#1/28.45274}{6}}
+ \global\expandafter\edef\csname #2\endcsname{\tkz@mathresult}%
+\endgroup
+}%
+%<-------------------------------------------------------------------------->
+% \tkzcmtopt passage de cm   pt mul par 28.45274
+%<--------------------------------------------------------------------------
+\def\tkzcmtopt(#1)#2{%
+\begingroup
+ \edef\tkz@mathresult{\tkz@Round{#1*28.45274}{6}}
+ \global\expandafter\edef\csname #2\endcsname{\tkz@mathresult}%
+\endgroup
+}%
+%<---------------------------------------------------------–>
+ \def\tkzGetResult#1{%
+ \global\expandafter\edef\csname #1\endcsname{\tkzMathResult}}
+%<---------------------------------------------------------–>
+% Schrodinger's cat idea 03/01/20
+\tikzset{veclen/.code={%
+\pgfmathdeclarefunction*{veclen}{2}{%
+\begingroup%
+ \pgfmath@x##1pt\relax%
+ \pgfmath@y##2pt\relax%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \edef\tkz@temp@xa{\strip@pt\pgf@xa}%
+ \edef\tkz@temp@ya{\strip@pt\pgf@ya}%
+ \edef\tkz@xfpMathLen{\tkz@veclen{\tkz@temp@xa}{\tkz@temp@ya}}%
+ \pgfmath@returnone\tkz@xfpMathLen pt%
+\endgroup%
+}}}%
+%<---------------------------------------------------------–>
+\def\tkzSwapPoints(#1,#2){
+ \pgfnodealias{tkzPointTmp}{#2}
+ \pgfnodealias{#2}{#1}
+ \pgfnodealias{#1}{tkzPointTmp}}
+%<---------------------------------------------------------–>
+\def\tkzPermute(#1,#2,#3){
+ \tkzURotateWithNodes(#1,#3,#2)(#3) \tkzGetPoint{tkzpt}
+ \tkzURotateWithNodes(#1,#2,#3)(#2) \tkzGetPoint{#2}
+ \tkzSwapPoints(tkzpt,#3)
+}
+%<---------------------------------------------------------–>
+\def\tkzDotProduct(#1,#2,#3){%
+\begingroup
+\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}}%
+\edef\tkzax{\strip@pt\pgf@x}%
+\edef\tkzay{\strip@pt\pgf@y}%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#2}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#2}{center}}%
+\edef\tkzbx{\strip@pt\pgf@x}%
+\edef\tkzby{\strip@pt\pgf@y}%
+\pgfextractx{\pgf@x}{\pgfpointanchor{#3}{center}}%
+\pgfextracty{\pgf@y}{\pgfpointanchor{#3}{center}}%
+\edef\tkzcx{\strip@pt\pgf@x}%
+\edef\tkzcy{\strip@pt\pgf@y}%
+\edef\tkz@tmp{\tkz@Dec{\tkz@Round{((\tkzbx-(\tkzax))*(\tkzcx-(\tkzax))+(\tkzby-(\tkzay))*(\tkzcy-(\tkzay)))/809.55841}{6}}}
+\global\let\tkzMathResult\tkz@tmp
+\endgroup
+}
+
+% #1,#2 and #3 aligned
+\def\tkzIsLinear(#1,#2,#3){%
+\begingroup
+\tkz@@CalcLengthcm(#1,#2){tkz@la}
+\tkz@@CalcLengthcm(#1,#3){tkz@lb}
+\tkzDotProduct(#1,#2,#3)
+\edef\tkzResult{\tkz@Dec{\tkz@Abs{\tkzMathResult}-(\tkz@la)*(\tkz@lb)}}
+\ifdim \tkzResult pt < 0.01 pt\relax%
+\global\tkzLineartrue
+\else
+\global\tkzLinearfalse
+\fi
+\endgroup
+}
+%<---------------------------------------------------------–>
+% syntax : vec(#2,#1) ortho vec(#3,#1)
+\def\tkzIsOrtho(#1,#2,#3){%
+\begingroup
+\tkzDotProduct(#1,#2,#3)
+\edef\tkzResult{\tkz@Dec{\tkz@Abs{\tkzMathResult}}}
+\ifdim \tkzResult pt < 1 pt\relax%
+\global\tkzOrthotrue
+\else
+\global\tkzOrthofalse
+\fi
+\endgroup
+}
+%<---------------------------------------------------------–>
+% \tkzPowerCircle(M)(O,A) --> OM^2-OA^2
+\def\tkzPowerCircle(#1)(#2,#3){%
+\begingroup
+\tkz@@CalcLengthcm(#2,#3){tkz@ra}
+\tkz@@CalcLengthcm(#1,#2){tkz@om}
+\gdef\tkzMathResult{\tkz@Dec{(\tkz@om)^2-(\tkz@ra)^2}}
+\endgroup
+}
+%<---------------------------------------------------------–>
+\def\tkzDefRadicalAxis(#1,#2)(#3,#4){%
+\begingroup
+\tkz@@CalcLengthcm(#1,#3){tkz@d}
+\tkz@@CalcLengthcm(#1,#2){tkz@ra}
+\tkz@@CalcLengthcm(#3,#4){tkz@rb}
+\edef\tkzMathResult{\tkz@Dec{\tkz@d-(\tkz@ra+\tkz@rb)}}
+\edef\tkzMathResultb{\tkz@Dec{\tkz@Abs{(\tkz@d-(\tkz@ra+\tkz@rb))}}}
+\edef\tkzMathResultc{\tkz@Dec{\tkz@Abs{\tkz@d-\tkz@Abs{(\tkz@ra-(\tkz@rb))}}}}
+\ifdim \tkzMathResultc pt < 0.1 pt\relax%
+ \tkzURotateAngle(#2,90)(#3) \tkzGetPoint{tkzFirstPointResult}
+ \tkzURotateAngle(#2,-90)(#3) \tkzGetPoint{tkzSecondPointResult}
+\else
+\ifdim \tkzMathResultb pt < 0.1 pt\relax%
+ \tkzURotateAngle(#2,90)(#3) \tkzGetPoint{tkzFirstPointResult}
+ \tkzURotateAngle(#2,-90)(#3) \tkzGetPoint{tkzSecondPointResult}
+ \else
+\ifdim \tkzMathResult pt > 1 pt\relax%
+ \tkzURotateAngle(#1,60)(#3) \tkzGetPoint{tkz@aux}
+ \tkzInterCC(#1,#2)(tkz@aux,#1) \tkzGetPoints{tkz@pta}{tkz@ptb}
+ \tkzInterCC(#3,#4)(tkz@aux,#1) \tkzGetPoints{tkz@ptc}{tkz@ptd}
+ \tkzInterLL(tkz@pta,tkz@ptb)(tkz@ptc,tkz@ptd) \tkzGetPoint{tkz@pta}
+ \tkzUProjection(#1,#3)(tkz@pta) \tkzGetPoint{tkz@ptb}
+ \pgfnodealias{tkzSecondPointResult}{tkz@ptb}
+ \pgfnodealias{tkzFirstPointResult}{tkz@pta}
+\else
+\tkzInterCCR(#1,\tkz@ra)(#3,\tkz@rb){tkzFirstPointResult}{tkzSecondPointResult}
+\fi
+\fi
+\fi
+\endgroup
+}
+
+\makeatother
+\endinput \ No newline at end of file