summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/libraries/shapes
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries/shapes')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex680
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex176
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex733
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex2525
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex98
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex2358
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex951
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex21
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex4419
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex1123
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex1354
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex2571
12 files changed, 17009 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex
new file mode 100644
index 00000000000..e79634a06ea
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex
@@ -0,0 +1,680 @@
+% Copyright 2008 by Till Tantau and others Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+
+%
+% Resistor shape based on a zig-zag-line
+%
+
+\pgfdeclareshape{var resistor IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Middle line
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ % Height
+ \pgf@xc=-.5\pgf@ya
+ \advance\pgf@xc by.5\pgf@yb
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ % Lines
+ \advance\pgf@xb by.1pt%
+ \pgfutil@loop%
+ \advance\pgf@xa by4\pgf@xc\relax%
+ \ifdim\pgf@xa<\pgf@xb%
+ \advance\pgf@xa by-3\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
+ \advance\pgf@xa by2\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \advance\pgf@xa by\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yc}}%
+ \pgfutil@repeat%
+ \advance\pgf@xb by-.1pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}%
+ }
+}
+
+
+
+%
+% Inductor shape based on a bumpy line
+%
+
+\pgfdeclareshape{inductor IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Height
+ \pgf@xc=\pgf@yb%
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ % Lines
+ \advance\pgf@xb by.1pt%
+ \pgfutil@loop%
+ \advance\pgf@xa by2\pgf@xc\relax%
+ \ifdim\pgf@xa<\pgf@xb%
+ \pgfpatharc{180}{0}{\pgf@xc}%
+ \pgfutil@repeat%
+ \advance\pgf@xb by-.1pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}%
+ }
+}
+
+
+
+
+%
+% Simple capacitor, consisting of two parallel lines
+%
+
+\pgfdeclareshape{capacitor IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+
+%
+% Simple ground, consisting of three lines, getting smaller
+%
+
+\pgfdeclareshape{ground IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % First line, simple
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Advance to middle
+ \pgfmathsetlength\pgf@xa{.5\pgf@xa+.5\pgf@xb}
+ % Make smaller
+ \pgfmathsetlength\pgf@yc{.16666\pgf@yb-.16666\pgf@ya}
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Make even smaller
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+%
+% Battery, consisting of two parallel lines, one smaller than
+% the other
+%
+
+\pgfdeclareshape{battery IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % First line, simple
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Make smaller
+ \pgfmathsetlength\pgf@yc{.25\pgf@yb-.25\pgf@ya}
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+%
+% Special diodes
+%
+
+
+\pgfdeclareshape{breakdown diode IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@xc=.5\pgf@xa \advance\pgf@xc by.5\pgf@xb
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by .5\pgf@yb
+ % Triangles:
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgfpathclose
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ \pgfpathclose
+ }
+
+
+ \beforebackgroundpath{
+ {
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfusepathqstroke
+ \pgf@xc=.5\pgf@xa
+ \advance\pgf@xc by.5\pgf@xb
+ \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgf@yc=.5\pgf@yb
+ \advance\pgf@yc by-.5\pgf@ya
+ \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
+ \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
+ \pgfpathlineto{\pgfqpoint{.5pt}{1pt}}
+ \pgfusepathqstroke
+ }
+ }
+}
+
+
+
+
+
+
+% Generic shapes
+%
+% When these shapes are used, you can set a key derived form the
+% shapes name to some code that will be executed as the before
+% background path. This means that the basic shape is fixed, but
+% things like a special line inside the shape or at the border can be
+% added without having to define a whole new shape.
+
+
+\pgfdeclareshape{generic circle IEC}
+{
+ % This shape is a generic circle, to which you can add something to
+ % the before background path using the key
+ % /pgf/generic circle IEC/before background
+ % When this key is invoked, the transformation matrix will have been
+ % setup such that the circle's center is at the origin and that the
+ % position \pgfpoint{1pt}{0pt} lies exactly on the top of the circle
+ % (and, there, on the middle of the line).
+
+ \inheritsavedanchors[from=circle ee]
+ \inheritanchorborder[from=circle ee]
+ \inheritanchor[from=circle ee]{north}
+ \inheritanchor[from=circle ee]{north west}
+ \inheritanchor[from=circle ee]{north east}
+ \inheritanchor[from=circle ee]{center}
+ \inheritanchor[from=circle ee]{west}
+ \inheritanchor[from=circle ee]{east}
+ \inheritanchor[from=circle ee]{south}
+ \inheritanchor[from=circle ee]{south west}
+ \inheritanchor[from=circle ee]{south east}
+ \inheritanchor[from=circle ee]{input}
+ \inheritanchor[from=circle ee]{output}
+ \inheritbackgroundpath[from=circle ee]
+
+ \beforebackgroundpath{
+ {
+ \centerpoint%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgftransformshift{}
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgftransformscale{\pgf@sys@tonumber{\pgfutil@tempdima}}
+ \pgfkeysvalueof{/pgf/generic circle IEC/before background}
+ }
+ }
+}
+
+
+
+%
+% Generic diode, based on a rectangle
+%
+
+\pgfdeclareshape{generic diode IEC}
+{
+ % This shape is a generic diode, to which you can add something to
+ % the before background path using the key
+ % /pgf/generic diode IEC/before background
+ % When this key is invoked, the transformation matrix will have been
+ % setup such that the center is at the tip of the diode. The
+ % position \pgfpoint{1pt}{0pt} lies exactly on the top of the
+ % (suggested) line before the diode.
+
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Move tip back a little bit
+ \advance\pgf@xb by-.5\pgflinewidth
+ % Triangle triangle:
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by .5\pgf@yb
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfpathclose
+ }
+
+
+ \beforebackgroundpath{
+ {
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfusepathqstroke
+ \pgftransformshift{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgf@yc=.5\pgf@yb
+ \advance\pgf@yc by-.5\pgf@ya
+ \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
+ \pgfkeysvalueof{/pgf/generic diode IEC/before background}
+ }
+ }
+}
+
+
+\pgfkeys{
+ /pgf/generic circle IEC/before background/.initial=,
+ /pgf/generic diode IEC/before background/.initial=,
+}
+
+
+
+
+
+%
+% Concacts
+%
+
+\pgfdeclareshape{make contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+%
+% Concacts
+%
+
+\pgfdeclareshape{var make contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ \pgf@xc=0.083333\pgf@x%
+ \advance\pgf@y by\pgf@xc%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{
+ \pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@xc=\pgf@xa
+ \pgfutil@tempdima=2\pgf@xb%
+ \pgfutil@tempdima=0.083333\pgfutil@tempdima%
+ \advance\pgf@xa by \pgfutil@tempdima
+ % Circle
+ {\pgfpathcircle{\pgfqpoint{\pgf@xa}{0pt}}{\pgfutil@tempdima}}
+ % Height
+ % Start point
+ \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgfqpoint{\pgf@xa}{0pt}}{\pgfqpoint{\pgf@xb}{\pgf@yb}}}}
+ \pgf@xc=\pgf@x
+ \pgf@yc=\pgf@y
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xa}{0pt}}{%
+ \pgfpointscale{\pgfutil@tempdima}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+\pgfdeclareshape{break contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ % Break point
+ \pgf@xc=.2\pgf@xb
+ \advance\pgf@xc by-.2\pgf@xa
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{0pt}}
+ \advance\pgf@xb by-\pgf@xc
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex
new file mode 100644
index 00000000000..ddf8a29f629
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex
@@ -0,0 +1,176 @@
+% Copyright 2008 by Till Tantau and others Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+
+
+%
+% Base shapes
+%
+% These shapes are identical to the shapes without "ee", only an "input"
+% and an "output" anchor have been added at the left and right end.
+
+\pgfdeclareshape{rectangle ee}
+{
+ \inheritsavedanchors[from=rectangle]
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
+ \inheritbackgroundpath[from=rectangle]
+ % New:
+ \anchor{input}{
+ \pgf@process{\northeast}%
+ \pgf@ya=.5\pgf@y%
+ \pgf@process{\southwest}%
+ \pgf@y=.5\pgf@y%
+ \advance\pgf@y by \pgf@ya%
+ }
+ \anchor{output}{%
+ \pgf@process{\southwest}%
+ \pgf@ya=.5\pgf@y%
+ \pgf@process{\northeast}%
+ \pgf@y=.5\pgf@y%
+ \advance\pgf@y by \pgf@ya%
+ }
+}
+
+\pgfdeclareshape{circle ee}
+{
+ \inheritsavedanchors[from=circle]
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritbackgroundpath[from=circle]
+ % New:
+ \anchor{input}{\centerpoint\advance\pgf@x by-\radius}
+ \anchor{output}{\centerpoint\advance\pgf@x by\radius}
+}
+
+
+
+%
+% Current direction indicator. This shape uses the current setting of
+% the current direction arrow tip for the arrow. The shape is a
+% rectangle around the arrow tip.
+%
+
+\pgfdeclareshape{direction ee}
+{
+ \savedanchor\northeast{
+ % Right border is given by right extend
+ \pgf@x=0pt%
+ \csname pgf@arrow@right@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname
+ % Height is given by minimum height/2
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=.5\pgf@y
+ }
+ \savedanchor\southwest{
+ % Left border is given by left extend
+ \pgf@x=0pt%
+ \csname pgf@arrow@left@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname
+ \pgf@x=-\pgf@x%
+ % Height is given by minimum height/2
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=-.5\pgf@y
+ }
+
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+ \nodeparts{}% no text
+
+ \behindbackgroundpath{
+ \pgf@process{\southwest}
+ \pgf@xa=\pgf@x
+ \pgf@process{\northeast}
+ \pgf@xb=\pgf@x
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
+ \pgfusepathqstroke
+ }
+
+ \beforebackgroundpath{
+ {
+ \pgfsetarrowsend{\pgfkeysvalueof{/pgf/direction ee arrow}}
+ \pgfsys@beginscope
+ \pgflowlevelsynccm%
+ \pgflowlevelobj{}{\pgf@endarrow}%
+ \pgfsys@endscope
+ }
+ }
+}
+
+\pgfkeys{
+ /pgf/direction ee arrow/.initial=direction ee,
+}
+
+
+
+% Special arrow for ee directions:
+
+\pgfarrowsdeclare{direction ee}{direction ee}
+{
+ \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
+ \pgfutil@tempdima=.5\pgfutil@tempdima
+ \pgfarrowsleftextend{+-\pgfutil@tempdima}
+ \pgfarrowsrightextend{+\pgfutil@tempdima}
+}
+{
+ \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{-0.5\pgfutil@tempdima}{0.38268343237\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-0.5\pgfutil@tempdima}{-0.38268343237\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfsetarrowoptions{direction ee}{4pt}
+
+
+
+
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex
new file mode 100644
index 00000000000..5b2beb2b0fb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex
@@ -0,0 +1,733 @@
+% Copyright 2008 by Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\usepgflibrary{shapes.gates.logic}
+
+\pgfkeys{/pgf/.cd,
+ and gate IEC symbol/.initial=$\char`\&$,
+ nand gate IEC symbol/.initial=$\char`\&$,
+ or gate IEC symbol/.initial=$\geq1$,
+ nor gate IEC symbol/.initial=$\geq1$,
+ xor gate IEC symbol/.initial={$=1$},
+ xnor gate IEC symbol/.initial={$=1$},
+ not gate IEC symbol/.initial=1,
+ buffer gate IEC symbol/.initial=1,
+ logic gate IEC symbol align/.initial=top,
+ logic gate IEC symbol color/.initial=% no value
+}
+
+\pgfkeys{/pgf/logic gate IEC symbol align/.cd,
+ top/.code=\pgftransformyshift{\innerhalfheight},
+ bottom/.code=\pgftransformyshift{-\innerhalfheight},
+ left/.code=\pgftransformxshift{-\innerhalfwidth},
+ right/.code=\pgftransformxshift{\innerhalfwidth}
+}
+
+\def\pgf@lib@sh@logicgates@IEC@foregroundpath#1{%
+ \dimensions%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate IEC symbol align}}%
+ \edef\pgf@lib@sh@@temp{/pgf/logic gate IEC symbol align/.cd, \pgf@lib@sh@temp}%
+ \expandafter\pgfkeys\expandafter{\pgf@lib@sh@@temp}%
+ \expandafter\pgftext\expandafter[\pgf@lib@sh@temp]{%
+ \pgfkeysgetvalue{/pgf/logic gate IEC symbol color}{\pgf@lib@sh@temp}%
+ \ifx\pgf@lib@sh@temp\pgfutil@empty%
+ \else%
+ \expandafter\color\expandafter{\pgf@lib@sh@temp}%
+ \fi%
+ \pgfkeysvalueof{/pgf/#1 gate IEC symbol}%
+ }%
+ }%
+}
+
+
+\def\pgf@lib@sh@logicgates@dimensions@IEC#1{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ % Adjust for the width of the gate symbol.
+ %
+ \setbox\pgf@hbox\hbox{{\pgfkeysvalueof{/pgf/#1 gate IEC symbol}}}% add braces as color-aftergroup-fix TT
+ \pgf@xa.5\wd\pgf@hbox%
+ \pgf@ya.5\ht\pgf@hbox%
+ \advance\pgf@ya.5\dp\pgf@hbox%
+ \ifdim\pgf@x<\pgf@xa%
+ \pgf@x\pgf@xa%
+ \fi%
+ \ifdim\pgf@y<\pgf@ya%
+ \pgf@y\pgf@ya%
+ \fi%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ %
+ % Adjust for minimum height and width.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ %
+ % Adjust the height for the number of inputs.
+ %
+ \c@pgf@counta\pgf@lib@sh@logicgate@numinputs%
+ \advance\c@pgf@counta1\relax%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \pgf@yb2.0\pgf@yb%
+ \advance\pgf@yb\pgflinewidth%
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/logic gate input sep}}%
+ \edef\inputsep{\the\pgf@yc}%
+ \addtosavedmacro\inputsep%
+ \ifdim\pgf@yb<\pgf@yc%
+ \pgf@yb\pgf@yc%
+ \fi%
+ \multiply\pgf@yb\c@pgf@counta%
+ \ifdim\pgf@y<.5\pgf@yb%
+ \pgf@y.5\pgf@yb%
+ \fi%
+ %
+ \pgf@xa\pgf@y%
+ \pgfmathaddtolength\pgf@xa{-\pgfkeysvalueof{/pgf/inner xsep}}%
+ \edef\innerhalfwidth{\the\pgf@xa}%
+ \addtosavedmacro\innerhalfwidth%
+ %
+ \pgf@ya\pgf@y%
+ \pgfmathaddtolength\pgf@ya{-\pgfkeysvalueof{/pgf/inner ysep}}%
+ \edef\innerhalfheight{\the\pgf@ya}%
+ \addtosavedmacro\innerhalfheight%
+ %
+ % Take into account the outer sep.
+ %
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ %
+ \edef\halfwidth{\the\pgf@x}%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfwidth%
+ \addtosavedmacro\halfheight%
+}%
+
+\def\pgf@lib@sh@logicgate@IEC@inputanchor#1{%
+ \dimensions%
+ \centerpoint%
+ \advance\pgf@x-\halfwidth%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname%
+ \advance\pgf@x-\invertedradius%
+ \advance\pgf@x-\outerinvertedradius%
+ \fi%
+ %
+ \pgfutil@tempdima\halfheight%
+ \multiply\pgfutil@tempdima2\relax%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \multiply\pgfutil@tempdima#1\relax%
+ \advance\pgf@y\halfheight%
+ \advance\pgf@y-\pgfutil@tempdima%
+}
+
+
+
+% Shape and gate IEC
+%
+\pgfdeclareshape{and gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@and gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@and gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An and gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{and}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}
+ \anchor{mid west}{%
+ \dimensions%
+ \midpoint%
+ \advance\pgf@x-\halfwidth}%
+ \anchor{mid east}{%
+ \dimensions%
+ \midpoint%
+ \advance\pgf@x\halfwidth}%
+ \anchor{base}{\basepoint}
+ \anchor{base west}{%
+ \dimensions%
+ \basepoint%
+ \advance\pgf@x-\halfwidth}%
+ \anchor{base east}{%
+ \dimensions%
+ \basepoint%
+ \advance\pgf@x\halfwidth}%
+ \anchor{north}{\dimensions\centerpoint\advance\pgf@y\halfheight}%
+ \anchor{south}{\dimensions\centerpoint\advance\pgf@y-\halfheight}%
+ \anchor{east}{\dimensions\centerpoint\advance\pgf@x\halfwidth}%
+ \anchor{west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth}%
+ \anchor{north east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y\halfheight}%
+ \anchor{north west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y\halfheight}%
+ \anchor{south east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y-\halfheight}%
+ \anchor{south west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y-\halfheight}%
+ \anchor{output}{\dimensions\centerpoint\advance\pgf@x\halfwidth}
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \pgfmathaddtolength\pgf@xc{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@yc{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathrectangle{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}%
+ {%
+ \pgf@xc2.0\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \pgfqpoint{\pgf@xc}{\pgf@yc}%
+ }%
+ \pgfpathclose%
+ %
+ % Draw inputs.
+ %
+ \pgf@xc-\halfwidth%
+ \advance\pgf@xc-\invertedradius%
+ \pgf@yc\halfheight%
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{and}}
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \dimensions%
+ \pgfpointadd{\centerpoint}{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}%
+ }%
+}
+
+
+
+
+
+% Shape nand gate IEC
+%
+\pgfdeclareshape{nand gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@nand gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@nand gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A nand gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{nand}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \anchor{output}{%
+ \csname pgf@anchor@and gate IEC@east\endcsname%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerinvertedradius%
+ }
+ \backgroundpath{%
+ \csname pgf@sh@bg@and gate IEC\endcsname%
+ \pgfpathcircle{%
+ \centerpoint%
+ \advance\pgf@x\halfwidth%
+ \advance\pgf@x\invertedradius%
+ }{+\invertedradius}%
+ }
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nand}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+
+% Shape or gate IEC
+%
+\pgfdeclareshape{or gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@or gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@or gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An or gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{or}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=and gate IEC]{output}
+ \inheritbackgroundpath[from=and gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{or}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+
+% Shape nor gate IEC
+%
+\pgfdeclareshape{nor gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@nor gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@nor gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A nor gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{nor}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=nand gate IEC]{output}%
+ \inheritbackgroundpath[from=nand gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nor}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+
+% Shape xor gate IEC
+%
+\pgfdeclareshape{xor gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{2}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@xor gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@xor gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An xor gate must have two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{xor}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=and gate IEC]{output}
+ \inheritbackgroundpath[from=and gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xor}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+% Shape xnor gate IEC
+%
+
+\pgfdeclareshape{xnor gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@xnor gate IEC@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@xnor gate IEC@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A xnor gate must have two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{xnor}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=nand gate IEC]{output}
+ \inheritbackgroundpath[from=nand gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xnor}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+% Shape buffer gate IEC
+%
+\pgfdeclareshape{buffer gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1}% Maximum 1 input.
+ %
+ \expandafter\gdef\csname pgf@anchor@buffer gate IEC@input\endcsname{%
+ \pgf@lib@sh@logicgate@IEC@inputanchor{1}%
+ }%
+ \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
+ \PackageError{PGF}{A buffer gate must have one inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{xor}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=and gate IEC]{output}
+ \inheritbackgroundpath[from=and gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{buffer}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+
+
+
+
+% Shape not gate IEC
+%
+\pgfdeclareshape{not gate IEC}{
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate IEC\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1}%
+ %
+ \pgfutil@ifundefined{pgf@anchor@not gate IEC@input}{%
+ \expandafter\gdef\csname pgf@anchor@not gate IEC@input\endcsname{%
+ \pgf@lib@sh@logicgate@IEC@inputanchor{1}%
+ }}{}%
+ \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
+ \PackageError{PGF}{A not gate must have one input}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{%
+ \pgf@lib@sh@logicgates@dimensions@IEC{not}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=and gate IEC]{center}
+ \inheritanchor[from=and gate IEC]{mid}
+ \inheritanchor[from=and gate IEC]{mid west}
+ \inheritanchor[from=and gate IEC]{mid east}
+ \inheritanchor[from=and gate IEC]{base}
+ \inheritanchor[from=and gate IEC]{base west}
+ \inheritanchor[from=and gate IEC]{base east}
+ \inheritanchor[from=and gate IEC]{north}
+ \inheritanchor[from=and gate IEC]{south}
+ \inheritanchor[from=and gate IEC]{east}
+ \inheritanchor[from=and gate IEC]{west}
+ \inheritanchor[from=and gate IEC]{north east}
+ \inheritanchor[from=and gate IEC]{north west}
+ \inheritanchor[from=and gate IEC]{south east}
+ \inheritanchor[from=and gate IEC]{south west}
+ \inheritanchor[from=nand gate IEC]{output}
+ \inheritbackgroundpath[from=nand gate IEC]
+ \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{not}}
+ \inheritanchorborder[from=and gate IEC]
+}
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex
new file mode 100644
index 00000000000..ae857c6fd42
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex
@@ -0,0 +1,2525 @@
+% Copyright 2008 by Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\usepgflibrary{shapes.gates.logic}
+
+
+\newif\ifpgfgateanchorsuseboundingrectangle%
+
+
+% Keys for US/CDH logic gates.
+%
+\pgfkeys{
+ /pgf/logic gate anchors use bounding box/.is if=pgfgateanchorsuseboundingrectangle,%
+}
+
+% An internal macro for calculating internal dimensions of
+% the US + CDH gates (excluding and gate US and nand gate US).
+%
+\def\pgf@lib@sh@logicgates@dimensions@orUS{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ % Adjust the height for the number of inputs.
+ %
+ \c@pgf@counta\pgf@lib@sh@logicgate@numinputs%
+ \advance\c@pgf@counta1\relax%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@ya\pgflinewidth%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}%
+ \pgf@yb.5\pgf@yb%
+ \ifdim\pgf@ya<\pgf@yb%
+ \pgf@ya\pgf@yb%
+ \fi%
+ \multiply\pgf@ya\c@pgf@counta%
+ \ifdim\pgf@y<\pgf@ya%
+ \pgf@y\pgf@ya%
+ \fi%
+ %
+ \ifdim\pgf@x>\pgf@y%
+ \pgf@y\pgf@x%
+ \else%
+ \pgf@x\pgf@y%
+ \fi%
+ %
+ % Adjust for minimum height and width.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \pgf@xb\pgf@x%
+ \advance\pgf@xb1.732051\pgf@y% 2y*cos(30)
+ \ifdim\pgf@xb<\pgf@xa%
+ \pgf@xb\pgf@xa%
+ \pgf@x0.366025\pgf@xb% xb / (1 + 2*cos(30))
+ \fi%
+ %
+ \ifdim\pgf@x>\pgf@y%
+ \pgf@y\pgf@x%
+ \else%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\halfside{\the\pgf@x}%
+ \addtosavedmacro\halfside%
+ %
+ % Take into account the outer sep.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\outerxsep{\the\pgf@xa}%
+ \edef\outerysep{\the\pgf@ya}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ %
+ \edef\halfwidth{\the\pgf@x}%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfwidth%
+ \addtosavedmacro\halfheight%
+ %
+ \pgfextract@process\tipanchor{%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ \pgf@x-.16666\pgf@x%
+ \pgf@yb2.0\pgf@y%
+ \advance\pgf@x.866025\pgf@yb%
+ \advance\pgf@x1.154701\pgf@xa%
+ \pgf@y0pt%
+ }%
+ \addtosavedmacro\tipanchor%
+}%
+
+
+% An internal macro for calculating internal dimensions of
+% the and gate US and nand gate US.
+%
+\def\pgf@lib@sh@logicgates@dimensions@andUS{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ % Adjust the height for the number of inputs.
+ %
+ \c@pgf@counta\pgf@lib@sh@logicgate@numinputs%
+ \advance\c@pgf@counta1\relax%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@ya\pgflinewidth%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}%
+ \pgf@yb.5\pgf@yb%
+ \ifdim\pgf@ya<\pgf@yb%
+ \pgf@ya\pgf@yb%
+ \fi%
+ \multiply\pgf@ya\c@pgf@counta%
+ \ifdim\pgf@y<\pgf@ya%
+ \pgf@y\pgf@ya%
+ \fi%
+ %
+ \ifdim\pgf@x>\pgf@y%
+ \pgf@y\pgf@x%
+ \else%
+ \pgf@x\pgf@y%
+ \fi%
+ %
+ % Adjust for minimum height and width.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \pgf@xb2.5\pgf@x%
+ \ifdim\pgf@xb<\pgf@xa%
+ \pgf@xb\pgf@xa%
+ \pgf@x0.4\pgf@xb%
+ \fi%
+ %
+ \ifdim\pgf@x>\pgf@y%
+ \pgf@y\pgf@x%
+ \else%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\halfside{\the\pgf@x}%
+ \addtosavedmacro\halfside%
+ %
+ % Take into account the outer sep.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\outerxsep{\the\pgf@xa}%
+ \edef\outerysep{\the\pgf@ya}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ %
+ \edef\halfwidth{\the\pgf@x}%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfwidth%
+ \addtosavedmacro\halfheight%
+ %
+}%
+
+
+% Internal macro for calculation input anchors. Used by
+% both and gates and nand gates, and also the not gate and buffer.
+%
+\def\pgf@lib@sh@logicgate@AND@inputanchor#1{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-.166666\pgf@xa%
+ \advance\pgf@x-\halfwidth%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname%
+ \advance\pgf@x-\invertedradius%
+ \advance\pgf@x-\outerinvertedradius%
+ \fi%
+ %
+ \pgfutil@tempdima\halfside%
+ \multiply\pgfutil@tempdima2\relax%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \multiply\pgfutil@tempdima#1\relax%
+ \advance\pgf@y\halfside%
+ \advance\pgf@y-\pgfutil@tempdima%
+}
+
+
+
+
+% Shape and gate US
+%
+\pgfdeclareshape{and gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@and gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@and gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An and gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \csname pgf@anchor@and gate US@east\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{mid west}{%
+ \csname pgf@anchor@and gate US@west\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \csname pgf@anchor@and gate US@east\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{base west}{%
+ \csname pgf@anchor@and gate US@west\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{east}{%
+ \dimensions%
+ \pgf@xa\halfwidth%
+ \pgf@xb\pgf@xa%
+ \advance\pgf@xb-\outerxsep%
+ \centerpoint%
+ \advance\pgf@x.333333\pgf@xb%
+ \advance\pgf@x\pgf@xa%
+ }
+ \anchor{output}{\csname pgf@anchor@and gate US@east\endcsname}
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@nand gate US@east\endcsname%
+ \advance\pgf@y\halfheight%
+ \else
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\pgf@xa%
+ \advance\pgf@xb-\outerxsep%
+ \centerpoint%
+ \advance\pgf@x.333333\pgf@xb%
+ \advance\pgf@x.707106\pgf@xa%
+ \advance\pgf@y.707106\pgf@ya%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@nand gate US@east\endcsname%
+ \advance\pgf@y-\halfheight%
+ \else
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\pgf@xa%
+ \advance\pgf@xb-\outerxsep%
+ \centerpoint%
+ \advance\pgf@x.333333\pgf@xb%
+ \advance\pgf@x.707106\pgf@xa%
+ \advance\pgf@y-.707106\pgf@ya%
+ \fi%
+ }
+ \anchor{north}{%
+ \dimensions%
+ \centerpoint%
+ \advance\pgf@y\halfheight%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \centerpoint%
+ \advance\pgf@y-\halfheight%
+ }
+ \anchor{south west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y-\halfheight%
+ }
+ \anchor{north west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y\halfheight%
+ }
+ \anchor{west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ \pgf@xb.333333\pgf@xc%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}%
+ {%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}%
+ \pgfpathclose%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \dimensions%
+ \pgf@xb\halfside%
+ \pgf@xc1.66666\pgf@xb%
+ \advance\pgf@xc\outerxsep%
+ \pgf@yc\halfheight%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@x.333333\pgf@xb%
+ }%
+ {0}{90}{+\halfwidth and +\halfheight}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}%
+ {\centerpoint\advance\pgf@x-\pgf@xc\advance\pgf@y\pgf@yc}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@x.333333\pgf@xb%
+ }%
+ {270}{360}{+\halfwidth and +\halfheight}%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@south west\endcsname}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}%
+ {\csname pgf@anchor@and gate US@south west\endcsname}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@and gate US@north west\endcsname}%
+ {\csname pgf@anchor@and gate US@south west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ }
+}
+
+
+
+
+
+% Shape nand gate US
+%
+\pgfdeclareshape{nand gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@nand gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@nand gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A nand gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \inheritanchor[from=and gate US]{mid}
+ \inheritanchor[from=and gate US]{mid east}
+ \inheritanchor[from=and gate US]{mid west}
+ \inheritanchor[from=and gate US]{base}
+ \inheritanchor[from=and gate US]{base east}
+ \inheritanchor[from=and gate US]{base west}
+ \anchor{output}{%
+ \dimensions
+ \pgfpointadd{\centerpoint}{%
+ \pgf@xa\halfside%
+ \pgf@x1.33333\pgf@xa%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerinvertedradius%
+ \advance\pgf@x\outerxsep%
+ \pgf@y0pt%
+ }%
+ }
+ \inheritanchor[from=and gate US]{east}
+ \inheritanchor[from=and gate US]{north east}
+ \inheritanchor[from=and gate US]{south east}
+ \inheritanchor[from=and gate US]{north}
+ \inheritanchor[from=and gate US]{south}
+ \inheritanchor[from=and gate US]{south west}
+ \inheritanchor[from=and gate US]{north west}
+ \inheritanchor[from=and gate US]{west}
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ \pgf@xb.333333\pgf@xc%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}%
+ {%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}%
+ \pgfpathclose%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-1.166666\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x1.33333\pgf@xc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ }%
+ }
+ \inheritanchorborder[from=and gate US]
+}
+
+
+% Internal macro for calculation input anchors. Used by
+% or, nor xnor gates (US).
+%
+\def\pgf@lib@sh@logicgate@OR@inputanchor#1{%
+ \dimensions%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ %
+ \pgfutil@tempdima\halfside%
+ \multiply\pgfutil@tempdima2\relax%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \multiply\pgfutil@tempdima#1\relax%
+ \pgf@yc\pgf@ya%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ %
+ \pgf@xb\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@xc-1.166666\pgf@ya%
+ \advance\pgf@xc-.866025\pgf@xb%
+ \advance\pgf@xc\pgfmathresult\pgf@yb%
+ \advance\pgf@xc\halflinewidth%
+ \advance\pgf@xc-\outerxsep%
+ %
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname%
+ \advance\pgf@xc-\invertedradius%
+ \advance\pgf@xc-\outerinvertedradius%
+ \fi%
+ %
+ \centerpoint%
+ \advance\pgf@x\pgf@xc%
+ \advance\pgf@y\pgf@yc%
+}
+
+
+% Shape or gate US
+%
+\pgfdeclareshape{or gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@or gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@or gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An or gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \csname pgf@anchor@or gate US@east\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{mid west}{%
+ \csname pgf@anchor@or gate US@north west\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \csname pgf@anchor@or gate US@east\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{base west}{%
+ \csname pgf@anchor@or gate US@north west\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{east}{%
+ \dimensions%
+ \pgfpointadd{\centerpoint}{\tipanchor}%
+ }
+ \anchor{output}{\csname pgf@anchor@or gate US@east\endcsname}
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\halfheight%
+ \else%
+ \centerpoint%
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\halfside%
+ \advance\pgf@x-.166666\pgf@xb%
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@x.5\pgf@xa%
+ \advance\pgf@y-\pgf@xb%
+ \advance\pgf@ya\pgf@xb%
+ \advance\pgf@y.866025\pgf@ya%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y-\halfheight%
+ \else
+ \centerpoint%
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\halfside%
+ \advance\pgf@x-.166666\pgf@xb%
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@x.5\pgf@xa%
+ \advance\pgf@y\pgf@xb%
+ \advance\pgf@ya\pgf@xb%
+ \advance\pgf@y-.866025\pgf@ya%
+ \fi%
+ }
+ \anchor{north}{%
+ \dimensions%
+ \centerpoint%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y\halfheight%
+ \else%
+ \pgf@ya\halfheight%
+ \advance\pgf@y.993043\pgf@ya%
+ \fi%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \centerpoint%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y-\halfheight%
+ \else%
+ \pgf@ya\halfheight%
+ \advance\pgf@y-.993043\pgf@ya%
+ \fi%
+ }
+ \anchor{south west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x-1.732050\pgf@xa%
+ \advance\pgf@y-\halfheight%
+ }
+ \anchor{north west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x-1.732050\pgf@xa%
+ \advance\pgf@y\halfheight%
+ }
+ \anchor{west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \else%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@x0.267949\pgf@xa%
+ \fi%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \pgfpatharc{-30}{0}{+\pgf@yc}%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \pgfpatharc{0}{30}{+\pgf@yc}%
+ }%
+ \pgfpathclose%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ \pgf@xa\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \let\sineangle\pgfmathresult%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@x-1.166666\pgf@ya%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x\pgfmathresult\pgf@yb%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \dimensions%
+ \pgf@xc\halfside%
+ %
+ \pgf@xc-.166666\pgf@xc%
+ \ifdim\pgf@xa<\pgf@xc%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@or gate US@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@or gate US@north\endcsname%
+ }%
+ {\csname pgf@anchor@or gate US@north west\endcsname}%
+ \else%
+ \pgfmathsubtract@{360}{\pgfmathresult}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@or gate US@south\endcsname%
+ }%
+ {\csname pgf@anchor@or gate US@south west\endcsname}%
+ \else%
+ \ifdim\pgf@ya>\pgf@yb%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \advance\pgf@yc-\outerxsep%
+ \pgfextract@process\point{%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.166666\pgf@xa%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ }%
+ {0}{90}{+\pgf@yc}%
+ }%
+ \else%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \advance\pgf@yc-\outerxsep%
+ \pgfextract@process\point{%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.166666\pgf@xa%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ }%
+ {270}{360}{+\pgf@yc}%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgf@y=0pt\relax%
+ \csname pgf@anchor@and gate US@east\endcsname%
+ \else%
+ \pgf@xc\halfwidth%
+ \advance\pgf@xc\halfside%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \pgf@xb\halfside%
+ \pgf@xb-.166666\pgf@xb%
+ \ifdim\pgf@ya<0pt%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {270}{330}{+\pgf@yc}%
+ \else%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y-\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {30}{90}{+\pgf@xc and +\pgf@yc}%
+ \fi%
+ \fi%
+ \fi%
+ }%
+}
+
+
+
+
+% Shape nor gate US
+%
+\pgfdeclareshape{nor gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@nor gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@nor gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A nor gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \inheritanchor[from=or gate US]{center}
+ \inheritanchor[from=or gate US]{mid}
+ \inheritanchor[from=or gate US]{mid east}
+ \inheritanchor[from=or gate US]{mid west}
+ \inheritanchor[from=or gate US]{base}
+ \inheritanchor[from=or gate US]{base east}
+ \inheritanchor[from=or gate US]{base west}
+ \inheritanchor[from=or gate US]{east}
+ \inheritanchor[from=or gate US]{north east}
+ \inheritanchor[from=or gate US]{south east}
+ \inheritanchor[from=or gate US]{north}
+ \inheritanchor[from=or gate US]{south}
+ \inheritanchor[from=or gate US]{south west}
+ \inheritanchor[from=or gate US]{north west}
+ \inheritanchor[from=or gate US]{west}
+ \anchor{output}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xc\halfside%
+ \pgf@yc\pgf@xc%
+ \advance\pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerxsep%
+ }%
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \pgfpatharc{-30}{0}{+\pgf@yc}%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \pgfpatharc{0}{30}{+\pgf@yc}%
+ }%
+ \pgfpathclose%
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ \pgf@xa\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \let\sineangle\pgfmathresult%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@x-1.166666\pgf@ya%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x\pgfmathresult\pgf@yb%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }%
+ \inheritanchorborder[from=or gate US]
+}
+
+
+
+% Internal macro for calculation input anchors. Used by
+% xor and xnor gates (US).
+%
+\def\pgf@lib@sh@logicgate@XOR@inputanchor#1{%
+ \dimensions%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ %
+ \pgfutil@tempdima\halfside%
+ \multiply\pgfutil@tempdima2\relax%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \multiply\pgfutil@tempdima#1\relax%
+ \pgf@yc\pgf@ya%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ %
+ \pgf@xb\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@xc-1.166666\pgf@ya%
+ \advance\pgf@xc-.866025\pgf@xb%
+ \advance\pgf@xc\pgfmathresult\pgf@yb%
+ \advance\pgf@xc\halflinewidth%
+ \advance\pgf@xc-\outerxsep%
+ %
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname%
+ \advance\pgf@xc-\invertedradius%
+ \advance\pgf@xc-\outerinvertedradius%
+ \fi%
+ %
+ \centerpoint%
+ \advance\pgf@x\pgf@xc%
+ \advance\pgf@y\pgf@yc%
+ \pgf@xa\halfside%
+ \advance\pgf@x-.333333\pgf@xa%
+}
+
+
+
+
+
+% Shape xor gate US
+%
+\pgfdeclareshape{xor gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{2}%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@xor gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@xor gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An xor gate must have at two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \inheritanchor[from=or gate US]{mid east}
+ \anchor{mid west}{%
+ \csname pgf@anchor@xor gate US@north west\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{base}{\basepoint}%
+ \inheritanchor[from=or gate US]{base east}
+ \anchor{base west}{%
+ \csname pgf@anchor@xor gate US@north west\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \inheritanchor[from=or gate US]{base}
+ \inheritanchor[from=or gate US]{output}
+ \inheritanchor[from=or gate US]{east}
+ \inheritanchor[from=or gate US]{north east}
+ \inheritanchor[from=or gate US]{south east}
+ \inheritanchor[from=or gate US]{north}
+ \inheritanchor[from=or gate US]{south}
+ \anchor{south west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x
+ \pgf@xb\halfside%
+ \pgf@xb2.0\pgf@xb%
+ \advance\pgf@xb-\halflinewidth%
+ \advance\pgf@xa.866025\pgf@xb%
+ \pgf@ya.5\pgf@xb%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y-\halfheight%
+ \else%
+ \advance\pgf@y-\pgf@ya%
+ \fi%
+ }
+ \anchor{north west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x
+ \pgf@xb\halfside%
+ \pgf@xb2.0\pgf@xb%
+ \advance\pgf@xb-\halflinewidth%
+ \advance\pgf@xa.866025\pgf@xb%
+ \pgf@ya.5\pgf@xb%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y\halfheight%
+ \else%
+ \advance\pgf@y\pgf@ya%
+ \fi%
+ }
+ \anchor{west}{%
+ \dimensions%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ %
+ \pgf@xb\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{0}{\pgfmath@tonumber{\pgf@yb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@xc-1.166666\pgf@ya%
+ \advance\pgf@xc-.866025\pgf@xb%
+ \advance\pgf@xc\pgfmathresult\pgf@yb%
+ \advance\pgf@xc\halflinewidth%
+ \advance\pgf@xc-\outerxsep%
+ %
+ \centerpoint%
+ \advance\pgf@x\pgf@xc%
+ \pgf@xa\halfside%
+ \advance\pgf@x-.333333\pgf@xa%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@x-0.133974\pgf@xa%
+ \fi%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ {%
+ \pgf@yc2.66666\pgf@yc%
+ \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}%
+ }
+ {%
+ \pgf@yc2.66666\pgf@yc%
+ \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}%
+ }%
+ \pgfpathclose%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ \pgf@xa\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@x-1.5\pgf@ya%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x\pgfmathresult\pgf@yb%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Now, some fooling around to stop the `tail' being filled.
+ % Technically it still is, but it isn't visible.
+ %
+ \pgf@xc\halfside%
+ \pgf@yc\halfside%
+ \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}%
+ \pgf@yc2.0\pgf@yc%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter<61\relax%
+ {%
+ \pgfextract@process\point{%
+ \pgfpointadd{%
+ \pgf@x\halfside%
+ \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x
+ \pgf@y0pt%
+ }{%
+ \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}%
+ }%
+ }%
+ \pgfpathlineto{\point}%
+ \pgfpathmoveto{\point}%
+ }
+ \repeatpgfmathloop%
+ }%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \dimensions%
+ \pgf@xc\halfside%
+ %
+ \pgf@xc-.166666\pgf@xc%
+ \ifdim\pgf@xa<\pgf@xc%
+ \pgfmathanglebetweenpoints{\centerpoint}%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@xor gate US@north west\endcsname%
+ }%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@xor gate US@north\endcsname%
+ }%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@xor gate US@north west\endcsname%
+ }%
+ \else%
+ \pgfmathsubtract@{360}{\pgfmathresult}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@xor gate US@south\endcsname%
+ }%
+ {%
+ \pgfgateanchorsuseboundingrectangletrue%
+ \csname pgf@anchor@xor gate US@south west\endcsname%
+ }%
+ \else%
+ \ifdim\pgf@ya>\pgf@yb%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \advance\pgf@yc-\outerxsep%
+ \pgf@process{%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.166666\pgf@xa%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@x-.166666\pgf@xa%
+ }%
+ {0}{90}{+\pgf@yc}%
+ }%
+ \else%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \advance\pgf@yc-\outerxsep%
+ \pgf@process{%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.166666\pgf@xa%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@x-.166666\pgf@xa%
+ }%
+ {270}{360}{+\pgf@yc}%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgf@y=0pt\relax%
+ \csname pgf@anchor@and gate US@east\endcsname%
+ \else%
+ \pgf@xc\halfwidth%
+ \advance\pgf@xc\halfside%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \pgf@xb\halfside%
+ \pgf@xb-.166666\pgf@xb%
+ \ifdim\pgf@ya<0pt%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {270}{330}{+\pgf@yc}%
+ \else%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y-\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {30}{90}{+\pgf@xc and +\pgf@yc}%
+ \fi%
+ \fi%
+ \fi%
+ }%
+}
+
+
+
+
+% Shape xnor gate US
+%
+\pgfdeclareshape{xnor gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{2}%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@xnor gate US@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@xnor gate US@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An xnor gate must have two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \inheritanchor[from=xor gate US]{mid east}
+ \inheritanchor[from=xor gate US]{mid west}
+ \anchor{base}{\basepoint}%
+ \inheritanchor[from=xor gate US]{base east}
+ \inheritanchor[from=xor gate US]{base west}
+ \inheritanchor[from=xor gate US]{base}
+ \inheritanchor[from=nor gate US]{output}
+ \inheritanchor[from=xor gate US]{east}
+ \inheritanchor[from=xor gate US]{north east}
+ \inheritanchor[from=xor gate US]{south east}
+ \inheritanchor[from=xor gate US]{north}
+ \inheritanchor[from=xor gate US]{south}
+ \inheritanchor[from=xor gate US]{south west}
+ \inheritanchor[from=xor gate US]{north west}
+ \inheritanchor[from=xor gate US]{west}
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ {%
+ \pgf@yc2.66666\pgf@yc%
+ \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}%
+ }
+ {%
+ \pgf@yc2.66666\pgf@yc%
+ \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}%
+ }%
+ \pgfpathclose%
+ %
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@ya\halfside%
+ \pgf@yb2.0\pgf@ya%
+ \pgf@xa\pgf@yb%
+ \advance\pgf@yb-\halflinewidth%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ %
+ \pgf@x-1.5\pgf@ya%
+ \advance\pgf@x-.866025\pgf@xa%
+ \advance\pgf@x\pgfmathresult\pgf@yb%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Now, some fooling around to stop the `tail' being filled.
+ %
+ \pgf@xc\halfside%
+ \pgf@yc\halfside%
+ \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}%
+ \pgf@yc2.0\pgf@yc%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter<61\relax%
+ {%
+ \pgfextract@process\point{%
+ \pgfpointadd{%
+ \pgf@x\halfside%
+ \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x
+ \pgf@y0pt%
+ }{%
+ \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}%
+ }%
+ }%
+ \pgfpathlineto{\point}%
+ \pgfpathmoveto{\point}%
+ }
+ \repeatpgfmathloop%
+ }%
+ }%
+ \inheritanchorborder[from=xor gate US]
+}
+
+
+
+
+
+
+% Shape not gate US
+%
+\pgfdeclareshape{not gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1}%
+ \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
+ \PackageError{PGF}{A not gate must have one input}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \midpoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@not gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \anchor{mid west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \midpoint%
+ \advance\pgf@x\pgf@xc%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \basepoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@not gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \anchor{base west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \basepoint%
+ \advance\pgf@x\pgf@xc%
+ }%
+ \inheritanchor[from=and gate US]{base}
+ \anchor{output}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \centerpoint%
+ \advance\pgf@x-.166666\pgf@xc%
+ \pgf@xc2.0\pgf@xc%
+ \advance\pgf@x.866025\pgf@xc%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerinvertedradius%
+ \advance\pgf@x\outerxsep%
+ }
+ \anchor{east}{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \anchor{north}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \centerpoint%
+ \advance\pgf@x-.833333\pgf@xa
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y-1.166666\pgf@xa%
+ \pgf@ya\outerysep%
+ \advance\pgf@y-1.565\pgf@ya% Selected by trial and error.
+ }%
+ \anchor{north west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \centerpoint%
+ \advance\pgf@x-.833333\pgf@xa
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y1.166666\pgf@xa%
+ \pgf@ya\outerysep%
+ \advance\pgf@y1.565\pgf@ya% Selected by trial and error.
+ }%
+ \anchor{input}{%
+ \dimensions%
+ \pgf@lib@sh@logicgate@AND@inputanchor{1}%
+ \pgf@xc\halfside%
+ \advance\pgf@x.333333\pgf@xc%
+ }%
+ \anchor{west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \centerpoint%
+ \advance\pgf@x\pgf@xc%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\tipanchor}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}%
+ \pgfpathlineto{\tipanchor}%
+ %
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ %
+ % Draw the input.
+ %
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-.833333\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ }%
+ }%
+ \anchorborder{%
+ \pgf@lib@gates@not@buffer@border{not gate US}
+ }
+}
+
+\def\pgf@lib@gates@not@buffer@border#1{
+ \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \ifx\pgfmathresult\pgf@lib@zero@text%
+ \csname pgf@anchor@#1@output\endcsname%
+ \else%
+ \ifx\pgfmathresult\pgf@lib@onehundredeighty@text%
+ \csname pgf@anchor@#1@input\endcsname%
+ \else%
+ \let\externalangle\pgfmathresult%
+ \dimensions%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@south west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+}%
+
+
+\def\pgf@lib@zero@text{0.0}
+\def\pgf@lib@onehundredeighty@text{180.0}
+
+
+
+
+% Shape buffer gate US.
+%
+\pgfdeclareshape{buffer gate US}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1}%
+ \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
+ \PackageError{PGF}{A buffer gate must have one input}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \midpoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@buffer gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \anchor{mid west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \midpoint%
+ \advance\pgf@x\pgf@xc%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \basepoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@buffer gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \inheritanchor[from=not gate US]{base west}
+ \inheritanchor[from=and gate US]{base}
+ \anchor{output}{\csname pgf@anchor@buffer gate US@east\endcsname}
+ \anchor{east}{%
+ \dimensions%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \anchor{north}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}%
+ {\csname pgf@anchor@buffer gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@buffer gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@buffer gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xc\outerxsep%
+ \advance\pgf@x2.350943\pgf@xc%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@buffer gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}%
+ {\csname pgf@anchor@buffer gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \inheritanchor[from=not gate US]{south west}
+ \inheritanchor[from=not gate US]{north west}
+ \inheritanchor[from=not gate US]{input}
+ \inheritanchor[from=not gate US]{west}
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\tipanchor}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}%
+ \pgfpathclose%
+ %
+ % Draw the input.
+ %
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-.833333\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ }%
+ }%
+ \anchorborder{%
+ \pgf@lib@gates@not@buffer@border{buffer gate US}
+ }
+}
+
+
+
+
+
+\pgfdeclareshape{and gate CDH}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate CDH\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@and gate CDH@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@and gate CDH@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{An and gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \csname pgf@anchor@and gate CDH@east\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{mid west}{%
+ \csname pgf@anchor@and gate CDH@west\endcsname%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa}
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \csname pgf@anchor@and gate CDH@east\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{base west}{%
+ \csname pgf@anchor@and gate CDH@west\endcsname%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \pgf@x\pgf@xa}
+ \anchor{east}{%
+ \dimensions%
+ \pgfpointadd{\centerpoint}{\tipanchor}%
+ }
+ \anchor{output}{\csname pgf@anchor@and gate CDH@east\endcsname}
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\halfheight%
+ \else%
+ \centerpoint%
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\halfside%
+ \advance\pgf@x-.166666\pgf@xb%
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@x.5\pgf@xa%
+ \advance\pgf@y-\pgf@xb%
+ \advance\pgf@ya\pgf@xb%
+ \advance\pgf@y.866025\pgf@ya%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y-\halfheight%
+ \else
+ \centerpoint%
+ \pgf@xa\halfwidth%
+ \pgf@ya\halfheight%
+ \pgf@xb\halfside%
+ \advance\pgf@x-.166666\pgf@xb%
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@x.5\pgf@xa%
+ \advance\pgf@y\pgf@xb%
+ \advance\pgf@ya\pgf@xb%
+ \advance\pgf@y-.866025\pgf@ya%
+ \fi%
+ }
+ \anchor{north}{%
+ \dimensions%
+ \centerpoint%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y\halfheight%
+ \else%
+ \pgf@ya\halfheight%
+ \advance\pgf@y.993043\pgf@ya%
+ \fi%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \centerpoint%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \advance\pgf@y-\halfheight%
+ \else%
+ \pgf@ya\halfheight%
+ \advance\pgf@y-.993043\pgf@ya%
+ \fi%
+ }
+ \anchor{south west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y-\halfheight%
+ }
+ \anchor{north west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y\halfheight%
+ }
+ \anchor{west}{%
+ \dimensions%
+ \centerpoint%
+ \pgf@xa\halfside%
+ \advance\pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-\outerxsep%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}%
+ \pgfpathclose%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \dimensions%
+ \pgf@xb\halfside%
+ %
+ \pgf@xb-.166666\pgf@xb%
+ \ifdim\pgf@xa<\pgf@xb%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointborderrectangle{\externalpoint}{%
+ \pgf@xc\halfside%
+ \pgf@xc.166666\pgf@xc%
+ \advance\pgf@xc\halfwidth%
+ \pgfqpoint{\pgf@xc}{\halfheight}%
+ }%
+ }%
+ \else%
+ \ifdim\pgf@y=0pt\relax%
+ \csname pgf@anchor@and gate CDH@east\endcsname%
+ \else%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgf@xc\halfwidth%
+ \advance\pgf@xc\halfside%
+ \pgf@yc\halfheight%
+ \advance\pgf@yc\halfside%
+ \ifdim\pgf@ya<0pt%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {270}{330}{+\pgf@yc}%
+ \else%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \advance\pgf@y-\halfside%
+ \advance\pgf@x\pgf@xb%
+ }%
+ {30}{90}{+\pgf@xc and +\pgf@yc}%
+ \fi%
+ \fi%
+ \fi%
+ }
+}
+
+
+\pgfdeclareshape{nand gate CDH}{%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate CDH\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs.
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@nand gate CDH@input \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@nand gate CDH@input \pgfmathcounter\endcsname{%
+ \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}%
+ }%
+ }{}%
+ \repeatpgfmathloop%
+ \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax%
+ \PackageError{PGF}{A nand gate must have at least two inputs}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \inheritanchor[from=and gate CDH]{mid east}
+ \inheritanchor[from=and gate CDH]{mid west}
+ \anchor{base}{\basepoint}%
+ \inheritanchor[from=and gate CDH]{base east}
+ \inheritanchor[from=and gate CDH]{base west}
+ \anchor{output}{%
+ \dimensions
+ \pgfpointadd{\centerpoint}{%
+ \pgf@xa\halfside%
+ \pgf@x-.166666\pgf@xa%
+ \pgf@xb2.0\pgf@xa%
+ \advance\pgf@x.866025\pgf@xb%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerinvertedradius%
+ \advance\pgf@x\outerxsep%
+ \pgf@y0pt%
+ }%
+ }
+ \inheritanchor[from=and gate CDH]{east}
+ \inheritanchor[from=and gate CDH]{north east}
+ \inheritanchor[from=and gate CDH]{south east}
+ \inheritanchor[from=and gate CDH]{north}
+ \inheritanchor[from=and gate CDH]{south}
+ \inheritanchor[from=and gate CDH]{south west}
+ \inheritanchor[from=and gate CDH]{north west}
+ \inheritanchor[from=and gate CDH]{west}
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}%
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ {%
+ \pgf@yc2.0\pgf@yc%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+ }
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}%
+ \pgfpathclose%
+ %
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ %
+ % Draw the inputs.
+ %
+ \pgfutil@tempdima2.0\pgf@yc%
+ \c@pgf@counta\numinputs%
+ \advance\c@pgf@counta1\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\numinputs%
+ \else%
+ \advance\pgf@yc-\pgfutil@tempdima%
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-1.16666\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y\pgf@yc%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ }%
+ \inheritanchorborder[from=and gate CDH]
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex
new file mode 100644
index 00000000000..8b047f04ab1
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex
@@ -0,0 +1,98 @@
+% Copyright 2008 by Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+
+% Common keys for all logic gates.
+%
+\pgfkeys{/pgf/.cd,%
+ logic gate input sep/.initial=0.125cm,
+ logic gate inputs/.initial={normal,normal},%
+ logic gate inverted radius/.initial=2pt
+}
+
+
+% Internal macro for parsing inputs.
+%
+\expandafter\ifx\csname pgf@lib@sh@logicgate@parseinputs\endcsname\relax%
+\def\pgf@lib@sh@logicgate@parseinputs#1{%
+ \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate inputs}}%
+ \c@pgf@counta#1\relax%
+ \c@pgf@countb0\relax%
+ \expandafter\pgfutil@in@\expandafter,\expandafter{\pgf@lib@sh@temp}%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@long%
+ \else%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@short%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@itext{i}
+\def\pgf@lib@sh@invertedtext{inverted}
+%
+% The `short' version for input specifcation is an extension of
+% ideas due to Juergen Werber and Christoph Bartoschek.
+%
+\def\pgf@lib@sh@logicgate@parseinputs@short{%
+ \expandafter\pgf@lib@sh@logicgate@parseinputs@@short\pgf@lib@sh@temp\pgf@stop%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@short#1{%
+ \ifx#1\pgf@stop%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \ifnum\c@pgf@countb=\c@pgf@counta%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \advance\c@pgf@countb1\relax%
+ \expandafter\ifx\pgf@lib@sh@itext#1%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
+ \else%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
+ \fi%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@short%
+ \fi%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@long{%
+ \expandafter\pgf@lib@sh@logicgate@parseinputs@@long\pgf@lib@sh@temp,\pgf@stop,%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@long#1,{%
+ \ifx#1\pgf@stop%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \ifnum\c@pgf@countb=\c@pgf@counta%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \advance\c@pgf@countb1\relax%
+ \def\pgf@lib@sh@temp{#1}%
+ \ifx\pgf@lib@sh@invertedtext\pgf@lib@sh@temp%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
+ \else%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
+ \fi%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@@long%
+ \fi%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@@long{%
+ \pgfutil@ifnextchar x{\pgf@lib@sh@logicgate@parseinputs@@long}%
+ {\pgf@lib@sh@logicgate@parseinputs@@long}%
+}
+\fi%
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex
new file mode 100644
index 00000000000..39f90d6f2e6
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex
@@ -0,0 +1,2358 @@
+% Copyright 2007 by Till Tantau and Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
+
+
+% keys for shape single arrow
+%
+% /pgf/single arrow tip angle
+% /pgf/single arrow head extend
+% /pgf/single arrow head indent
+
+\pgfkeys{/pgf/.cd,
+ single arrow tip angle/.initial=90,
+ single arrow head extend/.initial=.25cm,
+ single arrow head indent/.initial=0cm}
+
+% Shape single arrow
+%
+%
+\pgfdeclareshape{single arrow}{%
+ \savedmacro\getsinglearrowpoints{%
+ %
+ % Get the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \edef\xoutersep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\youtersep{\the\pgf@y}%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa.5\wd\pgfnodeparttextbox%
+ \advance\pgf@xa.5\pgflinewidth%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya.5\dp\pgfnodeparttextbox%
+ \advance\pgf@ya.5\pgflinewidth%
+ \ifpgfshapeborderusesincircle%
+ \ifdim\pgf@xa<\pgf@ya%
+ \pgf@xa\pgf@ya%
+ \fi%
+ \pgf@xa1.41421\pgf@xa%
+ \pgf@ya\pgf@xa%
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \ifdim\xoutersep>\youtersep\relax%
+ \let\youtersep\xoutersep%
+ \else%
+ \let\xoutersep\youtersep%
+ \fi%
+ \else%
+ %
+ % Round the rotation.
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \pgfmathmod@{\rotate}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@x\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \pgf@ya\pgf@x%
+ \let\pgfmathresult\xoutersep%
+ \let\xoutersep\youtersep%
+ \let\youtersep\pgfmathresult%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@x\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \pgf@ya\pgf@x%
+ \let\pgfmathresult\xoutersep%
+ \let\xoutersep\youtersep%
+ \let\youtersep\pgfmathresult%
+ \fi%
+ \fi%
+ \fi%
+ \addtosavedmacro\rotate%
+ %
+ % Get some useful trig stuff.
+ %
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/single arrow tip angle}}{2}%
+ \let\halftipangle\pgfmathresult%
+ \pgfmathcosec@{\halftipangle}%
+ \let\cosechalftipangle\pgfmathresult%
+ \pgfmathcos@{\halftipangle}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima\cosechalftipangle\pgfutil@tempdima%
+ \edef\cothalftipangle{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \let\sechalftipangle\pgfmathresult%
+ \pgfmathsin@{\halftipangle}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima\sechalftipangle\pgfutil@tempdima%
+ \edef\tanhalftipangle{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ %
+ % Get the single arrow head extend, and adjust for minimum width.
+ %
+ \pgf@xb\pgf@ya%
+ \pgf@xb\cothalftipangle\pgf@xb%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/single arrow head extend}}%
+ \pgf@yc\pgf@xc%
+ \advance\pgf@xc\pgf@ya%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@xc<.5\pgfutil@tempdimb%
+ \pgfutil@tempdimb.5\pgfutil@tempdimb%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgfutil@tempdimb}}{\pgfmath@tonumber{\pgf@xc}}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgf@xc\pgfmathresult\pgf@xc%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgf@xb\pgfmathresult\pgf@xb%
+ \fi%
+ %
+ % Now calculate the height of the arrow and adjust for minimum height.
+ %
+ \advance\pgf@xc-\pgf@ya%
+ \pgf@xc\cothalftipangle\pgf@xc%
+ \pgf@xa2.0\pgf@xa%
+ \advance\pgf@xa\pgf@xb%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@xa<\pgfutil@tempdimb%
+ \pgf@xa\pgfutil@tempdimb%
+ \fi%
+ \advance\pgf@xa-\pgf@xb%
+ \pgf@xa.5\pgf@xa%
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/single arrow head indent}}%
+ %
+ % Now:
+ %
+ % xa - .5 * width of the node minus xb.
+ % ya - .5 * height of the node contents.
+ % xb - distance from the end of the node contents to the arrow tip.
+ % xc - distance from the end of the node contents to the back end of the arrow head.
+ % yc - distance from the top of the node contents to the top end of the arrow head.
+ %
+ \pgfsavepgf@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfsavepgf@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \pgfsavepgf@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % As the arrow is symmetrical it can be described by only four points:
+ %
+ \pgfsavepgf@process\arrowtip{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x\pgf@xb%
+ \pgf@y0pt\relax%
+ }%
+ \pgfsavepgf@process\beforearrowtip{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x-\pgf@xc%
+ \pgf@y\pgf@ya%
+ \advance\pgf@y\pgf@yc%
+ }%
+ \pgfsavepgf@process\beforearrowhead{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x-\pgf@xc%
+ \advance\pgf@x\pgfutil@tempdima%
+ \pgf@y\pgf@ya%
+ }%
+ \pgfsavepgf@process\afterarrowtail{%
+ \pgf@x-\pgf@xa%
+ \pgf@y\pgf@ya%
+ }%
+ %
+ % Calculate the anchor point at the arrow tip...
+ %
+ \pgfsavepgf@process\arrowtipanchor{%
+ \pgfpointadd{\centerpoint}{\arrowtip}%
+ \pgf@xa\xoutersep\relax%
+ \advance\pgf@x\cosechalftipangle\pgf@xa%
+ }%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \edef\externalradius{\the\pgf@x}%
+ \addtosavedmacro\externalradius%
+ %
+ % ...and the rest of the points.
+ %
+ \pgfmathanglebetweenlines{\beforearrowtip}{\beforearrowhead}{\beforearrowtip}{\arrowtip}%
+ \pgf@xa\xoutersep\relax%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \advance\pgfutil@tempdima-\halftipangle pt\relax%
+ %
+ \pgfsavepgf@process\beforearrowtipanchor{%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgf@xa}%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@process{\pgfpointadd{\centerpoint}{\beforearrowtip}}%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \pgfmathanglebetweenpoints{\beforearrowhead}{\beforearrowtip}%
+ \pgfutil@tempdima-\pgfmathresult pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@xa\xoutersep\relax%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfsavepgf@process\beforearrowheadanchor{%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgf@xa}%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@process{\pgfpointadd{\centerpoint}{\beforearrowhead}}%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \pgfsavepgf@process\afterarrowtailanchor{%
+ \pgfpointadd{\centerpoint}{\afterarrowtail}%
+ \advance\pgf@x-\xoutersep\relax%
+ \advance\pgf@y\youtersep\relax%
+ }%
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\beforearrowtipanchor}%
+ \let\center@angle@beforearrowtip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\beforearrowheadanchor}%
+ \let\center@angle@beforearrowhead\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\afterarrowtailanchor}%
+ \let\center@angle@afterarrowtail\pgfmathresult%
+ \addtosavedmacro\center@angle@beforearrowtip%
+ \addtosavedmacro\center@angle@beforearrowhead%
+ \addtosavedmacro\center@angle@afterarrowtail%
+ %
+ \pgfmathanglebetweenpoints{\midpoint}{\beforearrowtipanchor}%
+ \let\mid@angle@beforearrowtip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\midpoint}{\beforearrowheadanchor}%
+ \let\mid@angle@beforearrowhead\pgfmathresult%
+ \pgfmathanglebetweenpoints{\midpoint}{\afterarrowtailanchor}%
+ \let\mid@angle@afterarrowtail\pgfmathresult%
+ \addtosavedmacro\mid@angle@beforearrowtip%
+ \addtosavedmacro\mid@angle@beforearrowhead%
+ \addtosavedmacro\mid@angle@afterarrowtail%
+ %
+ \pgfmathanglebetweenpoints{\basepoint}{\beforearrowtipanchor}%
+ \let\base@angle@beforearrowtip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\basepoint}{\beforearrowheadanchor}%
+ \let\base@angle@beforearrowhead\pgfmathresult%
+ \pgfmathanglebetweenpoints{\basepoint}{\afterarrowtailanchor}%
+ \let\base@angle@afterarrowtail\pgfmathresult%
+ \addtosavedmacro\base@angle@beforearrowtip%
+ \addtosavedmacro\base@angle@beforearrowhead%
+ \addtosavedmacro\base@angle@afterarrowtail%
+ %
+ \addtosavedmacro\arrowtipanchor%
+ \addtosavedmacro\beforearrowtipanchor%
+ \addtosavedmacro\beforearrowheadanchor%
+ \addtosavedmacro\afterarrowtailanchor%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \getsinglearrowpoints%
+ \let\pgf@singlearrow@referencepoint\midpoint%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{mid west}{%
+ \getsinglearrowpoints%
+ \let\pgf@singlearrow@referencepoint\midpoint%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \getsinglearrowpoints%
+ \let\pgf@singlearrow@referencepoint\basepoint%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{base west}{%
+ \getsinglearrowpoints%
+ \let\pgf@singlearrow@referencepoint\basepoint%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north east}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south east}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \anchor{south west}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{north west}{%
+ \getsinglearrowpoints%
+ \csname pgf@anchor@single arrow@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{before head}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{\beforearrowheadanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{before tip}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{\beforearrowtipanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{tip}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{\arrowtipanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{after tip}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{after head}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{before tail}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\afterarrowtailanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{after tail}{%
+ \getsinglearrowpoints%
+ \pgfmathrotatepointaround{\afterarrowtailanchor}{\centerpoint}{\rotate}%
+ }
+ \anchor{tail}{%
+ \getsinglearrowpoints%
+ \pgfpointlineattime{0.5}{%
+ \pgfmathrotatepointaround{\afterarrowtailanchor}{\centerpoint}{\rotate}%
+ }%
+ {%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\afterarrowtailanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }%
+ }%
+ \backgroundpath{%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgftransformrotate{\rotate}%
+ \pgfpathmoveto{\arrowtip}%
+ \pgfpathlineto{\beforearrowtip}%
+ \pgfpathlineto{\beforearrowhead}%
+ \pgfpathlineto{\afterarrowtail}%
+ \pgfpathlineto{\afterarrowtail\pgf@y-\pgf@y}%
+ \pgfpathlineto{\beforearrowhead\pgf@y-\pgf@y}%
+ \pgfpathlineto{\beforearrowtip\pgf@y-\pgf@y}%
+ }%
+ \pgfpathclose%
+ }%
+ \anchorborder{%
+ \pgfsavepgf@process\externalpoint{}%
+ \getsinglearrowpoints%
+ \pgfutil@ifundefined{pgf@singlearrow@referencepoint}{\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@singlearrow@referencepoint}%
+ \pgfsavepgf@process\externalpoint{%
+ \externalpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \referencepoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ \pgf@x\externalangle pt\relax%
+ \ifx\referencepoint\midpoint%
+ \pgf@xa\mid@angle@beforearrowtip pt\relax%
+ \pgf@xb\mid@angle@beforearrowhead pt\relax%
+ \pgf@xc\mid@angle@afterarrowtail pt\relax%
+ \else%
+ \ifx\referencepoint\basepoint%
+ \pgf@xa\base@angle@beforearrowtip pt\relax%
+ \pgf@xb\base@angle@beforearrowhead pt\relax%
+ \pgf@xc\base@angle@afterarrowtail pt\relax%
+ \else%
+ \pgf@xa\center@angle@beforearrowtip pt\relax%
+ \pgf@xb\center@angle@beforearrowhead pt\relax%
+ \pgf@xc\center@angle@afterarrowtail pt\relax%
+ \fi%
+ \fi%
+ \ifdim\pgf@x<\pgf@xa%
+ \let\firstpoint\arrowtipanchor%
+ \let\secondpoint\beforearrowtipanchor%
+ \else%
+ \ifdim\pgf@x<\pgf@xb%
+ \ifdim\pgf@xb<\pgf@xa%
+ \let\firstpoint\arrowtipanchor%
+ \let\secondpoint\beforearrowtipanchor%
+ \else%
+ \let\firstpoint\beforearrowheadanchor%
+ \let\secondpoint\beforearrowtipanchor%
+ \fi%
+ \else%
+ \ifdim\pgf@x<\pgf@xc%
+ \let\firstpoint\beforearrowheadanchor%
+ \let\secondpoint\afterarrowtailanchor%
+ \else%
+ \pgf@xc-\pgf@xc%
+ \advance\pgf@xc360pt\relax%
+ \ifdim\pgf@x<\pgf@xc%
+ \let\firstpoint\afterarrowtailanchor%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\afterarrowtailanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \else%
+ \pgf@xa-\pgf@xa%
+ \advance\pgf@xa360pt\relax%
+ \pgf@xb-\pgf@xb%
+ \advance\pgf@xb360pt\relax%
+ \ifdim\pgf@x<\pgf@xa%
+ \ifdim\pgf@x<\pgf@xb%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\afterarrowtailanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \else%
+ \ifdim\pgf@xb<\pgf@xa%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \else%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\arrowtipanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \fi%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \fi%
+ \else%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}%
+ }%
+ \let\secondpoint\arrowtipanchor%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfmathrotatepointaround{\firstpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfmathrotatepointaround{\secondpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfpointintersectionoflines{\referencepoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+}
+
+
+
+
+
+
+
+% keys for shape double arrow
+%
+% /pgf/double arrow tip angle
+% /pgf/double arrow head sep
+
+\pgfkeys{/pgf/.cd,
+ double arrow tip angle/.initial=90,
+ double arrow head extend/.initial=.25cm,
+ double arrow head indent/.initial=0cm}
+
+% Shape double arrow
+%
+%
+\pgfdeclareshape{double arrow}{%
+ \savedmacro\getdoublearrowpoints{%
+ %
+ % Get the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \edef\xoutersep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\youtersep{\the\pgf@y}%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa.5\wd\pgfnodeparttextbox%
+ \advance\pgf@xa.5\pgflinewidth%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya.5\dp\pgfnodeparttextbox%
+ \advance\pgf@ya.5\pgflinewidth%
+ \ifpgfshapeborderusesincircle%
+ \ifdim\pgf@xa<\pgf@ya%
+ \pgf@xa\pgf@ya%
+ \fi%
+ \pgf@xa1.41421\pgf@xa%
+ \pgf@ya\pgf@xa%
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \ifdim\xoutersep>\youtersep\relax%
+ \let\youtersep\xoutersep%
+ \else%
+ \let\xoutersep\youtersep%
+ \fi%
+ \else%
+ %
+ % Round the rotation.
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}
+ \pgfmathmod@{\rotate}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@x\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \pgf@ya\pgf@x%
+ \let\pgfmathresult\xoutersep%
+ \let\xoutersep\youtersep%
+ \let\youtersep\pgfmathresult%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@x\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \pgf@ya\pgf@x%
+ \let\pgfmathresult\xoutersep%
+ \let\xoutersep\youtersep%
+ \let\youtersep\pgfmathresult%
+ \fi%
+ \fi%
+ \fi%
+ \addtosavedmacro\rotate%
+ %
+ % Get some useful trig stuff.
+ %
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/double arrow tip angle}}{2}%
+ \let\halftipangle\pgfmathresult%
+ \pgfmathcosec@{\halftipangle}%
+ \let\cosechalftipangle\pgfmathresult%
+ \pgfmathcos@{\halftipangle}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima\cosechalftipangle\pgfutil@tempdima%
+ \edef\cothalftipangle{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \let\sechalftipangle\pgfmathresult%
+ \pgfmathsin@{\halftipangle}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima\sechalftipangle\pgfutil@tempdima%
+ \edef\tanhalftipangle{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ %
+ % Get the double arrow head extend, and adjust for minimum width.
+ %
+ \pgf@xb\pgf@ya%
+ \pgf@xb\cothalftipangle\pgf@xb%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/double arrow head extend}}%
+ \pgf@yc\pgf@xc%
+ \advance\pgf@xc\pgf@ya%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@xc<.5\pgfutil@tempdimb%
+ \pgfutil@tempdimb.5\pgfutil@tempdimb%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgfutil@tempdimb}}{\pgfmath@tonumber{\pgf@xc}}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgf@xc\pgfmathresult\pgf@xc%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgf@xb\pgfmathresult\pgf@xb%
+ \fi%
+ %
+ % Now calculate the height of the arrow and adjust for minimum height.
+ %
+ \advance\pgf@xc-\pgf@ya%
+ \pgf@xc\cothalftipangle\pgf@xc%
+ \advance\pgf@xa\pgf@xb%
+ \pgf@xa2.0\pgf@xa%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@xa<\pgfutil@tempdimb%
+ \pgf@xa\pgfutil@tempdimb%
+ \fi%
+ \pgf@xa.5\pgf@xa%
+ \advance\pgf@xa-\pgf@xb%
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/double arrow head indent}}%
+ %
+ % Now:
+ %
+ % xa - .5 * width of the node minus xb.
+ % ya - .5 * height of the node contents.
+ % xb - distance from the end of the node contents to the arrow tip.
+ % xc - distance from the end of the node contents to the back end of the arrow head.
+ % yc - distance from the top of the node contents to the top end of the arrow head.
+ %
+ \pgfsavepgf@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfsavepgf@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \pgfsavepgf@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % As the arrow is symmetrical it can be described by only 3 points:
+ %
+ \pgfsavepgf@process\arrowtip{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x\pgf@xb%
+ \pgf@y0pt\relax%
+ }%
+ \pgfsavepgf@process\beforearrowtip{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x-\pgf@xc%
+ \pgf@y\pgf@ya%
+ \advance\pgf@y\pgf@yc%
+ }%
+ \pgfsavepgf@process\beforearrowhead{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x-\pgf@xc%
+ \advance\pgf@x\pgfutil@tempdima%
+ \pgf@y\pgf@ya%
+ }%
+ %
+ % Calculate the anchor point at the arrow tip.
+ %
+ \pgfsavepgf@process\arrowtipanchor{%
+ \pgfpointadd{\centerpoint}{\arrowtip}%
+ \pgf@xa\xoutersep\relax%
+ \advance\pgf@x\cosechalftipangle\pgf@xa%
+ }%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \edef\externalradius{\the\pgf@x}%
+ \addtosavedmacro\externalradius%
+ %
+ %
+ \pgfmathanglebetweenlines{\beforearrowtip}{\beforearrowhead}{\beforearrowtip}{\arrowtip}%
+ \pgf@xa\xoutersep\relax%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \advance\pgfutil@tempdima-\halftipangle pt\relax%
+ \pgfsavepgf@process\beforearrowtipanchor{%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgf@xa}%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@process{\pgfpointadd{\centerpoint}{\beforearrowtip}}%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \pgfmathanglebetweenpoints{\beforearrowhead}{\beforearrowtip}%
+ \pgfutil@tempdima-\pgfmathresult pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@xa\xoutersep\relax%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfsavepgf@process\beforearrowheadanchor{%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgf@xa}%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@process{\pgfpointadd{\centerpoint}{\beforearrowhead}}%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ }%
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\beforearrowtipanchor}%
+ \let\center@angle@beforearrowtip\pgfmathresult%
+ \addtosavedmacro\center@angle@beforearrowtip%
+ %
+ \pgfmathanglebetweenpoints{\midpoint}{\beforearrowtipanchor}%
+ \let\mid@angle@beforearrowtip\pgfmathresult%
+ \addtosavedmacro\mid@angle@beforearrowtip%
+ %
+ \pgfmathanglebetweenpoints{\basepoint}{\beforearrowtipanchor}%
+ \let\base@angle@beforearrowtip\pgfmathresult%
+ \addtosavedmacro\base@angle@beforearrowtip%
+ %
+ \addtosavedmacro\arrowtipanchor%
+ \addtosavedmacro\beforearrowtipanchor%
+ \addtosavedmacro\beforearrowheadanchor%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \getdoublearrowpoints%
+ \let\pgf@singlearrow@referencepoint\midpoint%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{mid west}{%
+ \getdoublearrowpoints%
+ \let\pgf@singlearrow@referencepoint\midpoint%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \getdoublearrowpoints%
+ \let\pgf@singlearrow@referencepoint\basepoint%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{base west}{%
+ \getdoublearrowpoints%
+ \let\pgf@singlearrow@referencepoint\basepoint%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north east}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south east}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \anchor{south west}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{north west}{%
+ \getdoublearrowpoints%
+ \csname pgf@anchor@double arrow@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{before head 1}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{\beforearrowheadanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{before tip 1}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{\beforearrowtipanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{tip 1}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{\arrowtipanchor}{\centerpoint}{\rotate}%
+ }%
+ \anchor{after tip 1}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{after head 1}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{before head 2}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }%
+ \anchor{before tip 2}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }%
+ \anchor{tip 2}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\arrowtipanchor}%
+ \pgf@x-\pgf@x%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }%
+ \anchor{after tip 2}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@x-\pgf@x%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{after head 2}{%
+ \getdoublearrowpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@x-\pgf@x%
+ }{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \backgroundpath{%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgftransformrotate{\rotate}%
+ \pgfpathmoveto{\arrowtip}%
+ \pgfpathlineto{\beforearrowtip}%
+ \pgfpathlineto{\beforearrowhead}%
+ \pgfpathlineto{\beforearrowhead\pgf@x-\pgf@x}%
+ \pgfpathlineto{\beforearrowtip\pgf@x-\pgf@x}%
+ \pgfpathlineto{\arrowtip\pgf@x-\pgf@x}%
+ \pgfpathlineto{\beforearrowtip\pgf@x-\pgf@x\pgf@y-\pgf@y}%
+ \pgfpathlineto{\beforearrowhead\pgf@x-\pgf@x\pgf@y-\pgf@y}%
+ \pgfpathlineto{\beforearrowhead\pgf@y-\pgf@y}%
+ \pgfpathlineto{\beforearrowtip\pgf@y-\pgf@y}%
+ }%
+ \pgfpathclose%
+ }%
+ \anchorborder{%
+ \pgfsavepgf@process\externalpoint{}%
+ \getdoublearrowpoints%
+ \pgfutil@ifundefined{pgf@singlearrow@referencepoint}{\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@singlearrow@referencepoint}%
+ \pgfsavepgf@process\externalpoint{%
+ \externalpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \referencepoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ \pgf@x\externalangle pt\relax%
+ \ifx\referencepoint\midpoint%
+ \pgf@xa\mid@angle@beforearrowtip pt\relax%
+ \else%
+ \ifx\referencepoint\basepoint%
+ \pgf@xa\base@angle@beforearrowtip pt\relax%
+ \else%
+ \pgf@xa\center@angle@beforearrowtip pt\relax%
+ \fi%
+ \fi%
+ \ifdim\pgf@x<180pt\relax%
+ \ifdim\pgf@x<\pgf@xa%
+ \let\firstpoint\arrowtipanchor%
+ \let\secondpoint\beforearrowtipanchor%
+ \else%
+ \pgf@xa-\pgf@xa%
+ \advance\pgf@xa180pt\relax%
+ \ifdim\pgf@x<\pgf@xa%
+ \let\firstpoint\beforearrowheadanchor%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@x-\pgf@x
+ }{\centerpoint}}%
+ \else%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@x-\pgf@x
+ }{\centerpoint}}%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\arrowtipanchor}%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ \fi%
+ \fi%
+ \else%
+ \pgf@xa-\pgf@xa%
+ \advance\pgf@xa360pt\relax%
+ \ifdim\pgf@x<\pgf@xa%
+ \pgf@xa-\pgf@xa%
+ \advance\pgf@xa540pt\relax%
+ \ifdim\pgf@x<\pgf@xa%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\arrowtipanchor}%
+ \pgf@x-\pgf@x%
+ }{\centerpoint}}%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowtipanchor}%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ \else%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\centerpoint}{\beforearrowheadanchor}%
+ \pgf@y-\pgf@y%
+ }{\centerpoint}}%
+ \fi%
+ \else%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfpointadd{%
+ \pgfpointdiff{\beforearrowtipanchor}{\centerpoint}%
+ \pgf@x-\pgf@x%
+ }{\centerpoint}}%
+ \let\secondpoint\arrowtipanchor%
+ \fi%
+ \fi%
+ \pgfsavepgf@process\firstpoint{%
+ \pgfmathrotatepointaround{\firstpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfsavepgf@process\secondpoint{%
+ \pgfmathrotatepointaround{\secondpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfpointintersectionoflines{\referencepoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+}
+
+
+
+
+%
+% Internal macros for the arrow box/shape.
+%
+\def\pgf@lib@arrowbox@parsearrowlength#1#2#3{%
+ \edef\pgf@lib@temp{#3}%
+ \edef\pgf@lib@marshal{%
+ \noexpand\pgfutil@in@{none}{\pgf@lib@temp}%
+ }%
+ \pgf@lib@marshal%
+ \ifpgfutil@in@%
+ #10pt\relax%
+ \else%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter#1\pgf@lib@temp\relax\pgfmath@%
+ %
+ \edef\pgf@lib@marshal{%
+ \noexpand\pgfutil@in@{from center}{\pgf@lib@temp}%
+ }%
+ \pgf@lib@marshal%
+ \ifpgfutil@in@%
+ \else%
+ \ifdim#1>0pt\relax%
+ \advance#1#2\relax%
+ \fi%
+ \fi%
+ \fi}
+
+\def\pgf@lib@arrowbox@parsearrows#1{%
+ \pgfkeys{/pgf/.cd,%
+ arrow box west arrow=0pt,
+ arrow box east arrow=0pt,
+ arrow box south arrow=0pt,
+ arrow box north arrow=0pt
+ }%
+ \def\pgf@lib@arrowbox@extend{0pt}%
+ \edef\pgf@lib@temp{#1}%
+ \expandafter\pgf@lib@arrowbox@@parsearrows\pgf@lib@temp,\pgf@lib@arrowbox@parsearrows,}
+
+
+\def\pgf@lib@arrowbox@@parsearrows#1,{%
+ \ifx\pgf@lib@arrowbox@parsearrows#1%
+ \let\pgflib@next\relax%
+ \else%
+ \pgfutil@in@:{#1}%
+ \ifpgfutil@in@%
+ \pgf@lib@arrowbox@getextend#1\pgf@lib%
+ \else%
+ \def\pgf@lib@arrowbox@direction{#1}%
+ \fi%
+ \edef\pgf@marshal{%
+ \noexpand\pgfkeys{/pgf/arrow box \pgf@lib@arrowbox@direction\space arrow=\pgf@lib@arrowbox@extend}%
+ }%
+ \pgf@marshal%
+ \let\pgflib@next\pgf@lib@arrowbox@@@parsearrows%
+ \fi%
+ \pgflib@next%
+}
+\def\pgf@lib@arrowbox@@@parsearrows{%
+ \pgfutil@ifnextchar x{\relax\pgf@lib@arrowbox@@parsearrows}{\relax\pgf@lib@arrowbox@@parsearrows}%
+}
+
+\def\pgf@lib@arrowbox@getextend#1:#2\pgf@lib{%
+ \def\pgf@lib@arrowbox@direction{#1}%
+ \def\pgf@lib@arrowbox@extend{#2}%
+}%
+
+%
+% /pgf/arrow box north arrow
+% /pgf/arrow box south arrow
+% /pgf/arrow box west arrow
+% /pgf/arrow box east arrow
+% /pgf/arrow box arrows
+% /pgf/arrow box shaft width
+% /pgf/arrow box head extend
+% /pgf/arrow box head indent
+% /pgf/arrow box tip angle
+%
+\pgfkeys{/pgf/.cd,
+ arrow box west arrow/.initial=.5cm,
+ arrow box east arrow/.initial=.5cm,
+ arrow box south arrow/.initial=.5cm,
+ arrow box north arrow/.initial=.5cm,
+ arrow box shaft width/.initial=.125cm,
+ arrow box head extend/.initial=.125cm,
+ arrow box head indent/.initial=0cm,
+ arrow box tip angle/.initial=90,
+}
+
+%
+% arrow box/Shape.
+%
+\pgfdeclareshape{arrow box}{%
+ \saveddimen\shaftwidth{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box shaft width}}%
+ }%
+ %
+ % Calculate far the arrows extend from the center of the node.
+ %
+ \savedmacro\arrowboxpoints{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ %
+ \edef\halfboxwidth{\the\pgf@x}%
+ \edef\halfboxheight{\the\pgf@y}%
+ \pgfextract@process\arrowboxcorner{}%
+ \addtosavedmacro\arrowboxcorner%
+ %
+ \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxwidth}%
+ {\pgfkeysvalueof{/pgf/arrow box west arrow}}%
+ \edef\westextend{\the\pgf@x}%
+ \addtosavedmacro\westextend%
+ %
+ \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxwidth}%
+ {\pgfkeysvalueof{/pgf/arrow box east arrow}}%
+ \edef\eastextend{\the\pgf@x}%
+ \addtosavedmacro\eastextend%
+ %
+ \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxheight}%
+ {\pgfkeysvalueof{/pgf/arrow box north arrow}}%
+ \edef\northextend{\the\pgf@x}%
+ \addtosavedmacro\northextend%
+ %
+ \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxheight}%
+ {\pgfkeysvalueof{/pgf/arrow box south arrow}}%
+ \edef\southextend{\the\pgf@x}%
+ \addtosavedmacro\southextend%
+ }%
+ \saveddimen\arrowheadextend{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head extend}}%
+ }%
+ \saveddimen\arrowheadindent{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head indent}}%
+ }%
+ %
+ % Calculate the `miter' angle for the outer sep at the arrow tip.
+ %
+ \savedmacro\arrowtipmiterangle{%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\arrowtipmiterangle\pgfmathresult%
+ }%
+ %
+ % Calculate the `miter' angle for the outer sep at the point just
+ % before the arrow tip.
+ %
+ \savedmacro\arrowheadangles{%
+ %
+ % Calculate the `miter' angle and its cosecant at the arrow tip...
+ %
+ \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\arrowtipmiterangle\pgfmathresult%
+ \addtosavedmacro\arrowtipmiterangle%
+ \pgfmathcosec@{\arrowtipmiterangle}%
+ \let\cosecarrowtipmiterangle\pgfmathresult%
+ \addtosavedmacro\cosecarrowtipmiterangle%
+ %
+ % ...before the arrow head...
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head extend}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/arrow box head indent}}%
+ \ifdim\pgf@y=0pt\relax%
+ \def\pgfmathresult{90}%
+ \else%
+ \ifdim\pgf@y<0pt\relax%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \pgfmathadd@{\pgfmathresult}{180}%
+ \else%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \fi%
+ \fi%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\beforearrowheadmiterangle\pgfmathresult%
+ \addtosavedmacro\beforearrowheadmiterangle%
+ \pgfmathcosec@{\beforearrowheadmiterangle}%
+ \let\cosecbeforearrowheadmiterangle\pgfmathresult%
+ \addtosavedmacro\cosecbeforearrowheadmiterangle%
+ %
+ % ...and before the arrow tip.
+ %
+ \pgfutil@tempdima-\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima90pt\relax%
+ \pgfutil@tempdimb\beforearrowheadmiterangle pt\relax%
+ \pgfutil@tempdimb2.0\pgfutil@tempdimb%
+ \advance\pgfutil@tempdimb-90pt\relax%
+ \advance\pgfutil@tempdima\pgfutil@tempdimb%
+ \divide\pgfutil@tempdima2\relax%
+ \edef\beforearrowtipmiterangle{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \addtosavedmacro\beforearrowtipmiterangle%
+ \pgfmathcosec@{\beforearrowtipmiterangle}%
+ \let\cosecbeforearrowtipmiterangle\pgfmathresult%
+ \addtosavedmacro\cosecbeforearrowtipmiterangle%
+ }
+ \saveddimen\outerxsep{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \saveddimen\outerysep{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ %
+ % Calculate the (path) point immediately prior to an arrow tip.
+ %
+ \savedanchor\beforearrowtip{%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathcot@{\pgfmathresult}%
+ \let\cothalfangle\pgfmathresult%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/arrow box shaft width}}%
+ \pgf@y.5\pgf@y%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/arrow box head extend}}%
+ \pgf@y\pgf@y%
+ \pgf@x\cothalfangle\pgf@y%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{mid}{\midpoint}
+ \anchor{mid east}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \let\pgf@lib@shapes@arrowbox@referencepoint\midpoint%
+ \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{\eastextend}{0pt}};
+ \else%
+ \arrowboxcorner%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \advance\pgf@x\pgf@xa%
+ \fi%
+ }
+ \anchor{mid west}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \let\pgf@lib@shapes@arrowbox@referencepoint\midpoint%
+ \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{-\westextend}{0pt}};
+ \else%
+ \arrowboxcorner%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \advance\pgf@x-\pgf@xa%
+ \fi%
+ }
+ \anchor{base}{\basepoint}
+ \anchor{base east}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \let\pgf@lib@shapes@arrowbox@referencepoint\basepoint%
+ \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{\eastextend}{0pt}};
+ \else%
+ \arrowboxcorner%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \advance\pgf@x\pgf@xa%
+ \fi%
+ }
+ \anchor{base west}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \let\pgf@lib@shapes@arrowbox@referencepoint\basepoint%
+ \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{-\westextend}{0pt}};
+ \else%
+ \arrowboxcorner%
+ \pgf@xa\pgf@x%
+ \basepoint%
+ \advance\pgf@x-\pgf@xa%
+ \fi%
+ }
+ \anchor{north}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \csname pgf@anchor@arrow box@north arrow tip\endcsname%
+ \else%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner}%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \fi%
+ }%
+ \anchor{south}{%
+ \arrowboxpoints%
+ \ifdim\southextend>0pt\relax%
+ \csname pgf@anchor@arrow box@south arrow tip\endcsname%
+ \else%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@y-\pgf@y}%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \fi%
+ }%
+ \anchor{east}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \csname pgf@anchor@arrow box@east arrow tip\endcsname%
+ \else%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner}%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \pgf@x\pgf@xa%
+ \fi%
+ }%
+ \anchor{west}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \csname pgf@anchor@arrow box@west arrow tip\endcsname%
+ \else%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x}%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \pgf@x\pgf@xa%
+ \fi%
+ }%
+ \anchor{north east}{%
+ \arrowboxpoints%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner}%
+ }%
+ \anchor{north west}{%
+ \arrowboxpoints%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x}%
+ }%
+ \anchor{south west}{%
+ \arrowboxpoints%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x\pgf@y-\pgf@y}%
+ }%
+ \anchor{south east}{%
+ \arrowboxpoints%
+ \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@y-\pgf@y}%
+ }%
+ \anchor{before east arrow}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ \advance\pgf@y\outerysep\relax%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }%
+ \anchor{before east arrow head}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{before east arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ }%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{east arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \centerpoint%
+ \advance\pgf@x\eastextend\relax%
+ \pgf@xa\outerxsep\relax%
+ \pgfmathcosec@{\arrowtipmiterangle}%
+ \advance\pgf@x\pgfmathresult\pgf@xa%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{after east arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ }%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{after east arrow head}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{after east arrow}{%
+ \arrowboxpoints%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ \advance\pgf@y\outerysep\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }%
+ %
+ \anchor{before west arrow}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@x-\pgf@x%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ \advance\pgf@y\outerysep\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }%
+ \anchor{before west arrow head}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\westextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }
+ \anchor{before west arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\westextend\relax%
+ }%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }
+ \anchor{west arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \centerpoint%
+ \advance\pgf@x-\westextend\relax%
+ \pgf@xa\outerxsep\relax%
+ \pgfmathcosec@{\arrowtipmiterangle}%
+ \advance\pgf@x-\pgfmathresult\pgf@xa%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }
+ \anchor{after west arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\westextend\relax%
+ }%
+ \pgf@x-\pgf@x%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }
+ \anchor{after west arrow head}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\westextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgf@x-\pgf@x%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }
+ \anchor{after west arrow}{%
+ \arrowboxpoints%
+ \ifdim\westextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ \advance\pgf@y\outerysep\relax%
+ \pgf@x-\pgf@x%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@west\endcsname%
+ \fi%
+ }%
+ %
+ \anchor{before north arrow}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ \advance\pgf@x-\outerxsep\relax%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{before north arrow head}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima270pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{before north arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-90pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y-\pgf@xa%
+ \advance\pgf@y\northextend\relax%
+ }%
+ \pgf@x-\pgf@x%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{north arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \centerpoint%
+ \advance\pgf@y\northextend\relax%
+ \pgf@ya\outerysep\relax%
+ \pgfmathcosec@{\arrowtipmiterangle}%
+ \advance\pgf@y\pgfmathresult\pgf@ya%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{after north arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-90pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y-\pgf@xa%
+ \advance\pgf@y\northextend\relax%
+ }%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{after north arrow head}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima270pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \pgf@x-\pgf@x%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ \anchor{after north arrow}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ \advance\pgf@x\outerxsep\relax%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@north\endcsname%
+ \fi%
+ }
+ %
+ \anchor{before south arrow}{%
+ \arrowboxpoints%
+ \ifdim\southextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ \advance\pgf@x\outerxsep\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }%
+ \anchor{before south arrow head}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima270pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }
+ \anchor{before south arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-90pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y-\pgf@xa%
+ \advance\pgf@y\northextend\relax%
+ }%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }
+ \anchor{south arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\southextend>0pt\relax%
+ \centerpoint%
+ \advance\pgf@y-\southextend\relax%
+ \pgf@ya\outerysep\relax%
+ \pgfmathcosec@{\arrowtipmiterangle}%
+ \advance\pgf@y-\pgfmathresult\pgf@ya%
+ \else%
+ \csname pgf@anchor@arrow box@east\endcsname%
+ \fi%
+ }
+ \anchor{after south arrow tip}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima\arrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax%
+ \advance\pgfutil@tempdima-90pt\relax%
+ \pgfutil@tempdimb\outerxsep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y-\pgf@xa%
+ \advance\pgf@y\northextend\relax%
+ }%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }
+ \anchor{after south arrow head}{%
+ \arrowboxpoints%
+ \ifdim\northextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \arrowheadangles%
+ \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax%
+ \advance\pgfutil@tempdima270pt\relax%
+ \pgfutil@tempdimb\outerysep\relax%
+ \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }
+ \anchor{after south arrow}{%
+ \arrowboxpoints%
+ \ifdim\southextend>0pt\relax%
+ \pgfpointadd{\centerpoint}{%
+ \arrowboxcorner%
+ \pgf@x-\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ \advance\pgf@x-\outerxsep\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \else%
+ \csname pgf@anchor@arrow box@south\endcsname%
+ \fi%
+ }%
+ %
+ \backgroundpath{%
+ \arrowboxpoints%
+ \pgfextract@process\arrowboxcorner{%
+ \arrowboxcorner%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\arrowboxcorner}%
+ \ifdim\eastextend>0pt\relax%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ }%
+ \pgfpathlineto{%
+ \pgf@x\eastextend\relax%
+ \pgf@y0pt\relax%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\eastextend\relax%
+ \advance\pgf@x\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y-.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y-.5\pgf@y%
+ }%
+ \fi%
+ \pgfpathlineto{\arrowboxcorner\pgf@y-\pgf@y}%
+ \ifdim\southextend>0pt\relax%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@y\pgf@x%
+ \advance\pgf@y-\southextend\relax%
+ \advance\pgf@y-\arrowheadindent\relax%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@xa\pgf@y%
+ \pgf@y\pgf@x%
+ \advance\pgf@y-\southextend\relax%
+ \pgf@x\pgf@xa%
+ }%
+ \pgfpathlineto{%
+ \pgf@x0pt\relax%
+ \pgf@y-\southextend\relax%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@xa\pgf@y%
+ \pgf@y\pgf@x%
+ \advance\pgf@y-\southextend\relax%
+ \pgf@x-\pgf@xa%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@y\pgf@x%
+ \advance\pgf@y-\southextend\relax%
+ \advance\pgf@y-\arrowheadindent\relax%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x-.5\pgf@x%
+ }%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x-.5\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \fi%
+ \pgfpathlineto{\arrowboxcorner\pgf@x-\pgf@x\pgf@y-\pgf@y}%
+ \ifdim\westextend>0pt\relax%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x-\pgf@x
+ \pgf@y\shaftwidth\relax%
+ \pgf@y-.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \advance\pgf@x-\westextend\relax%
+ \advance\pgf@x-\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y-.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \advance\pgf@x-\westextend\relax%
+ \pgf@y-\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \pgf@x-\westextend\relax%
+ \pgf@y0pt\relax%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \advance\pgf@x-\westextend\relax%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \advance\pgf@x-\westextend\relax%
+ \advance\pgf@x-\arrowheadindent\relax%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x-\pgf@x%
+ \pgf@y\shaftwidth\relax%
+ \pgf@y.5\pgf@y%
+ }%
+ \fi%
+ \pgfpathlineto{\arrowboxcorner\pgf@x-\pgf@x}%
+ \ifdim\northextend>0pt\relax%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x-.5\pgf@x%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x-.5\pgf@x%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@xa\pgf@y%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \pgf@x-\pgf@xa%
+ }%
+ \pgfpathlineto{%
+ \pgf@x0pt\relax%
+ \pgf@y\northextend\relax%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@xa\pgf@y%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \pgf@x\pgf@xa%
+ }%
+ \pgfpathlineto{%
+ \beforearrowtip%
+ \pgf@y-\pgf@x%
+ \advance\pgf@y\northextend\relax%
+ \advance\pgf@y\arrowheadindent\relax%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \pgfpathlineto{%
+ \arrowboxcorner%
+ \pgf@x\shaftwidth\relax%
+ \pgf@x.5\pgf@x%
+ }%
+ \fi%
+ \pgfpathclose%
+ }%
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \pgfutil@ifundefined{pgf@lib@shapes@arrowbox@referencepoint}%
+ {\let\referencepoint\centerpoint}{\let\referencepoint\pgf@lib@shapes@arrowbox@referencepoint}%
+ \pgfextract@process\externalpoint{%
+ \pgfpointadd{\referencepoint}{\externalpoint}%
+ }%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@north\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@north east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before east arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{east arrow tip}%
+ \def\secondpoint{before east arrow tip}%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before east arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{before east arrow head}%
+ \def\secondpoint{before east arrow}%
+ \else%
+ \def\firstpoint{before east arrow}%
+ \def\secondpoint{north east}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after north arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after north arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{north east}%
+ \def\secondpoint{after north arrow}%
+ \else%
+ \def\firstpoint{after north arrow}%
+ \def\secondpoint{after north arrow head}%
+ \fi%
+ \else%
+ \def\firstpoint{after north arrow tip}%
+ \def\secondpoint{north arrow tip}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before north arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{north arrow tip}%
+ \def\secondpoint{before north arrow tip}%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before north arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{before north head}%
+ \def\secondpoint{before north arrow}%
+ \else%
+ \def\firstpoint{before north arrow}%
+ \def\secondpoint{north west}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after west arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after west arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{north west}%
+ \def\secondpoint{after west arrow}%
+ \else%
+ \def\firstpoint{after west arrow}%
+ \def\secondpoint{after west arrow head}%
+ \fi%
+ \else%
+ \def\firstpoint{after west arrow tip}%
+ \def\secondpoint{west arrow tip}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@south arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@south west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before west arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{west arrow tip}%
+ \def\secondpoint{before west arrow tip}%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before west arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{before west arrow head}%
+ \def\secondpoint{before west arrow}%
+ \else%
+ \def\firstpoint{before west arrow}%
+ \def\secondpoint{south west}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after south arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after south arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{south west}%
+ \def\secondpoint{after south arrow}%
+ \else%
+ \def\firstpoint{after south arrow}%
+ \def\secondpoint{after south arrow head}%
+ \fi%
+ \else%
+ \def\firstpoint{after south arrow tip}%
+ \def\secondpoint{south arrow tip}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@south east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before south arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{south arrow tip}%
+ \def\secondpoint{before south arrow tip}%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@before south arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{before south arrow head}%
+ \def\secondpoint{before south arrow}%
+ \else%
+ \def\firstpoint{before south arrow}%
+ \def\secondpoint{south east}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after east arrow tip\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}%
+ {\csname pgf@anchor@arrow box@after east arrow\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \def\firstpoint{south east}%
+ \def\secondpoint{after east arrow}%
+ \else%
+ \def\firstpoint{after east arrow}%
+ \def\secondpoint{after east arrow head}%
+ \fi%
+ \else%
+ \def\firstpoint{after east arrow tip}%
+ \def\secondpoint{east arrow tip}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgfpointintersectionoflines{\referencepoint}{\externalpoint}%
+ {\csname pgf@anchor@arrow box@\firstpoint\endcsname}%
+ {\csname pgf@anchor@arrow box@\secondpoint\endcsname}%
+ }
+}
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex
new file mode 100644
index 00000000000..440681b7b87
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex
@@ -0,0 +1,951 @@
+% Copyright 2007 by Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\usepgflibrary{shapes.symbols}
+
+% Keys for callouts
+%
+% Common to all callouts:
+% /pgf/callout absolute pointer
+% /pgf/callout relative pointer
+%
+% ellipse callout only:
+% /pgf/callout pointer arc
+%
+% rectangle callout only:
+% /pgf/callout pointer width
+%
+% cloud callout only:
+% /pgf/callout pointer start size
+% /pgf/callout pointer end size
+% /pgf/callout pointer segments
+%
+\newif\ifpgf@lib@callout@absolutepointer
+\pgfkeys{/pgf/.cd,
+ callout pointer arc/.initial=15,
+ callout pointer width/.initial=.25cm,
+ callout pointer start size/.initial=.2 of callout,
+ callout pointer end size/.initial=.1 of callout,
+ callout pointer segments/.initial=2,
+ callout absolute pointer/.code={\pgf@lib@callout@makeabsolutepointer{#1}},
+ callout relative pointer/.code={\pgf@lib@callout@makerelativepointer{#1}},
+ callout pointer shorten/.initial=0cm
+}
+
+
+
+\def\pgf@lib@callout@makeabsolutepointer#1{%
+ \pgf@lib@callout@absolutepointertrue%
+ {%
+ \pgftransformshift{#1}%
+ \pgfmultipartnode{coordinate}{center}{pgf@lib@callout@pointer}{}%
+ }%
+}
+
+\def\pgf@lib@callout@makerelativepointer#1{%
+ \pgf@lib@callout@absolutepointerfalse%
+ \def\pgf@lib@callout@relativepointer{#1}%
+}
+\pgfkeys{/pgf/callout relative pointer=\pgfpointpolar{300}{.5cm}}
+
+
+% Shape ellipse callout
+%
+%
+\pgfdeclareshape{ellipse callout}{%
+ \savedmacro\ellipsecalloutpoints{%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x>\pgf@y%
+ \edef\outersep{\the\pgf@x}%
+ \else%
+ \edef\outersep{\the\pgf@y}%
+ \fi%
+ \addtosavedmacro\outersep%
+ %
+ % Calculate the node dimensions...
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@x1.4142136\pgf@x%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \pgf@y1.4142136\pgf@y%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ %
+ % ...without outer sep...
+ %
+ \edef\xpathradius{\the\pgf@x}%
+ \edef\ypathradius{\the\pgf@y}%
+ %
+ % ...and width outer sep.
+ %
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \edef\xradius{\the\pgf@x}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\yradius{\the\pgf@y}%
+ %
+ \addtosavedmacro\xradius%
+ \addtosavedmacro\xpathradius%
+ \addtosavedmacro\yradius%
+ \addtosavedmacro\ypathradius%
+ %
+ \pgfmathsetmacro\pointerarc{\pgfkeysvalueof{/pgf/callout pointer arc}}%
+ \addtosavedmacro\pointerarc%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ %
+ % Get the realtive pointer.
+ %
+ \ifpgf@lib@callout@absolutepointer%
+ \else%
+ \pgfextract@process\calloutpointer{%
+ \pgfextract@process\borderpoint{%
+ \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}{\pgfqpoint{\xpathradius}{\ypathradius}}%
+ }%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}%
+ \let\pointerangle\pgfmathresult%
+ \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \edef\pointerradius{\pgfmathresult pt}%
+ \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ \addtosavedmacro\calloutpointer%
+ \pgf@lib@callouts@shortenpointer%
+ \pgf@lib@ellipsecallout@getpoints%
+ \addtosavedmacro\calloutpointeranchor%
+ \addtosavedmacro\beforecalloutangle%
+ \addtosavedmacro\aftercalloutangle%
+ \fi%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \ellipsecalloutpoints%
+ \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x\xradius}{\midpoint}%
+ {\centerpoint}{270}{450}{\xradius and \yradius}%
+ }%
+ \anchor{mid west}{%
+ \ellipsecalloutpoints%
+ \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x-\xradius}{\midpoint}%
+ {\centerpoint}{90}{270}{\xradius and \yradius}%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \ellipsecalloutpoints%
+ \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x\xradius}{\basepoint}%
+ {\centerpoint}{270}{450}{\xradius and \yradius}%
+ }%
+ \anchor{base west}{%
+ \ellipsecalloutpoints%
+ \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x-\xradius}{\basepoint}%
+ {\centerpoint}{90}{270}{\xradius and \yradius}%
+ }%
+ \anchor{north}{%
+ \ellipsecalloutpoints%
+ \centerpoint%
+ \advance\pgf@y\yradius\relax%
+ }
+ \anchor{south}{%
+ \ellipsecalloutpoints%
+ \centerpoint%
+ \advance\pgf@y-\yradius\relax%
+ }
+ \anchor{east}{%
+ \ellipsecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x\xradius\relax%
+ }
+ \anchor{west}{%
+ \ellipsecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x-\xradius\relax%
+ }
+ \anchor{north west}{%
+ \ellipsecalloutpoints%
+ \pgf@xa\xradius\relax%
+ \pgf@ya\yradius\relax%
+ \centerpoint%
+ \advance\pgf@y0.7071067\pgf@ya%
+ \advance\pgf@x-0.7071067\pgf@xa%
+ }
+ \anchor{north east}{%
+ \ellipsecalloutpoints%
+ \pgf@xa\xradius\relax%
+ \pgf@ya\yradius\relax%
+ \centerpoint%
+ \advance\pgf@y0.7071067\pgf@ya%
+ \advance\pgf@x0.7071067\pgf@xa%
+ }
+ \anchor{south west}{%
+ \ellipsecalloutpoints%
+ \pgf@xa\xradius\relax%
+ \pgf@ya\yradius\relax%
+ \centerpoint%
+ \advance\pgf@y-0.7071067\pgf@ya%
+ \advance\pgf@x-0.7071067\pgf@xa%
+ }
+ \anchor{south east}{%
+ \ellipsecalloutpoints%
+ \pgf@xa\xradius\relax%
+ \pgf@ya\yradius\relax%
+ \centerpoint%
+ \advance\pgf@y-0.7071067\pgf@ya%
+ \advance\pgf@x0.7071067\pgf@xa%
+ }
+ \anchor{pointer}{%
+ \ellipsecalloutpoints%
+ \calloutpointeranchor%
+ }%
+ \backgroundpath{%
+ \ellipsecalloutpoints%
+ \ifpgf@lib@callout@absolutepointer%
+ \pgfextract@process\calloutpointer{%
+ \pgfpointanchor{pgf@lib@callout@pointer}{center}%
+ }%
+ \pgf@lib@callouts@shortenpointer%
+ \pgf@lib@ellipsecallout@getpoints%
+ \calloutpointeranchor%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}%
+ \edef\pgf@sh@@@temp{%
+ \noexpand\def\noexpand\calloutpointeranchor{%
+ \noexpand\pgf@x\the\pgf@x%
+ \noexpand\pgf@y\the\pgf@y%
+ }%
+ }%
+ \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}
+ \fi%
+ \fi%
+ \pgfpathmoveto{\calloutpointer}%
+ \pgfpathlineto{\aftercalloutpointer}%
+ \ifdim\aftercalloutangle pt<\beforecalloutangle pt\relax%
+ \pgfpatharc{\aftercalloutangle}{\beforecalloutangle}{\xpathradius and \ypathradius}%
+ \else%
+ \pgfpatharc{\aftercalloutangle}{360}{\xpathradius and \ypathradius}%
+ \pgfpatharc{0}{\beforecalloutangle}{\xpathradius and \ypathradius}%
+ \fi%
+ \pgfpathclose%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \ellipsecalloutpoints%
+ \pgfpointadd{\pgfpointborderellipse{\externalpoint}{\pgfpoint{\xradius}{\yradius}}%
+ }{\centerpoint}%
+ }%
+}
+
+% Internal macro for calculating the points for the
+% ellipse callout pointer.
+%
+% The following must be set up:
+%
+% \centerpoint - the center of the ellipse.
+% \calloutpointer - the location of the callout point.
+% \pointerarc - the width of the pointer.
+% \xpathradius - the x radius of the ellipse.
+% \ypathradius - the y radius of the ellipse.
+%
+\def\pgf@lib@ellipsecallout@getpoints{%
+ \pgfextract@process\borderpoint{%
+ \pgfpointborderellipse{%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \calloutpointer%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ }{\pgfqpoint{\xpathradius}{\ypathradius}}%
+ }%
+ \pgfmathangleonellipse{\borderpoint}{\xpathradius and \ypathradius}%
+ \pgfutil@tempdima\pointerarc pt\relax%
+ \pgfutil@tempdimb\pgfmathresult pt\relax%
+ \advance\pgfutil@tempdimb-.5\pgfutil@tempdima%
+ \ifdim\pgfutil@tempdimb<0pt\relax%
+ \advance\pgfutil@tempdimb360pt\relax%
+ \fi%
+ \edef\beforecalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}%
+ \advance\pgfutil@tempdimb\pgfutil@tempdima%
+ \ifdim\pgfutil@tempdimb<360pt\relax%
+ \else%
+ \advance\pgfutil@tempdimb-360pt\relax%
+ \fi%
+ \edef\aftercalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}%
+ %
+ \pgfextract@process\beforecalloutpointer{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{\beforecalloutangle}{\xpathradius and \ypathradius}%
+ }%
+ }%
+ \pgfextract@process\aftercalloutpointer{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{\aftercalloutangle}{\xpathradius and \ypathradius}%
+ }%
+ }%
+ %
+ % Calculate the pointer anchor.
+ %
+ \pgf@lib@callouts@pointeranchor%
+}
+
+
+% If the callout pointer is very pointed and stroked, the anchor will be
+% miles away from the end of the pointer which will (typically) be
+% bevelled.
+% Using outer sep=0pt is one solution, however, another is provided
+% using this special key:
+%
+% /pgf/callout pointer anchor aspect
+%
+% which takes a value from 0 (ignore any outer sep) to 1 (use
+% the full outer sep).
+
+\pgfkeys{/pgf/callout pointer anchor aspect/.initial=1}
+
+% Internal macro for calculating the anchor for the callout pointer.
+%
+% Requires the following to be set up (points are anti-clockwise)
+%
+% \beforecalloutpointer - point on the border before the callout pointer
+% \calloutpointer
+% \aftercalloutpointer - point on the border after the callout pointer
+% \outersep - the largest of the outer xsep or ysep.
+%
+\def\pgf@lib@callouts@pointeranchor{%
+ \pgfutil@tempdimb\outersep\relax%
+ %
+ \pgfmathanglebetweenlines{\calloutpointer}{\aftercalloutpointer}{\calloutpointer}{\beforecalloutpointer}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \pgfmathanglebetweenpoints{\calloutpointer}{\aftercalloutpointer}%
+ \advance\pgfutil@tempdima\pgfmathresult pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ %
+ \pgfextract@process\calloutpointeranchor{%
+ \pgfpointadd{%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/callout pointer anchor aspect}}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ }{%
+ \calloutpointer%
+ }%
+ }%
+}%
+
+\def\pgf@lib@callouts@shortenpointer{%
+ \pgfextract@process\calloutpointer{%
+ \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}%
+ \let\angle\pgfmathresult%
+ \pgfmathsin@{\angle}%
+ \let\sinpointerangle\pgfmathresult%
+ \pgfmathcos@{\angle}%
+ \let\cospointerangle\pgfmathresult%
+ \pgfpointadd{\calloutpointer}{%
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/callout pointer shorten}}%
+ \pgf@x\cospointerangle\pgfutil@tempdima%
+ \pgf@y\sinpointerangle\pgfutil@tempdima%
+ }%
+ }%
+}%
+
+
+\pgfdeclareshape{rectangle callout}{%
+ \savedmacro\rectanglecalloutpoints{%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \edef\xtemp{\the\pgf@x}%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \edef\ytemp{\the\pgf@y}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ %
+ \edef\xlength{\the\pgf@x}%
+ \edef\ylength{\the\pgf@y}%
+ \addtosavedmacro\xlength%
+ \addtosavedmacro\ylength%
+ %
+ \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}%
+ \addtosavedmacro\pointerwidth%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ %
+ % Process the relative callout pointer.
+ %
+ \ifpgf@lib@callout@absolutepointer%
+ \else%
+ \pgfextract@process\calloutpointer{%
+ \pgfextract@process\borderpoint{%
+ \expandafter\pgfpointborderrectangle\expandafter{\pgf@lib@callout@relativepointer}%
+ {\pgfqpoint{\xtemp}{\ytemp}}%
+ }%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}%
+ \let\pointerangle\pgfmathresult%
+ \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \edef\pointerradius{\pgfmathresult pt}%
+ \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgf@lib@callouts@shortenpointer%
+ \addtosavedmacro\calloutpointer%
+ \pgf@lib@rectanglecallout@pointer%
+ \addtosavedmacro\calloutpointeranchor%
+ \addtosavedmacro\beforecalloutpointer%
+ \addtosavedmacro\aftercalloutpointer%
+ \addtosavedmacro\firstpoint%
+ \addtosavedmacro\secondpoint%
+ \addtosavedmacro\thirdpoint%
+ \addtosavedmacro\fourthpoint%
+ \fi%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5em}%
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{mid}{\midpoint}
+ \anchor{mid east}{%
+ \rectanglecalloutpoints%
+ \midpoint%
+ \advance\pgf@x\xlength\relax%
+ }
+ \anchor{mid west}{%
+ \rectanglecalloutpoints%
+ \midpoint%
+ \advance\pgf@x-\xlength\relax%
+ }
+ \anchor{base}{\basepoint}
+ \anchor{base east}{%
+ \rectanglecalloutpoints%
+ \basepoint%
+ \advance\pgf@x\xlength\relax%
+ }
+ \anchor{base west}{%
+ \rectanglecalloutpoints%
+ \basepoint%
+ \advance\pgf@x-\xlength\relax%
+ }
+ \anchor{north}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@y\ylength\relax%
+ }%
+ \anchor{south}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@y-\ylength\relax%
+ }%
+ \anchor{east}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x\xlength\relax%
+ }%
+ \anchor{west}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x-\xlength\relax%
+ }%
+ \anchor{north east}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x\xlength\relax%
+ \advance\pgf@y\ylength\relax%
+ }%
+ \anchor{south west}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x-\xlength\relax%
+ \advance\pgf@y-\ylength\relax%
+ }%
+ \anchor{south east}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x\xlength\relax%
+ \advance\pgf@y-\ylength\relax%
+ }%
+ \anchor{north west}{%
+ \rectanglecalloutpoints%
+ \centerpoint%
+ \advance\pgf@x-\xlength\relax%
+ \advance\pgf@y\ylength\relax%
+ }%
+ \anchor{pointer}{%
+ \rectanglecalloutpoints%
+ \calloutpointeranchor%
+ }%
+ \backgroundpath{%
+ \rectanglecalloutpoints%
+ \pgf@x\xlength\relax%
+ \pgf@y\ylength\relax%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\xtemp{\the\pgf@x}%
+ \edef\ytemp{\the\pgf@y}%
+ %
+ % The absolute pointer must be calculated here because the
+ % anchor of the shape (which is calculated after the saved
+ % macros and points) affects how the pointer joins the
+ % main rectangle.
+ %
+ \ifpgf@lib@callout@absolutepointer%
+ \pgfextract@process\calloutpointer{%
+ \pgfpointanchor{pgf@lib@callout@pointer}{center}%
+ }%
+ \pgf@lib@callouts@shortenpointer%
+ \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}%
+ \pgf@lib@rectanglecallout@pointer%
+ %
+ % \pgf@test = the shape name (from \pgfmultipartnode)
+ %
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ %
+ % Now hack an extra saved anchor \calloutpointeranchor,
+ % with the new anchor for the callout pointer.
+ %
+ \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}%
+ \edef\pgf@sh@@@temp{%
+ \noexpand\def\noexpand\calloutpointeranchor{%
+ \noexpand\pgf@x\the\pgf@x%
+ \noexpand\pgf@y\the\pgf@y%
+ }%
+ }%
+ \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}%
+ \fi%
+ \fi%
+ {%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathmoveto{\beforecalloutpointer}%
+ }%
+ \pgfpathlineto{\calloutpointer}%
+ {%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathlineto{\aftercalloutpointer}%
+ }%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathlineto{\firstpoint}%
+ \pgfpathlineto{\secondpoint}%
+ \pgfpathlineto{\thirdpoint}%
+ \pgfpathlineto{\fourthpoint}%
+ {%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathclose%
+ }%
+ }
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \rectanglecalloutpoints%
+ \pgfpointadd{\centerpoint}%
+ {%
+ \pgfpointborderrectangle{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ {\pgfqpoint{\xlength}{\ylength}}%
+ }%
+ }%
+}
+
+
+
+% \pgf@lib@rectanglecallout@pointer
+%
+% Internal macro for calculations relating to the rectangle callout.
+%
+% Requires the following to be set up:
+%
+% \calloutpointer - the location of the callout point.
+% \xtemp - the half width of the rectangle
+% \ytemp - the half height of the rectangle
+% \pointerwidth - the width of the pointer.
+%
+\def\pgf@lib@rectanglecallout@pointer{%
+ %
+ % Ensure that the pointer never connects to the main shape
+ % too near to a corner. This is done for two reasons:
+ % 1. It can look ugly.
+ % 2. If the corners are rounded, a mess can result.
+ %
+ \pgfextract@process\borderpoint{%
+ \pgfpointborderrectangle{%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \calloutpointer%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ }{\pgfqpoint{\xtemp}{\ytemp}}%
+ }%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}%
+ \let\borderangle\pgfmathresult%
+ %
+ \pgfutil@tempdima\pointerwidth\relax%
+ \pgf@xa\xtemp\relax%
+ \advance\pgf@xa-\pgfutil@tempdima%
+ \pgf@ya\ytemp\relax%
+ \advance\pgf@ya-\pgfutil@tempdima%
+ %
+ \pgf@process{%
+ \pgfutil@ifundefined{pgf@corner@arc}{\pgfpointorigin}{%
+ \expandafter\pgfqpoint\pgf@corner@arc}%
+ }%
+ \advance\pgf@xa-\pgf@x%
+ \advance\pgf@ya-\pgf@y%
+ %
+ \borderpoint%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ %
+ \pgf@xc0pt\relax%
+ \pgf@yc0pt\relax%
+ %
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{\ytemp}}%
+ \ifdim\borderangle pt<\pgfmathresult pt\relax%
+ \pgf@yc.5\pgfutil@tempdima%
+ \ifdim\pgf@yb>\pgf@ya%
+ \pgf@yb\pgf@ya%
+ \fi%
+ %
+ % Establish the order for drawing the rectangle corners.
+ %
+ \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}%
+ \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}%
+ \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}%
+ \else%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{\ytemp}}%
+ \ifdim\borderangle pt<\pgfmathresult pt\relax%
+ \pgf@xc-.5\pgfutil@tempdima%
+ \ifdim\pgf@xb>\pgf@xa%
+ \pgf@xb\pgf@xa%
+ \else%
+ \ifdim\pgf@xb<-\pgf@xa%
+ \pgf@xb-\pgf@xa%
+ \fi%
+ \fi%
+ \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}%
+ \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}%
+ \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}%
+ \else%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \ifdim\borderangle pt<\pgfmathresult pt\relax%
+ \pgf@yc-.5\pgfutil@tempdima%
+ \ifdim\pgf@yb>\pgf@ya%
+ \pgf@yb\pgf@ya%
+ \else%
+ \ifdim\pgf@yb<-\pgf@ya%
+ \pgf@yb-\pgf@ya%
+ \fi%
+ \fi%
+ \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}%
+ \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}%
+ \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}%
+ \else%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{-\ytemp}}%
+ \ifdim\borderangle pt<\pgfmathresult pt\relax%
+ \pgf@xc.5\pgfutil@tempdima%
+ \ifdim\pgf@xb>\pgf@xa%
+ \pgf@xb\pgf@xa%
+ \else%
+ \ifdim\pgf@xb<-\pgf@xa%
+ \pgf@xb-\pgf@xa%
+ \fi%
+ \fi%
+ \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}%
+ \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}%
+ \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}%
+ \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \else%
+ \pgf@yc.5\pgfutil@tempdima%
+ \ifdim\pgf@yb<-\pgf@ya%
+ \pgf@yb-\pgf@ya%
+ \fi%
+ \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}%
+ \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}%
+ \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}%
+ \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgfextract@process\beforecalloutpointer{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ \advance\pgf@x-\pgf@xc%
+ \advance\pgf@y-\pgf@yc%
+ }%
+ \pgfextract@process\aftercalloutpointer{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ \advance\pgf@x\pgf@xc%
+ \advance\pgf@y\pgf@yc%
+ }%
+ %
+ % Now calculate the pointer anchor.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x>\pgf@y%
+ \edef\outersep{\the\pgf@x}%
+ \else%
+ \edef\outersep{\the\pgf@y}%
+ \fi%
+ \pgf@lib@callouts@pointeranchor%
+}
+
+
+% Internal macro for parsing the size of
+% the cloud callout pointer.
+%
+% \pgf@x and \pgf@y should be set up as the
+% width and height of the main shape.
+%
+% \pgf@xa and \pgf@ya are returned appropriately.
+%
+\def\pgf@lib@callout@setpointersize#1{%
+ \edef\pgf@lib@callout@temp{#1}%
+ \edef\pgf@marshall{\noexpand\pgfutil@in@{of callout}{\pgf@lib@callout@temp}}%
+ \pgf@marshall%
+ \ifpgfutil@in@%
+ \expandafter\pgf@xa\expandafter\pgf@lib@callout@setpointerrelativesize%
+ \pgf@lib@callout@temp\pgf@lib@stop\pgf@x%
+ \expandafter\pgf@ya\expandafter\pgf@lib@callout@setpointerrelativesize%
+ \pgf@lib@callout@temp\pgf@lib@stop\pgf@y%
+ \else%
+ \edef\pgf@marshall{\noexpand\pgfutil@in@{and}{\pgf@lib@callout@temp}}%
+ \pgf@marshall%
+ \ifpgfutil@in@%
+ \expandafter\pgf@lib@callout@setpointerbothsizes\pgf@lib@callout@temp\pgf@lib@stop%
+ \else%
+ \pgfmathsetlength\pgf@xa{#1}%
+ \pgfmathsetlength\pgf@ya{#1}%
+ \fi%
+ \fi%
+}
+\def\pgf@lib@callout@setpointerrelativesize#1of callout#2\pgf@lib@stop{#1}%
+\def\pgf@lib@callout@setpointerbothsizes#1and#2\pgf@lib@stop{%
+ \pgfmathsetlength\pgf@xa{#2}%
+ \pgfmathsetlength\pgf@ya{#2}%
+}
+
+% Shape: cloud callout.
+%
+\pgfdeclareshape{cloud callout}{%
+ \savedanchor\calloutpointer{%
+ \pgfutil@ifundefined{pgf@sh@s@cloud}{%
+ \PackageError{PGF}{I cannot find the cloud shape. Please load the `symbol shapes' library}{}}{}%
+ \pgf@sh@s@cloud%
+ \pgf@sh@savedmacros%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \ifpgf@lib@callout@absolutepointer%
+ \else%
+ \pgfextract@process\calloutpointer{%
+ \pgfextract@process\borderpoint{%
+ \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}%
+ {\pgfqpoint{\xouterradius}{\youterradius}}%
+ }%
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}%
+ \let\pointerangle\pgfmathresult%
+ \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \edef\pointerradius{\pgfmathresult pt}%
+ \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgf@lib@callouts@shortenpointer%
+ \fi%
+ }
+ \anchor{pointer}{%
+ \calloutpointer%
+ }%
+ \inheritsavedanchors[from=cloud]
+ \inheritanchor[from=cloud]{center}
+ \inheritanchor[from=cloud]{base}
+ \inheritanchor[from=cloud]{mid}
+ \inheritanchor[from=cloud]{north}
+ \inheritanchor[from=cloud]{south}
+ \inheritanchor[from=cloud]{east}
+ \inheritanchor[from=cloud]{west}
+ \inheritanchor[from=cloud]{north east}
+ \inheritanchor[from=cloud]{south west}
+ \inheritanchor[from=cloud]{south east}
+ \inheritanchor[from=cloud]{north west}
+ \inheritanchorborder[from=cloud]
+ \backgroundpath{%
+ \pgf@sh@bg@cloud%
+ \ifpgf@lib@callout@absolutepointer%
+ \pgfextract@process\calloutpointer{%
+ \pgfpointanchor{pgf@lib@callout@pointer}{center}%
+ }%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}%
+ \edef\pgf@sh@@@temp{%
+ \noexpand\def\noexpand\calloutpointeranchor{%
+ \noexpand\pgf@x\the\pgf@x%
+ \noexpand\pgf@y\the\pgf@y%
+ }%
+ }%
+ \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}
+ \fi%
+ \fi%
+ %
+ \pgfextract@process\borderpoint{%
+ \pgfpointadd{%
+ \pgfpointborderellipse{\pgfpointdiff{\centerpoint}{\calloutpointer}}%
+ {\pgfqpoint{\xouterradius}{\youterradius}}%
+ }{\centerpoint}%
+ }%
+ \pgf@lib@callouts@shortenpointer%
+ \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}%
+ \let\angle\pgfmathresult%
+ \pgfmathsin@{\angle}%
+ \let\sinpointerangle\pgfmathresult%
+ \pgfmathcos@{\angle}%
+ \let\cospointerangle\pgfmathresult%
+ %
+ \pgf@x\xouterradius\relax%
+ \pgf@x2.0\pgf@x%
+ \pgf@y\yinnerradius\relax%
+ \pgf@y2.0\pgf@y%
+ \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer start size}}%
+ \pgf@xb\pgf@xa%
+ \pgf@yb\pgf@ya%
+ \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer end size}}%
+ \advance\pgf@xb-\pgf@xa%
+ \advance\pgf@yb-\pgf@ya%
+ %
+ \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/callout pointer segments}}%
+ \divide\pgf@xb\c@pgf@counta%
+ \divide\pgf@yb\c@pgf@counta%
+ %
+ \pgf@process{\pgfpointdiff{\borderpoint}{\calloutpointer}}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \divide\pgfutil@tempdima\c@pgf@counta%
+ %
+ \pgfutil@tempdimb0pt\relax%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\c@pgf@counta%
+ \else%
+ {%
+ \pgf@xa.5\pgf@xa%
+ \pgf@ya.5\pgf@ya%
+ \edef\tempxradius{\the\pgf@xa}%
+ \edef\tempyradius{\the\pgf@ya}%
+ \pgfpathellipse%
+ {%
+ \calloutpointer%
+ \advance\pgf@x\cospointerangle\pgfutil@tempdimb%
+ \advance\pgf@y\sinpointerangle\pgfutil@tempdimb%
+ }%
+ {\pgfqpoint{\tempxradius}{0pt}}{\pgfqpoint{0pt}{\tempyradius}}%
+ }%
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@ya\pgf@yb%
+ \advance\pgfutil@tempdimb\pgfutil@tempdima%
+ \repeatpgfmathloop%
+ }%
+ %
+ % Hack the puff anchors for the callout.
+ %
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@cloud callout\endcsname{%
+ \c@pgf@counta\puffs\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \pgfutil@ifundefined{pgf@anchor@cloud callout@puff\space\the\c@pgf@counta}{%
+ \expandafter\xdef\csname pgf@anchor@cloud callout@puff\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}%
+ }%
+ }{\c@pgf@counta0\relax}%
+ \advance\c@pgf@counta-1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex
new file mode 100644
index 00000000000..fc0b1d20aa5
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex
@@ -0,0 +1,21 @@
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
+
+% Only the following are loaded by default and only for historical
+% reasons.
+
+\usepgflibrary{shapes.geometric}
+\usepgflibrary{shapes.misc}
+\usepgflibrary{shapes.symbols}
+
+% Further libraries should be included directly
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex
new file mode 100644
index 00000000000..ae7ec0f3c4e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex
@@ -0,0 +1,4419 @@
+% Copyright 2006 by Till Tantau and Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
+
+\pgfdeclareshape{ellipse}
+%
+% Draws a circle around the text
+%
+{
+ \savedanchor\centerpoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgf@y=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\radius{%
+ %
+ % Caculate ``height radius''
+ %
+ \pgf@y=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y by.5\dp\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y by\pgf@yb%
+ %
+ % Caculate ``width radius''
+ %
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x by\pgf@xb%
+ %
+ % Adjust
+ %
+ \pgf@x=1.4142136\pgf@x%
+ \pgf@y=1.4142136\pgf@y%
+ %
+ % Adjust hieght, if necessary
+ %
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@yc%
+ \pgf@y=.5\pgf@yc%
+ \fi%
+ %
+ % Adjust width, if necessary
+ %
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<.5\pgf@xc%
+ \pgf@x=.5\pgf@xc%
+ \fi%
+ %
+ % Add outer sep
+ %
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \advance\pgf@x by\pgf@xb%
+ \advance\pgf@y by\pgf@yb%
+ }
+
+ %
+ % Anchors
+ %
+ \anchor{center}{\centerpoint}
+ \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}}
+ \anchor{base}{\centerpoint\pgf@y=0pt}
+ \anchor{north}
+ {
+ \pgf@process{\radius}
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@y by\pgf@ya
+ }
+ \anchor{south}
+ {
+ \pgf@process{\radius}
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@y by-\pgf@ya
+ }
+ \anchor{west}
+ {
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by-\pgf@xa
+ }
+ \anchor{mid west}
+ {%
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by-\pgf@xa%
+ \pgfmathsetlength\pgf@y{.5ex}
+ }
+ \anchor{base west}
+ {%
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by-\pgf@xa%
+ \pgf@y=0pt
+ }
+ \anchor{north west}
+ {
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by-0.707107\pgf@xa
+ \advance\pgf@y by0.707107\pgf@ya
+ }
+ \anchor{south west}
+ {
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by-0.707107\pgf@xa
+ \advance\pgf@y by-0.707107\pgf@ya
+ }
+ \anchor{east}
+ {%
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by\pgf@xa
+ }
+ \anchor{mid east}
+ {%
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by\pgf@xa%
+ \pgfmathsetlength\pgf@y{.5ex}
+ }
+ \anchor{base east}
+ {%
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by\pgf@xa%
+ \pgf@y=0pt
+ }
+ \anchor{north east}
+ {
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by0.707107\pgf@xa
+ \advance\pgf@y by0.707107\pgf@ya
+ }
+ \anchor{south east}
+ {
+ \pgf@process{\radius}
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\centerpoint}
+ \advance\pgf@x by0.707107\pgf@xa
+ \advance\pgf@y by-0.707107\pgf@ya
+ }
+ \anchorborder{
+ \edef\pgf@marshal{%
+ \noexpand\pgfpointborderellipse
+ {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}
+ {\noexpand\radius}%
+ }%
+ \pgf@marshal%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \centerpoint%
+ \advance\pgf@x by\pgf@xa%
+ \advance\pgf@y by\pgf@ya%
+ }
+
+ %
+ % Background path
+ %
+ \backgroundpath
+ {
+ \pgf@process{\radius}%
+ \pgfutil@tempdima=\pgf@x%
+ \pgfutil@tempdimb=\pgf@y%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \advance\pgfutil@tempdimb by-\pgf@yb%
+ \pgfpathellipse{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}{\pgfqpoint{0pt}{\pgfutil@tempdimb}}%
+ }
+}
+
+
+
+
+% Set the recommended shape aspect ratio
+%
+% #1 = aspect ratio
+%
+% Example:
+%
+% \pgfsetshapeaspect{1.5}
+
+% Keys for shape aspect ratio.
+%
+% /pgf/aspect : recommended width/height quotient.
+%
+\pgfkeys{/pgf/.cd,
+ aspect/.code={\pgfsetshapeaspect{#1}},% this for tikz...
+ shape aspect/.initial=1,% but this is consistent with other pgfset stuff.
+ shape aspect/.code={%
+ \pgfkeys{/pgf/aspect=#1}%
+ \pgfkeyssetvalue{/pgf/shape aspect}{#1}
+ }%
+}
+
+
+\def\pgfsetshapeaspect#1{%
+ \def\pgfshapeaspect{#1}%
+ % Invert
+ \pgfutil@tempdima=#1pt%
+ \pgfutil@tempdima=.125\pgfutil@tempdima%
+ \c@pgf@counta=\pgfutil@tempdima\relax% 8192*determinant
+ \pgfutil@tempdima=8192pt%
+ \divide\pgfutil@tempdima by\c@pgf@counta%
+ \edef\pgfshapeaspectinverse{\pgf@sys@tonumber{\pgfutil@tempdima}}
+}
+
+\pgfsetshapeaspect{1}
+
+\pgfdeclareshape{diamond}
+{
+ \savedanchor\outernortheast{%
+ %
+ % Calculate width and height of the inner rectangle
+ %
+ \pgf@xa=.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa by\pgf@xc%
+ \pgf@ya=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya by\pgf@yc%
+ %
+ % Calculate width and height of diamond
+ %
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by\pgfshapeaspect\pgf@ya%
+ \pgf@y=\pgfshapeaspectinverse\pgf@xa%
+ \advance\pgf@y by\pgf@ya%
+ %
+ % Check against minimum height/width
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@xb=.5\pgf@xb%
+ \ifdim\pgf@x<\pgf@xb%
+ % yes, too small. Enlarge...
+ \pgf@x=\pgf@xb%
+ \fi%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@yb=.5\pgf@yb%
+ \ifdim\pgf@y<\pgf@yb%
+ % yes, too small. Enlarge...
+ \pgf@y=\pgf@yb%
+ \fi%
+ %
+ % Add outer border
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \advance\pgf@x by\pgf@xa%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \advance\pgf@y by\pgf@ya%
+ }
+ \savedanchor\text{%
+ \pgf@x=-.5\wd\pgfnodeparttextbox%
+ \pgf@y=-.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y by.5\dp\pgfnodeparttextbox%
+ }
+
+ %
+ % Anchors
+ %
+ \anchor{text}{\text}%
+ \anchor{center}{\pgfpointorigin}%
+ \anchor{mid}{%
+ \pgf@process{\text}%
+ \pgf@x=0pt%
+ \pgfmathsetlength\pgf@ya{.5ex}
+ \advance\pgf@y by\pgf@ya%
+ }
+ \anchor{base}{\pgf@process{\text}\pgf@x=0pt }
+ \anchor{north}{\pgf@process{\outernortheast}\pgf@x=0pt}
+ \anchor{south}{\pgf@process{\outernortheast}\pgf@x=0pt\pgf@y=-\pgf@y}
+ \anchor{west}{\pgf@process{\outernortheast}\pgf@x=-\pgf@x\pgf@y=0pt}
+ \anchor{north west}{\pgf@process{\outernortheast}\pgf@x=-.5\pgf@x\pgf@y=.5\pgf@y}
+ \anchor{south west}{\pgf@process{\outernortheast}\pgf@x=-.5\pgf@x\pgf@y=-.5\pgf@y}
+ \anchor{east}{\pgf@process{\outernortheast}\pgf@y=0pt}
+ \anchor{north east}{\pgf@process{\outernortheast}\pgf@x=.5\pgf@x\pgf@y=.5\pgf@y}
+ \anchor{south east}{\pgf@process{\outernortheast}\pgf@x=.5\pgf@x\pgf@y=-.5\pgf@y}
+ \anchorborder{%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\outernortheast}%
+ \ifdim\pgf@xa>0pt%
+ \else%
+ \pgf@x=-\pgf@x%
+ \fi%
+ \ifdim\pgf@ya>0pt%
+ \else%
+ \pgf@y=-\pgf@y%
+ \fi%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpointintersectionoflines
+ {\noexpand\pgfpointorigin}
+ {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}
+ {\noexpand\pgfqpoint{\the\pgf@x}{0pt}}
+ {\noexpand\pgfqpoint{0pt}{\the\pgf@y}}%
+ }%
+ \pgf@process{\pgf@marshal}%
+ }
+
+ %
+ % Background path
+ %
+ \backgroundpath{
+ \pgf@process{\outernortheast}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \advance\pgf@xc by-1.414213\pgf@xa%
+ \advance\pgf@yc by-1.414213\pgf@ya%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xc}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-\pgf@xc}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@yc}}%
+ \pgfpathclose%
+ }
+}
+
+
+
+
+
+
+\newif\ifpgf@lib@shapes@starouterradiususesratio
+\pgf@lib@shapes@starouterradiususesratiotrue
+
+% Keys for star shape
+%
+% /pgf/star points : Number of points on the star.
+% /pgf/star point height : The height of the outer star points.
+% /pgf/star point ratio : The ratio of the outer point and inner point radii.
+
+\pgfkeys{/pgf/.cd,
+ star points/.initial=5,
+ star point height/.initial=.5cm,
+ star point height/.code={%
+ \def\pgf@lib@temp{#1}%
+ \pgfkeyslet{/pgf/star point height}{\pgf@lib@temp}%
+ \pgf@lib@shapes@starouterradiususesratiofalse%
+ },
+ star point ratio/.initial=1.5,
+ star point ratio/.code={%
+ \def\pgf@lib@temp{#1}%
+ \pgfkeyslet{/pgf/star point ratio}{\pgf@lib@temp}%
+ \pgf@lib@shapes@starouterradiususesratiotrue%
+ },%
+ star rotate/.style={/pgf/shape border rotate=#1}% For compatability with 1.18
+}
+
+
+% Shape star.
+%
+\pgfdeclareshape{star}{
+ \savedmacro\totalstarpoints{%
+ \pgfmathsetcounter{pgf@counta}{\pgfkeysvalueof{/pgf/star points}}%
+ \multiply\c@pgf@counta2\relax%
+ \edef\totalstarpoints{\the\c@pgf@counta}%
+ }
+ \savedmacro\anglestep{%
+ \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/star points}}%
+ \let\anglestep\pgfmathresult%
+ }
+ \savedmacro\calculateradii{%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \ifdim\pgf@y>\pgf@x%
+ \pgf@x\pgf@y%
+ \fi%
+ %
+ % Calculate the incircle radius.
+ %
+ \pgf@x1.41421\pgf@x%
+ \edef\innerradius{\the\pgf@x}%
+ %
+ % Calculate the circumcircle radius.
+ %
+ % Use the star point height or the star point ratio?
+ %
+ \ifpgf@lib@shapes@starouterradiususesratio%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/star point ratio}}%
+ \expandafter\pgf@x\pgfmathresult\pgf@x%
+ \else%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/star point height}}%
+ \fi%
+ \pgf@xc\pgf@x%
+ %
+ % Accommodate the larger of the minimum height/width.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@ya>\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \edef\outerradius{\the\pgf@x}%
+ %
+ % If the outer radius has been enlarged, adjust the inner radius...
+ %
+ \ifdim\pgf@x>\pgf@xc%
+ %
+ % ...using the star point ratio, or...
+ %
+ \ifpgf@lib@shapes@starouterradiususesratio%
+ \pgfmathreciprocal{\pgfkeysvalueof{/pgf/star point ratio}}%
+ \pgf@xa\pgfmathresult\pgf@x\relax%
+ \edef\innerradius{\the\pgf@xa}%
+ \else%
+ %
+ % The star point height.
+ %
+ \pgf@xa\pgf@x\relax%
+ \pgfmathaddtolength\pgf@xa{-\pgfkeysvalueof{/pgf/star point height}}%
+ \edef\innerradius{\the\pgf@xa}%
+ \fi%
+ \fi%
+ \edef\outerradius{\the\pgf@x}%
+ %
+ % Now calculate the anchor radii from the outer sep.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@ya>\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \fi
+ %
+ % Take into account the miter length...
+ %
+ \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/star points}}%
+ \let\angletofirstpoint\pgfmathresult%
+ \pgfmathmultiply@{\angletofirstpoint}{2}%
+ \let\angletosecondpoint\pgfmathresult%
+ %
+ % ...for the outer radius...
+ %
+ \pgfmathanglebetweenlines%
+ {\pgfqpointpolar{\angletofirstpoint}{\outerradius}}%
+ {\pgfqpointpolar{\angletosecondpoint}{\innerradius}}%
+ {\pgfqpointpolar{\angletofirstpoint}{\outerradius}}%
+ {\pgfqpointpolar{0}{\innerradius}}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@x\outerradius\relax%
+ \advance\pgf@x\pgfmathresult\pgf@xa%
+ \edef\anchorouterradius{\the\pgf@x}%
+ %
+ % ...and for the inner radius.
+ %
+ \pgfmathanglebetweenlines%
+ {\pgfqpointpolar{\angletofirstpoint}{\innerradius}}%
+ {\pgfqpointpolar{0}{\outerradius}}%
+ {\pgfqpointpolar{\angletofirstpoint}{\innerradius}}%
+ {\pgfqpointpolar{\angletosecondpoint}{\outerradius}}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@x\innerradius\relax%
+ \advance\pgf@x\pgfmathresult\pgf@xa%
+ \edef\anchorinnerradius{\the\pgf@x}%
+ %
+ % Save all radii.
+ %
+ \addtosavedmacro{\innerradius}%
+ \addtosavedmacro{\outerradius}%
+ \addtosavedmacro{\anchorinnerradius}%
+ \addtosavedmacro{\anchorouterradius}%
+ }
+ \savedmacro\startangle{%
+ \pgfmathadd{90}{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \let\startangle\pgfmathresult%
+ }
+ %
+ % Saved anchors.
+ %
+ \savedanchor{\centerpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor{\midpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % Other anchors.
+ %
+%
+ % Other anchors.
+ %
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}}%
+ \anchor{base}{\centerpoint\pgf@y=0pt}%
+ \anchor{north}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{\anchorouterradius}}}%
+ \anchor{south}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{-\anchorouterradius}}}%
+ \anchor{east}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{0pt}}}%
+ \anchor{west}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{0pt}}}%
+ \anchor{north east}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{\anchorouterradius}}}%
+ \anchor{north west}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{\anchorouterradius}}}%
+ \anchor{south east}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{-\anchorouterradius}}}%
+ \anchor{south west}{%
+ \calculateradii%
+ \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{-\anchorouterradius}}}%
+ %
+ % Background path.
+ %
+ \backgroundpath{%
+ \calculateradii%
+ \let\angle\startangle%
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\startangle}{\outerradius}}}%
+ \pgfmathloop%
+ \pgfmathadd@{\angle}{\anglestep}%
+ \let\angle\pgfmathresult%
+ \ifnum\pgfmathcounter=\totalstarpoints%
+ \pgfpathclose%
+ \else%
+ \ifodd\pgfmathcounter
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\innerradius}}}%
+ \else%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\outerradius}}}%
+ \fi%
+ \repeatpgfmathloop%
+ }%
+ %
+ % Define points on the anchor border.
+ %
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Adjust the location of the external
+ % point relative to \centerpoint.
+ %
+ \centerpoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Get the angle of the external point to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ %
+ % Locate the appropriate sides on the star border...
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\startangle}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \pgfmathdivide@{\pgfmathresult}{\anglestep}%
+ \pgfmathfloor@{\pgfmathresult}%
+ \afterassignment\pgfmath@gobbletilpgfmath@
+ \c@pgf@counta\pgfmathresult\relax\pgfmath@
+ \pgfmathmultiply@{\pgfmathresult}{\anglestep}%
+ \pgfmathadd@{\pgfmathresult}{\startangle}%
+ \let\firstangle\pgfmathresult%
+ \pgfmathadd@{\pgfmathresult}{\anglestep}%
+ \let\secondangle\pgfmathresult%
+ \calculateradii%
+ %
+ % ...and thus, the point on the star border.
+ %
+ \ifodd\c@pgf@counta
+ \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\firstangle}{+\anchorinnerradius}}%
+ }%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\secondangle}{+\anchorouterradius}}%
+ }%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\firstangle}{+\anchorouterradius}}%
+ }%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\secondangle}{+\anchorinnerradius}}%
+ }%
+ \fi%
+ }
+ %
+ % Some hackery. This is needed if a star is positioned using
+ % a `...point <n+1>' anchor, where n is the maximum number of
+ % points of any previously drawn star.
+ %
+ \pgfutil@g@addto@macro\pgf@sh@s@star{%
+ \c@pgf@counta\totalstarpoints\relax%
+ \divide\c@pgf@counta2\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \c@pgf@countb\c@pgf@counta\relax%
+ \advance\c@pgf@countb-1\relax%
+ \pgfutil@ifundefined{pgf@anchor@star@inner point\space\the\c@pgf@counta}{%
+ \expandafter\xdef\csname pgf@anchor@star@inner point\space\the\c@pgf@counta\endcsname{%
+ \noexpand\calculateradii%
+ \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}%
+ \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}%
+ \noexpand\let\noexpand\angle\noexpand\pgfmathresult%
+ \noexpand\pgfpointadd{\noexpand\centerpoint}%
+ {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorinnerradius}}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@star@outer point\space\the\c@pgf@counta\endcsname{%
+ \noexpand\calculateradii%
+ \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}%
+ \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}%
+ \noexpand\let\noexpand\angle\noexpand\pgfmathresult%
+ \noexpand\pgfpointadd{\noexpand\centerpoint}%
+ {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorouterradius}}%
+ }%
+ }{\c@pgf@counta0\relax}%
+ \advance\c@pgf@counta-1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+
+
+
+% Keys for shape regular polygon
+%
+% /pgf/regular polygon sides
+%
+\pgfkeys{/pgf/.cd,
+ regular polygon sides/.initial=5,
+ regular polygon rotate/.style={/pgf/shape border rotate=#1}% For compatability with 1.18
+}
+
+
+% Shape Regular Polygon.
+%
+\pgfdeclareshape{regular polygon}{
+ \savedmacro\sides{%
+ \pgfmathtruncatemacro\sides{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ }
+ \savedmacro\anglestep{%
+ \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ \let\anglestep\pgfmathresult%
+ }
+ \savedmacro\calculateradii{%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \ifdim\pgf@y>\pgf@x%
+ \pgf@x\pgf@y%
+ \fi%
+ %
+ % Calculate i, the incircle radius
+ %
+ \pgf@x1.41421\pgf@x%
+ %
+ % Calculate r, the polygon radius
+ %
+ % r = i / cos(360 / s / 2)
+ %
+ % (s = polygon sides)
+ %
+ \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ \pgfmathsec@{\pgfmathresult}%
+ \pgf@x\pgfmathresult\pgf@x%
+ %
+ % Accommodate the minimum width/height.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@ya>\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \edef\radius{\the\pgf@x}%
+ %
+ % Now calculate the anchor radius from the outer sep.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@ya>\pgf@xa%
+ \pgf@xa\pgf@ya%
+ \fi
+ %
+ % Take into account the miter length.
+ %
+ % m = o / sin (90 - (360 / s / 2))
+ %
+ % (o = outer sep, s = sides)
+ %
+ \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ \pgfmathsubtract@{90}{\pgfmathresult}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \advance\pgf@x\pgfmathresult\pgf@xa%
+ \edef\anchorradius{\the\pgf@x}%
+ %
+ % Save both radii.
+ %
+ \addtosavedmacro{\radius}%
+ \addtosavedmacro{\anchorradius}%
+ }
+ \savedmacro\startangle{%
+ \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ \let\anglestep\pgfmathresult%
+ \pgfmathtruncatemacro\sides{\pgfkeysvalueof{/pgf/regular polygon sides}}%
+ \expandafter\ifodd\sides\relax%
+ \edef\pgfmathresult{90}%
+ \else%
+ \pgfmathdivide@{\anglestep}{2}%
+ \pgfmathsubtract@{90}{\pgfmathresult}%
+ \fi%
+ \pgfmathadd{\pgfmathresult}{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \let\startangle\pgfmathresult%
+ }
+ %
+ % Saved anchors.
+ %
+ \savedanchor{\centerpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor{\midpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % Other anchors.
+ %
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{base}{\centerpoint\pgf@y=0pt}%
+ \anchor{north}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{0pt}{\anchorradius}}}%
+ \anchor{south}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{0pt}{-\anchorradius}}}%
+ \anchor{east}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{0pt}}}%
+ \anchor{west}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{0pt}}}%
+ \anchor{north east}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{\anchorradius}}}%
+ \anchor{north west}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{\anchorradius}}}%
+ \anchor{south east}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{-\anchorradius}}}%
+ \anchor{south west}{%
+ \calculateradii%
+ \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{-\anchorradius}}}%
+ %
+ % Background path.
+ %
+ \backgroundpath{%
+ \calculateradii%
+ \pgfpathmoveto{%
+ \pgfpointadd{\centerpoint}{\pgfqpointpolar{\startangle}{\radius}}%
+ }%
+ \let\angle\startangle%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\sides\relax%
+ \pgfpathclose%
+ \else%
+ \pgfmathadd@{\angle}{\anglestep}%
+ \let\angle\pgfmathresult%
+ \pgfpathlineto{%
+ \pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\radius}}%
+ }%
+ \repeatpgfmathloop%
+ }%
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Adjust the location of the external
+ % point relative to \centerpoint.
+ %
+ \centerpoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Get the angle of the external point to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ %
+ % Locate the appropriate sides on the polygon border...
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\startangle}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \pgfmathdivide@{\pgfmathresult}{\anglestep}%
+ \pgfmathfloor@{\pgfmathresult}%
+ \pgfmathmultiply@{\pgfmathresult}{\anglestep}%
+ \pgfmathadd@{\pgfmathresult}{\startangle}%
+ \let\firstangle\pgfmathresult%
+ \pgfmathadd@{\pgfmathresult}{\anglestep}%
+ \let\secondangle\pgfmathresult%
+ \calculateradii%
+ %
+ % ...and thus, the point on the polygon border.
+ %
+ \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\firstangle}{+\anchorradius}}%
+ }%
+ {%
+ \pgfpointadd{\centerpoint}%
+ {\pgfqpointpolar{+\secondangle}{+\anchorradius}}%
+ }%
+ }
+ %
+ % More hackery for when the recuglar polygon is positioned using
+ % a `corner <n+1>' or `side <n+1>' anchor, where n is the maximum
+ % number of sides of any previously drawn regular polygon.
+ %
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@regular polygon\endcsname{%
+ \c@pgf@counta\sides\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \pgfutil@ifundefined{pgf@anchor@regular polygon@corner\space\the\c@pgf@counta}{%
+ %
+ % ...(manually \xdef as \gdef is normally used by \anchor)...
+ %
+ \expandafter\xdef\csname pgf@anchor@regular polygon@corner\space\the\c@pgf@counta\endcsname{%
+ \noexpand\calculateradii%
+ \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}%
+ \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}%
+ \noexpand\let\noexpand\angle\noexpand\pgfmathresult%
+ \noexpand\pgfpointadd{\noexpand\centerpoint}%
+ {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorradius}}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@regular polygon@side\space\the\c@pgf@counta\endcsname{%
+ \noexpand\calculateradii%
+ \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}%
+ \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}%
+ \noexpand\let\noexpand\firstangle\noexpand\pgfmathresult%
+ \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}%
+ \noexpand\let\noexpand\secondangle\noexpand\pgfmathresult%
+ \noexpand\pgfpointlineattime{0.5}%
+ {\noexpand\pgfpointadd{\noexpand\centerpoint}%
+ {\noexpand\pgfqpointpolar{\noexpand\firstangle}{\noexpand\anchorradius}}}%
+ {\noexpand\pgfpointadd{\noexpand\centerpoint}%
+ {\noexpand\pgfqpointpolar{\noexpand\secondangle}{\noexpand\anchorradius}}}%
+ }%
+ }{\c@pgf@counta0\relax}%
+ \advance\c@pgf@counta-1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+
+
+% Keys for shape trapezium
+%
+% /pgf/trapezium left angle : angle of the left side.
+% /pgf/trapezium right angle : angle of the right side.
+
+\pgfkeys{/pgf/.cd,
+ trapezium left angle/.initial=60,
+ trapezium right angle/.initial=60,
+ trapezium angle/.style={
+ /pgf/trapezium left angle=#1,
+ /pgf/trapezium right angle=#1
+ },%
+ trapezium stretches/.is if=pgf@lib@sh@trapeziumstretches,%
+ trapezium stretches body/.is if=pgf@lib@sh@trapeziumstretchesbody%
+}
+
+\newif\ifpgf@lib@sh@trapeziumstretchesbody
+\newif\ifpgf@lib@sh@trapeziumstretches
+
+
+% Shape trapezium.
+%
+\pgfdeclareshape{trapezium}{
+ \savedmacro\installtrapeziumparameters{%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \ifpgfshapeborderusesincircle%
+ %
+ % Get the rotation (no rounding).
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ %
+ % Use the radius of the incircle if required...
+ %
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ \pgf@y\pgf@x%
+ \else%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ \fi%
+ \pgfmathmod{\pgfkeysvalueof{/pgf/trapezium left angle}}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\leftangle\pgfmathresult%
+ \ifdim\leftangle pt=0pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \pgfmathcot@{\leftangle}%
+ \fi%
+ \pgf@xa2\pgf@y%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfmathmod{\pgfkeysvalueof{/pgf/trapezium right angle}}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\rightangle\pgfmathresult%
+ \ifdim\rightangle pt=0pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \pgfmathcot@{\rightangle}%
+ \fi%
+ \pgf@xb2\pgf@y%
+ \pgf@xb\pgfmathresult\pgf@xb%
+ %
+ % Take into account minimum height and width.
+ %
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \ifpgf@lib@sh@trapeziumstretches%
+ \pgf@y.5\pgf@ya%
+ \else%
+ \ifpgf@lib@sh@trapeziumstretchesbody%
+ \pgf@y.5\pgf@ya%
+ \else%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@y}}%
+ \pgf@yb.5\pgf@ya%
+ \pgf@yb\pgfmathresult\pgf@yb%
+ \pgf@y.5\pgf@ya%
+ \pgf@x\pgfmath@tonumber{\pgf@yb}\pgf@x%
+ \pgf@xa\pgfmath@tonumber{\pgf@yb}\pgf@xa%
+ \pgf@xb\pgfmath@tonumber{\pgf@yb}\pgf@xb%
+ \fi%
+ \fi%
+ \fi%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@xc2\pgf@x%
+ \ifdim\pgf@xa<0pt\relax%
+ \advance\pgf@xc-\pgf@xa%
+ \else%
+ \advance\pgf@xc\pgf@xa%
+ \fi%
+ \ifdim\pgf@xb<0pt\relax%
+ \advance\pgf@xc-\pgf@xb%
+ \else%
+ \advance\pgf@xc\pgf@xb%
+ \fi%
+ \ifdim\pgf@xc<\pgf@ya%
+ \ifpgf@lib@sh@trapeziumstretchesbody%
+ \pgf@xc-\pgf@xc%
+ \advance\pgf@xc\pgf@ya%
+ \advance\pgf@x.5\pgf@xc%
+ \else%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@xc}}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgf@x\pgfmath@tonumber{\pgf@ya}\pgf@x%
+ \pgf@xa\pgfmath@tonumber{\pgf@ya}\pgf@xa%
+ \pgf@xb\pgfmath@tonumber{\pgf@ya}\pgf@xb%
+ \ifpgf@lib@sh@trapeziumstretches%
+ \else%
+ \pgf@y\pgfmath@tonumber{\pgf@ya}\pgf@y%
+ \fi%
+ \fi%
+ \fi%
+ \edef\halfheight{\the\pgf@y}%
+ \edef\halfwidth{\the\pgf@x}%
+ \edef\leftextension{\the\pgf@xa}%
+ \edef\rightextension{\the\pgf@xb}%
+ \pgf@xc2\pgf@x%
+ %
+ % Take the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@y>\pgf@x%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % The \externalradius is a length that is
+ % guarenteed to produce a point outside the trapezium.
+ %
+ \advance\pgf@xc2.0\pgf@x%
+ \pgf@yc\halfheight\relax%
+ \multiply\pgf@yc2\relax%
+ \advance\pgf@yc2.0\pgf@x%
+ \ifdim\pgf@xc<\pgf@yc%
+ \edef\externalradius{\the\pgf@yc}%
+ \else%
+ \edef\externalradius{\the\pgf@xc}%
+ \fi%
+ %
+ % Calculate the centre base and mid poins of the node.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfextract@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \pgfextract@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % Calculate each point on the trapezium (without rotation).
+ %
+ \pgfextract@process\lowerleftpoint{%
+ \centerpoint%
+ \advance\pgf@x-\halfwidth\relax%
+ \ifdim\leftextension>0pt\relax%
+ \advance\pgf@x-\leftextension\relax%
+ \fi%
+ \advance\pgf@y-\halfheight\relax%
+ }%
+ \pgfextract@process\upperleftpoint{%
+ \centerpoint%
+ \advance\pgf@x-\halfwidth\relax%
+ \ifdim\leftextension<0pt\relax%
+ \advance\pgf@x\leftextension\relax%
+ \fi%
+ \advance\pgf@y\halfheight\relax%
+ }%
+ \pgfextract@process\upperrightpoint{%
+ \centerpoint%
+ \advance\pgf@x\halfwidth\relax%
+ \ifdim\rightextension<0pt\relax%
+ \advance\pgf@x-\rightextension\relax%
+ \fi%
+ \advance\pgf@y\halfheight\relax%
+ }%
+ \pgfextract@process\lowerrightpoint{%
+ \centerpoint%
+ \advance\pgf@x\halfwidth\relax%
+ \ifdim\rightextension>0pt\relax%
+ \advance\pgf@x\rightextension\relax%
+ \fi%
+ \advance\pgf@y-\halfheight\relax%
+ }%
+ %
+ % Now calculate the adjustment for the miter length at each corner
+ % of the trapezium. This ensures more accurate anchor positioning
+ % when the line width is particularly thick.
+ %
+ \pgfextract@process\lowerleftmiter{%
+ \pgfmathanglebetweenlines{\lowerleftpoint}{\lowerrightpoint}{\lowerleftpoint}{\upperleftpoint}%
+ \pgfmathmultiply@{\pgfmathresult}{.5}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@x-\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y-\outersep\relax%
+ }%
+ \pgfextract@process\upperleftmiter{%
+ \pgfmathanglebetweenlines{\upperleftpoint}{\lowerleftpoint}{\upperleftpoint}{\upperrightpoint}%
+ \pgfmathmultiply@{\pgfmathresult}{.5}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@x-\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y\outersep\relax%
+ }%
+ \pgfextract@process\upperrightmiter{%
+ \pgfmathanglebetweenlines{\upperrightpoint}{\upperleftpoint}{\upperrightpoint}{\lowerrightpoint}%
+ \pgfmathmultiply@{\pgfmathresult}{.5}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y\outersep\relax%
+ }%
+ \pgfextract@process\lowerrightmiter{%
+ \pgfmathanglebetweenlines{\lowerrightpoint}{\upperrightpoint}{\lowerrightpoint}{\lowerleftpoint}%
+ \pgfmathmultiply@{\pgfmathresult}{.5}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y-\outersep\relax%
+ }%
+ %
+ % Now calculate the corners for determining anchor border
+ % points, by adding the adjustment for the miter length.
+ %
+ \pgfextract@process\lowerleftborderpoint{%
+ \pgfpointadd{\lowerleftpoint}{\lowerleftmiter}%
+ }%
+ \pgfextract@process\upperleftborderpoint{%
+ \pgfpointadd{\upperleftpoint}{\upperleftmiter}%
+ }%
+ \pgfextract@process\upperrightborderpoint{%
+ \pgfpointadd{\upperrightpoint}{\upperrightmiter}%
+ }%
+ \pgfextract@process\lowerrightborderpoint{%
+ \pgfpointadd{\lowerrightpoint}{\lowerrightmiter}%
+ }%
+ %
+ % Calulate the angle from the centerpoint to each corner.
+ % Rotation is not important here (see \anchorborder code).
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\lowerleftborderpoint}%
+ \let\angletolowerleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\upperleftborderpoint}%
+ \let\angletoupperleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\upperrightborderpoint}%
+ \let\angletoupperright\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\lowerrightborderpoint}%
+ \let\angletolowerright\pgfmathresult%
+ %
+ % Do the same for the *inversely rotated* base point...
+ %
+ \pgfextract@process\rotatedbasepoint{%
+ \pgfmathrotatepointaround{\basepoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\lowerleftborderpoint}%
+ \let\baseangletolowerleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\upperleftborderpoint}%
+ \let\baseangletoupperleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\upperrightborderpoint}%
+ \let\baseangletoupperright\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\lowerrightborderpoint}%
+ \let\baseangletolowerright\pgfmathresult%
+ %
+ % And the *inversely rotated* mid point...
+ %
+ \pgfextract@process\rotatedmidpoint{%
+ \pgfmathrotatepointaround{\midpoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\lowerleftborderpoint}%
+ \let\midangletolowerleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\upperleftborderpoint}%
+ \let\midangletoupperleft\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\upperrightborderpoint}%
+ \let\midangletoupperright\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\lowerrightborderpoint}%
+ \let\midangletolowerright\pgfmathresult%
+ %
+ % Now rotate the border points around the centerpoint...
+ %
+ \pgfextract@process\lowerleftborderpoint{%
+ \pgfmathrotatepointaround%
+ {\lowerleftborderpoint}%
+ {\centerpoint}%
+ {\rotate}%
+ }%
+ \pgfextract@process\upperleftborderpoint{%
+ \pgfmathrotatepointaround%
+ {\upperleftborderpoint}%
+ {\centerpoint}%
+ {\rotate}%
+ }%
+ \pgfextract@process\upperrightborderpoint{%
+ \pgfmathrotatepointaround%
+ {\upperrightborderpoint}%
+ {\centerpoint}%
+ {\rotate}%
+ }%
+ \pgfextract@process\lowerrightborderpoint{%
+ \pgfmathrotatepointaround%
+ {\lowerrightborderpoint}%
+ {\centerpoint}%
+ {\rotate}%
+ }%
+ %
+ % ...and the points for drawing the border (i.e. no outer sep).
+ %
+ \pgfextract@process\lowerleftpoint{%
+ \pgfmathrotatepointaround{\lowerleftpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\upperleftpoint{%
+ \pgfmathrotatepointaround{\upperleftpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\upperrightpoint{%
+ \pgfmathrotatepointaround{\upperrightpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\lowerrightpoint{%
+ \pgfmathrotatepointaround{\lowerrightpoint}{\centerpoint}{\rotate}%
+ }%
+ %
+ % And finally, save all the relevant stuff.
+ %
+ \addtosavedmacro{\lowerleftpoint}%
+ \addtosavedmacro{\upperleftpoint}%
+ \addtosavedmacro{\upperrightpoint}%
+ \addtosavedmacro{\lowerrightpoint}%
+ %
+ \addtosavedmacro{\lowerleftborderpoint}%
+ \addtosavedmacro{\upperleftborderpoint}%
+ \addtosavedmacro{\upperrightborderpoint}%
+ \addtosavedmacro{\lowerrightborderpoint}%
+ %
+ \addtosavedmacro{\angletolowerleft}%
+ \addtosavedmacro{\angletoupperleft}%
+ \addtosavedmacro{\angletoupperright}%
+ \addtosavedmacro{\angletolowerright}%
+ %
+ \addtosavedmacro{\baseangletolowerleft}%
+ \addtosavedmacro{\baseangletoupperleft}%
+ \addtosavedmacro{\baseangletoupperright}%
+ \addtosavedmacro{\baseangletolowerright}%
+ %
+ \addtosavedmacro{\midangletolowerleft}%
+ \addtosavedmacro{\midangletoupperleft}%
+ \addtosavedmacro{\midangletoupperright}%
+ \addtosavedmacro{\midangletolowerright}%
+ %
+ \addtosavedmacro{\rotate}%
+ \addtosavedmacro{\externalradius}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \installtrapeziumparameters%
+ \let\pgf@trapeziumanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{base west}{%
+ \installtrapeziumparameters%
+ \let\pgf@trapeziumanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \installtrapeziumparameters%
+ \let\pgf@trapeziumanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{mid west}{%
+ \installtrapeziumparameters%
+ \let\pgf@trapeziumanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{north}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north east}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south west}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{south east}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \anchor{north west}{%
+ \installtrapeziumparameters%
+ \csname pgf@anchor@trapezium@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{bottom left corner}{%
+ \installtrapeziumparameters%
+ \lowerleftborderpoint%
+ }%
+ \anchor{top left corner}{%
+ \installtrapeziumparameters%
+ \upperleftborderpoint%
+ }%
+ \anchor{top right corner}{%
+ \installtrapeziumparameters%
+ \upperrightborderpoint%
+ }%
+ \anchor{bottom right corner}{%
+ \installtrapeziumparameters%
+ \lowerrightborderpoint%
+ }%
+ \anchor{left side}{%
+ \installtrapeziumparameters%
+ \pgfpointlineattime{0.5}{\lowerleftborderpoint}{\upperleftborderpoint}%
+ }%
+ \anchor{right side}{%
+ \installtrapeziumparameters%
+ \pgfpointlineattime{0.5}{\lowerrightborderpoint}{\upperrightborderpoint}%
+ }%
+ \anchor{top side}{%
+ \installtrapeziumparameters%
+ \pgfpointlineattime{0.5}{\upperleftborderpoint}{\upperrightborderpoint}%
+ }%
+ \anchor{bottom side}{%
+ \installtrapeziumparameters%
+ \pgfpointlineattime{0.5}{\lowerleftborderpoint}{\lowerrightborderpoint}%
+ }%
+ \backgroundpath{%
+ \installtrapeziumparameters%
+ \pgfpathmoveto{\lowerleftpoint}%
+ \pgfpathlineto{\upperleftpoint}%
+ \pgfpathlineto{\upperrightpoint}%
+ \pgfpathlineto{\lowerrightpoint}%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % This allows anchors base east, base west, mid east and mid west,
+ % to redefine the `center' of the node to correctly calculate the
+ % border points.
+ %
+ \pgfutil@ifundefined{pgf@trapeziumanchorborderreferencepoint}%
+ {\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@trapeziumanchorborderreferencepoint}%
+ %
+ % Adjust the location of the external
+ % point relative to the reference point.
+ %
+ \referencepoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Install the required points and angles.
+ %
+ \installtrapeziumparameters%
+ %
+ % Get the angle of the external point to the \referencepoint.
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ %
+ % *Subtract* the rotation from the external angle. This is
+ % why the border point angles do not neeed to be rotated.
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ %
+ % Get the relevant angles for the reference point.
+ %
+ \let\externalangle\pgfmathresult%
+ \ifx\referencepoint\basepoint%
+ \let\angletoupperright\baseangletoupperright%
+ \let\angletoupperleft\baseangletoupperleft%
+ \let\angletolowerright\baseangletolowerright%
+ \let\angletolowerleft\baseangletolowerleft%
+ \else%
+ \ifx\referencepoint\midpoint%
+ \let\angletoupperright\midangletoupperright%
+ \let\angletoupperleft\midangletoupperleft%
+ \let\angletolowerright\midangletolowerright%
+ \let\angletolowerleft\midangletolowerleft%
+ \fi\fi%
+ %
+ % Find the line on the border...
+ %
+ \ifdim\externalangle pt<\angletoupperright pt\relax%
+ \let\firstpoint\upperrightborderpoint%
+ \let\secondpoint\lowerrightborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletoupperleft pt\relax%
+ \let\firstpoint\upperleftborderpoint%
+ \let\secondpoint\upperrightborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletolowerleft pt\relax%
+ \let\firstpoint\upperleftborderpoint%
+ \let\secondpoint\lowerleftborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletolowerright pt\relax%
+ \let\firstpoint\lowerleftborderpoint%
+ \let\secondpoint\lowerrightborderpoint%
+ \else%
+ \let\firstpoint\upperrightborderpoint%
+ \let\secondpoint\lowerrightborderpoint%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % ...and thus the point on the border.
+ %
+ \pgfpointintersectionoflines{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ }%
+}
+
+
+
+
+% Shape semicircle.
+%
+\pgfdeclareshape{semicircle}{
+ \savedmacro\installsemicircleparameters{%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x+.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y+.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y+.5\dp\pgfnodeparttextbox%
+ %
+ % Use the radius of the incircle if required...
+ %
+ \ifpgfshapeborderusesincircle%
+ %
+ % Get the rotation (no rounding).
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ \edef\halfheight{\the\pgf@x}%
+ \advance\pgf@x\pgf@x%
+ \else%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ \advance\pgf@y\pgf@y%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \pgf@x\pgfmathresult pt\relax%
+ \pgf@y.5\pgf@y%
+ \edef\halfheight{\the\pgf@y}%
+ \fi%
+ \edef\defaultradius{\the\pgf@x}%
+ %
+ % Take into account minimum height and width.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<\pgf@ya%
+ \pgf@x\pgf@ya%
+ \fi%
+ \edef\semicircleradius{\the\pgf@x}%
+ %
+ % Find the center/base/mid of the semi circle node.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y+-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfextract@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \pgfextract@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \pgfextract@process\semicirclecenterpoint{%
+ \centerpoint%
+ \pgf@ya\semicircleradius\relax%
+ \advance\pgf@ya-\defaultradius\relax%
+ %
+ % The point is adjusted to make the node contents
+ % appear more centered if the node is enlarged to
+ % some minimum size. The factor .4 just seems OK.
+ %
+ \pgf@ya.4\pgf@ya%
+ \advance\pgf@y-\pgf@ya%
+ \pgf@ya\halfheight\relax%
+ \advance\pgf@y-\pgf@ya%
+ }%
+ %
+ % Add the outer sep to the radius here.
+ %
+ \pgf@x\semicircleradius\relax%
+ \advance\pgf@x\outersep\relax%
+ \edef\semicircleradius{\the\pgf@x}%
+ \pgfpointdiff{\centerpoint}{\semicirclecenterpoint}%
+ \ifdim\pgf@y<0pt\pgf@y-\pgf@y\fi%
+ \edef\centerpointdiff{\the\pgf@y}%
+ %
+ % Calculate the start and end points on the border.
+ %
+ \pgfextract@process\arcstartborder{%
+ \semicirclecenterpoint%
+ \advance\pgf@x\semicircleradius\relax%
+ }%
+ \pgfextract@process\arcendborder{%
+ \semicirclecenterpoint%
+ \advance\pgf@x-\semicircleradius\relax%
+ }%
+ %
+ % Calculate the start and end *corner* points on the border.
+ % This is needed to accommodate the outer sep.
+ %
+ \pgfextract@process\arcstartcorner{%
+ \arcstartborder%
+ \advance\pgf@y-\outersep\relax%
+ }%
+ \pgfextract@process\arcendcorner{%
+ \arcendborder%
+ \advance\pgf@y-\outersep\relax%
+ }
+ %
+ % Now calculate all the relevant angles.
+ %
+ % For the center point.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcstartborder}%
+ \let\angletoarcstartborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcendborder}%
+ \let\angletoarcendborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcstartcorner}%
+ \let\angletoarcstartcorner\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcendcorner}%
+ \let\angletoarcendcorner\pgfmathresult%
+ %
+ % For the basepoint (rotated about the center point).
+ %
+ \pgfextract@process\rotatedbasepoint{%
+ \pgfmathrotatepointaround{\basepoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\arcstartborder}%
+ \let\baseangletoarcstartborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\arcendborder}%
+ \let\baseangletoarcendborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\arcstartcorner}%
+ \let\baseangletoarcstartcorner\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\arcendcorner}%
+ \let\baseangletoarcendcorner\pgfmathresult%
+ %
+ % For the midpoint (rotated about the center point).
+ %
+ \pgfextract@process\rotatedmidpoint{%
+ \pgfmathrotatepointaround{\midpoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\arcstartborder}%
+ \let\midangletoarcstartborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\arcendborder}%
+ \let\midangletoarcendborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\arcstartcorner}%
+ \let\midangletoarcstartcorner\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\arcendcorner}%
+ \let\midangletoarcendcorner\pgfmathresult%
+ %
+ % Now, rotate the semicircle points around the centerpoint.
+ %
+ \pgfextract@process\semicirclecenterpoint{%
+ \pgfmathrotatepointaround{\semicirclecenterpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcstartborder{%
+ \pgfmathrotatepointaround{\arcstartborder}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcendborder{%
+ \pgfmathrotatepointaround{\arcendborder}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcstartcorner{%
+ \pgfmathrotatepointaround{\arcstartcorner}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcendcorner{%
+ \pgfmathrotatepointaround{\arcendcorner}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Calculate the distance between the base point and the (rotated) semicircle center.
+ %
+ \pgfpointdiff{\basepoint}{\semicirclecenterpoint}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \edef\basesemicirclecenterdiff{\pgfmathresult pt}%
+ %
+ % Calculate the distance between the base point and the (rotated) semicircle center.
+ %
+ \pgfpointdiff{\midpoint}{\semicirclecenterpoint}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ \edef\midsemicirclecenterdiff{\pgfmathresult pt}%
+ %
+ % And save all the stuff.
+ %
+ \addtosavedmacro{\rotate}%
+ \addtosavedmacro{\outersep}%
+ \addtosavedmacro{\semicircleradius}%
+ %
+ \addtosavedmacro{\arcstartborder}%
+ \addtosavedmacro{\arcendborder}%
+ \addtosavedmacro{\arcstartcorner}%
+ \addtosavedmacro{\arcendcorner}%
+ \addtosavedmacro{\semicirclecenterpoint}%
+ %
+ \addtosavedmacro{\angletoarcstartborder}%
+ \addtosavedmacro{\angletoarcendborder}%
+ \addtosavedmacro{\angletoarcstartcorner}%
+ \addtosavedmacro{\angletoarcendcorner}%
+ %
+ \addtosavedmacro{\centerpointdiff}%
+ \addtosavedmacro{\basesemicirclecenterdiff}%
+ \addtosavedmacro{\midsemicirclecenterdiff}%
+ %
+ \addtosavedmacro{\baseangletoarcstartborder}%
+ \addtosavedmacro{\baseangletoarcendborder}%
+ \addtosavedmacro{\baseangletoarcstartcorner}%
+ \addtosavedmacro{\baseangletoarcendcorner}%
+ %
+ \addtosavedmacro{\midangletoarcstartborder}%
+ \addtosavedmacro{\midangletoarcendborder}%
+ \addtosavedmacro{\midangletoarcstartcorner}%
+ \addtosavedmacro{\midangletoarcendcorner}%
+ }
+ \savedanchor{\centerpoint}{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgfmathaddtolength\pgf@y{-.5\dp\pgfnodeparttextbox}%
+ }
+ \savedanchor{\basepoint}{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgf@y0pt\relax%
+ }
+ \savedanchor{\midpoint}{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{base}{\basepoint}
+ \anchor{base west}{%
+ \installsemicircleparameters%
+ \let\pgf@semicirclereferencepoint\basepoint%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpoint{-\semicircleradius}{0pt}}%
+ }
+ \anchor{base east}{%
+ \installsemicircleparameters%
+ \let\pgf@semicirclereferencepoint\basepoint%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpoint{\semicircleradius}{0pt}}%
+ }
+ \anchor{mid}{\midpoint}
+ \anchor{mid west}{%
+ \installsemicircleparameters%
+ \let\pgf@semicirclereferencepoint\midpoint%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpoint{-\semicircleradius}{0pt}}%
+ }
+ \anchor{mid east}{%
+ \installsemicircleparameters%
+ \let\pgf@semicirclereferencepoint\midpoint%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpoint{\semicircleradius}{0pt}}%
+ }
+ \anchor{apex}{%
+ \installsemicircleparameters%
+ \pgfmathadd@{\rotate}{90}%
+ \let\angle\pgfmathresult%
+ \pgfpointadd{\semicirclecenterpoint}{\pgfqpointpolar{\angle}{\semicircleradius}}%
+ }
+ \anchor{arc start}{%
+ \installsemicircleparameters%
+ \arcstartcorner%
+ }
+ \anchor{arc end}{%
+ \installsemicircleparameters%
+ \arcendcorner%
+ }
+ \anchor{chord center}{%
+ \installsemicircleparameters%
+ \pgfpointlineattime{0.5}{\arcstartcorner}{\arcendcorner}%
+ }
+ \anchor{north}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{90}{\semicircleradius}}%
+ }
+ \anchor{south}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{270}{\semicircleradius}}%
+ }
+ \anchor{east}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{0}{\semicircleradius}}%
+ }
+ \anchor{west}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{180}{\semicircleradius}}%
+ }
+ \anchor{north west}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{135}{\semicircleradius}}%
+ }
+ \anchor{south west}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{225}{\semicircleradius}}%
+ }
+ \anchor{north east}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{45}{\semicircleradius}}%
+ }
+ \anchor{south east}{%
+ \installsemicircleparameters%
+ \csname pgf@anchor@semicircle@border\endcsname{\pgfqpointpolar{315}{\semicircleradius}}%
+ }
+ \backgroundpath{%
+ \installsemicircleparameters%
+ \pgf@x\semicircleradius\relax%
+ \advance\pgf@x-\outersep\relax%
+ \edef\semicircleradius{\the\pgf@x}%
+ \pgfpathmoveto{\pgfpointadd{\semicirclecenterpoint}{\pgfqpointpolar{\rotate}{\semicircleradius}}}%
+ {%
+ \pgftransformrotate{\rotate}%
+ \pgfpatharc{0}{180}{\semicircleradius}%
+ \pgfpathclose%
+ }%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Check if a reference point has been defined (i.e. \midpoint or \basepoint).
+ %
+ \pgfutil@ifundefined{pgf@semicirclereferencepoint}%
+ {\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@semicirclereferencepoint}%
+ %
+ % Adjust the location of the external point relative to the reference point.
+ %
+ \referencepoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Install the required points and angles.
+ %
+ \installsemicircleparameters%
+ %
+ % Get the angle of the external point to the \referencepoint.
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ \let\externalangle\pgfmathresult%
+ %
+ % *Subtract* the rotation from the external angle.
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\angle\pgfmathresult%
+ \ifx\referencepoint\basepoint%
+ \let\angletoarcstartborder\baseangletoarcstartborder%
+ \let\angletoarcendborder\baseangletoarcendborder%
+ \let\angletoarcstartcorner\baseangletoarcstartcorner%
+ \let\angletoarcendcorner\baseangletoarcendcorner%
+ \let\centerpointdiff\basesemicirclecenterdiff%
+ \else%
+ \ifx\referencepoint\midpoint%
+ \let\angletoarcstartborder\midangletoarcstartborder%
+ \let\angletoarcendborder\midangletoarcendborder%
+ \let\angletoarcstartcorner\midangletoarcstartcorner%
+ \let\angletoarcendcorner\midangletoarcendcorner%
+ \let\centerpointdiff\midsemicirclecenterdiff%
+ \fi\fi%
+ %
+ % Determine if the line will cross the semicircle arc, or the chord.
+ %
+ \ifdim\angle pt>\angletoarcstartborder pt\relax%
+ \let\firstpoint\pgfutil@empty%
+ \let\secondpoint\pgfutil@empty%
+ \else%
+ \ifdim\angle pt>\angletoarcstartcorner pt\relax%
+ \let\firstpoint\arcstartcorner%
+ \let\secondpoint\arcstartborder%
+ \else%
+ \ifdim\angle pt>\angletoarcendcorner pt\relax%
+ \let\firstpoint\arcendcorner%
+ \let\secondpoint\arcstartcorner%
+ \else%
+ \ifdim\angle pt>\angletoarcendborder pt\relax%
+ \let\firstpoint\arcendborder%
+ \let\secondpoint\arcendcorner%
+ \else%
+ \let\firstpoint\pgfutil@empty%
+ \let\secondpoint\pgfutil@empty%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\firstpoint\pgfutil@empty
+ %
+ % Calculate the angle from the centre of the semicircle to the
+ % point on the semicircle arc which intersects the line from
+ % the external point to the reference point...
+ %
+ \pgfmathanglebetweenlines{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\semicirclecenterpoint}{\referencepoint}%
+ \pgfmathsin@{\pgfmathresult}%
+ \let\sineangle\pgfmathresult%
+ \pgf@x\semicircleradius\relax%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@x}}%
+ \let\reciprocalradius\pgfmathresult%
+ \pgf@x\centerpointdiff\relax%
+ \pgf@x\sineangle\pgf@x%
+ \pgf@x\reciprocalradius\pgf@x%
+ \pgfmathasin@{\pgfmath@tonumber{\pgf@x}}%
+ \pgf@x\pgfmathresult pt\relax%
+ \advance\pgf@x\externalangle pt\relax%
+ \edef\angle{\pgfmath@tonumber{\pgf@x}}%
+ %
+ % ...and thus the point on the border.
+ %
+ \pgfpointadd{\semicirclecenterpoint}{\pgfqpointpolar{\angle}{\semicircleradius}}%
+ \else%
+ %
+ % Calculate the the point where the semicircle chord intersects
+ % the line from the external point to the reference point.
+ %
+ \pgfpointintersectionoflines{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ \fi%
+ }
+}
+
+
+% Keys for shape isosceles triangle
+%
+% /pgf/isosceles triangle apex angle : angle at the apex of the triangle.
+\pgfkeys{/pgf/.cd,
+ isosceles triangle apex angle/.initial=45,
+ isosceles triangle stretches/.is if=pgf@lib@sh@isosceslestrianglestretches
+}
+\newif\ifpgf@lib@sh@isosceslestrianglestretches
+
+\pgfdeclareshape{isosceles triangle}{
+ \savedmacro\trianglepoints{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/isosceles triangle apex angle}}%
+ \divide\pgf@x2\relax%
+ \edef\halfapexangle{\pgfmath@tonumber{\pgf@x}}%
+ \addtosavedmacro\halfapexangle%
+ %
+ \pgfmathtan@{\halfapexangle}%
+ \let\tanhalfapexangle\pgfmathresult%
+ %
+ \pgfmathcot@{\halfapexangle}%
+ \let\cothalfapexangle\pgfmathresult%
+ %
+ \pgfmathsin@{\halfapexangle}%
+ \let\sinhalfapexangle\pgfmathresult%
+ %
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \let\cosechalfapexangle\pgfmathresult%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ \ifpgfshapeborderusesincircle%
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \else%
+ \pgf@y\pgf@x%
+ \fi%
+ \pgf@x1.414213\pgf@x%
+ \pgf@y1.414213\pgf@y%
+ %
+ \pgf@xa\pgf@x%
+ \advance\pgf@xa\cosechalfapexangle\pgf@x%
+ \pgf@ya\tanhalfapexangle\pgf@xa%
+ \else%
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \pgfmathsetcount\c@pgf@counta{+\pgfmathresult}%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \edef\rotate{\the\c@pgf@counta}%
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xa%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xa%
+ \fi%
+ \fi%
+ %
+ \pgf@xa2.0\pgf@x%
+ \pgf@ya\tanhalfapexangle\pgf@xa%
+ \advance\pgf@xa\cothalfapexangle\pgf@y%
+ \advance\pgf@ya\pgf@y%
+ \fi%
+ \addtosavedmacro\rotate%
+ \ifdim\pgf@xa=0pt\relax%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum height}}%
+ \fi%
+ % Adjust for minimum height and width.
+ %
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@ya<.5\pgf@yb%
+ \ifpgf@lib@sh@isosceslestrianglestretches%
+ \pgf@ya.5\pgf@yb%
+ %
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \let\halfapexangle\pgfmathresult%
+ %
+ \else%
+ \pgf@ya.5\pgf@yb%
+ \pgf@xa\cothalfapexangle\pgf@ya%
+ \fi%
+ \fi%
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@xa<\pgf@xb%
+ \ifpgf@lib@sh@isosceslestrianglestretches%
+ \pgf@xa\pgf@xb%
+ %
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \let\halfapexangle\pgfmathresult%
+ %
+ \else%
+ \pgf@xa\pgf@xb%
+ \pgf@ya\tanhalfapexangle\pgf@xa%
+ \fi%
+ \fi%
+ %
+ %
+ % Now find the ``offset height'' (h'). This is the distance from the
+ % center of the node contents to the base of the triangle.
+ %
+ \ifpgfshapeborderusesincircle%
+ %
+ % h' = H*sin(a/2) / (1+sin(a/2))
+ %
+ % where:
+ % H = the height of the triangle.
+ % a = the apex angle.
+ %
+ \pgf@xc\pgf@xa%
+ \pgfmathsin@{\halfapexangle}%
+ \pgf@xc\pgfmathresult\pgf@xc%
+ \pgf@yc1pt\relax%
+ \advance\pgf@yc\pgfmathresult pt\relax%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@xc}}{\pgfmath@tonumber{\pgf@yc}}
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \else%
+ %
+ % h' = 0.5*h + (0.5*(W-w)*cos(a/2) - h*sin(a/2))/(1+sin(a/2))
+ %
+ % where:
+ % h = the height of the node contents.
+ % w = the width of the node contents.
+ % W = the width of the triangle.
+ % a = the apex angle.
+ %
+ \pgf@xc\pgf@ya%
+ \advance\pgf@xc-\pgf@y%
+ \pgfmathcos@{\halfapexangle}%
+ \pgf@xc\pgfmathresult\pgf@xc%
+ \pgfmathsin@{\halfapexangle}%
+ \advance\pgf@xc-\pgfmathresult\pgf@x%
+ \advance\pgf@xc-\pgfmathresult\pgf@x%
+ \pgf@yc\pgfmathresult pt\relax%
+ \advance\pgf@yc1pt\relax%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@xc}}{\pgfmath@tonumber{\pgf@yc}}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \advance\pgfutil@tempdima\pgf@x%
+ \fi%
+ \pgfextract@process\apex{%
+ \pgf@y0pt%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x-\pgfutil@tempdima%
+ }%
+ \addtosavedmacro\apex%
+ %
+ \pgfextract@process\lowerleft{%
+ \pgf@y\pgf@ya%
+ \pgf@x-\pgfutil@tempdima%
+ }%
+ \addtosavedmacro\lowerleft%
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \pgf@xb\pgf@yb%
+ \fi%
+ \pgfextract@process\apexanchor{%
+ \apex%
+ \advance\pgf@x\cosechalfapexangle\pgf@xb%
+ }%
+ \addtosavedmacro\apexanchor%
+ %
+ \pgf@yc-\halfapexangle pt\relax%
+ \advance\pgf@yc90pt\relax%
+ \divide\pgf@yc2\relax%
+ \pgfmathcot@{\pgfmath@tonumber{\pgf@yc}}%
+ \pgfextract@process\lowerleftanchor{%
+ \lowerleft%
+ \advance\pgf@y\pgfmathresult\pgf@xb%
+ \advance\pgf@x-\pgf@xb%
+ }%
+ \addtosavedmacro\lowerleftanchor%
+ %
+ \pgfextract@process\lowerrightanchor{%
+ \lowerleftanchor%
+ \pgf@y-\pgf@y%
+ }%
+ \addtosavedmacro\lowerrightanchor%
+ }
+ \anchor{apex}{%
+ \trianglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \pgfmathrotatepointaround{\apexanchor}{\pgfpointorigin}{\rotate}%
+ }%
+ }%
+ \anchor{left corner}{%
+ \trianglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \pgfmathrotatepointaround{\lowerleftanchor}{\pgfpointorigin}{\rotate}%
+ }%
+ }%
+ \anchor{right corner}{%
+ \trianglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \pgfmathrotatepointaround{\lowerrightanchor}{\pgfpointorigin}{\rotate}%
+ }%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid west}{%
+ \trianglepoints%
+ \let\pgf@isoscelestriangle@referencepoint\midpoint%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{-1pt}{0pt}}%
+ }%
+ \anchor{mid east}{%
+ \trianglepoints%
+ \let\pgf@isoscelestriangle@referencepoint\midpoint%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{1pt}{0pt}}%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base west}{%
+ \trianglepoints%
+ \let\pgf@isoscelestriangle@referencepoint\basepoint%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{-1pt}{0pt}}%
+ }%
+ \anchor{base east}{%
+ \trianglepoints%
+ \let\pgf@isoscelestriangle@referencepoint\basepoint%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{1pt}{0pt}}%
+ }%
+ \anchor{north}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{0pt}{1pt}}%
+ }
+ \anchor{south}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{0pt}{-1pt}}%
+ }
+ \anchor{east}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{1pt}{0pt}}%
+ }
+ \anchor{west}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{-1pt}{0pt}}%
+ }
+ \anchor{north east}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{1pt}{1pt}}%
+ }
+ \anchor{south west}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{-1pt}{-1pt}}%
+ }
+ \anchor{south east}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{1pt}{-1pt}}%
+ }
+ \anchor{north west}{%
+ \trianglepoints%
+ \csname pgf@anchor@isosceles triangle@border\endcsname{\pgfqpoint{-1pt}{1pt}}%
+ }
+ \anchor{left side}{%
+ \trianglepoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{\pgfpointlineattime{0.5}{\lowerleftanchor}{\apexanchor}}{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{right side}{%
+ \trianglepoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{\pgfpointlineattime{0.5}{\lowerrightanchor}{\apexanchor}}{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \anchor{lower side}{%
+ \trianglepoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{\pgfpointlineattime{0.5}{\lowerleftanchor}{\lowerrightanchor}}{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }
+ \backgroundpath{%
+ \trianglepoints%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgftransformrotate{\rotate}%
+ \pgfpathmoveto{\apex}%
+ \pgfpathlineto{\lowerleft}%
+ \pgfpathlineto{\lowerleft\pgf@y-\pgf@y}%
+ \pgfpathclose%
+ }%
+ }
+ \anchorborder{%
+ \pgfutil@ifundefined{pgf@isoscelestriangle@referencepoint}{\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@isoscelestriangle@referencepoint}%
+ \pgfextract@process\externalpoint{%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \referencepoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \trianglepoints%
+ \pgfmathanglebetweenpoints{\referencepoint}{\externalpoint}%
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\centerpoint}{\lowerrightanchor}}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\centerpoint}{\lowerleftanchor}}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\centerpoint}{\apexanchor}}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \let\firstpoint\apexanchor%
+ \let\secondpoint\lowerleftanchor%
+ \else%
+ \let\firstpoint\apexanchor%
+ \let\secondpoint\lowerrightanchor%
+ \fi%
+ \else%
+ \let\firstpoint\lowerleftanchor%
+ \let\secondpoint\lowerrightanchor%
+ \fi%
+ \else%
+ \let\firstpoint\lowerrightanchor%
+ \let\secondpoint\apexanchor%
+ \fi%
+ \pgfpointintersectionoflines{\referencepoint}{\externalpoint}%
+ {\pgfmathrotatepointaround{\pgfpointadd{\centerpoint}{\firstpoint}}{\centerpoint}{\rotate}}%
+ {\pgfmathrotatepointaround{\pgfpointadd{\centerpoint}{\secondpoint}}{\centerpoint}{\rotate}}%
+ }%
+}
+
+
+
+
+% Keys for shape kite
+%
+%
+\pgfkeys{/pgf/.cd,
+ kite upper vertex angle/.initial=120,
+ kite lower vertex angle/.initial=60,
+ kite vertex angles/.code={%
+ \pgfutil@in@{and}{#1}%
+ \ifpgfutil@in@%
+ \def\pgf@marshal##1and##2\@@{%
+ \pgfkeys{/pgf/kite upper vertex angle=##1}%
+ \pgfkeys{/pgf/kite lower vertex angle=##2}%
+ }%
+ \expandafter\pgf@marshal#1\@@%
+ \else%
+ \pgfkeys{/pgf/kite upper vertex angle=#1}%
+ \pgfkeys{/pgf/kite lower vertex angle=#1}%
+ \fi%
+ }%
+}
+
+% Shape kite.
+%
+\pgfdeclareshape{kite}{
+ \savedmacro\installkiteparameters{%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % Calculate the centre, base and mid points of the node.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfextract@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \pgfextract@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % Halve the vertex angles.
+ %
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/kite upper vertex angle}}{2}%
+ \let\halfuppervertexangle\pgfmathresult%
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/kite lower vertex angle}}{2}%
+ \let\halflowervertexangle\pgfmathresult%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \ifpgfshapeborderusesincircle%
+ %
+ % Get the rotation.
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ %
+ % Get the radis of the incircle.
+ %
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ %
+ % Get the distances from the upper and lower verticies
+ % to the center of the incircle.
+ %
+ \pgfmathsin@{\halfuppervertexangle}%
+ \let\sinehalfuppervertexangle\pgfmathresult%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \let\cosechalfuppervertexangle\pgfmathresult%
+ \pgf@ya\pgfmathresult\pgf@x%
+ \pgfmathsin@{\halflowervertexangle}%
+ \let\sinehalflowervertexangle\pgfmathresult%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@yb\pgfmathresult\pgf@x%
+ %
+ % Now calculate vertical offset (yc) between the center of
+ % the incircle, and the intersection of the kite diagonals.
+ %
+ % yc = x * cosec(a/2) - x * cot(a/2) * (sin(a/2) + sin(b/2)) * cosec(a/2 + b/2)
+ %
+ % where:
+ % x = the incircle radius.
+ % a = the upper vertex angle.
+ % b = the lower vertex angle.
+ %
+ \pgf@yc\pgf@x%
+ \pgfmathadd@{\halfuppervertexangle}{\halflowervertexangle}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgfmathadd@{\sinehalfuppervertexangle}{\sinehalflowervertexangle}%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgfmathcos@{\halfuppervertexangle}%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgf@yc-\cosechalfuppervertexangle\pgf@yc%
+ \advance\pgf@yc\cosechalfuppervertexangle\pgf@x%
+ \edef\deltay{\the\pgf@yc}%
+ %
+ % Now calculate the height of the kite...
+ %
+ \advance\pgf@ya-\pgf@yc%
+ %
+ % ...and the depth.
+ %
+ \advance\pgf@yb\pgf@yc%
+ %
+ % Get the half width of the widest part of the kite.
+ %
+ \pgfmathtan@{\halfuppervertexangle}%
+ \pgf@xa\pgfmathresult\pgf@ya%
+ \else%
+ \multiply\pgf@x2\relax%
+ \multiply\pgf@y2\relax%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ %
+ % The node contents (total height y) extends a distance ya into the
+ % upper isosceles triangle of the kite and a distance yb into the
+ % lower isosceles triangle. Thus, the following relationships hold:
+ %
+ % ya/yb = tan(b/2)/tan(a/2)
+ %
+ % and y = ya + yb
+ %
+ % so ya = y * sin(a/2 + b/2) / (cos(a/2) * sin(b/2))
+ %
+ % where:
+ % a = upper vertex angle.
+ % b = lower vertex angle.
+ %
+ \pgfmathadd@{\halfuppervertexangle}{\halflowervertexangle}%
+ \pgfmathsin@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@ya\pgfmathresult\pgf@y%
+ \pgfmathcos@{\halfuppervertexangle}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgfmathsin@{\halflowervertexangle}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgf@yb\pgf@y%
+ \advance\pgf@yb-\pgf@ya%
+ %
+ % The vertical offset between the center of the node, and
+ % the intersection of the kite diagonals is given by:
+ %
+ % yc = y/2 - ya
+ %
+ \pgf@yc.5\pgf@y%
+ \advance\pgf@yc-\pgf@ya%
+ \edef\deltay{\the\pgf@yc}%
+ %
+ % Get the half width of the widest part of the kite.
+ %
+ \pgfmathtan@{\halfuppervertexangle}%
+ \pgf@xa.5\pgf@x%
+ \advance\pgf@xa\pgfmathresult\pgf@ya%
+ %
+ % Now calculate the height of the kite...
+ %
+ \pgf@xb.5\pgf@x%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \advance\pgf@ya\pgfmathresult\pgf@xb%
+ %
+ % ...and the depth.
+ %
+ \pgfmathtan@{\halflowervertexangle}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \advance\pgf@yb\pgfmathresult\pgf@xb%
+ \fi%
+ %
+ % Take into account minimum height and width.
+ %
+ % ya is the kite height.
+ % yb is the kite depth.
+ % xa is the kite (half) width.
+ %
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y\pgf@ya%
+ \advance\pgf@y\pgf@yb%
+ \ifdim\pgf@y<\pgf@yc%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@y}}%
+ \pgf@yc\pgfmathresult\pgf@yc%
+ \pgf@xa\pgfmath@tonumber{\pgf@yc}\pgf@xa%
+ \pgf@ya\pgfmath@tonumber{\pgf@yc}\pgf@ya%
+ \pgf@yb\pgfmath@tonumber{\pgf@yc}\pgf@yb%
+ \fi%
+ \pgf@x2.0\pgf@xa%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@x<\pgf@xc%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@x}}%
+ \pgf@xc\pgfmathresult\pgf@xc%
+ \pgf@xa\pgfmath@tonumber{\pgf@xc}\pgf@xa%
+ \pgf@ya\pgfmath@tonumber{\pgf@xc}\pgf@ya%
+ \pgf@yb\pgfmath@tonumber{\pgf@xc}\pgf@yb%
+ \fi%
+ \edef\kitehalfwidth{\the\pgf@xa}%
+ \edef\kiteheight{\the\pgf@ya}%
+ \edef\kitedepth{\the\pgf@yb}%
+ %
+ % Calculate the basic points on the kite (for the background path).
+ %
+ \pgfextract@process\toppoint{%
+ \centerpoint%
+ \advance\pgf@y\deltay\relax%
+ \advance\pgf@y\kiteheight%
+ }%
+ \pgfextract@process\bottompoint{%
+ \centerpoint%
+ \advance\pgf@y\deltay\relax%
+ \advance\pgf@y-\kitedepth%
+ }%
+ \pgfextract@process\leftpoint{%
+ \centerpoint%
+ \advance\pgf@y\deltay\relax%
+ \advance\pgf@x-\kitehalfwidth%
+ }%
+ \pgfextract@process\rightpoint{%
+ \centerpoint%
+ \advance\pgf@y\deltay\relax%
+ \advance\pgf@x\kitehalfwidth%
+ }%
+ %
+ % Now calculate the miter length. At the top...
+ %
+ \pgfmathsin@{\halfuppervertexangle}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@y\outersep\relax%
+ \pgf@y\pgfmathresult\pgf@y%
+ \edef\topmiter{\the\pgf@y}%
+ %
+ % ...at the bottom...
+ %
+ \pgfmathsin@{\halflowervertexangle}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@y\outersep\relax%
+ \pgf@y\pgfmathresult\pgf@y%
+ \edef\bottommiter{\the\pgf@y}%
+ %
+ % ...to the right...
+ %
+ \pgfmathsubtract@{180}{\halflowervertexangle}%
+ \pgfmathsubtract@{\pgfmathresult}{\halfuppervertexangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathsin@{\pgfmathresult}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@xa\outersep\relax%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfmathsubtract@{\halfuppervertexangle}{\halflowervertexangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angle\pgfmathresult%
+ \pgfextract@process\rightmiter{%
+ \pgfqpointpolar{\angle}{\the\pgf@xa}%
+ }%
+ %
+ % ...and to the left.
+ %
+ \pgfmathsubtract@{180}{\angle}%
+ \let\angle\pgfmathresult%
+ \pgfextract@process\leftmiter{%
+ \pgfqpointpolar{\angle}{\the\pgf@xa}%
+ }%
+ %
+ % Create the border points.
+ %
+ \pgfextract@process\topborderpoint{%
+ \toppoint%
+ \advance\pgf@y\topmiter\relax%
+ }%
+ \pgfextract@process\bottomborderpoint{%
+ \bottompoint%
+ \advance\pgf@y-\bottommiter\relax%
+ }%
+ \pgfextract@process\leftborderpoint{%
+ \leftpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \leftmiter%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfextract@process\rightborderpoint{%
+ \rightpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \rightmiter%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Get the angle from the \centerpoint to the *unrotated points*.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\topborderpoint}%
+ \let\angletotoppoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\leftborderpoint}%
+ \let\angletoleftpoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\bottomborderpoint}%
+ \let\angletobottompoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\rightborderpoint}%
+ \let\angletorightpoint\pgfmathresult%
+ %
+ % ...from the *inversly rotated* \basepoint...
+ %
+ \pgfextract@process\rotatedbasepoint{%
+ \pgfmathrotatepointaround{\basepoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\topborderpoint}%
+ \let\baseangletotoppoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\leftborderpoint}%
+ \let\baseangletoleftpoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\bottomborderpoint}%
+ \let\baseangletobottompoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\rightborderpoint}%
+ \let\baseangletorightpoint\pgfmathresult%
+ %
+ % ...and from the *inversely rotated* \midpoint.
+ %
+ \pgfextract@process\rotatedmidpoint{%
+ \pgfmathrotatepointaround{\midpoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\topborderpoint}%
+ \let\midangletotoppoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\leftborderpoint}%
+ \let\midangletoleftpoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\bottomborderpoint}%
+ \let\midangletobottompoint\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\rightborderpoint}%
+ \let\midangletorightpoint\pgfmathresult%
+ %
+ % Calculate a radius guaranteed to be outside the kite.
+ %
+ \pgfextractx\pgf@xa{\pgfpointdiff{\leftborderpoint}{\rightborderpoint}}%
+ \ifdim\pgf@xa<0pt\relax%
+ \pgf@xa-\pgf@xa%
+ \fi%
+ \pgfextracty\pgf@ya{\pgfpointdiff{\topborderpoint}{\bottomborderpoint}}%
+ \ifdim\pgf@ya<0pt\relax%
+ \pgf@ya-\pgf@ya%
+ \fi%
+ \ifdim\pgf@ya>\pgf@xa%
+ \edef\externalradius{\the\pgf@ya}%
+ \else%
+ \edef\externalradius{\the\pgf@xa}%
+ \fi%
+ %
+ % Now rotate the points...
+ %
+ \pgfextract@process\toppoint{%
+ \pgfmathrotatepointaround{\toppoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\bottompoint{%
+ \pgfmathrotatepointaround{\bottompoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\leftpoint{%
+ \pgfmathrotatepointaround{\leftpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\rightpoint{%
+ \pgfmathrotatepointaround{\rightpoint}{\centerpoint}{\rotate}%
+ }%
+ %
+ % ...and the border points.
+ %
+ \pgfextract@process\topborderpoint{%
+ \pgfmathrotatepointaround{\topborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\bottomborderpoint{%
+ \pgfmathrotatepointaround{\bottomborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\leftborderpoint{%
+ \pgfmathrotatepointaround{\leftborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\rightborderpoint{%
+ \pgfmathrotatepointaround{\rightborderpoint}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Now save it all.
+ %
+ \addtosavedmacro{\rotate}%
+ \addtosavedmacro{\externalradius}%
+ %
+ \addtosavedmacro\toppoint%
+ \addtosavedmacro\bottompoint%
+ \addtosavedmacro\leftpoint%
+ \addtosavedmacro\rightpoint%
+ %
+ \addtosavedmacro\topborderpoint%
+ \addtosavedmacro\bottomborderpoint%
+ \addtosavedmacro\leftborderpoint%
+ \addtosavedmacro\rightborderpoint%
+ %
+ \addtosavedmacro\angletotoppoint%
+ \addtosavedmacro\angletobottompoint%
+ \addtosavedmacro\angletoleftpoint%
+ \addtosavedmacro\angletorightpoint%
+ %
+ \addtosavedmacro\baseangletotoppoint%
+ \addtosavedmacro\baseangletobottompoint%
+ \addtosavedmacro\baseangletoleftpoint%
+ \addtosavedmacro\baseangletorightpoint%
+ %
+ \addtosavedmacro\midangletotoppoint%
+ \addtosavedmacro\midangletobottompoint%
+ \addtosavedmacro\midangletoleftpoint%
+ \addtosavedmacro\midangletorightpoint%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{base}{\basepoint}%
+ \anchor{base west}{%
+ \installkiteparameters%
+ \let\pgf@kiteanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{base east}{%
+ \installkiteparameters%
+ \let\pgf@kiteanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid west}{%
+ \installkiteparameters%
+ \let\pgf@kiteanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{mid east}{%
+ \installkiteparameters%
+ \let\pgf@kiteanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }%
+ \anchor{north}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north east}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south west}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{south east}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \anchor{north west}{%
+ \installkiteparameters%
+ \csname pgf@anchor@kite@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{upper vertex}{%
+ \installkiteparameters%
+ \topborderpoint}
+ \anchor{lower vertex}{%
+ \installkiteparameters%
+ \bottomborderpoint}
+ \anchor{left vertex}{%
+ \installkiteparameters%
+ \leftborderpoint}
+ \anchor{right vertex}{%
+ \installkiteparameters%
+ \rightborderpoint}
+ \anchor{upper left side}{%
+ \installkiteparameters%
+ \pgfpointlineattime{0.5}{\topborderpoint}{\leftborderpoint}}
+ \anchor{lower left side}{%
+ \installkiteparameters%
+ \pgfpointlineattime{0.5}{\bottomborderpoint}{\leftborderpoint}}
+ \anchor{upper right side}{%
+ \installkiteparameters%
+ \pgfpointlineattime{0.5}{\topborderpoint}{\rightborderpoint}}
+ \anchor{lower right side}{%
+ \installkiteparameters%
+ \pgfpointlineattime{0.5}{\bottomborderpoint}{\rightborderpoint}}
+ \backgroundpath{%
+ \installkiteparameters%
+ \pgfpathmoveto{\toppoint}%
+ \pgfpathlineto{\leftpoint}%
+ \pgfpathlineto{\bottompoint}%
+ \pgfpathlineto{\rightpoint}%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % This allows anchors base east, base west, mid east and mid west,
+ % to redefine the `center' of the node to correctly calculate the
+ % border points.
+ %
+ \pgfutil@ifundefined{pgf@kiteanchorborderreferencepoint}%
+ {\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@kiteanchorborderreferencepoint}%
+ %
+ % Adjust the location of the external
+ % point relative to the reference point.
+ %
+ \referencepoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Install the required points and angles.
+ %
+ \installkiteparameters%
+ %
+ % Get the angle of the external point relative to \referencepoint.
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ %
+ % *Subtract* the rotation from the external angle.
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ \ifx\referencepoint\basepoint%
+ \let\angletotoppoint\baseangletotoppoint%
+ \let\angletobottompoint\baseangletobottompoint%
+ \let\angletoleftpoint\baseangletoleftpoint%
+ \let\angletorightpoint\baseangletorightpoint%
+ \else%
+ \ifx\referencepoint\midpoint%
+ \let\angletotoppoint\midangletotoppoint%
+ \let\angletobottompoint\midangletobottompoint%
+ \let\angletoleftpoint\midangletoleftpoint%
+ \let\angletorightpoint\midangletorightpoint%
+ \fi\fi%
+ %
+ % Depending on the rotation, the angle to \rightborderpoint
+ % may be smaller than the angle to \topborderpoint.
+ %
+ \ifdim\angletorightpoint pt<\angletotoppoint pt\relax%
+ \ifdim\externalangle pt<\angletorightpoint pt\relax%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\bottomborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletotoppoint pt\relax%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\topborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletoleftpoint pt\relax%
+ \let\firstpoint\topborderpoint%
+ \let\secondpoint\leftborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletobottompoint pt\relax%
+ \let\firstpoint\leftborderpoint%
+ \let\secondpoint\bottomborderpoint%
+ \else%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\bottomborderpoint%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\externalangle pt<\angletotoppoint pt\relax%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\topborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletoleftpoint pt\relax%
+ \let\firstpoint\leftborderpoint%
+ \let\secondpoint\topborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletobottompoint pt\relax%
+ \let\firstpoint\bottomborderpoint%
+ \let\secondpoint\leftborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletorightpoint pt\relax%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\bottomborderpoint%
+ \else%
+ \let\firstpoint\rightborderpoint%
+ \let\secondpoint\topborderpoint%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgfpointintersectionoflines{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ }
+}
+
+
+
+
+% Keys for shape dart.
+%
+%
+
+\pgfkeys{/pgf/.cd,
+ dart tip angle/.initial=45,
+ dart tail angle/.initial=135
+}
+
+% Shape dart.
+%
+\pgfdeclareshape{dart}{%
+ \savedmacro\installdartparameters{%
+ %
+ % Get the halved angles (more useful).
+ %
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/dart tip angle}}{2}%
+ \let\halftipangle\pgfmathresult%
+ \pgfmathdivide{\pgfkeysvalueof{/pgf/dart tail angle}}{2}%
+ \let\halftailangle\pgfmathresult%
+ %
+ % Calculate some common results.
+ %
+ \pgfmathcot@{\halftipangle}%
+ \let\cothalftipangle\pgfmathresult%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % Calculate the centre, base and mid points of the node.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \pgfextract@process\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \pgfextract@process\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ %
+ % Get the (halved) dimension of the node.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ % Get the length of the dart tip.
+ %
+ \ifpgfshapeborderusesincircle%
+ %
+ % Get the (unrounded) rotation.
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ %
+ % Get the radius of the incircle.
+ %
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ %
+ % Calculate the length of the dart tip.
+ %
+ \pgf@xa\cothalftipangle\pgf@x%
+ \advance\pgf@xa\pgf@x%
+ \else%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Flip the width and height of the node contents,
+ % according to the appropriate border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ %
+ % Calculate the length of the dart tip.
+ %
+ \pgf@xa\cothalftipangle\pgf@y%
+ \advance\pgf@xa2.0\pgf@x%
+ \fi%
+ %
+ % Get the (half) separation of the dart tails.
+ %
+ \pgfmathsubtract@{\halftailangle}{\halftipangle}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@ya\pgfmathresult\pgf@xa%
+ \pgfmathsin@{\halftipangle}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ \pgfmathcos@{\halftipangle}%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ %
+ % Get the total length of the dart...
+ %
+ \pgf@xb\cothalftipangle\pgf@ya%
+ %
+ % and hence the length of the tails.
+ %
+ \pgf@xc-\pgf@xa%
+ \advance\pgf@xc\pgf@xb%
+ %
+ % Adjust for minimum height (length of the dart).
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@xb<\pgf@y%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@xb}}%
+ \pgf@y\pgfmathresult\pgf@y%
+ \pgf@xa\pgfmath@tonumber{\pgf@y}\pgf@xa%
+ \pgf@xc\pgfmath@tonumber{\pgf@y}\pgf@xc%
+ \pgf@ya\pgfmath@tonumber{\pgf@y}\pgf@ya%
+ \pgf@x\pgfmath@tonumber{\pgf@y}\pgf@x%
+ \fi%
+ %
+ % Adjust for minimum width (tail separation length).
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@y.5\pgf@y%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@ya}}%
+ \pgf@ya\pgf@y%
+ \pgf@y\pgfmathresult\pgf@y%
+ \pgf@xa\pgfmath@tonumber{\pgf@y}\pgf@xa%
+ \pgf@xc\pgfmath@tonumber{\pgf@y}\pgf@xc%
+ \pgf@x\pgfmath@tonumber{\pgf@y}\pgf@x%
+ \fi%
+ \edef\dartlength{\the\pgf@xa}%
+ \edef\deltax{\the\pgf@x}%
+ \edef\taillength{\the\pgf@xc}%
+ \edef\halftailseparation{\the\pgf@ya}
+ %
+ % Create the basic points on the dart (for the backgroundo path).
+ %
+ \pgfextract@process\tippoint{%
+ \centerpoint%
+ \advance\pgf@x\dartlength\relax%
+ \advance\pgf@x-\deltax\relax%
+ }%
+ \pgfextract@process\tailcenterpoint{%
+ \centerpoint%
+ \advance\pgf@x-\deltax\relax%
+ }%
+ \pgfextract@process\lefttailpoint{%
+ \centerpoint%
+ \advance\pgf@x-\deltax\relax%
+ \advance\pgf@x-\taillength\relax%
+ \advance\pgf@y\halftailseparation\relax%
+ }%
+ \pgfextract@process\righttailpoint{%
+ \centerpoint%
+ \advance\pgf@x-\deltax\relax%
+ \advance\pgf@x-\taillength\relax%
+ \advance\pgf@y-\halftailseparation\relax%
+ }%
+ %
+ % Calculate the miter vectors. At the dart tip...
+ %
+ \pgfextract@process\tipmiter{%
+ \pgfmathcosec@{\halftipangle}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y0pt\relax%
+ }%
+ %
+ % ...at the tail center...
+ %
+ \pgfextract@process\tailcentermiter{%
+ \pgfmathcosec@{\halftailangle}%
+ \pgf@x-\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y0pt\relax%
+ }%
+ %
+ % ...at the left tail...
+ %
+ \pgfmathsubtract@{\halftailangle}{\halftipangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angle\pgfmathresult%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgfmathadd@{\angle}{90}%
+ \pgfmathsubtract{\pgfmathresult}{\halftailangle}%
+ \pgfmathsincos@{\pgfmathresult}%
+ \pgf@ya\pgfmathresultx\pgf@x%
+ \pgf@xa\pgfmathresulty\pgf@x%
+ \pgfextract@process\lefttailmiter{%
+ \pgf@x-\pgf@xa%
+ \pgf@y\pgf@ya%
+ }%
+ %
+ % ...and the right tail.
+ %
+ \pgfextract@process\righttailmiter{%
+ \pgf@x-\pgf@xa%
+ \pgf@y-\pgf@ya%
+ }%
+ %
+ % Create the border points.
+ %
+ \pgfextract@process\tipborderpoint{%
+ \pgfpointadd{\tippoint}{\tipmiter}
+ }%
+ \pgfextract@process\tailcenterborderpoint{%
+ \pgfpointadd{\tailcenterpoint}{\tailcentermiter}%
+ }%
+ \pgfextract@process\lefttailborderpoint{%
+ \pgfpointadd{\lefttailpoint}{\lefttailmiter}%
+ }%
+ \pgfextract@process\righttailborderpoint{%
+ \pgfpointadd{\righttailpoint}{\righttailmiter}%
+ }%
+ %
+ % Calculate the angles between the centerpoint
+ % and the *unrotated* borderpoints.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\tipborderpoint}%
+ \let\angletotip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\tailcenterborderpoint}%
+ \let\angletotailcenter\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\lefttailborderpoint}%
+ \let\angletolefttail\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\righttailborderpoint}%
+ \let\angletorighttail\pgfmathresult%
+ %
+ % Calculate the angles between the *inversly rotated*
+ % basepoint and the *unrotated* borderpoints.
+ %
+ \pgfextract@process\rotatedbasepoint{%
+ \pgfmathrotatepointaround{\basepoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\tipborderpoint}%
+ \let\baseangletotip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\tailcenterborderpoint}%
+ \let\baseangletotailcenter\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\lefttailborderpoint}%
+ \let\baseangletolefttail\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedbasepoint}{\righttailborderpoint}%
+ \let\baseangletorighttail\pgfmathresult%
+ %
+ % Calculate the angles between the *inversly rotated*
+ % midpoint and the *unrotated* borderpoints.
+ %
+ \pgfextract@process\rotatedmidpoint{%
+ \pgfmathrotatepointaround{\midpoint}{\centerpoint}{-\rotate}%
+ }%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\tipborderpoint}%
+ \let\midangletotip\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\tailcenterborderpoint}%
+ \let\midangletotailcenter\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\lefttailborderpoint}%
+ \let\midangletolefttail\pgfmathresult%
+ \pgfmathanglebetweenpoints{\rotatedmidpoint}{\righttailborderpoint}%
+ \let\midangletorighttail\pgfmathresult%
+ %
+ % Rotate the background path points.
+ %
+ \pgfextract@process\tippoint{%
+ \pgfmathrotatepointaround{\tippoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\tailcenterpoint{%
+ \pgfmathrotatepointaround{\tailcenterpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\lefttailpoint{%
+ \pgfmathrotatepointaround{\lefttailpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\righttailpoint{%
+ \pgfmathrotatepointaround{\righttailpoint}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Calculate a radius guaranteed to be outside the dart.
+ %
+ \pgfextractx\pgf@xa{\pgfpointdiff{\lefttailborderpoint}{\tipborderpoint}}%
+ \pgfextracty\pgf@ya{\pgfpointdiff{\lefttailborderpoint}{\righttailborderpoint}}%
+ \ifdim\pgf@xa<0pt\relax%
+ \pgf@xa-\pgf@xa%
+ \fi%
+ \ifdim\pgf@ya<0pt\relax%
+ \pgf@ya-\pgf@ya%
+ \fi%
+ \ifdim\pgf@xa>\pgf@ya%
+ \edef\externalradius{\the\pgf@xa}%
+ \else%
+ \edef\externalradius{\the\pgf@ya}%
+ \fi%
+ %
+ % Rotate the border anchor points.
+ %
+ \pgfextract@process\tipborderpoint{%
+ \pgfmathrotatepointaround{\tipborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\tailcenterborderpoint{%
+ \pgfmathrotatepointaround{\tailcenterborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\lefttailborderpoint{%
+ \pgfmathrotatepointaround{\lefttailborderpoint}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\righttailborderpoint{%
+ \pgfmathrotatepointaround{\righttailborderpoint}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Save everything.
+ %
+ \addtosavedmacro{\rotate}%
+ \addtosavedmacro{\externalradius}%
+ %
+ \addtosavedmacro{\tippoint}%
+ \addtosavedmacro{\tailcenterpoint}%
+ \addtosavedmacro{\lefttailpoint}%
+ \addtosavedmacro{\righttailpoint}%
+ %
+ \addtosavedmacro{\tipborderpoint}%
+ \addtosavedmacro{\tailcenterborderpoint}%
+ \addtosavedmacro{\lefttailborderpoint}%
+ \addtosavedmacro{\righttailborderpoint}%
+ %
+ \addtosavedmacro{\angletotip}%
+ \addtosavedmacro{\angletotailcenter}%
+ \addtosavedmacro{\angletolefttail}%
+ \addtosavedmacro{\angletorighttail}%
+ %
+ \addtosavedmacro{\baseangletotip}%
+ \addtosavedmacro{\baseangletotailcenter}%
+ \addtosavedmacro{\baseangletolefttail}%
+ \addtosavedmacro{\baseangletorighttail}%
+ %
+ \addtosavedmacro{\midangletotip}%
+ \addtosavedmacro{\midangletotailcenter}%
+ \addtosavedmacro{\midangletolefttail}%
+ \addtosavedmacro{\midangletorighttail}%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{base}{\basepoint}%
+ \anchor{base west}{%
+ \installdartparameters%
+ \let\pgf@dartanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{base east}{%
+ \installdartparameters%
+ \let\pgf@dartanchorborderreferencepoint\basepoint%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{mid}{\midpoint}%
+ \anchor{mid west}{%
+ \installdartparameters%
+ \let\pgf@dartanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{mid east}{%
+ \installdartparameters%
+ \let\pgf@dartanchorborderreferencepoint\midpoint%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{north}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north east}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south west}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{south east}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \anchor{north west}{%
+ \installdartparameters%
+ \csname pgf@anchor@dart@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{tip}{%
+ \installdartparameters%
+ \tipborderpoint}
+ \anchor{left tail}{%
+ \installdartparameters%
+ \lefttailborderpoint}
+ \anchor{right tail}{%
+ \installdartparameters%
+ \righttailborderpoint}
+ \anchor{tail center}{%
+ \installdartparameters%
+ \tailcenterborderpoint}
+ \anchor{left side}{%
+ \installdartparameters%
+ \pgfpointlineattime{0.5}{\tipborderpoint}{\lefttailborderpoint}}
+ \anchor{right side}{%
+ \installdartparameters%
+ \pgfpointlineattime{0.5}{\tipborderpoint}{\righttailborderpoint}}
+ \backgroundpath{%
+ \installdartparameters%
+ \pgfpathmoveto{\tippoint}%
+ \pgfpathlineto{\lefttailpoint}%
+ \pgfpathlineto{\tailcenterpoint}%
+ \pgfpathlineto{\righttailpoint}%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % This allows anchors base east, base west, mid east and mid west,
+ % to redefine the `center' of the node to correctly calculate the
+ % border points.
+ %
+ \pgfutil@ifundefined{pgf@dartanchorborderreferencepoint}%
+ {\let\referencepoint\centerpoint}%
+ {\let\referencepoint\pgf@dartanchorborderreferencepoint}%
+ %
+ % Adjust the location of the external
+ % point relative to the reference point.
+ %
+ \referencepoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Install the required points and angles.
+ %
+ \installdartparameters%
+ %
+ % Get the angle of the external point relative to \referencepoint.
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ %
+ % *Subtract* the rotation from the external angle.
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ %
+ % Get the set of angles for the appropriate border point.
+ %
+ \ifx\referencepoint\basepoint%
+ \let\angletotip\baseangletotip%
+ \let\angletotailcenter\baseangletotailcenter%
+ \let\angletolefttail\baseangletolefttail%
+ \let\angletorighttail\baseangletorighttail%
+ \else%
+ \ifx\referencepoint\midpoint%
+ \let\angletotip\midangletotip%
+ \let\angletotailcenter\midangletotailcenter%
+ \let\angletolefttail\midangletolefttail%
+ \let\angletorighttail\midangletorighttail%
+ \fi\fi%
+ %
+ % Locate the appropriate line on the border...
+ %
+ \ifdim\externalangle pt<\angletotip pt\relax%
+ \let\firstpoint\tipborderpoint%
+ \let\secondpoint\righttailborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletolefttail pt\relax%
+ \let\firstpoint\lefttailborderpoint%
+ \let\secondpoint\tipborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletotailcenter pt\relax%
+ \let\firstpoint\lefttailborderpoint%
+ \let\secondpoint\tailcenterborderpoint%
+ \else%
+ \ifdim\externalangle pt<\angletorighttail pt\relax%
+ \let\firstpoint\righttailborderpoint%
+ \let\secondpoint\tailcenterborderpoint%
+ \else%
+ \let\firstpoint\tipborderpoint%
+ \let\secondpoint\righttailborderpoint%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % ...and thus the point on the border.
+ %
+ \pgfpointintersectionoflines{\referencepoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ }%
+}
+
+
+
+% Keys for shape circular sector:
+%
+% /pgf/circular sector angle : the angle at the center of the sector.
+%
+\pgfkeys{/pgf/circular sector angle/.initial=60}
+
+% Shape circular sector
+%
+\pgfdeclareshape{circular sector}{%
+ \savedmacro\installcircularsectorparameters{%
+ %
+ % Define a \centerpoint, \basepoint and \midpoint.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % Half of the sector angle is more useful.
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/circular sector angle}}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\angle\pgfmathresult%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\halfangle\pgfmathresult%
+ %
+ % Get some useful trigonometric stuff.
+ %
+ \pgfmathsin@{\halfangle}%
+ \let\sinehalfangle\pgfmathresult%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \let\cosechalfangle\pgfmathresult%
+ \pgfmathabs@{\halfangle}%
+ \pgfmathcos@{\pgfmathresult}%
+ \let\coshalfangle\pgfmathresult%
+ \pgf@x\pgfmathresult pt\relax%
+ \pgf@x\cosechalfangle\pgf@x%
+ \edef\cothalfangle{\pgfmath@tonumber{\pgf@x}}%
+ %
+ % Calculate the miter length at the center,
+ % according to the outer sep.
+ %
+ \pgf@x\outersep\relax%
+ \pgf@x\cosechalfangle\pgf@x%
+ \edef\centermiter{\the\pgf@x}%
+ %
+ % Get the start and end angles of the arc.
+ %
+ \pgfmathsubtract@{180}{\halfangle}%
+ \let\startangle\pgfmathresult%
+ \pgfmathadd@{180}{\halfangle}%
+ \let\endangle\pgfmathresult%
+ %
+ % Get (half) the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ % Calculate the radius of the sector and the `center offset',
+ % which is the distance between the center of the node and the
+ % center of the sector.
+ %
+ \ifpgfshapeborderusesincircle%
+ %
+ % Get the rotation.
+ %
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ %
+ % Calculate the incircle radius.
+ %
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ \pgf@xa\cosechalfangle\pgf@x%
+ %
+ % xa is the radius, xb the offset.
+ %
+ \pgf@xb\pgf@xa%
+ \advance\pgf@xa\pgf@x%
+ \else%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % Swap the height and width for relevant angles.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ %
+ % xa is the radius, xb the offset.
+ %
+ \pgf@xa\cosechalfangle\pgf@y%
+ \pgf@xa\coshalfangle\pgf@xa%
+ \advance\pgf@xa\pgf@x%
+ \pgf@xb\pgf@xa%
+ \advance\pgf@xa\pgf@x%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@y}}%
+ \pgf@xa\pgfmathresult pt\relax%
+ \fi%
+ %
+ % Adjust for minimum height and width.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x.5\pgf@x%
+ \pgfmathsec@{\halfangle}%
+ \pgf@xc\pgfmathresult\pgf@xb%
+ \ifdim\pgf@xc<0pt\relax%
+ \pgf@xc-\pgf@xc%
+ \fi%
+ \ifdim\pgf@xc<\pgf@x%
+ \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xc}}%
+ \pgf@xc\pgfmathresult\pgf@x% Increase by ratio.
+ \pgf@xa\pgfmath@tonumber{\pgf@xc}\pgf@xa%
+ \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb%
+ \fi%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@xa<\pgf@y%
+ \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xa}}%
+ \pgf@xc\pgfmathresult\pgf@y% Increase by ratio.
+ \pgf@xa\pgf@y%
+ \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb%
+ \fi%
+ \edef\centeroffset{\the\pgf@xb}%
+ \edef\radius{\the\pgf@xa}%
+ %
+ % Calculate the radius at sector border and the arc corners.
+ %
+ \advance\pgf@xa\outersep\relax%
+ \edef\borderradius{\the\pgf@xa}%
+ \pgf@x\outersep\relax%
+ \pgf@x\cosechalfangle\pgf@x%
+ \pgf@x\coshalfangle\pgf@x%
+ \advance\pgf@xa\pgf@x%
+ \edef\cornerradius{\the\pgf@xa}%
+ %
+ % Calculate the *unrotated* points for the background path.
+ %
+ \pgfextract@process\sectorcenter{%
+ \centerpoint%
+ \advance\pgf@x\centeroffset%
+ }%
+ \pgfextract@process\arcstart{%
+ \pgfqpointpolar{\startangle}{\radius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \sectorcenter%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Calculate the *unrotated* points for the anchor border.
+ %
+ \pgfextract@process\sectorcenterborder{%
+ \sectorcenter%
+ \advance\pgf@x\centermiter\relax%
+ }%
+ \pgfextract@process\arcstartborder{%
+ \pgfqpointpolar{\startangle}{\borderradius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \sectorcenter%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfextract@process\arcendborder{%
+ \pgfqpointpolar{\endangle}{\borderradius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \sectorcenter%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfextract@process\arcstartcorner{%
+ \pgfqpointpolar{\startangle}{\cornerradius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \sectorcenterborder%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfextract@process\arcendcorner{%
+ \pgfqpointpolar{\endangle}{\cornerradius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \sectorcenterborder%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Calculate the *unrotated* corner angles to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\sectorcenterborder}%
+ \let\angletosectorcenterborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcstartborder}%
+ \let\angletoarcstartborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcendborder}%
+ \let\angletoarcendborder\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcstartcorner}%
+ \let\angletoarcstartcorner\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcendcorner}%
+ \let\angletoarcendcorner\pgfmathresult%
+ %
+ % Rotate the background path points around the note center.
+ %
+ \pgfextract@process\sectorcenter{%
+ \pgfmathrotatepointaround{\sectorcenter}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcstart{%
+ \pgfmathrotatepointaround{\arcstart}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Rotate the border points around the note center.
+ %
+ \pgfextract@process\sectorcenterborder{%
+ \pgfmathrotatepointaround{\sectorcenterborder}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcstartborder{%
+ \pgfmathrotatepointaround{\arcstartborder}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcendborder{%
+ \pgfmathrotatepointaround{\arcendborder}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcstartcorner{%
+ \pgfmathrotatepointaround{\arcstartcorner}{\centerpoint}{\rotate}%
+ }%
+ \pgfextract@process\arcendcorner{%
+ \pgfmathrotatepointaround{\arcendcorner}{\centerpoint}{\rotate}%
+ }%
+ %
+ % Add the rotation to the start and end angles.
+ %
+ \pgfmathadd@{\startangle}{\rotate}%
+ \let\startangle\pgfmathresult%
+ \pgfmathadd@{\endangle}{\rotate}%
+ \let\endangle\pgfmathresult%
+ %
+ % Save everything.
+ %
+ % NB \addtosavedmacro is currently experimental. May get changed.
+ %
+ \addtosavedmacro{\rotate}%
+ \addtosavedmacro{\centeroffset}%
+ %
+ \addtosavedmacro{\radius}%
+ \addtosavedmacro{\borderradius}%
+ \addtosavedmacro{\cornerradius}%
+ %
+ \addtosavedmacro{\endangle}%
+ \addtosavedmacro{\startangle}%
+ %
+ \addtosavedmacro{\sectorcenter}%
+ \addtosavedmacro{\arcstart}%
+ %
+ \addtosavedmacro{\sectorcenterborder}%
+ \addtosavedmacro{\arcstartborder}%
+ \addtosavedmacro{\arcendborder}%
+ \addtosavedmacro{\arcstartcorner}%
+ \addtosavedmacro{\arcendcorner}%
+ %
+ \addtosavedmacro{\angletosectorcenterborder}%
+ \addtosavedmacro{\angletoarcstartborder}%
+ \addtosavedmacro{\angletoarcendborder}%
+ \addtosavedmacro{\angletoarcstartcorner}%
+ \addtosavedmacro{\angletoarcendcorner}%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{base}{\basepoint}
+ \anchor{mid}{\midpoint}
+ \anchor{arc start}{%
+ \installcircularsectorparameters%
+ \arcstartcorner%
+ }
+ \anchor{arc end}{%
+ \installcircularsectorparameters%
+ \arcendcorner%
+ }
+ \anchor{sector center}{%
+ \installcircularsectorparameters%
+ \sectorcenterborder%
+ }
+ \anchor{arc center}{%
+ \installcircularsectorparameters%
+ \pgfmathadd@{\rotate}{180}%
+ \let\angle\pgfmathresult%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpointpolar{\angle}{\cornerradius}}%
+ }
+ \anchor{north}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{\cornerradius}}%
+ }
+ \anchor{south}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{-\cornerradius}}%
+ }
+ \anchor{east}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{0pt}}%
+ }
+ \anchor{north west}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{\cornerradius}}%
+ }
+ \anchor{south west}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{-\cornerradius}}%
+ }
+ \anchor{north east}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{\cornerradius}}%
+ }
+ \anchor{south east}{%
+ \installcircularsectorparameters%
+ \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{-\cornerradius}}%
+ }
+ \backgroundpath{%
+ \installcircularsectorparameters%
+ \pgfpathmoveto{\sectorcenter}%
+ \pgfpathlineto{\arcstart}%
+ \ifdim\endangle pt>360pt\relax%
+ \ifdim\startangle pt>360pt\relax%
+ \pgfpatharc{\startangle}{\endangle}{\radius}%
+ \else%
+ \pgfpatharc{\startangle}{360}{\radius}%
+ \pgfpatharc{0}{\endangle}{\radius}%
+ \fi%
+ \else%
+ \pgfpatharc{\startangle}{\endangle}{\radius}%
+ \fi%
+ \pgfpathclose%
+ }%
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Adjust the location of the external point relative to \centerpoint.
+ %
+ \centerpoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Install the required points and angles.
+ %
+ \installcircularsectorparameters%
+ %
+ % Get the angle of the external point to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ \let\externalangle\pgfmathresult%
+ %
+ % *Subtract* the rotation from the external angle.
+ %
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\angle\pgfmathresult%
+ %
+ % Determine if the line will cross the sector arc.
+ %
+ \ifdim\angle pt>\angletoarcendcorner pt\relax%
+ \let\firstpoint\arcendcorner%
+ \let\secondpoint\sectorcenterborder%
+ \else%
+ \ifdim\angle pt>\angletoarcendborder pt\relax%
+ \let\firstpoint\arcendborder%
+ \let\secondpoint\arcendcorner%
+ \else%
+ \ifdim\angle pt>\angletoarcstartborder pt\relax%
+ \let\firstpoint\pgfutil@empty%
+ \let\secondpoint\pgfutil@empty%
+ \else%
+ \ifdim\angle pt>\angletoarcstartcorner pt\relax%
+ \let\firstpoint\arcstartborder
+ \let\secondpoint\arcstartcorner
+ \else%
+ \let\firstpoint\sectorcenterborder%
+ \let\secondpoint\arcstartcorner%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\firstpoint\pgfutil@empty
+ %
+ % Calculate the angle from the centre of the semicircle to the
+ % point on the semicircle arc which intersects the line from
+ % the external point to the reference point...
+ %
+ \pgfmathanglebetweenlines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\sectorcenter}{\centerpoint}%
+ \pgfmathsin@{\pgfmathresult}%
+ \let\sineangle\pgfmathresult%
+ \pgf@x\borderradius\relax%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@x}}%
+ \let\reciprocalradius\pgfmathresult%
+ \pgf@x\centeroffset\relax%
+ \pgf@x\sineangle\pgf@x%
+ \pgf@x\reciprocalradius\pgf@x%
+ \pgfmathasin@{\pgfmath@tonumber{\pgf@x}}%
+ \pgf@x\pgfmathresult pt\relax%
+ \advance\pgf@x\externalangle pt\relax%
+ \edef\angle{\pgfmath@tonumber{\pgf@x}}%
+ %
+ % ...and thus the point on the border.
+ %
+ \pgfpointadd{\sectorcenter}{\pgfqpointpolar{\angle}{\borderradius}}%
+ \else%
+ %
+ % Calculate the the point where the semicircle chord intersects
+ % the line from the external point to the reference point.
+ %
+ \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ \fi%
+ }%
+}
+
+
+
+% Keys for shape cylinder
+%
+% /pgf/shape aspect : Ratio between the x and y radii of the cylinder end.
+% /pgf/cylinder uses custom fill : Use a custom fill for the cylinder.
+% /pgf/cylinder end fill : Custom color for the cylinder end.
+% /pgf/cylinder body fill : Custom color for the cylinderbody.
+%
+
+\newif\ifpgfcylinderusescustomfill
+\pgfkeys{/pgf/.cd,
+ cylinder uses custom fill/.is if=pgfcylinderusescustomfill,
+ cylinder end fill/.initial=white,
+ cylinder body fill/.initial=white
+}
+
+
+\pgfdeclareshape{cylinder}{%
+ \savedmacro\getcylinderpoints{%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgf@x\pgf@xc%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y\pgf@yc%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \ifpgfshapeborderusesincircle%
+ \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \else%
+ \pgf@y\pgf@x%
+ \fi%
+ \pgf@x1.414213\pgf@x%
+ \pgf@y1.414213\pgf@y%
+ \else%
+ \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \pgfmathsetcount\c@pgf@counta{+\pgfmathresult}%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \edef\rotate{\the\c@pgf@counta}%
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xa%
+ \pgf@yc\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xa\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xa%
+ \pgf@yc\pgf@xc%
+ \fi%
+ \fi%
+ \fi%
+ \addtosavedmacro\rotate%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfutil@tempdima\pgfshapeaspect\pgf@ya%
+ \pgfutil@tempdimb\pgf@ya%
+ %
+ % Adjust for minimum height.
+ %
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdimb<.5\pgf@xc\relax%
+ \pgfutil@tempdimb.5\pgf@xc%
+ \pgf@ya\pgfutil@tempdimb%
+ \fi%
+ %
+ % Calculate how far the node contents can extend into the cylinder bottom.
+ %
+ \pgf@yb\pgfutil@tempdimb%
+ \advance\pgf@yb-\pgf@yc%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yb}}{\pgfmath@tonumber{\pgfutil@tempdimb}}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ \let\angle\pgfmathresult%
+ \pgf@xb\pgfmathresult\pgfutil@tempdima%
+ %
+ % Adjust for minimum width.
+ %
+ \pgf@x.5\pgflinewidth%
+ \advance\pgf@x2.0\pgf@xa%
+ \advance\pgf@x3.0\pgfutil@tempdima%
+ \advance\pgf@x-\pgf@xb%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<\pgf@xc%
+ \advance\pgf@xc-\pgf@x%
+ \advance\pgf@xa.5\pgf@xc%
+ \fi%
+ %
+ % Add the larger of the outer sep to the radii.
+ %
+ \pgf@x\pgfutil@tempdima\relax%
+ \pgf@y\pgfutil@tempdimb\relax%
+ \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xc>\pgf@yc%
+ \advance\pgf@x\pgf@xc%
+ \advance\pgf@y\pgf@xc%
+ \edef\outersep{\the\pgf@xc}%
+ \else%
+ \advance\pgf@x\pgf@yc%
+ \advance\pgf@y\pgf@yc%
+ \edef\outersep{\the\pgf@yc}%
+ \fi%
+ \edef\xradius{\the\pgf@x}%
+ \edef\yradius{\the\pgf@y}%
+ \addtosavedmacro\xradius%
+ \addtosavedmacro\yradius%
+ \addtosavedmacro\outersep%
+ %
+ \pgfextract@process\cylindercenter{%
+ \pgf@x\pgfutil@tempdima%
+ \advance\pgf@x.5\pgflinewidth%
+ \advance\pgf@x\pgf@xb%
+ \pgf@x.5\pgf@x%
+ \pgf@y0pt%
+ }%
+ \addtosavedmacro\cylindercenter%
+ %
+ \pgfextract@process\beforetop{%
+ \pgf@x\pgf@xa%
+ \advance\pgf@x\pgfutil@tempdima%
+ \advance\pgf@x.5\pgflinewidth%
+ \pgf@y\pgf@ya%
+ }%
+ \pgfextract@process\afterbottom{%
+ \pgf@x-\pgf@xa%
+ \advance\pgf@x\pgf@xb%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro\beforetop%
+ \addtosavedmacro\afterbottom%
+ \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfextract@process\beforetopanchor{%
+ \beforetop%
+ \advance\pgf@y\pgf@yc%
+ }%
+ \pgfextract@process\afterbottomanchor{%
+ \afterbottom%
+ \advance\pgf@y\pgf@yc%
+ }%
+ \addtosavedmacro\beforetopanchor%
+ \addtosavedmacro\afterbottomanchor%
+ %
+ \beforetopanchor%
+ \advance\pgf@x\xradius\relax%
+ \ifdim\pgf@x>\pgf@y%
+ \edef\externalradius{\the\pgf@x}%
+ \else%
+ \edef\externalradius{\the\pgf@y}%
+ \fi%
+ \addtosavedmacro\externalradius%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{shape center}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{\pgfpointadd{\cylindercenter}{\centerpoint}}%
+ {\centerpoint}{\rotate}%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \getcylinderpoints%
+ \let\pgf@cylinder@referencepoint\midpoint%
+ \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}%
+ }%
+ \anchor{mid west}{%
+ \getcylinderpoints%
+ \let\pgf@cylinder@referencepoint\midpoint%
+ \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \getcylinderpoints%
+ \let\pgf@cylinder@referencepoint\basepoint%
+ \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}%
+ }%
+ \anchor{base west}{%
+ \getcylinderpoints%
+ \let\pgf@cylinder@referencepoint\basepoint%
+ \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{north}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{0pt}{\externalradius}}%
+ }%
+ \anchor{south}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{0pt}{-\externalradius}}%
+ }%
+ \anchor{east}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}%
+ }%
+ \anchor{west}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}%
+ }%
+ \anchor{north east}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{\externalradius}}%
+ }%
+ \anchor{south west}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }%
+ \anchor{south east}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }%
+ \anchor{north west}{%
+ \getcylinderpoints%
+ \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }%
+ \anchor{before top}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \anchor{top}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \beforetop%
+ \pgf@y0pt\relax%
+ \advance\pgf@x\xradius\relax%
+ }{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \anchor{after top}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \anchor{before bottom}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \anchor{bottom}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{%
+ \pgfpointadd{%
+ \afterbottom%
+ \pgf@y0pt\relax%
+ \advance\pgf@x-\xradius\relax%
+ }{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \anchor{after bottom}{%
+ \getcylinderpoints%
+ \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}{\centerpoint}{\rotate}%
+ }
+ \backgroundpath{%
+ \getcylinderpoints%
+ {%
+ \pgf@x\xradius\relax%
+ \advance\pgf@x-\outersep\relax%
+ \edef\xradius{\the\pgf@x}%
+ \pgf@y\yradius\relax%
+ \advance\pgf@y-\outersep\relax%
+ \edef\yradius{\the\pgf@y}%
+ \pgftransformshift{\centerpoint}%
+ \pgftransformrotate{\rotate}%
+ \pgfpathmoveto{\afterbottom}%
+ \pgfpatharc{90}{270}{\xradius and \yradius}%
+ \pgfpathlineto{\beforetop\pgf@y-\pgf@y}%
+ \pgfpatharc{-90}{90}{\xradius and \yradius}%
+ \pgfpathclose%
+ \pgfpathmoveto{\beforetop}%
+ \pgfpatharc{90}{270}{\xradius and \yradius}%
+ }%
+ }%
+ \behindbackgroundpath{%
+ \ifpgfcylinderusescustomfill%
+ \getcylinderpoints%
+ \pgf@x\xradius\relax%
+ \advance\pgf@x-\outersep\relax%
+ \edef\xradius{\the\pgf@x}%
+ \pgf@y\yradius\relax%
+ \advance\pgf@y-\outersep\relax%
+ \edef\yradius{\the\pgf@y}%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgftransformrotate{\rotate}%
+ \pgfpathmoveto{\afterbottom}%
+ \pgfpatharc{90}{270}{\xradius and \yradius}%
+ \pgfpathlineto{\beforetop\pgf@y-\pgf@y}%
+ \pgfpatharc{270}{90}{\xradius and \yradius}%
+ \pgfpathclose%
+ \expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/cylinder body fill}}%
+ \pgfusepath{fill}%
+ %
+ \pgfpathmoveto{\beforetop}%
+ \pgfpatharc{90}{-270}{\xradius and \yradius}%
+ \pgfpathclose
+ \expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/cylinder end fill}}%
+ \pgfusepath{fill}%
+ }%
+ \fi%
+ }%
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \getcylinderpoints%
+ \pgfutil@ifundefined{pgf@cylinder@referencepoint}{\let\referencepoint\centerpoint}{%
+ \let\referencepoint\pgf@cylinder@referencepoint}%
+ \pgfextract@process\externalpoint{%
+ \externalpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \referencepoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ %
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor}{\centerpoint}}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor}{\centerpoint}}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathrotatepointaround{%
+ \pgfmathpointintersectionoflineandarc%
+ {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
+ {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
+ {%
+ \beforetop%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ {0}{90}{\xradius and \yradius}%
+ }{\centerpoint}{\rotate}%
+ \else%
+ \pgfpointintersectionoflines{%
+ \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}%
+ {\centerpoint}{\rotate}}{%
+ \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}%
+ {\centerpoint}{\rotate}}%
+ {\referencepoint}{\externalpoint}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}%
+ \ifdim\externalangle pt>\pgfmathresult pt\relax%
+ \pgfmathrotatepointaround{%
+ \pgfmathpointintersectionoflineandarc%
+ {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
+ {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
+ {%
+ \beforetop%
+ \pgf@xa\pgf@x%
+ \centerpoint
+ \advance\pgf@x\pgf@xa%
+ }%
+ {270}{360}{\xradius and \yradius}%
+ }{\centerpoint}{\rotate}%
+ \else%
+ \pgfpointintersectionoflines{%
+ \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}%
+ {\centerpoint}{\rotate}}{%
+ \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}%
+ {\centerpoint}{\rotate}}%
+ {\referencepoint}{\externalpoint}%
+ \fi%
+ \else%
+ \pgfmathrotatepointaround{%
+ \pgfmathpointintersectionoflineandarc%
+ {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
+ {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
+ {%
+ \afterbottom%
+ \pgf@xa\pgf@x%
+ \centerpoint
+ \advance\pgf@x\pgf@xa%
+ }%
+ {90}{270}{\xradius and \yradius}%
+ }{\centerpoint}{\rotate}%
+ \fi%
+ \fi%
+ }
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex
new file mode 100644
index 00000000000..a57b0cd4511
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex
@@ -0,0 +1,1123 @@
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex,v 1.3 2008/10/07 18:23:25 vibrovski Exp $
+
+
+\pgfdeclareshape{cross out}
+{
+ \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
+ \foregroundpath{
+ % store lower right in xa/ya and upper right in xb/yb
+ \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ }
+}
+
+
+\pgfdeclareshape{strike out}
+{
+ \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
+ \foregroundpath{
+ \pgfpathmoveto{\southwest}
+ \pgfpathlineto{\northeast}
+ }
+}
+
+
+% Rounded rectangle
+
+
+\pgfkeys{/pgf/.cd,
+ rounded rectangle west arc/.initial=convex,
+ rounded rectangle east arc/.initial=convex,
+ rounded rectangle left arc/.style={/pgf/rounded rectangle west arc=#1},%
+ rounded rectangle right arc/.style={/pgf/rounded rectangle east arc=#1},%
+ rounded rectangle arc length/.initial=180%
+}%
+
+\def\pgf@lib@sh@misc@rr@text@concave{concave}%
+\def\pgf@lib@sh@misc@rr@text@convex{convex}%
+
+\pgfdeclareshape{rounded rectangle}{%
+ \savedmacro\westarc{%
+ \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
+ }
+ \savedmacro\eastarc{%
+ \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
+ }
+ \savedmacro\roundedrectanglepoints{%
+ %
+ % Get half the arc angle, a.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}%
+ \pgf@x=.5\pgf@x%
+ \edef\halfarcangle{\pgfmath@tonumber{\pgf@x}}%
+ \addtosavedmacro\halfarcangle%
+ %
+ % Get the (half) node dimensions x & y.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \edef\innerxsep{\the\pgf@x}%
+ \pgf@xa=0.5\wd\pgfnodeparttextbox%
+ \edef\halftextwidth{\the\pgf@xa}%
+ \addtosavedmacro\halftextwidth%
+ \advance\pgf@x by\pgf@xa%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \edef\innerysep{\the\pgf@y}%
+ \pgf@ya=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+ \edef\halftextheight{\the\pgf@ya}%
+ \addtosavedmacro\halftextheight%
+ \advance\pgf@y by\pgf@ya%
+ %
+ % Adjust for minimum height
+ %
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@yb%
+ \pgf@y=.5\pgf@yb%
+ \fi%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfheight%
+ %
+ % Calculate the radius of the arc ends.
+ %
+ \pgfmathcosec@{\halfarcangle}%
+ \pgf@ya=\pgfmathresult\pgf@y%
+ \edef\radius{\the\pgf@ya}%
+ \addtosavedmacro\radius%
+ %
+ % Arc width = r - r*cos(a/2).
+ %
+ \pgfmathcos@{\halfarcangle}%
+ \pgf@xa=\pgf@ya%
+ \advance\pgf@xa by-\pgfmathresult\pgf@ya%
+ %
+ % When the node contents are pushed inside a convex arc,
+ % the resulting chord has a height r - r*cos(asin(0.5*h/r)).
+ %
+ \pgfmathdivide{\halftextheight}{\radius}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ \pgf@xb=\pgf@ya%
+ \advance\pgf@xb by-\pgfmathresult\pgf@ya%
+ %
+ % Adjust for minimum width.
+ %
+ \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
+ \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
+ %
+ \pgfutil@tempdima=2.0\pgf@x% x still holds the half width.
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \advance\pgfutil@tempdima by\pgf@xa%
+ \else%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
+ \fi%
+ %
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \advance\pgfutil@tempdima by\pgf@xa%
+ \else%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
+ \fi%
+ %
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<\pgfutil@tempdimb%
+ \advance\pgfutil@tempdimb by-\pgfutil@tempdima%
+ \divide\pgfutil@tempdimb by2\relax%
+ \edef\xoffset{\the\pgfutil@tempdimb}%
+ \else%
+ \let\xoffset=\innerxsep%
+ \fi%
+ %
+ % The node is made wider if convex arcs overlap.
+ %
+ \pgf@x=\halftextwidth\relax%
+ \advance\pgf@x by\xoffset\relax%
+ \pgf@xc=\pgf@ya%
+ \advance\pgf@xc by-\pgf@xb%
+ \ifdim\pgf@xc>\pgf@x\relax%
+ \advance\pgf@xc by-\pgf@x%
+ \advance\pgf@xc by\xoffset\relax%
+ \edef\xoffset{\the\pgf@xc}%
+ \fi%
+ \addtosavedmacro\xoffset%
+ %
+ \pgf@x=\halftextwidth\relax%
+ \advance\pgf@x by\xoffset\relax%
+ \edef\halfwidth{\the\pgf@x}%
+ \addtosavedmacro\halfwidth%
+ %
+ \edef\arcwidth{\the\pgf@xa}%
+ \addtosavedmacro\arcwidth%
+ %
+ \edef\chordwidth{\the\pgf@xb}%
+ \addtosavedmacro\chordwidth%
+ %
+ \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ %
+ % calculate some horizontal adjustments made for the default miter
+ % drawn when an arc meets the north or south side of the node path.
+ %
+ \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
+ \def\concavexshift{0pt}%
+ \else%
+ % For a concave arc: outer xsep * cosec((90-a/2)/2)*cos((90-a/2)/2).
+ \pgfmathsubtract@{90}{\halfarcangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angletemp=\pgfmathresult%
+ \pgf@x=\outerxsep\relax%
+ \pgfmathcosec@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \pgfmathcos@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \edef\concavexshift{\the\pgf@x}%
+ \fi%
+ \addtosavedmacro\concavexshift%
+ %
+ \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
+ \def\convexxshift{0pt}%
+ \else%
+ % For a convex arc: outer xsep * cosec((90+a/2)/2)*cos((90+a/2)/2).
+ \pgfmathadd@{90}{\halfarcangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angletemp=\pgfmathresult%
+ \pgf@x=\outerxsep\relax%
+ \pgfmathcosec@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \pgfmathcos@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \edef\convexxshift{\the\pgf@x}%
+ \fi%
+ \addtosavedmacro\convexxshift%
+ }%
+ \saveddimen\halflinewidth{\pgf@x.5\pgflinewidth}%
+ \savedanchor\centerpoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgf@y=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgf@y=0pt\relax%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid west}{%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \pgf@xc=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{mid east}{%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \pgf@xc=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base west}{%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \pgf@xc=\pgf@x%
+ \basepoint%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{base east}{%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \pgf@xc=\pgf@x%
+ \basepoint%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{north}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{\halfheight+\outerysep}}%
+ }%
+ \anchor{south}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{-\halfheight-\outerysep}}%
+ }%
+ \anchor{west}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpoint{-\halfwidth-\arcwidth-\concavexshift}{+0pt}%
+ \else%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpoint{-\halfwidth-\chordwidth-\outerxsep}{+0pt}%
+ \else%
+ \pgfpoint{-\halfwidth-\outerxsep}{+0pt}%
+ \fi%
+ \fi%
+ }%
+ }%
+ \anchor{north west}{%
+ \roundedrectanglepoints%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@north\endcsname%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{south west}{%
+ \roundedrectanglepoints%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@south\endcsname%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{east}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpoint{\halfwidth+\arcwidth+\concavexshift}{+0pt}%
+ \else%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpoint{\halfwidth+\chordwidth+\outerxsep}{+0pt}%
+ \else%
+ \pgfpoint{\halfwidth+\outerxsep}{+0pt}%
+ \fi%
+ \fi%
+ }%
+ }%
+ \anchor{north east}{%
+ \roundedrectanglepoints%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@north\endcsname%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{south east}{%
+ \roundedrectanglepoints%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@south\endcsname%
+ \pgf@x=\pgf@xc%
+ }%
+ \backgroundpath{%
+ {%
+ \roundedrectanglepoints%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfpoint{0pt}{\halfheight}}%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpathlineto{\pgfpoint{\halfwidth+\arcwidth}{+\halfheight}}%
+ \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{+\radius}%
+ \else%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpathlineto{\pgfpoint{\halfwidth+\chordwidth-\arcwidth}{+\halfheight}}%
+ \pgfpatharc{+\halfarcangle}{+-\halfarcangle}{+\radius}%
+ \else%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
+ \fi%
+ \fi%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpathlineto{\pgfpoint{-\halfwidth-\arcwidth}{+-\halfheight}}%
+ \pgfpatharc{+-\halfarcangle}{+\halfarcangle}{+\radius}%
+ \else%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpathlineto{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth}{+-\halfheight}}%
+ \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{+\radius}%
+ \else%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
+ \fi%
+ \fi%
+ \pgfpathclose%
+ }%
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{%
+ \pgfextract@process\externalpoint{}%
+ \pgfpointadd{\centerpoint}{\externalpoint}%
+ }%
+ \roundedrectanglepoints%
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle=\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ % Between north east and east.
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
+ }%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{0}{\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
+ \else%
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\externalpoint}{\centerpoint}%
+ \fi%
+ \else%
+ % Between north west and north east.
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\externalpoint}{\centerpoint}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ % Between south west and north west.
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\radius}{+0pt}}%
+ }%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{180-\halfarcangle}{180+\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
+ \else%
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ {\externalpoint}{\centerpoint}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ % Between south east and south west.
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ {\externalpoint}{\centerpoint}%
+ \else%
+ % Between east and south east.
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
+ }%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{360-\halfarcangle}{360}{\radius+\outerxsep and \radius+\outerysep}%
+ \else%
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\externalpoint}{\centerpoint}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }
+}
+
+
+
+% Keys for chamfered rectangle
+%
+% /pgf/chamfered rectangle corners : specify the corners to chamfer.
+% /pgf/chamfered rectangle angle : set the angle of the chamfer.
+% /pgf/chamfered rectangle xsep : set the extent of the x chamferling.
+% /pgf/chamfered rectangle ysep : set the extent of the y chamferling.
+
+\pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}
+\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}
+
+\def\pgf@lib@sh@misc@cr@chamferall{chamfer all}%
+\def\pgf@lib@sh@misc@cr@chamfer{chamfer}
+\let\pgf@lib@sh@misc@cr@corners\pgf@lib@sh@misc@cr@chamferall
+
+
+\def\pgf@lib@sh@misc@cr@getcorners{%
+ \let\northeastcorner\pgfutil@empty%
+ \let\southeastcorner\pgfutil@empty%
+ \let\southwestcorner\pgfutil@empty%
+ \let\northwestcorner\pgfutil@empty%
+ \expandafter\pgfutil@in@\expandafter{\pgf@lib@sh@misc@cr@corners}{chamfer all}%
+ \ifpgfutil@in@%
+ \let\northeastcorner\pgf@lib@sh@misc@cr@round%
+ \let\southeastcorner\pgf@lib@sh@misc@cr@round%
+ \let\southwestcorner\pgf@lib@sh@misc@cr@round%
+ \let\northwestcorner\pgf@lib@sh@misc@cr@round%
+ \let\pgf@next\relax%
+ \else%
+ \let\pgf@next\pgf@lib@sh@misc@cr@parsecorners%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@sh@misc@cr@parsecorners{%
+ \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@lib@sh@misc@cr@corners,\pgf@stop,%
+}
+
+\def\pgf@@chamferedrectangle@parsecorners#1,{%
+ \ifx#1\pgf@stop%
+ \let\pgf@next\relax%
+ \else%
+ \pgfutil@in@{@#1@}{@north east@@top left@}%
+ \ifpgfutil@in@%
+ \let\northeastcorner\pgf@lib@sh@misc@cr@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@south east@@bottom right@}%
+ \ifpgfutil@in@%
+ \let\southeastcorner\pgf@lib@sh@misc@cr@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@south west@@bottom left@}%
+ \ifpgfutil@in@%
+ \let\southwestcorner\pgf@lib@sh@misc@cr@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@north west@@top right@}%
+ \ifpgfutil@in@%
+ \let\northwestcorner\pgf@lib@sh@misc@cr@round%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \let\pgf@next\pgf@@@chamferedrectangle@parsecorners%
+ \fi%
+ \pgf@next%
+}
+\def\pgf@@@chamferedrectangle@parsecorners{%
+ \pgfutil@ifnextchar x{\pgf@@chamferedrectangle@parsecorners}{\pgf@@chamferedrectangle@parsecorners}%
+}%
+
+\pgfkeys{/pgf/.cd,
+ chamfered rectangle angle/.initial=45,%
+ chamfered rectangle xsep/.initial=.666ex,%
+ chamfered rectangle ysep/.initial=.666ex%
+}
+ \pgfkeys{/pgf/chamfered rectangle sep/.style={%
+ /pgf/chamfered rectangle xsep=#1,/pgf/chamfered rectangle ysep=#1}%
+}
+
+
+
+
+% Shape chamfered rectangle.
+%
+%
+\pgfdeclareshape{chamfered rectangle}{%
+ \savedmacro\getchamferedrectanglepoints{%
+ \pgf@lib@sh@misc@cr@getcorners%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya.5\dp\pgfnodeparttextbox%
+ %
+ % Get chamfer stuff.
+ %
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/chamfered rectangle angle}}%
+ \ifdim\pgfutil@tempdima<89pt\relax%
+ \ifdim\pgfutil@tempdima<1pt\relax%
+ \pgfutil@tempdima1pt\relax%
+ \fi%
+ \else%
+ \pgfutil@tempdima89pt\relax%
+ \fi%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima90pt\relax%
+ \pgfmathtan@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \let\tanangle\pgfmathresult%
+ \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \let\cotangle\pgfmathresult%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/chamfered rectangle xsep}}%
+ \pgf@yc\tanangle\pgf@xb%
+ \ifdim\pgf@yc>\pgf@ya%
+ \pgf@yc\pgf@ya%
+ \pgf@xb\cotangle\pgf@yc%
+ \fi%
+ \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/chamfered rectangle ysep}}%
+ \pgf@xc\cotangle\pgf@yb%
+ \ifdim\pgf@xc>\pgf@xa%
+ \pgf@xc\pgf@xa%
+ \pgf@yb\tanangle\pgf@xc%
+ \fi%
+ %
+ % Check for minimum width and height%
+ %
+ \pgfutil@tempdima\pgf@xa%
+ \advance\pgfutil@tempdima\pgf@xb%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb%
+ \pgf@xa.5\pgfutil@tempdimb%
+ \advance\pgf@xa-\pgf@xb%
+ \fi%
+ \pgfutil@tempdima\pgf@ya%
+ \advance\pgfutil@tempdima\pgf@yb%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb%
+ \pgf@ya.5\pgfutil@tempdimb%
+ \advance\pgf@ya-\pgf@yb%
+ \fi%
+ %
+ % Define the background path points.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}%
+ }%
+ \pgfextract@process\beforenortheast{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@ya%
+ \advance\pgf@y-\pgf@yc%
+ }%
+ \pgfextract@process\northeast{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ \ifx\northeastcorner\pgfutil@empty%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\afternortheast{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@x-\pgf@xc%
+ \advance\pgf@y\pgf@ya%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \pgfextract@process\northwest{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ \ifx\northwestcorner\pgfutil@empty%
+ \advance\pgf@x-\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\beforesouthwest{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@x-\pgf@xb%
+ \advance\pgf@y-\pgf@ya%
+ \advance\pgf@y\pgf@yc%
+ }%
+ \pgfextract@process\southwest{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ \ifx\southwestcorner\pgfutil@empty%
+ \advance\pgf@x-\pgf@xb%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\aftersouthwest{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@x\pgf@xc%
+ \advance\pgf@y-\pgf@ya%
+ \advance\pgf@y-\pgf@yb%
+ }%
+ \pgfextract@process\southeast{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ \ifx\southeastcorner\pgfutil@empty%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ }%
+ %
+ % Calculate the `miter' vectors.
+ %
+ \pgfmathanglebetweenlines{\beforenortheast}{\afternortheast}{\beforenortheast}%
+ {\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \ifdim\pgfutil@tempdima>180pt\relax%
+ \advance\pgfutil@tempdima-180pt\relax%
+ \fi%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \ifdim\pgfutil@tempdima<90pt\relax%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \pgfutil@tempdima0pt\relax%
+ \else%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima90pt\relax%
+ \fi%
+ \pgfextract@process\before@ne@anchor{%
+ \beforenortheast%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfextract@process\before@sw@anchor{%
+ \beforesouthwest%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ \pgfmathanglebetweenlines{\afternortheast}{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}%
+ {\afternortheast}{\beforenortheast}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \ifdim\pgfutil@tempdima>270pt\relax%
+ \advance\pgfutil@tempdima-270pt\relax%
+ \fi%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgfutil@tempdima<90pt\relax%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \pgfutil@tempdima90pt\relax%
+ \else%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb%
+ \fi%
+ %
+ \pgfextract@process\after@ne@anchor{%
+ \afternortheast%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfutil@tempdima-\pgfutil@tempdima%
+ \advance\pgfutil@tempdima180pt\relax%
+ \pgfextract@process\after@sw@anchor{%
+ \aftersouthwest
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro\before@ne@anchor%
+ \addtosavedmacro\after@ne@anchor%
+ \addtosavedmacro\before@sw@anchor%
+ \addtosavedmacro\after@sw@anchor%
+ \pgfextract@process\ne@anchor{%
+ \ifx\northeastcorner\pgfutil@empty%
+ \northeast%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \else%
+ \pgfpointlineattime{0.5}{\before@ne@anchor}{\after@ne@anchor}%
+ \fi%
+ }%
+ \pgfextract@process\nw@anchor{%
+ \ifx\northwestcorner\pgfutil@empty%
+ \northwest%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \else%
+ \pgfpointlineattime{0.5}{%
+ \before@ne@anchor%
+ \pgf@ya\pgf@y
+ \before@sw@anchor%
+ \pgf@y\pgf@ya%
+ }{%
+ \after@ne@anchor%
+ \pgf@ya\pgf@y
+ \after@sw@anchor%
+ \pgf@y\pgf@ya%
+ }%
+ \fi%
+ }%
+ \pgfextract@process\sw@anchor{%
+ \ifx\southwestcorner\pgfutil@empty%
+ \southwest%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ \else%
+ \pgfpointlineattime{0.5}{\before@sw@anchor}{\after@sw@anchor}%
+ \fi%
+ }%
+ \pgfextract@process\se@anchor{%
+ \ifx\southeastcorner\pgfutil@empty%
+ \southeast%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ \else%
+ \pgfpointlineattime{0.5}{%
+ \before@ne@anchor%
+ \pgf@xa\pgf@x
+ \before@sw@anchor%
+ \pgf@x\pgf@xa%
+ }{%
+ \after@ne@anchor%
+ \pgf@xa\pgf@x
+ \after@sw@anchor%
+ \pgf@x\pgf@xa%
+ }%
+ \fi%
+ }%
+ \addtosavedmacro\ne@anchor%
+ \addtosavedmacro\nw@anchor%
+ \addtosavedmacro\sw@anchor%
+ \addtosavedmacro\se@anchor%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \getchamferedrectanglepoints%
+ \midpoint%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \before@sw@anchor%
+ \pgf@ya\pgf@y%
+ \before@ne@anchor%
+ \pgf@y\pgf@ya
+ }%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}%
+ \else%
+ \pgf@process{\before@ne@anchor}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor}%
+ {\after@ne@anchor}%
+ \fi%
+ \fi%
+ }%
+ \anchor{mid west}{%
+ \getchamferedrectanglepoints%
+ \midpoint%
+ \pgf@ya\pgf@y%
+ \pgf@process{\before@sw@anchor}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor}{\after@sw@anchor}%
+ \else%
+ \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}%
+ \fi%
+ \fi%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \getchamferedrectanglepoints%
+ \basepoint%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \before@sw@anchor%
+ \pgf@ya\pgf@y%
+ \before@ne@anchor%
+ \pgf@y\pgf@ya
+ }%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}%
+ \else%
+ \pgf@process{\before@ne@anchor}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor}%
+ {\after@ne@anchor}%
+ \fi%
+ \fi%
+ }%
+ \anchor{base west}{%
+ \getchamferedrectanglepoints%
+ \basepoint%
+ \pgf@ya\pgf@y%
+ \pgf@process{\before@sw@anchor}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor}{\after@sw@anchor}%
+ \else%
+ \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ \ifdim\pgf@ya<\pgf@y%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@sw@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}%
+ \fi%
+ \fi%
+ }%
+ \anchor{before north east}{\getchamferedrectanglepoints\before@ne@anchor}%
+ \anchor{north east}{\getchamferedrectanglepoints\ne@anchor}%
+ \anchor{after north east}{\getchamferedrectanglepoints\after@ne@anchor}%
+ \anchor{north}{%
+ \getchamferedrectanglepoints%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \after@ne@anchor%
+ \pgf@x\pgf@xa}%
+ \anchor{before north west}{%
+ \getchamferedrectanglepoints%
+ \after@sw@anchor%
+ \pgf@xa\pgf@x%
+ \after@ne@anchor%
+ \pgf@x\pgf@xa}%
+ \anchor{north west}{\getchamferedrectanglepoints\nw@anchor}%
+ \anchor{after north west}{%
+ \getchamferedrectanglepoints%
+ \before@sw@anchor%
+ \pgf@xa\pgf@x%
+ \before@ne@anchor%
+ \pgf@x\pgf@xa}%
+ \anchor{west}{%
+ \getchamferedrectanglepoints%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \before@sw@anchor%
+ \pgf@y\pgf@ya}%
+ \anchor{before south west}{\getchamferedrectanglepoints\before@sw@anchor}%
+ \anchor{south west}{\getchamferedrectanglepoints\sw@anchor}%
+ \anchor{after south west}{\getchamferedrectanglepoints\after@sw@anchor}%
+ \anchor{south}{%
+ \getchamferedrectanglepoints%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \after@sw@anchor%
+ \pgf@x\pgf@xa}%
+ \anchor{before south east}{%
+ \getchamferedrectanglepoints%
+ \after@sw@anchor%
+ \pgf@ya\pgf@y%
+ \after@ne@anchor%
+ \pgf@y\pgf@ya}%
+ \anchor{south east}{\getchamferedrectanglepoints\se@anchor}%
+ \anchor{after south east}{%
+ \getchamferedrectanglepoints%
+ \before@sw@anchor%
+ \pgf@ya\pgf@y%
+ \before@ne@anchor%
+ \pgf@y\pgf@ya}%
+ \anchor{east}{%
+ \getchamferedrectanglepoints%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \before@ne@anchor%
+ \pgf@y\pgf@ya}%
+ \backgroundpath{%
+ \pgfpathmoveto{\beforenortheast}%
+ \pgfpathlineto{\northeast}%
+ \pgfpathlineto{\afternortheast}%
+ \pgfpathlineto{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}%
+ \pgfpathlineto{\northwest}%
+ \pgfpathlineto{\beforesouthwest\pgf@xa\pgf@x\beforenortheast\pgf@x\pgf@xa}%
+ \pgfpathlineto{\beforesouthwest}%
+ \pgfpathlineto{\southwest}%
+ \pgfpathlineto{\aftersouthwest}%
+ \pgfpathlineto{\aftersouthwest\pgf@ya\pgf@y\afternortheast\pgf@y\pgf@ya}%
+ \pgfpathlineto{\southeast}%
+ \pgfpathlineto{\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \getchamferedrectanglepoints%
+ \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% west.
+ \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% north.
+ \pgfmathanglebetweenpoints{\centerpoint}{\ne@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% north east.
+ \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% before north east.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}{\before@ne@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@ne@anchor}{\ne@anchor}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% after north east.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\ne@anchor}{\after@ne@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\after@ne@anchor}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\nw@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% north west.
+ \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% before north west.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}%
+ {\nw@anchor}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% after north west.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\nw@anchor}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}%
+ {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% south.
+ \pgfmathanglebetweenpoints{\centerpoint}{\sw@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% south west.
+ \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% before south west.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}%
+ {\before@sw@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@sw@anchor}{\sw@anchor}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% after south west.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@sw@anchor}{\after@sw@anchor}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\after@sw@anchor}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\se@anchor}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% south east.
+ \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% before south east.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
+ {\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}{\se@anchor}
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax% after south east.
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\se@anchor}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}%
+ {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }%
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex
new file mode 100644
index 00000000000..15d7baf090c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex
@@ -0,0 +1,1354 @@
+% Copyright 2007 by Till Tantau and Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex,v 1.2 2010/01/07 01:12:23 vibrovski Exp $
+
+\newbox\pgfnodepartlowerbox
+
+%
+% A circle that is split in the middle into an upper and a lower part.
+%
+% This node consists of two parts: The upper (main) part is shown in
+% the upper half of the circle. The second part is the (optional)
+% lower part.
+%
+% Parts: text, lower
+
+\pgfdeclareshape{circle split}
+{
+ %
+ % Node parts
+ %
+ \nodeparts{text,lower}
+
+ %
+ % Anchors
+ %
+ \savedanchor\centerpoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y=-\pgf@y%
+ \advance\pgf@y by-\dp\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }%
+ \savedanchor\loweranchor{%
+ \pgf@x=-.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x by.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y=-2\pgf@y%
+ \advance\pgf@y by-\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ \advance\pgf@y by-\dp\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }
+
+ \saveddimen\radius{%
+ %
+ % Caculate ``height radius''
+ %
+ %\pgf@ya=.5\ht\pgfnodeparttextbox%
+% \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+% \advance\pgf@ya by.5\ht\pgfnodepartlowerbox%
+% \advance\pgf@ya by.5\dp\pgfnodepartlowerbox%
+% \advance\pgf@ya by.5\pgflinewidth%
+ %
+ % MW: Suggested correction for above calculation: Use the tallest box * 2.
+ %
+ \pgf@ya=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+ \pgf@yb=.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@yb by.5\dp\pgfnodepartlowerbox%
+ \ifdim\pgf@ya>\pgf@yb\relax%
+ \pgf@ya2.0\pgf@ya\relax%
+ \else%
+ \pgf@ya2.0\pgf@yb\relax%
+ \fi%
+ \advance\pgf@ya by.5\pgflinewidth%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya by2\pgf@yb%
+ %
+ % Caculate ``width radius''
+ %
+ \pgf@xa=.5\wd\pgfnodeparttextbox%
+ \ifdim\pgf@xa<.5\wd\pgfnodepartlowerbox%
+ \pgf@xa=.5\wd\pgfnodepartlowerbox%
+ \fi%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa by\pgf@xb%
+ %
+ % Calculate length of radius vector:
+ %
+ \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
+ \ifdim\pgf@x>\pgf@y%
+ \c@pgf@counta=\pgf@x%
+ \ifnum\c@pgf@counta=0\relax%
+ \else%
+ \divide\c@pgf@counta by 255\relax%
+ \pgf@xa=16\pgf@xa\relax%
+ \divide\pgf@xa by\c@pgf@counta%
+ \pgf@xa=16\pgf@xa\relax%
+ \fi%
+ \else%
+ \c@pgf@counta=\pgf@y%
+ \ifnum\c@pgf@counta=0\relax%
+ \else%
+ \divide\c@pgf@counta by 255\relax%
+ \pgf@ya=16\pgf@ya\relax%
+ \divide\pgf@ya by\c@pgf@counta%
+ \pgf@xa=16\pgf@ya\relax%
+ \fi%
+ \fi%
+ \pgf@x=\pgf@xa%
+ %
+ % If necessary, adjust radius so that the size requirements are
+ % met:
+ %
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xb%
+ \pgf@x=.5\pgf@xb%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@yb%
+ \pgf@x=.5\pgf@yb%
+ \fi%
+ %
+ % Now, add larger of outer sepearations.
+ %
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgf@x by\pgf@yb%
+ \else%
+ \advance\pgf@x by\pgf@xb%
+ \fi%
+ }
+
+ %
+ % Anchors
+ %
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \anchor{lower}{\loweranchor}
+
+ %
+ % Background path
+ %
+ \inheritbackgroundpath[from=circle]
+ \beforebackgroundpath{
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \advance\pgfutil@tempdima by-.5\pgflinewidth%
+ \pgfsetshortenstart{0pt}%
+ \pgfsetshortenend{0pt}%
+ \pgfsetarrows{-}%
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-1\pgfutil@tempdima}{0pt}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}%
+ \pgfusepath{stroke}%
+ }
+}
+
+
+%
+% A circle that is split diagonally into an upper and a lower part.
+%
+% Parts: text, lower
+
+\pgfdeclareshape{circle solidus}{%
+ % Node parts
+ \nodeparts{text,lower}%
+ % Anchors
+ % solidus slants at 45 degrees
+ % text placement minimizes the required radius,
+ % this is achieved placing the "outer" corner
+ % of each box in the line orthogonal to the
+ % solidus which passes through circle center
+ \savedanchor\centerpoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\dp\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodeparttextbox%
+ \pgf@y=-\pgf@x%
+ \advance\pgf@y by\ht\pgfnodeparttextbox%
+ \advance\pgf@x by0.3536\pgflinewidth%
+ \advance\pgf@y by-0.3536\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x by\pgf@xa%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y by-\pgf@ya%
+ }%
+ \savedanchor\loweranchor{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\dp\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodeparttextbox%
+ \pgf@y=-\pgf@x%
+ \advance\pgf@y by\ht\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@x by0.5\dp\pgfnodepartlowerbox%
+ \advance\pgf@x by-0.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@y by-0.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by0.5\dp\pgfnodepartlowerbox%
+ \advance\pgf@y by-0.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x by0.7071\pgflinewidth%
+ \advance\pgf@y by-0.7071\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x by2\pgf@xa%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y by-2\pgf@ya%
+ }%
+ \saveddimen\radius{%
+ % "top" radius
+ \pgf@x=\ht\pgfnodeparttextbox%
+ \advance\pgf@x by\dp\pgfnodeparttextbox%
+ \advance\pgf@x by\wd\pgfnodeparttextbox%
+ % "bottom" radius
+ \pgf@y=\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by\dp\pgfnodepartlowerbox%
+ \advance\pgf@y by\wd\pgfnodepartlowerbox%
+ % use the larger
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x=\pgf@y%
+ \fi%
+ \pgf@x=0.7071\pgf@x%
+ % add spacings
+ \advance\pgf@x by0.5\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgfmathaddtolength{\pgf@x}{veclen(2\pgf@xa,2\pgf@ya)}%
+ % If necessary, adjust radius so that the size requirements are
+ % met:
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x=.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@ya%
+ \pgf@x=.5\pgf@ya%
+ \fi%
+ % Now, add larger of outer separations.
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xa<\pgf@ya%
+ \advance\pgf@x by\pgf@ya%
+ \else%
+ \advance\pgf@x by\pgf@xa%
+ \fi%
+ }%
+ % Anchors
+ \inheritanchorborder[from=circle]%
+ \inheritanchor[from=circle]{north}%
+ \inheritanchor[from=circle]{north west}%
+ \inheritanchor[from=circle]{north east}%
+ \inheritanchor[from=circle]{center}%
+ \inheritanchor[from=circle]{west}%
+ \inheritanchor[from=circle]{east}%
+ \inheritanchor[from=circle]{mid}%
+ \inheritanchor[from=circle]{mid west}%
+ \inheritanchor[from=circle]{mid east}%
+ \inheritanchor[from=circle]{base}%
+ \inheritanchor[from=circle]{base west}%
+ \inheritanchor[from=circle]{base east}%
+ \inheritanchor[from=circle]{south}%
+ \inheritanchor[from=circle]{south west}%
+ \inheritanchor[from=circle]{south east}%
+ \anchor{lower}{\loweranchor}%
+ % Background path
+ \inheritbackgroundpath[from=circle]%
+ \beforebackgroundpath{%
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xa<\pgf@ya%
+ \advance\pgfutil@tempdima by-\pgf@ya%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xa%
+ \fi%
+ \advance\pgfutil@tempdima by-.5\pgflinewidth%
+ \pgfsetshortenstart{0pt}%
+ \pgfsetshortenend{0pt}%
+ \pgfsetarrows{-}%
+ % solidus slants at 45 degrees and its length is
+ % the golden section of the diameter
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-0.437\pgfutil@tempdima}{-0.437\pgfutil@tempdima}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{0.437\pgfutil@tempdima}{0.437\pgfutil@tempdima}}}%
+ \pgfusepath{stroke}%
+ }%
+}
+
+
+\def\pgf@lib@sh@newbox{\csname newbox\endcsname}% Get round outer.
+
+\def\pgf@lib@sh@toalpha#1{%
+ \ifcase#1\relax%
+ \or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten%
+ \or eleven\or twelve\or thirteen\or fourteen\or fifteen%
+ \or sixteen\or seventeen\or eighteen\or nineteen\or twenty%
+ \else%
+ twenty%
+ \fi%
+}
+
+
+\def\pgf@lib@sh@getalpha#1#2{\expandafter\edef\expandafter#1\expandafter{\pgf@lib@sh@toalpha{#2}}}
+
+\newbox\pgfnodeparttwobox
+\newbox\pgfnodepartthreebox
+\newbox\pgfnodepartfourbox
+
+\let\pgfnodepartonebox=\pgfnodeparttextbox
+\let\pgfnodepartsecondbox=\pgfnodeparttwobox
+\let\pgfnodepartthirdbox=\pgfnodepartthreebox
+\let\pgfnodepartfourthbox=\pgfnodepartfourbox
+
+\def\pgf@lib@sh@allocateboxes#1{%
+ \c@pgf@counta=#1\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>4\relax%
+ \pgfutil@ifundefined{pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box}%
+ {%
+ \expandafter\pgf@lib@sh@newbox\csname pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box\endcsname%
+ }%
+ {}%
+ \advance\c@pgf@counta by-1\relax%
+ \repeatpgfmathloop%
+}
+
+\def\pgf@lib@sh@rs@lefttext{left}
+\def\pgf@lib@sh@rs@righttext{right}
+\def\pgf@lib@sh@rs@centertext{center}
+\def\pgf@lib@sh@rs@bottomtext{bottom}
+\def\pgf@lib@sh@rs@toptext{top}
+\def\pgf@lib@sh@rs@basetext{base}
+\def\pgf@lib@sh@rs@nonetext{none}
+
+
+\newif\ifpgfrectanglesplithorizontal
+\newif\ifpgfrectanglesplitdrawsplits\pgfrectanglesplitdrawsplitstrue
+\newif\ifpgfrectanglesplitignoreemptyparts
+\newif\ifpgfrectanglesplitusecustomfill
+
+\let\pgf@lib@sh@rs@every@emptypart=\pgfutil@empty
+\let\pgf@lib@sh@rs@every@part=\pgfutil@empty
+\def\pgf@lib@sh@rs@list@fill{none}
+
+\pgfkeys{/pgf/.cd,
+ rectangle split parts/.initial=4,
+ rectangle split part align/.initial=center,
+ rectangle split horizontal/.is if=pgfrectanglesplithorizontal,
+ rectangle split ignore empty parts/.is if=pgfrectanglesplitignoreemptyparts,
+ rectangle split empty part width/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width\the\pgf@x height0ptdepth0pt\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part width=1ex,
+ rectangle split empty part height/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight\the\pgf@x depth0pt\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part height=1ex,
+ rectangle split empty part depth/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight0ptdepth\the\pgf@x\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part depth=0ex,
+ rectangle split every empty part/.store in=\pgf@lib@sh@rs@every@emptypart,
+ rectangle split part fill/.code=\def\pgf@lib@sh@rs@list@fill{#1}\pgfrectanglesplitusecustomfilltrue,
+ rectangle split uses custom fill/.is if=pgfrectanglesplitusecustomfill,
+ rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits,
+ rectangle split allocate boxes/.code=\pgf@lib@sh@allocateboxes{#1}
+}
+
+
+\def\pgf@lib@sh@rs@process@list#1#2{%
+ \c@pgf@counta=1\relax%
+ \c@pgf@countb=#2\relax%
+ \edef\pgf@lib@sh@rs@temp{#1}%
+ \expandafter\pgf@lib@sh@rs@@process@list\pgf@lib@sh@rs@temp,\pgf@stop,}
+
+\def\pgf@lib@sh@rs@@process@list{%
+ \pgfutil@ifnextchar x{\pgf@lib@sh@rs@@@process@list}%
+ {\pgf@lib@sh@rs@@@process@list}}
+
+\def\pgf@lib@sh@rs@@@process@list#1,{%
+ \ifx#1\pgf@stop%
+ \let\pgf@next\pgf@lib@sh@rs@@@@process@list%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\c@pgf@counta}%
+ \def\pgf@lib@sh@rs@lastalign{#1}%
+ \pgfutil@namedef{pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item}{#1}%
+ \let\pgf@next\pgf@lib@sh@rs@@process@list%
+ \advance\c@pgf@counta by1\relax%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@sh@rs@@@@process@list{%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>\c@pgf@countb%
+ \else%
+ \expandafter\edef\csname pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item\endcsname%
+ {\pgf@lib@sh@rs@lastalign}%
+ \advance\c@pgf@counta by1\relax%
+ \repeatpgfmathloop%
+}
+
+\pgf@lib@sh@allocateboxes{20}
+
+\pgfdeclareshape{rectangle split}{%
+ \savedmacro\rectanglesplitparameters{%
+ \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/rectangle split parts}}%
+ \edef\parts{\the\c@pgf@counta}%
+ \addtosavedmacro\parts%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \edef\innerxsep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \edef\innerysep{\the\pgf@y}%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \edef\outerxsep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\outerysep{\the\pgf@y}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ %
+ \pgf@x=0pt\relax% Widest box.
+ \pgf@y=0pt\relax% Tallest box.
+ %
+ \pgfutil@tempdima=0pt\relax% Maximum box height.
+ \pgfutil@tempdimb=0pt\relax% Maximum box depth.
+ %
+ % Get the dimensions of the boxes...
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\expandafter\pgf@lib@sh@box\expandafter=%
+ \csname pgfnodepart\pgf@lib@sh@rs@number box\endcsname%
+ \pgf@xa=\wd\pgf@lib@sh@box%
+ \pgf@ya=\ht\pgf@lib@sh@box%
+ \pgf@yb=\dp\pgf@lib@sh@box%
+ %
+ % Test to see if the box is empty...
+ %
+ \expandafter\def\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname{\relax}%
+ \ifdim\pgf@xa=0pt\relax%
+ \ifdim\pgf@ya=0pt\relax%
+ \ifdim\pgf@yb=0pt\relax%
+ %
+ % ...It is. So...
+ %
+ \ifpgfrectanglesplitignoreemptyparts%
+ %
+ % ...flag this if we are ignoring parts...
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \else%
+ %
+ % ...otherwise insert the code for every empty part.
+ %
+ \setbox\pgf@lib@sh@box=\hbox{{\pgf@lib@sh@rs@every@emptypart}}%
+ \pgf@xa=\wd\pgf@lib@sh@box%
+ \pgf@ya=\ht\pgf@lib@sh@box%
+ \pgf@yb=\dp\pgf@lib@sh@box%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\edef\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname{\the\pgf@xa}%
+ \expandafter\edef\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname{\the\pgf@ya}%
+ \expandafter\edef\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname{\the\pgf@yb}%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname%
+ %
+ % ...saving the widest box...
+ %
+ \ifdim\pgf@xa>\pgf@x%
+ \pgf@x=\pgf@xa%
+ \fi%
+ %
+ % ...the maximum height and depth...
+ %
+ \ifdim\pgf@ya>\pgfutil@tempdima%
+ \pgfutil@tempdima=\pgf@ya%
+ \fi%
+ \ifdim\pgf@yb>\pgfutil@tempdimb%
+ \pgfutil@tempdimb=\pgf@yb%
+ \fi%
+ %
+ % ...and the tallest box.
+ %
+ \pgf@yc=\pgfutil@tempdima%
+ \advance\pgf@yc by\pgfutil@tempdimb%
+ \ifdim\pgf@yc>\pgf@y%
+ \pgf@y=\pgf@yc%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}%
+ \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\innerxsep\relax%
+ \pgf@xa=\pgf@x%
+ \advance\pgf@xa by-\pgf@lib@sh@rs@max@width\relax%
+ \ifdim\pgf@xa>0pt\relax%
+ \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}%
+ \fi%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \pgf@ya=\pgf@y%
+ \advance\pgf@ya by-\pgf@lib@sh@rs@max@totalheight\relax%
+ \ifdim\pgf@ya>0pt\relax%
+ \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}%
+ \fi%
+ %
+ % Get the alignment of each node part box.
+ %
+ \pgf@lib@sh@rs@process@list{\pgfkeysvalueof{/pgf/rectangle split part align}}{\parts}%
+ %
+ % Are we splitting horizontally or vertically?
+ %
+ \ifpgfrectanglesplithorizontal%
+ %
+ % Calculate the origins of each node part box.
+ %
+ \pgf@x=0pt\relax%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \ifpgfrectanglesplitignoreemptyparts%
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=%
+ \pgf@lib@sh@rs@lastanchor%
+ \fi%
+ \fi%
+ %
+ % Adjust for alignment.
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@bottomtext%
+ \pgf@y=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@toptext%
+ \pgf@y=-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by\pgf@lib@sh@rs@max@totalheight\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@basetext%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\pgfutil@tempdima%
+ \advance\pgf@y by\pgfutil@tempdimb%
+ \divide\pgf@y by2\relax%
+ \else%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \divide\pgf@y by2\relax%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % Re-adjust as the first box is at the origin.
+ %
+ \ifnum\pgfmathcounter=1\relax%
+ \edef\pgf@lib@sh@rs@yoffset{\the\pgf@y}%
+ \pgf@y=0pt\relax%
+ \pgfextract@process\pgf@lib@sh@rs@anchor@one{}%
+ \addtosavedmacro\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \else
+ \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\pgflinewidth%
+ \advance\pgf@x by\innerxsep\relax%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Calculate some anchors.
+ %
+ \pgfextract@process\northeast{%
+ \pgf@lib@sh@rs@lastanchor%
+ \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@y by\innerysep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ }%
+ \addtosavedmacro\northeast%
+ \pgfextract@process\southwest{%
+ \pgf@lib@sh@rs@anchor@one%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \pgf@y=-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ }%
+ \addtosavedmacro\southwest%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfpointadd{\southwest}{\northeast}%
+ \divide\pgf@x by2\relax%
+ \divide\pgf@y by2\relax%
+ }%
+ \addtosavedmacro\centerpoint%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@xa=\pgf@x%
+ \pgf@xb=\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@xa by0.5\pgf@xb%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname{%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname{%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \advance\pgf@xa by0.5\pgf@xb%
+ \advance\pgf@xa by\innerxsep\relax%
+ \advance\pgf@xa by.5\pgflinewidth%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname{%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname{%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{%
+ \centerpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \else%
+ %
+ % Calculate the origins of each node part box.
+ %
+ \pgf@y=0pt\relax%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \ifpgfrectanglesplitignoreemptyparts%
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=%
+ \pgf@lib@sh@rs@lastanchor%
+ \fi%
+ \fi%
+ %
+ % Adjust for alignment.
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@lefttext%
+ \pgf@x=0pt\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@righttext%
+ \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax%
+ \else%
+ \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax%
+ \divide\pgf@x by2\relax%
+ \fi%
+ \fi%
+ %
+ % Re-adjust as the first box is at the origin.
+ %
+ \ifnum\pgfmathcounter=1\relax%
+ \edef\pgf@lib@sh@rs@xoffset{\the\pgf@x}%
+ \pgf@x=0pt\relax%
+ \pgfextract@process\pgf@lib@sh@rs@anchor@one{}%
+ \addtosavedmacro\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \else
+ \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\pgflinewidth%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Calculate some anchors.
+ %
+ \pgfextract@process\northeast{%
+ \pgf@x=\pgf@lib@sh@rs@max@width\relax%
+ \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \pgf@y=\pgf@lib@sh@rs@height@one\relax%
+ \advance\pgf@y by\innerysep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ \advance\pgf@y by.5\pgflinewidth%
+ }%
+ \addtosavedmacro\northeast%
+ \pgfextract@process\southwest{%
+ \pgf@lib@sh@rs@lastanchor%
+ \pgf@x=-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }%
+ \addtosavedmacro\southwest%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfpointadd{\southwest}{\northeast}%
+ \divide\pgf@x by2\relax%
+ \divide\pgf@y by2\relax%
+ }%
+ \addtosavedmacro\centerpoint%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@ya=\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by0.5\pgf@ya%
+ \pgf@ya=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by-0.5\pgf@ya%
+ \pgf@ya=\pgf@y%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname{%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname{%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@ya=\pgf@y%
+ \advance\pgf@ya by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@ya by-\innerysep\relax%
+ \advance\pgf@ya by-.5\pgflinewidth%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname{%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname{%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{%
+ \centerpoint%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \pgf@y=0pt\relax%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \anchor{center}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ }%
+ \anchor{base}{\basepoint}
+ \anchor{base east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@y=0pt\relax%
+ }%
+ \anchor{base west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@y=0pt\relax%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@xa=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \anchor{mid west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@xa=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \anchor{north}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa=\pgf@x%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }
+ \anchor{south}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa=\pgf@x%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }
+ \anchor{east}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya=\pgf@y%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{west}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya=\pgf@y%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{north east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ }
+ \anchor{north west}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@ya=\pgf@y%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{south west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ }
+ \anchor{south east}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@ya=\pgf@y%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }
+ \behindbackgroundpath{%
+ \ifpgfrectanglesplitusecustomfill%
+ \pgf@lib@sh@rs@process@list{\pgf@lib@sh@rs@list@fill}{\parts}%
+ {%
+ \ifpgfrectanglesplithorizontal%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@south west\endcsname%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@north east\endcsname%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split north\endcsname%
+ \fi%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext%
+ \else%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \advance\pgf@y by\outerysep\relax%
+ \ifnum\pgfmathcounter=1\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \fi%
+ }%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \advance\pgf@y by-\outerysep\relax%
+ \ifnum\pgfmathcounter=\parts\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \fi%
+ }%
+ \ifnum\pgfmathcounter>1\relax%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathmoveto{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@bottomleft}%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@x=\pgf@xa%
+ }%
+ \ifnum\pgfmathcounter>1\relax%
+ \endgroup%
+ \fi%
+ \ifnum\pgfmathcounter<\parts%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}%
+ \pgfpathclose%
+ \ifnum\pgfmathcounter<\parts%
+ \endgroup%
+ \fi%
+ \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}%
+ \pgfusepath{fill}%
+ \fi%
+ \fi%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@ya=\pgf@y%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by-\outerysep%
+ }%
+ \repeatpgfmathloop%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@north east\endcsname%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@south west\endcsname%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split west\endcsname%
+ \fi%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext%
+ \else%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \advance\pgf@x by\outerxsep\relax%
+ \ifnum\parts=1\relax%
+ \advance\pgf@y by\outerysep\relax%
+ \else%
+ \ifnum\pgfmathcounter=\parts
+ \advance\pgf@y by\outerysep\relax%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \advance\pgf@x by-\outerxsep\relax%
+ \ifnum\parts=1\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \else%
+ \ifnum\pgfmathcounter=1\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \fi%
+ \fi%
+ }%
+ \pgfpathmoveto{\pgf@lib@sh@rs@fill@bottomleft}%
+ \ifnum\pgfmathcounter>1\relax%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}%
+ \ifnum\pgfmathcounter>1\relax%
+ \endgroup%%
+ \fi%
+ \ifnum\pgfmathcounter<\parts%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathclose%
+ \ifnum\pgfmathcounter<\parts%
+ \endgroup%
+ \fi%
+ \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}%
+ \pgfusepath{fill}%
+ \fi%
+ \fi%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by\outerxsep\relax%
+ }%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \fi%
+ }%
+ \backgroundpath{%
+ \begingroup%
+ \pgfextract@process\southwest{%
+ \southwest%
+ \advance\pgf@x by\outerxsep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ }%
+ \pgfextract@process\northeast{%
+ \northeast%
+ \advance\pgf@x by-\outerxsep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ }%
+ \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}%
+ \endgroup%
+ \ifpgfrectanglesplitdrawsplits%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \pgfpathmoveto{%
+ \ifpgfrectanglesplithorizontal%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname%
+ \advance\pgf@y by-\outerysep\relax%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname%
+ \advance\pgf@x by-\outerxsep\relax%
+ \fi%
+ }%
+ \pgfpathlineto{%
+ \ifpgfrectanglesplithorizontal%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname%
+ \advance\pgf@y by\outerysep\relax%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname%
+ \advance\pgf@x by\outerxsep\relax%
+ \fi%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \anchorborder{%
+ \pgfutil@tempdima\pgf@x%
+ \pgfutil@tempdimb\pgf@y%
+ \rectanglesplitparameters%
+ \pgfpointdiff{\southwest}{\northeast}%
+ \pgf@x.5\pgf@x%
+ \pgf@y.5\pgf@y%
+ \edef\pgf@marshall{%
+ \noexpand\pgfpointborderrectangle{%
+ \noexpand\pgfqpoint{\the\pgfutil@tempdima}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}%
+ }%
+ }%
+ \pgf@marshall%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Hackery to install the correct number of node parts.
+ %
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@rectangle split\endcsname{%
+ \let\pgf@lib@sh@rs@temp=\pgfutil@empty%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\edef\csname pgf@sh@boxes@rectangle split\endcsname%
+ {\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter}}%
+ \else%
+ \edef\pgf@lib@sh@rs@temp{\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter},}%
+ \repeatpgfmathloop%
+ }%
+}
+
+\pgfutil@for\pgf@lib@sh@rs@temp:={one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty}\do{%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp}{\noexpand\pgf@lib@sh@rs@anchor@one}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split}%
+ {\noexpand\centerpoint}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split north\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north}%
+ {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split south\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south}%
+ {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space north\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north}%
+ {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space south\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south}%
+ {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split east\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east}%
+ {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split west\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west}%
+ {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space east\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east}%
+ {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space west\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west}%
+ {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west\noexpand\endcsname}%
+ }%
+}%
+
+
+\pgfutil@namelet{pgf@anchor@rectangle split@text east}{pgf@anchor@rectangle split@one east}
+\pgfutil@namelet{pgf@anchor@rectangle split@text west}{pgf@anchor@rectangle split@one west}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split}{pgf@anchor@rectangle split@one split}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split east}{pgf@anchor@rectangle split@one split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split west}{pgf@anchor@rectangle split@one split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@second}{pgf@anchor@rectangle split@two}
+\pgfutil@namelet{pgf@anchor@rectangle split@second east}{pgf@anchor@rectangle split@two east}
+\pgfutil@namelet{pgf@anchor@rectangle split@second west}{pgf@anchor@rectangle split@two west}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split}{pgf@anchor@rectangle split@two split}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split east}{pgf@anchor@rectangle split@two split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split west}{pgf@anchor@rectangle split@two split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@third}{pgf@anchor@rectangle split@three}
+\pgfutil@namelet{pgf@anchor@rectangle split@third east}{pgf@anchor@rectangle split@three east}
+\pgfutil@namelet{pgf@anchor@rectangle split@third west}{pgf@anchor@rectangle split@three west}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split}{pgf@anchor@rectangle split@three split}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split east}{pgf@anchor@rectangle split@three split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split west}{pgf@anchor@rectangle split@three split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth}{pgf@anchor@rectangle split@four}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth east}{pgf@anchor@rectangle split@four east}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth west}{pgf@anchor@rectangle split@four west}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split}{pgf@anchor@rectangle split@four split}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split east}{pgf@anchor@rectangle split@four split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split west}{pgf@anchor@rectangle split@four split west}
+
+
+
+
+% Shape: ellipse split.
+%
+\pgfdeclareshape{ellipse split}{%
+ \nodeparts{text,lower}
+ \savedanchor\radii{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y2.0\pgf@y%
+ \advance\pgf@y.5\pgflinewidth%
+ \pgf@xa.5\wd\pgfnodeparttextbox%
+ \pgf@xb.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@xb\pgf@x%
+ \pgf@ya\ht\pgfnodeparttextbox%
+ \advance\pgf@ya\dp\pgfnodeparttextbox%
+ \pgf@yb\ht\pgfnodepartlowerbox%
+ \advance\pgf@yb\dp\pgfnodepartlowerbox%
+ \advance\pgf@ya\pgf@y%
+ \advance\pgf@yb\pgf@y%
+ \ifdim\pgf@xa>\pgf@xb%
+ \pgf@x1.414213\pgf@xa%
+ \else%
+ \pgf@x1.414213\pgf@xb%
+ \fi%
+ \ifdim\pgf@ya>\pgf@yb%
+ \pgf@y1.414213\pgf@ya%
+ \else%
+ \pgf@y1.414213\pgf@yb%
+ \fi%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }
+ \savedanchor\lower{%
+ \pgf@x-.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y-2.0\pgf@y%
+ \advance\pgf@y-\pgflinewidth%
+ \advance\pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-\ht\pgfnodepartlowerbox%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-.5\pgflinewidth%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{.5ex}%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{lower}{\lower}
+ \anchor{mid}{\midpoint}
+ \anchor{mid east}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x\pgf@xa}
+ \anchor{mid west}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x-\pgf@xa}
+ \anchor{base}{\basepoint}
+ \anchor{base east}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x\pgf@xa}
+ \anchor{base west}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x-\pgf@xa}
+ \anchor{north}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt}}%
+ \anchor{south}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt\pgf@y-\pgf@y}}%
+ \anchor{east}{\pgfpointadd{\centerpoint}{\radii\pgf@y0pt}}%
+ \anchor{west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-\pgf@x\pgf@y0pt}}%
+ \anchor{north west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
+ \anchor{south west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
+ \anchor{north east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
+ \anchor{south east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
+ \backgroundpath{%
+ \radii%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfutil@tempdima\pgf@x%
+ \pgfutil@tempdimb\pgf@y%
+ \pgfpathellipse{\centerpoint}{\pgfqpoint{\the\pgfutil@tempdima}{0pt}}{\pgfqpoint{0pt}{\the\pgfutil@tempdimb}}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x-\pgfutil@tempdima}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x\pgfutil@tempdima}%
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \radii%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
+ {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\centerpoint}%
+ }%
+ \pgf@marshal%
+ }%
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex
new file mode 100644
index 00000000000..b419a8cb624
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex
@@ -0,0 +1,2571 @@
+% Copyright 2007 by Till Tantau and Mark Wibrow
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex,v 1.3 2009/10/27 23:03:12 tantau Exp $
+
+\pgfdeclareshape{forbidden sign}
+{
+ \inheritsavedanchors[from=circle] % this is nearly a circle
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritbackgroundpath[from=circle]
+ \foregroundpath{
+ \centerpoint%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{-0.707107\pgfutil@tempdima}{-0.707107\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0.707107\pgfutil@tempdima}{0.707107\pgfutil@tempdima}}}
+ }
+}
+
+
+
+
+
+% Keys for starburst shape
+%
+% /pgf/starburst point height : The maximum height of the outer points.
+% /pgf/starburst points : The number of points.
+% /pgf/random starburst : The seed for the random number generator.
+%
+\pgfkeys{/pgf/random starburst/%
+ .code={%
+ \ifx\pgfkeysnovalue#1%
+ \pgfmathgeneratepseudorandomnumber%
+ \else%
+ \pgfmathtruncatemacro\pgfmathresult{#1}%
+ \fi%
+ \pgfkeyslet{/pgf/random starburst}{\pgfmathresult}%
+ }%
+}
+\pgfkeys{/pgf/random starburst=100}
+
+\pgfkeys{/pgf/starburst point height/.value required}
+\pgfkeys{/pgf/starburst point height/.code={%
+ \pgfmathparse{#1}%
+ \edef\pgfmathresult{\pgfmathresult pt}%
+ \pgfkeyslet{/pgf/starburst point height}{\pgfmathresult}%
+ }%
+}%
+\pgfkeys{/pgf/starburst point height=.5cm}
+
+\pgfkeys{/pgf/starburst points/.value required}
+\pgfkeys{/pgf/starburst points/.code={%
+ \pgfmathtruncatemacro\pgfmathresult{#1}%
+ \pgfkeyslet{/pgf/starburst points}{\pgfmathresult}%
+ }%
+}%
+\pgfkeys{/pgf/starburst points=17}
+
+\pgfdeclareshape{starburst}{%
+ \savedmacro\anglestep{%
+ \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}%
+ \let\anglestep\pgfmathresult%
+ }
+ \savedmacro\calculatestarburstpoints{%
+ %
+ % Get the angle step.
+ %
+ \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}%
+ \let\anglestep\pgfmathresult%
+ %
+ % Get the total number of points.
+ %
+ \pgfmathsetcounter{pgf@counta}{\pgfkeysvalueof{/pgf/starburst points}}%
+ \multiply\c@pgf@counta2\relax%
+ \edef\totalpoints{\the\c@pgf@counta}%
+ \addtosavedmacro{\totalpoints}%
+ %
+ % Calculate the centerpoint.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}%
+ }%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ %
+ % Get the node dimensions.
+ %
+ \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathaddtolength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgfmathaddtolength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgfmathaddtolength\pgf@y{+.5\dp\pgfnodeparttextbox}%
+ %
+ % Calculate the inner radii.
+ %
+ \ifpgfshapeborderusesincircle%
+ \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}%
+ %
+ % Use the incircle...
+ %
+ \ifdim\pgf@y>\pgf@x%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgf@x1.41421\pgf@x%
+ \pgf@y\pgf@x%
+ \else%
+ %
+ % Get the rotation (with rounding).
+ %
+ \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}%
+ \pgfmathmod@{\rotate}{360}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@%
+ \advance\c@pgf@counta45\relax%
+ \divide\c@pgf@counta90\relax%
+ \multiply\c@pgf@counta90\relax%
+ \ifnum\c@pgf@counta<0\relax%
+ \advance\c@pgf@counta360\relax%
+ \fi%
+ %
+ % Calculate the width and height of the node
+ % contents, according to any border rotation.
+ %
+ \ifnum\c@pgf@counta=90\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \else%
+ \ifnum\c@pgf@counta=270\relax%
+ \pgf@xc\pgf@x%
+ \pgf@x\pgf@y%
+ \pgf@y\pgf@xc%
+ \fi%
+ \fi%
+ \edef\rotate{\the\c@pgf@counta}%
+ %
+ % ...or not.
+ %
+ \pgf@x=1.41421\pgf@x%
+ \pgf@y=1.41421\pgf@y%
+ \fi%
+ \addtosavedmacro{\rotate}%
+ %
+ % Adjust innerradius for minimum width and height.
+ %
+ \pgf@xa\pgf@x%
+ \pgfmathsetlength\pgf@xb{+\pgfkeysvalueof{/pgf/starburst point height}}%
+ \advance\pgf@xa\pgf@xb%
+ \pgfmathsetlength\pgf@xc{+\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@xa<.5\pgf@xc%
+ \pgf@x.5\pgf@xc%
+ \advance\pgf@x-\pgf@xb%
+ \fi%
+ \pgf@ya\pgf@y%
+ \pgfmathsetlength\pgf@yb{+\pgfkeysvalueof{/pgf/starburst point height}}%
+ \advance\pgf@ya\pgf@yb%
+ \pgfmathsetlength\pgf@yc{+\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@ya<.5\pgf@yc%
+ \pgf@y.5\pgf@yc%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ \edef\xinnerradius{\the\pgf@x}%
+ \edef\yinnerradius{\the\pgf@y}%
+ \addtosavedmacro{\xinnerradius}%
+ \addtosavedmacro{\yinnerradius}%
+ %
+ % Calculate a radius outside the starburst.
+ %
+ \ifdim\pgf@y>\pgf@x%
+ \pgf@x\pgf@y%
+ \fi%
+ \pgfmathaddtolength\pgf@x{+\pgfkeysvalueof{/pgf/starburst point height}}%
+ \edef\externalradius{\the\pgf@x}%
+ \addtosavedmacro{\externalradius}%
+ %
+ % Set the seed for the random number generator.
+ %
+ \pgfmathsetseed{\pgfkeysvalueof{/pgf/random starburst}}%
+ %
+ % Now create the points on the shape and also
+ % the miter length and angle for each point.
+ %
+ \def\angle{90}% Start at the top.
+ %
+ % At point a, the miter length and angle are calculated for point b = a - 1.
+ %
+ \c@pgf@counta1\relax%
+ \c@pgf@countb0\relax%
+ %
+ % As 3 consecutive points are required to be defined for miter
+ % calculations, it is necessary to go over the first two points
+ % again.
+ %
+ \c@pgf@countc\totalpoints\relax%
+ \advance\c@pgf@countc2\relax%
+ \edef\looppoints{\the\c@pgf@countc}%
+ \let\secondpoint\pgfutil@empty%
+ \let\thirdpoint\pgfutil@empty%
+ \pgfmathloop%
+ %
+ % Cycle the point definitions.
+ %
+ \let\firstpoint\secondpoint%
+ \let\secondpoint\thirdpoint%
+ \ifnum\pgfmathcounter>\looppoints%
+ \else%
+ \ifnum\pgfmathcounter>\totalpoints%
+ \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname%
+ \else%
+ \ifodd\pgfmathcounter%
+ %
+ % An outer point.
+ %
+ \ifnum\pgfkeysvalueof{/pgf/random starburst}=0\relax%
+ \pgf@xa\pgfkeysvalueof{/pgf/starburst point height}\relax%
+ \else%
+ \pgf@x\pgfkeysvalueof{/pgf/starburst point height}\relax%
+ \pgf@xa.75\pgf@x%
+ \pgf@xb.25\pgf@x%
+ \pgfmathrnd%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \advance\pgf@xa\pgf@xb%
+ \fi%
+ \pgf@x\xinnerradius\relax%
+ \advance\pgf@x\pgf@xa%
+ \pgf@y\yinnerradius\relax%
+ \advance\pgf@y\pgf@xa%
+ \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{%
+ \pgfpointpolar{\angle}{\the\pgf@x and \the\pgf@y}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \else%
+ %
+ % An inner point.
+ %
+ \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{%
+ \pgfpointpolar{\angle}{\xinnerradius and \yinnerradius}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \fi%
+ %
+ % Add the points to the saved macro.
+ %
+ \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname%
+ \expandafter\addtosavedmacro\expandafter{\csname point@\the\c@pgf@counta @\endcsname}%
+ \fi%
+ %
+ % It is only possible to do the miter calculations if three points are defined.
+ %
+ \ifx\firstpoint\pgfutil@empty%
+ \else%
+ %
+ % Calculate the miter length...
+ %
+ \pgfmathanglebetweenlines{\secondpoint}{\thirdpoint}{\secondpoint}{\firstpoint}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\defaultmiterangle\pgfmathresult%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \edef\miterlength{\the\pgf@x}%
+ %
+ % ...the miter angle...
+ %
+ \pgfmathanglebetweenlines{\firstpoint}{\secondpoint}{\firstpoint}{\thirdpoint}%
+ \pgfmathadd@{\pgfmathresult}{\defaultmiterangle}%
+ \pgfmathsubtract@{180}{\pgfmathresult}%
+ \let\angletemp\pgfmathresult%
+ \pgfmathanglebetweenpoints{\firstpoint}{\thirdpoint}%
+ \pgfmathsubtract@{180}{\pgfmathresult}%
+ \pgfmathsubtract@{\angletemp}{\pgfmathresult}%
+ \edef\miterangle{\pgfmathresult}%
+ %
+ % ...and thus the border point.
+ %
+ \pgfextract@process\borderpoint{%
+ \secondpoint%
+ \pgf@xa\pgf@x
+ \pgf@ya\pgf@y%
+ \pgfpointpolar{\miterangle}{\miterlength}%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Get the angle from the centerpoint to the *unrotated* border points.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\borderpoint}%
+ \expandafter\edef\csname angletoborderpoint@\the\c@pgf@countb @\endcsname{\pgfmathresult}%
+ \expandafter\addtosavedmacro\expandafter{\csname angletoborderpoint@\the\c@pgf@countb @\endcsname}%
+ %
+ % Rotatee the border points and save.
+ %
+ \expandafter\pgfextract@process\csname borderpoint@\the\c@pgf@countb @\endcsname{%
+ \pgfmathrotatepointaround{\borderpoint}{\centerpoint}{\rotate}%
+ }%
+ \expandafter\addtosavedmacro\expandafter{\csname borderpoint@\the\c@pgf@countb @\endcsname}%
+ %
+ % Now create the anchors.
+ %
+ \c@pgf@countc\c@pgf@countb%
+ \advance\c@pgf@countc1\relax%
+ \divide\c@pgf@countc2\relax%
+ \ifodd\c@pgf@countb\relax%
+ \pgfutil@ifundefined{pgf@anchor@starburst@outer point\space\the\c@pgf@countc}{%
+ \expandafter\xdef\csname pgf@anchor@starburst@outer point\space\the\c@pgf@countc\endcsname{%
+ \noexpand\calculatestarburstpoints%
+ \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname%
+ }%
+ }{}%
+ \else%
+ \pgfutil@ifundefined{pgf@anchor@starburst@inner point\space\the\c@pgf@countc}{%
+ \expandafter\xdef\csname pgf@anchor@starburst@inner point\space\the\c@pgf@countc\endcsname{%
+ \noexpand\calculatestarburstpoints%
+ \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname%
+ }%
+ }{}%
+ \fi%
+ \fi%
+ \pgfmathadd@{\angle}{\anglestep}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \let\angle\pgfmathresult%
+ \advance\c@pgf@counta1\relax%
+ \ifnum\c@pgf@counta>\totalpoints%
+ \c@pgf@counta1\relax%
+ \fi%
+ \advance\c@pgf@countb1\relax%
+ \ifnum\c@pgf@countb>\totalpoints%
+ \c@pgf@countb1\relax%
+ \fi%
+ \repeatpgfmathloop%
+ }
+ \savedanchor\centerpoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}%
+ }%
+ \savedanchor\midpoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \savedanchor\basepoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgf@y0pt\relax%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{base}{\basepoint}
+ \anchor{mid}{\midpoint}
+ \anchor{north}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{\externalradius}}%
+ }
+ \anchor{south}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}%
+ }
+ \anchor{east}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{0pt}}%
+ }
+ \anchor{west}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}%
+ }
+ \anchor{north west}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}%
+ }
+ \anchor{south west}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}%
+ }
+ \anchor{north east}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}%
+ }
+ \anchor{south east}{%
+ \calculatestarburstpoints%
+ \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}%
+ }
+ \backgroundpath{%
+ \calculatestarburstpoints%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\totalpoints%
+ \else%
+ \ifnum\pgfmathcounter=1\relax%
+ \let\starburstaction\pgfpathmoveto%
+ \else%
+ \let\starburstaction\pgfpathlineto%
+ \fi%
+ \starburstaction{%
+ %\pgfmathrotatepointaround{\csname point@\pgfmathcounter @\endcsname}{\centerpoint}{\rotate}}%
+ \csname point@\pgfmathcounter @\endcsname}
+ \repeatpgfmathloop%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Adjust the location of the external
+ % point relative to \centerpoint.
+ %
+ \centerpoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Get the starburst points.
+ %
+ \calculatestarburstpoints%
+ %
+ % Get the angle of the external point to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ \pgfmathsubtract@{\pgfmathresult}{\rotate}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\externalangle\pgfmathresult%
+ %
+ % Locate the appropriate sides on the starburst border...
+ %
+ \ifdim\externalangle pt<90pt\relax%
+ \c@pgf@counta0\relax%
+ \c@pgf@countb\totalpoints\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \else%
+ \ifdim\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt>90pt\relax%
+ \c@pgf@counta\c@pgf@countb%
+ \else%
+ \ifdim\externalangle pt>\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt\relax%
+ \c@pgf@counta\c@pgf@countb%
+ \fi%
+ \fi%
+ \advance\c@pgf@countb-1\relax%
+ \repeatpgfmathloop%
+ \edef\first{\the\c@pgf@counta}%
+ \advance\c@pgf@counta1\relax%
+ \ifnum\c@pgf@counta>\totalpoints\relax%
+ \c@pgf@counta1\relax%
+ \fi%
+ \edef\second{\the\c@pgf@counta}%
+ \else%
+ \c@pgf@counta0\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \else%
+ \ifdim\csname angletoborderpoint@\pgfmathcounter @\endcsname pt<90pt\relax%
+ \c@pgf@counta\pgfmathcounter%
+ \else%
+ \ifdim\externalangle pt<\csname angletoborderpoint@\pgfmathcounter @\endcsname pt\relax%
+ \c@pgf@counta\pgfmathcounter%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \edef\first{\the\c@pgf@counta}%
+ \advance\c@pgf@counta-1\relax%
+ \ifnum\c@pgf@counta=0\relax%
+ \c@pgf@counta\totalpoints\relax%
+ \fi%
+ \edef\second{\the\c@pgf@counta}%
+ \fi%
+ %
+ % ...and thus, the point on the star border.
+ %
+ \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\csname borderpoint@\first @\endcsname}{\csname borderpoint@\second @\endcsname}%
+ }%
+}
+
+
+
+
+% Keys for shape cloud.
+%
+% /pgf/cloud puffs : the number of cloud puffs.
+% /pgf/cloud puff arc : the length of the cloud puff arc.
+
+\newif\ifpgfcloudanchorsuseellipse%
+\newif\ifpgfcloudignoresaspect%
+\pgfcloudignoresaspectfalse%
+\pgfkeys{/pgf/.cd,
+ cloud puffs/.initial=10,
+ cloud puff arc/.initial=150,
+ cloud ignores aspect/.is if=pgfcloudignoresaspect,
+ cloud anchors use ellipse/.is if=pgfcloudanchorsuseellipse
+}%
+
+
+% If symbol library is loaded separately these need to be defined.
+%
+\pgfkeys{/pgf/.cd,
+ aspect/.code={\pgfsetshapeaspect{#1}},% this for tikz...
+ shape aspect/.initial=1,% but this is consistent with other pgfset stuff.
+ shape aspect/.code={%
+ \pgfkeys{/pgf/aspect=#1}%
+ \pgfkeyssetvalue{/pgf/shape aspect}{#1}
+ }%
+}
+
+\def\pgfsetshapeaspect#1{%
+ \def\pgfshapeaspect{#1}%
+ % Invert
+ \pgfutil@tempdima=#1pt%
+ \pgfutil@tempdima=.125\pgfutil@tempdima%
+ \c@pgf@counta=\pgfutil@tempdima\relax% 8192*determinant
+ \pgfutil@tempdima=8192pt%
+ \divide\pgfutil@tempdima by\c@pgf@counta%
+ \edef\pgfshapeaspectinverse{\pgf@sys@tonumber{\pgfutil@tempdima}}
+}
+
+\pgfsetshapeaspect{1}
+%
+
+% Shape cloud.
+%
+\pgfdeclareshape{cloud}{%
+ \savedmacro\getradii{%
+ \pgfmathtruncatemacro\puffs{\pgfkeysvalueof{/pgf/cloud puffs}}%
+ \addtosavedmacro\puffs%
+ \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/cloud puffs}}%
+ \let\anglestep\pgfmathresult%
+ \addtosavedmacro\anglestep%
+ \pgfmathsetmacro\arc{\pgfkeysvalueof{/pgf/cloud puff arc}}%
+ \addtosavedmacro\arc%
+ %
+ % x radius.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@x1.4142135\pgf@x%
+ %
+ % y radius.
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ \pgf@y1.4142135\pgf@y%
+ %
+ % Adjust for shape aspect.
+ %
+ \ifpgfcloudignoresaspect%
+ \pgf@xc\pgf@x%
+ \pgf@yc\pgf@y%
+ \else%
+ \pgf@xc\pgfshapeaspect\pgf@y%
+ \ifdim\pgf@xc<\pgf@x%
+ \pgf@xc\pgf@x%
+ \fi%
+ \pgf@yc\pgfshapeaspectinverse\pgf@xc%
+ \ifdim\pgf@yc<\pgf@y%
+ \pgf@yc\pgf@y%
+ \pgf@xc\pgfshapeaspect\pgf@y%
+ \fi%
+ \fi%
+ %
+ \edef\xinnerradius{\the\pgf@xc}%
+ \edef\yinnerradius{\the\pgf@yc}%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x\pgf@y%
+ \fi%
+ \edef\outersep{\the\pgf@x}%
+ \addtosavedmacro\outersep%
+ %
+ % For a given cloud, with puff arc length a, the quotient of the
+ % distance between the start and end point of a puffs circular arc
+ % and the radius of that arc, is constant:
+ %
+ % g = .5 * sec((180-a)/2)
+ %
+ \pgfmathsubtract{180}{\arc}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\tempangle\pgfmathresult%
+ \pgfmathsec@{\pgfmathresult}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\arcradiusquotient\pgfmathresult%
+ \addtosavedmacro\arcradiusquotient%
+ %
+ % In addition, the quotient of the distance between the start and
+ % end point of a puffs circular arc and the height of that arc
+ % (ignoring rotation), is also constant:
+ %
+ % h = .5 * (1-sin((180-a)/2))/cos((180-a)/2)
+ % = g * (1 - sin((180-a)/2))
+ \pgfmathsin@{\tempangle}%
+ \pgfmathsubtract@{1}{\pgfmathresult}%
+ \pgfmathmultiply@{\pgfmathresult}{\arcradiusquotient}%
+ \let\archeightquotient\pgfmathresult%
+ \addtosavedmacro\archeightquotient%
+ %
+ % Minimum size is applied to the circum-ellipse (i.e. the ellipse
+ % that passes through the extremeties of each puff). Thus, the
+ % relationship between the radii of the elliptical incircle ("inellipse"?)
+ % of the cloud (x and y) and the radii of the circum-ellispe (X and Y),
+ % is given by
+ %
+ % X = 2(x*cos(p/2) + ky)
+ % Y = 2(y*cos(p/2) + kx)
+ %
+ % where:
+ % k = sin(p/2)*((1-cos(a/2))/sin(a/2))
+ % p = the angle between each puff (i.e. 360/<puffs>)
+ % a = the length of arc of the puff.
+ %
+ \pgfmathdivide{\arc}{2}%
+ \let\halfarcangle\pgfmathresult%
+ \pgfmathcos@{\pgfmathresult}%
+ \pgfmathsubtract@{1}{\pgfmathresult}%
+ \let\pgf@temp\pgfmathresult%
+ \pgfmathsin@{\halfarcangle}%
+ \pgfmathdivide@{\pgf@temp}{\pgfmathresult}%
+ \let\pgf@temp\pgfmathresult%
+ \pgfmathdivide@{\anglestep}{2}%
+ \pgfmathsin@{\pgfmathresult}%
+ \pgfmathmultiply@{\pgfmathresult}{\pgf@temp}%
+ \let\k\pgfmathresult%
+ %
+ \pgfmathdivide@{\anglestep}{2}%
+ \pgfmathcos@{\pgfmathresult}%
+ \let\coshalfanglestep\pgfmathresult%
+ %
+ % Calculate the actual radii of the circum-ellipse.
+ %
+ \pgf@x\xinnerradius\relax%
+ \pgf@y\yinnerradius\relax%
+ \pgf@xa\coshalfanglestep\pgf@x%
+ \advance\pgf@xa\k\pgf@y%
+ \pgf@ya\coshalfanglestep\pgf@y%
+ \advance\pgf@ya\k\pgf@x%
+ %
+ % Adjust for minimum height (Y').
+ %
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@ya<.5\pgf@yb%
+ \pgf@ya.5\pgf@yb%
+ \fi%
+ %
+ % Adjust for minimum width (X').
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgf@xa<.5\pgf@xb%
+ \pgf@xa.5\pgf@xb%
+ \fi%
+ %
+ \edef\xouterradius{\the\pgf@xa}%
+ \addtosavedmacro\xouterradius%
+ \edef\youterradius{\the\pgf@ya}%
+ \addtosavedmacro\youterradius%
+ %
+ % Now recalculate `in-ellispe' radii:
+ %
+ % x = (X'cos(p/2)-kY')/cos^2(p/2)-k^2,
+ % y = (Y'cos(p/2)-kX')/cos^2(p/2)-k^2,
+ %
+ \pgf@xc\k pt\relax%
+ \pgf@xc-\k\pgf@xc%
+ \pgf@yc\coshalfanglestep pt\relax%
+ \pgf@yc\coshalfanglestep\pgf@yc%
+ \advance\pgf@xc\pgf@yc\relax%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@xc}}% cos^2(p/2)-k^2
+ %
+ \pgf@x\coshalfanglestep\pgf@xa%
+ \advance\pgf@x-\k\pgf@ya%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y\coshalfanglestep\pgf@ya%
+ \advance\pgf@y-\k\pgf@xa%
+ \pgf@y\pgfmathresult\pgf@y%
+ %
+ \edef\xinnerradius{\the\pgf@x}%
+ \edef\yinnerradius{\the\pgf@y}%
+ \addtosavedmacro\xinnerradius%
+ \addtosavedmacro\yinnerradius%
+ %
+ % Get some useful trig. constants.
+ %
+ \pgfmathdivide@{\arc}{4}%
+ \let\quarterarc\pgfmathresult%
+ \pgfmathsubtract@{180}{\arc}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\halfcomplementarc\pgfmathresult%
+ %
+ \addtosavedmacro\arc%
+ \addtosavedmacro\quarterarc%
+ \addtosavedmacro\halfcomplementarc%
+ %
+ \pgfmathsec@{\halfcomplementarc}% 1/cos((180-a)/2)
+ \let\sechalfcomplementarc\pgfmathresult%
+ \pgfmathsin@{\halfcomplementarc}% sin((180-a)/2)
+ \let\sinhalfcomplementarc\pgfmathresult%
+ %
+ \addtosavedmacro\sechalfcomplementarc%
+ \addtosavedmacro\sinhalfcomplementarc%
+ %
+ \pgfmathsin@{\quarterarc}% sin(a/4)
+ \let\sinquarterarc\pgfmathresult%
+ \pgfmathcos@{\quarterarc}% cos(a/4)
+ \let\cosquarterarc\pgfmathresult%
+ \pgfmathreciprocal@{\cosquarterarc}%
+ \pgfmathmultiply@{\pgfmathresult}{\sinquarterarc}% tan(a/4)
+ \let\tanquarterarc\pgfmathresult%
+ %
+ \addtosavedmacro\sinquarterarc%
+ \addtosavedmacro\cosquarterarc%
+ \addtosavedmacro\tanquarterarc%
+ %
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{mid}{\midpoint}
+ \anchor{base}{\basepoint}
+ \anchor{north}{%
+ \getradii%
+ \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{\youterradius}}%
+ }%
+ \anchor{south}{%
+ \getradii%
+ \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{-\youterradius}}%
+ }%
+ \anchor{east}{%
+ \getradii%
+ \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{\xouterradius}{0pt}}%
+ }%
+ \anchor{west}{%
+ \getradii%
+ \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{-\xouterradius}{0pt}}%
+ }%
+ \anchor{north west}{%
+ \getradii%
+ \pgfextract@process\pgf@sh{%
+ \pgf@x\xouterradius\relax%
+ \pgf@x-0.707106\pgf@x%
+ \pgf@y\youterradius\relax%
+ \pgf@y0.707106\pgf@y%
+ }%
+ \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}%
+ }%
+ \anchor{north east}{%
+ \getradii%
+ \pgfextract@process\pgf@sh{%
+ \pgf@x\xouterradius\relax%
+ \pgf@x0.707106\pgf@x%
+ \pgf@y\youterradius\relax%
+ \pgf@y0.707106\pgf@y%
+ }%
+ \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}%
+ }%
+ \anchor{south west}{%
+ \getradii%
+ \pgfextract@process\pgf@sh{%
+ \pgf@x\xouterradius\relax%
+ \pgf@x-0.707106\pgf@x%
+ \pgf@y\youterradius\relax%
+ \pgf@y-0.707106\pgf@y%
+ }%
+ \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}%
+ }%
+ \anchor{south east}{%
+ \getradii%
+ \pgfextract@process\pgf@sh{%
+ \pgf@x\xouterradius\relax%
+ \pgf@x0.707106\pgf@x%
+ \pgf@y\youterradius\relax%
+ \pgf@y-0.707106\pgf@y%
+ }%
+ \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}%
+ }%
+ %
+ % Each `puff' is a circular arc of length a, drawn using two a/2
+ % arcs (a < 180), approximated by Bezier curves.
+ % Due to TeX rounding errors, it is sometimes necessary to `force'
+ % the arc to end at a specific point. So...
+ %
+ % @article{riskus2006,
+ % author = {Aleskus Ri\v{s}kus},
+ % title = {Approximation of a cubic Bezier curve by circular arcs and vice versa},
+ % journal = {Information Technology and Control},
+ % year = {2006},
+ % volume = {35},
+ % number = {4}
+ % }
+ %
+ \backgroundpath{%
+ {%
+ \getradii%
+ %
+ % Get the start angle.
+ %
+ \pgfmathdivide@{\anglestep}{2}%
+ \pgfmathsubtract@{90}{\pgfmathresult}%
+ \let\angle\pgfmathresult%
+ %
+ % Calculate the first arc point.
+ %
+ \pgfextract@process\arcfirstpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ \pgfpathmoveto{\arcfirstpoint}%
+ \let\arcendpoint\arcfirstpoint%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\puffs\relax%
+ \else
+ \let\arcstartpoint\arcendpoint%
+ %
+ % Make sure beginning and end of path are exactly the same.
+ %
+ \ifnum\pgfmathcounter=\puffs\relax%
+ \let\arcendpoint\arcfirstpoint%
+ \else%
+ \pgfmathadd@{\angle}{\anglestep}%
+ \let\angle\pgfmathresult%
+ \pgfextract@process\arcendpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ \fi%
+ %
+ % Get some useful cloud parameters from \arcstartpoint and \arcendpoint.
+ %
+ \pgf@sh@getcloudpuffparameters%
+ %
+ % Get the rotation for the Bezier curve.
+ %
+ \pgfmathsubtract@{90}{\quarterarc}%
+ \pgfmathadd@{\pgfmathresult}{\arcslope}%
+ \let\arcrotate\pgfmathresult%
+ \pgfmathsin@{\arcrotate}%
+ \let\sinarcrotate\pgfmathresult%
+ \pgfmathcos@{\arcrotate}%
+ \let\cosarcrotate\pgfmathresult%
+ %
+ % Calculate the amount by which to scale the control
+ % points, in order to approximate an a/2 arc with radius x.
+ %
+ \pgf@x\arcradius\relax%
+ \pgf@x\tanquarterarc\pgf@x% tan(a/4)
+ \edef\controlscale{\pgfmath@tonumber{\pgf@x}}%
+ %
+ % Get the first control point for the first arc (length a/2)...
+ %
+ \pgfextract@process\controlone{%
+ %
+ % k = 0.552284745 (a `magic' number)...
+ %
+ \pgf@x0.55228475pt\relax%
+ \pgf@x\sinquarterarc\pgf@x% k * sin(a/2)
+ \pgf@y0.55228475pt\relax%
+ \pgf@y\cosquarterarc\pgf@y% k * cos(a/2)
+ %
+ % ...scale the control points up...
+ %
+ \pgf@x\controlscale\pgf@x%
+ \pgf@y\controlscale\pgf@y%
+ %
+ % ...rotate...
+ %
+ \pgf@xa\cosarcrotate\pgf@x%
+ \advance\pgf@xa-\sinarcrotate\pgf@y%
+ \pgf@ya\cosarcrotate\pgf@y%
+ \advance\pgf@ya\sinarcrotate\pgf@x%
+ %
+ % ...and shift.
+ %
+ \arcstartpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Get the midpoint of the 150° arc.
+ %
+ \pgfextract@process\arcmidpoint{%
+ \pgfextract@process\arcmidpoint{%
+ \pgf@x-\halfchordlength\relax%
+ \pgf@y\segmentheight\relax%
+ }%
+ \pgfpointadd{\arcstartpoint}{%
+ \pgfmathrotatepointaround{\arcmidpoint}{\pgfpointorigin}{\arcslope}%
+ }%
+ }%
+ %
+ % Get the second control point for the first arc (length a/2)...
+ %
+ \pgfextract@process\controltwo{%
+ \pgf@x0.55228475pt\relax%
+ \pgf@x\sinquarterarc\pgf@x% k * sin(a/2)
+ \pgf@y-0.55228475pt\relax%
+ \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2)
+ %
+ % ...scale, rotate and shift.
+ %
+ \pgf@x\controlscale\pgf@x%
+ \pgf@y\controlscale\pgf@y%
+ %
+ \pgf@xa\cosarcrotate\pgf@x%
+ \advance\pgf@xa-\sinarcrotate\pgf@y%
+ \pgf@ya\cosarcrotate\pgf@y%
+ \advance\pgf@ya\sinarcrotate\pgf@x%
+ %
+ \arcmidpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ {%
+ \pgfsetcornersarced{\pgfpointorigin}%
+ \pgfpathcurveto{\controlone}{\controltwo}{\arcmidpoint}%
+ }%
+ %
+ % Do the same for the second arc...
+ %
+ \pgfmathadd@{\quarterarc}{90}%
+ \pgfmathadd@{\pgfmathresult}{\arcslope}%
+ \let\arcrotate\pgfmathresult%
+ \pgfmathsin@{\arcrotate}%
+ \let\sinarcrotate\pgfmathresult%
+ \pgfmathcos@{\arcrotate}%
+ \let\cosarcrotate\pgfmathresult%
+ %
+ % First control point for the second arc...
+ %
+ \pgfextract@process\controlone{%
+ \pgf@x0.55228475pt\relax%
+ \pgf@x\sinquarterarc\pgf@x% k * sin(a/2)
+ \pgf@y0.55228475pt\relax%
+ \pgf@y\cosquarterarc\pgf@y% k * cos(a/2)
+ %
+ % ...scale, rotate and shift.
+ %
+ \pgf@x\controlscale\pgf@x%
+ \pgf@y\controlscale\pgf@y%
+ %
+ \pgf@xa\cosarcrotate\pgf@x%
+ \advance\pgf@xa-\sinarcrotate\pgf@y%
+ \pgf@ya\cosarcrotate\pgf@y%
+ \advance\pgf@ya\sinarcrotate\pgf@x%
+ %
+ \arcmidpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Second control point for the second arc.
+ %
+ \pgfextract@process\controltwo{%
+ \pgf@x0.55228475pt\relax%
+ \pgf@x\sinquarterarc\pgf@x% k * sin(a/2)
+ \pgf@y-0.55228475pt\relax%
+ \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2)
+ %
+ % ...scale, rotate and shift.
+ %
+ \pgf@x\controlscale\pgf@x%
+ \pgf@y\controlscale\pgf@y%
+ %
+ \pgf@xa\cosarcrotate\pgf@x%
+ \advance\pgf@xa-\sinarcrotate\pgf@y%
+ \pgf@ya\cosarcrotate\pgf@y%
+ \advance\pgf@ya\sinarcrotate\pgf@x%
+ %
+ \arcendpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfpathcurveto{\controlone}{\controltwo}{\arcendpoint}%
+ \repeatpgfmathloop%
+ \pgfpathclose% Phew!
+ }%
+ }%
+ %
+ % Calculate a point on the border of the cloud. This is a two-stage process:
+ %
+ % 1. Locate the correct puff.
+ % 2. Locate the angle on the circular arc which forms the puff.
+ %
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Get the inner radii and trig. constants.
+ %
+ \getradii%
+ %
+ %
+ %
+ \ifpgfcloudanchorsuseellipse%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointborderellipse{%
+ \pgfpoint{\externalx}{\externaly}
+ }{%
+ \pgfpoint{\xouterradius}{\youterradius}
+ }%
+ }%
+ \else%
+ \pgfextract@process\externalpoint{%
+ \centerpoint%
+ \advance\pgf@x\externalx\relax%
+ \advance\pgf@y\externaly\relax%
+ }%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ %
+ % 1. Locate the correct puff:
+ %
+ % Get end angle of the relavent puff arc.
+ %
+ \pgfmathdivide@{\anglestep}{2}%
+ \let\halfanglestep\pgfmathresult%
+ \pgfmathsubtract@{90}{\halfanglestep}%
+ \let\endangle\pgfmathresult%
+ \pgfmathloop%
+ \pgfmathsubtract@{\endangle}{\anglestep}%
+ \ifdim\pgfmathresult pt<-\anglestep pt\relax%
+ \else%
+ \let\endangle\pgfmathresult%
+ \repeatpgfmathloop%
+ \def\angle{0}%
+ \let\lastangle\angle%
+ \pgfmathloop%
+ \pgfmathadd@{\endangle}{\anglestep}%
+ \let\endangle\pgfmathresult%
+ %
+ % Calculate the `miter point'. This is the point between
+ % each puff, and takes into account the outer sep.
+ %
+ \pgfextract@process\miterpoint{%
+ %
+ \pgfextract@process\secondpoint{%
+ \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ %
+ \pgfmathadd@{\endangle}{\anglestep}%
+ \let\angletemp\pgfmathresult%
+ \pgfextract@process\thirdpoint{%
+ \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}%
+ }%
+ %
+ \pgfmathsubtract@{\endangle}{\anglestep}%
+ \let\angletemp\pgfmathresult%
+ \pgfextract@process\firstpoint{%
+ \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}%
+ }%
+ %
+ \pgfmathanglebetweenpoints{\firstpoint}{\secondpoint}%
+ \let\anglealpha\pgfmathresult%
+ \pgfmathanglebetweenpoints{\secondpoint}{\thirdpoint}%
+ \let\anglebeta\pgfmathresult%
+ %
+ \pgfmathsubtract@{\anglebeta}{\anglealpha}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathadd@{\pgfmathresult}{\halfcomplementarc}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@x\outersep\relax%
+ \pgf@x\pgfmathresult\pgf@x%
+ \edef\miterradius{\the\pgf@x}%
+ %
+ \pgfmathadd@{\anglealpha}{\anglebeta}%
+ \pgfmathsubtract@{\pgfmathresult}{180}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\miterangle\pgfmathresult%
+ \pgfpointadd{\secondpoint}{%
+ \pgfqpointpolar{\miterangle}{\miterradius}%
+ }%
+ }%
+ %
+ % Get the angle of the miter point...
+ %
+ \pgfmathanglebetweenpoints{\pgfpointorigin}{\miterpoint}%
+ \let\angle\pgfmathresult%
+ \ifdim\angle pt<\lastangle pt\relax% Guard against 360° = 0°
+ \pgfmathadd@{\angle}{360}%
+ \let\angle\pgfmathresult%
+ \fi%
+ \let\lastangle\angle%
+ %
+ % ...and see if it is greater than the external point.
+ %
+ \ifdim\externalangle pt>\angle pt\relax%
+ \repeatpgfmathloop%
+ %
+ % Get the start angle of the relevant arc and ensure angles are in the range.
+ %
+ \pgfmathmod@{\endangle}{360}%
+ \let\endangle\pgfmathresult%
+ \pgfmathsubtract@{\endangle}{\anglestep}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\startangle\pgfmathresult%
+ %
+ % Now, get the start and end points of the arc.
+ %
+ \pgfextract@process\arcstartpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\startangle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ \pgfextract@process\arcendpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ %
+ % Get some useful cloud parameters from \arcstartpoint and \arcendpoint.
+ %
+ \pgf@sh@getcloudpuffparameters%
+ %
+ % Hackery, for when an arc straddles 0°.
+ %
+ \ifdim\endangle pt<\startangle pt\relax%
+ \pgfmathadd@{\externalangle}{180}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \let\x\pgfmathresult%
+ \else%
+ \let\x\externalangle%
+ \fi%
+ %
+ % 2. Locate the angle on the circular arc which forms the puff.
+ %
+ % Essentially a binary search to find the angle on the circular
+ % arc, which provides the nearset estimate to the border point.
+ %
+ \let\s\halfcomplementarc% The start of the arc.
+ \pgfmathadd@{\s}{\arc}%
+ \let\e\pgfmathresult% The end of the arc.
+ \pgfmathadd@{\e}{\s}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\n\pgfmathresult% The nearest estimate (default to middle of arc).
+ \def\m{360}% Measure of `nearness'.
+ \pgfmathloop%
+ \pgfmathadd@{\e}{\s}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\p\pgfmathresult% The point halfway between \s and \e.
+ \ifdim\p pt=\s pt\relax%
+ \else%
+ %
+ % Get the point on the circular arc.
+ %
+ \pgfmathadd@{\p}{\arcslope}%
+ \let\a\pgfmathresult%
+ \pgfextract@process\arcpoint{%
+ \pgfpointadd{\circlecenterpoint}{%
+ \pgfqpointpolar{\a}{\outerarcradius}%
+ }%
+ }%
+ %
+ % Find the angle between the node centre and the point on the arc.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\arcpoint}%
+ %
+ % Hackery, for when an arc straddles 0°.
+ %
+ \ifdim\endangle pt<\startangle pt\relax%
+ \pgfmathadd@{\pgfmathresult}{180}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \fi%
+ \let\q\pgfmathresult%
+ \ifdim\x pt=\q pt% Found it!
+ \pgfmathbreakloop% Breaks after current iteration is complete.
+ \else
+ \ifdim\x pt<\q pt\relax%
+ \let\e\p%
+ \else%
+ \let\s\p%
+ \fi%
+ \fi%
+ \pgfmathsubtract@{\x}{\q}%
+ \pgfmathabs@{\pgfmathresult}%
+ %
+ % Save the estimate if it is better than any previous estimate.
+ %
+ \ifdim\pgfmathresult pt<\m pt\relax%
+ \let\m\pgfmathresult%
+ \let\n\p%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Use the nearest estimate as the anchor angle.
+ %
+ \pgfmathadd@{\n}{\arcslope}%
+ \let\anchorangle\pgfmathresult%
+ %
+ % Finally, the required point.
+ %
+ \pgfpointadd{\circlecenterpoint}{%
+ \pgfqpointpolar{\anchorangle}{\outerarcradius}%
+ }%
+ \fi%
+ }% Again, Phew!
+ %
+ % Now, a sneaky hack. This means an arbitrary `puff' anchors
+ % can be used for positiong the cloud shape. This is needed
+ % if a cloud is positioned using the `puff <n+1>' anchor, where
+ % n is the number of puffs of any previously drawn cloud.
+ %
+ \pgfutil@g@addto@macro\pgf@sh@s@cloud{%
+ \c@pgf@counta\puffs\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0\relax%
+ \pgfutil@ifundefined{pgf@anchor@cloud@puff\space\the\c@pgf@counta}{%
+ \expandafter\xdef\csname pgf@anchor@cloud@puff\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}%
+ }%
+ }{\c@pgf@counta0\relax}%
+ \advance\c@pgf@counta-1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+% \pgf@sh@@cloudpuffanchor
+%
+% Internal macro for calculating the anchors puff 1, puff 2, ... etc.
+%
+\def\pgf@sh@@cloudpuffanchor#1{%
+ \getradii%
+ \pgfmathdivide@{\anglestep}{2}%
+ \let\halfanglestep\pgfmathresult%
+ \c@pgf@counta#1\relax%
+ \advance\c@pgf@counta-1\relax%
+ \pgfmathmultiply@{\anglestep}{\the\c@pgf@counta}%
+ \pgfmathadd@{\pgfmathresult}{90}%
+ \pgfmathsubtract@{\pgfmathresult}{\halfanglestep}%
+ \let\angle\pgfmathresult%
+ %
+ % Calculate the first arc point.
+ %
+ \pgfextract@process\arcstartpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ %
+ \pgfmathadd@{\angle}{\anglestep}%
+ \let\angle\pgfmathresult%
+ \pgfextract@process\arcendpoint{%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}%
+ }%
+ }%
+ %
+ % Get some useful cloud parameters from \arcstartpoint and \arcendpoint.
+ %
+ \pgf@sh@getcloudpuffparameters%
+ %
+ % Calculate the point.
+ %
+ \pgfmathadd@{\arcslope}{90}%
+ \let\anchorangle\pgfmathresult%
+ \pgfpointadd{\circlecenterpoint}{%
+ \pgfqpointpolar{\anchorangle}{\outerarcradius}%
+ }%
+}
+
+% \pgf@sh@cloudpuffparameters
+%
+% Internal macro to calculate some common arc parameters which
+% are required when calculating radii, drawing the background
+% path and calculating border anchors.
+%
+\def\pgf@sh@getcloudpuffparameters{%
+ %
+ % Calculate the angle to which the entire arc is sloped.
+ %
+ \pgfmathanglebetweenpoints{\arcendpoint}{\arcstartpoint}%
+ \let\arcslope\pgfmathresult%
+ %
+ % Calculate the chord length and arc radius.
+ %
+ \pgfpointdiff{\arcendpoint}{\arcstartpoint}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}
+ \pgf@x\pgfmathresult pt\relax%
+ \pgf@xa.5\pgf@x%
+ \edef\halfchordlength{\the\pgf@xa}%
+ \pgf@x\arcradiusquotient\pgf@x%
+ \edef\arcradius{\the\pgf@x}%
+ \pgf@xa\outersep\relax%
+ \advance\pgf@xa\pgf@x%
+ \edef\outerarcradius{\the\pgf@xa}%
+ %
+ % Calculate the height of the resulting segment.
+ %
+ \pgf@y-\sinhalfcomplementarc\pgf@x% sin((180-a)/2)
+ \advance\pgf@y\pgf@x%
+ \edef\segmentheight{\the\pgf@y}%
+ %
+ % Calculate the center of the circle of which the arc is a part.
+ %
+ \pgfextract@process\circlecenterpoint{%
+ \pgfextract@process\circlecenterpoint{%
+ \pgf@x-\halfchordlength\relax%
+ \pgf@y\segmentheight\relax%
+ \advance\pgf@y-\arcradius
+ }%
+ \pgfpointadd{\arcstartpoint}{%
+ \pgfmathrotatepointaround{\circlecenterpoint}{\pgfpointorigin}{\arcslope}%
+ }%
+ }%
+}
+
+
+
+
+
+% Internal macros for signal shape.
+%
+\def\pgf@lib@sh@signal@nowhere{nowhere}%
+\def\pgf@lib@sh@signal@from{from}%
+\def\pgf@lib@sh@signal@to{to}%
+
+\def\pgf@lib@sh@signal@parsedirection#1#2{%
+ %
+ \let\pgf@lib@sh@signal@direction=#2%
+ \edef\pgf@lib@sh@temp{#1}%
+ \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop}
+
+\def\pgf@lib@sh@signal@@parsedirection#1\pgf@stop{%
+ \pgfutil@in@{and}{#1}%
+ \ifpgfutil@in@%
+ \pgf@lib@sh@signal@@@parsedirection#1\pgf@lib%
+ \else%
+ \pgf@lib@sh@signal@@@parsedirection#1 and #1\pgf@lib%
+ \fi
+}
+\def\pgf@lib@sh@signal@@@parsedirection#1 and #2\pgf@lib{%
+ \pgfutil@in@{nowhere}{#1}%
+ \ifpgfutil@in@
+ \else%
+ \pgf@lib@sh@signal@@@@parsedirection{#1}%
+ \pgf@lib@sh@signal@@@@parsedirection{#2}%
+ \fi%
+}
+\def\pgf@lib@sh@signal@@@@parsedirection#1{%
+ \pgfutil@in@{ #1 }{ east right }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ left west }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ above up north }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ below down south }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
+ \fi%
+}
+
+
+% Keys for signal shape:
+%
+\pgfkeys{/pgf/.cd,
+ signal pointer angle/.initial=90,
+ signal to/.initial=east,
+ signal from/.initial=nowhere
+}
+
+\pgfdeclareshape{signal}{%
+ \savedmacro\installsignalparameters{%
+ %
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
+ %
+ \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal from}}{\pgf@lib@sh@signal@from}%
+ \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}%
+ %
+ % Define a centerpoint.
+ %
+ \pgfextract@process\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ %
+ % Get some useful trig. stuff
+ %
+ \pgfmathsetmacro\pointerangle{\pgfkeysvalueof{/pgf/signal pointer angle}}%
+ %
+ \pgfmathdivide@{\pointerangle}{2}%
+ \let\halfpointerangle=\pgfmathresult%
+ %
+ \pgfmathcosec@{\halfpointerangle}%
+ \let\cosechalfpointerangle=\pgfmathresult%
+ %
+ \pgfmathdivide@{\halfpointerangle}{2}%
+ \let\quarterpointerangle=\pgfmathresult%
+ %
+ \pgfmathcosec@{\quarterpointerangle}%
+ \let\cosecquarterpointerangle=\pgfmathresult%
+ %
+ \pgfmathsec@{\quarterpointerangle}%
+ \let\secquarterpointerangle=\pgfmathresult%
+ %
+ \pgfmathsubtract@{90}{\quarterpointerangle}%
+ \let\complementquarterpointerangle\pgfmathresult%
+ %
+ % Get the larger of the outer sep.
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@x>\pgf@y%
+ \pgf@y\pgf@x%
+ \fi%
+ \pgf@yc=\pgf@y%
+ %
+ % Calculate the miter due to the line width, at the pointer apex...
+ %
+ \pgf@x=\cosechalfpointerangle\pgf@y%
+ \edef\pointerapexmiter{\the\pgf@x}%
+ %
+ % ...at a corner by a `to' pointer (i.e. sticks out)...
+ %
+ \pgf@x=\secquarterpointerangle\pgf@y%
+ \edef\tocornermiter{\the\pgf@x}%
+ %
+ % ...at a corner by a `from' pointer (i.e. sticks in).
+ %
+ \pgf@x=\cosecquarterpointerangle\pgf@y
+ \edef\fromcornermiter{\the\pgf@x}%
+ %
+ % Get the (half) dimensions of the node.
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya.5\dp\pgfnodeparttextbox%
+ %
+ % Get the distance a pointer sticks out to the side...
+ %
+ \pgfmathsubtract@{90}{\halfpointerangle}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgf@xb=\pgfmathresult\pgf@ya%
+ %
+ % ...and up.
+ %
+ \pgf@yb=\pgfmathresult\pgf@xa%
+ %
+ % Adjust for minimum height.
+ %
+ \pgfutil@tempdima=2.0\pgf@ya%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by\pgf@yb%
+ \fi%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgfutil@tempdima<\pgf@y%
+ \pgfutil@tempdima=\pgf@y%
+ %
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \fi%
+ \pgf@ya=0.5\pgfutil@tempdima%
+ \pgfmathsubtract@{90}{\halfpointerangle}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgf@xb=\pgfmathresult\pgf@ya%
+ \fi%
+ %
+ % Adjust for minimum width.
+ %
+ \pgfutil@tempdima=2.0\pgf@xa%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<\pgf@x%
+ \pgfutil@tempdima=\pgf@x%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgf@xa=0.5\pgfutil@tempdima%
+ \pgfmathsubtract@{90}{\halfpointerangle}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgf@yb=\pgfmathresult\pgf@xa%
+ \fi%
+ %
+ % So, define the points for the background path.
+ %
+ \pgfextract@process\north{%
+ \centerpoint%
+ \advance\pgf@y\pgf@ya%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\south{%
+ \centerpoint%
+ \advance\pgf@y-\pgf@ya%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\east{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
+ \advance\pgf@x\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\west{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
+ \advance\pgf@x-\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\northeast{%
+ \centerpoint%
+ \advance\pgf@y\pgf@ya%
+ \advance\pgf@x\pgf@xa%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
+ \advance\pgf@x\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\southeast{%
+ \centerpoint%
+ \advance\pgf@y-\pgf@ya%
+ \advance\pgf@x\pgf@xa%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
+ \advance\pgf@x\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\southwest{%
+ \centerpoint%
+ \advance\pgf@y-\pgf@ya%
+ \advance\pgf@x-\pgf@xa%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
+ \advance\pgf@x-\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\northwest{%
+ \centerpoint%
+ \advance\pgf@y\pgf@ya%
+ \advance\pgf@x-\pgf@xa%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
+ \advance\pgf@x-\pgf@xb%
+ \fi%
+ }%
+ \addtosavedmacro{\north}%
+ \addtosavedmacro{\south}%
+ \addtosavedmacro{\east}%
+ \addtosavedmacro{\west}%
+ \addtosavedmacro{\northeast}%
+ \addtosavedmacro{\southwest}%
+ \addtosavedmacro{\southeast}%
+ \addtosavedmacro{\northwest}%
+ %
+ % Calculate the `miter vectors' (i.e. +outer sep).
+ %
+ \pgfextract@process\northmiter{%
+ \pgf@x0pt%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
+ \pgf@y\pgf@yc%
+ \else%
+ \pgf@y\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\southmiter{%
+ \pgf@x0pt%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
+ \pgf@y-\pgf@yc%
+ \else%
+ \pgf@y-\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\eastmiter{%
+ \pgf@y0pt%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \pgf@x\pgf@yc%
+ \else%
+ \pgf@x\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\westmiter{%
+ \pgf@y0pt%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \pgf@x-\pgf@yc%
+ \else%
+ \pgf@x-\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\northeastmiter{%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \pgf@x\pgf@yc
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
+ \pgfqpointpolar{\quarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
+ \pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
+ \pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to%
+ \pgfqpointpolar{\quarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\southeastmiter{%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \pgf@x\pgf@yc%
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
+ \pgfqpointpolar{-\quarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
+ \pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
+ \pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
+ \pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\southwestmiter{%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \pgf@x-\pgf@yc
+ \pgf@y-\pgf@yc%
+ \else
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
+ \pgfmathadd@{\quarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
+ \pgfmathadd@{\complementquarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
+ \pgfmathadd@{\complementquarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
+ \pgfmathadd@{\quarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\northwestmiter{%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \pgf@x-\pgf@yc%
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
+ \pgfmathsubtract@{180}{\quarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
+ \pgfmathsubtract@{180}{\complementquarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
+ \pgfmathsubtract@{180}{\complementquarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
+ \pgfmathsubtract@{180}{\quarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \addtosavedmacro{\northmiter}%
+ \addtosavedmacro{\southmiter}%
+ \addtosavedmacro{\eastmiter}%
+ \addtosavedmacro{\westmiter}%
+ \addtosavedmacro{\northeastmiter}%
+ \addtosavedmacro{\southeastmiter}%
+ \addtosavedmacro{\southwestmiter}%
+ \addtosavedmacro{\northwestmiter}%
+ %
+ % Now calculate the anchor points
+ %
+ \pgfextract@process\anchornorth{%
+ \pgfpointadd{\north}{\northmiter}%
+ }%
+ \pgfextract@process\anchorsouth{%
+ \pgfpointadd{\south}{\southmiter}%
+ }%
+ \pgfextract@process\anchoreast{%
+ \pgfpointadd{\east}{\eastmiter}%
+ }%
+ \pgfextract@process\anchorwest{%
+ \pgfpointadd{\west}{\westmiter}%
+ }%
+ \pgfextract@process\anchornortheast{%
+ \pgfpointadd{\northeast}{\northeastmiter}%
+ }%
+ \pgfextract@process\anchorsoutheast{%
+ \pgfpointadd{\southeast}{\southeastmiter}%
+ }%
+ \pgfextract@process\anchorsouthwest{%
+ \pgfpointadd{\southwest}{\southwestmiter}%
+ }%
+ \pgfextract@process\anchornorthwest{%
+ \pgfpointadd{\northwest}{\northwestmiter}%
+ }%
+ \addtosavedmacro{\anchornorth}%
+ \addtosavedmacro{\anchorsouth}%
+ \addtosavedmacro{\anchoreast}%
+ \addtosavedmacro{\anchorwest}%
+ \addtosavedmacro{\anchornortheast}%
+ \addtosavedmacro{\anchorsouthwest}%
+ \addtosavedmacro{\anchorsoutheast}%
+ \addtosavedmacro{\anchornorthwest}%
+ }%
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\centerpoint}%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \installsignalparameters%
+ \anchoreast%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \anchorsoutheast%
+ \ifdim\pgf@xa>\pgf@x%
+ \pgfutil@tempdima\pgf@xa%
+ \else%
+ \pgfutil@tempdima\pgf@x%
+ \fi%
+ \pgfextract@process\externalpoint{%
+ \basepoint%
+ \pgf@x\pgfutil@tempdima%
+ }
+ \basepoint%
+ \let\firstpoint\anchoreast%
+ \ifdim\pgf@y<\pgf@ya%
+ \let\secondpoint\anchorsoutheast%
+ \else%
+ \let\secondpoint\anchornortheast%
+ \fi%
+ \pgfpointintersectionoflines{\basepoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+ \anchor{base west}{%
+ \installsignalparameters%
+ \anchorwest%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \anchorsouthwest%
+ \ifdim\pgf@xa<\pgf@x%
+ \pgfutil@tempdima\pgf@xa%
+ \else%
+ \pgfutil@tempdima\pgf@x%
+ \fi%
+ \pgfextract@process\externalpoint{%
+ \basepoint%
+ \pgf@x\pgfutil@tempdima%
+ }
+ \basepoint%
+ \let\firstpoint\anchorwest%
+ \ifdim\pgf@y<\pgf@ya%
+ \let\secondpoint\anchorsouthwest%
+ \else%
+ \let\secondpoint\anchornorthwest%
+ \fi%
+ \pgfpointintersectionoflines{\basepoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \installsignalparameters%
+ \anchoreast%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \anchorsoutheast%
+ \ifdim\pgf@xa>\pgf@x%
+ \pgfutil@tempdima\pgf@xa%
+ \else%
+ \pgfutil@tempdima\pgf@x%
+ \fi%
+ \pgfextract@process\externalpoint{%
+ \midpoint%
+ \pgf@x\pgfutil@tempdima%
+ }
+ \midpoint%
+ \let\firstpoint\anchoreast%
+ \ifdim\pgf@y<\pgf@ya%
+ \let\secondpoint\anchorsoutheast%
+ \else%
+ \let\secondpoint\anchornortheast%
+ \fi%
+ \pgfpointintersectionoflines{\midpoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+ \anchor{mid west}{%
+ \installsignalparameters%
+ \anchorwest%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \anchorsouthwest%
+ \ifdim\pgf@xa<\pgf@x%
+ \pgfutil@tempdima\pgf@xa%
+ \else%
+ \pgfutil@tempdima\pgf@x%
+ \fi%
+ \pgfextract@process\externalpoint{%
+ \midpoint%
+ \pgf@x\pgfutil@tempdima%
+ }
+ \midpoint%
+ \let\firstpoint\anchorwest%
+ \ifdim\pgf@y<\pgf@ya%
+ \let\secondpoint\anchorsouthwest%
+ \else%
+ \let\secondpoint\anchornorthwest%
+ \fi%
+ \pgfpointintersectionoflines{\midpoint}{\externalpoint}%
+ {\firstpoint}{\secondpoint}%
+ }%
+ \anchor{north}{\installsignalparameters\anchornorth}%
+ \anchor{south}{\installsignalparameters\anchorsouth}%
+ \anchor{east}{\installsignalparameters\anchoreast}%
+ \anchor{west}{\installsignalparameters\anchorwest}%
+ \anchor{north east}{\installsignalparameters\anchornortheast}%
+ \anchor{south east}{\installsignalparameters\anchorsoutheast}%
+ \anchor{south west}{\installsignalparameters\anchorsouthwest}%
+ \anchor{north west}{\installsignalparameters\anchornorthwest}%
+ \backgroundpath{%
+ \installsignalparameters%
+ \pgfpathmoveto{\north}%
+ \pgfpathlineto{\northeast}%
+ \pgfpathlineto{\east}%
+ \pgfpathlineto{\southeast}%
+ \pgfpathlineto{\south}%
+ \pgfpathlineto{\southwest}%
+ \pgfpathlineto{\west}%
+ \pgfpathlineto{\northwest}%
+ \pgfpathclose%
+ }
+ \anchorborder{%
+ %
+ % Save x and y.
+ %
+ \edef\externalx{\the\pgf@x}%
+ \edef\externaly{\the\pgf@y}%
+ %
+ % Adjust the location of the external
+ % point relative to \centerpoint.
+ %
+ \centerpoint%
+ \pgf@xa\externalx\relax%
+ \pgf@ya\externaly\relax%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@ya\pgf@y%
+ \edef\externalx{\the\pgf@xa}%
+ \edef\externaly{\the\pgf@ya}%
+ %
+ % Get the shape parameters.
+ %
+ \installsignalparameters%
+ %
+ % Get the angle of the external point to the \centerpoint.
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ \let\externalangle\pgfmathresult%
+ %
+ %
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchorwest}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchornorth}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchornortheast}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \let\firstpoint\anchoreast%
+ \let\secondpoint\anchornortheast%
+ \else%
+ \let\secondpoint\anchornortheast%
+ \let\firstpoint\anchornorth%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchornorthwest}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \let\firstpoint\anchornorth%
+ \let\secondpoint\anchornorthwest%
+ \else%
+ \let\secondpoint\anchornorthwest%
+ \let\firstpoint\anchorwest%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouth}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouthwest}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \let\firstpoint\anchorwest%
+ \let\secondpoint\anchorsouthwest%
+ \else%
+ \let\secondpoint\anchorsouthwest%
+ \let\firstpoint\anchorsouth%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\anchorsoutheast}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \let\firstpoint\anchorsouth%
+ \let\secondpoint\anchorsoutheast%
+ \else%
+ \let\secondpoint\anchorsoutheast%
+ \let\firstpoint\anchoreast%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % Now locate the point.
+ %
+ \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}%
+ {\firstpoint}{\secondpoint}%
+ }%
+}%
+
+
+
+
+
+
+% Keys for shape tape
+%
+% /pgf/tape bend top : Type of bend for north side.
+% /pgf/tape bend bottom : Type of bend for south side.
+% /pgf/tape bend height : The height of the bends.
+\pgfkeys{/pgf/.cd,
+ tape bend top/.initial=in and out,
+ tape bend bottom/.initial=in and out,
+ tape bend/.style={/pgf/tape bend top=#1, /pgf/tape bend bottom=#1},
+ tape bend height/.initial=5pt
+}
+
+\def\pgf@lib@sh@inandouttext{in and out}
+\def\pgf@lib@sh@outandintext{out and in}
+\def\pgf@lib@sh@nonetext{none}
+
+\pgfdeclareshape{tape}{
+ \savedmacro\tapedimensions{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\dp\pgfnodeparttextbox%
+ %
+ \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ %
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/tape bend height}}%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \edef\halfbendheight{\the\pgfutil@tempdima}%
+ \addtosavedmacro\halfbendheight%
+ %
+ \pgfkeysgetvalue{/pgf/tape bend top}{\topbendstyle}%
+ \pgfkeysgetvalue{/pgf/tape bend bottom}{\bottombendstyle}%
+ \addtosavedmacro\topbendstyle%
+ \addtosavedmacro\bottombendstyle%
+ %
+ \ifx\topbendstyle\pgf@lib@sh@nonetext%
+ \else%
+ \advance\pgf@y\pgfutil@tempdima%
+ \fi%
+ \ifx\bottombendstyle\pgf@lib@sh@none%
+ \else%
+ \advance\pgf@y\pgfutil@tempdima%
+ \fi%
+ %
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \ifx\topbendstyle\pgf@lib@sh@nonetext%
+ \else%
+ \advance\pgf@y-\pgfutil@tempdima%
+ \fi%
+ \ifx\bottombendstyle\pgf@lib@sh@nonetext%
+ \else%
+ \advance\pgf@y-\pgfutil@tempdima%
+ \fi%
+ %
+ \pgfutil@tempdima3.414213\pgfutil@tempdima% 1 / (1-sin(45))
+ \edef\bendyradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\bendyradius%
+ \advance\pgfutil@tempdima\outerysep%
+ \edef\outerbendyradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\outerbendyradius%
+ \advance\pgfutil@tempdima-\outerysep%
+ \advance\pgfutil@tempdima-\outerysep%
+ \edef\innerbendyradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\innerbendyradius%
+ %
+ \pgfutil@tempdima0.707106\pgf@x% cos(45)
+ \edef\bendxradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\bendxradius%
+ \advance\pgfutil@tempdima\outerxsep%
+ \edef\outerbendxradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\outerbendxradius%
+ \advance\pgfutil@tempdima-\outerxsep%
+ \advance\pgfutil@tempdima-\outerxsep%
+ \edef\innerbendxradius{\the\pgfutil@tempdima}%
+ \addtosavedmacro\innerbendxradius%
+ %
+ \edef\halfwidth{\the\pgf@x}%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfwidth%
+ \addtosavedmacro\halfheight%
+ %
+ \advance\pgf@x\outerxsep%
+ \edef\outerhalfwidth{\the\pgf@x}%
+ \addtosavedmacro\outerhalfwidth%
+ %
+ \pgf@xc\bendxradius%
+ \pgf@yc\bendyradius%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@xc}}%
+ \pgfmathatan{\pgfmathresult}%
+ \pgf@xc\pgfmathresult pt\relax%
+ \pgf@xc.5\pgf@xc%
+ \edef\halfangle{\pgfmath@tonumber{\pgf@xc}}%
+ \addtosavedmacro\halfangle%
+ %
+ \pgf@xc45pt\relax%
+ \advance\pgf@xc-\halfangle pt%
+ \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}%
+ \let\cothalfanglein\pgfmathresult%
+ \addtosavedmacro\cothalfanglein%
+ %
+ \pgf@xc90pt\relax%
+ \advance\pgf@xc-\halfangle pt%
+ \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}%
+ \let\cothalfangleout\pgfmathresult%
+ \addtosavedmacro\cothalfangleout%
+ %
+ }
+ \savedanchor{\centerpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor{\midpoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor{\basepoint}{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{\tapedimensions\midpoint\advance\pgf@x\outerhalfwidth}%
+ \anchor{mid west}{\tapedimensions\midpoint\advance\pgf@x-\outerhalfwidth}%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{\tapedimensions\basepoint\advance\pgf@x\outerhalfwidth}%
+ \anchor{base west}{\tapedimensions\basepoint\advance\pgf@x-\outerhalfwidth}%
+ \anchor{north}{%
+ \csname pgf@anchor@tape@north east\endcsname%
+ \pgf@ya\pgf@y%
+ \csname pgf@anchor@tape@north west\endcsname%
+ \advance\pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y.5\pgf@ya%
+ }
+ \anchor{south}{%
+ \csname pgf@anchor@tape@south east\endcsname%
+ \pgf@ya\pgf@y%
+ \csname pgf@anchor@tape@south west\endcsname%
+ \advance\pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y.5\pgf@ya%
+ }
+ \anchor{east}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x\outerhalfwidth%
+ }
+ \anchor{west}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x-\outerhalfwidth%
+ }
+ \anchor{north east}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x\outerhalfwidth%
+ \advance\pgf@y\halfheight%
+ \pgf@yc\outerysep%
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ \advance\pgf@y\halfbendheight%
+ \advance\pgf@y\cothalfangleout\pgf@yc%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ \advance\pgf@y\halfbendheight%
+ \advance\pgf@y\cothalfanglein\pgf@yc%
+ \else%
+ \advance\pgf@y\pgf@yc%
+ \fi%
+ \fi%
+ }%
+ \anchor{north west}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x-\outerhalfwidth%
+ \advance\pgf@y\halfheight%
+ \pgf@yc\outerysep%
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ \advance\pgf@y\halfbendheight%
+ \advance\pgf@y\cothalfanglein\pgf@yc%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ \advance\pgf@y\halfbendheight%
+ \advance\pgf@y\cothalfangleout\pgf@yc%
+ \else%
+ \advance\pgf@y\pgf@yc%
+ \fi%
+ \fi%
+ }%
+ \anchor{south east}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x\outerhalfwidth%
+ \advance\pgf@y-\halfheight%
+ \pgf@yc\outerysep%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ \advance\pgf@y-\halfbendheight%
+ \advance\pgf@y-\cothalfangleout\pgf@yc%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ \advance\pgf@y-\halfbendheight%
+ \advance\pgf@y-\cothalfanglein\pgf@yc%
+ \else%
+ \advance\pgf@y-\pgf@yc%
+ \fi%
+ \fi%
+ }%
+ \anchor{south west}{%
+ \tapedimensions%
+ \centerpoint%
+ \advance\pgf@x-\outerhalfwidth%
+ \advance\pgf@y-\halfheight%
+ \pgf@yc\outerysep%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ \advance\pgf@y-\halfbendheight%
+ \advance\pgf@y-\cothalfanglein\pgf@yc%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ \advance\pgf@y-\halfbendheight%
+ \advance\pgf@y-\cothalfangleout\pgf@yc%
+ \else%
+ \advance\pgf@y-\pgf@yc%
+ \fi%
+ \fi%
+ }%
+ \backgroundpath{%
+ \tapedimensions%
+ %
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ %
+ \pgf@xc\bendxradius%
+ \pgf@yc\bendyradius%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}%
+ \pgfpatharc{225}{315}{\bendxradius and \bendyradius}%
+ \pgfpatharc{135}{45}{\bendxradius and \bendyradius}%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}%
+ \pgfpatharc{135}{45}{\bendxradius and \bendyradius}%
+ \pgfpatharc{225}{315}{\bendxradius and \bendyradius}%
+ \else%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
+ \fi%
+ \fi%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
+ \ifx\bottombendstyle\pgf@lib@sh@inandouttext%
+ \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}%
+ \pgfpatharc{45}{135}{\bendxradius and \bendyradius}%
+ \pgfpatharc{315}{225}{\bendxradius and \bendyradius}%
+ \else%
+ \ifx\bottombendstyle\pgf@lib@sh@outandintext%
+ \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}%
+ \pgfpatharc{315}{225}{\bendxradius and \bendyradius}%
+ \pgfpatharc{45}{135}{\bendxradius and \bendyradius}%
+ \else%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
+ \fi%
+ \fi%
+ \pgfpathclose%
+ }%
+ }
+ \anchorborder{%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfextract@process\externalpoint{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \let\externalangle\pgfmathresult%
+ \tapedimensions%
+ %
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \ifdim\externalangle pt<90pt%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@north east\endcsname}%
+ {\csname pgf@anchor@tape@south east\endcsname}%
+ \else%
+ % Between north and north east.
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ % in and out.
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x.5\pgf@xc%
+ \advance\pgf@y\halfheight%
+ \advance\pgf@y\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y-.707106\pgf@yc%
+ }%
+ {5}{175}{\outerbendxradius and \outerbendyradius}%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ % out and in.
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x.5\pgf@xc%
+ \advance\pgf@y\halfheight%
+ \advance\pgf@y\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y.707106\pgf@yc%
+ }%
+ {185}{355}{\innerbendxradius and \innerbendyradius}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@north east\endcsname}%
+ {\csname pgf@anchor@tape@north west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ % Between north and north west.
+ \ifx\topbendstyle\pgf@lib@sh@inandouttext%
+ % in and out.
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x-.5\pgf@xc%
+ \advance\pgf@y\halfheight%
+ \advance\pgf@y\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y.707106\pgf@yc%
+ }%
+ {185}{355}{\innerbendxradius and \innerbendyradius}%
+ \else%
+ \ifx\topbendstyle\pgf@lib@sh@outandintext%
+ % out and in.
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x-.5\pgf@xc%
+ \advance\pgf@y\halfheight%
+ \advance\pgf@y\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y-.707106\pgf@yc%
+ }%
+ {5}{175}{\outerbendxradius and \outerbendyradius}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@north east\endcsname}%
+ {\csname pgf@anchor@tape@north west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south west\endcsname}%
+ \ifdim\externalangle pt>\pgfmathresult pt%
+ \ifdim\externalangle pt>270pt%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south east\endcsname}%
+ \ifdim\externalangle pt>\pgfmathresult pt%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@north east\endcsname}%
+ {\csname pgf@anchor@tape@south east\endcsname}%
+ \else%
+ % Between south and south east.
+ \ifx\bottombendstyle\pgf@lib@sh@inandouttext%
+ % in and out.
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x.5\pgf@xc%
+ \advance\pgf@y-\halfheight%
+ \advance\pgf@y-\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y-.707106\pgf@yc%
+ }%
+ {5}{175}{\innerbendxradius and \innerbendyradius}%
+ \else%
+ \ifx\bottombendstyle\pgf@lib@sh@outandintext%
+ % out and in.
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x.5\pgf@xc%
+ \advance\pgf@y-\halfheight%
+ \advance\pgf@y-\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y.707106\pgf@yc%
+ }%
+ {185}{355}{\outerbendxradius and \outerbendyradius}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@south east\endcsname}%
+ {\csname pgf@anchor@tape@south west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ % Between south and south west.
+ \ifx\bottombendstyle\pgf@lib@sh@inandouttext%
+ % in and out.
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x-.5\pgf@xc%
+ \advance\pgf@y-\halfheight%
+ \advance\pgf@y-\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y.707106\pgf@yc%
+ }%
+ {185}{355}{\outerbendxradius and \outerbendyradius}%
+ \else%
+ \ifx\bottombendstyle\pgf@lib@sh@outandintext%
+ % out and in.
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xc\halfwidth%
+ \advance\pgf@x-.5\pgf@xc%
+ \advance\pgf@y-\halfheight%
+ \advance\pgf@y-\halfbendheight%
+ \pgf@yc\bendyradius%
+ \advance\pgf@y-.707106\pgf@yc%
+ }%
+ {5}{175}{\innerbendxradius and \innerbendyradius}%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@south east\endcsname}%
+ {\csname pgf@anchor@tape@south west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@tape@north west\endcsname}%
+ {\csname pgf@anchor@tape@south west\endcsname}%
+ \fi%
+ \fi%
+ }%
+}
+
+
+
+
+% Keys for magnifying glass shape
+%
+% /pgf/magnifying glass handle angle : The angle of handle
+% /pgf/magnifying glass handle aspect : The length of the handle as a multiple
+% of the radius of the circle
+%
+
+\pgfkeys{/pgf/.cd,
+ magnifying glass handle angle/.initial=-45,
+ magnifying glass handle aspect/.initial=1.5
+}
+
+\pgfdeclareshape{magnifying glass}
+{
+ \inheritsavedanchors[from=circle] % this is nearly a circle
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritbackgroundpath[from=circle]
+ \foregroundpath{
+ \centerpoint%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima+\pgfutil@tempdima*(\pgfkeysvalueof{/pgf/magnifying glass handle aspect})}}}
+ }
+}
+
+