diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircmath.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/circuitikz/pgfcircmath.tex | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmath.tex new file mode 100644 index 00000000000..2cfac94739f --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmath.tex @@ -0,0 +1,51 @@ +% Copyright 2007-2009 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +% angle between 0 and 360 +\def\pgf@circ@slope#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@x<0.1pt + \ifdim\pgf@x>-0.1pt % vertical + \ifdim\pgf@y<0pt + \def\pgfmathresult{-90.0} + \else + \def\pgfmathresult{+90.0} + \fi + \else % oblique with dx < 0 + \pgfmathdivide{\pgf@y}{\pgf@x} + \pgfmathatan{\pgfmathresult} + \ifdim\pgf@x<0pt + \pgfmathsubtract{\pgfmathresult}{+180} + \fi + \fi + \else % oblique with dx > 0 + \pgfmathdivide{\pgf@y}{\pgf@x} + \pgfmathatan{\pgfmathresult} + \ifdim\pgf@x<0pt + \pgfmathsubtract{\pgfmathresult}{+180} + \fi + \fi + \pgf@x=\pgfmathresult pt + \ifdim\pgf@x<0pt + \pgfmathadd{\pgfmathresult}{+360} + \fi + } + +\endinput + |