summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-vectors.tex
blob: 15637a8e9753cb99b2a2688e38d0ce3e5fa5fe38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
% 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}   

 %<--------------------------------------------------------------------------–>
%                          Vectors
%<--------------------------------------------------------------------------–>

%<-------------------------------------------------------------------------–> 
%<-------------------------------------------------------------------------–> 
\def\tkzAddVectors(#1,#2)(#3,#4)#5{% 
  \begingroup
    \pgfpointdiff{\pgfpointanchor{#3}{center}}%
                 {\pgfpointanchor{#4}{center}}%
    \pgf@xb=\pgf@x%
    \pgf@yb=\pgf@y%
    \path[coordinate] (#2)--+(\pgf@xb,\pgf@yb) coordinate (#5);
   \endgroup 
  }
%<--------------------------------------------------------------------------–>
%                             Draw   vector
%<--------------------------------------------------------------------------–>
\tikzset{vector style/.style={>=latex,->}}
\pgfkeys{
/tkzvec/.cd,
mark options/.code   =\tikzset{mkstyle/.style={#1}}%
                               \global\edef\tkz@mk@arg{#1},
label options/.code  =\tikzset{lbstyle/.style={#1}}%
                                \global\edef\tkz@lb@arg{#1},
 /tkzvec/.unknown/.code ={\let\searchname=\pgfkeyscurrentname
                        \pgfkeysalso{\searchname/.try=#1,
                                     /tikz/\searchname/.retry=#1}}
}
\def\tkzDrawVector{\pgfutil@ifnextchar[{\tkz@DrawVector}{%
                                         \tkz@DrawVector[]}}
 \def\tkz@DrawVector[#1](#2,#3){%
\begingroup
\pgfkeys{/tkzvec/.cd,mark options={},label options={}}
\pgfqkeys{/tkzvec}{#1}
% \ifx\tkzutil@empty\tkz@line@symbol
    \draw[vector style,#1] (#2) to (#3);
%  \else
%    \draw[vector style,line style,add=0 and 0,#1](#2) to node[sloped]
%       {\textcolor{\tkz@line@colorsymbol}{\tkz@line@symbol}}(#3);
%    \fi
% \ifx\tkzutil@empty\tkz@line@label
% \else
%   \path (#2) to  node[above=\tkz@line@poslabel]%
%       {\textcolor{\tkz@line@colorlabel}{\tkz@line@label}}(#3);
%             \fi\fi
     \endgroup
}
%<-------------------------------------------------------------------------–> 
%<-------------------------------------------------------------------------–> 

\def\tkzLabelVector{\pgfutil@ifnextchar[{\tkz@LabelVector}{%
                                        \tkz@LabelVector[]}}
\def\tkz@LabelVector[#1](#2,#3)#4{%
\begingroup    
\path  (#2) to node[above,#1]{#4} (#3) ;  
\endgroup 
}
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–>
% multiple
\def\tkz@multiLV#1 #2\@nil{%
 \protected@edef\tkz@temp{
   \noexpand \tkzLabelVector[\tkz@optlv](#1){\tkz@labelvec}}\tkz@temp%
   \def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
     \let\next\@gobble
   \fi
   \next#2\@nil
}
%<--------------------------------------------------------------------------–>
% correction 09/12/2010
\def\tkzLabelVectors{\pgfutil@ifnextchar[{\tkz@LabelVectors}{%
                                           \tkz@LabelVectors[]}}
\def\tkz@LabelVectors[#1](#2)#3{% 
\global\edef\tkz@optlv{#1}
\global\def\tkz@labelvec{#3}  
  \begingroup
   \let\next\tkz@multiLV
   \next#2 \@nil %    
\endgroup 
}   
%<-------------------------------------------------------------------------–> 
%<-------------------------------------------------------------------------–> 

 \def\tkz@multiVec#1 #2\@nil{% 
  \protected@edef\tkz@temp{
    \noexpand \tkzDrawVector[\tkz@optvec](#1)}\tkz@temp% 
    \def\tkz@nextArg{#2}%
    \ifx\tkzutil@empty\tkz@nextArg
      \let\next\@gobble
    \fi
    \next#2\@nil
 }

\def\tkzDrawVectors{\pgfutil@ifnextchar[{\tkz@DrawVectors}{%
                                        \tkz@DrawVectors[]}}  
\def\tkz@DrawVectors[#1](#2){% 
\global\edef\tkz@optvec{#1} 
 \begingroup
    \let\next\tkz@multiVec
    \next#2 \@nil %    
 \endgroup
 }

 
%<-------------------------------------------------------------------------–> 
\endinput