diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots')
14 files changed, 1123 insertions, 205 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.fillbetween.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.fillbetween.code.tex index b9a38406a75..e548032e2d3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.fillbetween.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.fillbetween.code.tex @@ -50,22 +50,62 @@ \usetikzlibrary{fillbetween} \usepgfplotslibrary{decorations.softclip} +% Takes a domain #1:#2 and returns a new domain \pgfplotsretval:\pgfplotsretvalb which is larger. +\def\pgfplots@softclip@enlarge#1#2{% + \begingroup + \pgfplotscoordmath{default}{parse}{0.1*(#2-#1)}\let\pgfplots@diff=\pgfmathresult + \pgfplotscoordmath{default}{if is}{\pgfplots@diff}{+}{% + % ok, max > min. Should always be the case. + \pgfplotscoordmath{default}{parse}{#1-\pgfplots@diff}\let\pgfplots@min=\pgfmathresult + \pgfplotscoordmath{default}{parse}{#2+\pgfplots@diff}\let\pgfplots@max=\pgfmathresult + }{% + \pgfplotscoordmath{default}{if is}{\pgfplots@diff}{0}{% + % ok, max == min. Very Strange. + \pgfplotscoordmath{default}{parse}{#1-1}\let\pgfplots@min=\pgfmathresult + \pgfplotscoordmath{default}{parse}{#2+1}\let\pgfplots@max=\pgfmathresult + }{% + % ok, max < min. Strange. + \pgfplotscoordmath{default}{parse}{#1+\pgfplots@diff}\let\pgfplots@min=\pgfmathresult + \pgfplotscoordmath{default}{parse}{#2-\pgfplots@diff}\let\pgfplots@max=\pgfmathresult + }% + }% + \global\let\pgfplots@glob@TMPa=\pgfplots@min + \global\let\pgfplots@glob@TMPb=\pgfplots@max + \endgroup + \let\pgfplotsretval=\pgfplots@glob@TMPa + \let\pgfplotsretvalb=\pgfplots@glob@TMPb +}% + \pgfkeys{ /pgfplots/every fill between plot/.style={/pgfplots/area legend,/tikz/fill,/pgfplots/on layer=pre main}, /tikz/soft clip assign/domain/.code args={#1:#2}{% \pgfplotsifisvisualizationphase{% + \ifpgfplots@yislinear + \pgfplots@softclip@enlarge + {min(\pgfkeysvalueof{/pgfplots/ymin},\pgfplots@data@ymin)}% + {max(\pgfkeysvalueof{/pgfplots/ymax},\pgfplots@data@ymax)}% + \else + \pgfplots@softclip@enlarge{\pgfkeysvalueof{/pgfplots/ymin}}{\pgfkeysvalueof{/pgfplots/ymax}}% + \fi \edef\pgfplots@loc@TMPa{% - (axis cs:#1,\pgfkeysvalueof{/pgfplots/ymin}) - rectangle (axis cs:#2,\pgfkeysvalueof{/pgfplots/ymax})}% + (axis cs:#1,\pgfplotsretval) + rectangle (axis cs:#2,\pgfplotsretvalb)}% \pgfkeysalso{/tikz/soft clip assign/path/.expand once=\pgfplots@loc@TMPa}% }{}% },% /tikz/soft clip assign/y domain y/.style={/tikz/soft clip assign/domain y={#1}}, /tikz/soft clip assign/domain y/.code args={#1:#2}{% \pgfplotsifisvisualizationphase{% + \ifpgfplots@yislinear + \pgfplots@softclip@enlarge + {min(\pgfkeysvalueof{/pgfplots/xmin},\pgfplots@data@xmin)}% + {max(\pgfkeysvalueof{/pgfplots/xmax},\pgfplots@data@xmax)}% + \else + \pgfplots@softclip@enlarge{\pgfkeysvalueof{/pgfplots/xmin}}{\pgfkeysvalueof{/pgfplots/xmax}}% + \fi \edef\pgfplots@loc@TMPa{% - (axis cs:\pgfkeysvalueof{/pgfplots/xmin},#1) - rectangle (axis cs:\pgfkeysvalueof{/pgfplots/xmax},#2)}% + (axis cs:\pgfplotsretval,#1) + rectangle (axis cs:\pgfplotsretvalb,#2)}% \pgfkeysalso{/tikz/soft clip assign/path/.expand once=\pgfplots@loc@TMPa}% }{}% },% diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 5812550a4fc..4e33bacd635 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -1159,8 +1159,15 @@ \else \def\pgfplotstable@loc@TMPa{#2}% \fi + % + % let the table contain one column named '@@@@@temporary@column@': \pgfplotslistnew#3{@@@@@temporary@column@\\}% - \expandafter\pgfplots@assign@list\csname\string#3@@@@@@temporary@column@\endcsname{1,2,...,\pgfplotstable@loc@TMPa}% + % populate the temporary column with enough rows: + \ifnum\pgfplotstable@loc@TMPa>0 + \expandafter\pgfplots@assign@list\csname\string#3@@@@@@temporary@column@\endcsname{1,...,\pgfplotstable@loc@TMPa}% + \else + \expandafter\pgfplotslistnewempty\csname\string#3@@@@@@temporary@column@\endcsname% + \fi % % now, create all real columns: \pgfplotstableset{#1,% diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex index 1cb10748269..b8f63abe8ad 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex @@ -1731,11 +1731,36 @@ \ifpgfplotstable@search@header \ifpgfplotstableread@curline@contains@colnames \else - \pgfplotstableread@isnumber@ITERATE#1\pgfplotstable@EOI + \def\pgfplotstableread@CURTOK{#1}% + % can we safely use the \pgfmathfloatparsenumber here? I + % doubt it -- what if the header contains macros? + % + % there is no (simple) expandable "to lower case". check + % for the most common forms here. + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@nan + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@NaN + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@NAN + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@inf + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@Inf + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@INF + \else + \pgfplotstableread@isnumber@ITERATE#1\pgfplotstable@EOI + \fi\fi\fi\fi\fi\fi %\ifpgfplotstableread@curline@contains@colnames\pgfplots@message{'#1' is a column name!}\else\pgfplots@message{'#1' is NO column name!}\fi \fi \fi } +\def\pgfplotstableread@isnumber@nan{nan} +\def\pgfplotstableread@isnumber@NaN{NaN} +\def\pgfplotstableread@isnumber@NAN{NAN} +\def\pgfplotstableread@isnumber@inf{inf} +\def\pgfplotstableread@isnumber@INF{INF} +\def\pgfplotstableread@isnumber@Inf{Inf} \def\pgfplotstableread@isnumber@plus{+} \def\pgfplotstableread@isnumber@minus{-} \def\pgfplotstableread@isnumber@zero{0} diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_leq.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_leq.code.tex new file mode 100644 index 00000000000..8be16c806a4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_leq.code.tex @@ -0,0 +1,279 @@ +% ====================================================== +% compatibility with PGF 3.0.1a +% ====================================================== +% +%%% This file is a copy of some part of PGF/Tikz. +%%% It has been copied here to provide : +%%% - compatibility with older PGF versions +%%% - availability of PGF contributions by Christian Feuersaenger +%%% which are necessary or helpful for pgfplots. +%%% +%%% It contains a couple of patches such that selected changes which +%%% are also part of PGF/TikZ (and can be found in the development +%%% version of PGF/TikZ) are available within pgfplots. +%%% +%%% this file contains solvers which have been written by Christian Feuersaenger (primarily, but not only, for pgfplots) + +% Solves a linear equation system of size 2x2 using gauss elimination. +% +% It employs TeX register arithmetics to do so. +% #1: should contain 4 sets of braces with matrix entries, +% {<a11>}{<a12>} +% {<a21>}{<a22>} +% where each entry should be a number without unit. +% It is acceptable if '#1' is a macro which expands to the expected +% format. +% #2: should contain 2 sets of braces with the right-hand-side, +% {<r1>}{<r2>} +% where each entry should be a number without unit. +% It is acceptable if '#2' is a macro which expands to the expected +% format. +% +% It will assign \pgfmathresult to contain two sets of braces with the +% result. +% +% Example: +% \pgfutilsolvetwotwoleq{ +% {0.24}{1} +% {-0.97}{0} +% }{ +% {-7} +% {18} +% } +% -> yields \pgfmathresult={−18.55618}{−2.54642} +% +% The algorithm employs column pivotisation. +% +% If the matrix is singular, the routine will return {}. +\def\pgfutilsolvetwotwoleq#1#2{% + \begingroup + \dimendef\aa=0 + \dimendef\ab=1 + \dimendef\ba=2 + \dimendef\bb=3 + \dimendef\ra=4 + \dimendef\rb=5 + \dimendef\tmpa=6 + \dimendef\tmpb=7 + \edef\pgf@temp{#1}% + \expandafter\pgfutilsolvetwotwoleq@A\pgf@temp + \edef\pgf@temp{#2}% + \expandafter\pgfutilsolvetwotwoleq@r\pgf@temp + % + \pgfutilsolvetwotwoleq@ifislarger\aa\ba{% + % identity "permutation": + \def\Pa{a}% + \def\Pb{b}% + }{% + % permutation matrix: switch rows! + \def\Pa{b}% + \def\Pb{a}% + }% + % \pivot := 1/aa + \tmpa=\csname m\Pa a\endcsname pt % + \ifdim\tmpa<0pt \tmpa=-\tmpa\fi + \ifdim\tmpa<0.0001pt + % singular matrix! + \let\pgfmathresult=\pgfutil@empty + \else + \pgfmathreciprocal@ + {\csname m\Pa a\endcsname}% + \let\pivot=\pgfmathresult + % + % \factor := 1/aa * ba + \csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname + \edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}% + % + % bb -= ba/aa * ab + \tmpa=-\factor\csname \Pa b\endcsname + \advance\csname \Pb b\endcsname by\tmpa + % + % rb -= ba/aa * ra + \tmpa=-\factor\csname r\Pa\endcsname + \advance\csname r\Pb\endcsname by\tmpa + % + \tmpa=\csname \Pb b\endcsname% + \ifdim\tmpa<0pt \tmpa=-\tmpa\fi + \ifdim\tmpa<0.0001pt + % singular matrix! + \let\pgfmathresult=\pgfutil@empty + \else + % xb := rb / bb (the modified rb and modified bb!) + \pgfmathdivide@ + {\expandafter\pgf@sys@tonumber\csname r\Pb\endcsname} + {\expandafter\pgf@sys@tonumber\csname \Pb b\endcsname}% + \expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult + % + % ra := ra - xb * ab + \tmpa=\csname pgfmathresult\Pb\endcsname\csname \Pa b\endcsname + \advance\csname r\Pa\endcsname by-\tmpa + % + % xa := 1/aa * ra (the modified ra!) + \tmpa=\pivot\csname r\Pa\endcsname + \expandafter\edef\csname pgfmathresult\Pa\endcsname{\pgf@sys@tonumber\tmpa}% + % + \edef\pgfmathresult{% + {\csname pgfmathresult\Pa\endcsname}% + {\csname pgfmathresult\Pb\endcsname}% + }% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\def\pgfutilsolvetwotwoleq@ifislarger#1#2#3#4{% + \tmpa=#1 + \ifdim\tmpa<0pt + \multiply\tmpa by-1 + \fi + \tmpb=#2 + \ifdim\tmpb<0pt + \multiply\tmpb by-1 + \fi + \ifdim\tmpa>\tmpb + #3% + \else + #4% + \fi +}% + +\def\pgfutilsolvetwotwoleqfloat@ifislarger#1#2#3#4{% + \pgfmathfloatabs@{#1}\let\tmpa=\pgfmathresult + \pgfmathfloatabs@{#2}\let\tmpb=\pgfmathresult + \pgfmathfloatlessthan@{\tmpb}{\tmpa}% + \ifpgfmathfloatcomparison + #3% + \else + #4% + \fi +}% +\def\pgfutilsolvetwotwoleq@A#1#2#3#4{% + \def\maa{#1}\def\mab{#2}% + \def\mba{#3}\def\mbb{#3}% + \aa=#1pt \ab=#2pt + \ba=#3pt \bb=#4pt +} +\def\pgfutilsolvetwotwoleq@r#1#2{% + \ra=#1pt \rb=#2pt +}% +\def\pgfutilsolvetwotwoleqfloat@A#1#2#3#4{% + \pgfmathfloatparsenumber{#1}\let\maa=\pgfmathresult + \pgfmathfloatparsenumber{#2}\let\mab=\pgfmathresult + \pgfmathfloatparsenumber{#3}\let\mba=\pgfmathresult + \pgfmathfloatparsenumber{#4}\let\mbb=\pgfmathresult +} +\def\pgfutilsolvetwotwoleqfloat@r#1#2{% + \pgfmathfloatparsenumber{#1}\let\ra=\pgfmathresult + \pgfmathfloatparsenumber{#2}\let\rb=\pgfmathresult +}% + +% Same as \pgfutilsolvetwotwoleq, but using floating point +% arithmetics. The return value is still in fixed point. +\def\pgfutilsolvetwotwoleqfloat#1#2{% + \begingroup + \pgfmathfloatcreate{1}{1.0}{-4}% FIXME : use a smaller threshold for FPU? + \let\thresh=\pgfmathresult + % + \edef\pgf@temp{#1}% + \expandafter\pgfutilsolvetwotwoleqfloat@A\pgf@temp + \edef\pgf@temp{#2}% + \expandafter\pgfutilsolvetwotwoleqfloat@r\pgf@temp + % + \pgfutilsolvetwotwoleqfloat@ifislarger\maa\mba{% + % identity "permutation": + \def\Pa{a}% + \def\Pb{b}% + }{% + % permutation matrix: switch rows! + \def\Pa{b}% + \def\Pb{a}% + }% + % \pivot := 1/aa + \expandafter\pgfmathfloatabs@\expandafter{\csname m\Pa a\endcsname}% + \let\tmpa=\pgfmathresult + \pgfmathfloatlessthan@{\tmpa}{\thresh}% + \ifpgfmathfloatcomparison + % singular matrix! + \let\pgfmathresult=\pgfutil@empty + \else + \expandafter\pgfmathfloatreciprocal@\expandafter{\csname m\Pa a\endcsname}% + \let\pivot=\pgfmathresult + % + % \factor := 1/aa * ba + \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pb a\endcsname}{\pivot}% + \let\factor=\pgfmathresult + \expandafter\let\csname m\Pb a\endcsname=\factor + % + % bb -= ba/aa * ab + \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pa b\endcsname}{\factor}% + \let\tmpa=\pgfmathresult + \expandafter\pgfmathfloatsubtract@\expandafter{\csname m\Pb b\endcsname}{\tmpa}% + \expandafter\let\csname m\Pb b\endcsname=\pgfmathresult + % + % rb -= ba/aa * ra + \expandafter\pgfmathfloatmultiply@\expandafter{\csname r\Pa\endcsname}{\factor}% + \let\tmpa=\pgfmathresult + \expandafter\pgfmathfloatsubtract@\expandafter{\csname r\Pb\endcsname}{\tmpa}% + \expandafter\let\csname r\Pb\endcsname=\pgfmathresult + % + \expandafter\pgfmathfloatabs@\expandafter{\csname m\Pb b\endcsname}% + \let\tmpa=\pgfmathresult + \pgfmathfloatlessthan@{\tmpa}{\thresh}% + \ifpgfmathfloatcomparison + % singular matrix! + \let\pgfmathresult=\pgfutil@empty + \else + % xb := rb / bb (the modified rb and modified bb!) + \edef\pgf@marshal{ + \noexpand\pgfmathfloatdivide@ + {\csname r\Pb\endcsname} + {\csname m\Pb b\endcsname}% + }% + \pgf@marshal + \expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult + \let\tmpa=\pgfmathresult + % + % ra := ra - xb * ab + \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pa b\endcsname}{\tmpa}% + \let\tmpa=\pgfmathresult + \expandafter\pgfmathfloatsubtract@\expandafter{\csname r\Pa\endcsname}{\tmpa}% + \expandafter\let\csname r\Pa\endcsname=\pgfmathresult + % + % xa := 1/aa * ra (the modified ra!) + \expandafter\pgfmathfloatmultiply@\expandafter{\csname r\Pa\endcsname}{\pivot}% + \expandafter\let\csname pgfmathresult\Pa\endcsname=\pgfmathresult + % + \edef\pgfmathresult{% + {\csname pgfmathresult\Pa\endcsname}% + {\csname pgfmathresult\Pb\endcsname}% + }% + \expandafter\pgfutilsolvetwotwoleqfloat@to@pgf@range\pgfmathresult + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +\def\pgfutilsolvetwotwoleqfloat@to@pgf@range#1#2{% + \pgfmathfloatcreate{1}{1.6}{4}\let\pgfutilsolvetwotwoleqfloat@to@pgf@range@max=\pgfmathresult + \pgfmathfloatabs@{#1}% + \expandafter\pgfmathfloatlessthan@\expandafter{\pgfmathresult}{\pgfutilsolvetwotwoleqfloat@to@pgf@range@max}% + \ifpgfmathfloatcomparison + \pgfmathfloatabs@{#2}% + \expandafter\pgfmathfloatlessthan@\expandafter{\pgfmathresult}{\pgfutilsolvetwotwoleqfloat@to@pgf@range@max}% + \ifpgfmathfloatcomparison + % ok. + \pgfmathfloattofixed{#1}\let\tmpa=\pgfmathresult + \pgfmathfloattofixed{#2}% + \edef\pgfmathresult{{\tmpa}{\pgfmathresult}}% + \else + % singular (because PGF cannot represent its result + \let\pgfmathresult=\pgfutil@empty + \fi + \else + % singular (because PGF cannot represent its result + \let\pgfmathresult=\pgfutil@empty + \fi +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index ab19ee35f13..b68c50eac2c 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -114,8 +114,7 @@ \fi - -\pgfutil@ifundefined{pgfmathfloatatan2}{ +\pgfutil@ifundefined{pgfmathfloat@stack@push@operand@single@str}{ \gdef\pgfplots@glob@TMPa{1}% } {}% @@ -323,5 +322,40 @@ % ok, plot function is up-to-date }% +\def\pgfmathfloatmod@broken#1#2{% + \begingroup + \pgfmathfloatdivide@{#1}{#2}% + \pgfmathfloatint@{\pgfmathresult}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +\ifx\pgfmathfloatmod@\pgfmathfloatmod@broken + \def\pgfmathfloatmod@#1#2{% + \begingroup + \pgfmathfloattoint{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloattoint{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \c@pgfmath@counta=\pgfmathfloat@loc@TMPa\relax + \divide\c@pgfmath@counta by\pgfmathfloat@loc@TMPb\relax + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + % + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + } +\fi + +\pgfutil@IfUndefined{pgfutilsolvetwotwoleqfloat}{% + \input pgfplotsoldpgfsupp_leq.code.tex +}{}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex index 39ec3b33cb7..1c9cfe742dd 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -19,7 +19,7 @@ % with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything: % This file comes without any warranty as the rest of pgfplots; there is no obligation for help. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Do 31. Dez 19:01:21 CET 2015 %%% +%%% Date of this copy: Fr 10. Nov 17:18:26 CET 2017 %%% @@ -90,7 +90,7 @@ \pgfmathfloatparsenumber{#1}% \fi \let\pgfmathfloatscale=\pgfmathresult% - },% + },% % determines the output format of each complete expression parsing % process. If 'scale results' is active, 'fixed' is assumed % automatically. @@ -192,7 +192,7 @@ \pgfutil@namelet{#1}{#2}% } \def\pgfmathfloat@install@unimplemented#1{% - \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname% + \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath#1@\endcsname% \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% } \def\pgfmathfloat@plots@install{% @@ -288,6 +288,7 @@ \expandafter\pgfmathfloat@install\csname pgfmathatan2@\endcsname=\pgfmathfloatatantwo@ \pgfmathfloat@install@unimplemented{isprime}% \pgfmathfloat@install@unimplemented{iseven}% + \pgfmathfloat@install@unimplemented{isodd}% \pgfmathfloat@install@unimplemented{gcd}% \pgfmathfloat@install@unimplemented{frac}% \pgfmathfloat@install@unimplemented{random}% @@ -325,6 +326,7 @@ \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent% \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parse@operand@quote=\pgfmathfloat@parse@operand@quote \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent % \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse% @@ -350,7 +352,7 @@ \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{% \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname% \noexpand\expandafter\noexpand\pgfmath@parse@}% - \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}% \noexpand\pgfmath@postfunction% }% @@ -510,6 +512,14 @@ \pgfmath@parse@@operator% }% +\def\pgfmathfloat@parse@operand@quote#1"{% + \edef\pgfmathresult{\pgfmath@fpu@stringmarker #1}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \pgfmath@parse@@operator% +} + +\def\pgfmath@fpu@stringmarker{@@str@@:}% + % This extends the functionality of the basic level operand stack: it % assures every element on the stack is a float. \def\pgfmathfloat@stack@push@operand#1{% @@ -526,10 +536,19 @@ \ifpgfutil@in@ \pgfmath@basic@stack@push@operand{#1}% \else - \pgfmathfloatparsenumber{#1}% - \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \expandafter\pgfutil@in@\expandafter{\pgfmath@fpu@stringmarker}{#1}% + \ifpgfutil@in@ + \pgfmathfloat@stack@push@operand@single@str#1\relax + \else + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \fi \fi }% + +\expandafter\def\expandafter\pgfmathfloat@stack@push@operand@single@str\pgfmath@fpu@stringmarker #1\relax{% + \pgfmath@basic@stack@push@operand{#1}% +}% \def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}% \def\pgfmathfloat@stack@push@operand@list#1{% \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}% @@ -1636,8 +1655,14 @@ % \def\pgfmathfloatmod@#1#2{% \begingroup - \pgfmathfloatdivide@{#1}{#2}% - \pgfmathfloatint@{\pgfmathresult}% + \pgfmathfloattoint{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloattoint{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \c@pgfmath@counta=\pgfmathfloat@loc@TMPa\relax + \divide\c@pgfmath@counta by\pgfmathfloat@loc@TMPb\relax + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + % \let\pgfmathfloat@loc@TMPa=\pgfmathresult \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% \let\pgfmathfloat@loc@TMPb=\pgfmathresult @@ -1651,15 +1676,20 @@ % A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already % known. This may be faster. \def\pgfmathfloatmodknowsinverse@#1#2#3{% - \begingroup - \pgfmathfloatmultiply@{#1}{#3}% - \pgfmathfloatint@{\pgfmathresult}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \pgfmathfloatmod@{#1}{#2}% + %-------------------------------------------------- + % \begingroup + % % FIXME : is this function correct? \pgfmathfloatmod had a + % % rounding flaw... + % \pgfmathfloatmultiply@{#1}{#3}% + % \pgfmathfloatint@{\pgfmathresult}% + % \let\pgfmathfloat@loc@TMPa=\pgfmathresult + % \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + % \let\pgfmathfloat@loc@TMPb=\pgfmathresult + % \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + % \pgfmath@smuggleone\pgfmathresult + % \endgroup + %-------------------------------------------------- } \let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@ @@ -2119,7 +2149,7 @@ \ifnum0=\c@pgfmath@counta % ah: 0^0 \pgfmathfloatcreate{1}{1.0}{0}% - \else + \else % ah: 0^x with x!=0: \pgfmathfloatcreate{0}{0.0}{0}% \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryintersections.code.tex index a3888007fd7..e6cb9e3bca7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryintersections.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryintersections.code.tex @@ -19,7 +19,7 @@ % with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything: % This file comes without any warranty as the rest of pgfplots; there is no obligation for help. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Fr 14. Feb 21:37:39 CET 2014 %%% +%%% Date of this copy: Di 14. Nov 22:41:45 CET 2017 %%% @@ -76,7 +76,7 @@ % Example: \pgfintersectiongetsolutionsegmentindices{0}{\first}{\second} % % -> \first may be 0 if point #0 is in the 0'th segment -% -> \second may be 42 if point #0 is in the 42'th segment +% -> \second may be 42 if point #0 is in the 42'th segment % % The "segment index" is actually close to the "time" of the solution. % If a solution is at "time" 42.2, it will have segment index 42. @@ -132,7 +132,7 @@ \def\pgf@temp##1##2##3##4{% \edef#2{##3}% \edef#3{##4}% - % + % % check for fallback to segment indices: \ifx#2\pgfutil@empty \edef#2{##1}\fi \ifx#3\pgfutil@empty \edef#3{##2}\fi @@ -147,7 +147,7 @@ \begingroup% \pgftransforminvert% \pgfpointorigin% - \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@pos@transform@glob \global\pgf@x=\pgf@x% \global\pgf@y=\pgf@y% \endgroup% @@ -161,7 +161,7 @@ \long\def\pgfintersectionofpaths#1#2{% \begingroup% \pgfinterruptpath% - #1% + #1% \pgfgetpath\pgf@intersect@path@a% \global\let\pgf@intersect@path@temp=\pgf@intersect@path@a% \endpgfinterruptpath% @@ -170,7 +170,7 @@ % \begingroup% \pgfinterruptpath% - #2% + #2% \pgfgetpath\pgf@intersect@path@b% \global\let\pgf@intersect@path@temp=\pgf@intersect@path@b% \endpgfinterruptpath% @@ -220,9 +220,9 @@ % % However, \pgf@intersect@time@offset and % \pgf@intersect@time@offset@b are *always* valid. In fact,they - % resemble a part of the time: it holds + % resemble a part of the time: it holds % 0 <= \pgf@intersect@time@a < 1 - % and \pgf@intersect@time@offset > 0. + % and \pgf@intersect@time@offset > 0. % % If we have an intersection in segment 42 of path A, % \pgf@intersect@time@offset will be 42. The time inside of that @@ -377,8 +377,7 @@ \pgf@iflinesintersect{#1}{#2}{#3}{#4}% {% \pgfextract@process\pgf@intersect@solution@candidate{% - \pgfpointintersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% - {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% + % pgf@x and pgf@y are already assigned by \pgf@iflinesintersect }% \pgf@ifsolution@duplicate{\pgf@intersect@solution@candidate}{% % ah - we a duplicate. Apparently, we have a hit on an @@ -402,7 +401,7 @@ \pgf@marshal% \pgfmathdivide@{\pgfmathresult}{\pgf@intersect@length@a}% \pgf@x=\pgfmathresult pt\relax% - \advance\pgf@x by\pgf@intersect@time@offset pt\relax% + \advance\pgf@x by\pgf@intersect@time@offset pt\relax% \edef\pgf@intersect@time@a{\pgfmath@tonumber{\pgf@x}}% \expandafter\global\expandafter\let\csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname= \pgf@intersect@time@a @@ -413,7 +412,8 @@ \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% }% % - }{}% + }{% + }% } % Test if two lines L1 and L2 intersect. @@ -435,16 +435,16 @@ % % t = |x4-x3 x3-x1| / |x4-x3 x2-x1| % |y4-y3 y3-y1| |y4-y3 y2-y1| -% +% % with 0<=s,t<=1 -% +% % s and t do not need to be calculated: % % Let s = A / C and t = B / C -% +% % Then 0<=s<=1 if !(C=0) && ((A=0) || ((A>0) && !(C<A)) || ((A<0) && !(C>A))) % 0<=t<=1 if !(C=0) && ((B=0) || ((B>0) && !(C<B)) || ((B<0) && !(C>B))) -% +% \newif\ifpgf@s \newif\ifpgf@t \def\pgfiflinesintersect#1#2#3#4{% @@ -454,95 +454,199 @@ \endgroup% } +% queried by pgfplots. Do not delete, only increase. +\def\pgf@intersections@version{2}% + +% #1,#2: line 1 +% #3,#4: line 2 \def\pgf@iflinesintersect#1#2#3#4{% - #4\relax% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - #3\relax% - \advance\pgf@xc by-\pgf@x% - \advance\pgf@yc by-\pgf@y% - \pgf@xb=\pgf@x% - \pgf@yb=\pgf@y% - #2\relax% + % first: check bounding boxes -- but somewhat increased such that we do not + % exclude "visible" hits due to rounding issues (i.e. use an upper bound): + \pgf@intersect@boundingbox@reset% + \pgf@intersect@boundingbox@update{#1}% + \pgf@intersect@boundingbox@update{#2}% + \pgf@intersect@boundingbox@assign@b% + % + \pgf@intersect@boundingbox@reset% + \pgf@intersect@boundingbox@update{#3}% + \pgf@intersect@boundingbox@update{#4}% + \pgf@intersect@boundingbox@assign@a% + % + \pgf@intersect@boundingbox@a% + \pgf@intersect@boundingbox@b% + % + \pgf@intersect@boundingbox@ifoverlap@upperbound{% + \pgf@iflinesintersect@{#1}{#2}{#3}{#4}% + }{% + \let\pgf@intersect@next=\pgfutil@secondoftwo% + }% + \pgf@intersect@next% +}% + +% a helper routine which simply defines \pgf@intersect@next. +% +% In principle, this routine is capable of computing the entire intersection... but we only invoke it after checking for bounding box overlaps. This has two reasons: +% 1. robustness. almost-parallel lines could cause "dimension too large" when solving the linear equation system +% XXX : I still needed to replace the linear solver by one using the FPU. Perhaps I do not need the BB check anymore? +% 2. performance. I hope it is faster to first check for BB (but this is not sure in TeX) +% +% #1,#2: line 1 +% #3,#4: line 2 +\def\pgf@iflinesintersect@#1#2#3#4{% + % we have two lines of sorts + % l_1(s) := #1 + s * (#2 - #1), 0<= s <= 1 + % and + % l_2(t) := #3 + t * (#4 - #3), 0<= t <= 1 + % -> + % set up LGS + % ( #2 - #1 ) *s + (#3-#4) * t = #3-#1 + % we have a hit if 0<= s,t <= 1 . + #1\relax% \pgf@xa=\pgf@x% \pgf@ya=\pgf@y% - #1\relax% - \advance\pgf@xa by-\pgf@x% - \advance\pgf@ya by-\pgf@y% - \advance\pgf@xb by-\pgf@x% - \advance\pgf@yb by-\pgf@y% + #2\relax% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + #3\relax% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + #4\relax% % - % xc = x4-x3; yc=y4-y3; - % xb = x3-x1; yb=y3-y1; - % xa = x2-x1; ya=y2-y1; + % will be overwritten, remember it: + \edef\pgf@intersect@A{% + \pgf@xa=\the\pgf@xa\space + \pgf@ya=\the\pgf@ya\space + }% % + % B := (2-1) + \advance\pgf@xb by-\pgf@xa + \advance\pgf@yb by-\pgf@ya % - % Normalise a little. 16384 may not be a robust choice. + % A := (3-1) + \advance\pgf@xa by-\pgf@xc + \advance\pgf@ya by-\pgf@yc + \pgf@xa=-\pgf@xa + \pgf@ya=-\pgf@ya % - \c@pgf@counta=\pgf@xa\divide\c@pgf@counta by16384\relax% - \c@pgf@countb=\pgf@xb\divide\c@pgf@countb by16384\relax% - \c@pgf@countc=\pgf@ya\divide\c@pgf@countc by16384\relax% - \c@pgf@countd=\pgf@yb\divide\c@pgf@countd by16384\relax% - \multiply\c@pgf@counta by\c@pgf@countd% - \multiply\c@pgf@countc by\c@pgf@countb% - \advance\c@pgf@counta by-\c@pgf@countc% - \pgfutil@tempcnta=\c@pgf@counta% + % C := (3-4) + \advance\pgf@xc by-\pgf@x + \advance\pgf@yc by-\pgf@y % - \c@pgf@counta=\pgf@xc\divide\c@pgf@counta by16384\relax% - \c@pgf@countc=\pgf@yc\divide\c@pgf@countc by16384\relax% - \multiply\c@pgf@countd by\c@pgf@counta% - \multiply\c@pgf@countb by\c@pgf@countc% - \advance\c@pgf@countd by-\c@pgf@countb% - \pgfutil@tempcntb=\c@pgf@countd% + \begingroup + % compute the |.|_1 norm of each of lines. We need to compute + % tolerance factors in order to decide if we have an intersection. + % line 1: compute |#2 - #1|_1 : + \ifdim\pgf@xb<0sp \pgf@xb=-\pgf@xb\fi + \ifdim\pgf@yb<0sp \pgf@yb=-\pgf@yb\fi + \advance\pgf@xb by\pgf@yb + \xdef\pgf@intersect@len@a{\pgf@sys@tonumber\pgf@xb}% % - \c@pgf@countb=\pgf@xa\divide\c@pgf@countb by16384\relax% - \c@pgf@countd=\pgf@ya\divide\c@pgf@countd by16384\relax% - \multiply\c@pgf@counta by\c@pgf@countd% - \multiply\c@pgf@countc by\c@pgf@countb% - \advance\c@pgf@counta by-\c@pgf@countc% + % line 2: compute |#3 - #4|_1 : + \ifdim\pgf@xc<0sp \pgf@xc=-\pgf@xc\fi + \ifdim\pgf@yc<0sp \pgf@yc=-\pgf@yc\fi + \advance\pgf@xc by\pgf@yc + \xdef\pgf@intersect@len@b{\pgf@sys@tonumber\pgf@xc}% + \endgroup + % + \edef\pgf@marshal{% + \noexpand\pgfutilsolvetwotwoleqfloat{% + {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xc}% + {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@yc}% + }{% + {\pgf@sys@tonumber\pgf@xa}% + {\pgf@sys@tonumber\pgf@ya}% + }% + }% + \pgf@marshal % - \pgf@sfalse% - \pgf@tfalse% - \ifnum\c@pgf@counta=0\relax% - \else% - \ifnum\pgfutil@tempcnta=0\relax% - \pgf@strue% - \else% - \ifnum\pgfutil@tempcnta>0\relax% - \ifnum\c@pgf@counta<\pgfutil@tempcnta% - \else% - \pgf@strue% - \fi% - \else% - \ifnum\c@pgf@counta>\pgfutil@tempcnta% - \else% - \pgf@strue% - \fi% - \fi% - \fi% - \ifnum\pgfutil@tempcntb=0\relax% - \pgf@ttrue% - \else% - \ifnum\pgfutil@tempcntb>0\relax% - \ifnum\c@pgf@counta<\pgfutil@tempcntb% - \else% - \pgf@ttrue% - \fi% - \else% - \ifnum\c@pgf@counta>\pgfutil@tempcntb% - \else% - \pgf@ttrue% - \fi% - \fi% - \fi% - \fi% \let\pgf@intersect@next=\pgfutil@secondoftwo% - \ifpgf@s% - \ifpgf@t% + \ifx\pgfmathresult\pgfutil@empty + % matrix was singular. + \else + \def\pgf@marshal##1##2{% + \global\pgf@x=##1pt % + \global\pgf@y=##2pt % + }% + \expandafter\pgf@marshal\pgfmathresult + % + \def\pgf@marshal{XXXX}% this should never be read + % FIRST: check line 1: + \ifdim\pgf@x<0sp + % let it count as hit if + % || l_1(s) - l_1(0) || < eps + % <=> |s| * ||#2 - #1|| < eps + % and, since s< 0 here: + % <=> -s * ||#2 - #1|| < eps + \pgf@xa=-\pgf@intersect@len@a\pgf@x + \ifdim\pgf@xa<\pgfintersectiontolerance\relax + % close enough to first endpoint of line 1: + \def\pgf@marshal{1}% + \else + \def\pgf@marshal{0}% + \fi + \else + \ifdim\pgf@x>1pt + % let it count as hit if + % || l_1(s) - l_1(1) || < eps + % <=> |s-1| * ||#2 - #1|| < eps + % and, since s > 1 here: + % <=> s * ||#2 - #1|| - ||#2 - #1|| < eps + \pgf@xa=\pgf@intersect@len@a\pgf@x + \advance\pgf@xa by-\pgf@intersect@len@a pt % + \ifdim\pgf@xa<\pgfintersectiontolerance\relax + % close enough to second endpoint of line 1: + \def\pgf@marshal{1}% + \else + \def\pgf@marshal{0}% + \fi + \else + % 0<= s <= 1: we have an intersection within line 1. + \def\pgf@marshal{1}% + \fi + \fi + % + % SECOND: check line 2: + \if1\pgf@marshal + \ifdim\pgf@y<0sp + % see remarks for line 1. same applies here. + \pgf@xa=-\pgf@intersect@len@b\pgf@y + \ifdim\pgf@xa<\pgfintersectiontolerance\relax + % close enough to first endpoint of line 2: + \def\pgf@marshal{1}% + \else + \def\pgf@marshal{0}% + \fi + \else + \ifdim\pgf@y>1pt + % see remarks for line 1. same applies here. + \pgf@xa=\pgf@intersect@len@b\pgf@y + \advance\pgf@xa by-\pgf@intersect@len@b pt % + \ifdim\pgf@xa<\pgfintersectiontolerance\relax + % close enough to second endpoint of line 2: + \def\pgf@marshal{1}% + \else + \def\pgf@marshal{0}% + \fi + \else + % 0<= t <= 1: we have an intersection within line 2. + \def\pgf@marshal{1}% + \fi + \fi + \fi + % + \if1\pgf@marshal + % Ok, compute the intersection point and return it: + % we use (x,y) = A + s * (B-A) + % keep in mind that (s,t) == (\pgf@x,\pgf@y) + \pgf@intersect@A + \pgf@yc=\pgf@x + \global\pgf@x=\pgf@sys@tonumber\pgf@xb\pgf@yc + \global\pgf@y=\pgf@sys@tonumber\pgf@yb\pgf@yc + \global\advance\pgf@x by \pgf@xa + \global\advance\pgf@y by \pgf@ya \let\pgf@intersect@next=\pgfutil@firstoftwo% - \fi% - \fi% - \pgf@intersect@next% + \fi + \fi } @@ -601,17 +705,18 @@ \def\pgfintersectiontolerance{0.1pt} +\def\pgfintersectiontoleranceupperbound{1pt} \def\pgfintersectiontolerancefactor{0.1} % Find the intersections of two bezier curves. -% +% % #1 - #4 = curve 1. % #5 - #8 = curve 2. % #9 = the solution number. % -% There is no guarantee of ordering of solutions. If there are +% There is no guarantee of ordering of solutions. If there are % no solutions, the origin is returned. % \def\pgfpointintersectionofcurves#1#2#3#4#5#6#7#8#9{% @@ -625,7 +730,7 @@ % Return any intersection points of two curves C1 and C2. % No order can be guaranteed for the solutions. % -% #1, #2, #3, #4 - the points on C1 +% #1, #2, #3, #4 - the points on C1 % #5, #6, #7, #8 - the points on C2 % % Returns: @@ -639,7 +744,7 @@ % S = {}; % intersection'(C1,C2); % return S; -% +% % intersection'(C1,C2) % B1 = boundingbox(C1); % B2 = boundingbox(C2); @@ -677,42 +782,114 @@ \endgroup% } +\def\pgf@intersect@boundingbox@assign@a{% + \edef\pgf@intersect@boundingbox@a{% + % lower left: + \noexpand\pgf@xb=\the\pgf@xa\space% + \noexpand\pgf@yb=\the\pgf@ya\space% + % upper right: + \noexpand\pgf@xc=\the\pgf@xb\space% + \noexpand\pgf@yc=\the\pgf@yb\space% + }% +} +\def\pgf@intersect@boundingbox@assign@b{% + \edef\pgf@intersect@boundingbox@b{% + % lower left: + \noexpand\global\noexpand\pgf@x=\the\pgf@xa\space% + \noexpand\global\noexpand\pgf@y=\the\pgf@ya\space% + % upper right: + \noexpand\pgf@xa=\the\pgf@xb\space% + \noexpand\pgf@ya=\the\pgf@yb\space% + }% +} + +% see \pgf@intersect@boundingbox@assign@a and \pgf@intersect@boundingbox@assign@b for the naming conventions +\def\pgf@intersect@boundingbox@ifoverlap{% + \def\pgf@intersect@next{\pgfutil@secondoftwo}% + % + \ifdim\pgf@xa<\pgf@xb% + \else% + \ifdim\pgf@x>\pgf@xc% + \else% + \ifdim\pgf@ya<\pgf@yb% + \else% + \ifdim\pgf@y>\pgf@yc% + \else% + \def\pgf@intersect@next{\pgfutil@firstoftwo}% + \fi + \fi + \fi + \fi + \pgf@intersect@next +}% +\def\pgf@intersect@boundingbox@ifoverlap@upperbound{% + \begingroup + \def\pgf@intersect@next{\pgfutil@secondoftwo}% + % + \advance\pgf@xa by+\pgfintersectiontolerance\relax + \ifdim\pgf@xa<\pgf@xb% + \else% + \global\advance\pgf@x by-\pgfintersectiontolerance\relax + \ifdim\pgf@x>\pgf@xc% + \else% + \advance\pgf@ya by\pgfintersectiontolerance\relax + \ifdim\pgf@ya<\pgf@yb% + \else% + \global\advance\pgf@y by-\pgfintersectiontolerance\relax + \ifdim\pgf@y>\pgf@yc% + \else% + \def\pgf@intersect@next{\pgfutil@firstoftwo}% + \fi + \fi + \fi + \fi + \expandafter + \endgroup + \pgf@intersect@next +}% +\def\pgf@intersect@boundingbox@ifoverlap@UNUSED{% + \let\pgf@intersect@next=\pgfutil@secondoftwo% + \ifdim\pgf@xa<\pgf@xb% + \else% + \ifdim\pgf@x>\pgf@xc% + \else% + \ifdim\pgf@ya<\pgf@yb% + \else% + \ifdim\pgf@y>\pgf@yc% + \else% + \let\pgf@intersect@next=\pgfutil@firstoftwo% + \fi + \fi + \fi + \fi + \pgf@intersect@next +}% \def\pgf@@intersectionofcurves#1#2#3#4#5#6#7#8{% \pgf@intersect@boundingbox@reset% \pgf@intersect@boundingbox@update{#1}% \pgf@intersect@boundingbox@update{#2}% \pgf@intersect@boundingbox@update{#3}% \pgf@intersect@boundingbox@update{#4}% - % (\pgf@xa, \pgf@ya) is lower-left - % (\pgf@xb, \pgf@yb) is upper-right - \edef\pgf@intersect@boundingbox@b{% - \noexpand\pgf@x=\the\pgf@xa% - \noexpand\pgf@y=\the\pgf@ya% - \noexpand\pgf@xa=\the\pgf@xb% - \noexpand\pgf@ya=\the\pgf@yb% - }% + \pgf@intersect@boundingbox@assign@b% + % \pgf@intersect@boundingbox@reset% \pgf@intersect@boundingbox@update{#5}% \pgf@intersect@boundingbox@update{#6}% \pgf@intersect@boundingbox@update{#7}% \pgf@intersect@boundingbox@update{#8}% - \edef\pgf@intersect@boundingbox@a{% - \noexpand\pgf@xb=\the\pgf@xa% - \noexpand\pgf@yb=\the\pgf@ya% - \noexpand\pgf@xc=\the\pgf@xb% - \noexpand\pgf@yc=\the\pgf@yb% - }% + \pgf@intersect@boundingbox@assign@a% + % \pgf@intersect@boundingbox@a% \pgf@intersect@boundingbox@b% - % check if the two bounding boxes overlap: - \ifdim\pgf@xa<\pgf@xb% - \else% - \ifdim\pgf@x>\pgf@xc% - \else% - \ifdim\pgf@ya<\pgf@yb% - \else% - \ifdim\pgf@y>\pgf@yc% - \else% + % + \pgf@intersect@boundingbox@ifoverlap{% + \pgf@@@intersectionofcurves{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% + }{% + % no overlap -- no intersection. + }% +} + +\def\pgf@@@intersectionofcurves#1#2#3#4#5#6#7#8{% % compute DIFFERENCE vectors: \advance\pgf@xc by-\pgf@xb% \advance\pgf@yc by-\pgf@yb% @@ -761,8 +938,8 @@ \pgf@intersect@solution@candidate% \ifpgf@intersect@sort% \expandafter\xdef% - \csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname% - {\pgf@intersect@time@a}% + \csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname% + {\pgf@intersect@time@a}% \fi% \endgroup }% @@ -774,10 +951,6 @@ \else% \pgf@intersect@subdivide@curve{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% \fi% - \fi% - \fi% - \fi% - \fi% } \def\pgf@intersect@subdivide@curve@b#1#2#3#4#5#6#7#8{% @@ -855,7 +1028,7 @@ \def\pgf@curve@subdivide@left#1#2#3#4{% % - % The left curve (from t=0 to t=.5) + % The left curve (from t=0 to t=.5) % \begingroup #1\relax% @@ -898,7 +1071,7 @@ \def\pgf@curve@subdivide@right#1#2#3#4{% % - % The right curve (from t=0.5 to t=1) + % The right curve (from t=0.5 to t=1) % \begingroup #1\relax% @@ -942,7 +1115,7 @@ % A solution S1 is considered a duplicate of S2, if -% +% % |x1 - x2|f < q and |y1 - y2|f < q % % where q is a small value (tolerance). @@ -956,7 +1129,7 @@ \let\pgf@intersect@next=\pgfutil@secondoftwo% \pgfmathloop% \ifnum\pgfmathcounter>\pgf@intersect@solutions\relax% - \else% + \else% \pgf@ifsolution@duplicate@{\pgfmathcounter}% \repeatpgfmathloop% \pgf@intersect@next% @@ -985,8 +1158,7 @@ \def\pgfintersectionsolutionsortbytime{% \pgf@intersect@solutions@sortfinishtrue% \pgfmathloop% - \ifnum\pgfmathcounter=\pgfintersectionsolutions\relax% - \else% + \ifnum\pgfmathcounter<\pgfintersectionsolutions\relax% \pgfutil@tempcnta=\pgfmathcounter% \advance\pgfutil@tempcnta by1\relax% \ifdim\csname pgf@intersect@solution@\pgfmathcounter @time@a\endcsname pt>% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index 9a36660282b..5ba17bc2d0e 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -19,7 +19,7 @@ % with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything: % This file comes without any warranty as the rest of pgfplots; there is no obligation for help. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Di 30. Dez 15:31:24 CET 2014 %%% +%%% Date of this copy: Fr 10. Nov 17:18:26 CET 2017 %%% @@ -1691,7 +1691,7 @@ \endgroup \let#3=\pgfmathfloat@glob@TMP }% - + % Changes the current number pretty printer to #1. % @@ -1858,7 +1858,7 @@ \fi \fi } - + % takes the current input and decides whether trailing zeros shall be % discarded or more zeros need to be filled in. \def\pgfmathroundto@impl@finish@with@truncation{% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex index 3512d7e3086..d17fff3e2fe 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex @@ -9,6 +9,12 @@ \usepgflibrary{intersections} + +\pgfutil@IfUndefined{pgf@intersections@version}{% + \input pgfplotsoldpgfsupp_pgflibraryintersections.code.tex +}{% +}% + % FIXME : ARCHITECTURE VIOLATION: REQUIRES % \usetikzlibrary{decorations.softclip} % @@ -61,6 +67,12 @@ % % 'end' has no arguments. /pgf/fill between/result stream/end/.code=,% + % + /pgf/fill between/omit empty segments/.is choice, + /pgf/fill between/omit empty segments/.default=true, + /pgf/fill between/omit empty segments/false/.code=\def\pgfpathfillbetween@omit@empty@segments{0},% + /pgf/fill between/omit empty segments/true/.code=\def\pgfpathfillbetween@omit@empty@segments{1},% + /pgf/fill between/omit empty segments/true, }% % \pgfpathfillbetween[<options>]{<first path>}{<second path>} @@ -104,10 +116,18 @@ \pgfpathcomputesoftclippath{#3}{\pgfpathfillbetween@softclip@B}\let#3=\pgfretval% % \ifx#2\pgfutil@empty - \pgfpathfillbetween@warning{first}% + \ifx\pgfpathfillbetween@softclip@A\pgfutil@empty + \pgfpathfillbetween@warning{first}% + \else + \pgfpathfillbetween@warning{soft-clipped first}% + \fi \else \ifx#3\pgfutil@empty - \pgfpathfillbetween@warning{second}% + \ifx\pgfpathfillbetween@softclip@B\pgfutil@empty + \pgfpathfillbetween@warning{second}% + \else + \pgfpathfillbetween@warning{soft-clipped second}% + \fi \else % \ifpgfpathfillbetween@split @@ -282,22 +302,79 @@ \pgferror{Illegal internal state encountered: the number segments induced by the intersection points of the two paths DIFFER between the first and the second path: first path has \pgfpathfilled@a@segments\space whereas the second has \pgfpathfilled@b@segments.}% \fi % - \pgfkeys{/pgf/fill between/result stream/begin=\pgfpathfilled@a@segments}% - % Recombine the pairs of segments (a_i, b_i), i = 0,..., N-1 in a - % filled way: + % STEP 1: find out if there are empty segments. Numerical + % inaccuracies occasionally result in such segments; we silently + % skip them. + \def\c@pgfpathfilled@nonemptysegments{0}% \def\c@pgfpathfilled@counter{0}% \pgfmathloop \ifnum\c@pgfpathfilled@counter<\pgfpathfilled@a@segments\relax \expandafter\let\expandafter\pgf@loc@path@a\csname pgf@intersect@path@split@a@\c@pgfpathfilled@counter\endcsname \expandafter\let\expandafter\pgf@loc@path@b\csname pgf@intersect@path@split@b@\c@pgfpathfilled@counter\endcsname % - \pgfpathfillbetween@compute{\pgf@loc@path@a}{\pgf@loc@path@b}% - % report to the result stream. It knows how to deal with it: - \pgfpathfillbetween@invoke{result stream/next ready}% + \if1\pgfpathfillbetween@omit@empty@segments + \pgfpathfillbetween@compute@checkempty{\pgf@loc@path@a}% + % A segment is empty if BOTH of its input segments are empty: + \if1\pgfretval + \pgfpathfillbetween@compute@checkempty{\pgf@loc@path@b}% + \if1\pgfretval + \pgfutil@IfUndefined{pgfplots@log}{}{% + \pgfplots@log4{fillbetween: skipping empty intersection segment no \c@pgfpathfilled@counter}% + }% + \expandafter\def\csname pgf@interset@path@empty@\c@pgfpathfilled@counter\endcsname{1}% + \else + \expandafter\def\csname pgf@interset@path@empty@\c@pgfpathfilled@counter\endcsname{0}% + \pgfutil@advancestringcounter\c@pgfpathfilled@nonemptysegments + \fi + \else + \expandafter\def\csname pgf@interset@path@empty@\c@pgfpathfilled@counter\endcsname{0}% + \pgfutil@advancestringcounter\c@pgfpathfilled@nonemptysegments + \fi + \else + \expandafter\def\csname pgf@interset@path@empty@\c@pgfpathfilled@counter\endcsname{0}% + \pgfutil@advancestringcounter\c@pgfpathfilled@nonemptysegments + \fi % \pgfutil@advancestringcounter\c@pgfpathfilled@counter \repeatpgfmathloop - \pgfpathfillbetween@invoke{result stream/end}% + % + \ifnum\c@pgfpathfilled@nonemptysegments=0 + \else + \pgfkeys{/pgf/fill between/result stream/begin=\c@pgfpathfilled@nonemptysegments}% + % Recombine the pairs of segments (a_i, b_i), i = 0,..., N-1 in a + % filled way: + \def\c@pgfpathfilled@counter{0}% + \pgfmathloop + \ifnum\c@pgfpathfilled@counter<\pgfpathfilled@a@segments\relax + \if0\csname pgf@interset@path@empty@\c@pgfpathfilled@counter\endcsname + \expandafter\let\expandafter\pgf@loc@path@a\csname pgf@intersect@path@split@a@\c@pgfpathfilled@counter\endcsname + \expandafter\let\expandafter\pgf@loc@path@b\csname pgf@intersect@path@split@b@\c@pgfpathfilled@counter\endcsname + % + \pgfpathfillbetween@compute{\pgf@loc@path@a}{\pgf@loc@path@b}% + % report to the result stream. It knows how to deal with it: + \pgfpathfillbetween@invoke{result stream/next ready}% + % + \fi + \pgfutil@advancestringcounter\c@pgfpathfilled@counter + \repeatpgfmathloop + \pgfpathfillbetween@invoke{result stream/end}% + \fi +} + +\def\pgflibraryfillbetweenemptysegmenttolerance{1pt} + +\def\pgfpathfillbetween@compute@checkempty#1{% + \def\pgfretval{0}% + \pgf@compute@BB{#1}% + \advance\pgf@xb by-\pgf@xa + \advance\pgf@yb by-\pgf@ya + % if one of the dimensions is empty, the segment is empty: + \ifdim\pgf@xb<\pgflibraryfillbetweenemptysegmenttolerance\relax + \def\pgfretval{1}% + \fi + \ifdim\pgf@yb<\pgflibraryfillbetweenemptysegmenttolerance\relax + \def\pgfretval{1}% + \fi } \def\pgfpathfillbetween@compute#1#2{% @@ -370,6 +447,37 @@ \def\pgfretval{{#2}{#3}}% }% +% assigns the bounding box of path #1 to +% (pgf@xa , pgf@ya) = (minx,miny) +% (pgf@xb , pgf@yb) = (maxx,maxy) +\def\pgf@compute@BB#1{% + \begingroup + \dimendef\pgf@pathmaxx=0 % + \dimendef\pgf@pathminx=1 % + \dimendef\pgf@pathmaxy=2 % + \dimendef\pgf@pathminy=3 % + \pgf@pathmaxx=-16000pt\relax% + \pgf@pathminx=16000pt\relax% + \pgf@pathmaxy=-16000pt\relax% + \pgf@pathminy=16000pt\relax% + \let\pgf@protocolsizes=\pgf@compute@BB@protocol@sizes + \expandafter\pgfsetpath@loop#1\pgf@stop + \xdef\pgf@marshal{% + \pgf@xa=\the\pgf@pathminx\relax + \pgf@ya=\the\pgf@pathminy\relax + \pgf@xb=\the\pgf@pathmaxx\relax + \pgf@yb=\the\pgf@pathmaxy\relax + }% + \endgroup + \pgf@marshal +}% +\def\pgf@compute@BB@protocol@sizes#1#2{% + \ifdim#1<\pgf@pathminx\pgf@pathminx#1\fi% + \ifdim#1>\pgf@pathmaxx\pgf@pathmaxx#1\fi% + \ifdim#2<\pgf@pathminy\pgf@pathminy#2\fi% + \ifdim#2>\pgf@pathmaxy\pgf@pathmaxy#2\fi% +} + % A utility function like \pgfsetpath which calls \pgfsetpath *and* protocols % the size of each path segment (i.e. compute the bounding box). % diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 28783b3ab5d..f534dc47e84 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -2212,6 +2212,9 @@ /pgfplots/x filter/.expression/.code=\pgfplots@install@filter@expression{x filter}{#1}, /pgfplots/y filter/.expression/.code=\pgfplots@install@filter@expression{y filter}{#1}, /pgfplots/z filter/.expression/.code=\pgfplots@install@filter@expression{z filter}{#1}, + /pgfplots/x filter/.append expression/.code=\pgfplots@install@filter@expression@append{x filter}{#1}, + /pgfplots/y filter/.append expression/.code=\pgfplots@install@filter@expression@append{y filter}{#1}, + /pgfplots/z filter/.append expression/.code=\pgfplots@install@filter@expression@append{z filter}{#1}, /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}{0}},% /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}{0}},% /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}{0}},% @@ -4333,6 +4336,7 @@ /pgfplots/compat/anchors/1.13/.style= {/pgfplots/compat/anchors/1.3,/pgfplots/correct polar positioning=true},% /pgfplots/compat/anchors/1.14/.style= {/pgfplots/compat/anchors/1.13},% /pgfplots/compat/anchors/1.15/.style= {/pgfplots/compat/anchors/1.13},% + /pgfplots/compat/anchors/1.16/.style= {/pgfplots/compat/anchors/1.13},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% % /pgfplots/compat/empty line/.is choice, @@ -4351,6 +4355,7 @@ /pgfplots/compat/empty line/1.13/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.14/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.15/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.16/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/default/.style= {/pgfplots/compat/empty line/1.4},% % /pgfplots/compat/path replacement/.is choice, @@ -4369,6 +4374,7 @@ /pgfplots/compat/path replacement/1.13/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/1.14/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/1.15/.style= {/pgfplots/compat/path replacement/1.5.1}, + /pgfplots/compat/path replacement/1.16/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/default/.style= {/pgfplots/compat/path replacement/pre 1.3},% % /pgfplots/compat/pgfpoint substitution/.is choice, @@ -4387,6 +4393,7 @@ /pgfplots/compat/pgfpoint substitution/1.13/.style= {/pgfplots/compat/pgfpoint substitution/1.11}, /pgfplots/compat/pgfpoint substitution/1.14/.style= {/pgfplots/compat/pgfpoint substitution/1.11}, /pgfplots/compat/pgfpoint substitution/1.15/.style= {/pgfplots/compat/pgfpoint substitution/1.11}, + /pgfplots/compat/pgfpoint substitution/1.16/.style= {/pgfplots/compat/pgfpoint substitution/1.11}, /pgfplots/compat/pgfpoint substitution/default/.style= {/pgfplots/compat/pgfpoint substitution/pre 1.3},% %ellipse/.is if=pgfplots@path@replace@ellipse, % @@ -4415,6 +4422,7 @@ /pgfplots/compat/labels/1.13/.style= {/pgfplots/compat/labels/1.8},% /pgfplots/compat/labels/1.14/.style= {/pgfplots/compat/labels/1.8},% /pgfplots/compat/labels/1.15/.style= {/pgfplots/compat/labels/1.8},% + /pgfplots/compat/labels/1.16/.style= {/pgfplots/compat/labels/1.8},% /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility % /pgfplots/compat/bar nodes/.is choice, @@ -4468,6 +4476,7 @@ },% /pgfplots/compat/bar nodes/1.14/.style= {/pgfplots/compat/bar nodes/1.13},% /pgfplots/compat/bar nodes/1.15/.style= {/pgfplots/compat/bar nodes/1.13},% + /pgfplots/compat/bar nodes/1.16/.style= {/pgfplots/compat/bar nodes/1.13},% /pgfplots/compat/bar nodes/default/.style= {/pgfplots/compat/bar nodes/pre 1.3},% maintain backwards compatibility /pgfplots/compat/bar nodes/default, % @@ -4501,6 +4510,7 @@ /pgfplots/compat/scaling/1.13/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/1.14/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/1.15/.style={/pgfplots/compat/scaling/1.6}, + /pgfplots/compat/scaling/1.16/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, % /pgfplots/compat/scale mode/.is choice, @@ -4519,6 +4529,7 @@ /pgfplots/compat/scale mode/1.13/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/1.14/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/1.15/.style={/pgfplots/compat/scale mode/1.6}, + /pgfplots/compat/scale mode/1.16/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5}, % % @@ -4538,6 +4549,7 @@ /pgfplots/compat/plot3graphics/1.13/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/1.14/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/1.15/.style= {/pgfplots/compat/plot3graphics/1.6},% + /pgfplots/compat/plot3graphics/1.16/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},% % % ATTENTION: there is a compatibility issue which slipped through @@ -4583,6 +4595,7 @@ /pgfplots/compat/bar width by units/1.13/.style= {/pgfplots/compat/bar width by units/1.7}, /pgfplots/compat/bar width by units/1.14/.style= {/pgfplots/compat/bar width by units/1.7}, /pgfplots/compat/bar width by units/1.15/.style= {/pgfplots/compat/bar width by units/1.7}, + /pgfplots/compat/bar width by units/1.16/.style= {/pgfplots/compat/bar width by units/1.7}, /pgfplots/compat/bar width by units/default/.style={/pgfplots/compat/bar width by units/pre 1.3}, % /pgfplots/compat/BB/.is choice, @@ -4601,6 +4614,7 @@ /pgfplots/compat/BB/1.13/.style= {/pgfplots/compat/BB/1.8},% /pgfplots/compat/BB/1.14/.style= {/pgfplots/compat/BB/1.8},% /pgfplots/compat/BB/1.15/.style= {/pgfplots/compat/BB/1.8},% + /pgfplots/compat/BB/1.16/.style= {/pgfplots/compat/BB/1.8},% /pgfplots/compat/BB/default/.style={/pgfplots/compat/BB/pre 1.3}, % /pgfplots/compat/general/.is choice, @@ -4659,6 +4673,7 @@ /pgfplots/3d log sampling=true, % FIXME finish this feature: see unittest_log_sampling_3d /pgfplots/clip limits compat=false, },% + /pgfplots/compat/general/1.16/.style= {/pgfplots/compat/general/1.15},% /pgfplots/compat/general/default/.style={/pgfplots/compat/general/1.11}, % /pgfplots/enable tick line clipping/.is if=pgfplots@enable@tick@line@clipping, @@ -4676,7 +4691,7 @@ /pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version, /pgfplots/compat/show suggested version=true, /pgfplots/compat/current/.initial=, - /pgfplots/compat/mostrecent/.initial=1.15, + /pgfplots/compat/mostrecent/.initial=1.16, /utils/exec={% \pgfplotsutilforeachcommasep{% /pgfplots/compat/current,% @@ -9547,6 +9562,10 @@ \def\pgfplots@filter@input@ticks@with@log#1#2{% \let\pgfplots@glob@TMPa=\pgfutil@empty \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfplotscoordmath{float}{parse}{\pgfplots@loc@TMPb}% + \pgfmathfloattofixed{\pgfmathresult}% + \let\pgfplots@loc@TMPb=\pgfmathresult + % \pgfplotscoordmath{#2}{log}{\pgfplots@loc@TMPb}% \ifx\pgfplots@glob@TMPa\pgfutil@empty \xdef\pgfplots@glob@TMPa{\pgfmathresult}% @@ -11648,8 +11667,10 @@ % see \pgfplots@countplots@advance for details. % % +% \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfplots@define@dummies@for@pseudoconstants \pgfplotsifinaxis{% \pgfplots@error{% Sorry, nested axis environments are not supported. @@ -11983,6 +12004,13 @@ \begingroup \pgfplots@beforenode % + \ifpgfplots@has@cell@picture + \else + % the transformations have already been applied to the + % coordinates which are used to setup the node. Reset them: + \pgftransformresetnontranslations + \fi + % \ifpgfplots@deprecated@anchors \pgfplots@restore@deprecated@lowlevel@shape \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex index 59068fa8d26..6dbe7ab1082 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex @@ -5,10 +5,10 @@ \catcode`\:=12 \catcode`\+=12 \catcode`\-=12 -\gdef\pgfplotsrevision{1.15} -\gdef\pgfplotsversion{1.15} -\gdef\pgfplotsversiondatetime{2017-06-05 20:30:57 +0200} -\gdef\pgfplotsrevisiondatetime{2017-06-05 20:30:57 +0200} +\gdef\pgfplotsrevision{1.16} +\gdef\pgfplotsversion{1.16} +\gdef\pgfplotsversiondatetime{2018-03-28 20:42:04 +0200} +\gdef\pgfplotsrevisiondatetime{2018-03-28 20:42:04 +0200} \gdef\pgfplots@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3} \xdef\pgfplotsversiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsversiondatetime\relax} \xdef\pgfplotsrevisiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsrevisiondatetime\relax} diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex index e079bb6d46f..d5d045ddfb6 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex @@ -2071,6 +2071,10 @@ }% }% \expandafter\pgfutilsolvetwotwoleq\pgfplots@loc@TMPa + \ifx\pgfmathresult\pgfutil@empty + \pgfplots@error{Singular matrix encountered during view computation. Please choose different input values.}% + \def\pgfmathresult{{0}{0}}% + \fi \def\pgfplots@loc@TMPb##1##2{% \def\pgfplots@view@dir@threedim@x{##1}% \def\pgfplots@view@dir@threedim@y{##2}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex index 6f2f127afde..92cb99709c5 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -1775,6 +1775,10 @@ \edef\pgfplots@RHS{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% % \pgfutilsolvetwotwoleq{\pgfplots@LEQ}{\pgfplots@RHS}% + \ifx\pgfmathresult\pgfutil@empty + \pgfplots@error{Singular matrix encountered while computing boundary anchor. Please choose different values.}% + \def\pgfmathresult{0}{0}% + \fi \def\pgfplots@extract##1##2{% \def\pgfplots@r{##1}% }% @@ -3082,6 +3086,12 @@ }% \let\pgfplotsscanlinelength@nan@cleanup=\relax \def\pgfplotsscanlinelength@nan@pendingwork@PREPARED{% + \pgfplotsplothandlerappendjumpmarker` + % + \let\pgfplotsscanlinelength@nan@pendingwork=\relax +}% + +\def\pgfplotsplothandlerappendjumpmarker{% \ifpgfplots@LUA@backend@supported \pgfplotsutil@directlua{pgfplots.texSurveyAddJump()}% \else @@ -3100,8 +3110,6 @@ \def\pgfplotsaxisplothasjumps{1}% \pgfplotsaxisserializedatapoint \fi - % - \let\pgfplotsscanlinelength@nan@pendingwork=\relax }% % % ------------------------------------------------------------------------------- @@ -3421,6 +3429,16 @@ \pgfplotscoordmath{meta}{parsenumber}{0}% \fi }% + \pgfmathredeclarefunction{thisrow}{% + \getthisrow{##1}\pgfmathresult + % XXX : this does NOT allow to return string values, + % unfortunately! the fpu makes garbage out of it. + % I already tried to parse it here and return special string + % markers, but that approach requires much more effort... + }% + \pgfmathredeclarefunction{thisrowno}{% + \getthisrowno{##1}\pgfmathresult + }% % % %%%%%%%%%%%%%% % @@ -3481,6 +3499,14 @@ \fi }% +\def\pgfplots@define@dummies@for@pseudoconstants{% + \pgfmathdeclarefunction{thisrow}{1}{% + \pgfplots@error{You cannot use 'thisrow' in the current context.}% + }% + \pgfmathdeclarefunction{thisrowno}{1}{% + \pgfplots@error{You cannot use 'thisrowno' in the current context.}% + }% +}% \def\pgfplotsaxisupdatelimitsforpointmeta#1{% \begingroup \def\pgfplots@current@point@meta{#1}% @@ -6294,6 +6320,8 @@ % I invoke the private '@opt@' method because the semicolon ';' % character may cause problems due to catcode mismatches. % *sigh*. + \let\pgfplots@addplotimpl@file@parsesingle@twodim=\pgfplots@addplotimpl@file@parsesingle@twodim@gnuplotformat + \let\pgfplots@addplotimpl@file@parsesingle@threedim=\pgfplots@addplotimpl@file@parsesingle@threedim@gnuplotformat \pgfplots@addplotimpl@file@opt@@{}{}{#2}{#1}% this does not invoke the \pgfplots@start@plot@with@behavioroptions method. \else \expandafter\pgfplots@end@plot @@ -6428,6 +6456,44 @@ \fi }% +\def\pgfplots@gnuplot@unbounded{u}% +\def\pgfplots@gnuplot@unbounded@handler@jump{jump}% +\def\pgfplots@gnuplot@handle@unbounded{% + \pgfkeysgetvalue{/pgfplots/empty line}\pgfplots@loc@TMPa% + \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded@handler@jump + \pgfplotsplothandlerappendjumpmarker + \else + \ifpgfplots@curplot@threedim + \def\pgfplots@current@point@z{nan}% + \else + \def\pgfplots@current@point@y{nan}% + \fi + \pgfplots@coord@stream@coord% + \fi +} +\def\pgfplots@addplotimpl@file@parsesingle@threedim@gnuplotformat#1 #2 #3 #4 #5\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \def\pgfplots@loc@TMPa{#4}% + \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded% + % a special gnuplot "unbounded" marker + \pgfplots@gnuplot@handle@unbounded + \else + \pgfplots@coord@stream@coord% + \fi +}% +\def\pgfplots@addplotimpl@file@parsesingle@twodim@gnuplotformat#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@loc@TMPa{#3}% + \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded + % a special gnuplot "unbounded" marker + \pgfplots@gnuplot@handle@unbounded + \else + \pgfplots@coord@stream@coord% + \fi +}% \def\pgfplots@addplotimpl@file@parsesingle@threedim#1 #2 #3 #4\pgfplots@EOI{% \def\pgfplots@current@point@x{#1}% \def\pgfplots@current@point@y{#2}% @@ -6676,14 +6742,14 @@ \let\pgfplotstable@coordindex@old=\coordindex \def\coordindex{\pgfplotstablerow}% \def\lineno{\coordindex}% is the same here - % These macros are-unfortunately- not accessable here. And the + % The normal implementation of \thisrow is not accessable here. And the % worst is: error messages are impossible either because they are - % not executed... try to provide useful hints: - \def\thisrow##1{thisrow_unavailable_load_table_directly}% - \def\thisrowno##1{thisrowno_unavailable_load_table_directly}% + % not executed... we resort to the associated math functions: + \def\thisrow##1{thisrow("##1")}% let us hope that math parsing is active! + \def\thisrowno##1{thisrowno(##1)}% % this should work. - \def\getthisrow##1##2{\pgfplotstablegetelem{\coordindex}{##1}\of{#3}{##2}}% - \def\getthisrowno##1##2{\pgfplotstablegetelem{\coordindex}{[index]##1}\of{#3}{##2}}% + \def\getthisrow##1##2{\pgfplotstablegetelem{\coordindex}{##1}\of{#3}\let##2=\pgfplotsretval}% + \def\getthisrowno##1##2{\pgfplotstablegetelem{\coordindex}{[index]##1}\of{#3}\let##2=\pgfplotsretval}% % \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@x}\of#3\to\addplot@tbl@x \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@y}\of#3\to\addplot@tbl@y @@ -7379,9 +7445,29 @@ % #1 the target which will contain the filter % #2 a math expression. \def\pgfplots@install@filter@expression#1#2{% - \pgfkeysdef{/pgfplots/#1}{\pgfplots@filter@expression{#1}}% + \pgfkeysdef{/pgfplots/#1}{% + % DO NOT MODIFY THIS VALUE without also modifying + % \pgfplots@ifisfilterexpression! + \pgfplots@filter@expression{#1}% + }% + % + % remember for lua backend: \pgfkeyssetvalue{/pgfplots/#1/@expressionvalue}{#2}% }% +% #1 the target which will contain the filter +% #2 a math expression. +\def\pgfplots@install@filter@expression@append#1#2{% + \pgfkeysgetvalue{/pgfplots/#1/.@cmd}\pgfplots@loc@TMPc + \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key + % ok, this is the first filter. Make sure it can also be + % processed by the lua backend + \pgfplots@install@filter@expression{#1}{#2}% + \else + % there is a subtle difference to /.expression: this here CANNOT + % be processed by the lua backend! + \pgfkeysalso{/pgfplots/#1/.append code={\pgfplots@filter@expression@{#1}{#2}}}% + \fi +}% % Executes #2 if the filter key was defined by % \pgfplots@install@filter@expression. @@ -7399,14 +7485,18 @@ \fi }% -% the key name (example: 'x filter') +% #1 the key name (example: 'x filter') \def\pgfplots@filter@expression#1{% + \pgfplots@filter@expression@{#1}{\pgfkeysvalueof{/pgfplots/#1/@expressionvalue}}% +}% +% #1 the key name (example: 'x filter') +% #2 the expression +\def\pgfplots@filter@expression@#1#2{% \begingroup \pgfkeys{/pgf/fpu=true,% /pgf/fpu/output format=float,% }% - \pgfkeysgetvalue{/pgfplots/#1/@expressionvalue}\pgfplots@loc@TMPa - \pgfmathparse{\pgfplots@loc@TMPa}% + \pgfmathparse{#2}% \pgfmath@smuggleone\pgfmathresult \endgroup }% @@ -7578,16 +7668,55 @@ \fi }% -% Returns the current points into the keys +% A command which returns high-level (logical) coordinates into the keys % /data point/x % /data point/y % /data point/z % /data point/meta +% /data point/index +% +% The command has two modes: +% +% 1. without arguments. In this case, it reads the "current" point +% from the plot handler. +% +% 2. with an argument in curly braces. In this case, it expects one of +% the following: +% a) a \pgfpoint instruction (i.e. some code which assigns \pgf@x and +% \pgf@y) and returns the associated logical (high-level) coordinates. +% b) a TikZ point starting with '('. +% +% Examples: +% * \pgfplotspointgetcoordinates +% -> useful for nodes near coords +% * \pgfplotspointgetcoordinates{\pgfpoint{200pt}{100pt}} +% * \pgfplotspointgetcoordinates{(5,3)} +% +% +% This works for 2D axes only. +% \def\pgfplotspointgetcoordinates{% + \pgfutil@ifnextchar\bgroup{% + \pgfplotspointgetcoordinates@frompgfpoint + }{% + \pgfplotspointgetcoordinates@currentpoint + }% +}% +\def\pgfplotspointgetcoordinates@frompgfpoint#1{% + \pgfplotspointgetnormalizedcoordinates{#1}% + \pgfplotspointgetcoordinatesfromnormalized +}% +\def\pgfplotspointgetcoordinates@currentpoint{% \pgfplotspointgetnormalizedcoordinates \pgfplotspointgetcoordinatesfromnormalized }% +\def\pgfplotspointgetnormalizedcoordinates@@@x{undefined} +\def\pgfplotspointgetnormalizedcoordinates@@@y{undefined} +\def\pgfplotspointgetnormalizedcoordinates@@@z{undefined} +\let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfutil@empty +\let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfutil@empty + % PRECONDITION: \pgfplots@current@point@x and its variants is given in % TRANSFORMED format, i.e. we assume that we are in the visualization % phase after the coordinates have been prepared. @@ -7599,7 +7728,7 @@ % computation due to the LUA backend in which case remembering it % leads to extensive (=expensive?) communication between lua and % TeX. Does it hurt here? Scatter plots compute this stuff... - \expandafter\let\expandafter\pgfplotsretval\csname pgfplots@current@point@#1\endcsname + \expandafter\let\expandafter\pgfplotsretval\csname pgfplotspointgetnormalizedcoordinates@@@#1\endcsname \ifx\pgfplotsretval\pgfutil@empty \else \pgfplots@if{pgfplots@apply@datatrafo@#1}{% @@ -7612,6 +7741,52 @@ % Same as \pgfplotspointgetcoordinates, but the resulting values are % for use in 'normalized axis cs'. \def\pgfplotspointgetnormalizedcoordinates{% + \pgfutil@ifnextchar\bgroup{% + \pgfplotspointgetnormalizedcoordinates@frompgfpoint + }{% + \pgfplotspointgetnormalizedcoordinates@currentpoint + }% +} +\def\pgfplotspointgetnormalizedcoordinates@frompgfpoint#1{% + \pgfplotspointgetnormalizedcoordinates@frompgfpoint@#1\pgfplots@EOI +} +\def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@{% + \pgfutil@ifnextchar({\pgfplotspointgetnormalizedcoordinates@frompgfpoint@tikz}{\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@}% +}% +\def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@tikz#1\pgfplots@EOI{% + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{(.)}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfplotspointgetnormalizedcoordinates@frompgfpoint@@\tikz@last@position\pgfplots@EOI + \else + \tikz@scan@one@point\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@@#1\relax + \fi +}% +\def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@@#1{% + \pgfplotspointgetnormalizedcoordinates@frompgfpoint@@#1\pgfplots@EOI +} +\def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@#1\pgfplots@EOI{% + \pgf@process{#1}% + \pgfplotsconvertunittocoordinate{x}{\pgf@x}% + \let\pgfplotspointgetnormalizedcoordinates@@@x=\pgfmathresult + \pgfplotsconvertunittocoordinate{y}{\pgf@y}% + \let\pgfplotspointgetnormalizedcoordinates@@@y=\pgfmathresult + \let\pgfplotspointgetnormalizedcoordinates@@@z=\pgfutil@empty + \let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfutil@empty + \let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfutil@empty + % + \pgfplotspointgetnormalizedcoordinates@internal% +}% + +\def\pgfplotspointgetnormalizedcoordinates@currentpoint{% + \let\pgfplotspointgetnormalizedcoordinates@@@x=\pgfplots@current@point@x + \let\pgfplotspointgetnormalizedcoordinates@@@y=\pgfplots@current@point@y + \let\pgfplotspointgetnormalizedcoordinates@@@z=\pgfplots@current@point@z + \let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfplots@current@point@meta + \let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfplots@current@point@coordindex + \pgfplotspointgetnormalizedcoordinates@internal +} +\def\pgfplotspointgetnormalizedcoordinates@internal{% \pgfplotspointgetnormalizedcoordinates@ x% \pgfkeyslet{/data point/x}\pgfplotsretval % @@ -7625,8 +7800,8 @@ \pgfkeyslet{/data point/z}\pgfutil@empty \fi % - \pgfkeyslet{/data point/meta}\pgfplots@current@point@meta - \edef\pgfplots@loc@TMPa{\pgfplots@current@point@coordindex}% + \pgfkeyslet{/data point/meta}\pgfplotspointgetnormalizedcoordinates@@@meta + \edef\pgfplots@loc@TMPa{\pgfplotspointgetnormalizedcoordinates@@@index}% \pgfkeyslet{/data point/index}\pgfplots@loc@TMPa }% @@ -7681,14 +7856,18 @@ \pgfplots@glob@TMPa }% \def\pgfplotspointgetcoordinatesfromnormalized@transform#1#2{% - \pgfplots@if{pgfplots@#1islinear}{% - \pgfplotscoordmath{#1}{tofixed}{#2}% - }{% - \pgfplotscoordmath{#1}{exp}{#2}% - }% - \let#2=\pgfmathresult - \pgfplots@coord@inv@trafo@apply{#1}{#2}% - \let#2=\pgfmathresult + \edef\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplots@if{pgfplots@#1islinear}{% + \pgfplotscoordmath{#1}{tofixed}{#2}% + }{% + \pgfplotscoordmath{#1}{exp}{#2}% + }% + \let#2=\pgfmathresult + \pgfplots@coord@inv@trafo@apply{#1}{#2}% + \let#2=\pgfmathresult + \fi }% % Defines an optimized and matching \pgfplotsaxisvisphasetransformcoordinate @@ -7857,6 +8036,8 @@ \noexpand\gdef\noexpand\pgfplotspointplotattimefirst{\pgfplotspointplotattimefirst}% \noexpand\gdef\noexpand\pgfplotspointplotattimesecond{\pgfplotspointplotattimesecond}% \noexpand\gdef\noexpand\pgfplotspointplotattimecoords{\pgfplotspointplotattimecoords}% + \noexpand\pgf@x=\the\pgf@x\space% attempt to fix bugs/94/ aka q/271792/. + \noexpand\pgf@y=\the\pgf@y\space% sometimes there are \noexpand sometimes there are not. }% \t@pgfplots@toka=\expandafter{\pgfplotspointplotattime@cache}% \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index 926476e73b5..f5acfd81ef7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -2521,14 +2521,24 @@ % take one arg) % #3: the output macro name \long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% + \pgfplots@transform@csv@list{#1}\to{#3}\with{% + \pgfplotscoordmath{float}{parse}{\pgfmathresult}% + %\pgfmathfloatparsenumber{\pgfmathresult}% #2{\pgfmathresult}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% + }% +}% + +% A helper macro which expects a \foreach-list '#1'. applies some transformation '#3' and stores results into a new csv list '#2'. +% '#3' is some macro. Its input is '\pgfmathresult', its expected output is '\pgfmathresult' +\long\def\pgfplots@transform@csv@list#1\to#2\with#3{% + \let#2=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \let\pgfmathresult=\pgfplots@loc@TMPb + #3% + \ifx#2\pgfutil@empty + \xdef#2{\pgfmathresult}% \else - \xdef#3{#3,\pgfmathresult}% + \xdef#2{#2,\pgfmathresult}% \fi }% % |