diff options
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex | 228 |
1 files changed, 40 insertions, 188 deletions
diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex index 9804439ee3..0e3e9f6096 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-obj-eu-draw-lines.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-draw-lines.tex -% Copyright 2020 Alain Matthes +% Copyright 2022 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -7,195 +7,26 @@ % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. -% % This work has the LPPL maintenance status “maintained”. -% % The Current Maintainer of this work is Alain Matthes. -% utf8 encoding -\def\fileversion{3.06c} -\def\filedate{2020/03/18} -\typeout{2020/03/18 3.06c tkz-obj-eu-draw-lines.tex} +\def\fileversion{4.00} +\def\filedate{2022/01/04} +\typeout{2022/01/04 4.00 tkz-obj-eu-draw-lines.tex} \makeatletter + \def\tkz@numdl{0} \pgfkeys{/tkzdrawl/.cd, - median/.code = \def\tkz@numdl{0}, - altitude/.code = \def\tkz@numdl{1}, - bisector/.code = \def\tkz@numdl{2}, - none/.code = \def\tkz@numdl{3}, - none, /tkzdrawl/.search also={/tikz} } %<--------------------------------------------------------------------------–> % Drawing a line > %<--------------------------------------------------------------------------–> \def\tkzDrawLine{\pgfutil@ifnextchar[{\tkz@DrawLine}{\tkz@DrawLine[]}} -\def\tkz@DrawLine[#1](#2){% +\def\tkz@DrawLine[#1](#2,#3){% \begingroup \pgfqkeys{/tkzdrawl}{#1} -\ifcase\tkz@numdl% - \tkzDrawMedian[#1](#2) - \or% 1 - \tkzDrawAltitude[#1](#2) - \or% 2 - \tkzDrawBisector[#1](#2) - \or% 3 - \tkzDrawSLine[#1](#2) - \fi -\endgroup -} -%<--------------------------------------------------------------------------–> -% Droites particulières d'un triangle -%<--------------------------------------------------------------------------–> -% -%<--------------------------------------------------------------------------–> -\def\tkzDrawSLine{\pgfutil@ifnextchar[{\tkz@DrawSLine}{\tkz@DrawSLine[]}} -\def\tkz@DrawSLine[#1](#2,#3){% -\begingroup -\draw[line style,#1] (#2) to (#3); -\endgroup -}% -%<--------------------------------------------------------------------------–> -% median -%<--------------------------------------------------------------------------–> -\def\tkzDrawMedian{\pgfutil@ifnextchar[{\tkz@Median}{\tkz@Median[]}} -\def\tkz@Median[#1](#2,#3,#4){% -\begingroup - \tkzDefMidPoint(#2,#4) - \tkzDrawSLine[add= 0 and 0,/tkzdrawl/.cd,#1](#3,tkzPointResult) -\endgroup -} -%<--------------------------------------------------------------------------–> -% altitude -%<--------------------------------------------------------------------------–> -\def\tkzDrawAltitude{\pgfutil@ifnextchar[{\tkz@Altitude}{\tkz@Altitude[]}} -\def\tkz@Altitude[#1](#2,#3,#4){% -\begingroup - \tkzUProjection(#2,#4)(#3) - \tkzDrawSLine[add= 0 and 0,/tkzdrawl/.cd,#1](#3,tkzPointResult) -\endgroup -} -%<--------------------------------------------------------------------------–> -% bisector -%<--------------------------------------------------------------------------–> -\def\tkzDrawBisector{\pgfutil@ifnextchar[{\tkz@Bisector}{\tkz@Bisector[]}} -\def\tkz@Bisector[#1](#2,#3,#4){% -\begingroup - \tkzDefBisectorLine(#2,#3,#4) - \tkzInterLL(#2,#4)(#3,tkzPointResult) - \tkzDrawSLine[add= 0 and 0,/tkzdrawl/.cd,#1](#3,tkzPointResult) -\endgroup -} -%<--------------------------------------------------------------------------–> -%<--------------------------------------------------------------------------–> -% \def\tkz@recuplast(#1,#2){\def\tkz@last{#1}} -% \def\tkz@stop{\tkz@stop} -%<--------------------------------------------------------------------------–> -% medians -%<--------------------------------------------------------------------------–> -\def\tkz@@Medians(#1,#2,#3)(#4,#5){% - \def\tkz@tmp{#5}% - \ifx\tkz@tmp\tkz@stop\else\tkz@@Medians(#2,#3)(#5)\fi - \tkz@recuplast(#3) - - \pgfcoordinate{#4}{\pgfpointscale{0.5}{% - \pgfpointadd{\pgfpointanchor{#2}{center}}{% - \pgfpointanchor{\tkz@last}{center}}% - }}% - \protected@edef\tkz@temp{\noexpand - \tkzDrawLine[add= 0 and 0,/DrawTLines/.cd,\tkz@opttline](#4,#1)}\tkz@temp% - \ifx\tkzutil@empty\tkz@newpoint@name - \else - \coordinate (\tkz@newpoint@name#4) at (#4); - \fi -} -\def\tkzDrawMedians{\pgfutil@ifnextchar[{\tkz@Medians}{\tkz@Medians[]}} -\def\tkz@Medians[#1](#2)#3{% -\begingroup - \xdef\tkz@opttline{#1} - \tkz@@Medians(#2,#2)(#3,\tkz@stop) - \endgroup -} - -%<--------------------------------------------------------------------------–> -% Altitudes -%<--------------------------------------------------------------------------–> -\def\tkz@@Altitudes(#1,#2,#3)(#4,#5){% - \def\tkz@tmp{#5}% - \ifx\tkz@tmp\tkz@stop\else\tkz@@Altitudes(#2,#3)(#5)\fi - \tkz@recuplast(#3) - \tkzUProjection(#2,\tkz@last)(#1) - \pgfnodealias{tkz@tmp@pt}{tkzPointResult} - \protected@edef\tkz@temp{% - \noexpand - \tkzDrawLine[add= 0 and 0,/DrawTLines/.cd,\tkz@opttline](#1,tkz@tmp@pt)}\tkz@temp% - \ifx\tkzutil@empty\tkz@newpoint@name - \else - \coordinate (\tkz@newpoint@name#4) at (tkz@tmp@pt); - \fi -} -\def\tkzDrawAltitudes{\pgfutil@ifnextchar[{\tkz@DrawAltitudes}{\tkz@DrawAltitudes[]}} -\def\tkz@DrawAltitudes[#1](#2)#3{% -\begingroup - \xdef\tkz@opttline{#1} - \tkz@@Altitudes(#2,#2)(#3,\tkz@stop) - \endgroup - } -%<--------------------------------------------------------------------------–> -% bisectors -%<--------------------------------------------------------------------------–> -\def\tkz@@Bisectors(#1,#2,#3)(#4,#5){% -\def\tkz@tmp{#5}% -\ifx\tkz@tmp\tkz@stop\else\tkz@@Bisectors(#2,#3)(#5)\fi - \tkz@recuplast(#3) - \tkzDefBisectorLine(\tkz@last,#1,#2) - \tkzInterLL(#2,\tkz@last)(#1,tkzPointResult) - \pgfnodealias{tkz@tmp@pt}{tkzPointResult} - \protected@edef\tkz@temp{ - \noexpand \tkzDrawLine[add= 0 and 0, - /DrawTLines/.cd, - \tkz@opttline](#1,tkz@tmp@pt)}\tkz@temp - \ifx\tkzutil@empty\tkz@newpoint@name - \else - \coordinate (\tkz@newpoint@name#4) at (tkz@tmp@pt); - \fi -} -\def\tkzDrawBisectors{\pgfutil@ifnextchar[{\tkz@DrawBisectors}{\tkz@DrawBisectors[]}} - -\def\tkz@DrawBisectors[#1](#2)#3{% -\begingroup - \xdef\tkz@opttline{#1} - \tkz@@Bisectors(#2,#2)(#3,\tkz@stop) -\endgroup -} -%<-------------------------------------------------------------------------– -%<-------------------------------------------------------------------------– -%<-------------------------------------------------------------------------– -\def\tkz@numdtls{0} -\pgfkeys{/DrawTLines/.cd, - median/.code = \def\tkz@numdtls{0}, - altitude/.code = \def\tkz@numdtls{1}, - bisector/.code = \def\tkz@numdtls{2}, - median, - name/.store in = \tkz@newpoint@name, - name/.initial = {}, - name = {}, - /DrawTLines/.search also={/tikz} -} -%<--------------------------------------------------------------------------–> -% Drawing tr lines > -%<--------------------------------------------------------------------------–> -\def\tkzDrawTLines{\pgfutil@ifnextchar[{\tkz@DrawTLines}{\tkz@DrawTLines[]}} -\def\tkz@DrawTLines[#1](#2)#3{% -\begingroup -\pgfqkeys{/DrawTLines}{#1} -\ifcase\tkz@numdtls% - \tkzDrawMedians[#1](#2){#3} - \or% 1 - \tkzDrawAltitudes[#1](#2){#3} - \or% 2 - \tkzDrawBisectors[#1](#2){#3} - \fi + \draw[line style,#1] (#2) to (#3); \endgroup } %<-------------------------------------------------------------------------– @@ -231,11 +62,11 @@ %<--------------------------------------------------------------------------–> \pgfkeys{% tkzsuline/.cd, - line width/.code = {\xdef\tkz@line@lw{#1}}, - color/.code = {\xdef\tkz@line@color{#1}}, - style/.code = {\xdef\tkz@line@style{#1}}, - add/.code args = {#1 and #2} {\xdef\tkz@line@left{#1}% - \xdef\tkz@line@right{#2}}, + line width/.code = \def\tkz@line@lw{#1}, + color/.code = \def\tkz@line@color{#1}, + style/.code = \def\tkz@line@style{#1}, + add/.code args = {#1 and #2} {\def\tkz@line@left{#1} + \def\tkz@line@right{#2}}, /tkzsuline/.search also={/tikz}% } %<--------------------------------------------------------------------------–> @@ -268,10 +99,10 @@ \def\tkzDrawSegment{\pgfutil@ifnextchar[{\tkz@DrawSegment}{% \tkz@DrawSegment[]}} \def\tkz@DrawSegment[#1](#2,#3){% -\begingroup +\scope \pgfqkeys{/tkzdraws}{#1} \draw[line style,add=0 and 0,#1] (#2) to (#3); -\endgroup +\endscope }% \def\tkz@multiDrawSeg#1 #2\@nil{% @@ -387,17 +218,24 @@ % \draw[dim={7cm,10pt,transform shape}] (B) -- (C); % \draw[dim={X,,}] (A) -- (C); %<--------------------------------------------------------------------------–> +% code from muzimuzhi Z + \pgfkeys{/pgf/decoration/.cd, distance/.initial = 10pt} \pgfdeclaredecoration{add dim}{final}{ \state{final}{% \pgfmathsetmacro{\dist}{\pgfkeysvalueof{/pgf/decoration/distance}} - \pgfpathmoveto{\pgfpoint{0pt}{0pt}} + \pgfpathmoveto{\pgfpoint{0pt}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{1.2*\dist}} \pgfpathmoveto{\pgfpoint{\pgfdecoratedpathlength}{0pt}} - \pgfpathlineto{\pgfpoint{(\pgfdecoratedpathlength}{1.2*\dist}} + \pgfpathlineto{\pgfpoint{(\pgfdecoratedpathlength}{1.2*\dist}} + % start of patch + \pgfusepath{stroke} \pgfsetarrowsstart{latex} \pgfsetarrowsend{latex} + \expandafter\pgfsetdash\tkz@dim@dashpattern + \pgfsetstrokecolor{\tkz@dim@color} + % end of patch \pgfpathmoveto{\pgfpoint{0pt}{\dist}} \pgfpathlineto{\pgfpoint{\pgfdecoratedpathlength}{\dist}} \pgfusepath{stroke} @@ -424,12 +262,26 @@ }, dim/.default={,0pt,} } - +\tikzset{ + dim color/.store in=\tkz@dim@color, + dim color=black, + % similar to code for \tikzoption{dash pattern}{...} + dim dash pattern/.code={% + \def\tikz@temp{#1}% + \ifx\tikz@temp\pgfutil@empty% + \def\tkz@dim@dashpattern{{}{0pt}}% + \else% + \def\tikz@dashpattern{}% + \expandafter\tikz@scandashon\pgfutil@gobble#1o\@nil% + \edef\tkz@dim@dashpattern{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% + \fi + }, + dim dash pattern=, +} %<--------------------------- style line ---------------------------------> \tikzset{add/.style args={#1 and #2}{to path={% ($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostart)$)% \tikztonodes}} } -%<--------------------------------------------------------------------------–> \makeatother -\endinput +\endinput
\ No newline at end of file |