summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfplots.paths.code.tex
blob: 7ea1bceee734f91ecaec9e93acf97b3a774f924a (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
%--------------------------------------------
%
% Package pgfplots
%
% Provides a user-friendly interface to create function plots (normal
% plots, semi-logplots and double-logplots).
% 
% It is based on Till Tantau's PGF package.
%
% Copyright 2007-2012 by Christian Feuersänger.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% 
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
%--------------------------------------------
%

\newif\ifpgfplots@path@replace@ellipse

\def\pgfplots@install@path@replacements{%
	\ifpgfplots@path@replace@ellipse
		\let\tikz@do@circle=\pgfplots@path@@tikz@do@circle
		\let\tikz@do@ellipse=\pgfplots@path@@tikz@do@ellipse
		\expandafter\def\expandafter\pgfinterruptpicture\expandafter{\pgfinterruptpicture
			\let\tikz@do@circle=\pgfplots@path@@tikz@do@circle@orig
			\let\tikz@do@ellipse=\pgfplots@path@@tikz@do@ellipse@orig
		}%
	\fi
}%

\let\pgfplots@path@@tikz@do@circle@orig=\tikz@do@circle
\let\pgfplots@path@@tikz@do@ellipse@orig=\tikz@do@ellipse

% This is a replacement for \tikz@do@circle which replaces the "xy"
% coordinate system by one which is compatible with pgfplots.
\def\pgfplots@path@@tikz@do@circle#1{%
  \begingroup
  \ifpgfplots@usefpu
	\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
  \fi
  \pgfmathparse{#1}%
  \let\tikz@ellipse@x=\pgfmathresult%
  \ifpgfmathunitsdeclared
    \pgfpathellipse{\pgfpointorigin}%
      {\pgfqpoint{\tikz@ellipse@x pt}{0pt}}%
      {\pgfpoint{0pt}{\tikz@ellipse@x pt}}%
  \else
    \pgfpathellipse{\pgfpointorigin}%
      {\pgfplotspointaxisdirectionxy{\tikz@ellipse@x}{0}}%
      {\pgfplotspointaxisdirectionxy{0}{\tikz@ellipse@x}}%
  \fi
  \endgroup
}

\def\pgfplots@path@@tikz@do@ellipse#1#2{%
  \begingroup
  \ifpgfplots@usefpu
	\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
  \fi
  \pgfmathparse{#1}%
  \let\tikz@ellipse@x=\pgfmathresult%
  \ifpgfmathunitsdeclared%
    \pgfmathparse{#2}%
    \let\tikz@ellipse@y=\pgfmathresult%
    \ifpgfmathunitsdeclared%
      \pgfpathellipse{\pgfpointorigin}{%
        \pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}%
    \else%
      \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
    \fi%
  \else%
    \pgfmathparse{#2}%
    \let\tikz@ellipse@y=\pgfmathresult%
    \ifpgfmathunitsdeclared%
      \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
    \else%
      \pgfpathellipse{\pgfpointorigin}
	  	{\pgfplotspointaxisdirectionxy{\tikz@ellipse@x}{0}}
		{\pgfplotspointaxisdirectionxy{0}{\tikz@ellipse@y}}%
    \fi%
  \fi%
  \endgroup
}

% Older versions of TikZ did not define \tikz@do@ellipse but only
% \tikz@do@circle which took the place of \tikz@do@ellipse, i.e. the same code
% was used for both paths.  In that case, we override the new circle code with
% the ellipse code to retain the behaviour of using the same code on both
% paths.
\ifdefined\tikz@do@ellipse\else
	\let\pgfplots@path@@tikz@do@circle=\pgfplots@path@@tikz@do@ellipse
\fi