summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex708
1 files changed, 681 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
index 79990ec1fb8..933f48854d2 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
@@ -56,9 +56,18 @@
+% A quadratic spline in the ordering
+%
+% <left> <right> <middle>
+%
+% where <left> is the function value at the left end of the spline
+% segmment, <right> the function value at the right end, and <middle>
+% the function value in the middle of the spline segment.
\pgfplotsdeclarepatchclass{quadratic spline}{%
allow matrix=0,
uses view depth=0,
+ get dimension=1,
+ supports global path=1,
new=\def\pgfplotspatchclass@qspline@no{A},
set next vertex={%
% EXPECTED ORDERING: first 2 corners, then 1 mid nodes
@@ -72,6 +81,31 @@
\expandafter\let\expandafter\pgfplotspatchclass@qspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@qspline@no\endcsname
\fi
},
+ if current point can be first last={%
+ \pgfplots@loc@tmptrue
+ \if A\pgfplotspatchclass@qspline@no
+ % Ah - the current point is the 'C' point, i.e. the
+ % control point (we have advanced the '@no' counter)
+ \pgfplots@loc@tmpfalse
+ \fi
+ \ifpgfplots@loc@tmp
+ #1\relax%
+ \else
+ #2\relax
+ \fi
+ },
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \pgfplotspatchready
+ },%
first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex,
foreach vertex={%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex #1%
@@ -93,7 +127,7 @@
% in does the same.
\def\pgfplots@edge{%
\ifx\pgfplotspatchclass@qspline@A\PA
- \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
+ \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
\fi
\pgfpathcurveto {%
\pgfpointadd
@@ -111,6 +145,7 @@
\let\PB=\pgfplotspatchclass@qspline@C
\let\PC=\pgfplotspatchclass@qspline@B
\pgfplots@edge
+ \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\PC\endvertex}%
\endgroup
},
triangulate class=line,
@@ -156,6 +191,8 @@
\pgfplotsdeclarepatchclass{cubic spline}{%
allow matrix=0,
uses view depth=0,
+ get dimension=1,
+ supports global path=1,
new=\def\pgfplotspatchclass@cspline@no{A},
set next vertex={%
% EXPECTED ORDERING: first 2 corners, then 1 mid nodes
@@ -169,6 +206,39 @@
\expandafter\let\expandafter\pgfplotspatchclass@cspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@cspline@no\endcsname
\fi
},
+ if current point can be first last={%
+ \pgfplots@loc@tmpfalse
+ \if B\pgfplotspatchclass@cspline@no
+ % Ah - the current point is the 'A' point (we have
+ % advanced the '@no' counter)
+ \pgfplots@loc@tmptrue
+ \fi
+ \if C\pgfplotspatchclass@cspline@no
+ % Ah - the current point is the 'B' point (we have
+ % advanced the '@no' counter)
+ \pgfplots@loc@tmptrue
+ \fi
+ \ifpgfplots@loc@tmp
+ #1\relax%
+ \else
+ #2\relax
+ \fi
+ },
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.3333333}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.6666666}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \pgfplotspatchready
+ },%
first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex,
foreach vertex={%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex #1%
@@ -178,32 +248,13 @@
},
fill path={%
% Draw the patch boundary using a bezier curve.
- \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}%
- % switch basis from lagrange to bezier (see formular on top of
- % this file)
- \pgfpathcurveto {%
- \begingroup
- \pgfplotspatchvertexaccumstart
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@A\times{-0.833333}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@C\times{3}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@D\times{-1.5}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@B\times{0.3333333}%
- \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
- \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
- \endgroup
- }{%
- \begingroup
- \pgfplotspatchvertexaccumstart
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@A\times{0.333333}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@C\times{-1.5}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@D\times{3}%
- \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@B\times{-0.833333}%
- \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
- \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
- \endgroup
- }{%
- \expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex
- }%
+ \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}%
+ \pgfplotspathcubicfrominterpolation
+ {\pgfplotspatchclass@cspline@A}%
+ {\pgfplotspatchclass@cspline@C}%
+ {\pgfplotspatchclass@cspline@D}%
+ {\pgfplotspatchclass@cspline@B}%
+ \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}%
},
triangulate class=line,
triangulate={%
@@ -299,6 +350,34 @@
get num vertices=4,
}%
+\def\pgfplotspathcubicfrominterpolation#1#2#3#4{%
+ % switch basis from lagrange to bezier (see formular on top of
+ % this file)
+ \pgfpathcurveto {%
+ \begingroup
+ \pgfplotspatchvertexaccumstart
+ \expandafter\pgfplotspatchvertexaddXY#1\times{-0.833333}%
+ \expandafter\pgfplotspatchvertexaddXY#2\times{3}%
+ \expandafter\pgfplotspatchvertexaddXY#3\times{-1.5}%
+ \expandafter\pgfplotspatchvertexaddXY#4\times{0.3333333}%
+ \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
+ \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
+ \endgroup
+ }{%
+ \begingroup
+ \pgfplotspatchvertexaccumstart
+ \expandafter\pgfplotspatchvertexaddXY#1\times{0.333333}%
+ \expandafter\pgfplotspatchvertexaddXY#2\times{-1.5}%
+ \expandafter\pgfplotspatchvertexaddXY#3\times{3}%
+ \expandafter\pgfplotspatchvertexaddXY#4\times{-0.833333}%
+ \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
+ \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
+ \endgroup
+ }{%
+ \expandafter\pgfplotspointpatchvertex#4\endvertex
+ }%
+}%
+
% make a linearized sequence around the edge of the quad.triangle.
% note the ordering: first 3 corners, then 3 mid nodes:
\def\pgfplots@qtri@next@A{D}%
@@ -342,6 +421,50 @@
\expandafter\let\expandafter\pgfplotspatchclass@qtri@no\csname pgfpptchindexnext@\pgfplotspatchclass@qtri@no\endcsname
\fi
},
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ %
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \pgfplotspatchready
+ %
+ %
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ %
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \pgfplotspatchready
+ },%
first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex,
foreach vertex={%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1%
@@ -797,6 +920,21 @@
\pgfplotspatchready%
\fi
},
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \pgfplotspatchready
+ },%
first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex,
foreach vertex={%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex #1%
@@ -1145,6 +1283,36 @@
\expandafter\let\expandafter\pgfplotspatchclass@biquad@no\csname pgfpptchindexnext@\pgfplotspatchclass@biquad@no\endcsname
\fi
},
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \def\pgfplotspatchclassx{0.5}%
+ \def\pgfplotspatchclassy{0.5}%
+ #1%
+ \pgfplotspatchready
+ },%
first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex,
foreach vertex={%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1%
@@ -1833,3 +2001,489 @@
get num vertices=16,
get num cdata vertices=4,
}%
+
+% A bicubic patch with 16 points.
+%
+% It expects points in the order (i.e. in matrix ordering, row-wise):
+%
+% AD BD CD DD
+% AC BC CC DC
+% AB BB CB DB
+% AA BA CA DA
+%
+\pgfplotsdeclarepatchclass{bicubic}{%
+ allow matrix=0,
+ new=\def\pgfplotspatchclass@bicubic@row{A}\def\pgfplotspatchclass@bicubic@col{A},
+ set next vertex={%
+ % defines \pgfplotspatchclass@bicubic@AA ... \pgfplotspatchclass@bicubic@DD (16 points)
+ \expandafter\edef\csname pgfplotspatchclass@bicubic@\pgfplotspatchclass@bicubic@row\pgfplotspatchclass@bicubic@col\endcsname{#1}%
+ \if D\pgfplotspatchclass@bicubic@row
+ \def\pgfplotspatchclass@bicubic@row{A}%
+ \if D\pgfplotspatchclass@bicubic@col
+ \def\pgfplotspatchclass@bicubic@col{A}%
+ \pgfplotspatchready
+ \else
+ \expandafter\let\expandafter\pgfplotspatchclass@bicubic@col\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@col\endcsname
+ \fi
+ \else
+ \expandafter\let\expandafter\pgfplotspatchclass@bicubic@row\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@row\endcsname
+ \fi
+ },
+ sample in unit cube={%
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.333333333}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{0.666666666}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0}%
+ #1%
+ %
+ %
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0.333333333}%
+ #1%
+ \def\pgfplotspatchclassx{0.333333333}%
+ \def\pgfplotspatchclassy{0.333333333}%
+ #1%
+ \def\pgfplotspatchclassx{0.666666666}%
+ \def\pgfplotspatchclassy{0.333333333}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0.333333333}%
+ #1%
+ %
+ %
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{0.666666666}%
+ #1%
+ \def\pgfplotspatchclassx{0.333333333}%
+ \def\pgfplotspatchclassy{0.666666666}%
+ #1%
+ \def\pgfplotspatchclassx{0.666666666}%
+ \def\pgfplotspatchclassy{0.666666666}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{0.666666666}%
+ #1%
+ %
+ %
+ \def\pgfplotspatchclassx{0}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0.333333333}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{0.666666666}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ \def\pgfplotspatchclassx{1}%
+ \def\pgfplotspatchclassy{1}%
+ #1%
+ %
+ %
+ %
+ \pgfplotspatchready
+ },%
+ first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex,
+ foreach vertex={%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AB\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BB\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CB\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DB\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AC\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BC\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CC\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DC\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BD\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CD\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1%
+ },
+ foreach cdata vertex={%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1%
+ },
+ fill path={%
+ % Visualize the patch boundary using four bezier curves.
+ %
+ % This involves a change from Lagrange to bezier
+ % representation of the boundary curves.
+ %
+ \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@bicubic@AA\endvertex}%
+ \pgfplotspathcubicfrominterpolation
+ {\pgfplotspatchclass@bicubic@AA}
+ {\pgfplotspatchclass@bicubic@BA}
+ {\pgfplotspatchclass@bicubic@CA}
+ {\pgfplotspatchclass@bicubic@DA}
+ \pgfplotspathcubicfrominterpolation
+ {\pgfplotspatchclass@bicubic@DA}
+ {\pgfplotspatchclass@bicubic@DB}
+ {\pgfplotspatchclass@bicubic@DC}
+ {\pgfplotspatchclass@bicubic@DD}
+ \pgfplotspathcubicfrominterpolation
+ {\pgfplotspatchclass@bicubic@DD}
+ {\pgfplotspatchclass@bicubic@CD}
+ {\pgfplotspatchclass@bicubic@BD}
+ {\pgfplotspatchclass@bicubic@AD}
+ \pgfplotspathcubicfrominterpolation
+ {\pgfplotspatchclass@bicubic@AD}
+ {\pgfplotspatchclass@bicubic@AC}
+ {\pgfplotspatchclass@bicubic@AB}
+ {\pgfplotspatchclass@bicubic@AA}
+ \pgfpathclose
+ },
+ stream to shader={%
+ \begingroup
+ %
+ % AD BD CD DD
+ % AC BC CC DC
+ % AB BB CB DB
+ % AA BA CA DA
+ %
+ % STEP 1: ensure that the patch's coordinates are streamed in
+ % a sequence which is compatible with the DEPTH of the
+ % corners.
+ %
+ % we use
+ % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
+ % which works for bilinear, biquadratic, and bicubic
+ %
+ % define helper macros which are input for
+ % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth:
+ \let\pgfplotspatchclass@rect@A=\pgfplotspatchclass@bicubic@AA
+ \let\pgfplotspatchclass@rect@B=\pgfplotspatchclass@bicubic@DA
+ \let\pgfplotspatchclass@rect@C=\pgfplotspatchclass@bicubic@DD
+ \let\pgfplotspatchclass@rect@D=\pgfplotspatchclass@bicubic@AD
+ \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
+ {pgfplotspatchclass@rect@}{\Pcur}{\Pnextseq}%
+ %
+ %\message{using \Pcur\space(set = \Pnextseq)^^J}%
+ % now, translate the result into our matrix form.
+ % This means to (a) identify the FIRST point which needs to be
+ % streamed (it is stored in \Pcur as 'A', 'B', 'C', or 'D')
+ % and (b) keep in mind that we have to take care of the
+ % sequence in which points are streamed ("forward" means to
+ % rotate the matrix elements and "backward" means to transpose
+ % the "forward" result).
+ %
+ \if A\Pcur
+ % Ah - the point "AA" needs to be streamed as first.
+ %
+ % Well, this is simple: take the matrix as-is!
+ % simply copy 1:1
+ \let\P@AA=\pgfplotspatchclass@bicubic@AA
+ \let\P@BA=\pgfplotspatchclass@bicubic@BA
+ \let\P@CA=\pgfplotspatchclass@bicubic@CA
+ \let\P@DA=\pgfplotspatchclass@bicubic@DA
+ \let\P@AB=\pgfplotspatchclass@bicubic@AB
+ \let\P@BB=\pgfplotspatchclass@bicubic@BB
+ \let\P@CB=\pgfplotspatchclass@bicubic@CB
+ \let\P@DB=\pgfplotspatchclass@bicubic@DB
+ \let\P@AC=\pgfplotspatchclass@bicubic@AC
+ \let\P@BC=\pgfplotspatchclass@bicubic@BC
+ \let\P@CC=\pgfplotspatchclass@bicubic@CC
+ \let\P@DC=\pgfplotspatchclass@bicubic@DC
+ \let\P@AD=\pgfplotspatchclass@bicubic@AD
+ \let\P@BD=\pgfplotspatchclass@bicubic@BD
+ \let\P@CD=\pgfplotspatchclass@bicubic@CD
+ \let\P@DD=\pgfplotspatchclass@bicubic@DD
+ \fi
+ \if B\Pcur
+ % the "DA" point needs to be streamed as first.
+ %
+ % Reorder
+ % AD BD CD DD
+ % AC BC CC DC
+ % AB BB CB DB
+ % AA BA CA DA
+ % to
+ % AA AB AC AD
+ % BA BB BC BD
+ % CA CB CC CD
+ % DA DB DC DD
+ %
+ \let\P@AA=\pgfplotspatchclass@bicubic@DA
+ \let\P@BA=\pgfplotspatchclass@bicubic@DB
+ \let\P@CA=\pgfplotspatchclass@bicubic@DC
+ \let\P@DA=\pgfplotspatchclass@bicubic@DD
+ \let\P@AB=\pgfplotspatchclass@bicubic@CA
+ \let\P@BB=\pgfplotspatchclass@bicubic@CB
+ \let\P@CB=\pgfplotspatchclass@bicubic@CC
+ \let\P@DB=\pgfplotspatchclass@bicubic@CD
+ \let\P@AC=\pgfplotspatchclass@bicubic@BA
+ \let\P@BC=\pgfplotspatchclass@bicubic@BB
+ \let\P@CC=\pgfplotspatchclass@bicubic@BC
+ \let\P@DC=\pgfplotspatchclass@bicubic@BD
+ \let\P@AD=\pgfplotspatchclass@bicubic@AA
+ \let\P@BD=\pgfplotspatchclass@bicubic@AB
+ \let\P@CD=\pgfplotspatchclass@bicubic@AC
+ \let\P@DD=\pgfplotspatchclass@bicubic@AD
+ \fi
+ \if C\Pcur
+ % the "DD" point needs to be streamed as first.
+ %
+ % Reorder
+ % AD BD CD DD
+ % AC BC CC DC
+ % AB BB CB DB
+ % AA BA CA DA
+ % to
+ % DA CA BA AA
+ % DB CB BB AB
+ % DC CC BC AC
+ % DD CD BD AD
+ %
+ \let\P@AA=\pgfplotspatchclass@bicubic@DD
+ \let\P@BA=\pgfplotspatchclass@bicubic@CD
+ \let\P@CA=\pgfplotspatchclass@bicubic@BD
+ \let\P@DA=\pgfplotspatchclass@bicubic@AD
+ \let\P@AB=\pgfplotspatchclass@bicubic@DC
+ \let\P@BB=\pgfplotspatchclass@bicubic@CC
+ \let\P@CB=\pgfplotspatchclass@bicubic@BC
+ \let\P@DB=\pgfplotspatchclass@bicubic@AC
+ \let\P@AC=\pgfplotspatchclass@bicubic@DB
+ \let\P@BC=\pgfplotspatchclass@bicubic@CB
+ \let\P@CC=\pgfplotspatchclass@bicubic@BB
+ \let\P@DC=\pgfplotspatchclass@bicubic@AB
+ \let\P@AD=\pgfplotspatchclass@bicubic@DA
+ \let\P@BD=\pgfplotspatchclass@bicubic@CA
+ \let\P@CD=\pgfplotspatchclass@bicubic@BA
+ \let\P@DD=\pgfplotspatchclass@bicubic@AA
+ \fi
+ \if D\Pcur
+ % the "AD" point needs to be streamed as first.
+ %
+ % Reorder
+ % AD BD CD DD
+ % AC BC CC DC
+ % AB BB CB DB
+ % AA BA CA DA
+ % to
+ % DD DC DB DA
+ % CD CC CB CA
+ % BD BC BB BA
+ % AD AC AB AA
+ %
+ \let\P@AA=\pgfplotspatchclass@bicubic@AD
+ \let\P@BA=\pgfplotspatchclass@bicubic@AC
+ \let\P@CA=\pgfplotspatchclass@bicubic@AB
+ \let\P@DA=\pgfplotspatchclass@bicubic@AA
+ \let\P@AB=\pgfplotspatchclass@bicubic@BD
+ \let\P@BB=\pgfplotspatchclass@bicubic@BC
+ \let\P@CB=\pgfplotspatchclass@bicubic@BB
+ \let\P@DB=\pgfplotspatchclass@bicubic@BA
+ \let\P@AC=\pgfplotspatchclass@bicubic@CD
+ \let\P@BC=\pgfplotspatchclass@bicubic@CC
+ \let\P@CC=\pgfplotspatchclass@bicubic@CB
+ \let\P@DC=\pgfplotspatchclass@bicubic@CA
+ \let\P@AD=\pgfplotspatchclass@bicubic@DD
+ \let\P@BD=\pgfplotspatchclass@bicubic@DC
+ \let\P@CD=\pgfplotspatchclass@bicubic@DB
+ \let\P@DD=\pgfplotspatchclass@bicubic@DA
+ \fi
+ \ifx\Pnextseq\pgfutil@empty
+ \else
+ % reverse the ordering. This means to transpose the
+ % matrix:
+ \pgfplotspatchclass@bicubic@transpose
+ \fi
+ %
+ % Step: convert to tensor bezier representation.
+ %
+ % Converting a 2d tensor product lagrangian interpoland to a
+ % 2d tensor product bezier interpoland can be achieved by
+ % means of 1d algorithms along LINES in the matrix.
+ %
+ % The underlying proof for this is related to the tensor
+ % product form: the U and V coordinates are orthogonal to each
+ % other, so we can redistribute all intermediate results. (I
+ % do not have the real proof, so this hand-waving argument has
+ % to be enough). I verified its results experimentally.
+ %
+ % Note that the underlying 1d operation is the same as for
+ % 'patch type=cubic spline' . We only need to apply it to all
+ % lines in U direction and afterwards to all lines in V
+ % direction.
+ %
+ \def\pgfplotspatchvertexaddXY@expanded##1\times{%
+ \edef\pgfplots@loc@TMPa{##1}%
+ \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times
+ }%
+ %
+ % this macro operates on \pgfplots@line{[ABCD]}, see below:
+ \def\pgfplots@apply@to@line{%
+ \pgfplotspatchvertexaccumstart
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.833333}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{3}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-1.5}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{0.3333333}%
+ \pgfplotspatchvertexfinish\pgfplots@controlpoint@A
+ %
+ \pgfplotspatchvertexaccumstart
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{0.333333}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{-1.5}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{3}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{-0.833333}%
+ \pgfplotspatchvertexfinish\pgfplots@controlpoint@B
+ %
+ \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A
+ \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B
+ }%
+ %
+ \def\pgfplots@line##1{\csname P@##1A\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@##1B\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@##1C\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@##1D\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ %
+ \def\pgfplots@line##1{\csname P@A##1\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@B##1\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@C##1\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ \def\pgfplots@line##1{\csname P@D##1\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ % OK. The tensor product representation is READY.
+ %
+ % Stream it to the shader. Note that the shader has a
+ % DIFFERENT ordering; it expects points in the cyclic ordering
+ %
+ % AA BA CA DA DB DC DD CD BD AD AC AB BB CB CC BC
+ %
+ % note furthermore that only the corners have "point meta" in
+ % this shading :-(
+ %
+ \expandafter\pgfplotspatchvertex\P@AA\endvertex
+ \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
+ \pgfplotsaxisvisphasetransformpointmeta
+ \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BA\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CA\endvertex}{\pgfplotspointmetatransformed}%
+ \expandafter\pgfplotspatchvertex\P@DA\endvertex
+ \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
+ \pgfplotsaxisvisphasetransformpointmeta
+ \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
+ %
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DB\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DC\endvertex}{\pgfplotspointmetatransformed}%
+ \expandafter\pgfplotspatchvertex\P@DD\endvertex
+ \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
+ \pgfplotsaxisvisphasetransformpointmeta
+ \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
+ %
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CD\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BD\endvertex}{\pgfplotspointmetatransformed}%
+ \expandafter\pgfplotspatchvertex\P@AD\endvertex
+ \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
+ \pgfplotsaxisvisphasetransformpointmeta
+ \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
+ %
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AC\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AB\endvertex}{\pgfplotspointmetatransformed}%
+ %
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BB\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CB\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CC\endvertex}{\pgfplotspointmetatransformed}%
+ \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BC\endvertex}{\pgfplotspointmetatransformed}%
+ \endgroup
+ },
+ triangulate={%
+ \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
+ \def\pgfplotsplothandlermesh@patchclass{triangle}%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
+ % Ok. Now create a lot of triangles.
+ %
+ % FIXME: The ordering is not arbitrary (unless z buffer=sort is in effect).
+ %
+ % ##1: the row index of the cell to be triangulated (either A,B,or C)
+ % ##2: the col index of the cell to be triangulated (either A,B,or C)
+ % ##3: the 1. 'set edge visible' value for the first triangle
+ % ##4: the 2. 'set edge visible' value for the first triangle
+ % ##5: the 3. 'set edge visible' value for the first triangle
+ % ##6: the 1. 'set edge visible' value for the second triangle
+ % ##7: the 2. 'set edge visible' value for the second triangle
+ % ##8: the 3. 'set edge visible' value for the second triangle
+ \def\pgfplots@bicubic@triangulate@cell##1##2##3##4##5##6##7##8{%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##3%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##4%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##5%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname##2\endcsname}%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}%
+ %
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##6%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##7%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##8%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1\csname pgfpptchindexnext@##2\endcsname\endcsname}%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}%
+ \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}%
+ %
+ }%
+ %
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20%
+ \pgfplots@bicubic@triangulate@cell AA100 100%
+ \pgfplots@bicubic@triangulate@cell BA100 000%
+ \pgfplots@bicubic@triangulate@cell CA110 000%
+ %
+ \pgfplots@bicubic@triangulate@cell AB000 100%
+ \pgfplots@bicubic@triangulate@cell BB000 000%
+ \pgfplots@bicubic@triangulate@cell CB010 000%
+ %
+ \pgfplots@bicubic@triangulate@cell AC000 101%
+ \pgfplots@bicubic@triangulate@cell BC000 001%
+ \pgfplots@bicubic@triangulate@cell CC010 001%
+ \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
+ },%
+ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
+ deserialize except vertices=,
+ get pdf shading type=7,
+ get num vertices=16,
+ get num cdata vertices=4,
+}%
+
+% Transpose a bicubic matrix (4x4).
+%
+% Reorder
+% AD BD CD DD
+% AC BC CC DC
+% AB BB CB DB
+% AA BA CA DA
+% to
+% DA DB DC DD
+% CA CB CC CD
+% BA BB BC BD
+% AA AB AC AD
+\def\pgfplotspatchclass@bicubic@transpose{%
+ \pgfplotsutil@swap\P@AB\P@BA
+ \pgfplotsutil@swap\P@CA\P@AC
+ \pgfplotsutil@swap\P@DA\P@AD
+ \pgfplotsutil@swap\P@CB\P@BC
+ \pgfplotsutil@swap\P@BD\P@DB
+ \pgfplotsutil@swap\P@DC\P@CD
+}
+\endinput