% 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.13 c}
\def\filedate{2011/01/19}   

 %<--------------------------------------------------------------------------–>
%                          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