Debian Codegraph @

texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex

raw
1 %--------------------------------------------
2 %
3 % Package pgfplots, library for higher order patch plots.
4 % It contains advanced patch plots like quadratic triangles,
5 % biquadratic quadrilaterals, coons patches and others.
6 % The basic implementation for patches supports already line, triangle
7 % and rectangle (=2 triangles) patches.
8 %
9 % Copyright 2007/2008/2009 by Christian Feuersänger.
10 %
11 % This program is free software: you can redistribute it and/or modify
12 % it under the terms of the GNU General Public License as published by
13 % the Free Software Foundation, either version 3 of the License, or
14 % (at your option) any later version.
15 %
16 % This program is distributed in the hope that it will be useful,
17 % but WITHOUT ANY WARRANTY; without even the implied warranty of
18 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 % GNU General Public License for more details.
20 %
21 % You should have received a copy of the GNU General Public License
22 % along with this program. If not, see <http://www.gnu.org/licenses/>.
23 %
24 %--------------------------------------------
25
26 % NOTES:
27 % In general, a Bezier spline C:[0,1] -> \R of order n fulfills
28 % C'(0) = n ( P_1 - P_0 ),
29 % C'(1) = n ( P_n - P_{n-1} ).
30 % For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know
31 % the derivatives at t=0 and t=1.
32 %
33 %
34 %
35 %--------------------------------------------------
36 % 4-point Lagrange interpolation on {0,1/3,2/3,1}:
37 % C(x) =
38 % a * (1/3 - x)/(1/3) * (2/3-x)/(2/3) * (1-x) +
39 % b * (0 - x)/(0 - 1/3) * (2/3-x)/(2/3-1/3) * (1-x)/(1-1/3) +
40 % c * (0 - x)/(0 - 2/3) * (1/3-x)/(1/3-2/3) * (1-x)/(1-2/3) +
41 % d * (0 - x)/(0 - 1) * (1/3-x)/(1/3-1) * (2/3-x) /(2/3-1)
42 %
43 %
44 % Derivative:
45 %
46 % (-9*c + 2*d + 72*c*x - 18*d*x - 81*c*x^2 + 27*d*x^2 +
47 % a*(-11 + 36*x - 27*x^2) + 9*b*(2 - 10*x + 9*x^2))/2
48 %
49 % bezier control points are
50 % P1 = (-5*a)/6 + 3*b - (3*c)/2 + d/3
51 % = -0.833333 a + 3. b - 1.5 c + 0.333333 d
52 %
53 % P2 = 0.333333 (0.5 (2. a - 9. b + 18. c - 11. d) + 3. d)
54 % = 0.333333 a - 1.5 b + 3. c - 0.833333 d
55 %--------------------------------------------------
56
57
58
59 % A quadratic spline in the ordering
60 %
61 % <left> <right> <middle>
62 %
63 % where <left> is the function value at the left end of the spline
64 % segmment, <right> the function value at the right end, and <middle>
65 % the function value in the middle of the spline segment.
66 \pgfplotsdeclarepatchclass{quadratic spline}{%
67 get dimension=\def\pgfplotsretval{1},
68 supports global path=\def\pgfplotsretval{1},
69 new=\def\pgfplotspatchclass@qspline@no{A},
70 set next vertex={%
71 % EXPECTED ORDERING: first 2 corners, then 1 mid nodes
72 % (interpolatory).
73 % defines \pgfplotspatchclass@qspline@A ... \pgfplotspatchclass@qspline@C (3 points)
74 \expandafter\edef\csname pgfplotspatchclass@qspline@\pgfplotspatchclass@qspline@no\endcsname{#1}%
75 \if C\pgfplotspatchclass@qspline@no
76 \def\pgfplotspatchclass@qspline@no{A}%
77 \pgfplotspatchready
78 \else
79 \expandafter\let\expandafter\pgfplotspatchclass@qspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@qspline@no\endcsname
80 \fi
81 },
82 if current point can be first last={%
83 \pgfplots@loc@tmptrue
84 \if A\pgfplotspatchclass@qspline@no
85 % Ah - the current point is the 'C' point, i.e. the
86 % control point (we have advanced the '@no' counter)
87 \pgfplots@loc@tmpfalse
88 \fi
89 \ifpgfplots@loc@tmp
90 #1\relax%
91 \else
92 #2\relax
93 \fi
94 },
95 sample in unit cube={%
96 \def\pgfplotspatchclassx{0}%
97 \def\pgfplotspatchclassy{0}%
98 #1%
99 \def\pgfplotspatchclassx{1}%
100 \def\pgfplotspatchclassy{0}%
101 #1%
102 \def\pgfplotspatchclassx{0.5}%
103 \def\pgfplotspatchclassy{0}%
104 #1%
105 \pgfplotspatchready
106 },%
107 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex,
108 foreach vertex={%
109 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex #1%
110 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@B\endvertex #1%
111 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@C\endvertex #1%
112 },
113 fill path={%
114 \begingroup
115 % Draw the patch boundary using a bezier curves.
116 %
117 % Since I have lagrange points to describe the patch (i.e.
118 % points the patch passes through), I have to convert the
119 % lagrange representation to bezier.
120 %
121 % Furthermore, I convert to *cubic* bezier since pdf only
122 % supports cubic curves.
123 %
124 % See the docs for 'biquadratic::fill path' for more details,
125 % in does the same.
126 \def\pgfplots@edge{%
127 \ifx\pgfplotspatchclass@qspline@A\PA
128 \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
129 \fi
130 \pgfpathcurveto {%
131 \pgfpointadd
132 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
133 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
134 }{%
135 \pgfpointadd
136 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
137 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
138 }{%
139 \expandafter\pgfplotspointpatchvertex\PC\endvertex
140 }%
141 }%
142 \let\PA=\pgfplotspatchclass@qspline@A
143 \let\PB=\pgfplotspatchclass@qspline@C
144 \let\PC=\pgfplotspatchclass@qspline@B
145 \pgfplots@edge
146 \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\PC\endvertex}%
147 \endgroup
148 },
149 triangulate class=\def\pgfplotsretval{line},
150 triangulate={%
151 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
152 \def\pgfplotsplothandlermesh@patchclass{line}%
153 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
154 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@A}%
155 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@C}%
156 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@C}%
157 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@B}%
158 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
159 },%
160 recursive refine@={%
161 \pgfplotspatchclass{\pgfplotspatchclassname}{new}%
162 \pgfplotspatchvertexaccumstart
163 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@A\times{0.375}%
164 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@B\times{-0.125}%
165 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@C\times{0.75}%
166 \pgfplotspatchvertexfinish\pgfplotspatchclass@qspline@AC
167 %
168 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@A}%
169 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@C}%
170 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@AC}%
171 #1%
172 %
173 \pgfplotspatchvertexaccumstart
174 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@A\times{-0.125}%
175 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@B\times{0.375}%
176 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qspline@C\times{0.75}%
177 \pgfplotspatchvertexfinish\pgfplotspatchclass@qspline@CB
178 %
179 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@C}%
180 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@B}%
181 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qspline@CB}%
182 #1%
183 %
184 },%
185 get pdf shading type=0,
186 get num vertices=\def\pgfplotsretval{3},
187 }%
188
189 \pgfplotsdeclarepatchclass{cubic spline}{%
190 get dimension=\def\pgfplotsretval{1},
191 supports global path=\def\pgfplotsretval{1},
192 new=\def\pgfplotspatchclass@cspline@no{A},
193 set next vertex={%
194 % EXPECTED ORDERING: first 2 corners, then 1 mid nodes
195 % (interpolatory).
196 % defines \pgfplotspatchclass@cspline@A ... \pgfplotspatchclass@cspline@D (4 points)
197 \expandafter\edef\csname pgfplotspatchclass@cspline@\pgfplotspatchclass@cspline@no\endcsname{#1}%
198 \if D\pgfplotspatchclass@cspline@no
199 \def\pgfplotspatchclass@cspline@no{A}%
200 \pgfplotspatchready
201 \else
202 \expandafter\let\expandafter\pgfplotspatchclass@cspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@cspline@no\endcsname
203 \fi
204 },
205 if current point can be first last={%
206 \pgfplots@loc@tmpfalse
207 \if B\pgfplotspatchclass@cspline@no
208 % Ah - the current point is the 'A' point (we have
209 % advanced the '@no' counter)
210 \pgfplots@loc@tmptrue
211 \fi
212 \if C\pgfplotspatchclass@cspline@no
213 % Ah - the current point is the 'B' point (we have
214 % advanced the '@no' counter)
215 \pgfplots@loc@tmptrue
216 \fi
217 \ifpgfplots@loc@tmp
218 #1\relax%
219 \else
220 #2\relax
221 \fi
222 },
223 sample in unit cube={%
224 \def\pgfplotspatchclassx{0}%
225 \def\pgfplotspatchclassy{0}%
226 #1%
227 \def\pgfplotspatchclassx{1}%
228 \def\pgfplotspatchclassy{0}%
229 #1%
230 \def\pgfplotspatchclassx{0.3333333}%
231 \def\pgfplotspatchclassy{0}%
232 #1%
233 \def\pgfplotspatchclassx{0.6666666}%
234 \def\pgfplotspatchclassy{0}%
235 #1%
236 \pgfplotspatchready
237 },%
238 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex,
239 foreach vertex={%
240 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex #1%
241 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@B\endvertex #1%
242 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@C\endvertex #1%
243 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@D\endvertex #1%
244 },
245 fill path={%
246 % Draw the patch boundary using a bezier curve.
247 \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}%
248 \pgfplotspathcubicfrominterpolation
249 {\pgfplotspatchclass@cspline@A}%
250 {\pgfplotspatchclass@cspline@C}%
251 {\pgfplotspatchclass@cspline@D}%
252 {\pgfplotspatchclass@cspline@B}%
253 \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}%
254 },
255 triangulate class=\def\pgfplotsretval{line},
256 triangulate={%
257 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
258 \def\pgfplotsplothandlermesh@patchclass{line}%
259 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
260 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@A}%
261 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@C}%
262 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@C}%
263 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@D}%
264 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@D}%
265 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@B}%
266 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
267 },%
268 recursive refine@={%
269 % The 4-point lagrangian interpolation formular is shown on
270 % the top of this page. What I do here is simply to evaluate
271 % C(i*1/9) for i =0,...,9:
272 % 0
273 % 0.493827 A +0.740741 C -0.296296 D +0.0617284 B
274 % 0.17284 A +1.03704 C -0.259259 D +0.0493827 B
275 % 1/3
276 % -0.0617284 A +0.740741 C +0.37037 D -0.0493827 B
277 % -0.0493827 A +0.37037 C +0.740741 D -0.0617284 B
278 % 2/3
279 % 0.0493827 A -0.259259 C +1.03704 D +0.17284 B
280 % 0.0617284 A -0.296296 C +0.740741 D +0.493827 B
281 % 1
282 \pgfplotspatchclass{\pgfplotspatchclassname}{new}%
283 \pgfplotspatchvertexaccumstart
284 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{0.493827}%
285 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{0.0617284}%
286 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{0.740741}%
287 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{-0.296296}%
288 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AA
289 %
290 \pgfplotspatchvertexaccumstart
291 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{0.17284}%
292 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{0.0493827}%
293 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{1.03704}%
294 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{-0.259259}%
295 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AB
296 %
297 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@A}%
298 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@C}%
299 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AA}%
300 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AB}%
301 #1%
302 %
303 %
304 \pgfplotspatchvertexaccumstart
305 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{-0.0617284}%
306 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{-0.0493827}%
307 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{0.740741}%
308 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{0.37037}%
309 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AA
310 %
311 \pgfplotspatchvertexaccumstart
312 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{-0.0493827}%
313 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{-0.0617284}%
314 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{0.37037}%
315 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{0.740741}%
316 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AB
317 %
318 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@C}%
319 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@D}%
320 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AA}%
321 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AB}%
322 #1%
323 %
324 %
325 \pgfplotspatchvertexaccumstart
326 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{0.0493827}%
327 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{0.17284}%
328 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{-0.259259}%
329 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{+1.03704}%
330 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AA
331 %
332 \pgfplotspatchvertexaccumstart
333 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@A\times{0.0617284}%
334 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@B\times{0.493827}%
335 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@C\times{-0.296296}%
336 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@cspline@D\times{0.740741}%
337 \pgfplotspatchvertexfinish\pgfplotspatchclass@cspline@AB
338 %
339 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@D}%
340 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@B}%
341 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AA}%
342 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@AB}%
343 #1%
344 },
345 get pdf shading type=0,
346 get num vertices=\def\pgfplotsretval{4},
347 }%
348
349 \def\pgfplotspathcubicfrominterpolation#1#2#3#4{%
350 % switch basis from lagrange to bezier (see formular on top of
351 % this file)
352 \pgfpathcurveto {%
353 \begingroup
354 \pgfplotspatchvertexaccumstart
355 \expandafter\pgfplotspatchvertexaddXY#1\times{-0.833333}%
356 \expandafter\pgfplotspatchvertexaddXY#2\times{3}%
357 \expandafter\pgfplotspatchvertexaddXY#3\times{-1.5}%
358 \expandafter\pgfplotspatchvertexaddXY#4\times{0.3333333}%
359 \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
360 \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
361 \endgroup
362 }{%
363 \begingroup
364 \pgfplotspatchvertexaccumstart
365 \expandafter\pgfplotspatchvertexaddXY#1\times{0.333333}%
366 \expandafter\pgfplotspatchvertexaddXY#2\times{-1.5}%
367 \expandafter\pgfplotspatchvertexaddXY#3\times{3}%
368 \expandafter\pgfplotspatchvertexaddXY#4\times{-0.833333}%
369 \pgfplotspatchvertexfinish\pgfplots@loc@TMPa
370 \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex
371 \endgroup
372 }{%
373 \expandafter\pgfplotspointpatchvertex#4\endvertex
374 }%
375 }%
376
377 % This is JUST a curveto operation! Nothing special.
378 \pgfplotsdeclarepatchclass{bezier spline}{%
379 get dimension=\def\pgfplotsretval{1},
380 supports global path=\def\pgfplotsretval{1},
381 new=\def\pgfplotspatchclass@cspline@no{A},
382 set next vertex={%
383 % EXPECTED ORDERING: first 2 corners, then 2 control points
384 % (NOT interpolatory).
385 % defines \pgfplotspatchclass@cspline@A ... \pgfplotspatchclass@cspline@D (4 points)
386 \expandafter\edef\csname pgfplotspatchclass@cspline@\pgfplotspatchclass@cspline@no\endcsname{#1}%
387 \if D\pgfplotspatchclass@cspline@no
388 \def\pgfplotspatchclass@cspline@no{A}%
389 \pgfplotspatchready
390 \else
391 \expandafter\let\expandafter\pgfplotspatchclass@cspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@cspline@no\endcsname
392 \fi
393 },
394 if current point can be first last={%
395 \pgfplots@loc@tmpfalse
396 \if B\pgfplotspatchclass@cspline@no
397 % Ah - the current point is the 'A' point (we have
398 % advanced the '@no' counter)
399 \pgfplots@loc@tmptrue
400 \fi
401 \if C\pgfplotspatchclass@cspline@no
402 % Ah - the current point is the 'B' point (we have
403 % advanced the '@no' counter)
404 \pgfplots@loc@tmptrue
405 \fi
406 \ifpgfplots@loc@tmp
407 #1\relax%
408 \else
409 #2\relax
410 \fi
411 },
412 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex,
413 foreach vertex={%
414 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex #1%
415 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@B\endvertex #1%
416 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@C\endvertex #1%
417 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@D\endvertex #1%
418 },
419 fill path={%
420 % Draw the patch boundary using a bezier curve.
421 \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}%
422 \pgfpathcurveto {
423 \expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@C\endvertex
424 }{
425 \expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@D\endvertex
426 }{%
427 \expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex
428 }%
429 \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}%
430 },
431 triangulate class=\def\pgfplotsretval{line},
432 triangulate={%
433 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
434 \def\pgfplotsplothandlermesh@patchclass{line}%
435 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
436 % XXX : very poor quality ...
437 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@A}%
438 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@cspline@B}%
439 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
440 },%
441 get pdf shading type=0,
442 get num vertices=\def\pgfplotsretval{4},
443 }%
444
445
446
447 % make a linearized sequence around the edge of the quad.triangle.
448 % note the ordering: first 3 corners, then 3 mid nodes:
449 \def\pgfplots@qtri@next@A{D}%
450 \def\pgfplots@qtri@next@B{E}%
451 \def\pgfplots@qtri@next@C{F}%
452 \def\pgfplots@qtri@next@D{B}%
453 \def\pgfplots@qtri@next@E{C}%
454 \def\pgfplots@qtri@next@F{A}%
455
456 \def\pgfplots@qtri@rnext@A{F}%
457 \def\pgfplots@qtri@rnext@B{D}%
458 \def\pgfplots@qtri@rnext@C{E}%
459 \def\pgfplots@qtri@rnext@D{A}%
460 \def\pgfplots@qtri@rnext@E{B}%
461 \def\pgfplots@qtri@rnext@F{C}%
462
463 \def\pgfplotspatchclass@qtri@recursiverefine@newnames{%
464 \let\pgfplotspatchclass@qtri@A@=\pgfplotspatchclass@qtri@A%
465 \let\pgfplotspatchclass@qtri@B@=\pgfplotspatchclass@qtri@B%
466 \let\pgfplotspatchclass@qtri@C@=\pgfplotspatchclass@qtri@C%
467 \let\pgfplotspatchclass@qtri@D@=\pgfplotspatchclass@qtri@D%
468 \let\pgfplotspatchclass@qtri@E@=\pgfplotspatchclass@qtri@E%
469 \let\pgfplotspatchclass@qtri@F@=\pgfplotspatchclass@qtri@F%
470 }%
471
472
473 % A 3-point interpolatory patch which draws quadratic polynomial
474 % splines (functions f(x), x 1d).
475 \pgfplotsdeclarepatchclass{triangle quadr}{%
476 uses view depth=\def\pgfplotsretval{1},% used by the shader: we reorder corners.
477 new=\def\pgfplotspatchclass@qtri@no{A}\let\pgfplotspatchclass@qtrie@AB\relax,
478 set next vertex={%
479 % EXPECTED ORDERING: first 3 corners, then 3 mid nodes.
480 % defines \pgfplotspatchclass@qtri@A ... \pgfplotspatchclass@qtri@F (6 points)
481 \expandafter\edef\csname pgfplotspatchclass@qtri@\pgfplotspatchclass@qtri@no\endcsname{#1}%
482 \if F\pgfplotspatchclass@qtri@no
483 \def\pgfplotspatchclass@qtri@no{A}%
484 \pgfplotspatchready
485 \else
486 \expandafter\let\expandafter\pgfplotspatchclass@qtri@no\csname pgfpptchindexnext@\pgfplotspatchclass@qtri@no\endcsname
487 \fi
488 },
489 sample in unit cube={%
490 \def\pgfplotspatchclassx{0}%
491 \def\pgfplotspatchclassy{0}%
492 #1%
493 \def\pgfplotspatchclassx{1}%
494 \def\pgfplotspatchclassy{0}%
495 #1%
496 \def\pgfplotspatchclassx{0}%
497 \def\pgfplotspatchclassy{1}%
498 #1%
499 %
500 \def\pgfplotspatchclassx{0.5}%
501 \def\pgfplotspatchclassy{0}%
502 #1%
503 \def\pgfplotspatchclassx{0.5}%
504 \def\pgfplotspatchclassy{0.5}%
505 #1%
506 \def\pgfplotspatchclassx{0}%
507 \def\pgfplotspatchclassy{0.5}%
508 #1%
509 \pgfplotspatchready
510 %
511 %
512 \def\pgfplotspatchclassx{0}%
513 \def\pgfplotspatchclassy{1}%
514 #1%
515 \def\pgfplotspatchclassx{1}%
516 \def\pgfplotspatchclassy{0}%
517 #1%
518 \def\pgfplotspatchclassx{1}%
519 \def\pgfplotspatchclassy{1}%
520 #1%
521 %
522 \def\pgfplotspatchclassx{0.5}%
523 \def\pgfplotspatchclassy{0.5}%
524 #1%
525 \def\pgfplotspatchclassx{1}%
526 \def\pgfplotspatchclassy{0.5}%
527 #1%
528 \def\pgfplotspatchclassx{0.5}%
529 \def\pgfplotspatchclassy{1}%
530 #1%
531 \pgfplotspatchready
532 },%
533 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex,
534 foreach vertex={%
535 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1%
536 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@B\endvertex #1%
537 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@C\endvertex #1%
538 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@D\endvertex #1%
539 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@E\endvertex #1%
540 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@F\endvertex #1%
541 },
542 foreach cdata vertex={%
543 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1%
544 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@B\endvertex #1%
545 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@C\endvertex #1%
546 },
547 fill path={%
548 \begingroup
549 % Draw the patch boundary using three bezier curves.
550 %
551 % Since I have lagrange points to describe the patch (i.e.
552 % points the patch passes through), I have to convert the
553 % lagrange representation to bezier.
554 %
555 % Furthermore, I convert to *cubic* bezier since pdf only
556 % supports cubic curves.
557 %
558 % See the docs for 'biquadratic::fill path' for more details,
559 % in does the same.
560 \def\pgfplots@edge{%
561 \ifx\pgfplotspatchclass@qtri@A\PA
562 \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
563 \fi
564 \pgfpathcurveto {%
565 \pgfpointadd
566 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
567 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
568 }{%
569 \pgfpointadd
570 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
571 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
572 }{%
573 \expandafter\pgfplotspointpatchvertex\PC\endvertex
574 }%
575 }%
576 \let\PA=\pgfplotspatchclass@qtri@A
577 \let\PB=\pgfplotspatchclass@qtri@D
578 \let\PC=\pgfplotspatchclass@qtri@B
579 \pgfplots@edge
580 %
581 \let\PA=\pgfplotspatchclass@qtri@B
582 \let\PB=\pgfplotspatchclass@qtri@E
583 \let\PC=\pgfplotspatchclass@qtri@C
584 \pgfplots@edge
585 %
586 \let\PA=\pgfplotspatchclass@qtri@C
587 \let\PB=\pgfplotspatchclass@qtri@F
588 \let\PC=\pgfplotspatchclass@qtri@A
589 \pgfplots@edge
590 \endgroup
591 \pgfpathclose
592 },
593 %--------------------------------------------------
594 % stroke path={%
595 % \ifx\pgfplotspatchclass@qtrie@AB\relax
596 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@A\endvertex}%
597 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@B\endvertex}%
598 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@C\endvertex}%
599 % \pgfpathclose
600 % \else
601 % \if1\pgfplotspatchclass@qtrie@AB
602 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@A\endvertex}%
603 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@B\endvertex}%
604 % \fi
605 % \if1\pgfplotspatchclass@qtrie@BC
606 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@B\endvertex}%
607 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@C\endvertex}%
608 % \fi
609 % \if1\pgfplotspatchclass@qtrie@CA
610 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@C\endvertex}%
611 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@qtri@A\endvertex}%
612 % \fi
613 % \fi
614 % },
615 %--------------------------------------------------
616 stream to shader={%
617 % create a degenerate coons patch:
618 \begingroup
619 %\message{EDGE INIT^^J}%
620 % this defines \Pcur and \Pnextseq :
621 \pgfplotspatchclass@tri@to@coonspatch@findshadingsequence@for@depth
622 %
623 \pgfutil@namelet{Pstart}{pgfplotspatchclass@qtri@\Pcur}%
624 %
625 % see the docus for "fill path" about these 1.33333 and -0.33333 factors
626 \def\pgfplots@coonsedge{%
627 %\message{EDGE \Pcur^^J}%
628 \expandafter\let\expandafter\PA\csname pgfplotspatchclass@qtri@\Pcur\endcsname
629 \edef\Pcur{\csname pgfplots@qtri@\Pnextseq next@\Pcur\endcsname}%
630 %\message{---> \Pcur^^J}%
631 \expandafter\let\expandafter\PB\csname pgfplotspatchclass@qtri@\Pcur\endcsname
632 \edef\Pcur{\csname pgfplots@qtri@\Pnextseq next@\Pcur\endcsname}%
633 %\message{---> \Pcur^^J}%
634 \expandafter\let\expandafter\PC\csname pgfplotspatchclass@qtri@\Pcur\endcsname
635 \ifx\PA\Pstart
636 \expandafter\pgfplotspatchvertex\PA\endvertex
637 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
638 \pgfplotsaxisvisphasetransformpointmeta
639 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
640 % degenerate: the "edge" \PA -- \PA collabses into one
641 % point.
642 % Per construction, the "edge" is the FOREGROUND.
643 %\message{STREAMING COLLAPSED EDGE AT START POINT^^J}%
644 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
645 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
646 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
647 \fi
648 \pgfplotslibrarysurfstreamcoord{%
649 \pgfpointadd
650 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
651 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
652 }{}%
653 \pgfplotslibrarysurfstreamcoord{%
654 \pgfpointadd
655 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
656 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
657 }{}%
658 \ifx\PC\Pstart
659 \else
660 \expandafter\pgfplotspatchvertex\PC\endvertex
661 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
662 \pgfplotsaxisvisphasetransformpointmeta
663 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
664 \fi
665 }%
666 \pgfplots@coonsedge
667 %
668 \pgfplots@coonsedge
669 %
670 \pgfplots@coonsedge
671 %
672 %
673 \endgroup
674 },%
675 triangulate={%
676 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
677 \def\pgfplotsplothandlermesh@patchclass{triangle}%
678 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
679 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
680 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}11%
681 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20%
682 % Ok. Now create 4 triangles. The ordering is not arbitrary
683 % (unless z buffer=sort is in effect). Let's assume that the
684 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
685 % this sequence here should have approximately the same depth
686 % ordering:
687 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F}%
688 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@A}%
689 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D}%
690 %
691 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}00%
692 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
693 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F}%
694 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D}%
695 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E}%
696 %
697 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
698 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}11%
699 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D}%
700 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@B}%
701 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E}%
702 %
703 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E}%
704 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@C}%
705 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F}%
706 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
707 },%
708 set edge visible={%
709 \ifcase#1
710 \edef\pgfplotspatchclass@qtrie@AB{#2}%
711 \or
712 \edef\pgfplotspatchclass@qtrie@BC{#2}%
713 \or
714 \edef\pgfplotspatchclass@qtrie@CA{#2}%
715 \fi
716 },
717 serialize except vertices={%
718 \ifx\pgfplotspatchclass@qtrie@AB\relax
719 \let\pgfplotsretval\pgfutil@empty%
720 \else
721 \edef\pgfplotsretval{%
722 \noexpand\def\noexpand\pgfplotspatchclass@qtrie@AB{\pgfplotspatchclass@qtrie@AB}%
723 \noexpand\def\noexpand\pgfplotspatchclass@qtrie@BC{\pgfplotspatchclass@qtrie@BC}%
724 \noexpand\def\noexpand\pgfplotspatchclass@qtrie@CA{\pgfplotspatchclass@qtrie@CA}%
725 }%
726 \fi
727 },%
728 deserialize except vertices=%
729 \let\pgfplotspatchclass@qtrie@AB\relax
730 #1,
731 recursive refine@={%
732 \pgfplotspatchclass@qtri@recursiverefine@newnames
733 %
734 \pgfplotspatchclass{\pgfplotspatchclassname}{new}%
735 %--------------------------------------------------
736 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}01%
737 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}11%
738 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}20%
739 %--------------------------------------------------
740 % The ordering is not arbitrary
741 % (unless z buffer=sort is in effect). Let's assume that the
742 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
743 % this sequence here should have approximately the same depth
744 % ordering:
745 %
746 % I used the reference triangle and shape functions as listed in
747 % http://www.colorado.edu/engineering/CAS/courses.d/IFEM.d/
748 \pgfplotspatchvertexaccumstart
749 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{0.375}%
750 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-0.125}%
751 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.75}%
752 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@AD
753 %
754 \pgfplotspatchvertexaccumstart
755 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-.125}%
756 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-.125}%
757 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.5}%
758 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.25}%
759 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.5}%
760 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@DF
761 %
762 \pgfplotspatchvertexaccumstart
763 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{0.375}%
764 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-0.125}%
765 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.75}%
766 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@AF
767 %
768 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F@}%
769 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@A@}%
770 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D@}%
771 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@AF}%
772 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@AD}%
773 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@DF}%
774 %
775 #1\pgfplotspatchclass@qtri@recursiverefine@newnames
776 %
777 %
778 %
779 \pgfplotspatchvertexaccumstart
780 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-.125}%
781 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-.125}%
782 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.5}%
783 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.25}%
784 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.5}%
785 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@DF
786 %
787 \pgfplotspatchvertexaccumstart
788 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-.125}%
789 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-.125}%
790 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.5}%
791 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.5}%
792 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.25}%
793 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@DE
794 %
795 \pgfplotspatchvertexaccumstart
796 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-.125}%
797 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-.125}%
798 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.25}%
799 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.5}%
800 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.5}%
801 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@EF
802 %
803 %
804 %--------------------------------------------------
805 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}00%
806 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}10%
807 %--------------------------------------------------
808 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F@}%
809 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D@}%
810 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E@}%
811 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@DF}%
812 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@DE}%
813 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@EF}%
814 % %
815 % %--------------------------------------------------
816 % % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}01%
817 % % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}11%
818 % %--------------------------------------------------
819 #1\pgfplotspatchclass@qtri@recursiverefine@newnames
820 %
821 %
822 \pgfplotspatchvertexaccumstart
823 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-0.125}%
824 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{0.375}%
825 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.75}%
826 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@DB
827 %
828 \pgfplotspatchvertexaccumstart
829 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-.125}%
830 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-.125}%
831 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.5}%
832 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.5}%
833 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.25}%
834 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@DE
835 %
836 %
837 \pgfplotspatchvertexaccumstart
838 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{0.375}%
839 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{-0.125}%
840 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.75}%
841 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@BE
842 %
843 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@D@}%
844 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@B@}%
845 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E@}%
846 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@DB}%
847 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@BE}%
848 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@DE}%
849 %
850 #1\pgfplotspatchclass@qtri@recursiverefine@newnames
851 %
852 \pgfplotspatchvertexaccumstart
853 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-0.125}%
854 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{0.375}%
855 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.75}%
856 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@EC
857 %
858 \pgfplotspatchvertexaccumstart
859 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-.125}%
860 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@B\times{-.125}%
861 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@D\times{0.25}%
862 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@E\times{0.5}%
863 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.5}%
864 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@EF
865 %
866 %
867 \pgfplotspatchvertexaccumstart
868 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@A\times{-0.125}%
869 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@C\times{0.375}%
870 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@qtri@F\times{0.75}%
871 \pgfplotspatchvertexfinish\pgfplotspatchclass@qtri@CF
872 %
873 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@E@}%
874 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@C@}%
875 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@F@}%
876 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@EC}%
877 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@CF}%
878 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@qtri@EF}%
879 %
880 #1%
881 %
882 },%
883 get pdf shading type=6,
884 get num vertices=\def\pgfplotsretval{6},
885 get num cdata vertices=\def\pgfplotsretval{3},
886 }%
887
888
889 % see
890 % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
891 % and its documentation.
892 %
893 % POSTCONDITION:
894 % \Pcur and \Pnextseq are defined.
895 \def\pgfplotspatchclass@tri@to@coonspatch@findshadingsequence@for@depth{%
896 \def\Pcur{A}%
897 \def\Pnextseq{}%
898 %
899 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex
900 \ifx\pgfplotspatchvertexdepth\pgfutil@empty
901 \else
902 % ah. We have view depth. Use it!
903 % The idea here is as follows.
904 % According to pdf standard, the COONS Shading is
905 % generated in the unit cube and then mapped to the
906 % shading. If u,v in [0,1] are the coordinates in the unit
907 % cube, pixel values for v=1 overwrite values for v=0.
908 % If pixel values have the same v, u=1 overwrites u=0.
909 % In other words, the loop is
910 % for v= 0 to Nv
911 % for u = 0 to Nu
912 % shade pixel for (u,v)
913 %
914 % BB-------CC <--v=1
915 % | |
916 % | |
917 % | |
918 % AA-------DD <--v=0
919 % | |
920 % u=0 u=1
921 %
922 %
923 % IDEA: re-order the sequence of vertices such that z
924 % buffering is obtained.
925 %
926 % APPROACH:
927 % the edge BB--CC collapses into just one point, namely
928 % the FOREGROUND point (i.e. it is drawn on top of
929 % everything else).
930 %
931 % The AA point is the second nearest foreground point.
932 % The sequence is chosen such that AA,BB is the first
933 % edge.
934 %
935 % What is to do (besides determining the vertices for AA
936 % and BB)? Well, make sure, that we can arrange them in
937 % the desired order. This involves a periodic "next vertex"
938 % algorithm which might either go forward
939 % or backward.
940 %
941 % sort according to depth.
942 % To do so, prepare macros \PA,\PB,\PC for use in
943 % \pgfplotsutilsortthree. FORMAT:
944 % \PA={<sortkey>pt <originalindex>}
945 \edef\PA{\pgfplotspatchvertexdepth pt A}%
946 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@B\endvertex
947 \edef\PB{\pgfplotspatchvertexdepth pt B}%
948 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@C\endvertex
949 \edef\PC{\pgfplotspatchvertexdepth pt C}%
950 \pgfplotsutilsortthree\PA\PB\PC
951 \def\toCHAR##1pt ##2{##2}% get original index
952 %
953 \edef\Pcur{\expandafter\toCHAR\PB}%%
954 \edef\Pnext{\csname pgfplots@qtri@next@\Pcur\endcsname}%
955 \edef\Pnext{\csname pgfplots@qtri@next@\Pnext\endcsname}%
956 \if\Pnext\PA
957 % ok, next(next(AA)) = BB.
958 % that means we have to advance forward.
959 \def\Pnextseq{}%
960 \else
961 % well, since we have a triangle, there only remains
962 % the backwards direction.
963 \def\Pnextseq{r}%
964 \fi
965 %\message{FOREGROUND VERTEX = \PA.^^J}%
966 %\message{SECOND NEAREST VERTEX = \PB.^^J}%
967 \fi
968 }
969 \def\pgfplotspatchclass@tri@to@coonspatch@findshadingsequence@for@depth@no@op{%
970 \def\Pcur{A}%
971 \def\Pnextseq{}%
972 }
973
974 % bilinear is the same as 'rectangle', but it uses a different shader.
975 \pgfplotsdeclarepatchclass{bilinear}{%
976 allow matrix=\def\pgfplotsretval{1},
977 new=\def\pgfplotspatchclass@rect@no{0},
978 set next vertex={%
979 \ifcase\pgfplotspatchclass@rect@no\relax
980 \edef\pgfplotspatchclass@rect@A{#1}%
981 \def\pgfplotspatchclass@rect@no{1}%
982 \or
983 \edef\pgfplotspatchclass@rect@B{#1}%
984 \def\pgfplotspatchclass@rect@no{2}%
985 \or
986 \edef\pgfplotspatchclass@rect@C{#1}%
987 \def\pgfplotspatchclass@rect@no{3}%
988 \or
989 \edef\pgfplotspatchclass@rect@D{#1}%
990 \def\pgfplotspatchclass@rect@no{0}%
991 \pgfplotspatchready%
992 \fi
993 },
994 sample in unit cube={%
995 \def\pgfplotspatchclassx{0}%
996 \def\pgfplotspatchclassy{0}%
997 #1%
998 \def\pgfplotspatchclassx{1}%
999 \def\pgfplotspatchclassy{0}%
1000 #1%
1001 \def\pgfplotspatchclassx{1}%
1002 \def\pgfplotspatchclassy{1}%
1003 #1%
1004 \def\pgfplotspatchclassx{0}%
1005 \def\pgfplotspatchclassy{1}%
1006 #1%
1007 \pgfplotspatchready
1008 },%
1009 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex,
1010 first vertex before z buffer=\pgfplotspatchclass@rect@first@before@z@buffer,
1011 foreach vertex={%
1012 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex #1%
1013 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex #1%
1014 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex #1%
1015 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex #1%
1016 },
1017 stream to shader={%
1018 % create a coons patch:
1019 \begingroup
1020 \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
1021 {pgfplotspatchclass@rect@}{\Pcur}{\Pnextseq}%
1022 %
1023 \pgfutil@namelet{Pstart}{pgfplotspatchclass@rect@\Pcur}%
1024 \def\pgfplots@coonsedge{%
1025 %\message{EDGE \Pcur^^J}%
1026 \expandafter\let\expandafter\PA\csname pgfplotspatchclass@rect@\Pcur\endcsname
1027 \edef\Pcur{\csname pgfplots@rect@\Pnextseq next@\Pcur\endcsname}%
1028 %\message{---> \Pcur^^J}%
1029 \expandafter\let\expandafter\PB\csname pgfplotspatchclass@rect@\Pcur\endcsname
1030 \ifx\PA\Pstart
1031 \expandafter\pgfplotspatchvertex\PA\endvertex
1032 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
1033 \pgfplotsaxisvisphasetransformpointmeta
1034 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
1035 \fi
1036 %
1037 % CONTROL POINT A+1/3(B-A)
1038 \pgfplotslibrarysurfstreamcoord{%
1039 \pgfpointadd
1040 {\pgfqpointscale{0.6666666}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
1041 {\pgfqpointscale{0.3333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
1042 }{}%
1043 % CONTROL POINT A+2/3(B-A)
1044 \pgfplotslibrarysurfstreamcoord{%
1045 \pgfpointadd
1046 {\pgfqpointscale{0.3333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
1047 {\pgfqpointscale{0.6666666}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
1048 }{}%
1049 \ifx\PB\Pstart
1050 \else
1051 \expandafter\pgfplotspatchvertex\PB\endvertex
1052 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
1053 \pgfplotsaxisvisphasetransformpointmeta
1054 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
1055 \fi
1056 }%
1057 %
1058 \pgfplots@coonsedge
1059 %
1060 \pgfplots@coonsedge
1061 %
1062 \pgfplots@coonsedge
1063 %
1064 \pgfplots@coonsedge
1065 %
1066 \endgroup
1067 },%
1068 fill path={%
1069 \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@A\endvertex}%
1070 \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@B\endvertex}%
1071 \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@C\endvertex}%
1072 \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@D\endvertex}%
1073 \pgfpathclose
1074 },
1075 triangulate={%
1076 \pgfplotscoordmath{meta}{parsenumber}{0.25}%
1077 \let\pgfplots@loc@scale=\pgfmathresult
1078 %
1079 \pgfplotspatchvertexaccumstart
1080 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\endvertex\times{0.25}%
1081 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\endvertex\times{0.25}%
1082 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\endvertex\times{0.25}%
1083 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\endvertex\times{0.25}%
1084 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@M
1085 %
1086 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
1087 \def\pgfplotsplothandlermesh@patchclass{triangle}%
1088 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
1089 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
1090 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
1091 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20%
1092 % Ok. Now create 4 triangles. The ordering is not arbitrary
1093 % (unless z buffer=sort is in effect). Let's assume that the
1094 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
1095 % this sequence here should have approximately the same depth
1096 % ordering:
1097 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@A}%
1098 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B}%
1099 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@M}%
1100 %
1101 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B}%
1102 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@C}%
1103 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@M}%
1104 %
1105 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}%
1106 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@A}%
1107 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@M}%
1108 %
1109 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@C}%
1110 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}%
1111 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@M}%
1112 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
1113 },%
1114 recursive refine@={%
1115 \pgfplotspatchclass@rect@refine@{#1}%
1116 },%
1117 serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
1118 deserialize except vertices=,
1119 get pdf shading type=6,
1120 get num vertices=\def\pgfplotsretval{4},
1121 }%
1122
1123 \pgfplotsdeclarepatchclass{rectangle}{%
1124 recursive refine@={%
1125 \pgfplotspatchclass@rect@refine@{#1}%
1126 },%
1127 }
1128 \def\pgfplotspatchclass@rect@refine@#1{%
1129 \pgfplotspatchclass@rect@recursiverefine@newnames
1130 %
1131 \pgfplotspatchclass{\pgfplotspatchclassname}{new}%
1132 %--------------------------------------------------
1133 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}01%
1134 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}11%
1135 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}20%
1136 %--------------------------------------------------
1137 % The ordering is not arbitrary
1138 % (unless z buffer=sort is in effect). Let's assume that the
1139 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
1140 % this sequence here should have approximately the same depth
1141 % ordering:
1142 %
1143 \pgfplotspatchvertexaccumstart
1144 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\times{0.25}%
1145 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\times{0.25}%
1146 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\times{0.25}%
1147 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\times{0.25}%
1148 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@M
1149 %
1150 \expandafter\pgfplotspatchclass@rect@refine@@\expandafter{\pgfplotspatchclass@rect@M}{#1}%
1151 }
1152 \def\pgfplotspatchclass@rect@refine@@#1#2{%
1153 \pgfplotspatchvertexaccumstart
1154 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\times{0.5}%
1155 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\times{0.5}%
1156 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@AB
1157 %
1158 \pgfplotspatchvertexaccumstart
1159 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\times{0.5}%
1160 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\times{0.5}%
1161 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@DA
1162 %
1163 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@A@}%
1164 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@AB}%
1165 \pgfplotsplothandlermesh@setnextvertex{#1}%
1166 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@DA}%
1167 #2\pgfplotspatchclass@rect@recursiverefine@newnames
1168 %
1169 %
1170 \pgfplotspatchvertexaccumstart
1171 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\times{0.5}%
1172 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\times{0.5}%
1173 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@AB
1174 %
1175 \pgfplotspatchvertexaccumstart
1176 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\times{0.5}%
1177 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\times{0.5}%
1178 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@BC
1179 %
1180 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@AB}%
1181 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B@}%
1182 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@BC}%
1183 \pgfplotsplothandlermesh@setnextvertex{#1}%
1184 #2\pgfplotspatchclass@rect@recursiverefine@newnames
1185 %
1186 %
1187 %
1188 \pgfplotspatchvertexaccumstart
1189 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\times{0.5}%
1190 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\times{0.5}%
1191 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@CD
1192 %
1193 \pgfplotspatchvertexaccumstart
1194 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\times{0.5}%
1195 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\times{0.5}%
1196 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@BC
1197 %
1198 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@BC}%
1199 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@C@}%
1200 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@CD}%
1201 \pgfplotsplothandlermesh@setnextvertex{#1}%
1202 #2\pgfplotspatchclass@rect@recursiverefine@newnames
1203 %
1204 %
1205 %
1206 \pgfplotspatchvertexaccumstart
1207 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\times{0.5}%
1208 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\times{0.5}%
1209 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@CD
1210 %
1211 \pgfplotspatchvertexaccumstart
1212 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\times{0.5}%
1213 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\times{0.5}%
1214 \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@DA
1215 %
1216 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@CD}%
1217 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D@}%
1218 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@DA}%
1219 \pgfplotsplothandlermesh@setnextvertex{#1}%
1220 #2\pgfplotspatchclass@rect@recursiverefine@newnames
1221 %
1222 }%
1223
1224 \def\pgfplotspatchclass@rect@recursiverefine@newnames{%
1225 \let\pgfplotspatchclass@rect@A@=\pgfplotspatchclass@rect@A%
1226 \let\pgfplotspatchclass@rect@B@=\pgfplotspatchclass@rect@B%
1227 \let\pgfplotspatchclass@rect@C@=\pgfplotspatchclass@rect@C%
1228 \let\pgfplotspatchclass@rect@D@=\pgfplotspatchclass@rect@D%
1229 }%
1230
1231
1232 % An arbitrary poligy specified in the sequence
1233 % D <-- C
1234 % | ^
1235 % v |
1236 % A --> B
1237 %
1238 \pgfkeyssetvalue{/pgfplots/vertex count}{0}%
1239 \pgfplotsdeclarepatchclass{polygon}{%
1240 new=\def\pgfplotspatchclass@poly@no{0},
1241 set next vertex={%
1242 \pgfplotspatchclass@poly@checkcount
1243 \expandafter\edef\csname pgfplotspatchclass@poly@\pgfplotspatchclass@poly@no\endcsname{#1}%
1244 \pgfplotsutil@advancestringcounter\pgfplotspatchclass@poly@no
1245 \ifnum\pgfplotspatchclass@poly@no=\pgfkeysvalueof{/pgfplots/vertex count} %
1246 \def\pgfplotspatchclass@poly@no{0}%
1247 \pgfplotspatchready%
1248 \fi
1249 },
1250 first vertex=\expandafter\expandafter\expandafter\pgfplotspatchvertex\csname pgfplotspatchclass@poly@0\endcsname\endvertex,
1251 foreach vertex={%
1252 \pgfplotspatchclass@poly@foreach@loop{0}{#1}%
1253 },
1254 init pdf shading={%
1255 \pgfplots@error{Sorry, patch type=polygon does not support shadings}%
1256 },
1257 serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
1258 deserialize except vertices=,
1259 get pdf shading type=4,
1260 get num vertices=\def\pgfplotsretval{\pgfkeysvalueof{/pgfplots/vertex count}},
1261 }%
1262 \def\pgfplotspatchclass@poly@checkcount{%
1263 \ifnum\pgfkeysvalueof{/pgfplots/vertex count}>0
1264 \else
1265 \pgfplots@error{Sorry, 'patch type=polygon' *requires* that 'vertex count=<num>' is set (note: it is allowed if multiple vertices have the same coordinates).}%
1266 \fi
1267 }%
1268 \long\def\pgfplotspatchclass@poly@foreach@loop#1#2{%
1269 \ifnum#1<\pgfkeysvalueof{/pgfplots/vertex count} %
1270 \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname pgfplotspatchclass@poly@#1\endcsname\endvertex #2%
1271 \begingroup
1272 \c@pgf@counta=#1 %
1273 \advance\c@pgf@counta by1 %
1274 \t@pgfplots@toka={#2}%
1275 \xdef\pgfplots@glob@TMPc{\noexpand\pgfplotspatchclass@poly@foreach@loop{\the\c@pgf@counta}{\the\t@pgfplots@toka}}%
1276 \endgroup
1277 \else
1278 \gdef\pgfplots@glob@TMPc{}%
1279 \fi
1280 \pgfplots@glob@TMPc
1281 }%
1282
1283 \def\pgfplots@biquad@next@A{E}
1284 \def\pgfplots@biquad@next@B{F}
1285 \def\pgfplots@biquad@next@C{G}
1286 \def\pgfplots@biquad@next@D{H}
1287 \def\pgfplots@biquad@next@E{B}
1288 \def\pgfplots@biquad@next@F{C}
1289 \def\pgfplots@biquad@next@G{D}
1290 \def\pgfplots@biquad@next@H{A}
1291
1292
1293 \def\pgfplots@biquad@rnext@A{H}
1294 \def\pgfplots@biquad@rnext@B{E}
1295 \def\pgfplots@biquad@rnext@C{F}
1296 \def\pgfplots@biquad@rnext@D{G}
1297 \def\pgfplots@biquad@rnext@E{A}
1298 \def\pgfplots@biquad@rnext@F{B}
1299 \def\pgfplots@biquad@rnext@G{C}
1300 \def\pgfplots@biquad@rnext@H{D}
1301
1302 \def\pgfplotspatchclass@biquad@recursiverefine@newnames{%
1303 \let\pgfplotspatchclass@biquad@A@=\pgfplotspatchclass@biquad@A%
1304 \let\pgfplotspatchclass@biquad@B@=\pgfplotspatchclass@biquad@B%
1305 \let\pgfplotspatchclass@biquad@C@=\pgfplotspatchclass@biquad@C%
1306 \let\pgfplotspatchclass@biquad@D@=\pgfplotspatchclass@biquad@D%
1307 \let\pgfplotspatchclass@biquad@E@=\pgfplotspatchclass@biquad@E%
1308 \let\pgfplotspatchclass@biquad@F@=\pgfplotspatchclass@biquad@F%
1309 \let\pgfplotspatchclass@biquad@G@=\pgfplotspatchclass@biquad@G%
1310 \let\pgfplotspatchclass@biquad@H@=\pgfplotspatchclass@biquad@H%
1311 \let\pgfplotspatchclass@biquad@I@=\pgfplotspatchclass@biquad@I%
1312 }%
1313
1314
1315 % mathematica shape functions parameterized in
1316 % (xi,eta) in [-1,1]x[-1,1]:
1317 %f[xi_, eta_] =
1318 % a*1/4*(1 - xi) (1 - eta) xi*eta +
1319 % b 1/4 (-1 - xi) (1 - eta) xi*eta +
1320 % c* 1/4 (-1 - xi) (-1 - eta) xi*eta +
1321 % d *1/4 (1 - xi) (-1 - eta) xi*eta +
1322 % e * 1/2 (xi^2 - 1) (1 - eta) eta +
1323 % f*1/2 (-1 - xi) (eta^2 - 1) xi +
1324 % g* -1/2 (1 - xi^2) (-1 - eta) eta +
1325 % h* -1/2 (1 - xi) (1 - eta^2) xi +
1326 % i*(1 - xi^2) (1 - eta^2)
1327 % here, a,b,...,i are the 9 nodes.
1328 \pgfplotsdeclarepatchclass{biquadratic}{%
1329 new=\def\pgfplotspatchclass@biquad@no{A}\let\pgfplotspatchclass@biquade@AB\relax,
1330 set next vertex={%
1331 % defines \pgfplotspatchclass@biquad@A ... \pgfplotspatchclass@biquad@I (9 points)
1332 \expandafter\edef\csname pgfplotspatchclass@biquad@\pgfplotspatchclass@biquad@no\endcsname{#1}%
1333 \if I\pgfplotspatchclass@biquad@no
1334 \def\pgfplotspatchclass@biquad@no{A}%
1335 \pgfplotspatchready
1336 \else
1337 \expandafter\let\expandafter\pgfplotspatchclass@biquad@no\csname pgfpptchindexnext@\pgfplotspatchclass@biquad@no\endcsname
1338 \fi
1339 },
1340 sample in unit cube={%
1341 \def\pgfplotspatchclassx{0}%
1342 \def\pgfplotspatchclassy{0}%
1343 #1%
1344 \def\pgfplotspatchclassx{1}%
1345 \def\pgfplotspatchclassy{0}%
1346 #1%
1347 \def\pgfplotspatchclassx{1}%
1348 \def\pgfplotspatchclassy{1}%
1349 #1%
1350 \def\pgfplotspatchclassx{0}%
1351 \def\pgfplotspatchclassy{1}%
1352 #1%
1353 \def\pgfplotspatchclassx{0.5}%
1354 \def\pgfplotspatchclassy{0}%
1355 #1%
1356 \def\pgfplotspatchclassx{1}%
1357 \def\pgfplotspatchclassy{0.5}%
1358 #1%
1359 \def\pgfplotspatchclassx{0.5}%
1360 \def\pgfplotspatchclassy{1}%
1361 #1%
1362 \def\pgfplotspatchclassx{0}%
1363 \def\pgfplotspatchclassy{0.5}%
1364 #1%
1365 \def\pgfplotspatchclassx{0.5}%
1366 \def\pgfplotspatchclassy{0.5}%
1367 #1%
1368 \pgfplotspatchready
1369 },%
1370 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex,
1371 foreach vertex={%
1372 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1%
1373 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@B\endvertex #1%
1374 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@C\endvertex #1%
1375 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@D\endvertex #1%
1376 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@E\endvertex #1%
1377 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@F\endvertex #1%
1378 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@G\endvertex #1%
1379 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@H\endvertex #1%
1380 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@I\endvertex #1%
1381 },
1382 foreach cdata vertex={%
1383 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1%
1384 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@B\endvertex #1%
1385 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@C\endvertex #1%
1386 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@D\endvertex #1%
1387 },
1388 fill path={%
1389 \begingroup
1390 % Visualize the patch boundary using four bezier curves.
1391 %
1392 % This involves a change from Lagrange to bezier
1393 % representation of the boundary curves.
1394 %
1395 % Furthermore, pdf supports only **cubic** bezier curves. What
1396 % I am doing here is
1397 % a) change of basis from 3-point lagrange ---> 3 point quadratic bezier
1398 % b) expression 3 point quadratic bezier ----> 4 point cubic bezier
1399 %
1400 % INPUT:
1401 % 3 langrange points (i.e. the patch passes through them)
1402 % \PA,\PB,\PC (start,middle,end)
1403 %
1404 % OUTPUT:
1405 % \PA,bezier control 1, bezier control 2, \PC.
1406 %
1407 \def\pgfplots@edge{%
1408 \ifx\pgfplotspatchclass@biquad@A\PA
1409 \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
1410 \fi
1411 \pgfpathcurveto {%
1412 \pgfpointadd
1413 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
1414 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
1415 }{%
1416 \pgfpointadd
1417 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
1418 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
1419 }{%
1420 \expandafter\pgfplotspointpatchvertex\PC\endvertex
1421 }%
1422 }%
1423 \let\PA=\pgfplotspatchclass@biquad@A
1424 \let\PB=\pgfplotspatchclass@biquad@E
1425 \let\PC=\pgfplotspatchclass@biquad@B
1426 \pgfplots@edge
1427 %
1428 \let\PA=\pgfplotspatchclass@biquad@B
1429 \let\PB=\pgfplotspatchclass@biquad@F
1430 \let\PC=\pgfplotspatchclass@biquad@C
1431 \pgfplots@edge
1432 %
1433 \let\PA=\pgfplotspatchclass@biquad@C
1434 \let\PB=\pgfplotspatchclass@biquad@G
1435 \let\PC=\pgfplotspatchclass@biquad@D
1436 \pgfplots@edge
1437 %
1438 \let\PA=\pgfplotspatchclass@biquad@D
1439 \let\PB=\pgfplotspatchclass@biquad@H
1440 \let\PC=\pgfplotspatchclass@biquad@A
1441 \pgfplots@edge
1442 \endgroup
1443 \pgfpathclose
1444 },
1445 %--------------------------------------------------
1446 % stroke path={%
1447 % \ifx\pgfplotspatchclass@biquade@AB\relax
1448 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@A\endvertex}%
1449 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@B\endvertex}%
1450 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@C\endvertex}%
1451 % \pgfpathclose
1452 % \else
1453 % \if1\pgfplotspatchclass@biquade@AB
1454 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@A\endvertex}%
1455 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@B\endvertex}%
1456 % \fi
1457 % \if1\pgfplotspatchclass@biquade@BC
1458 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@B\endvertex}%
1459 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@C\endvertex}%
1460 % \fi
1461 % \if1\pgfplotspatchclass@biquade@CA
1462 % \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@C\endvertex}%
1463 % \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@biquad@A\endvertex}%
1464 % \fi
1465 % \fi
1466 % },
1467 %--------------------------------------------------
1468 stream to shader={%
1469 \begingroup
1470 %
1471 % An early version of this shader used Coons patch shadings
1472 % (which provides coordinates only for the 9 boundary
1473 % vertices, not for the inner vertices). That is a little bit
1474 % simpler than what you see in the following lines of code: a
1475 % transformation to a tensor bezier shading.
1476 %
1477 % What we need is to map the 3x3 data from lagrangrian
1478 % (interpolation) representation to 4x4 cubic bezier - and
1479 % handle the four INNER nodes correctly.
1480 %
1481 % The algorithm to convert from 1d curves with 3 point langrange to 4 point
1482 % bezier is well-known and relatively simple. Fortunately, the
1483 % extension to 3x3 -> 4x4 can be boiled down to a successive
1484 % application of the 1d algorithm - applied to horizontal and
1485 % vertical lines in the data matrizes.
1486 %
1487 % NOTE: the algorithm in the following lines results in
1488 % EXACTLY THE SAME four cubic boundary curves as the approach
1489 % in 'fill path'. The only difference is that it also does the
1490 % right thing for the inner node.
1491 %
1492 % STEP 1: ensure that the patch's coordinates are streamed in
1493 % a sequence which is compatible with the DEPTH of the
1494 % corners.
1495 %
1496 % we use
1497 % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
1498 % which works for bilinear, biquadratic, and bicubic
1499 \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
1500 {pgfplotspatchclass@biquad@}{\Pcur}{\Pnextseq}%
1501 %
1502 % STEP 2:
1503 % now, translate the result into our matrix form.
1504 % This means to (a) identify the FIRST point which needs to be
1505 % streamed (it is stored in \Pcur as 'A', 'B', 'C', or 'D')
1506 % and (b) keep in mind that we have to take care of the
1507 % sequence in which points are streamed ("forward" means to
1508 % rotate the matrix elements and "backward" means to transpose
1509 % the "forward" result).
1510 %
1511 % This can be seen as conversion from the "linearized"
1512 % numbering to matrix indexing - while respecting the "start
1513 % point".
1514 %
1515 % INPUT:
1516 %
1517 % D G C
1518 % H I F
1519 % A E B
1520 %
1521 \if A\Pcur
1522 % Ah - the point "A" needs to be streamed as first.
1523 %
1524 % Well, this is simple: take the matrix as-is!
1525 % simply copy 1:1
1526 %
1527 % i.e. convert
1528 % D G C
1529 % H I F
1530 % A E B
1531 %
1532 % to
1533 %
1534 % AC BC CC
1535 % AB BB CB
1536 % AA BA CA
1537 \let\P@AA=\pgfplotspatchclass@biquad@A
1538 \let\P@BA=\pgfplotspatchclass@biquad@E
1539 \let\P@CA=\pgfplotspatchclass@biquad@B
1540 \let\P@AB=\pgfplotspatchclass@biquad@H
1541 \let\P@BB=\pgfplotspatchclass@biquad@I
1542 \let\P@CB=\pgfplotspatchclass@biquad@F
1543 \let\P@AC=\pgfplotspatchclass@biquad@D
1544 \let\P@BC=\pgfplotspatchclass@biquad@G
1545 \let\P@CC=\pgfplotspatchclass@biquad@C
1546 \fi
1547 \if B\Pcur
1548 % the "B" point needs to be streamed as first.
1549 %
1550 % i.e. reorder
1551 % D G C
1552 % H I F
1553 % A E B
1554 %
1555 % to
1556 % A H D AC BC CC
1557 % E I G =: AB BB CB
1558 % B F C AA BA CA
1559 %
1560 \let\P@AA=\pgfplotspatchclass@biquad@B
1561 \let\P@BA=\pgfplotspatchclass@biquad@F
1562 \let\P@CA=\pgfplotspatchclass@biquad@C
1563 \let\P@AB=\pgfplotspatchclass@biquad@E
1564 \let\P@BB=\pgfplotspatchclass@biquad@I
1565 \let\P@CB=\pgfplotspatchclass@biquad@G
1566 \let\P@AC=\pgfplotspatchclass@biquad@A
1567 \let\P@BC=\pgfplotspatchclass@biquad@H
1568 \let\P@CC=\pgfplotspatchclass@biquad@D
1569 \fi
1570 \if C\Pcur
1571 % the "C" point needs to be streamed as first.
1572 %
1573 % i.e. reorder
1574 % D G C
1575 % H I F
1576 % A E B
1577 %
1578 % to
1579 % B E A AC BC CC
1580 % F I H =: AB BB CB
1581 % C G D AA BA CA
1582 %
1583 \let\P@AA=\pgfplotspatchclass@biquad@C
1584 \let\P@BA=\pgfplotspatchclass@biquad@G
1585 \let\P@CA=\pgfplotspatchclass@biquad@D
1586 \let\P@AB=\pgfplotspatchclass@biquad@F
1587 \let\P@BB=\pgfplotspatchclass@biquad@I
1588 \let\P@CB=\pgfplotspatchclass@biquad@H
1589 \let\P@AC=\pgfplotspatchclass@biquad@B
1590 \let\P@BC=\pgfplotspatchclass@biquad@E
1591 \let\P@CC=\pgfplotspatchclass@biquad@A
1592 \fi
1593 \if D\Pcur
1594 % the "D" point needs to be streamed as first.
1595 %
1596 % i.e. reorder
1597 % D G C
1598 % H I F
1599 % A E B
1600 %
1601 % to
1602 % C F B AC BC CC
1603 % G I E =: AB BB CB
1604 % D H A AA BA CA
1605 %
1606 \let\P@AA=\pgfplotspatchclass@biquad@D
1607 \let\P@BA=\pgfplotspatchclass@biquad@H
1608 \let\P@CA=\pgfplotspatchclass@biquad@A
1609 \let\P@AB=\pgfplotspatchclass@biquad@G
1610 \let\P@BB=\pgfplotspatchclass@biquad@I
1611 \let\P@CB=\pgfplotspatchclass@biquad@E
1612 \let\P@AC=\pgfplotspatchclass@biquad@C
1613 \let\P@BC=\pgfplotspatchclass@biquad@F
1614 \let\P@CC=\pgfplotspatchclass@biquad@B
1615 \fi
1616 \ifx\Pnextseq\pgfutil@empty
1617 \else
1618 % reverse the ordering. This means to transpose the
1619 % matrix:
1620 \pgfplotspatchclass@biquad@transpose
1621 \fi
1622 %
1623 %
1624 % Step: convert to tensor bezier representation.
1625 %
1626 % Converting a 2d tensor product lagrangian interpoland to a
1627 % 2d tensor product bezier interpoland can be achieved by
1628 % means of 1d algorithms along LINES in the matrix.
1629 %
1630 % The underlying proof for this is related to the tensor
1631 % product form: the U and V coordinates are orthogonal to each
1632 % other, so we can redistribute all intermediate results. (I
1633 % do not have the real proof, so this hand-waving argument has
1634 % to be enough). I verified its results experimentally.
1635 %
1636 % Note that the underlying 1d operation is the same as for
1637 % 'patch type=quadratic spline' . We only need to apply it to all
1638 % lines in U direction and afterwards to all lines in V
1639 % direction.
1640 %
1641 \def\pgfplotspatchvertexaddXY@expanded##1\times{%
1642 \edef\pgfplots@loc@TMPa{##1}%
1643 \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times
1644 }%
1645 %
1646 % this macro operates on \pgfplots@line{[ABC]} and defines
1647 % \pgfplots@line{[ABCD]} (i.e. one dimension more!)
1648 \def\pgfplots@apply@to@line{%
1649 \pgfplotspatchvertexaccumstart
1650 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}%
1651 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-0.333333}%
1652 \pgfplotspatchvertexfinish\pgfplots@controlpoint@A
1653 %
1654 \pgfplotspatchvertexaccumstart
1655 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.333333}%
1656 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}%
1657 \pgfplotspatchvertexfinish\pgfplots@controlpoint@B
1658 %
1659 % ... we output 4 points (cubic!).
1660 % A= left endpoint (untouched)
1661 % B= first control
1662 % C= second control
1663 % D= right endpoint (untouched, is formerly called 'C')
1664 \edef\pgfplots@loc@TMPa{\pgfplots@line{C}}%
1665 \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A
1666 \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B
1667 \expandafter\expandafter\expandafter\let\pgfplots@line{D}=\pgfplots@loc@TMPa
1668 }%
1669 %
1670 \def\pgfplots@line##1{\csname P@##1A\endcsname}%
1671 \pgfplots@apply@to@line
1672 %
1673 \def\pgfplots@line##1{\csname P@##1B\endcsname}%
1674 \pgfplots@apply@to@line
1675 %
1676 \def\pgfplots@line##1{\csname P@##1C\endcsname}%
1677 \pgfplots@apply@to@line
1678 %
1679 % Now, we have a 3x4 matrix.
1680 %
1681 %
1682 \def\pgfplots@line##1{\csname P@A##1\endcsname}%
1683 \pgfplots@apply@to@line
1684 %
1685 \def\pgfplots@line##1{\csname P@B##1\endcsname}%
1686 \pgfplots@apply@to@line
1687 %
1688 \def\pgfplots@line##1{\csname P@C##1\endcsname}%
1689 \pgfplots@apply@to@line
1690 %
1691 \def\pgfplots@line##1{\csname P@D##1\endcsname}%
1692 \pgfplots@apply@to@line
1693 %
1694 % OK. The tensor product representation is READY.
1695 %
1696 % in particular, we have a 4x4 matrix right now:
1697 %
1698 \pgfplotsplothandlermesh@shade@cubic@tensor
1699 \endgroup
1700 },%
1701 triangulate={%
1702 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
1703 \def\pgfplotsplothandlermesh@patchclass{triangle}%
1704 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
1705 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
1706 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
1707 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20%
1708 % Ok. Now create 4 triangles. The ordering is not arbitrary
1709 % (unless z buffer=sort is in effect). Let's assume that the
1710 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
1711 % this sequence here should have approximately the same depth
1712 % ordering:
1713 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@A}%
1714 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@E}%
1715 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1716 %
1717 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@H}%
1718 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@A}%
1719 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1720 %
1721 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@E}%
1722 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@B}%
1723 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1724 %
1725 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@B}%
1726 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@F}%
1727 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1728 %
1729 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@D}%
1730 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@H}%
1731 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1732 %
1733 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@D}%
1734 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@G}%
1735 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1736 %
1737 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@G}%
1738 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@C}%
1739 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1740 %
1741 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@C}%
1742 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@F}%
1743 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I}%
1744 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
1745 },%
1746 %--------------------------------------------------
1747 % set edge visible={%
1748 % \ifcase#1
1749 % \edef\pgfplotspatchclass@biquade@AB{#2}%
1750 % \or
1751 % \edef\pgfplotspatchclass@biquade@BC{#2}%
1752 % \or
1753 % \edef\pgfplotspatchclass@biquade@CA{#2}%
1754 % \fi
1755 % },
1756 %--------------------------------------------------
1757 serialize except vertices={%
1758 \ifx\pgfplotspatchclass@biquade@AB\relax
1759 \let\pgfplotsretval\pgfutil@empty%
1760 \else
1761 \edef\pgfplotsretval{%
1762 \noexpand\def\noexpand\pgfplotspatchclass@biquade@AB{\pgfplotspatchclass@biquade@AB}%
1763 \noexpand\def\noexpand\pgfplotspatchclass@biquade@BC{\pgfplotspatchclass@biquade@BC}%
1764 \noexpand\def\noexpand\pgfplotspatchclass@biquade@CA{\pgfplotspatchclass@biquade@CA}%
1765 }%
1766 \fi
1767 },%
1768 deserialize except vertices=%
1769 \let\pgfplotspatchclass@biquade@AB\relax
1770 #1,
1771 recursive refine@={%
1772 \pgfplotspatchclass@biquad@recursiverefine@newnames
1773 %
1774 \pgfplotspatchclass{\pgfplotspatchclassname}{new}%
1775 %--------------------------------------------------
1776 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}01%
1777 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}11%
1778 % \pgfplotspatchclass{\pgfplotspatchclassname}{set edge visible}20%
1779 %--------------------------------------------------
1780 % The ordering is not arbitrary
1781 % (unless z buffer=sort is in effect). Let's assume that the
1782 % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then
1783 % this sequence here should have approximately the same depth
1784 % ordering:
1785 %
1786 % I used the reference triangle and shape functions as listed in
1787 % http://www.colorado.edu/engineering/CAS/courses.d/IFEM.d/,
1788 % see above for the definition of f[xi,eta]
1789 %
1790 % N[{f[-1/2, -1], f[0, -1/2], f[-1/2, 0], f[-1, -1/2], f[-1/2, -1/2]}]
1791 % {0.375` a - 0.125` b + 0.75` e,
1792 % 0.375` e - 0.125` g + 0.75` i,
1793 % -0.125` f + 0.375` h + 0.75` i,
1794 % 0.375` a - 0.125` d + 0.75` h,
1795 % 0.140625` a - 0.046875` b + 0.015625` c - 0.046875` d +
1796 % 0.28125` e - 0.09375` f - 0.09375` g + 0.28125` h +
1797 % 0.5625` i}
1798 %--------------------------------------------------
1799 \pgfplotspatchvertexaccumstart
1800 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{0.375}%
1801 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{-0.125}%
1802 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.75}%
1803 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@AE
1804 %
1805 \pgfplotspatchvertexaccumstart
1806 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.375}%
1807 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{-0.125}%
1808 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1809 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@EI
1810 %
1811 \pgfplotspatchvertexaccumstart
1812 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{-0.125}%
1813 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.375}%
1814 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1815 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@HI
1816 %
1817 \pgfplotspatchvertexaccumstart
1818 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{0.375}%
1819 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{-0.125}%
1820 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.75}%
1821 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@AH
1822 %
1823 \pgfplotspatchvertexaccumstart
1824 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{0.140625}%
1825 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{-0.046875}%
1826 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{0.015625}%
1827 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{-0.046875}%
1828 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.28125}%
1829 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{-0.09375}%
1830 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{-0.09375}%
1831 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.28125}%
1832 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.5625}%
1833 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@AEIH
1834 %
1835 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@A@}%
1836 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@E@}%
1837 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I@}%
1838 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@H@}%
1839 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@AE}%
1840 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@EI}%
1841 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@HI}%
1842 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@AH}%
1843 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@AEIH}%
1844 %
1845 #1\pgfplotspatchclass@biquad@recursiverefine@newnames
1846 %
1847 % N[{f[1/2, -1], f[1, -1/2], f[1/2, 0], f[1/2, -1/2]}]
1848 % {-0.125` a + 0.375` b + 0.75` e,
1849 % 0.375` b - 0.125` c + 0.75` f,
1850 % 0.375` f - 0.125` h + 0.75` i,
1851 % -0.046875 a + 0.140625 b - 0.046875 c + 0.015625 d + 0.28125 e + 0.28125 f - 0.09375 g - 0.09375 h + 0.5625 i}
1852 \pgfplotspatchvertexaccumstart
1853 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{-0.125}%
1854 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{0.375}%
1855 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.75}%
1856 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@EB
1857 %
1858 \pgfplotspatchvertexaccumstart
1859 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{0.375}%
1860 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{-0.125}%
1861 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.75}%
1862 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@BF
1863 %
1864 \pgfplotspatchvertexaccumstart
1865 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.375}%
1866 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{-0.125}%
1867 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1868 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@FI
1869 %
1870 %
1871 \pgfplotspatchvertexaccumstart
1872 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.375}%
1873 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{-0.125}%
1874 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1875 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@EI
1876 %
1877 \pgfplotspatchvertexaccumstart
1878 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{-0.046875}%
1879 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{0.140625}%
1880 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{-0.046875}%
1881 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{0.015625}%
1882 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{0.28125}%
1883 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.28125}%
1884 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{-0.09375}%
1885 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{-0.09375}%
1886 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.5625}%
1887 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@EBFI
1888 %
1889 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@E@}%
1890 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@B@}%
1891 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@F@}%
1892 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I@}%
1893 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@EB}%
1894 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@BF}%
1895 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@FI}%
1896 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@EI}%
1897 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@EBFI}%
1898 %
1899 #1\pgfplotspatchclass@biquad@recursiverefine@newnames
1900 %
1901 %
1902 % N[ {f[1, 1/2], f[1/2, 1], f[0, 1/2], f[1/2, 1/2]}]
1903 % {-0.125` b + 0.375` c + 0.75` f,
1904 % 0.375` c - 0.125` d + 0.75` g,
1905 % -0.125` e + 0.375` g + 0.75` i,
1906 % 0.015625` a - 0.046875` b + 0.140625` c - 0.046875` d - 0.09375` e + 0.28125` f + 0.28125` g - 0.09375` h + 0.5625` i}
1907 \pgfplotspatchvertexaccumstart
1908 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{-0.125}%
1909 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{0.375}%
1910 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.75}%
1911 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@FC
1912 %
1913 \pgfplotspatchvertexaccumstart
1914 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{0.375}%
1915 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{-0.125}%
1916 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.75}%
1917 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@CG
1918 %
1919 \pgfplotspatchvertexaccumstart
1920 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{-0.125}%
1921 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.375}%
1922 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1923 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@GI
1924 %
1925 \pgfplotspatchvertexaccumstart
1926 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.375}%
1927 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{-0.125}%
1928 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1929 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@FI
1930 %
1931 %
1932 %
1933 \pgfplotspatchvertexaccumstart
1934 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{0.015625}%
1935 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{-0.046875}%
1936 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{0.140625}%
1937 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{-0.046875}%
1938 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{-0.09375}%
1939 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{0.28125}%
1940 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.28125}%
1941 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{-0.09375}%
1942 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.5625}%
1943 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@IFCG
1944 %
1945 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I@}%
1946 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@F@}%
1947 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@C@}%
1948 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@G@}%
1949 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@FI}%
1950 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@FC}%
1951 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@CG}%
1952 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@GI}%
1953 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@IFCG}%
1954 %
1955 #1\pgfplotspatchclass@biquad@recursiverefine@newnames
1956 %
1957 %
1958 % N[{f[-1/2, 1], f[-1, 1/2], f[-1/2, 1/2]}]
1959 % {-0.125 c + 0.375 d + 0.75 g,
1960 % -0.125 a + 0.375 d + 0.75 h,
1961 % -0.046875 a + 0.015625 b - 0.046875 c + 0.140625 d - 0.09375 e - 0.09375 f + 0.28125 g + 0.28125 h + 0.5625 i}
1962 \pgfplotspatchvertexaccumstart
1963 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{-0.125}%
1964 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{0.375}%
1965 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.75}%
1966 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@GD
1967 %
1968 \pgfplotspatchvertexaccumstart
1969 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{-0.125}%
1970 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{0.375}%
1971 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.75}%
1972 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@DH
1973 %
1974 \pgfplotspatchvertexaccumstart
1975 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{-0.125}%
1976 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.375}%
1977 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1978 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@GI
1979 %
1980 \pgfplotspatchvertexaccumstart
1981 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{-0.125}%
1982 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.375}%
1983 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.75}%
1984 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@HI
1985 %
1986 \pgfplotspatchvertexaccumstart
1987 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@A\times{-0.046875}%
1988 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@B\times{0.015625}%
1989 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@C\times{-0.046875}%
1990 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@D\times{0.140625}%
1991 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@E\times{-0.09375}%
1992 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@F\times{-0.09375}%
1993 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@G\times{0.28125}%
1994 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@H\times{0.28125}%
1995 \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@biquad@I\times{0.5625}%
1996 \pgfplotspatchvertexfinish\pgfplotspatchclass@biquad@HIGD
1997 %
1998 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@H@}%
1999 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@I@}%
2000 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@G@}%
2001 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@D@}%
2002 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@HI}%
2003 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@GI}%
2004 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@GD}%
2005 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@DH}%
2006 \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@biquad@HIGD}%
2007 %
2008 #1%
2009 %
2010 },%
2011 get pdf shading type*={%
2012 \if1\b@pgfplotsplothandlermesh@enable@fixed@biquadratic
2013 \def\pgfplotsretval{7}%
2014 \else
2015 \def\pgfplotsretval{6}%
2016 \fi
2017 },%
2018 get num vertices=\def\pgfplotsretval{9},
2019 get num cdata vertices=\def\pgfplotsretval{4},
2020 }%
2021
2022 % set this to 0 to revert to an older implementation (which was buggy,
2023 % though)
2024 \def\b@pgfplotsplothandlermesh@enable@fixed@biquadratic{1}%
2025
2026
2027 % see docs in 'biquadratic::stream to shader' for details.
2028 % PRECONDITION: to be used inside of 'stream to shader'.
2029 \def\pgfplotspatchclass@biquad@coonsedge{%
2030 %\message{EDGE \Pcur^^J}%
2031 \expandafter\let\expandafter\PA\csname pgfplotspatchclass@biquad@\Pcur\endcsname
2032 \edef\Pcur{\csname pgfplots@biquad@\Pnextseq next@\Pcur\endcsname}%
2033 \expandafter\let\expandafter\PB\csname pgfplotspatchclass@biquad@\Pcur\endcsname
2034 %\message{---> \Pcur^^J}%
2035 \edef\Pcur{\csname pgfplots@biquad@\Pnextseq next@\Pcur\endcsname}%
2036 \expandafter\let\expandafter\PC\csname pgfplotspatchclass@biquad@\Pcur\endcsname
2037 %\message{---> \Pcur^^J}%
2038 \ifx\PA\Pstart
2039 \expandafter\pgfplotspatchvertex\PA\endvertex
2040 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2041 \pgfplotsaxisvisphasetransformpointmeta
2042 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2043 \fi
2044 \pgfplotslibrarysurfstreamcoord{%
2045 \pgfpointadd
2046 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
2047 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
2048 }{}%
2049 \pgfplotslibrarysurfstreamcoord{%
2050 \pgfpointadd
2051 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
2052 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
2053 }{}%
2054 \ifx\PC\Pstart
2055 \else
2056 \expandafter\pgfplotspatchvertex\PC\endvertex
2057 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2058 \pgfplotsaxisvisphasetransformpointmeta
2059 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2060 \fi
2061 }%
2062 \def\pgfplotspatchclass@biquad@innercontrolpoints{%
2063 \begingroup
2064 %
2065 % This here computes the FOUR INNER CONTROL POINTS of a tensor
2066 % cubic bezier patch (Shading Type 7).
2067 %
2068 %
2069 % the following point coordinates have been acquired from
2070 % biquadratic::recursive refine. See above for documentation.
2071 \pgfplotspatchvertexaccumstart
2072 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@A\times{0.375}%
2073 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@B\times{-0.125}%
2074 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@E\times{0.75}%
2075 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@AE
2076 %
2077 %
2078 \pgfplotspatchvertexaccumstart
2079 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@F\times{-0.125}%
2080 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@H\times{0.375}%
2081 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@I\times{0.75}%
2082 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@HI
2083 %
2084 \pgfplotspatchvertexaccumstart
2085 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@A\times{-0.125}%
2086 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@B\times{0.375}%
2087 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@E\times{0.75}%
2088 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@EB
2089 %
2090 \pgfplotspatchvertexaccumstart
2091 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@F\times{0.375}%
2092 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@H\times{-0.125}%
2093 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@I\times{0.75}%
2094 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@FI
2095 %
2096 \pgfplotspatchvertexaccumstart
2097 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@C\times{0.375}%
2098 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@D\times{-0.125}%
2099 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@G\times{0.75}%
2100 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@CG
2101 %
2102 \pgfplotspatchvertexaccumstart
2103 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@C\times{-0.125}%
2104 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@D\times{0.375}%
2105 \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@biquad@G\times{0.75}%
2106 \pgfplotspatchvertexfinishXY\pgfplotspatchclass@biquad@GD
2107 %
2108 %
2109 \let\PA=\pgfplotspatchclass@biquad@AE
2110 \let\PB=\pgfplotspatchclass@biquad@HI
2111 \let\PC=\pgfplotspatchclass@biquad@GD
2112 \pgfplotspatchclass@biquad@innercontrolpoints@PREPARE\pgfplotspatchclass@biquad@@A\pgfplotspatchclass@biquad@@D
2113 %
2114 \let\PA=\pgfplotspatchclass@biquad@EB
2115 \let\PB=\pgfplotspatchclass@biquad@FI
2116 \let\PC=\pgfplotspatchclass@biquad@CG
2117 \pgfplotspatchclass@biquad@innercontrolpoints@PREPARE\pgfplotspatchclass@biquad@@B\pgfplotspatchclass@biquad@@C
2118 %
2119 %
2120 \let\Pcur=\Pstartidx
2121 \pgfplotslibrarysurfstreamcoord{\csname pgfplotspatchclass@biquad@@\Pcur\endcsname}{}%
2122 %
2123 \edef\Pcur{\csname pgfplots@rect@\Pnextseq next@\Pcur\endcsname}%
2124 \pgfplotslibrarysurfstreamcoord{\csname pgfplotspatchclass@biquad@@\Pcur\endcsname}{}%
2125 %
2126 \edef\Pcur{\csname pgfplots@rect@\Pnextseq next@\Pcur\endcsname}%
2127 \pgfplotslibrarysurfstreamcoord{\csname pgfplotspatchclass@biquad@@\Pcur\endcsname}{}%
2128 %
2129 \edef\Pcur{\csname pgfplots@rect@\Pnextseq next@\Pcur\endcsname}%
2130 \pgfplotslibrarysurfstreamcoord{\csname pgfplotspatchclass@biquad@@\Pcur\endcsname}{}%
2131 \endgroup
2132 }%
2133 \def\pgfplotspatchclass@biquad@innercontrolpoints@PREPARE#1#2{%
2134 \pgfpointadd
2135 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
2136 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}}%
2137 \edef#1{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
2138 %
2139 \pgfpointadd
2140 {\pgfqpointscale{1.333333}{\expandafter\pgfplotspointpatchvertex\PB\endvertex}}%
2141 {\pgfqpointscale{-0.333333}{\expandafter\pgfplotspointpatchvertex\PA\endvertex}}%
2142 \edef#2{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
2143 %
2144 \pgfpathcircle{\expandafter\pgfplotspointpatchvertex\PA\endvertex}{1pt}\pgfusepath{fill}%
2145 \pgfpathcircle{\expandafter\pgfplotspointpatchvertex\PB\endvertex}{1pt}\pgfusepath{fill}%
2146 \pgfpathcircle{\expandafter\pgfplotspointpatchvertex\PC\endvertex}{1pt}\pgfusepath{fill}%
2147 \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}%
2148 \pgfpathcurveto{#1}{#2}{\expandafter\pgfplotspointpatchvertex\PC\endvertex}%
2149 \pgfusepath{stroke}%
2150 }
2151
2152 % Direct interface to coons patches (pdf shading type 6).
2153 % See manual and/or pdf reference
2154 \pgfplotsdeclarepatchclass{coons}{%
2155 new=\def\pgfplotspatchclass@coons@no{A},
2156 set next vertex={%
2157 % defines \pgfplotspatchclass@coons@A ... \pgfplotspatchclass@coons@L (12 points)
2158 \expandafter\edef\csname pgfplotspatchclass@coons@\pgfplotspatchclass@coons@no\endcsname{#1}%
2159 \if L\pgfplotspatchclass@coons@no
2160 \def\pgfplotspatchclass@coons@no{A}%
2161 \pgfplotspatchready
2162 \else
2163 \expandafter\let\expandafter\pgfplotspatchclass@coons@no\csname pgfpptchindexnext@\pgfplotspatchclass@coons@no\endcsname
2164 \fi
2165 },
2166 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@A\endvertex,
2167 foreach vertex={%
2168 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@A\endvertex #1%
2169 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@B\endvertex #1%
2170 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@C\endvertex #1%
2171 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@D\endvertex #1%
2172 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@E\endvertex #1%
2173 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@F\endvertex #1%
2174 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@G\endvertex #1%
2175 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@H\endvertex #1%
2176 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@I\endvertex #1%
2177 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@J\endvertex #1%
2178 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@K\endvertex #1%
2179 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@L\endvertex #1%
2180 },
2181 foreach cdata vertex={%
2182 % 0, 3, 6, 9
2183 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@A\endvertex #1%
2184 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@D\endvertex #1%
2185 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@G\endvertex #1%
2186 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@coons@J\endvertex #1%
2187 },
2188 fill path={%
2189 \pgfpathmoveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@A\endvertex}%
2190 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@B\endvertex}%
2191 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@C\endvertex}%
2192 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@D\endvertex}%
2193 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@E\endvertex}%
2194 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@F\endvertex}%
2195 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@G\endvertex}%
2196 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@H\endvertex}%
2197 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@I\endvertex}%
2198 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@J\endvertex}%
2199 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@K\endvertex}%
2200 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@L\endvertex}%
2201 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@coons@A\endvertex}%
2202 \pgfpathclose
2203 },
2204 serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
2205 deserialize except vertices=,
2206 get pdf shading type=6,
2207 get num vertices=\def\pgfplotsretval{12},
2208 get num cdata vertices=\def\pgfplotsretval{4},
2209 }%
2210
2211 % Direct interface to tensor product bezier patches (pdf shading type 7).
2212 % See manual and/or pdf reference
2213 \pgfplotsdeclarepatchclass{tensor bezier}{%
2214 new=\def\pgfplotspatchclass@tensor@no{A},
2215 set next vertex={%
2216 % defines \pgfplotspatchclass@tensor@A ... \pgfplotspatchclass@tensor@P (16 points)
2217 \expandafter\edef\csname pgfplotspatchclass@tensor@\pgfplotspatchclass@tensor@no\endcsname{#1}%
2218 \if P\pgfplotspatchclass@tensor@no
2219 \def\pgfplotspatchclass@tensor@no{A}%
2220 \pgfplotspatchready
2221 \else
2222 \expandafter\let\expandafter\pgfplotspatchclass@tensor@no\csname pgfpptchindexnext@\pgfplotspatchclass@tensor@no\endcsname
2223 \fi
2224 },
2225 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@A\endvertex,
2226 foreach vertex={%
2227 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@A\endvertex #1%
2228 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@B\endvertex #1%
2229 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@C\endvertex #1%
2230 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@D\endvertex #1%
2231 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@E\endvertex #1%
2232 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@F\endvertex #1%
2233 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@G\endvertex #1%
2234 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@H\endvertex #1%
2235 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@I\endvertex #1%
2236 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@J\endvertex #1%
2237 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@K\endvertex #1%
2238 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@L\endvertex #1%
2239 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@M\endvertex #1%
2240 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@N\endvertex #1%
2241 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@O\endvertex #1%
2242 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@P\endvertex #1%
2243 },
2244 foreach cdata vertex={%
2245 % 0, 3, 6, 9
2246 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@A\endvertex #1%
2247 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@D\endvertex #1%
2248 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@G\endvertex #1%
2249 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tensor@J\endvertex #1%
2250 },
2251 fill path={%
2252 \pgfpathmoveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@A\endvertex}%
2253 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@B\endvertex}%
2254 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@C\endvertex}%
2255 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@D\endvertex}%
2256 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@E\endvertex}%
2257 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@F\endvertex}%
2258 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@G\endvertex}%
2259 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@H\endvertex}%
2260 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@I\endvertex}%
2261 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@J\endvertex}%
2262 \pgfpathcurveto {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@K\endvertex}%
2263 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@L\endvertex}%
2264 {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tensor@A\endvertex}%
2265 \pgfpathclose
2266 },
2267 serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
2268 deserialize except vertices=,
2269 get pdf shading type=7,
2270 get num vertices=\def\pgfplotsretval{16},
2271 get num cdata vertices=\def\pgfplotsretval{4},
2272 }%
2273
2274 % A bicubic patch with 16 points.
2275 %
2276 % It expects points in the order (i.e. in matrix ordering, row-wise):
2277 %
2278 % AD BD CD DD
2279 % AC BC CC DC
2280 % AB BB CB DB
2281 % AA BA CA DA
2282 %
2283 \pgfplotsdeclarepatchclass{bicubic}{%
2284 new=\def\pgfplotspatchclass@bicubic@row{A}\def\pgfplotspatchclass@bicubic@col{A},
2285 set next vertex={%
2286 % defines \pgfplotspatchclass@bicubic@AA ... \pgfplotspatchclass@bicubic@DD (16 points)
2287 \expandafter\edef\csname pgfplotspatchclass@bicubic@\pgfplotspatchclass@bicubic@row\pgfplotspatchclass@bicubic@col\endcsname{#1}%
2288 \if D\pgfplotspatchclass@bicubic@row
2289 \def\pgfplotspatchclass@bicubic@row{A}%
2290 \if D\pgfplotspatchclass@bicubic@col
2291 \def\pgfplotspatchclass@bicubic@col{A}%
2292 \pgfplotspatchready
2293 \else
2294 \expandafter\let\expandafter\pgfplotspatchclass@bicubic@col\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@col\endcsname
2295 \fi
2296 \else
2297 \expandafter\let\expandafter\pgfplotspatchclass@bicubic@row\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@row\endcsname
2298 \fi
2299 },
2300 sample in unit cube={%
2301 \def\pgfplotspatchclassx{0}%
2302 \def\pgfplotspatchclassy{0}%
2303 #1%
2304 \def\pgfplotspatchclassx{0.333333333}%
2305 \def\pgfplotspatchclassy{0}%
2306 #1%
2307 \def\pgfplotspatchclassx{0.666666666}%
2308 \def\pgfplotspatchclassy{0}%
2309 #1%
2310 \def\pgfplotspatchclassx{1}%
2311 \def\pgfplotspatchclassy{0}%
2312 #1%
2313 %
2314 %
2315 \def\pgfplotspatchclassx{0}%
2316 \def\pgfplotspatchclassy{0.333333333}%
2317 #1%
2318 \def\pgfplotspatchclassx{0.333333333}%
2319 \def\pgfplotspatchclassy{0.333333333}%
2320 #1%
2321 \def\pgfplotspatchclassx{0.666666666}%
2322 \def\pgfplotspatchclassy{0.333333333}%
2323 #1%
2324 \def\pgfplotspatchclassx{1}%
2325 \def\pgfplotspatchclassy{0.333333333}%
2326 #1%
2327 %
2328 %
2329 \def\pgfplotspatchclassx{0}%
2330 \def\pgfplotspatchclassy{0.666666666}%
2331 #1%
2332 \def\pgfplotspatchclassx{0.333333333}%
2333 \def\pgfplotspatchclassy{0.666666666}%
2334 #1%
2335 \def\pgfplotspatchclassx{0.666666666}%
2336 \def\pgfplotspatchclassy{0.666666666}%
2337 #1%
2338 \def\pgfplotspatchclassx{1}%
2339 \def\pgfplotspatchclassy{0.666666666}%
2340 #1%
2341 %
2342 %
2343 \def\pgfplotspatchclassx{0}%
2344 \def\pgfplotspatchclassy{1}%
2345 #1%
2346 \def\pgfplotspatchclassx{0.333333333}%
2347 \def\pgfplotspatchclassy{1}%
2348 #1%
2349 \def\pgfplotspatchclassx{0.666666666}%
2350 \def\pgfplotspatchclassy{1}%
2351 #1%
2352 \def\pgfplotspatchclassx{1}%
2353 \def\pgfplotspatchclassy{1}%
2354 #1%
2355 %
2356 %
2357 %
2358 \pgfplotspatchready
2359 },%
2360 first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex,
2361 foreach vertex={%
2362 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1%
2363 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BA\endvertex #1%
2364 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CA\endvertex #1%
2365 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1%
2366 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AB\endvertex #1%
2367 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BB\endvertex #1%
2368 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CB\endvertex #1%
2369 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DB\endvertex #1%
2370 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AC\endvertex #1%
2371 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BC\endvertex #1%
2372 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CC\endvertex #1%
2373 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DC\endvertex #1%
2374 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1%
2375 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BD\endvertex #1%
2376 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CD\endvertex #1%
2377 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1%
2378 },
2379 foreach cdata vertex={%
2380 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1%
2381 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1%
2382 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1%
2383 \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1%
2384 },
2385 fill path={%
2386 % Visualize the patch boundary using four bezier curves.
2387 %
2388 % This involves a change from Lagrange to bezier
2389 % representation of the boundary curves.
2390 %
2391 \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@bicubic@AA\endvertex}%
2392 \pgfplotspathcubicfrominterpolation
2393 {\pgfplotspatchclass@bicubic@AA}
2394 {\pgfplotspatchclass@bicubic@BA}
2395 {\pgfplotspatchclass@bicubic@CA}
2396 {\pgfplotspatchclass@bicubic@DA}%
2397 \pgfplotspathcubicfrominterpolation
2398 {\pgfplotspatchclass@bicubic@DA}
2399 {\pgfplotspatchclass@bicubic@DB}
2400 {\pgfplotspatchclass@bicubic@DC}
2401 {\pgfplotspatchclass@bicubic@DD}%
2402 \pgfplotspathcubicfrominterpolation
2403 {\pgfplotspatchclass@bicubic@DD}
2404 {\pgfplotspatchclass@bicubic@CD}
2405 {\pgfplotspatchclass@bicubic@BD}
2406 {\pgfplotspatchclass@bicubic@AD}%
2407 \pgfplotspathcubicfrominterpolation
2408 {\pgfplotspatchclass@bicubic@AD}
2409 {\pgfplotspatchclass@bicubic@AC}
2410 {\pgfplotspatchclass@bicubic@AB}
2411 {\pgfplotspatchclass@bicubic@AA}%
2412 \pgfpathclose
2413 },
2414 stream to shader={%
2415 \begingroup
2416 %
2417 % AD BD CD DD
2418 % AC BC CC DC
2419 % AB BB CB DB
2420 % AA BA CA DA
2421 %
2422 % STEP 1: ensure that the patch's coordinates are streamed in
2423 % a sequence which is compatible with the DEPTH of the
2424 % corners.
2425 %
2426 % we use
2427 % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
2428 % which works for bilinear, biquadratic, and bicubic
2429 %
2430 % define helper macros which are input for
2431 % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth:
2432 \let\pgfplotspatchclass@rect@A=\pgfplotspatchclass@bicubic@AA
2433 \let\pgfplotspatchclass@rect@B=\pgfplotspatchclass@bicubic@DA
2434 \let\pgfplotspatchclass@rect@C=\pgfplotspatchclass@bicubic@DD
2435 \let\pgfplotspatchclass@rect@D=\pgfplotspatchclass@bicubic@AD
2436 \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth
2437 {pgfplotspatchclass@rect@}{\Pcur}{\Pnextseq}%
2438 %
2439 %\message{using \Pcur\space(set = \Pnextseq)^^J}%
2440 % now, translate the result into our matrix form.
2441 % This means to (a) identify the FIRST point which needs to be
2442 % streamed (it is stored in \Pcur as 'A', 'B', 'C', or 'D')
2443 % and (b) keep in mind that we have to take care of the
2444 % sequence in which points are streamed ("forward" means to
2445 % rotate the matrix elements and "backward" means to transpose
2446 % the "forward" result).
2447 %
2448 \if A\Pcur
2449 % Ah - the point "AA" needs to be streamed as first.
2450 %
2451 % Well, this is simple: take the matrix as-is!
2452 % simply copy 1:1
2453 \let\P@AA=\pgfplotspatchclass@bicubic@AA
2454 \let\P@BA=\pgfplotspatchclass@bicubic@BA
2455 \let\P@CA=\pgfplotspatchclass@bicubic@CA
2456 \let\P@DA=\pgfplotspatchclass@bicubic@DA
2457 \let\P@AB=\pgfplotspatchclass@bicubic@AB
2458 \let\P@BB=\pgfplotspatchclass@bicubic@BB
2459 \let\P@CB=\pgfplotspatchclass@bicubic@CB
2460 \let\P@DB=\pgfplotspatchclass@bicubic@DB
2461 \let\P@AC=\pgfplotspatchclass@bicubic@AC
2462 \let\P@BC=\pgfplotspatchclass@bicubic@BC
2463 \let\P@CC=\pgfplotspatchclass@bicubic@CC
2464 \let\P@DC=\pgfplotspatchclass@bicubic@DC
2465 \let\P@AD=\pgfplotspatchclass@bicubic@AD
2466 \let\P@BD=\pgfplotspatchclass@bicubic@BD
2467 \let\P@CD=\pgfplotspatchclass@bicubic@CD
2468 \let\P@DD=\pgfplotspatchclass@bicubic@DD
2469 \fi
2470 \if B\Pcur
2471 % the "DA" point needs to be streamed as first.
2472 %
2473 % Reorder
2474 % AD BD CD DD
2475 % AC BC CC DC
2476 % AB BB CB DB
2477 % AA BA CA DA
2478 % to
2479 % AA AB AC AD
2480 % BA BB BC BD
2481 % CA CB CC CD
2482 % DA DB DC DD
2483 %
2484 \let\P@AA=\pgfplotspatchclass@bicubic@DA
2485 \let\P@BA=\pgfplotspatchclass@bicubic@DB
2486 \let\P@CA=\pgfplotspatchclass@bicubic@DC
2487 \let\P@DA=\pgfplotspatchclass@bicubic@DD
2488 \let\P@AB=\pgfplotspatchclass@bicubic@CA
2489 \let\P@BB=\pgfplotspatchclass@bicubic@CB
2490 \let\P@CB=\pgfplotspatchclass@bicubic@CC
2491 \let\P@DB=\pgfplotspatchclass@bicubic@CD
2492 \let\P@AC=\pgfplotspatchclass@bicubic@BA
2493 \let\P@BC=\pgfplotspatchclass@bicubic@BB
2494 \let\P@CC=\pgfplotspatchclass@bicubic@BC
2495 \let\P@DC=\pgfplotspatchclass@bicubic@BD
2496 \let\P@AD=\pgfplotspatchclass@bicubic@AA
2497 \let\P@BD=\pgfplotspatchclass@bicubic@AB
2498 \let\P@CD=\pgfplotspatchclass@bicubic@AC
2499 \let\P@DD=\pgfplotspatchclass@bicubic@AD
2500 \fi
2501 \if C\Pcur
2502 % the "DD" point needs to be streamed as first.
2503 %
2504 % Reorder
2505 % AD BD CD DD
2506 % AC BC CC DC
2507 % AB BB CB DB
2508 % AA BA CA DA
2509 % to
2510 % DA CA BA AA
2511 % DB CB BB AB
2512 % DC CC BC AC
2513 % DD CD BD AD
2514 %
2515 \let\P@AA=\pgfplotspatchclass@bicubic@DD
2516 \let\P@BA=\pgfplotspatchclass@bicubic@CD
2517 \let\P@CA=\pgfplotspatchclass@bicubic@BD
2518 \let\P@DA=\pgfplotspatchclass@bicubic@AD
2519 \let\P@AB=\pgfplotspatchclass@bicubic@DC
2520 \let\P@BB=\pgfplotspatchclass@bicubic@CC
2521 \let\P@CB=\pgfplotspatchclass@bicubic@BC
2522 \let\P@DB=\pgfplotspatchclass@bicubic@AC
2523 \let\P@AC=\pgfplotspatchclass@bicubic@DB
2524 \let\P@BC=\pgfplotspatchclass@bicubic@CB
2525 \let\P@CC=\pgfplotspatchclass@bicubic@BB
2526 \let\P@DC=\pgfplotspatchclass@bicubic@AB
2527 \let\P@AD=\pgfplotspatchclass@bicubic@DA
2528 \let\P@BD=\pgfplotspatchclass@bicubic@CA
2529 \let\P@CD=\pgfplotspatchclass@bicubic@BA
2530 \let\P@DD=\pgfplotspatchclass@bicubic@AA
2531 \fi
2532 \if D\Pcur
2533 % the "AD" point needs to be streamed as first.
2534 %
2535 % Reorder
2536 % AD BD CD DD
2537 % AC BC CC DC
2538 % AB BB CB DB
2539 % AA BA CA DA
2540 % to
2541 % DD DC DB DA
2542 % CD CC CB CA
2543 % BD BC BB BA
2544 % AD AC AB AA
2545 %
2546 \let\P@AA=\pgfplotspatchclass@bicubic@AD
2547 \let\P@BA=\pgfplotspatchclass@bicubic@AC
2548 \let\P@CA=\pgfplotspatchclass@bicubic@AB
2549 \let\P@DA=\pgfplotspatchclass@bicubic@AA
2550 \let\P@AB=\pgfplotspatchclass@bicubic@BD
2551 \let\P@BB=\pgfplotspatchclass@bicubic@BC
2552 \let\P@CB=\pgfplotspatchclass@bicubic@BB
2553 \let\P@DB=\pgfplotspatchclass@bicubic@BA
2554 \let\P@AC=\pgfplotspatchclass@bicubic@CD
2555 \let\P@BC=\pgfplotspatchclass@bicubic@CC
2556 \let\P@CC=\pgfplotspatchclass@bicubic@CB
2557 \let\P@DC=\pgfplotspatchclass@bicubic@CA
2558 \let\P@AD=\pgfplotspatchclass@bicubic@DD
2559 \let\P@BD=\pgfplotspatchclass@bicubic@DC
2560 \let\P@CD=\pgfplotspatchclass@bicubic@DB
2561 \let\P@DD=\pgfplotspatchclass@bicubic@DA
2562 \fi
2563 \ifx\Pnextseq\pgfutil@empty
2564 \else
2565 % reverse the ordering. This means to transpose the
2566 % matrix:
2567 \pgfplotspatchclass@bicubic@transpose
2568 \fi
2569 %
2570 % Step: convert to tensor bezier representation.
2571 %
2572 % Converting a 2d tensor product lagrangian interpoland to a
2573 % 2d tensor product bezier interpoland can be achieved by
2574 % means of 1d algorithms along LINES in the matrix.
2575 %
2576 % The underlying proof for this is related to the tensor
2577 % product form: the U and V coordinates are orthogonal to each
2578 % other, so we can redistribute all intermediate results. (I
2579 % do not have the real proof, so this hand-waving argument has
2580 % to be enough). I verified its results experimentally.
2581 %
2582 % Note that the underlying 1d operation is the same as for
2583 % 'patch type=cubic spline' . We only need to apply it to all
2584 % lines in U direction and afterwards to all lines in V
2585 % direction.
2586 %
2587 \def\pgfplotspatchvertexaddXY@expanded##1\times{%
2588 \edef\pgfplots@loc@TMPa{##1}%
2589 \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times
2590 }%
2591 %
2592 % this macro operates on \pgfplots@line{[ABCD]}, see below:
2593 \def\pgfplots@apply@to@line{%
2594 \pgfplotspatchvertexaccumstart
2595 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.833333}%
2596 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{3}%
2597 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-1.5}%
2598 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{0.3333333}%
2599 \pgfplotspatchvertexfinish\pgfplots@controlpoint@A
2600 %
2601 \pgfplotspatchvertexaccumstart
2602 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{0.333333}%
2603 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{-1.5}%
2604 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{3}%
2605 \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{-0.833333}%
2606 \pgfplotspatchvertexfinish\pgfplots@controlpoint@B
2607 %
2608 \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A
2609 \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B
2610 }%
2611 %
2612 \def\pgfplots@line##1{\csname P@##1A\endcsname}%
2613 \pgfplots@apply@to@line
2614 %
2615 \def\pgfplots@line##1{\csname P@##1B\endcsname}%
2616 \pgfplots@apply@to@line
2617 %
2618 \def\pgfplots@line##1{\csname P@##1C\endcsname}%
2619 \pgfplots@apply@to@line
2620 %
2621 \def\pgfplots@line##1{\csname P@##1D\endcsname}%
2622 \pgfplots@apply@to@line
2623 %
2624 %
2625 \def\pgfplots@line##1{\csname P@A##1\endcsname}%
2626 \pgfplots@apply@to@line
2627 %
2628 \def\pgfplots@line##1{\csname P@B##1\endcsname}%
2629 \pgfplots@apply@to@line
2630 %
2631 \def\pgfplots@line##1{\csname P@C##1\endcsname}%
2632 \pgfplots@apply@to@line
2633 %
2634 \def\pgfplots@line##1{\csname P@D##1\endcsname}%
2635 \pgfplots@apply@to@line
2636 %
2637 % OK. The tensor product representation is READY.
2638 %
2639 \pgfplotsplothandlermesh@shade@cubic@tensor
2640 \endgroup
2641 },
2642 triangulate={%
2643 \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
2644 \def\pgfplotsplothandlermesh@patchclass{triangle}%
2645 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
2646 % Ok. Now create a lot of triangles.
2647 %
2648 % FIXME: The ordering is not arbitrary (unless z buffer=sort is in effect).
2649 %
2650 % ##1: the row index of the cell to be triangulated (either A,B,or C)
2651 % ##2: the col index of the cell to be triangulated (either A,B,or C)
2652 % ##3: the 1. 'set edge visible' value for the first triangle
2653 % ##4: the 2. 'set edge visible' value for the first triangle
2654 % ##5: the 3. 'set edge visible' value for the first triangle
2655 % ##6: the 1. 'set edge visible' value for the second triangle
2656 % ##7: the 2. 'set edge visible' value for the second triangle
2657 % ##8: the 3. 'set edge visible' value for the second triangle
2658 \def\pgfplots@bicubic@triangulate@cell##1##2##3##4##5##6##7##8{%
2659 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##3%
2660 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##4%
2661 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##5%
2662 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}%
2663 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname##2\endcsname}%
2664 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}%
2665 %
2666 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##6%
2667 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##7%
2668 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##8%
2669 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1\csname pgfpptchindexnext@##2\endcsname\endcsname}%
2670 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}%
2671 \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}%
2672 %
2673 }%
2674 %
2675 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
2676 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
2677 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20%
2678 \pgfplots@bicubic@triangulate@cell AA100 100%
2679 \pgfplots@bicubic@triangulate@cell BA100 000%
2680 \pgfplots@bicubic@triangulate@cell CA110 000%
2681 %
2682 \pgfplots@bicubic@triangulate@cell AB000 100%
2683 \pgfplots@bicubic@triangulate@cell BB000 000%
2684 \pgfplots@bicubic@triangulate@cell CB010 000%
2685 %
2686 \pgfplots@bicubic@triangulate@cell AC000 101%
2687 \pgfplots@bicubic@triangulate@cell BC000 001%
2688 \pgfplots@bicubic@triangulate@cell CC010 001%
2689 \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@
2690 },%
2691 serialize except vertices=\let\pgfplotsretval\pgfutil@empty,%
2692 deserialize except vertices=,
2693 get pdf shading type=7,
2694 get num vertices=\def\pgfplotsretval{16},
2695 get num cdata vertices=\def\pgfplotsretval{4},
2696 }%
2697
2698 % Transpose a bicubic matrix (4x4).
2699 %
2700 % Reorder
2701 % AD BD CD DD
2702 % AC BC CC DC
2703 % AB BB CB DB
2704 % AA BA CA DA
2705 % to
2706 % DA DB DC DD
2707 % CA CB CC CD
2708 % BA BB BC BD
2709 % AA AB AC AD
2710 \def\pgfplotspatchclass@bicubic@transpose{%
2711 \pgfplotsutil@swap\P@AB\P@BA
2712 \pgfplotsutil@swap\P@CA\P@AC
2713 \pgfplotsutil@swap\P@DA\P@AD
2714 \pgfplotsutil@swap\P@CB\P@BC
2715 \pgfplotsutil@swap\P@BD\P@DB
2716 \pgfplotsutil@swap\P@DC\P@CD
2717 }
2718
2719 % Transpose a bicubic matrix (4x4).
2720 %
2721 % Reorder
2722 % AC BC CC
2723 % AB BB CB
2724 % AA BA CA
2725 % to
2726 % CA CB CC
2727 % BA BB BC
2728 % AA AB AC
2729 \def\pgfplotspatchclass@biquad@transpose{%
2730 \pgfplotsutil@swap\P@AB\P@BA
2731 \pgfplotsutil@swap\P@CA\P@AC
2732 \pgfplotsutil@swap\P@CB\P@BC
2733 }
2734
2735 % Expects that a 4x4 matrix in tensor bezier representation where
2736 % A = left end point
2737 % B = first control point
2738 % C = second control point
2739 % D = right end point
2740 %
2741 % and the coordinates are stored in \csname P@[ABCD][ABCD]\endcsname
2742 %
2743 % Streaming starts with \P@AA and is applied rowwise.
2744 \def\pgfplotsplothandlermesh@shade@cubic@tensor{%
2745 % Stream it to the shader. Note that the shader has a
2746 % DIFFERENT ordering; it expects points in the cyclic ordering
2747 %
2748 % AA BA CA DA DB DC DD CD BD AD AC AB BB CB CC BC
2749 %
2750 % note furthermore that only the corners have "point meta" in
2751 % this shading :-(
2752 %
2753 \expandafter\pgfplotspatchvertex\P@AA\endvertex
2754 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2755 \pgfplotsaxisvisphasetransformpointmeta
2756 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2757 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BA\endvertex}{\pgfplotspointmetatransformed}%
2758 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CA\endvertex}{\pgfplotspointmetatransformed}%
2759 \expandafter\pgfplotspatchvertex\P@DA\endvertex
2760 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2761 \pgfplotsaxisvisphasetransformpointmeta
2762 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2763 %
2764 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DB\endvertex}{\pgfplotspointmetatransformed}%
2765 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DC\endvertex}{\pgfplotspointmetatransformed}%
2766 \expandafter\pgfplotspatchvertex\P@DD\endvertex
2767 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2768 \pgfplotsaxisvisphasetransformpointmeta
2769 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2770 %
2771 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CD\endvertex}{\pgfplotspointmetatransformed}%
2772 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BD\endvertex}{\pgfplotspointmetatransformed}%
2773 \expandafter\pgfplotspatchvertex\P@AD\endvertex
2774 \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta
2775 \pgfplotsaxisvisphasetransformpointmeta
2776 \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}%
2777 %
2778 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AC\endvertex}{\pgfplotspointmetatransformed}%
2779 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AB\endvertex}{\pgfplotspointmetatransformed}%
2780 %
2781 %
2782 \pgfplotspatchclass{\pgfplotspatchclassname}{get pdf shading type}%
2783 \if 7\pgfplotsretval
2784 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BB\endvertex}{\pgfplotspointmetatransformed}%
2785 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CB\endvertex}{\pgfplotspointmetatransformed}%
2786 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CC\endvertex}{\pgfplotspointmetatransformed}%
2787 \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BC\endvertex}{\pgfplotspointmetatransformed}%
2788 \else
2789 % assume 'get pdf shading type=6' - it does not contain the
2790 % inner vertices.
2791 \fi
2792 }
2793 \endinput