Debian Codegraph @

texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty

raw
1 % Copyright 2018 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \RequirePackage{pgfrcs}
11
12 \ProvidesPackageRCS{pgfcomp-version-0-65.sty}
13
14 \def\pgfdirection#1{\csname pgf@direction#1\endcsname}
15
16 \def\pgf@directionn{90}
17 \def\pgf@directionnorth{90}
18 \def\pgf@directionabove{90}
19 \def\pgf@directions{270}
20 \def\pgf@directionsouth{270}
21 \def\pgf@directionbelow{270}
22 \def\pgf@directionw{180}
23 \def\pgf@directionwest{180}
24 \def\pgf@directionleft{180}
25 \def\pgf@directione{0}
26 \def\pgf@directioneast{0}
27 \def\pgf@directionright{0}
28 \def\pgf@directionne{45}
29 \def\pgf@directionse{315}
30 \def\pgf@directionnw{135}
31 \def\pgf@directionsw{-135}
32
33
34 \def\pgfpictureboxed#1#2#3#4{%
35 \pgfpicture{#1}{#2}{#3}{#4}%
36 \pgfmoveto{\pgfpoint{#1}{#2}}%
37 \pgflineto{\pgfpoint{#1}{#4}}%
38 \pgflineto{\pgfpoint{#3}{#4}}%
39 \pgflineto{\pgfpoint{#3}{#2}}%
40 \pgfclosestroke\ignorespaces}
41 \def\endpgfpictureboxed{\endpgfpicture}
42
43 \def\pgfxyline(#1,#2)(#3,#4){%
44 \pgfmoveto{\pgfxy(#1,#2)}%
45 \pgflineto{\pgfxy(#3,#4)}%
46 \pgfstroke}
47
48 \def\pgfxycurve(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
49 \pgfmoveto{\pgfxy(#1,#2)}%
50 \pgfbezier{\pgfxy(#3,#4)}{\pgfxy(#5,#6)}{\pgfxy(#7,#8)}%
51 \pgfstroke}
52
53 \def\pgfline#1#2{%
54 \pgfmoveto{#1}%
55 \pgflineto{#2}%
56 \pgfstroke}
57
58 \let\pgflineto=\pgfpathlineto
59 \let\pgfmoveto=\pgfpathmoveto
60 \let\pgfcurveto=\pgfpathcurveto
61 \let\pgfbezier=\pgfpathcurveto
62 \let\pgfarc=\pgfpatharc
63
64 \def\pgfzerocircle#1{\pgfcircle{\pgforigin}{#1}}
65 \def\pgfzeroellipse#1#2{\pgfellipse{\pgforigin}{#1}{#2}}
66 \def\pgfeofill{{\pgfseteorule\pgfsys@flushpath\pgfsys@fill}\pgf@resetpathsizes\ignorespaces}
67 \def\pgfeofillstroke{{\pgfseteorule\pgfsys@flushpath\pgfsys@fillstroke}\pgf@resetpathsizes\ignorespaces}
68 \def\pgf@perform@eofill{\pgfeofill}
69 \def\pgf@perform@eofillstroke{\pgfeofillstroke}
70 \let\pgfdiff=\pgfpointdiff
71 \let\pgfrelative=\pgfpointadd
72 \let\pgfpartway=\pgfpointlineattime
73 \let\pgfbackoff=\pgfpointlineatdistance
74 \def\pgflabel#1#2#3#4{%
75 % First, calculate base point
76 \pgfpointlineattime{#1}{#2}{#3}%
77 \pgf@xb=\pgf@x%
78 \pgf@yb=\pgf@y%
79 \pgf@process{#2}%
80 \pgf@xa=\pgf@x% xb/yb = start point
81 \pgf@ya=\pgf@y%
82 \pgf@process{#3}%
83 \advance\pgf@x by-\pgf@xa%
84 \advance\pgf@y by-\pgf@ya%
85 \pgf@process{\pgfpointnormalised{}}% x/y = normalised vector
86 \setlength\pgf@ya{#4}%
87 \pgf@xa=-\pgf@ya\relax%
88 \pgf@xa=\pgf@sys@tonumber{\pgf@y}\pgf@xa%
89 \pgf@ya=\pgf@sys@tonumber{\pgf@x}\pgf@ya%
90 \pgf@x=\pgf@xb\relax%
91 \pgf@y=\pgf@yb\relax%
92 \advance\pgf@x by\pgf@xa\relax%
93 \advance\pgf@y by\pgf@ya\relax%
94 \ignorespaces}
95 \let\pgfnormalise=\pgfpointnormalised
96 \let\pgfpolar=\pgfpointpolar
97 \let\pgforigin=\pgfpointorigin
98 \let\pgfclosepath=\pgfpathclose
99
100 \def\pgfxy(#1,#2){\pgfpointxy{#1}{#2}}
101 \def\pgfxyz(#1,#2,#3){\pgfpointxyz{#1}{#2}{#3}}
102 \newcommand\pgfgrid[3][]{\pgfpathgrid[#1]{#2}{#3}\pgfqstroke}
103 \newcommand\pgfellipse[4][]{%
104 \pgfpathellipse{#2}{#3}{#4}%
105 \csname pgf@perform@#1\endcsname\ignorespaces
106 }
107 \newcommand\pgfcircle[3][]{\pgfellipse[#1]{#2}{\pgfpoint{#3}{0pt}}{\pgfpoint{0pt}{#3}}}
108 \newcommand\pgfrect[3][]{%
109 \pgfpathrectangle{#2}{#3}%
110 \csname pgf@perform@#1\endcsname%
111 }
112 \def\pgf@perform@stroke{\pgfqstroke}
113 \def\pgf@perform@fill{\pgffill}
114 \def\pgf@perform@fillstroke{\pgffillstroke}
115 \def\pgf@perform@clip{\pgfclip}
116
117 \def\pgfsincos#1{%
118 \pgfmathparse{#1}%
119 \pgfmathcos@{#1}\pgf@y\pgfmathresult pt%
120 \pgfmathsin@{#1}\pgf@x\pgfmathresult pt%
121 }
122
123 \let\pgfdegree=\pgfsincos
124
125 \newenvironment{pgfmagnify}[2]{\pgflowlevelscope{\pgftransformcm{#1}{0}{0}{#2}{\pgfpointorigin}}}{\endpgflowlevelscope}
126 \newenvironment{pgftranslate}[1]{\pgflowlevelscope{\pgftransformshift{#1}}}{\endpgflowlevelscope}
127 \newcommand{\pgftranslateto}[1]{\pgflowlevel{\pgftransformshift{#1}}}
128 \newenvironment{pgfrotateby}[1]{%
129 \pgf@process{#1}%
130 \pgf@xa=-\pgf@x%
131 \edef\pgf@temp{\noexpand\pgflowlevelscope{\noexpand\pgftransformcm{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@y}}{\noexpand\pgfpointorigin}}}%
132 \pgf@temp}
133 {\endpgflowlevelscope}
134
135 \long\def\pgfputat#1#2{\begin{pgftranslate}{#1}#2\end{pgftranslate}}
136 \def\pgfputlabelrotated#1#2#3#4#5{%
137 \pgflabel{#1}{#2}{#3}{#4}%
138 \pgfputat{}{%
139 \pgf@process{#2}%
140 \pgf@xa=\pgf@x% xb/yb = start point
141 \pgf@ya=\pgf@y%
142 \pgf@process{#3}%
143 \advance\pgf@x by-\pgf@xa%
144 \advance\pgf@y by-\pgf@ya%
145 \pgfnormalise{}% x/y = normalised vector
146 \pgf@ya=-\pgf@y%
147 \pgfsys@transformcm{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{0pt}{0pt}%
148 #5}%
149 \ignorespaces}
150 \def\pgfqcurveto#1#2#3#4#5#6{\pgfpathqcurveto{#1bp}{#2bp}{#3bp}{#4bp}{#5bp}{#6bp}}
151 \let\pgfqbezier=\pgfqcurveto
152 \def\pgfqlineto#1#2{\pgfpathqlineto{#1bp}{#2bp}}
153 \def\pgfqmoveto#1#2{\pgfpathqmoveto{#1bp}{#2bp}}
154 \let\pgfqstroke=\pgfusepathqstroke
155
156 \def\pgfstroke{\pgfusepath{stroke}}
157 \def\pgfclip{\pgfusepath{clip}}
158 \def\pgffill{\pgfusepath{fill}}
159 \def\pgfclosestroke{\pgfpathclose\pgfusepath{stroke}}
160 \def\pgffillstroke{\pgfusepath{fill,stroke}}
161 \def\pgfstrokeclip{\pgfusepath{clip,stroke}}
162 \def\pgffillclip{\pgfusepath{clip,stroke}}
163 \def\pgfclosestrokeclip{\pgfpathclose\pgfusepath{stroke,clip}}
164 \def\pgffillstrokeclip{\pgfusepath{stroke,fill,clip}}
165 \def\pgfclearendarrow{\pgfsetendarrow{}}
166 \def\pgfclearstartarrow{\pgfsetstartarrow{}}
167
168 \def\pgfputarrow#1#2#3{\pgflowlevelobj{\pgftransformarrow{#1}{#2}}{\pgfsys@setdash{}{0pt}#3}}
169
170 \def\pgfsetstartarrow#1{\def\pgf@startarrow{#1}\def\pgf@shorten@start{\pgf@x=0.0pt}}
171 \def\pgfsetendarrow#1{\def\pgf@endarrow{#1}\def\pgf@shorten@end{\pgf@x=0.0pt}}
172
173 \def\pgfdefarrow#1#2#3#4{%
174 \pgfdefobject{pgf@#1}{#2}{#3}{\pgfsys@setlinewidth{1bp}#4}%
175 \expandafter\gdef\csname#1\endcsname{%
176 \pgf@x=\pgflinewidth%
177 \pgf@y=\pgflinewidth%
178 \pgfuseobjectmagnify{pgf@#1}\ignorespaces}}
179 \def\pgfdefarrowabs#1#2#3#4{%
180 \pgfdefobject{pgf@#1}{#2}{#3}{\pgfarrowlinewidthscale{1}#4}%
181 \expandafter\gdef\csname#1\endcsname{%
182 \pgfuseobject{pgf@#1}\ignorespaces}
183 }
184 \def\pgfarrowlinewidthscale#1{\pgfsys@setlinewidth{#1bp}\ignorespaces}
185 \pgfdefarrow{pgfarrowsingle}{\pgfpoint{-7pt}{-5pt}}{\pgfpoint{3pt}{5pt}}{%
186 \pgfqmoveto{2}{0}
187 \pgfqlineto{-6}{4}
188 \pgfqlineto{-3}{0}
189 \pgfqlineto{-6}{-4}
190 \pgfusepathqfill}
191 \def\pgfarrowswap#1{\pgflowlevelobj{\pgftransformxscale{-1}}{#1}}
192 \def\pgfarrowcombine#1#2{%
193 #1%
194 \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#2}}
195 \def\pgfarrowcombineloose#1#2{#1\pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#2}}
196 \def\pgfarrowdouble#1{\pgfarrowcombine{#1}{#1}}
197 \def\pgfarrowtriple#1{%
198 #1%
199 \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#1}%
200 \pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#1}}
201 \pgfdefarrow{pgfarrowto}{\pgfpoint{-4pt}{-5pt}}{\pgfpoint{2pt}{5pt}}{%
202 \pgfarrowlinewidthscale{0.8}
203 \pgfsetdash{}{0pt}
204 \pgfsetroundcap
205 \pgfsetroundjoin
206 \pgfqmoveto{-3}{4}
207 \pgfqcurveto{-2.75}{2.5}{0}{0.25}{0.75}{0}
208 \pgfqcurveto{0}{-0.25}{-2.75}{-2.5}{-3}{-4}
209 \pgfusepathqstroke}
210 \pgfdefarrow{pgfarrowbar}{\pgfpoint{-1pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{%
211 \pgfsetdash{}{0pt}
212 \pgfqmoveto{0}{-5}
213 \pgfqlineto{0}{5}
214 \pgfusepathqstroke}
215 \pgfdefarrow{pgfarrowsquare}{\pgfpoint{-4pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{%
216 \pgfsetdash{}{0pt}
217 \pgfqmoveto{-3}{-5}
218 \pgfqlineto{0}{-5}
219 \pgfqlineto{0}{5}
220 \pgfqlineto{-3}{5}
221 \pgfusepathqstroke}
222 \pgfdefarrow{pgfarrowround}{\pgfpoint{-3pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{%
223 \pgfsetdash{}{0pt}
224 \pgfqmoveto{-2}{-5}
225 \pgfqcurveto{1}{-3}{1}{3}{-2}{5}
226 \pgfusepathqstroke}
227 \pgfdefarrow{pgfarrowpointed}{\pgfpoint{-6pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{%
228 \pgfsetdash{}{0pt}
229 \pgfqmoveto{-4.5}{-5}
230 \pgfqlineto{0.5}{0}
231 \pgfqlineto{-4.5}{5}
232 \pgfusepathqstroke}
233 \pgfdefarrow{pgfarrowdot}{\pgfpoint{-7pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{%
234 \pgfsys@transformshift{-2.5bp}{0bp}%
235 \pgfsetdash{}{0pt}
236 \pgfpathqcircle{3bp}
237 \pgfusepathqfillstroke}
238 \pgfdefarrow{pgfarrowdiamond}{\pgfpoint{-12pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{%
239 \pgfsetdash{}{0pt}
240 \pgfqmoveto{1}{0}
241 \pgfqlineto{-5}{3}
242 \pgfqlineto{-11}{0}
243 \pgfqlineto{-5}{-3}
244 \pgfpathclose
245 \pgfusepathqfillstroke}
246 \def\pgfarrowcircle#1{%
247 \pgfsetdash{}{0pt}
248 \setlength\pgf@xa{#1}%
249 \pgf@xb=\pgf@xa%
250 \advance\pgf@xa by-0.5\pgflinewidth
251 \begin{pgflowlevelscope}{\pgftransformshift{\pgfpoint{-\pgf@xa}{0pt}}}%
252 \pgfpathqcircle{\pgf@sys@tonumber{\pgf@xb}bp}
253 \pgfusepathqfillstroke
254 \end{pgflowlevelscope}}
255 \def\pgfarrowtriangle#1{%
256 \pgfsetdash{}{0pt}
257 \begin{pgfscope}%
258 \setlength\pgf@xa{#1}%
259 \pgf@ya=0.577\pgf@xa%
260 \advance\pgf@xb by-\pgflinewidth%
261 \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}%
262 \pgfpathlineto{\pgfpoint{\pgflinewidth}{0pt}}%
263 \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}}%
264 \pgfpathclose%
265 \pgfusepathqfillstroke%
266 \end{pgfscope}}
267 \def\pgfarrowlargepointed#1{%
268 \pgfsetdash{}{0pt}
269 \begin{pgfscope}%
270 \setlength\pgf@xa{#1}%
271 \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@xa}}
272 \pgfpathlineto{\pgfpointorigin}
273 \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@xa}}
274 \pgfusepathqstroke
275 \end{pgfscope}}
276
277 \newcommand\pgfcorner[3][sw]{%
278 \pgf@process{#2}%
279 \pgf@xa=\pgf@x%
280 \pgf@ya=\pgf@y%
281 \pgf@process{#3}%
282 \ifdim\pgf@xa<\pgf@x%
283 \pgf@xb=\pgf@x%
284 \pgf@x=\pgf@xa%
285 \pgf@xa=\pgf@xb%
286 \fi%
287 \ifdim\pgf@ya<\pgf@y%
288 \pgf@yb=\pgf@y%
289 \pgf@y=\pgf@ya%
290 \pgf@ya=\pgf@yb%
291 \fi%
292 \csname pgf@corner@#1\endcsname\relax%
293 }
294 \def\pgf@corner@se{\pgf@x=\pgf@xa}
295 \def\pgf@corner@ne{\pgf@x=\pgf@xa\pgf@y=\pgf@ya}
296 \def\pgf@corner@nw{\pgf@y=\pgf@ya}
297 \def\pgf@corner@sw{}
298 \def\pgf@corner@s{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa}
299 \def\pgf@corner@n{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa\pgf@y=\pgf@ya}
300 \def\pgf@corner@w{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya}
301 \def\pgf@corner@e{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya\pgf@x=\pgf@xa}
302
303 % Defines a circle node of name #1 at position #3 of radius #4.
304 %
305 % #1 = a name
306 % #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw
307 % nothing)
308 % #3 = a point
309 % #4 = a radius
310 %
311 % Example:
312 %
313 % \pgfnodecircle{mynode}[stroke]{\pgfxy(1,1)}{2cm}
314
315 \def\pgfnodecircle#1[#2]#3#4{%
316 \pgf@process{#3}%
317 \expandafter\def\csname pgfno@#1\endcsname{\pgf@backoffcircle{#4}}%
318 \expandafter\def\csname pgfnob@#1\endcsname{\pgf@anglecircle{#4}}%
319 \expandafter\edef\csname pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@x}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@y}pt}%
320 \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual%
321 \else%
322 \pgfcircle[#2]{\csname pgfnom@#1\endcsname}{#4}%
323 \fi\ignorespaces}
324
325 \def\pgf@@virtual{}
326
327
328 % Defines a rectangular node of name #1 with center at position #3 and
329 % width/height vector #4
330 %
331 % #1 = a name
332 % #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw
333 % nothing)
334 % #3 = a center
335 % #4 = width/height vector
336 %
337 % Example:
338 %
339 % \pgfnoderect{mynode}[stroke]{\pgfxy(1,1)}{\pgfxy(2,2)}
340
341 \def\pgfnoderect#1[#2]#3#4{%
342 \pgf@process{#3}%
343 \pgf@xa=\pgf@x%
344 \pgf@ya=\pgf@y%
345 \pgf@process{#4}%
346 \pgf@x=.5\pgf@x%
347 \pgf@y=.5\pgf@y%
348 \expandafter\edef\csname pgfno@#1\endcsname{\noexpand\pgf@backoffrect%
349 {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}%
350 \expandafter\edef\csname pgfnob@#1\endcsname{\noexpand\pgf@anglerect%
351 {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}%
352 \expandafter\edef\csname
353 pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}%
354 \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual%
355 \else%
356 \advance\pgf@xa by-\pgf@x%
357 \advance\pgf@ya by-\pgf@y%
358 \edef\pgf@temp{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}%
359 \pgfrect[#2]{\pgf@temp}{#4}%
360 \fi\ignorespaces}
361
362
363 % Defines a rectangular node of name #1 with center at position #3
364 % contaning a box #4
365 %
366 % #1 = a name
367 % #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw
368 % nothing)
369 % #3 = a center
370 % #4 = TeX text that will be boxed
371 % #5 = a horizontal border offset
372 % #6 = a vertical border offset
373 %
374 % Example:
375 %
376 % \pgfnodebox{mynode}[stroke]{\pgfxy(1,1)}{start}{2pt}{2pt}
377
378 \def\pgfnodebox#1[#2]#3#4#5#6{%
379 \pgf@makehbox{#4}%
380 \pgf@x=\wd\pgf@hbox%
381 \pgf@y=\ht\pgf@hbox%
382 \advance\pgf@y by \dp\pgf@hbox%
383 \addtolength\pgf@x{#5}%
384 \addtolength\pgf@x{#5}%
385 \addtolength\pgf@y{#6}%
386 \addtolength\pgf@y{#6}%
387 \edef\pgf@boxsize{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}%
388 \csname pgf@haligncompcenter\endcsname%
389 \csname pgf@valigncompcenter\endcsname%
390 \wd\pgf@hbox=0pt%
391 \pgfputat{#3}{%
392 \pgfsys@hbox\pgf@hbox}%
393 \pgfnoderect{#1}[#2]{#3}{\pgf@boxsize}\ignorespaces}
394
395
396
397
398 % Retrieves the center of #1.
399 %
400 % #1 = a node name
401 %
402 % Example:
403 %
404 % \pgfpathmoveto{\pgfnodecenter{mynode}}
405
406 \def\pgfnodecenter#1{%
407 \expandafter\ifx\csname pgfnom@#1\endcsname\relax%
408 \GenericError{\space\space\space\@spaces\@spaces\@spaces}%
409 {PGF Error: Node "#1" undefined.}{}{\@ehc}%
410 \pgfpoint{0pt}{0pt}%
411 \else\csname pgfnom@#1\endcsname\fi\ignorespaces}
412
413
414
415 % Returns a position relative to the center of #1.
416 %
417 % #1 = a node name
418 % #2 = a direction (see \pgfdirection)
419 % #3 = a distance
420 %
421 % Example:
422 %
423 % \pgfpathmoveto{\pgfnoderelative{mynode}[north]{1cm}}
424
425 \def\pgfnoderelative#1[#2]#3{%
426 \pgfrelative{\pgfnodecenter{#1}}{\pgfpolar{\pgfdirection{#2}}{#3}}\ignorespaces}
427
428
429
430 % Retrieves a border point of #1 at angle #2 and distance #3 from
431 % border.
432 %
433 % #1 = a node name
434 % #2 = an angle
435 % #3 = a distance from the border
436 %
437 % Example:
438 %
439 % \pgfpathmoveto{\pgfnodeborder{first}{30}{0pt}}
440 % \pgfpathlineto{\pgfnodeborder{second}{180}{2pt}}
441 % \pgfstroke
442
443 \def\pgfnodeborder#1#2#3{%
444 \csname pgfnob@#1\endcsname{#3}{#2}{\pgfnodecenter{#1}}\ignorespaces}
445
446
447
448 % Gives the beginning of a connection of #2 and #3, taking a
449 % separation distance of #1 into account.
450 %
451 % #1 = a separation distance
452 % #2 = a node name
453 % #3 = a second node name
454 %
455 % Example:
456 %
457 % \pgfpathmoveto{\pgfnodeconnstart{first}{second}}
458 % \pgfpathlineto{\pgfnodeconnstart{second}{first}}
459
460 \def\pgfnodeconnstart[#1]#2#3{%
461 \csname pgfno@#2\endcsname[#1]{\pgfnodecenter{#2}}{\pgfnodecenter{#3}}%
462 \ignorespaces}
463
464
465
466 \newdimen\pgf@nodesepstart
467 \newdimen\pgf@nodesepend
468
469 % Sets the node separation for starts of lines.
470 %
471 % #1 = a distance
472 %
473 % Example:
474 %
475 % \pgfnodesetsepstart{2pt}
476
477 \def\pgfnodesetsepstart#1{\setlength\pgf@nodesepstart{#1}\ignorespaces}
478
479 \pgfnodesetsepstart{0pt}
480
481
482 % Sets the node separation for end of lines.
483 %
484 % #1 = a distance
485 %
486 % Example:
487 %
488 % \pgfnodesetsepend{2pt}
489
490 \def\pgfnodesetsepend#1{\setlength\pgf@nodesepend{#1}\ignorespaces}
491
492 \pgfnodesetsepend{0pt}
493
494
495
496
497 % Draws a line from #1 to #2.
498 %
499 % #1 = a node name
500 % #2 = a second node name
501 %
502 % Example:
503 %
504 % \pgfnodeconnline{first}{second}
505
506 \def\pgfnodeconnline#1#2{%
507 \pgfpathmoveto{\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}%
508 \pgfpathlineto{\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}%
509 \pgfstroke%
510 \ignorespaces}
511
512
513
514 % Draws a curve from #1 to #2. The starting angle at #1 is #3 and the
515 % length to the first support point is #5. The starting angle at #2
516 % is #4 and the length to the second support point is #6.
517 %
518 % #1 = a node name
519 % #2 = a second node name
520 % #3 = angle at first node
521 % #4 = angle at second node
522 % #5 = distance to support point at first node
523 % #6 = distance to support point at second node
524 %
525 % Example:
526 %
527 % \pgfnodeconncurve{first}{second}{10}{-10}{1cm}{1cm}
528
529 \def\pgfnodeconncurve#1#2#3#4#5#6{%
530 \pgfpathmoveto{\pgfnodeborder{#1}{#3}{\pgf@nodesepstart}}%
531 \pgfpathcurveto{\pgfnodeborder{#1}{#3}{#5}}{\pgfnodeborder{#2}{#4}{#6}}%
532 {\pgfnodeborder{#2}{#4}{\pgf@nodesepend}}%
533 \pgfstroke\ignorespaces}
534
535
536
537
538 % Put a label on a line from #1 to #2.
539 %
540 % #1 = a node name
541 % #2 = a second node name
542 % #3 = fraction of way from #1 to #2
543 % #4 = vertical offset
544 % #5 = label
545 %
546 % Example:
547 %
548 % \pgfnodelabel{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}}
549
550 \def\pgfnodelabel#1#2[#3][#4]#5{%
551 \pgfputat{\pgflabel%
552 {#3}%
553 {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}%
554 {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}%
555 {#4}}%
556 {#5}\ignorespaces}
557
558
559 % Put a rotated label on a line from #1 to #2.
560 %
561 % #1 = a node name
562 % #2 = a second node name
563 % #3 = fraction of way from #1 to #2
564 % #4 = vertical offset
565 % #5 = label
566 %
567 % Example:
568 %
569 % \pgfnodelabelrotated{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}}
570
571 \def\pgfnodelabelrotated#1#2[#3][#4]#5{%
572 \pgfputlabelrotated%
573 {#3}%
574 {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}%
575 {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}%
576 {#4}%
577 {#5}\ignorespaces}
578
579
580
581 % Internals
582
583 \def\pgf@backoffcircle#1[#2]#3#4{%
584 % Calculate backoff for a circle of radius
585 % #1 and offset separation #2. #3 is the center of the circle, #4
586 % is the target point.
587 \setlength\pgf@x{#1}%
588 \addtolength\pgf@x{#2}%
589 \edef\pgf@temp{{\pgf@sys@tonumber{\pgf@x}pt}}%
590 \expandafter\pgfbackoff\pgf@temp{#3}{#4}\ignorespaces}
591
592 \def\pgf@mult#1#2#3{#1=#2#3}
593
594 \def\pgf@anglecircle#1#2#3#4{%
595 % Calculate border point. #1 is radius, #2 is additional backoff, #3
596 % is an angle, #4 is the center of the circle.
597 \pgfsincos{#3}%
598 \setlength\pgf@xa{#1}%
599 \addtolength\pgf@xa{#2}%
600 \pgf@ya=\pgf@xa\relax%
601 \pgf@mult{\pgf@xa}{\pgf@sys@tonumber{\pgf@x}}{\pgf@xa}%
602 \pgf@mult{\pgf@ya}{\pgf@sys@tonumber{\pgf@y}}{\pgf@ya}%
603 \pgf@process{#4}%
604 \advance\pgf@y by\pgf@xa\relax%
605 \advance\pgf@x by\pgf@ya\ignorespaces}
606
607 \def\pgf@backoffrect#1#2[#3]#4#5{%
608 % Calculate backoff for a rect with half width #1,
609 % half height #2, offset separation #3. #4 is the center of the rect, #5
610 % is the target point.
611 \pgfdiff{#4}{#5}%
612 \pgf@xa=\pgf@x%
613 \pgf@ya=\pgf@y%
614 \setlength\pgf@xb{#1}%
615 \setlength\pgf@yb{#2}%
616 \addtolength\pgf@xb{#3}%
617 \addtolength\pgf@yb{#3}%
618 \ifnum\pgf@xa<0\relax% move into first quadrant
619 \pgf@x=-\pgf@x%
620 \fi%
621 \ifnum\pgf@ya<0\relax%
622 \pgf@y=-\pgf@y%
623 \fi%
624 \c@pgf@counta=\pgf@x%
625 \c@pgf@countb=\pgf@y%
626 \divide\c@pgf@counta by 256\relax%
627 \divide\c@pgf@countb by 256\relax%
628 \ifnum\c@pgf@countb<\c@pgf@counta%
629 \ifnum\c@pgf@counta<1\relax%
630 \pgf@y=\pgf@yb\relax%
631 \pgf@x=0pt\relax%
632 \else%
633 \pgf@y=16\pgf@y%
634 \divide\pgf@y by \c@pgf@counta%
635 \pgf@y=16\pgf@y%
636 \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}%
637 \ifnum\pgf@y<\pgf@yb%
638 \pgf@x=\pgf@xb%
639 \else% rats, calculate intersection on upper side
640 \ifnum\c@pgf@countb<1\relax%
641 \pgf@x=\pgf@xb\relax%
642 \pgf@y=0pt\relax%
643 \else%
644 \pgf@x=16\pgf@x%
645 \divide\pgf@x by \c@pgf@countb%
646 \pgf@x=16\pgf@x%
647 \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}%
648 \pgf@y=\pgf@yb%
649 \fi%
650 \fi%
651 \fi%
652 \else%
653 \ifnum\c@pgf@countb<1\relax%
654 \pgf@x=\pgf@xb\relax%
655 \pgf@y=0pt\relax%
656 \else%
657 \pgf@x=16\pgf@x%
658 \divide\pgf@x by \c@pgf@countb%
659 \pgf@x=16\pgf@x%
660 \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}%
661 \ifnum\pgf@x<\pgf@xb%
662 \pgf@y=\pgf@yb%
663 \else%
664 \ifnum\c@pgf@counta<1\relax%
665 \pgf@y=\pgf@yb\relax%
666 \pgf@x=0pt\relax%
667 \else%
668 \pgf@y=16\pgf@y%
669 \divide\pgf@y by \c@pgf@counta%
670 \pgf@y=16\pgf@y%
671 \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}%
672 \pgf@x=\pgf@xb%
673 \fi%
674 \fi%
675 \fi%
676 \fi%
677 \ifnum\pgf@xa<0\relax\pgf@x=-\pgf@x\fi%
678 \ifnum\pgf@ya<0\relax\pgf@y=-\pgf@y\fi%
679 \pgf@xa=\pgf@x%
680 \pgf@ya=\pgf@y%
681 \pgf@process{#4}%
682 \advance\pgf@x by\pgf@xa%
683 \advance\pgf@y by\pgf@ya\ignorespaces}
684
685 \def\pgf@anglerect#1#2#3#4#5{%
686 % Calculate border point. #1/#2 is half width/height, #3 is additional backoff, #4
687 % is an angle, #5 is the center of the rect.
688 \pgfsincos{#4}%
689 \pgf@xa=100\pgf@x%
690 \pgf@ya=100\pgf@y%
691 \pgf@process{#5}%
692 \advance\pgf@x by\pgf@ya%
693 \advance\pgf@y by\pgf@xa%
694 \edef\pgf@temp{{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}}%
695 \expandafter\pgf@caller\pgf@temp{#1}{#2}{#3}{#5}\ignorespaces}
696
697 \def\pgf@caller#1#2#3#4#5{\pgf@backoffrect{#2}{#3}[#4]{#5}{#1}}
698
699 \long\def\pgfbox[#1,#2]#3{%
700 \pgf@makehbox{#3}%
701 \csname pgf@haligncomp#1\endcsname%
702 \csname pgf@valigncomp#2\endcsname%
703 \wd\pgf@hbox=0pt%
704 \ht\pgf@hbox=0pt%
705 \dp\pgf@hbox=0pt%
706 \pgfqbox{\pgf@hbox}%
707 \ignorespaces}
708
709 \def\pgf@haligncompleft{}% do nothing
710 \def\pgf@haligncompcenter{\setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\box\pgf@hbox}}
711 \def\pgf@haligncompright{\setbox\pgf@hbox=\hbox{\hskip-\wd\pgf@hbox\box\pgf@hbox}}
712 \def\pgf@valigncompbase{}% do nothing
713 \def\pgf@valigncompbottom{\setbox\pgf@hbox=\hbox{\raise\dp\pgf@hbox\box\pgf@hbox}}
714 \def\pgf@valigncompcenter{%
715 \setbox\pgf@hbox=\hbox{\raise.5\dp\pgf@hbox\hbox{\lower.5\ht\pgf@hbox\box\pgf@hbox}}}%
716 \def\pgf@valigncomptop{\setbox\pgf@hbox=\hbox{\lower\ht\pgf@hbox\box\pgf@hbox}}
717
718
719 \endinput