Debian Codegraph @

texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex

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 \ProvidesFileRCS{pgflibraryshapes.misc.code.tex}
11
12
13 \pgfdeclareshape{cross out}
14 {%
15 \inheritsavedanchors[from=rectangle]% % this is nearly a rectangle
16 \inheritanchorborder[from=rectangle]%
17 \inheritanchor[from=rectangle]{north}%
18 \inheritanchor[from=rectangle]{north west}%
19 \inheritanchor[from=rectangle]{north east}%
20 \inheritanchor[from=rectangle]{center}%
21 \inheritanchor[from=rectangle]{west}%
22 \inheritanchor[from=rectangle]{east}%
23 \inheritanchor[from=rectangle]{mid}%
24 \inheritanchor[from=rectangle]{mid west}%
25 \inheritanchor[from=rectangle]{mid east}%
26 \inheritanchor[from=rectangle]{base}%
27 \inheritanchor[from=rectangle]{base west}%
28 \inheritanchor[from=rectangle]{base east}%
29 \inheritanchor[from=rectangle]{south}%
30 \inheritanchor[from=rectangle]{south west}%
31 \inheritanchor[from=rectangle]{south east}%
32 \foregroundpath{
33 % store lower right in xa/ya and upper right in xb/yb
34 \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
35 \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
36 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
37 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
38 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
39 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
40 \pgfsetarrowsstart{}
41 \pgfsetarrowsend{}
42 }%
43 }%
44
45
46 \pgfdeclareshape{strike out}
47 {%
48 \inheritsavedanchors[from=rectangle]% % this is nearly a rectangle
49 \inheritanchorborder[from=rectangle]%
50 \inheritanchor[from=rectangle]{north}%
51 \inheritanchor[from=rectangle]{north west}%
52 \inheritanchor[from=rectangle]{north east}%
53 \inheritanchor[from=rectangle]{center}%
54 \inheritanchor[from=rectangle]{west}%
55 \inheritanchor[from=rectangle]{east}%
56 \inheritanchor[from=rectangle]{mid}%
57 \inheritanchor[from=rectangle]{mid west}%
58 \inheritanchor[from=rectangle]{mid east}%
59 \inheritanchor[from=rectangle]{base}%
60 \inheritanchor[from=rectangle]{base west}%
61 \inheritanchor[from=rectangle]{base east}%
62 \inheritanchor[from=rectangle]{south}%
63 \inheritanchor[from=rectangle]{south west}%
64 \inheritanchor[from=rectangle]{south east}%
65 \foregroundpath{
66 \pgfpathmoveto{\southwest}
67 \pgfpathlineto{\northeast}
68 \pgfsetarrowsstart{}
69 \pgfsetarrowsend{}
70 }%
71 }%
72
73
74 % Rounded rectangle
75
76
77 \pgfkeys{/pgf/.cd,
78 rounded rectangle west arc/.initial=convex,
79 rounded rectangle east arc/.initial=convex,
80 rounded rectangle left arc/.style={/pgf/rounded rectangle west arc={#1}},%
81 rounded rectangle right arc/.style={/pgf/rounded rectangle east arc={#1}},%
82 rounded rectangle arc length/.initial=180%
83 }%
84
85 \def\pgf@lib@sh@misc@rr@text@concave{concave}%
86 \def\pgf@lib@sh@misc@rr@text@convex{convex}%
87
88 \pgfdeclareshape{rounded rectangle}{%
89 \savedmacro\westarc{%
90 \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
91 }%
92 \savedmacro\eastarc{%
93 \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
94 }%
95 \savedmacro\roundedrectanglepoints{%
96 %
97 % Get half the arc angle, a.
98 %
99 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}%
100 \pgf@x=.5\pgf@x%
101 \edef\halfarcangle{\pgfmath@tonumber{\pgf@x}}%
102 \addtosavedmacro\halfarcangle%
103 %
104 % Get the (half) node dimensions x & y.
105 %
106 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
107 \edef\innerxsep{\the\pgf@x}%
108 \pgf@xa=0.5\wd\pgfnodeparttextbox%
109 \edef\halftextwidth{\the\pgf@xa}%
110 \addtosavedmacro\halftextwidth%
111 \advance\pgf@x by\pgf@xa%
112 %
113 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
114 \edef\innerysep{\the\pgf@y}%
115 \pgf@ya=.5\ht\pgfnodeparttextbox%
116 \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
117 \edef\halftextheight{\the\pgf@ya}%
118 \addtosavedmacro\halftextheight%
119 \advance\pgf@y by\pgf@ya%
120 %
121 % Adjust for minimum height
122 %
123 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
124 \ifdim\pgf@y<.5\pgf@yb%
125 \pgf@y=.5\pgf@yb%
126 \fi%
127 \edef\halfheight{\the\pgf@y}%
128 \addtosavedmacro\halfheight%
129 %
130 % Calculate the radius of the arc ends.
131 %
132 \pgfmathcosec@{\halfarcangle}%
133 \pgf@ya=\pgfmathresult\pgf@y%
134 \edef\radius{\the\pgf@ya}%
135 \addtosavedmacro\radius%
136 %
137 % Arc width = r - r*cos(a/2).
138 %
139 \pgfmathcos@{\halfarcangle}%
140 \pgf@xa=\pgf@ya%
141 \advance\pgf@xa by-\pgfmathresult\pgf@ya%
142 %
143 % When the node contents are pushed inside a convex arc,
144 % the resulting chord has a height r - r*cos(asin(0.5*h/r)).
145 %
146 \pgfmathdivide{\halftextheight}{\radius}%
147 \pgfmathasin@{\pgfmathresult}%
148 \pgfmathcos@{\pgfmathresult}%
149 \pgf@xb=\pgf@ya%
150 \advance\pgf@xb by-\pgfmathresult\pgf@ya%
151 %
152 % Adjust for minimum width.
153 %
154 \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
155 \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
156 %
157 \pgfutil@tempdima=2.0\pgf@x% x still holds the half width.
158 \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
159 \advance\pgfutil@tempdima by\pgf@xa%
160 \else%
161 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
162 \advance\pgfutil@tempdima by\pgf@xb%
163 \fi%
164 \fi%
165 %
166 \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
167 \advance\pgfutil@tempdima by\pgf@xa%
168 \else%
169 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
170 \advance\pgfutil@tempdima by\pgf@xb%
171 \fi%
172 \fi%
173 %
174 \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
175 \ifdim\pgfutil@tempdima<\pgfutil@tempdimb%
176 \advance\pgfutil@tempdimb by-\pgfutil@tempdima%
177 \divide\pgfutil@tempdimb by2\relax%
178 \edef\xoffset{\the\pgfutil@tempdimb}%
179 \else%
180 \let\xoffset=\innerxsep%
181 \fi%
182 %
183 % The node is made wider if convex arcs overlap.
184 %
185 \pgf@x=\halftextwidth\relax%
186 \advance\pgf@x by\xoffset\relax%
187 \pgf@xc=\pgf@ya%
188 \advance\pgf@xc by-\pgf@xb%
189 \ifdim\pgf@xc>\pgf@x\relax%
190 \advance\pgf@xc by-\pgf@x%
191 \advance\pgf@xc by\xoffset\relax%
192 \edef\xoffset{\the\pgf@xc}%
193 \fi%
194 \addtosavedmacro\xoffset%
195 %
196 \pgf@x=\halftextwidth\relax%
197 \advance\pgf@x by\xoffset\relax%
198 \edef\halfwidth{\the\pgf@x}%
199 \addtosavedmacro\halfwidth%
200 %
201 \edef\arcwidth{\the\pgf@xa}%
202 \addtosavedmacro\arcwidth%
203 %
204 \edef\chordwidth{\the\pgf@xb}%
205 \addtosavedmacro\chordwidth%
206 %
207 \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}%
208 \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}%
209 \addtosavedmacro\outerxsep%
210 \addtosavedmacro\outerysep%
211 %
212 % calculate some horizontal adjustments made for the default miter
213 % drawn when an arc meets the north or south side of the node path.
214 %
215 \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
216 \def\concavexshift{0pt}%
217 \else%
218 % For a concave arc: outer xsep * cosec((90-a/2)/2)*cos((90-a/2)/2).
219 \pgfmathsubtract@{90}{\halfarcangle}%
220 \pgfmathdivide@{\pgfmathresult}{2}%
221 \let\angletemp=\pgfmathresult%
222 \pgf@x=\outerxsep\relax%
223 \pgfmathcosec@{\angletemp}%
224 \pgf@x=\pgfmathresult\pgf@x%
225 \pgfmathcos@{\angletemp}%
226 \pgf@x=\pgfmathresult\pgf@x%
227 \edef\concavexshift{\the\pgf@x}%
228 \fi%
229 \addtosavedmacro\concavexshift%
230 %
231 \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
232 \def\convexxshift{0pt}%
233 \else%
234 % For a convex arc: outer xsep * cosec((90+a/2)/2)*cos((90+a/2)/2).
235 \pgfmathadd@{90}{\halfarcangle}%
236 \pgfmathdivide@{\pgfmathresult}{2}%
237 \let\angletemp=\pgfmathresult%
238 \pgf@x=\outerxsep\relax%
239 \pgfmathcosec@{\angletemp}%
240 \pgf@x=\pgfmathresult\pgf@x%
241 \pgfmathcos@{\angletemp}%
242 \pgf@x=\pgfmathresult\pgf@x%
243 \edef\convexxshift{\the\pgf@x}%
244 \fi%
245 \addtosavedmacro\convexxshift%
246 }%
247 \saveddimen\halflinewidth{\[email protected]\pgflinewidth}%
248 \savedanchor\centerpoint{%
249 \pgf@x=.5\wd\pgfnodeparttextbox%
250 \pgf@y=.5\ht\pgfnodeparttextbox%
251 \advance\pgf@y by-.5\dp\pgfnodeparttextbox%
252 }%
253 \savedanchor\midpoint{%
254 \pgf@x=.5\wd\pgfnodeparttextbox%
255 \pgfmathsetlength\pgf@y{+0.5ex}%
256 }%
257 \savedanchor\basepoint{%
258 \pgf@x=.5\wd\pgfnodeparttextbox%
259 \pgf@y=0pt\relax%
260 }%
261 \anchor{center}{\centerpoint}%
262 \anchor{mid}{\midpoint}%
263 \anchor{mid west}{%
264 \csname pgf@anchor@rounded rectangle@west\endcsname%
265 \pgf@xc=\pgf@x%
266 \midpoint%
267 \pgf@x=\pgf@xc%
268 }%
269 \anchor{mid east}{%
270 \csname pgf@anchor@rounded rectangle@east\endcsname%
271 \pgf@xc=\pgf@x%
272 \midpoint%
273 \pgf@x=\pgf@xc%
274 }%
275 \anchor{base}{\basepoint}%
276 \anchor{base west}{%
277 \csname pgf@anchor@rounded rectangle@west\endcsname%
278 \pgf@xc=\pgf@x%
279 \basepoint%
280 \pgf@x=\pgf@xc%
281 }%
282 \anchor{base east}{%
283 \csname pgf@anchor@rounded rectangle@east\endcsname%
284 \pgf@xc=\pgf@x%
285 \basepoint%
286 \pgf@x=\pgf@xc%
287 }%
288 \anchor{north}{%
289 \roundedrectanglepoints%
290 \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{\halfheight+\outerysep}}%
291 }%
292 \anchor{south}{%
293 \roundedrectanglepoints%
294 \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{-\halfheight-\outerysep}}%
295 }%
296 \anchor{west}{%
297 \roundedrectanglepoints%
298 \pgfpointadd{\centerpoint}{%
299 \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
300 \pgfpoint{-\halfwidth-\arcwidth-\concavexshift}{+0pt}%
301 \else%
302 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
303 \pgfpoint{-\halfwidth-\chordwidth-\outerxsep}{+0pt}%
304 \else%
305 \pgfpoint{-\halfwidth-\outerxsep}{+0pt}%
306 \fi%
307 \fi%
308 }%
309 }%
310 \anchor{north west}{%
311 \roundedrectanglepoints%
312 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
313 \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
314 \else%
315 \csname pgf@anchor@rounded rectangle@west\endcsname%
316 \fi%
317 \pgf@xc=\pgf@x%
318 \csname pgf@anchor@rounded rectangle@north\endcsname%
319 \pgf@x=\pgf@xc%
320 }%
321 \anchor{south west}{%
322 \roundedrectanglepoints%
323 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
324 \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
325 \else%
326 \csname pgf@anchor@rounded rectangle@west\endcsname%
327 \fi%
328 \pgf@xc=\pgf@x%
329 \csname pgf@anchor@rounded rectangle@south\endcsname%
330 \pgf@x=\pgf@xc%
331 }%
332 \anchor{east}{%
333 \roundedrectanglepoints%
334 \pgfpointadd{\centerpoint}{%
335 \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
336 \pgfpoint{\halfwidth+\arcwidth+\concavexshift}{+0pt}%
337 \else%
338 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
339 \pgfpoint{\halfwidth+\chordwidth+\outerxsep}{+0pt}%
340 \else%
341 \pgfpoint{\halfwidth+\outerxsep}{+0pt}%
342 \fi%
343 \fi%
344 }%
345 }%
346 \anchor{north east}{%
347 \roundedrectanglepoints%
348 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
349 \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
350 \else%
351 \csname pgf@anchor@rounded rectangle@east\endcsname%
352 \fi%
353 \pgf@xc=\pgf@x%
354 \csname pgf@anchor@rounded rectangle@north\endcsname%
355 \pgf@x=\pgf@xc%
356 }%
357 \anchor{south east}{%
358 \roundedrectanglepoints%
359 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
360 \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
361 \else%
362 \csname pgf@anchor@rounded rectangle@east\endcsname%
363 \fi%
364 \pgf@xc=\pgf@x%
365 \csname pgf@anchor@rounded rectangle@south\endcsname%
366 \pgf@x=\pgf@xc%
367 }%
368 \backgroundpath{%
369 {%
370 \roundedrectanglepoints%
371 \pgftransformshift{\centerpoint}%
372 \pgfpathmoveto{\pgfpoint{0pt}{\halfheight}}%
373 \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
374 \pgfpathlineto{\pgfpoint{\halfwidth+\arcwidth}{+\halfheight}}%
375 \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{+\radius}%
376 \else%
377 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
378 \pgfpathlineto{\pgfpoint{\halfwidth+\chordwidth-\arcwidth}{+\halfheight}}%
379 \pgfpatharc{+\halfarcangle}{+-\halfarcangle}{+\radius}%
380 \else%
381 \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
382 \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
383 \fi%
384 \fi%
385 \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
386 \pgfpathlineto{\pgfpoint{-\halfwidth-\arcwidth}{+-\halfheight}}%
387 \pgfpatharc{+-\halfarcangle}{+\halfarcangle}{+\radius}%
388 \else%
389 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
390 \pgfpathlineto{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth}{+-\halfheight}}%
391 \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{+\radius}%
392 \else%
393 \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
394 \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
395 \fi%
396 \fi%
397 \pgfpathclose%
398 }%
399 }%
400 \anchorborder{%
401 \pgfextract@process\externalpoint{%
402 \pgfextract@process\externalpoint{}%
403 \pgfpointadd{\centerpoint}{\externalpoint}%
404 }%
405 \roundedrectanglepoints%
406 %
407 \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
408 \let\externalangle=\pgfmathresult%
409 \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}%
410 \ifdim\externalangle pt<\pgfmathresult pt\relax%
411 \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
412 \ifdim\externalangle pt<\pgfmathresult pt\relax%
413 % Between north east and east.
414 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
415 \pgfextract@process\arccenter{%
416 \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
417 }%
418 \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
419 {\arccenter}{0}{\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
420 \else%
421 \pgfpointintersectionoflines%
422 {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
423 {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
424 {\externalpoint}{\centerpoint}%
425 \fi%
426 \else%
427 % Between north west and north east.
428 \pgfpointintersectionoflines%
429 {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
430 {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
431 {\externalpoint}{\centerpoint}%
432 \fi%
433 \else%
434 \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
435 \ifdim\externalangle pt<\pgfmathresult pt\relax%
436 % Between south west and north west.
437 \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
438 \pgfextract@process\arccenter{%
439 \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\radius}{+0pt}}%
440 }%
441 \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
442 {\arccenter}{180-\halfarcangle}{180+\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
443 \else%
444 \pgfpointintersectionoflines%
445 {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
446 {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
447 {\externalpoint}{\centerpoint}%
448 \fi%
449 \else%
450 \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}%
451 \ifdim\externalangle pt<\pgfmathresult pt\relax%
452 % Between south east and south west.
453 \pgfpointintersectionoflines%
454 {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
455 {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
456 {\externalpoint}{\centerpoint}%
457 \else%
458 % Between east and south east.
459 \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
460 \pgfextract@process\arccenter{%
461 \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
462 }%
463 \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
464 {\arccenter}{360-\halfarcangle}{360}{\radius+\outerxsep and \radius+\outerysep}%
465 \else%
466 \pgfpointintersectionoflines%
467 {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
468 {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
469 {\externalpoint}{\centerpoint}%
470 \fi%
471 \fi%
472 \fi%
473 \fi%
474 }%
475 }%
476
477
478
479 % Keys for chamfered rectangle
480 %
481 % /pgf/chamfered rectangle corners : specify the corners to chamfer.
482 % /pgf/chamfered rectangle angle : set the angle of the chamfer.
483 % /pgf/chamfered rectangle xsep : set the extent of the x chamferling.
484 % /pgf/chamfered rectangle ysep : set the extent of the y chamferling.
485
486 \pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}%
487 \pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}%
488
489 \def\pgf@lib@sh@misc@cr@chamferall{chamfer all}%
490 \def\pgf@lib@sh@misc@cr@chamfer{chamfer}%
491 \let\pgf@lib@sh@misc@cr@corners\pgf@lib@sh@misc@cr@chamferall
492
493
494 \def\pgf@lib@sh@misc@cr@getcorners{%
495 \let\northeastcorner\pgfutil@empty%
496 \let\southeastcorner\pgfutil@empty%
497 \let\southwestcorner\pgfutil@empty%
498 \let\northwestcorner\pgfutil@empty%
499 \expandafter\pgfutil@in@\expandafter{\pgf@lib@sh@misc@cr@corners}{chamfer all}%
500 \ifpgfutil@in@%
501 \let\northeastcorner\pgf@lib@sh@misc@cr@round%
502 \let\southeastcorner\pgf@lib@sh@misc@cr@round%
503 \let\southwestcorner\pgf@lib@sh@misc@cr@round%
504 \let\northwestcorner\pgf@lib@sh@misc@cr@round%
505 \let\pgf@next\relax%
506 \else%
507 \let\pgf@next\pgf@lib@sh@misc@cr@parsecorners%
508 \fi%
509 \pgf@next}%
510
511 \def\pgf@lib@sh@misc@cr@parsecorners{%
512 \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@lib@sh@misc@cr@corners,\pgf@stop,%
513 }%
514
515 \def\pgf@@chamferedrectangle@parsecorners#1,{%
516 \ifx#1\pgf@stop%
517 \let\pgf@next\relax%
518 \else%
519 \pgfutil@in@{@#1@}{@north east@@top left@}%
520 \ifpgfutil@in@%
521 \let\northeastcorner\pgf@lib@sh@misc@cr@chamfer%
522 \else%
523 \pgfutil@in@{@#1@}{@south east@@bottom right@}%
524 \ifpgfutil@in@%
525 \let\southeastcorner\pgf@lib@sh@misc@cr@chamfer%
526 \else%
527 \pgfutil@in@{@#1@}{@south west@@bottom left@}%
528 \ifpgfutil@in@%
529 \let\southwestcorner\pgf@lib@sh@misc@cr@chamfer%
530 \else%
531 \pgfutil@in@{@#1@}{@north west@@top right@}%
532 \ifpgfutil@in@%
533 \let\northwestcorner\pgf@lib@sh@misc@cr@round%
534 \fi%
535 \fi%
536 \fi%
537 \fi%
538 \let\pgf@next\pgf@@@chamferedrectangle@parsecorners%
539 \fi%
540 \pgf@next%
541 }%
542 \def\pgf@@@chamferedrectangle@parsecorners{%
543 \pgfutil@ifnextchar x{\pgf@@chamferedrectangle@parsecorners}{\pgf@@chamferedrectangle@parsecorners}%
544 }%
545
546 \pgfkeys{/pgf/.cd,
547 chamfered rectangle angle/.initial=45,%
548 chamfered rectangle xsep/.initial=.666ex,%
549 chamfered rectangle ysep/.initial=.666ex%
550 }%
551 \pgfkeys{/pgf/chamfered rectangle sep/.style={%
552 /pgf/chamfered rectangle xsep={#1},/pgf/chamfered rectangle ysep={#1}}%
553 }%
554
555
556
557
558 % Shape chamfered rectangle.
559 %
560 %
561 \pgfdeclareshape{chamfered rectangle}{%
562 \savedmacro\getchamferedrectanglepoints{%
563 \pgf@lib@sh@misc@cr@getcorners%
564 %
565 % Get the node dimensions.
566 %
567 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
568 \advance\[email protected]\wd\pgfnodeparttextbox%
569 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
570 \advance\[email protected]\ht\pgfnodeparttextbox%
571 \advance\[email protected]\dp\pgfnodeparttextbox%
572 %
573 % Get chamfer stuff.
574 %
575 \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/chamfered rectangle angle}}%
576 \ifdim\pgfutil@tempdima<89pt\relax%
577 \ifdim\pgfutil@tempdima<1pt\relax%
578 \pgfutil@tempdima1pt\relax%
579 \fi%
580 \else%
581 \pgfutil@tempdima89pt\relax%
582 \fi%
583 \pgfutil@tempdima-\pgfutil@tempdima%
584 \advance\pgfutil@tempdima90pt\relax%
585 \pgfmathtan@{\pgfmath@tonumber{\pgfutil@tempdima}}%
586 \let\tanangle\pgfmathresult%
587 \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}%
588 \let\cotangle\pgfmathresult%
589 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/chamfered rectangle xsep}}%
590 \pgf@yc\tanangle\pgf@xb%
591 \ifdim\pgf@yc>\pgf@ya%
592 \pgf@yc\pgf@ya%
593 \pgf@xb\cotangle\pgf@yc%
594 \fi%
595 \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}%
596 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/chamfered rectangle ysep}}%
597 \pgf@xc\cotangle\pgf@yb%
598 \ifdim\pgf@xc>\pgf@xa%
599 \pgf@xc\pgf@xa%
600 \pgf@yb\tanangle\pgf@xc%
601 \fi%
602 %
603 % Check for minimum width and height%
604 %
605 \pgfutil@tempdima\pgf@xa%
606 \advance\pgfutil@tempdima\pgf@xb%
607 \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
608 \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb%
609 \[email protected]\pgfutil@tempdimb%
610 \advance\pgf@xa-\pgf@xb%
611 \fi%
612 \pgfutil@tempdima\pgf@ya%
613 \advance\pgfutil@tempdima\pgf@yb%
614 \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}%
615 \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb%
616 \[email protected]\pgfutil@tempdimb%
617 \advance\pgf@ya-\pgf@yb%
618 \fi%
619 %
620 % Define the background path points.
621 %
622 \pgfextract@process\centerpoint{%
623 \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
624 \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
625 \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}%
626 }%
627 \pgfextract@process\beforenortheast{%
628 \centerpoint%
629 \advance\pgf@x\pgf@xa%
630 \advance\pgf@x\pgf@xb%
631 \advance\pgf@y\pgf@ya%
632 \advance\pgf@y-\pgf@yc%
633 }%
634 \pgfextract@process\northeast{%
635 \centerpoint%
636 \advance\pgf@x\pgf@xa%
637 \advance\pgf@y\pgf@ya%
638 \ifx\northeastcorner\pgfutil@empty%
639 \advance\pgf@x\pgf@xb%
640 \advance\pgf@y\pgf@yb%
641 \fi%
642 }%
643 \pgfextract@process\afternortheast{%
644 \centerpoint%
645 \advance\pgf@x\pgf@xa%
646 \advance\pgf@x-\pgf@xc%
647 \advance\pgf@y\pgf@ya%
648 \advance\pgf@y\pgf@yb%
649 }%
650 \pgfextract@process\northwest{%
651 \centerpoint%
652 \advance\pgf@x-\pgf@xa%
653 \advance\pgf@y\pgf@ya%
654 \ifx\northwestcorner\pgfutil@empty%
655 \advance\pgf@x-\pgf@xb%
656 \advance\pgf@y\pgf@yb%
657 \fi%
658 }%
659 \pgfextract@process\beforesouthwest{%
660 \centerpoint%
661 \advance\pgf@x-\pgf@xa%
662 \advance\pgf@x-\pgf@xb%
663 \advance\pgf@y-\pgf@ya%
664 \advance\pgf@y\pgf@yc%
665 }%
666 \pgfextract@process\southwest{%
667 \centerpoint%
668 \advance\pgf@x-\pgf@xa%
669 \advance\pgf@y-\pgf@ya%
670 \ifx\southwestcorner\pgfutil@empty%
671 \advance\pgf@x-\pgf@xb%
672 \advance\pgf@y-\pgf@yb%
673 \fi%
674 }%
675 \pgfextract@process\aftersouthwest{%
676 \centerpoint%
677 \advance\pgf@x-\pgf@xa%
678 \advance\pgf@x\pgf@xc%
679 \advance\pgf@y-\pgf@ya%
680 \advance\pgf@y-\pgf@yb%
681 }%
682 \pgfextract@process\southeast{%
683 \centerpoint%
684 \advance\pgf@x\pgf@xa%
685 \advance\pgf@y-\pgf@ya%
686 \ifx\southeastcorner\pgfutil@empty%
687 \advance\pgf@x\pgf@xb%
688 \advance\pgf@y-\pgf@yb%
689 \fi%
690 }%
691 %
692 % Calculate the `miter' vectors.
693 %
694 \pgfmathanglebetweenlines{\beforenortheast}{\afternortheast}{\beforenortheast}%
695 {\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}%
696 \pgfutil@tempdima\pgfmathresult pt\relax%
697 \ifdim\pgfutil@tempdima>180pt\relax%
698 \advance\pgfutil@tempdima-180pt\relax%
699 \fi%
700 \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer xsep}}%
701 \ifdim\pgfutil@tempdima<90pt\relax%
702 \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
703 \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
704 \pgfutil@tempdima0pt\relax%
705 \else%
706 \[email protected]\pgfutil@tempdima%
707 \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
708 \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
709 \pgfutil@tempdima-\pgfutil@tempdima%
710 \advance\pgfutil@tempdima90pt\relax%
711 \fi%
712 \pgfextract@process\before@ne@anchor{%
713 \beforenortheast%
714 \pgf@xa\pgf@x%
715 \pgf@ya\pgf@y%
716 \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
717 \advance\pgf@x\pgf@xa%
718 \advance\pgf@y\pgf@ya%
719 }%
720 \pgfutil@tempdima-\pgfutil@tempdima%
721 \advance\pgfutil@tempdima180pt\relax%
722 \pgfextract@process\before@sw@anchor{%
723 \beforesouthwest%
724 \pgf@xa\pgf@x%
725 \pgf@ya\pgf@y%
726 \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
727 \advance\pgf@x\pgf@xa%
728 \advance\pgf@y\pgf@ya%
729 }%
730 %
731 \pgfmathanglebetweenlines{\afternortheast}{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}%
732 {\afternortheast}{\beforenortheast}%
733 \pgfutil@tempdima\pgfmathresult pt\relax%
734 \ifdim\pgfutil@tempdima>270pt\relax%
735 \advance\pgfutil@tempdima-270pt\relax%
736 \fi%
737 \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer ysep}}%
738 \ifdim\pgfutil@tempdima<90pt\relax%
739 \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
740 \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
741 \pgfutil@tempdima90pt\relax%
742 \else%
743 \[email protected]\pgfutil@tempdima%
744 \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
745 \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
746 \fi%
747 %
748 \pgfextract@process\after@ne@anchor{%
749 \afternortheast%
750 \pgf@xa\pgf@x%
751 \pgf@ya\pgf@y%
752 \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
753 \advance\pgf@x\pgf@xa%
754 \advance\pgf@y\pgf@ya%
755 }%
756 \pgfutil@tempdima-\pgfutil@tempdima%
757 \advance\pgfutil@tempdima180pt\relax%
758 \pgfextract@process\after@sw@anchor{%
759 \aftersouthwest
760 \pgf@xa\pgf@x%
761 \pgf@ya\pgf@y%
762 \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
763 \advance\pgf@x\pgf@xa%
764 \advance\pgf@y\pgf@ya%
765 }%
766 \addtosavedmacro\before@ne@anchor%
767 \addtosavedmacro\after@ne@anchor%
768 \addtosavedmacro\before@sw@anchor%
769 \addtosavedmacro\after@sw@anchor%
770 \pgfextract@process\ne@anchor{%
771 \ifx\northeastcorner\pgfutil@empty%
772 \northeast%
773 \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
774 \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
775 \else%
776 \pgfpointlineattime{0.5}{\before@ne@anchor}{\after@ne@anchor}%
777 \fi%
778 }%
779 \pgfextract@process\nw@anchor{%
780 \ifx\northwestcorner\pgfutil@empty%
781 \northwest%
782 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
783 \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
784 \else%
785 \pgfpointlineattime{0.5}{%
786 \before@ne@anchor%
787 \pgf@ya\pgf@y
788 \before@sw@anchor%
789 \pgf@y\pgf@ya%
790 }{%
791 \after@ne@anchor%
792 \pgf@ya\pgf@y
793 \after@sw@anchor%
794 \pgf@y\pgf@ya%
795 }%
796 \fi%
797 }%
798 \pgfextract@process\sw@anchor{%
799 \ifx\southwestcorner\pgfutil@empty%
800 \southwest%
801 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
802 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
803 \else%
804 \pgfpointlineattime{0.5}{\before@sw@anchor}{\after@sw@anchor}%
805 \fi%
806 }%
807 \pgfextract@process\se@anchor{%
808 \ifx\southeastcorner\pgfutil@empty%
809 \southeast%
810 \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
811 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
812 \else%
813 \pgfpointlineattime{0.5}{%
814 \before@ne@anchor%
815 \pgf@xa\pgf@x
816 \before@sw@anchor%
817 \pgf@x\pgf@xa%
818 }{%
819 \after@ne@anchor%
820 \pgf@xa\pgf@x
821 \after@sw@anchor%
822 \pgf@x\pgf@xa%
823 }%
824 \fi%
825 }%
826 \addtosavedmacro\ne@anchor%
827 \addtosavedmacro\nw@anchor%
828 \addtosavedmacro\sw@anchor%
829 \addtosavedmacro\se@anchor%
830 }%
831 \savedanchor\centerpoint{%
832 \[email protected]\wd\pgfnodeparttextbox%
833 \[email protected]\ht\pgfnodeparttextbox%
834 \advance\[email protected]\dp\pgfnodeparttextbox%
835 }%
836 \savedanchor\midpoint{%
837 \[email protected]\wd\pgfnodeparttextbox%
838 \pgfmathsetlength\pgf@y{+.5ex}%
839 }%
840 \savedanchor\basepoint{%
841 \[email protected]\wd\pgfnodeparttextbox%
842 \pgf@y0pt%
843 }%
844 \anchor{center}{\centerpoint}%
845 \anchor{mid}{\midpoint}%
846 \anchor{mid east}{%
847 \getchamferedrectanglepoints%
848 \midpoint%
849 \pgf@ya\pgf@y%
850 \pgf@process{%
851 \before@sw@anchor%
852 \pgf@ya\pgf@y%
853 \before@ne@anchor%
854 \pgf@y\pgf@ya%
855 }%
856 \ifdim\pgf@ya<\pgf@y%
857 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
858 {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
859 {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}%
860 \else%
861 \pgf@process{\before@ne@anchor}%
862 \ifdim\pgf@ya<\pgf@y%
863 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
864 {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
865 {\before@ne@anchor}%
866 \else%
867 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
868 {\before@ne@anchor}%
869 {\after@ne@anchor}%
870 \fi%
871 \fi%
872 }%
873 \anchor{mid west}{%
874 \getchamferedrectanglepoints%
875 \midpoint%
876 \pgf@ya\pgf@y%
877 \pgf@process{\before@sw@anchor}%
878 \ifdim\pgf@ya<\pgf@y%
879 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
880 {\before@sw@anchor}{\after@sw@anchor}%
881 \else%
882 \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
883 \ifdim\pgf@ya<\pgf@y%
884 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
885 {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
886 {\before@sw@anchor}%
887 \else%
888 \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
889 {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
890 {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}%
891 \fi%
892 \fi%
893 }%
894 \anchor{base}{\basepoint}%
895 \anchor{base east}{%
896 \getchamferedrectanglepoints%
897 \basepoint%
898 \pgf@ya\pgf@y%
899 \pgf@process{%
900 \before@sw@anchor%
901 \pgf@ya\pgf@y%
902 \before@ne@anchor%
903 \pgf@y\pgf@ya%
904 }%
905 \ifdim\pgf@ya<\pgf@y%
906 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
907 {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
908 {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}%
909 \else%
910 \pgf@process{\before@ne@anchor}%
911 \ifdim\pgf@ya<\pgf@y%
912 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
913 {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
914 {\before@ne@anchor}%
915 \else%
916 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
917 {\before@ne@anchor}%
918 {\after@ne@anchor}%
919 \fi%
920 \fi%
921 }%
922 \anchor{base west}{%
923 \getchamferedrectanglepoints%
924 \basepoint%
925 \pgf@ya\pgf@y%
926 \pgf@process{\before@sw@anchor}%
927 \ifdim\pgf@ya<\pgf@y%
928 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
929 {\before@sw@anchor}{\after@sw@anchor}%
930 \else%
931 \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
932 \ifdim\pgf@ya<\pgf@y%
933 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
934 {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
935 {\before@sw@anchor}%
936 \else%
937 \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
938 {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
939 {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}%
940 \fi%
941 \fi%
942 }%
943 \anchor{before north east}{\getchamferedrectanglepoints\before@ne@anchor}%
944 \anchor{north east}{\getchamferedrectanglepoints\ne@anchor}%
945 \anchor{after north east}{\getchamferedrectanglepoints\after@ne@anchor}%
946 \anchor{north}{%
947 \getchamferedrectanglepoints%
948 \centerpoint%
949 \pgf@xa\pgf@x%
950 \after@ne@anchor%
951 \pgf@x\pgf@xa}%
952 \anchor{before north west}{%
953 \getchamferedrectanglepoints%
954 \after@sw@anchor%
955 \pgf@xa\pgf@x%
956 \after@ne@anchor%
957 \pgf@x\pgf@xa}%
958 \anchor{north west}{\getchamferedrectanglepoints\nw@anchor}%
959 \anchor{after north west}{%
960 \getchamferedrectanglepoints%
961 \before@sw@anchor%
962 \pgf@xa\pgf@x%
963 \before@ne@anchor%
964 \pgf@x\pgf@xa}%
965 \anchor{west}{%
966 \getchamferedrectanglepoints%
967 \centerpoint%
968 \pgf@ya\pgf@y%
969 \before@sw@anchor%
970 \pgf@y\pgf@ya}%
971 \anchor{before south west}{\getchamferedrectanglepoints\before@sw@anchor}%
972 \anchor{south west}{\getchamferedrectanglepoints\sw@anchor}%
973 \anchor{after south west}{\getchamferedrectanglepoints\after@sw@anchor}%
974 \anchor{south}{%
975 \getchamferedrectanglepoints%
976 \centerpoint%
977 \pgf@xa\pgf@x%
978 \after@sw@anchor%
979 \pgf@x\pgf@xa}%
980 \anchor{before south east}{%
981 \getchamferedrectanglepoints%
982 \after@sw@anchor%
983 \pgf@ya\pgf@y%
984 \after@ne@anchor%
985 \pgf@y\pgf@ya}%
986 \anchor{south east}{\getchamferedrectanglepoints\se@anchor}%
987 \anchor{after south east}{%
988 \getchamferedrectanglepoints%
989 \before@sw@anchor%
990 \pgf@ya\pgf@y%
991 \before@ne@anchor%
992 \pgf@y\pgf@ya}%
993 \anchor{east}{%
994 \getchamferedrectanglepoints%
995 \centerpoint%
996 \pgf@ya\pgf@y%
997 \before@ne@anchor%
998 \pgf@y\pgf@ya}%
999 \backgroundpath{%
1000 \pgfpathmoveto{\beforenortheast}%
1001 \pgfpathlineto{\northeast}%
1002 \pgfpathlineto{\afternortheast}%
1003 \pgfpathlineto{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}%
1004 \pgfpathlineto{\northwest}%
1005 \pgfpathlineto{\beforesouthwest\pgf@xa\pgf@x\beforenortheast\pgf@x\pgf@xa}%
1006 \pgfpathlineto{\beforesouthwest}%
1007 \pgfpathlineto{\southwest}%
1008 \pgfpathlineto{\aftersouthwest}%
1009 \pgfpathlineto{\aftersouthwest\pgf@ya\pgf@y\afternortheast\pgf@y\pgf@ya}%
1010 \pgfpathlineto{\southeast}%
1011 \pgfpathlineto{\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}%
1012 \pgfpathclose%
1013 }%
1014 \anchorborder{%
1015 \pgfextract@process\externalpoint{%
1016 \pgf@xa\pgf@x%
1017 \pgf@ya\pgf@y%
1018 \centerpoint%
1019 \advance\pgf@x\pgf@xa%
1020 \advance\pgf@y\pgf@ya%
1021 }%
1022 \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
1023 \let\externalangle\pgfmathresult%
1024 \getchamferedrectanglepoints%
1025 \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
1026 \ifdim\externalangle pt<\pgfmathresult pt\relax% west.
1027 \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1028 \ifdim\externalangle pt<\pgfmathresult pt\relax% north.
1029 \pgfmathanglebetweenpoints{\centerpoint}{\ne@anchor}%
1030 \ifdim\externalangle pt<\pgfmathresult pt\relax% north east.
1031 \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor}%
1032 \ifdim\externalangle pt<\pgfmathresult pt\relax% before north east.
1033 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1034 {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}{\before@ne@anchor}%
1035 \else%
1036 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1037 {\before@ne@anchor}{\ne@anchor}%
1038 \fi%
1039 \else%
1040 \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor}%
1041 \ifdim\externalangle pt<\pgfmathresult pt\relax% after north east.
1042 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1043 {\ne@anchor}{\after@ne@anchor}%
1044 \else%
1045 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1046 {\after@ne@anchor}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1047 \fi%
1048 \fi%
1049 \else%
1050 \pgfmathanglebetweenpoints{\centerpoint}{\nw@anchor}%
1051 \ifdim\externalangle pt<\pgfmathresult pt\relax% north west.
1052 \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1053 \ifdim\externalangle pt<\pgfmathresult pt\relax% before north west.
1054 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1055 {\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1056 {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1057 \else%
1058 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1059 {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
1060 {\nw@anchor}%
1061 \fi%
1062 \else%
1063 \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
1064 \ifdim\externalangle pt<\pgfmathresult pt\relax% after north west.
1065 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1066 {\nw@anchor}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
1067 \else%
1068 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1069 {\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
1070 {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}%
1071 \fi%
1072 \fi%
1073 \fi%
1074 \else%
1075 \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
1076 \ifdim\externalangle pt<\pgfmathresult pt\relax% south.
1077 \pgfmathanglebetweenpoints{\centerpoint}{\sw@anchor}%
1078 \ifdim\externalangle pt<\pgfmathresult pt\relax% south west.
1079 \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor}%
1080 \ifdim\externalangle pt<\pgfmathresult pt\relax% before south west.
1081 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1082 {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}%
1083 {\before@sw@anchor}%
1084 \else%
1085 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1086 {\before@sw@anchor}{\sw@anchor}%
1087 \fi%
1088 \else%
1089 \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor}%
1090 \ifdim\externalangle pt<\pgfmathresult pt\relax% after south west.
1091 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1092 {\sw@anchor}{\after@sw@anchor}%
1093 \else%
1094 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1095 {\after@sw@anchor}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
1096 \fi%
1097 \fi%
1098 \else%
1099 \pgfmathanglebetweenpoints{\centerpoint}{\se@anchor}%
1100 \ifdim\externalangle pt<\pgfmathresult pt\relax% south east.
1101 \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
1102 \ifdim\externalangle pt<\pgfmathresult pt\relax% before south east.
1103 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1104 {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
1105 {\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
1106 \else%
1107 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1108 {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}{\se@anchor}
1109 \fi%
1110 \else%
1111 \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
1112 \ifdim\externalangle pt<\pgfmathresult pt\relax% after south east.
1113 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1114 {\se@anchor}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
1115 \else%
1116 \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
1117 {\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
1118 {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
1119 \fi%
1120 \fi%
1121 \fi%
1122 \fi%
1123 }%
1124 }%
1125
1126
1127 \endinput