diff options
author | Norbert Preining <norbert@preining.info> | 2023-01-24 03:02:57 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-01-24 03:02:57 +0000 |
commit | b06c6695162b493aeec3b594c6beb518c15c98ba (patch) | |
tree | 0c1dc3cfc73ea789d6bdc4673d776f3ef652d6d8 /macros/latex/contrib/tkz/tkz-euclide/latex/obj | |
parent | 4451a2090261307c963209bc65fea9fde4eceeea (diff) |
CTAN sync 202301240302
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-euclide/latex/obj')
11 files changed, 2617 insertions, 0 deletions
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex new file mode 100644 index 0000000000..3d2fedacc2 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex @@ -0,0 +1,171 @@ +% tkz-obj-eu-axesmin.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-obj-eu-axesmin} + +\makeatletter +\def\removedot#1.{#1} +\newcommand\tkzgetinteger[1]{\expandafter\tkz@getinteger#1.\@nil} +\def\tkz@getinteger#1.#2\@nil{% + \ifx\empty#2\empty + \tkz@integertrue + \else + \ifnum\removedot#2=0 + \tkz@integertrue + \else + \tkz@integerfalse + \fi + \fi +} + +%<--------------------------------------------------------------------------–> +% Setup axe +%<--------------------------------------------------------------------------–> +\pgfkeys{tkzaxis/.cd, + line width/.code = \xdef\tkz@sua@lw{#1}, + color/.code = \xdef\tkz@sua@color{#1}, + tickwd/.code = \xdef\tkz@sua@tickwd{#1}, + ticka/.code = \xdef\tkz@sua@ticka{#1}, + tickb/.code = \xdef\tkz@sua@tickb{#1}, + line width = \tkz@init@lw, + color = \tkz@init@color, + tickwd = \tkz@init@tickwd, + ticka = \tkz@init@ticka, + tickb = \tkz@init@tickb +} + +\def\tkzSetUpAxis{\pgfutil@ifnextchar[{\tkz@SetUpAxis}{\tkz@SetUpAxis[]}} +\def\tkz@SetUpAxis[#1]{% +\begingroup +\pgfqkeys{/tkzaxis}{#1} +\global\let\tkz@init@lw\tkz@sua@lw +\global\let\tkz@init@gradsize\tkz@sua@gradsize +\global\let\tkz@init@color\tkz@sua@color +\global\let\tkz@init@tickwd\tkz@sua@tickwd +\global\let\tkz@init@ticka\tkz@sua@ticka +\global\let\tkz@init@tickb\tkz@sua@tickb +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzDrawX todo améliorer les unités +% sans doute à revoir loop from 0 to i then calcul dans la boucle de la position +% et de l'affichage +%<--------------------------------------------------------------------------–> +\pgfkeys{% + /tkzdrawX/.cd, + color/.store in = \tkz@X@color, + label/.store in = \tkz@X@label, + right space/.store in = \tkz@axe@rxspace, + left space/.store in = \tkz@axe@lxspace, + step/.code = {\edef\tkz@posnext{\fpeval{#1}}}, + color = \tkz@init@color, + label = \tkz@init@xlabel, + step = \tkz@init@xstep, + right space = \tkz@init@rightspace, %??? + left space = \tkz@init@leftspace, + noticks/.is if = tkz@X@noticks, + noticks/.default = true, + noticks = true, + tickwd/.store in = \tkz@X@tickwd, + tickup/.store in = \tkz@X@tickup, + tickdn/.store in = \tkz@X@tickdn, + tickwd = \tkz@init@tickwd, + tickup = \tkz@init@ticka, + tickdn = \tkz@init@tickb, + /tkzdrawX/.search also={/tikz}, + } + +\def\tkzDrawX{\pgfutil@ifnextchar[{\tkz@DrawX}{\tkz@DrawX[]}} +\def\tkz@DrawX[#1]{ +\begingroup% +\pgfqkeys{/tkzdrawX}{#1} +\edef\tkz@posmax{\fpeval{trunc(\tkz@xb,\tkz@init@xdec)}} +\edef\tkz@posmin{\fpeval{trunc(\tkz@xa,\tkz@init@xdec)}} +\edef\tkz@xbsup{\fpeval{\tkz@xb+\tkz@axe@rxspace}} +\edef\tkz@xainf{\fpeval{\tkz@xa-\tkz@axe@lxspace}} +\path (\tkz@xainf,0)--(\tkz@xbsup,0) node(tkz@xline){}; +\draw[xaxe style, + color = \tkz@X@color, + /tkzdrawX/.cd, #1] (\tkz@xainf,0)--(\tkz@xbsup,0) + node[ xlabel style, + /tkzdrawX/.cd, + #1]{\tkz@X@label}; + \iftkz@X@noticks + \else + \edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@xdec)}} + \edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@xstep+\tkz@posmin}} + \foreach \pos in {\tkz@posmin,...,\tkz@posmax}{% + \edef\tkz@pos{\fpeval{\pos*1}}% ??? + \draw[ color = \tkz@X@color, + line width = \tkz@X@tickwd, + shift = {(\tkz@pos,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn); + } + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzDrawY todo améliorer les unités +%<--------------------------------------------------------------------------–> +\pgfkeys{% + /tkzdrawY/.cd, + color/.store in = \tkz@Y@color, + label/.store in = \tkz@Y@label, + up space/.store in = \tkz@axe@uyspace, + down space/.store in = \tkz@axe@dyspace, + step/.code = {\edef\tkz@posnext{\fpeval{#1}}}, + color = \tkz@init@color, + label = \tkz@init@ylabel, + step = \tkz@init@ystep, + up space = \tkz@init@upspace, + down space = \tkz@init@downspace, + noticks/.is if = tkz@Y@noticks, + noticks/.default = true, + noticks = true, + tickwd/.store in = \tkz@Y@tickwd, + ticklt/.store in = \tkz@Y@ticklt, + tickrt/.store in = \tkz@Y@tickrt, + tickwd = \tkz@init@tickwd, + ticklt = \tkz@init@tickb, + tickrt = \tkz@init@ticka, + /tkzdrawY/.search also={/tikz}, + } + +\def\tkzDrawY{\pgfutil@ifnextchar[{\tkz@DrawY}{\tkz@DrawY[]}} +\def\tkz@DrawY[#1]{% +\begingroup +\pgfkeys{/tkzdrawY/.cd,step = \tkz@init@ystep} +\pgfqkeys{/tkzdrawY}{#1} +\edef\tkz@posmax{\fpeval{trunc(\tkz@yb,\tkz@init@ydec)}} +\edef\tkz@posmin{\fpeval{trunc(\tkz@ya,\tkz@init@ydec)}} +\edef\tkz@ybsup{\fpeval{\tkz@yb+\tkz@axe@uyspace}} +\edef\tkz@yainf{\fpeval{\tkz@ya-\tkz@axe@dyspace}} +\path (0,\tkz@yainf)--(0,\tkz@ybsup) node(tkz@yline){}; +\draw[color = \tkz@Y@color, + yaxe style,/tkzdrawY/.cd,#1] (0,\tkz@yainf)--(0,\tkz@ybsup) + node[ylabel style,/tkzdrawY/.cd,#1]{\tkz@Y@label}; + \iftkz@Y@noticks + \else + \edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@ydec)}} + \edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@ystep+\tkz@posmin}} + \foreach \tkz@pos in {\tkz@posmin,\tkz@posnext,...,\tkz@posmax}{% + \draw[color = \tkz@Y@color, + line width = \tkz@Y@tickwd, + shift = {(0,\tkz@pos)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);} + + \fi +\endgroup} +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex new file mode 100644 index 0000000000..b4f7f8ebaf --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex @@ -0,0 +1,157 @@ +% tkz-obj-eu-circles.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-obj-eu-circles.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% tkzCircle center and one point +%<--------------------------------------------------------------------------–> +% attention radius circle is defined by center and a point on the circle +% R defined by center and the value of the radius +% no need to define a circle with R tikz uses this method. +% through instead of radius +\def\tkz@numcby{0} +\pgfkeys{/tkzDefCircleBy/.cd, + translation/.code args = {from #1 to #2} { \def\tkz@numcby{0} + \def\tkzfrom{#1} + \def\tkzto{#2}}, + homothety/.code args = {center #1 ratio #2}{ \def\tkz@numcby{1} + \def\tkzcenter{#1} + \def\tkzratio{#2}}, + reflection/.code args = {over #1--#2}{ \def\tkz@numcby{2} + \def\tkzdeb{#1} + \def\tkzfin{#2}}, + symmetry/.code args = {center #1}{ \def\tkz@numcby{3} + \def\tkzcenter{#1}}, + rotation/.code args = {center #1 angle #2}{ \def\tkz@numcby{4} + \def\tkzcenter{#1} + \def\tkzangle{#2}}, + inversion/.code args={center #1 through #2}{ \def\tkz@numcby{5} + \def\tkzcenter{#1} + \def\tkzpoint{#2}}, + inversion negative/.code args = {center #1 through #2}{\def\tkz@numcby{6} + \def\tkzcenter{#1} + \def\tkzpoint{#2}} + } +\def\tkzDefCircleBy{\pgfutil@ifnextchar[{\tkz@DefCircleBy}{\tkz@DefCircleBy[]}} +\def\tkz@DefCircleBy[#1](#2){% +\begingroup +\pgfqkeys{/tkzDefCircleBy}{#1} +\ifcase\tkz@numcby% + \tkzDefCircleTranslation(#2)% + \or% 1 + \tkzDefCircleHomothety(#2) + \or% 2 + \tkzDefCircleReflection(#2) + \or% 3 + \tkzDefCircleSymmetry(#2) + \or% 4 + \tkzDefCircleRotation(#2) + \or% 5 + \tkzDefInversionCircle(#2,\tkzcenter,\tkzpoint) + \or% 6 + \tkzDefInversionNegativeCircle(#2,\tkzcenter,\tkzpoint) +\fi +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleTranslation(#1,#2){% +\begingroup + \tkzUTranslation(\tkzfrom,\tkzto)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUTranslation(\tkzfrom,\tkzto)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleHomothety(#1,#2){% +\begingroup + \tkzUHomo(\tkzcenter,\tkzratio)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUHomo(\tkzcenter,\tkzratio)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleReflection(#1,#2){% +\begingroup + \tkzUSymOrth(\tkzdeb,\tkzfin)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUSymOrth(\tkzdeb,\tkzfin)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleSymmetry(#1,#2){% +\begingroup + \tkzUCSym(\tkzcenter)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUCSym(\tkzcenter)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleRotation(#1,#2){% +\begingroup + \tkzURotateAngle(\tkzcenter,\tkzangle)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzURotateAngle(\tkzcenter,\tkzangle)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +% #3,#4 cercle d'inversion centre #3. through #4 +% Si le cercle passe par le pôle l'image est une droite +\def\tkzDefInversionCircle(#1,#2,#3,#4){% +\begingroup + \tkz@@CalcLengthcm(#1,#2){tkz@lna}% + \tkz@@CalcLengthcm(#1,#3){tkz@lnb}% + \gdef\tkzMathResult{\fpeval{round(abs(\tkz@lnb - \tkz@lna),6)}} + \ifdim\tkzMathResult pt < 1 pt\relax% + \tkzURotateAngle(#1,-90)(#2) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzUInversePoint(#3,#4)(tkz@a) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUInversePoint(#3,#4)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \else + \tkzURotateAngle(#1,90)(#2) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzURotateAngle(#1,-90)(#2) + \pgfnodealias{tkz@b}{tkzPointResult} + \tkzUInversePoint(#3,#4)(tkz@a) + \pgfnodealias{tkz@p1}{tkzPointResult} + \tkzUInversePoint(#3,#4)(tkz@b) + \pgfnodealias{tkz@p2}{tkzPointResult} + \tkzUInversePoint(#3,#4)(#2) + \pgfnodealias{tkz@p3}{tkzPointResult} + \tkzDefCircle[circum](tkz@p3,tkz@p1,tkz@p2) + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefInversionNegativeCircle(#1,#2,#3,#4){% +\begingroup + \tkzDefInversionCircle(#1,#2,#3,#4) + \tkzUCSym(\tkzcenter)(tkzFirstPointResult) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUCSym(\tkzcenter)(tkzSecondPointResult) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +% End Def Circle +%<--------------------------------------------------------------------------–> +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex new file mode 100644 index 0000000000..4428f407f5 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex @@ -0,0 +1,223 @@ +% tkz-obj-eu-circles.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-obj-eu-circles.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% tkzCircle center and one point +%<--------------------------------------------------------------------------–> +% attention radius circle is defined by center and a point on the circle +% R defined by center and the value of the radius +% no need to define a circle with R tikz uses this method. +% through instead of radius +\def\tkz@numc{0} +\pgfkeys{/tkzcircle/.cd, + R/.code = \def\tkz@numc{0}, + diameter/.code = \def\tkz@numc{1}, + circum/.code = \def\tkz@numc{2}, + in/.code = \def\tkz@numc{3}, + ex/.code = \def\tkz@numc{4}, + euler/.code = \def\tkz@numc{5}, + nine/.code = \def\tkz@numc{5}, + apollonius/.code = \def\tkz@numc{6}, + spieker/.code = \def\tkz@numc{7}, + orthogonal from/.code args = {#1}{\gdef\tkz@numc{8} + \def\tkz@ptfrom{#1}}, + orthogonal through/.code args = {#1 and #2}{\gdef\tkz@numc{9} + \def\tkz@ptone{#1} + \def\tkz@pttwo{#2}}, + K/.code = \def\tkz@koeff{#1}, + K = 1, + circum + } +\def\tkzDefCircle{\pgfutil@ifnextchar[{\tkz@DefCircle}{\tkz@DefCircle[]}} +\def\tkz@DefCircle[#1](#2){% +\begingroup +\pgfqkeys{/tkzcircle}{#1} +\ifcase\tkz@numc% + \tkzDefCircleR(#2) + \or% 1 + \tkzDefCircleD(#2) + \or% 2 + \tkzDefCircumCircle(#2) + \or% 3 + \tkzDefInCircle(#2) + \or% 4 + \tkzDefExCircle(#2) + \or% 5 + \tkzDefEulerCircle(#2) + \or% 6 + \tkzDefApolloniusCircle(#2) + \or% 7 + \tkzDefSpiekerCircle(#2) + \or% 8 + \tkzDefOrthogonalCircle(#2,\tkz@ptfrom) + \or% 9 + \tkzDefOrthoThroughCircle(#2,\tkz@ptone,\tkz@pttwo) + \fi +\endgroup +} +%for compatibility +%<--------------------------------------------------------------------------–> +% R +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleR(#1,#2){% +\begingroup + \edef\tkzLengthResult{\fpeval{round(#2,5)}} + \global\let\tkzLengthResult\tkzLengthResult + \path (#1)--++(\tkzLengthResult,0) coordinate (tkzSecondPointResult); + \tkzRenamePoint(tkzSecondPointResult){tkzPointResult} +\endgroup +} + +%<--------------------------------------------------------------------------–> +% Diameter Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefCircleD(#1,#2){% +\begingroup + \tkzDefMidPoint(#1,#2) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \pgfnodealias{tkzSecondPointResult}{#2} + \tkz@@CalcLengthcm(#1,tkzPointResult){tkzLengthResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Circum Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefCircumCircle(#1,#2,#3){% +\begingroup + \tkzCircumCenter(#1,#2,#3) + \tkzRenamePoint(tkzPointResult){tkzFirstPointResult} + \tkzRenamePoint(#1){tkzSecondPointResult} + \tkz@@CalcLengthcm(#1,tkzPointResult){tkzLengthResult}%3.06 add [cm] +\endgroup +} +%<--------------------------------------------------------------------------–> +% In(scribe) Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefInCircle(#1,#2,#3){% +\begingroup + \tkzInCenter(#1,#2,#3) + \pgfnodealias{tkz@incenter}{tkzPointResult} + \tkzUProjection(#1,#3)(tkz@incenter) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \tkz@@CalcLengthcm(tkzPointResult,tkz@incenter){tkzLengthResult} + \pgfnodealias{tkzPointResult}{tkz@incenter} + \pgfnodealias{tkzFirstPointResult}{tkz@incenter} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Ex(scribe) Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefExCircle(#1,#2,#3){% +\begingroup + \tkzExCenter(#1,#2,#3) + \pgfnodealias{tkz@excenter}{tkzPointResult} + \tkzUProjection(#1,#3)(tkz@excenter) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \tkz@@CalcLengthcm(tkzPointResult,tkz@excenter){tkzLengthResult}% for tkzGetLength + \pgfnodealias{tkzPointResult}{tkz@excenter} + \pgfnodealias{tkzFirstPointResult}{tkz@excenter} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Radius Ex Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefExRadius(#1,#2,#3){% +\begingroup + \tkzExCenter(#1,#2,#3) + \tkzUProjection(#1,#3)(tkzPointResult) +\endgroup +} +%<--------------------------------------------------------------------------–> +% The nine-point circle, also called Euler's circle or the Feuerbach circle +% best way Ma,Mb,Mc circum center 2020 +%<--------------------------------------------------------------------------–> +\def\tkzDefEulerCircle(#1,#2,#3){% +\begingroup + \tkzDefMidPoint(#1,#2) \pgfnodealias{tkz@e1}{tkzPointResult} + \tkzDefMidPoint(#2,#3) \pgfnodealias{tkz@e2}{tkzPointResult} + \tkzDefMidPoint(#1,#3) \pgfnodealias{tkz@e3}{tkzPointResult} + \tkzCircumCenter(tkz@e1,tkz@e2,tkz@e3) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzRenamePoint(tkz@e1){tkzSecondPointResult} + \tkz@@CalcLengthcm(tkzPointResult,tkz@e1){tkzLengthResult} +\endgroup +} +\let\tkzDefNinePointsCircle\tkzEulerCircle% +\let\tkzFeuerBachCircle\tkzEulerCircle% + +\def\tkzDefEulerRadius(#1,#2,#3){% +\begingroup + \tkzEulerCenter(#1,#2,#3) + \pgfnodealias{eur@pta}{tkzPointResult} + \tkzDefMidPoint(#1,#2) + \tkz@@CalcLengthcm(eur@pta,tkzPointResult){tkzLengthResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Apollonius circle +%<--------------------------------------------------------------------------–> +\def\tkzDefApolloniusCircle(#1,#2){% +\begingroup + \tkzDefBarycentricPoint(#1=1,#2=\tkz@koeff) + \pgfnodealias{apo@pta}{tkzPointResult} + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \tkzDefBarycentricPoint(#1=1,#2=-\tkz@koeff) + \pgfnodealias{apo@ptb}{tkzPointResult} + \tkzDefMidPoint(apo@pta,apo@ptb) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkz@@CalcLengthcm(tkzFirstPointResult,apo@pta){tkzLengthResult} + \pgfnodealias{tkzThirdPointResult}{apo@ptb} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefOrthogonalCircle(#1,#2,#3){% +\begingroup + \tkzTgtFromP(#1,#2)(#3) + \tkz@@CalcLengthcm(#1,tkzFirstPointResult){tkzLengthResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefOrthoThroughCircle(#1,#2,#3,#4){% +\begingroup + \tkz@@CalcLengthcm(#1,#3){tkz@lnb}% + \edef\tkz@lnc{\fpeval{1/\tkz@lnb}} + \tkzVecKNorm[\tkz@lnc](#1,#3) + \pgfnodealias{tkz@PointResult}{tkzPointResult} + \tkzCircumCenter(tkz@PointResult,#3,#4) + \tkz@@CalcLengthcm(tkzPointResult,#3){tkzLengthResult} + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \pgfnodealias{tkzSecondPointResult}{#3} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Spieker Circle +%<--------------------------------------------------------------------------–> +\def\tkzDefSpiekerCircle(#1,#2,#3){% +\begingroup + \tkzSpiekerCenter(#1,#2,#3) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzUProjection(tkz@m1,tkz@m2)(tkzPointResult) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \tkz@@CalcLength(tkzSecondPointResult,tkzFirstPointResult){tkzLengthResult} +\endgroup +} +%<--------------------------------------------------------------------------–> + +%<--------------------------------------------------------------------------–> +% End Def Circle +%<--------------------------------------------------------------------------–> +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex new file mode 100644 index 0000000000..c6c1be300d --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex @@ -0,0 +1,83 @@ +% tkz-obj-eu-grids.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-obj-eu-grids.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% Setup Grid +%<--------------------------------------------------------------------------–> +\pgfkeys{/tkzsugrid/.cd, + line width/.store in = \tkz@sug@lw, + color/.store in = \tkz@sug@color, + line width = \tkz@grid@lw, + color = \tkz@grid@color + } + +\def\tkzSetUpGrid{\pgfutil@ifnextchar[{\tkz@SetUpGrid}{\tkz@SetUpGrid[]}} +\def\tkz@SetUpGrid[#1]{% +\begingroup +\pgfqkeys{/tkzsugrid}{#1} +\global\let\tkz@grid@lw\tkz@sug@lw +\global\let\tkz@grid@color\tkz@sug@color +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzGrid +%<--------------------------------------------------------------------------–> +\pgfkeys{/tkzGrid/.cd, + color/.code = {\def\tkz@gd@color{#1}% + \edef\tkz@gd@subcolor{% + \tkz@gd@color!\tkzCoeffSubColor}}, + subxstep/.store in = {\tkz@gd@subxstep}, + subystep/.store in = {\tkz@gd@subystep}, + ratio/.store in = {\tkz@gd@ratio}, + line width/.code = {\edef\tkz@gd@lw{#1} + \edef\tkz@gd@sublw{\tkz@gd@ratio\tkz@gd@lw}}, + sub/.is if = tkz@gd@sub, + sub/.default = true , + sub = false, + color = \tkz@grid@color, + ratio = 0.75, + subxstep = \tkz@grid@xstep, + subystep = \tkz@grid@ystep, + line width = \tkz@grid@lw, + /tkzGrid/.search also= {/tikz}, +} +%<--------------------------------------------------------------------------–> +\def\tkzGrid{\pgfutil@ifnextchar[{\tkz@Grid}{\tkz@Grid[]}} +\def\tkz@Grid[#1]{\@ifnextchar({\tkz@@Grid[#1]}% + {\tkz@@Grid[#1](\tkz@tmp@xa,\tkz@tmp@ya)(\tkz@tmp@xb,\tkz@tmp@yb)}} +\def\tkz@@Grid[#1](#2,#3)(#4,#5){% + \pgfqkeys{/tkzGrid}{#1} + \begingroup + \edef\tkz@gxa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}} + \edef\tkz@gxb{\fpeval{(#4-\tkz@init@xorigine)/\tkz@init@xstep}} + \edef\tkz@gya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}} + \edef\tkz@gyb{\fpeval{(#5-\tkz@init@yorigine)/\tkz@init@ystep}} + \iftkz@gd@sub% + \edef\@subxstep{\fpeval{\tkz@gd@subxstep/\tkz@init@xstep}}% + \edef\@subystep{\fpeval{\tkz@gd@subystep/\tkz@init@ystep}}% + \draw [xstep = \@subxstep cm,% + ystep = \@subystep cm,% + color = \tkz@gd@subcolor,% + line width = \tkzRatioLineGrid]% + (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);% + \fi + \draw [color = \tkz@gd@color,% + line width = \tkz@gd@lw]% + (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);% + \endgroup +}% +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex new file mode 100644 index 0000000000..5d5e2934fe --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex @@ -0,0 +1,293 @@ +% tkz-obj-eu-lines.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-obj-eu-lines.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% les lignes +%<--------------------------------------------------------------------------–> +\def\tkz@numline{0} +\pgfkeys{/tkzdefline/.cd, + mediator/.code = \def\tkz@numline{0}, + perpendicular/.code args = {through #1} {\def\tkz@numline{1}% + \def\tkz@through{#1}}, + orthogonal/.code args = {through #1} {\def\tkz@numline{1}% + \def\tkz@through{#1}}, + parallel/.code args = {through #1}{\def\tkz@numline{2}% + \def\tkz@through{#1}}, + bisector/.code = \def\tkz@numline{3}, + bisector out/.code = \def\tkz@numline{4}, + symmedian/.code = \def\tkz@numline{5}, + altitude/.code = \def\tkz@numline{6}, + euler/.code = \def\tkz@numline{7}, + tangent from/.code = \def\tkz@numline{8} \def\tkz@ptfrom{#1}, + tangent at/.code = \def\tkz@numline{9} \def\tkz@ptat{#1}, + K/.code = \def\tkz@koeff{#1}, + K = 1, + normed/.is if = tkz@line@normed, + normed/.default = true, + normed = false, + mediator +} +\def\tkzDefLine{\pgfutil@ifnextchar[{\tkz@DefLine}{\tkz@DefLine[]}} +\def\tkz@DefLine[#1](#2){% +\begingroup +%\pgfkeys{/tkzdefline/.cd,K=1} +\pgfqkeys{/tkzdefline}{#1} +\ifcase\tkz@numline% + % first case 0 + \tkzDefMediatorLine(#2) + \or% 1 + \tkzDefOrthLine[\tkz@koeff](#2) + \or% 2 + \tkzDefLineLL(#2) + \or% 3 + \tkzDefBisectorLine(#2) + \or% 4 + \tkzDefBisectorOutLine(#2) + \or% 5 + \tkzDefSymmedianLine(#2) + \or% 6 + \tkzDefAltitudeLine(#2) + \or% 7 + \tkzDefEulerLine(#2) + \or% 8 + \tkzTgtFromP(#2)(\tkz@ptfrom) + \or% 9 + \tkzTgtAt(#2)(\tkz@ptat) + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzLineLL revoir out !! +%<--------------------------------------------------------------------------–> +\def\tkzDefLineLL{\pgfutil@ifnextchar[{\tkz@DefLineLL}{% + \tkz@DefLineLL[1]}} +\def\tkz@DefLineLL[#1](#2,#3){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}{\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x\relax%% + \pgf@ya=\pgf@y\relax%% + \pgfinterruptboundingbox + \path[coordinate](\tkz@through)--++(\tkz@koeff\pgf@xa,\tkz@koeff\pgf@ya)% + coordinate (tkzPointResult); + \endpgfinterruptboundingbox + \iftkz@line@normed + \tkzVecKNorm(\tkz@through,tkzPointResult) + \fi +\endgroup}% +%<--------------------------------------------------------------------------–> +% tkzOrthLine +%<--------------------------------------------------------------------------–> +\def\tkzDefOrthLine{\pgfutil@ifnextchar[{\tkz@DefOrthLine}{% + \tkz@DefOrthLine[1]}} +\def\tkz@DefOrthLine[#1](#2,#3){% +\begingroup + \tkzDefPointWith(#2,#3) + \pgfnodealias{tkz@OLtmp}{tkzPointResult} + \tkz@VecKCoLinear[\tkz@koeff](#2,tkz@OLtmp,\tkz@through) + \iftkz@line@normed + \pgfinterruptboundingbox + \tkzVecKNorm(\tkz@through,tkzPointResult) + \endpgfinterruptboundingbox + \fi +\endgroup}% +%<--------------------------------------------------------------------------–> +% tkzMediatorLine +%<--------------------------------------------------------------------------–> +\def\tkzDefMediatorLine{\pgfutil@ifnextchar[{\tkz@DefMediatorLine}{% + \tkz@DefMediatorLine[1]}} + +\def\tkz@DefMediatorLine[#1](#2,#3){% new 2020 +\begingroup + \tkzDefEquilateral(#2,#3) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzDefEquilateral(#3,#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \ifx\tkz@koeff=1 % + \else + \tkzDefMidPoint(#2,#3) + \pgfnodealias{tkz@mid}{tkzPointResult} + \tkz@VecK[\tkz@koeff](tkz@mid,tkzFirstPointResult) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkz@VecK[\tkz@koeff](tkz@mid,tkzSecondPointResult) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + \fi + \iftkz@line@normed + \tkzDefMidPoint(#2,#3) + \pgfnodealias{tkz@mid}{tkzPointResult} + % \pgfinterruptboundingbox + \tkzVecKNorm[\tkz@koeff](tkz@mid,tkzFirstPointResult) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzVecKNorm[\tkz@koeff](tkz@mid,tkzSecondPointResult) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} + % \endpgfinterruptboundingbox + \fi +\endgroup} +% autre possibilité + +%<--------------------------------------------------------------------------–> +% BisectorLine +%<--------------------------------------------------------------------------–> +\def\tkzDefBisectorLine(#1,#2,#3){% +\begingroup + \pgfinterruptboundingbox + \tkzDuplicateSegment(#2,#1)(#2,#3) + \pgfnodealias{bi@tmp}{tkzPointResult} + \tkzDefMidPoint(bi@tmp,#1) +% \tkzDefEquilateral(bi@tmp,#1) + \ifx\tkz@koeff=1 % + \else + \tkzVecK[\tkz@koeff](#2,tkzPointResult) + \fi + \iftkz@line@normed + \tkzVecKNorm[\tkz@koeff](#2,tkzPointResult) + \fi + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% Out BisectorLine +%<--------------------------------------------------------------------------–> +\def\tkzDefBisectorOutLine(#1,#2,#3){% +\begingroup +\pgfinterruptboundingbox + \tkzDuplicateLength(#2,#1)(#2,#3) + \pgfnodealias{out@tmp}{tkzPointResult} + \tkzDefMidPoint(#1,out@tmp) + \pgfnodealias{out@pt1}{tkzPointResult} + \tkzURotateAngle(#2,90)(out@pt1) + \ifx\tkz@koeff=1 % + \else + \tkzVecK[\tkz@koeff](#2,tkzPointResult) + \fi + \iftkz@line@normed + \tkzVecKNorm[\tkz@koeff](#2,tkzPointResult) + \fi +\endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% Symmedian line +%<--------------------------------------------------------------------------–> +\def\tkzDefSymmedianLine(#1,#2,#3){% +\begingroup + \tkzDefBisectorLine(#1,#2,#3) + \pgfnodealias{sym@pt1}{tkzPointResult} + \tkzDefMidPoint(#1,#3) + \pgfnodealias{sym@pt2}{tkzPointResult} + \tkzUSymOrth(#2,sym@pt1)(sym@pt2) + \ifx\tkz@koeff=1 % + \else + \tkzVecK[\tkz@koeff](#2,tkzPointResult) + \fi + \iftkz@line@normed + \tkzVecKNorm[\tkz@koeff](#2,tkzPointResult) + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +% Altitude Line +%<--------------------------------------------------------------------------–> +\def\tkzDefAltitudeLine(#1,#2,#3){% +\begingroup + \pgfinterruptboundingbox + \tkzUProjection(#1,#3)(#2) + \pgfnodealias{ort@pta}{tkzPointResult} + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% Euler Line +%<--------------------------------------------------------------------------–> +\def\tkzDefEulerLine(#1,#2,#3){% +\begingroup + \pgfinterruptboundingbox + \tkzOrthoCenter(#1,#2,#3) + \pgfnodealias{euler@pt1}{tkzPointResult} + \tkzEulerCenter(#1,#2,#3) + \pgfnodealias{euler@pt2}{tkzPointResult} + \pgfnodealias{tkzSecondPointResult}{euler@pt2} + \pgfnodealias{tkzFirstPointResult}{euler@pt1} + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% tangente à cercle passant par un point donné +%<--------------------------------------------------------------------------–> + +\def\tkzTgtAt(#1)(#2){% +\begingroup + \tkz@VecKOrthNorm[-1](#2,#1) + \endgroup +} +%<-------------------------------------------------------------------------–> +\def\tkzTgtFromP(#1,#2)(#3){% +\begingroup + \tkz@@CalcLengthcm(#1,#2){tkz@radone} + \tkzDefMidPoint(#1,#3) + \tkz@@CalcLengthcm(tkzPointResult,#1){tkz@radtwo} + \tkzInterCCR(#1,\tkz@radone)(tkzPointResult,\tkz@radtwo){% + tkzFirstPointResult}{tkzSecondPointResult}% + \tkzFindAngle(#3,tkzFirstPointResult,#1) \tkzGetAngle{tkz@an} + \ifdim\tkz@an pt<180 pt\relax% + \else + \pgfnodealias{tkzPointTmp}{tkzSecondPointResult} + \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult} + \pgfnodealias{tkzFirstPointResult}{tkzPointTmp} + \fi +\endgroup +} +%<-------------------------------------------------------------------------–> +\def\tkzTgtFromPR(#1,#2)(#3){% +\begingroup + \tkzDefMidPoint(#1,#3) + \tkz@@CalcLengthcm(tkzPointResult,#1){tkzLengthResult} + \tkzInterCCR(#1,#2)(tkzPointResult,\tkzLengthResult){% + tkzFirstPointResult}{% + tkzSecondPointResult}% + \tkzFindAngle(#3,tkzFirstPointResult,#1) \tkzGetAngle{tkz@an} + \ifdim\tkz@an pt<180 pt\relax% + \else + \pgfnodealias{tkzPointTmp}{tkzSecondPointResult} + \pgfnodealias{tkzSecondPointResult}{tkzFirstPointResult} + \pgfnodealias{tkzFirstPointResult}{tkzPointTmp} + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkz@numtang{0} +\pgfkeys{/tkz@tang/.cd, + at/.code = {\def\tkz@numtang{0}\def\tkz@ptat{#1}}, + from/.code = {\def\tkz@numtang{1}\def\tkz@ptfrom{#1}}, + from with R/.code = {\def\tkz@numtang{2}\def\tkz@ptfrom{#1}} + } +%<--------------------------------------------------------------------------–> +\def\tkzDefTangent{\pgfutil@ifnextchar[{\tkz@Tangent}{\tkz@Tangent[]}} + +\def\tkz@Tangent[#1](#2){% +\begingroup +\pgfkeys{tkz@tang/.cd} +\pgfqkeys{/tkz@tang}{#1} +\ifcase\tkz@numtang + \tkzTgtAt(#2)(\tkz@ptat) +\or + \tkzTgtFromP(#2)(\tkz@ptfrom) + \or + \tkzTgtFromPR(#2)(\tkz@ptfrom) +\fi +\endgroup +} +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex new file mode 100644 index 0000000000..2af038e957 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex @@ -0,0 +1,520 @@ +% tkz-tools-eu-points-by.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-eu-points-by.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% Transformations Géométriques +%<--------------------------------------------------------------------------–> +\def\tkz@numtrsf{0} +\pgfkeys{/tkzDefPointBy/.cd, + translation/.code args={from #1 to #2}{ \def\tkzfrom{#1}% + \def\tkzto{#2}% + \def\tkz@numtrsf{0}}, + homothety/.code args={center #1 ratio #2}{ \def\tkzcenter{#1}% + \def\tkzratio{#2}% + \def\tkz@numtrsf{1}}, + reflection/.code args={over #1--#2}{ \def\tkzdeb{#1}% + \def\tkzfin{#2}% + \def\tkz@numtrsf{2}}, + symmetry/.code args={center #1}{ \def\tkzcenter{#1}% + \def\tkz@numtrsf{3}}, + projection/.code args={onto #1--#2}{ \def\tkzdeb{#1}% + \def\tkzfin{#2}% + \def\tkz@numtrsf{4}}, + rotation/.code args={center #1 angle #2}{ \def\tkzcenter{#1}% + \def\tkzangle{#2}% + \def\tkz@numtrsf{5}}, + rotation in rad/.code args={center #1 angle #2}{ \def\tkzcenter{#1}% + \def\tkzangle{#2}% + \def\tkz@numtrsf{6}}, + inversion/.code args={center #1 through #2}{ \def\tkzcenter{#1}% + \def\tkzpoint{#2}% + \def\tkz@numtrsf{7}}, + inversion negative/.code args={center #1 through #2}{ \def\tkzcenter{#1}% + \def\tkzpoint{#2}% + \def\tkz@numtrsf{8}}, + rotation with nodes/.code args={center #1 from #2 to #3}{ \def\tkzcenter{#1}% + \def\tkzfrom{#2}% + \def\tkzto{#3}% + \def\tkz@numtrsf{9}} +} +%<--------------------------------------------------------------------------–> +\def\tkzDefPointBy{\pgfutil@ifnextchar[{\tkz@DefPointBy}{\tkz@DefPointBy[]}} +\def\tkz@DefPointBy[#1](#2){% +\begingroup +\pgfqkeys{/tkzDefPointBy}{#1} + \ifcase\tkz@numtrsf% +% % first case 0 + \tkzUTranslation(\tkzfrom,\tkzto)(#2) +\or% 1 + \tkzUHomo(\tkzcenter,\tkzratio)(#2) +\or% 2 + \tkzUSymOrth(\tkzdeb,\tkzfin)(#2) +\or% 3 + \tkzUCSym(\tkzcenter)(#2) +\or% 4 + \tkzUProjection(\tkzdeb,\tkzfin)(#2) +\or% 5 + \tkzURotateAngle(\tkzcenter,\tkzangle)(#2) +\or% 6 + \tkzURotateInRad(\tkzcenter,\tkzangle)(#2) +\or% 7 + \tkzUInversePoint(\tkzcenter,\tkzpoint)(#2) +\or% 8 + \tkzUInverseNegativePoint(\tkzcenter,\tkzpoint)(#2) +\or% 9 + \tkzURotateWithNodes(\tkzcenter,\tkzfrom,\tkzto)(#2) +\fi +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefPointsBy{\pgfutil@ifnextchar[{\tkz@DefPointsBy}{\tkz@DefPointsBy[]}} +\def\tkz@DefPointsBy[#1](#2)#3{% +\begingroup +\pgfqkeys{/tkzDefPointBy}{#1} +\ifcase\tkz@numtrsf% + % first case 0 + \tkzTranslation(\tkzfrom,\tkzto)(#2){#3} + \or% 1 + \tkzHomo(\tkzcenter,\tkzratio)(#2){#3} + \or% 2 + \tkzSymOrth(\tkzdeb,\tkzfin)(#2){#3} + \or% 3 + \tkzCSym(\tkzcenter)(#2){#3} + \or% 4 + \tkzProjection(\tkzdeb,\tkzfin)(#2){#3} + \or% 5 + \tkzRotateAngle(\tkzcenter,\tkzangle)(#2){#3} + \or% 6 + \tkzRotateInRad(\tkzcenter,\tkzangle)(#2){#3} + \or% 7 + \tkzInversePoint(\tkzcenter,\tkzpoint)(#2){#3} + \or% 8 + \tkzInverseNegativePoint(\tkzcenter,\tkzpoint)(#2){#3} + \or% 9 + \tkzRotateWithNodes(\tkzcenter,\tkzfrom,\tkzto)(#2){#3} +\fi +\endgroup +} + +%<--------------------------------------------------------------------------–> + +\def\ExtractPoint#1,#2\@nil{% +\xdef\tkz@LastList{#2} +\xdef\tkz@FirstPoint{#1} +} +\def\FirstPointInList#1{% +\edef\tkz@templist{#1,} +\expandafter\ExtractPoint\tkz@templist\@nil +} +%<--------------------------------------------------------------------------–> +% Translation par rapport à un point +%<--------------------------------------------------------------------------–> +\def\tkzTranslation(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} +\foreach\PT in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \def\tkz@pointtsf{\PT '} + \else + \def\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkz@VecCoLinear(#1,#2,\PT) + \pgfnodealias{\tkz@pointtsf}{tkzPointResult} + } +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUTranslation(#1,#2)(#3){% +\begingroup + \tkz@VecCoLinear(#1,#2,#3)% +\endgroup +} + +%<--------------------------------------------------------------------------–> +% Symétrie par rapport à un point Homo with (-1) +% #2 le centre #3 l'antécédent +%<--------------------------------------------------------------------------–> +\def\tkzCSym(#1)(#2)#3{% +\begingroup +\gdef\tkz@LastList{#3} + \foreach\PointCS in {#2}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \xdef\tkz@pointtsf{\PointCS '} + \else + \xdef\tkz@pointtsf{\tkz@FirstPoint} + \fi + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{\PointCS}{center}}% + \tkz@ax=\pgf@x% + \tkz@ay=\pgf@y% + \pgfinterruptboundingbox + \path(#1)--++(-\tkz@ax,-\tkz@ay)coordinate (\tkz@pointtsf); + \endpgfinterruptboundingbox +} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUCSym(#1)(#2){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \tkz@ax=\pgf@x% + \tkz@ay=\pgf@y% + \path(#1)--++(-\tkz@ax,-\tkz@ay)coordinate (tkzPointResult); +\endgroup +} +%<--------------------------------------------------------------------------–> +% Symétrie orthogonale par rapport à une droite +%<--------------------------------------------------------------------------–> +\def\tkzSymOrth(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointSO in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \def\tkz@pointtsf{\PointSO '} + \else + \def\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkzUSymOrth(#1,#2)(\PointSO) + \pgfnodealias{\tkz@pointtsf}{tkzPointResult} + } +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUSymOrth(#1,#2)(#3){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \tkz@ax =\pgf@y% + \tkz@ay =\pgf@x% + \pgfinterruptboundingbox + \path[coordinate] (#3)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point); + \endpgfinterruptboundingbox + \tkzInterLL(#1,#2)(#3,tkz@point) + \pgfnodealias{tkzPointofSym}{tkzPointResult} + \tkz@VecK[2](#3,tkzPointofSym) +\endgroup +} + +%<--------------------------------------------------------------------------–> +% Projection orthogonale sur une droite +%<--------------------------------------------------------------------------–> +\def\tkzProjection(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointPJ in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \def\tkz@pointtsf{\PointPJ '} + \else + \def\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkzUProjection(#1,#2)(\PointPJ) + \pgfnodealias{\tkz@pointtsf}{tkzPointResult} + } +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUProjection(#1,#2)(#3){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \tkz@ax =\pgf@y% + \tkz@ay =\pgf@x% + \pgfinterruptboundingbox + \path[coordinate](#3)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point); + \tkzInterLL(#1,#2)(#3,tkz@point)% définit tkzPointResult + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkz@Projection(#1,#2)(#3)#4{% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \tkz@ax =\pgf@y% + \tkz@ay =\pgf@x% + \pgfinterruptboundingbox + \path[coordinate](#3)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point); + \endpgfinterruptboundingbox + \tkz@InterLL(#1,#2)(#3,tkz@point){#4}% définit tkzPointResult +\endgroup +} +%<--------------------------------------------------------------------------–> +% Homothétie par rapport à un point +%<--------------------------------------------------------------------------–> +\def\tkzHomo(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointHO in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \xdef\tkz@pointtsf{\PointHO '} + \else + \xdef\tkz@pointtsf{\tkz@FirstPoint} + \fi + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{\PointHO}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfmathparse{#2}\edef\tkz@coeff{\pgfmathresult}% + \pgfinterruptboundingbox + \path[coordinate](#1)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya)% + coordinate(\tkz@pointtsf); + \endpgfinterruptboundingbox + } +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUHomo(#1,#2)(#3){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfmathparse{#2}\edef\tkz@coeff{\pgfmathresult}% + \pgfinterruptboundingbox + \path[coordinate](#1)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya)% + coordinate(tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% rotation en degré +%<--------------------------------------------------------------------------–> +\def\tkzRotateAngle(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointRot in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \def\tkz@pointtsf{\PointRot '} + \else + \def\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkz@@extractxy{\PointRot} + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \tkz@@extractxy{#1} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {#2} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path[coordinate](\tkz@bx,\tkz@by)coordinate(\tkz@pointtsf);% + \endpgfinterruptboundingbox + } + \endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzURotateAngle(#1,#2)(#3){% +\begingroup + \pgf@process{\pgfpointanchor{#3}{center}}% + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \pgf@process{\pgfpointanchor{#1}{center}}% + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {#2} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path (\tkz@bx,\tkz@by) coordinate (tkzPointResult);% + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% % rotation en radian +% %<--------------------------------------------------------------------------–> +\def\tkzRotateInRad(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointRot in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \xdef\tkz@pointtsf{\PointRot '} + \else + \xdef\tkz@pointtsf{\tkz@FirstPoint} + \fi + \pgfmathparse{#2 r} + \let\tkz@Angle\pgfmathresult + \tkz@@extractxy{\PointRot} + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \tkz@@extractxy{#1} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {\tkz@Angle} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path[coordinate](\tkz@bx,\tkz@by)coordinate(\tkz@pointtsf); + \endpgfinterruptboundingbox +} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzURotateInRad(#1,#2)(#3){% +\begingroup + \pgfmathparse{#2 r} + \let\tkz@Angle\pgfmathresult + \tkz@@extractxy{#3} + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \tkz@@extractxy{#1} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {\tkz@Angle} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path[coordinate](\tkz@bx,\tkz@by)coordinate(tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% Inverse of a point +%<--------------------------------------------------------------------------–> +\def\tkzInversePoint(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointIP in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \xdef\tkz@pointtsf{\PointIP '} + \else + \xdef\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkz@@CalcLengthcm(#1,#2){tkz@lna} + \tkz@@CalcLengthcm(#1,\PointIP){tkz@lnb} + \edef\tkz@lnc{\fpeval{\tkz@lna/\tkz@lnb*\tkz@lna}} + \tkzVecKNorm[\tkz@lnc](#1,\PointIP) + \pgfnodealias{\tkz@pointtsf}{tkzPointResult} + } +\endgroup +} +\def\tkzUInversePoint(#1,#2)(#3){% +\begingroup + \tkz@@CalcLengthcm(#1,#2){tkz@lna}% + \tkz@@CalcLengthcm(#1,#3){tkz@lnb}% + \edef\tkz@lnc{\fpeval{\tkz@lna/\tkz@lnb*\tkz@lna}} + \tkzVecKNorm[\tkz@lnc](#1,#3) +\endgroup +} +% possible +% \tkzDefLine[tangent from =#3](#1,#2) +% \tkzTgtFromP(#1,#2)(#3) +% \tkzInterLL(tkzFirstPointResult,tkzSecondPointResult)(#1,#2) +%<--------------------------------------------------------------------------–> +% Inverse negative of a point +%<--------------------------------------------------------------------------–> +\def\tkzInverseNegativePoint(#1,#2)(#3)#4{% +\begingroup +\gdef\tkz@LastList{#4} + \foreach\PointIP in {#3}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \xdef\tkz@pointtsf{\PointIP '} + \else + \xdef\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkz@@CalcLengthcm(#1,#2){tkz@lna} + \tkz@@CalcLengthcm(#1,\PointIP){tkz@lnb} + \edef\tkz@lnc{\fpeval{\tkz@lna/\tkz@lnb*\tkz@lna}} + \tkzVecKNorm[\tkz@lnc](#1,\PointIP) + \tkzUCSym(#1)(tkzPointResult) + \pgfnodealias{\tkz@pointtsf}{tkzPointResult} + } +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzUInverseNegativePoint(#1,#2)(#3){% +\begingroup + \tkz@@CalcLengthcm(#1,#2){tkz@lna}% + \tkz@@CalcLengthcm(#1,#3){tkz@lnb}% + \edef\tkz@lnc{\fpeval{\tkz@lna/\tkz@lnb*\tkz@lna}} + \tkzVecKNorm[\tkz@lnc](#1,#3) + \tkzUCSym(#1)(tkzPointResult) +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------- rotate with nodes ------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzRotateWithNodes(#1,#2,#3)(#4)#5{% +\begingroup +\gdef\tkz@LastList{#5} + \foreach\PointRotWN in {#4}{% + \FirstPointInList\tkz@LastList + \ifx\tkz@FirstPoint\tkzutil@empty + \def\tkz@pointtsf{\PointRotWN '} + \else + \def\tkz@pointtsf{\tkz@FirstPoint} + \fi + \tkzFindAngle(#2,#1,#3) + \tkz@@extractxy{\PointRotWN} + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \tkz@@extractxy{#1} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {\tkzAngleResult} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path[coordinate](\tkz@bx,\tkz@by) coordinate (\tkz@pointtsf);% + \endpgfinterruptboundingbox +} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzURotateWithNodes(#1,#2,#3)(#4){% +\begingroup + \tkzFindAngle(#2,#1,#3) + \pgf@process{\pgfpointanchor{#4}{center}}% + \tkz@ax\pgf@x% + \tkz@ay\pgf@y% + \pgf@process{\pgfpointanchor{#1}{center}}% + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfmathrotatepointaround{\pgfpoint{\tkz@ax}{\tkz@ay}}% + {\pgfpoint{\tkz@bx}{\tkz@by}}% + {\tkzAngleResult} + \tkz@bx\pgf@x% + \tkz@by\pgf@y% + \pgfinterruptboundingbox + \path (\tkz@bx,\tkz@by) coordinate (tkzPointResult);% + \endpgfinterruptboundingbox +\endgroup +} +%<--------------------------------------------------------------------------–> +% Fin des transformations +%<--------------------------------------------------------------------------–> +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex new file mode 100644 index 0000000000..a5aa32776a --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex @@ -0,0 +1,119 @@ +% tkz-obj-eu-points-rnd.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-obj-eu-points-rnd.tex} +%<--------------------------------------------------------------------------–> +\makeatletter +%<-------------------------------------------------------------------------–> +% Points aléatoires sur un segment, une droite, une demi-droite un cercle +%<--------------------------------------------------------------------------–> +% les points aléatoires +%<--------------------------------------------------------------------------–> +\def\tkz@numrp{0} +\pgfkeys{/@tkzDefRandPoint/.cd, + rectangle/.code args = {#1 and #2}{\def\tkz@numrp{0}% + \def\tkz@infl{#1}% + \def\tkz@supr{#2}}, + segment/.code args = {#1--#2}{\def\tkz@numrp{1}% + \def\tkz@start{#1}% + \def\tkz@end{#2}}, + line/.code args = {#1--#2}{\def\tkz@numrp{2}% + \def\tkz@start{#1}% + \def\tkz@end{#2}}, + circle/.code args = {center #1 radius #2}{\def\tkz@numrp{3}% + \def\tkz@center{#1} + \def\tkz@rad{#2}}, + circle through/.code args = {center #1 through #2}{\def\tkz@numrp{4}% + \def\tkz@center{#1} + \def\tkz@point{#2}}, + disk through/.code args = {center #1 through #2}{\def\tkz@numrp{5}% + \def\tkz@center{#1} + \def\tkz@point{#2}}, +} +%<------------------------ version 2019 ----------------------------------> +\def\tkzDefRandPointOn{\pgfutil@ifnextchar[{\tkz@DefRandPointOn}{% + \tkz@DefRandPointOn[]}} +\def\tkz@DefRandPointOn[#1]{% +\begingroup +\pgfqkeys{/@tkzDefRandPoint}{#1} +\ifcase\tkz@numrp% + % first case 0 + \tkzRandPointOnRect(\tkz@infl,\tkz@supr) + \or% 1 + \tkzRandPointOnSegment(\tkz@start,\tkz@end) + \or% 2 + \tkzRandPointOnLine(\tkz@start,\tkz@end) + \or% 3 + \tkzRandPointOnCircle(\tkz@center,\tkz@rad) + \or% 4 + \tkzRandPointOnCircleThrough(\tkz@center,\tkz@point) + \or% 5 + \tkzRandPointOnDisk(\tkz@center,\tkz@point) +\fi +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzRandPointOnRect(#1,#2){% +\tkz@@extractxy{#1} + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \tkz@@extractxy{#2} + \pgf@xb=\pgf@x\relax% + \pgf@yb=\pgf@y\relax% + \edef\tkz@a{\fpeval{\pgf@xb-\pgf@xa}} + \edef\tkz@b{\fpeval{\pgf@yb-\pgf@ya}} + \pgfmathparse{rnd}\global\let\tkzrndone\pgfmathresult + \pgfmathparse{rnd}\global\let\tkzrndtwo\pgfmathresult + \path[coordinate] ($(#1)+(\tkzrndone*\tkz@a pt,\tkzrndtwo*\tkz@b pt)$) coordinate (tkzPointResult); + } +%<--------------------------------------------------------------------------–> +\def\tkzRandPointOnSegment(#1,#2){% + \pgfmathparse{rnd} + \let\myrnd\pgfmathresult +\path[coordinate] ($ (#1)!\myrnd!(#2) $) coordinate (tkzPointResult); +} +%<--------------------------------------------------------------------------–> +\def\tkzRandPointOnLine(#1,#2){% + \pgfmathparse{rand} + \let\myrnd\pgfmathresult +\path[coordinate] ($ (#1)!\myrnd!(#2) $) coordinate (tkzPointResult); +} +%<--------------------------------------------------------------------------–> +\def\tkzRandPointOnCircle(#1,#2){% +\pgfmathrandominteger{\tkzrnd}{0}{360} +\tkz@ax#2cm % + \edef\tkz@pxa{\fpeval{\tkz@ax*cosd(\tkzrnd)}} + \edef\tkz@pxb{\fpeval{\tkz@ax*sind(\tkzrnd)}} + \path[coordinate]($(#1) + (\tkz@pxa pt,\tkz@pxb pt) $) coordinate (tkzPointResult); +} +\def\tkzRandPointOnCircleThrough(#1,#2){% +\pgfmathrandominteger{\tkzrnd}{0}{360} +\tkz@@CalcLength(#1,#2){tkzLengthResult} + \edef\tkz@pxa{\fpeval{\tkzLengthResult*cosd(\tkzrnd)}} + \edef\tkz@pxb{\fpeval{\tkzLengthResult*sind(\tkzrnd)}} +\path[coordinate]($(#1) + (\tkz@pxa pt ,\tkz@pxb pt) $) coordinate (tkzPointResult); +} +%<--------------------------------------------------------------------------–> +\def\tkzRandPointOnDisk(#1,#2){% + \pgfmathrandominteger{\tkzrnd}{0}{360} + \tkz@@CalcLength(#1,#2){tkzLengthResult} + \edef\tkz@pxa{\fpeval{\tkzLengthResult*cosd(\tkzrnd)}} + \edef\tkz@pxb{\fpeval{\tkzLengthResult*sind(\tkzrnd)}} + \path[coordinate]($(#1) + (\tkz@pxa pt ,\tkz@pxb pt) $) coordinate (tkz@tmp); + \pgfmathparse{rnd} + \let\myrnd\pgfmathresult + \path[coordinate] ($ (#1)!\myrnd!(tkz@tmp) $) coordinate (tkzPointResult); +} +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex new file mode 100644 index 0000000000..b650e32727 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex @@ -0,0 +1,265 @@ +% tkz-obj-el-points-with.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-obj-eu-points-with.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% Vectors +%<--------------------------------------------------------------------------–> +% Objet : outils mathématiques pour la géométrie euclideienne avec pgf/tikz +% utilisable de préférence avec un repère orthonormé et le cm comme unité +% utile pour la compatibilité avec pgf 2 +%<--------------------------------------------------------------------------–> +% Duplicate Length à revoir pas de pt pas de global +% ||v(CN)||= ||v(AB)|| et v(CN) colineaire à v(CD) +% A-->#1 B-->#2 C-->#3 D-->#4 N-->#5 ????? +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% Outils pour les vecteurs +%<--------------------------------------------------------------------------–> +% ce sont des outils élémentaires qui à partir de deux points en définissent +% un troisième +% #1 si c'est une option alors c'est un nombre réel +% #2 et #3 sont deux points +% #4 est le nom du point qui résulte de la transformation +% exemple : \tkzVecKNorm (A,B){C} définit un point C tel que AC = 1 et C est % % un point de la droite (AC). #1 peut être négatif + +\def\tkzDuplicateSegment(#1,#2)(#3,#4){% +\begingroup + \tkz@@CalcLength(#1,#2){tkz@firstlen}% + \tkz@@CalcLength(#3,#4){tkz@secondlen}% + \edef\tkz@ratio{\fpeval{\tkz@firstlen/\tkz@secondlen}} + \tkz@VecKCoLinear[\tkz@ratio](#3,#4,#3)% +\endgroup +} +\let\tkzDuplicateLength\tkzDuplicateSegment +%<--------------------------------------------------------------------------–> +% Coordonnées d'un vecteur (couple de points) +% Deux points A et B donc un vecteur on récupère les coordonnées de v(AB) +% en cm +% tkzGetVecCoord en cm ou en pt ??? +%<--------------------------------------------------------------------------–> +%result in #3x et #3y #1 et #2 sont les points +% passage en cm avec fp ? +% 28.45274 =1 cm +\def\tkzGetVectxy(#1,#2)#3{% +\begingroup +\pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% +\pgfmathparse{\pgf@sys@tonumber{\pgf@x}/1cm}% +\let\tkzresultx\pgfmathresult +\pgfmathparse{\pgf@sys@tonumber{\pgf@y}/1cm}% +\let\tkzresulty\pgfmathresult +\global\expandafter\edef\csname #3x\endcsname{\tkzresultx}% +\global\expandafter\edef\csname #3y\endcsname{\tkzresulty}% +\endgroup +} +%<--------------------------------------------------------------------------–> +% options #1 two points #2,#3 result in #4 +% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% tkzDefPointWith +%<--------------------------------------------------------------------------–> +\def\tkz@numv{0} +\pgfkeys{/@pointwith/.cd, + colinear/.code args = {at #1}{\def\tkz@numv{0}\def\tkz@frompoint{#1}}, + orthogonal/.code = {\def\tkz@numv{1}}, + linear/.code = {\def\tkz@numv{2}}, + orthogonal normed/.code = {\def\tkz@numv{3}}, + linear normed/.code = {\def\tkz@numv{4}}, + colinear normed/.code args = {at #1}{\def\tkz@numv{5}\def\tkz@frompoint{#1}}, + K/.code = {\edef\tkz@coeff{\fpeval{#1}}}, + K = 1, + normed/.is if = tkz@line@normed, + normed/.default = true, + normed = false, + orthogonal +} +\def\tkzDefPointWith{\pgfutil@ifnextchar[{\tkz@DefPointWith}{\tkz@DefPointWith[]}} + +\def\tkz@DefPointWith[#1](#2,#3){% +\begingroup +\pgfkeys{/@pointwith/.cd,K=1} +\pgfqkeys{/@pointwith}{#1} +\ifcase\tkz@numv% + % first case 0 + \tkz@DefVectorColinearat[\tkz@coeff](#2,#3) + \or% 1 + \tkz@VecKOrth[\tkz@coeff](#2,#3) + \or% 2 + \tkz@VecK[\tkz@coeff](#2,#3) + \or% 3 + \tkz@VecKOrthNorm[\tkz@coeff](#2,#3) + \or% 4 + \tkz@VecKNorm[\tkz@coeff](#2,#3) + \or% 5 + \tkz@VecKColinearNorm[\tkz@coeff](#2,#3) + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzDefVectorfrom +%<--------------------------------------------------------------------------–> +% tkz@numv 0 +\def\tkz@DefVectorColinearat[#1](#2,#3){% +\iftkz@line@normed + \tkz@VecKColinearNorm[#1](#2,#3) +\else +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}{\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \pgfinterruptboundingbox + \path (\tkz@frompoint)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +\fi +} +%<--------------------------------------------------------------------------–> +% tkzVector K Orth coeff dans #1 +% v(AN) perp v(AB) (v(AB) , v(AN) ) sens direct cercle trigo +% ||v(AN)||=||v(AB)|| +%<--------------------------------------------------------------------------–> +% tkz@numv 1 +\def\tkzVecKOrth{\pgfutil@ifnextchar[{\tkz@VecKOrth}{\tkz@VecKOrth[1]}} +\def\tkz@VecKOrth[#1](#2,#3){% +\iftkz@line@normed + \tkz@VecKOrthNorm[#1](#2,#3) +\else +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}{\pgfpointanchor{#3}{center}}% + \pgf@xa=-\pgf@y% + \pgf@ya=\pgf@x% + \pgfinterruptboundingbox + \path (#2)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +\fi +}% + +%<--------------------------------------------------------------------------–> +% v(AN)=#1 x v(AB) +% #1 le coeff; #2--> A #3--> B #4-->N tq #4-#2 = #1*(#3-#2) +%<--------------------------------------------------------------------------–> +% tkz@numv 2 +\def\tkzVecK{\pgfutil@ifnextchar[{\tkz@VecK}{\tkz@VecK[1]}} +\def\tkz@VecK[#1](#2,#3){% +\iftkz@line@normed + \tkz@VecKNorm[#1](#2,#3) +\else +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \pgfmathparse{#1} + \let\tkz@coeff\pgfmathresult + \pgfinterruptboundingbox + \path (#2)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +\fi +}% +%<--------------------------------------------------------------------------–> +% tkzVecKOrthNorm coeff dans #1 +% v(AN) perp v(AB) v(AB) v(AN) sens direct cercle trigo +% ||v(AN||=1 si #1 est vide ou =1 sinon ||v(AN||=K +%<--------------------------------------------------------------------------–> +% tkz@numv 3 +\def\tkzVecKOrthNorm{\pgfutil@ifnextchar[{\tkz@VecKOrthNorm}% + {\tkz@VecKOrthNorm[1]}} +\def\tkz@VecKOrthNorm[#1](#2,#3){% +\begingroup + \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}} + \pgf@xa=-\pgf@y\relax% + \pgf@ya=\pgf@x\relax% + \edef\tkz@x{\fpeval{28.45274*(#1)*\pgf@xa}} + \edef\tkz@y{\fpeval{28.45274*(#1)*\pgf@ya}} + \pgfinterruptboundingbox + \path (#2)--++(\tkz@x pt,\tkz@y pt) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +}% +%<--------------------------------------------------------------------------–> +% VectorNormalised ou K*VectorNormalised +% A-->#2 B-->#3 N-->#4 v(AB) devient v(AN) tq ||v(AN)||=1 si #1=1 +% sinon ||v(AN)||=#1 +%<--------------------------------------------------------------------------–> +% tkz@numv 4 +\def\tkzVecKNorm{\pgfutil@ifnextchar[{\tkz@VecKNorm}{\tkz@VecKNorm[1]}} +\def\tkz@VecKNorm[#1](#2,#3){% +\begingroup + \tkzpointnormalised{% + \pgfpointdiff{\pgfpointanchor{#2}{center}} + {\pgfpointanchor{#3}{center}}} + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \edef\tkz@x{\fpeval{28.45274*(#1)*\pgf@xa}} + \edef\tkz@y{\fpeval{28.45274*(#1)*\pgf@ya}} + \pgfinterruptboundingbox + \path (#2)--++(\tkz@x pt,\tkz@y pt) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +}% +%<--------------------------------------------------------------------------–> +% \tkz@VecKColinearNorm +%<--------------------------------------------------------------------------–> +%% tkz@numv 5 +\def\tkz@VecKColinearNorm[#1](#2,#3){% +\begingroup + \tkzpointnormalised{% + \pgfpointdiff{\pgfpointanchor{#2}{center}} + {\pgfpointanchor{#3}{center}}} + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \edef\tkz@x{\fpeval{28.45274*(#1)*\pgf@xa}} + \edef\tkz@y{\fpeval{28.45274*(#1)*\pgf@ya}} + \pgfinterruptboundingbox + \path (\tkz@frompoint)--++(\tkz@x pt,\tkz@y pt) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +}% +%<--------------------------------------------------------------------------–> +% VecKCoLinear CN = K x AB #1 pt #2 pt #3 pt #4 nb #5 pt result +% il faut modifier cette macro : on supprime #3 pour la colinéarité +% Il suffit d'utiliser Replicate ou Duplicate coeff dans #1 +% v(CD)=#1 x v(AB) #1 le coeff; #2-->A #3-->B #4-->C +%<--------------------------------------------------------------------------–> +\def\tkz@VecKCoLinear[#1](#2,#3,#4){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \edef\tkz@coeff{\fpeval{#1}} + \pgfinterruptboundingbox + \path (#4)--+(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +}% +\def\tkz@VecCoLinear(#1,#2,#3){% +\begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \pgfinterruptboundingbox + \path (#3)--+(\pgf@xa,\pgf@ya) coordinate (tkzPointResult); + \endpgfinterruptboundingbox +\endgroup +}% +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex new file mode 100644 index 0000000000..5a247848dd --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex @@ -0,0 +1,173 @@ + % tkz-obj-eu-points.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-obj-eu-points.tex} +\makeatletter +%<---------------------------------------------------------------------------> +% init def point +%<---------------------------------------------------------------------------> +% tkzDefPoint +%<---------------------------------------------------------------------------> +% macros complémentaires pour def point +%<---------------------------------------------------------------------------> +\def\tkz@parsecoordinate#1{% +\tkz@getseparator#1,\@nil +\iftkz@polar + \tkz@getfrompolar#1\@nil +\else + \tkz@getfromcart#1\@nil +\fi +} +\def\tkz@getseparator#1,#2\@nil{% +\ifx\tkzempty#2\tkzempty% + \tkz@polartrue +\else + \tkz@polarfalse +\fi +} +\def\tkz@getfrompolar#1:#2\@nil{% +\edef\tkz@a{\fpeval{#1}} +\edef\tkz@r{\fpeval{#2}} +\xdef\tkz@polarrad{\tkz@r} +\xdef\tkz@polarangle{\tkz@a} +} +\def\tkz@getfromcart#1,#2\@nil{% +\edef\tkz@x{\fpeval{#1}} +\edef\tkz@y{\fpeval{#2}} +\xdef\tkz@absc{\tkz@x} +\xdef\tkz@ord{\tkz@y} +} +%<---------------------------------------------------------------------------> +% options pour point definition +%<---------------------------------------------------------------------------> +\pgfkeys{/tkzPt/.cd, + polar/.is if = tkz@pt@polar, + polar/.default = true, + polar = false +} +%<---------------------------------------------------------------------------> +% tkz@ptStar +%<---------------------------------------------------------------------------> +\def\tkz@ptStar[#1](#2,#3)#{% +\pgfkeys{/tkzPt/.cd, polar = false} +\pgfqkeys{/tkzPt}{#1} +\iftkz@pt@polar% + \edef\tkz@x{\fpeval{#3*cosd(#2)}} + \edef\tkz@y{\fpeval{#3*sind(#2)}} +\else + \edef\tkz@x{\fpeval{#2}} + \edef\tkz@y{\fpeval{#3}} +\fi +\edef\tkzpt@xa{\fpeval{(\tkz@x-\tkz@init@xorigine)/\tkz@init@xstep}} +\edef\tkzpt@ya{\fpeval{(\tkz@y-\tkz@init@yorigine)/\tkz@init@ystep}} +\tkz@node +} +%<---------------------------------------------------------------------------> +% la macro defpoint les coordonnées cartésiennes ou polaires sont traitées +% afin de pouvoir être adaptées avec les unités choisies +%<---------------------------------------------------------------------------> +\def\tkzDefPoint{\pgfutil@ifnextchar[{\tkz@DefPoint}{\tkz@DefPoint[]}} + +\def\tkz@DefPoint[#1](#2)#{% +\tkz@parsecoordinate{#2} +\iftkz@polar + \tkz@ptStar[polar](\tkz@polarangle,\tkz@polarrad){tkz@coord@temp} +\else + \tkz@ptStar[](#2){tkz@coord@temp} +\fi +\tkz@DefPointEnd[#1] +}% +\def\tkz@DefPointEnd[#1]#2{\coordinate[#1] (#2) at (tkz@coord@temp);} +%<---------------------------------------------------------------------------> +% tkzDefPoints +%<---------------------------------------------------------------------------> +\def\tkzDefPoints{\pgfutil@ifnextchar[{\tkz@DefPoints}{\tkz@DefPoints[]}} +\def\tkz@DefPoints[#1]#2{% + \begingroup + \def\tkz@parenthesis@for@err{(}% + \def\tkz@maybe@parenthesis{#2}% + \ifx\tkz@maybe@parenthesis\tkz@parenthesis@for@err + \PackageError{tkz-base}{Syntax error use {} instead of ()}{You need to use {} instead of ()}% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\tkz@absorb@bad@arg}% + {\foreach \ptx/\pty/\name in {#2}{\tkzDefPoint[#1](\ptx,\pty){\name}}% + \endgroup}% +} +\def\tkz@absorb@bad@arg#1){\endgroup} +%<---------------------------------------------------------------------------> +\def\tkz@node#1{ \pgfinterruptboundingbox +\path[coordinate](\tkzpt@xa,\tkzpt@ya) coordinate(#1); + \endpgfinterruptboundingbox} +% \def\tkz@drawnode#1{\path[coordinate](\tkzpt@xa,\tkzpt@ya) coordinate(#1); +% \tkz@DrawPt{#1} +% } +% +%<---------------------------------------------------------------------------> +\def\tkzRenamePoint(#1)#2{\coordinate (#2) at (#1);} +\def\tkz@RenamePointEnd[#1]#2{\coordinate[#1] (#2) at (\tkz@ax,\tkz@ay);} +\def\tkzGetPoint#1{\coordinate (#1) at (tkzPointResult);} +\def\tkzGetPoints#1#2{\coordinate (#1) at (tkzFirstPointResult); + \coordinate (#2) at (tkzSecondPointResult);} +\def\tkzGetFirstPoint#1{\coordinate (#1) at (tkzFirstPointResult);} +\def\tkzGetSecondPoint#1{\coordinate (#1) at (tkzSecondPointResult);} +\def\tkzGetThirdPoint#1{\coordinate (#1) at (tkzThirdPointResult);} +\def\tkzDefShiftPointCoord[#1](#2)#3{% + \begin{scope}[shift={(#1)}] + \coordinate (#3) at (#2); + \end{scope} + }% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> + +%<---------------------------------------------------------------------------> +% tkzDefShiftPoint +%<---------------------------------------------------------------------------> +\def\tkzDefShiftPoint[#1](#2)#3{% + \tkz@@extractxy{#1} + \tkz@ax\pgf@x % + \tkz@ay\pgf@y % +\begin{scope}[shift={(\tkz@ax,\tkz@ay)}] + \coordinate (#3) at (#2); +\end{scope} +} +%<---------------------------------------------------------------------------> +% Coordonnées d'un point +% result in #2x et #2y #1 est le point et on récupère ses coordonnées +% usage soit A un point \tkzGetPointCoord(A){V} alors \Vx = xA et \Vy = yA +% en cm +% tkzGetPointCoord avec [#1] cm ou bien pt ?? todo +%<---------------------------------------------------------------------------> +\def\tkzGetPointCoord(#1)#2{% +\begingroup + \pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}} + \pgfmathparse{\pgf@sys@tonumber{\pgf@x}/28.45274} + \global\let\tkzresultx\pgfmathresult + \global\expandafter\edef\csname #2x\endcsname{\tkzresultx}% + \pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}} + \pgfmathparse{\pgf@sys@tonumber{\pgf@y}/28.45274} + \global\let\tkzresulty\pgfmathresult + \global\expandafter\edef\csname #2y\endcsname{\tkzresulty} +\endgroup +} +\def\tkz@@extractxy#1{% +\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}} +\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}} +} +\let\tkzGetPointxy\tkzGetPointCoord +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex new file mode 100644 index 0000000000..4c79826734 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex @@ -0,0 +1,113 @@ +% tkz-obj-eu-polygons.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-obj-eu-polygons.tex} +% bug in regular polygon side 2020/03/09 +\makeatletter +%<--------------------------------------------------------------------------–> +% Polygon +%<--------------------------------------------------------------------------–> +%<--------------------------- square ------------------------------------–> +% +%<--------------------------------------------------------------------------–> +\def\tkzDefSquare(#1,#2){ +\begingroup + \tkzURotateAngle(#2,-90)(#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzURotateAngle(#1, 90)(#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +%<--------------------- parallélogramme ---------------------------------–> +% +%<--------------------------------------------------------------------------–> +\def\tkzDefParallelogram(#1,#2,#3){ +\begingroup +\tkzDefPointWith[colinear= at #3](#2,#1) +\endgroup +} +%<--------------------- rectangle ---------------------------------–> +% +%<--------------------------------------------------------------------------–> +\def\tkzDefRectangle{\pgfutil@ifnextchar[{\tkz@DefRectangle}% + {\tkz@DefRectangle[]}} +\def\tkz@DefRectangle[#1](#2,#3){% +\begingroup + \path[#1](#2) -| coordinate (tkzFirstPointResult) (#3) -| coordinate (tkzSecondPointResult) (#2); +\endgroup +} +%<-------------------------- gold rectangle -------------------------------–> +% +%<--------------------------------------------------------------------------–> +\def\tkzDefGoldRectangle(#1,#2){ +\begingroup + \tkzDefPointWith[K=-\tkzInvPhi](#2,#1) + \pgfnodealias{tkzFirstPointResult}{tkzPointResult} + \tkzDefPointWith[K=\tkzInvPhi](#1,#2) + \pgfnodealias{tkzSecondPointResult}{tkzPointResult} +\endgroup +} +\let\tkzDefGoldenRectangle\tkzDefGoldRectangle +%<---------------------------- Regular Polygon -------------------------–> +\def\tkz@numregpol{0} +\pgfkeys{/defregpoly/.cd, + name/.store in = \tkz@regpolname, + sides/.store in = \tkz@regpolsides, + center/.code = \def\tkz@numregpol{0}, + side/.code = \def\tkz@numregpol{1}, + name/.default = P, + sides/.default = 5, + center +} +\def\tkzDefRegPolygon{\pgfutil@ifnextchar[{\tkz@DefRegPolygon}{\tkz@DefRegPolygon[]}} +\def\tkz@DefRegPolygon[#1](#2,#3){% +\begingroup +\pgfqkeys{/defregpoly}{#1} +\ifcase\tkz@numregpol% + \tkzRegPolygonCenter(#2,#3) + \or% + \tkzRegPolygonSide(#2,#3) + \fi +\endgroup +} +\def\tkzRegPolygonCenter(#1,#2){ +\begingroup + \foreach \v in {1,2,...,\tkz@regpolsides} + {% + \pgfmathsetmacro{\tkz@regangle}{360/\tkz@regpolsides*(\v-1)} + \tkzDefPointBy[rotation= center #1 angle \tkz@regangle](#2) + \pgfnodealias{\tkz@regpolname\v}{tkzPointResult} + } +\endgroup +} +\def\tkzRegPolygonSide(#1,#2){ +\begingroup +% get the center +\pgfmathsetmacro{\tkz@regangle}{360/\tkz@regpolsides*(\tkz@regpolsides-1)} +\pgfmathsetmacro{\tkz@regangleside}{(180-\tkz@regangle)/2} +\tkzDefMidPoint(#1,#2) +\pgfnodealias{tkz@tempPt}{tkzPointResult} +\tkz@@CalcLengthcm(tkz@tempPt,#1){tkz@len} +\pgfmathsetmacro{\tkz@inscriberadius}{% + \tkz@len*tan(90*(\tkz@regpolsides-2)/\tkz@regpolsides)} +\tkzDefPointWith[orthogonal normed,K=\tkz@inscriberadius](tkz@tempPt,#2) +\pgfnodealias{tkz@RegPolCenter}{tkzPointResult} +\tkzRegPolygonCenter(tkz@RegPolCenter,#1) +\pgfnodealias{tkzPointResult}{tkz@RegPolCenter} +\endgroup +} + + +\makeatother +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex new file mode 100644 index 0000000000..738221b1b6 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex @@ -0,0 +1,500 @@ +% tkz-obj-eu-triangles.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-obj-eu-triangles.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% Triangle Equilateral +%<--------------------------------------------------------------------------–> +\def\tkzDefEquilateral(#1,#2){ +\begingroup + %\tkzDefMidPoint(#1,#2) + \tkzURotateAngle(#1,60)(#2) +\endgroup +} +%<--------------------------------------------------------------------------–> +% Triangle Isosceles Right +%<--------------------------------------------------------------------------–> +\def\tkzDefIsoscelesRightTriangle(#1,#2){ +\begingroup + \tkzURotateAngle(#1,45)(#2) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzUHomo(#1,\tkzSqrTwobyTwo)(tkz@a) +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzDefIsoscelesRightTriangle(#1,#2){% +\begingroup + \tkzURotateAngle(#1,45)(#2) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzUHomo(#1,\tkzSqrTwobyTwo)(tkz@a) +\endgroup +} +%<--------------------------------------------------------------------------–> +% Triangle OneTwo +%<--------------------------------------------------------------------------–> +\def\tkzDefTwoOne(#1,#2){ +\begingroup + \iftkz@swap@tr + \tkzDefPointWith[K=-.5](#2,#1) + \else + \tkzDefPointWith[K=.5](#2,#1) + \fi + \endgroup +} +%<--------------------------------------------------------------------------– +% Pythagore +%<--------------------------------------------------------------------------– +\def\tkzDefPythagore(#1,#2){ +\begingroup +\iftkz@swap@tr + \tkzDefPointWith[K=-.75](#2,#1) + \else + \tkzDefPointWith[K=.75](#2,#1) + \fi +\endgroup +} +%<--------------------------------------------------------------------------– +% School +%<--------------------------------------------------------------------------– +\def\tkzDefSchoolTriangle(#1,#2){ +\begingroup +\iftkz@swap@tr + \tkzDefPointWith(#2,#1) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzURotateAngle(#1,-30)(#2) + \tkzInterLL(#1,tkzPointResult)(#2,tkz@a) +\else + \tkzDefPointWith(#2,#1) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzURotateAngle(#1,30)(#2) + \tkzInterLL(#1,tkzPointResult)(#2,tkz@a) + \fi +\endgroup +} +%<--------------------------------------------------------------------------– +% Gold +%<--------------------------------------------------------------------------– +\def\tkzDefGoldTriangle(#1,#2){ +\begingroup + \iftkz@swap@tr + \tkzDefPointWith[K=-\tkzInvPhi](#2,#1) + \else + \tkzDefPointWith[K=\tkzInvPhi](#2,#1) + \fi +\endgroup +} +%<--------------------------------------------------------------------------– +% +%<--------------------------------------------------------------------------– +\def\tkzDefEuclideTriangle(#1,#2){ +\begingroup + \iftkz@swap@tr + \tkzURotateAngle(#1,36)(#2) + \else + \tkzURotateAngle(#1,-36)(#2) + \fi +\endgroup +} +%<--------------------------------------------------------------------------– +% +%<--------------------------------------------------------------------------– +\def\tkzDefGoldenTriangle(#1,#2){ +\begingroup + \tkzURotateAngle(#1,72)(#2) + \tkzUHomo(#1,\tkzPhi)(tkzPointResult) +\endgroup +} +%<--------------------------------------------------------------------------– +% +%<--------------------------------------------------------------------------– +\def\tkzDefCheopsTriangle(#1,#2){ +\begingroup + \tkzDefMidPoint(#1,#2) + \tkzDefPointWith[K=-\tkzSqrtPhi](tkzPointResult,#1) +\endgroup +} +%<--------------------------------------------------------------------------– +% +%<--------------------------------------------------------------------------– +\def\tkzDefTwoAnglesTriangle(#1,#2){ +\begingroup + \tkzURotateAngle(#1,\tkz@alpha)(#2) + \pgfnodealias{tkz@a}{tkzPointResult} + \tkzURotateAngle(#2,-\tkz@beta)(#1) + \pgfnodealias{tkz@b}{tkzPointResult} + \tkzInterLL(#1,tkz@a)(#2,tkz@b) +\endgroup +} +%<--------------------------------------------------------------------------–> +% Triangles +%<--------------------------------------------------------------------------–> + +\def\tkz@numtr{0} +\pgfkeys{/deftriangle/.cd, + equilateral/.code = \def\tkz@numtr{0}, + half/.code = \def\tkz@numtr{1}, + two one/.code = \def\tkz@numtr{1}, + pythagore/.code = \def\tkz@numtr{2}, + pythagoras/.code = \def\tkz@numtr{2}, + right/.code = \def\tkz@numtr{2}, + egyptian/.code = \def\tkz@numtr{2}, + school/.code = \def\tkz@numtr{3}, + golden/.code = \def\tkz@numtr{4}, + sublime/.code = \def\tkz@numtr{4}, + euclid/.code = \def\tkz@numtr{5}, + euclide/.code = \def\tkz@numtr{5}, + gold/.code = \def\tkz@numtr{6}, + cheops/.code = \def\tkz@numtr{7}, + two angles/.code args = {#1 and #2} { \def\tkz@numtr{8}% + \def\tkz@alpha{#1}% + \def\tkz@beta{#2}}, + isosceles right/.code = \def\tkz@numtr{9}, + swap/.is if = tkz@swap@tr, + swap/.default = true, + swap = false, + equilateral +} + +\def\tkzDefTriangle{\pgfutil@ifnextchar[{\tkz@DefTriangle}{\tkz@DefTriangle[]}} +\def\tkz@DefTriangle[#1](#2,#3){% +\begingroup +\pgfqkeys{/deftriangle}{#1} +\ifcase\tkz@numtr% + \tkzDefEquilateral(#2,#3) + \or% 1 + \tkzDefTwoOne(#2,#3) + \or% 2 + \tkzDefPythagore(#2,#3) + \or% 3 + \tkzDefSchoolTriangle(#2,#3) + \or% 4 + \tkzDefGoldenTriangle(#2,#3) + \or% 5 + \tkzDefEuclideTriangle(#2,#3) + \or% 6 + \tkzDefGoldTriangle(#2,#3) + \or% 7 + \tkzDefCheopsTriangle(#2,#3) + \or% 8 + \tkzDefTwoAnglesTriangle(#2,#3) + \or% 9 + \tkzDefIsoscelesRightTriangle(#2,#3) + \fi +\endgroup +} +%<--------------------------------------------------------------------------–> +% les triangles sspécifiques +%<--------------------------------------------------------------------------–> + +%<--------------------------------------------------------------------------– +\def\tkz@numtspc{0} +\pgfkeys{/tkzDefSpcTriangle/.cd, + in/.code = \def\tkz@numtspc{0}, + incentral/.code = \def\tkz@numtspc{0}, + ex/.code = \def\tkz@numtspc{1}, + excentral/.code = \def\tkz@numtspc{1}, + extouch/.code = \def\tkz@numtspc{2}, + intouch/.code = \def\tkz@numtspc{3}, + contact/.code = \def\tkz@numtspc{3}, + centroid/.code = \def\tkz@numtspc{4}, + medial/.code = \def\tkz@numtspc{4}, + orthic/.code = \def\tkz@numtspc{5}, + ortho/.code = \def\tkz@numtspc{5}, + feuerbach/.code = \def\tkz@numtspc{6}, + euler/.code = \def\tkz@numtspc{7}, + tangential/.code = \def\tkz@numtspc{8}, + symmedial/.code = \def\tkz@numtspc{9}, + name/.store in = \tkz@pttr@name, + name = {}, + centroid, + } +\def\tkzDefSpcTriangle{\pgfutil@ifnextchar[{\tkz@DefSpcTriangle}{% + \tkz@DefSpcTriangle[]}} +\def\tkz@DefSpcTriangle[#1](#2)#3{% +\begingroup +\pgfqkeys{/tkzDefSpcTriangle}{#1} +\ifcase\tkz@numtspc% + \tkzDefIncentralTriangle(#2){#3} + \or% 1 + \tkzDefExcentralTriangle(#2){#3} + \or% 2 + \tkzDefExtouchTriangle(#2){#3} + \or% 3 + \tkzDefIntouchTriangle(#2){#3} + \or% 4 + \tkzDefCentroidTriangle(#2){#3} + \or% 5 + \tkzDefOrthicTriangle(#2){#3} + \or% 6 + \tkzDefFeuerbachTriangle(#2){#3} + \or% 7 + \tkzDefEulerTriangle(#2){#3} + \or% 8 + \tkzDefTangentialTriangle(#2){#3} + \or% 8 + \tkzDefSymmedialTriangle(#2){#3} + \fi +\endgroup +} + +\pgfkeys{/setuppttr/.is family} +\def\SetUpPTTR#1{\pgfqkeys{/setuppttr}{#1}} +\pgfkeys{/setuppttr/.cd, + name/.store in = \tkz@pttr@name, + name = {} +} +%<--------------------------------------------------------------------------– +% InCentral +%<--------------------------------------------------------------------------– +%<--------------------------------------------------------------------------–> +\def\@DefIncentralTriangle(#1,#2,#3)(#4,#5){% +\def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \tkzDefBisectorLine(#2,#1,\tkz@last) + \tkzInterLL(#2,\tkz@last)(#1,tkzPointResult) + \pgfnodealias{\tkz@pttr@name#4}{tkzPointResult} + \ifx\tkz@tmp\tkz@stop\else\@DefIncentralTriangle(#2,#3)(#5)\fi +} + +\def\tkzDefIncentralTriangle{\pgfutil@ifnextchar[{% + \tkz@DefIncentralTriangle}{% + \tkz@DefIncentralTriangle[]}} + +\def\tkz@DefIncentralTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \pgfinterruptboundingbox + \@DefIncentralTriangle(#2,#2)(#3,\tkz@stop) + \endpgfinterruptboundingbox +\endgroup +} +\let\tkzIncentralTriangle\tkzInExcentralTriangle +%<--------------------------------------------------------------------------– +% ExCentral +%<--------------------------------------------------------------------------– + +%<--------------------------------------------------------------------------–> +\def\@DefExcentralTriangle(#1,#2,#3)(#4,#5){% + \def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \tkzDefExCircle(#2,#1,\tkz@last) + \pgfnodealias{\tkz@pttr@name#4}{tkzPointResult} + \ifx\tkz@tmp\tkz@stop\else\@DefExcentralTriangle(#2,#3)(#5)\fi +} + +\def\tkzDefExcentralTriangle{\pgfutil@ifnextchar[{% + \tkz@DefExcentralTriangle}{% + \tkz@DefExcentralTriangle[]}} + +\def\tkz@DefExcentralTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \@DefExcentralTriangle(#2,#2)(#3,\tkz@stop) +\endgroup +} +\let\tkzExcentralTriangle\tkzDefExcentralTriangle +%<--------------------------------------------------------------------------–> +% Intouch Triangle +%<--------------------------------------------------------------------------–> +\def\@DefIntouchTriangle(#1,#2,#3)(#4,#5){% + \def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \tkzUProjection(#2,\tkz@last)(tkz@pt) + \pgfnodealias{\tkz@pttr@name#4}{tkzPointResult} + \ifx\tkz@tmp\tkz@stop\else\@DefIntouchTriangle(#2,#3)(#5)\fi +} + +\def\tkzDefIntouchTriangle{\pgfutil@ifnextchar[{% + \tkz@DefIntouchTriangle}{% + \tkz@DefIntouchTriangle[]}} + +\def\tkz@DefIntouchTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \tkzInCenter(#2) + \pgfnodealias{tkz@pt}{tkzPointResult} + \@DefIntouchTriangle(#2,#2)(#3,\tkz@stop) +\endgroup +} +\let\tkzDefContactTriangle\tkzDefIntouchTriangle +%<--------------------------------------------------------------------------–> +% Extouch Triangle +%<--------------------------------------------------------------------------–> +\def\tkzDefExtouchTriangle{\pgfutil@ifnextchar[{% + \tkz@DefExtouchTriangle}{% + \tkz@DefExtouchTriangle[]}} + +\def\tkz@DefExtouchTriangle[#1](#2,#3,#4)#5{% +\begingroup + \SetUpPTTR{#1} + \foreach \name [count=\i] in {#5} {% + \global\expandafter\edef\csname tkz@point\i\endcsname{\name} + } + \begingroup + \def\tkz@pttr@name{} + \tkzDefExcentralTriangle(#2,#3,#4){tkz@a,tkz@b,tkz@c} + \endgroup + \tkzUProjection(#3,#4)(tkz@a) + \pgfnodealias{\tkz@pttr@name\csname tkz@point1\endcsname}{tkzPointResult} + \tkzUProjection(#2,#3)(tkz@c) + \pgfnodealias{\tkz@pttr@name\csname tkz@point3\endcsname}{tkzPointResult} + \tkzUProjection(#2,#4)(tkz@b) + \pgfnodealias{\tkz@pttr@name\csname tkz@point2\endcsname}{tkzPointResult} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Feuerbach triangle +%<--------------------------------------------------------------------------–> +\def\tkzDefFeuerbachTriangle{\pgfutil@ifnextchar[{% + \tkz@DefFeuerbachTriangle}{\tkz@DefFeuerbachTriangle[]}} + +\def\tkz@DefFeuerbachTriangle[#1](#2,#3,#4)#5{% +\begingroup + \SetUpPTTR{#1} + \foreach \name [count=\i] in {#5} {% + \global\expandafter\edef\csname tkz@point\i\endcsname{\name} + } + \tkzDefExCircle(#2,#3,#4) \tkzGetPoints{tkz@b}{tkz@hb} + \tkzDefExCircle(#3,#4,#2) \tkzGetPoints{tkz@c}{tkz@hc} + \tkzDefExCircle(#4,#2,#3) \tkzGetPoints{tkz@a}{tkz@ha} + \tkzInterLC[near](#3,tkz@b)(tkz@b,tkz@hb) + \tkzGetFirstPoint{\tkz@pttr@name\csname tkz@point2\endcsname} + \tkzInterLC[near](#4,tkz@c)(tkz@c,tkz@hc) + \tkzGetFirstPoint{\tkz@pttr@name\csname tkz@point3\endcsname} + \tkzInterLC[near](#2,tkz@a)(tkz@a,tkz@ha) + \tkzGetFirstPoint{\tkz@pttr@name\csname tkz@point1\endcsname} +\endgroup +} +%<--------------------------------------------------------------------------–> +% Centroid +%<--------------------------------------------------------------------------–> +% The medial triangle or midpoint triangle of a triangle ABC +\def\@DefCentroidTriangle(#1,#2,#3)(#4,#5){% + \def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \pgfcoordinate{\tkz@pttr@name#4}{% + \pgfpointscale{0.5}{% + \pgfpointadd{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{\tkz@last}{center}}} + }% + \ifx\tkz@tmp\tkz@stop\else\@DefCentroidTriangle(#2,#3)(#5)\fi + } +\def\tkzDefCentroidTriangle{\pgfutil@ifnextchar[{\tkz@DefCentroidTriangle} + {\tkz@DefCentroidTriangle[]}} +\def\tkz@DefCentroidTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \@DefCentroidTriangle(#2,#2)(#3,\tkz@stop) +\endgroup +} +\let\tkzDefMedialTriangle\tkzDefCentroidTriangle +\let\tkzDefMidpointTriangle\tkzDefCentroidTriangle +%<--------------------------------------------------------------------------–> +% Orthic Triangle H Ha Hb Hc modif 3.03 +%<--------------------------------------------------------------------------–> +\def\@DefOrthicTriangle(#1,#2,#3)(#4,#5){% + \def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \tkzUProjection(#2,\tkz@last)(#1) + \pgfnodealias{\tkz@pttr@name#4}{tkzPointResult} + \ifx\tkz@tmp\tkz@stop\else\@DefOrthicTriangle(#2,#3)(#5)\fi +} + +\def\tkzDefOrthicTriangle{\pgfutil@ifnextchar[{\tkz@DefOrthicTriangle} + {\tkz@DefOrthicTriangle[]}} +\def\tkz@DefOrthicTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \@DefOrthicTriangle(#2,#2)(#3,\tkz@stop) +\endgroup +} +\let\tkzDefAltitudeTriangle\tkzDefOrthicTriangle + +%<--------------------------------------------------------------------------–> +% The Euler triangle +%<--------------------------------------------------------------------------–> +\def\tkzDefEulerTriangle{\pgfutil@ifnextchar[{% + \tkz@DefEulerTriangle}{\tkz@DefEulerTriangle[]}} +\def\tkz@DefEulerTriangle[#1](#2,#3,#4)#5{% +\begingroup + \SetUpPTTR{#1} + \pgfinterruptboundingbox + \tkzOrthoCenter(#2,#3,#4) + \pgfnodealias{tkz@e}{tkzPointResult} + \tkzDefMidPoint(#2,tkz@e) + \pgfnodealias{tkz@m1}{tkzPointResult} + \tkzDefMidPoint(#3,tkz@e) + \pgfnodealias{tkz@m2}{tkzPointResult} + \tkzDefMidPoint(#4,tkz@e) + \pgfnodealias{tkz@m3}{tkzPointResult} + \endpgfinterruptboundingbox + \foreach \name [count=\i] in {#5} {% + \coordinate (\tkz@pttr@name\name) at (tkz@m\i); + } +\endgroup +} +%<--------------------------------------------------------------------------–> +% TangentialTriangle +%<--------------------------------------------------------------------------–> +\def\tkzDefTangentialTriangle{\pgfutil@ifnextchar[{% + \tkz@DefTangentialTriangle}{\tkz@DefTangentialTriangle[]}} +\def\tkz@DefTangentialTriangle[#1](#2,#3,#4)#5{% +\begingroup + \SetUpPTTR{#1} + \tkzCircumCenter(#2,#3,#4) + \pgfnodealias{tkz@circ}{tkzPointResult} + \tkzDefLine[orthogonal=through #2](tkz@circ,#2) + \pgfnodealias{tkz@pta}{tkzPointResult} + \tkzDefLine[orthogonal=through #3](tkz@circ,#3) + \pgfnodealias{tkz@ptb}{tkzPointResult} + \tkzDefLine[orthogonal=through #4](tkz@circ,#4) + \pgfnodealias{tkz@ptc}{tkzPointResult} + \tkzInterLL(#2,tkz@pta)(#3,tkz@ptb) + \pgfnodealias{tkz@tg3}{tkzPointResult} + \tkzInterLL(#3,tkz@ptb)(#4,tkz@ptc) + \pgfnodealias{tkz@tg1}{tkzPointResult} + \tkzInterLL(#4,tkz@ptc)(#2,tkz@pta) + \pgfnodealias{tkz@tg2}{tkzPointResult} + \foreach \name [count=\i] in {#5} {% + \coordinate (\tkz@pttr@name\name) at (tkz@tg\i); + } +\endgroup +} +%<--------------------------------------------------------------------------– +% tkzDefSymmedianLine +%<--------------------------------------------------------------------------– +\def\@DefSymmedialTriangle(#1,#2,#3)(#4,#5){% + \def\tkz@tmp{#5}% + \tkz@recuplast(#3) + \tkzDefSymmedianLine(#2,#1,\tkz@last) + \tkzInterLL(#2,\tkz@last)(#1,tkzPointResult) + \pgfnodealias{\tkz@pttr@name#4}{tkzPointResult} + \ifx\tkz@tmp\tkz@stop\else\@DefSymmedialTriangle(#2,#3)(#5)\fi +} + +\def\tkzDefSymmedialTriangle{\pgfutil@ifnextchar[{% + \tkz@DefSymmedialTriangle}{% + \tkz@DefSymmedialTriangle[]}} + +\def\tkz@DefSymmedialTriangle[#1](#2)#3{% +\begingroup + \SetUpPTTR{#1} + \pgfinterruptboundingbox + \@DefSymmedialTriangle(#2,#2)(#3,\tkz@stop) + \endpgfinterruptboundingbox +\endgroup +} +\makeatother +\endinput
\ No newline at end of file |