diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tkz-base')
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-base.cfg | 131 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-base.sty | 195 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-obj-marks.tex | 135 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-obj-points.tex | 519 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-obj-segments.tex | 142 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-arith.tex | 212 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-base.tex | 700 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-math.tex | 688 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-misc.tex | 181 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-obsolete.tex | 219 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex | 338 |
11 files changed, 3460 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-base.cfg b/Master/texmf-dist/tex/latex/tkz-base/tkz-base.cfg new file mode 100644 index 00000000000..14c17857837 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-base.cfg @@ -0,0 +1,131 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + +% original tkz-base.cfg +% +% If you modify this original file, YOUR CHANGES WILL BE LOST when it is +% updated. Instead, put your changes in the entire copy of tkz-base.cfg +% and save the file in a directory part of your TEXINPUTS environment +% variable. + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} +\makeatletter +%<--------- axes cartesian system ---------------------------------------–> +\global\edef\tkz@init@color{\tkz@textcolor} +\global\def\tkz@init@lw{0.4 pt} +\global\def\tkz@init@tickwd{0.8 pt} +\global\def\tkz@init@ticka{2 pt} +\global\def\tkz@init@tickb{2 pt} +\global\def\tkz@init@xlabel{$x$} +\global\def\tkz@init@ylabel{$y$} +\global\def\tkz@init@tickb{2 pt} +\global\def\tkz@init@rightspace{.5} +\global\def\tkz@init@leftspace{0} +\global\def\tkz@init@upspace{.5} +\global\def\tkz@init@downspace{0} +\global\let\tkzmathstyle\displaystyle +\global\def\tkz@legend@line@len{1cm} +%<------------------------------ styles ---------------------------------–> +\tikzset{xlabel style/.style={below=3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{xaxe style/.style ={>=latex,->}} +\tikzset{ylabel style/.style={left = 3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{yaxe style/.style ={>=latex,->}} +%<-------------------------- rep ---------------------------------------–> +\global\edef\tkz@sur@color{\tkz@mainlinecolor} +\global\edef\tkz@sur@colorlabel{\tkz@mainlinecolor} +\global\def\tkz@sur@lw{0.8 pt} +\global\def\tkz@sur@posxlabel{below=2pt} +\global\def\tkz@sur@posylabel{left=2pt} +\tikzset{rep style/.style={->,>=latex}} +%<-------------------------- grid ---------------------------------------–> +\global\edef\tkz@grid@color{gray} +\global\def\tkz@grid@lw{0.4 pt} +\global\def\tkzCoeffSubColor{50} +\global\def\tkzCoeffSubLw{0.8} +\global\def\tkz@grid@xstep{0.2} +\global\def\tkz@grid@ystep{0.2} +%<-------------------------- line ---------------------------------------–> +\global\edef\tkz@euc@linecolor{\tkz@mainlinecolor} +\global\def\tkz@euc@linewidth{0.6pt} +\global\def\tkz@euc@linestyle{solid} +\global\def\tkz@euc@lineleft{.2} +\global\def\tkz@euc@lineright{.2} +\tikzset{line style/.style={% + line width = \tkz@euc@linewidth, + color = \tkz@euc@linecolor, + style = \tkz@euc@linestyle, + add = {\tkz@euc@lineleft} and {\tkz@euc@lineright}} + } +%<-------------------------- points -----------------------------------–> +\global\edef\tkz@euc@pointshape{circle} +\global\edef\tkz@euc@pointcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@labelcolor{\tkz@mainlinecolor} +\global\def\tkz@euc@pointsize{6} +\global\def\tkz@euc@pointpos{below right} +\global\edef\tkz@euc@segmentcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@circlecolor{\tkz@mainlinecolor} +\tikzset{point style/.style={draw = \tkz@euc@pointcolor, + inner sep = 0pt, + shape = \tkz@euc@pointshape, + minimum size = \tkz@euc@pointsize*\pgflinewidth, + fill = \tkz@euc@pointcolor!50}} +%<------------------------- compass -----------------------------------–> +\global\edef\tkz@euc@compasscolor{\tkz@otherlinecolor} +\global\def\tkz@euc@compasswidth{0.4pt} +\global\def\tkz@euc@compassstyle{solid} +\tikzset{compass style/.style={color = \tkz@euc@compasscolor, + line width = \tkz@euc@compasswidth, + style = \tkz@euc@compassstyle}} +%<---------------------------- mark -----------------------------------–> +\global\edef\tkz@mk@color{\tkz@mainlinecolor} +\global\edef\tkz@mk@mark{*} +\global\edef\tkz@mk@size{3pt} +\global\edef\tkz@mk@fill{\tkz@otherlinecolor} +\tikzset{mark style/.style={mark=\tkz@mk@mark,mark size=\tkz@mk@size,mark options={color=\tkz@mk@color,fill=\tkz@mk@fill}}} +%<---------------------- show coord -----------------------------------–> +\tikzset{arrow coord style/.style={dashed, + \tkz@euc@linecolor, + >=latex', + ->}} +\tikzset{xcoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + below=3pt}} +\tikzset{ycoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + left=3pt}} +%<--------------------------- vector --------------------------------------–> +\tikzset{vector style/.style={>=latex,->}} + +%<------------------------- Cartesian system -----------------------------–> +% Default +% Geometry Euclidean with unity for x and y = 1cm ---> step=1 +% 0 ≤ x ≤ 10 +% 0 ≤ y ≤ 10 +\xdef\tkz@init@xorigine{0} +\xdef\tkz@init@yorigine{0} +\xdef\tkz@init@xstep{1} +\xdef\tkz@init@ystep{1} +\xdef\tkz@init@xmin{0} +\xdef\tkz@init@ymin{0} +\xdef\tkz@init@xmax{10} +\xdef\tkz@init@ymax{10} +\xdef\tkz@init@xdec{1} +\xdef\tkz@init@ydec{1} +%<--------------------------------------------------------------------------–> +\makeatother +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-base.sty b/Master/texmf-dist/tex/latex/tkz-base/tkz-base.sty new file mode 100644 index 00000000000..fdd47e29895 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-base.sty @@ -0,0 +1,195 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% This work consists of the main source file interfaces.dtx +% and the derived files + +% tkz-base.sty % this file +% tkz-base.cfg +% tkz-obj-marks.tex +% tkz-obj-points.tex +% tkz-obj-segments.tex +% tkz-tools-arith.tex +% tkz-tools-base.tex +% tkz-tools-math.tex +% tkz-tools-misc.tex +% tkz-tools-obsolete.tex +% tkz-tools-utilities.tex +%<--------------------------------------------------------------------------–> +% Objet : Outils pour la création de graphiques géométriques +%<--------------------------------------------------------------------------–> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tkz-base}[2011/06/01 1.16 c tkz-base] +\RequirePackage{etex} +\RequirePackage{tikz} +\usetikzlibrary{calc,% + arrows,% + plotmarks,% + positioning,% + shapes.misc,% + decorations,% + decorations.markings,% + decorations.pathreplacing, + patterns} +% Pour les les labels sur les axes +\@ifpackageloaded{numprint}{} +{\RequirePackage[autolanguage]{numprint}} % +\RequirePackage{fp} +% pas de messages de la part de fp ! +\FPmessagesfalse% +\newdimen\tkzRadius +\newdimen\tkzLength +\newdimen\tkz@radi +\newdimen\tkz@ax +\newdimen\tkz@ay +\newdimen\tkz@bx +\newdimen\tkz@by +\newdimen\tkz@cx +\newdimen\tkz@cy +\newdimen\tkz@dx +\newdimen\tkz@dy +\newif\iftkz@Y@noticks +\newif\iftkz@Y@nograd +\newif\iftkz@Y@orig +\newif\iftkz@Y@unit +\newif\iftkz@X@noticks +\newif\iftkz@X@nograd +\newif\iftkz@X@orig +\newif\iftkz@X@unit +\global\def\tkz@mathresult{} +%<--------------------------- colors ---------------------------------------> +\def\tkz@backgroundcolor{white} +\def\tkz@textcolor{black} +\global\edef\tkz@fillcolor{\tkz@backgroundcolor} +\global\edef\tkz@mainlinecolor{\tkz@textcolor} +\global\edef\tkz@otherlinecolor{\tkz@mainlinecolor!50} +\tikzset{% + add/.style args={#1 and #2}{ + to path={% + ($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostart)$)% + \tikztonodes}} +} +%<--------- axes cartesian system ---------------------------------------–> +\global\edef\tkz@init@color{\tkz@textcolor} +\global\def\tkz@init@lw{0.4 pt} +\global\edef\tkz@init@gradsize{\textstyle} +\global\def\tkz@init@xlabel{$x$} +\global\def\tkz@init@ylabel{$y$} +\global\def\tkz@init@tickwd{0.8 pt} +\global\def\tkz@init@ticka{2 pt} +\global\def\tkz@init@tickb{2 pt} +\global\def\tkz@init@rightspace{.5} +\global\def\tkz@init@leftspace{0} +\global\def\tkz@init@upspace{.5} +\global\let\tkzmathstyle\displaystyle +\global\def\tkz@init@downspace{0} +%<------------------------------ styles ---------------------------------–> +\tikzset{xlabel style/.style={below=3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{xaxe style/.style ={>=latex,->}} +\tikzset{ylabel style/.style={left = 3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{yaxe style/.style ={>=latex,->}} +%<-------------------------- rep ---------------------------------------–> +\global\edef\tkz@sur@color{\tkz@mainlinecolor} +\global\edef\tkz@sur@colorlabel{\tkz@mainlinecolor} +\global\def\tkz@sur@lw{0.8 pt} +\global\def\tkz@sur@posxlabel{below=2pt} +\global\def\tkz@sur@posylabel{left=2pt} +\tikzset{rep style/.style={->,>=latex}} +%<-------------------------- grid ---------------------------------------–> +\global\edef\tkz@grid@color{gray} +\global\def\tkz@grid@lw{0.4 pt} +\global\def\tkzCoeffSubColor{50} +\global\def\tkzCoeffSubLw{0.8} +\global\def\tkz@grid@xstep{0.2} +\global\def\tkz@grid@ystep{0.2} +%<-------------------------- line ---------------------------------------–> +\global\edef\tkz@euc@linecolor{\tkz@mainlinecolor} +\global\def\tkz@euc@linewidth{0.6pt} +\global\def\tkz@euc@linestyle{solid} +\global\def\tkz@euc@lineleft{.2} +\global\def\tkz@euc@lineright{.2} +\global\def\tkz@legend@line@len{1cm} +\tikzset{line style/.style={% + line width = \tkz@euc@linewidth, + color = \tkz@euc@linecolor, + style = \tkz@euc@linestyle, + add = {\tkz@euc@lineleft} and {\tkz@euc@lineright}} + } +%<-------------------------- points -----------------------------------–> +\global\edef\tkz@euc@pointshape{circle} +\global\edef\tkz@euc@pointcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@labelcolor{\tkz@mainlinecolor} +\global\def\tkz@euc@pointsize{6} +\global\def\tkz@euc@pointpos{below right} +\global\edef\tkz@euc@segmentcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@circlecolor{\tkz@mainlinecolor} +\tikzset{point style/.style={draw = \tkz@euc@pointcolor, + inner sep = 0pt, + shape = \tkz@euc@pointshape, + minimum size = \tkz@euc@pointsize*\pgflinewidth, + fill = \tkz@euc@pointcolor!50}} +%<------------------------- compass -----------------------------------–> +\global\edef\tkz@euc@compasscolor{\tkz@otherlinecolor} +\global\def\tkz@euc@compasswidth{0.4pt} +\global\def\tkz@euc@compassstyle{solid} +\tikzset{compass style/.style={color = \tkz@euc@compasscolor, + line width = \tkz@euc@compasswidth, + style = \tkz@euc@compassstyle}} +%<---------------------------- mark -----------------------------------–> +\global\edef\tkz@mk@color{\tkz@mainlinecolor} +\global\edef\tkz@mk@mark{*} +\global\edef\tkz@mk@size{3pt} +\global\edef\tkz@mk@fill{\tkz@otherlinecolor} +\tikzset{mark style/.style={mark=\tkz@mk@mark,mark size=\tkz@mk@size,mark options={color=\tkz@mk@color,fill=\tkz@mk@fill}}} +%<---------------------- show coord -----------------------------------–> +\tikzset{arrow coord style/.style={dashed, + \tkz@euc@linecolor, + >=latex', + ->}} +\tikzset{xcoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + below=3pt}} +\tikzset{ycoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + left=3pt}} +%<--------------------------- vector --------------------------------------–> +\tikzset{vector style/.style={>=latex,->}} +%<------------------------- Cartesian system -----------------------------–> +% Default +% Geometry Euclidean with unity for x and y = 1cm ---> step=1 +% 0 ≤ x ≤ 10 +% 0 ≤ y ≤ 10 +\xdef\tkz@init@xorigine{0} +\xdef\tkz@init@yorigine{0} +\xdef\tkz@init@xstep{1} +\xdef\tkz@init@ystep{1} +\xdef\tkz@init@xmin{0} +\xdef\tkz@init@ymin{0} +\xdef\tkz@init@xmax{10} +\xdef\tkz@init@ymax{10} +\xdef\tkz@init@xdec{1} +\xdef\tkz@init@ydec{1} + +\input{tkz-tools-utilities}% obligatoire +\input{tkz-tools-arith}% used only for axis +\input{tkz-tools-base} +\input{tkz-tools-misc} +\input{tkz-tools-math} +\input{tkz-obj-points} +\input{tkz-obj-segments} +\input{tkz-obj-marks} +\endinput + diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-marks.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-marks.tex new file mode 100644 index 00000000000..adb51bec600 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-marks.tex @@ -0,0 +1,135 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + +%<-------------------------------------------------------------------------–> +% Setup Marks +%<-------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% DefSetOfPoints +%<--------------------------------------------------------------------------–> +\newif\iftkz@sop@show +\newcount\tkz@cntmk +\pgfkeys{ + /tkzSoPt/.cd, + prefix/.code = {\global\edef\tkz@pref{#1}}, + /tkzSoPt/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}} +} +\def\tkzDefSetOfPoints{\pgfutil@ifnextchar[{\tkz@SetOfPoints}{% + \tkz@SetOfPoints[]}} +\def\tkz@SetOfPoints[#1]#2{% +\begingroup +\pgfkeys{% +/tkzSoPt/.cd, +prefix=tkzPt} +\pgfqkeys{/tkzSoPt}{#1} + \tkz@cntmk1 % + \edef\tkz@@cnt{\the\tkz@cntmk} + \foreach \x/\y in {#2}{% + \tkz@cntmk=\tkz@@cnt % + \tkzDefPoint(\x,\y){\tkz@pref\the\tkz@cntmk} + \advance\tkz@cntmk by1 % + \global\edef\tkz@@cnt{\the\tkz@cntmk} + }% +\endgroup}% +%<-------------------------------------------------------------------------–> +\pgfkeys{ + /tkzjoinmk/.cd, + prefix/.code = {\global\edef\tkz@pref{#1}}, + /tkzjoinmk/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}} +} +\def\tkzJoinSetOfPoints{\pgfutil@ifnextchar[{\tkz@JoinSetOfPoints}{% + \tkz@JoinSetOfPoints[]}} +\def\tkz@JoinSetOfPoints[#1]{% +\begingroup +\pgfkeys{% +/tkzjoinmk/.cd, +prefix=tkzPt} +\pgfqkeys{/tkzjoinmk}{#1} +\pgfmathsetcount{\tkz@cntmk}{\tkz@@cnt-2} +\edef\tkz@@cnt{\the\tkz@cntmk} +\foreach \nb in {1,...,\tkz@@cnt}{% +\tkz@cntmk=\nb +\advance\tkz@cntmk by1 +\draw[line cap=round,/tkzjoinmk/.cd,#1] (\tkz@pref\nb)--(\tkz@pref\the\tkz@cntmk);} +\endgroup} +%<-------------------------------------------------------------------------–> +% ShowSetOfMark +%<-------------------------------------------------------------------------–> +\pgfkeys{ +/tkzdrawmk/.cd, +prefix/.code = {\global\edef\tkz@pref{#1}}, +/tkzdrawmk/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}} +} +\def\tkzDrawSetOfPoints{\pgfutil@ifnextchar[{\tkz@DrawSetOfPoints}{ + \tkz@DrawSetOfPoints[]}} +\def\tkz@DrawSetOfPoints[#1]{% +\begingroup +\pgfkeys{/tkzdrawmk/.cd, prefix=tkzPt} +\pgfqkeys{/tkzdrawmk}{#1} +\pgfmathsetcount{\tkz@cntmk}{\tkz@@cnt-1} +\foreach \nb in {1,...,\tkz@cntmk}{% +\tkzDrawMark[#1](\tkz@pref\nb)} +\endgroup} + +%<-------------------------------------------------------------------------–> +% tkzmark +%<-------------------------------------------------------------------------–> +\def\tkzDrawMark{\pgfutil@ifnextchar[{\tkz@DrawMark}{\tkz@DrawMark[]}} +\def\tkz@DrawMark[#1](#2){% + \draw plot[mark style,#1] coordinates {(#2)}; +} +%<-------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzDrawMarks{\pgfutil@ifnextchar[{\tkz@DrawMarks}{\tkz@DrawMarks[]}} +\def\tkz@DrawMarks[#1](#2){% +\foreach \point in {#2}{% +\draw plot[mark style,#1] coordinates {(\point)}; % StyleMark, +}} + +%<--------------------------------------------------------------------------–> +% Init pour mark +%<--------------------------------------------------------------------------–> +\pgfkeys{% +setupmk/.cd, +size/.code = {\global\edef\tkz@sum@mk@size{#1}}, +color/.code = {\global\edef\tkz@sum@mk@color{#1}}, +fill/.code = {\global\edef\tkz@sum@mk@fill{#1}}, +mark/.code = {\global\edef\tkz@sum@mk@mark{#1}} +} + +\def\tkzSetUpMark{\pgfutil@ifnextchar[{\tkzActivOff\tkz@SetUpMark}{% + \tkzActivOff\tkz@SetUpMark[]}} + +\def\tkz@SetUpMark[#1]{% + \pgfkeys{% +/setupmk/.cd, +mark = \tkz@mk@mark, +color = \tkz@mk@color, +fill = \tkz@mk@color!50, +size = \tkz@mk@size} +\pgfqkeys{/setupmk}{#1} +\tikzset{mark style/.style={inner sep = 0pt, + mark = \tkz@sum@mk@mark, + mark size = \tkz@sum@mk@size, + mark options = {color = \tkz@sum@mk@color, + fill = \tkz@sum@mk@fill}}} +}% + +%<--------------------------------------------------------------------------–> +\endinput +
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-points.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-points.tex new file mode 100644 index 00000000000..d4e5e982fef --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-points.tex @@ -0,0 +1,519 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + +%<--------------------------------------------------------------------------–> +% init def point +%<--------------------------------------------------------------------------–> +\newif\iftkz@polar\tkz@polarfalse +\newif\iftkz@pt@polar +\newif\iftkz@pt@show +\newif\iftkz@pt@noname + + +%<--------------------------------------------------------------------------–> +\pgfdeclareshape{cross} +{% + \inheritsavedanchors[from=rectangle] % this is nearly a rectangle + \inheritanchorborder[from=rectangle] + \inheritanchor[from=rectangle]{north} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{center} + \inheritanchor[from=rectangle]{west} + \inheritanchor[from=rectangle]{east} + \inheritanchor[from=rectangle]{mid} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{base east} + \inheritanchor[from=rectangle]{south} + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{south east} + \foregroundpath{ +% store lower right in xa/ya and upper right in xb/yb + \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y + \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y + \pgfpathmoveto{\pgfqpoint{0 pt}{\pgf@ya}} + \pgfpathlineto{\pgfqpoint{0 pt}{\pgf@yb}} + \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0 pt}} + \pgfpathlineto{\pgfqpoint{\pgf@xb}{0 pt}} + } +} +%<--------------------------------------------------------------------------–> +% 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{ + \FPeval\tkz@a{(#1)} + \FPeval\tkz@r{(#2)} +\global\edef\tkz@polarrad{\tkz@r} +\global\edef\tkz@polarangle{\tkz@a} +} +\def\tkz@getfromcart#1,#2\@nil{ + \FPeval\tkz@x{(#1)} + \FPeval\tkz@y{(#2)} +\global\edef\tkz@absc{\tkz@x} +\global\edef\tkz@ord{\tkz@y} +} +%<--------------------------------------------------------------------------–> +% la macro defpoint les coordonnées cartésiennes ou polaires sont traitées +% afin de pouvoir adaptées avec les unités choisies +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzDefPoint{\pgfutil@ifnextchar[{\tkzActivOff\tkz@DefPoint}{% + \tkzActivOff\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 + \foreach \ptx/\pty/\name in {#2}{\tkzDefPoint[#1](\ptx,\pty){\name}}% +\endgroup +} %<--------------------------------------------------------------------------–> +% Init pour Draw +%<--------------------------------------------------------------------------–> +\pgfkeys{% +setuppt/.cd, +size/.code = {\global\edef\tkz@pt@size{#1}}, +color/.code = {\global\edef\tkz@pt@color{#1}}, +fill/.code = {\global\edef\tkz@pt@fill{#1}}, +shape/.code = {\global\edef\tkz@pt@shape{#1}} +} +%<--------------------------------------------------------------------------–> +% tkzSetUpPoint définit la forme d'un point +%<--------------------------------------------------------------------------–> +\def\tkzSetUpPoint{\pgfutil@ifnextchar[{\tkzActivOff\tkz@SetUpPoint}{% + \tkzActivOff\tkz@SetUpPoint[]}} + +\def\tkz@SetUpPoint[#1]{% +\pgfkeys{% +/setuppt/.cd, +size = \tkz@euc@pointsize, +color = \tkz@euc@pointcolor, +fill = \tkz@euc@pointcolor!50, +shape = \tkz@euc@pointshape} +\pgfqkeys{/setuppt}{#1} +\tikzset{point style/.style={draw = \tkz@pt@color, + inner sep = 0pt, + shape = \tkz@pt@shape, + minimum size = \tkz@pt@size*\pgflinewidth, + fill = \tkz@pt@fill}}}% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% Draw Point +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +%\tikzset{/drawpoint/size/.style={minimum size=#1*\pgflinewidth}} +\pgfkeys{/drawpoint/.cd, + size/.code = {\tikzset{point style/.append style={% + minimum size = #1*\pgflinewidth}}}, + color/.code = {\tikzset{point style/.append style={% + draw = #1}}}, + shape/.code = {\tikzset{point style/.append style={% + shape=#1}}}, + fill/.code = {\tikzset{point style/.append style={% + fill=#1}}} } + +\def\tkzDrawPoint{\pgfutil@ifnextchar[{\tkz@DrawPoint}{\tkz@DrawPoint[]}} +\def\tkz@DrawPoint[#1](#2){% +\begingroup +\pgfkeys{/drawpoint/.cd} +\pgfqkeys{/drawpoint}{#1} +\node[point style] at (#2) {}; +\endgroup +} + +%<--------------------------------------------------------------------------–> +\def\tkzDrawPoints{\pgfutil@ifnextchar[{\tkz@drawpts}{\tkz@drawpts[]}} +%<--------------------------------------------------------------------------–> +\def\tkz@drawpts[#1](#2){% +\begingroup +\pgfkeys{/drawpoint/.cd} +\pgfqkeys{/drawpoint}{#1} +\foreach \point in {#2}{% + \node[point style] at (\point) {};} +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% rename +%<--------------------------------------------------------------------------–> +% \def\tkzRenamePoint{\pgfutil@ifnextchar[{\tkzActivOff\tkz@RenamePoint}{% +% \tkzActivOff\tkz@RenamePoint[]}} +% \def\tkz@RenamePoint[#1](#2)#{% +% \coordinate (tkz@coord@temp) at (#2);% +% \pgfextractx{\pgf@x}{\pgfpointanchor{tkz@coord@temp}{center}} +% \pgfextracty{\pgf@y}{\pgfpointanchor{tkz@coord@temp}{center}} +% \tkz@ax\pgf@x % +% \tkz@ay\pgf@y % +% \tkz@RenamePointEnd[#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\tkzDefShiftPointCoord[#1](#2)#3{% +\begin{scope}[shift={(#1)}] + \coordinate (#3) at (#2); +\end{scope} +}% + +\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} +} +%<-------------------------------------------------------------------------–> +% tkzLabelPoint Affichage des LABELS pour un point +%<-------------------------------------------------------------------------–> +% \newif\iftkz@mode@show +% \tikzoption{show}{\tikz@addmode{\tkz@mode@showfalse}} +\tikzset{label style/.style={\tkz@euc@pointpos,\tkz@euc@labelcolor,font=\normalsize}} +\def\tkzLabelPoint{\pgfutil@ifnextchar[{\tkz@LabelPoint}{\tkz@LabelPoint[]}} +\def\tkz@LabelPoint[#1](#2)#3{\node[label style,#1] at (#2) {#3};}% + +\def\tkzLabelPoints{\pgfutil@ifnextchar[{\tkz@LabelPoints}{% + \tkz@LabelPoints[]}}% +\def\tkz@LabelPoints[#1](#2){% + \foreach \point in {#2}{ + \node[label style,#1] at (\point) {$\point$};} +}% +%<--------------------------------------------------------------------------–> +% Coord +%<--------------------------------------------------------------------------–> +\newif\if@tkz@coord@noxdraw +\newif\if@tkz@coord@noydraw +\pgfkeys{ +/tkzprcoord/.cd, + xlabel/.code = {\global\edef\tkz@xlabel{#1}},% + ylabel/.code = {\global\edef\tkz@ylabel{#1}}, + xstyle/.code = {\tikzset{xcoord style/.append style={#1}}}, + ystyle/.code = {\tikzset{ycoord style/.append style={#1}}}, + noxdraw/.is if = @tkz@coord@noxdraw, + noxdraw/.default = true, + noydraw/.is if = @tkz@coord@noydraw, + noydraw/.default = true, + /tkzprcoord/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}} +} + \def\tkzPointShowCoord{\pgfutil@ifnextchar[{\tkz@PointShowCoord}{% + \tkz@PointShowCoord[]}} +\def\tkz@PointShowCoord[#1](#2){% +\begingroup +\pgfkeys{% +tkzprcoord/.cd, + xlabel = {}, + ylabel = {}, + xstyle = {}, + ystyle = {}, + noxdraw = false, + noydraw = false + } +\pgfqkeys{/tkzprcoord}{#1} +\if@tkz@coord@noxdraw\else\draw[arrow coord style] (#2)--(#2 |- tkz@xline); \fi +\if@tkz@coord@noydraw\else \draw[arrow coord style] (#2)--(#2 -| tkz@yline);\fi +\ifx\tkzutil@empty\tkz@xlabel +\else + \protected@edef\tkz@temp{% + \noexpand\path (#2)--(#2 |- tkz@xline) + \noexpand node[xcoord style]}\tkz@temp {\tkz@xlabel}; +\fi +\ifx\tkzutil@empty\tkz@ylabel +\else + \protected@edef\tkz@temp{% + \noexpand\path (#2)--(#2 -| tkz@yline) + \noexpand node[ycoord style]}\tkz@temp {\tkz@ylabel}; +\fi +\endgroup +} + +%<-------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% tkzPoint +%<--------------------------------------------------------------------------–> +\pgfkeys{ + tkzpt/.cd, + pos/.code = {\def\tkz@pt@pos{#1}}, + size/.code = {\def\tkz@pt@size{#1}}, + name/.code = {\def\tkz@pt@name{#1}}, + namecolor/.code = {\def\tkz@pt@namecolor{#1}}, + time/.code = {\def\tkz@pt@time{#1}}, + color/.code = {\def\tkz@pt@color{#1}}, + shape/.code = {\def\tkz@pt@shape{#1}}, + polar/.is if = tkz@pt@polar, + polar/.default = true, + noname/.is if = tkz@pt@noname, + noname/.default = true +} + +\def\tkz@node#1{\path[coordinate](\ptxa,\ptya) coordinate(#1);} +\def\tkz@drawnode#1{\path[coordinate](\ptxa,\ptya) coordinate(#1); +\tkz@DrawPt{#1} +} + +\def\tkz@draw@point#1{% + \node[ inner sep = 0pt, + shape = \tkz@pt@shape,% + draw = \tkz@pt@color,% + minimum size = \tkz@pt@size*\pgflinewidth,% + fill = \tkz@pt@color] at (#1) {};} + +\def\tkzPoint{\@ifstar\tkzptStar\tkzptNoStar} +\def\tkzptNoStar{\pgfutil@ifnextchar[{\tkz@ptNoStar}{\tkz@ptNoStar[]}} +\def\tkz@ptNoStar[#1](#2,#3)#{% +\pgfkeys{/tkzpt/.cd, + noname = false,% pas de nom + name = {},% le nom est vide + polar = false,% + namecolor = \tkz@euc@labelcolor,% couleur du nom + pos = \tkz@euc@pointpos,% name + shape = \tkz@euc@pointshape,% + color = \tkz@euc@pointcolor,% couleur du point + size = \tkz@euc@pointsize,% + time = 0.5 +} +\pgfqkeys{/tkzpt}{#1} + \iftkz@pt@polar% + \FPeval\tkz@x{(#2*cos(#3*\FPpi/180))} + \FPeval\tkz@y{(#2*sin(#3*\FPpi/180))} + \else + \FPeval\tkz@x{(#2)} + \FPeval\tkz@y{(#3)} + \fi + + \FPadd{\ptxa}{\tkz@x}{-\tkz@init@xorigine} + \FPadd{\ptya}{\tkz@y}{-\tkz@init@yorigine} + \FPdiv{\ptxa}{\ptxa}{\tkz@init@xstep} + \FPdiv{\ptya}{\ptya}{\tkz@init@ystep} + \tkz@drawnode +} +% dessin du point (par défaut c'est un node donc il ne peut pas être scalé) +\def\tkz@DrawPt#1{% + \iftkz@pt@noname% pas de nom rien + \else% si name={} alors on prend le nom du node sinon name + \ifx\tkzutil@empty\tkz@pt@name\def\tkz@pt@name{$#1$}% + \fi + \protected@edef\tkz@temp{% + \noexpand \node[\tkz@pt@pos]}\tkz@temp at (#1)% + {\textcolor{\tkz@pt@namecolor} {\tkz@pt@name}};% + \fi +% on retrace ??? ici ou après le fi +\tkz@draw@point{#1} +} + +%<--------------------------------------------------------------------------–> +% Star version tkzPoint* +%<--------------------------------------------------------------------------–> +\def\tkzptStar{\pgfutil@ifnextchar[{\tkz@ptStar}{\tkz@ptStar[]}} +\def\tkz@ptStar[#1](#2,#3)#{% +\pgfkeys{/tkzpt/.cd, + polar = false,% +} +\pgfqkeys{/tkzpt}{#1} +\iftkz@pt@polar% + \FPeval\tkz@x{(#3*cos(#2*\FPpi/180))} + \FPeval\tkz@y{(#3*sin(#2*\FPpi/180))} +\else + \FPeval\tkz@x{(#2)} + \FPeval\tkz@y{(#3)} +\fi +\FPadd{\ptxa}{\tkz@x}{-\tkz@init@xorigine} +\FPadd{\ptya}{\tkz@y}{-\tkz@init@yorigine} +\FPdiv{\ptxa}{\ptxa}{\tkz@init@xstep} +\FPdiv{\ptya}{\ptya}{\tkz@init@ystep} +\tkz@node +} + +%<--------------------------------------------------------------------------–> +% Points +%<--------------------------------------------------------------------------–> +\def\tkzPoints{\pgfutil@ifnextchar[{\tkz@Points}{\tkz@Points[]}} +\def\tkz@Points[#1](#2){% +\begingroup + \foreach \ptx/\pty/\name in {#2}{% + \tkzPoint[#1](\ptx,\pty){\name}% + } +\endgroup +} + + %<--------------------------------------------------------------------------–> +% macro d'affichage % +%<--------------------------------------------------------------------------–> +\pgfqkeys{/pointwith} +{ orthogonal/.code =\def\tkz@numv{0}, + orthogonal normed/.code =\def\tkz@numv{1}, + linear/.code =\def\tkz@numv{2}, + linear normed/.code =\def\tkz@numv{3}, + colinear/.code args ={at #1} {\global\def\tkz@numv{4} + \global\def\tkz@frompoint{#1}}, + K/.code =\def\tkz@Koeff{#1} + } + +\def\tkzDefPointWith{\pgfutil@ifnextchar[{\tkz@DefPointWith}{% + \tkz@DefPointWith[]}} +\def\tkz@DefPointWith[#1](#2){% +\pgfqkeys{/pointwith}{linear,K=1} +\pgfqkeys{/pointwith}{#1} +\ifcase\tkz@numv% + % first case 0 + \tkz@VecKOrth[\tkz@Koeff](#2){tkzPointResult} + \or% 1 + \tkz@VecKOrthNorm[\tkz@Koeff](#2){tkzPointResult} + \or% 2 + \tkz@VecK[\tkz@Koeff](#2){tkzPointResult} + \or% 3 + \tkz@VecKNorm[\tkz@Koeff](#2){tkzPointResult} + \or% 4 + \tkz@VecKCoLinear[\tkz@Koeff](#2,\tkz@frompoint){tkzPointResult} + \fi +} + +%<-------------------------------------------------------------------------–> +% % % 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}{\global\def\tkz@numrp{0}% + \global\def\tkz@infl{#1}% + \global\def\tkz@supr{#2}}, +segment/.code args={#1--#2}{\global\def\tkz@numrp{1}% + \global\def\tkz@start{#1}% + \global\def\tkz@end{#2}}, +line/.code args={#1--#2}{\global\def\tkz@numrp{2}% + \global\def\tkz@start{#1}% + \global\def\tkz@end{#2}}, +circle/.code args={center #1 radius #2}{\def\tkz@numrp{3}% + \global\def\tkz@center{#1} + \global\def\tkz@rad{#2}} +} + +\def\tkzGetRandPointOn{\pgfutil@ifnextchar[{\tkz@DefRandPointOn}{% + \tkz@DefRandPointOn[]}} +\def\tkz@DefRandPointOn[#1]#2{% +\begingroup +\pgfkeys{/tkzDefRandPoint/.cd} +\pgfqkeys{/tkzDefRandPoint}{#1} +\ifcase\tkz@numrp% + % first case 0 + \tkzRandPointOnRect(\tkz@infl,\tkz@supr){#2} + \or% 1 + \tkzRandPointOnSegment(\tkz@start,\tkz@end){#2} + \or% 2 + \tkzRandPointOnLine(\tkz@start,\tkz@end){#2} + \or% 3 + \tkzRandPointOnCircle(\tkz@center,\tkz@rad){#2} +\fi +\endgroup +} + +\def\tkzRandPointOnRect(#1,#2)#3{% +\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% +\FPadd{\tkz@a}{\pgf@sys@tonumber{\pgf@xb}}{-\pgf@sys@tonumber{\pgf@xa}} +\FPadd{\tkz@b}{\pgf@sys@tonumber{\pgf@yb}}{-\pgf@sys@tonumber{\pgf@ya}} + \pgfmathparse{rnd}\global\let\myrndone\pgfmathresult + \pgfmathparse{rnd}\global\let\myrndtwo\pgfmathresult +\path[coordinate] ($(#1)+(\myrndone*\tkz@a pt,% + \myrndtwo*\tkz@b pt)$) coordinate (#3); + } + +\def\tkzRandPointOnSegment(#1,#2)#3{% + \pgfmathparse{rnd}\global\let\myrnd\pgfmathresult +\path[coordinate] ($ (#1)!\myrnd!(#2) $) coordinate (#3);} + +\def\tkzRandPointOnLine(#1,#2)#3{% + \pgfmathparse{rand}\global\let\myrnd\pgfmathresult +\path[coordinate] ($ (#1)!\myrnd!(#2) $) coordinate (#3);} + +\def\tkzRandPointOnCircle(#1,#2)#3{% +\pgfmathrandominteger{\myrnd}{0}{360} +\tkz@ax#2 % +\FPeval\tkz@xa{\pgf@sys@tonumber{\tkz@ax}*cos(\myrnd*\FPpi/180)} +\FPeval\tkz@xb{\pgf@sys@tonumber{\tkz@ax}*sin(\myrnd*\FPpi/180)} +\path[coordinate]($(#1) + (\tkz@xa pt,\tkz@xb pt) $) coordinate (#3); +} + +%<--------------------------------------------------------------------------–> +% 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 !!! %<--------------------------------------------------------------------------–> +\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 +%<--------------------------------------------------------------------------–> + +\endinput diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-segments.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-segments.tex new file mode 100644 index 00000000000..f8ad21b85b9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-obj-segments.tex @@ -0,0 +1,142 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + +%<--------------------------------------------------------------------------–> +% Setup Segment +%<--------------------------------------------------------------------------–> + +%<--------------------------------------------------------------------------–> +% draw segment (s) +%<--------------------------------------------------------------------------–> +\def\tkzDrawSegment{\pgfutil@ifnextchar[{\tkz@DrawSegment}{% + \tkz@DrawSegment[]}} +\def\tkz@DrawSegment[#1](#2,#3){% +\begingroup + \draw[line style,add=0 and 0,#1] (#2) to (#3); +\endgroup +}% + +\def\tkz@multiDrawSeg#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzDrawSegment[\tkz@optseg](#1)}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +\def\tkzDrawSegments{\pgfutil@ifnextchar[{\tkz@DrawSegments}{% + \tkz@DrawSegments[]}} +\def\tkz@DrawSegments[#1](#2){% +\global\edef\tkz@optseg{#1} +\begingroup + \let\next\tkz@multiDrawSeg + \next#2 \@nil % +\endgroup +} +%<-------------------------------------------------------------------------–> +%<-------------------------------------------------------------------------–> +\pgfkeys{tkzmarkoptions/.cd, +pos/.code = {\global\def\tkz@mkpos{#1}}, +color/.code = {\global\def\tkz@mkcolor{#1}}, +mark/.code = {\global\def\tkz@mark{#1}}, +size/.code = {\global\def\tkz@mksize{#1}}, +/tkzmarkoptions/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1} + } +} + +\def\tkzMarkSegment{\pgfutil@ifnextchar[{\tkz@MarkSegment}{% + \tkz@MarkSegment[]}} +\def\tkz@MarkSegment[#1](#2,#3){% +\pgfkeys{tkzmarkoptions/.cd, + size = 4pt, + color = \tkz@mk@color, + pos = .5, + mark = none} +\pgfqkeys{/tkzmarkoptions}{#1} + +\global\def\tkz@mymark{% + \pgfsetplotmarksize{\tkz@mksize} + \pgfuseplotmark{\tkz@mark} +} +\begin{scope} [decoration={ markings,mark=at position \tkz@mkpos with \tkz@mymark}] +\path [\tkz@mkcolor,postaction={decorate}] (#2) -- (#3); +\end{scope} +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% multiple +\def\tkz@multiMS#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzMarkSegment[\tkz@optsg](#1)}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +%<--------------------------------------------------------------------------–> +\def\tkzMarkSegments{\pgfutil@ifnextchar[{\tkz@MarkSegments}{% + \tkz@MarkSegments[]}} +\def\tkz@MarkSegments[#1](#2){% +\global\edef\tkz@optsg{#1} + \begingroup + \let\next\tkz@multiMS + \next#2 \@nil % +\endgroup +} +%<--------------------------------------------------------------------------–> +%<------------------------- Label on segment -------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzLabelSegment{\pgfutil@ifnextchar[{\tkz@LabelSegment}{% + \tkz@LabelSegment[]}} +\def\tkz@LabelSegment[#1](#2,#3)#4{% +\begingroup +\path (#2) to node[above,#1]{#4} (#3) ; +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% multiple +\def\tkz@multiLS#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzLabelSegment[\tkz@optls](#1){\tkz@labelseg}}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +%<--------------------------------------------------------------------------–> +\def\tkzLabelSegments{\pgfutil@ifnextchar[{\tkz@LabelSegments}{% + \tkz@LabelSegments[]}} +\def\tkz@LabelSegments[#1](#2)#3{% +\global\edef\tkz@optls{#1} +\global\def\tkz@labelseg{#3} + \begingroup + \let\next\tkz@multiLS + \next#2 \@nil % +\endgroup +} +%<--------------------------------------------------------------------------–> +% PolySeg +%<--------------------------------------------------------------------------–> +\def\tkzDrawPolySeg{\pgfutil@ifnextchar[{\tkz@DrawPolySeg}{% + \tkz@DrawPolySeg[]}} +\def\tkz@DrawPolySeg[#1](#2,#3){% +\begingroup +\draw[#1] (#2) + \foreach \tkz@pt in {#3}{--(\tkz@pt)};% +\endgroup +} +\endinput diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-arith.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-arith.tex new file mode 100644 index 00000000000..8c087c45479 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-arith.tex @@ -0,0 +1,212 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + +%<--------------------------------------------------------------------------–> +% Objet : tools for arithmetic +%<--------------------------------------------------------------------------–> +% [About integers numbers] +%<--------------------------------------------------------------------------–> +\ProvidesFile{tkz-tool-arith.tex}[tkz-tool-arith 1.13 c] +\edef\tkzAtCode{\the\catcode`\@} +\catcode`\@=11\relax +%<--------------------------------------------------------------------------–> +% arithmetic tools +%<--------------------------------------------------------------------------–> + +\tkzutil@ifundefined{pgfmath@function@gcd}{% +\pgfmathdeclarefunction{gcd}{2}{% + \begingroup% + \pgfmathcontinuelooptrue + \pgfmath@xa=#1pt\relax% + \pgfmath@xb=#2pt\relax% + \ifdim\pgfmath@xa=0pt \pgfmathcontinueloopfalse + \pgfmath@xa=\pgfmath@xb + \fi + \ifdim\pgfmath@xb=0pt \pgfmathcontinueloopfalse + \pgfmath@xb=\pgfmath@xa + \fi +\loop +\ifpgfmathcontinueloop + \ifdim \pgfmath@xa=\pgfmath@xb\pgfmathcontinueloopfalse + \else + \ifdim \pgfmath@xa>\pgfmath@xb + \advance \pgfmath@xa by-\pgfmath@xb + \else + \advance \pgfmath@xb by-\pgfmath@xa + \fi + \fi + \repeat + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@xa}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +}{} +%<---------------------------------------------------------------------------> + +\tkzutil@ifundefined{pgfmath@function@isprime}{% +\newif\ifpgf@unknown +\newif\ifpgf@isaprime +\pgfmathdeclarefunction{isprime}{1}{% + \begingroup% +\pgf@unknowntrue +\c@pgfmath@counta#1\relax% + \ifcase#1\relax + % |#1| = 0 + \pgf@isaprimefalse\pgf@unknownfalse + \or + % |#1| = 1 + \pgf@isaprimefalse\pgf@unknownfalse + \or +% |#1| = 2 + \pgf@isaprimetrue\pgf@unknownfalse + \or +% |#1| = 3 + \pgf@isaprimetrue\pgf@unknownfalse + \else + % |#1| > 3 + \ifodd#1\relax + \else + \pgf@isaprimefalse\pgf@unknownfalse + \fi + \fi +\ifpgf@unknown +\c@pgfmath@countd=\thr@@ \pgf@isaprimetrue + \loop + \c@pgfmath@countb=\c@pgfmath@counta + \divide\c@pgfmath@countb by\c@pgfmath@countd + \ifnum\c@pgfmath@countb>\c@pgfmath@countd \pgf@unknowntrue + \else\pgf@unknownfalse\fi + \multiply\c@pgfmath@countb by\c@pgfmath@countd + \ifnum\c@pgfmath@countb=\c@pgfmath@counta + \global\pgf@isaprimefalse\pgf@unknownfalse\fi + \ifpgf@unknown\advance\c@pgfmath@countd by 2\relax% + \repeat +\fi +\ifpgf@isaprime + \def\pgfmathresult{1}% +\else + \def\pgfmathresult{0}% +\fi + \pgfmath@smuggleone\pgfmathresult% +\endgroup +}}{} +%<---------------------------------------------------------------------------> +\tkzutil@ifundefined{pgfmath@function@isodd}{% +\pgfmathdeclarefunction{isodd}{1}{% +\begingroup +\ifodd #1 \def\pgfmathresult{1}% +\else\def\pgfmathresult{0}% +\fi + \pgfmath@smuggleone\pgfmathresult% +\endgroup} +}{} +%<---------------------------------------------------------------------------> +\pgfmathdeclarefunction{isfactor}{2}{% +\begingroup +\c@pgfmath@counta#1\relax% +\c@pgfmath@countb#2\relax% +\c@pgfmath@countc#1\relax% +\divide\c@pgfmath@counta by\c@pgfmath@countb% +\multiply\c@pgfmath@counta by\c@pgfmath@countb% +\advance\c@pgfmath@countc by-\c@pgfmath@counta% +\ifnum\c@pgfmath@countc=0 \def\pgfmathresult{1}% +\else + \def\pgfmathresult{0}% + \fi +\pgfmath@smuggleone\pgfmathresult% +\endgroup} +%<---------------------------------------------------------------------------> +\def\tkzfactors#1{% +\begingroup +\c@pgfmath@countb#1 +\pgfmathisprime{\c@pgfmath@countb}% +\ifnum\pgfmathresult=1 + \number\c@pgfmath@countb\ % prime number +\else% we can found factors +\tkz@factors{#1} +\fi +\endgroup}% +%<--------------------------------------------------------------------------–> +\def\tkz@factors#1{% +\begingroup +\c@pgfmath@countb#1 +\c@pgfmath@countd2\relax + \loop + \ifodd\c@pgfmath@countb\relax% + \else + \divide\c@pgfmath@countb by2 % + \number\c@pgfmath@countd\ % + \repeat% +%%%%%%%%%%%%%% +\def\tkzprim@last{1}% +\loop% first loop + \ifnum\c@pgfmath@countb>1\relax + \c@pgfmath@countd\tkzprim@last\relax + \c@pgfmath@countc1\relax +%%%%%%%%%%%%%% +\tkz@find@last +%%%%%%%%%%%%%% + \divide\c@pgfmath@countb by\c@pgfmath@countd\relax + \number\c@pgfmath@countd\ % affiche le facteur +\repeat% end first loop +%%%%%%%%%%%%%% +\endgroup% +}% +%<---------------------------------------------------------------------------> +\def\tkz@find@last{% + \ifnum\c@pgfmath@countc>\z@ + \edef\tkzprim@last{\the\c@pgfmath@countd}% + \advance\c@pgfmath@countd by2\relax% begins with 3 + \c@pgfmath@counta\c@pgfmath@countb% macro mod !! + \c@pgfmath@countc\c@pgfmath@counta% + \divide\c@pgfmath@counta by\c@pgfmath@countd + \multiply\c@pgfmath@counta by\c@pgfmath@countd + \advance\c@pgfmath@countc by-\c@pgfmath@counta + \let\tkz@find@next=\tkz@find@last + \else + \let\tkz@find@next=\relax% + \fi + \tkz@find@next +}% +%<---------------------------------------------------------------------------> +%<---------------------------------------------------------------------------> +\def\tkzReducFrac#1#2{% +\begingroup +\ifnum#1<0\relax% + \c@pgfmath@counta=0\relax + \advance\c@pgfmath@counta by-#1 + \else + \c@pgfmath@counta#1 + \fi + \c@pgfmath@countb#2 + \pgfmathgcd{\c@pgfmath@counta}{\c@pgfmath@countb}% + \pgfmathsetcount\c@pgfmath@countc{\pgfmathresult} + \ifnum\c@pgfmath@counta=0\relax + \c@pgfmath@counta#1 + \c@pgfmath@countb#2 + \else + \c@pgfmath@counta#1 + \c@pgfmath@countb#2 + \divide\c@pgfmath@counta by\c@pgfmath@countc% + \divide\c@pgfmath@countb by\c@pgfmath@countc% + \fi +\global\edef\tkzMathFirstResult{\the\c@pgfmath@counta} +\global\edef\tkzMathSecondResult{\the\c@pgfmath@countb} +\endgroup} +%<---------------------------------------------------------------------------> +%<---------------------------------------------------------------------------> +%<---------------------------------------------------------------------------> + +\catcode`\@=\tkzAtCode\relax +\endinput + + diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-base.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-base.tex new file mode 100644 index 00000000000..7da17a198a4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-base.tex @@ -0,0 +1,700 @@ +% tkz-tools-base.tex +% Copyright 2011 by Alain Matthes +% This file may be distributed and/or modified +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +% utf8 encoding + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + +%<--------------------------------------------------------------------------–> +\global\let\@xa\tkz@init@xmin +\global\let\@xb\tkz@init@xmax +\global\let\@ya\tkz@init@ymin +\global\let\@yb\tkz@init@ymax +%<--------------------------------------------------------------------------–> +\gdef\xgrad{1} +\gdef\ygrad{1} +\gdef\tkz@xa{0} +\gdef\tkz@xb{10} +\gdef\tkz@ya{0} +\gdef\tkz@yb{10} +\newif\iftkz@init@NO +\pgfkeys{ + /tkzInit/.cd, + xmin/.code = {\def\tkz@init@xmin{#1}}, + xmax/.code = {\def\tkz@init@xmax{#1}}, + xstep/.code = {\def\tkz@init@xstep{#1}}, + ymin/.code = {\def\tkz@init@ymin{#1}}, + ymax/.code = {\def\tkz@init@ymax{#1}}, + ystep/.code = {\def\tkz@init@ystep{#1}}, + NO/.is if = tkz@init@NO, + NO/.default = true } + +\def\tkzInit{\pgfutil@ifnextchar[{\tkz@Init}{\tkz@Init[]}} +\def\tkz@Init[#1]{% +\pgfkeys{/tkzInit/.cd, + xmin = 0, + xmax = 10, + xstep = 1, + ymin = 0, + ymax = 10, + ystep = 1, + NO = false +} + \pgfqkeys{/tkzInit}{#1} + \ifx\tkzfctloaded\undefined + \else + \tkz@tkzf@fct=0 % only if tkz-fct loaded + \fi + \xdef\tkz@init@xorigine{0} + \xdef\tkz@init@yorigine{0} + \FPsgn\@xsgmin{\tkz@init@xmin} + \FPsgn\@xsgmax{\tkz@init@xmax} + \FPsgn\@ysgmin{\tkz@init@ymin} + \FPsgn\@ysgmax{\tkz@init@ymax} + \global\let\@xa\tkz@init@xmin + \global\let\@xb\tkz@init@xmax + \global\let\@ya\tkz@init@ymin + \global\let\@yb\tkz@init@ymax + \tkz@init@NOfalse + \ifx\@xsgmin\@xsgmax \tkz@init@NOtrue \fi + \ifx\@ysgmin\@ysgmax \tkz@init@NOtrue \fi + \iftkz@init@NO% + \ifx\@xsgmin\@xsgmax + \FPadd{\tkz@init@xmax}{\tkz@init@xmax}{-\tkz@init@xmin}% + \edef\tkz@init@xorigine{\tkz@init@xmin} + \edef\tkz@init@xmin{0} + \fi + + \ifx\@ysgmin\@ysgmax + \FPadd{\tkz@init@ymax}{\tkz@init@ymax}{-\tkz@init@ymin}% + \edef\tkz@init@yorigine{\tkz@init@ymin} + \edef\tkz@init@ymin{0} + \fi + \fi + \FPdiv{\tkz@xa}{\tkz@init@xmin}{\tkz@init@xstep} + \FPdiv{\tkz@xb}{\tkz@init@xmax}{\tkz@init@xstep} + \FPdiv{\tkz@ya}{\tkz@init@ymin}{\tkz@init@ystep} + \FPdiv{\tkz@yb}{\tkz@init@ymax}{\tkz@init@ystep} + \tkz@getdecimal{\tkz@init@xstep} % amélioration nb dec et integer + \global\edef\tkz@init@xdec{\number\c@pgfmath@countb} + \tkz@getdecimal{\tkz@init@ystep} + \global\edef\tkz@init@ydec{\number\c@pgfmath@countb} +}% +%<--------------------------------------------------------------------------–> +\pgfkeys{Clip/.cd, space/.code = {\def\tkz@CLI@space{#1}}} + +\def\tkzClip{\pgfutil@ifnextchar[{\tkz@Clip}{\tkz@Clip[]}} +\def\tkz@Clip[#1]{% +\pgfkeys{Clip/.cd,space = {}} +\pgfqkeys{/Clip}{#1} +\ifx\tkzutil@empty\tkz@CLI@space + \clip (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb); + \else + \FPadd{\tkz@xxa}{\tkz@xa}{-\tkz@CLI@space} + \FPadd{\tkz@yya}{\tkz@ya}{-\tkz@CLI@space} + \FPadd{\tkz@xxb}{\tkz@xb}{\tkz@CLI@space} + \FPadd{\tkz@yyb}{\tkz@yb}{\tkz@CLI@space} + \clip (\tkz@xxa,\tkz@yya) rectangle (\tkz@xxb,\tkz@yyb); +\fi +} +%todo add options +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkz@showgrad#1{% +\FPifint{#1}\FPtrunc\tkz@result{#1}{0}\else\FPset\tkz@result{#1}\fi}% + +\def\tkz@Xresult{% +\tkz@showgrad{\xgrad}% + $\numprint{\tkz@result}$% +}% +%<--------------------------------------------------------------------------–> +\def\tkz@Yresult{% +\tkz@showgrad{\ygrad}% +$\numprint{\tkz@result}$ +}% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkz@Xshowgradresult{% +\iftkz@X@orig +\tkz@Xresult% +\else % orig + \iftkz@init@NO% + \unless\ifx\tkz@pos\tkz@posmin + \tkz@Xresult\fi + \else % NO + \unless\ifx\tkz@pos\x@tkzero% + \tkz@Xresult + \fi%end of x@tkzero + \fi%end of NO +\fi%end of orig +}% +%<--------------------------------------------------------------------------–> +\def\tkz@Yshowgradresult{% +\iftkz@Y@orig +\tkz@Yresult% +\else % orig + \iftkz@init@NO% + \unless\ifx\tkz@pos\tkz@posmin + \tkz@Yresult\fi + \else % NO + \unless\ifx\tkz@pos\y@tkzero% + \tkz@Yresult + \fi%end of x@tkzero + \fi%end of NO +\fi%end of orig +}% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkz@Xshowgrad{% +\iftkz@X@orig +\tkzprintfrac% +\else % orig + \iftkz@init@NO% + \unless\ifx\tz@pos\tkz@posmin + \tkzprintfrac\fi + \else % NO + \unless\ifx\tz@pos\x@tkzero% + \tkzprintfrac + \fi%end of x@tkzero + \fi%end of NO +\fi%end of orig +}% +%<--------------------------------------------------------------------------–> +\def\tkz@Yshowgrad{% +\iftkz@Y@orig +\tkzprintfrac% +\else % orig + \iftkz@init@NO% + \unless\ifx\tz@pos\tkz@posmin + \tkzprintfrac\fi + \else % NO + \unless\ifx\tz@pos\y@tkzero% + \tkzprintfrac + \fi%end of x@tkzero + \fi%end of NO +\fi%end of orig +}% + +%<--------------------------------------------------------------------------–> +% Setup axe +%<--------------------------------------------------------------------------–> +\pgfkeys{tkzaxis/.cd, +line width/.code = {\global\edef\tkz@sua@lw{#1}}, +color/.code = {\global\edef\tkz@sua@color{#1}}, +tickwd/.code = {\global\edef\tkz@sua@tickwd{#1}}, +ticka/.code = {\global\edef\tkz@sua@ticka{#1}}, +tickb/.code = {\global\edef\tkz@sua@tickb{#1}} +} + +\def\tkzSetUpAxis{\pgfutil@ifnextchar[{\tkz@SetUpAxis}{\tkz@SetUpAxis[]}} +\def\tkz@SetUpAxis[#1]{% +\begingroup + \pgfkeys{/tkzaxis/.cd, + line width = \tkz@init@lw, + color = \tkz@init@color, + tickwd = \tkz@init@tickwd, + ticka = \tkz@init@ticka, + tickb = \tkz@init@tickb + } +\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 +%<--------------------------------------------------------------------------–> +\pgfkeys{% prob avec space +tkzdrawX/.cd, +color/.code = {\global\def\tkz@X@color{#1}}, +label/.code = {\global\def\tkz@X@label{#1}}, +right space/.code = {\global\def\tkz@axe@rxspace{#1}}, +left space/.code = {\global\def\tkz@axe@lxspace{#1}}, +noticks/.is if = tkz@X@noticks, +noticks/.default = true, +trig/.code = {\global\def\tkz@X@trig{#1}}, +step/.code = {\FPeval\tkz@posnext{#1}}, +tickwd/.code = {\global\def\tkz@X@tickwd{#1}}, +tickup/.code = {\global\def\tkz@X@tickup{#1}}, +tickdn/.code = {\global\def\tkz@X@tickdn{#1}}, +/tkzdrawX/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + +\def\tkzDrawX{\pgfutil@ifnextchar[{\tkz@DrawX}{\tkz@DrawX[]}} +\def\tkz@DrawX[#1]{ +\begingroup% +\pgfkeys{/tkzdrawX/.cd, +color = \tkz@init@color, +label = \tkz@init@xlabel, +trig = 0, +step = \tkz@init@xstep, +right space = \tkz@init@rightspace, +left space = \tkz@init@leftspace, +noticks = false, +tickwd = \tkz@init@tickwd, +tickup = \tkz@init@ticka, +tickdn = \tkz@init@tickb} +\pgfqkeys{/tkzdrawX}{#1} +\FPtrunc\tkz@posmax{\tkz@xb}{\tkz@init@xdec} +\FPtrunc\tkz@posmin{\tkz@xa}{\tkz@init@xdec} +\FPadd\tkz@xbsup{\tkz@xb}{\tkz@axe@rxspace} +\FPadd\tkz@xainf{\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 + \ifnum\tkz@X@trig=0 + \FPtrunc\tkz@posmax{\tkz@posmax}{\tkz@init@xdec}% + \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@xstep} + \FPadd\tz@posnext{\tkz@posmin}{\tkz@posnext} + \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% + \draw[color = \tkz@X@color, + line width = \tkz@X@tickwd, + shift = {(\tz@pos,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn);} + \else + \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% + \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}% + \FPmul\tkz@posmax{\tkz@posmax}{\tkz@X@trig}% + \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}% + \FPmul\tkz@posmin{\tkz@posmin}{\tkz@X@trig}% + \FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \FPmul\tz@pospi{\tz@pos}{\FPpi} + \FPdiv\tz@pospi{\tz@pospi}{\tkz@X@trig}% + \draw[color = \tkz@X@color, + line width = \tkz@X@tickwd,% + shift = {(\tz@pospi,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn); + }% end foreach + \fi + \fi +\endgroup} +%<--------------------------------------------------------------------------–> +\pgfkeys{% prob avec space +tkzAxeX/.cd, +color/.code = {\def\tkz@X@color{#1}}, +label/.code = {\global\def\tkz@X@label{#1}}, +frac/.code = {\def\tkzX@frac{#1}}, +trig/.code = {\def\tkzX@trig{#1}}, +/tkzAxeX/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + +\def\tkzAxeX{\pgfutil@ifnextchar[{\tkz@AxeX}{\tkz@AxeX[]}} +\def\tkz@AxeX[#1]{% +\begingroup +\tkzLabelX[#1] \tkzDrawX[#1] +\endgroup +} + + +%<--------------------------------------------------------------------------–> +% tkzDrawY todo améliorer les unités +%<--------------------------------------------------------------------------–> +\pgfkeys{% prob avec space +tkzdrawY/.cd, +color/.code = {\def\tkz@Y@color{#1}}, +label/.code = {\def\tkz@Y@label{#1}}, +up space/.code = {\global\def\tkz@axe@uyspace{#1}}, +down space/.code = {\global\def\tkz@axe@dyspace{#1}}, +noticks/.is if = tkz@Y@noticks, +noticks/.default = true, +trig/.code = {\global\def\tkz@Y@trig{#1}}, +step/.code = {\FPeval\tkz@posnext{#1}}, +tickwd/.code = {\global\def\tkz@Y@tickwd{#1}}, +ticklt/.code = {\global\def\tkz@Y@ticklt{#1}}, +tickrt/.code = {\global\def\tkz@Y@tickrt{#1}}, +/tkzdrawY/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + +\def\tkzDrawY{\pgfutil@ifnextchar[{\tkz@DrawY}{\tkz@DrawY[]}} +\def\tkz@DrawY[#1]{% +\begingroup +\pgfkeys{/tkzdrawY/.cd, +color = \tkz@init@color, +label = \tkz@init@ylabel, +trig = 0, +step = \tkz@init@ystep, +up space = \tkz@init@upspace, +down space = \tkz@init@downspace, +noticks = false, +tickwd = \tkz@init@tickwd, +ticklt = \tkz@init@tickb, +tickrt = \tkz@init@ticka} +\pgfqkeys{/tkzdrawY}{#1} +\FPtrunc\tkz@posmax{\tkz@yb}{\tkz@init@ydec} +\FPtrunc\tkz@posmin{\tkz@ya}{\tkz@init@ydec} +\FPadd\tkz@ybsup{\tkz@yb}{\tkz@axe@uyspace} +\FPadd\tkz@yainf{\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 + \ifnum\tkz@Y@trig=0 + \FPtrunc\tkz@posmax{\tkz@posmax}{\tkz@init@ydec}% + \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@ystep} + \FPadd\tz@posnext{\tkz@posmin}{\tkz@posnext} + \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% + \draw[color = \tkz@Y@color, + line width = \tkz@Y@tickwd, + shift = {(0,\tz@pos)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);} + \else + \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% + \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}% + \FPmul\tkz@posmax{\tkz@posmax}{\tkz@Y@trig}% + \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}% + \FPmul\tkz@posmin{\tkz@posmin}{\tkz@Y@trig}% + \FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \FPmul\tz@pospi{\tz@pos}{\FPpi} + \FPdiv\tz@pospi{\tz@pospi}{\tkz@Y@trig}% + \draw[color = \tkz@Y@color, + line width = \tkz@Y@tickwd,% + shift = {(0,\tz@pospi)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt); + }% end foreach + \fi + \fi +\endgroup} +%<---------------------------------------------------------------------------> +\newif\iftkz@np +\pgfkeys{% prob avec space +tkzlabelX/.cd, +frac/.code = {\def\tkz@X@frac{#1}}, +trig/.code = {\def\tkz@X@trig{#1}}, +step/.code = {\def\tkz@posnext{#1}}, +label options/.code = {\def\cmd@X@option{#1}}, +np off/.is if = tkz@np, +np off/.default = true, +orig/.is if = tkz@X@orig, +orig/.default = false, +tickwd/.code = {\global\def\tkz@X@tickwd{#1}}, +tickup/.code = {\global\def\tkz@X@tickup{#1}}, +tickdn/.code = {\global\def\tkz@X@tickdn{#1}}, +/tkzlabelX/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + \def\tkzLabelX{\pgfutil@ifnextchar[{\tkz@LabelX}{\tkz@LabelX[]}} +\def\tkz@LabelX[#1]{% +\begingroup +\pgfkeys{/tkzlabelX/.cd, +frac = 0, +trig = 0, +step = \tkz@init@xstep, +np off = false, +orig = true, +label options = {}, +tickwd = \tkz@init@tickwd, +tickup = \tkz@init@ticka, +tickdn = \tkz@init@tickb} +\pgfqkeys{/tkzlabelX}{#1} +\iftkz@np\let\numprint@saved\numprint % +\let\numprint\relax\fi % + +\FPtrunc\tkz@posmin{\tkz@xa}{\tkz@init@xdec}% +\FPtrunc\tkz@posmax{\tkz@xb}{\tkz@init@xdec}% +\FPtrunc\x@tkzero{0.0000000}{\tkz@init@xdec}% + +\ifnum\tkz@X@frac=0 % + \ifnum\tkz@X@trig=0 % affichage normal + \FPdiv\tz@posnext{\tkz@posnext}{\tkz@init@xstep} + \FPadd\tz@posnext{\tkz@posmin}{\tz@posnext} + \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% + \FPtrunc\tkz@pos{\tz@pos}{\tkz@init@xdec}% + \FPmul{\xgrad}{\tz@pos}{\tkz@init@xstep}% + \FPadd{\xgrad}{\xgrad}{\tkz@init@xorigine}% + \FPtrunc\xgrad{\xgrad}{\tkz@init@xdec}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(\tz@pos,0)}] + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)% + node[xlabel style,% + fill = \tkz@fillcolor, + \cmd@X@option]}\tkz@temp{\tkz@Xshowgradresult}; +}% + \else% trig > 0 + \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% + \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}% + \FPmul\tkz@posmax{\tkz@posmax}{\tkz@X@trig}% + \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}% + \FPmul\tkz@posmin{\tkz@posmin}{\tkz@X@trig}% + \FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \tkzPrintFracWithPi{\tz@pos}{\tkz@X@trig} + \FPmul\tz@pospi{\tz@pos}{\FPpi} + \FPdiv\tz@pospi{\tz@pospi}{\tkz@X@trig}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(\tz@pospi,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)% + node[xlabel style, + text height = 8pt, + fill = \tkz@fillcolor, + \cmd@X@option]}\tkz@temp{\tkz@Xshowgrad};% + }% end foreach + \fi +\else% frac > 0 +\FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \tkzPrintFrac{\tz@pos}{\tkz@X@frac}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(\tz@pos,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)% + node[xlabel style, + text height = 8pt, + fill = \tkz@fillcolor, + \cmd@X@option]}\tkz@temp{\tkz@Xshowgrad}% + ;% + }% end foreach +\fi + \iftkz@np\let\numprint\numprint@saved \fi% +\endgroup +} + +%<---------------------------------------------------------------------------> +\pgfkeys{% prob avec space +tkzticksY/.cd, +frac/.code = {\def\tkz@Y@frac{#1}}, +trig/.code = {\def\tkz@Y@trig{#1}}, +step/.code = {\def\tkz@posnext{#1}}, +label options/.code = {\def\cmd@Y@option{#1}}, +np off/.is if = tkz@np, +np off/.default = true, +orig/.is if = tkz@Y@orig, +orig/.default = false, +tickwd/.code = {\global\def\tkz@Y@tickwd{#1}}, +ticklt/.code = {\global\def\tkz@Y@ticklt{#1}}, +tickrt/.code = {\global\def\tkz@Y@tickrt{#1}}, +/tkzticksY/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + \def\tkzLabelY{\pgfutil@ifnextchar[{\tkz@LabelY}{\tkz@LabelY[]}} +\def\tkz@LabelY[#1]{% +\begingroup +\pgfkeys{/tkzticksY/.cd, +frac = 0, +trig = 0, +step = \tkz@init@ystep, +np off = false, +orig = true, +label options = {}, +tickwd = \tkz@init@tickwd, +ticklt = \tkz@init@tickb, +tickrt = \tkz@init@ticka} +\pgfqkeys{/tkzticksY}{#1} +\iftkz@np\let\numprint@saved\numprint % +\let\numprint\relax\fi % + +\FPtrunc\tkz@posmin{\tkz@ya}{\tkz@init@ydec}% +\FPtrunc\tkz@posmax{\tkz@yb}{\tkz@init@ydec}% +\FPtrunc\y@tkzero{0.0000000}{\tkz@init@ydec}% + +\ifnum\tkz@Y@frac=0 + \ifnum\tkz@Y@trig=0 % affichage normal + \FPdiv\tz@posnext{\tkz@posnext}{\tkz@init@ystep} + \FPadd\tz@posnext{\tkz@posmin}{\tz@posnext} + \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% + \FPtrunc\tkz@pos{\tz@pos}{\tkz@init@ydec}% + \FPmul{\ygrad}{\tz@pos}{\tkz@init@ystep}% + \FPadd{\ygrad}{\ygrad}{\tkz@init@yorigine}% + \FPtrunc\ygrad{\ygrad}{\tkz@init@ydec}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(0,\tz@pos)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)% + node[ylabel style, + fill = \tkz@fillcolor, + \cmd@Y@option]}\tkz@temp{\tkz@Yshowgradresult}; +} + \else% trig > 0 + \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% + \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}% + \FPmul\tkz@posmax{\tkz@posmax}{\tkz@Y@trig}% + \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}% + \FPmul\tkz@posmin{\tkz@posmin}{\tkz@Y@trig}% + \FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \tkzPrintFracWithPi{\tz@pos}{\tkz@Y@trig} + \FPmul\tz@pospi{\tz@pos}{\FPpi} + \FPdiv\tz@pospi{\tz@pospi}{\tkz@Y@trig}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(0,\tz@pospi)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)% + node[ylabel style, + text height = 8pt, + fill = \tkz@fillcolor, + \cmd@Y@option]}\tkz@temp{\tkz@Yshowgrad};% + }% end foreach + \fi +\else% frac > 0 +\FPround\tkz@posmin{\tkz@posmin}{0}% + \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% + \tkzPrintFrac{\tz@pos}{\tkz@Y@frac}% + \protected@edef\tkz@temp{% + \noexpand\path[shift = {(0,\tz@pos)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)% + node[ylabel style, + text height = 8pt, + fill = \tkz@fillcolor, + \cmd@Y@option]}\tkz@temp{\tkz@Yshowgrad}% + ;% + }% end foreach +\fi + \iftkz@np\let\numprint\numprint@saved \fi% +\endgroup} +%<--------------------------------------------------------------------------–> +\def\tkzAxeY{\pgfutil@ifnextchar[{\tkz@AxeY}{\tkz@AxeY[]}} +\def\tkz@AxeY[#1]{% +\begingroup + \tkzDrawY[#1] \tkzLabelY[#1] +\endgroup} +%<--------------------------------------------------------------------------> +\newif\if@tkz@swap +\pgfkeys{% prob avec space + tkzAxeXY/.cd, + swap/.is if = @tkz@swap, + swap/.default = true, + /tkzAxeXY/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + +\def\tkzAxeXY{\pgfutil@ifnextchar[{\tkzAxe@XY}{\tkzAxe@XY[]}} +\def\tkzAxe@XY[#1]{% +\pgfkeys{ + /tkzAxeXY/.cd, + swap = false} +\pgfqkeys{/tkzAxeXY}{#1} +\if@tkz@swap +\tkzLabelX[#1]\tkzLabelY[#1]\tkzDrawX[#1]\tkzDrawY[#1] +\else +\tkzDrawX[#1]\tkzDrawY[#1]\tkzLabelX[#1]\tkzLabelY[#1] +\fi} +\def\tkzDrawXY{\pgfutil@ifnextchar[{\tkzDraw@XY}{\tkzDraw@XY[]}} +\def\tkzDraw@XY[#1]{\tkzDrawX[#1]\tkzDrawY[#1]} +\def\tkzLabelXY{\pgfutil@ifnextchar[{\tkzLabel@XY}{\tkzLabel@XY[]}} +\def\tkzLabel@XY[#1]{\tkzLabelX[#1]\tkzLabelY[#1]} +%<--------------------------------------------------------------------------–> +% grid +%<--------------------------------------------------------------------------–> +\newif\if@tkz@gd@sub +\def\tkzRatioLineGrid{0.75} +\def\tkz@gd@sublw{0.4 pt} + + +\pgfkeys{ + /tkzGrid/.cd, + color/.code = {\def\tkz@gd@color{#1}% + \edef\tkz@gd@subcolor{% + \tkz@gd@color!\tkzCoeffSubColor}}, + subxstep/.code = {\def\tkz@gd@subxstep{#1}}, + subystep/.code = {\def\tkz@gd@subystep{#1}}, + ratio/.code = {\def\tkz@gd@ratio{#1}}, + 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 , + /tkzGrid/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} + +\def\tkzGrid{\pgfutil@ifnextchar[{\tkz@Grid}{\tkz@Grid[]}} +\def\tkz@Grid[#1]{\@ifnextchar({\tkz@@Grid[#1]}% + {\tkz@@Grid[#1](\@xa,\@ya)(\@xb,\@yb)}} +\def\tkz@@Grid[#1](#2,#3)(#4,#5){% +\pgfkeys{ + /tkzGrid/.cd, + sub = false, + color = \tkz@grid@color, + ratio = 0.75, + subxstep = \tkz@grid@xstep, + subystep = \tkz@grid@ystep, + line width = \tkz@grid@lw} + \pgfqkeys{/tkzGrid}{#1} + \begingroup + \FPadd{\tkz@gxa}{#2}{-\tkz@init@xorigine} + \FPadd{\tkz@gxb}{#4}{-\tkz@init@xorigine} + \FPadd{\tkz@gya}{#3}{-\tkz@init@yorigine} + \FPadd{\tkz@gyb}{#5}{-\tkz@init@yorigine} + \FPdiv{\tkz@gxa}{\tkz@gxa}{\tkz@init@xstep} + \FPdiv{\tkz@gya}{\tkz@gya}{\tkz@init@ystep} + \FPdiv{\tkz@gxb}{\tkz@gxb}{\tkz@init@xstep} + \FPdiv{\tkz@gyb}{\tkz@gyb}{\tkz@init@ystep} + \if@tkz@gd@sub% + \FPeval\@subxstep{\tkz@gd@subxstep/\tkz@init@xstep}% + \FPeval\@subystep{\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 +}% +%<--------------------------------------------------------------------------–> +% repère +%<--------------------------------------------------------------------------–> + +\newif\iftkz@Rep@orig +\pgfkeys{ + /tkzRep/.cd, + line width/.code = {\def\tkz@Rep@lw{#1}}, + xlabel/.code = {\def\tkz@Rep@xlabel{#1}}, + ylabel/.code = {\def\tkz@Rep@ylabel{#1}}, + posxlabel/.code = {\def\tkz@Rep@posxlabel{#1}}, + posylabel/.code = {\def\tkz@Rep@posylabel{#1}}, + xnorm/.code = {\def\tkz@Rep@xnorm{#1}}, + ynorm/.code = {\def\tkz@Rep@ynorm{#1}}, + color/.code = {\def\tkz@Rep@color{#1}}, + colorlabel/.code = {\def\tkz@Rep@colorlabel{#1}}} + % /tkzRep/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + % \pgfkeysalso{\searchname/.try=#1, + % /tikz/\searchname/.retry=#1}}} +%<--------------------------------------------------------------------------–> +\def\tkzRep{\pgfutil@ifnextchar[{\tkz@Rep}{% + \tkz@Rep[]}} +\def\tkz@Rep[#1]{% +\pgfkeys{ + /tkzRep/.cd, +line width = \tkz@sur@lw, +xlabel = $\vec{\imath}$, +ylabel = $\vec{\jmath}$, +posxlabel = {\tkz@sur@posxlabel}, +posylabel = {\tkz@sur@posylabel}, +xnorm = 1, +ynorm = 1, +color = \tkz@sur@color,% remove ? +colorlabel = \tkz@sur@colorlabel}% remove ? +\pgfqkeys{/tkzRep}{#1} +\begingroup + \protected@edef\tkz@temp{% + \noexpand\draw [line width=\tkz@Rep@lw,color=\tkz@Rep@color,rep style]% + (0,0) to node[\tkz@Rep@posylabel,color = \tkz@Rep@colorlabel]}\tkz@temp% + {\tkz@Rep@ylabel}(0,\tkz@Rep@ynorm); + \protected@edef\tkz@temp{% + \noexpand \draw [line width=\tkz@Rep@lw,color=\tkz@Rep@color,rep style]% + (0,0) to node[\tkz@Rep@posxlabel,color = \tkz@Rep@colorlabel]}\tkz@temp% + {\tkz@Rep@xlabel}(\tkz@Rep@xnorm,0); +\endgroup +} +\def\tkzAddName{\pgfutil@ifnextchar[{\tkz@AddName}{\tkz@AddName[]}} +\def\tkz@AddName[#1]#2{% +\node[above left,#1] at (\pgf@path@lastx,\pgf@path@lasty){#2}; +}% +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-math.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-math.tex new file mode 100644 index 00000000000..fecd512c0bb --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-math.tex @@ -0,0 +1,688 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + + +% 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 ????? +%<--------------------------------------------------------------------------–> +\def\tkzDuplicateLen(#1,#2)(#3,#4){% +\begingroup + \tkzCalcLength(#1,#2)\tkzGetLength{tkz@firstlen}% + \tkzCalcLength(#3,#4)\tkzGetLength{tkz@secondlen}% + \FPdiv\tkz@ratio{\tkz@firstlen}{\tkz@secondlen}% + \tkz@VecKCoLinear[\tkz@ratio](#3,#4,#3){tkzPointResult}% +\endgroup +} +\let\tkzDuplicateSegment\tkzDuplicateLen %<--------------------------------------------------------------------------–> +% 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 ? +\def\tkzGetVectxy(#1,#2)#3{% +\begingroup +\pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% +\pgfmathparse{\pgf@sys@tonumber{\pgf@x}/28.45274}% +\global\let\tkzresultx\pgfmathresult +\pgfmathparse{\pgf@sys@tonumber{\pgf@y}/28.45274}% +\global\let\tkzresulty\pgfmathresult +\global\expandafter\edef\csname #3x\endcsname{\tkzresultx}% +\global\expandafter\edef\csname #3y\endcsname{\tkzresulty}% +\endgroup +} +\let\tkzGetVecCoord\tkzGetVectxy +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkz@numv{0} +\pgfkeys{/tkzdefv/.cd, +K/.code = {\pgfmathparse{#1}\global\def\tkz@ratio{\pgfmathresult}}, +colinear/.code args = {at #1}{\global\def\tkz@numv{0}% + \global\def\tkz@frompoint{#1}}, +orthogonal/.code = {\global\def\tkz@numv{1}}, +linear/.code = {\global\def\tkz@numv{2}}\pgfmathparse{#1}, +normed orthogonal/.code = {\global\def\tkz@numv{3}}, +normed linear/.code = {\global\def\tkz@numv{4}}, +} +\def\tkzDefVector[#1](#2,#3)#4{% +\begingroup +\pgfkeys{/tkzdefv/.cd,K=1} +\pgfqkeys{/tkzdefv}{#1} +\ifcase\tkz@numv% + % first case 0 + \tkzDefVectorfrom[\tkz@ratio](#2,#3){#4} + \or% 1 + \tkz@VecKOrth[\tkz@ratio](#2,#3){#4} + \or% 2 + \tkz@VecK[\tkz@ratio](#2,#3){#4} + \or% 3 + \tkz@VecKOrthNorm[\tkz@ratio](#2,#3){#4} + \or% 4 + \tkz@VecKCoLinear[#1](#2,#3)#4 + \fi +\endgroup +} + +\def\tkzDefVectorfrom[#1](#2,#3)#4{% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \path[coordinate](\tkz@frompoint)--+(\tkz@ratio\pgf@xa,% + \tkz@ratio\pgf@ya) coordinate (#4); +\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 #5-->N +%<--------------------------------------------------------------------------–> +\def\tkzVecKCoLinear{\pgfutil@ifnextchar[{\tkz@VecKCoLinear}{\tkz@VecKCoLinear[1]}} +\def\tkz@VecKCoLinear[#1](#2,#3,#4)#5{% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfmathparse{#1}\edef\tkz@coeff{\pgfmathresult} + \path[coordinate](#4)--+(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya)% + coordinate (#5);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% v(AN)=#1 x v(AB) +% #1 le coeff; #2--> A #3--> B #4-->N tq #4-#2 = #1*(#3-#2) +%<--------------------------------------------------------------------------–> +\pgfkeys{ + /tkzscalev/.cd, + ratio/.code = {\pgfmathparse{#1}\global\edef\tkz@ratio{\pgfmathresult}} + } +\def\tkzScaleVector{\pgfutil@ifnextchar[{\tkz@ScaleVector}{% + \tkz@ScaleVector[]}} +\def\tkz@ScaleVector[#1](#2,#3)#4{% +\begingroup +\pgfkeys{/tkzscalev/.cd,ratio=-1} +\pgfqkeys{/tkzscalev}{#1} + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \path[coordinate](#2)--++(\pgf@xa *\tkz@ratio,\pgf@ya *\tkz@ratio)% + coordinate (#4);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% 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 + +%<--------------------------------------------------------------------------–> +% 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 +%<--------------------------------------------------------------------------–> +\def\tkzVecKNorm{\pgfutil@ifnextchar[{\tkz@VecKNorm}{\tkz@VecKNorm[1]}} +\def\tkz@VecKNorm[#1](#2,#3)#4{% +\begingroup + \tkzpointnormalised{% + \pgfpointdiff{\pgfpointanchor{#2}{center}} + {\pgfpointanchor{#3}{center}}} + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + \pgfmathparse{#1}\edef\tkz@coeff{\pgfmathresult} + \FPmul\tkz@coeff{28.45274}{\tkz@coeff} + \FPmul\tkz@x{\tkz@coeff}{\pgf@sys@tonumber{\pgf@xa}} + \FPmul\tkz@y{\tkz@coeff}{\pgf@sys@tonumber{\pgf@ya}} + \path[coordinate](#2)--++(\tkz@x pt,\tkz@y pt)% + coordinate (#4);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% v(AN)=#1 x v(AB) +% #1 le coeff; #2--> A #3--> B #4-->N tq #4-#2 = #1*(#3-#2) +%<--------------------------------------------------------------------------–> +\def\tkzVecK{\pgfutil@ifnextchar[{\tkz@VecK}{\tkz@VecK[1]}} +\def\tkz@VecK[#1](#2,#3)#4{% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfmathparse{#1}\edef\tkz@coeff{\pgfmathresult} + \path[coordinate](#2)--++(\pgf@xa *\tkz@coeff,% + \pgf@ya *\tkz@coeff)% + coordinate (#4);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% tkzVector K Orth coeff dans #1 +% v(AN) perp v(AB) v(AB) v(AN) sens direct cercle trigo +% ||v(AN)||=||v(AB)|| +%<--------------------------------------------------------------------------–> +\def\tkzVecKOrth{\pgfutil@ifnextchar[{\tkz@VecKOrth}{\tkz@VecKOrth[1]}} +\def\tkz@VecKOrth[#1](#2,#3)#4{% +\begingroup + \pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}% + \pgf@xa=-\pgf@y% + \pgf@ya=\pgf@x% + \pgfmathparse{#1}\edef\tkz@coeff{\pgfmathresult} + \path[coordinate](#2)--++(\tkz@coeff\pgf@xa,\tkz@coeff\pgf@ya)% + coordinate (#4);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% 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 +%<--------------------------------------------------------------------------–> +\def\tkzVecKOrthNorm{\pgfutil@ifnextchar[{\tkz@VecKOrthNorm}% + {\tkz@VecKOrthNorm[1]}} +\def\tkz@VecKOrthNorm[#1](#2,#3)#4{% +\begingroup + \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#2}{center}}% + {\pgfpointanchor{#3}{center}}} + \pgf@xa=-\pgf@y% + \pgf@ya=\pgf@x% + \FPmul\tkz@coeff{28.45274}{#1} + \FPmul\tkz@x{\tkz@coeff}{\pgf@sys@tonumber{\pgf@xa}} + \FPmul\tkz@y{\tkz@coeff}{\pgf@sys@tonumber{\pgf@ya}} + \path[coordinate](#2)--++(\tkz@x pt,\tkz@y pt)% + coordinate (#4);% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% \tkzpointnormalised normalise un point A-->A' tq ||v(OA')=1|| +% équivalent de \pgfpointnormalised avec fp +% example +% \tkzpointnormalised{% +% \pgfpointdiff{\pgfpointanchor{A}{center}} +% {\pgfpointanchor{B}{center}}} + +% or +% \pgf@x=1 cm +% \pgf@y=12 cm +% \tkzpointnormalised{} %<--------------------------------------------------------------------------–> +\def\tkzpointnormalised#1{% +\pgf@process{#1}% +\FPmul{\tkz@sx}{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@x}} +\FPmul{\tkz@sy}{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@y}} +\FPadd{\tkz@sxy}{\tkz@sx}{\tkz@sy} +\FProot{\tkz@den}{\tkz@sxy}{2} +\FPdiv{\tkz@coordx}{\pgf@sys@tonumber{\pgf@x}}{\tkz@den} +\FPround{\tkz@coordx}{\tkz@coordx}{5} +\FPdiv{\tkz@coordy}{\pgf@sys@tonumber{\pgf@y}}{\tkz@den} +\FPround{\tkz@coordy}{\tkz@coordy}{5} +\pgf@x = \tkz@coordx pt +\pgf@y = \tkz@coordy pt +} +%<--------------------------------------------------------------------------–> +% restaure and save length +\def\tkz@save@length{% +\global\let\tkz@temp@length\tkzLengthResult}% +\def\tkz@restore@length{% + \global\let\tkzLengthResult\tkz@temp@length }% +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% \tkzCalcLength Distance entre deux points en pt ou en cm avec FP +% \veclen mais avec fp +% option cm le résultat est en cm sinon en pt +%<--------------------------------------------------------------------------–> + +\newif\iftkzLengthIncm +\pgfkeys{ +DefVecLen/.cd, + cm/.is if = tkzLengthIncm, + cm/.default = true} + +\def\tkzCalcLength{\pgfutil@ifnextchar[{\tkz@CalcLength}{\tkz@CalcLength[]}} +\def\tkz@CalcLength[#1](#2,#3){% +\pgfkeys{DefVecLen/.cd, cm = false} +\pgfqkeys{/DefVecLen}{#1}% +\begingroup +\tkz@@CalcLength(#2,#3){tkzLengthResult} +\iftkzLengthIncm + \FPdiv\tkzFPMathLen{\tkzFPMathLen}{28.45274} + \FPround\tkzFPMathLen\tkzFPMathLen5\relax% + \global\let\tkzLengthResult\tkzFPMathLen +\fi +\endgroup +}% +\def\tkz@@CalcLength(#1,#2)#3{% +\pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% +\pgf@xa=\pgf@x% +\pgf@ya=\pgf@y% +\FPeval\tkz@temp@a{\pgfmath@tonumber{\pgf@xa}}% +\FPeval\tkz@temp@b{\pgfmath@tonumber{\pgf@ya}}% +\FPeval\tkz@temp@sum{(\tkz@temp@a*\tkz@temp@a+\tkz@temp@b*\tkz@temp@b)}% +\FProot{\tkzFPMathLen}{\tkz@temp@sum}{2}% +\FPround\tkzFPMathLen\tkzFPMathLen5\relax +\global\expandafter\edef\csname #3\endcsname{\tkzFPMathLen} +} +%<--------------------------------------------------------------------------–> +\def\tkzGetLength#1{% +\global\expandafter\edef\csname #1\endcsname{\tkzLengthResult}} +%<--------------------------------------------------------------------------–> +% \tkzpttocm passage de pt à cm div par 28.45274 +%<--------------------------------------------------------------------------–> +\def\tkzpttocm(#1)#2{% +\begingroup + \FPdiv\tkz@mathresult{#1}{28.45274} + \FPround\tkz@mathresult\tkz@mathresult5\relax% + \global\let\tkz@mathresult\tkz@mathresult + \global\expandafter\edef\csname #2\endcsname{\tkz@mathresult}% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% \tkzcmtopt passage de cm à pt mul par 28.45274 %<--------------------------------------------------------------------------– +\def\tkzcmtopt(#1)#2{% +\begingroup + \FPmul\tkz@mathresult{#1}{28.45274} + \FPround\tkz@mathresult\tkz@mathresult5\relax% + \global\let\tkz@mathresult\tkz@mathresult +\global\expandafter\edef\csname #2\endcsname{\tkz@mathresult}% +\endgroup +}% +%<--------------------------------------------------------------------------–> +% Slope +%<--------------------------------------------------------------------------–> +\def\tkzFindSlope{\tkz@FindSlope} +\def\tkz@FindSlope(#1,#2)#3{% + \begingroup + \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}} + \tkz@ax=\pgf@x\relax% + \tkz@ay=\pgf@y\relax% + \FPdiv{\tkz@Slope}{\pgfmath@tonumber{\tkz@ay}}{\pgfmath@tonumber{\tkz@ax}} + \FPround{\tkz@Slope}{\tkz@Slope}{5} + \global\expandafter\edef\csname #3\endcsname{\tkz@Slope}% +\endgroup +} +%<--------------------------------------------------------------------------–> +%<----------------– for compatibility --------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzmathanglebetweenpoints#1#2{% +\begingroup + \pgf@process{\pgfpointdiff{#1}{#2}}% + % + % First approximate the angle of the external point... + % + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \ifdim\pgf@xa<0pt\relax% + \pgf@xa-\pgf@xa% + \fi + \ifdim\pgf@ya<0pt\relax% + \pgf@ya-\pgf@ya% + \fi + \ifdim\pgf@ya>\pgf@xa% + \pgf@x\pgf@xa% + \pgf@y\pgf@ya% + \else + \pgf@x\pgf@ya% + \pgf@y\pgf@xa% + \fi + \ifdim\pgf@y=0pt\relax% + \pgf@x0pt% + \else + \FPdiv\pgfmathresult{1}{\pgfmath@tonumber{\pgf@y}} + \FPround\pgfmathresult\pgfmathresult5\relax% + \pgf@x\pgfmathresult\pgf@x% + \fi + \multiply\pgf@x1000\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgf@counta\the\pgf@x\relax\pgfmath@% +\expandafter\pgf@x\csname pgfmath@atan@\the\c@pgf@counta\endcsname pt\relax% + \ifdim\pgfmath@ya>\pgfmath@xa\relax% + \pgf@x-\pgf@x% + \advance\pgf@x90pt% + \fi + \ifdim\pgf@xb<0pt% + \ifdim\pgf@yb>0pt% + \pgf@x-\pgf@x% + \fi + \advance\pgf@x180pt\relax% + \else + \ifdim\pgf@yb<0pt% + \pgf@x-\pgf@x% + \advance\pgf@x360pt\relax% + \fi + \fi + \ifdim\pgf@x>180pt% + \advance\pgf@x-360pt\relax% + \fi + \pgfmath@returnone\pgf@x% + \endgroup +} + +% \tkzmathrotatepointaround +% +% Rotate point #1 about point #2 by #3 degrees. +% +\def\tkzmathrotatepointaround#1#2#3{% + \pgf@process{% + \pgf@process{#1}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#2}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + \pgfmathsetmacro\tkz@angle{#3}% + \pgfmathsin@{\tkz@angle}% + \let\sineangle\pgfmathresult% + \pgfmathcos@{\tkz@angle}% + \let\cosineangle\pgfmathresult% + \pgf@xa\cosineangle\pgf@x% + \advance\pgf@xa-\sineangle\pgf@y% + \pgf@ya\sineangle\pgf@x% + \advance\pgf@ya\cosineangle\pgf@y% + \pgf@x\pgf@xb% + \pgf@y\pgf@yb% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% +} + + +% \tkzmathanglebetweenlines +% +% Calculate the clockwise angle between a line from point #1 +% to point #2 and a line from #3 to point #4. +% +\def\tkzmathanglebetweenlines#1#2#3#4{% + \begingroup + \tkzmathanglebetweenpoints{#1}{#2}% + \let\firstangle\pgfmathresult% + \tkzmathanglebetweenpoints{#3}{#4}% + \let\secondangle\pgfmathresult% + \ifdim\firstangle pt>\secondangle pt\relax% + \pgfmathadd@{\secondangle}{360}% + \let\secondangle\pgfmathresult% + \fi + \pgfmathsubtract@{\secondangle}{\firstangle}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup +} +% \pgfmathpointreflectalongaxis +% +% Reflects point #2 around an axis centered on #2 at an angle #3. +% +\def\tkzmathreflectpointalongaxis#1#2#3{% + \pgf@process{% + \pgfmathanglebetweenpoints{#2}{#1}% + \pgfmath@tempdima\pgfmathresult pt\relax% + \pgfmathparse{#3}% + \advance\pgfmath@tempdima-\pgfmathresult pt\relax% + \pgfmath@tempdima-2.0\pgfmath@tempdima% + \pgfmathrotatepointaround{#1}{#2}{\pgfmath@tonumber{\pgfmath@tempdima}}% + }% +} + + +% \pgfmathpointintersectionoflineandarc +% +% A bit experimental at the moment: +% +% Locates the point where a line crosses an eliptical arc. If the line +% does not cross the arc, a meaningless point will result. +% +% #1 the point of the line on the "convex" side of the arc. +% #2 the point of the line on the "concave" side of the arc. +% #3 the center of the eliptical arc. +% #4 start angle of the arc. +% #5 end angle of the arc. +% #6 radii of the arc. +% +\def\tkzmathpointintersectionoflineandarc#1#2#3#4#5#6{% + \pgf@process{% + % + % Get the required angle. + % + \pgfmathanglebetweenpoints{#2}{#1}% + \let\x\pgfmathresult% + % + % Get the radii of the arc. + % + \pgfmath@in@{and }{#6}% + \ifpgfmath@in@% + \pgf@polar@#6\@@% + \else + \pgf@polar@#6 and #6\@@% + \fi + \edef\xarcradius{\the\pgf@x}% + \edef\yarcradius{\the\pgf@y}% + % + % Get the start and end angles of the arc... + % + \pgfmathsetmacro\s{#4}% + \pgfmathsetmacro\e{#5}% + % + % ...and also with rounding. + % + \pgfmathmod@{\s}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi + \let\ss\pgfmathresult% + \pgfmathmod@{\e}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi + \let\ee\pgfmathresult% + % + % Hackery for when arc straddles zero. + % + \ifdim\ee pt<\ss pt\relax% + \pgfmathadd@{\x}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \let\x\pgfmathresult% + \fi + \def\m{360}% Measure of nearness. + \pgfmathadd@{\s}{\e}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\n\pgfmathresult% The best estimate (default to middle of arc). + \pgfmathloop% + \pgfmathadd@{\s}{\e}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\p\pgfmathresult% + \ifdim\p pt=\s pt\relax% + \else + \tkzmathanglebetweenpoints{#2}{% + \pgfpointadd{#3}{% + \pgf@x\xarcradius\relax% + \pgfmathcos@{\p}% + \pgf@x\pgfmathresult\pgf@x% + \pgf@y\yarcradius\relax% + \pgfmathsin@{\p}% + \pgf@y\pgfmathresult\pgf@y% + }% + }% + % + % Hackery for when arc straddles zero. + % + \ifdim\ee pt<\ss pt\relax% + \pgfmathadd@{\pgfmathresult}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \fi + \let\q\pgfmathresult% + % + % More hackery... + % + \ifdim\x pt>335pt\relax% + \ifdim\q pt<45pt\relax% + \pgfmathadd@{\q}{360}% + \let\q\pgfmathresult% + \fi + \fi + \ifdim\x pt=\q pt% Found it! + \pgfmathbreakloop% Breaks after current iteration is complete. + \else + \ifdim\x pt<\q pt\relax% + \let\e\p% + \else + \let\s\p% + \fi + \fi + \pgfmathsubtract@{\x}{\q}% + \pgfmathabs@{\pgfmathresult}% + % + % Save the estimate if it is better than any previous estimate. + % + \ifdim\pgfmathresult pt<\m pt\relax% + \let\m\pgfmathresult% + \let\n\p% + \fi + \repeatpgfmathloop% + \pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}% + }% +} + +% \tkzmathangleonellipse +% +% Find the angle corresponding to a point on the border of an ellispe. +% +% #1 - the point on the border. +% #2 - the radii of the ellipse. +% +\def\tkzmathangleonellipse#1#2{% + \begingroup + \pgfmath@in@{and }{#2}% + \ifpgfmath@in@% + \pgf@polar@#2\@@% + \else + \pgf@polar@#2 and #2\@@% + \fi + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@process{#1}% + \ifdim\pgf@x=0pt\relax% + \pgfutil@tempdima1pt\relax% + \else + \pgfutil@tempdima\pgf@x% +%\pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgfutil@tempdima}}% +\FPdiv\pgfmathresult{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgfutil@tempdima}} +\FPround\pgfmathresult\pgfmathresult5\relax% + \pgfutil@tempdima\pgfmathresult pt\relax% + \fi + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima1pt\relax% + \else + % \pgfmathdivide@{\pgfmath@tonumber{\pgf@y}}{\pgfmath@tonumber{\pgf@ya}}% + \FPdiv\pgfmathresult{\pgfmath@tonumber{\pgf@y}}{% + \pgfmath@tonumber{\pgf@ya}}% + \FPround\pgfmathresult\pgfmathresult5\relax% + \pgfutil@tempdima\pgfmathresult\pgfutil@tempdima% + \pgfmathatan@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \fi + % + \pgfutil@tempdima\pgfmathresult pt\relax% + \ifdim\pgfutil@tempdima<0pt\relax% + \advance\pgfutil@tempdima360pt\relax% + \fi + \ifdim\pgf@x<0pt\relax% + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima180pt\relax% + \else + \ifdim\pgf@y<0pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \else + \advance\pgfutil@tempdima-180pt\relax% + \fi + \fi + \else + \ifdim\pgf@x=0pt\relax% + \ifdim\pgf@y<0pt\relax% + \pgfutil@tempdima270pt\relax% + \else + \pgfutil@tempdima90pt\relax% + \fi + \else + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima0pt\relax% + \fi + \fi + \fi + \pgfmath@returnone\pgfutil@tempdima% + \endgroup +} + +\def\tkzpointborderellipse#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@xa=\pgf@ya% circle. that's easy! + \pgf@process{\pgfpointnormalised{#1}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@xa}\pgf@y% + \else + \ifdim\pgf@xa<\pgf@ya% + % Ok, first, let's compute x/y: + \c@pgf@countb=\pgf@ya% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@xc=\pgf@x% + \pgf@yc=8192pt% + \pgf@y=.125\pgf@y% + \c@pgf@countb=\pgf@y% + \divide\pgf@yc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@y=\pgf@sys@tonumber{\pgf@yc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \else + % Ok, now let's compute y/x: + \c@pgf@countb=\pgf@xa% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@yc=\pgf@y% + \pgf@xc=8192pt% + \pgf@x=.125\pgf@x% + \c@pgf@countb=\pgf@x% + \divide\pgf@xc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@x% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \fi + \fi +} +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-misc.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-misc.tex new file mode 100644 index 00000000000..cb25c163b14 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-misc.tex @@ -0,0 +1,181 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + +%<--------------------------------------------------------------------------–> +% tkzText +%<--------------------------------------------------------------------------–> +\newif\iftkz@node\tkz@nodefalse + +\def\tkz@parsenode#1{% +\tkz@getvirg#1,\@nil +\iftkz@node +\else + \tkz@getfromcart#1\@nil +\fi +} +\def\tkz@getvirg#1,#2\@nil{% +\ifx\tkzempty#2\tkzempty% + \tkz@nodetrue +\else + \tkz@nodefalse +\fi +} + + +\def\tkzText{\pgfutil@ifnextchar[{\tkz@Text}{\tkz@Text[]}} +\def\tkz@Text[#1](#2)#3{% + \begingroup + \tkz@parsenode{#2} + \iftkz@node \node[#1] at (#2){#3}; + \else + \FPadd{\ptxa}{\tkz@absc}{-\tkz@init@xorigine} + \FPadd{\ptya}{\tkz@ord}{-\tkz@init@yorigine} + \FPdiv{\ptxa}{\ptxa}{\tkz@init@xstep} + \FPdiv{\ptya}{\ptya}{\tkz@init@ystep} + \node[#1] at (\ptxa,\ptya){#3};% + \fi +\endgroup +}% +% %<--------------------------------------------------------------------------–> +% % légende +% %<--------------------------------------------------------------------------–> +\newif\iftkz@legend@line +\pgfkeys{ +/tkzlegend/.cd, +line/.is if = tkz@legend@line, +line/.default = true, +/tkzlegend/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}} +} + +\def\tkzLegend{\pgfutil@ifnextchar[{\tkz@Legend}{\tkz@Legend[]}} +\def\tkz@Legend[#1](#2,#3)#4{% +\pgfkeys{/tkzlegend/.cd, +line=false} + \pgfqkeys{/tkzlegend}{#1} + \begingroup +\c@pgfmath@counta=0 % +\FPadd{\ptxa}{#2}{-\tkz@init@xorigine} +\FPadd{\ptya}{#3}{-\tkz@init@yorigine} +\FPdiv{\ptxa}{\ptxa}{\tkz@init@xstep} +\FPdiv{\ptya}{\ptya}{\tkz@init@ystep} +\node[/tkzlegend/.cd,#1] at (\ptxa,\ptya) {% +\begin{tikzpicture} + \foreach \motif/\size/\col/\mtext in {#4}{% + \iftkz@legend@line + \draw[color = \col, + line width = \size, + style = \motif, + text = \tkz@mainlinecolor]% + (0cm ,\the\c@pgfmath@counta ex)--% + (\tkz@legend@line@len,\the\c@pgfmath@counta ex) + \else + \draw plot[mark size = \size,% + mark = \motif,% + mark options = {color=\col}]% + coordinates{(0 ex,\the\c@pgfmath@counta ex)}% + \fi + node[right=1ex] {\mtext}; + \global\advance\c@pgfmath@counta by 3 % + }% + +\end{tikzpicture}% +};% +\endgroup +} + +%<--------------------------------------------------------------------------–> +% hline pb avec line +%<--------------------------------------------------------------------------–> +\def\tkzHLine{\pgfutil@ifnextchar[{\tkz@HLine}{\tkz@HLine[]}} +\def\tkz@HLine[#1]#2{% + \begingroup + \FPeval{\tkz@valy}{(#2)}% + \FPadd{\tkz@ptya}{\tkz@valy}{-\tkz@init@yorigine} + \FPdiv{\tkz@ptya}{\tkz@ptya}{\tkz@init@ystep} + \draw[#1] (\tkz@xa,\tkz@ptya)--(\tkz@xb,\tkz@ptya);% +\endgroup +} +%<--------------------------------------------------------------------------–> +% hlines pb avec line +%<--------------------------------------------------------------------------–> +\def\tkzHLines{\pgfutil@ifnextchar[{\tkz@HLines}{\tkz@HLines[]}} +\def\tkz@HLines[#1]#2{% + \begingroup + \foreach \tkz@vy in {#2}{% + \FPeval\my@tkz@vy{\tkz@vy} + \tkz@HLine[#1]{\my@tkz@vy}} +\endgroup +} +%<---------------------------------------------------------------------------> +% vline +%<---------------------------------------------------------------------------> +\def\tkzVLine{\pgfutil@ifnextchar[{\tkz@VLine}{\tkz@VLine[]}} +\def\tkz@VLine[#1]#2{% +\begingroup + \FPeval\tkz@valx{(#2)}% + \FPadd{\tkz@ptxa}{\tkz@valx}{-\tkz@init@xorigine} + \FPdiv{\tkz@ptxa}{\tkz@ptxa}{\tkz@init@xstep} + \draw[#1](\tkz@ptxa,\tkz@ya)--(\tkz@ptxa,\tkz@yb); +\endgroup +} + +%<---------------------------------------------------------------------------> +% vlines +%<---------------------------------------------------------------------------> +\def\tkzVLines{\pgfutil@ifnextchar[{\tkz@VLines}{\tkz@VLines[]}} +\def\tkz@VLines[#1]#2{% +\begingroup + \foreach \tkz@vx in {#2}{% + \FPeval\my@tkz@vx{\tkz@vx} + \tkz@VLine[#1]{\my@tkz@vx}} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzHTick{\pgfutil@ifnextchar[{\tkz@HTick}{\tkz@HTick[]}} +\def\tkz@HTick[#1]#2{% + \begingroup + \FPeval\tkz@ptxa{(#2)}% + \FPround\tkz@ptxa\tkz@ptxa{5} + \FPclip\tkz@ptxa\tkz@ptxa + \FPadd\tkz@ptxa\tkz@ptxa{-\tkz@init@xorigine} + \FPdiv\tkz@ptxa\tkz@ptxa{\tkz@init@xstep} + \draw plot[mark style,#1] coordinates {(\tkz@ptxa,0)}; +\endgroup +} +\def\tkzHTicks{\pgfutil@ifnextchar[{\tkz@HTicks}{\tkz@HTicks[]}} +\def\tkz@HTicks[#1]#2{% + \begingroup +\foreach \tkz@hy in {#2} {\tkz@HTick[#1]{\tkz@hy}} +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzVTick{\pgfutil@ifnextchar[{\tkz@VTick}{\tkz@VTick[]}} +\def\tkz@VTick[#1]#2{% + \begingroup + \FPeval\tkz@ptya{(#2)}% + \FPround\tkz@ptya\tkz@ptya{5}% + \FPclip\tkz@ptya\tkz@ptya + \FPadd\tkz@ptya\tkz@ptya{-\tkz@init@yorigine}% + \FPdiv\tkz@ptya\tkz@ptya{\tkz@init@ystep}% + \draw plot[mark style,#1] coordinates {(0,\tkz@ptya)}; +\endgroup +} +%<--------------------------------------------------------------------------–> +\def\tkzVTicks{\pgfutil@ifnextchar[{\tkz@VTicks}{\tkz@VTicks[]}} +\def\tkz@VTicks[#1]#2{% +\begingroup +\foreach \tkz@hy in {#2} {\tkz@VTick[#1]{\tkz@hy}} +\endgroup +} +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-obsolete.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-obsolete.tex new file mode 100644 index 00000000000..82f7e1bcbb0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-obsolete.tex @@ -0,0 +1,219 @@ +\makeatletter +\global\edef\tkz@sua@lw{0.4pt} +\global\edef\tkz@sua@color{black} +\global\edef\tkz@sua@gradsize{\textstyle} +\global\edef\tkz@sua@tickwd{0.8 pt} +\global\edef\tkz@sua@ticka{2 pt} +\global\edef\tkz@sua@tickb{2 pt} + + + +\def\tkzX{\pgfutil@ifnextchar[{\tkz@X}{\tkz@X[]}} +\def\tkz@X[#1]{% +\begingroup + \pgfkeys{/tkzX/.cd, + trig = 0, + lw = \tkz@sua@lw, + gradsize = \tkz@sua@gradsize, + color = \tkz@sua@color, + tickwd = \tkz@sua@tickwd, + tickup = \tkz@sua@ticka, + tickdn = \tkz@sua@tickb, + pos = {below = 3pt}, + label = $x$, + poslabel = {below = 3pt}, + noticks = false, + nograd = false, +% unit = false, + orig = false, + step = \tkz@init@xstep + } + \pgfqkeys{/tkzX}{#1} + \FPtrunc\posmax{\tkz@xb}{\tkz@init@xdec}% + \FPtrunc\posmin{\tkz@xa}{\tkz@init@xdec}% + \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@xstep} + \FPadd\posnext{\posmin}{\tkz@posnext} + \FPadd\tkz@xbsup{\tkz@xb}{\tkz@init@rightspace} + \path (\tkz@xa,0)--(\tkz@xb,0) node(tkz@xline){};% + \protected@edef\tkz@temp{% + \noexpand% + \draw[xaxe style,line width = \tkz@X@lw,% + color = \tkz@X@color]% + (\tkz@xa,0)--(\tkz@xbsup,0)% + node[xlabel style,\tkz@X@poslabel]}\tkz@temp% + {\tkz@X@label};% + \FPtrunc\xtkzero{0.0000000}{\tkz@init@xdec}% + \iftkz@X@noticks% + \else +\ifnum\tkz@X@trig=0% + \FPtrunc\posmax{\posmax}{\tkz@init@xdec}% + \foreach \pos in {\posmin,\posnext,...,\posmax}{% + \FPtrunc\tkz@pos{\pos}{\tkz@init@xdec}% + \protected@edef\tkz@temp{% + \noexpand% + \draw[line width = \tkz@X@tickwd,shift = {(\pos,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)% + node[\tkz@X@pos,inner sep = 0pt]}\tkz@temp + {\FPmul{\xgrad}{\pos}{\tkz@init@xstep}% + \FPadd{\xgrad}{\xgrad}{\tkz@init@xorigine}% + \FPtrunc\xgrad{\xgrad}{\tkz@init@xdec}% + \iftkz@X@orig% + \iftkz@X@nograd + \else\tkz@showgrad{\xgrad}% + $\textcolor{\tkz@sur@colorlabel}{% + \tkz@X@gradsize{\numprint{\tkz@result}}}$% + \fi + \else % orig + \iftkz@init@NO% + \ifx\tkz@pos\posmin + \else + \tkz@showgrad{\xgrad}% + $\textcolor{\tkz@sur@colorlabel}{% + \tkz@X@gradsize{\numprint{\tkz@result}}}$ + \fi + \else % NO + \ifx\tkz@pos\xtkzero% + % \iftkz@X@unit\tkz@showgrad{\xgrad}% + % $\textcolor{\tkz@sur@colorlabel}{% + % \tkz@X@gradsize{\numprint{\tkz@result}}}$ + % \fi + \else + \iftkz@X@nograd% + \else\tkz@showgrad{\xgrad}% + $\textcolor{\tkz@sur@colorlabel}{% + \tkz@X@gradsize{\numprint{\tkz@result}}}$ + \fi + \fi%end of xtkzero + \fi%end of NO + \fi%end of orig +};% end of draw +}% end foreach + \else %trig affichage + \FPadd{\posmin}{\posmin}{0.5}% + \FPdiv\nbtrigticksmax{\posmax}{\FPpi}% + \FPdiv\nbtrigticksmin{\posmin}{\FPpi}% + \FPmul\nbtrigticksmax{\nbtrigticksmax}{\tkz@X@trig}% + \FPmul\nbtrigticksmin{\nbtrigticksmin}{\tkz@X@trig}% + \FPround\nbtrigticksmin{\nbtrigticksmin}{0}% + \foreach \pos in {\nbtrigticksmin,...,\nbtrigticksmax}{% + \FPmul\pospi{\pos}{\FPpi} + \FPdiv\pospi{\pospi}{\tkz@X@trig}% + \protected@edef\tkz@temp{% + \noexpand\draw[line width = \tkz@X@tickwd,% + shift = {(\pospi,0)}]% + (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickup)% + node[\tkz@X@pos,% + text height = 8pt,% + inner sep = 1pt]}\tkz@temp% + {\tkzPrintFracWithPi{\pos}{\tkz@X@trig}% + \tkzprintfrac};% + }% end foreach + \fi +\fi% end ticks +\endgroup + }% todo macro pour l'affichage + +%<--------------------------------------------------------------------------–> +% tkzY +%<--------------------------------------------------------------------------–> + +\pgfkeys{ + tkzY/.cd, + pos/.code = {\def\tkz@Y@pos{#1}}, + trig/.code = {\def\tkz@Y@trig{#1}}, + lw/.code = {\def\tkz@Y@lw{#1}}, + color/.code = {\def\tkz@Y@color{#1}}, + label/.code = {\def\tkz@Y@label{#1}}, + poslabel/.code = {\def\tkz@Y@poslabel{#1}}, + tickwd/.code = {\def\tkz@Y@tickwd{#1}}, + ticklt/.code = {\def\tkz@Y@ticklt{#1}}, + tickrt/.code = {\def\tkz@Y@tickrt{#1}}, + gradsize/.code = {\def\tkz@Y@gradsize{#1}}, + step/.code = {\def\tkz@posnext{#1}}, + noticks/.is if = tkz@Y@noticks, + noticks/.default = true, + nograd/.is if = tkz@Y@nograd, + nograd/.default = true, + orig/.is if = tkz@Y@orig, + orig/.default = true, + unit/.is if = tkz@Y@unit, + unit/.default = true } +\def\tkzY{\pgfutil@ifnextchar[{\tkz@Y}{\tkz@Y[]}} +\def\tkz@Y[#1]{% + \pgfkeys{/tkzY/.cd, + trig = 0, + lw = \tkz@sua@lw, + gradsize = \tkz@sua@gradsize, + color = \tkz@sua@color, + tickwd = \tkz@sua@tickwd, + tickrt = \tkz@sua@ticka, + ticklt = \tkz@sua@tickb, + label = $y$, + poslabel = {left = 3pt}, + pos = {left = 3pt}, + noticks = false, + nograd = false, + unit = false, + orig = false, + step = \tkz@init@ystep + } + \pgfqkeys{/tkzY}{#1} + \FPtrunc\posmax{\tkz@yb}{\tkz@init@ydec}% + \FPtrunc\posmin{\tkz@ya}{\tkz@init@ydec}% + \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@ystep} + \FPadd\posnext{\posmin}{\tkz@posnext} + \path (0,\tkz@ya)--(0,\tkz@yb) node(tkz@yline){};% + \FPadd\tkz@ybsup{\tkz@yb}{\tkz@init@upspace} + \protected@edef\tkz@temp{% + \noexpand% + \draw[line width = \tkz@Y@lw,% + color = \tkz@Y@color,yaxe style]% + (0,\tkz@ya)--(0,\tkz@ybsup)% + node[\tkz@Y@poslabel,ylabel style]}\tkz@temp% + {\tkz@Y@label};% + \FPtrunc\ytkzero{0.000000}{\tkz@init@ydec}% + \iftkz@Y@noticks% + \else + \foreach \pos in {\posmin,\posnext,...,\posmax}{% + \FPtrunc\tkz@pos{\pos}{\tkz@init@ydec}% + \protected@edef\tkz@temp{% + \noexpand% + \draw[line width = \tkz@Y@tickwd,% + shift = {(0,\pos)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)% + node[\tkz@Y@pos,inner sep = 0pt]}\tkz@temp% + {\FPmul{\ygrad}{\pos}{\tkz@init@ystep}% + \FPadd{\ygrad}{\ygrad}{\tkz@init@yorigine} + \FPtrunc\ygrad{\ygrad}{\tkz@init@ydec}% + \iftkz@Y@orig% + \iftkz@Y@nograd\else\tkz@showgrad{\ygrad}% + $\textcolor{\tkz@sur@colorlabel}{\tkz@Y@gradsize{\numprint{\tkz@result}}}$\fi + \else + \iftkz@init@NO% + \ifx\tkz@pos \posmin\else + \tkz@showgrad{\ygrad}% + $\textcolor{\tkz@sur@colorlabel}{\tkz@Y@gradsize{\numprint{\tkz@result}}}$\fi + \else + \ifx\tkz@pos \ytkzero + \iftkz@Y@unit\tkz@showgrad{\ygrad}% + $\textcolor{\tkz@sur@colorlabel}{\tkz@Y@gradsize{\numprint{\tkz@result}}}$\fi\else + \iftkz@Y@nograd% + \else \tkz@showgrad{\ygrad}% + $\textcolor{\tkz@sur@colorlabel}{\tkz@Y@gradsize{\numprint{\tkz@result}}}$\fi\fi + \fi + \fi + };% + }% +\fi +\iftkz@init@NO\else\iftkz@Y@unit% + \draw[line width = 1pt,% + inner sep = 1pt] (0,0) -- (0,1)% + node[left=3pt]% + {$\tkz@Y@gradsize{\numprint{\tkz@init@ystep}}$};% + \draw[line width = \tkz@Y@tickwd,% + shift = {(0,1)}]% + (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);% + \fi\fi +}% +\makeatother +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex new file mode 100644 index 00000000000..b8e99fe4272 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex @@ -0,0 +1,338 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + +%<--------------------------------------------------------------------------–> +\def\tkzutil@empty{} +\def\tkzutil@firstofone#1{#1} +\def\tkzutil@firstoftwo#1#2{#1} +\def\tkzutil@secondoftwo#1#2{#2} +%<--------------------------------------------------------------------------–> +\long\def\tkzutil@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\tkzutil@firstoftwo + \else + \expandafter\tkzutil@secondoftwo + \fi} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\global\def\tkzActivOff{% +\edef\tkzTwoPtCode{\the\catcode`\:} +\edef\tkzPtExCode{\the\catcode`\!} +\edef\tkzPtVirCode{\the\catcode`\;} +\catcode`\:=12 \catcode`\!=12 \catcode`\;=12}% +\global\def\tkzActivOn{% +\catcode`\:=\tkzTwoPtCode\relax +\catcode`\!=\tkzPtExCode\relax +\catcode`\;=\tkzPtVirCode\relax +}% + +%<----------------------------– autres tools --------------------------------> +%<-------------------------- Initialisation --------------------------------> +\pgfkeys{ +/tkzsupcol/.cd, + background/.code = {\global\edef\tkz@suc@bkc{#1}},% + text/.code = {\global\edef\tkz@suc@txt{#1}}, +} +\def\tkzSetUpColors{\pgfutil@ifnextchar[{\tkz@SetUpColors}{\tkz@SetUpColors[]}} +\def\tkz@SetUpColors[#1]{% +\begingroup +\pgfkeys{% +tkzsupcol/.cd, + background = \tkz@backgroundcolor, + text = \tkz@textcolor + } +\pgfqkeys{/tkzsupcol}{#1} +\global\edef\tkz@fillcolor{\tkz@suc@bkc} +\global\edef\tkz@mainlinecolor{\tkz@suc@txt} +\global\edef\tkz@textcolor{\tkz@suc@txt} +\global\def\tkz@otherlinecolor{\tkz@suc@txt!50} +\global\edef\tkz@sua@color{\tkz@mainlinecolor} +\pagecolor{\tkz@suc@bkc} +\color{\tkz@suc@txt} + \InputIfFileExists{tkz-base.cfg}{\typeout{Local configuration file tkz-param.cfg found and used}}{\typeout{tkz-base.cfg not found} +%<--------- axes cartesian system ---------------------------------------–> +\global\edef\tkz@init@color{\tkz@textcolor} +\global\def\tkz@init@lw{0.4 pt} +\global\def\tkz@init@xlabel{$x$} +\global\def\tkz@init@ylabel{$y$} +\global\def\tkz@init@tickwd{0.8 pt} +\global\def\tkz@init@ticka{2 pt} +\global\def\tkz@init@tickb{2 pt} +\global\def\tkz@init@rightspace{.5} +\global\def\tkz@init@leftspace{0} +\global\def\tkz@init@upspace{.5} +\global\def\tkz@init@downspace{0} +\global\let\tkzmathstyle\displaystyle +\tikzset{xlabel style/.style={below=3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{xaxe style/.style ={>=latex,->}} +\tikzset{ylabel style/.style={left = 3 pt, + inner sep = 1pt, + outer sep = 0pt}} +\tikzset{yaxe style/.style ={>=latex,->}} +%<-------------------------- rep ---------------------------------------–> +\global\edef\tkz@sur@color{\tkz@mainlinecolor} +\global\edef\tkz@sur@colorlabel{\tkz@mainlinecolor} +\global\def\tkz@sur@lw{0.8 pt} +\global\def\tkz@sur@posxlabel{below=2pt} +\global\def\tkz@sur@posylabel{left=2pt} +%<-------------------------- grid ---------------------------------------–> +\global\edef\tkz@grid@color{gray} +\global\def\tkz@grid@lw{0.4 pt} +\global\def\tkzCoeffSubColor{50} +\global\def\tkzCoeffSubLw{0.8} +\global\def\tkz@grid@xstep{0.2} +\global\def\tkz@grid@ystep{0.2} +%<-------------------------- line ---------------------------------------–> +\global\edef\tkz@euc@linecolor{\tkz@mainlinecolor} +\global\def\tkz@euc@linewidth{0.6pt} +\global\def\tkz@euc@linestyle{solid} +\global\def\tkz@euc@lineleft{.2} +\global\def\tkz@euc@lineright{.2} +\global\def\tkz@legend@line@len{1cm} +\global\edef\tkz@euc@segmentcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@circlecolor{\tkz@mainlinecolor} +\tikzset{line style/.style={% + line width = \tkz@euc@linewidth, + color = \tkz@euc@linecolor, + style = \tkz@euc@linestyle, + add = {\tkz@euc@lineleft} and {\tkz@euc@lineright}}} +%<-------------------------- points -----------------------------------–> +\global\edef\tkz@euc@pointshape{circle} +\global\edef\tkz@euc@pointcolor{\tkz@mainlinecolor} +\global\edef\tkz@euc@labelcolor{\tkz@mainlinecolor} +\global\def\tkz@euc@pointsize{6} +\global\def\tkz@euc@pointpos{below right} +\tikzset{point style/.style={draw = \tkz@euc@pointcolor, + inner sep = 0pt, + shape = \tkz@euc@pointshape, + minimum size = \tkz@euc@pointsize*\pgflinewidth, + fill = \tkz@euc@pointcolor!50}} +%<---------------------------- mark -----------------------------------–> +\global\edef\tkz@mk@color{\tkz@mainlinecolor} +\global\edef\tkz@mk@mark{*} +\global\edef\tkz@mk@size{3pt} +\global\edef\tkz@mk@fill{\tkz@otherlinecolor} +\tikzset{mark style/.style={mark=\tkz@mk@mark,mark size=\tkz@mk@size,mark options={color=\tkz@mk@color,fill=\tkz@mk@fill}}} +\tikzset{arrow coord style/.style={dashed, + \tkz@euc@linecolor, + >=latex', + ->}} +\tikzset{xcoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + below=3pt}} +\tikzset{ycoord style/.style={\tkz@euc@labelcolor, + font=\normalsize,text height=1ex, + inner sep = 0pt, + outer sep = 0pt, + fill=\tkz@fillcolor, + left=3pt}} +%<--------------------------- vector --------------------------------------–> +\tikzset{vector style/.style={>=latex,->}} +%<------------------------- compass -----------------------------------–> +\global\edef\tkz@euc@compasscolor{\tkz@otherlinecolor} +\global\def\tkz@euc@compasswidth{0.4pt} +\global\def\tkz@euc@compassstyle{solid} +\tikzset{compass style/.style={color = \tkz@euc@compasscolor, + line width = \tkz@euc@compasswidth, + style = \tkz@euc@compassstyle}} +} +\endgroup} + +%<--------------------------------------------------------------------------–> +% Pour savoir le nombre de décimales d'un nombre +% le nombre dans #1 et le résultat dans \c@pgfmath@countb +%<--------------------------------------------------------------------------–> + +\newcommand*\tkz@getdecimal[1]{% + \expandafter\@getdecimal#1.\@nil +} + +\def\@getdecimal#1.#2\@nil{% + \ifx\empty#2\empty + % Si #2 est vide, c'est qu'il n'y avait pas de point + % dans la chaîne initiale + \c@pgfmath@countb0 % + \global\def\tkz@decpart{}% + \else + % sinon c'est la chaîne qui suit le point décimal... + \CountToken{#2}% + % ... y compris le point en trop ajouté par \tkz@getdecimal :-) + \advance\c@pgfmath@countb by-1 % + \@@getdecimal#2\@nil + \fi +} +\def\@@getdecimal#1.\@nil{\global\def\tkz@decpart{#1}} +%<--------------------------------------------------------------------------–> +% code from JCC modifi +\newcommand\CountToken[1]{% + \c@pgfmath@countb0 % + \expandafter\C@untToken#1\@nil +%modifi ajout du expandafter +} +\newcommand\C@untToken{% + \afterassignment\C@untT@ken\let\CurrT@ken= +} +\newcommand\C@untT@ken{% + \ifx\CurrT@ken\@nil \else + \advance\c@pgfmath@countb by1 % + \expandafter\C@untToken + \fi +} +% end code from JCC + +%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> +% Tools +%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> +%<–––––––– code from TeX in Practice ––––––––> +\newif\if@TestSubString +\def\SubStringConditional #1#2{% + TT\fi + \edef\@MainString{#1}% + \edef\@SubStringConditionalTemp{{#1}{#2}}% + \expandafter\@SubStringConditional\@SubStringConditionalTemp +} +\def\@SubStringConditional #1#2{% + \def\@TestSubS ##1#2##2\\{% + \def\@TestTemp{##1}% + }% + \@TestSubS #1#2\\ + \ifx\@MainString\@TestTemp + \@TestSubStringfalse + \else + \@TestSubStringtrue + \fi + \if@TestSubString +} + +\def\RecursionMacroEnd #1#2#3{% + #1\relax + \def\@RecursionMacroEndNext{#2}% + \else + \def\@RecursionMacroEndNext{#3}% + \fi + \@RecursionMacroEndNext +} + +\def\ReplaceSubStrings #1#2#3#4{% + \def\@ReplaceResult{#1}% + \edef\@ReplaceMain{#2}% + \edef\@ReplaceSub{#3}% + \edef\@ReplaceSubRep{#4}% + \@ReplaceSubStrings +} +\def\@ReplaceSubStrings{% + \RecursionMacroEnd + {\if\SubStringConditional{\@ReplaceMain}{\@ReplaceSub}}% + {\@ReplaceSubStringsDo}{\expandafter\edef\@ReplaceResult{\@ReplaceMain}}% +} +\def\@ReplaceSubStringsDoX{% + \def\@ReplaceSubStringsDoA ##1% +}% +\def\@ReplaceSubStringsDo{% + \expandafter\@ReplaceSubStringsDoX \@ReplaceSub + ##2\@EndReplaceSubStrings{% + \edef\@ReplaceMain{##1\@ReplaceSubRep ##2}% + }% + \expandafter\@ReplaceSubStringsDoA\@ReplaceMain + \@EndReplaceSubStrings + \@ReplaceSubStrings +} +\def\tkzPrintFrac#1#2{% +\begingroup +\tkzReducFrac{#1}{#2} +\global\edef\tkzprintfrac{$ \frac{\tkzMathFirstResult}{\tkzMathSecondResult}$}% + \ifnum\tkzMathFirstResult=0% + \global\edef\tkzprintfrac{$0$}% + \else + \ifnum\tkzMathSecondResult=1 % + \ifnum\tkzMathFirstResult=1 % + \global\edef\tkzprintfrac{$1$}% + \else + \ifnum\tkzMathFirstResult=-1% + \global\edef\tkzprintfrac{$-1$}% + \else + \global\edef\tkzprintfrac{$\tkzMathFirstResult$}% + \fi\fi + \else + \ifnum\tkzMathFirstResult=1 % + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{1}{\tkzMathSecondResult}$}% + \else + \ifnum\tkzMathFirstResult=-1 % + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{-1}{\tkzMathSecondResult}$}% + \else + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult}{% + \tkzMathSecondResult}$}% + \fi\fi\fi\fi +\endgroup} +%<---------------------------------------------------------------------------> +\def\tkzPrintFracWithPi#1#2{% +\begingroup +\tkzReducFrac{#1}{#2} +\global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult\pi}{\tkzMathSecondResult}$}% + \ifnum\tkzMathFirstResult=0% + \global\edef\tkzprintfrac{$0$}% + \else + \ifnum\tkzMathSecondResult=1 % + \ifnum\tkzMathFirstResult=1 % + \global\edef\tkzprintfrac{$\pi$}% + \else + \ifnum\tkzMathFirstResult=-1% + \global\edef\tkzprintfrac{$-\pi$}% + \else + \global\edef\tkzprintfrac{$\tkzMathFirstResult\pi$}% + \fi\fi + \else + \ifnum\tkzMathFirstResult=1 % + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\pi}{\tkzMathSecondResult}$}% + \else + \ifnum\tkzMathFirstResult=-1 % + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{-\pi}{\tkzMathSecondResult}$}% + \else + \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult\pi}{% + \tkzMathSecondResult}$}% + \fi\fi\fi\fi +\endgroup}% + +%<---------------------------------------------------------------------------> +% chargement des modules +\def\tkz@obj@all{polygons,vectors,arcs,sectors,angles,protractor} +\def\tkz@obj@txt{all} +\def\usetkzobj{\pgfutil@ifnextchar[{\use@usetkzobj}{\use@@usetkzobj}}%} +\def\use@usetkzobj[#1]{\use@@usetkzobj{#1}} +\def\use@@usetkzobj#1{% + \def\tkz@list{#1} + \ifx\tkz@obj@txt\tkz@list \edef\tkz@list{\tkz@obj@all}% + \else + \edef\tkz@list{#1}% + \fi + %\edef\tkz@list{#1}% + \pgfutil@for\tkz@temp:=\tkz@list\do{% + \expandafter\ifx\csname tkz@library@\tkz@temp @loaded\endcsname\relax% + \expandafter\global\expandafter\let\csname tkz@library@\tkz@temp @loaded\endcsname=\pgfutil@empty% + \expandafter\edef\csname tkz@obj@#1@atcode\endcsname{\the\catcode`\@} + \expandafter\edef\csname tkz@obj@#1@barcode\endcsname{\the\catcode`\|} + \catcode`\@=11 + \catcode`\|=12 + \input tkz-obj-\tkz@temp.tex + \catcode`\@=\csname tkz@obj@#1@atcode\endcsname + \catcode`\|=\csname tkz@obj@#1@barcode\endcsname + \fi% + }% +}% +\def\DisabledNumprint{\let\tkz@numprint\numprint +\let\numprint\relax} +\def\EnabledNumprint{\let\numprint\tkz@numprint} +\endinput
\ No newline at end of file |