summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-08-06 22:47:59 +0000
committerKarl Berry <karl@freefriends.org>2014-08-06 22:47:59 +0000
commit1da164bf9c4fed03b30b98439a239f5a1873f9ae (patch)
tree2ed76752cb203cacf4135b821206b45c24b1a534 /Master/texmf-dist/tex/generic/pgfplots/pgfcontrib
parente16354c1642ffdd8e82798c9f0f60108e85059c6 (diff)
pgfplots (6aug14)
git-svn-id: svn://tug.org/texlive/trunk@34851 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfcontrib')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex122
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibrarydecorations.softclip.code.tex25
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibraryfillbetween.code.tex177
3 files changed, 282 insertions, 42 deletions
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 bf2ebd6b64d..2b1eebdcb58 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/pgflibraryfillbetween.code.tex
@@ -48,7 +48,8 @@
% ...
% end
%
- % 'begin' has no arguments.
+ % 'begin' has one arguments: the number of following single
+ % streams.
/pgf/fill between/result stream/begin/.code=,%
%
% 'next ready' has macro arguments, but the macro \pgfretval
@@ -108,15 +109,15 @@
\ifx#3\pgfutil@empty
\pgfpathfillbetween@warning{second}%
\else
- \pgfpathfillbetween@invoke{result stream/begin}%
%
\ifpgfpathfillbetween@split
\pgfpathfillbetween@compute@splitted{#2}{#3}%
\else
+ \pgfkeys{/pgf/fill between/result stream/begin=1}%
\pgfpathfillbetween@compute{#2}{#3}%
\pgfpathfillbetween@invoke{result stream/next ready}%
+ \pgfpathfillbetween@invoke{result stream/end}%
\fi
- \pgfpathfillbetween@invoke{result stream/end}%
\fi
\fi
%
@@ -132,19 +133,84 @@
% 'lineto'. This excludes the first moveto.
%
% The motivation is that fillbetween should ignore inner movetos.
+%
+% UPDATE: it turned out that replacing inner movetos is necessary, but
+% not sufficient. Now, this macro does more:
+% - it replaces isolated inner movetos by lineto
+% - if two successive inner movetos occur, it throws away the first
+% one replaces the second by lineto
+% - if one or more trailing movetos occur in a path, these will be
+% thrown away.
\def\pgfpathfillbetween@connect@inner@movetos#1{%
\expandafter\pgfpathfillbetween@connect@inner@movetos@#1\pgf@stop%
\let#1=\pgfretval
}
\def\pgfpathfillbetween@connect@inner@movetos@#1#2\pgf@stop{%
\ifx#1\pgfsyssoftpath@movetotoken
- \pgfutilstrreplace{\pgfsyssoftpath@movetotoken}{\pgfsyssoftpath@linetotoken}{#2}%
+ \pgfpathfillbetween@connect@inner@movetos@@{#2}%
\expandafter\def\expandafter\pgfretval\expandafter{\expandafter\pgfsyssoftpath@movetotoken\pgfretval}%
\else
- \pgfutilstrreplace{\pgfsyssoftpath@movetotoken}{\pgfsyssoftpath@linetotoken}{#1#2}%
+ \pgfpathfillbetween@connect@inner@movetos@@{#1#2}%
\fi
}%
+% Substitute all movetotokens by linetotokens.
+%
+% In addition, it should *deduplicate* movetos, i.e.
+% "moveto{<x>}{<y}moveto{<x2>}{<y2>}"
+% -> "moveto{<x2>}{<y2>}"
+%
+% and: trailing movetos should be discarded.
+\def\pgfpathfillbetween@connect@inner@movetos@@#1{%
+ % this implementation is derived from \pgfutilstrreplace - it does
+ % almost the same as
+ % s/\pgfsyssoftpath@movetotoken/pgfsyssoftpath@linetotoken/g
+ % -> but with the extra additions of deduplication and trailing
+ % moveto removal.
+ \def\pgfretval{}%
+ \pgfpathfillbetween@search@and@replace@loop{#1}%
+}
+\def\pgfpathfillbetween@connect@inner@moveto@foundit@#1\pgfsyssoftpath@movetotoken#2#3#4{%
+ \ifx#4\pgf@EOI
+ % ah - a trailing moveto.
+ % In this case, we remember all until the moveto, but we omit
+ % the trailing moveto and its arguments.
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #1}%
+ %
+ % ... and stop searching.
+ \let\pgf@loc@TMPa\relax
+ \else
+ \ifx#4\pgfsyssoftpath@movetotoken
+ % DEDUPLICATE: we have at least two successive movetos.
+ % silently skip the first moveto and its arguments and go on
+ % with the second moveto.
+ \def\pgf@loc@TMPa{\pgfpathfillbetween@connect@inner@moveto@foundit@#1\pgfsyssoftpath@movetotoken}%
+ \else
+ % substitute it by a lineto.
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #1\pgfsyssoftpath@linetotoken{#2}{#3}}%
+ %
+ % ... continue the standard loop which skips over paths
+ % until the next moveto. Remember to re-insert '#4':
+ \def\pgf@loc@TMPa{\pgfpathfillbetween@connect@inner@moveto@foundit@@ #4}%
+ \fi
+ \fi
+ \pgf@loc@TMPa
+}%
+\def\pgfpathfillbetween@connect@inner@moveto@foundit@@#1\pgf@EOI{%
+ \pgfpathfillbetween@search@and@replace@loop{#1}%
+}%
+
+\def\pgfpathfillbetween@search@and@replace@loop#1{%
+ \pgfutil@in@{\pgfsyssoftpath@movetotoken}{#1}%
+ \ifpgfutil@in@
+ \def\pgf@loc@TMPa{\pgfpathfillbetween@connect@inner@moveto@foundit@ #1\pgf@EOI}%
+ \else
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #1}%
+ \let\pgf@loc@TMPa=\relax
+ \fi
+ \pgf@loc@TMPa
+}%
+
\def\pgfpathfillbetween@invoke#1{\pgfkeysvalueof{/pgf/fill between/#1/.@cmd}\pgfeov}
\def\pgfpathfillbetween@replace@first@moveto#1#2\pgf@stop{%
@@ -216,6 +282,7 @@
\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:
\def\c@pgfpathfilled@counter{0}%
@@ -230,6 +297,7 @@
%
\pgfutil@advancestringcounter\c@pgfpathfilled@counter
\repeatpgfmathloop
+ \pgfpathfillbetween@invoke{result stream/end}%
}
\def\pgfpathfillbetween@compute#1#2{%
@@ -307,8 +375,11 @@
%
% #1 a macro containing a softpath (i.e. something returned by
% \pgfgetpath)
+%
+% SIDE--EFFECT: defines \pgfpointlastofsetpath to be the last point of path #1
\def\pgfsetpathandBB#1{%
- \expandafter\pgfsetpath@protocolsizes@loop#1\pgf@stop
+ \let\pgfpointlastofsetpath=\pgfutil@empty
+ \expandafter\pgfsetpath@loop#1\pgf@stop
%
\pgfsetpath{#1}%
}%
@@ -318,8 +389,10 @@
%
% #1 a macro containing a softpath (i.e. something returned by
% \pgfgetpath)
+% SIDE--EFFECT: defines \pgfpointlastofsetpath to be the last point of path #1
\def\pgfaddpathandBB#1{%
- \expandafter\pgfsetpath@protocolsizes@loop#1\pgf@stop
+ \let\pgfpointlastofsetpath=\pgfutil@empty
+ \expandafter\pgfsetpath@loop#1\pgf@stop
\pgfaddpath#1%
}
@@ -410,12 +483,14 @@
}%
}
-\def\pgfsetpath@protocolsizes@loop#1{%
+% Accumulates the path's bounding box, the last moveto, and the last
+% coord.
+\def\pgfsetpath@loop#1{%
\ifx#1\pgf@stop%
\let\pgfsetpathBB@protocolsizesnext=\relax%
\else%
\ifx#1\pgfsyssoftpath@movetotoken%
- \let\pgfsetpathBB@protocolsizesnext=\pgfsetpathBB@protocolsizestoken@simple%
+ \let\pgfsetpathBB@protocolsizesnext=\pgfsetpathBB@protocolsizestoken@moveto%
\else%
\ifx#1\pgfsyssoftpath@linetotoken%
\let\pgfsetpathBB@protocolsizesnext=\pgfsetpathBB@protocolsizestoken@simple%
@@ -436,16 +511,27 @@
\fi%
\pgfsetpathBB@protocolsizesnext}
+\def\pgfsetpathBB@protocol@lastmoveto#1#2{%
+ \gdef\pgfsyssoftpath@lastmoveto{{#1}{#2}}%
+}
+
+\def\pgfsetpathBB@protocolsizestoken@moveto#1#2{%
+ % required for --cycle, among others:
+ \pgfsetpathBB@protocol@lastmoveto{#1}{#2}%
+ \pgfsetpathBB@protocolsizestoken@simple{#1}{#2}%
+}
\def\pgfsetpathBB@protocolsizestoken@simple#1#2{%
+ \def\pgfpointlastofsetpath{\pgfqpoint{#1}{#2}}%
\pgf@protocolsizes{#1}{#2}%
- \pgfsetpath@protocolsizes@loop%
+ \pgfsetpath@loop%
}
\def\pgfsetpathBB@protocolsizestoken@curveto#1#2\pgfsyssoftpath@curvetosupportbtoken#3#4\pgfsyssoftpath@curvetotoken#5#6{%
+ \def\pgfpointlastofsetpath{\pgfqpoint{#5}{#6}}%
\pgf@protocolsizes{#1}{#2}%
\pgf@protocolsizes{#3}{#4}%
\pgf@protocolsizes{#5}{#6}%
- \pgfsetpath@protocolsizes@loop
+ \pgfsetpath@loop
}
\def\pgfsetpathBB@protocolsizestoken@rect#1#2\pgfsyssoftpath@rectsizetoken#3#4{%
@@ -455,7 +541,7 @@
\pgf@ya=#2\relax%
\advance\pgf@ya by#4\relax%
\pgf@protocolsizes{\pgf@xa}{\pgf@ya}%
- \pgfsetpath@protocolsizes@loop
+ \pgfsetpath@loop
}%
% Defines \pgfretval to be the reversed path of #1.
@@ -606,7 +692,7 @@
% the current scope), this command computes the intersection segments
% for one of the input arguments.
%
-% On output, \pgfretval contains the number of computed segments. The
+% On output, both \pgfretval and \pgfintersectionsegments contain the number of computed segments. The
% segments as such can be accessed via \pgfgetintersectionsegmentpath.
%
% #1 : should be '1' if the FIRST argument of
@@ -689,6 +775,7 @@
\pgfutil@advancestringcounter\c@pgf@path@result%
\let\pgfretval=\c@pgf@path@result%
\fi
+ \let\pgfintersectionsegments=\pgfretval
}%
% Defines \pgfretval to contain the desired path segment as softpath.
@@ -701,12 +788,15 @@
% \pgfintersectionofpaths are requested or '2' if results for the
% SECOND path are requested (compare \pgfcomputeintersectionsegments).
% #2: the segment index (a number 0<= #2 < numbersegments).
-% The number of segments is returned by
-% \pgfcomputeintersectionsegments.
+% The number of segments is \pgfintersectionsegments
\def\pgfgetintersectionsegmentpath#1#2{%
\pgfcomputeintersectionsegments@set@src{#1}%
+ \pgfmathparse{#2}%
\afterassignment\pgfcomputeintersectionsegments@set@src@gobble
- \c@pgf@countc=#2\relax%
+ \c@pgf@countc=\pgfmathresult\relax%
+ \ifnum\c@pgf@countc<0
+ \advance\c@pgf@countc by \pgfintersectionsegments\relax
+ \fi
\expandafter\let\expandafter\pgfretval\csname pgf@intersect@path@split@\pgf@insert@intersections@src @\the\c@pgf@countc\endcsname
\ifx\pgfretval\relax
\pgferror{There is no intersection segment '#2' in path '#1'}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibrarydecorations.softclip.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibrarydecorations.softclip.code.tex
index 98fca71c047..7544d66d313 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibrarydecorations.softclip.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibrarydecorations.softclip.code.tex
@@ -54,7 +54,13 @@
% or
% soft clip={A}
% where 'A' is defined using 'name path=A' somewhere
- /pgf/decoration/soft clip path/.initial=,
+ /pgf/decoration/soft clip path/.code={%
+ % FIXME : I would rather NOT evaluate path arguments in this
+ % context! Who knows how people set keys!? But alas, we cannot
+ % evaluate late because the CM is reset while working on
+ % decorations ... (see below)
+ \tikzlibsoftclip@setkey{\tikzlibsoftclip@setkey@assign}#1\pgf@stop
+ },
/pgf/decoration/every soft clipped path/.style={},%
}
@@ -69,9 +75,14 @@
\state{replace}[width=\pgfdecoratedpathlength,
persistent precomputation={%
- \pgfkeysgetvalue{/pgf/decoration/soft clip path}\pgf@temp
- \def\tikz@marshal{\tikzlibsoftclip@setkey{\tikzlibsoftclip@setkey@assign}}%
- \expandafter\tikz@marshal\pgf@temp\pgf@stop
+ % This here is an earlier draft... but alas, the
+ % transformation matrix has been reset in this context,
+ % and we cannot define the clip path dynamically here.
+ % I left it to document that.
+ %
+ %\pgfkeysgetvalue{/pgf/decoration/soft clip path}\pgf@temp
+ %\def\tikz@marshal{\tikzlibsoftclip@setkey{\tikzlibsoftclip@setkey@assign}}%
+ %\expandafter\tikz@marshal\pgf@temp\pgf@stop
}
]{%
\ifx\pgf@decoration@soft@clip\pgfutil@empty
@@ -142,6 +153,7 @@
\pgfsetpath#2%
}%
%
+%\message{... num intersections = \pgfintersectionsolutions^^J}%
%
\ifnum\pgfintersectionsolutions=0 %
\if1\b@pgffill@is@outside@clip
@@ -312,7 +324,10 @@
\pgf@getpathsizes\pgf@interrupt@pathsizes
% we only need the path size here:
\pgf@relevantforpicturesizefalse
- \expandafter\pgfsetpath@protocolsizes@loop#1\pgf@stop
+ %
+ % FIXME : CODE CLEANUP NEEDED
+ \def\pgfsetpathBB@protocol@lastmoveto##1##2{}%
+ \expandafter\pgfsetpath@loop#1\pgf@stop
\pgfpointdiff
{\pgfqpoint\pgf@pathminx\pgf@pathminy}%
{\pgfqpoint\pgf@pathmaxx\pgf@pathmaxy}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibraryfillbetween.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibraryfillbetween.code.tex
index 6446027318f..8f60ef1e6b9 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibraryfillbetween.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfcontrib/tikzlibraryfillbetween.code.tex
@@ -86,8 +86,10 @@
\immediate\write16{Package pgfplots: loading complementary 'name path' implementation for your pgf version...}
\let\tikz@key@name@path=\tikz@key@name@path@new
\fi
+
% ------------------------------------------------------------
+\newif\iftikzfillbetween@optimize@name@intersections
\pgfkeys{%
/tikz/fill between/of/.code=\tikzlibraryfillbetween@parse#1\pgf@stop,
@@ -96,6 +98,12 @@
/tikz/fill between/every segment/.style={},
/tikz/fill between/every odd segment/.style={},
/tikz/fill between/every even segment/.style={},
+ /tikz/fill between/every last segment/.style={},
+ %
+ % Allows to add path instructions *after* the segment.
+ % If you want to add some *before* the segment, you can rely on
+ % 'every segment no 0/.style={ ... suitable tikz options ... }'
+ /tikz/fill between/path after segment/.initial={},
%
% soft clip={(axis cs:0,0) rectangle (axis cs:1,1)}
/tikz/fill between/soft clip/.style={
@@ -109,6 +117,10 @@
/tikz/fill between/@draw style/.style={
/pgf/fill between/result stream/begin/.code={%
\gdef\tikzsegmentindex{0}%
+ \xdef\tikzsegmentindices{##1}%
+ \c@pgf@countc=##1 %
+ \advance\c@pgf@countc by-1 %
+ \xdef\tikzsegmentlastindex{\the\c@pgf@countc}%
},%
/pgf/fill between/result stream/next ready/.code={%
\let\pgflibraryfill@path=\pgfretval
@@ -127,13 +139,30 @@
}%
\fi
%
+ \ifnum\tikzsegmentindex=\tikzsegmentlastindex\relax
+ \expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPa
+ /tikz/fill between/every last segment,
+ }%
+ \fi
+ %
\expandafter\fill\expandafter[\pgfplots@loc@TMPa]
- \pgfextra \pgfsetpathandBB{\pgflibraryfill@path}\endpgfextra;%
+ \pgfextra
+ \pgfsetpathandBB{\pgflibraryfill@path}%
+ \pgfkeysgetvalue{/tikz/fill between/path after segment}\tikz@fillbetween@post@segment
+ \expandafter
+ \endpgfextra
+ \tikz@fillbetween@post@segment
+ ;%
\pgfplotsutil@advancestringcounter@global\tikzsegmentindex
},%
/pgf/fill between/result stream/end/.code=,%
},
/tikz/fill between/.search also={/pgf/fill between,/pgfplots},
+ /tikz/fill between/optimize name intersections/.is if=tikzfillbetween@optimize@name@intersections,
+ %
+ % FIXME : this optimization needs much more work... I believe it
+ % would be stable enough, but it covers too few cases.
+ %/tikz/fill between/optimize name intersections=true,
%
%
%
@@ -252,6 +281,12 @@
\expandafter\let\expandafter\tikz@fillbetween@b@path
\csname tikz@intersect@path@name@\tikz@fillbetween@b\endcsname
%
+ \iftikzfillbetween@optimize@name@intersections
+ \ifpgfpathfillbetween@split
+ \tikzfillbetween@optimize@name@intersections\tikz@fillbetween@a\tikz@fillbetween@b
+ \fi
+ \fi
+ %
\pgfpathfillbetween{\tikz@fillbetween@a@path}{\tikz@fillbetween@b@path}%
}%
@@ -330,18 +365,27 @@
% compute intersections using the PGF intersection lib...
\pgfintersectionofpaths{\pgfsetpath\tikz@path@segments@A}{\pgfsetpath\tikz@path@segments@B}%
%
- % ... and compute the intersection *segments* for both input
- % paths...
- \pgfcomputeintersectionsegments1%
- \pgfcomputeintersectionsegments2%
+ \ifnum\pgfintersectionsolutions=0 %
+ \pgferror{The argument of 'sequence' requests an intersection segment -- but the two input paths do not intersect. Please use A* or B* to select the whole path}%
+ \def\b@tikz@select@all{1}%
+ \else
+ %
+ % ... and compute the intersection *segments* for both input
+ % paths...
+ \pgfcomputeintersectionsegments1%
+ \pgfcomputeintersectionsegments2%
+ \fi
\let\tikz@ensurehascomputedintersection=\relax
}%
%
\pgfkeysgetvalue{/tikz/segments/sequence}\tikz@sequence
%
\def\b@tikz@isect@nextismoveto{1}%
+ \let\pgfpointlastofsetpath=\pgfutil@empty
\expandafter\tikzpathintersectionsegments@parse@loop\tikz@sequence\pgf@stop
+ \pgfmath@smuggleone\pgfpointlastofsetpath
\endgroup
+ \tikz@make@last@position{\pgfpointlastofsetpath}%
}%
\def\tikzpathintersectionsegments@parse@loop{%
@@ -354,10 +398,18 @@
\pgfutil@ifnextchar B{%
\tikz@isect@p@next
}{%
- \pgfutil@ifnextchar\pgf@stop{%
- \tikz@isect@finish
+ \pgfutil@ifnextchar L{%
+ \tikz@isect@p@next
}{%
- \tikz@isect@p@error
+ \pgfutil@ifnextchar R{%
+ \tikz@isect@p@next
+ }{%
+ \pgfutil@ifnextchar\pgf@stop{%
+ \tikz@isect@finish
+ }{%
+ \tikz@isect@p@error
+ }%
+ }%
}%
}%
}%
@@ -376,12 +428,25 @@
}
\def\tikz@isect@p@next#1#2{%
+ \def\tikz@temp{#2}%
+ \def\tikz@@temp{-}%
+ \ifx\tikz@@temp\tikz@temp
+ % also accept minus signs without curly braces, i.e.
+ % L-2 instead of L{-2}
+ \def\tikz@next{\tikz@isect@p@next@{#1}{#2}}%
+ \else
+ \def\tikz@next{\tikz@isect@p@next@{#1}{#2}{}}%
+ \fi
+ \tikz@next
+}%
+\def\tikz@isect@p@next@#1#2#3{%
\pgfutil@ifnextchar[{%
- \tikz@isect@p@next@opt{#1}{#2}%
+ \tikz@isect@p@next@opt{#1}{#2#3}%
}{%
- \tikz@isect@p@next@opt{#1}{#2}[]%
+ \tikz@isect@p@next@opt{#1}{#2#3}[]%
}%
}%
+
\def\tikz@isect@p@next@opt#1#2[#3]{%
\begingroup
%
@@ -392,8 +457,38 @@
\pgfqkeys{/tikz/segments}{#3}%
\fi
%
+ \def\tikz@indexshift{}%
+ \if A#1%
+ % FIRST function (0-based index)
+ \def\tikz@path{1}%
+ \def\tikz@path@ab{A}%
+ \else
+ \if B#1%
+ % SECOND function (0-based index)
+ \def\tikz@path{2}%
+ \def\tikz@path@ab{B}%
+ \else
+ \if L#1%
+ % FIRST function (1-based index)
+ \def\tikz@path{1}%
+ \def\tikz@indexshift{-1}%
+ \def\tikz@path@ab{A}%
+ \else
+ \if R#1%
+ % SECOND function (1-based index)
+ \def\tikz@path{2}%
+ \def\tikz@indexshift{-1}%
+ \def\tikz@path@ab{B}%
+ \else
+ \def\tikz@path{}%
+ \pgferror{The argument of 'sequence' has an unexpected format near '#1#2': expected L#2 or R#2}%
+ \fi
+ \fi
+ \fi
+ \fi
+ %
% parse arguments:
- \edef\pgfmathresult{#2}%
+ \def\pgfmathresult{#2}%
\def\tikz@temp{*}%
\ifx\pgfmathresult\tikz@temp
\def\b@tikz@select@all{1}%
@@ -402,27 +497,29 @@
\tikz@ensurehascomputedintersection
\pgfmathparse{round(#2)}%
\let\tikz@index=\pgfmathresult
- \fi
- %
- \if A#1%
- \def\tikz@path{1}%
- \else
- \if B#1%
- \def\tikz@path{2}%
+ \ifx\tikz@indexshift\pgfutil@empty
\else
- \def\tikz@path{}%
- \pgferror{The argument of 'sequence' has an unexpected format near '#1#2': expected A#2 or B#2}%
+ \afterassignment\pgfutil@gobble@until@relax
+ \c@pgf@countc=\tikz@index\relax
+ \ifnum\c@pgf@countc<0 \else
+ % the index shift is ONLY for positive numbers: we
+ % want to start indexing at 1, not at 0 -- and the
+ % negative ones start at -1 anyway.
+ \advance\c@pgf@countc by\tikz@indexshift\relax
+ \edef\tikz@index{\the\c@pgf@countc}%
+ \fi
\fi
\fi
%
%
% PROCESS IT:
\ifx\tikz@path\pgfutil@empty
+ \let\pgfpointlastofsetpath=\pgfutil@empty
\else
\if1\b@tikz@select@all%
% ok... select the *entire* path.
% #1 = A|B :
- \expandafter\let\expandafter\pgfretval\csname tikz@path@segments@#1\endcsname
+ \expandafter\let\expandafter\pgfretval\csname tikz@path@segments@\tikz@path@ab\endcsname
\else
\pgfgetintersectionsegmentpath{\tikz@path}{\tikz@index}%
\fi
@@ -434,9 +531,47 @@
\fi
\pgfaddpathandBB\pgfretval
\fi
+ \pgfmath@smuggleone\pgfpointlastofsetpath
\endgroup
\def\b@tikz@isect@nextismoveto{1}%
\tikzpathintersectionsegments@parse@loop
}%
+\def\tikzfillbetween@optimize@name@intersections#1#2{%
+ \edef\tikzfillbetween@precached@intersectionofpaths@A{#1}%
+ \edef\tikzfillbetween@precached@intersectionofpaths@B{#2}%
+ \pgfkeys{%
+ /tikz/name intersections/.add code={%
+ \let\pgfintersectionofpaths=\tikzfillbetween@precached@intersectionofpaths
+ }{%
+ \let\pgfintersectionofpaths=\pgfintersectionofpaths@orig
+ }
+ }%
+}%
+
+\let\pgfintersectionofpaths@orig=\pgfintersectionofpaths
+
+\def\tikzfillbetween@precached@intersectionofpaths@log{%
+ \immediate\write-1{fill between: outcome of 'name intersections={of=\tikz@intersect@path@a\space and \tikz@intersect@path@b}' has been computed from available information of fill between}%
+}
+\def\tikzfillbetween@precached@intersectionofpaths#1#2{%
+ \def\pgf@loc@TMPa{0}%
+ \ifx\tikz@intersect@path@a\tikzfillbetween@precached@intersectionofpaths@A
+ \ifx\tikz@intersect@path@b\tikzfillbetween@precached@intersectionofpaths@B
+ \def\pgf@loc@TMPa{1}%
+ \fi
+ \fi
+ \ifx\tikz@intersect@path@b\tikzfillbetween@precached@intersectionofpaths@A
+ \ifx\tikz@intersect@path@a\tikzfillbetween@precached@intersectionofpaths@B
+ \def\pgf@loc@TMPa{1}%
+ \fi
+ \fi
+ %
+ \if1\pgf@loc@TMPa
+ \tikzfillbetween@precached@intersectionofpaths@log
+ \relax
+ \else
+ \pgfintersectionofpaths@orig{#1}{#2}%
+ \fi
+}%
\endinput