summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-03-27 23:45:11 +0000
committerKarl Berry <karl@freefriends.org>2013-03-27 23:45:11 +0000
commitcfb1e943eb2782734fb13768cf8242e6a03aa904 (patch)
tree59470eac1319852a3b8726e3308923e0e1019bb5 /Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
parent02aa64ea1b6cd28f8217d06507a941c70d39dd9a (diff)
pgfplots
git-svn-id: svn://tug.org/texlive/trunk@29531 c570f23f-e606-0410-a88d-b1316a301751
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.tex461
1 files changed, 347 insertions, 114 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 933f48854d2..9e885f380ba 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
@@ -64,10 +64,8 @@
% 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,
+ get dimension=\def\pgfplotsretval{1},
+ supports global path=\def\pgfplotsretval{1},
new=\def\pgfplotspatchclass@qspline@no{A},
set next vertex={%
% EXPECTED ORDERING: first 2 corners, then 1 mid nodes
@@ -148,7 +146,7 @@
\pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\PC\endvertex}%
\endgroup
},
- triangulate class=line,
+ triangulate class=\def\pgfplotsretval{line},
triangulate={%
\let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
\def\pgfplotsplothandlermesh@patchclass{line}%
@@ -185,14 +183,12 @@
%
},%
get pdf shading type=0,
- get num vertices=3,
+ get num vertices=\def\pgfplotsretval{3},
}%
\pgfplotsdeclarepatchclass{cubic spline}{%
- allow matrix=0,
- uses view depth=0,
- get dimension=1,
- supports global path=1,
+ get dimension=\def\pgfplotsretval{1},
+ supports global path=\def\pgfplotsretval{1},
new=\def\pgfplotspatchclass@cspline@no{A},
set next vertex={%
% EXPECTED ORDERING: first 2 corners, then 1 mid nodes
@@ -256,7 +252,7 @@
{\pgfplotspatchclass@cspline@B}%
\pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}%
},
- triangulate class=line,
+ triangulate class=\def\pgfplotsretval{line},
triangulate={%
\let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
\def\pgfplotsplothandlermesh@patchclass{line}%
@@ -347,7 +343,7 @@
#1%
},
get pdf shading type=0,
- get num vertices=4,
+ get num vertices=\def\pgfplotsretval{4},
}%
\def\pgfplotspathcubicfrominterpolation#1#2#3#4{%
@@ -407,8 +403,7 @@
% A 3-point interpolatory patch which draws quadratic polynomial
% splines (functions f(x), x 1d).
\pgfplotsdeclarepatchclass{triangle quadr}{%
- allow matrix=0,
- uses view depth=1,
+ uses view depth=\def\pgfplotsretval{1},% used by the shader: we reorder corners.
new=\def\pgfplotspatchclass@qtri@no{A}\let\pgfplotspatchclass@qtrie@AB\relax,
set next vertex={%
% EXPECTED ORDERING: first 3 corners, then 3 mid nodes.
@@ -474,6 +469,11 @@
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@E\endvertex #1%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@F\endvertex #1%
},
+ foreach cdata vertex={%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@B\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@C\endvertex #1%
+ },
fill path={%
\begingroup
% Draw the patch boundary using three bezier curves.
@@ -811,7 +811,8 @@
%
},%
get pdf shading type=6,
- get num vertices=6,
+ get num vertices=\def\pgfplotsretval{6},
+ get num cdata vertices=\def\pgfplotsretval{3},
}%
@@ -902,7 +903,7 @@
% bilinear is the same as 'rectangle', but it uses a different shader.
\pgfplotsdeclarepatchclass{bilinear}{%
- allow matrix=1,
+ allow matrix=\def\pgfplotsretval{1},
new=\def\pgfplotspatchclass@rect@no{0},
set next vertex={%
\ifcase\pgfplotspatchclass@rect@no\relax
@@ -1004,29 +1005,12 @@
\pgfplotscoordmath{meta}{parsenumber}{0.25}%
\let\pgfplots@loc@scale=\pgfmathresult
%
- \pgf@xa=0pt
- \pgf@ya=0pt
- \pgf@yb=0pt
- \pgfplotscoordmath{meta}{zero}%
- \def\pgfplots@loc@accum@mean{%
- \advance\pgf@xa by\pgfplotspatchvertexx\relax
- \advance\pgf@ya by\pgfplotspatchvertexy\relax
- \pgfplotscoordmath{meta}{op}{add}{{\pgfmathresult}{\pgfplotspatchvertexmeta}}%
- \ifx\pgfplotspatchvertexdepth\pgfutil@empty
- \else
- \advance\pgf@yb by\pgfplotspatchvertexdepth pt\relax
- \fi
- }%
- \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex \pgfplots@loc@accum@mean%
- \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex \pgfplots@loc@accum@mean%
- \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex \pgfplots@loc@accum@mean%
- \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex \pgfplots@loc@accum@mean%
- %
- \divide\pgf@xa by4
- \divide\pgf@ya by4
- \divide\pgf@yb by4
- \pgfplotscoordmath{meta}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@scale}}%
- \edef\pgfplotspatchclass@rect@M{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else \pgf@sys@tonumber\pgf@yb\fi:}%
+ \pgfplotspatchvertexaccumstart
+ \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\endvertex\times{0.25}%
+ \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\endvertex\times{0.25}%
+ \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\endvertex\times{0.25}%
+ \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\endvertex\times{0.25}%
+ \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@M
%
\let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
\def\pgfplotsplothandlermesh@patchclass{triangle}%
@@ -1062,7 +1046,7 @@
serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
deserialize except vertices=,
get pdf shading type=6,
- get num vertices=4,
+ get num vertices=\def\pgfplotsretval{4},
}%
\pgfplotsdeclarepatchclass{rectangle}{%
@@ -1202,7 +1186,7 @@
serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
deserialize except vertices=,
get pdf shading type=4,
- get num vertices=\pgfkeysvalueof{/pgfplots/vertex count},
+ get num vertices=\def\pgfplotsretval{\pgfkeysvalueof{/pgfplots/vertex count}},
}%
\def\pgfplotspatchclass@poly@checkcount{%
\ifnum\pgfkeysvalueof{/pgfplots/vertex count}>0
@@ -1271,7 +1255,6 @@
% i*(1 - xi^2) (1 - eta^2)
% here, a,b,...,i are the 9 nodes.
\pgfplotsdeclarepatchclass{biquadratic}{%
- allow matrix=0,
new=\def\pgfplotspatchclass@biquad@no{A}\let\pgfplotspatchclass@biquade@AB\relax,
set next vertex={%
% defines \pgfplotspatchclass@biquad@A ... \pgfplotspatchclass@biquad@I (9 points)
@@ -1325,6 +1308,12 @@
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@H\endvertex #1%
\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@I\endvertex #1%
},
+ foreach cdata vertex={%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@B\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@C\endvertex #1%
+ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@D\endvertex #1%
+ },
fill path={%
\begingroup
% Visualize the patch boundary using four bezier curves.
@@ -1407,36 +1396,235 @@
%--------------------------------------------------
stream to shader={%
\begingroup
+ %
+ % An early version of this shader used Coons patch shadings
+ % (which provides coordinates only for the 9 boundary
+ % vertices, not for the inner vertices). That is a little bit
+ % simpler than what you see in the following lines of code: a
+ % transformation to a tensor bezier shading.
+ %
+ % What we need is to map the 3x3 data from lagrangrian
+ % (interpolation) representation to 4x4 cubic bezier - and
+ % handle the four INNER nodes correctly.
+ %
+ % The algorithm to convert from 1d curves with 3 point langrange to 4 point
+ % bezier is well-known and relatively simple. Fortunately, the
+ % extension to 3x3 -> 4x4 can be boiled down to a successive
+ % application of the 1d algorithm - applied to horizontal and
+ % vertical lines in the data matrizes.
+ %
+ % NOTE: the algorithm in the following lines results in
+ % EXACTLY THE SAME four cubic boundary curves as the approach
+ % in 'fill path'. The only difference is that it also does the
+ % right thing for the inner node.
+ %
+ % 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
\pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
{pgfplotspatchclass@biquad@}{\Pcur}{\Pnextseq}%
%
- \let\Pstartidx\Pcur%
- \pgfutil@namelet{Pstart}{pgfplotspatchclass@biquad@\Pcur}%
+ % STEP 2:
+ % 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).
%
- % create a tensor cubic bezier patch.
+ % This can be seen as conversion from the "linearized"
+ % numbering to matrix indexing - while respecting the "start
+ % point".
%
- % Again, the outer boundary involves a map from 3 point lagrange
- % representation to 4 point cubic bezier.
+ % INPUT:
%
- % The main complication arises to support the INNER node (\pgfplotspatchclass@biquad@I) .
- % We need the four inner bezier control points to get it
- % correctly.
+ % D G C
+ % H I F
+ % A E B
%
- % this here handles only the OUTER shaper. It is the same as
- % for 'fill path'.
- % See 'fill path' for docs.
+ \if A\Pcur
+ % Ah - the point "A" needs to be streamed as first.
+ %
+ % Well, this is simple: take the matrix as-is!
+ % simply copy 1:1
+ %
+ % i.e. convert
+ % D G C
+ % H I F
+ % A E B
+ %
+ % to
+ %
+ % AC BC CC
+ % AB BB CB
+ % AA BA CA
+ \let\P@AA=\pgfplotspatchclass@biquad@A
+ \let\P@BA=\pgfplotspatchclass@biquad@E
+ \let\P@CA=\pgfplotspatchclass@biquad@B
+ \let\P@AB=\pgfplotspatchclass@biquad@H
+ \let\P@BB=\pgfplotspatchclass@biquad@I
+ \let\P@CB=\pgfplotspatchclass@biquad@F
+ \let\P@AC=\pgfplotspatchclass@biquad@D
+ \let\P@BC=\pgfplotspatchclass@biquad@G
+ \let\P@CC=\pgfplotspatchclass@biquad@C
+ \fi
+ \if B\Pcur
+ % the "B" point needs to be streamed as first.
+ %
+ % i.e. reorder
+ % D G C
+ % H I F
+ % A E B
+ %
+ % to
+ % A H D AC BC CC
+ % E I G =: AB BB CB
+ % B F C AA BA CA
+ %
+ \let\P@AA=\pgfplotspatchclass@biquad@B
+ \let\P@BA=\pgfplotspatchclass@biquad@F
+ \let\P@CA=\pgfplotspatchclass@biquad@C
+ \let\P@AB=\pgfplotspatchclass@biquad@E
+ \let\P@BB=\pgfplotspatchclass@biquad@I
+ \let\P@CB=\pgfplotspatchclass@biquad@G
+ \let\P@AC=\pgfplotspatchclass@biquad@A
+ \let\P@BC=\pgfplotspatchclass@biquad@H
+ \let\P@CC=\pgfplotspatchclass@biquad@D
+ \fi
+ \if C\Pcur
+ % the "C" point needs to be streamed as first.
+ %
+ % i.e. reorder
+ % D G C
+ % H I F
+ % A E B
+ %
+ % to
+ % B E A AC BC CC
+ % F I H =: AB BB CB
+ % C G D AA BA CA
+ %
+ \let\P@AA=\pgfplotspatchclass@biquad@C
+ \let\P@BA=\pgfplotspatchclass@biquad@G
+ \let\P@CA=\pgfplotspatchclass@biquad@D
+ \let\P@AB=\pgfplotspatchclass@biquad@F
+ \let\P@BB=\pgfplotspatchclass@biquad@I
+ \let\P@CB=\pgfplotspatchclass@biquad@H
+ \let\P@AC=\pgfplotspatchclass@biquad@B
+ \let\P@BC=\pgfplotspatchclass@biquad@E
+ \let\P@CC=\pgfplotspatchclass@biquad@A
+ \fi
+ \if D\Pcur
+ % the "D" point needs to be streamed as first.
+ %
+ % i.e. reorder
+ % D G C
+ % H I F
+ % A E B
+ %
+ % to
+ % C F B AC BC CC
+ % G I E =: AB BB CB
+ % D H A AA BA CA
+ %
+ \let\P@AA=\pgfplotspatchclass@biquad@D
+ \let\P@BA=\pgfplotspatchclass@biquad@H
+ \let\P@CA=\pgfplotspatchclass@biquad@A
+ \let\P@AB=\pgfplotspatchclass@biquad@G
+ \let\P@BB=\pgfplotspatchclass@biquad@I
+ \let\P@CB=\pgfplotspatchclass@biquad@E
+ \let\P@AC=\pgfplotspatchclass@biquad@C
+ \let\P@BC=\pgfplotspatchclass@biquad@F
+ \let\P@CC=\pgfplotspatchclass@biquad@B
+ \fi
+ \ifx\Pnextseq\pgfutil@empty
+ \else
+ % reverse the ordering. This means to transpose the
+ % matrix:
+ \pgfplotspatchclass@biquad@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=quadratic spline' . We only need to apply it to all
+ % lines in U direction and afterwards to all lines in V
+ % direction.
%
- \pgfplotspatchclass@biquad@coonsedge
+ \def\pgfplotspatchvertexaddXY@expanded##1\times{%
+ \edef\pgfplots@loc@TMPa{##1}%
+ \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times
+ }%
%
- \pgfplotspatchclass@biquad@coonsedge
+ % this macro operates on \pgfplots@line{[ABC]} and defines
+ % \pgfplots@line{[ABCD]} (i.e. one dimension more!)
+ \def\pgfplots@apply@to@line{%
+ \pgfplotspatchvertexaccumstart
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-0.333333}%
+ \pgfplotspatchvertexfinish\pgfplots@controlpoint@A
+ %
+ \pgfplotspatchvertexaccumstart
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.333333}%
+ \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}%
+ \pgfplotspatchvertexfinish\pgfplots@controlpoint@B
+ %
+ % ... we output 4 points (cubic!).
+ % A= left endpoint (untouched)
+ % B= first control
+ % C= second control
+ % D= right endpoint (untouched, is formerly called 'C')
+ \edef\pgfplots@loc@TMPa{\pgfplots@line{C}}%
+ \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A
+ \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B
+ \expandafter\expandafter\expandafter\let\pgfplots@line{D}=\pgfplots@loc@TMPa
+ }%
%
- \pgfplotspatchclass@biquad@coonsedge
+ \def\pgfplots@line##1{\csname P@##1A\endcsname}%
+ \pgfplots@apply@to@line
%
- \pgfplotspatchclass@biquad@coonsedge
+ \def\pgfplots@line##1{\csname P@##1B\endcsname}%
+ \pgfplots@apply@to@line
%
- % FIXME:
- % \pgfplotspatchclass@biquad@innercontrolpoints
+ \def\pgfplots@line##1{\csname P@##1C\endcsname}%
+ \pgfplots@apply@to@line
+ %
+ % Now, we have a 3x4 matrix.
+ %
+ %
+ \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.
+ %
+ % in particular, we have a 4x4 matrix right now:
+ %
+ \pgfplotsplothandlermesh@shade@cubic@tensor
\endgroup
},%
triangulate={%
@@ -1749,10 +1937,22 @@
#1%
%
},%
- get pdf shading type=6,
- get num vertices=9,
+ get pdf shading type*={%
+ \if1\b@pgfplotsplothandlermesh@enable@fixed@biquadratic
+ \def\pgfplotsretval{7}%
+ \else
+ \def\pgfplotsretval{6}%
+ \fi
+ },%
+ get num vertices=\def\pgfplotsretval{9},
+ get num cdata vertices=\def\pgfplotsretval{4},
}%
+% set this to 0 to revert to an older implementation (which was buggy,
+% though)
+\def\b@pgfplotsplothandlermesh@enable@fixed@biquadratic{1}%
+
+
% see docs in 'biquadratic::stream to shader' for details.
% PRECONDITION: to be used inside of 'stream to shader'.
\def\pgfplotspatchclass@biquad@coonsedge{%
@@ -1881,7 +2081,6 @@
% Direct interface to coons patches (pdf shading type 6).
% See manual and/or pdf reference
\pgfplotsdeclarepatchclass{coons}{%
- allow matrix=0,
new=\def\pgfplotspatchclass@coons@no{A},
set next vertex={%
% defines \pgfplotspatchclass@coons@A ... \pgfplotspatchclass@coons@L (12 points)
@@ -1934,14 +2133,13 @@
serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
deserialize except vertices=,
get pdf shading type=6,
- get num vertices=12,
- get num cdata vertices=4,
+ get num vertices=\def\pgfplotsretval{12},
+ get num cdata vertices=\def\pgfplotsretval{4},
}%
% Direct interface to tensor product bezier patches (pdf shading type 7).
% See manual and/or pdf reference
\pgfplotsdeclarepatchclass{tensor bezier}{%
- allow matrix=0,
new=\def\pgfplotspatchclass@tensor@no{A},
set next vertex={%
% defines \pgfplotspatchclass@tensor@A ... \pgfplotspatchclass@tensor@P (16 points)
@@ -1998,8 +2196,8 @@
serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
deserialize except vertices=,
get pdf shading type=7,
- get num vertices=16,
- get num cdata vertices=4,
+ get num vertices=\def\pgfplotsretval{16},
+ get num cdata vertices=\def\pgfplotsretval{4},
}%
% A bicubic patch with 16 points.
@@ -2012,7 +2210,6 @@
% 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)
@@ -2125,22 +2322,22 @@
{\pgfplotspatchclass@bicubic@AA}
{\pgfplotspatchclass@bicubic@BA}
{\pgfplotspatchclass@bicubic@CA}
- {\pgfplotspatchclass@bicubic@DA}
+ {\pgfplotspatchclass@bicubic@DA}%
\pgfplotspathcubicfrominterpolation
{\pgfplotspatchclass@bicubic@DA}
{\pgfplotspatchclass@bicubic@DB}
{\pgfplotspatchclass@bicubic@DC}
- {\pgfplotspatchclass@bicubic@DD}
+ {\pgfplotspatchclass@bicubic@DD}%
\pgfplotspathcubicfrominterpolation
{\pgfplotspatchclass@bicubic@DD}
{\pgfplotspatchclass@bicubic@CD}
{\pgfplotspatchclass@bicubic@BD}
- {\pgfplotspatchclass@bicubic@AD}
+ {\pgfplotspatchclass@bicubic@AD}%
\pgfplotspathcubicfrominterpolation
{\pgfplotspatchclass@bicubic@AD}
{\pgfplotspatchclass@bicubic@AC}
{\pgfplotspatchclass@bicubic@AB}
- {\pgfplotspatchclass@bicubic@AA}
+ {\pgfplotspatchclass@bicubic@AA}%
\pgfpathclose
},
stream to shader={%
@@ -2368,46 +2565,7 @@
%
% 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}%
+ \pgfplotsplothandlermesh@shade@cubic@tensor
\endgroup
},
triangulate={%
@@ -2462,8 +2620,8 @@
serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
deserialize except vertices=,
get pdf shading type=7,
- get num vertices=16,
- get num cdata vertices=4,
+ get num vertices=\def\pgfplotsretval{16},
+ get num cdata vertices=\def\pgfplotsretval{4},
}%
% Transpose a bicubic matrix (4x4).
@@ -2486,4 +2644,79 @@
\pgfplotsutil@swap\P@BD\P@DB
\pgfplotsutil@swap\P@DC\P@CD
}
+
+% Transpose a bicubic matrix (4x4).
+%
+% Reorder
+% AC BC CC
+% AB BB CB
+% AA BA CA
+% to
+% CA CB CC
+% BA BB BC
+% AA AB AC
+\def\pgfplotspatchclass@biquad@transpose{%
+ \pgfplotsutil@swap\P@AB\P@BA
+ \pgfplotsutil@swap\P@CA\P@AC
+ \pgfplotsutil@swap\P@CB\P@BC
+}
+
+% Expects that a 4x4 matrix in tensor bezier representation where
+% A = left end point
+% B = first control point
+% C = second control point
+% D = right end point
+%
+% and the coordinates are stored in \csname P@[ABCD][ABCD]\endcsname
+%
+% Streaming starts with \P@AA and is applied rowwise.
+\def\pgfplotsplothandlermesh@shade@cubic@tensor{%
+ % 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}%
+ %
+ %
+ \pgfplotspatchclass{\pgfplotspatchclassname}{get pdf shading type}%
+ \if 7\pgfplotsretval
+ \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}%
+ \else
+ % assume 'get pdf shading type=6' - it does not contain the
+ % inner vertices.
+ \fi
+}
\endinput