summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex842
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex265
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex520
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex212
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex2358
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex21
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex4419
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex1333
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex1097
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex2513
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex17
11 files changed, 13597 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex
new file mode 100644
index 00000000000..9de07884dd5
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex
@@ -0,0 +1,842 @@
+% 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/pgflibraryarrows.code.tex,v 1.7 2007/06/07 07:41:11 tantau Exp $
+
+
+% A square bracket shaped arrow
+
+\pgfarrowsdeclare{[}{]}
+{
+ \pgfutil@tempdima=1pt%
+ \advance\pgfutil@tempdima by1.25\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdima}
+ \pgfarrowsrightextend{+.5\pgflinewidth}
+}
+{
+ \pgfutil@tempdima=2pt%
+ \advance\pgfutil@tempdima by1.5\pgflinewidth%
+ \pgfutil@tempdimb=\pgfutil@tempdima%
+ \advance\pgfutil@tempdimb by\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfsetbuttcap
+ \pgfpathmoveto{\pgfqpoint{-.5\pgfutil@tempdimb}{-1\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-1\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-.5\pgfutil@tempdimb}{\pgfutil@tempdima}}
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclarereversed{]}{[}{[}{]}
+
+
+% A round bracket shaped arrow
+
+\pgfarrowsdeclare{(}{)}
+{
+ \pgfutil@tempdima=2pt%
+ \advance\pgfutil@tempdima by1.5\pgflinewidth%
+ \pgfutil@tempdimb=0.0625\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+ \pgfutil@tempdimb=0.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=2pt%
+ \advance\pgfutil@tempdima by1.5\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfqpoint{-.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{.25\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
+ {\pgfqpoint{.25\pgfutil@tempdima}{.5\pgfutil@tempdima}}
+ {\pgfqpoint{-.5\pgfutil@tempdima}{\pgfutil@tempdima}}
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclarereversed{)}{(}{(}{)}
+
+
+
+
+% A pointed bracket shaped arrow
+
+\pgfarrowsdeclare{angle 90}{angle 90}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by0.707\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpoint{-5.5\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-5.5\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclarereversed{angle 90 reversed}{angle 90 reversed}{angle 90}{angle 90}
+
+
+\pgfarrowsdeclare{angle 60}{angle 60}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{150}{9\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-150}{9\pgfutil@tempdima}}}
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclarereversed{angle 60 reversed}{angle 60 reversed}{angle 60}{angle 60}
+
+
+
+\pgfarrowsdeclare{angle 45}{angle 45}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=8.705\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.28\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.3pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{157}{10\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-157}{10\pgfutil@tempdima}}}
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclarereversed{angle 45 reversed}{angle 45 reversed}{angle 45}{angle 45}
+
+
+
+% A dot shaped arrow
+
+\pgfarrowsdeclare{*}{*}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb by\pgflinewidth
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=1.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfpathcircle{\pgfqpoint{-3\pgfutil@tempdima}{0pt}}{+4.5\pgfutil@tempdima}
+ \pgfusepathqfillstroke
+}
+
+
+% An open dot shaped arrow
+
+\pgfarrowsdeclare{o}{o}
+{
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfutil@tempdimb=9\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfpathcircle{\pgfqpoint{4.5\pgfutil@tempdima}{0bp}}{4.5\pgfutil@tempdima}
+ \pgfusepathqstroke
+}
+
+
+
+% A diamond shaped arrow
+
+\pgfarrowsdeclare{diamond}{diamond}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.275\pgflinewidth%
+ \pgfutil@tempdimb=13\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=1\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.275\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{1\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-6\pgfutil@tempdima}{4\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-13\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-6\pgfutil@tempdima}{-4\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfarrowsdeclare{open diamond}{open diamond}%{{-.5bp}{14.5bp}}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.275\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=14\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.275\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{14\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{7\pgfutil@tempdima}{4\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{7\pgfutil@tempdima}{-4\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+% A triangle shaped arrow
+
+\pgfarrowsdeclare{triangle 90}{triangle 90}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by0.707\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpoint{-5.5\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-5.5\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfarrowsdeclarereversed{triangle 90 reversed}{triangle 90 reversed}{triangle 90}{triangle 90}
+
+
+\pgfarrowsdeclare{triangle 60}{triangle 60}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{150}{9\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-150}{9\pgfutil@tempdima}}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfarrowsdeclarereversed{triangle 60 reversed}{triangle 60 reversed}{triangle 60}{triangle 60}
+
+
+
+
+\pgfarrowsdeclare{triangle 45}{triangle 45}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfutil@tempdimb=8.705\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.28\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{157}{10\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-157}{10\pgfutil@tempdima}}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfarrowsdeclarereversed{triangle 45 reversed}{triangle 45 reversed}{triangle 45}{triangle 45}
+
+
+
+
+\pgfarrowsdeclare{open triangle 90}{open triangle 90}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=6\pgfutil@tempdima\advance\pgfutil@tempdimb by0.707\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+\pgfarrowsdeclare{open triangle 90 reversed}{open triangle 90 reversed}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-.707\pgflinewidth}
+ \pgfutil@tempdimb=6\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{6\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+\pgfarrowsdeclare{open triangle 60}{open triangle 60}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=7.794\pgfutil@tempdima\advance\pgfutil@tempdimb by\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{7.794\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{150}{9\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{7.794\pgfutil@tempdima}{0pt}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{7.794\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-150}{9\pgfutil@tempdima}}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+\pgfarrowsdeclare{open triangle 60 reversed}{open triangle 60 reversed}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgflinewidth}
+ \pgfutil@tempdimb=7.794\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpointpolar{30}{9\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathlineto{\pgfqpointpolar{-30}{9\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+\pgfarrowsdeclare{open triangle 45}{open triangle 45}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=9.205\pgfutil@tempdima\advance\pgfutil@tempdimb by1.28\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{9.205\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{157}{10\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfqpoint{9.205\pgfutil@tempdima}{0pt}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{9.205\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-157}{10\pgfutil@tempdima}}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+\pgfarrowsdeclare{open triangle 45 reversed}{open triangle 45 reversed}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfarrowsleftextend{+-1.28\pgflinewidth}
+ \pgfutil@tempdimb=9.205\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.5pt%
+ \advance\pgfutil@tempdima by.25\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetmiterjoin
+ \pgfpathmoveto{\pgfqpointpolar{23}{10\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathlineto{\pgfqpointpolar{-23}{10\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+
+% A less fleshy variant of LaTeX's orginal arrow type
+
+\pgfarrowsdeclare{latex'}{latex'}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{+-4\pgfutil@tempdima}
+ \pgfarrowsrightextend{+6\pgfutil@tempdima}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
+ {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
+ {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
+ {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
+ {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
+ {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
+ {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfusepathqfill
+}
+
+\pgfarrowsdeclarereversed{latex' reversed}{latex' reversed}{latex'}{latex'}
+
+
+% A rounded variant of the stealth arrow
+
+\pgfarrowsdeclare{stealth'}{stealth'}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfutil@tempdimb=6\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=2\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{2\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
+ {\pgfqpoint{-3\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
+ {\pgfqpoint{-6\pgfutil@tempdima}{3.25\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-3\pgfutil@tempdima}{1\pgfutil@tempdima}}
+ {\pgfqpoint{-3\pgfutil@tempdima}{-1\pgfutil@tempdima}}
+ {\pgfqpoint{-6\pgfutil@tempdima}{-3.25\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-3\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
+ {\pgfqpoint{-.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
+ {\pgfqpoint{2\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfarrowsdeclarereversed{stealth' reversed}{stealth' reversed}{stealth'}{stealth'}
+
+
+
+% The two half of the $\to$ arrow
+
+\pgfarrowsdeclare{left to}{left to}
+{
+ \pgfutil@tempdima=-0.84pt%
+ \advance\pgfutil@tempdima by-1.3\pgflinewidth%
+ \pgfutil@tempdimb=0.21pt%
+ \advance\pgfutil@tempdimb by.625\pgflinewidth%
+ \pgfarrowsleftextend{+\pgfutil@tempdima}
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfsetlinewidth{0.8\pgflinewidth}
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-2.75\pgfutil@tempdima}{2.5\pgfutil@tempdima}}
+ {\pgfqpoint{0pt}{0.25\pgfutil@tempdima}}
+ {\pgfqpoint{0.75\pgfutil@tempdima}{0pt}}
+ \pgfpathcurveto
+ {\pgfqpoint{0.55\pgfutil@tempdima}{-0.125\pgflinewidth}}
+ {\pgfqpoint{0.5\pgfutil@tempdima}{-0.125\pgflinewidth}}
+ {\pgfqpoint{0.5\pgfutil@tempdima}{-0.125\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-0.125\pgflinewidth}}
+ \pgfusepathqstroke
+}
+
+
+\pgfarrowsdeclare{right to}{right to}
+{
+ \pgfutil@tempdima=-0.84pt%
+ \advance\pgfutil@tempdima by-1.3\pgflinewidth%
+ \pgfutil@tempdimb=0.21pt%
+ \advance\pgfutil@tempdimb by.625\pgflinewidth%
+ \pgfarrowsleftextend{+\pgfutil@tempdima}
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfsetlinewidth{0.8\pgflinewidth}
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{-3\pgfutil@tempdima}{-4\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-2.75\pgfutil@tempdima}{-2.5\pgfutil@tempdima}}
+ {\pgfqpoint{0pt}{-0.25\pgfutil@tempdima}}
+ {\pgfqpoint{0.75\pgfutil@tempdima}{0pt}}
+ \pgfpathcurveto
+ {\pgfqpoint{0.55\pgfutil@tempdima}{0.125\pgflinewidth}}
+ {\pgfqpoint{0.5\pgfutil@tempdima}{0.125\pgflinewidth}}
+ {\pgfqpoint{0.5\pgfutil@tempdima}{0.125\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{0pt}{0.125\pgflinewidth}}
+ \pgfusepathqstroke
+}
+
+
+
+% The halfs of the $\to$ arrow reversed
+
+\pgfarrowsdeclare{left to reversed}{left to reversed}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{+-.1\pgflinewidth}
+ \pgfutil@tempdimb=3.75\pgfutil@tempdima\advance\pgfutil@tempdimb by0.9\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfsetbuttcap
+ \pgfpathmoveto{\pgfqpoint{0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfqpoint{-0.1\pgflinewidth}{0pt}}
+ \pgfusepathqstroke
+ \pgfsetroundcap
+ \pgfsetlinewidth{.8\pgflinewidth}
+ {\pgftransformxshift{0.625\pgflinewidth}
+ \pgfpathmoveto{\pgfqpoint{3.75\pgfutil@tempdima}{4\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.5\pgfutil@tempdima}{2.5\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{0.25\pgfutil@tempdima}}{\pgfqpoint{0pt}{0.125\pgflinewidth}}
+ \pgfpathmoveto{\pgfqpoint{3.75\pgfutil@tempdima}{4\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.5\pgfutil@tempdima}{2.5\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{0.25\pgfutil@tempdima}}{\pgfqpoint{0pt}{-0.125\pgflinewidth}}
+ }
+ \pgfusepathqstroke%
+}
+
+\pgfarrowsdeclare{right to reversed}{right to reversed}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{+-.1\pgflinewidth}
+ \pgfutil@tempdimb=3.75\pgfutil@tempdima\advance\pgfutil@tempdimb by0.9\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.28pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfsetbuttcap
+ \pgfpathmoveto{\pgfqpoint{0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfqpoint{-0.1\pgflinewidth}{0pt}}
+ \pgfusepathqstroke
+ \pgfsetroundcap
+ \pgfsetlinewidth{.8\pgflinewidth}
+ {\pgftransformxshift{0.625\pgflinewidth}
+ \pgfpathmoveto{\pgfqpoint{3.75\pgfutil@tempdima}{-4\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.5\pgfutil@tempdima}{-2.5\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{-0.25\pgfutil@tempdima}}{\pgfqpoint{0pt}{-0.125\pgflinewidth}}
+ \pgfpathmoveto{\pgfqpoint{3.75\pgfutil@tempdima}{-4\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.5\pgfutil@tempdima}{-2.5\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{-0.25\pgfutil@tempdima}}{\pgfqpoint{0pt}{0.125\pgflinewidth}}
+ }
+ \pgfusepathqstroke%
+}
+
+
+
+% A left hook
+
+\pgfarrowsdeclare{left hook}{left hook}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=3.75\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.75\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{2.415\pgfutil@tempdima}{0\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{1.665\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{3\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.75\pgfutil@tempdima}{4.665\pgfutil@tempdima}}{\pgfqpoint{2.415\pgfutil@tempdima}{6\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfusepathqstroke%
+}
+
+\pgfarrowsdeclarereversed{left hook reversed}{left hook reversed}{left hook}{left hook}
+
+
+
+% A right hook
+
+\pgfarrowsdeclare{right hook}{right hook}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=3.75\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.75\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{2.415\pgfutil@tempdima}{0\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{-1.665\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{-3\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.75\pgfutil@tempdima}{-4.665\pgfutil@tempdima}}{\pgfqpoint{2.415\pgfutil@tempdima}{-6\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfusepathqstroke%
+}
+
+\pgfarrowsdeclarereversed{right hook reversed}{right hook reversed}{right hook}{right hook}
+
+
+% Hooks in both directions
+
+\pgfarrowsdeclare{hooks}{hooks}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \pgfutil@tempdimb=3.75\pgfutil@tempdima\advance\pgfutil@tempdimb by0.5\pgflinewidth%
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.75\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{2.415\pgfutil@tempdima}{0\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{1.665\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{3\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.75\pgfutil@tempdima}{4.665\pgfutil@tempdima}}{\pgfqpoint{2.415\pgfutil@tempdima}{6\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{6\pgfutil@tempdima}}
+ \pgfpathmoveto{\pgfqpoint{0.75\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{2.415\pgfutil@tempdima}{0\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{-1.665\pgfutil@tempdima}}{\pgfqpoint{3.75\pgfutil@tempdima}{-3\pgfutil@tempdima}}
+ \pgfpathcurveto{\pgfqpoint{3.75\pgfutil@tempdima}{-4.665\pgfutil@tempdima}}{\pgfqpoint{2.415\pgfutil@tempdima}{-6\pgfutil@tempdima}}{\pgfqpoint{0.75\pgfutil@tempdima}{-6\pgfutil@tempdima}}
+ \pgfusepathqstroke%
+}
+
+\pgfarrowsdeclarereversed{hooks reversed}{hooks reversed}{hooks}{hooks}
+
+
+% An arrow that looks like a serif of the computer modern font
+
+\pgfarrowsdeclare{serif cm}{serif cm}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.45\pgflinewidth%
+ \pgfarrowsleftextend{+-.75\pgfutil@tempdima}
+ \pgfarrowsrightextend{+.04\pgflinewidth}
+}
+{
+ \pgfutil@tempdima=0.4pt%
+ \advance\pgfutil@tempdima by.45\pgflinewidth%
+ \pgftransformxshift{.04\pgflinewidth}
+ \pgfpathmoveto{\pgfqpoint{-.75\pgfutil@tempdima}{.5\pgflinewidth}}
+ \pgfpathcurveto
+ {\pgfqpoint{-.375\pgfutil@tempdima}{.5\pgflinewidth}}
+ {\pgfqpoint{-.375\pgfutil@tempdima}{.7\pgflinewidth}}
+ {\pgfqpoint{-.375\pgfutil@tempdima}{1.95\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0pt}{1.95\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-.04\pgflinewidth}{.5\pgfutil@tempdima}}
+ {\pgfqpoint{-.04\pgflinewidth}{-.5\pgfutil@tempdima}}
+ {\pgfqpoint{0pt}{-1.95\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-.375\pgfutil@tempdima}{-1.95\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-.375\pgfutil@tempdima}{-.7\pgflinewidth}}
+ {\pgfqpoint{-.375\pgfutil@tempdima}{-.5\pgflinewidth}}
+ {\pgfqpoint{-.75\pgfutil@tempdima}{-.5\pgflinewidth}}
+ \pgfpathclose
+ \pgfusepathqfill
+}
+
+
+
+% Round cap
+
+\pgfarrowsdeclare{round cap}{round cap}
+{\pgfarrowsleftextend{+0pt}\pgfarrowsrightextend{+\pgflinewidth}}
+{
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0pt}}
+ \pgfusepathqstroke
+}
+
+
+% Butt cap
+
+\pgfarrowsdeclare{butt cap}{butt cap}
+{\pgfarrowsleftextend{+-.1\pgflinewidth}\pgfarrowsrightextend{+.5\pgflinewidth}}
+{
+ \pgfsetdash{}{+0pt}
+ \pgfsetbuttcap
+ \pgfpathmoveto{\pgfqpoint{-.1\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0pt}}
+ \pgfusepathqstroke
+}
+
+
+
+% 90 degrees cap
+
+\pgfarrowsdeclare{triangle 90 cap}{triangle 90 cap}
+{\pgfarrowsleftextend{+-.1\pgflinewidth}\pgfarrowsrightextend{+\pgflinewidth}}
+{
+ \pgfpathmoveto{\pgfqpoint{-.1\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}}
+ \pgfusepathqfill
+}
+
+
+% reversed 90 degrees cap
+
+\pgfarrowsdeclare{triangle 90 cap reversed}{triangle 90 cap reversed}
+{\pgfarrowsleftextend{+-.1\pgflinewidth}\pgfarrowsrightextend{+\pgflinewidth}}
+{
+ \pgfpathmoveto{\pgfqpoint{1\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0\pgflinewidth}}
+ \pgfusepathqfill
+}
+
+
+
+% fast
+
+\pgfarrowsdeclare{fast cap}{fast cap}
+{\pgfarrowsleftextend{+-.1\pgflinewidth}\pgfarrowsrightextend{+2\pgflinewidth}}
+{
+ \pgfpathmoveto{\pgfqpoint{-.1\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}}
+ \pgfpathclose
+ \pgfpathmoveto{\pgfqpoint{1\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{2\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{-0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathclose
+ \pgfusepathqfill
+}
+
+
+\pgfarrowsdeclare{fast cap reversed}{fast cap reversed}
+{\pgfarrowsleftextend{+-.1\pgflinewidth}\pgfarrowsrightextend{+2\pgflinewidth}}
+{
+ \pgfpathmoveto{\pgfqpoint{-.1\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}}
+ \pgfpathclose
+ \pgfpathmoveto{\pgfqpoint{1.5\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{2\pgflinewidth}{0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{2\pgflinewidth}{-.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{-0.5\pgflinewidth}}
+ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{0\pgflinewidth}}
+ \pgfpathclose
+ \pgfusepathqfill
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex
new file mode 100644
index 00000000000..c9c29958585
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex
@@ -0,0 +1,265 @@
+% 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/pgflibrarypatterns.code.tex,v 1.12 2008/01/15 10:27:34 tantau Exp $
+
+
+% Lines in different directions
+
+\pgfdeclarepatternformonly{horizontal lines}{\pgfpointorigin}{\pgfqpoint{100pt}{1pt}}{\pgfqpoint{100pt}{3pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{0pt}{0.5pt}}
+ \pgfpathlineto{\pgfqpoint{100pt}{0.5pt}}
+ \pgfusepath{stroke}
+}
+
+\pgfdeclarepatternformonly{vertical lines}{\pgfpointorigin}{\pgfqpoint{1pt}{100pt}}{\pgfqpoint{3pt}{100pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{0.5pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0.5pt}{100pt}}
+ \pgfusepath{stroke}
+}
+
+\pgfdeclarepatternformonly{north east lines}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{4pt}{4pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{3.1pt}{3.1pt}}
+ \pgfusepath{stroke}
+}
+
+\pgfdeclarepatternformonly{north west lines}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{4pt}{4pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{0pt}{3pt}}
+ \pgfpathlineto{\pgfqpoint{3.1pt}{-0.1pt}}
+ \pgfusepath{stroke}
+}
+
+% Crossed lines in different directions
+
+\pgfdeclarepatternformonly{grid}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{4pt}{4pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{3.1pt}}
+ \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{3.1pt}{0pt}}
+ \pgfusepath{stroke}
+}
+
+\pgfdeclarepatternformonly{crosshatch}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{4pt}{4pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfsetlinewidth{0.4pt}
+ \pgfpathmoveto{\pgfqpoint{3.1pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{3.1pt}}
+ \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfqpoint{3.1pt}{3.1pt}}
+ \pgfusepath{stroke}
+}
+
+
+% Dotted regions
+
+\pgfdeclarepatternformonly{dots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatternformonly{crosshatch dots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{2.5pt}{2.5pt}}{\pgfqpoint{3pt}{3pt}}%
+{
+ \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}
+ \pgfpathcircle{\pgfqpoint{1.5pt}{1.5pt}}{.5pt}
+ \pgfusepath{fill}
+}
+
+
+
+
+% Star shaped patterns
+
+\pgfdeclarepatternformonly{fivepointed stars}{\pgfpointorigin}{\pgfqpoint{3mm}{3mm}}{\pgfqpoint{3mm}{3mm}}%
+{
+ \pgftransformshift{\pgfqpoint{1mm}{1mm}}
+ \pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{162}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{306}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{90}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{234}{1mm}}
+ \pgfpathclose%
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatternformonly{sixpointed stars}{\pgfpointorigin}{\pgfqpoint{3mm}{3mm}}{\pgfqpoint{3mm}{3mm}}%
+{
+ \pgftransformshift{\pgfqpoint{1mm}{1mm}}
+ \pgfpathmoveto{\pgfqpointpolar{30}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{150}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{270}{1mm}}
+ \pgfpathclose%
+ \pgfpathmoveto{\pgfqpointpolar{-30}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{-270}{1mm}}
+ \pgfpathlineto{\pgfqpointpolar{-150}{1mm}}
+ \pgfpathclose%
+ \pgfsetnonzerorule
+ \pgfusepath{fill}
+}
+
+
+
+% Bricks
+
+\pgfdeclarepatternformonly{bricks}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{5mm}{5mm}}{\pgfqpoint{4mm}{4mm}}%
+{
+ \pgfsetlinewidth{0.8pt}
+ \pgfpathmoveto{\pgfqpoint{0mm}{1mm}}
+ \pgfpathlineto{\pgfqpoint{4mm}{1mm}}
+ \pgfpathmoveto{\pgfqpoint{0mm}{3mm}}
+ \pgfpathlineto{\pgfqpoint{4mm}{3mm}}
+ \pgfpathmoveto{\pgfqpoint{1mm}{0mm}}
+ \pgfpathlineto{\pgfqpoint{1mm}{1mm}}
+ \pgfpathmoveto{\pgfqpoint{3mm}{1mm}}
+ \pgfpathlineto{\pgfqpoint{3mm}{3mm}}
+ \pgfpathmoveto{\pgfqpoint{1mm}{3mm}}
+ \pgfpathlineto{\pgfqpoint{1mm}{4mm}}
+ \pgfusepath{stroke}
+}
+
+
+% Checkerboards
+
+\pgfdeclarepatternformonly{checkerboard}{\pgfpointorigin}{\pgfqpoint{4mm}{4mm}}{\pgfqpoint{4mm}{4mm}}%
+{
+ \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{2mm}{2mm}}
+ \pgfpathrectangle{\pgfqpoint{2mm}{2mm}}{\pgfqpoint{2mm}{2mm}}
+ \pgfusepath{fill}
+}
+
+
+
+% Backgrounds
+
+\pgfdeclarepatterninherentlycolored{checkerboard light gray}
+{\pgfpointorigin}{\pgfqpoint{4mm}{4mm}}{\pgfqpoint{4mm}{4mm}}%
+{
+ \pgfsetfillcolor{black!10}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{4.1mm}{4.1mm}}% make
+ % slightly larger to ensure that tiles
+ % are really solid
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!20}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{2mm}{2mm}}
+ \pgfpathrectangle{\pgfqpoint{2mm}{2mm}}{\pgfqpoint{2mm}{2mm}}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatterninherentlycolored{horizontal lines light gray}
+{\pgfpointorigin}{\pgfpoint{100pt}{4pt}}
+{\pgfpoint{100pt}{4pt}}
+{
+ \pgfsetfillcolor{black!10}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!15}
+ \pgfpathrectangle{\pgfpoint{0pt}{2pt}}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatterninherentlycolored{horizontal lines gray}
+{\pgfpointorigin}{\pgfpoint{100pt}{4pt}}
+{\pgfpoint{100pt}{4pt}}
+{
+ \pgfsetfillcolor{black!30}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!35}
+ \pgfpathrectangle{\pgfpoint{0pt}{2pt}}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatterninherentlycolored{horizontal lines dark gray}
+{\pgfpointorigin}{\pgfpoint{100pt}{4pt}}
+{\pgfpoint{100pt}{4pt}}
+{
+ \pgfsetfillcolor{black!90}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!85}
+ \pgfpathrectangle{\pgfpoint{0pt}{2pt}}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatterninherentlycolored{horizontal lines light blue}
+{\pgfpointorigin}{\pgfpoint{100pt}{4pt}}
+{\pgfpoint{100pt}{4pt}}
+{
+ \pgfsetfillcolor{blue!10}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{blue!15}
+ \pgfpathrectangle{\pgfpoint{0pt}{2pt}}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+}
+
+\pgfdeclarepatterninherentlycolored{horizontal lines dark blue}
+{\pgfpointorigin}{\pgfpoint{100pt}{4pt}}
+{\pgfpoint{100pt}{4pt}}
+{
+ \pgfsetfillcolor{blue!90}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{blue!85}
+ \pgfpathrectangle{\pgfpoint{0pt}{2pt}}{\pgfpoint{100pt}{2.5pt}}
+ \pgfusepath{fill}
+}
+
+
+\pgfdeclarepatterninherentlycolored{crosshatch dots gray}
+{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
+{\pgfpoint{8pt}{8pt}}
+{
+ \pgfsetfillcolor{black!20}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!10}
+ \pgfpathcircle{\pgfpoint{2pt}{1.75pt}}{1pt}
+ \pgfpathcircle{\pgfpoint{6pt}{5.75pt}}{1pt}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!70}
+ \pgfpathcircle{\pgfpoint{2pt}{2.25pt}}{1pt}
+ \pgfpathcircle{\pgfpoint{6pt}{6.25pt}}{1pt}
+ \pgfusepath{fill}
+}
+
+\pgfutil@definecolor{pgf@lightsteelblue}{rgb}{0.6875,0.765625,0.8671875}
+
+\pgfdeclarepatterninherentlycolored{crosshatch dots light steel blue}
+{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
+{\pgfpoint{8pt}{8pt}}
+{
+ \pgfsetfillcolor{pgf@lightsteelblue}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!80!pgf@lightsteelblue!10}
+ \pgfpathcircle{\pgfpoint{2pt}{1.75pt}}{1pt}
+ \pgfpathcircle{\pgfpoint{6pt}{5.75pt}}{1pt}
+ \pgfusepath{fill}
+ \pgfsetfillcolor{black!80!pgf@lightsteelblue!70}
+ \pgfpathcircle{\pgfpoint{2pt}{2.25pt}}{1pt}
+ \pgfpathcircle{\pgfpoint{6pt}{6.25pt}}{1pt}
+ \pgfusepath{fill}
+}
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
new file mode 100644
index 00000000000..a0f504431eb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
@@ -0,0 +1,520 @@
+% 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/pgflibraryplothandlers.code.tex,v 1.9 2007/03/09 17:49:32 tantau Exp $
+
+\newif\ifpgf@plot@started
+
+
+% This handler converts each plot stream command into a curveto
+% command, except for the first, which is converted to the previously
+% specified action.
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointorigin}
+% \pgfsetlinetofirstplotpoint
+% \pgfplothandlercurveto
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlercurveto{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@initial%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgf@plot@curveto@handler@finish%
+ \global\pgf@plot@startedfalse%
+ }%
+}
+
+\def\pgf@plot@curveto@handler@initial#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@plot@first@action{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \xdef\pgf@plot@curveto@first{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \global\let\pgf@plot@curveto@first@support=\pgf@plot@curveto@first%
+ \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@second%
+}
+
+\def\pgf@plot@curveto@handler@second#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@curveto@second{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@third%
+ \global\pgf@plot@startedtrue%
+}
+
+\def\pgf@plot@curveto@handler@third#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@curveto@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % compute difference vector:
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgf@plot@curveto@first}
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ % compute support directions:
+ \pgf@xa=\pgf@plottension\pgf@xa%
+ \pgf@ya=\pgf@plottension\pgf@ya%
+ % first marshal:
+ \pgf@process{\pgf@plot@curveto@second}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xb by-\pgf@xa%
+ \advance\pgf@yb by-\pgf@ya%
+ \advance\pgf@xc by\pgf@xa%
+ \advance\pgf@yc by\pgf@ya%
+ \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@curveto@first@support}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@curveto@second}}%
+ {\pgf@marshal}%
+ % Prepare next:
+ \global\let\pgf@plot@curveto@first=\pgf@plot@curveto@second%
+ \global\let\pgf@plot@curveto@second=\pgf@plot@curveto@current%
+ \xdef\pgf@plot@curveto@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+}
+
+\def\pgf@plot@curveto@handler@finish{%
+ \ifpgf@plot@started%
+ \pgfpathcurveto{\pgf@plot@curveto@first@support}{\pgf@plot@curveto@second}{\pgf@plot@curveto@second}%
+ \fi%
+}
+
+
+% This commands sets the tension for smoothing of plots.
+%
+% #1 = tension of curves. A value of 1 will yield a circle when the
+% control points are at quarters of a circle. A smaller value
+% will result in a tighter curve. Default is 0.5.
+%
+% Example:
+%
+% \pgfsetplottension{0.2}
+
+\def\pgfsetplottension#1{%
+ \pgf@x=#1pt\relax%
+ \pgf@x=0.2775\pgf@x\relax%
+ \edef\pgf@plottension{\pgf@sys@tonumber\pgf@x}}
+\pgfsetplottension{0.5}
+
+
+% This handler converts the plot stream command into a curveto
+% command that is closed using a closepath.
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointorigin}
+% \pgfplothandlerclosedcurve
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlerclosedcurve{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@initial%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgf@plot@closedcurve@handler@finish%
+ }%
+}
+
+\def\pgf@plot@closedcurve@handler@initial#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \xdef\pgf@plot@closedcurve@initial{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@second%
+ \global\pgf@plot@startedfalse%
+}
+
+\def\pgf@plot@closedcurve@handler@second#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@closedcurve@after@initial{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ {\pgfpathmoveto{}}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@third%
+}
+
+\def\pgf@plot@closedcurve@handler@third#1{%
+ \global\pgf@plot@startedtrue%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@closedcurve@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % compute difference vector:
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgf@plot@closedcurve@initial}
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ % compute support directions:
+ \pgf@xa=\pgf@plottension\pgf@xa%
+ \pgf@ya=\pgf@plottension\pgf@ya%
+ % first marshal:
+ \pgf@process{\pgf@plot@closedcurve@after@initial}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xb by-\pgf@xa%
+ \advance\pgf@yb by-\pgf@ya%
+ \advance\pgf@xc by\pgf@xa%
+ \advance\pgf@yc by\pgf@ya%
+ \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@after@initial%
+ \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current%
+ \xdef\pgf@plot@closedcurve@after@initial@presupport{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}%
+ \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@fourth%
+}
+
+\def\pgf@plot@closedcurve@handler@fourth#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@closedcurve@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % compute difference vector:
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgf@plot@closedcurve@first}
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ % compute support directions:
+ \pgf@xa=\pgf@plottension\pgf@xa%
+ \pgf@ya=\pgf@plottension\pgf@ya%
+ % first marshal:
+ \pgf@process{\pgf@plot@closedcurve@second}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xb by-\pgf@xa%
+ \advance\pgf@yb by-\pgf@ya%
+ \advance\pgf@xc by\pgf@xa%
+ \advance\pgf@yc by\pgf@ya%
+ \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}%
+ {\pgf@marshal}%
+ % Prepare next:
+ \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@second%
+ \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current%
+ \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+}
+
+\def\pgf@plot@closedcurve@handler@finish{%
+ \ifpgf@plot@started
+ %
+ % first, draw line from 2nd last to last:
+ %
+ \pgf@process{\pgf@plot@closedcurve@initial}%
+ % compute difference vector:
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgf@plot@closedcurve@first}%
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ % compute support directions:
+ \pgf@xa=\pgf@plottension\pgf@xa%
+ \pgf@ya=\pgf@plottension\pgf@ya%
+ % first marshal:
+ \pgf@process{\pgf@plot@closedcurve@second}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xb by-\pgf@xa%
+ \advance\pgf@yb by-\pgf@ya%
+ \advance\pgf@xc by\pgf@xa%
+ \advance\pgf@yc by\pgf@ya%
+ \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}%
+ {\pgf@marshal}%
+ \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ %
+ % second, draw line from last point to start:
+ %
+ \pgf@process{\pgf@plot@closedcurve@after@initial}%
+ % compute difference vector:
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgf@plot@closedcurve@second}%
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ % compute support directions:
+ \pgf@xa=\pgf@plottension\pgf@xa%
+ \pgf@ya=\pgf@plottension\pgf@ya%
+ % first marshal:
+ \pgf@process{\pgf@plot@closedcurve@initial}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xb by-\pgf@xa%
+ \advance\pgf@yb by-\pgf@ya%
+ \advance\pgf@xc by\pgf@xa%
+ \advance\pgf@yc by\pgf@ya%
+ \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@initial}}%
+ {\pgf@marshal}%
+ %
+ % third, draw line from first to second point:
+ %
+ \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ {\noexpand\pgf@plot@closedcurve@after@initial@presupport}{\noexpand\pgf@plot@closedcurve@after@initial}}%
+ {\pgf@marshal}%
+ \pgfpathclose%
+ \fi%
+}
+
+
+
+
+
+% This handler converts each point in a stream into a line from the
+% $y$-axis to the given points coordinate, resulting in a
+% ``comb.''
+%
+% Example:
+%
+% \pgfplothandlerxcomb
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlerxcomb{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+
+\def\pgf@plot@xcomb@handler#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgf@ya}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+}
+
+
+% This handler converts each point in a stream into a line from the
+% $x$-axis straight up to the given points coordinate, resulting in a
+% ``comb.''
+%
+% Example:
+%
+% \pgfplothandlerycomb
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlerycomb{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+
+\def\pgf@plot@ycomb@handler#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+}
+
+
+
+
+
+
+% This handler converts each point in a stream into a line from the
+% origin to the point's coordinate, resulting in a ``star''.
+%
+% Example:
+%
+% \pgfplothandlerpolarcomb
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlerpolarcomb{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@polarcomb@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+
+\def\pgf@plot@polarcomb@handler#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgfpathmoveto{\pgfpointorigin}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+}
+
+
+
+
+% This handler draws a given mark at each point.
+%
+% #1 = some code to be executed at each point (with the coordinate
+% system translated to that point).
+% Typically, this code will be \pgfuseplotmark{whatever}.
+%
+% Example:
+%
+% \pgfplothandlermark{\pgfuseplotmark{*}}
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlermark#1{%
+ \pgf@plothandlermark{%
+ \ifnum\pgf@plot@mark@count<\pgf@plot@mark@repeat\relax%
+ \else%
+ \global\pgf@plot@mark@count=0\relax%
+ #1%
+ \fi%
+ }%
+}
+
+\newcount\pgf@plot@mark@count
+\def\pgf@plot@mark@phase{0}
+
+\def\pgf@plothandlermark#1{%
+ \def\pgf@plot@mark{#1}%
+ \def\pgf@plotstreamstart{%
+ \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax%
+ \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax%
+ \global\let\pgf@plotstreampoint=\pgf@plot@mark@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+
+\def\pgf@plot@mark@handler#1{%
+ \global\advance\pgf@plot@mark@count by1\relax%
+ {\pgftransformshift{#1}\pgf@plot@mark}%
+}
+
+
+% Set the repeat count for marks. For example, if 3 is given as a
+% value, only every third point will get a mark.
+%
+% #1 = repeat count
+%
+% Example:
+%
+% \pgfsetplotmarkrepeat{2}
+
+\def\pgfsetplotmarkrepeat#1{\def\pgf@plot@mark@repeat{#1}}
+\pgfsetplotmarkrepeat{1}
+
+
+% Set the phase for marks. For example, if 3 is the repeat and 3 is
+% the phase, already the first point will be marked.
+%
+% #1 = the index of the first point that should be marked.
+%
+% Example:
+%
+% \pgfsetplotmarkphase{3}
+
+\def\pgfsetplotmarkphase#1{\def\pgf@plot@mark@phase{#1}}
+\pgfsetplotmarkphase{1}
+
+
+
+% This handler draws a given mark at those points whose number is
+% given in the (pgffor-like) list.
+%
+% #1 = some code to be executed at each point (with the coordinate
+% system translated to that point).
+% Typically, this code will be \pgfuseplotmark{whatever}.
+% #2 = list of positions like "1,2,4,...,9,10"
+%
+% Example:
+%
+% \pgfplothandlermarklisted{\pgfuseplotmark{*}}{1,2,4,...,9}
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlermarklisted#1#2{%
+ \let\pgf@plot@mark@list=\pgfutil@empty%
+ \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}}
+ \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}%
+ \pgf@plothandlermark{%
+ \edef\pgf@marshal{\noexpand\pgfutil@in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}%
+ \pgf@marshal%
+ \ifpgfutil@in@#1\fi}%
+}
+
+
+% Define a new plot mark for use with \pgfplotmark.
+%
+% #1 = a plot mark mnemonic
+% #2 = code for drawing the mark
+%
+% Example:
+%
+% \pgfdeclareplotmark{*}{\pgfpathcircle{\pgfpointorigin}{2pt}\pgfusepathqfill}
+
+\def\pgfdeclareplotmark#1#2{\expandafter\def\csname pgf@plot@mark@#1\endcsname{#2}}
+
+
+% Set the size of plot marks. For circles, this will be the radius,
+% for other shapes it should be about half the width/height.
+%
+% Example:
+%
+% \pgfsetplotmarksize{1pt}
+
+\def\pgfsetplotmarksize#1{\pgfmathsetlength\pgfplotmarksize{#1}}
+
+\newdimen\pgfplotmarksize
+\pgfplotmarksize=2pt
+
+
+% Insert a plot mark's code at the origin.
+%
+% #1 = plot mark mnemonic
+%
+% Example:
+%
+% \pgfuseplotmark{*}
+
+\def\pgfuseplotmark#1{\csname pgf@plot@mark@#1\endcsname}
+
+
+% A stroke-filled circle mark
+
+\pgfdeclareplotmark{*}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfusepathqfillstroke
+}
+
+
+% A plus-sign like mark
+
+\pgfdeclareplotmark{+}
+{%
+ \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+
+% An x-shaped mark
+
+\pgfdeclareplotmark{x}
+{%
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+% See pgflibraryplotmarks for more plot marks
+
+
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex
new file mode 100644
index 00000000000..e20805d50a1
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex
@@ -0,0 +1,212 @@
+% 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/pgflibraryplotmarks.code.tex,v 1.5 2007/03/09 17:49:32 tantau Exp $
+
+
+% A stroked circle mark
+
+\pgfdeclareplotmark{o}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfusepathqstroke
+}
+
+
+
+% A six-pointed star mark
+
+\pgfdeclareplotmark{asterisk}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{210}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{-30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-210}{\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+
+% A five-pointed star mark
+
+\pgfdeclareplotmark{star}
+{%
+ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{18}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{-54}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+
+% An \oplus mark
+
+\pgfdeclareplotmark{oplus}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+\pgfdeclareplotmark{oplus*}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfusepathqfillstroke
+}
+
+
+% An \otimes mark
+
+\pgfdeclareplotmark{otimes}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+\pgfdeclareplotmark{otimes*}
+{%
+ \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize}
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}
+ \pgfusepathqfillstroke
+}
+
+
+% A vertical bar mark
+
+\pgfdeclareplotmark{|}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+
+
+% A horizontal bar mark
+
+\pgfdeclareplotmark{-}
+{%
+ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}
+ \pgfusepathqstroke
+}
+
+
+% A square stroked mark
+
+\pgfdeclareplotmark{square}
+{%
+ \pgfpathrectangle{\pgfqpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfqpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}%
+ \pgfusepathqstroke
+}
+
+% A square stroked-filled mark
+
+\pgfdeclareplotmark{square*}
+{%
+ \pgfpathrectangle{\pgfqpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfqpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}%
+ \pgfusepathqfillstroke
+}
+
+
+% A triangle mark
+
+\pgfdeclareplotmark{triangle}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-150}{\pgfplotmarksize}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+% A stroke-filled triangle mark
+
+\pgfdeclareplotmark{triangle*}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-150}{\pgfplotmarksize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+
+
+% A diamond-shaped mark
+
+\pgfdeclareplotmark{diamond}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+% A stroke-filled diamond-shaped mark
+
+\pgfdeclareplotmark{diamond*}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+
+
+% A pentagon-shaped mark
+
+\pgfdeclareplotmark{pentagon}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{18}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-54}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+% A stroke-filled pentagon-shaped mark
+
+\pgfdeclareplotmark{pentagon*}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{18}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{-54}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex
new file mode 100644
index 00000000000..a188ad2871e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/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/pgflibraryshapes.arrows.code.tex,v 1.3 2007/11/10 09:16:33 vibrovski 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/pgflibraryshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex
new file mode 100644
index 00000000000..02d4956235c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/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/pgflibraryshapes.code.tex,v 1.14 2007/12/17 16:20:50 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/pgflibraryshapes.geometric.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex
new file mode 100644
index 00000000000..2f11e6a4fd2
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/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/pgflibraryshapes.geometric.code.tex,v 1.22 2008/02/01 17:09:04 vibrovski 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@{\the\pgf@xa}{\the\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/pgflibraryshapes.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex
new file mode 100644
index 00000000000..62e488dc79a
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex
@@ -0,0 +1,1333 @@
+% 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/pgflibraryshapes.misc.code.tex,v 1.10 2008/02/12 18:02:25 tantau 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}
+ }
+}
+
+\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/.code={/pgf/rounded rectangle east arc=#1},%
+ rounded rectangle arc length/.initial=180%
+}%
+
+\def\pgf@lib@shapes@roundedrectangle@concave{concave}%
+\def\pgf@lib@shapes@roundedrectangle@convex{convex}%
+
+\pgfdeclareshape{rounded rectangle}{
+ \savedmacro\leftarc{%
+ \edef\leftarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
+ }
+ \savedmacro\rightarc{%
+ \edef\rightarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
+ }
+ \savedmacro\roundedrectanglepoints{%
+ %
+ % Get half the arc angle.
+ %
+ \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}}%
+ \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 for minimum height
+ %
+ %
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@y<.5\pgf@yb%
+ \pgf@y.5\pgf@yb%
+ \fi%
+ %
+ % Calculate the radii xa & ya of the arc ends.
+ %
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}%
+ \pgfutil@tempdima.5\pgfutil@tempdima%
+ \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@ya\pgfmathresult\pgf@y%
+ \pgf@xa\pgf@ya%
+ %
+ % Calculate the width of the arc end.
+ %
+ \pgfmathcos@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgf@xb-\pgfmathresult\pgf@xa%
+ \advance\pgf@xb\pgf@xa\relax%
+ \edef\arcwidth{\the\pgf@xb}%
+ \addtosavedmacro{\arcwidth}%
+ %
+ % Adjust for minimum width
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \advance\pgf@x\arcwidth\relax%
+ \ifdim\pgf@x<.5\pgf@xb%
+ \pgf@x.5\pgf@xb%
+ \fi%
+ \advance\pgf@x-\arcwidth\relax%
+ %
+ % Get the outer sep.
+ %
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\outerxsep{\the\pgf@xb}%
+ \edef\outerysep{\the\pgf@yb}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ %
+ \edef\xpathradius{\the\pgf@xa}%
+ \edef\ypathradius{\the\pgf@ya}%
+ \addtosavedmacro\xpathradius%
+ \addtosavedmacro\ypathradius%
+ %
+ \advance\pgf@xa\pgf@xb%
+ \advance\pgf@ya\pgf@yb%
+ \edef\xradius{\the\pgf@xa}%
+ \edef\yradius{\the\pgf@ya}%
+ \addtosavedmacro\xradius%
+ \addtosavedmacro\yradius%
+ %
+ \advance\pgf@xa-2.0\pgf@xb%
+ \advance\pgf@ya-2.0\pgf@yb%
+ \edef\xinnerradius{\the\pgf@xa}%
+ \edef\yinnerradius{\the\pgf@ya}%
+ \addtosavedmacro\xinnerradius%
+ \addtosavedmacro\yinnerradius%
+ %
+ \pgfextract@process\pathcornernoarc{}%
+ \addtosavedmacro\pathcornernoarc%
+ %
+ \pgfextract@process\pathcornerconvexarc{%
+ \pathcornernoarc%
+ \pgf@xc\arcwidth\relax%
+ \advance\pgf@x-.707106\pgf@xc
+ }%
+ \addtosavedmacro\pathcornerconvexarc%
+ %
+ \pgfextract@process\pathcornerconcavearc{%
+ \pathcornernoarc%
+ \advance\pgf@x\arcwidth\relax%
+ }%
+ \addtosavedmacro\pathcornerconcavearc%
+ %
+ \pgfextract@process\anchorcornernoarc{%
+ \pathcornernoarc%
+ \advance\pgf@x\pgf@xb%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \addtosavedmacro\anchorcornernoarc%
+ %
+ \pgfextract@process\anchorcornerconvexarc{%
+ \pathcornerconvexarc%
+ \ifdim\halfarcangle pt=90pt\relax%
+ \else%
+ \pgfmathsin@{\halfarcangle}%
+ \pgf@xa\xpathradius\relax%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfmathcos@{\halfarcangle}%
+ \pgf@ya\ypathradius\relax%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ %
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \let\angle\pgfmathresult%
+ \pgfmathadd@{90}{\angle}%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@xb\pgfmathresult\pgf@xb%
+ \pgfmathadd@{90}{\halfarcangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \pgfmathcos@{\pgfmathresult}%
+ \advance\pgf@x\pgfmathresult\pgf@xb%
+ \fi%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \addtosavedmacro\anchorcornerconvexarc%
+ %
+ \pgfextract@process\anchorcornerconcavearc{%
+ \pathcornerconcavearc%
+ \ifdim\halfarcangle pt=90pt\relax%
+ \else%
+ \pgfmathsin@{\halfarcangle}%
+ \pgf@xa\xpathradius\relax%
+ \pgf@xa\pgfmathresult\pgf@xa%
+ \pgfmathcos@{\halfarcangle}%
+ \pgf@ya\ypathradius\relax%
+ \pgf@ya\pgfmathresult\pgf@ya%
+ %
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
+ \pgfmathatan@{\pgfmathresult}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angle\pgfmathresult%
+ \pgfmathcosec@{\pgfmathresult}%
+ \pgf@xb\pgfmathresult\pgf@xb%
+ \pgfmathcos@{\angle}%
+ \advance\pgf@x\pgfmathresult\pgf@xb%
+ \fi%
+ \advance\pgf@y\pgf@yb%
+ }%
+ \addtosavedmacro\anchorcornerconcavearc%
+ %
+ }%
+ \saveddimen\halflinewidth{\pgf@x.5\pgflinewidth}%
+ \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\relax%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \else%
+ \csname pgf@anchor@rounded rectangle@south east\endcsname%
+ \fi%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa%
+ }%
+ \anchor{mid west}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \else%
+ \csname pgf@anchor@rounded rectangle@south west\endcsname%
+ \fi%
+ \pgf@xa\pgf@x%
+ \midpoint%
+ \pgf@x\pgf@xa%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \else%
+ \csname pgf@anchor@rounded rectangle@south east\endcsname%
+ \fi%
+ \pgf@y0pt%
+ }%
+ \anchor{base west}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \else%
+ \csname pgf@anchor@rounded rectangle@south west\endcsname%
+ \fi%
+ \pgf@y0pt%
+ }%
+ \anchor{north}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \anchorcornernoarc%
+ \pgf@x0pt%
+ }%
+ }%
+ \anchor{east}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \advance\pgf@x\arcwidth\relax%
+ \advance\pgf@x\outerxsep\relax%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \advance\pgf@x-\arcwidth\relax%
+ \advance\pgf@x\outerxsep\relax%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ \pgf@y0pt\relax%
+ }%
+ }%
+ \anchor{west}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \advance\pgf@x\arcwidth\relax%
+ \advance\pgf@x\outerxsep\relax%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \advance\pgf@x-\arcwidth\relax%
+ \advance\pgf@x\outerxsep\relax%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ \pgf@x-\pgf@x%
+ \pgf@y0pt\relax%
+ }%
+ }%
+ \anchor{south}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \anchorcornernoarc%
+ \pgf@x0pt%
+ \pgf@y-\pgf@y
+ }%
+ }%
+ \anchor{north east}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \anchorcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \anchorcornerconcavearc%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ }%
+ }%
+ \anchor{north west}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \anchorcornerconvexarc%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \anchorcornerconcavearc%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ \pgf@x-\pgf@x%
+ }%
+ }%
+ \anchor{south west}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \anchorcornerconvexarc%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \anchorcornerconcavearc%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ }%
+ \anchor{south east}{%
+ \pgfpointadd{\centerpoint}{%
+ \roundedrectanglepoints%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \anchorcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \anchorcornerconcavearc%
+ \else%
+ \anchorcornernoarc%
+ \fi%
+ \fi%
+ \pgf@y-\pgf@y%
+ }%
+ }%
+ \anchor{shape center}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{%
+ \pgfpointadd{%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi}%
+ {%
+ \pgfpointadd{%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi
+ \pgf@x-\pgf@x}%
+ {%
+ \pgfpointadd{%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y}%
+ {%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi
+ \pgf@y-\pgf@y%
+ }%
+ }%
+ }%
+ \divide\pgf@x4\relax%
+ \divide\pgf@y4\relax%
+ }%
+ }%
+ \backgroundpath{%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \roundedrectanglepoints%
+ %
+ \pgf@x\xradius\relax%
+ \pgf@y\yradius\relax%
+ \advance\pgf@x-\outerxsep\relax%
+ \advance\pgf@y-\outerysep\relax%
+ \edef\xradius{\the\pgf@x}%
+ \edef\yradius{\the\pgf@y}%
+ %
+ \pgfpathmoveto{%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi%
+ }%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfpatharc{\halfarcangle}{-\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \pgfpathlineto{\pathcornernoarc\pgf@y-\pgf@y}%
+ \fi%
+ \fi%
+ \pgfpathlineto{%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pathcornerconvexarc%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pathcornerconcavearc%
+ \else%
+ \pathcornernoarc%
+ \fi%
+ \fi%
+ \pgf@x-\pgf@x%
+ \pgf@y-\pgf@y%
+ }%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfpatharc{-\halfarcangle}{\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \pgfpathlineto{\pathcornernoarc\pgf@x-\pgf@x}%
+ \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@west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \advance\pgf@x-\xradius\relax%
+ }%
+ {0}{\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pathcornernoarc%
+ \advance\pgf@x\pgf@xa%
+ \pgf@y\pgf@ya%
+ \advance\pgf@x\xpathradius\relax%
+ }%
+ {180-\halfarcangle}{180}{\xinnerradius and \yinnerradius}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ \fi%
+ \fi%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \advance\pgf@x\xradius\relax%
+ }%
+ {180-\halfarcangle}{180}{\xradius and \yradius}%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pathcornernoarc%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\pgf@xa%
+ \pgf@y\pgf@ya%
+ \advance\pgf@x-\xpathradius\relax%
+ }%
+ {0}{\halfarcangle}{\xinnerradius and \yinnerradius}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \advance\pgf@x\xradius\relax%
+ }%
+ {180}{180+\halfarcangle}{\xradius and \yradius}%
+ \else%
+ \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pathcornernoarc%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x\pgf@xa%
+ \pgf@y\pgf@ya%
+ \advance\pgf@x-\xpathradius\relax%
+ }%
+ {360-\halfarcangle}{360}{\xinnerradius and \yinnerradius}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ \fi%
+ \fi%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ \fi%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt\relax%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \advance\pgf@x-\xradius\relax%
+ }%
+ {360-\halfarcangle}{360}{\xradius and \yradius}%
+ \else%
+ \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
+ \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
+ {%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pathcornernoarc%
+ \advance\pgf@x\pgf@xa%
+ \pgf@y\pgf@ya%
+ \advance\pgf@x\xpathradius\relax%
+ }%
+ {180}{180+\halfarcangle}{\xinnerradius and \yinnerradius}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ \fi%
+ \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@chamferedrectangle@corners}
+\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@chamferedrectangle@corners}
+
+\def\pgf@chamferedrectangle@chamferall{chamfer all}%
+\def\pgf@chamferedrectangle@chamfer{chamfer}
+\let\pgf@chamferedrectangle@corners\pgf@chamferedrectangle@chamferall
+
+
+\def\pgf@chamferedrectangle@getcorners{%
+ \let\northeastcorner\pgfutil@empty%
+ \let\southeastcorner\pgfutil@empty%
+ \let\southwestcorner\pgfutil@empty%
+ \let\northwestcorner\pgfutil@empty%
+ \expandafter\pgfutil@in@\expandafter{\pgf@chamferedrectangle@corners}{chamfer all}%
+ \ifpgfutil@in@%
+ \let\northeastcorner\pgf@chamferedrectangle@round%
+ \let\southeastcorner\pgf@chamferedrectangle@round%
+ \let\southwestcorner\pgf@chamferedrectangle@round%
+ \let\northwestcorner\pgf@chamferedrectangle@round%
+ \let\pgf@next\relax%
+ \else%
+ \let\pgf@next\pgf@chamferedrectangle@parsecorners%
+ \fi%
+ \pgf@next}
+
+\def\pgf@chamferedrectangle@parsecorners{%
+ \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@chamferedrectangle@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@chamferedrectangle@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@south east@@bottom right@}%
+ \ifpgfutil@in@%
+ \let\southeastcorner\pgf@chamferedrectangle@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@south west@@bottom left@}%
+ \ifpgfutil@in@%
+ \let\southwestcorner\pgf@chamferedrectangle@chamfer%
+ \else%
+ \pgfutil@in@{@#1@}{@north west@@top right@}%
+ \ifpgfutil@in@%
+ \let\southeastcorner\pgf@chamferedrectangle@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@chamferedrectangle@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/pgflibraryshapes.multipart.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex
new file mode 100644
index 00000000000..41f0fcfb243
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex
@@ -0,0 +1,1097 @@
+% 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/pgflibraryshapes.multipart.code.tex,v 1.7 2008/01/15 15:41:18 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}%
+ }
+}
+
+
+
+
+
+% (Most) keys for shape rectangle split.
+%
+% /pgf/rectangle split parts : Set the number of rectangles to split into.
+% /pgf/rectangle split part align : Align the for the boxes in each part
+% (also keys for each part)
+% /pgf/rectangle split use custom fill : Use a custom (behindbackground path) fill.
+% /pgf/rectangle split part fill : Custom fill for ech part.
+% (also keys for each part)
+% /pgf/rectangle split draw splits : Draw the line between node parts.
+% /pgf/rectangle split empty part height : Set the default height for empty boxes.
+
+
+\newif\ifpgfrectanglesplitdrawsplits
+\pgfrectanglesplitdrawsplitstrue
+
+\newif\ifpgfrectanglesplitusecustomfill
+\pgfrectanglesplitusecustomfillfalse
+
+\pgfkeys{/pgf/.cd,
+ rectangle split parts/.initial=4,
+ rectangle split empty part height/.initial=1ex,
+ rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits,
+ %
+ rectangle split part align/.code=\pgf@lib@shapes@rectanglesplit@assigntoparts{#1}{align},
+ rectangle split text part align/.initial=center,
+ rectangle split second part align/.initial=center,
+ rectangle split third part align/.initial=center,
+ rectangle split fourth part align/.initial=center,
+ %
+ rectangle split use custom fill/.is if=pgfrectanglesplitusecustomfill,
+ rectangle split part fill/.code={%
+ \pgfrectanglesplitusecustomfilltrue%
+ \pgf@lib@shapes@rectanglesplit@assigntoparts{#1}{fill}%
+ },
+ rectangle split text part fill/.initial=white,
+ rectangle split second part fill/.initial=white,
+ rectangle split third part fill/.initial=white,
+ rectangle split fourth part fill/.initial=white
+}
+
+% Internal macros for the rectangle split shape.
+%
+\def\pgf@lib@shapes@rectanglesplit@left{left}
+\def\pgf@lib@shapes@rectanglesplit@right{right}
+
+\def\pgf@lib@shapes@rectanglesplit@assigntoparts#1#2{%
+ \expandafter\pgf@lib@shapes@rectanglesplit@@assigntoparts#1,\@@,\@@,\@@,\@@,\pgf@lib#2\pgf@lib}
+\def\pgf@lib@shapes@rectanglesplit@@assigntoparts#1,#2,#3,#4,#5\pgf@lib#6\pgf@lib{%
+ \pgfkeys{/pgf/.cd,%
+ rectangle split text part #6=#1,
+ rectangle split second part #6=#1,
+ rectangle split third part #6=#1,
+ rectangle split fourth part #6=#1
+ }%
+ \ifx#2\@@\else%
+ \pgfkeys{/pgf/.cd,%
+ rectangle split second part #6=#2,
+ rectangle split third part #6=#2,
+ rectangle split fourth part #6=#2
+ }%
+ \fi%
+ \ifx#3\@@\else%
+ \pgfkeys{/pgf/.cd,%
+ rectangle split third part #6=#3,
+ rectangle split fourth part #6=#3
+ }%
+ \fi%
+ \ifx#4\@@\else%
+ \pgfkeys{/pgf/rectangle split fourth part #6=#4}%
+ \fi%
+}%
+
+\newbox\pgfnodepartsecondbox
+\newbox\pgfnodepartthirdbox
+\newbox\pgfnodepartfourthbox
+
+\pgfdeclareshape{rectangle split}{%
+ \nodeparts{text,second,third,fourth}
+ \savedmacro\getrectanglesplitparameters{%
+ %
+ % If the height+depth of any box is 0pt use the default empty height.
+ %
+ \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/rectangle split empty part height}}
+ \pgf@y\ht\pgfnodeparttextbox%
+ \advance\pgf@y\dp\pgfnodeparttextbox%
+ \ifdim\pgf@y=0pt\relax%
+ \setbox\pgfnodeparttextbox=\hbox{%
+ \vrule width0pt height\the\pgfutil@tempdima depth0pt%
+ }%
+ \fi%
+ \pgf@y\ht\pgfnodepartsecondbox%
+ \advance\pgf@y\dp\pgfnodepartsecondbox%
+ \ifdim\pgf@y=0pt\relax%
+ \setbox\pgfnodepartsecondbox=\hbox{%
+ \vrule width0pt height\the\pgfutil@tempdima depth0pt%
+ }%
+ \fi%
+ \pgf@y\ht\pgfnodepartthirdbox%
+ \advance\pgf@y\dp\pgfnodepartthirdbox%
+ \ifdim\pgf@y=0pt\relax%
+ \setbox\pgfnodepartthirdbox=\hbox{%
+ \vrule width0pt height\the\pgfutil@tempdima depth0pt%
+ }%
+ \fi%
+ \pgf@y\ht\pgfnodepartfourthbox%
+ \advance\pgf@y\dp\pgfnodepartfourthbox%
+ \ifdim\pgf@y=0pt\relax%
+ \setbox\pgfnodepartfourthbox=\hbox{%
+ \vrule width0pt height\the\pgfutil@tempdima depth0pt%
+ }%
+ \fi%
+ %
+ % Empty boxes (without voiding them) if they are not used.
+ %
+ \pgfmathtruncatemacro\parts{\pgfkeysvalueof{/pgf/rectangle split parts}}%
+ \addtosavedmacro{\parts}%
+ \ifnum\parts<2\relax%
+ \setbox\pgfnodepartsecondbox=\hbox{}%
+ \fi%
+ \ifnum\parts<3\relax%
+ \setbox\pgfnodepartthirdbox=\hbox{}%
+ \fi%
+ \ifnum\parts<4\relax%
+ \setbox\pgfnodepartfourthbox=\hbox{}%
+ \fi%
+ %
+ % Save the line width.
+ %
+ \pgfmathsetlength\pgf@x{\pgflinewidth}
+ \edef\linewidth{\the\pgf@x}%
+ \addtosavedmacro{\linewidth}%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \edef\innerysep{\the\pgf@y}%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \edef\innerxsep{\the\pgf@x}%
+ %
+ % Get the widths.
+ %
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@xa.5\wd\pgfnodepartsecondbox%
+ \pgf@xb.5\wd\pgfnodepartthirdbox%
+ \pgf@xc.5\wd\pgfnodepartfourthbox%
+ %
+ % Find the maximum width%
+ %
+ \pgfutil@tempdima\pgf@x%
+ \ifdim\pgfutil@tempdima<\pgf@xa%
+ \pgfutil@tempdima\pgf@xa%
+ \fi%
+ \ifdim\pgfutil@tempdima<\pgf@xb%
+ \pgfutil@tempdima\pgf@xb%
+ \fi%
+ \ifdim\pgfutil@tempdima<\pgf@xc%
+ \pgfutil@tempdima\pgf@xc%
+ \fi%
+ %
+ % Adjust for alignment.
+ %
+ \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split text part align}}%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
+ \pgf@x-\pgfutil@tempdima%
+ \else%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
+ \pgf@x-2.0\pgf@x%
+ \advance\pgf@x\pgfutil@tempdima%
+ \else%
+ \pgf@x-\pgf@x%
+ \fi%
+ \fi%
+ %
+ \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split second part align}}%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
+ \pgf@xa-\pgfutil@tempdima%
+ \else%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
+ \pgf@xa-2.0\pgf@xa%
+ \advance\pgf@xa\pgfutil@tempdima%
+ \else%
+ \pgf@xa-\pgf@xa%
+ \fi%
+ \fi%
+ %
+ \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split third part align}}%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
+ \pgf@xb-\pgfutil@tempdima%
+ \else%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
+ \pgf@xb-2.0\pgf@xb%
+ \advance\pgf@xb\pgfutil@tempdima%
+ \else%
+ \pgf@xb-\pgf@xb%
+ \fi%
+ \fi%
+ %
+ \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split fourth part align}}%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
+ \pgf@xc-\pgfutil@tempdima%
+ \else%
+ \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
+ \pgf@xc-2.0\pgf@xc%
+ \advance\pgf@xc\pgfutil@tempdima%
+ \else%
+ \pgf@xc-\pgf@xc%
+ \fi%
+ \fi%
+ %
+ % Make relative to x.
+ %
+ \advance\pgf@xa-\pgf@x%
+ \advance\pgf@xb-\pgf@x%
+ \advance\pgf@xc-\pgf@x%
+ \pgf@x0pt%
+ %
+ % Find the minimum.
+ %
+ \pgfutil@tempdimb\pgf@x%
+ \ifdim\pgfutil@tempdimb>\pgf@xa%
+ \pgfutil@tempdimb\pgf@xa%
+ \fi%
+ \ifdim\pgfutil@tempdimb>\pgf@xb%
+ \pgfutil@tempdimb\pgf@xb%
+ \fi%
+ \ifdim\pgfutil@tempdimb>\pgf@xc%
+ \pgfutil@tempdimb\pgf@xc%
+ \fi%
+ %
+ % Anchor for the text box is (0pt, 0pt)
+ %
+ \pgfsavepgf@process\textanchor{\pgfqpoint{0pt}{0pt}}%
+ %
+ % Anchor for second box.
+ %
+ \pgfsavepgf@process\lowestanchor{\pgfqpoint{0pt}{0pt}}%
+ \let\lowestbox\pgfnodeparttextbox%
+ \ifnum\parts>1\relax%
+ \pgfsavepgf@process\secondanchor{%
+ \pgf@x\pgf@xa%
+ \pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\pgflinewidth%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\ht\pgfnodepartsecondbox%
+ }%
+ \let\lowestanchor\secondanchor%
+ \let\lowestbox\pgfnodepartsecondbox%
+ \else%
+ \let\secondanchor\textanchor%
+ \fi%
+ %
+ % Anchor for third box.
+ %
+ \ifnum\parts>2\relax%
+ \pgfsavepgf@process\thirdanchor{%
+ \lowestanchor%
+ \pgf@x\pgf@xb%
+ \advance\pgf@y-\dp\pgfnodepartsecondbox%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\pgflinewidth%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\ht\pgfnodepartthirdbox%
+ }%
+ \let\lowestanchor\thirdanchor%
+ \let\lowestbox\pgfnodepartthirdbox%
+ \else%
+ \let\thirdanchor\secondanchor%
+ \fi%
+ %
+ % Anchor for fourth box.
+ %
+ \ifnum\parts>3\relax%
+ \pgfsavepgf@process\fourthanchor{%
+ \lowestanchor%
+ \pgf@x\pgf@xc%
+ \advance\pgf@y-\dp\lowestbox%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\pgflinewidth%
+ \advance\pgf@y-\innerysep\relax%
+ \advance\pgf@y-\ht\pgfnodepartfourthbox%
+ }%
+ \let\lowestanchor\fourthanchor%
+ \let\lowestbox\pgfnodepartfourthbox%
+ \else%
+ \let\fourthanchor\thirdanchor%
+ \fi%
+ %
+ \addtosavedmacro{\textanchor}%
+ \addtosavedmacro{\secondanchor}%
+ \addtosavedmacro{\thirdanchor}%
+ \addtosavedmacro{\fourthanchor}%
+ %
+ % Adjust the boxwidth for minimum width
+ %
+ \pgfmathaddtolength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<.5\pgf@x%
+ \pgfutil@tempdima.5\pgf@x%
+ \fi%
+ \pgfmathaddtolength\pgfutil@tempdima{-\pgfkeysvalueof{/pgf/inner xsep}}%
+ %
+ % Get some important points.
+ %
+ \pgfsavepgf@process\southwest{%
+ \lowestanchor%
+ \pgf@x\pgfutil@tempdimb%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgf@ya\linewidth\relax%
+ \advance\pgf@x-.5\pgf@ya%
+ \advance\pgf@y-\dp\lowestbox%
+ \advance\pgf@y-.5\pgf@ya%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \pgfsavepgf@process\northeast{%
+ \pgf@x\pgfutil@tempdimb%
+ \advance\pgf@x2.0\pgfutil@tempdima%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgf@ya\linewidth\relax%
+ \advance\pgf@x.5\pgf@ya%
+ \pgf@y\ht\pgfnodeparttextbox%
+ \advance\pgf@y.5\pgf@ya%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \addtosavedmacro{\northeast}%
+ \addtosavedmacro{\southwest}%
+ \pgfsavepgf@process\centerpoint{%
+ \pgfpointadd{\southwest}{%
+ \pgfpointdiff{\southwest}{\northeast}%
+ \pgf@x.5\pgf@x%
+ \pgf@y.5\pgf@y%
+ }%
+ }%
+ \addtosavedmacro{\centerpoint}%
+ \pgfsavepgf@process\south{%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \southwest%
+ \pgf@x\pgf@xa%
+ }%
+ %
+ % Get the split points.
+ %
+ \let\lastsplit\south%
+ \ifnum\parts>1\relax%
+ \pgfsavepgf@process\textsplit{%
+ \pgf@x\pgfutil@tempdimb%
+ \advance\pgf@x\pgfutil@tempdima%
+ \pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-\innerysep%
+ \advance\pgf@y-.5\pgflinewidth%
+ }%
+ \else%
+ \let\textsplit\south%
+ \fi%
+ \addtosavedmacro{\textsplit}%
+ \pgfsavepgf@process\textspliteast{%
+ \textsplit%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\textspliteast}%
+ \pgfsavepgf@process\textsplitwest{%
+ \textsplit%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\textsplitwest}%
+ \ifnum\parts>2\relax%
+ \pgfsavepgf@process\secondsplit{%
+ \secondanchor%
+ \pgf@x\pgfutil@tempdimb%
+ \advance\pgf@x\pgfutil@tempdima%
+ \advance\pgf@y-\dp\pgfnodepartsecondbox%
+ \advance\pgf@y-\innerysep%
+ \advance\pgf@y-.5\pgflinewidth%
+ }%
+ \else%
+ \let\secondsplit\south%
+ \fi%
+ \addtosavedmacro{\secondsplit}%
+ \pgfsavepgf@process\secondspliteast{%
+ \secondsplit%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\secondspliteast}%
+ \pgfsavepgf@process\secondsplitwest{%
+ \secondsplit%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\secondsplitwest}%
+ \ifnum\parts>3\relax%
+ \pgfsavepgf@process\thirdsplit{%
+ \thirdanchor%
+ \pgf@x\pgfutil@tempdimb%
+ \advance\pgf@x\pgfutil@tempdima%
+ \advance\pgf@y-\dp\pgfnodepartthirdbox%
+ \advance\pgf@y-\innerysep%
+ \advance\pgf@y-.5\pgflinewidth%
+ }%
+ \let\lastsplit\thirdsplit%
+ \else%
+ \let\thirdsplit\south%
+ \fi%
+ \addtosavedmacro{\thirdsplit}%
+ \pgfsavepgf@process\thirdspliteast{%
+ \thirdsplit%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\thirdspliteast}%
+ \pgfsavepgf@process\thirdsplitwest{%
+ \thirdsplit%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya%
+ }%
+ \addtosavedmacro{\thirdsplitwest}%
+ }%
+ \savedanchor\basepoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
+ \pgfmathsetlength\pgf@y{+.5ex}%
+ }%
+ \anchor{center}{\getrectanglesplitparameters\centerpoint}%
+ \anchor{base}{\basepoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{second}{\getrectanglesplitparameters\secondanchor}%
+ \anchor{third}{\getrectanglesplitparameters\thirdanchor}%
+ \anchor{fourth}{\getrectanglesplitparameters\fourthanchor}%
+ \anchor{north east}{\getrectanglesplitparameters\northeast}
+ \anchor{south west}{\getrectanglesplitparameters\southwest}
+ \anchor{south east}{%
+ \getrectanglesplitparameters%
+ \northeast%
+ \pgf@xa\pgf@x%
+ \southwest%
+ \pgf@x\pgf@xa}
+ \anchor{north west}{%
+ \getrectanglesplitparameters%
+ \northeast%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya}
+ \anchor{south}{%
+ \getrectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \southwest%
+ \pgf@x\pgf@xa}
+ \anchor{north}{%
+ \getrectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa\pgf@x%
+ \northeast%
+ \pgf@x\pgf@xa}
+ \anchor{west}{%
+ \getrectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya}
+ \anchor{east}{%
+ \getrectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya}
+ \anchor{text split}{\getrectanglesplitparameters\textsplit}
+ \anchor{text split east}{\getrectanglesplitparameters\textspliteast}
+ \anchor{text split west}{\getrectanglesplitparameters\textsplitwest}
+ \anchor{second split}{\getrectanglesplitparameters\secondsplit}
+ \anchor{second split east}{\getrectanglesplitparameters\secondspliteast}
+ \anchor{second split west}{\getrectanglesplitparameters\secondsplitwest}
+ \anchor{third split}{\getrectanglesplitparameters\thirdsplit}
+ \anchor{third split east}{\getrectanglesplitparameters\thirdspliteast}
+ \anchor{third split west}{\getrectanglesplitparameters\thirdsplitwest}
+ \anchor{text east}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>1\relax%
+ \textsplit%
+ \pgf@ya\pgf@y
+ \northeast%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@ya\linewidth\relax%
+ \advance\pgf@y-.25\pgf@ya%
+ \else%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ \fi%
+ }
+ \anchor{text west}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>1\relax%
+ \textsplit%
+ \pgf@ya\pgf@y
+ \southwest%
+ \pgf@xa\pgf@x%
+ \northeast%
+ \pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@ya\linewidth\relax%
+ \advance\pgf@y-.25\pgf@ya%
+ \else%
+ \centerpoint%
+ \pgf@ya\pgf@y%
+ \southwest%
+ \pgf@y\pgf@ya%
+ \fi%
+ }
+ \anchor{second east}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>1\relax%
+ \northeast%
+ \pgf@xa\pgf@x%
+ \secondsplit%
+ \pgf@ya\pgf@y
+ \textsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \southwest%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ \fi%
+ }
+ \anchor{second west}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>1\relax%
+ \southwest%
+ \pgf@xa\pgf@x%
+ \secondsplit%
+ \pgf@ya\pgf@y
+ \textsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \southwest%
+ \fi%
+ }
+ \anchor{third east}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>2\relax%
+ \northeast%
+ \pgf@xa\pgf@x%
+ \thirdsplit%
+ \pgf@ya\pgf@y
+ \secondsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \southwest%
+ \pgf@ya\pgf@y%
+ \northeast%
+ \pgf@y\pgf@ya%
+ \fi%
+ }
+ \anchor{third west}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>2\relax%
+ \southwest%
+ \pgf@xa\pgf@x%
+ \thirdsplit%
+ \pgf@ya\pgf@y
+ \secondsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \southwest
+ \fi%
+ }
+ \anchor{fourth east}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>3\relax%
+ \northeast%
+ \pgf@xa\pgf@x%
+ \southwest%
+ \pgf@ya\linewidth\relax%
+ \pgf@ya.5\pgf@ya%
+ \advance\pgf@ya\pgf@y%
+ \thirdsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \northeast%
+ \pgf@xa\pgf@x%
+ \southwest%
+ \pgf@x\pgf@xa%
+ \fi%
+ }
+ \anchor{fourth west}{%
+ \getrectanglesplitparameters%
+ \ifnum\parts>3\relax%
+ \southwest%
+ \pgf@xa\pgf@x%
+ \pgf@ya\linewidth\relax%
+ \pgf@ya.5\pgf@ya%
+ \advance\pgf@ya\pgf@y%
+ \thirdsplit%
+ \advance\pgf@y\pgf@ya%
+ \pgf@y.5\pgf@y%
+ \pgf@x\pgf@xa%
+ \else%
+ \southwest%
+ \fi%
+ }
+ \backgroundpath{%
+ \getrectanglesplitparameters%
+ %
+ % Remove outer sep.
+ %
+ \pgfsavepgf@process\southwest{%
+ \southwest%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \pgfsavepgf@process\northeast{%
+ \northeast%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \pgfsavepgf@process\textsplit{%
+ \textsplit%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\secondsplit{%
+ \secondsplit%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\thirdsplit{%
+ \thirdsplit%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}%
+ {%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \ifnum\parts>1\relax%
+ \pgfpathmoveto{\textsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
+ \pgfpathlineto{\textsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
+ \fi%
+ \ifnum\parts>2\relax%
+ \pgfpathmoveto{\secondsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
+ \pgfpathlineto{\secondsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
+ \fi%
+ \ifnum\parts>3\relax%
+ \pgfpathmoveto{\thirdsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
+ \pgfpathlineto{\thirdsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
+ \fi%
+ }%
+ }
+ \behindbackgroundpath{%
+ \ifpgfrectanglesplitusecustomfill%
+ %
+ % Remove outer sep.
+ %
+ \getrectanglesplitparameters%
+ \pgfsavepgf@process\southwest{%
+ \southwest%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \pgfsavepgf@process\northeast{%
+ \northeast%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ }%
+ \pgfsavepgf@process\textspliteast{%
+ \textspliteast%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\textsplitwest{%
+ \textsplitwest%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\secondspliteast{%
+ \secondspliteast%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\secondsplitwest{%
+ \secondsplitwest%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\thirdspliteast{%
+ \thirdspliteast%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ \pgfsavepgf@process\thirdsplitwest{%
+ \thirdsplitwest%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ }%
+ %
+ % Always fill the text box.
+ %
+ \pgfpathmoveto{\textsplitwest}%
+ \pgfpathlineto{\northeast\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
+ \pgfpathlineto{\northeast}%
+ \ifnum\parts>1\relax%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \fi%
+ \pgfpathlineto{\textspliteast}%
+ \pgfpathclose%
+ \ifnum\parts>1\relax%
+ \egroup%
+ \fi%
+ \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split text part fill}}%
+ \pgfusepath{fill}%
+ %
+ % Second box.
+ %
+ \ifnum\parts>1\relax%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathmoveto{\textsplitwest}%
+ \pgfpathlineto{\textspliteast}%
+ \ifnum\parts=2\relax%
+ \egroup%
+ \fi%
+ \pgfpathlineto{\secondspliteast}%
+ \pgfpathlineto{\secondsplitwest}%
+ \ifnum\parts=2\relax%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \fi%
+ \pgfpathclose%
+ \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split second part fill}}%
+ \pgfusepath{fill}%
+ \egroup%
+ \fi%
+ %
+ % Third box.
+ %
+ \ifnum\parts>2\relax%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathmoveto{\secondsplitwest}%
+ \pgfpathlineto{\secondspliteast}%
+ \ifnum\parts=3\relax%
+ \egroup%
+ \fi%
+ \pgfpathlineto{\thirdspliteast}%
+ \pgfpathlineto{\thirdsplitwest}%
+ \ifnum\parts=3\relax%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \fi%
+ \pgfpathclose%
+ \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split third part fill}}%
+ \pgfusepath{fill}%
+ \egroup%
+ \fi%
+ %
+ % And the fourth box.
+ %
+ \ifnum\parts>3\relax%
+ \pgfpathmoveto{\thirdsplitwest}%
+ \pgfpathlineto{\southwest}%
+ \pgfpathlineto{\southwest\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
+ \bgroup%
+ \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
+ \pgfpathlineto{\thirdspliteast}%
+ \pgfpathclose%
+ \egroup%
+ \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split fourth part fill}}%
+ \pgfusepath{fill}%
+ \fi%
+ \fi%
+ }
+ \anchorborder{%
+ \pgfutil@tempdima\pgf@x%
+ \pgfutil@tempdimb\pgf@y%
+ \getrectanglesplitparameters%
+ \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%
+ }%
+}
+
+
+% 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/pgflibraryshapes.symbols.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex
new file mode 100644
index 00000000000..152ee00c4fb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex
@@ -0,0 +1,2513 @@
+% 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/pgflibraryshapes.symbols.code.tex,v 1.13 2008/01/30 07:56:38 vibrovski 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@shapes@signal@nowhere{nowhere}%
+\def\pgf@lib@shapes@signal@from{from}%
+\def\pgf@lib@shapes@signal@to{to}%
+
+\let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+\let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+\let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+\let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+
+\def\pgf@lib@shapes@signal@parsedirection#1#2{%
+ \let\pgf@lib@shapes@signal@direction#2%
+ \pgfutil@in@{and}{#1}%
+ \ifpgfutil@in@%
+ \pgf@lib@shapes@signal@@parsedirection#1\pgf@lib%
+ \else%
+ \pgf@lib@shapes@signal@@parsedirection#1 and #1\pgf@lib%
+ \fi
+}
+\def\pgf@lib@shapes@signal@@parsedirection#1 and #2\pgf@lib{%
+ \pgfutil@in@{nowhere}{#1}%
+ \ifpgfutil@in@
+ \pgf@lib@shapes@signal@@donowhere%
+ \else%
+ \pgf@lib@shapes@signal@@@parsedirection{#1}%
+ \pgf@lib@shapes@signal@@@parsedirection{#2}%
+ \fi%
+}
+\def\pgf@lib@shapes@signal@@@parsedirection#1{%
+ \pgfutil@in@{ #1 }{ east right }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@direction%
+ \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ left west }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@direction%
+ \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ above up north }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@direction%
+ \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \pgfutil@in@{ #1 }{ below down south }%
+ \ifpgfutil@in@%
+ \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@direction%
+ \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \fi%
+}
+
+\def\pgf@lib@shapes@signal@@donowhere{%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@direction%
+ \pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@direction%
+ \pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@direction%
+ \pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@direction%
+ \pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \fi%
+}
+
+
+% Keys for signal shape:
+%
+\pgfkeys{/pgf/.cd,
+ signal pointer angle/.initial=90,
+ signal from/.code={\pgf@lib@shapes@signal@parsedirection{#1}{\pgf@lib@shapes@signal@from}},
+ signal to/.code={\pgf@lib@shapes@signal@parsedirection{#1}{\pgf@lib@shapes@signal@to}}
+}
+
+
+\pgfkeys{/pgf/.cd,
+ signal to=east,
+ signal from=nowhere
+}
+
+
+% Shape signal
+%
+%
+\pgfdeclareshape{signal}{%
+ \savedmacro\installsignalparameters{%
+ %
+ % 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@tempdima2.0\pgf@ya%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima\pgf@yb%
+ \fi%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgfutil@tempdima<\pgf@y%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdima\pgfmathresult\pgf@y%
+ \pgf@xa\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xa%
+ \pgf@ya\pgfmath@tonumber{\pgfutil@tempdima}\pgf@ya%
+ \pgf@xb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xb%
+ \pgf@yb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@yb%
+ \fi%
+ %
+ % Adjust for minimum width.
+ %
+ \pgfutil@tempdima2.0\pgf@xa%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima\pgf@xb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima\pgf@xb%
+ \fi%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<\pgf@x%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdima\pgfmathresult\pgf@x%
+ \pgf@xa\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xa%
+ \pgf@ya\pgfmath@tonumber{\pgfutil@tempdima}\pgf@ya%
+ \pgf@xb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xb%
+ \pgf@yb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@yb%
+ \fi%
+ %
+ % So, define the points for the background path.
+ %
+ \pgfextract@process\north{%
+ \centerpoint%
+ \advance\pgf@y\pgf@ya%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@to%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\south{%
+ \centerpoint%
+ \advance\pgf@y-\pgf@ya%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ }%
+ \pgfextract@process\east{%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \advance\pgf@x\pgf@xb%
+ \fi%
+ }%
+ \pgfextract@process\west{%
+ \centerpoint%
+ \advance\pgf@x-\pgf@xa%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@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@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@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@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@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@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \advance\pgf@y-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@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@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \advance\pgf@y\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@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@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \pgf@y\pgf@yc%
+ \else%
+ \pgf@y\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\southmiter{%
+ \pgf@x0pt%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \pgf@y-\pgf@yc%
+ \else%
+ \pgf@y-\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\eastmiter{%
+ \pgf@y0pt%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \pgf@x\pgf@yc%
+ \else%
+ \pgf@x\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\westmiter{%
+ \pgf@y0pt%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \pgf@x-\pgf@yc%
+ \else%
+ \pgf@x-\pointerapexmiter\relax%
+ \fi%
+ }%
+ \pgfextract@process\northeastmiter{%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \pgf@x\pgf@yc
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \pgfqpointpolar{\quarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@to%
+ \pgfqpointpolar{\quarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\southeastmiter{%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \pgf@x\pgf@yc%
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \pgfqpointpolar{-\quarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\southwestmiter{%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \pgf@x-\pgf@yc
+ \pgf@y-\pgf@yc%
+ \else
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \pgfmathadd@{\quarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \pgfmathadd@{\complementquarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \pgfmathadd@{\complementquarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \pgfmathadd@{\quarterpointerangle}{180}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\northwestmiter{%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \pgf@x-\pgf@yc%
+ \pgf@y\pgf@yc%
+ \else
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \pgfmathsubtract@{180}{\quarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
+ \else%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \pgfmathsubtract@{180}{\complementquarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \pgfmathsubtract@{180}{\complementquarterpointerangle}%
+ \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
+ \else%
+ \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@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%
+ }%
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex
new file mode 100644
index 00000000000..f6c89af3efe
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex
@@ -0,0 +1,17 @@
+% 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/pgflibrarysnakes.code.tex,v 1.24 2008/01/19 16:52:30 tantau Exp $
+
+\PackageWarning{pgf}{Snakes have been superseded by decorations. Use
+the decoration libraries instead of the snakes library}
+
+\usepgflibrary{decorations.pathmorphing,decorations.pathreplacing,decorations.shapes}
+
+\endinput