summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex')
-rw-r--r--Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex425
1 files changed, 425 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex b/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex
new file mode 100644
index 00000000000..76923e844b7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-eu-draw-lines.tex
@@ -0,0 +1,425 @@
+% tkz-obj-eu-draw-lines.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.
+\def\fileversion{3.01c}
+\def\filedate{2020/01/23}
+\typeout{2020/01/23 3.01c tkz-obj-eu-draw-lines.tex}
+\makeatletter
+\def\tkz@numdl{0}
+\pgfkeys{/DrawLine/.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,
+ /DrawLine/.search also={/tikz}
+}
+%<--------------------------------------------------------------------------–>
+% Drawing a line >
+%<--------------------------------------------------------------------------–>
+\def\tkzDrawLine{\pgfutil@ifnextchar[{\tkz@DrawLine}{\tkz@DrawLine[]}}
+\def\tkz@DrawLine[#1](#2){%
+\begingroup
+\pgfqkeys{/DrawLine}{#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[#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,/DrawLine/.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,/DrawLine/.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,/DrawLine/.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
+\endgroup
+}
+%<-------------------------------------------------------------------------–
+% tkzDrawLines
+%<-------------------------------------------------------------------------–
+\def\tkz@@multiLines#1 #2\@nil{%
+ \protected@edef\tkz@temp{
+ \noexpand \tkzDrawLine[\tkz@optline](#1)}\tkz@temp%
+ \def\tkz@nextArg{#2}%
+ \ifx\tkzutil@empty\tkz@nextArg
+ \let\next\@gobble
+ \fi
+ \next#2\@nil
+}
+%<--------------------------------------------------------------------------–>
+\def\tkzDrawLines{\pgfutil@ifnextchar[{\tkz@DrawLines}{%
+ \tkz@DrawLines[]}}
+\def\tkz@DrawLines[#1](#2){%
+\xdef\tkz@optline{#1}
+\begingroup
+ \let\next\tkz@@multiLines
+ \next#2 \@nil %
+\endgroup
+}%
+%<-------------------------------------------------------------------------–>
+% Label
+%<-------------------------------------------------------------------------–>
+\def\tkzLabelLine{\pgfutil@ifnextchar[{\tkz@AddLabelLine}{\tkz@AddLabelLine[]}}
+\def\tkz@AddLabelLine[#1](#2,#3)#4{\path (#2) to node[#1]{#4}(#3);}
+
+%<--------------------------------------------------------------------------–>
+% Setup Line
+%<--------------------------------------------------------------------------–>
+\pgfkeys{%
+ setupline/.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}%
+ }
+}
+%<--------------------------------------------------------------------------–>
+\def\tkzSetUpLine{\pgfutil@ifnextchar[{\tkzActivOff\tkz@SetUpLine}{%
+ \tkzActivOff\tkz@SetUpLine[]}}
+\def\tkz@SetUpLine[#1]{%
+\pgfkeys{%
+ setupline/.cd,
+ line width = \tkz@euc@linewidth,
+ color = \tkz@euc@linecolor,
+ style = \tkz@euc@linestyle,
+ add = {\tkz@euc@lineleft} and {\tkz@euc@lineright}}
+\pgfqkeys{/setupline}{#1}
+%<--------------------------------------------------------------------------–>
+% Line style
+%<--------------------------------------------------------------------------–>
+\tikzset{%
+ line style/.style ={%
+ color = \tkz@line@color,
+ line width = \tkz@line@lw,
+ style = \tkz@line@style,
+ add = {\tkz@line@left} and {\tkz@line@right}
+}}}% end setup
+%<--------------------------------------------------------------------------–>
+% draw segment (s)
+%<--------------------------------------------------------------------------–>
+\pgfkeys{/@tkzsegoptions/.cd,
+ /@tkzsegoptions/.search also={/tikz},
+}
+\def\tkzDrawSegment{\pgfutil@ifnextchar[{\tkz@DrawSegment}{%
+ \tkz@DrawSegment[]}}
+\def\tkz@DrawSegment[#1](#2,#3){%
+\begingroup
+ \pgfqkeys{/@tkzsegoptions}{#1}
+ \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){%
+\def\tkz@optseg{#1}
+\begingroup
+ \let\next\tkz@multiDrawSeg
+ \next#2 \@nil %
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% Mark Segment
+%<--------------------------------------------------------------------------–>
+\pgfkeys{
+ /@tkzmarkoptions/.cd,
+ pos/.store in = \tkz@mkpos,
+ color/.store in = \tkz@mkcolor,
+ mark/.store in = \tkz@markseg,
+ size/.store in = \tkz@mksize,
+ size = 4pt,
+ color = \tkz@mk@color,
+ pos = .5,
+ mark = |,
+ /@tkzmarkoptions/.search also={/tikz},
+}
+\def\tkzMarkSegment{\pgfutil@ifnextchar[{\tkz@MarkSegment}{\tkz@MarkSegment[]}}
+\def\tkz@MarkSegment[#1](#2,#3){%
+\begingroup
+ \pgfqkeys{/@tkzmarkoptions}{#1}
+\def\tkz@mymark{\pgfsetplotmarksize{\tkz@mksize}\pgfuseplotmark{\tkz@markseg}}
+\begin{scope}
+ [decoration={markings,mark=at position \tkz@mkpos with {\tkz@mymark}}]
+ \path [\tkz@mkcolor,/@tkzmarkoptions/.cd,#1,postaction={decorate}] (#2) -- (#3);
+\end{scope}
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% 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){%
+\def\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[label seg style,#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{%
+\def\tkz@optls{#1}
+\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[line style,#1] (#2)
+ \foreach \po in {#3}{--(\po)};%
+\endgroup
+}
+%<--------------------------------------------------------------------------–>
+% add dim
+ % \draw[dim={5cm,7pt,}] (A) -- (B);
+ % \draw[dim={7cm,10pt,transform shape}] (B) -- (C);
+ % \draw[dim={X,,}] (A) -- (C);
+%<--------------------------------------------------------------------------–>
+\pgfkeys{/pgf/decoration/.cd, distance/.initial = 10pt}
+
+\pgfdeclaredecoration{add dim}{final}{
+\state{final}{%
+\pgfmathsetmacro{\dist}{\pgfkeysvalueof{/pgf/decoration/distance}}
+ \pgfpathmoveto{\pgfpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{1.2*\dist}}
+ \pgfpathmoveto{\pgfpoint{\pgfdecoratedpathlength}{0pt}}
+ \pgfpathlineto{\pgfpoint{(\pgfdecoratedpathlength}{1.2*\dist}}
+ \pgfsetarrowsstart{latex}
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{0pt}{\dist}}
+ \pgfpathlineto{\pgfpoint{\pgfdecoratedpathlength}{\dist}}
+ \pgfusepath{stroke}
+ \pgfpathmoveto{\pgfpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgfdecoratedpathlength}{0pt}}
+}}
+
+\tikzset{
+ dim/.style args={#1,#2,#3}{%
+ decoration = {add dim,distance=\ifx&#2&0pt\else#2\fi},
+ decorate,
+ postaction = {%
+ decorate,
+ decoration={%
+ raise=#2,
+ markings,
+ mark=at position .5 with {%
+ \node[inner sep=0pt,
+ font=\footnotesize,
+ fill=\tkz@fillcolor,
+ #3] at (0,0) {#1};}
+ }
+ }
+ },
+ dim/.default={,0pt,}
+}
+
+%<--------------------------- style line --------------------------------->
+\tikzset{add/.style args={#1 and #2}{to path={%
+ ($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostart)$)%
+ \tikztonodes}}
+}
+%<--------------------------------------------------------------------------–>
+\makeatother
+\endinput