From ac768be5ab2e638802806ac364ca4402e8e9935e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 24 Feb 2008 18:22:07 +0000 Subject: pgf 2.0, third try git-svn-id: svn://tug.org/texlive/trunk@6747 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/pgf/basiclayer/pgfcore.code.tex | 32 + .../generic/pgf/basiclayer/pgfcorearrows.code.tex | 513 +++ .../pgf/basiclayer/pgfcoregraphicstate.code.tex | 230 + .../generic/pgf/basiclayer/pgfcoreobjects.code.tex | 101 + .../pgf/basiclayer/pgfcorepathconstruct.code.tex | 890 ++++ .../pgf/basiclayer/pgfcorepathprocessing.code.tex | 465 ++ .../pgf/basiclayer/pgfcorepathusage.code.tex | 228 + .../generic/pgf/basiclayer/pgfcorepoints.code.tex | 1173 ++++++ .../generic/pgf/basiclayer/pgfcorequick.code.tex | 134 + .../generic/pgf/basiclayer/pgfcorescopes.code.tex | 571 +++ .../generic/pgf/basiclayer/pgfcoreshade.code.tex | 580 +++ .../pgf/basiclayer/pgfcoretransformations.code.tex | 632 +++ .../tex/generic/pgf/frontendlayer/tikz.code.tex | 3618 ---------------- .../pgf/libraries/pgflibraryarrows.code.tex | 842 ++++ .../pgf/libraries/pgflibrarypatterns.code.tex | 265 ++ .../pgf/libraries/pgflibraryplothandlers.code.tex | 520 +++ .../pgf/libraries/pgflibraryplotmarks.code.tex | 212 + .../pgf/libraries/pgflibraryshapes.arrows.code.tex | 2358 +++++++++++ .../pgf/libraries/pgflibraryshapes.code.tex | 21 + .../libraries/pgflibraryshapes.geometric.code.tex | 4419 ++++++++++++++++++++ .../pgf/libraries/pgflibraryshapes.misc.code.tex | 1333 ++++++ .../libraries/pgflibraryshapes.multipart.code.tex | 1097 +++++ .../libraries/pgflibraryshapes.symbols.code.tex | 2513 +++++++++++ .../pgf/libraries/pgflibrarysnakes.code.tex | 17 + .../tex/generic/pgf/math/pgfmath.code.tex | 10 + .../tex/generic/pgf/math/pgfmathbase.code.tex | 262 ++ .../tex/generic/pgf/math/pgfmathcalc.code.tex | 253 ++ .../generic/pgf/math/pgfmathoperations.code.tex | 1488 +++++++ .../tex/generic/pgf/math/pgfmathparser.code.tex | 970 +++++ .../tex/generic/pgf/math/pgfmathrnd.code.tex | 212 + .../tex/generic/pgf/math/pgfmathtrig.code.tex | 1496 +++++++ .../tex/generic/pgf/math/pgfmathutil.code.tex | 265 ++ .../texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg | 25 + .../generic/pgf/systemlayer/pgfsys-common-pdf.def | 92 + .../pgf/systemlayer/pgfsys-common-postscript.def | 425 ++ .../generic/pgf/systemlayer/pgfsys-common-svg.def | 419 ++ .../tex/generic/pgf/systemlayer/pgfsys-dvi.def | 392 ++ .../tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def | 40 + .../tex/generic/pgf/systemlayer/pgfsys-dvips.def | 126 + .../tex/generic/pgf/systemlayer/pgfsys-pdftex.def | 395 ++ .../tex/generic/pgf/systemlayer/pgfsys-tex4ht.def | 193 + .../generic/pgf/systemlayer/pgfsys-textures.def | 87 + .../tex/generic/pgf/systemlayer/pgfsys-vtex.def | 99 + .../tex/generic/pgf/systemlayer/pgfsys.code.tex | 905 ++++ .../pgf/systemlayer/pgfsysprotocol.code.tex | 70 + .../pgf/systemlayer/pgfsyssoftpath.code.tex | 209 + .../tex/generic/pgf/utilities/pgfcalendar.code.tex | 717 ++++ .../tex/generic/pgf/utilities/pgfexternal.tex | 32 + .../tex/generic/pgf/utilities/pgffor.code.tex | 236 ++ .../tex/generic/pgf/utilities/pgfrcs.code.tex | 95 + .../tex/generic/pgf/utilities/pgfutil-common.tex | 133 + .../tex/generic/pgf/utilities/pgfutil-context.def | 245 ++ .../tex/generic/pgf/utilities/pgfutil-latex.def | 64 + .../tex/generic/pgf/utilities/pgfutil-plain.def | 226 + Master/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty | 39 + .../tex/latex/pgf/basiclayer/pgfbaseimage.sty | 15 + .../tex/latex/pgf/basiclayer/pgfbaselayers.sty | 15 + .../tex/latex/pgf/basiclayer/pgfbasematrix.sty | 17 + .../tex/latex/pgf/basiclayer/pgfbasepatterns.sty | 15 + .../tex/latex/pgf/basiclayer/pgfbaseplot.sty | 17 + .../tex/latex/pgf/basiclayer/pgfbaseshapes.sty | 17 + .../tex/latex/pgf/basiclayer/pgfbasesnakes.sty | 17 + .../tex/latex/pgf/basiclayer/pgfcore.sty | 17 + .../tex/latex/pgf/compatibility/pgfarrows.sty | 19 + .../tex/latex/pgf/compatibility/pgfautomata.sty | 315 ++ .../pgf/compatibility/pgfcomp-version-0-65.sty | 719 ++++ .../tex/latex/pgf/compatibility/pgfheaps.sty | 107 + .../latex/pgf/compatibility/pgflibraryarrows.sty | 16 + .../latex/pgf/compatibility/pgflibraryautomata.sty | 16 + .../pgf/compatibility/pgflibraryplothandlers.sty | 17 + .../pgf/compatibility/pgflibraryplotmarks.sty | 17 + .../latex/pgf/compatibility/pgflibraryshapes.sty | 18 + .../latex/pgf/compatibility/pgflibrarysnakes.sty | 17 + .../compatibility/pgflibrarytikzbackgrounds.sty | 17 + .../pgf/compatibility/pgflibrarytikztrees.sty | 17 + .../tex/latex/pgf/compatibility/pgfnodes.sty | 19 + .../tex/latex/pgf/compatibility/pgfshade.sty | 19 + .../tex/latex/pgf/frontendlayer/pgfpict2e.sty | 112 + .../tex/latex/pgf/frontendlayer/tikz.sty | 15 + Master/texmf-dist/tex/latex/pgf/math/pgfmath.sty | 12 + .../tex/latex/pgf/systemlayer/pgfsys.sty | 16 + .../tex/latex/pgf/utilities/pgfcalendar.sty | 14 + .../texmf-dist/tex/latex/pgf/utilities/pgffor.sty | 14 + .../tex/latex/pgf/utilities/pgfpages.sty | 1047 +++++ .../texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty | 15 + .../texmf-dist/tex/latex/pgf/utilities/xxcolor.sty | 108 + Master/texmf-dist/tex/plain/pgf/basiclayer/pgf.tex | 28 + .../tex/plain/pgf/basiclayer/pgfbaseimage.tex | 20 + .../tex/plain/pgf/basiclayer/pgfbaselayers.tex | 20 + .../tex/plain/pgf/basiclayer/pgfbasematrix.tex | 22 + .../tex/plain/pgf/basiclayer/pgfbasepatterns.tex | 20 + .../tex/plain/pgf/basiclayer/pgfbaseplot.tex | 22 + .../tex/plain/pgf/basiclayer/pgfbaseshapes.tex | 22 + .../tex/plain/pgf/basiclayer/pgfbasesnakes.tex | 22 + .../tex/plain/pgf/basiclayer/pgfcore.tex | 23 + .../tex/plain/pgf/frontendlayer/tikz.tex | 23 + Master/texmf-dist/tex/plain/pgf/math/pgfmath.tex | 23 + .../tex/plain/pgf/systemlayer/pgfsys.tex | 28 + .../tex/plain/pgf/utilities/pgfcalendar.tex | 18 + .../texmf-dist/tex/plain/pgf/utilities/pgffor.tex | 18 + .../texmf-dist/tex/plain/pgf/utilities/pgfrcs.tex | 26 + 101 files changed, 32517 insertions(+), 3618 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex delete mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseimage.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaselayers.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasematrix.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasepatterns.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseplot.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseshapes.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasesnakes.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfarrows.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfautomata.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfheaps.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryarrows.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryautomata.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplothandlers.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplotmarks.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryshapes.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarysnakes.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikzbackgrounds.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikztrees.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfnodes.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/compatibility/pgfshade.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/frontendlayer/pgfpict2e.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/math/pgfmath.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/utilities/pgffor.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/utilities/pgfpages.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty create mode 100644 Master/texmf-dist/tex/latex/pgf/utilities/xxcolor.sty create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgf.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseimage.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaselayers.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasematrix.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasepatterns.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseplot.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseshapes.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasesnakes.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/basiclayer/pgfcore.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/frontendlayer/tikz.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/math/pgfmath.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/systemlayer/pgfsys.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/utilities/pgfcalendar.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/utilities/pgffor.tex create mode 100644 Master/texmf-dist/tex/plain/pgf/utilities/pgfrcs.tex (limited to 'Master') diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex new file mode 100644 index 00000000000..b76772cc4ac --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex @@ -0,0 +1,32 @@ +% 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. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.6 2008/01/15 10:27:34 tantau Exp $ + +\newif\ifpgf@draftmode + +\input pgfmath.code.tex + +\input pgfcorepoints.code.tex +\input pgfcorepathconstruct.code.tex +\input pgfcorepathusage.code.tex +\input pgfcorescopes.code.tex +\input pgfcoregraphicstate.code.tex +\input pgfcoretransformations.code.tex +\input pgfcorequick.code.tex +\input pgfcoreobjects.code.tex +\input pgfcorepathprocessing.code.tex +\input pgfcorearrows.code.tex +\input pgfcoreshade.code.tex +\input pgfcoreimage.code.tex +\input pgfcorelayers.code.tex +\input pgfcoretransparency.code.tex +\input pgfcorepatterns.code.tex + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex new file mode 100644 index 00000000000..bdf4906c1be --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex @@ -0,0 +1,513 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.8 2007/06/07 07:41:10 tantau Exp $ + + +% Sets the end arrow +% +% #1 = An arrow name +% +% Example: +% +% \pgfsetarrowsend{stealth} + +\def\pgfsetarrowsend#1{\pgf@arrowset{end}{#1}} +\def\pgf@arrowset#1#2{% + \pgfutil@ifundefined{pgf@arrow@code@#2} + {\PackageError{pgf}{Arrow #1 type ``#2'' unknown}{}} + {% + \edef\pgf@arrow@temp{#2}% + \ifx\pgf@arrow@temp\pgfutil@empty% ah. clear! + \expandafter\let\csname pgf@#1arrow\endcsname=\pgfutil@empty% + \expandafter\let\csname pgf@shorten@#1\endcsname=\pgfutil@empty% + \else% + %\pgf@arrow@prepare{#2}% + \expandafter\def\csname pgf@#1arrow\endcsname{\pgf@arrow@call{#2}}% + \expandafter\edef\csname pgf@shorten@#1\endcsname{\expandafter\noexpand\csname pgf@arrow@right@#2\endcsname}% + \fi% + }% +} + + +% Sets the start arrow +% +% #1 = An arrow name +% +% Example: +% +% \pgfsetarrowsstart{stealth} + +\def\pgfsetarrowsstart#1{\pgf@arrowset{start}{\csname pgf@arrows@invert#1\endcsname}} + +\def\pgf@arrows@invname#1#2{\expandafter\def\csname pgf@arrows@invert#1\endcsname{#2}} +\pgf@arrows@invname{}{} + + + + +% Sets arrows +% +% #1 = An arrow specification of the form ``left''-``right''. The last +% and right should be arrow types that have been defined using +% the \pgfarrowsdef command +% +% Example: +% +% \pgfsetarrows{-to} + +\def\pgfsetarrows#1{\pgf@arrows#1\pgf@stop} +\def\pgf@arrows#1-#2\pgf@stop{% + \pgfsetarrowsstart{#1} + \pgfsetarrowsend{#2} +} + +\def\pgf@arrows@checked#1#2#3{% + \pgfutil@ifundefined{pgf@arrow@code@#2}% + {% + \PackageError{pgf}{Arrow end type ``#2'' unknown}{}}% + {% + \pgfutil@ifundefined{pgf@arrow@code@\csname pgf@arrows@invert#1\endcsname} + {\PackageError{pgf}{Arrow start type ``#1'' unknown}{}}% + {#3}% + }% +} + +\def\pgf@arrows@check@already#1#2#3{% + \pgfutil@ifundefined{pgf@arrow@code@#2} + {#3}% + {\PackageError{pgf}{Arrow end type ``#2'' already defined}{}}% +} + + +% Called when an arrow needs to be rendered + +\def\pgf@arrow@call#1{% + \expandafter\ifx\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname\relax% + \pgfsysprotocol@getcurrentprotocol\pgf@arrow@temp% + {% + \pgfinterruptpath% + \let\pgfusepath=\pgf@nousepath@here% + \pgf@relevantforpicturesizefalse% + \pgftransformreset% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsys@beginscope% + \csname pgf@arrow@code@#1\endcsname% + \pgfsys@endscope% + \pgfsysprotocol@getcurrentprotocol\pgf@@arrow@temp% + \global\let\pgf@@arrow@temp=\pgf@@arrow@temp% + \endpgfinterruptpath% + \expandafter\def\expandafter\pgf@temp\expandafter{\expandafter\pgfsys@invoke\expandafter{\pgf@@arrow@temp}}% + \expandafter\global\expandafter\let\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname=\pgf@temp% + }% + \pgfsysprotocol@setcurrentprotocol\pgf@arrow@temp% + \fi% + \csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname% +} + +\def\pgf@arrow@code@{} % dummy + +\def\pgf@nousepath@here#1{% + \PackageError{pgf}{The definition of an arrow may not use \string\pgfusepath}{} +} + + + +% Define an arrow type. +% +% #1 = name or mnemonic for arrow when used at the start (examples: ``to'' or ``<'') +% #2 = name or mnemonic for arrow when used at the end (examples: ``to'' or ``>'') +% #3 = code to setup the left and right extend of the arrow. To set +% the left extend, call \pgfarrowsleftextend, for the right \pgfarrowsrightextend. +% #4 = protocolable code +% +% Description: +% +% When you define an arrow using this command, you must give two +% names. The first is used for the arrow when it is ``at the start'', +% the other when it is at the end. For example, a simple arrow might +% have the names ``<'' and ``>'', though these particular names are +% not used by pgf and left for the user. +% +% The code should be ``protocolable'' code. This means that it uses +% only pretty simple commands. +% +% The arrow code will be protocolled once for each line width at which +% the arrow is used. Thus, the code can (and often should) depend on +% the line width. +% +% The arrow should ``point right'' in the coordinate system. The end +% of the line at which the arrow should be drawn will be at the origin +% of the coordinate system. The coordinate system will be scaled and +% rotated appropriately before the arrow is drawn. +% +% The right extend of the arrow should be set to how much the arrow +% ``protrudes over the right''. Prior to drawing the arrow, the line +% will be shortened by this amount so that the arrow tip will exactly +% touch the original right end of the unshortened line. +% +% The left extend specifies the leftmost point of the arrow. This is +% important only if you use the swapping command, when this end is +% used to compute the shortening. +% +% The definition of an arrow should normally take care of the fact +% that the line cap of the main line may be a butt cap, a round cap or +% a rect cap. In all cases, the arrow should ``cover'' the cap +% completely or not at all. +% +% Example: +% +% \pgfarrowsdeclare{stealth}{stealth} +% { +% \pgfarrowsleftextend{-6\pgflinewidth} +% \pgfarrowsrightextend{2\pgflinewidth} +% { +% \pgfpathmoveto{\pgfpoint{2\pgflinewidth}{0pt}} +% \pgfpathlineto{\pgfpoint{-6\pgflinewidth}{4\pgflinewidth}} +% \pgfpathlineto{\pgfpoint{-3\pgflinewidth}{0pt}} +% \pgfpathlineto{\pgfpoint{-6\pgflinewidth}{-4\pgflinewidth}} +% \pgfusepathqfill +% } + +\def\pgfarrowsdeclare#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2} + {% + \expandafter\def\csname pgf@arrow@code@#2\endcsname{#4}% + \expandafter\def\csname pgf@arrow@left@#2\endcsname{#3\advance\pgf@x by-\pgf@xa}% + \expandafter\def\csname pgf@arrow@right@#2\endcsname{#3\advance\pgf@x by\pgf@xb}% + \pgf@arrows@invname{#1}{#2}% + }% +} + +\def\pgfarrowsleftextend#1{\pgfmathsetlength\pgf@xa{#1}} +\def\pgfarrowsrightextend#1{\pgfmathsetlength\pgf@xb{#1}} + +\def\pgf@arrows@repeat#1#2{% + \edef\pgf@arrows@marshal{\noexpand\let\expandafter\noexpand\csname#2\endcsname=\expandafter\noexpand\csname#1\endcsname}% + \pgf@arrows@marshal} + + + +% Declare a new arrow type to be the same as another one. +% +% #1 = name of new start +% #2 = name or new end +% #3 = name or old start +% #4 = name or old end +% +% Example: +% +% \pgfarrowsdeclarealias{<}{>}{to}{to} + +\def\pgfarrowsdeclarealias#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2} + {% + \pgf@arrows@checked{#3}{#4}% + {% + \pgf@arrows@repeat{pgf@arrow@code@#4}{pgf@arrow@code@#2}% + \pgf@arrows@repeat{pgf@arrow@left@#4}{pgf@arrow@left@#2}% + \pgf@arrows@repeat{pgf@arrow@right@#4}{pgf@arrow@right@#2}% + \pgf@arrows@invname{#1}{#2}% + }% + }% +} + + + + +% Creates a new arrows by ``swapping'' an existing arrow. +% +% #1 = name of new start +% #2 = name of new end +% #3 = name of old start +% #4 = name of old end +% +% Example: +% +% \pgfarrowsdeclarealias{]}{[}{[}{]} + +\def\pgfarrowsdeclarereversed#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2}% + {% + \pgf@arrows@checked{#3}{#4}% + {% + \expandafter\def\csname pgf@arrow@code@#2\endcsname{% + \pgflowlevel{\pgftransformxscale{-1}}% + \csname pgf@arrow@code@#4\endcsname}% + \pgf@arrows@repeat{pgf@arrow@right@#4}{pgf@arrow@left@#2}% + \pgf@arrows@repeat{pgf@arrow@left@#4}{pgf@arrow@right@#2}% + \pgf@arrows@invname{#1}{#2}% + }% + }% +} + + + +% Creates new arrows by combining two existing arrows. +% +% #1 = optional additional space +% #2 = name of new start +% #3 = name of new end +% #4 = name of second (innermost) start +% #5 = name of second end +% #6 = name of first (outermost) start +% #7 = name of first end +% +% In the star form, the line will end at the innermost arrows, +% otherwise the line will end at the outermost arrows. +% +% Example: +% +% \pgfarrowsdeclarecombine*{|<}{>|}{|}{|}{<}{>} +% \pgfarrowsdeclarecombine{<<}{>>}{<}{>}{<}{>} + +\def\pgfarrowsdeclarecombine{\pgfutil@ifnextchar*{\pgfarrowsdeclarecombine@star}{\pgf@@arrowsdeclarecombine}} + +\def\pgf@@arrowsdeclarecombine{\pgfutil@ifnextchar[{\pgf@arrowsdeclarecombine}{\pgf@arrowsdeclarecombine[0pt]}} +\def\pgf@arrowsdeclarecombine[#1]#2#3#4#5#6#7{% + \pgf@arrows@check@already{#2}{#3}% + {% + \pgf@arrows@checked{#4}{#5}% + {% + \pgf@arrows@checked{#6}{#7}% + {% + \expandafter\edef\csname pgf@arrow@code@#3\endcsname{% + \noexpand\pgfscope% + {\expandafter\noexpand\csname pgf@arrow@code@#7\endcsname}% + \noexpand\endpgfscope% + {% + \noexpand\pgfmathsetlength\pgf@x{#1}% + \noexpand\pgf@process{\expandafter\noexpand\csname pgf@arrow@left@#7\endcsname}% + \noexpand\pgf@process{\expandafter\noexpand\csname pgf@arrow@right@#5\endcsname}% + \pgf@x=-\pgf@x% + \noexpand\pgflowlevel{\noexpand\pgftransformxshift{\pgf@x}}% + \expandafter\noexpand\csname pgf@arrow@code@#5\endcsname}% + }% + \pgf@arrows@repeat{pgf@arrow@right@#7}{pgf@arrow@right@#3}% + \expandafter\def\csname pgf@arrow@left@#3\endcsname{% + \pgf@process{% + \pgfmathsetlength\pgf@y{#1}% + \advance\pgf@x by\pgf@y% + \pgf@process{\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\csname pgf@arrow@right@#5\endcsname}% + \pgf@process{\csname pgf@arrow@left@#5\endcsname}% + }% + }% + \pgf@arrows@invname{#2}{#3}% + }% + }% + }% +} + +\def\pgfarrowsdeclarecombine@star*{\pgfutil@ifnextchar[{\pgf@arrowsdeclarecombine@star}{\pgf@arrowsdeclarecombine@star[0pt]}} +\def\pgf@arrowsdeclarecombine@star[#1]#2#3#4#5#6#7{% + \pgf@arrows@check@already{#2}{#3}% + {% + \pgf@arrows@checked{#4}{#5}% + {% + \pgf@arrows@checked{#6}{#7}% + {% + \expandafter\edef\csname pgf@arrow@code@#3\endcsname{% + \noexpand\pgfscope% + {% + \noexpand\pgfmathsetlength\pgf@x{#1}% + \pgf@process{\expandafter\noexpand\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\expandafter\noexpand\csname pgf@arrow@right@#5\endcsname}% + \noexpand\pgflowlevel{\noexpand\pgftransformxshift{\pgf@x}}% + }% + {\expandafter\noexpand\csname pgf@arrow@code@#7\endcsname}% + \noexpand\endpgfscope% + \expandafter\noexpand\csname pgf@arrow@code@#5\endcsname% + }% + \pgf@arrows@repeat{pgf@arrow@left@#7}{pgf@arrow@left@#3}% + \expandafter\def\csname pgf@arrow@right@#3\endcsname{% + \pgf@process{% + \pgfmathsetlength\pgf@y{#1}% + \advance\pgf@x by\pgf@y% + \pgf@process{\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\csname pgf@arrow@right@#5\endcsname}% + \pgf@process{\csname pgf@arrow@right@#7\endcsname}% + }% + }% + \pgf@arrows@invname{#2}{#3}% + }% + }% + }% +} + + + +% Creates new arrows by doubling/tripling existing arrows. +% +% #1 = optional additional space in multiples of line width +% #2 = name of new start +% #3 = name of new end +% #4 = name of old start +% #5 = name of old end +% +% Example: +% +% \pgfarrowsdeclaredouble{<<}{>>}{<}{>} + +\def\pgfarrowsdeclaredouble{\pgfutil@ifnextchar[{\pgf@arrowsdeclaredouble}{\pgf@arrowsdeclaredouble[0pt]}} +\def\pgf@arrowsdeclaredouble[#1]#2#3#4#5{\pgfarrowsdeclarecombine[#1]{#2}{#3}{#4}{#5}{#4}{#5}} +\def\pgfarrowsdeclaretriple{\pgfutil@ifnextchar[{\pgf@arrowsdeclaretriple}{\pgf@arrowsdeclaretriple[0pt]}} +\def\pgf@arrowsdeclaretriple[#1]#2#3#4#5{% + \pgfarrowsdeclarecombine[#1]{pgf@trip@#2}{pgf@trip@#3}{#4}{#5}{#4}{#5}% + \pgfarrowsdeclarecombine[#1]{#2}{#3}{pgf@trip@#2}{pgf@trip@#3}{#4}{#5}% +} + + +% A stealth-fighter-like pointed arrow +% +% Example: +% +% \pgfsetarrows{-stealth} + +\pgfarrowsdeclare{stealth}{stealth} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-3\pgfutil@tempdima} + \pgfarrowsrightextend{+5\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}} + \pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{-4\pgfutil@tempdima}} + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{stealth reversed}{stealth reversed}{stealth}{stealth} + + +% An arrow similar to the $\to$ arrow +% +% Example: +% +% \pgfsetarrow{-to} + +\pgfarrowsdeclare{to}{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{0pt}{-0.25\pgfutil@tempdima}} + {\pgfqpoint{-2.75\pgfutil@tempdima}{-2.5\pgfutil@tempdima}} + {\pgfqpoint{-3\pgfutil@tempdima}{-4\pgfutil@tempdima}} + \pgfusepathqstroke +} + +\pgfarrowsdeclare{to reversed}{to reversed} +{ + \pgfutil@tempdima=-0.21pt% + \advance\pgfutil@tempdima by-0.475\pgflinewidth% + \pgfutil@tempdimb=0.98pt% + \advance\pgfutil@tempdimb by1.45\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.5\pgfutil@tempdima}{4\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{3.25\pgfutil@tempdima}{2.5\pgfutil@tempdima}} + {\pgfqpoint{0.5\pgfutil@tempdima}{0.25\pgfutil@tempdima}} + {\pgfqpoint{-0.25\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{0.5\pgfutil@tempdima}{-0.25\pgfutil@tempdima}} + {\pgfqpoint{3.25\pgfutil@tempdima}{-2.5\pgfutil@tempdima}} + {\pgfqpoint{3.5\pgfutil@tempdima}{-4\pgfutil@tempdima}} + \pgfusepathqstroke +} + + + +% LaTeX's orginal arrow type +% +% Example: +% +% \pgfsetarrows{-latex} + +\pgfarrowsdeclare{latex}{latex} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-1\pgfutil@tempdima} + \pgfarrowsrightextend{+9\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{9\pgfutil@tempdima}{0pt}} + \pgfpathcurveto + {\pgfqpoint{6.3333\pgfutil@tempdima}{.5\pgfutil@tempdima}} + {\pgfqpoint{2\pgfutil@tempdima}{2\pgfutil@tempdima}} + {\pgfqpoint{-1\pgfutil@tempdima}{3.75\pgfutil@tempdima}} + \pgfpathlineto{\pgfqpoint{-1\pgfutil@tempdima}{-3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{2\pgfutil@tempdima}{-2\pgfutil@tempdima}} + {\pgfqpoint{6.3333\pgfutil@tempdima}{-.5\pgfutil@tempdima}} + {\pgfqpoint{9\pgfutil@tempdima}{0pt}} + \pgfusepathqfill +} +\pgfarrowsdeclarereversed{latex reversed}{latex reversed}{latex}{latex} + + + +% A bar shaped arrow +% +% Example: +% +% \pgfsetarrows{-|} + +\pgfarrowsdeclare{|}{|} +{ + \pgfarrowsleftextend{+-0.25\pgflinewidth} + \pgfarrowsrightextend{+.75\pgflinewidth} +} +{ + \pgfutil@tempdima=2pt% + \advance\pgfutil@tempdima by1.5\pgflinewidth% + \pgfsetdash{}{+0pt} + \pgfsetrectcap + \pgfpathmoveto{\pgfqpoint{0.25\pgflinewidth}{-\pgfutil@tempdima}} + \pgfpathlineto{\pgfqpoint{0.25\pgflinewidth}{\pgfutil@tempdima}} + \pgfusepathqstroke +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex new file mode 100644 index 00000000000..b3a04e6cad0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex @@ -0,0 +1,230 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.8 2007/12/12 16:57:17 tantau Exp $ + +% Globals + +\newdimen\pgflinewidth + + +% Set the line width to #1. +% +% #1 = new line width. +% +% Example: +% +% \pgfsetlinewidth{3pt} + +\def\pgfsetlinewidth#1{% + \pgfmathsetlength\pgflinewidth{#1}% + \global\pgflinewidth=\pgflinewidth% + \pgfsys@setlinewidth{\the\pgflinewidth}% + \ignorespaces} + + +% Set the miter limit to #1. +% +% #1 = new miter limit factor. +% +% Example: +% +% \pgfsetmiterlimit{3} + +\def\pgfsetmiterlimit#1{% + \pgfsys@setmiterlimit{#1}% + \ignorespaces} + + +% Set the dash pattern to #1 with phase #2/ +% +% #1 = a row of numbers of length of ``on'' and ``off'' points. +% #2 = a phase +% +% Example: +% +% \pgfsetdash{} {0pt} % solid line +% \pgfsetdash{{.1cm}} {0pt} % long dashes +% \pgfsetdash{{1pt}{1ex}}{0pt} % dotted + +\def\pgfsetdash#1#2{% + \def\pgf@temp{}% + \def\pgf@next{\pgf@strip}% + \pgf@strip#1{pgf@stop}% + \pgfmathsetlength\pgf@x{#2}% + \pgfsys@setdash{\pgf@temp}{\the\pgf@x}% + \ignorespaces} + +\def\pgf@strip#1{% + \def\pgf@@temp{#1}% + \ifx\pgf@@temp\pgf@stop% + \let\pgf@next=\relax% + \else% + \pgfmathsetlength\pgf@x{#1}% + \ifx\pgf@temp\pgfutil@empty% + \edef\pgf@temp{\the\pgf@x}% + \else% + \edef\pgf@temp{\pgf@temp,\the\pgf@x}% + \fi% + \fi\pgf@next} + +\def\pgf@stop{pgf@stop} + + +% Set color of strokes. This will overrule the normal color. +% +% Example: +% +% \pgfsetstrokecolor{red} + +\def\pgfsetstrokecolor#1{% + \pgfutil@colorlet{pgf@tempcolor}{#1}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setstrokecolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setstrokecolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4@stroke\endcsname\relax% + \PackageError{pgfbase}{Unsupported color model `#4'. Sorry}{}% + \else% + \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4@stroke\endcsname}% + \pgf@uncomma#5,,% + \pgf@colmarshal% + \fi} + +\def\pgf@uncomma#1,{% + \def\pgf@coltest{#1}% + \ifx\pgf@coltest\pgfutil@empty% + \let\pgf@colnext=\relax% + \else% + \expandafter\def\expandafter\pgf@colmarshal\expandafter{\pgf@colmarshal{#1}}% + \let\pgf@colnext=\pgf@uncomma% + \fi% + \pgf@colnext% +} + + +% Set color of fills. This will overrule the normal color. +% +% Example: +% +% \pgfsetfillcolor{gray} + +\def\pgfsetfillcolor#1{% + \pgfutil@colorlet{pgf@tempcolor}{#1}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setfillcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setfillcolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4@fill\endcsname\relax% + \PackageError{pgfbase}{Unsupported color model `#4'. Sorry}{}% + \else% + \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4@fill\endcsname}% + \pgf@uncomma#5,,% + \pgf@colmarshal% + \fi} + + + +% Sets both the stroke and fill color. +% +% Example: +% +% \pgfsetcolor{blue} + +\def\pgfsetcolor#1{% + \pgfutil@colorlet{pgf@tempcolor}{#1}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setcolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4\endcsname\relax% + \PackageError{pgfbase}{Unsupported color model `#4'. Sorry}{}% + \else% + \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4\endcsname}% + \pgf@uncomma#5,,% + \pgf@colmarshal% + \fi} + +% Code for ensuring the stroke/fill colors are correctly reset. +\def\XC@bcolor{\pgfsys@color@reset} + +% Set a butt line cap. +% +% Example: +% +% \pgfsetbuttcap + +\def\pgfsetbuttcap{\pgfsys@buttcap\ignorespaces} + + +% Set a round line cap. +% +% Example: +% +% \pgfsetroundcap + +\def\pgfsetroundcap{\pgfsys@roundcap\ignorespaces} + + +% Set a rectangular line cap. +% +% Example: +% +% \pgfsetrectcap + +\def\pgfsetrectcap{\pgfsys@rectcap\ignorespaces} + + +% Set a miter line join. +% +% Example: +% +% \pgfsetmiterjoin + +\def\pgfsetmiterjoin{\pgfsys@miterjoin\ignorespaces} + + +% Set a bevel line join. +% +% Example: +% +% \pgfsetbeveljoin + +\def\pgfsetbeveljoin{\pgfsys@beveljoin\ignorespaces} + + +% Set a round line join. +% +% Example: +% +% \pgfsetroundjoin + +\def\pgfsetroundjoin{\pgfsys@roundjoin\ignorespaces} + + +% Sets the even-odd rule for filling and clipping. +% +% Example: +% +% \pgfseteorule + +\def\pgfseteorule{\pgfsys@eoruletrue\ignorespaces} + + +% Sets the non-zero winding number rule for filling and clipping. +% +% Example: +% +% \pgfsetnonzerorule + +\def\pgfsetnonzerorule{\pgfsys@eorulefalse\ignorespaces} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex new file mode 100644 index 00000000000..557558d82ef --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex @@ -0,0 +1,101 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreobjects.code.tex,v 1.2 2006/10/11 15:22:25 tantau Exp $ + + +% Object reuse + + +% Define a pgf object for reuse. Such objects will be stored +% efficiently internally. +% +% #1 = name for later reuse +% #2 = lower left corner point of bounding box +% #3 = upper right left corner point of bounding box +% #4 = pure pgf code (nothing too fancy!) +% +% Description: +% +% Used to define reusable objects. The object must be composed of +% basic pgf graphic primitives. Nothing fancy can be used. The +% created object will be stored as an xform object in pdf or as a +% postscript procedure in postscript. +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfpathqmoveto{0pt}{0pt} +% \pgfpathqmoveto{10pt}{0pt} +% \pgfpathqmoveto{10pt}{10pt} +% \pgfpathqmoveto{0pt}{10pt} +% \pgfpathclose +% \pgfusepath{stroke}} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgfuseobject{myrect} +% \end{pgfpicture} + +\def\pgfdefobject#1#2#3#4{% + \pgfinterruptpath% + \pgf@relevantforpicturesizefalse% + \pgfsys@defobject{#1}{#2}{#3}{#4}% + \endpgfinterruptpath% + \ignorespaces% +} + + +% Use an object that was previously defined using pgfdefobject +% +% #1 = name of previously defined object +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfqmoveto{0}{0} +% \pgfqmoveto{10}{0} +% \pgfqmoveto{10}{10} +% \pgfqmoveto{0}{10} +% \pgfclosestroke} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgfuseobject{myrect} +% \end{pgfpicture} + +\def\pgfuseobject#1{\pgfsys@beginscope\pgfsys@useobject{#1}{}\pgfsys@endscope} + + +% Use an object that was previously defined using pgfdefobject, but +% magnify the object by the current x and y register values +% +% #1 = name of previously defined object +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfqmoveto{0}{0} +% \pgfqmoveto{10}{0} +% \pgfqmoveto{10}{10} +% \pgfqmoveto{0}{10} +% \pgfclosestroke} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgf@x=2pt% Scale by factor two in x-direction +% \pgf@y=2pt% Scale by factor two in y-direction +% \pgfuseobjectmagnify{myrect} +% \end{pgfpicture} + +\def\pgfuseobjectmagnify#1{% + \pgfsys@beginscope% + \pgfsys@useobject{#1}{\pgfsys@transformxyscale{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}}% + \pgfsys@endscope% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex new file mode 100644 index 00000000000..b96d766b081 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex @@ -0,0 +1,890 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.14 2008/02/13 15:10:06 tantau Exp $ + + +\newdimen\pgf@path@lastx +\newdimen\pgf@path@lasty + + + +% Replace corners by arcs. +% +% #1 = in-size of arc +% #2 = out-size of arc +% +% Description: +% +% This command influences path construction command like +% \pgfpathlineto or \pgfpatharc. It will cause the corners at the end +% of these commands to be replaced by little arcs. If the +% corner is a 90 degrees corner and if #1=#2, a quarter-circle of +% radius #1 is put in place of the corner. If #1 and #2 are different, +% the quarter circle will instead by a quarter ellipse. If the angle +% is different from 90 degrees, a deformed quarter circle will +% result, which may or may not be desirable. For a ``perfect'' arc you +% must use the \pgfpatharc command. +% +% +% Example: One rounded corner. +% +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathlineto{\pgfpointxy{0}{1}} +% \pgfpathlineto{\pgfpointxy{1}{1}} +% \pgfstroke +% +% Example: A rounded rectangle +% +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{1cm}{1cm}} +% \pgfstroke +% +% Example: A rounded triangles +% +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{1cm}{0cm}} +% \pgfpathlineto{\pgfpoint{1cm}{1cm}} +% \pgfpathclose +% \pgfstroke + +\newif\ifpgf@arccorners + +\def\pgfsetcornersarced#1{% + \pgf@process{#1}% + \edef\pgf@corner@arc{{\the\pgf@x}{\the\pgf@y}}% + \pgf@arccornerstrue% + \ifdim\pgf@x=0pt% + \ifdim\pgf@y=0pt\relax% + \pgf@arccornersfalse% + \fi% + \fi% +} + +\def\pgf@roundcornerifneeded{% + \ifpgf@arccorners\expandafter\pgfsyssoftpath@specialround\pgf@corner@arc\fi% +} + + +% Move current point to #1. +% +% #1 = new current point +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfstroke + +\def\pgfpathmoveto#1{% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgfsyssoftpath@moveto{\the\pgf@x}{\the\pgf@y}% + \global\pgf@path@lastx=\pgf@x% + \global\pgf@path@lasty=\pgf@y% +} + +\def\pgf@protocolsizes#1#2{% + \ifpgf@relevantforpicturesize% + \ifdim#1<\pgf@picminx\global\pgf@picminx#1\fi% + \ifdim#1>\pgf@picmaxx\global\pgf@picmaxx#1\fi% + \ifdim#2<\pgf@picminy\global\pgf@picminy#2\fi% + \ifdim#2>\pgf@picmaxy\global\pgf@picmaxy#2\fi% + \fi% + \ifdim#1<\pgf@pathminx\global\pgf@pathminx#1\fi% + \ifdim#1>\pgf@pathmaxx\global\pgf@pathmaxx#1\fi% + \ifdim#2<\pgf@pathminy\global\pgf@pathminy#2\fi% + \ifdim#2>\pgf@pathmaxy\global\pgf@pathmaxy#2\fi% + \ifpgf@size@hooked% + \let\pgf@size@hook@x#1\let\pgf@size@hook@y#2\pgf@path@size@hook% + \fi% +} +\newif\ifpgf@size@hooked +\let\pgf@path@size@hook=\pgfutil@empty% + +\def\pgf@resetpathsizes{% + \global\pgf@pathmaxx=-16000pt\relax% + \global\pgf@pathminx=16000pt\relax% + \global\pgf@pathmaxy=-16000pt\relax% + \global\pgf@pathminy=16000pt\relax% +} + +\def\pgf@getpathsizes#1{% + \edef#1{{\the\pgf@pathmaxx}{\the\pgf@pathminx}{\the\pgf@pathmaxy}{\the\pgf@pathminy}}% +} +\def\pgf@setpathsizes#1{% + \expandafter\pgf@@setpathsizes#1% +} +\def\pgf@@setpathsizes#1#2#3#4{% + \global\pgf@pathmaxx=#1\relax% + \global\pgf@pathminx=#2\relax% + \global\pgf@pathmaxy=#3\relax% + \global\pgf@pathminy=#4\relax% +} + + + + + +% Append a line from the current point to #1 to the current path. +% +% #1 = end of line +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfstroke + +\def\pgfpathlineto#1{% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@lineto{\the\pgf@x}{\the\pgf@y}% + \global\pgf@path@lastx=\pgf@x% + \global\pgf@path@lasty=\pgf@y% +} + + + +% Close the current path. +% +% Example: +% +% % Draws two triangles +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfclosepath +% \pgfpathmoveto{\pgfxy(2,0)} +% \pgfpathlineto{\pgfxy(2,1)} +% \pgfpathlineto{\pgfxy(3,0)} +% \pgfpathclose +% \pgfstroke + +\def\pgfpathclose{% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@closepath% +} + + +% Append a bezier spline from the current point to #3 with control +% points #1 and #2 to the current path. +% +% #1 = first control point +% #2 = second control point +% #3 = end point +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathcurveto{\pgfxy(0,1)}{\pgfxy(1,1)}{\pgfxy(1,2)} +% \pgfstroke + +\def\pgfpathcurveto#1#2#3{% + \pgfpointtransformed{#3}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgfpointtransformed{#2}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}% + \global\pgf@path@lastx=\pgf@xb% + \global\pgf@path@lasty=\pgf@yb% +} + + +% Append an arc to the current point, where the current point is at +% angle #1 and the end is at angle #2. If #2 > #1, the arc is drawn +% counter-clockwise, otherwise it is clockwise. +% +% #1 = angle of first point +% #2 = angle of second point +% #3 = radius or x-radius/y-radius +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpatharc{0}{90}{2cm} +% \pgfstroke + +\def\pgfpatharc#1#2#3{% + {% + \pgfmathparse{#1}\let\pgf@temp@a=\pgfmathresult% + \pgfmathparse{#2}\let\pgf@temp@b=\pgfmathresult% + \pgfutil@in@{and }{#3}% + \ifpgfutil@in@% + \pgf@arc@get@radii#3\pgf@arc@stop% + \else + \pgf@arc@get@radii#3and #3\pgf@arc@stop% + \fi% + \pgf@arc@local@angle@a=\pgf@temp@a pt% + \pgf@arc@local@angle@b=\pgf@temp@b pt% + \relax% + \ifdim\pgf@arc@local@angle@a>360pt\relax% + \advance\pgf@arc@local@angle@a by-360pt\relax% + \fi% + \ifdim\pgf@arc@local@angle@a<-360pt\relax% + \advance\pgf@arc@local@angle@a by360pt\relax% + \fi% + \ifdim\pgf@arc@local@angle@b>360pt\relax% + \advance\pgf@arc@local@angle@b by-360pt\relax% + \fi% + \ifdim\pgf@arc@local@angle@b<-360pt\relax% + \advance\pgf@arc@local@angle@b by360pt\relax% + \fi% + \loop% + \pgfutil@tempdima=\pgf@arc@local@angle@a% + \advance\pgfutil@tempdima by-\pgf@arc@local@angle@b\relax% + \ifdim\pgfutil@tempdima<0pt\relax% + \pgfutil@tempdima=-\pgfutil@tempdima\relax% + \fi% + \ifdim\pgfutil@tempdima>90pt\relax% + \ifdim\pgfutil@tempdima>115pt\relax% + \pgf@arc@temp=90pt% big skip + \else% + \pgf@arc@temp=60pt% smaller skip to ensure wide segments + % (important shortened end segments because + % of arrow tips) + \fi% + \ifdim\pgf@arc@local@angle@b>\pgf@arc@local@angle@a\relax% + {% + \pgf@arc@local@angle@b=\pgf@arc@local@angle@a\relax% + \advance\pgf@arc@local@angle@b by\pgf@arc@temp\relax% + \pgf@arc% + } + \advance\pgf@arc@local@angle@a by\pgf@arc@temp\relax% + \else + {% + \pgf@arc@local@angle@b=\pgf@arc@local@angle@a\relax% + \advance\pgf@arc@local@angle@b by-\pgf@arc@temp\relax% + \pgf@arc% + }% + \advance\pgf@arc@local@angle@a by-\pgf@arc@temp\relax% + \fi% + \repeat% + \pgf@roundcornerifneeded% + \pgf@arc% + }% +} +\dimendef\pgf@arc@local@angle@a=0 +\dimendef\pgf@arc@local@angle@b=1 +\dimendef\pgf@arc@temp=2 + +\def\pgf@arc@get@radii#1and #2\pgf@arc@stop{% + \pgfmathparse{#1}\let\pgf@arc@radius@a=\pgfmathresult% + \pgfmathparse{#2}\let\pgf@arc@radius@b=\pgfmathresult% +} + + +\def\pgf@arc{% + {% + % \pgfmathsetlength{\pgfutil@tempdima}{#3}% + % \pgfmathsetlength{\pgfutil@tempdimb}{#4}% + \pgfutil@tempdima=\pgf@arc@radius@a pt% + \pgfutil@tempdimb=\pgf@arc@radius@b pt% + % + \pgf@xa=\pgf@arc@local@angle@a\relax% + \pgf@xb=\pgf@arc@local@angle@b\relax% + % \pgfutil@tempcnta=#1\relax% + % \pgfutil@tempcntb=#2\relax% + \advance\pgf@xb by-\pgf@xa\relax% + \ifdim\pgf@xb<0pt\relax% + \pgf@xb=-\pgf@xb\relax% + \fi% + \ifdim\pgf@xb>85pt\relax% hackery to correct the control points + \pgfutil@tempdima=0.0555\pgfutil@tempdima\relax% + \pgfutil@tempdimb=0.0555\pgfutil@tempdimb\relax% + \else% + \ifdim\pgf@xb>75pt\relax% + \pgfutil@tempdima=0.055\pgfutil@tempdima\relax% + \pgfutil@tempdimb=0.055\pgfutil@tempdimb\relax% + \else% + \ifdim\pgf@xb>60pt\relax% + \pgfutil@tempdima=0.0545\pgfutil@tempdima\relax% + \pgfutil@tempdimb=0.0545\pgfutil@tempdimb\relax% + \else% + \pgfutil@tempdima=0.054\pgfutil@tempdima\relax% + \pgfutil@tempdimb=0.054\pgfutil@tempdimb\relax% + \fi% + \fi% + \fi + \pgfutil@tempdima=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdima\relax% + \divide\pgfutil@tempdima by 9\relax% + \pgfutil@tempdimb=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdimb\relax% + \divide\pgfutil@tempdimb by 9\relax% + %.. controls +(\pgf@xa+90:\pgfutil@tempdima) and +(\pgf@xb-90:\pgfutil@tempdima) .. +(-(#1:#3)+(#2:#3))% + % store first support vector in xa/ya: + \pgf@xa=\pgf@arc@local@angle@a\relax% + \ifdim\pgf@arc@local@angle@b>\pgf@arc@local@angle@a\relax% + \advance\pgf@xa by 90pt\relax% + \else% + \advance\pgf@xa by -90pt\relax% + \fi% + \edef\pgf@arc@angle{\pgf@sys@tonumber{\pgf@xa}}% + \pgfpointtransformed{\pgfpointpolar{\pgf@arc@angle}{\pgfutil@tempdima and \pgfutil@tempdimb}}% + \advance\pgf@x by-\pgf@pt@x% + \advance\pgf@y by-\pgf@pt@y% + \pgf@xa=\pgf@path@lastx% + \pgf@ya=\pgf@path@lasty% + \advance\pgf@xa by \pgf@x% + \advance\pgf@ya by \pgf@y% + % store target in xb/yb: + \pgfpointtransformed{\pgfpointpolar{\pgf@sys@tonumber{\pgf@arc@local@angle@a}}{\pgf@arc@radius@a pt and \pgf@arc@radius@b pt}}% + \pgf@xb=\pgf@path@lastx% + \pgf@yb=\pgf@path@lasty% + \advance\pgf@xb by -\pgf@x% + \advance\pgf@yb by -\pgf@y% + \pgfpointtransformed{\pgfpointpolar{\pgf@sys@tonumber{\pgf@arc@local@angle@b}}{\pgf@arc@radius@a pt and \pgf@arc@radius@b pt}}% + \advance\pgf@xb by \pgf@x% + \advance\pgf@yb by \pgf@y% + % store second support xc/yc: + \ifdim\pgf@arc@local@angle@b>\pgf@arc@local@angle@a\relax% + \advance\pgf@arc@local@angle@b by -90pt\relax% + \else% + \advance\pgf@arc@local@angle@b by 90pt\relax% + \fi% + \pgfpointtransformed{\pgfpointpolar{\pgf@sys@tonumber{\pgf@arc@local@angle@b}}{\pgfutil@tempdima and \pgfutil@tempdimb}}% + \advance\pgf@x by-\pgf@pt@x% + \advance\pgf@y by-\pgf@pt@y% + \pgf@xc=\pgf@xb\relax% + \pgf@yc=\pgf@yb\relax% + \advance \pgf@xc by \pgf@x\relax% + \advance \pgf@yc by \pgf@y\relax% + \pgfsyssoftpath@curveto{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xc}{\the\pgf@yc}{\the\pgf@xb}{\the\pgf@yb}% + \global\pgf@path@lastx=\pgf@xb% + \global\pgf@path@lasty=\pgf@yb% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + \pgf@protocolsizes{\pgf@xc}{\pgf@yc}% + }% +} + +% Append an arc to the current point, where the arc is on an ellipse +% given by two axis vectors. +% +% #1 = angle of first point +% #2 = angle of second point +% #3 = first axis +% #4 = second axis +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpatharcaxes{0}{90}{\pgfpointxy{2}{0}}{\pgfpointxy{0}{2}} +% \pgfstroke + +\def\pgfpatharcaxes#1#2#3#4{% + {% + \pgftransformtriangle{\pgfpointorigin}{#3}{#4}% + \pgfpatharc{#1}{#2}{1pt}% + }% +} + + + + +% Append an ellipse to the current path. +% +% #1 = center +% #2 = first axis +% #3 = second axis +% +% Example: +% +% % Add a circle of radius 3cm around the origin +% \pgfpathellipse{\pgforigin}{\pgfxy(2,0)}{\pgfxy(0,1)} +% +% % Draw a non-filled circle of radius 1cm around the point (1,1) +% \pgfpathellipse{\pgfxy(1,1)}{\pgfxy(1,1)}{\pgfxy(-2,2)} +% \pgfstroke + +\def\pgfpathellipse#1#2#3{% + \pgfpointtransformed{#1}% store center in xc/yc + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpointtransformed{#2}% + \pgf@xa=\pgf@x% store first axis in xa/ya + \pgf@ya=\pgf@y% + \advance\pgf@xa by-\pgf@pt@x% + \advance\pgf@ya by-\pgf@pt@y% + \pgfpointtransformed{#3}% + \pgf@xb=\pgf@x% store second axis in xb/yb + \pgf@yb=\pgf@y% + \advance\pgf@xb by-\pgf@pt@x% + \advance\pgf@yb by-\pgf@pt@y% + {% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgf@x=0.555\pgf@xb% first arc + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xa% + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xb by\pgf@xc% + \advance\pgf@yb by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xb}{\the\pgf@yb}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + }% + \pgf@xa=-\pgf@xa% flip first axis + \pgf@ya=-\pgf@ya% + \pgf@x=0.555\pgf@xa% second arc + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xb% + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgf@xb=-\pgf@xb% flip second axis + \pgf@yb=-\pgf@yb% + \pgf@x=0.555\pgf@xb% third arc + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xa% + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xb by\pgf@xc% + \advance\pgf@yb by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xb}{\the\pgf@yb}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + }% + \pgf@xa=-\pgf@xa% flip first axis once more + \pgf@ya=-\pgf@ya% + \pgf@x=0.555\pgf@xa% fourth arc + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xb% + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgfsyssoftpath@closepath% + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% +} + + + +% Append a circle to the current path +% +% #1 = center +% #2 = radius +% +% Example: +% +% % Append a circle of radius 3cm around the the point (1,1) +% \pgfpathcircle{\pgxy(1,1)}{3cm} + +\def\pgfpathcircle#1#2{\pgfpathellipse{#1}{\pgfpoint{#2}{0pt}}{\pgfpoint{0pt}{#2}}} + + + + +% Append a rectangle to the current path +% +% #1 = lower left corner point of rectangle +% #2 = width and height vector +% +% Example: +% +% % A rectangle with corners (2,2) and (3,3) +% \pgfpathrectangle{\pgfpointxy{2}{2}}{\pgfpointxy{1}{1}} + +\def\pgfpathrectangle{% + \let\pgfrect@next=\pgf@specialrect% + \ifpgf@pt@identity% + \ifpgf@arccorners% + \else% + \let\pgfrect@next=\pgf@normalrect% + \fi% + \fi% + \pgfrect@next% +} + +\def\pgf@normalrect#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpointtransformed{#1}% + \pgfsyssoftpath@rect{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% +} + +\def\pgf@specialrect#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@xa by\pgf@xb% + \advance\pgf@ya by\pgf@yb% + \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}% + \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathclose% + \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yb}}% +} + +% Append a rectangle to the current path +% +% #1 = one corner of the rectangle +% #2 = opposite corner of the rectangle +% +% Example: +% +% % A rectangle with corners (2,2) and (3,3) +% \pgfpathrectanglecorners{\pgfpointxy{2}{2}}{\pgfpointxy{3}{3}} + +\def\pgfpathrectanglecorners#1#2{% + \pgf@process{#2}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xc by-\pgf@x% + \advance\pgf@yc by-\pgf@y% + \pgfpathrectangle{#1}{\pgfqpoint{\pgf@xc}{\pgf@yc}}% +} + + +% Append a grid to the current path. +% +% #1 = lower left point of grid +% #2 = upper right point of grid +% +% Options: +% +% stepx = x-step dimension (default 1cm) +% stepy = y-step dimension (default 1cm) +% step = dimesion vector +% +% Example: +% +% \pgfsetlinewidth{0.8pt} +% \pgfgrid{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgfsetlinewidth{0.4pt} +% \pgfgrid[stepx=1cm,stepy=1cm]{\pgfxy(0,0)}{\pgfxy(3,2)} + +\pgfkeys{ + /pgf/stepx/.initial=1cm, + /pgf/stepy/.initial=1cm, + /pgf/step/.code={\pgf@process{#1}\pgfkeysalso{/pgf/stepx/.expanded=\the\pgf@x,/pgf/stepy/.expanded=\the\pgf@y}}, + /pgf/step/.value required +} + +\def\pgfpathgrid{\pgfutil@ifnextchar[{\pgf@pathgrid}{\pgf@pathgrid[]}} +\def\pgf@pathgrid[#1]#2#3{% + \pgfset{#1}% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/stepx}}% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/stepy}}% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#2}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + {% + % compute bounding box + % first corner + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % second corner + \pgf@x=\pgf@xb% + \pgf@y=\pgf@ya% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % third corner + \pgf@x=\pgf@xa% + \pgf@y=\pgf@yb% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % fourth corner + \pgf@x=\pgf@xa% + \pgf@y=\pgf@ya% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + }% + \c@pgf@counta=\pgf@y\relax% + \c@pgf@countb=\pgf@yc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgf@y=\c@pgf@counta\pgf@yc\relax% + \ifdim\pgf@y<\pgf@ya% + \advance\pgf@y by\pgf@yc% + \fi% + \loop% horizontal lines + {% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@lineto{\the\pgf@xa}{\the\pgf@ya}% + }% + \advance\pgf@y by\pgf@yc% + \ifdim\pgf@y<\pgf@yb% + \repeat% + \advance\pgf@y by-0.01pt\relax% + \ifdim\pgf@y<\pgf@yb% + {% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@lineto{\the\pgf@xa}{\the\pgf@ya}% + }% + \fi% + \c@pgf@counta=\pgf@x\relax% + \c@pgf@countb=\pgf@xc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgf@x=\c@pgf@counta\pgf@xc\relax% + \ifdim\pgf@x<\pgf@xa% + \advance\pgf@x by\pgf@xc% + \fi% + \loop% vertical lines + {% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@lineto{\the\pgf@xc}{\the\pgf@yc}% + }% + \advance\pgf@x by\pgf@xc% + \ifdim\pgf@x<\pgf@xb% + \repeat% + \advance\pgf@x by-0.01pt\relax% + \ifdim\pgf@x<\pgf@xb% + {% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@lineto{\the\pgf@xc}{\the\pgf@yc}% + }% + \fi% +} + + + +% Append two half-parabolas to the path +% +% #1 = bend (relative to current point) +% #2 = end point (relative to bend point) +% +% Description: +% +% This command appends a half-parabola that starts at the current point +% and has its bend at #1+current point. Then, a second parabola is +% appended that starts at #1+current point, where it also has its +% minimum/maximum, and ends at #1+current point+#2, which becomes the +% new current point. +% +% By setting #2 = (0,0) you draw only a half parabola that goes from the +% current point to the bend; by setting #1 = (0,0) +% you draw a half parabola that going to current point + #2 and has its +% bend at the current point. +% +% Examples: +% +% % Half-parabola going ``up and right'' +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpointorigin}{\pgfpoint{2cm}{4cm}} +% +% % Half-parabola going ``down and right'' +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpoint{-2cm}{4cm}}}{\pgfpointorigin} +% +% % Full parabola +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpoint{-2cm}{4cm}}{\pgfpoint{2cm}{4cm}} + +\def\pgfpathparabola#1#2{% + {% + \pgf@process{#2}% untransformed + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfutil@tempswatrue% + \ifdim\pgf@xb=0pt\relax% + \ifdim\pgf@yb=0pt\relax% + \pgfutil@tempswafalse% + \fi% + \fi% + {% + \ifpgfutil@tempswa% + \pgf@arccornersfalse + \else% + \fi% + \pgfutil@tempswatrue% + \ifdim\pgf@xc=0pt\relax% + \ifdim\pgf@yc=0pt\relax% + \pgfutil@tempswafalse% + \fi% + \fi% + \ifpgfutil@tempswa + {% + \pgf@pt@x=\pgf@path@lastx% + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfqpoint{.1125\pgf@xc}{.225\pgf@yc}}% found by trial and error + {\pgfqpoint{.5\pgf@xc}{\pgf@yc}}% found by trial and error + {\pgfqpoint{\pgf@xc}{\pgf@yc}}% + }% + \fi% + }% + \ifpgfutil@tempswa% + \pgf@xc=\pgf@xb% + \pgf@yc=\pgf@yb% + {% + \pgf@pt@x=\pgf@path@lastx% + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfqpoint{.5\pgf@xc}{0\pgf@yc}}% found by trial and error + {\pgfqpoint{.8875\pgf@xc}{.775\pgf@yc}}% found by trial and error + {\pgfqpoint{\pgf@xc}{\pgf@yc}}% + }% + \fi% + }% +} + + + + +% Append a sine curve between 0 and \pi/2 to the path. +% +% #1 = vector, describing the width and height of the curve +% +% Description: +% +% This command appends a sine curve in the interval 0 and \pi/2 to the +% current path. The sine curve ends at currentpoint+#1. +% +% Examples: +% +% % One complete sine in the interval [0,\pi] +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathsine{\pgfpoint{1.57cm}{1cm}} +% \pgfpathcosine{\pgfpoint{3.141cm}{0cm}} + +\def\pgfpathsine#1{% + {% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfqpoint{.31831\pgf@xc}{.5\pgf@yc}}% found by trial and error + {\pgfqpoint{.63503\pgf@xc}{\pgf@yc}}% found by trial and error + {\pgfqpoint{\pgf@xc}{\pgf@yc}}% + }% +} + +% Append a cosine curve between 0 and \pi/2 to the path. +% +% #1 = vector, describing the width and height of the curve +% +% Examples: +% +% % One complete sine in the interval [0,\pi] +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathsine{\pgfpoint{1.57cm}{1cm}} +% \pgfpathcosine{\pgfpoint{3.141cm}{0cm}} + +\def\pgfpathcosine#1{% + {% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfqpoint{.36497\pgf@xc}{0pt}}% found by trial and error + {\pgfqpoint{.68169\pgf@xc}{.5\pgf@yc}}% found by trial and error + {\pgfqpoint{\pgf@xc}{\pgf@yc}}% + }% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex new file mode 100644 index 00000000000..a8da0ca9410 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex @@ -0,0 +1,465 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.7 2008/01/23 15:22:29 tantau Exp $ + + + + + +% Extract start and end vectors of a path +% +% #1 = a macro that stores a path +% +% Description: +% +% This command will extract the first and second coordinate on the +% path as well as the last and second-last. These coordinates will be +% put in the pgfpoint-macros \pgfpointfirstonpath, +% \pgfpointsecondonpath, \pgfpointsecondlastonpath, and +% \pgfpointlastonpath. If the path is empty, these macros are set to +% \pgfpointorigin. +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{30}{40}{40} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfprocesspathextractpoints\mypath +% +% % \pgfpointfirstonpath is now \pgfpoint{0}{0} +% % \pgfpointsecondonpath is now \pgfpoint{10bp}{10bp} +% % \pgfpointsecondlastonpath is now \pgfpoint{30bp}{30bp} +% % \pgfpointlastonpath is now \pgfpoint{40bp}{40bp} + +\def\pgfprocesspathextractpoints#1{% + \ifx#1\pgfutil@empty% + \let\pgfpointfirstonpath=\pgfpointorigin% + \let\pgfpointsecondonpath=\pgfpointorigin% + \let\pgfpointsecondlastonpath=\pgfpointorigin% + \let\pgfpointlastonpath=\pgfpointorigin% + \else% + \expandafter\pgf@extractprocessorfirst#1\pgf@stop% + \fi% +} + +\def\pgf@extractprocessorfirst#1#2#3#4{% + \def\pgfpointfirstonpath{\pgfqpoint{#2}{#3}}% + \ifx#4\pgf@stop% + % pretty short path... + \let\pgfpointsecondonpath=\pgfpointfirstonpath% + \let\pgfpointsecondlastonpath=\pgfpointfirstonpath% + \let\pgfpointlastonpath=\pgfpointfirstonpath% + \let\next=\pgfutil@gobble% + \else + \let\next=\pgf@extractprocessorsecond% + \fi% + \next#4% +} + +\def\pgf@extractprocessorsecond#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + % Reset things... + \let\pgf@next=\pgf@extractprocessorfirst% + \else% + \let\pgf@next=\pgf@@extractprocessorsecond% + \fi% + \pgf@next#1% +} +\def\pgf@@extractprocessorsecond#1#2#3#4{% + \def\pgfpointsecondonpath{\pgfqpoint{#2}{#3}}% + \let\pgfpointsecondlastonpath=\pgfpointfirstonpath% + \let\pgfpointlastonpath=\pgfpointsecondonpath% + \ifx#4\pgf@stop% + % short path... + \let\next=\pgfutil@gobble% + \else + \let\next=\pgf@extractprocessorother% + \fi% + \next#4% +} + +\def\pgf@extractprocessorother#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + % Reset things... + \let\pgf@next=\pgf@extractprocessorfirst% + \else% + \let\pgf@next=\pgf@@extractprocessorother% + \fi% + \pgf@next#1% +} +\def\pgf@@extractprocessorother#1#2#3#4{% + \let\pgfpointsecondlastonpath=\pgfpointlastonpath% + \def\pgfpointlastonpath{\pgfqpoint{#2}{#3}}% + \ifx#4\pgf@stop% + % end! + \let\next=\pgfutil@gobble% + \fi% + \next#4% +} + + + +% Check for closepath and rectangles +% +% #1 = a macro that stores a path +% #2 = command to be executed when a closepath or a rectangle is encountered +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{30}{40}{40} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfprocesscheckclosed{\mypath}{\pgf@drawarrowsfalse} + +\def\pgfprocesscheckclosed#1#2{% + {% + \global\let\pgf@proc@todo=\relax% + \let\pgfsyssoftpath@movetotoken=\pgfutil@gobbletwo% + \let\pgfsyssoftpath@linetotoken=\pgfutil@gobbletwo% + \let\pgfsyssoftpath@curvetosupportatoken=\pgfutil@gobbletwo% + \let\pgfsyssoftpath@curvetosupportbtoken=\pgfutil@gobbletwo% + \let\pgfsyssoftpath@curvetotoken=\pgfutil@gobbletwo% + \def\pgfsyssoftpath@rectcornertoken{\gdef\pgf@proc@todo{#2}\pgfutil@gobbletwo}% + \def\pgfsyssoftpath@rectsizetoken{\gdef\pgf@proc@todo{#2}\pgfutil@gobbletwo}% + \def\pgfsyssoftpath@closepathtoken{\gdef\pgf@proc@todo{#2}\pgfutil@gobbletwo}% + #1% + }% + \pgf@proc@todo% +} + + +% Resolve specialround +% +% #1 = a macro that stores a path +% #2 = a macro that stores the new path +% +% Description: +% +% Resolves all specialround tokens. When such a token is encountered, +% the objective is to replace the next corner by a rounded corner. +% + +\def\pgfprocessround#1#2{% + % first, check whether #1 contains \pgfsyssoftpath@specialroundtoken. + % if not, do quick assignment! + \expandafter\pgf@processroundcheck\expandafter#1\expandafter#2#1\pgfsyssoftpath@specialroundtoken\pgf@stop% +} + +\def\pgf@processroundcheck#1#2#3\pgfsyssoftpath@specialroundtoken#4\pgf@stop{% + \def\pgf@test{#4}% + \ifx\pgf@test\pgfutil@empty% + % ok, nothing to be done! + \let#2=#1% + \else% + % very well... + \pgf@@processround#1#2% + \fi% +} + + +\def\pgf@@processround#1#2{% + \let\pgfprocess@newpath\pgfutil@empty% + \let\pgfprocess@moveto\pgfutil@empty% + \let\pgfprocess@firstto\pgfutil@empty% + \let\pgfprocess@segment\pgfutil@empty% + \pgf@xa=0pt% + \pgf@ya=0pt% + \expandafter\pgfprocess@round#1\pgf@stop{0pt}{0pt}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@moveto}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@segment}% + \let#2=\pgfprocess@newpath% +} + +\def\pgfprocess@round#1#2#3{% + \ifx#1\pgf@stop% + \let\next=\relax% + \else% + \ifx#1\pgfsyssoftpath@specialroundtoken% + \def\pgfprocess@savex{#2}% + \def\pgfprocess@savey{#3}% + \let\next=\pgfprocess@specialround% + \ifdim#2=0pt% + \ifdim#3=0pt% + \let\next=\pgfprocess@round% skip! + \fi% + \fi% + \else% + \ifx\pgfprocess@firstto\pgfutil@empty% + \def\pgfprocess@firstto{{#2}{#3}}% + \fi% + \pgf@xa=#2% + \pgf@ya=#3% + \ifx#1\pgfsyssoftpath@movetotoken% + % ok, move old segment to newpath + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@moveto}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@segment}% + \def\pgfprocess@moveto{#1{#2}{#3}}% + \let\pgfprocess@firstto=\pgfutil@empty% + \let\pgfprocess@segment=\pgfutil@empty% + \else% + \pgfutil@g@addto@macro\pgfprocess@segment{#1{#2}{#3}}% + \fi% + \let\next=\pgfprocess@round% + \fi% + \fi% + \next% +} + +\def\pgfprocess@specialround#1#2#3{% + \ifx\pgfprocess@firstto\pgfutil@empty% + \def\pgfprocess@firstto{{#2}{#3}}% + \fi% + \let\next=\pgfprocess@round% default: do nothing + \ifx#1\pgfsyssoftpath@linetotoken% + % Ok, round a lineto + \let\next=\pgfprocess@specialroundcope% + \else% + \ifx#1\pgfsyssoftpath@curvetosupportatoken% + % Ok, round a curveto. + \let\next=\pgfprocess@specialroundcurveto% + \else% + \ifx#1\pgfsyssoftpath@closepathtoken% + % Ok, round a closepath (this is tricky...) + \let\next=\pgfprocess@specialroundclose% + \fi% + \fi% + \fi% + \next#1{#2}{#3}% +}% + +\def\pgfprocess@specialroundcope#1#2#3#4#5#6{% + \let\next=\pgfprocess@round% do nothing by default + \let\pgfprocess@continueafterrounding=\pgfprocess@round% + \ifx#4\pgfsyssoftpath@linetotoken% + % ok, let's get kicking... + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else% + \ifx#4\pgfsyssoftpath@curvetosupportatoken% + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else% + \ifx#4\pgfsyssoftpath@closepathtoken% + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else + \ifx#4\pgfsyssoftpath@specialroundtoken% + \let\next=\pgfprocess@@findrightcoordinates% + \fi% + \fi% + \fi% + \fi% + \next#1{#2}{#3}#4{#5}{#6}% +} + +\def\pgfprocess@@findrightcoordinates#1#2#3#4#5#6#7#8#9{% + \pgf@xc=#8% + \pgf@yc=#9% + \pgfprocess@@specialround#1{#2}{#3}#4{#5}{#6}#7{#8}{#9}% +} + +\def\pgfprocess@@specialround#1#2#3{% + \pgfutil@g@addto@macro\pgfprocess@segment{#1}% + % calculate start coordinate of the curve + \pgf@xb=#2% + \pgf@yb=#3% + % + \edef\pgf@marshal% + {\noexpand\pgfpointlineatdistance{\pgfprocess@savex}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}}% + \pgf@process{\pgf@marshal}% + \pgf@xa=\pgf@x% save start point of added curve + \pgf@ya=\pgf@y% + \edef\pgfprocess@addition{{\the\pgf@x}{\the\pgf@y}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + % + % now add curve + % + \edef\pgf@marshal% + {\noexpand\pgfpointlineatdistance{\pgfprocess@savey}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}% + \pgf@process{\pgf@marshal}% + \pgf@xc=\pgf@x% save end point of added curve + \pgf@yc=\pgf@y% + % calculate first support: + {% + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \advance\pgf@xa by 0.555\pgf@x% + \advance\pgf@ya by 0.555\pgf@y% + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportatoken{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + }% + % calculate second support: + {% + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by-\pgf@xc% + \advance\pgf@y by-\pgf@yc% + \advance\pgf@xc by 0.555\pgf@x% + \advance\pgf@yc by 0.555\pgf@y% + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportbtoken{\the\pgf@xc}{\the\pgf@yc}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + }% + % add end: + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetotoken{\the\pgf@xc}{\the\pgf@yc}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + % + % continue! + % + \pgf@xa=#2% + \pgf@ya=#3% + \pgfprocess@continueafterrounding% +} + +\def\pgfprocess@specialroundcurveto#1#2#3#4#5#6{% + \pgfutil@g@addto@macro\pgfprocess@segment{#1{#2}{#3}#4{#5}{#6}}% supports + \pgf@xa=#5% + \pgf@ya=#6% + \pgfprocess@specialroundcope} + +\def\pgfprocess@specialroundclose{% + \let\next=\pgfprocess@round% + \ifx\pgfprocess@moveto\pgfutil@empty% + \else% + \ifx\pgfprocess@firstto\pgfutil@empty% + \else% + \expandafter\pgfprocess@@specialclosetarget\pgfprocess@firstto% + \let\pgfprocess@continueafterrounding=\pgfprocess@cleanupafterclose% + \edef\next{% + \noexpand\pgfprocess@@specialround% + \expandafter\expandafter\expandafter\noexpand\expandafter\pgfprocess@@specialclosemoveto\pgfprocess@moveto% + }% + \fi% + \fi% + \next% +} + +\def\pgfprocess@@specialclosetarget#1#2{% + \pgf@xc=#1% + \pgf@yc=#2% +} + +\def\pgfprocess@@specialclosemoveto#1#2#3{% + \pgfsyssoftpath@linetotoken{#2}{#3}% +} + + +\def\pgfprocess@cleanupafterclose#1#2#3{% + \edef\pgfprocess@moveto{\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@marshal{\noexpand\pgfprocess@round\noexpand\pgfsyssoftpath@closepathtoken{\the\pgf@xc}{\the\pgf@yc}}% + \pgf@marshal% +} + + +% Replace start and end coordinates of a path +% +% #1 = new start coordinate +% #2 = new end coordinate +% +% Description: +% +% This command will replace the first and last coordinates on a path +% by the given coordinates. +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{10}{40}{0} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfsetlinewidth{2pt} +% \pgfusepath{stroke} +% \pgfprocesspathextractpoints{\mypath} +% \pgfprocesspathreplacestartandend{\mypath} +% {\pgfpointlineatdistance{2pt}{\pgfpointfirstonpath}{\pgfpointsecondonpath}}% +% {\pgfpointlineatdistance{2pt}{\pgfpointlastonpath}{\pgfpointsecondlastonpath}}% +% \pgfsyssoftpath@setcurrentpath\mypath +% \pgfsetlinewidth{1pt} +% \color{red} +% \pgfusepath{stroke} + +\def\pgfprocesspathreplacestartandend#1#2#3{% + \ifx#1\pgfutil@empty% + \else% + {% + % We (mis)use the current path to store (in a buffered manner) the + % rest path. + \pgfsyssoftpath@getcurrentpath\pgf@replace@origpath% + \let\pgf@prepath=\pgfutil@empty% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \expandafter\pgf@replaceprocessfirst#1\pgf@stop% + \pgfsyssoftpath@getcurrentpath\pgf@restpath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter#1% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgf@prepath% + \expandafter\pgf@newstart\pgf@restpath}% + % Restore current path + \pgfsyssoftpath@setcurrentpath\pgf@replace@origpath% + }% + \fi% +} + +\def\pgf@replaceprocessfirst#1#2#3#4{% + \def\pgf@origstart{#1{#2}{#3}}% + \edef\pgf@newstart{\noexpand#1{\the\pgf@x}{\the\pgf@y}}% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \ifx#4\pgf@stop% + \let\pgf@next=\pgfutil@gobble% + \else% + \let\pgf@next=\pgf@replaceprocessother% + \let\pgf@@next=\pgf@@replaceprocessother% + \fi% + \pgf@next#4% +} + +\def\pgf@replaceprocessother#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + \pgf@replace@handle@move% + \fi% + \pgf@@next#1% +} +\def\pgf@@replaceprocessother#1#2#3#4{% + \ifx#4\pgf@stop% + \edef\pgf@restpathaddition{{\noexpand#1{\the\pgf@xa}{\the\pgf@ya}}}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgf@restpathaddition% + \let\pgf@next=\pgfutil@gobble% + \else% + \pgfsyssoftpath@addtocurrentpath{#1{#2}{#3}}% + \fi% + \pgf@next#4% +} + +\def\pgf@replace@handle@move{% + \pgfsyssoftpath@getcurrentpath\pgf@restpath% + % Arggghh! Must reset everything! + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgf@prepath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgf@prepath% + \expandafter\pgf@origstart\pgf@restpath}% + % Redo first. + \let\pgf@@next=\pgf@replaceprocessfirst% +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex new file mode 100644 index 00000000000..e14a4e44447 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex @@ -0,0 +1,228 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.11 2008/01/23 13:15:28 tantau Exp $ + + +% Stroke/fill/clip/etc. the current path. Depending on the options, +% the current path will be stroked/filled/clipped/etc. If no options +% are given, the path is stroked. If multiple options are given, all +% of them are performed (in a sensible order). +% +% #1 = action(s) to be applied to the current path. Valid actions are: +% stroke - strokes the path. If no options are given, this is the +% default. +% draw - same as stroke. +% fill - fills the path. +% clip - clip the path. +% discard - Discards the path. Same effect as having an empty +% options list. +% +% Example: +% +% % Draws an edge. +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfusepath{stroke} + +\pgfkeys{ + /pgf/stroke/.code=\def\pgf@up@stroke{stroke}, + /pgf/draw/.code=\def\pgf@up@stroke{stroke}, + /pgf/fill/.code=\def\pgf@up@fill{fill}, + /pgf/clip/.code=\def\pgf@up@clip{clip}, + /pgf/discard/.code=, + /pgf/use as bounding box/.code=\def\pgf@up@bb{\pgf@relevantforpicturesizefalse} +} + +\def\pgfusepath#1{% + \let\pgf@up@stroke\pgfutil@empty% + \let\pgf@up@fill\pgfutil@empty% + \let\pgf@up@clip\pgfutil@empty% + \let\pgf@up@discard\pgfutil@empty% + \let\pgf@up@bb\pgfutil@empty% + \pgfset{#1}% + \expandafter\def\expandafter\pgf@up@action\expandafter{\csname pgfsys@\pgf@up@fill\pgf@up@stroke\endcsname}% + \ifx\pgf@up@stroke\pgfutil@empty% + \ifx\pgf@up@fill\pgfutil@empty% + \ifx\pgf@up@clip\pgfutil@empty% + \let\pgf@up@action=\pgfutil@empty% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \else% + % only clipping + \let\pgf@up@action=\pgfsys@discardpath% + \fi% + \fi% + \fi% + \pgfsyssoftpath@getcurrentpath\pgf@last@processed@path + \pgfprocessround{\pgf@last@processed@path}{\pgf@last@processed@path}% change the path + \pgfsyssoftpath@setcurrentpath\pgf@last@processed@path% + % + % Check whether the path is stroked. If so, add half the line width + % to the bounding box. + % + \ifpgf@relevantforpicturesize% + \ifx\pgf@up@stroke\pgfutil@empty% + \else% + \ifdim\pgf@picmaxx=-16000pt\relax% + \else% + \pgf@x=\pgf@pathminx\advance\pgf@x by-.5\pgflinewidth% + \ifdim\pgf@x<\pgf@picminx\global\pgf@picminx\pgf@x\fi% + \pgf@y=\pgf@pathminy\advance\pgf@y by-.5\pgflinewidth% + \ifdim\pgf@y<\pgf@picminy\global\pgf@picminy\pgf@y\fi% + \pgf@x=\pgf@pathmaxx\advance\pgf@x by.5\pgflinewidth% + \ifdim\pgf@x>\pgf@picmaxx\global\pgf@picmaxx\pgf@x\fi% + \pgf@y=\pgf@pathmaxy\advance\pgf@y by.5\pgflinewidth% + \ifdim\pgf@y>\pgf@picmaxy\global\pgf@picmaxy\pgf@y\fi% + \fi% + \fi% + \fi% + % + \ifx\pgf@up@clip\pgfutil@empty% + \ifx\pgf@up@stroke\pgfutil@empty% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \else% + \pgf@check@for@arrows% + \ifpgf@drawarrows% + \pgf@shorten@path@as@needed% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \pgf@add@arrows@as@needed% + \else% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \fi% + \fi% + \else% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgfsys@clipnext% + \pgf@up@action% + \pgf@relevantforpicturesizefalse% + \fi% + \pgf@up@bb% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \pgf@resetpathsizes% + \ignorespaces% +} + + +% Shorten start/end of paths by a certain amount. +% +% #1 = amount by which paths should be shortened. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{10pt}{0pt} +% +% % The following has the same effect: +% \pgfsetshortenstart{1pt} +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{11pt}{0pt} + +\def\pgfsetshortenstart#1{\pgfmathsetlength\pgf@shorten@start@additional{#1}} +\def\pgfsetshortenend#1{\pgfmathsetlength\pgf@shorten@end@additional{#1}} + +\newif\ifpgf@drawarrows + +\def\pgf@check@for@arrows{% + \pgf@drawarrowsfalse% + \ifx\pgf@startarrow\pgfutil@empty\else\pgf@drawarrowstrue\fi% + \ifx\pgf@endarrow\pgfutil@empty\else\pgf@drawarrowstrue\fi% + \ifdim\pgf@shorten@end@additional=0pt\relax\else\pgf@drawarrowstrue\fi% + \ifdim\pgf@shorten@start@additional=0pt\relax\else\pgf@drawarrowstrue\fi% + \ifpgf@drawarrows% + \pgfsyssoftpath@getcurrentpath\pgf@arrowpath% + \ifx\pgf@arrowpath\pgfutil@empty% + \pgf@drawarrowsfalse% + \else% + \pgfprocesscheckclosed{\pgf@arrowpath}{\pgf@drawarrowsfalse}% + \fi% + \fi% +} + +\newdimen\pgf@shorten@end@additional +\newdimen\pgf@shorten@start@additional + +\let\pgf@shorten@end=\pgfutil@empty +\let\pgf@shorten@start=\pgfutil@empty + +\def\pgf@shorten@path@as@needed{% + \pgfprocesspathextractpoints{\pgf@arrowpath}% + \let\pgf@arrow@next=\pgf@shorten@now% + \ifx\pgf@shorten@start\pgfutil@empty% + \ifx\pgf@shorten@end\pgfutil@empty% + \ifdim\pgf@shorten@end@additional=0pt\relax% + \ifdim\pgf@shorten@start@additional=0pt\relax% + \let\pgf@arrow@next=\relax% + \fi% + \fi% + \fi% + \fi% + \pgf@arrow@next% +} + +\def\pgf@shorten@now{% + {% + \pgf@x=0pt% + \pgf@shorten@start% + \advance\pgf@x by\pgf@shorten@start@additional% + \pgf@xc=\pgf@x% + \pgfpointlineatdistance{\pgf@xc}{\pgfpointfirstonpath}{\pgfpointsecondonpath}% + \global\pgf@xb=\pgf@x% + \global\pgf@yb=\pgf@y% + \pgf@process{\pgfpointsecondonpath}% + \global\advance\pgf@x by\pgf@xa% + \global\advance\pgf@y by\pgf@ya% + }% + \edef\pgfpointfirstonpath{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + \edef\pgfpointsecondonpath{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + {% + \pgf@x=0pt% + \pgf@shorten@end% + \advance\pgf@x by\pgf@shorten@end@additional% + \pgf@xc=\pgf@x% + \pgfpointlineatdistance{\pgf@xc}{\pgfpointlastonpath}{\pgfpointsecondlastonpath}% + \global\pgf@xb=\pgf@x% + \global\pgf@yb=\pgf@y% + \pgf@process{\pgfpointsecondlastonpath}% + \global\advance\pgf@x by\pgf@xa% + \global\advance\pgf@y by\pgf@ya% + }% + \edef\pgfpointlastonpath{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + \edef\pgfpointsecondlastonpath{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfprocesspathreplacestartandend{\pgf@arrowpath}{\pgfpointfirstonpath}{\pgfpointlastonpath}% + \pgfsyssoftpath@setcurrentpath\pgf@arrowpath% +} + +\def\pgf@add@arrows@as@needed{% + \ifx\pgf@startarrow\pgfutil@empty% + \else% + \pgflowlevelobj% + {\pgftransformarrow{\pgfpointsecondonpath}{\pgfpointfirstonpath}} + {\pgf@startarrow}% + \fi% + \ifx\pgf@endarrow\pgfutil@empty% + \else% + \pgflowlevelobj% + {\pgftransformarrow{\pgfpointsecondlastonpath}{\pgfpointlastonpath}} + {\pgf@endarrow}% + \fi% +} + +\let\pgf@startarrow=\pgfutil@empty +\let\pgf@endarrow=\pgfutil@empty + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex new file mode 100644 index 00000000000..3ab2b4e009b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex @@ -0,0 +1,1173 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.13 2008/02/03 19:37:26 tantau Exp $ + +\newdimen\pgf@picminx +\newdimen\pgf@picmaxx +\newdimen\pgf@picminy +\newdimen\pgf@picmaxy + +\newdimen\pgf@pathminx +\newdimen\pgf@pathmaxx +\newdimen\pgf@pathminy +\newdimen\pgf@pathmaxy + +\newif\ifpgf@relevantforpicturesize + +\def\pgf@process#1{{#1\global\pgf@x=\pgf@x\global\pgf@y=\pgf@y}} + +% Save a point. +% +% #1 = macro for storing point. +% #2 = code for point (should define x and y) +% +% Example: +% +% \pgfextract@process\mypoint{\pgf@x=10pt \pgf@y10pt} +% \pgfextract@process\myarcpoint{\pgfpointpolar{30}{5cm and 2cm}} + +\def\pgfextract@process#1#2{% + \pgf@process{#2}% + \edef#1{\noexpand\pgf@x\the\pgf@x\noexpand\pgf@y\the\pgf@y}% +} +% This needed until old shapes code changed. +\let\pgfsavepgf@process\pgfextract@process% + + +% Return a point +% +% #1 = x-coordinate of the point +% #2 = y-coordinate of the point +% +% x = #1 +% y = #2 +% +% Example: +% +% \pgfpathmoveto{\pgfpoint{2pt+3cm}{3cm}} + +\def\pgfpoint#1#2{% + \pgfmathsetlength\pgf@x{#1}% + \pgfmathsetlength\pgf@y{#2}\ignorespaces} + + +% Quickly a point +% +% #1 = x-coordinate of the point (no calculations done) +% #2 = y-coordinate of the point (no calculations done) +% +% x = #1 +% y = #2 +% +% Example: +% +% \pgfpathmoveto{\pgfqpoint{2pt}{3cm}} + +\def\pgfqpoint#1#2{\pgf@x=#1\pgf@y=#2} + + + +% Return the origin. +% +% x = 0 +% y = 0 +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} + +\def\pgfpointorigin{\pgf@x=0pt\pgf@y=\pgf@x\ignorespaces} + + + +% Return a transformed point +% +% #1 = a point +% +% Description: +% +% This command applies pgf's current transformation matrix to the +% given point. Normally, this is done automatically by commands like +% lineto or moveto, but sometimes you may wish to access a transformed +% point yourself. In the below example, this command is used for a low level +% coordinate system shift. +% +% In addition to applying the transformation matrix to the given +% point, this function also applies the pre- and post-morphing +% macros. +% +% Example: +% +% \begin{pgflowleveltransformshiftscope}{\pgfpointtransformed{\pgfpointorigin}} +% \pgfbox[center,center]{Hi!} +% \end{pgflowleveltransformshiftscope} + +\def\pgfpointtransformed#1{% + \pgf@process{% + #1% + \pgfmorph@prelist% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgfmorph@postlist% + }% +} + + +% Return the difference vector of two points. +% +% #1 = start of vector +% #2 = end of vector +% +% x = x-component of difference +% y = y-component of difference +% +% Example: +% +% \pgfpathmoveto{\pgfpointdiff{\pgfpointxy{1}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointdiff#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by-\pgf@xa\relax% + \advance\pgf@y by-\pgf@ya\relax\ignorespaces} + +% Add two vectors. +% +% #1 = first vector +% #2 = second vector +% +% x = x-component of addition +% y = y-component of addition +% +% Example: +% +% \pgfpathmoveto{\pgfpointadd{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointadd#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya} + + + +% Multiply a vector by a factor. +% +% #1 = factor +% #2 = vector +% +% Example: +% +% \pgfpointscale{2}{\pgfpointxy{0}{1}} + +\def\pgfpointscale#1#2{% + \pgf@process{#2}% + \pgf@x=#1\pgf@x% + \pgf@y=#1\pgf@y% +} + + +% The intersection of two lines +% +% #1 = point on first line +% #2 = another point on first line +% #3 = point on second line +% #4 = another point on second line +% +% Returns the intersection of the two lines. If there is no +% intersection or if the points #1 and #2 or the points #3 and #4 are +% identical, the behaviour is not specified. +% +% Example: +% +% \pgfpointintersectionoflines{\pgfpointxy{0}{1}}{\pgfpointxy{1}{0}}{\pgfpointxy{2}{2}}{\pgfpointxy{3}{4}} + +\def\pgfpointintersectionoflines#1#2#3#4{% + { + % + % Compute orthogonal vector to #1--#2 + % + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \pgf@ya=-\pgf@ya% + % Normalise a bit + \c@pgf@counta=\pgf@xa% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta\relax% + \fi% + \c@pgf@countb=\pgf@ya% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb\relax% + \fi% + \advance\c@pgf@counta by\c@pgf@countb\relax% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta>0\relax% + \divide\pgf@xa by\c@pgf@counta\relax% + \divide\pgf@ya by\c@pgf@counta\relax% + \fi% + % + % Compute projection + % + \pgf@xc=\pgf@sys@tonumber{\pgf@ya}\pgf@x% + \advance\pgf@xc by\pgf@sys@tonumber{\pgf@xa}\pgf@y% + % + % The orthogonal vector is (\pgf@ya,\pgf@xa) + % + % + % Compute orthogonal vector to #3--#4 + % + \pgf@process{#4}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#3}% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + \pgf@yb=-\pgf@yb% + % Normalise a bit + \c@pgf@counta=\pgf@xb% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta\relax% + \fi% + \c@pgf@countb=\pgf@yb% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb\relax% + \fi% + \advance\c@pgf@counta by\c@pgf@countb\relax% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta>0\relax% + \divide\pgf@xb by\c@pgf@counta\relax% + \divide\pgf@yb by\c@pgf@counta\relax% + \fi% + % + % Compute projection + % + \pgf@yc=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \advance\pgf@yc by\pgf@sys@tonumber{\pgf@xb}\pgf@y% + % + % The orthogonal vector is (\pgf@yb,\pgf@xb) + % + % Setup transformation matrx (this is just to use the matrix + % inversion) + % + \pgfsettransform{{\pgf@sys@tonumber\pgf@ya}{\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@xb}{0pt}{0pt}}% + \pgftransforminvert% + \pgf@process{\pgfpointtransformed{\pgfpoint{\pgf@xc}{\pgf@yc}}}% + }% +} + + +% The intersection of two circles +% +% #1 = center of first circle +% #2 = center of second circle +% #3 = radius of first circle +% #4 = radius of second circle +% #5 = solution number +% +% Returns the intersection of the two circles. If #5 is to "1", the +% first intersection is returned, otherwise the second. If the circles +% do not intersect, an error may occur. +% +% Example: +% +% \pgfpointintersectionofcircles{\pgfpointxy{0}{1}}{\pgfpointxy{1}{0}}{1cm}{1cm}{1} + +\def\pgfpointintersectionofcircles#1#2#3#4#5{% + {% + % Store first point in (xa,ya) and radius in xc. + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfmathsetlength{\pgf@xc}{#3}% + % Store second point in (xb,yb) and radius in yc. + \pgf@process{#2}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgfmathsetlength{\pgf@yc}{#4}% + % + % Ok, now make numbers smaller, in case they are too large + % + \c@pgf@counta=1\relax% + \loop% + \pgf@scale@downfalse% + \ifdim\pgf@xc>50pt\relax% + \pgf@scale@downtrue% + \fi% + \ifdim\pgf@yc>50pt\relax% + \pgf@scale@downtrue% + \fi% + \ifpgf@scale@down% + \multiply\c@pgf@counta by2\relax% + \divide\pgf@xa by2\relax% + \divide\pgf@ya by2\relax% + \divide\pgf@xb by2\relax% + \divide\pgf@yb by2\relax% + \divide\pgf@xc by2\relax% + \divide\pgf@yc by2\relax% + \repeat% + % The following code is taken from the Dr. Math internet forum: + % + % Let the centers be: (a,b), (c,d) + % Let the radii be: r, s + % + % e = c - a [difference in x coordinates] + % f = d - b [difference in y coordinates] + % p = sqrt(e^2 + f^2) [distance between centers] + % k = (p^2 + r^2 - s^2)/(2p) [distance from center 1 to line + % joining points of intersection] + % x = a + ek/p + (f/p)sqrt(r^2 - k^2) + % y = b + fk/p - (e/p)sqrt(r^2 - k^2) + % OR + % x = a + ek/p - (f/p)sqrt(r^2 - k^2) + % y = b + fk/p + (e/p)sqrt(r^2 - k^2) + % + % Since we are running low on registers, use + % \dimen0 for e + % \dimen1 for f + % \dimen2 for p + % \dimen3 for p^2 + % \dimen4 for k + % \dimen5 for 1/p + % \dimen6 for sqrt(r^2 - k^2) + % \dimen7 for k^2 + % \dimen8 for k/p + % \dimen9 for sqrt(r^2 - k^2)/p + % Also note that: + % \pgf@xa for a + % \pgf@ya for b + % \pgf@xb for c + % \pgf@yb for d + % \pgf@xc for r + % \pgf@yc for s + % + % Now: + % e = c - a + \dimen0=\pgf@xb% + \advance\dimen0 by-\pgf@xa% + % f = d - b + \dimen1=\pgf@yb% + \advance\dimen1 by-\pgf@ya% + % p^2 = e^2 + f^2 + \pgf@x=\dimen0\relax% + \pgf@x=\pgf@sys@tonumber{\pgf@x}\pgf@x% + \dimen3=\pgf@x% + \pgf@x=\dimen1\relax% + \advance\dimen3 by\pgf@sys@tonumber{\pgf@x}\pgf@x% + % p = sqrt(p^2) + \pgfmathparse{sqrt(\the\dimen3)}% + \dimen2=\pgfmathresult pt% + % 1/p = 1/p + \pgfmathreciprocal@{\pgfmathresult}% + \dimen5=\pgfmathresult pt% + % k = (p^2 + r^2 - s^2)/(2p) + \dimen4=\dimen3\relax% + \pgf@x=\pgf@xc% + \advance\dimen4 by\pgf@sys@tonumber{\pgf@x}\pgf@x\relax% + \pgf@x=\pgf@yc% + \advance\dimen4 by-\pgf@sys@tonumber{\pgf@x}\pgf@x\relax% + \dimen4=.5\dimen4% + \dimen4=\pgf@sys@tonumber{\dimen5}\dimen4% + % dimen7 is k^2 + \dimen7=\pgf@sys@tonumber{\dimen4}\dimen4\relax% + % dimen6 is sqrt(r^2 - k^2) + \pgfmathparse{sqrt(\pgf@sys@tonumber{\pgf@xc}\pgf@xc-\the\dimen7)}% + \dimen6=\pgfmathresult pt% + % dimen8 is k/p + \dimen8=\pgf@sys@tonumber{\dimen4}\dimen5\relax% + % dimen9 is sqrt(r^2 - k^2)/p + \dimen9=\pgf@sys@tonumber{\dimen6}\dimen5\relax% + \ifnum#5=1\relax% + % x = a + ek/p + (f/p)sqrt(r^2 - k^2) + \pgf@x=\pgf@xa% + \advance\pgf@x by\pgf@sys@tonumber{\dimen0}\dimen8\relax% + \advance\pgf@x by\pgf@sys@tonumber{\dimen1}\dimen9\relax% + % y = b + fk/p - (e/p)sqrt(r^2 - k^2) + \pgf@y=\pgf@ya% + \advance\pgf@y by\pgf@sys@tonumber{\dimen1}\dimen8\relax% + %temp + \pgf@xb=\pgf@sys@tonumber{\dimen0}\dimen9% + \pgf@xb=-\pgf@xb% + \advance\pgf@y by\pgf@xb\relax% + \else% + % x = a + ek/p - (f/p)sqrt(r^2 - k^2) + \pgf@x=\pgf@xa% + \advance\pgf@x by\pgf@sys@tonumber{\dimen0}\dimen8\relax% + %temp + \pgf@xb=\pgf@sys@tonumber{\dimen1}\dimen9% + \pgf@xb=-\pgf@xb% + \advance\pgf@x by\pgf@xb\relax% + % y = b + fk/p + (e/p)sqrt(r^2 - k^2) + \pgf@y=\pgf@ya% + \advance\pgf@y by\pgf@sys@tonumber{\dimen1}\dimen8\relax% + \advance\pgf@y by\pgf@sys@tonumber{\dimen0}\dimen9\relax% + \fi% + \pgf@x=\c@pgf@counta\pgf@x% + \pgf@y=\c@pgf@counta\pgf@y% + \pgf@process{}% get results outside + }% +} +\newif\ifpgf@scale@down + + +% Returns point on a line from #2 to #3 at time #1. +% +% #1 = a time, where 0 is the start and 1 is the end +% #2 = start point +% #3 = end point +% +% x = x-component of #1*start + (1-#1)*end +% y = y-component of #1*start + (1-#1)*end +% +% Example: +% +% % Middle of (1,1) and (2,3) +% \pgfpathmoveto{\pgfpointlineattime{0.5}{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointlineattime#1#2#3{% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@xa by-\pgf@x\relax% + \advance\pgf@ya by-\pgf@y\relax% + \advance\pgf@x by #1\pgf@xa\relax% + \advance\pgf@y by #1\pgf@ya\relax% + \ignorespaces} + + +% Move point #2 #1 many units in the direction of #3. +% +% #1 = a distance +% #2 = start point +% #3 = end point +% +% x = x-component of start + #1*(normalise(end-start)) +% y = y-component of start + #1*(normalise(end-start)) +% xa = #1*(normalise(end-start)) +% ya = #1*(normalise(end-start)) +% +% Example: +% +% +% \pgfpathmoveto{\pgfpointlineatdistance{2pt}{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} +% \pgfpathlineto{\pgfpointlineatdistance{3pt}{\pgfpointxy{2}{3}}{\pgfpointxy{0}{1}}} + +\def\pgfpointlineatdistance#1#2#3{% + \pgf@process{#2}% + \pgf@xb=\pgf@x\relax% xb/yb = start point + \pgf@yb=\pgf@y\relax% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xb\relax% + \advance\pgf@y by-\pgf@yb\relax% + \pgf@process{\pgfpointnormalised{}}% x/y = normalised vector + \pgfmathsetlength\pgf@xa{#1}% + \pgf@ya=\pgf@xa\relax% + \pgf@xa=\pgf@sys@tonumber{\pgf@x}\pgf@xa% + \pgf@ya=\pgf@sys@tonumber{\pgf@y}\pgf@ya% + \pgf@x=\pgf@xb\relax% + \pgf@y=\pgf@yb\relax% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \ignorespaces} + + +% Returns point on a curve from #2 to #5 with controls #3 and #4 at time #1. +% +% #1 = a time +% #2 = start point +% #3 = first control point +% #4 = second control point +% #5 = end point +% +% x = x-component of place on the curve at time t +% y = y-component of place on the curve at time t +% +% Additionally, (\pgf@xa,\pgf@ya) and (\pgf@xb,\pgf@yb) will be on a +% tangent to the point on the curve (this can be useful for computing +% a label rotation). +% +% Example: +% +% % Middle of (1,1) and (2,3) +% \pgfpathmoveto{\pgfpointcurveattime{0.5}{\pgfpointxy{0}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointcurveattime#1#2#3#4#5{% + \pgfmathparse{#1}% + \let\pgf@time@s=\pgfmathresult% + \pgf@x=\pgfmathresult pt% + \pgf@x=-\pgf@x% + \advance\pgf@x by 1pt% + \edef\pgf@time@t{\pgf@sys@tonumber{\pgf@x}}% + \pgf@process{#5}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#4}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + % First iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + \pgf@xb=\pgf@time@t\pgf@xb\advance\pgf@xb by\pgf@time@s\pgf@xc% + \pgf@yb=\pgf@time@t\pgf@yb\advance\pgf@yb by\pgf@time@s\pgf@yc% + % Second iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + % Save x/y + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + % Third iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% +} + + + + + + +% Internal registers +\newdimen\pgf@xx +\newdimen\pgf@xy +\newdimen\pgf@yx +\newdimen\pgf@yy +\newdimen\pgf@zx +\newdimen\pgf@zy + + + +% A polar coordinate +% +% #1 = a degree +% #2 = a radius -- either a dimension or two dimensions separated by +% " and ". +% +% x = (first dimension in #2) * cos(#1) +% y = (second dimension in #2) * sin(#2) +% +% Example: +% +% \pgfpathmoveto{\pgfpointpolar{30}{1cm}} +% \pgfpathlineto{\pgfpointpolar{30}{1cm and 2cm}} + +\def\pgfpointpolar#1#2{% + \pgfutil@in@{and }{#2}% + \ifpgfutil@in@% + \pgf@polar@#2\@@% + \else% + \pgf@polar@#2 and #2\@@% + \fi% + \pgfmathparse{#1}% + \let\pgfpoint@angle=\pgfmathresult% + \pgfmathcos@{\pgfpoint@angle}% + \pgf@x=\pgfmathresult\pgf@x% + \pgfmathsin@{\pgfpoint@angle}% + \pgf@y=\pgfmathresult\pgf@y% +} + +\def\pgf@polar@#1and #2\@@{% + \pgfmathsetlength{\pgf@y}{#2}% + \pgfmathsetlength{\pgf@x}{#1}% +} + +% Quick version of the polar coordinate method + +\def\pgfqpointpolar#1#2{% + \pgf@x=#2% + \pgf@y=\pgf@x% + \pgfmathcos@{#1}% + \pgf@x=\pgfmathresult\pgf@x% + \pgfmathsin@{#1}% + \pgf@y=\pgfmathresult\pgf@y\relax% +} + + + + +% A polar coordinate in the xy plane. +% +% #1 = a degree +% #2 = a radius given as a number or two radi +% +% result = (first dim in #2) * x-vector * cos(#1) + +% (second dim in #2) * y-vector * sin(#1) +% +% Example: +% +% \pgfpathmoveto{\pgfpointpolarxy{30}{2}} + +\def\pgfpointpolarxy#1#2{% + \pgfutil@in@{and }{#2}% + \ifpgfutil@in@% + \pgf@polarxy@#2\@@% + \else% + \pgf@polarxy@#2and #2\@@% + \fi% + \pgfmathparse{#1}% + \let\pgfpoint@angle=\pgfmathresult% + \pgfmathcos@{\pgfpoint@angle}% + \pgf@xa=\pgfmathresult\pgf@xa% + \pgfmathsin@{\pgfpoint@angle}% + \pgf@ya=\pgfmathresult\pgf@ya% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@xx% + \advance\pgf@x by \pgf@sys@tonumber{\pgf@ya}\pgf@yx% + \pgf@y=\pgf@sys@tonumber{\pgf@xa}\pgf@xy% + \advance\pgf@y by \pgf@sys@tonumber{\pgf@ya}\pgf@yy} + +\def\pgf@polarxy@#1and #2\@@{% + \pgfmathsetlength{\pgf@xa}{#1}% + \pgfmathsetlength{\pgf@ya}{#2}% +} + + + +% A cylindrical coordinate. +% +% #1 = a degree +% #2 = a radius given as a number +% #3 = a height given as a number +% +% result = #2*(x-vector * cos(#1) + y-vector * sin(#1)) + #3*z-vector +% +% Example: +% +% \pgfpathmoveto{\pgfpointcylindrical{30}{2}{1}} + +\def\pgfpointcylindrical#1#2#3{% + \pgfpointpolarxy{#1}{#2}% + \pgfmathparse{#3}% + \advance\pgf@x by \pgfmathresult\pgf@zx% + \advance\pgf@y by \pgfmathresult\pgf@zy} + + +% A spherical coordinate. +% +% #1 = a longitude +% #2 = a latitude +% #3 = a radius +% +% result = #3*(cos(#2)*(x-vector * cos(#1) + y-vector * sin(#1)) + sin(#2)*z-vector) +% +% Example: +% +% \pgfpathmoveto{\pgfpointspherical{30}{30}{2}} + +\def\pgfpointspherical#1#2#3{% + \pgfmathparse{#1}% + \let\pgfpoint@angle=\pgfmathresult% + \pgfmathsin@{\pgfpoint@angle}% + \pgf@xb=\pgfmathresult\pgf@xx% + \pgf@yb=\pgfmathresult\pgf@xy% + \pgfmathcos@{\pgfpoint@angle}% + \advance\pgf@xb by \pgfmathresult\pgf@yx% + \advance\pgf@yb by \pgfmathresult\pgf@yy% + % + \pgfmathparse{#2}% + \let\pgfpoint@angle=\pgfmathresult% + \pgfmathcos@{\pgfpoint@angle}% + \pgf@xc=\pgfmathresult\pgf@xb% + \pgf@yc=\pgfmathresult\pgf@yb% + \pgfmathsin@{\pgfpoint@angle}% + \advance\pgf@xc by \pgfmathresult\pgf@zx% + \advance\pgf@yc by \pgfmathresult\pgf@zy% + \pgfmathparse{#3}% + \pgf@x=\pgfmathresult\pgf@xc% + \pgf@y=\pgfmathresult\pgf@yc\relax% +} + + +% Store the vector #1 * x-vec + #2 * y-vec +% +% #1 = a factor for the x-vector +% #2 = a factor fot the y-vector +% +% x = x-component of result vector +% y = y-component of result vector +% +% Description: +% +% This command can be used to create a new coordinate system +% without using the rotate/translate/scale commands. This +% may be useful, if you do not want arrows and line width to +% be scaled/transformed together with the coordinate system. +% +% Example: +% +% % Create a slanted rectangle +% +% \pgfsetxvec{\pgfpoint{1cm}{1cm}} +% \pgfsetyvec{\pgfpoint{0cm}{1cm}} +% +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfpathlineto{\pgfpointxy{1}{0}} +% \pgfpathlineto{\pgfpointxy{1}{1}} +% \pgfpathlineto{\pgfpointxy{0}{1}} +% \pgfclosestroke + +\def\pgfpointxy#1#2{% + \pgfmathparse{#1}% + \let\pgftemp@x=\pgfmathresult% + \pgfmathparse{#2}% + \let\pgftemp@y=\pgfmathresult% + \pgf@x=\pgftemp@x\pgf@xx% + \advance\pgf@x by \pgftemp@y\pgf@yx% + \pgf@y=\pgftemp@x\pgf@xy% + \advance\pgf@y by \pgftemp@y\pgf@yy} + + +% Store the vector #1 * x-vec + #2 * y-vec + #3 * z-vec +% +% #1 = a factor for the x-vector +% #2 = a factor fot the y-vector +% #3 = a factor fot the z-vector +% +% x = x-component of result vector +% y = y-component of result vector +% +% +% Description: +% +% This command allows you to use a 3d coordinate system. +% +% +% Example: +% +% % Draw a cubus +% +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{0}{0}{1}} +% \pgfline{\pgfpointxyz{0}{1}{0}}{\pgfpointxyz{0}{1}{1}} +% \pgfline{\pgfpointxyz{1}{0}{0}}{\pgfpointxyz{1}{0}{1}} +% \pgfline{\pgfpointxyz{1}{1}{0}}{\pgfpointxyz{1}{1}{1}} +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{0}{1}{0}} +% \pgfline{\pgfpointxyz{0}{0}{1}}{\pgfpointxyz{0}{1}{1}} +% \pgfline{\pgfpointxyz{1}{0}{0}}{\pgfpointxyz{1}{1}{0}} +% \pgfline{\pgfpointxyz{1}{0}{1}}{\pgfpointxyz{1}{1}{1}} +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{1}{0}{0}} +% \pgfline{\pgfpointxyz{0}{0}{1}}{\pgfpointxyz{1}{0}{1}} +% \pgfline{\pgfpointxyz{0}{1}{0}}{\pgfpointxyz{1}{1}{0}} +% \pgfline{\pgfpointxyz{0}{1}{1}}{\pgfpointxyz{1}{1}{1}} + +\def\pgfpointxyz#1#2#3{% + \pgfmathparse{#1}% + \let\pgftemp@x=\pgfmathresult% + \pgfmathparse{#2}% + \let\pgftemp@y=\pgfmathresult% + \pgfmathparse{#3}% + \let\pgftemp@z=\pgfmathresult% + \pgf@x=\pgftemp@x\pgf@xx% + \advance\pgf@x by \pgftemp@y\pgf@yx% + \advance\pgf@x by \pgftemp@z\pgf@zx% + \pgf@y=\pgftemp@x\pgf@xy% + \advance\pgf@y by \pgftemp@y\pgf@yy% + \advance\pgf@y by \pgftemp@z\pgf@zy} + + + + +% Set the x-vector +% +% #1 = a point the is the new x-vector +% +% Example: +% +% \pgfsetxvec{\pgfpoint{1cm}{0cm}} + +\def\pgfsetxvec#1{% + \pgf@process{#1}% + \pgf@xx=\pgf@x% + \pgf@xy=\pgf@y% + \ignorespaces} + + +% Set the y-vector +% +% #1 = a point the is the new y-vector +% +% Example: +% +% \pgfsetyvec{\pgfpoint{0cm}{1cm}} + +\def\pgfsetyvec#1{% + \pgf@process{#1}% + \pgf@yx=\pgf@x% + \pgf@yy=\pgf@y% + \ignorespaces} + + +% Set the z-vector +% +% #1 = a point the is the new z-vector +% +% Example: +% +% \pgfsetzvec{\pgfpoint{-0.385cm}{-0.385cm}} + +\def\pgfsetzvec#1{% + \pgf@process{#1}% + \pgf@zx=\pgf@x% + \pgf@zy=\pgf@y% + \ignorespaces} + + + +% Default values +\pgfsetxvec{\pgfpoint{1cm}{0cm}} +\pgfsetyvec{\pgfpoint{0cm}{1cm}} +\pgfsetzvec{\pgfpoint{-0.385cm}{-0.385cm}} + + + + +% Normalise a point. +% +% #1 = point with coordinates (a,b) +% +% x = a/\sqrt(a*a+b*b) +% y = b/\sqrt(a*a+b*b) +% +% Example: +% +% \pgfpointnormalised{\pgfpointxy{2}{1}} + +\def\pgfpointnormalised#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@x<0pt\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifdim\pgf@y<0pt\relax% + \pgf@y=-\pgf@y% + \fi% + \ifdim\pgf@x>\pgf@y% x > y + % make point small + \c@pgf@counta=\pgf@x% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \divide\pgf@x by\c@pgf@counta% + \divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \pgf@x=.125\pgf@x% + \pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@x% + \c@pgf@countb=\pgf@y% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \pgf@x=1pt\relax% + \pgf@y=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \pgf@x=\csname pgf@cosfrac\the\c@pgf@countb\endcsname pt% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@ya% + \pgf@y=\pgf@sys@tonumber{\pgf@x}\pgf@y% + \fi% + \ifdim\pgf@xa<0pt% + \pgf@x=-\pgf@x% + \fi% + \else% x <= y + % make point small + \c@pgf@counta=\pgf@y% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \divide\pgf@x by\c@pgf@counta% + \divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \pgf@x=.125\pgf@x% + \pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@y% + \c@pgf@countb=\pgf@x% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \pgf@y=1pt\relax% + \pgf@x=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \pgf@y=\csname pgf@cosfrac\the\c@pgf@countb\endcsname pt% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@xa% + \pgf@x=\pgf@sys@tonumber{\pgf@y}\pgf@x% + \fi% + \ifdim\pgf@ya<0pt% + \pgf@y=-\pgf@y% + \fi% + \fi\ignorespaces% +} + + + + + +% A point on a rectangle in a certain direction. +% +% #1 = a point pointing in some direction (length should be about 1pt, +% but need not be exact) +% #2 = upper right corner of a rectangle centered at the origin +% +% Returns the intersection of a line starting at the origin going in +% the given direction and the rectangle's border. +% +% Example: +% +% \pgfpointborderrectangle{\pgfpointnormalised{\pgfpointxy{2}{1}} +% {\pgfpoint{1cm}{2cm}} + +\def\pgfpointborderrectangle#1#2{% + \pgf@process{#2}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#1}% + % Ok, let's find out about the direction: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifnum\pgf@xa<0\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifnum\pgf@ya<0\relax% + \pgf@y=-\pgf@y% + \fi% + \pgf@xc=.125\pgf@x% + \pgf@yc=.125\pgf@y% + \c@pgf@counta=\pgf@xc% + \c@pgf@countb=\pgf@yc% + \ifnum\c@pgf@countb<\c@pgf@counta% + \ifnum\c@pgf@counta<255\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% \pgf@xc = 1/\pgf@x + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xb}\pgf@y% + \ifnum\pgf@y<\pgf@yb% + \pgf@x=\pgf@xb% + \else% rats, calculate intersection on upper side + \ifnum\c@pgf@countb<255\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@yc=8192pt% + \divide\pgf@yc by\c@pgf@countb% \pgf@xc = 1/\pgf@x + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \pgf@y=\pgf@yb% + \fi% + \fi% + \fi% + \else% + \ifnum\c@pgf@countb<255\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@yc=8192pt% + \divide\pgf@yc by\c@pgf@countb% \pgf@xc = 1/\pgf@x + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \ifnum\pgf@x<\pgf@xb% + \pgf@y=\pgf@yb% + \else% + \ifnum\c@pgf@counta<255\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% \pgf@xc = 1/\pgf@x + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xb}\pgf@y% + \pgf@x=\pgf@xb% + \fi% + \fi% + \fi% + \fi% + \ifnum\pgf@xa<0\relax\pgf@x=-\pgf@x\fi% + \ifnum\pgf@ya<0\relax\pgf@y=-\pgf@y\fi% +} + + + + +% An approximation to a point on an ellipse in a certain +% direction. Will be exact only if the ellipse is a circle. +% +% #1 = a point pointing in some direction +% #2 = upper right corner of a bounding box for the ellipse +% +% Returns the intersection of a line starting at the origin going in +% the given direction and the ellipses border. +% +% Example: +% +% \pgfpointborderellipse{\pgfpointnormalised{\pgfpointxy{2}{1}} +% {\pgfpoint{1cm}{2cm}} + +\def\pgfpointborderellipse#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@xa=\pgf@ya% circle. that's easy! + \pgf@process{\pgfpointnormalised{#1}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@xa}\pgf@y% + \else% + \ifdim\pgf@xa<\pgf@ya% + % Ok, first, let's compute x/y: + \c@pgf@countb=\pgf@ya% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@xc=\pgf@x% + \pgf@yc=8192pt% + \pgf@y=.125\pgf@y% + \c@pgf@countb=\pgf@y% + \divide\pgf@yc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@y=\pgf@sys@tonumber{\pgf@yc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \else% + % Ok, now let's compute y/x: + \c@pgf@countb=\pgf@xa% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@yc=\pgf@y% + \pgf@xc=8192pt% + \pgf@x=.125\pgf@x% + \c@pgf@countb=\pgf@x% + \divide\pgf@xc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@x% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \fi% + \fi% +} + + + + + +% Extract the x-coordinate of a point to a dimensions +% +% #1 = a TeX dimension +% #2 = a point +% +% Example: +% +% \newdimen\mydim +% \pgfextractx{\mydim}{\pgfpoint{2cm}{4pt}} +% % \mydim is now 2cm + +\def\pgfextractx#1#2{% + \pgf@process{#2}% + #1=\pgf@x\relax} + + +% Extract the y-coordinate of a point to a dimensions +% +% #1 = a TeX dimension +% #2 = a point +% +% Example: +% +% \newdimen\mydim +% \pgfextracty{\mydim}{\pgfpoint{2cm}{4pt}} +% % \mydim is now 4pt + +\def\pgfextracty#1#2{% + \pgf@process{#2}% + #1=\pgf@y\relax} + + + +\def\pgf@def#1#2#3{\expandafter\def\csname pgf@#1#2\endcsname{#3}} +\pgf@def{cosfrac}{0}{1} +\pgf@def{cosfrac}{1}{0.99995} \pgf@def{cosfrac}{2}{0.9998} +\pgf@def{cosfrac}{3}{0.99955} \pgf@def{cosfrac}{4}{0.999201} +\pgf@def{cosfrac}{5}{0.998752} \pgf@def{cosfrac}{6}{0.998205} +\pgf@def{cosfrac}{7}{0.997559} \pgf@def{cosfrac}{8}{0.996815} +\pgf@def{cosfrac}{9}{0.995974} \pgf@def{cosfrac}{10}{0.995037} +\pgf@def{cosfrac}{11}{0.994004} \pgf@def{cosfrac}{12}{0.992877} +\pgf@def{cosfrac}{13}{0.991656} \pgf@def{cosfrac}{14}{0.990342} +\pgf@def{cosfrac}{15}{0.988936} \pgf@def{cosfrac}{16}{0.987441} +\pgf@def{cosfrac}{17}{0.985856} \pgf@def{cosfrac}{18}{0.984183} +\pgf@def{cosfrac}{19}{0.982424} \pgf@def{cosfrac}{20}{0.980581} +\pgf@def{cosfrac}{21}{0.978653} \pgf@def{cosfrac}{22}{0.976644} +\pgf@def{cosfrac}{23}{0.974555} \pgf@def{cosfrac}{24}{0.972387} +\pgf@def{cosfrac}{25}{0.970143} \pgf@def{cosfrac}{26}{0.967823} +\pgf@def{cosfrac}{27}{0.965429} \pgf@def{cosfrac}{28}{0.962964} +\pgf@def{cosfrac}{29}{0.960429} \pgf@def{cosfrac}{30}{0.957826} +\pgf@def{cosfrac}{31}{0.955157} \pgf@def{cosfrac}{32}{0.952424} +\pgf@def{cosfrac}{33}{0.949629} \pgf@def{cosfrac}{34}{0.946773} +\pgf@def{cosfrac}{35}{0.943858} \pgf@def{cosfrac}{36}{0.940887} +\pgf@def{cosfrac}{37}{0.937862} \pgf@def{cosfrac}{38}{0.934784} +\pgf@def{cosfrac}{39}{0.931655} \pgf@def{cosfrac}{40}{0.928477} +\pgf@def{cosfrac}{41}{0.925252} \pgf@def{cosfrac}{42}{0.921982} +\pgf@def{cosfrac}{43}{0.918669} \pgf@def{cosfrac}{44}{0.915315} +\pgf@def{cosfrac}{45}{0.911922} \pgf@def{cosfrac}{46}{0.90849} +\pgf@def{cosfrac}{47}{0.905024} \pgf@def{cosfrac}{48}{0.901523} +\pgf@def{cosfrac}{49}{0.89799} \pgf@def{cosfrac}{50}{0.894427} +\pgf@def{cosfrac}{51}{0.890835} \pgf@def{cosfrac}{52}{0.887217} +\pgf@def{cosfrac}{53}{0.883573} \pgf@def{cosfrac}{54}{0.879905} +\pgf@def{cosfrac}{55}{0.876216} \pgf@def{cosfrac}{56}{0.872506} +\pgf@def{cosfrac}{57}{0.868777} \pgf@def{cosfrac}{58}{0.865031} +\pgf@def{cosfrac}{59}{0.861269} \pgf@def{cosfrac}{60}{0.857493} +\pgf@def{cosfrac}{61}{0.853704} \pgf@def{cosfrac}{62}{0.849903} +\pgf@def{cosfrac}{63}{0.846092} \pgf@def{cosfrac}{64}{0.842271} +\pgf@def{cosfrac}{65}{0.838444} \pgf@def{cosfrac}{66}{0.834609} +\pgf@def{cosfrac}{67}{0.83077} \pgf@def{cosfrac}{68}{0.826927} +\pgf@def{cosfrac}{69}{0.82308} \pgf@def{cosfrac}{70}{0.819232} +\pgf@def{cosfrac}{71}{0.815383} \pgf@def{cosfrac}{72}{0.811534} +\pgf@def{cosfrac}{73}{0.807687} \pgf@def{cosfrac}{74}{0.803842} +\pgf@def{cosfrac}{75}{0.8} \pgf@def{cosfrac}{76}{0.796162} +\pgf@def{cosfrac}{77}{0.792329} \pgf@def{cosfrac}{78}{0.788502} +\pgf@def{cosfrac}{79}{0.784682} \pgf@def{cosfrac}{80}{0.780869} +\pgf@def{cosfrac}{81}{0.777064} \pgf@def{cosfrac}{82}{0.773268} +\pgf@def{cosfrac}{83}{0.769481} \pgf@def{cosfrac}{84}{0.765705} +\pgf@def{cosfrac}{85}{0.761939} \pgf@def{cosfrac}{86}{0.758185} +\pgf@def{cosfrac}{87}{0.754443} \pgf@def{cosfrac}{88}{0.750714} +\pgf@def{cosfrac}{89}{0.746997} \pgf@def{cosfrac}{90}{0.743294} +\pgf@def{cosfrac}{91}{0.739605} \pgf@def{cosfrac}{92}{0.735931} +\pgf@def{cosfrac}{93}{0.732272} \pgf@def{cosfrac}{94}{0.728628} +\pgf@def{cosfrac}{95}{0.724999} \pgf@def{cosfrac}{96}{0.721387} +\pgf@def{cosfrac}{97}{0.717792} \pgf@def{cosfrac}{98}{0.714213} +\pgf@def{cosfrac}{99}{0.710651} \pgf@def{cosfrac}{100}{0.707107} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex new file mode 100644 index 00000000000..84a432ceadb --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex @@ -0,0 +1,134 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.2 2006/10/11 15:22:25 tantau Exp $ + +% Quick version of basic drawing commands. Most high-level commands +% are not available if these commands are used. + +% Move current point to (#1,#2). +% +% #1 = x dimension of new current point +% #2 = y dimension of new current point +% +% Example: +% +% \pgfpathqmoveto{0pt}{0pt} +% \pgfpathqlineto{1pt}{1pt} +% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt} +% \pgfqstroke + +\def\pgfpathqmoveto#1#2{\pgfsyssoftpath@moveto{#1}{#2}} + + +% Append a line to (#1,#2) to the current path. +% +% #1 = x dimension of target +% #2 = y dimension of target +% +% Example: +% +% \pgfpathqmoveto{0pt}{0pt} +% \pgfpathqlineto{1pt}{1pt} +% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt} +% \pgfqstroke + +\def\pgfpathqlineto#1#2{\pgfsyssoftpath@lineto{#1}{#2}} + + +% Append a bezier spline to the current path. +% +% #1 = x dimension of first support point +% #2 = y dimension of first support point +% #3 = x dimension of second support point +% #4 = y dimension of second support point +% #5 = x dimension of target point +% #6 = y dimension of target point +% +% Example: +% +% \pgfpathqmoveto{0pt}{0pt} +% \pgfpathqlineto{1pt}{1pt} +% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt} +% \pgfqstroke + +\def\pgfpathqcurveto#1#2#3#4#5#6{\pgfsyssoftpath@curveto{#1}{#2}{#3}{#4}{#5}{#6}} + + + + +% Append a circle of the given radius around the origin. +% +% #1 = radius +% +% Example: +% +% \pgfpathqcircle{10pt} +% is quicker than +% \pgfpathcircle{\pgforigin}{10pt} + +\def\pgfpathqcircle#1{% + {% + \pgf@x=#1% + \pgf@y=0.555\pgf@x% + \pgfsyssoftpath@moveto{\the\pgf@x}{0pt}% + \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@y}{\the\pgf@x}{0pt}{\the\pgf@x}% + \pgfsyssoftpath@curveto{-\the\pgf@y}{\the\pgf@x}{-\the\pgf@x}{\the\pgf@y}{-\the\pgf@x}{0pt}% + \pgfsyssoftpath@curveto{-\the\pgf@x}{-\the\pgf@y}{-\the\pgf@y}{-\the\pgf@x}{0pt}{-\the\pgf@x}% + \pgfsyssoftpath@curveto{\the\pgf@y}{-\the\pgf@x}{\the\pgf@x}{-\the\pgf@y}{\the\pgf@x}{0pt}% + \pgfsyssoftpath@closepath% + }% +} + + + +% Stroke current path. No hooks called. +% +% Example: +% +% \pgfpathqmoveto{0cm}{0cm} +% \pgfpathqlineto{1cm}{1cm} +% \pgfpathqcurveto{2cm}{1cm}{2cm}{2cm}{3cm}{2cm} +% \pgfqstroke + +\def\pgfusepathqstroke{% + \pgfsyssoftpath@flushcurrentpath% + \pgfsys@stroke% + \pgf@resetpathsizes% +} + + +% Quickly fill current path. + +\def\pgfusepathqfill{% + \pgfsyssoftpath@flushcurrentpath% + \pgfsys@fill% + \pgf@resetpathsizes% +} + + +% Quickly fill and stroke current path. + +\def\pgfusepathqfillstroke{% + \pgfsyssoftpath@flushcurrentpath% + \pgfsys@fillstroke% + \pgf@resetpathsizes% +} + +% Quickly clip current path. + +\def\pgfusepathqclip{% + \pgfsyssoftpath@flushcurrentpath% + \pgfsys@clipnext% + \pgfsys@discardpath% + \pgf@resetpathsizes% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex new file mode 100644 index 00000000000..b637ff10ded --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex @@ -0,0 +1,571 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.26 2008/01/15 10:27:34 tantau Exp $ + +% Globals + +\newbox\pgfpic +\newbox\pgf@hbox + +\newbox\pgf@layerbox@main + +\newcount\pgf@picture@serial@count + + + +% This if decides whether the position of pictures on the page is +% protocolled or not. Normally, +% this is switched off as it works only with certain drivers and it +% causes external files to be written. When switched on, the position +% of pgfpictures are protocolled and can be referenced using +% \pgfsys@getposition{XXX} where XXX is the value of \pgfpictureid +% inside the picture. +\newif\ifpgfrememberpicturepositiononpage + + + +% Library files inclusion + + +% Include a library file. +% +% #1 = List of names of library file. +% +% Description: +% +% This command includes a list of library files. For each file X in the +% list, the file pgflibraryX.code.tex is included, provided this has +% not been done earlier. +% +% For the convenience of Context users, both round and square brackets +% are possible for the argument. +% +% Example: +% +% \usepgflibrary{arrows} +% \usepgflibrary[patterns,snakes] + +\def\usepgflibrary{\pgfutil@ifnextchar[{\use@pgflibrary}{\use@@pgflibrary}}%} +\def\use@pgflibrary[#1]{\use@@pgflibrary{#1}} +\def\use@@pgflibrary#1{% + \edef\pgf@list{#1}% + \pgfutil@for\pgf@temp:=\pgf@list\do{% + \expandafter\ifx\csname pgf@library@\pgf@temp @loaded\endcsname\relax% + \expandafter\let\csname pgf@library@\pgf@temp @loaded\endcsname=\pgfutil@empty% + \expandafter\edef\csname pgf@library@#1@atcode\endcsname{\the\catcode`\@} + \expandafter\edef\csname pgf@library@#1@barcode\endcsname{\the\catcode`\|} + \catcode`\@=11 + \catcode`\|=12 + \input pgflibrary\pgf@temp.code.tex + \catcode`\@=\csname pgf@library@#1@atcode\endcsname + \catcode`\|=\csname pgf@library@#1@barcode\endcsname + \fi% + }% +} + + +% Include a module file. +% +% #1 = List of names of module files. +% +% Description: +% +% This command includes a list of module files. For each file X in the +% list, the file pgfmoduleX.code.tex is included, provided this has +% not been done earlier. +% +% For the convenience of Context users, both round and square brackets +% are possible for the argument. +% +% Example: +% +% \usepgfmodule{matrix} + +\def\usepgfmodule{\pgfutil@ifnextchar[{\use@pgfmodule}{\use@@pgfmodule}}%} +\def\use@pgfmodule[#1]{\use@@pgfmodule{#1}} +\def\use@@pgfmodule#1{% + \edef\pgf@list{#1}% + \pgfutil@for\pgf@temp:=\pgf@list\do{% + \expandafter\ifx\csname pgf@module@\pgf@temp @loaded\endcsname\relax% + \expandafter\let\csname pgf@module@\pgf@temp @loaded\endcsname=\pgfutil@empty% + \expandafter\edef\csname pgf@module@#1@atcode\endcsname{\the\catcode`\@} + \expandafter\edef\csname pgf@module@#1@barcode\endcsname{\the\catcode`\|} + \catcode`\@=11 + \catcode`\|=12 + \input pgfmodule\pgf@temp.code.tex + \catcode`\@=\csname pgf@module@#1@atcode\endcsname + \catcode`\|=\csname pgf@module@#1@barcode\endcsname + \fi% + }% +} + + + +% Scopes + + +% Pgf scope environment. All changes of the graphic state are local to +% the scope. +% +% Example: +% +% \begin{pgfscope} +% \pgfsetlinewidth{3pt} +% \pgfline{\pgfxy(0,0)}{\pgfxy(3,3)} +% \end{pgfscope} + +\def\pgfscope{% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \pgfsys@beginscope% + \pgf@resetpathsizes% + \edef\pgfscope@linewidth{\the\pgflinewidth}% + \begingroup} +\def\endpgfscope{% + \endgroup% + \global\pgflinewidth=\pgfscope@linewidth% + \pgfsys@endscope} + + + + +% Quickly insert a box can contain normal TeX text at the origin. +% +% #1 = box of width/height and depth 0pt +% +% Example: +% +% \pgfqbox{\mybox} + +\def\pgfqbox#1{% + \pgfsys@hbox#1% +} + + +% Insert a box that can contain normal TeX text at the origin, but +% with the current coordinate transformation matrix synced with the +% low-level transformation matrix. +% +% #1 = box of width/height and depth 0pt +% +% In essence, this command does the same as if you first said +% \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a +% ``TeX-translation'' for the translation part of the transformation +% cm. This will ensure that hyperlinks ``survive'' at least +% translations. +% +% Example: +% +% \pgfqboxsynced{\mybox} + +\def\pgfqboxsynced#1{% + \pgfsys@hboxsynced#1% +} + + +% Puts some text in a box and inserts it with the current +% transformations applied. +% +% #1 = List of optional positioning. Possible values are ``left'', ``right'', +% ``top'', ``bottom'' and ``base''. +% #2 = TeX text. May contain verbatims. +% +% Example: +% +% \pgftransformshift{\pgfpoint{1cm}{0cm}} +% \pgftext{Hello World!} + +\def\pgftext{\pgfutil@ifnextchar[\pgf@text{\pgf@text[]}}% +\def\pgf@text[#1]{% + \def\pgf@text@options{#1}% + \pgf@maketext\pgf@after@text} +\def\pgf@after@text{% + {% + \def\pgf@text@hshift{center}% + \def\pgf@text@vshift{center}% + \expandafter\pgf@text@setkeys\expandafter{\pgf@text@options}% + \csname pgf@halign\pgf@text@hshift\endcsname% + \csname pgf@valign\pgf@text@vshift\endcsname% + % Protocol sizes: + \pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\dp\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\dp\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\ht\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\ht\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgfqboxsynced{\pgf@hbox}% + }% +} +\def\pgf@text@setkeys{\pgfqkeys{/pgf/text}}% + +\pgfkeys{/pgf/text/left/.code=\def\pgf@text@hshift{left}} +\pgfkeys{/pgf/text/center/.code=} +\pgfkeys{/pgf/text/right/.code=\def\pgf@text@hshift{right}} +\pgfkeys{/pgf/text/top/.code=\def\pgf@text@vshift{top}} +\pgfkeys{/pgf/text/bottom/.code=\def\pgf@text@vshift{bottom}} +\pgfkeys{/pgf/text/base/.code=\def\pgf@text@vshift{base}} +\pgfkeys{/pgf/text/at/.cd,.code=\pgftransformshift{#1},.value required} +\pgfkeys{/pgf/text/x/.cd,.code=\pgftransformxshift{#1},.value required} +\pgfkeys{/pgf/text/y/.cd,.code=\pgftransformyshift{#1},.value required} +\pgfkeys{/pgf/text/rotate/.cd,.code=\pgftransformrotate{#1},.value required} + +\def\pgf@halignleft{}% do nothing +\def\pgf@haligncenter{\pgftransformxshift{+-.5\wd\pgf@hbox}} +\def\pgf@halignright{\pgftransformxshift{+-\wd\pgf@hbox}}% +\def\pgf@valignbase{}% do nothing +\def\pgf@valignbottom{\pgftransformyshift{+\dp\pgf@hbox}}% +\def\pgf@valigncenter{\pgftransformyshift{+.5\dp\pgf@hbox}\pgftransformyshift{+-.5\ht\pgf@hbox}}% +\def\pgf@valigntop{\pgftransformyshift{+-\ht\pgf@hbox}}% + + +% Internal function for creating a hbox. +\def\pgf@maketext#1{% + \def\pgf@@maketextafter{#1}% + \setbox\pgf@hbox=\hbox\bgroup% + \pgfinterruptpicture% + \bgroup% + \aftergroup\pgf@collectresetcolor% + \let\next=% +} +\def\pgf@collectresetcolor{% + \pgfutil@ifnextchar\reset@color% + {\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}% + {\pgf@textdone}% +} +\def\pgf@textdone{% + \endpgfinterruptpicture% + \egroup% + \pgf@@maketextafter% +} + +\long\def\pgf@makehbox#1{% + \setbox\pgf@hbox=\hbox{{% + \pgfinterruptpicture% + #1% + \endpgfinterruptpicture% + }}} + + + +% Picture environment +% +% Example: +% +% \begin{pgfpicture} +% \pgfsetendarrow{\pgfarrowto} +% \pgfpathmoveto{\pgfpointxy{-0.9}{0.2}} +% \pgfpathlineto{\pgfpointxy{0.9}{0.4}} +% \pgfusepath{stroke} +% \end{pgfpicture} + +\newif\ifpgfpicture + +\def\pgfpicture{% + \begingroup% + \pgfpicturetrue% + \global\advance\pgf@picture@serial@count by1\relax% + \edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}% + \let\pgf@nodecallback=\pgfutil@gobble% + \pgf@picmaxx=-16000pt\relax% + \pgf@picminx=16000pt\relax% + \pgf@picmaxy=-16000pt\relax% + \pgf@picminy=16000pt\relax% + \pgf@relevantforpicturesizetrue% + \pgf@resetpathsizes% + \pgfutil@ifnextchar\bgroup\pgf@oldpicture\pgf@picture} +\def\pgf@oldpicture#1#2#3#4{% + \pgfmathsetlength\pgf@picminx{#1}% + \pgfmathsetlength\pgf@picminy{#2}% + \pgfmathsetlength\pgf@picmaxx{#3}% + \pgfmathsetlength\pgf@picmaxy{#4}% + \pgf@relevantforpicturesizefalse% + \pgf@picture} + +\def\pgf@picture{% + \setbox\pgfpic\hbox to0pt\bgroup% + \begingroup% + \pgfsys@beginpicture% + \pgfsys@beginscope% + \begingroup% + \pgfsetcolor{.}% + \pgfsetlinewidth{0.4pt}% + \pgftransformreset% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \begingroup% + \let\pgf@setlengthorig=\setlength% + \let\pgf@addtolengthorig=\addtolength% + \let\pgf@selectfontorig=\selectfont% + \let\setlength=\pgf@setlength% + \let\addtolength=\pgf@addtolength% + \let\selectfont=\pgf@selectfont% + \nullfont\spaceskip\z@\xspaceskip\z@% + \setbox\pgf@layerbox@main\hbox to0pt\bgroup% + \begingroup% + } +\def\endpgfpicture{% + \ifpgfrememberpicturepositiononpage% + \hbox to0pt{\pgfsys@markposition{\pgfpictureid}}% + \fi% + % ok, now let's position the box + \ifdim\pgf@picmaxx=-16000pt\relax% + % empty picture. make size 0. + \global\pgf@picmaxx=0pt\relax% + \global\pgf@picminx=0pt\relax% + \global\pgf@picmaxy=0pt\relax% + \global\pgf@picminy=0pt\relax% + \fi% + % Shift baseline outside: + \pgf@relevantforpicturesizefalse% + \pgf@process{\pgf@baseline}% + \gdef\pgf@shift@baseline{\the\pgf@y}% + \endgroup% + \hss% + \egroup% + \pgf@insertlayers% + \endgroup% + \pgfsys@discardpath% + \endgroup% + \pgfsys@endscope% + \pgfsys@endpicture% + \endgroup% + \hss + \egroup% + \pgfsys@typesetpicturebox\pgfpic% + \endgroup% +} + +\def\pgf@insertlayers{% + \box\pgf@layerbox@main% +} + +\def\pgf@selectfont{\pgf@selectfontorig\nullfont} + +\def\pgf@setlength#1#2{% these will be used only when \nullfont is active + \begingroup% keep font setting local + \pgfutil@selectfont% restore font + \pgf@setlengthorig#1{#2}% calculate dimension (possibly using calc) + \expandafter% + \endgroup% + \expandafter#1\expandafter=\the#1\relax} +\def\pgf@addtolength#1#2{% + \begingroup% keep font setting local + \pgfutil@selectfont% restore font + \pgf@addtolengthorig#1{#2}% calculate dimension (possibly using calc) + \expandafter% + \endgroup% + \expandafter#1\expandafter=\the#1\relax} + + +% Sets the baseline at the y-coordinate of a given point +% +% #1 = point +% +% Sets the baseline of the picture to the y-coordinate of a given +% point. However, the point will be evaluated *at the end of the +% picture*. +% +% Example: +% +% \pgfsetbaselinepointlater{\pgfpointanchor{mynode}{base}} + +\def\pgfsetbaselinepointlater#1{\def\pgf@baseline{#1}} + + +% Sets the baseline at the y-coordinate of a given point, now +% +% #1 = point +% +% Sets the baseline of the picture to the y-coordinate of a given +% point. +% +% Example: +% +% \pgfsetbaselinepointnow{\pgfpoint{1cm}{2pt}} + +\def\pgfsetbaselinepointnow#1{% + \pgf@process{#1}% + \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfsetbaselinepointlater{\pgf@setter@baseline}% +} + + +% Sets the baseline +% +% #1 = baseline +% +% Sets the baseline of the picture. Default is the lower border, which +% is the same as \pgf@picminy +% +% Example: +% +% \pgfsetbaseline{1cm+2pt} + +\def\pgfsetbaseline#1{\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}} +\pgfsetbaseline{\pgf@picminy} + + + + +% Interrupt path +% +% Description: +% +% The environment can be used to insert some drawing commands while +% constructing a path. The drawing commands inside the environment +% will not interfere with the path being constructed ``outside.'' +% However, you must ward against graphic state changes using a scope. +% +% Example: Draw two parallel lines +% +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \begin{pgfinterruptpath} +% \pgfmoveto{\pgfpoint{1cm}{0cm}} +% \pgfmoveto{\pgfpoint{1cm}{1cm}} +% \pgfusepath{stroke} +% \end{pgfinterruptpath} +% \pgflineto{\pgfpoint{0cm}{1cm}} +% \pgfusepath{stroke} + +\def\pgfinterruptpath +{% + \begingroup% + % save all sorts of things... + \edef\pgf@interrupt@savex{\the\pgf@path@lastx}% + \edef\pgf@interrupt@savey{\the\pgf@path@lasty}% + \pgf@getpathsizes\pgf@interrupt@pathsizes% + \pgfsyssoftpath@getcurrentpath\pgf@interrupt@path% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% + \edef\pgfscope@linewidth{\the\pgflinewidth}% + \let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto% + \begingroup% +} +\def\endpgfinterruptpath +{% + \endgroup% + \global\pgflinewidth=\pgfscope@linewidth% + \pgfsyssoftpath@setcurrentpath\pgf@interrupt@path% + \pgf@setpathsizes\pgf@interrupt@pathsizes% + \global\pgf@path@lastx=\pgf@interrupt@savex% + \global\pgf@path@lasty=\pgf@interrupt@savey% + \global\let\pgfsyssoftpath@lastmoveto=\pgf@interrupt@lastmoveto% + \endgroup% +} + + + +% Interrupt bounding box +% +% Description: +% +% The environment can be used to temporarily setup a new bounding box +% computation. The bounding box will be made empty at the beginning of +% the environment and will be reset to its old value after the +% environment. +% +% Example: +% +% \begin{pgfinterruptboundinbox} +% \pgfmoveto{\pgfpoint{1cm}{0cm}} +% \pgfmoveto{\pgfpoint{1cm}{1cm}} +% \pgfusepath{stroke} +% \end{pgfinterruptboundinbox} + +\def\pgfinterruptboundingbox +{% + \begingroup% + \edef\pgf@interrupt@savemaxx{\the\pgf@picmaxx}% + \edef\pgf@interrupt@saveminx{\the\pgf@picminx}% + \edef\pgf@interrupt@savemaxy{\the\pgf@picmaxy}% + \edef\pgf@interrupt@saveminy{\the\pgf@picminy}% + \pgf@picmaxx=-16000pt\relax% + \pgf@picminx=16000pt\relax% + \pgf@picmaxy=-16000pt\relax% + \pgf@picminy=16000pt\relax% +} +\def\endpgfinterruptboundingbox +{% + \global\pgf@picmaxx=\pgf@interrupt@savemaxx% + \global\pgf@picmaxy=\pgf@interrupt@savemaxy% + \global\pgf@picminx=\pgf@interrupt@saveminx% + \global\pgf@picminy=\pgf@interrupt@saveminy% + \endgroup% +} + + + + + +% Interrupts a picture +% +% Description: +% +% This environment interrupts a picture and temporarily returns to +% normal TeX mode. All sorts of things are saved and restored by this +% environment. +% +% WARNING: Using this environment in conjuction with low level +% transformations can *strongly* upset the typesetting. Typically, the +% contents of this environment should have size/height/depth 0pt in +% the end. +% +% WARNING: This environment should only be used inside typesetting a +% box and this box must in turn be inserted using \pgfqbox. +% +% Example: Draw two parallel lines +% +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \setbox\mybox=\hbox{ +% \begin{pgfinterruptpicture} +% This is normal text. +% \begin{pgfpicture} % a subpicture +% \pgfmoveto{\pgfpoint{1cm}{0cm}} +% \pgfmoveto{\pgfpoint{1cm}{1cm}} +% \pgfusepath{stroke} +% \end{pgfpicture} +% More text. +% \end{pgfinterruptpicture} +% } +% \ht\mybox=0pt +% \wd\mybox=0pt +% \dp\mybox=0pt +% \pgfqbox{\mybox}% +% \pgfpathlineto{\pgfpoint{0cm}{1cm}} +% \pgfusepath{stroke} + +\def\pgfinterruptpicture +{% + \begingroup% + \pgfinterruptboundingbox% + \pgftransformreset% + \pgfinterruptpath% + \ifx\pgf@selectfontorig\@undefined% + \else% + \let\setlength\pgf@setlengthorig% + \let\addtolength\pgf@addtolengthorig% + \let\selectfont\pgf@selectfontorig% + \fi% + \pgfutil@selectfont% + \pgfpicturefalse% + \pgf@savelayers% +} +\def\endpgfinterruptpicture +{% + \pgf@restorelayers% + \endpgfinterruptpath% + \endpgfinterruptboundingbox% + \endgroup% +} + +\let\pgf@savelayers=\relax +\let\pgf@restorelayers=\relax + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex new file mode 100644 index 00000000000..e8225bb0225 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex @@ -0,0 +1,580 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.9 2007/12/10 13:19:32 tantau Exp $ + +% +% Parsing functions +% +\newdimen\pgf@max +\newcount\pgf@sys@shading@range@num +\def\pgf@parsefunc#1{% + \edef\temp{{#1}}% + \expandafter\pgf@convertrgbstring\temp% + \edef\temp{{\pgf@rgbconv}}% + \expandafter\pgf@@parsefunc\temp} +\def\pgf@@parsefunc#1{% + \let\pgf@bounds=\pgfutil@empty% + \let\pgf@funcs=\pgfutil@empty% + \let\pgf@psfuncs=\pgfutil@empty% + \let\pgf@encode=\pgfutil@empty% + \let\pgf@sys@shading@ranges=\pgfutil@empty% + \pgf@sys@shading@range@num=0\relax% + \pgf@parsefirst[#1; ]% + \pgf@parselastdom[#1; ]% + \pgf@parsemid[#1; ]% + \ifx\pgf@bounds\pgfutil@empty% + \edef\pgf@pdfparseddomain{0 1}% + \edef\pgf@pdfparsedfunction{\pgf@singlefunc\space}% + \else% + \edef\pgf@pdfparseddomain{\pgf@doma\space\pgf@domb}% + \edef\pgf@pdfparsedfunction{% + << /FunctionType 3 /Domain [\pgf@doma\space\pgf@domb] /Functions + [\pgf@funcs\space] /Bounds [\pgf@bounds] /Encode [0 1 \pgf@encode] + >> }% << + \fi% + \xdef\pgf@psfuncs{\pgf@psfuncs}% + } +\def\pgf@parsefirst[rgb(#1)=(#2,#3,#4)#5]{% + \pgfmathsetlength\pgf@x{#1}% + \edef\pgf@sys@shading@start@pos{\the\pgf@x}% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@doma{\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@start@rgb{\pgf@sys@rgb}% + \let\pgf@sys@prevcolor=\pgf@sys@shading@start@rgb% + \let\pgf@sys@prevpos=\pgf@sys@shading@start@pos% + \edef\pgf@prevcolor{\pgf@rgb}% + \edef\pgf@firstcolor{\pgf@rgb}} +\def\pgf@parselastdom[rgb(#1)=(#2,#3,#4); {% + \pgfutil@ifnextchar]{% + \pgfmathsetlength\pgf@x{#1}% + \edef\pgf@sys@shading@end@pos{\the\pgf@x}% + \pgf@max=\pgf@x\relax% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@domb{\pgf@sys@tonumber{\pgf@x}}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@end@rgb{\pgf@sys@rgb}% + \pgfutil@gobble}{\pgf@parselastdom[}} +\def\pgf@parsemid[rgb(#1)=(#2,#3,#4); {\pgf@parserest[} +\def\pgf@parserest[rgb(#1)=(#2,#3,#4); {% + \advance\pgf@sys@shading@range@num by1\relax% + \pgfutil@ifnextchar]{% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@singlefunc{\space% + << /FunctionType 2 /Domain [0 1] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% << + \edef\pgf@funcs{\pgf@funcs\space% + << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% << + \edef\pgf@psfuncs{\pgf@prevx\space \pgf@rgb\space \pgf@prevcolor\space pgfshade \pgf@psfuncs}% + \pgfmathsetlength\pgf@x{#1}% + \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{{\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@rgb}}}% + \edef\pgf@sys@prevpos{\the\pgf@x}% + \let\pgf@sys@prevcolor=\pgf@sys@rgb% + \pgfutil@gobble}{% + \pgfmathsetlength\pgf@x{#1}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{{\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@rgb}}}% + \edef\pgf@sys@prevpos{\the\pgf@x}% + \let\pgf@sys@prevcolor=\pgf@sys@rgb% + \edef\pgf@psfuncs{\pgf@prevx\space \pgf@rgb\space \pgf@prevcolor\space pgfshade \pgf@psfuncs}% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@bounds{\pgf@bounds\space\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@encode{\pgf@encode\space0 1}% + \edef\pgf@singlefunc{\space% + << /FunctionType 2 /Domain [0 1] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% << + \edef\pgf@funcs{\pgf@funcs\space% + << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% << + \edef\pgf@prevcolor{\pgf@rgb}% + \pgf@parserest[}} + +\def\pgf@getrgbtuplewithmixin#1#2#3{% + \pgfutil@definecolor{pgfshadetemp}{rgb}{#1,#2,#3}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgfshadetemp}}% + \pgfutil@extractcolorspec{pgfshadetemp}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgf@getrgb@@\pgf@rgbcolor!} +\def\pgf@getrgb@@#1,#2,#3!{% + \def\pgf@rgb{#1 #2 #3}% + \def\pgf@sys@rgb{{#1}{#2}{#3}}% +} + + +\def\pgf@convertrgbstring#1{% + \def\pgf@rgbconv{}% + \pgf@converttorgb#1]% + } +\def\pgf@converttorgb{% + \pgfutil@ifnextchar]{\pgfutil@gobble}%done! + {% + \pgfutil@ifnextchar;{\pgf@grabsemicolor}% + {% + \pgfutil@ifnextchar r{\pgf@grabrgb}% + {% + \pgfutil@ifnextchar g{\pgf@grabgray}% + {% + \pgfutil@ifnextchar c{\pgf@grabcolor}% + {\PackageError{pgfshade}{Illformed shading + specification}{}\pgf@converttorgb}% + }% + }% + }% + }% +} +\def\pgf@grabsemicolor;{% + \edef\pgf@rgbconv{\pgf@rgbconv; }\pgf@converttorgb} +\def\pgf@grabrgb rgb(#1)=(#2,#3,#4){% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#1)=(#2,#3,#4)}\pgf@converttorgb} +\def\pgf@grabgray gray(#1)=(#2){% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#1)=(#2,#2,#2)}\pgf@converttorgb} +\def\pgf@grabcolor color(#1)=(#2){% + \pgfutil@colorlet{pgf@tempcol}{#2}% + \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgf@convgetrgb@\expandafter{\pgf@rgbcolor}{#1}% +} +\def\pgf@convgetrgb@#1#2{% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#2)=(#1)}\pgf@converttorgb} + + + + +% Declares a horizontal shading for later use. The shading is a +% horizontal bar that changes its color. +% +% #1 = optional dependencies +% #2 = name of the shading for later use +% #3 = height of the shading +% #4 = color specification in the following format: A list of colors +% that the bar should have at certain points. If the bar should +% be red at 1cm, this is specified as +% "rgb(1cm)=(1,0,0)". Multiple specifications are separated by a +% semicolon and a space. At least two specifications must be +% given. The specified positions must be given in increasing +% order. +% +% Description: +% +% The optional dependecies have the following effect: If present, it +% should consist of a list of colors, separated by commas. Each time +% the shading is used, these colors will be reevaluated. It will be +% checked whether the colors still have their "original meaning". If +% the colors have changed, a new shading will be created internally to +% reflect the changed color's values. +% +% Example: +% +% \pgfdeclarehorizontalshading{redtogreentoblue}{1cm}{% +% rgb(0cm)=(1,0,0); % red +% rgb(1cm)=(0,1,0); % green +% rgb(2cm)=(0,0,1)} +% +% \begin{document} +% The following bar is 2cm long: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclarehorizontalshading{\pgfutil@ifnextchar[\pgf@declarehorizontalshading{\pgf@declarehorizontalshading[]}}% +\def\pgf@declarehorizontalshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% + \pgfsys@horishading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@horishading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% + \fi} + + +% Declares a vertical shading for later use. +% +% #1 = optinal dependecies +% #2 = name of the shading for later use +% #3 = height of the shading +% #4 = color specification +% +% Example: +% +% \pgfdeclareverticalshading{redtogreentoblue}{1cm}{% +% rgb(0cm)=(1,0,0); % red +% rgb(1cm)=(0,1,0); % green +% rgb(2cm)=(0,0,1)} +% +% \begin{document} +% The following bar is 2cm high: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclareverticalshading{\pgfutil@ifnextchar[\pgf@declareverticalshading{\pgf@declareverticalshading[]}}% +\def\pgf@declareverticalshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% + \pgfsys@vertshading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@vertshading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% + \fi} + + +% Declares a radial shading for later use. +% +% #1 = optional dependencies +% #2 = name of the shading for later use +% #3 = center of inner circle +% #4 = color specification +% +% Description: +% +% A radial shading creates a smooth color transition between two +% circles. The center of the inner circle is at the give position. Its +% radius is the start of the color specification. The +% center of the outer circle is at the center of the whole shading, +% whose radius is the end of the color specification. For example, +% suppose the color specification is "rgb(1cm)=(1,1,1); rgb(2cm)=(0,0,0)". +% Then the shading would be 4cm times 4cm large. The inner circle would +% have diameter 1cm and the outer circle would have diameter 2cm. The +% outer circle would be centered in the middle of the shading, whereas +% the outer circle would be centered at the given position. +% +% Example: +% +% \pgfdeclareradialshading{redtogreentoblue}{\pgfpoint{2cm}{2cm}}{% +% rgb(10pt)=(1,0,0); % red +% rgb(2cm)=(0,1,0); % green +% rgb(3cm)=(0,0,1)} +% +% \begin{document} +% The following ball has diameter 3cm: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclareradialshading{\pgfutil@ifnextchar[\pgf@declareradialshading{\pgf@declareradialshading[]}}% +\def\pgf@declareradialshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% + \pgfsys@radialshading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@radialshading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% + \fi} + + + + +% Declares a functional shading for later use. +% +% #1 = optional dependecies +% #2 = name of the shading for later use +% #3 = lower left corner of the shading as a pgfpoint. +% #4 = upper right corner of the shading as a pgfpoint. +% #5 = Preparation code +% #6 = a PDF type 4 function (restricted Postscript function), see the +% PDF-specification 1.7, section 3.9.4 +% +% Description: +% +% This command creates a so-called functional shading. For such a +% shading the color of each point is calculated by calling a function +% for each point that gets the coordinates as input and yields the +% color as an output. Note that the function is evaluated by the +% *renderer*, not by PGF or TeX or someone else at compile-time. This +% means that the evaluation of this function has to be done *extremely +% quickly* and the funciton should be *very simple*. For this reason, +% only a very restricted set of operations are possible in the +% function (see 3.9.4 of the PDF-spec 1.7). Also functions should be +% kept small. Any errors in the function will only be noticed by the +% renderer. +% +% The function gets the coordinates of a point as input (as bp). This +% input consists of the top two elements of an otherwise empty +% (virtual, PostScript) stack. The function should then replace these +% two values by three values, representing the red, green, and blue +% color of the point. The numbers should be real values, not integers +% since Apple's PDF renderer is broken in this regard (use cvr at the +% end if necessary). +% +% Conceptually, the function will be evaluated once for each point of +% the rectangle (#3) to (#4). A renderer may choose to evaluate the +% function at less points, but, in principle, the function will be +% evaluated for each pixel independently. +% +% Because of the rather difficult PostScript syntax, use this macro +% only *if you know what you are doing* (or if you are advanterous, of +% course). +% +% As for other shadings, the optional depencies argument is used to +% determine whether a shading needs to be recalculated when a color +% has changed. +% +% The code #5 is executed each time a shading is +% (re)calculated. Typically, it will contain code to extract +% coordinates from colors (see below). +% +% Inside the PostScript function #6 you cannot use colors +% directly. Rather, you must push the color components on the +% stack. For this, it is useful to call \pgfshadergb in the startup +% code #4. The macro takes a color name as input and stores the color's +% red/green/blue components real numbers between 0.0 and 1.0 separated +% by spaces (which is exactly what you need if you want to push it on +% a stack) in a macro. +% +% Example: +% +%\pgfdeclarefunctionalshading{twospots}{\pgfpointorigin}{\pgfpoint{200bp}{200bp}}{}{ +% 2 copy +% 90 sub dup mul exch +% 80 sub dup mul add sqrt +% dup mul neg 1.0005 exch exp 1.0 exch sub +% 3 1 roll +% 120 sub dup mul exch +% 100 sub dup mul add sqrt +% dup mul neg 1.002 exch exp 1.0 exch sub +% 1.0 +%} +% +% \pgfdeclarefunctionalshading[mycol]{sweep}{\pgfpointorigin}{\pgfpoint{100bp}{100bp}} +% {\pgfshadecolortorgb{mycol}{\myrgb}}{ +% add 150 div % not very useful... +% dup +% \myrgb % push mycol +% 5 4 roll % multiply all components by calculated value +% mul +% 3 1 roll +% 3 index +% mul +% 3 1 roll +% 4 3 roll +% mul +% 3 1 roll +% } +% +% \begin{document} +% Have a look at this: \pgfuseshading{twospots}. +% Here is \colorlet{mycol}{green!50}\pgfuseshading{sweep} in green +% and in \colorlet{mycol}{red!50!blue}\pgfuseshading{sweep} in red/blue. +% \end{document} + +\def\pgfdeclarefunctionalshading{\pgfutil@ifnextchar[\pgf@declarefunctionalshading{\pgf@declarefunctionalshading[]}}% +\def\pgf@declarefunctionalshading[#1]#2#3#4#5#6{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% + \pgfshade@functionaldo{#2}{#3}{#4}{#5}{#6}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfshade@functionaldo}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}{#5}{#6}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% + \fi} +\def\pgfshade@functionaldo#1#2#3#4#5{% + {% + #4% + \pgfsys@functionalshading{#1}{#2}{#3}{#5}% + }% +} + +\def\pgfshadecolortorgb#1#2{% + \pgfutil@colorlet{pgf@tempcol}{#1}% + \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgfshading@rgb\pgf@rgbcolor\relax% + \edef#2{\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@xc}\space}% +} +\def\pgfshading@rgb#1,#2,#3\relax{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + + + + +% Inserts a box into the text that contains a previously defined +% shading. +% +% #1 = Name of a shading +% +% Example: +% +% \pgfuseshading{redtogreentoblue} + +\def\pgfuseshading#1{% + \edef\pgf@shadingname{@pgfshading#1}% + \pgf@tryextensions{\pgf@shadingname}{\pgfalternateextension}% + \expandafter\pgfutil@ifundefined\expandafter{\pgf@shadingname}% + {\PackageError{pgfshade}{Undefined shading "#1"}{}}% + {% + {% + \pgfutil@globalcolorsfalse% + \def\pgf@shade@adds{}% + \pgfutil@ifundefined{pgf@deps\pgf@shadingname}% + {}% + {% + \edef\@list{\csname pgf@deps\pgf@shadingname\endcsname}% + \pgfutil@for\@temp:=\@list\do{% + {% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{\@temp}}% + \pgfutil@extractcolorspec{\@temp}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \xdef\pgf@shade@adds{\pgf@shade@adds,\pgf@rgbcolor}% + }% + }% + }% + \expandafter\pgf@strip@shadename\pgf@shadingname!!% + \pgfutil@ifundefined{@pgfshading\pgf@basename\pgf@shade@adds!}% + {% + {% + \expandafter\def\expandafter\@temp\expandafter{\csname pgf@func\pgf@shadingname\endcsname}% + \edef\@args{{\pgf@basename\pgf@shade@adds}}% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@@args% + \expandafter\expandafter\expandafter{\csname pgf@args\pgf@shadingname\endcsname}% + \expandafter\expandafter\expandafter\@temp\expandafter\@args\@@args% + % + }% + }% + {}% + \pgf@invokeshading{\csname @pgfshading\pgf@basename\pgf@shade@adds!\endcsname}% + }% + }% +} + +\def\pgf@strip@shadename @pgfshading#1!!!{\def\pgf@basename{#1}} + +\def\pgf@invokeshading#1{% + \ifpgfpicture% + \pgfsys@shadinginsidepgfpicture{#1}% + \else% + \pgfsys@shadingoutsidepgfpicture{#1}% + \fi% +} + + +% Create an alias name for a shading +% +% #1 = name of the alias +% #2 = name of the original +% +% Example: +% +% \pgfaliasshading{shading!25}{shadingshaded} + +\def\pgfaliasshading#1#2{% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname @pgfshading#2!\endcsname% + \expandafter\let\csname @pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@deps@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@deps@pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@func@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@func@pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@args@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@args@pgfshading#1!\endcsname=\pgf@temp% +} + + + + +% Shades the current path, but does not discard it. +% +% #1 - a shading (see below) +% #2 - an angle +% +% Description: +% +% \pgfshadepath ``tries'' to fill the +% current path with a shading. The shading's original size should +% completely cover the area between (0,0) and (100bp,100bp). The +% shading will be rotated by #2 and then rescaled so that it +% completely covers the path. Then the path will be used (locally) for +% clipping and the shading is drawn. +% +% In addition to the rotation, any transformation set by the +%\pgfsetadditionalshadetransform will also be applied. +% +% After all this, the path can still be used for the normal +% stroking/clipping operations. +% +% The shading is rotated around its middle. If no rotation occurs, the +% lower left corner of the path will lie on (25bp, 25bp), the upper +% right corner on (75bp, 75bp). +% +% Example: +% +% \pgfdeclareverticalshading{myshading}{100bp}{color(0pt)=(red); color(100bp)=(green)} +% +% \pgfpathmoveto{\pgforigin} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfpathlineto{\pgfxy(1,1)} +% \pgfshadepath{myshading}{0} +% \pgfusepath{stroke} + +\def\pgfshadepath#1#2{% + \ifdim\pgf@pathminx=16000pt% + \PackageWarning{pgfshade}{No path specified that can be filled}% + \else% + \begingroup% + \pgfsys@beginscope% + % Calculate center: + \pgf@xb=.5\pgf@pathmaxx% + \advance\pgf@xb by.5\pgf@pathminx% + \pgf@yb=.5\pgf@pathmaxy% + \advance\pgf@yb by.5\pgf@pathminy% + % Calculate scaling: + \pgf@xc=\pgf@pathmaxx% + \advance\pgf@xc by-\pgf@pathminx% + \pgf@yc=\pgf@pathmaxy% + \advance\pgf@yc by-\pgf@pathminy% + \pgf@xc=.02\pgf@xc% + \pgf@yc=.02\pgf@yc% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@clipnext% + \pgfsys@discardpath% + % Compute new transformation matrix: + \pgfsys@transformcm{1}{0}{0}{1}{\pgf@xb}{\pgf@yb}% + \pgfsys@transformcm% + {\pgf@sys@tonumber{\pgf@xc}}{0}% + {0}{\pgf@sys@tonumber{\pgf@yc}}{0pt}{0pt}% + \pgfmathparse{#2}% + \let\pgfshade@angle=\pgfmathresult% + \pgfmathsin@{\pgfshade@angle}% + \let\pgfshade@sin=\pgfmathresult% + \pgfmathcos@{\pgfshade@angle}% + \let\pgfshade@cos=\pgfmathresult% + \pgf@x=\pgfshade@sin pt% + \pgf@xa=-\pgf@x% + \pgfsys@transformcm{\pgfshade@cos}{\pgfshade@sin}{\pgf@sys@tonumber{\pgf@xa}}{\pgfshade@cos}{0pt}{0pt}% + \ifx\pgf@shade@extra@transform\pgfutil@empty% + \else% + \pgflowlevel{\pgf@shade@extra@transform}% + \fi% + \pgfuseshading{#1}% + \pgfsys@endscope% + \endgroup% + \fi% +} + + +% Additionally transform shade paths +% +% #1 = Transformation code that is used in addition to the normal +% shading transformation. +% +% Example: +% +% \pgfsetadditionalshadetransform{\pgftransformrotate{30}} + +\def\pgfsetadditionalshadetransform#1{\def\pgf@shade@extra@transform{#1}} +\let\pgf@shade@extra@transform=\pgfutil@empty + + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex new file mode 100644 index 00000000000..caf5432b4d8 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex @@ -0,0 +1,632 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.10 2008/02/04 17:19:54 tantau Exp $ + + +% Position transformations + +\newdimen\pgf@pt@x +\newdimen\pgf@pt@y + +\newdimen\pgf@pt@temp + +\newif\ifpgf@pt@identity +\pgf@pt@identitytrue + +\def\pgf@pt@aa{1.0} \def\pgf@pt@ab{0.0} +\def\pgf@pt@ba{0.0} \def\pgf@pt@bb{1.0} + + + +% Store the current transformation matrix in a macro. +% +% #1 = macro name +% +% Example: +% +% \pgfgettransform\mytransform + +\def\pgfgettransform#1{% + \edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}} +} + + +% Restore the current transformation matrix from a macro. +% +% #1 = macro name, previously used with \pgfgettransform +% +% Example: +% +% \pgfsettransform\mytransform + +\def\pgfsettransform#1{% + \edef\pgf@temp{#1}% + \expandafter\pgf@settransform\pgf@temp% +} +\def\pgf@settransform#1#2#3#4#5#6{% + \def\pgf@pt@aa{#1}% + \def\pgf@pt@ab{#2}% + \def\pgf@pt@ba{#3}% + \def\pgf@pt@bb{#4}% + \pgf@pt@x=#5% + \pgf@pt@y=#6% + \edef\pgf@idtest{#1,#2,#3,#4}% + \ifx\pgf@idtest\pgf@idmatrixtext% + \pgf@pt@identitytrue% + \else% + \pgf@pt@identityfalse% + \fi% +} + +\def\pgf@idmatrixtext{1.0,0.0,0.0,1.0} +\def\pgf@zerozerotext{0.0,0.0} + +% Transformation command +% +% #1 = x dimension +% #2 = y dimension +% +% Description: +% +% Applies the pgfs transformation matrix to the point (#1,#2). The +% result is once more stored in the point. +% +% +% Example: +% +% \pgf@pos@transform{\pgf@x}{\pgf@y} + +\def\pgf@pos@transform#1#2{% + \ifpgf@pt@identity% + \else% + \pgf@pt@temp=#1% + #1=\pgf@pt@aa#1% + \advance#1 by\pgf@pt@ba#2% + #2=\pgf@pt@bb#2% + \advance#2 by\pgf@pt@ab\pgf@pt@temp% + \fi% + \advance#1 by\pgf@pt@x% + \advance#2 by\pgf@pt@y% +} + + +% Invert the current transformation matrix +% +% Description: +% +% This command replaces the current transformation matrix by its +% inverse. The inversion is not very exact if the matrix is nearly +% singular. +% +% Example: +% +% \pgftransforminvert + +\def\pgftransforminvert{% + % First, invert the shift. That's easy + \pgf@pt@x=-\pgf@pt@x + \pgf@pt@y=-\pgf@pt@y + \ifpgf@pt@identity% + \else% + % Sigh. Have to calculate the inverse of the matrix. + % Perhaps we are lucky and ba and bb are zero? + \edef\pgf@zerotest{\pgf@pt@ab,\pgf@pt@ba}% + \ifx\pgf@zerotest\pgf@zerozerotext% + % Ha! Just invert aa and bb + \pgfmathreciprocal@{\pgf@pt@aa}% + \let\pgf@pt@aa\pgfmathresult% + \pgfmathreciprocal@{\pgf@pt@bb}% + \let\pgf@pt@bb\pgfmathresult% + \else% + % Start with determinant + % Matrix = (aa ab + % ba bb) + {% + \pgfutil@tempdima=\pgf@pt@aa pt% + \pgfutil@tempdima=\pgf@pt@bb\pgfutil@tempdima% aa * bb + \pgfutil@tempdimb=\pgf@pt@ba pt% + \pgfutil@tempdimb=\pgf@pt@ab\pgfutil@tempdimb% ba * ab + \advance\pgfutil@tempdima by -\pgfutil@tempdimb% aa*bb - ba*ab + % Invert + \pgfmathreciprocal@{\pgf@sys@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdima=\pgfmathresult pt% + \pgf@x=\pgf@pt@bb\pgfutil@tempdima% bb/(det A) + \xdef\pgf@new@pt@aa{\pgf@sys@tonumber{\pgf@x}}% + \pgf@x=\pgf@pt@aa\pgfutil@tempdima% aa/(det A) + \xdef\pgf@new@pt@bb{\pgf@sys@tonumber{\pgf@x}}% + \pgfutil@tempdima=-\pgfutil@tempdima% + \pgf@x=\pgf@pt@ba\pgfutil@tempdima% -ba/(det A) + \xdef\pgf@new@pt@ba{\pgf@sys@tonumber{\pgf@x}}% + \pgf@x=\pgf@pt@ab\pgfutil@tempdima% -ab/(det A) + \xdef\pgf@new@pt@ab{\pgf@sys@tonumber{\pgf@x}}% + }% + \let\pgf@pt@aa\pgf@new@pt@aa% + \let\pgf@pt@ab\pgf@new@pt@ab% + \let\pgf@pt@ba\pgf@new@pt@ba% + \let\pgf@pt@bb\pgf@new@pt@bb% + \fi% + \pgf@pt@temp=\pgf@pt@x% + \pgf@pt@x=\pgf@pt@aa\pgf@pt@x% + \advance\pgf@pt@x by\pgf@pt@ba\pgf@pt@y% + \pgf@pt@y=\pgf@pt@bb\pgf@pt@y% + \advance\pgf@pt@y by\pgf@pt@ab\pgf@pt@temp% + \fi% +} + + + + +% PGF-Level concatenation of the transformation matrix with a given +% matrix. +% +% #1 - #5 = a concatenation matrix (see pdf spec). Entry #5 is a +% translation point. +% +% Description: +% +% All coordinates given to subsequent path construction commands will +% be transformed additionally by the given transformation matrix. If +% the command is followed by a 6th argument, the transformation is +% only applied to this argument. +% +% +% Example: +% +% \pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}} % 100pt to the right. +% +% \pgftransformcm{2}{0}{0}{2}{\pgfpointorigin} % double in in size +% \pgfpathmoveto{\pgfpoint{0cm}{0cm}} +% \pgfpathlineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm + +\def\pgftransformcm#1#2#3#4#5{% + \edef\pgf@marshal{\noexpand\pgf@transformcm{#1}{#2}{#3}{#4}}% + \pgf@marshal{#5}% +} +\def\pgf@transformcm#1#2#3#4#5{% + {% + \pgf@process{#5}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + % + \pgfmathsetlength\pgf@x{#1}% + \pgfmathsetlength\pgf@y{#2}% + % + \pgf@xa=\pgf@pt@aa\pgf@x% + \advance\pgf@xa by \pgf@pt@ba\pgf@y% + % + \pgf@ya=\pgf@pt@ab\pgf@x% + \advance\pgf@ya by \pgf@pt@bb\pgf@y% + % + \pgfmathsetlength\pgf@x{#3}% + \pgfmathsetlength\pgf@y{#4}% + % + \pgf@xb=\pgf@pt@aa\pgf@x% + \advance\pgf@xb by \pgf@pt@ba\pgf@y% + % + \pgf@yb=\pgf@pt@ab\pgf@x% + \advance\pgf@yb by \pgf@pt@bb\pgf@y% + % + \pgf@x=\pgf@pt@aa\pgf@xc% + \advance\pgf@x by\pgf@pt@ba\pgf@yc% + \advance\pgf@x by\pgf@pt@x% + % + \pgf@y=\pgf@pt@ab\pgf@xc% + \advance\pgf@y by\pgf@pt@bb\pgf@yc% + \advance\pgf@y by\pgf@pt@y% + % + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + \xdef\pgf@tempaa{\pgf@sys@tonumber{\pgf@xa}}% + \xdef\pgf@tempab{\pgf@sys@tonumber{\pgf@ya}}% + \xdef\pgf@tempba{\pgf@sys@tonumber{\pgf@xb}}% + \xdef\pgf@tempbb{\pgf@sys@tonumber{\pgf@yb}}% + }% + \pgf@pt@x=\pgf@x% + \pgf@pt@y=\pgf@y% + \let\pgf@pt@aa=\pgf@tempaa% + \let\pgf@pt@ba=\pgf@tempba% + \let\pgf@pt@ab=\pgf@tempab% + \let\pgf@pt@bb=\pgf@tempbb% + \edef\pgf@idtest{\pgf@pt@aa,\pgf@pt@ba,\pgf@pt@ab,\pgf@pt@bb}% + \ifx\pgf@idtest\pgf@idmatrixtext% + \pgf@pt@identitytrue% + \else% + \pgf@pt@identityfalse% + \fi% +} + + +% Add a pre-morph +% +% #1 = morphing code +% +% Description: +% +% This function adds code to the pre-morphing list. When a +% coordinate is transformed, the current pre-morphing code is +% called first. Then the transformation matrix is applied. Finally, all +% post-morphing code is called. The morphing list is local to the +% current TeX group. +% +% The job of the #1 macro is to modify the values of \pgf@x and +% \pgf@y. It should not have any other sideeffects. +% +% Example: +% +% \pgfmorphaddmorph{\advance\pgf@x by 1cm\relax} + +\def\pgfmorphaddpre#1{\expandafter\def\expandafter\pgfmorph@prelist\expandafter{\pgfmorph@prelist#1}} +\let\pgfmorph@prelist=\pgfutil@empty + + +% Add a post-morph +% +% #1 = morphing macro +% +% Description: +% +% The only difference to the pre-morphs is that post morphs are +% executed after the transformation matrix has been applied. + +\def\pgfmorphaddpost#1{\expandafter\def\expandafter\pgfmorph@postlist\expandafter{\pgfmorph@postlist#1}} +\let\pgfmorph@postlist=\pgfutil@empty + + +% Transformation into a given triangle. The three corners of the +% triangle are called "origin", "x" and "y" are given. After this +% transformation has been applied, the canvas origin is at "origin", +% the vector (1pt,0pt) lies at "x" and the vector (0pt,1pt) lies at +% "y". +% +% #1 = origin +% #2 = x +% #3 = y +% +% Example: +% +% \pgftransformtriangle{\pgfpointorigin}{\pgfpoint{1cm}{1cm}}{\pgfpoint{-1cm}{1cm}} + +\def\pgftransformtriangle#1#2#3{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@ya}% + {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@yb}% + {\pgfpoint{\pgf@x}{\pgf@y}}% +} + + + +% Undo all transformations +% +% Example: +% +% \pgftansformreset + +\def\pgftransformreset{% + \pgf@pt@x=0pt% + \pgf@pt@y=0pt% + \def\pgf@pt@aa{1.0}% + \def\pgf@pt@ba{0.0}% + \def\pgf@pt@ab{0.0}% + \def\pgf@pt@bb{1.0}% + \pgf@pt@identitytrue% +} + + +% Undo all slanting/rotation, but not translations +% +% Example: +% +% \pgftansformreset + +\def\pgftransformresetnontranslations{% + \def\pgf@pt@aa{1.0}% + \def\pgf@pt@ba{0.0}% + \def\pgf@pt@ab{0.0}% + \def\pgf@pt@bb{1.0}% + \pgf@pt@identitytrue% +} + + + + +% Shifting command and environment +% +% #1 = vector by which all subsequent points should be moved. +% +% Example: +% +% \pgftansformshift{\pgfpoint{1cm}{1cm}} + +\def\pgftransformshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{#1}} +\def\pgftransformxshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{\pgfpoint{#1}{0pt}}} +\def\pgftransformyshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{\pgfpoint{0pt}{#1}}} + + + + +% Scaling commands +% +% #1 = scaling for all subsequent points. +% +% Example: +% +% \pgftransformscale{2} +% \pgftransformxscale{2} +% \pgftransformyscale{2} + +\def\pgftransformscale#1{\pgftransformcm{#1}{0}{0}{#1}{\pgfpointorigin}} +\def\pgftransformxscale#1{\pgftransformcm{#1}{0}{0}{1.0}{\pgfpointorigin}} +\def\pgftransformyscale#1{\pgftransformcm{1.0}{0}{0}{#1}{\pgfpointorigin}} + + + +% Slanting commands +% +% #1 = slanting in x-direction. 1 means 45 degrees. +% +% Example: +% +% \pgftransformxslant{2} +% \pgftransformyslant{2} + +\def\pgftransformxslant#1{\pgftransformcm{1.0}{0}{#1}{1.0}{\pgfpointorigin}} +\def\pgftransformyslant#1{\pgftransformcm{1.0}{#1}{0}{1.0}{\pgfpointorigin}} + + + +% Rotation commands +% +% #1 = degrees for the rotation +% +% Example: +% +% \pgftransformrotate{30} + +\def\pgftransformrotate#1{% + \pgfmathparse{#1}% + \let\pgftransform@angle=\pgfmathresult% + \pgfmathsin@{\pgftransform@angle}% + \let\pgftransform@sin=\pgfmathresult% + \pgfmathcos@{\pgftransform@angle}% + \let\pgftransform@cos=\pgfmathresult% + \pgf@x=\pgftransform@sin pt% + \pgf@xa=-\pgf@x% + \pgftransformcm{\pgftransform@cos}{\pgftransform@sin}{\pgf@sys@tonumber{\pgf@xa}}{\pgftransform@cos}{\pgfpointorigin}% +} + + + +% The following if's have the following effect: +% +% \ifpgfslopedattime decides whether the coordinate system of an +% xxxattime transformation command should be rotated such that text +% drawn on the line should be tangent to the line +% +% \ifpgfallowupsidedowattime decides whether the transformation should +% be done in such a way that the text is always ``upright,'' that is, +% text drawn in this coordiante system is never upside-down. +% +% \ifpgfresetnontranslationattime decides whether the coordinate +% system of an xxxattime transformation command should be reset +% (concerning the non-translations) before a possible rotation is +% applied. This is useful, for example, if the main coordinate system +% is scaled by, say, a factor of 2 and you do not want that to apply +% to the text, but you do want the rotation to applyu. + +\newif\ifpgfslopedattime +\newif\ifpgfallowupsidedownattime +\newif\ifpgfresetnontranslationattime + + +% Transform to the coordinate system of a point on a line +% +% #1 = a time fraction of line where to put the label, where 0 means start, +% 1 means end, and for example 0.5 means the middle. +% #2 = start of line +% #3 = end of line +% +% Example: +% +% { +% \pgftransformlineattime{.5}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftext{Hi!} +% } +% +% { +% \pgftransformlineattime{.75}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftransformresetnontranslations +% \pgftext{Hi!} +% } +% +\def\pgftransformlineattime#1#2#3{% + \pgftransformshift{\pgfpointlineattime{#1}{#2}{#3}}% + \ifpgfresetnontranslationattime% + \pgftransformresetnontranslations% + \fi% + \ifpgfslopedattime% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifpgfallowupsidedownattime% + \else% + \ifdim\pgf@x<0pt% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + \fi% + \fi% + \pgfpointnormalised{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}% + \fi% +} + + + + +% Transform to the coordinate system of a point on a curve +% +% #1 = a time fraction of line where to put the label, where 0 means start, +% 1 means end, and for example 0.5 means the middle. +% #2 = start of line +% #3 = first control +% #4 = second control +% #5 = end of line +% +% Example: +% +% { +% \pgftransformcurveattime{.5}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftext{Hi!} +% } +% +% { +% \pgftransformcurveattime{.75}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftransformresetnontranslations +% \pgftext{Hi!} +% } +% +\def\pgftransformcurveattime#1#2#3#4#5{% + \pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}% + \pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}% + \ifpgfresetnontranslationattime% + \pgftransformresetnontranslations% + \fi% + \ifpgfslopedattime% + \pgf@x=\pgf@xa% + \pgf@y=\pgf@ya% + \advance\pgf@x by-\pgf@xb% + \advance\pgf@y by-\pgf@yb% + \ifpgfallowupsidedownattime% + \else% + \ifdim\pgf@x<0pt% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + \fi% + \fi% + \pgfpointnormalised{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}% + \fi% +} + + + + + +% Transform to the coordinate system of an arrow at the end of the +% line going from point #1 to point #2 with the correct rotation. +% +% #1 = a start point an (invisible) line +% #2 = an end point an (invisible) line +% +% Example: +% +% \pgftransformarrow{\pgfpointorigin}{\pgfpoint{1cm}{0cm}} + +\def\pgftransformarrow#1#2{% + \pgftransformshift{#2}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \pgf@x=\pgf@xa% + \pgf@y=\pgf@ya% + \pgfpointnormalised{}% + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfqpoint{0pt}{0pt}}% +} + + + +% Low-level transformations + +% Causes the current high-level transformation command to be applied +% to the low-level. +% +% Description: +% +% All subsequent drawing will be transformed additionally by the +% current high-level transformation. Thus, the high-level +% transformation becomes the low-level transformation. The high-level +% transformation is reset at this point. + +\def\pgflowlevelsynccm{% + \pgfsys@transformcm% + {\pgf@pt@aa}{\pgf@pt@ab}% + {\pgf@pt@ba}{\pgf@pt@bb}% + {\pgf@pt@x}{\pgf@pt@y}% + \pgftransformreset% + \pgf@relevantforpicturesizefalse% +} + + + +% Causes a transformation command to be applied to the ``lowlevel'' +% transformation matrix. +% +% #1 - a high-level transformation command +% +% Description: +% +% All subsequent drawing will be transformed additionally by the given +% transformation matrix. Note that PGF will no longer be able to +% ``keep track'' of the coordinates. Also, transformations are applied +% to *everything*, including line thickness and line endings. Most +% often, this is not desirable. +% +% Example: +% +% \pgflowlevel{\pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}}} % 100bp to the right. +% +% \begin{pgflowlevelscope}{\pgftransformcm{2}{0}{0}{2}{\pgfpointorigin}} % double in in size +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \pgflineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm +% \end{pgflowlevelscope} + +\def\pgflowlevel#1{% + {% + \pgftransformreset% + #1% + \pgflowlevelsynccm% + }% + \pgf@relevantforpicturesizefalse% +} + +\def\pgflowlevelscope#1{\pgfscope\pgflowlevel{#1}} +\def\endpgflowlevelscope{\endpgfscope} + +\long\def\pgflowlevelobj#1#2{\pgfscope{\pgflowlevel{#1}#2}\endpgfscope} + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex deleted file mode 100644 index 805f27bcad6..00000000000 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex +++ /dev/null @@ -1,3618 +0,0 @@ -% 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. - -\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz.code.tex,v 1.87 2007/06/07 07:41:10 tantau Exp $ - - -% Always-present libraries: - -\usepgflibrary{plothandlers} - - -\let\tikz@orig@setkeys=\setkeys % guard against changes, later -\let\tikz@orig@define@key=\define@key - -\newdimen\tikz@lastx -\newdimen\tikz@lasty -\newdimen\tikz@lastxsaved -\newdimen\tikz@lastysaved - -\newdimen\tikzleveldistance -\newdimen\tikzsiblingdistance - -\newbox\tikz@figbox -\newbox\tikz@tempbox - -\newcount\tikztreelevel -\newcount\tikznumberofchildren -\newcount\tikznumberofcurrentchild - -\newcount\tikz@fig@count - -\newif\iftikz@node@is@a@label -\newif\iftikz@snaked - -\let\tikz@options=\pgfutil@empty -\def\tikz@addoption#1{\expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}} -\def\tikz@addmode#1{\expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}} -\def\tikz@addtransform#1{% - \ifx\tikz@transform\relax% - #1% - \else% - \expandafter\def\expandafter\tikz@transform\expandafter{\tikz@transform#1}% - \fi% -} - - - -% TikZ options: - -\def\tikzoption{\tikz@orig@define@key{tikz}} - - - -% Baseline options -\tikzoption{baseline}[0pt]{\pgfutil@ifnextchar({\tikz@baseline@coordinate}{\tikz@baseline@simple}#1\@nil}%) -\def\tikz@baseline@simple#1\@nil{\pgfsetbaseline{#1}} -\def\tikz@baseline@coordinate#1\@nil{\pgfsetbaselinepointlater{\tikz@scan@one@point\@firstofone#1}} - -% Draw options -\tikzoption{line width}{\tikz@semiaddlinewidth{#1}}% - -\def\tikz@semiaddlinewidth#1{\tikz@addoption{\pgfsetlinewidth{#1}}\pgfmathsetlength\pgflinewidth{#1}} - -\tikzoption{cap}{\tikz@addoption{\csname pgfset#1cap\endcsname}} -\tikzoption{join}{\tikz@addoption{\csname pgfset#1join\endcsname}} -\tikzoption{miter limit}{\tikz@addoption{\pgfsetmiterlimit{#1}}} - -\tikzoption{dash pattern}{% syntax: on 2pt off 3pt on 4pt ... - \def\tikz@temp{#1}% - \ifx\tikz@temp\pgfutil@empty% - \def\tikz@dashpattern{}% - \tikz@addoption{\pgfsetdash{}{0pt}}% - \else% - \def\tikz@dashpattern{}% - \expandafter\tikz@scandashon\pgfutil@gobble#1o\@nil% - \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% - \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% - \fi} -\tikzoption{dash phase}{% - \def\tikz@dashphase{#1}% - \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% - \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% -}% -\def\tikz@dashphase{0pt} - -\def\tikz@scandashon n#1o{% - \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% - \pgfutil@ifnextchar\@nil{\pgfutil@gobble}{\tikz@scandashoff}} -\def\tikz@scandashoff ff#1o{% - \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% - \pgfutil@ifnextchar\@nil{\pgfutil@gobble}{\tikz@scandashon}} - -\tikzoption{draw opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}}} - -% Double draw options -\tikzoption{double}[]{% - \def\tikz@temp{#1}% - \ifx\tikz@temp\tikz@nonetext% - \tikz@addmode{\tikz@mode@doublefalse}% - \else% - \ifx\tikz@temp\pgfutil@empty% - \else% - \def\tikz@double@color{#1}% - \fi% - \tikz@addmode{\tikz@mode@doubletrue}% - \fi} -\tikzoption{double distance}{% - \pgfmathsetlength{\pgf@x}{#1}% - \edef\tikz@double@width@distance{\the\pgf@x}% - \tikz@addmode{\tikz@mode@doubletrue}} - -\def\tikz@double@width@distance{0.6pt} -\def\tikz@double@color{white} - -% Fill options - -\tikzoption{even odd rule}[]{\tikz@addoption{\pgfseteorule}} -\tikzoption{nonzero rule}[]{\tikz@addoption{\pgfsetnonzerorule}} - -\tikzoption{fill opacity}{\tikz@addoption{\pgfsetfillopacity{#1}}} - - -% Joined fill/draw options - -\tikzoption{opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}\pgfsetfillopacity{#1}}} - - -% Main color options -\tikzoption{color}{% - \tikz@addoption{% - \ifx\tikz@fillcolor\pgfutil@empty% - \ifx\tikz@strokecolor\pgfutil@empty% - \else% - \pgfsys@color@reset@inorderfalse% - \let\tikz@strokecolor\pgfutil@empty% - \let\tikz@fillcolor\pgfutil@empty% - \fi% - \else% - \pgfsys@color@reset@inorderfalse% - \let\tikz@strokecolor\pgfutil@empty% - \let\tikz@fillcolor\pgfutil@empty% - \fi% - \pgfutil@colorlet{tikz@color}{#1}% - \pgfutil@colorlet{.}{tikz@color}% - \pgfsetcolor{.}% - \pgfsys@color@reset@inordertrue% - }% - \def\tikz@textcolor{#1}} - - - -% Rounding options -\tikzoption{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}} -\tikzoption{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}} - - - -% Coordinate options -\tikzoption{x}{\tikz@handle@vec{\pgfsetxvec}{\tikz@handle@x}#1\relax} -\tikzoption{y}{\tikz@handle@vec{\pgfsetyvec}{\tikz@handle@y}#1\relax} -\tikzoption{z}{\tikz@handle@vec{\pgfsetzvec}{\tikz@handle@z}#1\relax} - -\def\tikz@handle@vec#1#2{\pgfutil@ifnextchar({\tikz@handle@coordinate#1}{\tikz@handle@single#2}} -\def\tikz@handle@coordinate#1{\tikz@scan@one@point#1} -\def\tikz@handle@single#1#2\relax{#1{#2}} -\def\tikz@handle@x#1{\pgfsetxvec{\pgfpoint{#1}{0pt}}} -\def\tikz@handle@y#1{\pgfsetyvec{\pgfpoint{0pt}{#1}}} -\def\tikz@handle@z#1{\pgfsetzvec{\pgfpoint{#1}{#1}}} - - -% Transformation options -\tikzoption{scale}{\tikz@addtransform{\pgftransformscale{#1}}} -\tikzoption{xscale}{\tikz@addtransform{\pgftransformxscale{#1}}} -\tikzoption{xslant}{\tikz@addtransform{\pgftransformxslant{#1}}} -\tikzoption{yscale}{\tikz@addtransform{\pgftransformyscale{#1}}} -\tikzoption{yslant}{\tikz@addtransform{\pgftransformyslant{#1}}} -\tikzoption{rotate}{\tikz@addtransform{\pgftransformrotate{#1}}} -\tikzoption{rotate around}{\tikz@addtransform{\tikz@rotatearound{#1}}} -\def\tikz@rotatearound#1{% - \edef\tikz@temp{#1}% get rid of active stuff - \expandafter\tikz@rotateparseA\tikz@temp% -}% -\def\tikz@rotateparseA#1:{% - \def\tikz@temp@rot{#1}% - \tikz@scan@one@point\tikz@rotateparseB% -} -\def\tikz@rotateparseB#1{% - \pgf@process{#1}% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \pgftransformrotate{\tikz@temp@rot}% - \pgftransformshift{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}% -} - -\tikzoption{shift}{\tikz@addtransform{\tikz@scan@one@point\pgftransformshift#1\relax}} -\tikzoption{xshift}{\tikz@addtransform{\pgftransformxshift{#1}}} -\tikzoption{yshift}{\tikz@addtransform{\pgftransformyshift{#1}}} -\tikzoption{cm}{\tikz@addtransform{\tikz@parse@cm#1\relax}} -\tikzoption{reset cm}[]{\tikz@addtransform{\pgftransformreset}} -\tikzoption{shift only}[]{\tikz@addtransform{\pgftransformresetnontranslations}} - -\def\tikz@parse@cm#1,#2,#3,#4,{% - \def\tikz@p@cm{{#1}{#2}{#3}{#4}}% - \tikz@scan@one@point\tikz@parse@cmA} -\def\tikz@parse@cmA#1{% - \expandafter\pgftransformcm\tikz@p@cm{#1}% -} - - - -% Grid options -\tikzoption{xstep}{\def\tikz@grid@x{#1}} -\tikzoption{ystep}{\def\tikz@grid@y{#1}} -\tikzoption{step}{\tikz@handle@vec{\tikz@step@point}{\tikz@step@single}#1\relax} -\def\tikz@step@single#1{\def\tikz@grid@x{#1}\def\tikz@grid@y{#1}} -\def\tikz@step@point#1{\pgf@process{#1}\edef\tikz@grid@x{\the\pgf@x}\edef\tikz@grid@y{\the\pgf@y}} - -\def\tikz@grid@x{1cm} -\def\tikz@grid@y{1cm} - - -% Path usage options -\newif\iftikz@mode@double -\newif\iftikz@mode@fill -\newif\iftikz@mode@draw -\newif\iftikz@mode@clip -\newif\iftikz@mode@boundary -\newif\iftikz@mode@shade -\let\tikz@mode=\pgfutil@empty - -\def\tikz@nonetext{none} - -\tikzoption{path only}[]{\let\tikz@mode=\pgfutil@empty} -\tikzoption{shade}[]{\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{fill}[]{% - \def\tikz@temp{#1}% - \ifx\tikz@temp\tikz@nonetext% - \tikz@addmode{\tikz@mode@fillfalse}% - \else% - \ifx\tikz@temp\pgfutil@empty% - \else% - \tikz@addoption{\pgfsetfillcolor{#1}}% - \def\tikz@fillcolor{#1}% - \fi% - \tikz@addmode{\tikz@mode@filltrue}% - \fi% -} -\tikzoption{draw}[]{% - \def\tikz@temp{#1}% - \ifx\tikz@temp\tikz@nonetext% - \tikz@addmode{\tikz@mode@drawfalse}% - \else% - \ifx\tikz@temp\pgfutil@empty% - \else% - \tikz@addoption{\pgfsetstrokecolor{#1}}% - \def\tikz@strokecolor{#1}% - \fi% - \tikz@addmode{\tikz@mode@drawtrue}% - \fi% -} -\tikzoption{clip}[]{\tikz@addmode{\tikz@mode@cliptrue}} -\tikzoption{use as bounding box}[]{\tikz@addmode{\tikz@mode@boundarytrue}} - -\tikzoption{save path}{\tikz@addmode{\pgfsyssoftpath@getcurrentpath#1\global\let#1=#1}} - -\let\tikz@fillcolor=\pgfutil@empty -\let\tikz@strokecolor=\pgfutil@empty - - -% Pattern options -\tikzoption{pattern color}{\def\tikz@pattern@color{#1}} -\tikzoption{pattern}[]{% - \def\tikz@temp{#1}% - \ifx\tikz@temp\tikz@nonetext% - \tikz@addmode{\tikz@mode@fillfalse}% - \else% - \ifx\tikz@temp\pgfutil@empty% - \else% - \tikz@addoption{\pgfsetfillpattern{#1}{\tikz@pattern@color}}% - \def\tikz@pattern{#1}% - \fi% - \tikz@addmode{\tikz@mode@filltrue}% - \fi% -} -\def\tikz@pattern@color{black} -\def\tikz@pattern{dots} - - -% Shading options -\tikzoption{shading}{\def\tikz@shading{#1}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{shading angle}{\def\tikz@shade@angle{#1}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{top color}{% - \pgfutil@colorlet{tikz@axis@top}{#1}% - \pgfutil@colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% - \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{bottom color}{% - \pgfutil@colorlet{tikz@axis@bottom}{#1}% - \pgfutil@colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% - \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{middle color}{% - \pgfutil@colorlet{tikz@axis@middle}{#1}% - \def\tikz@shading{axis}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{left color}{% - \pgfutil@colorlet{tikz@axis@top}{#1}% - \pgfutil@colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% - \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{right color}{% - \pgfutil@colorlet{tikz@axis@bottom}{#1}% - \pgfutil@colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% - \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{ball color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{ball}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{inner color}{\pgfutil@colorlet{tikz@radial@inner}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} -\tikzoption{outer color}{\pgfutil@colorlet{tikz@radial@outer}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} - -\def\tikz@shading{axis} -\def\tikz@shade@angle{0} - -\pgfdeclareverticalshading[tikz@axis@top,tikz@axis@middle,tikz@axis@bottom]{axis}{100bp}{% - color(0bp)=(tikz@axis@bottom); - color(25bp)=(tikz@axis@bottom); - color(50bp)=(tikz@axis@middle); - color(75bp)=(tikz@axis@top); - color(100bp)=(tikz@axis@top)} - -\pgfutil@colorlet{tikz@axis@top}{gray} -\pgfutil@colorlet{tikz@axis@middle}{gray!50!white} -\pgfutil@colorlet{tikz@axis@bottom}{white} - -\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% - color(0bp)=(tikz@ball!15!white); - color(9bp)=(tikz@ball!75!white); - color(18bp)=(tikz@ball!70!black); - color(25bp)=(tikz@ball!50!black); - color(50bp)=(black)} - -\pgfutil@colorlet{tikz@ball}{blue} - -\pgfdeclareradialshading[tikz@radial@inner,tikz@radial@outer]{radial}{\pgfpointorigin}{% - color(0bp)=(tikz@radial@inner); - color(25bp)=(tikz@radial@outer); - color(50bp)=(tikz@radial@outer)} - -\pgfutil@colorlet{tikz@radial@inner}{gray} -\pgfutil@colorlet{tikz@radial@outer}{white} - - -% Pin options -\tikzoption{pin}{\pgfutil@ifnextchar[{\tikz@parse@pin}{\tikz@parse@pin[]}#1\pgf@nil} -\tikzoption{pin distance}{\def\tikz@pin@distance{#1}} -\tikzoption{pin edge}{\def\tikz@pin@edge@style{#1}} - -\tikzoption{tikz@pin@post}[]{% - \tikz@compute@direction{\tikz@label@angle}{\tikz@pin@distance}% - \global\let\tikz@pin@edge@style@smuggle=\tikz@pin@edge@style% -} -\tikzoption{tikz@pre@pin@edge}[]{\def\pgf@marshal{\tikzstyle{tikz@pin@options}=} - \expandafter\pgf@marshal\expandafter[\tikz@pin@edge@style@smuggle]% -} - -\def\tikz@pin@distance{3ex} -\def\tikz@pin@edge@style{} - -\def\tikz@parse@pin[#1]#2:#3\pgf@nil{% - \tikz@add@after@node@path{\bgroup - \pgfextra{\let\tikz@save@last@node=\tikzlastnode}% - node - [every pin,tikz@label@angle=#2,#1,at=(\tikzlastnode.\tikz@label@angle),% - after node path={(\tikz@save@last@node) edge[every pin edge,tikz@pre@pin@edge,tikz@pin@options] (\tikzlastnode)}, - tikz@pin@post] - {#3} \egroup} -} - - -% Label and pin options - -\tikzoption{label}{\pgfutil@ifnextchar[{\tikz@parse@label}{\tikz@parse@label[]}#1\pgf@nil} -\tikzoption{label distance}{\def\tikz@label@distance{#1}} - -\tikzoption{tikz@label@angle}{\def\tikz@label@angle{#1}\csname tikz@label@angle@is@#1\endcsname} - -\tikzoption{tikz@label@post}[]{\tikz@compute@direction{\tikz@label@angle}{\tikz@label@distance}} - -\def\tikz@label@distance{0pt} - -\def\tikz@parse@label[#1]#2:#3\pgf@nil{% - \tikz@add@after@node@path{ - \bgroup - \pgfextra{\let\tikz@save@last@fig@name=\tikz@last@fig@name}% - node - [every label,% - tikz@label@angle=#2,% - #1,% - at=(\tikzlastnode.\tikz@label@angle),tikz@label@post]% - {#3}% - \pgfextra{\global\let\tikz@last@fig@name=\tikz@save@last@fig@name}% - \egroup% - } -} - -\expandafter\def\csname tikz@label@angle@is@right\endcsname{\def\tikz@label@angle{0}} -\expandafter\def\csname tikz@label@angle@is@above right\endcsname{\def\tikz@label@angle{45}} -\expandafter\def\csname tikz@label@angle@is@above\endcsname{\def\tikz@label@angle{90}} -\expandafter\def\csname tikz@label@angle@is@above left\endcsname{\def\tikz@label@angle{135}} -\expandafter\def\csname tikz@label@angle@is@left\endcsname{\def\tikz@label@angle{180}} -\expandafter\def\csname tikz@label@angle@is@below left\endcsname{\def\tikz@label@angle{225}} -\expandafter\def\csname tikz@label@angle@is@below\endcsname{\def\tikz@label@angle{270}} -\expandafter\def\csname tikz@label@angle@is@below right\endcsname{\def\tikz@label@angle{315}} - -\def\tikz@compute@direction#1#2{% - \let\tikz@do@auto@anchor=\relax - \c@pgf@counta=#1\relax% - \ifnum\c@pgf@counta<0\relax - \advance\c@pgf@counta by 360\relax% - \fi% - \ifnum\c@pgf@counta>359\relax - \advance\c@pgf@counta by-360\relax% - \fi% - \ifnum\c@pgf@counta<4\relax% - \def\tikz@anchor{west}% - \else\ifnum\c@pgf@counta<87\relax% - \def\tikz@anchor{south west}% - \else\ifnum\c@pgf@counta<94\relax% - \def\tikz@anchor{south}% - \else\ifnum\c@pgf@counta<177\relax% - \def\tikz@anchor{south east}% - \else\ifnum\c@pgf@counta<184\relax% - \def\tikz@anchor{east}% - \else\ifnum\c@pgf@counta<267\relax% - \def\tikz@anchor{north east}% - \else\ifnum\c@pgf@counta<274\relax% - \def\tikz@anchor{north}% - \else\ifnum\c@pgf@counta<357\relax% - \def\tikz@anchor{north west}% - \else% - \def\tikz@anchor{west}% - \fi\fi\fi\fi\fi\fi\fi\fi% - \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#1}{#2}}}% -} - - - -% General shape options -\tikzoption{name}{\edef\tikz@fig@name{#1}} - -\tikzoption{at}{\tikz@scan@one@point\tikz@set@at#1} -\def\tikz@set@at#1{\def\tikz@node@at{#1}}% - -\tikzoption{shape}{\edef\tikz@shape{#1}} - -\tikzoption{nodes}{\tikzstyle{every node}+=[#1]} - -\tikzoption{inner sep}{\def\pgfshapeinnerxsep{#1}\def\pgfshapeinnerysep{#1}} -\tikzoption{inner xsep}{\def\pgfshapeinnerxsep{#1}} -\tikzoption{inner ysep}{\def\pgfshapeinnerysep{#1}} - -\tikzoption{outer sep}{\def\pgfshapeouterxsep{#1}\def\pgfshapeouterysep{#1}} -\tikzoption{outer xsep}{\def\pgfshapeouterxsep{#1}} -\tikzoption{outer ysep}{\def\pgfshapeouterysep{#1}} - -\tikzoption{minimum width}{\def\pgfshapeminwidth{#1}} -\tikzoption{minimum height}{\def\pgfshapeminheight{#1}} -\tikzoption{minimum size}{\def\pgfshapeminwidth{#1}\def\pgfshapeminheight{#1}} - -\tikzoption{aspect}{\pgfsetshapeaspect{#1}} - -\tikzoption{after node path}{\tikz@add@after@node@path{#1}}% -\def\tikz@add@after@node@path#1{\expandafter\def\expandafter\tikz@after@node\expandafter{\tikz@after@node#1}} - -\def\tikzaddafternodepathoption#1{% - #1% - \expandafter\def\expandafter\tikz@afternodepathoptions\expandafter{\tikz@afternodepathoptions#1}} - -\let\tikz@afternodepathoptions=\pgfutil@empty - -\tikzoption{anchor}{\def\tikz@anchor{#1}\let\tikz@do@auto@anchor=\relax} - -\tikzoption{left}[]{\def\tikz@anchor{east}\tikz@possibly@transform{x}{-}{#1}} -\tikzoption{right}[]{\def\tikz@anchor{west}\tikz@possibly@transform{x}{}{#1}} -\tikzoption{above}[]{\def\tikz@anchor{south}\tikz@possibly@transform{y}{}{#1}} -\tikzoption{below}[]{\def\tikz@anchor{north}\tikz@possibly@transform{y}{-}{#1}} -\tikzoption{above left}[]% - {\def\tikz@anchor{south east}% - \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{}{#1}} -\tikzoption{above right}[]% - {\def\tikz@anchor{south west}% - \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{}{#1}} -\tikzoption{below left}[]% - {\def\tikz@anchor{north east}% - \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{-}{#1}} -\tikzoption{below right}[]% - {\def\tikz@anchor{north west}% - \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{-}{#1}} - -\tikzoption{node distance}{\def\tikz@node@distance{#1}} -\def\tikz@node@distance{1cm} - -\tikzoption{above of}{\tikz@of{#1}{90}}% -\tikzoption{below of}{\tikz@of{#1}{-90}}% -\tikzoption{left of}{\tikz@of{#1}{180}}% -\tikzoption{right of}{\tikz@of{#1}{0}}% -\tikzoption{above left of}{\tikz@of{#1}{135}}% -\tikzoption{below left of}{\tikz@of{#1}{-135}}% -\tikzoption{above right of}{\tikz@of{#1}{45}}% -\tikzoption{below right of}{\tikz@of{#1}{-45}}% - -\def\tikz@of#1#2{% - \def\tikz@anchor{center}% - \let\tikz@do@auto@anchor=\relax% - \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#2}{\tikz@node@distance}}}% - \def\tikz@node@at{\pgfpointanchor{#1}{center}}} - -\tikzoption{transform shape}[true]{% - \csname tikz@fullytransformed#1\endcsname% - \iftikz@fullytransformed% - \pgfresetnontranslationattimefalse% - \else% - \pgfresetnontranslationattimetrue% - \fi% -} - -\newif\iftikz@fullytransformed -\pgfresetnontranslationattimetrue% - -\def\tikz@anchor{center}% -\def\tikz@shape{rectangle}% - -\def\tikz@possibly@transform#1#2#3{% - \let\tikz@do@auto@anchor=\relax% - \def\tikz@test{#3}% - \ifx\tikz@test\pgfutil@empty% - \else% - \pgfmathsetlength{\pgf@x}{#3}% - \pgf@x=#2\pgf@x\relax% - \edef\tikz@marshal{\noexpand\tikz@addtransform{% - \expandafter\noexpand\csname pgftransform#1shift\endcsname{\the\pgf@x}}}% - \tikz@marshal% - \fi% -} - - -% Inter-picture options -\tikzoption{remember picture}[true]{\csname pgfrememberpicturepositiononpage#1\endcsname} -\tikzoption{overlay}[]{\pgf@relevantforpicturesizefalse} - - - -% Line/curve label placement options -\tikzoption{sloped}[true]{\csname pgfslopedattime#1\endcsname} -\tikzoption{allow upside down}[true]{\csname pgfallowupsidedownattime#1\endcsname} - -\tikzoption{pos}{\edef\tikz@time{#1}} - -\tikzoption{auto}[]{\csname tikz@install@auto@anchor@#1\endcsname} -\tikzoption{swap}[]{% - \def\tikz@temp{left}% - \ifx\tikz@auto@anchor@direction\tikz@temp% - \def\tikz@auto@anchor@direction{right}% - \else% - \def\tikz@auto@anchor@direction{left}% - \fi% -} - -\def\tikz@time{.5} - -\def\tikz@install@auto@anchor@{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on} -\def\tikz@install@auto@anchor@false{\let\tikz@do@auto@anchor=\relax} -\def\tikz@install@auto@anchor@left{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on\def\tikz@auto@anchor@direction{left}} -\def\tikz@install@auto@anchor@right{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on\def\tikz@auto@anchor@direction{right}} - -\let\tikz@do@auto@anchor=\relax% - -\def\tikz@auto@anchor@on{\csname tikz@auto@anchor@\tikz@auto@anchor@direction\endcsname} - -\def\tikz@auto@anchor@left{\tikz@auto@pre\tikz@auto@anchor\tikz@auto@post} -\def\tikz@auto@anchor@right{\tikz@auto@pre\tikz@auto@anchor@prime\tikz@auto@post} - -\def\tikz@auto@anchor@direction{left} - -% Text options -\tikzoption{text}{\def\tikz@textcolor{#1}} -\tikzoption{font}{\def\tikz@textfont{#1}} -\tikzoption{text opacity}{\def\tikz@textopacity{#1}} -\tikzoption{text width}{\def\tikz@text@width{#1}} -\tikzoption{text height}{\def\tikz@text@height{#1}} -\tikzoption{text depth}{\def\tikz@text@depth{#1}} -\tikzoption{text ragged}[]% -{\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} -\tikzoption{text badly ragged}[]{\def\tikz@text@action{\raggedright\relax}} -\tikzoption{text ragged left}[]% -{\def\tikz@text@action{\raggedleft\leftskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} -\tikzoption{text badly ragged left}[]{\def\tikz@text@action{\raggedleft\relax}} -\tikzoption{text justified}[]{\def\tikz@text@action{\leftskip\z@\rightskip\z@\relax}} -\tikzoption{text centered}[]{\def\tikz@text@action{% - \leftskip\z@ plus2em% - \rightskip\z@ plus2em% - \spaceskip.3333em \xspaceskip.5em% - \parfillskip=0pt% - \let\\=\@centercr% for latex - \relax}} -\tikzoption{text badly centered}[]% -{\def\tikz@text@action{% - \let\\=\@centercr% for latex - \parfillskip=0pt% - \rightskip\@flushglue% - \leftskip\@flushglue\relax}} - -\let\tikz@text@width=\pgfutil@empty -\let\tikz@text@height=\pgfutil@empty -\let\tikz@text@depth=\pgfutil@empty -\let\tikz@textcolor=\pgfutil@empty -\let\tikz@textfont=\pgfutil@empty -\let\tikz@textopacity=\pgfutil@empty - -\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax} - - - - - -% Arrow options -\tikzoption{arrows}{\tikz@processarrows{#1}} - -\tikzoption{>}{% - \tikz@set@pointed{\csname pgf@arrows@invert#1\endcsname}{#1}% - \expandafter\tikz@processarrows\expandafter{\tikz@current@arrows}% -} - -\tikzoption{shorten <}{\pgfsetshortenstart{#1}} -\tikzoption{shorten >}{\pgfsetshortenend{#1}} - -\def\tikz@set@pointed#1#2{% - \pgfutil@ifundefined{pgf@arrow@code@tikze@>@#2} - {% - \pgfarrowsdeclarealias{tikzs@<@#2}{tikze@>@#2}{#1}{#2}% - \pgfarrowsdeclarereversed{tikzs@>@#2}{tikze@<@#2}{#1}{#2}% - \pgfarrowsdeclarecombine*{tikz@|<@#2}{tikz@>|@#2}{#1}{#2}{|}{|}% - \pgfarrowsdeclaredouble[\pgflinewidth]{tikzs@<<@#2}{tikze@>>@#2}{#1}{#2}% - \pgfarrowsdeclarereversed{tikzs@>>@#2}{tikze@<<@#2}{tikzs@<<@#2}{tikze@>>@#2}% - }{}% - \pgfutil@namedef{tikz@special@arrow@start<}{tikzs@<@#2}% - \pgfutil@namedef{tikz@special@arrow@end>}{tikze@>@#2}% - \pgfutil@namedef{tikz@special@arrow@start>}{tikzs@>@#2}% - \pgfutil@namedef{tikz@special@arrow@end<}{tikze@<@#2}% - \pgfutil@namedef{tikz@special@arrow@start|<}{tikz@|<@#2}% - \pgfutil@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}% - \pgfutil@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}% - \pgfutil@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}% - \pgfutil@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}% - \pgfutil@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}% -} - -\def\tikz@processarrows#1{% - \def\tikz@current@arrows{#1}% - \def\tikz@temp{#1}% - \ifx\tikz@temp\pgfutil@empty% - \else% - \tikz@@processarrows#1\@nil - \fi% -} -\def\tikz@@processarrows#1-#2\@nil{% - \expandafter\ifx\csname tikz@special@arrow@start#1\endcsname\relax% - \pgfsetarrowsstart{#1} - \else% - \pgfsetarrowsstart{\csname tikz@special@arrow@start#1\endcsname}% - \fi% - \expandafter\ifx\csname tikz@special@arrow@end#2\endcsname\relax% - \pgfsetarrowsend{#2} - \else% - \pgfsetarrowsend{\csname tikz@special@arrow@end#2\endcsname}% - \fi% -} - -\tikz@set@pointed{\pgf@arrows@invertto}{to} -\def\tikz@current@arrows{-} - -% Parabola options -\tikzoption{bend}{\tikz@scan@one@point\tikz@set@parabola@bend#1\relax}% -\tikzoption{bend pos}{\def\tikz@parabola@bend@factor{#1}} -\tikzoption{parabola height}{% - \def\tikz@parabola@bend@factor{.5}% - \def\tikz@parabola@bend{\pgfpointadd{\pgfpoint{0pt}{#1}}{\tikz@last@position@saved}}} - -\def\tikz@parabola@bend{\tikz@last@position@saved} -\def\tikz@parabola@bend@factor{0} - -\def\tikz@set@parabola@bend#1{\def\tikz@parabola@bend{#1}} - -% Axis options -\tikzoption{domain}{\def\tikz@plot@domain{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax} -\tikzoption{range}{\def\tikz@plot@range{#1}} - -% Plot options -\tikzoption{smooth}[]{\let\tikz@plot@handler=\pgfplothandlercurveto} -\tikzoption{smooth cycle}[]{\let\tikz@plot@handler=\pgfplothandlerclosedcurve} -\tikzoption{sharp plot}[]{\let\tikz@plot@handler\pgfplothandlerlineto} - -\tikzoption{tension}{\pgfsetplottension{#1}} - -\tikzoption{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb} -\tikzoption{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb} -\tikzoption{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb} - -\tikzoption{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname} -\tikzoption{prefix}{\def\tikz@plot@prefix{#1}} -\tikzoption{id}{\def\tikz@plot@id{#1}} - -\tikzoption{samples}{\def\tikz@plot@samples{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax} -\tikzoption{samples at}{\def\tikz@plot@samplesat{#1}} -\tikzoption{parametric}[true]{\csname tikz@plot@parametric#1\endcsname} - -\tikzoption{variable}{\def\tikz@plot@var{#1}} - -\tikzoption{only marks}[]{\let\tikz@plot@handler\pgfplothandlerdiscard} - -\tikzoption{mark}{\def\tikz@plot@mark{#1}} -\tikzoption{mark options}{\def\tikz@plot@mark@options{#1}} -\tikzoption{mark size}{\pgfsetplotmarksize{#1}} - -\tikzoption{mark indices}{\def\tikz@mark@list{#1}} -\tikzoption{mark phase}{\pgfsetplotmarkphase{#1}} -\tikzoption{mark repeat}{\pgfsetplotmarkrepeat{#1}} - -\let\tikz@mark@list=\pgfutil@empty - -\let\tikz@plot@mark@options=\pgfutil@empty - -\let\tikz@plot@handler=\pgfplothandlerlineto -\let\tikz@plot@mark=\pgfutil@empty - -\def\tikz@plot@samples{25} -\def\tikz@plot@domain{-5:5} -\def\tikz@plot@var{\x} -\def\tikz@plot@samplesat{-5,-4.6,...,5} -\def\tikz@plot@samples@recalc#1:#2\relax{% - \pgfmathparse{#1}% - \let\tikz@temp@start=\pgfmathresult% - \pgfmathparse{#2}% - \let\tikz@temp@end=\pgfmathresult% - \pgfmathparse{\tikz@temp@start+(\tikz@temp@end-\tikz@temp@start)/\tikz@plot@samples}% - \edef\tikz@plot@samplesat{\tikz@temp@start,\pgfmathresult,...,\tikz@temp@end}% -} - - -\def\tikz@plot@prefix{\jobname.} -\def\tikz@plot@id{pgf-plot} - -\newif\iftikz@plot@parametric -\newif\iftikz@plot@raw@gnuplot - - -% To options -\tikzoption{to path}{\def\tikz@to@path{#1}} - -\def\tikz@to@path{-- (\tikztotarget) \tikztonodes} - - - -% Tree options -\tikzoption{edge from parent path}{\def\tikz@edge@to@parent@path{#1}} - -\tikzoption{parent anchor}{\def\tikzparentanchor{.#1}\ifx\tikzparentanchor\tikz@border@text\let\tikzparentanchor\pgfutil@empty\fi} -\tikzoption{child anchor}{\def\tikzchildanchor{.#1}\ifx\tikzchildanchor\tikz@border@text\let\tikzchildanchor\pgfutil@empty\fi} - -\tikzoption{level distance}{\pgfmathsetlength\tikzleveldistance{#1}} -\tikzoption{sibling distance}{\pgfmathsetlength\tikzsiblingdistance{#1}} - -\tikzoption{growth function}{\let\tikz@grow=#1} -\tikzoption{growth parent anchor}{\def\tikz@growth@anchor{#1}} -\tikzoption{grow}{\tikz@set@growth{#1}\edef\tikz@special@level{\the\tikztreelevel}}% -\tikzoption{grow'}{\tikz@set@growth{#1}\tikz@swap@growth\edef\tikz@special@level{\the\tikztreelevel}}% - -\def\tikz@growth@anchor{center} - -\def\tikz@special@level{-1}% never - -\def\tikz@swap@growth{% - % Swap left and right - \let\tikz@temp=\tikz@angle@grow@right% - \let\tikz@angle@grow@right=\tikz@angle@grow@left% - \let\tikz@angle@grow@left=\tikz@temp% -}% - -\def\tikz@set@growth#1{% - \let\tikz@grow=\tikz@grow@direction% - \expandafter\ifx\csname tikz@grow@direction@#1\endcsname\relax% - \c@pgf@counta=#1\relax% - \else% - \c@pgf@counta=\csname tikz@grow@direction@#1\endcsname% - \fi% - \edef\tikz@angle@grow{\the\c@pgf@counta}% - \advance\c@pgf@counta by-90\relax% - \edef\tikz@angle@grow@left{\the\c@pgf@counta}% - \advance\c@pgf@counta by180\relax% - \edef\tikz@angle@grow@right{\the\c@pgf@counta}% -} - -\def\tikz@border@text{.border} -\let\tikzparentanchor=\pgfutil@empty -\let\tikzchildanchor=\pgfutil@empty -\def\tikz@edge@to@parent@path{(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor)} - -\tikzleveldistance=15mm -\tikzsiblingdistance=15mm - -\def\tikz@grow@direction@down{-90} -\def\tikz@grow@direction@up{90} -\def\tikz@grow@direction@left{180} -\def\tikz@grow@direction@right{0} - -\def\tikz@grow@direction@south{-90} -\def\tikz@grow@direction@north{90} -\def\tikz@grow@direction@west{180} -\def\tikz@grow@direction@east{0} - -\expandafter\def\csname tikz@grow@direction@north east\endcsname{45} -\expandafter\def\csname tikz@grow@direction@north west\endcsname{135} -\expandafter\def\csname tikz@grow@direction@south east\endcsname{-45} -\expandafter\def\csname tikz@grow@direction@south west\endcsname{-135} - -\def\tikz@grow@direction{% - \pgftransformshift{\pgfpointpolar{\tikz@angle@grow}{\tikzleveldistance}}% - \ifnum\tikztreelevel=\tikz@special@level% - \else% - \pgf@xc=.5\tikzsiblingdistance% - \c@pgf@counta=\tikznumberofchildren% - \advance\c@pgf@counta by1\relax% - \pgfutil@tempdima=\c@pgf@counta\pgf@xc% - \pgftransformshift{\pgfpointpolar{\tikz@angle@grow@left}{\pgfutil@tempdima}}% - \pgftransformshift{\pgfpointpolar{\tikz@angle@grow@right}{\tikznumberofcurrentchild\tikzsiblingdistance}}% - \fi% -} - -\tikz@orig@setkeys{tikz}{grow=down} - - - - -% Snake options -\tikzoption{snake}[]{% - \def\tikz@@snake{#1}% - \ifx\tikz@@snake\pgfutil@empty% - \tikz@snakedtrue% - \else% - \ifx\tikz@@snake\tikz@nonetext% - \tikz@snakedfalse% - \else% - \tikz@snakedtrue% - \let\tikz@snake=\tikz@@snake% - \fi% - \fi} - -\tikzoption{segment amplitude}{\pgfmathsetlength{\pgfsnakesegmentamplitude}{#1}} -\tikzoption{segment length}{\pgfmathsetlength{\pgfsnakesegmentlength}{#1}} -\tikzoption{segment angle}{\pgfmathparse{#1}\let\pgfsnakesegmentangle=\pgfmathresult} -\tikzoption{segment aspect}{\pgfmathparse{#1}\let\pgfsnakesegmentaspect=\pgfmathresult} - -\tikzoption{segment object length}{\pgfmathparse{#1}\edef\pgfsnakesegmentobjectlength{\pgfmathresult pt}} - -\tikzoption{raise snake}{\def\pgf@snake@raise{\pgftransformyshift{#1}}} -\tikzoption{mirror snake}[true]{% - \csname if#1\endcsname - \def\pgf@snake@mirror{\pgftransformyscale{-1}}% - \else% - \let\pgf@snake@mirror=\pgfutil@empty% - \fi -} - -\tikzoption{gap before snake}{\def\tikz@presnake{{moveto}{#1}}} -\tikzoption{line before snake}{\def\tikz@presnake{{lineto}{#1}}} - -\tikzoption{gap after snake}{\def\tikz@postsnake{{moveto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance+-#1}} -\tikzoption{line after snake}{\def\tikz@postsnake{{lineto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance+-#1}} - -\tikzoption{gap around snake}{% - \def\tikz@presnake{{moveto}{#1}}% - \def\tikz@postsnake{{moveto}{#1}}% - \def\tikz@mainsnakelength{\pgfsnakeremainingdistance+-#1}% -} -\tikzoption{line around snake}{% - \def\tikz@presnake{{lineto}{#1}}% - \def\tikz@postsnake{{lineto}{#1}}% - \def\tikz@mainsnakelength{\pgfsnakeremainingdistance+-#1}% -} -\let\pgf@snake@mirror=\pgfutil@empty -\let\pgf@snake@raise=\pgfutil@empty - -\pgfsetsnakesegmenttransformation{\pgf@snake@mirror\pgf@snake@raise} - -\def\tikz@snake{zigzag} - -\let\tikz@presnake=\pgfutil@empty -\let\tikz@postsnake=\pgfutil@empty -\def\tikz@mainsnakelength{\pgfsnakeremainingdistance} - - -% Matrix options -\tikzoption{matrix}[true]{\csname tikz@is@matrix#1\endcsname} - -\tikzoption{matrix anchor}{\def\tikz@matrix@anchor{#1}} - -\tikzoption{column sep}{\def\pgfmatrixcolumnsep{#1}} -\tikzoption{row sep}{\def\pgfmatrixrowsep{#1}} - -\tikzoption{cells}{\tikzstyle{every cell}+=[#1]} - -\tikzoption{ampersand replacement}{\def\tikz@ampersand@replacement{#1}} - -\newif\iftikz@is@matrix -\let\tikz@matrix@anchor=\pgfutil@empty -\let\tikz@ampersand@replacement=\pgfutil@empty - -% Execute option - -\tikzoption{execute at begin picture}{\expandafter\def\expandafter\tikz@atbegin@picture\expandafter{\tikz@atbegin@picture#1}} -\tikzoption{execute at end picture}{\expandafter\def\expandafter\tikz@atend@picture\expandafter{\tikz@atend@picture#1}} -\tikzoption{execute at begin scope}{\expandafter\def\expandafter\tikz@atbegin@scope\expandafter{\tikz@atbegin@scope#1}} -\tikzoption{execute at end scope}{\expandafter\def\expandafter\tikz@atend@scope\expandafter{\tikz@atend@scope#1}} -\tikzoption{execute at begin to}{\expandafter\def\expandafter\tikz@atbegin@to\expandafter{\tikz@atbegin@to#1}} -\tikzoption{execute at end to}{\expandafter\def\expandafter\tikz@atend@to\expandafter{\tikz@atend@to#1}} -\tikzoption{execute at begin node}{\expandafter\def\expandafter\tikz@atbegin@node\expandafter{\tikz@atbegin@node#1}} -\tikzoption{execute at end node}{\expandafter\def\expandafter\tikz@atend@node\expandafter{\tikz@atend@node#1}} -\tikzoption{execute at begin cell}{\expandafter\def\expandafter\tikz@atbegin@cell\expandafter{\tikz@atbegin@cell#1}} -\tikzoption{execute at end cell}{\expandafter\def\expandafter\tikz@atend@cell\expandafter{\tikz@atend@cell#1}} -\tikzoption{execute at empty cell}{\expandafter\def\expandafter\tikz@at@emptycell\expandafter{\tikz@at@emptycell#1}} - -\let\tikz@atbegin@picture=\pgfutil@empty -\let\tikz@atend@picture=\pgfutil@empty -\let\tikz@atbegin@scope=\pgfutil@empty -\let\tikz@atend@scope=\pgfutil@empty -\let\tikz@atbegin@to=\pgfutil@empty -\let\tikz@atend@to=\pgfutil@empty -\let\tikz@atbegin@node=\pgfutil@empty -\let\tikz@atend@node=\pgfutil@empty -\let\tikz@atbegin@cell=\pgfutil@empty -\let\tikz@atend@cell=\pgfutil@empty -\let\tikz@at@emptycell=\pgfutil@empty - - - - -% Styles -\tikzoption{set style}{\tikzstyle#1} - -% Handled in a special way. -\def\tikzstyle{\pgfutil@ifnextchar\bgroup\tikz@style@parseA\tikz@style@parseB} -\def\tikz@style@parseB#1={\tikz@style@parseA{#1}=} -\def\tikz@style@parseA#1#2=#3[#4]{% #2 and #3 are dummy - \pgfutil@in@+{#2}% - \ifpgfutil@in@% - \tikz@style{#1}{#4}% - \else% - \expandafter\def\csname tikz@st@#1\endcsname{#4}% - \fi} -\def\tikz@style#1#2{% - \iftikzstyleempty{#1} - {\expandafter\def\csname tikz@st@#1\endcsname{#2}}% - {% - \edef\tikz@marshal{\def\expandafter\noexpand\csname tikz@st@#1\endcsname}% - \expandafter\expandafter\expandafter\tikz@marshal\expandafter\expandafter\expandafter{\csname - tikz@st@#1\endcsname,#2}% - }% -} - -\def\iftikzstyleempty#1#2#3{% - \expandafter\ifx\csname tikz@st@#1\endcsname\pgfutil@empty% - \let\pgf@next=\pgfutil@firstoftwo% - \else% - \expandafter\ifx\csname tikz@st@#1\endcsname\relax% - \let\pgf@next=\pgfutil@firstoftwo% - \else - \let\pgf@next=\pgfutil@secondoftwo% - \fi% - \fi% - \pgf@next{#2}{#3}} - - -% -% -% Predefined styles -% -% - -\tikzstyle{help lines}= [color=gray,line width=0.2pt] - -\tikzstyle{every picture}= [] -\tikzstyle{every path}= [] -\tikzstyle{every scope}= [] -\tikzstyle{every plot}= [] -\tikzstyle{every node}= [] -\tikzstyle{every child}= [] -\tikzstyle{every child node}= [] -\tikzstyle{every to}= [] -\tikzstyle{every cell}= [] -\tikzstyle{every matrix}= [] -\tikzstyle{every edge}= [draw] -\tikzstyle{every label}= [draw=none,fill=none] -\tikzstyle{every pin}= [draw=none,fill=none] -\tikzstyle{every pin edge}= [help lines] - -\tikzstyle{ultra thin}= [line width=0.1pt] -\tikzstyle{very thin}= [line width=0.2pt] -\tikzstyle{thin}= [line width=0.4pt] -\tikzstyle{semithick}= [line width=0.6pt] -\tikzstyle{thick}= [line width=0.8pt] -\tikzstyle{very thick}= [line width=1.2pt] -\tikzstyle{ultra thick}= [line width=1.6pt] - -\tikzstyle{solid}= [dash pattern=] -\tikzstyle{dotted}= [dash pattern=on \pgflinewidth off 2pt] -\tikzstyle{densely dotted}= [dash pattern=on \pgflinewidth off 1pt] -\tikzstyle{loosely dotted}= [dash pattern=on \pgflinewidth off 4pt] -\tikzstyle{dashed}= [dash pattern=on 3pt off 3pt] -\tikzstyle{densely dashed}= [dash pattern=on 3pt off 2pt] -\tikzstyle{loosely dashed}= [dash pattern=on 3pt off 6pt] - -\tikzstyle{transparent}= [opacity=0] -\tikzstyle{ultra nearly transparent}=[opacity=0.05] -\tikzstyle{very nearly transparent}= [opacity=0.1] -\tikzstyle{nearly transparent}= [opacity=0.25] -\tikzstyle{semitransparent}= [opacity=0.5] -\tikzstyle{nearly opaque}= [opacity=0.75] -\tikzstyle{very nearly opaque}= [opacity=0.9] -\tikzstyle{ultra nearly opaque}= [opacity=0.95] -\tikzstyle{opaque}= [opacity=1] - -\tikzstyle{at start}= [pos=0] -\tikzstyle{very near start}= [pos=0.125] -\tikzstyle{near start}= [pos=0.25] -\tikzstyle{midway}= [pos=0.5] -\tikzstyle{near end}= [pos=0.75] -\tikzstyle{very near end}= [pos=0.875] -\tikzstyle{at end}= [pos=1] - -\tikzstyle{bend at start}= [bend pos=0,bend={+(0,0)}] -\tikzstyle{bend at end}= [bend pos=1,bend={+(0,0)}] - -\tikzstyle{edge from parent}= [draw] - -\tikzstyle{snake triangles 45}= [snake=triangles,segment object length=2.41421356\pgfsnakesegmentamplitude] -\tikzstyle{snake triangles 60}= [snake=triangles,segment object length=1.73205081\pgfsnakesegmentamplitude] -\tikzstyle{snake triangles 90}= [snake=triangles,segment object length=\pgfsnakesegmentamplitude] - - -% -% Setting keys -% - -\let\tikz@late@keys=\pgfutil@empty% - -\def\tikz@set@one@key#1{% - \tikz@orig@setkeys*{tikz}{#1}% - \ifx\XKV@rm\pgfutil@empty% - % fine - \else% - \expandafter\pgfutil@in@\expandafter!\expandafter{\XKV@rm}% - \ifpgfutil@in@% - % this is a color! - \expandafter\tikz@addoption\expandafter{\expandafter\pgfutil@color\expandafter{\XKV@rm}}% - \edef\tikz@textcolor{\XKV@rm}% - \else% - \pgfutil@doifcolorelse{\XKV@rm} - { % - \expandafter\tikz@addoption\expandafter{\expandafter\pgfutil@color\expandafter{\XKV@rm}}% - \edef\tikz@textcolor{\XKV@rm}% - }% - {% - % Ok, second chance: This might be an arrow specification: - \expandafter\pgfutil@in@\expandafter-\expandafter{\XKV@rm} - \ifpgfutil@in@% - % Ah, an arrow spec! - \expandafter\tikz@processarrows\expandafter{\XKV@rm}% - \else% - % Ok, third chance: A shape! - \expandafter\ifx\csname pgf@sh@s@\XKV@rm\endcsname\relax% - \PackageError{tikz}{I do not know what to do with the option ``\XKV@rm''}{} - \else% - \edef\tikz@shape{\XKV@rm}% - \fi% - \fi% - }% - \fi% - \fi% -} - -\def\tikz@setkeys#1{\tikz@@setkeys#1,\pgf@stop} - -\def\tikz@@setkeys#1,#2\pgf@stop{% - \def\tikz@key@test{#1}% - \def\tikz@key@rest{#2}% - \ifx\tikz@key@test\pgfutil@empty% - \else% - \pgfutil@ifnextchar s{\tikz@parse@key}{\tikz@parse@key}#1==\pgf@stop% - \fi% - \ifx\tikz@key@rest\pgfutil@empty% - \else% - \expandafter\expandafter\expandafter\tikz@@setkeys\expandafter\tikz@key@rest\expandafter\pgf@stop% - \fi% -} - -\def\tikz@style@text{style} - -\def\tikz@parse@key#1=#2=#3\pgf@stop{ - \def\tikz@key@test{#1}% - \ifx\tikz@key@test\tikz@style@text% - % Ok, style! - \pgfutil@ifundefined{tikz@st@#2}% - {\PackageError{tikz}{Unknown style ``#2}''{}} - {% - \expandafter\let\expandafter\tikz@temp\expandafter=\csname tikz@st@#2\endcsname% - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter\tikz@key@rest - \expandafter\expandafter\expandafter{\expandafter\tikz@temp\expandafter,\tikz@key@rest}% - }% - \else% - \expandafter\ifx\csname tikz@st@#1\endcsname\relax% - % Ok, normal! - \def\tikz@test{#3}% - \ifx\tikz@test\pgfutil@empty% - \tikz@set@one@key{#1}% - \else% - \tikz@set@one@key{#1={#2}}% - \fi% - \else% - % Ok, style! - \expandafter\let\expandafter\tikz@temp\expandafter=\csname tikz@st@#1\endcsname% - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter\tikz@key@rest - \expandafter\expandafter\expandafter{\expandafter\tikz@temp\expandafter,\tikz@key@rest}% - \fi% - \fi% -} - -\def\tikz@every@style#1{% - \expandafter\ifx\csname tikz@st@#1\endcsname\relax% - \else% - \expandafter\expandafter\expandafter\tikz@setkeys - \expandafter\expandafter\expandafter{\csname tikz@st@#1\endcsname}% - \fi% -} - - - - - -% -% Main TikZ Environment -% - -\def\tikzpicture{\pgfutil@ifnextchar[\tikz@picture{\tikz@picture[]}}%} -\def\tikz@picture[#1]{% - \pgfpicture% - \let\tikz@atbegin@picture=\pgfutil@empty% - \let\tikz@atend@picture=\pgfutil@empty% - \let\tikz@transform=\relax% - \tikz@installcommands\scope[style=every picture,#1]% - \tikz@atbegin@picture% -} -\def\endtikzpicture{% - \tikz@atend@picture% - \global\let\pgf@shift@baseline=\pgf@baseline% - \global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage% - \endscope% - \let\pgf@baseline=\pgf@shift@baseline% - \let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle% - \endpgfpicture} - - - -% Inlined picture -% -% #1 - some code to be put in a tikzpicture environment. -% -% If the command is not followed by braces, everything up to the next -% semicolon is used as argument. -% -% Example: -% -% The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and -% height 1ex. - -\def\tikz{\pgfutil@ifnextchar[{\tikz@opt}{\tikz@opt[]}} -\def\tikz@opt[#1]{\pgfutil@ifnextchar\bgroup{\tikz@[#1]}{\tikz@@[#1]}} -\def\tikz@[#1]#2{\tikzpicture[#1]#2\endtikzpicture} -\def\tikz@@{% - \let\tikz@next=\tikz@collectnormalsemicolon% - \ifnum\the\catcode`\;=\active\relax% - \let\tikz@next=\tikz@collectactivesemicolon% - \fi% - \tikz@next} -\def\tikz@collectnormalsemicolon[#1]#2;{\tikzpicture[#1]#2;\endtikzpicture} -{ - \catcode`\;=\active - \gdef\tikz@collectactivesemicolon[#1]#2;{\tikzpicture[#1]#2;\endtikzpicture} -} - - - -% -% Environment for scoping graphic state settings -% -\def\tikz@scope@env{\pgfutil@ifnextchar[\tikz@@scope@env{\tikz@@scope@env[]}} -\def\tikz@@scope@env[#1]{% - \pgfscope% - \begingroup% - \let\tikz@atbegin@scope=\pgfutil@empty% - \let\tikz@atend@scope=\pgfutil@empty% - \let\tikz@options=\pgfutil@empty% - \let\tikz@mode=\pgfutil@empty% - \tikz@every@style{every scope}% - \tikz@setkeys{#1}% - \tikz@options% - \tikz@atbegin@scope% -} -\def\endtikz@scope@env{% - \tikz@atend@scope% - \endgroup% - \endpgfscope% -} - - -% -% Install the abbreviated commands -% -\def\tikz@installcommands{% - \ifnum\the\catcode`\;=\active\relax\expandafter\let\expandafter\tikz@origsemi\expandafter=\tikz@activesemicolon\fi% - \ifnum\the\catcode`\:=\active\relax\expandafter\let\expandafter\tikz@origcolon\expandafter=\tikz@activecolon\fi% - \ifnum\the\catcode`\|=\active\relax\expandafter\let\expandafter\tikz@origbar\expandafter=\tikz@activebar\fi% - \let\tikz@origscope=\scope% - \let\tikz@origendscope=\endscope% - \let\tikz@origstartscope=\startscope% - \let\tikz@origstopscope=\stopscope% - \let\tikz@origpath=\path% - \let\tikz@origagainpath=\againpath% - \let\tikz@origdraw=\draw% - \let\tikz@origpattern=\pattern% - \let\tikz@origfill=\fill% - \let\tikz@origfilldraw=\filldraw% - \let\tikz@origshade=\shade% - \let\tikz@origshadedraw=\shadedraw% - \let\tikz@origclip=\clip% - \let\tikz@origuseasboundingbox=\useasboundingbox% - \let\tikz@orignode=\node% - \let\tikz@origcoordinate=\coordinate% - \let\tikz@origmatrix=\matrix% - \let\tikz@origcalendar=\calendar% - % - \tikz@deactivatthings% - % - \let\scope=\tikz@scope@env% - \let\endscope=\endtikz@scope@env% - \let\startscope=\scope% - \let\stopscope=\endscope% - \let\path=\tikz@command@path% - \let\againpath=\tikz@command@againpath% - % - \def\draw{\path[draw]} - \def\pattern{\path[pattern]} - \def\fill{\path[fill]} - \def\filldraw{\path[fill,draw]} - \def\shade{\path[shade]} - \def\shadedraw{\path[shade,draw]} - \def\clip{\path[clip]} - \def\useasboundingbox{\path[use as bounding box]} - \def\node{\path node} - \def\coordinate{\path coordinate} - \def\matrix{\path node[matrix]} - \def\calendar{\tikz@lib@cal@calendar}% -} -\ifx\tikz@lib@cal@calendar\@undefined -\def\tikz@lib@cal@calendar{\PackageError{tikz}{You need to load the calendar library}{}} -\fi - -\def\tikz@uninstallcommands{% - \ifnum\the\catcode`\;=\active\relax\expandafter\let\tikz@activesemicolon=\tikz@origsemi\fi% - \ifnum\the\catcode`\:=\active\relax\expandafter\let\tikz@activecolon=\tikz@origcolon\fi% - \ifnum\the\catcode`\|=\active\relax\expandafter\let\tikz@activebar=\tikz@origbar\fi% - \let\scope=\tikz@origscope% - \let\endscope=\tikz@origendscope% - \let\startscope=\tikz@origstartscope% - \let\stopscope=\tikz@origstopscope% - \let\path=\tikz@origpath% - \let\againpath=\tikz@origagainpath% - \let\draw=\tikz@origdraw% - \let\pattern=\tikz@origpattern% - \let\fill=\tikz@origfill% - \let\filldraw=\tikz@origfilldraw% - \let\shade=\tikz@origshade% - \let\shadedraw=\tikz@origshadedraw% - \let\clip=\tikz@origclip% - \let\useasboundingbox=\tikz@origuseasboundingbox% - \let\node=\tikz@orignode% - \let\coordinate=\tikz@origcoordinate% - \let\matrix=\tikz@origmatrix% - \let\calendar=\tikz@origcalendar% -} - - -{ - \catcode`\;=12 - \gdef\tikz@nonactivesemicolon{;} - \catcode`\:=12 - \gdef\tikz@nonactivecolon{:} - \catcode`\|=12 - \gdef\tikz@nonactivebar{|} - \catcode`\;=\active - \catcode`\:=\active - \catcode`\|=\active - \catcode`\"=\active - \gdef\tikz@activesemicolon{;}% - \gdef\tikz@activecolon{:}% - \gdef\tikz@activebar{|}% - \gdef\tikz@activequotes{"}% - \gdef\tikz@deactivatthings{% - \def;{\tikz@nonactivesemicolon} - \def:{\tikz@nonactivecolon} - \def|{\tikz@nonactivebar} - } -} - - - - - -% Constructs a path and draws/fills them according to the current -% settings. - -\def\tikz@command@path{% - \let\tikz@signal@path=\tikz@signal@path% for detection at begin of matrix cell - \pgfutil@ifnextchar[{\tikz@check@earg}%] - {\pgfutil@ifnextchar<{\tikz@doopt}{\tikz@@command@path}}} -\def\tikz@signal@path{\tikz@signal@path}% -\def\tikz@check@earg[#1]{% - \pgfutil@ifnextchar<{\tikz@swap@args[#1]}{\tikz@@command@path[#1]}} -\def\tikz@swap@args[#1]<#2>{\tikz@command@path<#2>[#1]} - -\def\tikz@doopt{% - \let\tikz@next=\tikz@eargnormalsemicolon% - \ifnum\the\catcode`\;=\active\relax% - \let\tikz@next=\tikz@eargactivesemicolon% - \fi% - \tikz@next} -\long\def\tikz@eargnormalsemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} -{ - \catcode`\;=\active - \long\global\def\tikz@eargactivesemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} -} - -\def\tikz@@command@path{% - \edef\tikzscope@linewidth{\the\pgflinewidth}% - \begingroup% - \let\tikz@options=\pgfutil@empty% - \let\tikz@mode=\pgfutil@empty% - \let\tikz@moveto@waiting=\relax% - \let\tikz@timer=\relax% - \let\tikz@collected@onpath=\pgfutil@empty% - \tikz@snakedfalse% - \tikz@node@is@a@labelfalse% - \tikz@expandcount=1000\relax% - \tikz@lastx=0pt% - \tikz@lasty=0pt% - \tikz@lastxsaved=0pt% - \tikz@lastysaved=0pt% - \tikz@every@style{every path}% - \tikz@scan@next@command% -} -\def\tikz@scan@next@command{% - \ifx\tikz@collected@onpath\pgfutil@empty% - \else% - \tikz@invoke@collected@onpath% - \fi% - \afterassignment\tikz@handle\let\@let@token=% -} -\newcount\tikz@expandcount - -% Central dispatcher for commands -\def\tikz@handle{% - \let\@next=\tikz@expand% - \ifx\@let@token(%) - \let\@next=\tikz@movetoabs% - \else% - \ifx\@let@token+% - \let\@next=\tikz@movetorel% - \else% - \ifx\@let@token-% - \let\@next=\tikz@lineto% - \else% - \ifx\@let@token.% - \let\@next=\tikz@dot% - \else% - \ifx\@let@token r% - \let\@next=\tikz@rect% - \else% - \ifx\@let@token a% - \let\@next=\tikz@arcA% - \else% - \ifx\@let@token[%] - \let\@next=\tikz@parse@options% - \else% - \ifx\@let@token n% - \let\@next=\tikz@fig% - \else% - \ifx\@let@token\bgroup% - \let\@next=\tikz@beginscope% - \else% - \ifx\@let@token\egroup% - \let\@next=\tikz@endscope% - \else% - \ifx\@let@token;% - \let\@next=\tikz@finish% - \else% - \ifx\@let@token c% - \let\@next=\tikz@cchar% - \else% - \ifx\@let@token e% - \let\@next=\tikz@e@char% - \else% - \ifx\@let@token g% - \let\@next=\tikz@grid% - \else% - \ifx\@let@token s% - \let\@next=\tikz@sine% - \else% - \ifx\@let@token |% - \let\@next=\tikz@vh@lineto% - \else% - \ifx\@let@token p% - \let\@next=\tikz@pchar% - \pgfsetmovetofirstplotpoint% - \else% - \ifx\@let@token t% - \let\@next=\tikz@to% - \else% - \ifx\@let@token\pgfextra% - \let\@next=\tikz@extra% - \else% - \ifx\@let@token\foreach% - \let\@next=\tikz@foreach% - \else% - \ifx\@let@token\pgf@stop% - \let\@next=\relax% - \else% - \ifx\@let@token\par% - \let\@next=\tikz@scan@next@command% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \@next% -} - -\def\tikz@pchar{\pgfutil@ifnextchar l{\tikz@plot}{\tikz@parabola}} -\def\tikz@cchar{% - \pgfutil@ifnextchar i{\tikz@circle}% - {\pgfutil@ifnextchar h{\tikz@children}{\tikz@cochar}}}% -\def\tikz@cochar o{% - \pgfutil@ifnextchar o{\tikz@coordinate}{\tikz@cosine}} -\def\tikz@e@char{% - \pgfutil@ifnextchar l{\tikz@ellipse}{\tikz@@e@char}}% -\def\tikz@@e@char dge{% - \pgfutil@ifnextchar f{\tikz@edgetoparent}{\tikz@edge@plain}}% - - -\def\tikz@finish{% - \tikz@mode@fillfalse% - \tikz@mode@drawfalse% - \tikz@mode@doublefalse% - \tikz@mode@clipfalse% - \tikz@mode@boundaryfalse% - \edef\tikz@pathextend{% - {\noexpand\pgfqpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}% - {\noexpand\pgfqpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}% - }% - \tikz@mode% installs the mode settings - % Rendering pipeline: - % - % Step 1: Setup options - % - \ifx\tikz@options\pgfutil@empty% - \else% - \pgfsys@beginscope% - \begingroup% - \tikz@options% - \fi% - % - % Step 2: Do a fill if shade follows. - % - \iftikz@mode@fill% - \iftikz@mode@shade% - \pgfprocessround{\pgfsyssoftpath@currentpath}{\pgfsyssoftpath@currentpath}% change the current path - \pgfsyssoftpath@invokecurrentpath% - \pgfsys@fill% - \tikz@mode@fillfalse% no more filling... - \fi% - \fi% - % - % Step 3: Do a shade if necessary. - % - \iftikz@mode@shade% - \pgfprocessround{\pgfsyssoftpath@currentpath}{\pgfsyssoftpath@currentpath}% change the current path - \pgfshadepath{\tikz@shading}{\tikz@shade@angle}% - \tikz@mode@shadefalse% no more shading... - \fi% - % - % Step 4: Double stroke, if necessary - % - \iftikz@mode@draw% - \iftikz@mode@double% - % Change line width - \begingroup% - \pgfsys@beginscope% - \pgf@x=2\pgflinewidth% - \advance\pgf@x by\tikz@double@width@distance% - \pgflinewidth=\pgf@x% - \pgfsetlinewidth{\the\pgflinewidth}% - \fi% - \fi% - % - % Step 5: Do stroke/fill/clip as needed - % - \edef\tikz@temp{\noexpand\pgfusepath{% - \iftikz@mode@fill fill,\fi% - \iftikz@mode@draw draw,\fi% - \iftikz@mode@clip clip,\fi% - }}% - \tikz@temp% - \tikz@mode@fillfalse% no more filling - % - % Step 6: Double stroke, if necessary - % - \iftikz@mode@draw% - \iftikz@mode@double% - \pgfsyssoftpath@setcurrentpath\pgf@last@used@path% reinstall - \pgf@x=\tikz@double@width@distance% - \pgfsetlinewidth{\the\pgf@x}% - \pgfsetstrokecolor{\tikz@double@color}% - \pgfsyssoftpath@flushcurrentpath% - \pgfsys@stroke% - \pgfsys@endscope% - \pgf@add@arrows@as@needed - \endgroup% - \fi% - \fi% - \tikz@mode@drawfalse% no more stroking - % - % Step 7: Add labels and nodes - % - \copy\tikz@figbox% - \setbox\tikz@figbox=\box\voidb@x% - % - % Step 8: Close option brace - % - \ifx\tikz@options\pgfutil@empty% - \else% - \endgroup% - \pgfsys@endscope% - \iftikz@mode@clip% - \PackageError{tikz}{Extra options not allowed for clipping path command.}{}% - \fi% - \fi% - \iftikz@mode@clip% - \aftergroup\pgf@relevantforpicturesizefalse% - \fi% - \iftikz@mode@boundary% - \aftergroup\pgf@relevantforpicturesizefalse% - \fi% - \endgroup% - \global\pgflinewidth=\tikzscope@linewidth% -} - - - - -\def\tikz@skip#1{\tikz@scan@next@command#1} -\def\tikz@expand{% - \advance\tikz@expandcount by -1% - \ifnum\tikz@expandcount<0\relax% - \PackageError{tikz}{Giving up on this path. Did you forget a semicolon?}{}% - \let\@next=\tikz@finish% - \else% - \let\@next=\tikz@@expand - \fi% - \@next} - -\def\tikz@@expand{% - \expandafter\tikz@scan@next@command\@let@token} - - - -% Syntax for scopes: -% {scoped path commands} - -\def\tikz@beginscope{\begingroup\tikz@scan@next@command} -\def\tikz@endscope{% - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@scan@next@command} - - -% Syntax for pgfextra: -% \pgfextra {normal tex text} -% \pgfextra normal tex text \endpgfextra - -\def\tikz@extra{\pgfutil@ifnextchar\bgroup\tikz@@extra\relax} -\long\def\tikz@@extra#1{#1\tikz@scan@next@command} -\let\endpgfextra=\tikz@scan@next@command - -\def\pgfextra{pgfextra} - - -% Syntax for \foreach: -% \foreach \var in {list} {path text} -% -% Example: -% -% \draw (0,0) \foreach \x in {1,2,3} {-- (\x,0) circle (1cm)} -- (5,5); - -\def\tikz@foreach{% - \def\pgffor@beginhook{\setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\@firstofone}% - \def\pgffor@endhook{\pgfextra{% - \xdef\tikz@foreach@save@lastx{\the\tikz@lastx}% - \xdef\tikz@foreach@save@lasty{\the\tikz@lasty}% - \xdef\tikz@foreach@save@lastxsaved{\the\tikz@lastxsaved}% - \xdef\tikz@foreach@save@lastysaved{\the\tikz@lastysaved}% - \global\setbox\tikz@tempbox=\copy\tikz@figbox\pgfutil@gobble}}% - \def\pgffor@afterhook{% - \tikz@lastx=\tikz@foreach@save@lastx% - \tikz@lasty=\tikz@foreach@save@lasty% - \tikz@lastxsaved=\tikz@foreach@save@lastxsaved% - \tikz@lastysaved=\tikz@foreach@save@lastysaved% - \setbox\tikz@figbox=\box\tikz@tempbox\tikz@scan@next@command}% - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \foreach} - - -% Syntax for againpath: -% \againpath \somepathname - -\def\tikz@command@againpath#1{% - \pgfextra{% - \pgfsyssoftpath@getcurrentpath\tikz@temp% - \expandafter\pgfutil@g@addto@macro\expandafter\tikz@temp\expandafter{#1}% - \pgfsyssoftpath@setcurrentpath\tikz@temp% - } -} - - - - -% -% When this if is set, a just-scanned point is a shape and its border -% position still needs to be determined, depending on subsequent -% commands. -% - -\newif\iftikz@shapeborder - - -% Syntax for moveto: -% -\def\tikz@movetoabs{\tikz@moveto(} -\def\tikz@movetorel{\tikz@moveto+} -\def\tikz@moveto{% - \tikz@scan@one@point{\tikz@@moveto}} -\def\tikz@@moveto#1{% - \tikz@make@last@position{#1}% - \iftikz@shapeborder% - % ok, the moveto will have to wait. flag that we have a moveto in - % wainting: - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \else% - \pgfpathmoveto{\tikz@last@position}% - \let\tikz@moveto@waiting=\relax% - \fi% - \tikz@scan@next@command% -} - -\let\tikz@moveto@waiting=\relax % normally, nothing is waiting... - -\def\tikz@flush@moveto{% - \ifx\tikz@moveto@waiting\relax% - \else% - \pgfpathmoveto{\tikz@last@position}% - \fi% - \let\tikz@moveto@waiting=\relax% -} - - -\def\tikz@flush@moveto@toward#1#2#3{% - % #1 = a point towards which the last moveto should be corrected - % #2 = a dimension to which the corrected x-coordinate should be stored - % #3 = a dimension for the corrected y-coordinate - \ifx\tikz@moveto@waiting\relax% - % do nothing - \else% - \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{#1}}% - #2=\pgf@x% - #3=\pgf@y% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% - \fi% - \let\tikz@moveto@waiting=\relax% -} - - -% -% Collecting labels on the path -% - -\def\tikz@collect@coordinate@onpath#1coordinate{% - \pgfutil@ifnextchar[{\tikz@@collect@coordinate@opt#1}{\tikz@@collect@coordinate@opt#1[]}}%} -\def\tikz@@collect@coordinate@opt#1[#2]{% - \pgfutil@ifnextchar({\tikz@@collect@coordinate#1[#2]}{% - \tikz@collect@label@onpath#1node[shape=coordinate,#2]{}}}%} -\def\tikz@@collect@coordinate#1[#2](#3){% - \tikz@collect@label@onpath#1node[shape=coordinate,#2](#3){}} - -\def\tikz@collect@label@onpath#1node{% - \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath node}% - \tikz@collect@label@scan#1} - -\def\tikz@collect@label@scan#1{% - \pgfutil@ifnextchar({\tikz@collect@paran#1}% - {\pgfutil@ifnextchar[{\tikz@collect@options#1}% - {\pgfutil@ifnextchar\bgroup{\tikz@collect@arg#1}% - {#1}}}% -}%}} - -\def\tikz@collect@paran#1(#2){% - \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath(#2)}% - \tikz@collect@label@scan#1% -} -\def\tikz@collect@options#1[#2]{% - \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath[#2]}% - \tikz@collect@label@scan#1% -} -\def\tikz@collect@arg#1#2{% - \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{#2}}% - #1% -} - - -\def\tikz@invoke@collected@onpath{% - \tikz@node@is@a@labeltrue% - \let\tikz@temp=\tikz@collected@onpath% - \let\tikz@collected@onpath=\pgfutil@empty% - \expandafter\tikz@scan@next@command\tikz@temp\pgf@stop% - \tikz@node@is@a@labelfalse% -} - - - - -% Syntax for lineto: -% -- - -\def\tikz@lineto{% - \pgfutil@ifnextchar |% - {\expandafter\tikz@hv@lineto\pgfutil@gobble}% - {\expandafter\pgfutil@ifnextchar\tikz@activebar{\expandafter\tikz@hv@lineto\pgfutil@gobble}% - {\expandafter\tikz@lineto@mid\pgfutil@gobble}}} -\def\tikz@lineto@mid{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@lineto@mid}% - {% - \pgfutil@ifnextchar c{\tikz@close}{% - \pgfutil@ifnextchar p{\pgfsetlinetofirstplotpoint\expandafter\tikz@plot\pgfutil@gobble}% - {\tikz@scan@one@point{\tikz@@lineto}}}}} -\def\tikz@@lineto#1{% - % Record the starting point for later labels on the path: - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} - \iftikz@shapeborder% - % ok, target is a shape. recalculate end - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@last@position}}% - \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% - \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% - \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \tikz@make@last@position{#1}% - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \else% - % target is a reasonable point... - % Record the starting point for later labels on the path: - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% - \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \let\tikz@timer=\tikz@timer@line% - \tikz@scan@next@command% -} - -% snake or lineto? -\def\tikz@path@lineto#1{% - \iftikz@snaked% - { - \pgfsyssoftpathmovetorelevantfalse% - \pgfpathsnakesto{\tikz@presnake,{\tikz@snake}{\tikz@mainsnakelength},\tikz@postsnake}{#1}% - } - \else% - \pgfpathlineto{#1}% - \fi% -} - -% snake or lineto? -\def\tikz@path@close#1{% - \iftikz@snaked% - {% - \pgftransformreset% - \pgfpathsnakesto{\tikz@presnake,{\tikz@snake}{\tikz@mainsnakelength},\tikz@postsnake}{#1}% - }% - \pgfpathclose% - \else% - \pgfpathclose% - \fi% -} - - -% Syntax for lineto horizontal/vertical: -% -| - -\def\tikz@hv@lineto{% - \pgfutil@ifnextchar n - {\tikz@collect@label@onpath\tikz@hv@lineto} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@hv@lineto}% - {\tikz@scan@one@point{\tikz@@hv@lineto}}}} -\def\tikz@@hv@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@yc=\tikz@lasty% - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@x\pgf@yc% - \iftikz@shapeborder% - % ok, target is a shape. have to work now: - {% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yc}}}% - \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@yc}}% - \tikz@path@lineto{\tikz@last@position}% - \xdef\tikz@timer@end@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group - }% - \let\tikz@timer@end=\tikz@timer@end@temp% - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \else% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@yc}}% - \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group - \fi% - \let\tikz@timer=\tikz@timer@hvline% - \tikz@scan@next@command% -} - -% Syntax for lineto vertical/horizontal: -% |- - -\def\tikz@vh@lineto-{\tikz@vh@lineto@next} -\def\tikz@vh@lineto@next{% - \pgfutil@ifnextchar n - {\tikz@collect@label@onpath\tikz@vh@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@vh@lineto@next}% - {\tikz@scan@one@point\tikz@@vh@lineto}}} -\def\tikz@@vh@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc=\tikz@lastx% - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@y% - \iftikz@shapeborder% - % ok, target is a shape. have to work now: - {% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xc}{\tikz@lasty}}}% - \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% - \tikz@path@lineto{\pgfqpoint{\pgf@xc}{\tikz@lasty}}% - \tikz@path@lineto{\tikz@last@position}% - \xdef\tikz@timer@end@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group - }% - \let\tikz@timer@end=\tikz@timer@end@temp% - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \else% - \tikz@path@lineto{\pgfqpoint{\pgf@xc}{\tikz@lasty}}% - \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \let\tikz@timer=\tikz@timer@vhline% - \tikz@scan@next@command% -} - -% Syntax for cycle: -% -- cycle -\def\tikz@close c{% - \pgfutil@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@lineto@mid c}% oops, a coordinate - {\tikz@@close c}}% -\def\tikz@@close cycle{% - \tikz@flush@moveto% - \tikz@path@close{\expandafter\pgfpoint\pgfsyssoftpath@lastmoveto}% - \def\pgfstrokehook{}% - \let\tikz@timer=\@undefined% - \tikz@scan@next@command% -} - - -% Syntax for options: -% [options] -\def\tikz@parse@options#1]{% - \tikz@setkeys{#1}% - \tikz@scan@next@command% -} - -% Syntax for edges: -% edge [options] (coordinate) -% edge [options] node {node text} (coordinate) -\def\tikz@edge@plain{% - \begingroup% - \tikz@to@use@whom% - \let\tikz@to@or@edge@function=\tikz@do@edge% - \tikz@to@or@edge} - -% Syntax for to paths: -% to [options] (coordinate) -% to [options] node {node text} (coordinate) -\def\tikz@to o{% - \tikz@to@use@last@coordinate% - \let\tikz@to@or@edge@function=\tikz@do@to% - \tikz@to@or@edge} - -\def\tikz@to@or@edge{\pgfutil@ifnextchar[\tikz@@to@or@edge{\tikz@@to@or@edge[]}}%} -\def\tikz@@to@or@edge[#1]{% - \def\tikz@@to@local@options{[#1]}% - \let\tikz@collected@onpath=\pgfutil@empty% - \tikz@@to@collect% -} -\def\tikz@@to@collect{% - \pgfutil@ifnextchar(\tikz@@to@or@edge@coordinate - {\pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@@to@collect}% - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect} - {\PackageError{tikz}{( expected}{}%} - \tikz@@to@or@edge@coordinate()}}}% -} - -\def\tikz@@to@or@edge@coordinate(#1){% - \def\tikztotarget{#1}% - \tikz@to@or@edge@function% -} - -\def\tikz@do@edge{% - \setbox\tikz@figbox=\hbox\bgroup% - \unhbox\tikz@figbox% - \hbox\bgroup - \bgroup% - \pgfinterruptpath% - \pgfscope% - \let\tikz@transform=\pgfutil@empty% - \let\tikz@options=\pgfutil@empty% - \let\tikz@tonodes=\tikz@collected@onpath% - \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% - \let\tikz@collected@onpath=\pgfutil@empty% - \tikz@options% - \tikz@transform% - % Typeset node: - \tikz@atbegin@to% - \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path;% - \tikz@atend@to% - \endpgfscope% - \endpgfinterruptpath% - \egroup - \egroup% - \egroup% - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@scan@next@command% -} - -\def\tikz@do@to{% - \let\tikz@tonodes=\tikz@collected@onpath% - \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% - \let\tikz@collected@onpath=\pgfutil@empty% - \tikz@scan@next@command% - \pgfextra{\tikz@atbegin@to}% - [style=every to]\tikz@@to@local@options\tikz@to@path% - \pgfextra{\tikz@atend@to}% -} - - -\def\tikz@to@use@last@coordinate{% - \iftikz@shapeborder% - \edef\tikztostart{\tikz@shapeborder@name}% - \else% - \edef\tikztostart{\the\tikz@lastx,\the\tikz@lasty}% - \fi% -} -\def\tikz@to@use@last@fig@name{% - \edef\tikztostart{\tikz@to@last@fig@name}% -} - - - -% Syntax for edge from parent: -% edge from parent [options] -\def\tikz@edgetoparent from parent{\pgfutil@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%} -\def\tikz@@edgetoparent[#1]{% - \let\tikz@edge@to@parent@needed=\pgfutil@empty% - \tikz@node@is@a@labeltrue% - \tikz@scan@next@command [style=edge from parent,#1] \tikz@edge@to@parent@path% -} - - -% Syntax for bezier curves -% .. controls(point) and (point) .. (target) -% .. controls(point) .. (target) -% .. (target) % currently not supported - -\def\tikz@dot.{\tikz@@dot}% -\def\tikz@@dot{% - \pgfutil@ifnextchar n% - {\tikz@collect@label@onpath\tikz@@dot}% - {\pgfutil@ifnextchar c{\tikz@curveto@double}{\tikz@curveto@auto}}} - -\def\tikz@curveto@double co{% - \pgfutil@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@@dot co} - {\tikz@cureveto@@double}} -\def\tikz@cureveto@@double ntrols#1{% - \tikz@scan@one@point\tikz@curveA#1% -} -\def\tikz@curveA#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - {% - \tikz@make@last@position{#1}% - \xdef\tikz@curve@first{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - }% - \pgfutil@ifnextchar a - {\tikz@curveBand}% - {\let\tikz@curve@second\tikz@curve@first\tikz@curveCdots}% -} -\def\tikz@curveBand and{% - \tikz@scan@one@point\tikz@curveB% -} -\def\tikz@curveB#1{% - \def\tikz@curve@second{#1}% - \tikz@curveCdots} -\def\tikz@curveCdots{% - \afterassignment\tikz@curveCdot\let\@next=} -\def\tikz@curveCdot.{% - \ifx\@next.% - \else% - \PackageError{tikz}{Dot expected}{}% - \fi% - \tikz@updatecurrenttrue% - \tikz@curveCcheck% -} -\def\tikz@curveCcheck{% - \pgfutil@ifnextchar n% - {\tikz@collect@label@onpath\tikz@curveCcheck} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@curveCcheck} - {\tikz@scan@one@point\tikz@curveC}}% -} -\def\tikz@curveC#1{% - \tikz@make@last@position{#1}% - \edef\tikz@curve@third{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - {% - \tikz@lastxsaved=\tikz@lastx% - \tikz@lastysaved=\tikz@lasty% - \tikz@make@last@position{\tikz@curve@second}% - \xdef\tikz@curve@second{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - }% - % - % Start recalculating things in case start and end are shapes. - % - % First, the start: - \ifx\tikz@moveto@waiting\relax% - \else% - \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{\tikz@curve@first}}% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% - \fi% - \let\tikz@timer@cont@one=\tikz@curve@first% - \let\tikz@timer@cont@two=\tikz@curve@second% - % Second, the end: - \iftikz@shapeborder% - % ok, target is a shape. recalculate third - {% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@curve@second}}% - \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% - \edef\tikz@curve@third{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgfpathcurveto{\tikz@curve@first}{\tikz@curve@second}{\tikz@curve@third}% - \global\let\tikz@timer@end@temp=\tikz@curve@third% move out of group - }% - \let\tikz@timer@end=\tikz@timer@end@temp% - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \else% - \pgfpathcurveto{\tikz@curve@first}{\tikz@curve@second}{\tikz@curve@third}% - \let\tikz@timer@end=\tikz@curve@third - \let\tikz@moveto@waiting=\relax% - \fi% - \let\tikz@timer=\tikz@timer@curve% - \tikz@scan@next@command% -} - - -% Syntax for rectangles: -% rectangle -\def\tikz@rect ectangle{% - \tikz@flush@moveto% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \tikz@@rect}% -\def\tikz@@rect{% - \pgfutil@ifnextchar n - {\tikz@collect@label@onpath\tikz@@rect} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@rect}% - { - \pgf@xa=\tikz@lastx\relax% - \pgf@ya=\tikz@lasty\relax% - \tikz@scan@one@point\tikz@rectB}}} -\def\tikz@rectB#1{% - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \let\tikz@timer=\tikz@timer@line% - \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% - \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% - \iftikz@snaked% - \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% - \fi% - \pgfpathclose% - \pgfpathmoveto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - \def\pgfstrokehook{}% - \tikz@scan@next@command% -} - - - -% Syntax for grids: -% grid -\def\tikz@grid rid{% - \tikz@flush@moveto% - \pgf@xa=\tikz@lastx\relax% - \pgf@ya=\tikz@lasty\relax% - \pgfutil@ifnextchar[{\tikz@gridA}{\tikz@gridA[]}}%} -\def\tikz@gridA[#1]{% - \def\tikz@grid@options{#1}% - \tikz@scan@one@point\tikz@gridB}% -\def\tikz@gridB#1{% - \tikz@make@last@position{#1}% - {% - \expandafter\tikz@setkeys\expandafter{\tikz@grid@options} - \tikz@checkunit{\tikz@grid@x}% - \iftikz@isdimension% - \pgf@process{\pgfpoint{\tikz@grid@x}{0pt}}% - \else% - \pgf@process{\pgfpointxy{\tikz@grid@x}{0}}% - \fi% - \pgf@xb=\pgf@x% - \pgf@yb=\pgf@y% - \tikz@checkunit{\tikz@grid@y}% - \iftikz@isdimension% - \pgf@process{\pgfpoint{0pt}{\tikz@grid@y}}% - \else% - \pgf@process{\pgfpointxy{0}{\tikz@grid@y}}% - \fi% - \advance\pgf@xb by\pgf@x% - \advance\pgf@yb by\pgf@y% - \pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb]% - {\pgfqpoint{\pgf@xa}{\pgf@ya}}{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - } - \tikz@scan@next@command% -} - - - -% Syntax for plot: -% plot [local options] ... % starts with a moveto -% -- plot [local options] ... % starts with a lineto -\def\tikz@plot lot{% - \tikz@flush@moveto% - \pgfutil@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%} -\def\tikz@@plot[#1]{% - \begingroup% - \let\tikz@options=\pgfutil@empty% - \tikz@every@style{every plot}% - \tikz@setkeys{#1}% - \pgfutil@ifnextchar f{\tikz@plot@f}% - {\pgfutil@ifnextchar c{\tikz@plot@scan@points}% - {\pgfutil@ifnextchar ({\tikz@plot@expression}{% - \PackageError{tikz}{Cannot parse this plotting data}{}% - \endgroup}}}} -\def\tikz@plot@f f{\pgfutil@ifnextchar i{\tikz@plot@file}{\tikz@plot@function}} - -\def\tikz@plot@file ile#1{\def\tikz@plot@data{\pgfplotxyfile{#1}}\tikz@@@plot}% -\def\tikz@plot@scan@points coordinates#1{% - \pgfplothandlerrecord\tikz@plot@data% - \pgfplotstreamstart% - \pgfutil@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\pgfutil@gobble} - {\tikz@scan@one@point\tikz@plot@next@point}% - #1\pgf@stop% -} -\def\tikz@plot@next@point#1{% - \pgfplotstreampoint{#1}% - \pgfutil@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\pgfutil@gobble}% - {\tikz@scan@one@point\tikz@plot@next@point}% -} -\def\tikz@plot@function unction#1{% - \def\tikz@plot@filename{\tikz@plot@prefix\tikz@plot@id}% - \iftikz@plot@raw@gnuplot% - \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{#1}}% - \else% - \iftikz@plot@parametric% - \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% - set samples \tikz@plot@samples; - set parametric; - plot [t=\tikz@plot@domain] #1}}% - \else% - \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% - set samples \tikz@plot@samples; - plot [x=\tikz@plot@domain] #1}}% - \fi% - \fi% - \tikz@@@plot% -} - -\def\tikz@plot@no@resample{% - \pgfutil@IfFileExists{\tikz@plot@filename.table}% - {\def\tikz@plot@data{\pgfplotxyfile{\tikz@plot@filename.table}}}% - {}% -} - -\def\tikz@plot@expression(#1){% - \edef\tikz@plot@data{\noexpand\pgfplotfunction{\expandafter\noexpand\tikz@plot@var}{\tikz@plot@samplesat}}% - \expandafter\def\expandafter\tikz@plot@data\expandafter{\tikz@plot@data{\tikz@scan@one@point\pgfutil@firstofone(#1)}}% - \tikz@@@plot% -} - -\def\tikz@@@plot{% - \def\pgfplotlastpoint{\pgfpointorigin}% - \tikz@plot@handler% - \tikz@plot@data% - \global\let\tikz@@@temp=\pgfplotlastpoint% - \ifx\tikz@plot@mark\pgfutil@empty% - \else% - % Marks are drawn after the path. - \setbox\tikz@figbox=\hbox{% - \unhbox\tikz@figbox% - \hbox{{% - \pgfinterruptpath% - \pgfscope% - \let\tikz@options=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \expandafter\tikz@setkeys\expandafter{\tikz@plot@mark@options}% - \tikz@options% - \ifx\tikz@mark@list\pgfutil@empty% - \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% - \else - \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% - \fi - \tikz@plot@data% - \endpgfscope - \endpgfinterruptpath% - }}% - }% - \fi% - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@make@last@position{\tikz@@@temp}% - \tikz@scan@next@command% -} - - -\pgfdeclareplotmark{ball} -{% - \def\tikz@shading{ball}% - \shade (0,0) circle (\pgfplotmarksize);% -} - - - - -% Syntax for cosine curves: -% cos -\def\tikz@cosine s{\tikz@scan@one@point\tikz@@cosine} -\def\tikz@@cosine#1{% - \tikz@flush@moveto% - \pgf@process{#1}% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - \advance\pgf@xc by-\tikz@lastx% - \advance\pgf@yc by-\tikz@lasty% - \advance\tikz@lastx by\pgf@xc% - \advance\tikz@lasty by\pgf@yc% - \tikz@lastxsaved=\tikz@lastx% - \tikz@lastysaved=\tikz@lasty% - \tikz@updatecurrenttrue% - \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command% -} - -% Syntax for sine curves: -% sin -\def\tikz@sine in{\tikz@scan@one@point\tikz@@sine} -\def\tikz@@sine#1{% - \tikz@flush@moveto% - \pgf@process{#1}% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - \advance\pgf@xc by-\tikz@lastx% - \advance\pgf@yc by-\tikz@lasty% - \advance\tikz@lastx by\pgf@xc% - \advance\tikz@lasty by\pgf@yc% - \tikz@lastxsaved=\tikz@lastx% - \tikz@lastysaved=\tikz@lasty% - \tikz@updatecurrenttrue% - \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command% -} - -% Syntax for parabolas: -% parabola[options] bend -\def\tikz@parabola arabola{% - \pgfutil@ifnextchar[{\tikz@parabola@options}{\tikz@parabola@options[]}}%} - -\def\tikz@parabola@options[#1]{% - \def\tikz@parabola@option{#1}% - \pgfutil@ifnextchar b{\tikz@parabola@scan@bend}{\tikz@scan@one@point\tikz@parabola@semifinal}} -\def\tikz@parabola@scan@bend bend{\tikz@scan@one@point\tikz@parabola@scan@bendB} -\def\tikz@parabola@scan@bendB#1{% - \def\tikz@parabola@bend{#1}% - \tikz@scan@one@point\tikz@parabola@semifinal% -} -\def\tikz@parabola@semifinal#1{% - \tikz@flush@moveto% - % Save original start: - \pgf@xb=\tikz@lastx% - \pgf@yb=\tikz@lasty% - \tikz@make@last@position{#1}% - \pgf@xc=\tikz@lastx% - \pgf@yc=\tikz@lasty% - \begingroup% now calculate bend: - \expandafter\tikz@setkeys\expandafter{\tikz@parabola@option}% - \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx% - \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty% - \advance\tikz@lastxsaved by\pgf@xb% - \advance\tikz@lastysaved by\pgf@yb% - \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb% - \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb% - \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% - % Calculate delta from bend - \advance\pgf@xc by-\tikz@lastx% - \advance\pgf@yc by-\tikz@lasty% - % Ok, now calculate delta to bend - \advance\tikz@lastx by-\pgf@xb% - \advance\tikz@lasty by-\pgf@yb% - \xdef\tikz@parabola@b{{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}% - \endgroup% - \expandafter\pgfpathparabola\tikz@parabola@b% - \tikz@scan@next@command% -} - - -% Syntax for circles: -% circle (radius) -% -% Syntax for ellipses: -% ellipse (x-radius and y-radius) -% -% radii can be dimensionless, then they are in the xy-system -\def\tikz@circle ircle{\tikz@flush@moveto\tikz@@circle} -\def\tikz@ellipse llipse{\tikz@flush@moveto\tikz@@circle} -\def\tikz@@circle{% - \pgfutil@ifnextchar(\tikz@@@circle{%) - \advance\tikz@expandcount by -1% - \ifnum\tikz@expandcount<0\relax% - \let\@next=\tikz@@circle@scangiveup% - \else% - \let\@next=\tikz@@circle@scanexpand% - \fi% - \@next% - }% -} -\def\tikz@@circle@scanexpand{\expandafter\tikz@@circle} -\def\tikz@@circle@scangiveup#1{\PackageError{tikz}{Cannot parse this radius}{}#1{\tikz@scan@next@command}} -\def\tikz@@@circle(#1){% - \pgfutil@in@{ and }{#1}% - \ifpgfutil@in@% - \tikz@@ellipseB(#1)% - \else% - \tikz@@ellipseB(#1 and #1)% - \fi% - \tikz@scan@next@command% -} -\def\tikz@@ellipseB(#1 and #2){% - \tikz@checkunit{#1}% - \iftikz@isdimension% - \pgfpathellipse{\tikz@last@position}{\pgfpoint{#1}{0pt}}{\pgfpoint{0pt}{#2}}% - \else% - \pgfpathellipse{\tikz@last@position}{\pgfpointxy{#1}{0}}{\pgfpointxy{0}{#2}}% - \fi% -} - -% Syntax 1 for arcs: -% arc (start angle:end angle:radius) -% -% Syntax 2 for arcs: -% arc (start angle:end angle:x-radius and y-radius) -% -% radius can be dimensionless, then the arc is in the xy-coordinate system -\def\tikz@arcA rc{% - \tikz@flush@moveto% - \pgfutil@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}} - -\def\tikz@@arcto(#1){% - \edef\tikz@temp{(#1)}% - \expandafter\tikz@@@arcto@check@slashand\tikz@temp% -} - -\def\tikz@@@arcto@check@slashand(#1:#2:#3){% - \pgfutil@in@{ and }{#3}% - \ifpgfutil@in@% - \tikz@parse@arc@and(#1:#2:#3)% - \else% - \tikz@parse@arc@and(#1:#2:#3 and #3)% - \fi% -} - -\def\tikz@parse@arc@and(#1:#2:#3 and #4){% - \tikz@checkunit{#3}% - \iftikz@isdimension% - \tikz@@@arcfinal{\pgfpatharc{#1}{#2}{#3 and #4}} - {\pgfpointpolar{#1}{#3 and #4}} - {\pgfpointpolar{#2}{#3 and #4}}% - \else% - \tikz@@@arcfinal{\pgfpatharcaxes{#1}{#2}{\pgfpointxy{#3}{0}}{\pgfpointxy{0}{#4}}} - {\pgfpointpolarxy{#1}{#3 and #4}}{\pgfpointpolarxy{#2}{#3 and #4}}% - \fi% -} - -\def\tikz@@@arcfinal#1#2#3{% - #1% - \pgf@process{#2}% - \advance\tikz@lastx by-\pgf@x% - \advance\tikz@lasty by-\pgf@y% - \pgf@process{#3}% - \advance\tikz@lastx by\pgf@x% - \advance\tikz@lasty by\pgf@y% - \tikz@lastxsaved=\tikz@lastx% - \tikz@lastysaved=\tikz@lasty% - \tikz@scan@next@command% -} - - -% Syntax for coordinates: -% coordinate[options] (coordinate name) at (point) -% where ``at (point)'' is optional -\def\tikz@coordinate ordinate{% - \pgfutil@ifnextchar[{\tikz@@coordinate@opt}{\tikz@@coordinate@opt[]}} -\def\tikz@@coordinate@opt[#1]{% - \pgfutil@ifnextchar({\tikz@@coordinate[#1]} - {\tikz@fig ode[shape=coordinate,#1]{}}}%} -\def\tikz@@coordinate[#1](#2){% - \pgfutil@ifnextchar a{\tikz@@coordinate@at[#1](#2)} - {\tikz@fig ode[shape=coordinate,#1](#2){}}} -\def\tikz@@coordinate@at[#1](#2)at#3(#4){% - \tikz@fig ode[shape=coordinate,#1](#2)at(#4){}} - - - -% Syntax for nodes: -% node[options] (node name) {label text} -% -% all of [options], (node name) and {label text} are optional. There -% can be multiple options before the label text as in -% node[draw] (a) [rotate=10] {text} -% -% A label text always ``ends'' the node. -\def\tikz@fig ode{% - \edef\tikz@save@line@width{\the\pgflinewidth}% - \begingroup% - \let\tikz@fig@name=\pgfutil@empty% - \begingroup% - \tikz@is@matrixfalse% - \let\nodepart=\tikz@nodepart% - \let\tikz@options=\pgfutil@empty% - \let\tikz@after@node=\pgfutil@empty% - \let\tikz@afternodepathoptions=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \let\tikz@mode=\pgfutil@empty% - \def\tikz@node@at{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \iftikz@node@is@a@label% - \else% - \let\tikz@time=\pgfutil@empty% - \fi% - \tikz@every@style{every node}% - \tikz@@scan@fig}% -\def\tikz@@scan@fig{% - \pgfutil@ifnextchar a{\tikz@fig@scan@at} - {\pgfutil@ifnextchar({\tikz@fig@scan@name} - {\pgfutil@ifnextchar[{\tikz@fig@scan@options}% - {\pgfutil@ifnextchar\bgroup{\tikz@fig@main}% - {\PackageError{tikz}{A node must have a (possibly empty) label text}{}% - \tikz@fig@main{}}}}}}%}} -\def\tikz@fig@scan@at at{% - \tikz@scan@one@point\tikz@@fig@scan@at} -\def\tikz@@fig@scan@at#1{% - \def\tikz@node@at{#1}\tikz@@scan@fig}% -\def\tikz@fig@scan@name(#1){\edef\tikz@fig@name{#1}\tikz@@scan@fig}% -\def\tikz@fig@scan@options[#1]{\tikz@setkeys{#1}\def\test{#1}\tikz@@scan@fig}% -\def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=} -\def\tikz@@fig@main{% - \pgfutil@ifundefined{pgf@sh@s@\tikz@shape}% - {\PackageError{tikz}% - {Unknown shape ``\tikz@shape.'' Using ``rectangle'' instead}{}% - \def\tikz@shape{rectangle}}% - {}% - \tikz@every@style{every \tikz@shape\space node}% - \iftikz@is@matrix% - \let\tikz@next=\tikz@do@matrix% - \else% - \let\tikz@next=\tikz@do@fig% - \fi% - \tikz@next% -} -\def\tikz@do@fig{% - \setbox\pgfnodeparttextbox=\hbox% - \bgroup% - \tikz@every@style{every text node part}% - \ifx\tikz@textopacity\pgfutil@empty% - \else% - \pgfsetfillopacity{\tikz@textopacity}% - \pgfsetstrokeopacity{\tikz@textopacity}% - \fi% - \pgfinterruptpicture% - \tikz@textfont% - \ifx\tikz@text@width\pgfutil@empty% - \else% - \begingroup% - \pgfutil@minipage[t]{\tikz@text@width}% - \tikz@text@action% - \fi% - \tikz@atbegin@node% - \bgroup% - \aftergroup\unskip% - \ifx\tikz@textcolor\pgfutil@empty% - \else% - \pgfutil@colorlet{.}{\tikz@textcolor}% - \fi% - \pgfsetcolor{.}% - \setbox\tikz@figbox=\box\voidb@x% - \tikz@uninstallcommands% - \aftergroup\tikz@fig@collectresetcolor% - \ignorespaces% -} -\def\tikz@fig@collectresetcolor{% - \pgfutil@ifnextchar\reset@color% - {\reset@color\afterassignment\tikz@fig@collectresetcolor\let\tikz@temp=}% - {\tikz@fig@boxdone}% -} -\def\tikz@fig@boxdone{% - \tikz@atend@node% - \ifx\tikz@text@width\pgfutil@empty% - \else% - \pgfutil@endminipage% - \endgroup% - \fi% - \endpgfinterruptpicture% - \egroup% - \pgfutil@ifnextchar c{\tikz@fig@mustbenamed\tikz@fig@continue}% - {\pgfutil@ifnextchar[{\tikz@fig@mustbenamed\tikz@fig@continue}% - {\pgfutil@ifnextchar t{\tikz@fig@mustbenamed\tikz@fig@continue} - {\pgfutil@ifnextchar e{\tikz@fig@mustbenamed\tikz@fig@continue} - {\ifx\tikz@after@node\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%} - -\def\tikz@do@matrix{% - \tikz@every@style{every matrix}% - \tikz@node@transformations% - \tikz@fig@mustbenamed% - \setbox\tikz@figbox=\hbox\bgroup% - \setbox\pgfutil@tempboxa=\copy\tikz@figbox% - \unhbox\pgfutil@tempboxa% - \hbox\bgroup\bgroup% - \pgfinterruptpath% - \pgfscope% - \tikz@options% - \setbox\tikz@figbox=\box\voidb@x% - \let\tikzmatrixname=\tikz@fig@name% - \edef\tikz@m@anchor{\ifx\tikz@matrix@anchor\pgfutil@empty\tikz@anchor\else\tikz@matrix@anchor\fi}% - \expandafter\pgfutil@in@\expandafter{\expandafter.\expandafter}\expandafter{\tikz@m@anchor}% - \ifpgfutil@in@% - \expandafter\tikz@matrix@split\tikz@m@anchor\relax% - \else% - \def\tikz@matrix@shift{\pgfpointorigin}% - \fi% - \let\tikz@transform=\relax% - \pgfmatrix% - {\tikz@shape}% - {\tikz@m@anchor}% - {\tikz@fig@name}% - {% - \pgfutil@tempdima=\pgflinewidth% - {\begingroup\tikz@finish}% - \global\pgflinewidth=\pgfutil@tempdima% - }% - {\tikz@matrix@shift}% - {% - \tikz@matrix@make@active@ampersand% - \def\pgfmatrixbegincode{% - \pgfsys@beginscope% - \tikz@common@matrix@code% - \tikz@atbegin@cell% - }% - \def\tikz@common@matrix@code{% - \let\tikz@options=\pgfutil@empty% - \let\tikz@mode=\pgfutil@empty% - \tikz@every@style{every cell}% - \tikz@every@style{column \the\pgfmatrixcurrentcolumn}% - \ifodd\pgfmatrixcurrentcolumn% - \tikz@every@style{every odd column}% - \else% - \tikz@every@style{every even column}% - \fi% - \tikz@every@style{row \the\pgfmatrixcurrentrow}% - \ifodd\pgfmatrixcurrentrow% - \tikz@every@style{every odd row}% - \else% - \tikz@every@style{every even row}% - \fi% - \tikz@every@style{row \the\pgfmatrixcurrentrow\space column \the\pgfmatrixcurrentcolumn}% - \tikz@options% - }% - \def\pgfmatrixendcode{% - \tikz@atend@cell% - \pgfsys@endscope% - }% - \def\pgfmatrixemptycode{% - \pgfsys@beginscope% - \tikz@common@matrix@code% - \tikz@at@emptycell% - \pgfsys@endscope% - }% - \aftergroup\tikz@do@matrix@cont}% - \bgroup% -} -\def\tikz@do@matrix@cont{% - \endpgfscope - \endpgfinterruptpath% - \egroup\egroup% - \egroup% - % - \tikz@node@finish% -} - -{% - \catcode`\&=13 - \gdef\tikz@matrix@make@active@ampersand{% - \ifx\tikz@ampersand@replacement\pgfutil@empty% - \catcode`\&=13% - \let&=\pgfmatrixnextcell% - \else% - \expandafter\let\tikz@ampersand@replacement=\pgfmatrixnextcell% - \fi% - }% -}% - - -\def\tikz@matrix@split#1.#2\relax{% - \def\tikz@m@anchor{text}% - \def\tikz@matrix@shift{\pgfpointanchor{#1}{#2}}% -} - -\def\tikz@fig@continue{% - \ifx\tikz@text@width\pgfutil@empty% - \else% - \pgfmathsetlength{\pgf@x}{\tikz@text@width}% - \wd\pgfnodeparttextbox=\pgf@x% - \fi% - \ifx\tikz@text@height\pgfutil@empty% - \else% - \pgfmathsetlength{\pgf@x}{\tikz@text@height}% - \ht\pgfnodeparttextbox=\pgf@x% - \fi% - \ifx\tikz@text@depth\pgfutil@empty% - \else% - \pgfmathsetlength{\pgf@x}{\tikz@text@depth}% - \dp\pgfnodeparttextbox=\pgf@x% - \fi% - % - % Node transformation - % - \tikz@node@transformations - % - \setbox\tikz@figbox=\hbox{% - \setbox\pgfutil@tempboxa=\copy\tikz@figbox% - \unhbox\pgfutil@tempboxa% - \hbox{{% - \pgfinterruptpath% - \pgfscope% - \tikz@options% - \setbox\tikz@figbox=\box\voidb@x% - \pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{% - \pgfutil@tempdima=\pgflinewidth% - {\begingroup\tikz@finish}% - \global\pgflinewidth=\pgfutil@tempdima% - }% - \endpgfscope - \endpgfinterruptpath% - }}% - }% - % - \tikz@node@finish% -} - - -\def\tikz@fig@mustbenamed{% - \ifx\tikz@fig@name\pgfutil@empty% - % Assign a dummy name - \global\advance\tikz@fig@count by1\relax - \edef\tikz@fig@name{tikz@f@\the\tikz@fig@count}% - \fi% -} - -\def\tikz@node@transformations{ - % - % Possibly, we are ``online'' - % - \ifx\tikz@time\pgfutil@empty% - \pgftransformshift{\tikz@node@at}% - \iftikz@fullytransformed% - \else% - \pgftransformresetnontranslations% - \fi% - \else% - \tikz@do@auto@anchor% - \tikz@timer% - \fi% - % Invoke local transformations - \tikz@transform% -} - -\def\tikz@node@finish{% - \global\let\tikz@last@fig@name=\tikz@fig@name% - \global\let\tikz@after@node@smuggle=\tikz@after@node% - \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions% - % shift box outside group - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \endgroup\endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% - \pgflinewidth=\tikz@save@line@width% - \let\tikz@to@last@fig@name=\tikz@last@fig@name% - \let\tikz@to@use@whom=\tikz@to@use@last@fig@name% - \let\tikzlastnode=\tikz@last@fig@name% - \ifx\tikz@after@node@smuggle\pgfutil@empty% - \else% - \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop% - \fi% - \tikz@scan@next@command% -} -\let\tikz@fig@continue@orig=\tikz@fig@continue - - - -% Syntax for parts of nodes: -% node ... {... \nodepart{name} ... \nodepart{name} ...} - -\def\tikz@nodepart#1{% - \tikz@atend@node% - \unskip% - \gdef\tikz@nodepart@name{#1}% - \global\let\tikz@fig@continue=\tikz@nodepart@continue% - \pgfutil@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces -} -\def\tikz@nodepart@continue{% - \global\let\tikz@fig@continue=\tikz@fig@continue@orig% - % Now start new box: - \expandafter\setbox\csname pgfnodepart\tikz@nodepart@name box\endcsname=\hbox% - \bgroup% - \tikz@every@style{every \tikz@nodepart@name\space node part}% - \pgfinterruptpicture% - \tikz@textfont% - \ifx\tikz@text@width\pgfutil@empty% - \else% - \begingroup% - \pgfutil@minipage[t]{\tikz@text@width}% - \tikz@text@action% - \fi% - \bgroup% - \aftergroup\unskip% - \ifx\tikz@textcolor\pgfutil@empty% - \else% - \pgfutil@colorlet{.}{\tikz@textcolor}% - \fi% - \pgfsetcolor{.}% - \setbox\tikz@figbox=\box\voidb@x% - \tikz@uninstallcommands% - \tikz@atbegin@node% - \aftergroup\tikz@fig@collectresetcolor% - \ignorespaces% -} - - -% Auto placement - -\def\tikz@auto@pre{% - \begingroup - \pgfresetnontranslationattimefalse - \pgfslopedattimetrue% - \pgfallowupsidedownattimetrue% - \tikz@timer% - \pgf@x=\pgf@pt@aa pt% - \pgf@y=\pgf@pt@ab pt% - \pgfpointnormalised{}% -} - -\def\tikz@auto@post{% - \global\let\tikz@anchor@smuggle=\tikz@anchor% - \endgroup% - \let\tikz@anchor=\tikz@anchor@smuggle% -} - -\def\tikz@auto@anchor{% - \ifdim\pgf@x>0.05pt% - \ifdim\pgf@y>0.05pt% - \def\tikz@anchor{south east}% - \else\ifdim\pgf@y<-0.05pt% - \def\tikz@anchor{south west}% - \else - \def\tikz@anchor{south}% - \fi\fi% - \else\ifdim\pgf@x<-0.05pt% - \ifdim\pgf@y>0.05pt% - \def\tikz@anchor{north east}% - \else\ifdim\pgf@y<-0.05pt% - \def\tikz@anchor{north west}% - \else - \def\tikz@anchor{north}% - \fi\fi% - \else% - \ifdim\pgf@y>0pt% - \def\tikz@anchor{east}% - \else% - \def\tikz@anchor{west}% - \fi% - \fi\fi% -} - -\def\tikz@auto@anchor@prime{% - \ifdim\pgf@x>0.05pt% - \ifdim\pgf@y>0.05pt% - \def\tikz@anchor{north west}% - \else\ifdim\pgf@y<-0.05pt% - \def\tikz@anchor{north east}% - \else - \def\tikz@anchor{north}% - \fi\fi% - \else\ifdim\pgf@x<-0.05pt% - \ifdim\pgf@y>0.05pt% - \def\tikz@anchor{south west}% - \else\ifdim\pgf@y<-0.05pt% - \def\tikz@anchor{south east}% - \else - \def\tikz@anchor{south}% - \fi\fi% - \else% - \ifdim\pgf@y>0pt% - \def\tikz@anchor{west}% - \else% - \def\tikz@anchor{east}% - \fi% - \fi\fi% -} - - - - -% Syntax for trees: -% node {...} child [options] {...} child [options] {...} ... -% node {...} child [options] foreach \var in {list} [options] {...} ... - -\def\tikz@children{% - % Start collecting the children: - \let\tikz@children@list=\pgfutil@empty% - \tikznumberofchildren=0\relax% - \tikz@collect@children c} - -\def\tikz@collect@children{\pgfutil@ifnextchar c{\tikz@collect@children@cchar}{\tikz@children@collected}} -\def\tikz@collect@children@cchar c{\pgfutil@ifnextchar h{\tikz@collect@child}{\tikz@children@collected c}} -\def\tikz@collect@child hild{\pgfutil@ifnextchar[{\tikz@collect@childA}{\tikz@collect@childA[]}}%} -\def\tikz@collect@childA[#1]{\pgfutil@ifnextchar f{\tikz@collect@children@foreach[#1]}{\tikz@collect@childB[#1]}} -\def\tikz@collect@childB[#1]{% - \advance\tikznumberofchildren by1\relax - \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list \tikz@childnode[#1]}% - \pgfutil@ifnextchar\bgroup{\tikz@collect@child@code}{\tikz@collect@child@code{}}} -\def\tikz@collect@child@code#1{% - \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list{#1}}% - \tikz@collect@children% -} -\def\tikz@collect@children@foreach[#1]foreach#2in#3{% - \pgfutil@ifnextchar\bgroup{\tikz@collect@children@foreachA{#1}{#2}{#3}}{\tikz@collect@children@foreachA{#1}{#2}{#3}{}}} -\def\tikz@collect@children@foreachA#1#2#3#4{% - \expandafter\def\expandafter\tikz@children@list\expandafter - {\tikz@children@list\tikz@childrennodes[#1]{#2}{#3}{#4}}% - \c@pgf@counta=\tikznumberofchildren% - \foreach#2in{#3}% - {% - \global\advance\c@pgf@counta by1\relax% - }% - \tikznumberofchildren=\c@pgf@counta% - \tikz@collect@children% -} -\long\def\tikz@children@collected{% - \begingroup% - \advance\tikztreelevel by 1\relax% - \let\tikz@options=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \tikz@every@style{level \the\tikztreelevel}% - \tikz@transform% - \let\tikzparentnode=\tikz@last@fig@name% - % Transform to center of node - \pgftransformshift{\pgfpointanchor{\tikzparentnode}{\tikz@growth@anchor}}% - \tikznumberofcurrentchild=0\relax% - \tikz@children@list% - \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@scan@next@command% -} - - -% Syntax for children: -% -% child [all children options] foreach \var in {values} [child options] {...} -\def\tikz@childrennodes[#1]#2#3#4{% - \c@pgf@counta=\tikznumberofcurrentchild\relax% - \setbox\tikz@tempbox=\box\tikz@figbox% - \foreach#2in{#3}{% - \tikznumberofcurrentchild=\c@pgf@counta\relax% - \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@childnode[#1]{#4}% - % we must now make the current child number and the figbox survive - % the group - \global\c@pgf@counta=\tikznumberofcurrentchild\relax% - \global\setbox\tikz@tempbox=\box\tikz@figbox% - }% - \tikznumberofcurrentchild=\c@pgf@counta\relax% - \setbox\tikz@figbox=\box\tikz@tempbox% -} - - -% Syntax for child: -% -% child -% -% child[options] -% -% child[options] {node (name) {child node text} ... -% edge from parent[options] node {label text} node {label text}} - -\def\tikz@childnode[#1]#2{% - \advance\tikznumberofcurrentchild by1\relax% - \setbox\tikz@figbox=\hbox\bgroup% - \unhbox\tikz@figbox% - \hbox\bgroup\bgroup% - \pgfinterruptpath% - \pgfscope% - \let\tikz@transform=\pgfutil@empty% - \tikz@every@style{every child}% - \tikz@setkeys{#1}% - \tikz@options% - \tikz@transform% - \tikz@grow% - % Typeset node: - \edef\tikz@parent@node@name{[name=\tikzparentnode-\the\tikznumberofcurrentchild,style=every child node]}% - \def\tikz@child@node@text{[shape=coordinate]{}} - \tikz@parse@child@node#2\pgf@stop% - \expandafter\expandafter\expandafter\node - \expandafter\tikz@parent@node@name - \tikz@child@node@text - \pgfextra{\global\let\tikz@childnode@name=\tikz@last@fig@name};% - \let\tikzchildnode=\tikz@childnode@name% - {% - \def\tikz@edge@to@parent@needed{edge from parent} - \ifx\tikz@child@node@rest\pgfutil@empty% - \path edge from parent;% - \else% - \path (0,0) \tikz@child@node@rest \tikz@edge@to@parent@needed;% - \fi% - }% - \endpgfscope% - \endpgfinterruptpath% - \egroup\egroup% - \egroup% -} - -\def\tikz@parse@child@node{% - \pgfutil@ifnextchar n{\tikz@parse@child@node@n}% - {\pgfutil@ifnextchar c{\tikz@parse@child@node@c}% - {\tikz@parse@child@node@rest}}} -\def\tikz@parse@child@node@rest#1\pgf@stop{\def\tikz@child@node@rest{#1}} -\def\tikz@parse@child@node@c c{\pgfutil@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}} -\def\tikz@parse@child@node@co o{\pgfutil@ifnextchar o{\tikz@parse@child@node@coordinate}{\tikz@parse@child@node@rest co}} -\def\tikz@parse@child@node@coordinate ordinate{% - \pgfutil@ifnextchar ({\tikz@@parse@child@node@coordinate}{% - \def\tikz@child@node@text{[shape=coordinate]{}}% - \tikz@parse@child@node@rest}}%} -\def\tikz@@parse@child@node@coordinate(#1){% - \pgfutil@ifnextchar a{\tikz@p@c@n@c@at(#1)}{% - \def\tikz@child@node@text{[shape=coordinate,name=#1]{}}% - \tikz@parse@child@node@rest}} -\def\tikz@p@c@n@c@at(#1)at#2(#3){% - \def\tikz@child@node@text{[shape=coordinate,name=#1]at(#3){}}% - \tikz@parse@child@node@rest}% -\def\tikz@parse@child@node@n node{% - \let\tikz@child@node@text=\pgfutil@empty% - \tikz@p@c@s}% -\def\tikz@p@c@s{% - \pgfutil@ifnextchar a{\tikz@p@c@s@at} - {\pgfutil@ifnextchar ({\tikz@p@c@s@paran} - {\pgfutil@ifnextchar [{\tikz@p@c@s@bra} - {\pgfutil@ifnextchar \bgroup{\tikz@p@c@s@group} - {\PackageError{tikz}{Cannot parse this node}{}}}}}}%}} -\def\tikz@p@c@s@at at#1(#2){% - \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text at(#2)} - \tikz@p@c@s} -\def\tikz@p@c@s@paran(#1){% - \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text(#1)} - \tikz@p@c@s} -\def\tikz@p@c@s@bra[#1]{% - \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text[#1]} - \tikz@p@c@s} -\def\tikz@p@c@s@group#1{% - \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text{#1}} - \tikz@parse@child@node@rest} - - -% -% Timers -% - -\def\tikz@timer@line{% - \pgftransformlineattime{\tikz@time}{\tikz@timer@start}{\tikz@timer@end}% -} - -\def\tikz@timer@vhline{% - \ifdim\tikz@time pt<0.5pt% first half - \pgf@process{\tikz@timer@start}% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \pgf@process{\tikz@timer@end}% - \pgf@xb=\tikz@time pt% - \pgf@xb=2\pgf@xb% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% - \tikz@marshal% - \else% second half - \pgf@process{\tikz@timer@start}% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \pgf@process{\tikz@timer@end}% - \pgf@xb=\tikz@time pt% - \pgf@xb=2\pgf@xb% - \advance\pgf@xb by-1pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% - \tikz@marshal% - \fi% -} - -\def\tikz@timer@hvline{% - \ifdim\tikz@time pt<0.5pt% first half - \pgf@process{\tikz@timer@start}% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \pgf@process{\tikz@timer@end}% - \pgf@xb=\tikz@time pt% - \pgf@xb=2\pgf@xb% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% - \tikz@marshal% - \else% second half - \pgf@process{\tikz@timer@start}% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \pgf@process{\tikz@timer@end}% - \pgf@xb=\tikz@time pt% - \pgf@xb=2\pgf@xb% - \advance\pgf@xb by-1pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@end}}% - \tikz@marshal% - \fi% -} - -\def\tikz@timer@curve{% - \pgftransformcurveattime{\tikz@time}{\tikz@timer@start}{\tikz@timer@cont@one}{\tikz@timer@cont@two}{\tikz@timer@end}% -} - - - -% -% Coordinate systems -% - -\def\tikzdeclarecoordinatesystem#1#2{% - \expandafter\def\csname tikz@parse@cs@#1\endcsname(##1){% - \pgf@process{% - #2% - % Smuggle outside: - \iftikz@shapeborder% - \global\let\tikz@smuggle@a=\tikz@shapebordertrue% - \else% - \global\let\tikz@smuggle@a=\tikz@shapeborderfalse% - \fi% - \global\let\tikz@smubble@b=\tikz@shapeborder@name% - }% - \tikz@smuggle@a% - \let\tikz@shapeborder@name=\tikz@smubble@b% - \edef\tikz@return@coordinate{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% -} -\def\tikzaliascoordinatesystem#1#2{% - \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname - tikz@parse@cs@#1\endcsname=\expandafter\noexpand\csname - tikz@parse@cs@#2\endcsname}% - \pgf@marshal% -} - - -% Default coodinate systems: - -\tikzdeclarecoordinatesystem{canvas} -{% - \tikz@orig@setkeys{tikzcskeys}{x=0pt,y=0pt,#1}% - \pgfpoint{\tikz@cs@x}{\tikz@cs@y}% -} - -\tikzdeclarecoordinatesystem{canvas polar} -{% - \tikz@orig@setkeys{tikzcskeys}{angle=0,radius=0cm,#1}% - \pgfpointpolar{\tikz@cs@angle}{\tikz@cs@xradius/\tikz@cs@yradius}% -} - -\tikzdeclarecoordinatesystem{xyz} -{% - \tikz@orig@setkeys{tikzcskeys}{x=0,y=0,z=0,#1}% - \pgfpointxyz{\tikz@cs@x}{\tikz@cs@y}{\tikz@cs@z}% -} - -\tikzdeclarecoordinatesystem{xyz polar} -{% - \tikz@orig@setkeys{tikzcskeys}{angle=0,radius=0,#1}% - \pgfpointpolarxy{\tikz@cs@angle}{\tikz@cs@xradius and \tikz@cs@yradius}% -} -\tikzaliascoordinatesystem{xy polar}{xyz polar} - - -\tikzdeclarecoordinatesystem{node} -{% - \tikz@orig@setkeys{tikzcskeys}{name=,anchor=none,angle=none,#1}% - \ifx\tikz@cs@anchor\tikz@nonetext% - \ifx\tikz@cs@angle\tikz@nonetext% - \expandafter\ifx\csname pgf@sh@ns@\tikz@cs@node\endcsname\tikz@coordinate@text% - \else - \tikz@shapebordertrue% - \edef\tikz@shapeborder@name{\tikz@cs@node}% - \fi% - \pgfpointanchor{\tikz@cs@node}{center}% - \else% - \pgfpointanchor{\tikz@cs@node}{\tikz@cs@angle}% - \fi% - \else% - \pgfpointanchor{\tikz@cs@node}{\tikz@cs@anchor}% - \fi% -} - -\tikzdeclarecoordinatesystem{intersection} -{% - \tikz@orig@setkeys{tikzcskeys}{#1}% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@a\tikz@cs@line@a@begin% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@b\tikz@cs@line@a@end% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@c\tikz@cs@line@b@begin% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@d\tikz@cs@line@b@end% - \edef\pgf@marshal{% - {\noexpand\pgfpointintersectionoflines% - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}% - \pgf@marshal% -} - -\tikzdeclarecoordinatesystem{perpendicular} -{% - \tikz@orig@setkeys{tikzcskeys}{#1}% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@a\tikz@cs@hori@line% - \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@b\tikz@cs@vert@line% - \pgfqpoint{\the\pgf@xb}{\the\pgf@ya} -} - -\tikzdeclarecoordinatesystem{barycentric} -{% - {% - \pgf@xa=0pt% point - \pgf@ya=0pt% - \pgf@xb=0pt% sum - \tikz@bary@dolist#1,=,% - \pgfmathparse{1/\the\pgf@xb}% - \global\pgf@x=\pgfmathresult\pgf@xa% - \global\pgf@y=\pgfmathresult\pgf@ya% - }% -} - -\def\tikz@bary@dolist#1=#2,{% - \def\tikz@temp{#1}% - \ifx\tikz@temp\pgfutil@empty% - \else - \pgf@process{\pgfpointanchor{#1}{center}}% - \pgfmathparse{#2}% - \advance\pgf@xa by\pgfmathresult\pgf@x% - \advance\pgf@ya by\pgfmathresult\pgf@y% - \advance\pgf@xb by\pgfmathresult pt% - \expandafter\tikz@bary@dolist% - \fi% -} - - -\tikz@orig@define@key{tikzcskeys}{x}{\def\tikz@cs@x{#1}} -\tikz@orig@define@key{tikzcskeys}{y}{\def\tikz@cs@y{#1}} -\tikz@orig@define@key{tikzcskeys}{z}{\def\tikz@cs@z{#1}} -\tikz@orig@define@key{tikzcskeys}{angle}{\def\tikz@cs@angle{#1}} -\tikz@orig@define@key{tikzcskeys}{radius}{\def\tikz@cs@xradius{#1}\def\tikz@cs@yradius{#1}} -\tikz@orig@define@key{tikzcskeys}{x radius}{\def\tikz@cs@xradius{#1}} -\tikz@orig@define@key{tikzcskeys}{y radius}{\def\tikz@cs@yradius{#1}} -\tikz@orig@define@key{tikzcskeys}{name}{\def\tikz@cs@node{#1}} -\tikz@orig@define@key{tikzcskeys}{anchor}{\def\tikz@cs@anchor{#1}} - -\tikz@orig@define@key{tikzcskeys}{first line}{\tikz@parse@cs@line{tikz@cs@line@a}#1} -\tikz@orig@define@key{tikzcskeys}{second line}{\tikz@parse@cs@line{tikz@cs@line@b}#1} - -\def\tikz@parse@cs@line#1(#2)--(#3){% - \expandafter\def\csname #1@begin\endcsname{(#2)}% - \expandafter\def\csname #1@end\endcsname{(#3)}% -} - -\tikz@orig@define@key{tikzcskeys}{horizontal line through}{\def\tikz@cs@hori@line{#1}} -\tikz@orig@define@key{tikzcskeys}{vertical line through}{\def\tikz@cs@vert@line{#1}} - - - - -% -% Coordinate management -% - - -% Last position visited -\def\tikz@last@position{\pgfqpoint{\tikz@lastx}{\tikz@lasty}} -\def\tikz@last@position@saved{\pgfqpoint{\tikz@lastxsaved}{\tikz@lastysaved}} - -% Make given point the last position visited -\def\tikz@make@last@position#1{% - \pgf@process{#1}% - \tikz@lastx=\pgf@x\relax% - \tikz@lasty=\pgf@y\relax% - \iftikz@updatecurrent% - \tikz@lastxsaved=\pgf@x\relax% - \tikz@lastysaved=\pgf@y\relax% - \fi% - \tikz@updatecurrenttrue% -} - -\newif\iftikz@updatecurrent -\tikz@updatecurrenttrue - - - -% Scanner: Scans a point or a relative point. -% It then calls the first parameter with the argument set to an -% appropriate pgf command representing that point. - -\def\tikz@scan@one@point#1{% - \let\tikz@to@use@whom=\tikz@to@use@last@coordinate% - \tikz@shapeborderfalse% - \pgfutil@ifnextchar+{\tikz@scan@relative#1}{\tikz@scan@absolute#1}} -\def\tikz@scan@absolute#1{% - \pgfutil@ifnextchar({\tikz@scan@@absolute#1}%) - {% - \advance\tikz@expandcount by -1% - \ifnum\tikz@expandcount<0\relax% - \let\@next=\tikz@@scangiveup% - \else% - \let\@next=\tikz@@scanexpand% - \fi% - \@next{#1}% - }% -} -\def\tikz@@scanexpand#1{\expandafter\tikz@scan@one@point\expandafter#1} -\def\tikz@@scangiveup#1{\PackageError{tikz}{Cannot parse this coordinate}{}#1{\pgfpointorigin}} -\def\tikz@scan@@absolute#1(#2){% - \edef\tikz@temp{(#2)}% - \expandafter\tikz@@scan@@absolute\expandafter#1\tikz@temp% -} -\def\tikz@@scan@@absolute#1({% - \pgfutil@ifnextchar[% uhoh... options! - {\def\tikz@scan@point@recall{#1}\tikz@scan@options}% - {\tikz@@@scan@@absolute#1(}% -} - -\def\tikz@scan@options[#1]#2{% - \def\tikz@scan@point@options{#1}% - \tikz@@@scan@@absolute\tikz@scan@handle@options(#2% -} - -\def\tikz@scan@handle@options#1{% - {% - % Ok, compute point with options set and zero transformation - % matrix: - \pgftransformreset% - \let\tikz@transform=\pgfutil@empty% - \expandafter\tikz@setkeys\expandafter{\tikz@scan@point@options}% - \tikz@transform% - \pgf@process{\pgfpointtransformed{#1}}% - \xdef\tikz@marshal{\expandafter\noexpand\tikz@scan@point@recall{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% - }% - \tikz@marshal% -} - -\def\tikz@@@scan@@absolute#1(#2){% - \pgfutil@in@{intersection of}{#2}% - \ifpgfutil@in@% - \let\@next\tikz@parse@intersection% - \else% - \pgfutil@in@|{#2}% - \ifpgfutil@in@ - \pgfutil@in@{-|}{#2}% - \ifpgfutil@in@ - \let\@next\tikz@parse@hv% - \else% - \let\@next\tikz@parse@vh% - \fi% - \else% - \pgfutil@in@{cs:}{#2}% - \ifpgfutil@in@% - \let\@next\tikz@parse@coordinatesystem% - \else% - \pgfutil@in@:{#2}% - \ifpgfutil@in@ - \let\@next\tikz@parse@polar% - \else% - \pgfutil@in@,{#2}% - \ifpgfutil@in@% - \let\@next\tikz@parse@regular% - \else% - \let\@next\tikz@parse@node% - \fi% - \fi% - \fi% - \fi% - \fi% - \@next#1(#2)% -} - -\def\tikz@parse@coordinatesystem#1(#2 cs:#3){% - \let\tikz@return@coordinate=\pgfpointorigin% - \pgfutil@ifundefined{tikz@parse@cs@#2} - {\PackageError{tikz}{Unknown coordinate system '#2'}{}} - {\csname tikz@parse@cs@#2\endcsname(#3)}% - \expandafter#1\expandafter{\tikz@return@coordinate}% -} - - -\newif\iftikz@isdimension -\def\tikz@checkunit#1{% - \pgfmathparse{#1}% - \let\iftikz@isdimension=\ifpgfmathunitsdeclared% -} -\def\tikz@@checkunit{\pgfutil@ifnextchar\tikz@unique{\tikz@checkunit@number}{\tikz@checkunit@dimension}} -\def\tikz@checkunit@number\tikz@unique{\tikz@isdimensionfalse} -\def\tikz@checkunit@dimension#1\tikz@unique{\tikz@isdimensiontrue} - -\def\tikz@parse@polar#1(#2:#3){% - \pgfutil@ifundefined{tikz@polar@dir@#2} - {\tikz@@parse@polar#1(#2:#3)} - {\tikz@@parse@polar#1(\csname tikz@polar@dir@#2\endcsname:#3)}% -} -\def\tikz@@parse@polar#1(#2:#3){% - \pgfutil@in@{ and }{#3}% - \ifpgfutil@in@% - \edef\tikz@args{(#2:#3)}% - \else% - \edef\tikz@args{(#2:#3 and #3)}% - \fi% - \expandafter\tikz@@@parse@polar\expandafter#1\tikz@args% -} -\def\tikz@@@parse@polar#1(#2:#3 and #4){% - \tikz@checkunit{#3}% - \iftikz@isdimension% - \def\tikz@next{#1{\pgfpointpolar{#2}{#3 and #4}}}% - \else% - \def\tikz@next{#1{\pgfpointpolarxy{#2}{#3 and #4}}}% - \fi% - \tikz@next% -} -\def\tikz@polar@dir@up{90} -\def\tikz@polar@dir@down{-90} -\def\tikz@polar@dir@left{180} -\def\tikz@polar@dir@right{0} -\def\tikz@polar@dir@north{90} -\def\tikz@polar@dir@south{-90} -\def\tikz@polar@dir@east{0} -\def\tikz@polar@dir@west{180} -\expandafter\def\csname tikz@polar@dir@north east\endcsname{45} -\expandafter\def\csname tikz@polar@dir@north west\endcsname{135} -\expandafter\def\csname tikz@polar@dir@south east\endcsname{-45} -\expandafter\def\csname tikz@polar@dir@south west\endcsname{-135} - -\def\tikz@parse@regular#1(#2,#3){% - \pgfutil@in@,{#3}% - \ifpgfutil@in@% - \tikz@parse@splitxyz{#1}{#2}#3,% - \else% - \tikz@checkunit{#2}% - \iftikz@isdimension% - \def\@next{#1{\pgfpoint{#2}{#3}}}% - \else% - \def\@next{#1{\pgfpointxy{#2}{#3}}}% - \fi% - \fi% - \@next% -} - -\def\tikz@parse@splitxyz#1#2#3,#4,{% - \def\@next{#1{\pgfpointxyz{#2}{#3}{#4}}}% -} - -\def\tikz@coordinate@text{coordinate} - -\def\tikz@parse@node#1(#2){% - \pgfutil@in@.{#2}% Ok, flag this - \ifpgfutil@in@ - \tikz@calc@anchor#2\tikz@stop% - \else% - \tikz@calc@anchor#2.center\tikz@stop% to be on the save side, in - % case iftikz@shapeborder is ignored... - \expandafter\ifx\csname pgf@sh@ns@#2\endcsname\tikz@coordinate@text% - \else - \tikz@shapebordertrue% - \def\tikz@shapeborder@name{#2}% - \fi% - \fi% - \edef\tikz@marshal{\noexpand#1{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% - \tikz@marshal% -} - -\def\tikz@calc@anchor#1.#2\tikz@stop{% - \pgfpointanchor{#1}{#2}% -} - - -\def\tikz@parse@hv#1(#2){% - \pgfutil@in@{ -| }{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@hvboth% - \else% - \pgfutil@in@{ -|}{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@hvleft% - \else% - \pgfutil@in@{-| }{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@hvright% - \else% - \let\tikz@next=\tikz@parse@hvdone% - \fi% - \fi% - \fi% - \tikz@next#1(#2)} -\def\tikz@parse@hvboth#1(#2 -| #3){\tikz@parse@vhdone#1(#3|-#2)} -\def\tikz@parse@hvleft#1(#2 -|#3){\tikz@parse@vhdone#1(#3|-#2)} -\def\tikz@parse@hvright#1(#2-| #3){\tikz@parse@vhdone#1(#3|-#2)} -\def\tikz@parse@hvdone#1(#2-|#3){\tikz@parse@vhdone#1(#3|-#2)} - -\def\tikz@parse@vh#1(#2){% - \pgfutil@in@{ |- }{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@vhboth% - \else% - \pgfutil@in@{ |-}{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@vhleft% - \else% - \pgfutil@in@{|- }{#2}% - \ifpgfutil@in@% - \let\tikz@next=\tikz@parse@vhright% - \else% - \let\tikz@next=\tikz@parse@vhdone% - \fi% - \fi% - \fi% - \tikz@next#1(#2)} -\def\tikz@parse@vhboth#1(#2 |- #3){\tikz@parse@vhdone#1(#2|-#3)} -\def\tikz@parse@vhleft#1(#2 |-#3){\tikz@parse@vhdone#1(#2|-#3)} -\def\tikz@parse@vhright#1(#2|- #3){\tikz@parse@vhdone#1(#2|-#3)} -\def\tikz@parse@vhdone#1(#2|-#3){% - {% - \tikz@@@scan@@absolute\tikz@parse@vh@mid(#2)% - \tikz@@@scan@@absolute\tikz@parse@vh@end(#3)% - \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}}% - }% - \tikz@shapeborderfalse% - \tikz@marshal% -} -\def\tikz@parse@vh@mid#1{\pgf@process{#1}\pgf@xa=\pgf@x} -\def\tikz@parse@vh@end#1{\pgf@process{#1}\pgf@ya=\pgf@y} - -\def\tikz@parse@intersection#1(intersection of #2--#3 and #4--#5){% - {% - \tikz@@@scan@@absolute\tikz@parse@intersection@a(#2)% - \tikz@@@scan@@absolute\tikz@parse@intersection@b(#3)% - \tikz@@@scan@@absolute\tikz@parse@intersection@c(#4)% - \tikz@@@scan@@absolute\tikz@parse@intersection@d(#5)% - \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfpointintersectionoflines% - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}% - }% - \tikz@shapeborderfalse% - \tikz@marshal% -} - -\def\tikz@parse@intersection@a#1{\pgf@process{#1}\pgf@xa=\pgf@x\pgf@ya=\pgf@y} -\def\tikz@parse@intersection@b#1{\pgf@process{#1}\pgf@xb=\pgf@x\pgf@yb=\pgf@y} -\def\tikz@parse@intersection@c#1{\pgf@process{#1}\pgf@xc=\pgf@x\pgf@yc=\pgf@y} -\def\tikz@parse@intersection@d#1{\pgf@process{#1}} - -\def\tikz@scan@relative#1+{% - \pgfutil@ifnextchar+{\tikz@scan@plusplus#1}{\tikz@scan@oneplus#1}} - -\def\tikz@scan@plusplus#1+{% - \def\tikz@doafter{#1}% - \tikz@scan@absolute\tikz@add% -} -\def\tikz@add#1{% - \tikz@doafter{\pgfpointadd{#1}{\tikz@last@position@saved}}% -} -\def\tikz@scan@oneplus#1{% - \def\tikz@doafter{#1}% - \tikz@updatecurrentfalse% - \tikz@scan@absolute\tikz@add% -} - - - -% Loading further libraries - -% Include a library file. -% -% #1 = List of names of library file. -% -% Description: -% -% This command includes a list of TikZ library files. For each file X in the -% list, the file pgflibrarytikzX.code.tex is included, provided this has -% not been done earlier. -% -% For the convenience of Context users, both round and square brackets -% are possible for the argument. -% -% Example: -% -% \usetikzlibrary{arrows} -% \usetikzlibrary[patterns,topaths] - -\def\usetikzlibrary{\pgfutil@ifnextchar[{\use@tikzlibrary}{\use@@tikzlibrary}}%} -\def\use@tikzlibrary[#1]{\use@@tikzlibrary{#1}} -\def\use@@tikzlibrary#1{% - \edef\pgf@list{#1}% - \pgfutil@for\pgf@temp:=\pgf@list\do{% - \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax% - \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty% - \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@} - \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|} - \catcode`\@=11 - \catcode`\|=12 - \input pgflibrarytikz\pgf@temp.code.tex - \catcode`\@=\csname tikz@library@#1@atcode\endcsname - \catcode`\|=\csname tikz@library@#1@barcode\endcsname - \fi% - }% -} - - -% Always-present libraries: - -\usetikzlibrary{topaths} - - - - -\endinput 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 ' 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 ' or `side ' 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/) + % 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 ' 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 diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex new file mode 100644 index 00000000000..c901c3972f1 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex @@ -0,0 +1,10 @@ +% Copyright 2007 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. + +\input pgfmathcalc.code.tex \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex new file mode 100644 index 00000000000..cd34d3a8db0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex @@ -0,0 +1,262 @@ +% Copyright 2007 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% This file provides basic macros for converting between bases. +% +% Version 1.414213 29/9/2007 + +% \pgfmathbasetodec +% +% Convert a representation of an integer from +% the spcified base to base 10. +% +% #1 - a macro to store the result. +% #2 - the representation of a number (i.e. not a register) +% #3 - the current base. +% +% e.g. +% +% \pgfmathbasetodec\mynumber{10111}{2} +% +% \mynumber <- 23 +% +\def\pgfmathbasetodec#1#2#3{% + \pgfmath@checknumber{#2}% + \pgfmath@checkbase{#3}% + \def\pgfmath@base{#3}% + \def\pgfmath@macro{#1}% + \c@pgfmath@counta1\relax% + \def\pgfmath@reversed{}% + \expandafter\pgfmathbasetodec@#2\pgfmathbasetodec} + +\def\pgfmathbasetodec@#1{% + \ifx\pgfmathbasetodec#1% + \c@pgfmath@countb0% + \divide\c@pgfmath@counta by\pgfmath@base\relax% + \expandafter\pgfmathbasetodec@@% + \else% + \edef\pgfmath@reversed{\pgfmath@reversed#1}% + \expandafter\multiply\expandafter\c@pgfmath@counta\pgfmath@base\relax% + \expandafter\pgfmathbasetodec@% + \fi} + +\def\pgfmathbasetodec@@{\expandafter\pgfmathbasetodec@@@\pgfmath@reversed\pgfmathbasetodec} + +\def\pgfmathbasetodec@@@#1{% + \ifx\pgfmathbasetodec#1\relax% + \expandafter\edef\pgfmath@macro{\the\c@pgfmath@countb}% + \let\pgfmath@next\pgfmathbasetodec@@@@% + \else% + \chardef\pgfmath@charnum`#1\relax% + \c@pgfmath@countc\pgfmath@charnum% + \ifnum\c@pgfmath@countc>96\relax% + \advance\c@pgfmath@countc-87\relax% + \else + \ifnum\c@pgfmath@countc>64\relax% + \advance\c@pgfmath@countc-55\relax% + \else + \advance\c@pgfmath@countc-48\relax% + \fi\fi% + \ifnum\c@pgfmath@countc<\pgfmath@base\relax% + \multiply\c@pgfmath@countc\c@pgfmath@counta\relax% + \advance\c@pgfmath@countb\c@pgfmath@countc% + \divide\c@pgfmath@counta by\pgfmath@base\relax% + \let\pgfmath@next\pgfmathbasetodec@@@% + \else + \pgfmath@error{Digit `#1' invalid for base \pgfmath@base}% + \let\pgfmath@next\relax% + \fi% + \fi% + \pgfmath@next} +\def\pgfmathbasetodec@@@@{% + \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@macro}% +} + +% \pgfmathdectobase +% +% Convert a representation of an integer from +% base 10 to the spcified base. Letters for bases +% greater than 10 are in lowercase. +% +% #1 - a macro to store the result. +% #2 - a number in base 10 (in a macro, not a register) +% #3 - the required base. +% +% e.g. +% +% \pgfmathdectobase\mynumber{127}{16} +% +% \mynumber <- 7f +% +\def\pgfmathdectobase#1#2#3{% + \pgfmath@checknumber{#2}% + \pgfmath@checkbase{#3}% + \c@pgfmath@counta#2\relax% + \def#1{}% + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb#3\relax% + \multiply\c@pgfmath@countb-#3\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}% + \divide\c@pgfmath@counta#3\relax% + \repeatpgfmathloop% + \pgfmath@ensurenumberlength{#1}} + +% \pgfmathdectoBase +% +% Convert a representation of an integer from +% base 10 to the spcified base. Letters for bases +% greater than 10 are in uppercase. +% +% #1 - a macro to store the result. +% #2 - a number in base 10 (in a macro, not a register) +% #3 - the required base. +% +% e.g. +% +% \pgfmathdectoBase\mynumber{127}{16} +% +% \mynumber <- 7F +% +\def\pgfmathdectoBase#1#2#3{% + \pgfmath@checkbase{#3}% + \pgfmath@checknumber{#2}% + \c@pgfmath@counta#2\relax% + \def#1{}% + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb#3\relax% + \multiply\c@pgfmath@countb-#3\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}% + \divide\c@pgfmath@counta#3\relax% + \repeatpgfmathloop% + \pgfmath@ensurenumberlength{#1}} + +\def\pgfmath@createdigits{% + \def\pgfmath@digitstyle{lowercase digit}% + \c@pgfmath@counta0\relax% + \pgfmath@createdigits@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@createdigits% + \def\pgfmath@digitstyle{uppercase digit}% + \c@pgfmath@counta0\relax% + \pgfmath@createdigits@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@createdigits} + +\def\pgfmath@createdigits@#1{% + \ifx\pgfmath@createdigits#1\relax% + \else% + \expandafter\pgfmath@def\expandafter{\pgfmath@digitstyle}{\the\c@pgfmath@counta}{#1}% + \advance\c@pgfmath@counta1\relax% + \expandafter\pgfmath@createdigits@% + \fi} +\pgfmath@createdigits + +% \pgfmathbasetobase +% +% Convert a representation of an integer from +% between the specified bases. Letters for target +% bases greater than 10 are in lppercase. +% +% #1 - a macro to store the result. +% #2 - a number (in a macro, not a register) +% #3 - the source base. +% #4 - the target base. +% +% e.g. +% +% \pgfmathbasetobase\mynumber{4321}{5}{9} +% +% \mynumber <- 721 +% +\def\pgfmathbasetobase#1#2#3#4{% + \pgfmathbasetodec{\pgfmath@temp}{#2}{#3}% + \pgfmathdectobase{#1}{\pgfmath@temp}{#4} +} + +% \pgfmathbasetobase +% +% Convert a representation of an integer from +% between the specified bases. Letters for target +% bases greater than 10 are in uppercase. +% +% #1 - a macro to store the result. +% #2 - a number (in a macro, not a register) +% #3 - the source base. +% #4 - the target base. +% +% e.g. +% +% \pgfmathbasetobase\mynumber{1234}{5}{12} +% +% \mynumber <- 142 +% +\def\pgfmathbasetoBase#1#2#3#4{% + \pgfmathbasetodec{\pgfmath@temp}{#2}{#3}% + \pgfmathdectoBase{#1}{\pgfmath@temp}{#4} +} + +\def\pgfmath@checkbase#1{% + \ifnum#1<2\relax% + \pgfmath@error{Cannot process numbers in base `#1'.}% + \else% + \ifnum#1>36\relax% + \pgfmath@error{Cannot process numbers in base `#1'.}% + \fi\fi} + +\def\pgfmath@checknumber#1{% + \expandafter\pgfmath@checknumber@#1\pgfmath@} +\def\pgfmath@checknumber@#1#2\pgfmath@{% + \ifx#1-% + \pgfmath@error{Cannot process negative numbers.}% + \fi} + +% \pgfmath@ensurenumberlength +% +% Internal macro for making a representation of a number have +% a specific length, byt prefixing zeros to the number. +% +% #1 - a macro contatining a representation of an integer. +% #2 - the number of digits to ensure. +% +% e.g. +% +% \foo <- 7FF +% +% \pgfmathsetnumberlength{8}% +% \pgfmath@ensurenumberlength\foo +% +% \foo <- 000007FF +% +\def\pgfmath@ensurenumberlength#1{% + \def\pgfmath@tempa{#1}% + \expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax% + \expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength} +\def\pgfmath@ensurenumberlength@#1{% + \ifx\pgfmath@ensurenumberlength#1\relax% + \expandafter\pgfmath@ensurenumberlength@@% + \else% + \advance\c@pgfmath@counta-1\relax% + \expandafter\pgfmath@ensurenumberlength@ + \fi} + +\def\pgfmath@ensurenumberlength@@{% + \edef\pgfmath@tempb{\pgfmath@tempa}% + \pgfmath@ensurenumberlength@@@} +\def\pgfmath@ensurenumberlength@@@{% + \ifnum\c@pgfmath@counta>0\relax% + \advance\c@pgfmath@counta-1\relax% + \edef\pgfmath@tempb{0\pgfmath@tempb}% + \expandafter\pgfmath@ensurenumberlength@@@% + \fi% + \expandafter\edef\pgfmath@tempa{\pgfmath@tempb}} + +\def\pgfmathsetbasenumberlength#1{\def\pgfmath@basenumberlength{#1}} +\pgfmathsetbasenumberlength{1}% \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex new file mode 100644 index 00000000000..29a2be58693 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex @@ -0,0 +1,253 @@ +% Copyright 2007 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% This file loads all the parsing, functions and operator stuff +% +% Version 1.414213 29/9/2007 + +\input pgfmathutil.code.tex +\input pgfmathparser.code.tex +\input pgfmathoperations.code.tex +\input pgfmathbase.code.tex + +% \pgfmathsetlength, \pgfmathaddtolength +% +% #1 = dimension register +% #2 = expression +% +% Description: +% +% These functions work similar to \setlength and \addtolength. Only, +% they allow #2 to contain an expression, which is evaluated before +% assignment. Furthermore, the font is setup before the assignment is +% done, so that dimensions like 1em are evaluated correctly. +% +% If #2 starts with "+", then a simple assignment is done (but the +% font is still setup). This is orders of magnitude faster than a +% parsed assignment. + +\def\pgfmathsetlength#1#2{% + \expandafter\pgfmath@onquick#2\pgfmath@% + {% + % Ok, quick version: + \begingroup% + \pgfmath@selectfont% + \pgfmath@x#2\unskip% + \pgfmath@returnone\pgfmath@x% + \endgroup% + #1\pgfmathresult pt\relax% + }% + {% + \pgfmathparse{#2}% + #1\pgfmathresult pt\relax% + }% + \ignorespaces% +} + +% \pgfmathaddtolength +% +% Add to #1 the result of evaluating #2. +% +% #1 - a dimension register +% #2 - an expression +% +\def\pgfmathaddtolength#1#2{% + \expandafter\pgfmath@onquick#2\pgfmath@% + {% + \begingroup% + \pgfmath@selectfont% + \pgfmath@x#1\relax% + \advance\pgfmath@x#2\unskip% + \pgfmath@returnone\pgfmath@x% + \endgroup% + #1\pgfmathresult pt\relax% + }% + {% + \pgfmathparse{#2}% + \advance#1\pgfmathresult pt\relax% + }% + \ignorespaces% +} + +% \pgfmathsetcount +% +% Assign #1 the truncated evaluation of #2. +% +% #1 - a count register +% #2 - an expression +% +\def\pgfmathsetcount#1#2{% + \expandafter\pgfmath@onquick#2\pgfmath@% + {% + #1#2\relax% + }% + {% + \pgfmathparse{#2}% + \afterassignment\pgfmath@gobbletilpgfmath@% + #1\pgfmathresult\relax\pgfmath@% + }% + \ignorespaces% +} + +% \pgfmathaddtocount +% +% Add to #1 the truncated evaluation of #2. +% +% #1 - a count register +% #2 - an expression +% +\def\pgfmathaddtocount#1#2{% + \expandafter\pgfmath@onquick#2\pgfmath@% + {% + \advance#1#2\relax% + }% + {% + \edef\pgfmath@addtocounttemp{\the#1}% + \pgfmathparse{#2}% + \afterassignment\pgfmath@gobbletilpgfmath@% + #1\pgfmathresult\relax\pgfmath@% + \advance#1\pgfmath@addtocounttemp\relax% + }% + \ignorespaces% +} + +% \pgfmathnewcounter +% +% LaTeX style counter which also works in plain TeX. Defines +% \c@ as a count register and also defines \the. +% +% #1 the name of the counter. +% +% Example: +% +% \pgfmathnewcounter{counter} +% \pgfmathsetcounter{counter}{12} +% \thecounter (same as \the\c@counter) +% +\def\pgfmathnewcounter#1{% + \expandafter\ifx\csname c@#1\endcsname\relax% + \def\pgfmath@marshal{\csname newcount\endcsname}% Ha! Who cares about \outer? + \expandafter\pgfmath@marshal\csname c@#1\endcsname% + \expandafter\def\csname the#1\endcsname{\expandafter\the\csname c@#1\endcsname}% + \fi% +} + +% \pgfmathsetcounter +% +% Set the counter #1 to the evaluation of #2. +% +% #1 - a counter name +% #2 - an expression +% +\def\pgfmathsetcounter#1#2{% + \expandafter\pgfmathsetcount\csname c@#1\endcsname{#2}% +} + +% \pgfmathaddtocounter +% +% Add the counter #1 to the evaluation of #2. +% +% #1 - a counter name +% #2 - an expression +% +\def\pgfmathaddtocounter#1#2{% + \expandafter\pgfmathaddtocount\csname c@#1\endcsname{#2}% +} + +% \pgfmathmakecounterglobal +% +% Make the current value of a counter globally defined. +% +% #1 - a (valid) counter name. +% +\def\pgfmath@pgftext{pgf} +\def\pgfmath@tikztext{tikz} +\def\pgfmathmakecounterglobal#1{% + \pgfmath@ifundefined{c@#1}{}{% + \expandafter\pgfmath@in@\expandafter{\pgfmath@pgftext}{#1}% + \ifpgfmath@in@% + \else% + \expandafter\pgfmath@in@\expandafter{\pgfmath@tikztext}{#1}% + \ifpgfmath@in@% + \else% + \expandafter\global\csname c@#1\endcsname\csname c@#1\endcsname\relax% + \fi% + \fi% + }% +} + +% \pgfmathsetmacro +% +% \edef#1 as the result of evaluating #2. +% +% #1 - a macro +% #2 - an expression +% +\def\pgfmathsetmacro#1#2{% + \begingroup% + \pgfmathsetlength\pgfmath@x{#2}% + \edef#1{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone{#1}% + \endgroup% +} + +% \pgfmathsetlengthmacro +% +% \edef#1 as the result of evaluating #2 with pt. +% +% #1 - a macro +% #2 - an expression +% +\def\pgfmathsetlengthmacro#1#2{% + \begingroup% + \pgfmathsetlength\pgfmath@x{#2}% + \edef#1{\the\pgfmath@x}% + \pgfmath@smuggleone{#1}% + \endgroup% +} + +% \pgfmathtruncatemacro +% +% \edef#1 as the truncated result of evaluating #2. +% +% #1 - a macro +% #2 - an expression +% +\def\pgfmathtruncatemacro#1#2{% + \begingroup% + \pgfmathsetcount\c@pgfmath@counta{#2}% + \edef#1{\the\c@pgfmath@counta}% + \pgfmath@smuggleone{#1}% + \endgroup% +} + +% Check whether a given parameter starts with quick. +% +% The command should be followed by nonempty text, ending with +% \pgfmath@ as a stop-token. Then should follow +% +% #1 - code to execute if text starts with + +% #2 - code to execute if text does not +% +% Example: +% +% \pgfmath@onquick+0pt\pgfmath@{is quick}{is slow} + +\def\pgfmath@onquick{% + \afterassignment\pgfmath@afterquick% + \let\pgfmath@next=% +} + +\def\pgfmath@afterquick#1\pgfmath@{% + \ifx\pgfmath@next+% + \expandafter\pgfmath@firstoftwo% + \else% + \expandafter\pgfmath@secondoftwo% + \fi% +} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex new file mode 100644 index 00000000000..452b9fa0b2c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex @@ -0,0 +1,1488 @@ +% Copyright 2007 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% This file defines the mathematical functions and operators. +% +% Version 1.414213 29/9/2007 + +% This file defines the mathematical functions and operators. +% +% Adding/redefining extra operators/functions: +% +% Each operator/function XXX has two forms: +% +% +% \pgfmathXXX#1... a public version which evaluates any +% arguments passed to it and passes the +% results on to... +% +% \pgfmathXXX@#1... a non-public version which performs +% required calculation on arguments which +% must have already been evaluated (i.e. +% *without* dimensions). +% +% If a function XXX is to be included in the parser, it is +% recommended, for consistency, that where possible, the +% pgfmathparser file should define the macro \pgfmath@parseXXX. +% The parser should (ideally) then call \pgfmathXXX@. +% +% It is also recommened that all calculations (where necessary) +% take place within a TeX group. \pgfmath@returnone#1 makes and +% expanded version of #1 global and stores this in \pgfmathresult +% after the group is ended. +% + +\input pgfmathtrig.code.tex% Load the trig. stuff. +\input pgfmathrnd.code.tex% Load the random stuff. + + +% \pgfmathadd +% +% Add #1 and #2. +% +\def\pgfmathadd#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathadd@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathadd@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x by\pgfmath@y% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathsubtract +% +% Subtract #2 from #1. +% +\def\pgfmathsubtract#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathsubtract@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathsubtract@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x-\pgfmath@y% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathmultiply +% +% Multiply #1 by #2. +% +\def\pgfmathmultiply#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathmultiply@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathmultiply@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathdivide +% +% Divide #1 by #2. +% +\def\pgfmathdivide#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathdivide@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathdivide@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \def\pgfmath@sign{}% + \ifdim\pgfmath@y=0pt\relax% + \pgfmath@error{You've asked me to divide `#1' by `#2', % + but I cannot divide any number by `#2'}% + \fi% + \afterassignment\pgfmath@xa% + \expandafter\c@pgfmath@counta\the\pgfmath@y\relax% + % + % If y is an integer, use TeX arithmatic. + % + \ifdim\pgfmath@xa=0pt\relax% + \divide\pgfmath@x\c@pgfmath@counta\relax% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \let\pgfmath@next\pgfmathdivide@@@% + \else% + % + % Simple long division. + % + \ifdim\pgfmath@x<0pt\relax% + \def\pgfmath@sign{-}% + \pgfmath@x-\pgfmath@x% + \fi% + \ifdim\pgfmath@y<0pt\relax% + \edef\pgfmath@sign{\pgfmath@sign-}% + \pgfmath@y-\pgfmath@y% + \fi% + \pgfmath@ya\pgfmath@y% + \c@pgfmath@counta0\relax% + \ifdim\pgfmath@x>\pgfmath@ya% + \ifdim\pgfmath@ya<1638.4pt\relax% + \pgfmathmultiply@dimenbyten\pgfmath@ya% + \ifdim\pgfmath@ya>\pgfmath@x% + \pgfmathdivide@dimenbyten\pgfmath@ya% + \c@pgfmath@counta0\relax% + \else% + \ifdim\pgfmath@ya<1638.4pt\relax% + \pgfmathmultiply@dimenbyten\pgfmath@ya% + \ifdim\pgfmath@ya>\pgfmath@x% + \pgfmathdivide@dimenbyten\pgfmath@ya% + \c@pgfmath@counta1\relax% + \else% + \ifdim\pgfmath@ya<1638.4pt\relax% + \pgfmathmultiply@dimenbyten\pgfmath@ya% + \ifdim\pgfmath@ya>\pgfmath@x% + \pgfmathdivide@dimenbyten\pgfmath@ya% + \c@pgfmath@counta2\relax% + \else% + \ifdim\pgfmath@ya<1638.4pt\relax% + \pgfmathmultiply@dimenbyten\pgfmath@ya% + \ifdim\pgfmath@ya>\pgfmath@x% + \pgfmathdivide@dimenbyten\pgfmath@ya% + \c@pgfmath@counta3\relax% + \else% + \pgfmath@error{The result of `#1/#2' is too big for me}{}% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + % + % If y < 1pt use reciprocal operation. + % + \ifdim\pgfmath@y<1pt\relax% + \ifdim\pgfmath@y<.00007pt\relax% + \pgfmath@error{The result of `#1/#2' is too big for me}{}% + \fi% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% + \pgfmath@x\pgfmathresult\pgfmath@x% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \let\pgfmath@next\pgfmathdivide@@@% + \else% + \pgfmath@y\pgfmath@ya% + \def\pgfmathresult{}% + \let\pgfmath@next\pgfmathdivide@@% + \fi% + \fi% + \pgfmath@next% +} + +\def\pgfmathdivide@dimenbyten#1{% + \edef\pgfmath@temp{\pgfmath@tonumber{#1}}% + \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@} +\def\pgfmathdivide@@dimenbyten#1.#2\@@#3\@@{% + \pgfmath@tempcnta#1\relax% + \divide\pgfmath@tempcnta10\relax% + \pgfmath@tempcntb\pgfmath@tempcnta% + \multiply\pgfmath@tempcnta-10\relax% + \advance\pgfmath@tempcnta#1\relax% + #3\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax% +} + +\def\pgfmathmultiply@dimenbyten#1{% + \edef\pgfmath@temp{\pgfmath@tonumber{#1}}% + \expandafter\pgfmathmultiply@@dimenbyten\pgfmath@temp\@@#1\@@} +\def\pgfmathmultiply@@dimenbyten#1.#2#3\@@#4\@@{#4#1#2.#3pt\relax} + +\def\pgfmathdivide@@{% + \ifdim\pgfmath@x>\pgfmath@y% + \pgfmath@yb6.0\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 6*y + \advance\pgfmath@yb-\pgfmath@y% + \advance\pgfmath@yb-\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 4*y + \advance\pgfmath@yb-\pgfmath@y% + \advance\pgfmath@yb-\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 2*y + \advance\pgfmath@yb-\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 1*y + \c@pgfmath@countb0\relax% + \else% + \c@pgfmath@countb1\relax% + \fi% + \else% + \advance\pgfmath@yb\pgfmath@y% 3*y + \ifdim\pgfmath@yb>\pgfmath@x% + \c@pgfmath@countb2\relax% + \else% + \c@pgfmath@countb3\relax% + \fi% + \fi% + \else% + \advance\pgfmath@yb\pgfmath@y% 5*y + \ifdim\pgfmath@yb>\pgfmath@x% + \c@pgfmath@countb4\relax% + \else% + \c@pgfmath@countb5\relax% + \fi% + \fi% + \else% + \advance\pgfmath@yb\pgfmath@y% + \advance\pgfmath@yb\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 8*y + \advance\pgfmath@yb-\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 7*y + \c@pgfmath@countb6\relax% + \else% + \c@pgfmath@countb7\relax% + \fi% + \else% + \advance\pgfmath@yb\pgfmath@y% + \ifdim\pgfmath@yb>\pgfmath@x% 9*y + \c@pgfmath@countb8\relax% + \else% + \c@pgfmath@countb9\relax% + \fi% + \fi% + \fi% + \else% + \c@pgfmath@countb=0\relax% + \fi% + \ifnum\c@pgfmath@countb=0\relax% + \edef\pgfmathresult{\pgfmathresult0}% + \else% + \pgfmath@yb\c@pgfmath@countb\pgfmath@y% + \advance\pgfmath@x-\pgfmath@yb% + \edef\pgfmathresult{\pgfmathresult\the\c@pgfmath@countb}% + \fi% + \pgfmathdivide@dimenbyten\pgfmath@y% + \ifnum\c@pgfmath@counta=0\relax% + \edef\pgfmathresult{\pgfmathresult.}% + \fi% + \advance\c@pgfmath@counta-1\relax% + \ifdim\pgfmath@y=0pt\relax% + \let\pgfmath@next\pgfmathdivide@@@% + \else% + \let\pgfmath@next\pgfmathdivide@@% + \fi% + \pgfmath@next% +} + +\def\pgfmathdivide@@@{% + \pgfmath@x\pgfmath@sign\pgfmathresult pt\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + + +% \pgfmathgreaterthan +% +% 1.0 if #1 > #2. Otherwise 0.0 +% +\def\pgfmathgreaterthan#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathgreaterthan@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathgreaterthan@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x-\pgfmath@y% + \ifdim\pgfmath@x>0pt\relax% + \pgfmath@x1pt\relax% + \else% + \pgfmath@x0pt\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathlessthan +% +% 1.0 if #1< #2. Otherwise 0.0 +% +\def\pgfmathlessthan#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathlessthan@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathlessthan@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x-\pgfmath@y\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x1pt\relax% + \else% + \pgfmath@x0pt\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathequalto +% +% 1.0 if #1 = #2. Otherwise 0.0 +% +\def\pgfmathequalto#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathequalto@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathequalto@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x-\pgfmath@y% + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@x1pt\relax% + \else% + \pgfmath@x0pt\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathreciprocal +% +% 1 / #1 +% +\def\pgfmathreciprocal#1{% + \pgfmathparse{#1}% + \pgfmathreciprocal@{\pgfmathresult}} +\def\pgfmathreciprocal@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}% + \fi% + \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}% + \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@} +\def\pgfmathreciprocal@@#1.#2#3#4#5#6#7\pgfmath@{% + \c@pgfmath@counta#2#3#4#5#6\relax% + % If the number is an integer, use TeX arithmatic. + \ifnum\c@pgfmath@counta=0\relax% + \pgfmath@x1pt\relax% + \divide\pgfmath@x#1\relax% + \else% + \ifnum#1>100\relax% + \c@pgfmath@counta#1#2#3#4\relax% + \c@pgfmath@countb1000000000\relax% + \divide\c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countb% + \divide\c@pgfmath@counta10000\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \multiply\c@pgfmath@counta-10000\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \pgfmath@y\c@pgfmath@countb pt\relax% + \divide\pgfmath@y1000000\relax% + \advance\pgfmath@x\pgfmath@y% + \else% + \c@pgfmath@counta#1#2#3#4#5#6\relax% + \c@pgfmath@countb1000000000\relax% + \divide\c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countb% + \divide\c@pgfmath@counta10000\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \multiply\c@pgfmath@counta-10000\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \pgfmath@y\c@pgfmath@countb pt\relax% + \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure... + \pgfmath@y.1\pgfmath@y% + \pgfmath@y.1\pgfmath@y% + \pgfmath@y.1\pgfmath@y% + \advance\pgfmath@x\pgfmath@y% + \fi% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathln +% +% Calculate ln(#1} +% +% This is based on an algorithm due to Rouben Rostamian and +% uses coefficients contributed by Alain Matthes. +% +\def\pgfmathln#1{\pgfmathparse{#1}\pgfmathln@{\pgfmathresult}} +\def\pgfmathln@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x>0pt\else% + \pgfmath@error{I cannot calculate the logarithm of `#1'}{}% + \fi% + \c@pgfmath@counta0\relax% + \ifdim\pgfmath@x>2pt\relax% + \ifdim\pgfmath@x<128pt\relax% + \ifdim\pgfmath@x<8pt\relax% + \ifdim\pgfmath@x<4pt\relax% + \divide\pgfmath@x2\relax% + \c@pgfmath@counta1\relax% + \else% + \divide\pgfmath@x4\relax% + \c@pgfmath@counta2\relax% + \fi% + \else% + \ifdim\pgfmath@x<32pt\relax% + \ifdim\pgfmath@x<16pt\relax% + \divide\pgfmath@x8\relax% + \c@pgfmath@counta3\relax% + \else% + \divide\pgfmath@x16\relax% + \c@pgfmath@counta4\relax% + \fi% + \else% + \ifdim\pgfmath@x<64pt\relax% + \divide\pgfmath@x32\relax% + \c@pgfmath@counta5\relax% + \else% + \divide\pgfmath@x64\relax% + \c@pgfmath@counta6\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<2048pt\relax% + \ifdim\pgfmath@x<512pt\relax% + \ifdim\pgfmath@x<256pt\relax% + \divide\pgfmath@x128\relax% + \c@pgfmath@counta7\relax% + \else% + \divide\pgfmath@x256\relax% + \c@pgfmath@counta8\relax% + \fi% + \else% + \ifdim\pgfmath@x<1024pt\relax% + \divide\pgfmath@x512\relax% + \c@pgfmath@counta9\relax% + \else% + \divide\pgfmath@x1024\relax% + \c@pgfmath@counta10\relax% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<8192pt\relax% + \ifdim\pgfmath@x<4096pt\relax% + \divide\pgfmath@x2048\relax% + \c@pgfmath@counta11\relax% + \else% + \divide\pgfmath@x4096\relax% + \c@pgfmath@counta12\relax% + \fi% + \else% + \divide\pgfmath@x8192\relax% + \c@pgfmath@counta13\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<1pt\relax% + \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7 + \ifdim\pgfmath@x>0.125pt\relax% 2^-3 + \ifdim\pgfmath@x>0.5pt\relax% 2^-1 + \multiply\pgfmath@x2\relax% + \c@pgfmath@counta-1\relax% + \else% + \multiply\pgfmath@x4\relax% + \c@pgfmath@counta-2\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.03125pt\relax% 2^-5 + \ifdim\pgfmath@x>0.0625pt\relax% + \multiply\pgfmath@x8\relax% + \c@pgfmath@counta-3\relax% + \else% + \multiply\pgfmath@x16\relax% + \c@pgfmath@counta-4\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.015625pt\relax% 2^-6 + \multiply\pgfmath@x32\relax% + \c@pgfmath@counta-5\relax% + \else% + \multiply\pgfmath@x64\relax% + \c@pgfmath@counta-6\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11 + \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9 + \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8 + \multiply\pgfmath@x128\relax% + \c@pgfmath@counta-7\relax% + \else% + \multiply\pgfmath@x256\relax% + \c@pgfmath@counta-8\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10 + \multiply\pgfmath@x512\relax% + \c@pgfmath@counta-9\relax% + \else% + \multiply\pgfmath@x1024\relax% + \c@pgfmath@counta-10\relax% + \fi% + \fi% + \else% + \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13 + \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12 + \multiply\pgfmath@x2048\relax% + \c@pgfmath@counta-11\relax% + \else% + \multiply\pgfmath@x4096\relax% + \c@pgfmath@counta-12\relax% + \fi% + \else% + \multiply\pgfmath@x8192\relax% + \c@pgfmath@counta-13\relax% + \fi% + \fi% + \fi% + \fi% + \fi% + % + % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x + % + % where: + % A = -2.787927935 + % B = 5.047861502 + % C = -3.489886985 + % D = 1.589480044 + % E = -.4025153233 + % F = 0.04300521312 + % + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@x0.04300521312\pgfmath@x% + \advance\pgfmath@x-.4025153233pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x1.589480044pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x-3.489886985pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x5.047861502pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x-2.787927935pt\relax% + \advance\pgfmath@x\c@pgfmath@counta pt\relax% + \pgfmath@x0.6931471806\pgfmath@x% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathabs +% +% Calculate |#1| +% +\def\pgfmathabs#1{% + \pgfmathparse{#1}% + \pgfmathabsolute@{\pgfmathresult}} +\def\pgfmathabs@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathmod +% +% Calculate #1 mod #2. +% +\def\pgfmathmod#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathmod@{\pgfmathresult}{\pgfmath@arg}% +} +\def\pgfmathmod@#1#2{% + \begingroup% + \pgfmath@xa#1pt% + \pgfmath@xb#2pt% + \pgfmath@x\pgfmath@xa% + \c@pgfmath@counta\pgfmath@xa% + \c@pgfmath@countb\pgfmath@xb% + \divide\c@pgfmath@counta\c@pgfmath@countb% + \multiply\pgfmath@xb\c@pgfmath@counta% + \advance\pgfmath@x-\pgfmath@xb% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathsqrt +% +% Square-root of #1. +% +% +\def\pgfmathsqrt#1{\pgfmathparse{#1}\pgfmathsqrt@{\pgfmathresult}} +\def\pgfmathsqrt@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}% + \else% + \ifdim\pgfmath@x<10pt\relax% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{1}% + \else% + \ifdim\pgfmath@x<100pt\relax% + \def\pgfmath@zeros{}% + \def\pgfmath@targetiterations{1}% + \else% + \ifdim\pgfmath@x<1000pt\relax% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{2}% + \else% + \ifdim\pgfmath@x<10000pt\relax% + \def\pgfmath@zeros{}% + \def\pgfmath@targetiterations{2}% + \else% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{3}% + \fi\fi\fi\fi\fi% + \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}% + \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@% +} +\def\pgfmath@sqrt@#1.#2\pgfmath@{\pgfmath@@sqrt@#1#2\pgfmath@empty\pgfmath@empty\pgfmath@} + +\def\pgfmath@@sqrt@#1#2{% + \c@pgfmath@countb#1#2\relax% + \ifnum\c@pgfmath@countb>35\relax% + \ifnum\c@pgfmath@countb>63\relax% + \ifnum\c@pgfmath@countb>80\relax% + \c@pgfmath@counta9\relax% + \else% + \c@pgfmath@counta8\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>48\relax% + \c@pgfmath@counta7\relax% + \else% + \c@pgfmath@counta6\relax% + \fi% + \fi% + \else% + \ifnum\c@pgfmath@countb>15\relax% + \ifnum\c@pgfmath@countb>24\relax% + \c@pgfmath@counta5\relax% + \else% + \c@pgfmath@counta4\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>3\relax% + \ifnum\c@pgfmath@countb>8\relax% + \c@pgfmath@counta3\relax% + \else% + \c@pgfmath@counta2\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>0\relax% + \c@pgfmath@counta1\relax% + \else% + \c@pgfmath@counta0\relax% + \fi% + \fi% + \fi% + \fi% + \edef\pgfmath@root{\the\c@pgfmath@counta}% + \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}% + \multiply\c@pgfmath@counta-\c@pgfmath@counta\relax% + \advance\c@pgfmath@counta#1#2\relax% + \edef\pgfmath@remainder{\the\c@pgfmath@counta}% + \pgfmath@@@sqrt@% +} + +\def\pgfmath@@@sqrt@#1#2{% + \ifx\pgfmath@empty#1% + \edef\pgfmath@remainder{\pgfmath@remainder00}% + \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% + \else% + \ifx\pgfmath@empty#2% + \edef\pgfmath@remainder{\pgfmath@remainder#10}% + \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% + \else% + \edef\pgfmath@remainder{\pgfmath@remainder#1#2}% + \def\pgfmath@tokens{}% + \fi\fi% + \c@pgfmath@counta\pgfmath@rootspecial\relax% + \multiply\c@pgfmath@counta20\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \multiply\c@pgfmath@countb6\relax% + \advance\c@pgfmath@countb36\relax% + \c@pgfmath@countc\c@pgfmath@counta\relax% + \multiply\c@pgfmath@countc2\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb-\c@pgfmath@countc% + \advance\c@pgfmath@countb-20\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb-\c@pgfmath@countc% + \advance\c@pgfmath@countb-12\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb-\c@pgfmath@counta% + \advance\c@pgfmath@countb-3\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{0}% + \else% + \def\pgfmath@digit{1}% + \fi% + \else% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb5\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{2}% + \else% + \def\pgfmath@digit{3}% + \fi% + \fi% + \else% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb9\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{4}% + \else% + \def\pgfmath@digit{5}% + \fi% + \fi% + \else% + \advance\c@pgfmath@countb\c@pgfmath@countc% + \advance\c@pgfmath@countb28\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb-\c@pgfmath@counta% + \advance\c@pgfmath@countb-15\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{6}% + \else% + \def\pgfmath@digit{7}% + \fi% + \else% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb17\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{8}% + \else% + \def\pgfmath@digit{9}% + \fi% + \fi% + \fi% + \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}% + \advance\c@pgfmath@counta\pgfmath@digit\relax% + \multiply\c@pgfmath@counta-\pgfmath@digit\relax% + \advance\c@pgfmath@counta\pgfmath@remainder\relax% + \edef\pgfmath@remainder{\the\c@pgfmath@counta}% + \c@pgfmath@counta\pgfmath@targetiterations\relax% + \advance\c@pgfmath@counta-1\relax% + \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}% + \ifnum\c@pgfmath@counta=0\relax% + \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}% + \else% + \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}% + \fi% + \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision. + \let\pgfmath@next\pgfmath@sqrt@end% + \else% + \let\pgfmath@next\pgfmath@@@sqrt@% + \fi% + \expandafter\pgfmath@next\pgfmath@tokens% +} + +\def\pgfmath@sqrt@end#1\pgfmath@{% + \edef\pgfmathresult{\pgfmath@root}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup} + +% \pgfmathpow +% +% Calculates #1 ^ #2 +% +\def\pgfmathpow#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathpow@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathpow@#1#2{% + \begingroup% + \pgfmath@xa#1pt% + \pgfmath@xb#2pt% + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\the\pgfmath@xb\relax% + \ifnum\c@pgfmath@counta<0\relax% + \c@pgfmath@counta-\c@pgfmath@counta% + \pgfmathreciprocal@{#1}% + \pgfmath@xa\pgfmathresult pt\relax% + \fi + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@x1pt\relax% + \pgfmathloop% + \ifnum\c@pgfmath@counta>0\relax% + \ifodd\c@pgfmath@counta% + \pgfmath@x\pgfmath@tonumber{\pgfmath@x}\pgfmath@xa% + \fi + \ifnum\c@pgfmath@counta>1\relax% + \pgfmath@xa\pgfmath@tonumber{\pgfmath@xa}\pgfmath@xa% + \fi% + \divide\c@pgfmath@counta2\relax% + \repeatpgfmathloop% + \else% + \pgfmathln@{#1}% + \pgfmath@x\pgfmathresult pt\relax% + \pgfmath@x\pgfmath@tonumber{\pgfmath@xb}\pgfmath@x% + \pgfmathexp@{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@x\pgfmathresult pt\relax% + \fi% + \pgfmath@returnone\pgf@x% + \endgroup% +} + +% \pgfmathround +% +% Asymmetric Half-up rounding. +% +\def\pgfmathround#1{\pgfmathparse{#1}\pgfmathround@{\pgfmathresult}} +\def\pgfmathround@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@xa% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + \pgfmath@xb\pgfmath@x% + \ifdim\pgfmath@xb<0pt\relax% + \ifdim\pgfmath@xa<0.5pt\relax% + \else% + \advance\c@pgfmath@counta-1\relax% + \fi% + \else% + \ifdim\pgfmath@xa<0.5pt\relax% + \else% + \advance\c@pgfmath@counta1\relax% + \fi% + \fi% + \pgfmath@returnone\the\c@pgfmath@counta pt% + \endgroup% +}% + +% \pgfmathfloor +% +% Floor function. +% +\def\pgfmathfloor#1{\pgfmathparse{#1}\pgfmathfloor@{\pgfmathresult}} +\def\pgfmathfloor@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \pgfmath@x\c@pgfmath@counta pt\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +% \pgfmathceil +% +% Ceiling function. +% +\def\pgfmathceil#1{\pgfmathparse{#1}\pgfmathceil@{\pgfmathresult}} +\def\pgfmathceil@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \pgfmath@y\pgfmath@x% + \advance\pgfmath@y-\c@pgfmath@counta pt\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \ifdim\pgfmath@y>0pt\relax% + \advance\pgfmath@x1pt\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +% \pgfmathexp +% +% A Maclaurens expansion for e^#1. +% 0 <= #1 < ln(16384). +% +\def\pgfmathexp#1{\pgfmathparse{#1}\pgfmathexp@{\pgfmathresult}} +\def\pgfmathexp@#1{% + \begingroup% + \edef\pgfmath@arg{#1}% + \pgfmath@x1pt\relax% + \pgfmath@xa1pt\relax% + \pgfmath@xb\pgfmath@x% + \pgfmathloop% + \pgfmath@xc\pgfmathcounter pt\relax% + \c@pgfmath@counta\pgfmath@xc% + \divide\c@pgfmath@counta65536\relax% + \pgfmath@xc1pt\relax% + \divide\pgfmath@xc\c@pgfmath@counta% + \pgfmath@xa\pgfmath@tonumber{\pgfmath@xc}\pgfmath@xa% + \expandafter\pgfmath@xa\pgfmath@arg\pgfmath@xa% + \advance\pgfmath@x\pgfmath@xa% + \ifdim\pgfmath@x=\pgfmath@xb% + \else% + \pgfmath@xb\pgfmath@x% + \repeatpgfmathloop% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + + + +% \pgfmathvectorlength +% +% Calcluate the Eulidean length of a 2D vector. +% +% This based on polynomial approximation co-efficents +% contributed by Rouben Rostamian. +% +% #1 - the x component of the vector. +% #2 - the y component of the vector. +% +\def\pgfmathveclen#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathveclen@{\pgfmathresult}{\pgfmath@arg}% +} +\def\pgfmathveclen@#1#2{% + \begingroup% + \pgfmath@x#1pt\relax% + \pgfmath@y#2pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \ifdim\pgfmath@y<0pt\relax% + \pgfmath@y-\pgfmath@y% + \fi% + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@x\pgfmath@y% + \else% + \ifdim\pgfmath@y=0pt\relax% + \else% + \ifdim\pgfmath@x>\pgfmath@y% + \pgfmath@xa\pgfmath@x% + \pgfmath@x\pgfmath@y% + \pgfmath@y\pgfmath@xa% + \fi% + % We use a scaling factor to reduce errors. + \ifdim\pgfmath@y>10000pt\relax% + \c@pgfmath@counta1500\relax% + \else% + \ifdim\pgfmath@y>1000pt\relax% + \c@pgfmath@counta150\relax% + \else% + \ifdim\pgfmath@y>100pt\relax% + \c@pgfmath@counta50\relax% + \else% + \c@pgfmath@counta1\relax% + \fi% + \fi% + \fi% + \divide\pgfmath@x\c@pgfmath@counta\relax% + \divide\pgfmath@y\c@pgfmath@counta\relax% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% + \pgfmath@x\pgfmathresult\pgfmath@x% + \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x% + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}% + % + % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2))) + % where + % A = +1.000012594 + % B = +0.4993615349 + % C = -0.1195159052 + % D = +0.04453994279 + % E = -0.01019210944 + % + \pgfmath@x-0.01019210944\pgfmath@xa% + \advance\pgfmath@x0.04453994279pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x-0.1195159052pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x0.4993615349pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x1.000012594pt\relax% + \ifdim\pgfmath@y<0pt\relax% + \pgfmath@y-\pgfmath@y% + \fi% + \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x% + % Invert the scaling factor. + \multiply\pgfmath@x\c@pgfmath@counta\relax% + \fi% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathmax +% +% Return the maximum of #1 or #2 +% +\def\pgfmathmax#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathmax@{\pgfmathresult}{\pgfmath@arg}}% +\def\pgfmathmax@#1#2{% + \begingroup + \pgfmath@x#1pt% + \pgfmath@y#2pt\relax% + \ifdim\pgfmath@x>\pgfmath@y% + \pgfmath@returnone\pgfmath@x% + \else% + \pgfmath@returnone\pgfmath@y% + \fi% + \endgroup +} + +% \pgfmathmax +% +% Return the minimim of #1 or #2 +% +\def\pgfmathmin#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathmin@{\pgfmathresult}{\pgfmath@arg}}% +\def\pgfmathmin@#1#2{% + \begingroup + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \relax% + \ifdim\pgfmath@x<\pgfmath@y% + \pgfmath@returnone\pgfmath@x% + \else% + \pgfmath@returnone\pgfmath@y% + \fi% + \endgroup% +} + +% \pgfmathscientific +% +% Return the value of #1e#2 +% +% e.g. \pgfmathscientific{1.23456789123}{4} +% +% defines \pgfmathresult as 12345.67891 +% +% NB These arguments *are not parsed*, as the long mantissa would be lost. +% +\def\pgfmathscientific#1#2{% + \begingroup% + \edef\pgfmath@sci@exponent{#2}% + \pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \edef\pgfmath@sci@sign{-}% + \edef\pgfmath@temp{\pgfmath@gobbleone#1}% + \else% + \edef\pgfmath@sci@sign{+}% + \edef\pgfmath@temp{#1}% + \fi% + \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@} + +\def\pgfmath@scientific@@#1.#2#3#4#5#6{% + \edef\pgfmath@sci@int{#1}% + \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}% + \pgfmath@scientific@@@} + +\def\pgfmath@scientific@@@#1#2#3#4#5#6\pgfmath@{% + \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}% + \c@pgfmath@counta\pgfmath@sci@exponent\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \ifnum\c@pgfmath@counta<0\relax% + \c@pgfmath@counta-\c@pgfmath@counta% + \fi% + \pgfmathpow@{10}{\the\c@pgfmath@counta}% + \afterassignment\pgfmath@gobbletilpgfmath@ + \c@pgfmath@countc\pgfmathresult\relax\pgfmath@ + \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}% + \ifnum\c@pgfmath@countb<0\relax% + % xE-y: easy... + \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax% + \divide\pgfmath@x\pgfmath@sci@factor\relax% + \else% + % xE+y: + % Must do this way so as not lose digits in a long mantissa. Sigh... + \c@pgfmath@counta\pgfmath@sci@int% + \c@pgfmath@countb\pgfmath@sci@mantissaA% + \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax% + \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% + \c@pgfmath@countc\c@pgfmath@countb% + \divide\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@counta\c@pgfmath@countb% + \multiply\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@countc-\c@pgfmath@countb% + \c@pgfmath@countb\pgfmath@sci@mantissaB\relax% + \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% + \divide\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@countc\c@pgfmath@countb% + \advance\c@pgfmath@countc100000\relax% + \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}% + \pgfmath@x\pgfmath@sci@result\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup} + + + + + +% *** The following commands DO NOT WORK without the rest of PGF *** +% +% (a dumping ground for stuff that doesn't really belong anywhere else) + +% \pgfmathanglebetweenpoints +% +% Define \pgfmathresult as the angle between points #1 and #2 +% Should get the quadrants right as well. +% +\def\pgfmathanglebetweenpoints#1#2{% + \begingroup% + \pgf@process{\pgfpointdiff{#1}{#2}}% + % + % First approximate the angle of the external point... + % + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \ifdim\pgf@xa<0pt\relax% + \pgf@xa-\pgf@xa% + \fi% + \ifdim\pgf@ya<0pt\relax% + \pgf@ya-\pgf@ya% + \fi% + \ifdim\pgf@ya>\pgf@xa% + \pgf@x\pgf@xa% + \pgf@y\pgf@ya% + \else% + \pgf@x\pgf@ya% + \pgf@y\pgf@xa% + \fi% + \ifdim\pgf@y=0pt\relax% + \pgf@x0pt% + \else% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@y}}% + \pgf@x\pgfmathresult\pgf@x% + \fi% + \multiply\pgf@x1000\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgf@counta\the\pgf@x\relax\pgfmath@% + \expandafter\pgf@x\csname pgfmath@atan@\the\c@pgf@counta\endcsname pt\relax% + \ifdim\pgfmath@ya>\pgfmath@xa\relax% + \pgf@x-\pgf@x% + \advance\pgf@x90pt% + \fi% + \ifdim\pgf@xb<0pt% + \ifdim\pgf@yb>0pt% + \pgf@x-\pgf@x% + \fi% + \advance\pgf@x180pt\relax% + \else% + \ifdim\pgf@yb<0pt% + \pgf@x-\pgf@x% + \advance\pgf@x360pt\relax% + \fi\fi% + \pgfmath@returnone\pgf@x% + \endgroup% +} + +% +% \pgfmathrotatepointaround +% +% Rotate point #1 about point #2 by #3 degrees. +% +\def\pgfmathrotatepointaround#1#2#3{% + \pgf@process{% + \pgf@process{#2}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \pgf@process{#1}% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + \pgfmathsetmacro\angle{#3}% + \pgfmathsin@{\angle}% + \let\sineangle\pgfmathresult% + \pgfmathcos@{\angle}% + \let\cosineangle\pgfmathresult% + \pgf@xa\cosineangle\pgf@x% + \advance\pgf@xa-\sineangle\pgf@y% + \pgf@ya\sineangle\pgf@x% + \advance\pgf@ya\cosineangle\pgf@y% + \pgf@x\pgf@xb% + \pgf@y\pgf@yb% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% +} + +% \pgfmathanglebetweenlines +% +% Calculate the clockwise angle between a line from point #1 +% to point #2 and a line from #3 to point #4. +% +\def\pgfmathanglebetweenlines#1#2#3#4{% + \begingroup% + \pgfmathanglebetweenpoints{#1}{#2}% + \let\firstangle\pgfmathresult% + \pgfmathanglebetweenpoints{#3}{#4}% + \let\secondangle\pgfmathresult% + \ifdim\firstangle pt>\secondangle pt\relax% + \pgfmathadd@{\secondangle}{360}% + \let\secondangle\pgfmathresult% + \fi% + \pgfmathsubtract@{\secondangle}{\firstangle}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% \pgfmathpointreflectalongaxis +% +% Reflects point #2 around an axis centered on #2 at an angle #3. +% +\def\pgfmathreflectpointalongaxis#1#2#3{% + \pgf@process{% + \pgfmathanglebetweenpoints{#2}{#1}% + \pgfmath@tempdima\pgfmathresult pt\relax% + \pgfmathparse{#3}% + \advance\pgfmath@tempdima-\pgfmathresult pt\relax% + \pgfmath@tempdima-2.0\pgfmath@tempdima% + \pgfmathrotatepointaround{#1}{#2}{\pgfmath@tonumber{\pgfmath@tempdima}}% + }% +} + + +% \pgfmathpointintersectionoflineandarc +% +% A bit experimental at the moment: +% +% Locates the point where a line crosses an eliptical arc. If the line +% does not cross the arc, a meaningless point will result. +% +% #1 the point of the line on the "convex" side of the arc. +% #2 the point of the line on the "concave" side of the arc. +% #3 the center of the eliptical arc. +% #4 start angle of the arc. +% #5 end angle of the arc. +% #6 radii of the arc. +% +\def\pgfmathpointintersectionoflineandarc#1#2#3#4#5#6{% + \pgf@process{% + % + % Get the required angle. + % + \pgfmathanglebetweenpoints{#2}{#1}% + \let\x\pgfmathresult% + % + % Get the radii of the arc. + % + \pgfmath@in@{and }{#6}% + \ifpgfmath@in@% + \pgf@polar@#6\@@% + \else% + \pgf@polar@#6 and #6\@@% + \fi% + \edef\xarcradius{\the\pgf@x}% + \edef\yarcradius{\the\pgf@y}% + % + % Get the start and end angles of the arc... + % + \pgfmathsetmacro\s{#4}% + \pgfmathsetmacro\e{#5}% + % + % ...and also with rounding. + % + \pgfmathmod@{\s}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\ss\pgfmathresult% + \pgfmathmod@{\e}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\ee\pgfmathresult% + % + % Hackery for when arc straddles zero. + % + \ifdim\ee pt<\ss pt\relax% + \pgfmathadd@{\x}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \let\x\pgfmathresult% + \fi% + \def\m{360}% Measure of nearness. + \pgfmathadd@{\s}{\e}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\n\pgfmathresult% The best estimate (default to middle of arc). + \pgfmathloop% + \pgfmathadd@{\s}{\e}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\p\pgfmathresult% + \ifdim\p pt=\s pt\relax% + \else% + \pgfmathanglebetweenpoints{#2}{% + \pgfpointadd{#3}{% + \pgf@x\xarcradius\relax% + \pgfmathcos@{\p}% + \pgf@x\pgfmathresult\pgf@x% + \pgf@y\yarcradius\relax% + \pgfmathsin@{\p}% + \pgf@y\pgfmathresult\pgf@y% + }% + }% + % + % Hackery for when arc straddles zero. + % + \ifdim\ee pt<\ss pt\relax% + \pgfmathadd@{\pgfmathresult}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \fi% + \let\q\pgfmathresult% + % + % More hackery... + % + \ifdim\x pt>335pt\relax% + \ifdim\q pt<45pt\relax% + \pgfmathadd@{\q}{360}% + \let\q\pgfmathresult% + \fi% + \fi% + \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% + \pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}% + }% +} + +% \pgfmathangleonellipse +% +% Find the angle corresponding to a point on the border of an ellispe. +% +% #1 - the point on the border. +% #2 - the radii of the ellipse. +% +\def\pgfmathangleonellipse#1#2{% + \begingroup% + \pgfmath@in@{and }{#2}% + \ifpgfmath@in@% + \pgf@polar@#2\@@% + \else% + \pgf@polar@#2 and #2\@@% + \fi% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@process{#1}% + \ifdim\pgf@x=0pt\relax% + \pgfutil@tempdima1pt\relax% + \else% + \pgfutil@tempdima\pgf@x% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdima\pgfmathresult pt\relax% + \fi% + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima1pt\relax% + \else% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@y}}{\pgfmath@tonumber{\pgf@ya}}% + \pgfutil@tempdima\pgfmathresult\pgfutil@tempdima% + \pgfmathatan@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \fi% + % + \pgfutil@tempdima\pgfmathresult pt\relax% + \ifdim\pgfutil@tempdima<0pt\relax% + \advance\pgfutil@tempdima360pt\relax% + \fi% + \ifdim\pgf@x<0pt\relax% + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima180pt\relax% + \else% + \ifdim\pgf@y<0pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \else% + \advance\pgfutil@tempdima-180pt\relax% + \fi% + \fi% + \else% + \ifdim\pgf@x=0pt\relax% + \ifdim\pgf@y<0pt\relax% + \pgfutil@tempdima270pt\relax% + \else% + \pgfutil@tempdima90pt\relax% + \fi% + \else% + \ifdim\pgf@y=0pt\relax% + \pgfutil@tempdima0pt\relax% + \fi% + \fi% + \fi% + \pgfmath@returnone\pgfutil@tempdima% + \endgroup% +} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex new file mode 100644 index 00000000000..3d69d34b73c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex @@ -0,0 +1,970 @@ +% Copyright 2007 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. + +% This file parses/evaluates a decimal expression. +% +% Version 1.414213 29/9/2007 + +% \pgfmathparse, \pgfmathqparse +% +% Evaluates a decimal expression. +% +% #1 - the expression. +% +% returns +% +% x = the result as a dimension. +% +% E.g. +% \pgfmathparse{3pt*2cm+1.5} +% \pgfmathqparse{3pt*2cm+1.5pt} +% +% Every number in \pgfmathqparse *must* +% specify a unit. +% +\newif\ifpgfmath@quickparse + +\def\pgfmathparse{% + \pgfmath@quickparsefalse% + \pgfmathparse@} + +\def\pgfmathqparse{% + \pgfmath@quickparsetrue% + \pgfmathparse@} + +\def\pgfmath@calcreal#1{#1}% +\def\pgfmath@calcminof#1#2{min(#1,#2)}% +\def\pgfmath@calcmaxof#1#2{max(#1,#2)}% +\def\pgfmath@calcratio#1#2{#1/#2}% + +\def\pgfmathparse@#1{% + \begingroup% + % Reinstall correct font, so that dimensions like 1em are correct + \pgfmath@selectfont% + \let\real\pgfmath@calcreal% + \let\minof\pgfmath@calcminof% + \let\maxof\pgfmath@calcmaxof% + \let\ratio\pgfmath@calcratio% + \edef\pgfmath@temp{#1}% + \pgfmath@resetparsingparameters% + \global\pgfmathunitsdeclaredfalse% + \ifpgfmath@quickparse% + \let\pgfmath@parseoperand\pgfmath@quickparseoperand% + \else% + \let\pgfmath@parseoperand\pgfmath@parseoperand% + \fi% + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \expandafter\pgfmath@parse@\pgfmath@temp @@@@@@@@@@@\pgfmath@empty} + + +% \pgfmath@resetparsingparameters +% +% Reset the stack at the begining of the parse/group. +% +\def\pgfmath@resetparsingparameters{% + \pgfmath@stack{\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}% + \def\pgfmath@stacknextoperator{\pgfmath@empty}% Will not work with \let +} +% \pgfmath@parse@ +% +% Start parsing. Expect one of +% 1) the end of the parse +% 2) the start of a group +% 3) a (possible) operand. +% +\def\pgfmath@parse@#1{% + \def\pgfmath@token{}% + \ifx#1@% + \let\pgfmath@parsenext\pgfmath@endparse% + \else% + \ifx#1(% + \let\pgfmath@parsenext\pgfmath@startparsegroup% + \else% + \edef\pgfmath@token{#1}% + \let\pgfmath@parsenext\pgfmath@parseoperand% + \fi\fi% + \pgfmath@parsenext% +} + +% If no TeX units are declared *at any point* in the parse +% the result is scaled by \pgfmathresultunitscale. +\newif\ifpgfmathunitsdeclared +\def\pgfmathsetresultunitscale#1{\def\pgfmathresultunitscale{#1}} +\def\pgfmathresultunitscale{1} + +% \pgfmath@endparse +% +% Everything stops here. +% +\def\pgfmath@endparse#1\pgfmath@empty{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + \begingroup% + \ifpgfmathunitsdeclared% + \pgfmath@x1pt\relax% + \else% + \afterassignment\pgfmath@gobbletilpgfmath@% + \pgfmath@x\pgfmathresultunitscale pt\relax\pgfmath@% + \fi% + \expandafter\pgfmath@x\pgfmathresult\pgfmath@x% + \pgfmath@returnone\pgfmath@x% + \endgroup% + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \ignorespaces% +} + +% \pgfmath@startparsegroup +% +% When opening ( is scanned start a new group. +% +\def\pgfmath@startparsegroup{% + \begingroup% + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \pgfmath@resetparsingparameters% + \pgfmath@parse@} + +% \pgfmath@endparsegroup +% +% When closing ) is scanned, processes all waiting +% operations (within the group) and close the group. +% +\def\pgfmath@endparsegroup{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + \expandafter\pgfmath@x\pgfmathresult pt\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup% + \pgfmath@parsepostgroup% +} + +% \pgfmath@parseoperator +% +% An operator is expected here. +% Or the end of the parse or parse group. +% +\def\pgfmath@parseoperator#1{% + \def\pgfmath@token{}% + % Push the operand in \pgfmathresult on to the stack. + \expandafter\pgfmath@stackpushoperand\expandafter{\pgfmathresult}% + \ifx#1@% + \let\pgfmath@parsenext\pgfmath@endparse% + \else% + \ifx#1+% + \let\pgfmath@parsenext\pgfmath@parseadd% + \else% + \ifx#1-% + \let\pgfmath@parsenext\pgfmath@parsesubtract% + \else% + \ifx#1*% + \let\pgfmath@parsenext\pgfmath@parsemultiply% + \else% + \ifx#1/% + \let\pgfmath@parsenext\pgfmath@parsedivide% + \else + \ifx#1)% + \let\pgfmath@parsenext\pgfmath@endparsegroup% + \else% + \ifx#1r% + \let\pgfmath@parsenext\pgfmath@parseradians% + \else% + \ifx#1>% + \let\pgfmath@parsenext\pgfmath@parsegreaterthan% + \else% + \ifx#1<% + \let\pgfmath@parsenext\pgfmath@parselessthan% + \else% + \if#1=% + \let\pgfmath@parsenext\pgfmath@parseequalto% + \else% + \if#1^% + \let\pgfmath@parsenext\pgfmath@parsepower% + \else% + \pgfmath@error{Unknown operator `#1'}% + \let\pgfmath@parsenext\relax% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \pgfmath@parsenext% +} + +% Use a \toks register as a stack. +\newtoks\pgfmath@stack + +% \pgfmath@stackpushoperator +% +% Push an operator (actually its macro e.g., \pgfmathadd@) +% on to the stack. And keep track of it using the macro +% \pgfmath@stacknextoperator. +% +\def\pgfmath@stackpushoperator#1{% + \edef\pgfmath@temp{\noexpand#1\the\pgfmath@stack}% + \expandafter\pgfmath@stack\expandafter{\pgfmath@temp}% + \def\pgfmath@stacknextoperator{#1}}% <- Must \def. Cannot \let. + +% \pgfmath@stackpushoperand +% +% Push an operand (i.e. a number) on the stack. It is +% put within a TeX group to make popping a lot simpler. +% +\def\pgfmath@stackpushoperand#1{% + \edef\pgfmath@temp{{#1}\the\pgfmath@stack}% + \expandafter\pgfmath@stack\expandafter{\pgfmath@temp}% +} + +% \pgfmath@stackpeek +% +% Peek (i.e. without removal) at the top of the stack. +% +\def\pgfmath@stackpeek{\expandafter\pgfmath@stackpeek@\the\pgfmath@stack\pgfmath@} +\def\pgfmath@stackpeek@#1#2\pgfmath@{#1}% + +% \pgfmath@stackpop +% +% Pop (i.e. remove) the top of the stack into #1. +% +\def\pgfmath@stackpop#1{\expandafter\pgfmath@stackpop@\expandafter#1\the\pgfmath@stack\pgfmath@} +\def\pgfmath@stackpop@#1#2#3\pgfmath@{\edef#1{#2}\pgfmath@stack{#3}}% + +% \pgfmath@stackpopoperation +% +% Remove and perform an operation from the stack. +% +\def\pgfmath@stackpopoperation{% + \expandafter\pgfmath@stackpopoperation@\the\pgfmath@stack\pgfmath@% +} +\def\pgfmath@stackpopoperation@#1#2#3#4#5\pgfmath@{% + \ifx\pgfmath@empty#1\relax% + \pgfmath@stack{\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}% + \else% + \ifx\pgfmath@empty#2\relax% + \pgfmath@stack{{#1}\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}% + \else% + #2{#3}{#1}% + \pgfmath@stack{#4#5}% + \expandafter\pgfmath@stackpushoperand\expandafter{\pgfmathresult}% + \fi\fi% + \def\pgfmath@stacknextoperator{#4}} + +% \pgfmath@processalloperations +% +% Process all operation in the stack. The +% overall result is at the top of the stack. +% +\def\pgfmath@processalloperations{% + \expandafter\pgfmath@in@\pgfmath@stacknextoperator{\pgfmath@empty}% + \ifpgfmath@in@% + \let\pgfmath@processnext\relax% + \else% + \pgfmath@stackpopoperation% + \let\pgfmath@processnext\pgfmath@processalloperations% + \fi% + \pgfmath@processnext} + +% \pgfmath@processoperationsuntil +% +% Process operations in the stack, until the specified +% operation/s is/are encountered. The overall result is +% at the top of the stack. +% +\def\pgfmath@processoperationsuntil#1{% + \expandafter\pgfmath@in@\pgfmath@stacknextoperator{#1\pgfmath@empty}% + \ifpgfmath@in@% + \let\pgfmath@processnext\pgfmath@processoperationsuntil@end% + \else% + \pgfmath@stackpopoperation% + \let\pgfmath@processnext\pgfmath@processoperationsuntil% + \fi% + \pgfmath@processnext{#1}} +\def\pgfmath@processoperationsuntil@end#1{} + + +% OK. Now the operators are parsed. +% These correspond to the + - / * ^ < > = operators and r (postfix) function. +% +\def\pgfmath@parseadd{% + % If no operator has been assigned (i.e. + is the first operator scanned), + % do nothing, except add addition to the stack. + \ifx\pgfmath@stacknextoperator\pgfmath@empty% + \else% + % Empty the process stack up to any inequalities. + \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@}% + \fi% + \pgfmath@stackpushoperator{\pgfmathadd@}% + \pgfmath@parse@} + +\def\pgfmath@parsesubtract{% + % If no operator has been assigned (i.e. - is the first operator scanned), + % do nothing, except add subtract to the stack. + \ifx\pgfmath@stacknextoperator\pgfmath@empty% + \else% + % Empty the process stack up to any inequalities. + \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@}% + \fi% + \pgfmath@stackpushoperator{\pgfmathsubtract@}% + \pgfmath@parse@} + +\def\pgfmath@parsemultiply{% + % If no operator has been assigned (i.e. * is the first operator scanned), + % do nothing, except push multiply onto the stack. + \ifx\pgfmath@stacknextoperator\pgfmath@empty% + \else% + % Process all operations up to inequalites or addition/subtraction + \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@% + \pgfmathadd@\pgfmathsubtract@}% + \fi% + \pgfmath@stackpushoperator{\pgfmathmultiply@}% + \pgfmath@parse@} + +\def\pgfmath@parsedivide{% + % If no operator has been assigned (i.e. / is the first operator scanned), + % do nothing, except push divide onto the stack. + \ifx\pgfmath@stacknextoperator\pgfmath@empty% + \else% + % Process all operations up to inequalites or addition/subtraction + \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@% + \pgfmathadd@\pgfmathsubtract@}% + \fi% + \pgfmath@stackpushoperator{\pgfmathdivide@}% + \pgfmath@parse@} + +\def\pgfmath@parsegreaterthan{% + % On scanning an equality/inequality operator everything up to + % (but not including) the operator is evaluated... + \pgfmath@processalloperations% + % ...and the operation pushed onto the stack. + \pgfmath@stackpushoperator{\pgfmathgreaterthan@}% + \pgfmath@parse@} + +\def\pgfmath@parselessthan{% + \pgfmath@processalloperations% + \pgfmath@stackpushoperator{\pgfmathlessthan@}% + \pgfmath@parse@} + +\def\pgfmath@parseequalto={% + \pgfmath@processalloperations% + \pgfmath@stackpushoperator{\pgfmathequalto@}% + \pgfmath@parse@} + +\def\pgfmath@parsepower{% + % Easy, just push power onto the stack. + \pgfmath@stackpushoperator{\pgfmathpow@}% + \pgfmath@parse@} + +\def\pgfmath@parseradians{% + % r is a post-fix function... + \ifx\pgfmath@primaryoperation\pgfmath@empty% + \else% + \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@% + \pgfmathadd@\pgfmathsubtract@}% + \fi% + \pgfmath@stackpop{\pgfmath@temp}% + \pgfmathdeg@{\pgfmath@temp}% + % ...so processing returns to \pgfmath@parseoperator + \pgfmath@parseoperator} + +\newcount\c@pgfmath@parsecounta +\newcount\c@pgfmath@parsecountb +\newcount\c@pgfmath@parsecountc +\newdimen\pgfmath@parsex + +% \pgfmath@quickparseoperand +% +% An operand can *only* be a dimension. +% +\def\pgfmath@quickparseoperand{% + \afterassignment\pgfmath@quickparseoperand@% + \pgfmath@parsex\pgfmath@token} +\def\pgfmath@quickparseoperand@{% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \pgfmath@parseoperator% +} + +% \pgfmath@parseoperand +% +% An operand can be an ASCII number (with or without dimensions, with +% or without a decimal point), a TeX register (count, dimen or skip, +% which may have expanded with \the), or a function e.g. sin(X). +% +% It is assumed that after \edef-ing, the only unexpanded tokens are registers. +% +\def\pgfmath@parseoperand{% + \def\pgfmath@sign{}% + \expandafter\pgfmath@parseoperandsign\pgfmath@token} +\def\pgfmath@parseoperandsign#1{% + \pgfmath@in@#1{-+}% + \ifpgfmath@in@ + % Gobble multiple signs. + \edef\pgfmath@sign{\pgfmath@sign#1}% + \expandafter\pgfmath@parseoperandsign% + \else% + \expandafter\pgfmath@parsenumberorfunction\expandafter#1% + \fi% +} + +\newif\ifpgfmath@dimen@ + +\def\pgfmath@ifregisterdimen@#1\pgfmath@{% + \pgfmath@in@{p}{#1}% + \ifpgfmath@in@% + \pgfmath@dimen@true% + \else% + \pgfmath@dimen@false% + \fi} + +\def\pgfmath@parsenumberorfunction#1{% + \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@simple% + \ifx#1\wd\let\pgfmath@parsenext\pgfmath@boxdimen\fi% + \ifx#1\ht\let\pgfmath@parsenext\pgfmath@boxdimen\fi% + \ifx#1\dp\let\pgfmath@parsenext\pgfmath@boxdimen\fi% + \pgfmath@parsenext#1% +} + +\def\pgfmath@boxdimen#1#2{% + \pgfmath@parsex=\pgfmath@sign#1#2% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \global\pgfmathunitsdeclaredtrue% a dimension has units + \pgfmath@parseoperator% +} + +\def\pgfmath@parsenumberorfunction@simple#1{% + \expandafter\ifcat#1\relax% + % So, a TeX register. + \afterassignment\pgfmath@ifregisterdimen@% + \pgfmath@parsex\pgfmath@sign#1pt\relax\pgfmath@% + \ifpgfmath@dimen@% + % A dimension! So stop scanning operand here. + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \global\pgfmathunitsdeclaredtrue% a dimension has units + \def\pgfmath@temp{}% + \let\pgfmath@parsenext\pgfmath@parseoperator% + \else% + % A count! Expand it, but carry on as usual as it might + % be immediately followed by a dimension. + \ifdim\pgfmath@parsex<0pt\relax% + \edef\pgfmath@sign{\pgfmath@sign-}% + \pgfmath@parsex-\pgfmath@parsex% + \fi% + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@parsex}}% + \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@% + \fi% + \else% + % Could be a number or a function...? + \edef\pgfmath@temp{#1}% + \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@% + \fi% + \expandafter\pgfmath@parsenext\pgfmath@temp% +}% + +\def\pgfmath@parsenumberorfunction@#1{% + \ifx#1(% It might be a group e.g. -(1+2)... + \let\pgfmath@parsenext\pgfmath@parseoperandgroup% + \else% + \pgfmath@in@{#1}{.0123456789}% + \ifpgfmath@in@% ... or a number... + \let\pgfmath@parsenext\pgfmath@parsenumber% + \else% ... or a function. + \let\pgfmath@parsenext\pgfmath@parsefunction% + \fi% + \fi% + \pgfmath@parsenext#1% +}% + +\def\pgfmath@parseoperandgroup({% + \let\pgfmath@postparsegroup\pgfmath@@parseoperandgroup% + \pgfmath@startparsegroup% +} + +\def\pgfmath@@parseoperandgroup{% + \let\pgfmath@postparsegroup\pgfmath@parseoperator% + \edef\pgfmathresult{\pgfmath@sign\pgfmathresult}% + \pgfmath@parseoperator% +} + +\def\pgfmath@parsenumber{% + % Consider the number 3.14159 + % 3 is parsed by assignment to a, then '.' is absorbed and 14159 + % parsed by assignement to b (actually b=114159, see below). + \c@pgfmath@parsecountc0\relax% + \afterassignment\pgfmath@parsedecimalpoint% + \c@pgfmath@parsecounta0} + +\def\pgfmath@parsedecimalpoint#1{% + \ifx#1.% Is there a decimal point? If not, see if there are any units. + \let\pgfmath@parsenext\pgfmath@parsemantissa% + \else% + \c@pgfmath@parsecountb10\relax% The first digit of b is gobbled (see below). + \let\pgfmath@parsenext\pgfmath@parseunits% + \fi% + \pgfmath@parsenext#1} + + + +% We would like to assign the following number (which is the mantisse) +% to a number. However, for a very long mantisse as in 3.141592653589793238462643 +% this will fail since the number becomes too large. +% +% Because of this, we have to do some ``magic'': We scan 9 tokens and +% then do an assignment with a guard after 9 tokens so that the +% assigment cannot fail. +% +\def\pgfmath@parsemantissa.#1#2#3#4#5#6#7#8#9{% + \afterassignment\pgfmath@checkforguard% + % Consider the number: 2.005 + % 2 is assigned to a, but b will be assigned 5, which is *not right*. + % So using 1 here hereresults in b=1005. The first digit is then + % gobbled later, when expanded with \the. + \c@pgfmath@parsecountb1#1#2#3#4#5#6#7#8#9\relax}% + +\def\pgfmath@checkforguard{% + \pgfmath@ifnextchar\relax% + {% + % Ok, this is a looong mantisse. Start gobbling all following + % numbers + \pgfmath@gobblemantisse% + }% + {% + \pgfmath@removeguard% + }% +} + +\def\pgfmath@gobblemantisse\relax#1#2#3#4#5#6#7#8#9{% + \afterassignment\pgfmath@checkforguard% + \c@pgfmath@parsecountc0#1#2#3#4#5#6#7#8#9\relax% these digits are ignored +} + +\def\pgfmath@removeguard#1\relax{\pgfmath@parseunits#1} + + +\def\pgfmath@parseunits#1{% + % Here the extra first digit in b is gobbled. + \edef\pgfmath@resulttemp{% + \pgfmath@sign\the\c@pgfmath@parsecounta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@parsecountb}% + % Check whether #1 is a \dp, \wd, or \ht + \let\pgfmath@parsenext=\pgfmath@parseunits@simple% + \ifx#1\wd\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi% + \ifx#1\ht\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi% + \ifx#1\dp\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi% + \pgfmath@parsenext#1% +} + +\def\pgfmath@parseunits@boxdimen#1#2{% + \pgfmath@parsex=\pgfmath@sign#1#2% + \pgfmath@parsex\pgfmath@resulttemp\pgfmath@parsex% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \global\pgfmathunitsdeclaredtrue% a dimension has units + \pgfmath@parseoperator% +} + +\def\pgfmath@parseunits@simple#1{% + % Now check if #1 is actually a register. + \ifcat#1\relax% + \afterassignment\pgfmath@ifregisterdimen@% + \pgfmath@parsex#1pt\relax\pgfmath@% + \pgfmath@parsex\pgfmath@resulttemp\pgfmath@parsex% + \ifpgfmath@dimen@% If it's a dimen stop scanning operand here. + \global\pgfmathunitsdeclaredtrue% a dimension has units + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \let\pgfmath@parsenext\pgfmath@parseoperator% + \else + \edef\pgfmath@resulttemp{\pgfmath@tonumber{\pgfmath@parsex}}% + \let\pgfmath@parsenext\pgfmath@parseunits@% + \fi% + \expandafter\pgfmath@parsenext% + \else% + \expandafter\pgfmath@parseunits@\expandafter#1% + \fi} + +\def\pgfmath@parseunits@#1#2{% + % Check if #1 is an operator, or the character `@' indicating the end of the parse. + \pgfmath@in@#1{@+-*/^r<>=()}% + \ifpgfmath@in@% + \edef\pgfmath@tokens{#1#2}% + \edef\pgfmathresult{\pgfmath@resulttemp}% + \let\pgfmath@parsenext\pgfmath@parseoperator% + \else% + \pgfmath@in@#1{Ee}% e+0X + \ifpgfmath@in@% + % Oh no! It might be and em or an ex... + \pgfmath@in@#2{mx}% + \ifpgfmath@in@% + \global\pgfmathunitsdeclaredtrue% + \pgfmath@parsex\pgfmath@resulttemp#1#2\relax% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \edef\pgfmath@tokens{}% + \let\pgfmath@parsenext\pgfmath@parseoperator% + \else% + \edef\pgfmath@tokens{#2}% + \let\pgfmath@parsenext\pgfmath@parsescientific% + \fi% + \else + % Anything else *should* be a TeX unit. + \global\pgfmathunitsdeclaredtrue% + \pgfmath@parsex\pgfmath@resulttemp#1#2\relax% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}% + \edef\pgfmath@tokens{}% + \let\pgfmath@parsenext\pgfmath@parseoperator% + \fi\fi% + \expandafter\pgfmath@parsenext\pgfmath@tokens% +} + +% Parse 'Scientific' notation in the form xEyy +% +\def\pgfmath@parsescientific{% + \afterassignment\pgfmath@parsescientific@% + \c@pgfmath@parsecounta} + +\def\pgfmath@parsescientific@{% + \edef\pgfmath@parsesci@temp{\pgfmath@resulttemp\the\c@pgfmath@parsecountc}% + \expandafter\pgfmathscientific\expandafter{\pgfmath@parsesci@temp}% + {\the\c@pgfmath@parsecounta}% + \edef\pgfmath@resulttemp{\pgfmathresult}% + \pgfmath@parseunits@} + +% Functions parsed (not calculated) here are: +% +% round(X) 'half-up' rounding. +% floor(X) floor function. +% ciel(X) ceiling function. +% abs(X) absolute function. +% +% exp(X) e^X (0 <= X <~= 9.7). +% ln(X) logarithm of X. +% pow(X,Y) X^Y, +% +% sin(X) sine function. +% cos(X) cosine function. +% tan(X) tan function. +% asin(X) arcsine of X (in radians) -1 <= X <= 1 +% acos(X) arccosine of X (in radians) -1 <= X <= 1 +% atan(X) arctangent of X (in radians) -1 <= X <= 1 +% veclen(X,Y) the length Z where Z^2 = X^2 + Y^2 +% mod(X,Y) X modulo Y +% max(X,Y) the maximum of X or Y +% min(X,Y) the minimum of X or Y +% +% NB veclen, mod, max, and min *cannot* be nested. +% +% deg(X) converts X to degrees (X in radians) +% rad(X) converts X to radians (X in degrees) +% +% rnd generate pseudo-random number X (0 <= X <= 1). +% rand generate pseudo-random number X (1 <= X <= -1). +% sqrt(X) square root. +% +% pi the constant PI. + +\def\pgfmath@parsefunction{% + \def\pgfmath@parsedfunctionname{}% + \futurelet\pgfmath@parsetoken\pgfmath@parsefunction@@} +\def\pgfmath@parsefunction@@#1{% + \pgfmath@in@#1{()@+-*/^<>=}% A function name ends with one of these... + \ifpgfmath@in@% + \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@end% + \else% + \ifx\pgfmath@parsetoken\pgfmath@sptoken% ...or a space. + \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@end% + \else% + \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@continue% + \fi\fi% + \pgfmath@parsefunctionnext#1} + +\def\pgfmath@parsefunction@end#1{% + \expandafter\ifx\csname pgfmath@parsefunction@\pgfmath@parsedfunctionname\endcsname\relax% + \pgfmath@reportunknownfunction% + \let\pgfmath@parsefunctionnext\relax% + \else% + \let\pgfmath@parsefunctionnext\pgfmath@executeparsefunction@% + \fi% + \pgfmath@parsefunctionnext#1} + +\def\pgfmath@parsefunction@continue#1{% + \edef\pgfmath@parsedfunctionname{\pgfmath@parsedfunctionname#1}% + \futurelet\pgfmath@parsetoken\pgfmath@parsefunction@@} + +\def\pgfmath@executeparsefunction@{\csname pgfmath@parsefunction@\pgfmath@parsedfunctionname\endcsname} + + +\def\pgfmath@reportunknownfunction{% + \pgfmath@error{Unknown function `\pgfmath@parsedfunctionname'}{}% +} + +% \pgfmath@postfunction +% +% In scanning a function e.g. sin(40), we subvert the normal parsing +% group mechanism by messing around with \pgfmath@parsepostgroup, so +% that after scanning ), the parser doesn't scan for an operator, but +% returns to the macros scanning the function. +% Here the mechanism is restored, and the value of the function is +% stored along with the approprate sign, which was saved earlier. +% +\def\pgfmath@postfunction{% + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \edef\pgfmathresult{\pgfmath@sign\pgfmathresult}% + \pgfmath@parseoperator} + + +% \pgfmath@parsefunction@abs +% +\def\pgfmath@parsefunction@abs{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@abs@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@abs@{% + \expandafter\pgfmathabs@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@sqrt +% +\def\pgfmath@parsefunction@sqrt{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sqrt@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@sqrt@{% + \expandafter\pgfmathsqrt@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@round +% +\def\pgfmath@parsefunction@round{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@round@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@round@{% + \expandafter\pgfmathround@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@floor +% +\def\pgfmath@parsefunction@floor{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@floor@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@floor@{% + \expandafter\pgfmathfloor@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@ceil +% +\def\pgfmath@parsefunction@ceil{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@ceil@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@ceil@{% + \expandafter\pgfmathceil@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@sin +% +\def\pgfmath@parsefunction@sin{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sin@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@sin@{% + \expandafter\pgfmathsin@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@cos +% +\def\pgfmath@parsefunction@cos{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cos@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@cos@{% + \expandafter\pgfmathcos@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@asin +% +\def\pgfmath@parsefunction@asin{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@asin@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@asin@{% + \expandafter\pgfmathasin@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@acos +% +\def\pgfmath@parsefunction@acos{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@acos@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@acos@{% + \expandafter\pgfmathacos@\expandafter{\pgfmathresult}% + \pgfmath@postfunction} + +% \pgfmath@parsefunction@atan +% +\def\pgfmath@parsefunction@atan{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@atan@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@atan@{% + \expandafter\pgfmathatan@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@tan +% +\def\pgfmath@parsefunction@tan{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@tan@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@tan@{% + \expandafter\pgfmathtan@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@cot +% +\def\pgfmath@parsefunction@cot{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cot@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@cot@{% + \expandafter\pgfmathcot@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@sec +% +\def\pgfmath@parsefunction@sec{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sec@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@sec@{% + \expandafter\pgfmathsec@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@cosec +% +\def\pgfmath@parsefunction@cosec{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cosec@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@cosec@{% + \expandafter\pgfmathcosec@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@rad +% +\def\pgfmath@parsefunction@rad{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@rad@% + \pgfmath@parse@} +\def\pgfmath@parsefunction@rad@{% + \expandafter\pgfmathrad@\expandafter{\pgfmathresult}% + \pgfmath@postfunction}% + +% \pgfmath@parsefunction@rad +% +\def\pgfmath@parsefunction@deg{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@deg@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@deg@{% + \expandafter\pgfmathdeg@\expandafter{\pgfmathresult}% + \pgfmath@postfunction}% + +% \pgfmath@parsefunction@rnd +% +\def\pgfmath@parsefunction@rnd{% + \expandafter\pgfmathrnd% + \expandafter\pgfmath@postfunction} + +% \pgfmath@parsefunction@rand +% +\def\pgfmath@parsefunction@rand{% + \expandafter\pgfmathrand% + \expandafter\pgfmath@postfunction}% + +% \pgfmath@parsefunction@exp +% +\def\pgfmath@parsefunction@exp{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@exp@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@exp@{% + \expandafter\pgfmathexp@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@ln +% +\def\pgfmath@parsefunction@ln{% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@ln@% + \expandafter\pgfmath@parse@} +\def\pgfmath@parsefunction@ln@{% + \expandafter\pgfmathln@\expandafter{\pgfmathresult}% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@pi +% +\def\pgfmath@parsefunction@pi{% + \pgfmathpi% + \pgfmath@postfunction% +} + +% \pgfmath@parsefunction@veclen +% +\def\pgfmath@parsefunction@veclen{% + \expandafter\pgfmath@parsefunction@veclen@} +\def\pgfmath@parsefunction@veclen@(#1,{% + \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@veclen@@ + \pgfmath@startparsegroup} +\def\pgfmath@parsefunction@veclen@@{% + \edef\pgfmath@secondoperand{\pgfmathresult}% + \pgfmathveclen@{\pgfmath@firstoperand}{\pgfmath@secondoperand}% + \pgfmath@postfunction} + +% \pgfmath@parsefunction@mod +% +\def\pgfmath@parsefunction@mod{% + \expandafter\pgfmath@parsefunction@mod@} +\def\pgfmath@parsefunction@mod@(#1,{% + \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@mod@@ + \pgfmath@startparsegroup} +\def\pgfmath@parsefunction@mod@@{% + \edef\pgfmath@secondoperand{\pgfmathresult}% + \pgfmathmod@{\pgfmath@firstoperand}{\pgfmath@secondoperand}% + \pgfmath@postfunction} + +% \pgfmath@parsefunction@max +% +\def\pgfmath@parsefunction@max{% + \expandafter\pgfmath@parsefunction@max@} +\def\pgfmath@parsefunction@max@(#1,{% + \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@max@@ + \pgfmath@startparsegroup} +\def\pgfmath@parsefunction@max@@{% + \edef\pgfmath@secondoperand{\pgfmathresult}% + \pgfmathmax@{\pgfmath@firstoperand}{\pgfmath@secondoperand}% + \pgfmath@postfunction} + +% \pgfmath@parsefunction@min +% +\def\pgfmath@parsefunction@min{% + \expandafter\pgfmath@parsefunction@min@} +\def\pgfmath@parsefunction@min@(#1,{% + \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@min@@ + \pgfmath@startparsegroup} +\def\pgfmath@parsefunction@min@@{% + \edef\pgfmath@secondoperand{\pgfmathresult}% + \pgfmathmin@{\pgfmath@firstoperand}{\pgfmath@secondoperand}% + \pgfmath@postfunction} + +% \pgfmath@parsefunction@pow +% +\def\pgfmath@parsefunction@pow{% + \expandafter\pgfmath@parsefunction@pow@} +\def\pgfmath@parsefunction@pow@(#1,{% + \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}% + \let\pgfmath@parsepostgroup\pgfmath@parsefunction@pow@@ + \pgfmath@startparsegroup} +\def\pgfmath@parsefunction@pow@@{% + \edef\pgfmath@secondoperand{\pgfmathresult}% + \pgfmathpow@{\pgfmath@firstoperand}{\pgfmath@secondoperand}% + \pgfmath@postfunction} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex new file mode 100644 index 00000000000..ea8d5bb3092 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex @@ -0,0 +1,212 @@ +% Copyright 2007 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% This file defines the pesudorandom numbers. +% +% Version 1.414213 29/9/2007 + +% Pseudo-random number generation. +% +% See: +% \book@{pressetal1992, +% author = {William H. Press and Brian P. Flannery and Saul A. +% Teukolsky and William T. Vetterling}, +% title = {Numerical Recipies in C}, +% edition = {Second}, +% publisher = {Cambridge University Press} +% } +% +% See also, the documentation for the lcg package by Erich Janka: +% (http://www.ctan.org/tex-archive/macros/latex/contrib/lcg/lcg.pdf) +% +\def\pgfmath@rnd@m{2147483647}% LaTeX Maximum. + +\begingroup +\c@pgfmath@counta=\time% +\multiply\c@pgfmath@counta by\year% +\xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% The seed. +\endgroup + +% \pgfmathsetseed +% +% Explictly set the seed for the generator +% +% #1 -> the new seed. +% +\def\pgfmathsetseed#1{\pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult\relax}% +\def\pgfmath@setseed#1.#2\relax{\def\pgfmath@rnd@z{#1}}% + +% Alternative paramaters - see Press et al (1992) p278-279, +% for discussion. +% +% a=16807 q=127773 r=2836 +% a=48271 q=4488 r=3399 +% +\def\pgfmath@rnd@a{69621} +\def\pgfmath@rnd@r{23902} +\def\pgfmath@rnd@q{30845} + +% \pgfmathgeneratepseudorandomnumber +% +% A linear congruency generator for generating +% pseudo-random numbers. Generates numbers in +% the range 1 - 2^31-1. +% +\def\pgfmathgeneratepseudorandomnumber{% + \begingroup% + \c@pgfmath@counta=\pgfmath@rnd@z% + \c@pgfmath@countb=\pgfmath@rnd@z% + \c@pgfmath@countc=\pgfmath@rnd@q% + \divide\c@pgfmath@counta by\c@pgfmath@countc% + \multiply\c@pgfmath@counta by-\c@pgfmath@countc% + \advance\c@pgfmath@counta by\c@pgfmath@countb + \c@pgfmath@countc=\pgfmath@rnd@a% + \multiply\c@pgfmath@counta by\c@pgfmath@countc% + \c@pgfmath@countc=\pgfmath@rnd@q% + \divide\c@pgfmath@countb by\c@pgfmath@countc% + \c@pgfmath@countc=\pgfmath@rnd@r% + \multiply\c@pgfmath@countb by\c@pgfmath@countc% + \advance\c@pgfmath@counta by-\c@pgfmath@countb% + \ifnum\c@pgfmath@counta<0\relax% + \c@pgfmath@countb=\pgfmath@rnd@m% + \advance\c@pgfmath@counta by\c@pgfmath@countb% + \fi% + \xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% + \endgroup% + \edef\pgfmathresult{\pgfmath@rnd@z}% +} + +% \pgfmathrnd +% +% Generates a pseudo-random number between 0 and 1. +% +\def\pgfmathrnd{% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta\pgfmathresult% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb100001\relax% To get one. + \multiply\c@pgfmath@countb-100001\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb1000000\relax% + \expandafter\pgfmathrnd@\the\c@pgfmath@countb\pgfmath@% + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +\def\pgfmathrnd@#1#2#3\pgfmath@{% + \edef\pgfmath@temp{#2.#3}% + \pgfmath@x=\pgfmath@temp pt\relax% +}% + +% \pgfmathrand +% +% Generates a pseudo-random number between -1 and 1. +% +\def\pgfmathrand{% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta\pgfmathresult% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb200001\relax% + \multiply\c@pgfmath@countb-200001\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb-100000\relax% + \ifnum\c@pgfmath@countb<0\relax% + \advance\c@pgfmath@countb-1000000\relax% + \else% + \advance\c@pgfmath@countb1000000\relax% + \fi% + \expandafter\pgfmathrand@\the\c@pgfmath@countb\pgfmath@% + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +\def\pgfmathrand@#1#2#3#4\pgfmath@{% + \ifx#1-% + \edef\pgfmath@temp{-#3.#4}% + \else% + \edef\pgfmath@temp{#2.#3#4}% + \fi% + \pgfmath@x=\pgfmath@temp pt\relax% +}% + +% \pgfmathrandominteger +% +% Return a 'randomly' selected integer in the range #2 - #3 (inclusive). +% +% #1 - a macro to store the integer (not a count register). +% #2 - the lower limit of the range. +% #3 - the upper limit of the range. +% +\def\pgfmathrandominteger#1#2#3{% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta#2\relax% + \c@pgfmath@countb#3\relax% + \c@pgfmath@countc\c@pgfmath@countb% + % OK. Maybe #2 > #3. + \ifnum\c@pgfmath@counta>\c@pgfmath@countb\relax% + \c@pgfmath@countc\c@pgfmath@countb% + \c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countc% + \fi% + \advance\c@pgfmath@countc1\relax% + \advance\c@pgfmath@countc-\c@pgfmath@counta% + \c@pgfmath@counta\pgfmathresult\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb\c@pgfmath@countc% + \multiply\c@pgfmath@countb-\c@pgfmath@countc% + \advance\c@pgfmath@counta\c@pgfmath@countb% + \advance\c@pgfmath@counta#2\relax% + \edef\pgfmathresult{\the\c@pgfmath@counta}% + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \edef#1{\pgfmathresult}% +} + +% \pgfmathdeclarerandomlist +% +% Create a list to be used with \pgfmathrandomelement. +% +% #1 - the name of the list +% #2 - a list of comma separated elements. +% +\def\pgfmathdeclarerandomlist#1#2{% + \def\pgfmath@randomlistname{#1}% + \begingroup% + \c@pgfmath@counta=1\relax% + % {} is a possible random element so (locally) + % redefine \pgfmath@empty. + \def\pgfmath@empty{pgfmath@empty}% + \expandafter\pgfmath@scanrandomlist#2{pgfmath@empty}} +\def\pgfmath@scanrandomlist#1{% + \def\pgfmath@scanneditem{#1}% + \ifx\pgfmath@scanneditem\pgfmath@empty% + \advance\c@pgfmath@counta-1\relax% + \expandafter\xdef\csname pgfmath@randomlist@\pgfmath@randomlistname\endcsname{\the\c@pgfmath@counta}% + \endgroup% + \else% + \expandafter\gdef\csname pgfmath@randomlist@\pgfmath@randomlistname @\the\c@pgfmath@counta\endcsname{#1}% + \advance\c@pgfmath@counta1\relax% + \expandafter\pgfmath@scanrandomlist% + \fi} + +% \pgfmathrandomitem +% +% Return a 'randomly' selected element from a list. +% +% #1 - a macro to store the item. +% #2 - the name of the list. +% +\def\pgfmathrandomitem#1#2{% + \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{% + \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}% + \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}% + \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex new file mode 100644 index 00000000000..20d86dd8bdf --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex @@ -0,0 +1,1496 @@ +% Copyright 2007 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% This file defines the trigonometric functions/operations. +% +% Much of this file is based on ideas and code (particularly +% the old \pgfcoremath.code.tex) due to Till Tantau. +% +% Version 1.414213 29/9/2007 + +% \pgfmathpi +% +\def\pgfmathpi{\edef\pgfmathresult{\pgfmath@pi}} +\def\pgfmath@pi{3.14159} + +% \pgfmathradians +% (for comptability with 1.18 beta, will be deprecated) +% +% Convert #1 from radians to degrees (accurate to 1 deg). +% +\def\pgfmathradians#1{% + \pgfmathparse{#1}% + \pgfmathradians@{\pgfmathresult}} +\def\pgfmathradians@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@x57.29577\pgfmath@x\relax% 57.29577 = 360/(2*pi) + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +% \pgfmathdeg +% +% Convert #1 from radians to degrees. +% +\def\pgfmathdeg#1{% + \pgfmathparse{#1}% + \pgfmathdeg@{\pgfmathresult}} +\def\pgfmathdeg@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@x57.29577\pgfmath@x\relax% 57.29577 = 360/(2*pi) + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +% \pgfmathrad +% +% Convert #1 from degrees to radians. +% +\def\pgfmathrad#1{% + \pgfmathparse{#1}% + \pgfmathrad@{\pgfmathresult}} +\def\pgfmathrad@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@x3.14159\pgfmath@x% + \divide\pgfmath@x180\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup% +}% + +% \pgfmathsin +% +% Calculate the sine of #1 (in degrees). +% +\def\pgfmathsin#1{% + \pgfmathparse{#1}% + \pgfmathsin@{\pgfmathresult}} +\def\pgfmathsin@#1{% + % Let #1 = a.b + % Then sin(#1) \approx (1-b)*sin(a) + b*sin(a+1) + % + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \advance\pgfmath@x-90pt\relax% + \afterassignment\pgfmath@gobbletilpgfmath@ + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@ + \divide\c@pgfmath@counta360\relax% + \multiply\c@pgfmath@counta-360\relax% + \advance\pgfmath@x\c@pgfmath@counta pt\relax% + \ifdim\pgfmath@x<0pt\relax\pgfmath@x-\pgfmath@x\fi% + \ifdim\pgfmath@x<180pt\relax% + \else + \pgfmath@x-\pgfmath@x% + \advance\pgfmath@x360pt\relax% + \fi% + % Now 0 <= x < 179. So split x into integer and decimal... + % + \afterassignment\pgfmath@xa% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + % + % ...if #1 is an integer, don't do anything fancy. + \ifdim\pgfmath@xa=0pt% + \expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname pt\relax% + \else% + \pgfmath@x-\pgfmath@xa% + \advance\pgfmath@x1pt\relax% + \expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@x% + \advance\c@pgfmath@counta1\relax% + \expandafter\advance\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@xa% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup +} + +% \pgfmathcos +% +% Calculate the cosine of #1 (in degrees). +% +\def\pgfmathcos#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathcos@\expandafter{\pgfmathresult}} +\def\pgfmathcos@#1{% + % Let x = a.b + % Then cos(x) \approx (1-b)*cos(a) + b*cos(a+1) + % + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \divide\c@pgfmath@counta360\relax% + \multiply\c@pgfmath@counta-360\relax% + \advance\pgfmath@x\c@pgfmath@counta pt\relax% + \ifdim\pgfmath@x<0pt\relax\pgfmath@x-\pgfmath@x\fi% + \ifdim\pgfmath@x<180pt\relax% + \else% + \pgfmath@x-\pgfmath@x% + \advance\pgfmath@x360pt\relax% + \fi% + % Now 0 <= x < 179. So split x into integer and decimal... + % + \afterassignment\pgfmath@xa% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + % + % ...if #1 is an integer, don't do anything fancy. + \ifdim\pgfmath@xa=0pt% + \expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname pt% + \else% + \pgfmath@x-\pgfmath@xa% + \advance\pgfmath@x1pt\relax% + \expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@x% + \advance\c@pgfmath@counta1\relax% + \ifnum\c@pgfmath@counta=181\relax\c@pgfmath@counta179\relax\fi% + \expandafter\advance\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@xa% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathsincos +% +% Calculate the sin and cosine of #1 (in degrees). +% +\def\pgfmathsincos#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathsincos@\expandafter{\pgfmathresult}} +\def\pgfmathsincos@#1{% + \edef\pgfmath@temparg{#1}% + \pgfmathsin@{\pgfmath@temparg}\edef\pgfmathresulty{\pgfmathresult}% + \pgfmathcos@{\pgfmath@temparg}\edef\pgfmathresultx{\pgfmathresult}% +} + +% \pgfmathtan +% +% Calculate the tangent of #1 (in degrees). +% +\def\pgfmathtan#1{% + \pgfmathparse{#1}% + \pgfmathtan@{\pgfmathresult}} +\def\pgfmathtan@#1{% + \begingroup% + \edef\pgfmath@temparg{#1}% + \pgfmathcos@{\pgfmath@temparg}% + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \edef\pgfmath@tantemp{\pgfmathresult}% + \pgfmathsin@{\pgfmath@temparg}% + \pgfmath@x\pgfmathresult pt\relax% + \pgfmath@x\pgfmath@tantemp\pgfmath@x% + \ifdim\pgfmath@x<0pt\relax% + \c@pgfmath@countb-1\relax% + \else% + \c@pgfmath@countb1\relax% + \fi% + % Adjust to 4 decimal places. This gets rid of some annoyingly tiny errors. + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + \ifdim\pgfmath@x<.0001pt\relax% + \pgfmath@x0pt\relax% + \fi% + \advance\pgfmath@x\c@pgfmath@counta pt% + \multiply\pgfmath@x\c@pgfmath@countb% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathcosec +% +% Calculate the cosec of #1 (in degrees). +% +\def\pgfmathcosec#1{% + \pgfmathparse{#1}% + \pgfmathcosec@{\pgfmathresult}} +\def\pgfmathcosec@#1{% + \expandafter\pgfmathsin@\expandafter{#1}% + \pgfmathreciprocal@{\pgfmathresult}% +} + +% \pgfmathsec +% +% Calculate the sec of #1 (in degrees). +% +\def\pgfmathsec#1{% + \pgfmathparse{#1}% + \pgfmathsec@{\pgfmathresult}} +\def\pgfmathsec@#1{% + \expandafter\pgfmathcos@\expandafter{#1}% + \pgfmathreciprocal@{\pgfmathresult}% +} + +% \pgfmathcot +% +% Calculate the cotangent of #1 (in degrees). +% +\def\pgfmathcot#1{% + \pgfmathparse{#1}% + \pgfmathcot@{\pgfmathresult}} +\def\pgfmathcot@#1{% + \begingroup% + \edef\pgfmath@temparg{#1}% + \pgfmathsin@{\pgfmath@temparg}% + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \edef\pgfmath@tantemp{\pgfmathresult}% + \pgfmathcos@{\pgfmath@temparg}% + \pgfmath@x\pgfmathresult pt\relax% + \pgfmath@x\pgfmath@tantemp\pgfmath@x% + \ifdim\pgfmath@x<0pt\relax% + \c@pgfmath@countb-1\relax% + \else% + \c@pgfmath@countb1\relax% + \fi% + % Adjust to 4 decimal places. This gets rid of some annoyingly tiny errors. + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + \ifdim\pgfmath@x<.0001pt\relax% + \pgfmath@x0pt\relax% + \fi% + \advance\pgfmath@x\c@pgfmath@counta pt% + \multiply\pgfmath@x\c@pgfmath@countb% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathasin +% +% The asin of #1 +% +\def\pgfmathasin#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathasin@\expandafter{\pgfmathresult}} +\def\pgfmathasin@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@xa\pgfmath@x% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@x1000\pgfmath@x% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \pgfmath@x-\csname pgfmath@acos@\the\c@pgfmath@counta\endcsname pt\relax% + \advance\pgfmath@x90pt\relax% + \ifdim\pgfmath@xa<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathacos +% +% The acos of #1 +% +\def\pgfmathacos#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathacos@\expandafter{\pgfmathresult}} +\def\pgfmathacos@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@xa\pgfmath@x% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@x1000\pgfmath@x% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \expandafter\pgfmath@x\csname pgfmath@acos@\the\c@pgfmath@counta\endcsname pt\relax% + \ifdim\pgfmath@xa<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + +% \pgfmathasin +% +% The atan of #1 +% +\def\pgfmathatan#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathatan@\expandafter{\pgfmathresult}} +\def\pgfmathatan@#1{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \pgfmath@xa\pgfmath@x% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@xb\pgfmath@x% + \ifdim\pgfmath@x>1pt\relax% + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmathreciprocal@{\pgfmath@temp}% + \pgfmath@x\pgfmathresult pt\relax% + \fi% + \pgfmath@x1000\pgfmath@x% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \ifdim\pgfmath@xb>1pt\relax% + \expandafter\pgfmath@x\expandafter-\csname pgfmath@atan@\the\c@pgfmath@counta\endcsname pt\relax% + \advance\pgfmath@x90pt% + \else% + \expandafter\pgfmath@x\csname pgfmath@atan@\the\c@pgfmath@counta\endcsname pt\relax% + \fi% + \ifdim\pgfmath@xa<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% +} + + +\def\pgfmath@def#1#2#3{\expandafter\def\csname pgfmath@#1@#2\endcsname{#3}} +\pgfmath@def{cos}{0}{1.00000} \pgfmath@def{cos}{1}{0.99985} +\pgfmath@def{cos}{2}{0.99939} \pgfmath@def{cos}{3}{0.99863} +\pgfmath@def{cos}{4}{0.99756} \pgfmath@def{cos}{5}{0.99619} +\pgfmath@def{cos}{6}{0.99452} \pgfmath@def{cos}{7}{0.99255} +\pgfmath@def{cos}{8}{0.99027} \pgfmath@def{cos}{9}{0.98769} +\pgfmath@def{cos}{10}{0.98481} \pgfmath@def{cos}{11}{0.98163} +\pgfmath@def{cos}{12}{0.97815} \pgfmath@def{cos}{13}{0.97437} +\pgfmath@def{cos}{14}{0.97030} \pgfmath@def{cos}{15}{0.96593} +\pgfmath@def{cos}{16}{0.96126} \pgfmath@def{cos}{17}{0.95630} +\pgfmath@def{cos}{18}{0.95106} \pgfmath@def{cos}{19}{0.94552} +\pgfmath@def{cos}{20}{0.93969} \pgfmath@def{cos}{21}{0.93358} +\pgfmath@def{cos}{22}{0.92718} \pgfmath@def{cos}{23}{0.92050} +\pgfmath@def{cos}{24}{0.91355} \pgfmath@def{cos}{25}{0.90631} +\pgfmath@def{cos}{26}{0.89879} \pgfmath@def{cos}{27}{0.89101} +\pgfmath@def{cos}{28}{0.88295} \pgfmath@def{cos}{29}{0.87462} +\pgfmath@def{cos}{30}{0.86603} \pgfmath@def{cos}{31}{0.85717} +\pgfmath@def{cos}{32}{0.84805} \pgfmath@def{cos}{33}{0.83867} +\pgfmath@def{cos}{34}{0.82904} \pgfmath@def{cos}{35}{0.81915} +\pgfmath@def{cos}{36}{0.80902} \pgfmath@def{cos}{37}{0.79864} +\pgfmath@def{cos}{38}{0.78801} \pgfmath@def{cos}{39}{0.77715} +\pgfmath@def{cos}{40}{0.76604} \pgfmath@def{cos}{41}{0.75471} +\pgfmath@def{cos}{42}{0.74314} \pgfmath@def{cos}{43}{0.73135} +\pgfmath@def{cos}{44}{0.71934} \pgfmath@def{cos}{45}{0.70711} +\pgfmath@def{cos}{46}{0.69466} \pgfmath@def{cos}{47}{0.68200} +\pgfmath@def{cos}{48}{0.66913} \pgfmath@def{cos}{49}{0.65606} +\pgfmath@def{cos}{50}{0.64279} \pgfmath@def{cos}{51}{0.62932} +\pgfmath@def{cos}{52}{0.61566} \pgfmath@def{cos}{53}{0.60182} +\pgfmath@def{cos}{54}{0.58779} \pgfmath@def{cos}{55}{0.57358} +\pgfmath@def{cos}{56}{0.55919} \pgfmath@def{cos}{57}{0.54464} +\pgfmath@def{cos}{58}{0.52992} \pgfmath@def{cos}{59}{0.51504} +\pgfmath@def{cos}{60}{0.50000} \pgfmath@def{cos}{61}{0.48481} +\pgfmath@def{cos}{62}{0.46947} \pgfmath@def{cos}{63}{0.45399} +\pgfmath@def{cos}{64}{0.43837} \pgfmath@def{cos}{65}{0.42262} +\pgfmath@def{cos}{66}{0.40674} \pgfmath@def{cos}{67}{0.39073} +\pgfmath@def{cos}{68}{0.37461} \pgfmath@def{cos}{69}{0.35837} +\pgfmath@def{cos}{70}{0.34202} \pgfmath@def{cos}{71}{0.32557} +\pgfmath@def{cos}{72}{0.30902} \pgfmath@def{cos}{73}{0.29237} +\pgfmath@def{cos}{74}{0.27564} \pgfmath@def{cos}{75}{0.25882} +\pgfmath@def{cos}{76}{0.24192} \pgfmath@def{cos}{77}{0.22495} +\pgfmath@def{cos}{78}{0.20791} \pgfmath@def{cos}{79}{0.19081} +\pgfmath@def{cos}{80}{0.17365} \pgfmath@def{cos}{81}{0.15643} +\pgfmath@def{cos}{82}{0.13917} \pgfmath@def{cos}{83}{0.12187} +\pgfmath@def{cos}{84}{0.10453} \pgfmath@def{cos}{85}{0.08716} +\pgfmath@def{cos}{86}{0.06976} \pgfmath@def{cos}{87}{0.05234} +\pgfmath@def{cos}{88}{0.03490} \pgfmath@def{cos}{89}{0.01745} +\pgfmath@def{cos}{90}{0.00000} \pgfmath@def{cos}{91}{-0.01745} +\pgfmath@def{cos}{92}{-0.03490} \pgfmath@def{cos}{93}{-0.05234} +\pgfmath@def{cos}{94}{-0.06976} \pgfmath@def{cos}{95}{-0.08716} +\pgfmath@def{cos}{96}{-0.10453} \pgfmath@def{cos}{97}{-0.12187} +\pgfmath@def{cos}{98}{-0.13917} \pgfmath@def{cos}{99}{-0.15643} +\pgfmath@def{cos}{100}{-0.17365} \pgfmath@def{cos}{101}{-0.19081} +\pgfmath@def{cos}{102}{-0.20791} \pgfmath@def{cos}{103}{-0.22495} +\pgfmath@def{cos}{104}{-0.24192} \pgfmath@def{cos}{105}{-0.25882} +\pgfmath@def{cos}{106}{-0.27564} \pgfmath@def{cos}{107}{-0.29237} +\pgfmath@def{cos}{108}{-0.30902} \pgfmath@def{cos}{109}{-0.32557} +\pgfmath@def{cos}{110}{-0.34202} \pgfmath@def{cos}{111}{-0.35837} +\pgfmath@def{cos}{112}{-0.37461} \pgfmath@def{cos}{113}{-0.39073} +\pgfmath@def{cos}{114}{-0.40674} \pgfmath@def{cos}{115}{-0.42262} +\pgfmath@def{cos}{116}{-0.43837} \pgfmath@def{cos}{117}{-0.45399} +\pgfmath@def{cos}{118}{-0.46947} \pgfmath@def{cos}{119}{-0.48481} +\pgfmath@def{cos}{120}{-0.50000} \pgfmath@def{cos}{121}{-0.51504} +\pgfmath@def{cos}{122}{-0.52992} \pgfmath@def{cos}{123}{-0.54464} +\pgfmath@def{cos}{124}{-0.55919} \pgfmath@def{cos}{125}{-0.57358} +\pgfmath@def{cos}{126}{-0.58779} \pgfmath@def{cos}{127}{-0.60182} +\pgfmath@def{cos}{128}{-0.61566} \pgfmath@def{cos}{129}{-0.62932} +\pgfmath@def{cos}{130}{-0.64279} \pgfmath@def{cos}{131}{-0.65606} +\pgfmath@def{cos}{132}{-0.66913} \pgfmath@def{cos}{133}{-0.68200} +\pgfmath@def{cos}{134}{-0.69466} \pgfmath@def{cos}{135}{-0.70711} +\pgfmath@def{cos}{136}{-0.71934} \pgfmath@def{cos}{137}{-0.73135} +\pgfmath@def{cos}{138}{-0.74314} \pgfmath@def{cos}{139}{-0.75471} +\pgfmath@def{cos}{140}{-0.76604} \pgfmath@def{cos}{141}{-0.77715} +\pgfmath@def{cos}{142}{-0.78801} \pgfmath@def{cos}{143}{-0.79864} +\pgfmath@def{cos}{144}{-0.80902} \pgfmath@def{cos}{145}{-0.81915} +\pgfmath@def{cos}{146}{-0.82904} \pgfmath@def{cos}{147}{-0.83867} +\pgfmath@def{cos}{148}{-0.84805} \pgfmath@def{cos}{149}{-0.85717} +\pgfmath@def{cos}{150}{-0.86603} \pgfmath@def{cos}{151}{-0.87462} +\pgfmath@def{cos}{152}{-0.88295} \pgfmath@def{cos}{153}{-0.89101} +\pgfmath@def{cos}{154}{-0.89879} \pgfmath@def{cos}{155}{-0.90631} +\pgfmath@def{cos}{156}{-0.91355} \pgfmath@def{cos}{157}{-0.92050} +\pgfmath@def{cos}{158}{-0.92718} \pgfmath@def{cos}{159}{-0.93358} +\pgfmath@def{cos}{160}{-0.93969} \pgfmath@def{cos}{161}{-0.94552} +\pgfmath@def{cos}{162}{-0.95106} \pgfmath@def{cos}{163}{-0.95630} +\pgfmath@def{cos}{164}{-0.96126} \pgfmath@def{cos}{165}{-0.96593} +\pgfmath@def{cos}{166}{-0.97030} \pgfmath@def{cos}{167}{-0.97437} +\pgfmath@def{cos}{168}{-0.97815} \pgfmath@def{cos}{169}{-0.98163} +\pgfmath@def{cos}{170}{-0.98481} \pgfmath@def{cos}{171}{-0.98769} +\pgfmath@def{cos}{172}{-0.99027} \pgfmath@def{cos}{173}{-0.99255} +\pgfmath@def{cos}{174}{-0.99452} \pgfmath@def{cos}{175}{-0.99619} +\pgfmath@def{cos}{176}{-0.99756} \pgfmath@def{cos}{177}{-0.99863} +\pgfmath@def{cos}{178}{-0.99939} \pgfmath@def{cos}{179}{-0.99985} +\pgfmath@def{cos}{180}{-1.00000} \pgfmath@def{cos}{181}{-0.99985} + +\pgfmath@def{cosfrac}{0}{1.00000} \pgfmath@def{cosfrac}{1}{0.99995} +\pgfmath@def{cosfrac}{2}{0.99980} \pgfmath@def{cosfrac}{3}{0.99955} +\pgfmath@def{cosfrac}{4}{0.99920} \pgfmath@def{cosfrac}{5}{0.99875} +\pgfmath@def{cosfrac}{6}{0.99820} \pgfmath@def{cosfrac}{7}{0.99755} +\pgfmath@def{cosfrac}{8}{0.99681} \pgfmath@def{cosfrac}{9}{0.99597} +\pgfmath@def{cosfrac}{10}{0.99503} \pgfmath@def{cosfrac}{11}{0.99400} +\pgfmath@def{cosfrac}{12}{0.99287} \pgfmath@def{cosfrac}{13}{0.99165} +\pgfmath@def{cosfrac}{14}{0.99034} \pgfmath@def{cosfrac}{15}{0.98893} +\pgfmath@def{cosfrac}{16}{0.98744} \pgfmath@def{cosfrac}{17}{0.98585} +\pgfmath@def{cosfrac}{18}{0.98418} \pgfmath@def{cosfrac}{19}{0.98242} +\pgfmath@def{cosfrac}{20}{0.98058} \pgfmath@def{cosfrac}{21}{0.97865} +\pgfmath@def{cosfrac}{22}{0.97664} \pgfmath@def{cosfrac}{23}{0.97455} +\pgfmath@def{cosfrac}{24}{0.97238} \pgfmath@def{cosfrac}{25}{0.97014} +\pgfmath@def{cosfrac}{26}{0.96782} \pgfmath@def{cosfrac}{27}{0.96542} +\pgfmath@def{cosfrac}{28}{0.96296} \pgfmath@def{cosfrac}{29}{0.96042} +\pgfmath@def{cosfrac}{30}{0.95782} \pgfmath@def{cosfrac}{31}{0.95515} +\pgfmath@def{cosfrac}{32}{0.95242} \pgfmath@def{cosfrac}{33}{0.94962} +\pgfmath@def{cosfrac}{34}{0.94677} \pgfmath@def{cosfrac}{35}{0.94385} +\pgfmath@def{cosfrac}{36}{0.94088} \pgfmath@def{cosfrac}{37}{0.93786} +\pgfmath@def{cosfrac}{38}{0.93478} \pgfmath@def{cosfrac}{39}{0.93165} +\pgfmath@def{cosfrac}{40}{0.92847} \pgfmath@def{cosfrac}{41}{0.92525} +\pgfmath@def{cosfrac}{42}{0.92198} \pgfmath@def{cosfrac}{43}{0.91866} +\pgfmath@def{cosfrac}{44}{0.91531} \pgfmath@def{cosfrac}{45}{0.91192} +\pgfmath@def{cosfrac}{46}{0.90849} \pgfmath@def{cosfrac}{47}{0.90502} +\pgfmath@def{cosfrac}{48}{0.90152} \pgfmath@def{cosfrac}{49}{0.89799} +\pgfmath@def{cosfrac}{50}{0.89442} \pgfmath@def{cosfrac}{51}{0.89083} +\pgfmath@def{cosfrac}{52}{0.88721} \pgfmath@def{cosfrac}{53}{0.88357} +\pgfmath@def{cosfrac}{54}{0.87990} \pgfmath@def{cosfrac}{55}{0.87621} +\pgfmath@def{cosfrac}{56}{0.87250} \pgfmath@def{cosfrac}{57}{0.86877} +\pgfmath@def{cosfrac}{58}{0.86503} \pgfmath@def{cosfrac}{59}{0.86126} +\pgfmath@def{cosfrac}{60}{0.85749} \pgfmath@def{cosfrac}{61}{0.85370} +\pgfmath@def{cosfrac}{62}{0.84990} \pgfmath@def{cosfrac}{63}{0.84609} +\pgfmath@def{cosfrac}{64}{0.84227} \pgfmath@def{cosfrac}{65}{0.83844} +\pgfmath@def{cosfrac}{66}{0.83460} \pgfmath@def{cosfrac}{67}{0.83077} +\pgfmath@def{cosfrac}{68}{0.82692} \pgfmath@def{cosfrac}{69}{0.82308} +\pgfmath@def{cosfrac}{70}{0.81923} \pgfmath@def{cosfrac}{71}{0.81538} +\pgfmath@def{cosfrac}{72}{0.81153} \pgfmath@def{cosfrac}{73}{0.80768} +\pgfmath@def{cosfrac}{74}{0.80384} \pgfmath@def{cosfrac}{75}{0.80000} +\pgfmath@def{cosfrac}{76}{0.79616} \pgfmath@def{cosfrac}{77}{0.79232} +\pgfmath@def{cosfrac}{78}{0.78850} \pgfmath@def{cosfrac}{79}{0.78468} +\pgfmath@def{cosfrac}{80}{0.78086} \pgfmath@def{cosfrac}{81}{0.77706} +\pgfmath@def{cosfrac}{82}{0.77326} \pgfmath@def{cosfrac}{83}{0.76948} +\pgfmath@def{cosfrac}{84}{0.76570} \pgfmath@def{cosfrac}{85}{0.76193} +\pgfmath@def{cosfrac}{86}{0.75818} \pgfmath@def{cosfrac}{87}{0.75444} +\pgfmath@def{cosfrac}{88}{0.75071} \pgfmath@def{cosfrac}{89}{0.74699} +\pgfmath@def{cosfrac}{90}{0.74329} \pgfmath@def{cosfrac}{91}{0.73960} +\pgfmath@def{cosfrac}{92}{0.73593} \pgfmath@def{cosfrac}{93}{0.73227} +\pgfmath@def{cosfrac}{94}{0.72862} \pgfmath@def{cosfrac}{95}{0.72499} +\pgfmath@def{cosfrac}{96}{0.72138} \pgfmath@def{cosfrac}{97}{0.71779} +\pgfmath@def{cosfrac}{98}{0.71421} \pgfmath@def{cosfrac}{99}{0.71065} +\pgfmath@def{cosfrac}{100}{0.70710} + +% Oh No! Some really loooooong tables. +\pgfmath@def{atan}{0}{0.00000} \pgfmath@def{atan}{1}{0.05729} +\pgfmath@def{atan}{2}{0.11459} \pgfmath@def{atan}{3}{0.17188} +\pgfmath@def{atan}{4}{0.22918} \pgfmath@def{atan}{5}{0.28647} +\pgfmath@def{atan}{6}{0.34377} \pgfmath@def{atan}{7}{0.40106} +\pgfmath@def{atan}{8}{0.45835} \pgfmath@def{atan}{9}{0.51564} +\pgfmath@def{atan}{10}{0.57293} \pgfmath@def{atan}{11}{0.63022} +\pgfmath@def{atan}{12}{0.68751} \pgfmath@def{atan}{13}{0.74480} +\pgfmath@def{atan}{14}{0.80208} \pgfmath@def{atan}{15}{0.85937} +\pgfmath@def{atan}{16}{0.91665} \pgfmath@def{atan}{17}{0.97393} +\pgfmath@def{atan}{18}{1.03121} \pgfmath@def{atan}{19}{1.08848} +\pgfmath@def{atan}{20}{1.14576} \pgfmath@def{atan}{21}{1.20303} +\pgfmath@def{atan}{22}{1.26030} \pgfmath@def{atan}{23}{1.31757} +\pgfmath@def{atan}{24}{1.37483} \pgfmath@def{atan}{25}{1.43209} +\pgfmath@def{atan}{26}{1.48935} \pgfmath@def{atan}{27}{1.54661} +\pgfmath@def{atan}{28}{1.60386} \pgfmath@def{atan}{29}{1.66111} +\pgfmath@def{atan}{30}{1.71835} \pgfmath@def{atan}{31}{1.77560} +\pgfmath@def{atan}{32}{1.83284} \pgfmath@def{atan}{33}{1.89007} +\pgfmath@def{atan}{34}{1.94730} \pgfmath@def{atan}{35}{2.00453} +\pgfmath@def{atan}{36}{2.06175} \pgfmath@def{atan}{37}{2.11897} +\pgfmath@def{atan}{38}{2.17619} \pgfmath@def{atan}{39}{2.23340} +\pgfmath@def{atan}{40}{2.29061} \pgfmath@def{atan}{41}{2.34781} +\pgfmath@def{atan}{42}{2.40500} \pgfmath@def{atan}{43}{2.46220} +\pgfmath@def{atan}{44}{2.51938} \pgfmath@def{atan}{45}{2.57657} +\pgfmath@def{atan}{46}{2.63374} \pgfmath@def{atan}{47}{2.69092} +\pgfmath@def{atan}{48}{2.74808} \pgfmath@def{atan}{49}{2.80524} +\pgfmath@def{atan}{50}{2.86240} \pgfmath@def{atan}{51}{2.91955} +\pgfmath@def{atan}{52}{2.97669} \pgfmath@def{atan}{53}{3.03383} +\pgfmath@def{atan}{54}{3.09097} \pgfmath@def{atan}{55}{3.14809} +\pgfmath@def{atan}{56}{3.20521} \pgfmath@def{atan}{57}{3.26232} +\pgfmath@def{atan}{58}{3.31943} \pgfmath@def{atan}{59}{3.37653} +\pgfmath@def{atan}{60}{3.43363} \pgfmath@def{atan}{61}{3.49071} +\pgfmath@def{atan}{62}{3.54779} \pgfmath@def{atan}{63}{3.60487} +\pgfmath@def{atan}{64}{3.66193} \pgfmath@def{atan}{65}{3.71899} +\pgfmath@def{atan}{66}{3.77604} \pgfmath@def{atan}{67}{3.83308} +\pgfmath@def{atan}{68}{3.89012} \pgfmath@def{atan}{69}{3.94715} +\pgfmath@def{atan}{70}{4.00417} \pgfmath@def{atan}{71}{4.06118} +\pgfmath@def{atan}{72}{4.11819} \pgfmath@def{atan}{73}{4.17518} +\pgfmath@def{atan}{74}{4.23217} \pgfmath@def{atan}{75}{4.28915} +\pgfmath@def{atan}{76}{4.34612} \pgfmath@def{atan}{77}{4.40308} +\pgfmath@def{atan}{78}{4.46004} \pgfmath@def{atan}{79}{4.51698} +\pgfmath@def{atan}{80}{4.57392} \pgfmath@def{atan}{81}{4.63084} +\pgfmath@def{atan}{82}{4.68776} \pgfmath@def{atan}{83}{4.74467} +\pgfmath@def{atan}{84}{4.80157} \pgfmath@def{atan}{85}{4.85846} +\pgfmath@def{atan}{86}{4.91534} \pgfmath@def{atan}{87}{4.97221} +\pgfmath@def{atan}{88}{5.02907} \pgfmath@def{atan}{89}{5.08592} +\pgfmath@def{atan}{90}{5.14276} \pgfmath@def{atan}{91}{5.19959} +\pgfmath@def{atan}{92}{5.25641} \pgfmath@def{atan}{93}{5.31322} +\pgfmath@def{atan}{94}{5.37002} \pgfmath@def{atan}{95}{5.42681} +\pgfmath@def{atan}{96}{5.48359} \pgfmath@def{atan}{97}{5.54035} +\pgfmath@def{atan}{98}{5.59711} \pgfmath@def{atan}{99}{5.65385} +\pgfmath@def{atan}{100}{5.71059} \pgfmath@def{atan}{101}{5.76731} +\pgfmath@def{atan}{102}{5.82402} \pgfmath@def{atan}{103}{5.88072} +\pgfmath@def{atan}{104}{5.93741} \pgfmath@def{atan}{105}{5.99409} +\pgfmath@def{atan}{106}{6.05075} \pgfmath@def{atan}{107}{6.10741} +\pgfmath@def{atan}{108}{6.16405} \pgfmath@def{atan}{109}{6.22068} +\pgfmath@def{atan}{110}{6.27729} \pgfmath@def{atan}{111}{6.33390} +\pgfmath@def{atan}{112}{6.39049} \pgfmath@def{atan}{113}{6.44707} +\pgfmath@def{atan}{114}{6.50364} \pgfmath@def{atan}{115}{6.56019} +\pgfmath@def{atan}{116}{6.61673} \pgfmath@def{atan}{117}{6.67326} +\pgfmath@def{atan}{118}{6.72978} \pgfmath@def{atan}{119}{6.78628} +\pgfmath@def{atan}{120}{6.84277} \pgfmath@def{atan}{121}{6.89924} +\pgfmath@def{atan}{122}{6.95571} \pgfmath@def{atan}{123}{7.01216} +\pgfmath@def{atan}{124}{7.06859} \pgfmath@def{atan}{125}{7.12501} +\pgfmath@def{atan}{126}{7.18142} \pgfmath@def{atan}{127}{7.23781} +\pgfmath@def{atan}{128}{7.29419} \pgfmath@def{atan}{129}{7.35056} +\pgfmath@def{atan}{130}{7.40691} \pgfmath@def{atan}{131}{7.46324} +\pgfmath@def{atan}{132}{7.51957} \pgfmath@def{atan}{133}{7.57587} +\pgfmath@def{atan}{134}{7.63217} \pgfmath@def{atan}{135}{7.68844} +\pgfmath@def{atan}{136}{7.74471} \pgfmath@def{atan}{137}{7.80095} +\pgfmath@def{atan}{138}{7.85719} \pgfmath@def{atan}{139}{7.91340} +\pgfmath@def{atan}{140}{7.96961} \pgfmath@def{atan}{141}{8.02579} +\pgfmath@def{atan}{142}{8.08196} \pgfmath@def{atan}{143}{8.13812} +\pgfmath@def{atan}{144}{8.19426} \pgfmath@def{atan}{145}{8.25038} +\pgfmath@def{atan}{146}{8.30649} \pgfmath@def{atan}{147}{8.36258} +\pgfmath@def{atan}{148}{8.41866} \pgfmath@def{atan}{149}{8.47472} +\pgfmath@def{atan}{150}{8.53076} \pgfmath@def{atan}{151}{8.58679} +\pgfmath@def{atan}{152}{8.64280} \pgfmath@def{atan}{153}{8.69879} +\pgfmath@def{atan}{154}{8.75477} \pgfmath@def{atan}{155}{8.81073} +\pgfmath@def{atan}{156}{8.86667} \pgfmath@def{atan}{157}{8.92260} +\pgfmath@def{atan}{158}{8.97851} \pgfmath@def{atan}{159}{9.03440} +\pgfmath@def{atan}{160}{9.09027} \pgfmath@def{atan}{161}{9.14613} +\pgfmath@def{atan}{162}{9.20197} \pgfmath@def{atan}{163}{9.25779} +\pgfmath@def{atan}{164}{9.31359} \pgfmath@def{atan}{165}{9.36938} +\pgfmath@def{atan}{166}{9.42515} \pgfmath@def{atan}{167}{9.48090} +\pgfmath@def{atan}{168}{9.53663} \pgfmath@def{atan}{169}{9.59235} +\pgfmath@def{atan}{170}{9.64804} \pgfmath@def{atan}{171}{9.70372} +\pgfmath@def{atan}{172}{9.75938} \pgfmath@def{atan}{173}{9.81502} +\pgfmath@def{atan}{174}{9.87064} \pgfmath@def{atan}{175}{9.92624} +\pgfmath@def{atan}{176}{9.98182} \pgfmath@def{atan}{177}{10.03739} +\pgfmath@def{atan}{178}{10.09294} \pgfmath@def{atan}{179}{10.14846} +\pgfmath@def{atan}{180}{10.20397} \pgfmath@def{atan}{181}{10.25946} +\pgfmath@def{atan}{182}{10.31493} \pgfmath@def{atan}{183}{10.37037} +\pgfmath@def{atan}{184}{10.42580} \pgfmath@def{atan}{185}{10.48121} +\pgfmath@def{atan}{186}{10.53660} \pgfmath@def{atan}{187}{10.59197} +\pgfmath@def{atan}{188}{10.64732} \pgfmath@def{atan}{189}{10.70265} +\pgfmath@def{atan}{190}{10.75796} \pgfmath@def{atan}{191}{10.81325} +\pgfmath@def{atan}{192}{10.86852} \pgfmath@def{atan}{193}{10.92377} +\pgfmath@def{atan}{194}{10.97900} \pgfmath@def{atan}{195}{11.03420} +\pgfmath@def{atan}{196}{11.08939} \pgfmath@def{atan}{197}{11.14456} +\pgfmath@def{atan}{198}{11.19970} \pgfmath@def{atan}{199}{11.25483} +\pgfmath@def{atan}{200}{11.30993} \pgfmath@def{atan}{201}{11.36501} +\pgfmath@def{atan}{202}{11.42007} \pgfmath@def{atan}{203}{11.47511} +\pgfmath@def{atan}{204}{11.53013} \pgfmath@def{atan}{205}{11.58512} +\pgfmath@def{atan}{206}{11.64010} \pgfmath@def{atan}{207}{11.69505} +\pgfmath@def{atan}{208}{11.74998} \pgfmath@def{atan}{209}{11.80489} +\pgfmath@def{atan}{210}{11.85977} \pgfmath@def{atan}{211}{11.91464} +\pgfmath@def{atan}{212}{11.96948} \pgfmath@def{atan}{213}{12.02430} +\pgfmath@def{atan}{214}{12.07910} \pgfmath@def{atan}{215}{12.13388} +\pgfmath@def{atan}{216}{12.18863} \pgfmath@def{atan}{217}{12.24336} +\pgfmath@def{atan}{218}{12.29807} \pgfmath@def{atan}{219}{12.35275} +\pgfmath@def{atan}{220}{12.40741} \pgfmath@def{atan}{221}{12.46205} +\pgfmath@def{atan}{222}{12.51667} \pgfmath@def{atan}{223}{12.57126} +\pgfmath@def{atan}{224}{12.62583} \pgfmath@def{atan}{225}{12.68038} +\pgfmath@def{atan}{226}{12.73490} \pgfmath@def{atan}{227}{12.78940} +\pgfmath@def{atan}{228}{12.84388} \pgfmath@def{atan}{229}{12.89833} +\pgfmath@def{atan}{230}{12.95276} \pgfmath@def{atan}{231}{13.00717} +\pgfmath@def{atan}{232}{13.06155} \pgfmath@def{atan}{233}{13.11590} +\pgfmath@def{atan}{234}{13.17024} \pgfmath@def{atan}{235}{13.22455} +\pgfmath@def{atan}{236}{13.27883} \pgfmath@def{atan}{237}{13.33309} +\pgfmath@def{atan}{238}{13.38733} \pgfmath@def{atan}{239}{13.44154} +\pgfmath@def{atan}{240}{13.49573} \pgfmath@def{atan}{241}{13.54989} +\pgfmath@def{atan}{242}{13.60403} \pgfmath@def{atan}{243}{13.65814} +\pgfmath@def{atan}{244}{13.71223} \pgfmath@def{atan}{245}{13.76630} +\pgfmath@def{atan}{246}{13.82034} \pgfmath@def{atan}{247}{13.87435} +\pgfmath@def{atan}{248}{13.92834} \pgfmath@def{atan}{249}{13.98230} +\pgfmath@def{atan}{250}{14.03624} \pgfmath@def{atan}{251}{14.09015} +\pgfmath@def{atan}{252}{14.14404} \pgfmath@def{atan}{253}{14.19790} +\pgfmath@def{atan}{254}{14.25174} \pgfmath@def{atan}{255}{14.30555} +\pgfmath@def{atan}{256}{14.35933} \pgfmath@def{atan}{257}{14.41309} +\pgfmath@def{atan}{258}{14.46682} \pgfmath@def{atan}{259}{14.52053} +\pgfmath@def{atan}{260}{14.57421} \pgfmath@def{atan}{261}{14.62787} +\pgfmath@def{atan}{262}{14.68149} \pgfmath@def{atan}{263}{14.73510} +\pgfmath@def{atan}{264}{14.78867} \pgfmath@def{atan}{265}{14.84222} +\pgfmath@def{atan}{266}{14.89575} \pgfmath@def{atan}{267}{14.94924} +\pgfmath@def{atan}{268}{15.00271} \pgfmath@def{atan}{269}{15.05615} +\pgfmath@def{atan}{270}{15.10957} \pgfmath@def{atan}{271}{15.16296} +\pgfmath@def{atan}{272}{15.21632} \pgfmath@def{atan}{273}{15.26966} +\pgfmath@def{atan}{274}{15.32297} \pgfmath@def{atan}{275}{15.37625} +\pgfmath@def{atan}{276}{15.42950} \pgfmath@def{atan}{277}{15.48273} +\pgfmath@def{atan}{278}{15.53593} \pgfmath@def{atan}{279}{15.58910} +\pgfmath@def{atan}{280}{15.64224} \pgfmath@def{atan}{281}{15.69536} +\pgfmath@def{atan}{282}{15.74845} \pgfmath@def{atan}{283}{15.80151} +\pgfmath@def{atan}{284}{15.85454} \pgfmath@def{atan}{285}{15.90755} +\pgfmath@def{atan}{286}{15.96052} \pgfmath@def{atan}{287}{16.01347} +\pgfmath@def{atan}{288}{16.06640} \pgfmath@def{atan}{289}{16.11929} +\pgfmath@def{atan}{290}{16.17215} \pgfmath@def{atan}{291}{16.22499} +\pgfmath@def{atan}{292}{16.27780} \pgfmath@def{atan}{293}{16.33058} +\pgfmath@def{atan}{294}{16.38333} \pgfmath@def{atan}{295}{16.43605} +\pgfmath@def{atan}{296}{16.48875} \pgfmath@def{atan}{297}{16.54142} +\pgfmath@def{atan}{298}{16.59405} \pgfmath@def{atan}{299}{16.64666} +\pgfmath@def{atan}{300}{16.69924} \pgfmath@def{atan}{301}{16.75179} +\pgfmath@def{atan}{302}{16.80431} \pgfmath@def{atan}{303}{16.85680} +\pgfmath@def{atan}{304}{16.90927} \pgfmath@def{atan}{305}{16.96170} +\pgfmath@def{atan}{306}{17.01411} \pgfmath@def{atan}{307}{17.06648} +\pgfmath@def{atan}{308}{17.11883} \pgfmath@def{atan}{309}{17.17114} +\pgfmath@def{atan}{310}{17.22343} \pgfmath@def{atan}{311}{17.27569} +\pgfmath@def{atan}{312}{17.32792} \pgfmath@def{atan}{313}{17.38012} +\pgfmath@def{atan}{314}{17.43228} \pgfmath@def{atan}{315}{17.48442} +\pgfmath@def{atan}{316}{17.53653} \pgfmath@def{atan}{317}{17.58861} +\pgfmath@def{atan}{318}{17.64066} \pgfmath@def{atan}{319}{17.69268} +\pgfmath@def{atan}{320}{17.74467} \pgfmath@def{atan}{321}{17.79663} +\pgfmath@def{atan}{322}{17.84855} \pgfmath@def{atan}{323}{17.90045} +\pgfmath@def{atan}{324}{17.95232} \pgfmath@def{atan}{325}{18.00416} +\pgfmath@def{atan}{326}{18.05596} \pgfmath@def{atan}{327}{18.10774} +\pgfmath@def{atan}{328}{18.15949} \pgfmath@def{atan}{329}{18.21120} +\pgfmath@def{atan}{330}{18.26289} \pgfmath@def{atan}{331}{18.31454} +\pgfmath@def{atan}{332}{18.36616} \pgfmath@def{atan}{333}{18.41775} +\pgfmath@def{atan}{334}{18.46931} \pgfmath@def{atan}{335}{18.52084} +\pgfmath@def{atan}{336}{18.57234} \pgfmath@def{atan}{337}{18.62381} +\pgfmath@def{atan}{338}{18.67525} \pgfmath@def{atan}{339}{18.72665} +\pgfmath@def{atan}{340}{18.77803} \pgfmath@def{atan}{341}{18.82937} +\pgfmath@def{atan}{342}{18.88068} \pgfmath@def{atan}{343}{18.93196} +\pgfmath@def{atan}{344}{18.98321} \pgfmath@def{atan}{345}{19.03443} +\pgfmath@def{atan}{346}{19.08562} \pgfmath@def{atan}{347}{19.13677} +\pgfmath@def{atan}{348}{19.18789} \pgfmath@def{atan}{349}{19.23898} +\pgfmath@def{atan}{350}{19.29004} \pgfmath@def{atan}{351}{19.34107} +\pgfmath@def{atan}{352}{19.39206} \pgfmath@def{atan}{353}{19.44303} +\pgfmath@def{atan}{354}{19.49396} \pgfmath@def{atan}{355}{19.54486} +\pgfmath@def{atan}{356}{19.59572} \pgfmath@def{atan}{357}{19.64656} +\pgfmath@def{atan}{358}{19.69736} \pgfmath@def{atan}{359}{19.74813} +\pgfmath@def{atan}{360}{19.79887} \pgfmath@def{atan}{361}{19.84958} +\pgfmath@def{atan}{362}{19.90025} \pgfmath@def{atan}{363}{19.95089} +\pgfmath@def{atan}{364}{20.00150} \pgfmath@def{atan}{365}{20.05208} +\pgfmath@def{atan}{366}{20.10262} \pgfmath@def{atan}{367}{20.15313} +\pgfmath@def{atan}{368}{20.20361} \pgfmath@def{atan}{369}{20.25406} +\pgfmath@def{atan}{370}{20.30447} \pgfmath@def{atan}{371}{20.35485} +\pgfmath@def{atan}{372}{20.40520} \pgfmath@def{atan}{373}{20.45551} +\pgfmath@def{atan}{374}{20.50579} \pgfmath@def{atan}{375}{20.55604} +\pgfmath@def{atan}{376}{20.60626} \pgfmath@def{atan}{377}{20.65644} +\pgfmath@def{atan}{378}{20.70659} \pgfmath@def{atan}{379}{20.75670} +\pgfmath@def{atan}{380}{20.80679} \pgfmath@def{atan}{381}{20.85684} +\pgfmath@def{atan}{382}{20.90685} \pgfmath@def{atan}{383}{20.95684} +\pgfmath@def{atan}{384}{21.00678} \pgfmath@def{atan}{385}{21.05670} +\pgfmath@def{atan}{386}{21.10658} \pgfmath@def{atan}{387}{21.15643} +\pgfmath@def{atan}{388}{21.20625} \pgfmath@def{atan}{389}{21.25603} +\pgfmath@def{atan}{390}{21.30578} \pgfmath@def{atan}{391}{21.35549} +\pgfmath@def{atan}{392}{21.40517} \pgfmath@def{atan}{393}{21.45482} +\pgfmath@def{atan}{394}{21.50444} \pgfmath@def{atan}{395}{21.55402} +\pgfmath@def{atan}{396}{21.60356} \pgfmath@def{atan}{397}{21.65307} +\pgfmath@def{atan}{398}{21.70255} \pgfmath@def{atan}{399}{21.75200} +\pgfmath@def{atan}{400}{21.80140} \pgfmath@def{atan}{401}{21.85078} +\pgfmath@def{atan}{402}{21.90012} \pgfmath@def{atan}{403}{21.94943} +\pgfmath@def{atan}{404}{21.99870} \pgfmath@def{atan}{405}{22.04794} +\pgfmath@def{atan}{406}{22.09715} \pgfmath@def{atan}{407}{22.14632} +\pgfmath@def{atan}{408}{22.19546} \pgfmath@def{atan}{409}{22.24456} +\pgfmath@def{atan}{410}{22.29362} \pgfmath@def{atan}{411}{22.34266} +\pgfmath@def{atan}{412}{22.39166} \pgfmath@def{atan}{413}{22.44062} +\pgfmath@def{atan}{414}{22.48955} \pgfmath@def{atan}{415}{22.53845} +\pgfmath@def{atan}{416}{22.58731} \pgfmath@def{atan}{417}{22.63613} +\pgfmath@def{atan}{418}{22.68492} \pgfmath@def{atan}{419}{22.73368} +\pgfmath@def{atan}{420}{22.78240} \pgfmath@def{atan}{421}{22.83109} +\pgfmath@def{atan}{422}{22.87974} \pgfmath@def{atan}{423}{22.92836} +\pgfmath@def{atan}{424}{22.97694} \pgfmath@def{atan}{425}{23.02549} +\pgfmath@def{atan}{426}{23.07400} \pgfmath@def{atan}{427}{23.12248} +\pgfmath@def{atan}{428}{23.17092} \pgfmath@def{atan}{429}{23.21933} +\pgfmath@def{atan}{430}{23.26770} \pgfmath@def{atan}{431}{23.31604} +\pgfmath@def{atan}{432}{23.36434} \pgfmath@def{atan}{433}{23.41261} +\pgfmath@def{atan}{434}{23.46084} \pgfmath@def{atan}{435}{23.50904} +\pgfmath@def{atan}{436}{23.55720} \pgfmath@def{atan}{437}{23.60532} +\pgfmath@def{atan}{438}{23.65341} \pgfmath@def{atan}{439}{23.70147} +\pgfmath@def{atan}{440}{23.74949} \pgfmath@def{atan}{441}{23.79747} +\pgfmath@def{atan}{442}{23.84542} \pgfmath@def{atan}{443}{23.89334} +\pgfmath@def{atan}{444}{23.94122} \pgfmath@def{atan}{445}{23.98906} +\pgfmath@def{atan}{446}{24.03687} \pgfmath@def{atan}{447}{24.08464} +\pgfmath@def{atan}{448}{24.13238} \pgfmath@def{atan}{449}{24.18008} +\pgfmath@def{atan}{450}{24.22774} \pgfmath@def{atan}{451}{24.27537} +\pgfmath@def{atan}{452}{24.32296} \pgfmath@def{atan}{453}{24.37052} +\pgfmath@def{atan}{454}{24.41804} \pgfmath@def{atan}{455}{24.46553} +\pgfmath@def{atan}{456}{24.51298} \pgfmath@def{atan}{457}{24.56040} +\pgfmath@def{atan}{458}{24.60778} \pgfmath@def{atan}{459}{24.65512} +\pgfmath@def{atan}{460}{24.70243} \pgfmath@def{atan}{461}{24.74970} +\pgfmath@def{atan}{462}{24.79693} \pgfmath@def{atan}{463}{24.84413} +\pgfmath@def{atan}{464}{24.89130} \pgfmath@def{atan}{465}{24.93842} +\pgfmath@def{atan}{466}{24.98551} \pgfmath@def{atan}{467}{25.03257} +\pgfmath@def{atan}{468}{25.07959} \pgfmath@def{atan}{469}{25.12657} +\pgfmath@def{atan}{470}{25.17352} \pgfmath@def{atan}{471}{25.22043} +\pgfmath@def{atan}{472}{25.26731} \pgfmath@def{atan}{473}{25.31414} +\pgfmath@def{atan}{474}{25.36095} \pgfmath@def{atan}{475}{25.40771} +\pgfmath@def{atan}{476}{25.45444} \pgfmath@def{atan}{477}{25.50114} +\pgfmath@def{atan}{478}{25.54780} \pgfmath@def{atan}{479}{25.59442} +\pgfmath@def{atan}{480}{25.64100} \pgfmath@def{atan}{481}{25.68755} +\pgfmath@def{atan}{482}{25.73406} \pgfmath@def{atan}{483}{25.78054} +\pgfmath@def{atan}{484}{25.82698} \pgfmath@def{atan}{485}{25.87338} +\pgfmath@def{atan}{486}{25.91975} \pgfmath@def{atan}{487}{25.96608} +\pgfmath@def{atan}{488}{26.01237} \pgfmath@def{atan}{489}{26.05863} +\pgfmath@def{atan}{490}{26.10485} \pgfmath@def{atan}{491}{26.15103} +\pgfmath@def{atan}{492}{26.19718} \pgfmath@def{atan}{493}{26.24329} +\pgfmath@def{atan}{494}{26.28937} \pgfmath@def{atan}{495}{26.33541} +\pgfmath@def{atan}{496}{26.38141} \pgfmath@def{atan}{497}{26.42737} +\pgfmath@def{atan}{498}{26.47330} \pgfmath@def{atan}{499}{26.51919} +\pgfmath@def{atan}{500}{26.56505} \pgfmath@def{atan}{501}{26.61086} +\pgfmath@def{atan}{502}{26.65665} \pgfmath@def{atan}{503}{26.70239} +\pgfmath@def{atan}{504}{26.74810} \pgfmath@def{atan}{505}{26.79377} +\pgfmath@def{atan}{506}{26.83941} \pgfmath@def{atan}{507}{26.88500} +\pgfmath@def{atan}{508}{26.93057} \pgfmath@def{atan}{509}{26.97609} +\pgfmath@def{atan}{510}{27.02158} \pgfmath@def{atan}{511}{27.06703} +\pgfmath@def{atan}{512}{27.11244} \pgfmath@def{atan}{513}{27.15782} +\pgfmath@def{atan}{514}{27.20316} \pgfmath@def{atan}{515}{27.24846} +\pgfmath@def{atan}{516}{27.29373} \pgfmath@def{atan}{517}{27.33896} +\pgfmath@def{atan}{518}{27.38415} \pgfmath@def{atan}{519}{27.42931} +\pgfmath@def{atan}{520}{27.47443} \pgfmath@def{atan}{521}{27.51951} +\pgfmath@def{atan}{522}{27.56455} \pgfmath@def{atan}{523}{27.60956} +\pgfmath@def{atan}{524}{27.65453} \pgfmath@def{atan}{525}{27.69947} +\pgfmath@def{atan}{526}{27.74437} \pgfmath@def{atan}{527}{27.78923} +\pgfmath@def{atan}{528}{27.83405} \pgfmath@def{atan}{529}{27.87884} +\pgfmath@def{atan}{530}{27.92359} \pgfmath@def{atan}{531}{27.96830} +\pgfmath@def{atan}{532}{28.01297} \pgfmath@def{atan}{533}{28.05761} +\pgfmath@def{atan}{534}{28.10221} \pgfmath@def{atan}{535}{28.14678} +\pgfmath@def{atan}{536}{28.19130} \pgfmath@def{atan}{537}{28.23579} +\pgfmath@def{atan}{538}{28.28025} \pgfmath@def{atan}{539}{28.32466} +\pgfmath@def{atan}{540}{28.36904} \pgfmath@def{atan}{541}{28.41338} +\pgfmath@def{atan}{542}{28.45769} \pgfmath@def{atan}{543}{28.50196} +\pgfmath@def{atan}{544}{28.54619} \pgfmath@def{atan}{545}{28.59038} +\pgfmath@def{atan}{546}{28.63454} \pgfmath@def{atan}{547}{28.67865} +\pgfmath@def{atan}{548}{28.72274} \pgfmath@def{atan}{549}{28.76678} +\pgfmath@def{atan}{550}{28.81079} \pgfmath@def{atan}{551}{28.85476} +\pgfmath@def{atan}{552}{28.89869} \pgfmath@def{atan}{553}{28.94259} +\pgfmath@def{atan}{554}{28.98645} \pgfmath@def{atan}{555}{29.03027} +\pgfmath@def{atan}{556}{29.07405} \pgfmath@def{atan}{557}{29.11780} +\pgfmath@def{atan}{558}{29.16151} \pgfmath@def{atan}{559}{29.20519} +\pgfmath@def{atan}{560}{29.24882} \pgfmath@def{atan}{561}{29.29242} +\pgfmath@def{atan}{562}{29.33598} \pgfmath@def{atan}{563}{29.37951} +\pgfmath@def{atan}{564}{29.42299} \pgfmath@def{atan}{565}{29.46644} +\pgfmath@def{atan}{566}{29.50986} \pgfmath@def{atan}{567}{29.55323} +\pgfmath@def{atan}{568}{29.59657} \pgfmath@def{atan}{569}{29.63987} +\pgfmath@def{atan}{570}{29.68314} \pgfmath@def{atan}{571}{29.72636} +\pgfmath@def{atan}{572}{29.76955} \pgfmath@def{atan}{573}{29.81270} +\pgfmath@def{atan}{574}{29.85582} \pgfmath@def{atan}{575}{29.89890} +\pgfmath@def{atan}{576}{29.94194} \pgfmath@def{atan}{577}{29.98494} +\pgfmath@def{atan}{578}{30.02791} \pgfmath@def{atan}{579}{30.07084} +\pgfmath@def{atan}{580}{30.11373} \pgfmath@def{atan}{581}{30.15658} +\pgfmath@def{atan}{582}{30.19940} \pgfmath@def{atan}{583}{30.24218} +\pgfmath@def{atan}{584}{30.28492} \pgfmath@def{atan}{585}{30.32763} +\pgfmath@def{atan}{586}{30.37030} \pgfmath@def{atan}{587}{30.41293} +\pgfmath@def{atan}{588}{30.45552} \pgfmath@def{atan}{589}{30.49808} +\pgfmath@def{atan}{590}{30.54060} \pgfmath@def{atan}{591}{30.58308} +\pgfmath@def{atan}{592}{30.62553} \pgfmath@def{atan}{593}{30.66794} +\pgfmath@def{atan}{594}{30.71031} \pgfmath@def{atan}{595}{30.75264} +\pgfmath@def{atan}{596}{30.79494} \pgfmath@def{atan}{597}{30.83720} +\pgfmath@def{atan}{598}{30.87942} \pgfmath@def{atan}{599}{30.92160} +\pgfmath@def{atan}{600}{30.96375} \pgfmath@def{atan}{601}{31.00586} +\pgfmath@def{atan}{602}{31.04794} \pgfmath@def{atan}{603}{31.08997} +\pgfmath@def{atan}{604}{31.13197} \pgfmath@def{atan}{605}{31.17393} +\pgfmath@def{atan}{606}{31.21586} \pgfmath@def{atan}{607}{31.25775} +\pgfmath@def{atan}{608}{31.29960} \pgfmath@def{atan}{609}{31.34141} +\pgfmath@def{atan}{610}{31.38319} \pgfmath@def{atan}{611}{31.42493} +\pgfmath@def{atan}{612}{31.46663} \pgfmath@def{atan}{613}{31.50829} +\pgfmath@def{atan}{614}{31.54992} \pgfmath@def{atan}{615}{31.59151} +\pgfmath@def{atan}{616}{31.63306} \pgfmath@def{atan}{617}{31.67458} +\pgfmath@def{atan}{618}{31.71606} \pgfmath@def{atan}{619}{31.75750} +\pgfmath@def{atan}{620}{31.79891} \pgfmath@def{atan}{621}{31.84028} +\pgfmath@def{atan}{622}{31.88161} \pgfmath@def{atan}{623}{31.92290} +\pgfmath@def{atan}{624}{31.96416} \pgfmath@def{atan}{625}{32.00538} +\pgfmath@def{atan}{626}{32.04656} \pgfmath@def{atan}{627}{32.08771} +\pgfmath@def{atan}{628}{32.12882} \pgfmath@def{atan}{629}{32.16989} +\pgfmath@def{atan}{630}{32.21092} \pgfmath@def{atan}{631}{32.25192} +\pgfmath@def{atan}{632}{32.29288} \pgfmath@def{atan}{633}{32.33381} +\pgfmath@def{atan}{634}{32.37469} \pgfmath@def{atan}{635}{32.41554} +\pgfmath@def{atan}{636}{32.45636} \pgfmath@def{atan}{637}{32.49713} +\pgfmath@def{atan}{638}{32.53787} \pgfmath@def{atan}{639}{32.57857} +\pgfmath@def{atan}{640}{32.61924} \pgfmath@def{atan}{641}{32.65987} +\pgfmath@def{atan}{642}{32.70046} \pgfmath@def{atan}{643}{32.74101} +\pgfmath@def{atan}{644}{32.78153} \pgfmath@def{atan}{645}{32.82201} +\pgfmath@def{atan}{646}{32.86246} \pgfmath@def{atan}{647}{32.90286} +\pgfmath@def{atan}{648}{32.94323} \pgfmath@def{atan}{649}{32.98357} +\pgfmath@def{atan}{650}{33.02386} \pgfmath@def{atan}{651}{33.06412} +\pgfmath@def{atan}{652}{33.10435} \pgfmath@def{atan}{653}{33.14453} +\pgfmath@def{atan}{654}{33.18468} \pgfmath@def{atan}{655}{33.22479} +\pgfmath@def{atan}{656}{33.26487} \pgfmath@def{atan}{657}{33.30491} +\pgfmath@def{atan}{658}{33.34491} \pgfmath@def{atan}{659}{33.38488} +\pgfmath@def{atan}{660}{33.42481} \pgfmath@def{atan}{661}{33.46470} +\pgfmath@def{atan}{662}{33.50455} \pgfmath@def{atan}{663}{33.54437} +\pgfmath@def{atan}{664}{33.58416} \pgfmath@def{atan}{665}{33.62390} +\pgfmath@def{atan}{666}{33.66361} \pgfmath@def{atan}{667}{33.70328} +\pgfmath@def{atan}{668}{33.74292} \pgfmath@def{atan}{669}{33.78252} +\pgfmath@def{atan}{670}{33.82208} \pgfmath@def{atan}{671}{33.86161} +\pgfmath@def{atan}{672}{33.90110} \pgfmath@def{atan}{673}{33.94055} +\pgfmath@def{atan}{674}{33.97997} \pgfmath@def{atan}{675}{34.01935} +\pgfmath@def{atan}{676}{34.05869} \pgfmath@def{atan}{677}{34.09800} +\pgfmath@def{atan}{678}{34.13727} \pgfmath@def{atan}{679}{34.17650} +\pgfmath@def{atan}{680}{34.21570} \pgfmath@def{atan}{681}{34.25486} +\pgfmath@def{atan}{682}{34.29398} \pgfmath@def{atan}{683}{34.33307} +\pgfmath@def{atan}{684}{34.37212} \pgfmath@def{atan}{685}{34.41114} +\pgfmath@def{atan}{686}{34.45012} \pgfmath@def{atan}{687}{34.48906} +\pgfmath@def{atan}{688}{34.52797} \pgfmath@def{atan}{689}{34.56684} +\pgfmath@def{atan}{690}{34.60567} \pgfmath@def{atan}{691}{34.64447} +\pgfmath@def{atan}{692}{34.68323} \pgfmath@def{atan}{693}{34.72195} +\pgfmath@def{atan}{694}{34.76064} \pgfmath@def{atan}{695}{34.79930} +\pgfmath@def{atan}{696}{34.83791} \pgfmath@def{atan}{697}{34.87649} +\pgfmath@def{atan}{698}{34.91504} \pgfmath@def{atan}{699}{34.95354} +\pgfmath@def{atan}{700}{34.99202} \pgfmath@def{atan}{701}{35.03045} +\pgfmath@def{atan}{702}{35.06885} \pgfmath@def{atan}{703}{35.10721} +\pgfmath@def{atan}{704}{35.14554} \pgfmath@def{atan}{705}{35.18383} +\pgfmath@def{atan}{706}{35.22209} \pgfmath@def{atan}{707}{35.26031} +\pgfmath@def{atan}{708}{35.29849} \pgfmath@def{atan}{709}{35.33664} +\pgfmath@def{atan}{710}{35.37475} \pgfmath@def{atan}{711}{35.41282} +\pgfmath@def{atan}{712}{35.45086} \pgfmath@def{atan}{713}{35.48886} +\pgfmath@def{atan}{714}{35.52683} \pgfmath@def{atan}{715}{35.56476} +\pgfmath@def{atan}{716}{35.60266} \pgfmath@def{atan}{717}{35.64052} +\pgfmath@def{atan}{718}{35.67834} \pgfmath@def{atan}{719}{35.71613} +\pgfmath@def{atan}{720}{35.75388} \pgfmath@def{atan}{721}{35.79160} +\pgfmath@def{atan}{722}{35.82928} \pgfmath@def{atan}{723}{35.86692} +\pgfmath@def{atan}{724}{35.90453} \pgfmath@def{atan}{725}{35.94211} +\pgfmath@def{atan}{726}{35.97965} \pgfmath@def{atan}{727}{36.01715} +\pgfmath@def{atan}{728}{36.05461} \pgfmath@def{atan}{729}{36.09204} +\pgfmath@def{atan}{730}{36.12944} \pgfmath@def{atan}{731}{36.16680} +\pgfmath@def{atan}{732}{36.20412} \pgfmath@def{atan}{733}{36.24141} +\pgfmath@def{atan}{734}{36.27866} \pgfmath@def{atan}{735}{36.31588} +\pgfmath@def{atan}{736}{36.35306} \pgfmath@def{atan}{737}{36.39021} +\pgfmath@def{atan}{738}{36.42732} \pgfmath@def{atan}{739}{36.46440} +\pgfmath@def{atan}{740}{36.50144} \pgfmath@def{atan}{741}{36.53844} +\pgfmath@def{atan}{742}{36.57541} \pgfmath@def{atan}{743}{36.61234} +\pgfmath@def{atan}{744}{36.64924} \pgfmath@def{atan}{745}{36.68611} +\pgfmath@def{atan}{746}{36.72293} \pgfmath@def{atan}{747}{36.75973} +\pgfmath@def{atan}{748}{36.79648} \pgfmath@def{atan}{749}{36.83321} +\pgfmath@def{atan}{750}{36.86989} \pgfmath@def{atan}{751}{36.90654} +\pgfmath@def{atan}{752}{36.94316} \pgfmath@def{atan}{753}{36.97974} +\pgfmath@def{atan}{754}{37.01629} \pgfmath@def{atan}{755}{37.05280} +\pgfmath@def{atan}{756}{37.08928} \pgfmath@def{atan}{757}{37.12572} +\pgfmath@def{atan}{758}{37.16212} \pgfmath@def{atan}{759}{37.19849} +\pgfmath@def{atan}{760}{37.23483} \pgfmath@def{atan}{761}{37.27113} +\pgfmath@def{atan}{762}{37.30740} \pgfmath@def{atan}{763}{37.34363} +\pgfmath@def{atan}{764}{37.37982} \pgfmath@def{atan}{765}{37.41598} +\pgfmath@def{atan}{766}{37.45211} \pgfmath@def{atan}{767}{37.48820} +\pgfmath@def{atan}{768}{37.52426} \pgfmath@def{atan}{769}{37.56028} +\pgfmath@def{atan}{770}{37.59627} \pgfmath@def{atan}{771}{37.63222} +\pgfmath@def{atan}{772}{37.66814} \pgfmath@def{atan}{773}{37.70402} +\pgfmath@def{atan}{774}{37.73987} \pgfmath@def{atan}{775}{37.77568} +\pgfmath@def{atan}{776}{37.81146} \pgfmath@def{atan}{777}{37.84720} +\pgfmath@def{atan}{778}{37.88291} \pgfmath@def{atan}{779}{37.91859} +\pgfmath@def{atan}{780}{37.95423} \pgfmath@def{atan}{781}{37.98983} +\pgfmath@def{atan}{782}{38.02540} \pgfmath@def{atan}{783}{38.06094} +\pgfmath@def{atan}{784}{38.09644} \pgfmath@def{atan}{785}{38.13191} +\pgfmath@def{atan}{786}{38.16734} \pgfmath@def{atan}{787}{38.20274} +\pgfmath@def{atan}{788}{38.23811} \pgfmath@def{atan}{789}{38.27344} +\pgfmath@def{atan}{790}{38.30873} \pgfmath@def{atan}{791}{38.34399} +\pgfmath@def{atan}{792}{38.37922} \pgfmath@def{atan}{793}{38.41441} +\pgfmath@def{atan}{794}{38.44957} \pgfmath@def{atan}{795}{38.48469} +\pgfmath@def{atan}{796}{38.51979} \pgfmath@def{atan}{797}{38.55484} +\pgfmath@def{atan}{798}{38.58986} \pgfmath@def{atan}{799}{38.62485} +\pgfmath@def{atan}{800}{38.65980} \pgfmath@def{atan}{801}{38.69472} +\pgfmath@def{atan}{802}{38.72961} \pgfmath@def{atan}{803}{38.76446} +\pgfmath@def{atan}{804}{38.79928} \pgfmath@def{atan}{805}{38.83406} +\pgfmath@def{atan}{806}{38.86881} \pgfmath@def{atan}{807}{38.90353} +\pgfmath@def{atan}{808}{38.93821} \pgfmath@def{atan}{809}{38.97285} +\pgfmath@def{atan}{810}{39.00747} \pgfmath@def{atan}{811}{39.04205} +\pgfmath@def{atan}{812}{39.07659} \pgfmath@def{atan}{813}{39.11111} +\pgfmath@def{atan}{814}{39.14558} \pgfmath@def{atan}{815}{39.18003} +\pgfmath@def{atan}{816}{39.21444} \pgfmath@def{atan}{817}{39.24882} +\pgfmath@def{atan}{818}{39.28316} \pgfmath@def{atan}{819}{39.31747} +\pgfmath@def{atan}{820}{39.35175} \pgfmath@def{atan}{821}{39.38599} +\pgfmath@def{atan}{822}{39.42020} \pgfmath@def{atan}{823}{39.45438} +\pgfmath@def{atan}{824}{39.48852} \pgfmath@def{atan}{825}{39.52263} +\pgfmath@def{atan}{826}{39.55670} \pgfmath@def{atan}{827}{39.59074} +\pgfmath@def{atan}{828}{39.62475} \pgfmath@def{atan}{829}{39.65873} +\pgfmath@def{atan}{830}{39.69267} \pgfmath@def{atan}{831}{39.72658} +\pgfmath@def{atan}{832}{39.76045} \pgfmath@def{atan}{833}{39.79429} +\pgfmath@def{atan}{834}{39.82810} \pgfmath@def{atan}{835}{39.86188} +\pgfmath@def{atan}{836}{39.89562} \pgfmath@def{atan}{837}{39.92933} +\pgfmath@def{atan}{838}{39.96300} \pgfmath@def{atan}{839}{39.99665} +\pgfmath@def{atan}{840}{40.03025} \pgfmath@def{atan}{841}{40.06383} +\pgfmath@def{atan}{842}{40.09737} \pgfmath@def{atan}{843}{40.13088} +\pgfmath@def{atan}{844}{40.16436} \pgfmath@def{atan}{845}{40.19781} +\pgfmath@def{atan}{846}{40.23122} \pgfmath@def{atan}{847}{40.26459} +\pgfmath@def{atan}{848}{40.29794} \pgfmath@def{atan}{849}{40.33125} +\pgfmath@def{atan}{850}{40.36453} \pgfmath@def{atan}{851}{40.39778} +\pgfmath@def{atan}{852}{40.43099} \pgfmath@def{atan}{853}{40.46417} +\pgfmath@def{atan}{854}{40.49732} \pgfmath@def{atan}{855}{40.53044} +\pgfmath@def{atan}{856}{40.56352} \pgfmath@def{atan}{857}{40.59657} +\pgfmath@def{atan}{858}{40.62959} \pgfmath@def{atan}{859}{40.66257} +\pgfmath@def{atan}{860}{40.69553} \pgfmath@def{atan}{861}{40.72845} +\pgfmath@def{atan}{862}{40.76133} \pgfmath@def{atan}{863}{40.79419} +\pgfmath@def{atan}{864}{40.82701} \pgfmath@def{atan}{865}{40.85980} +\pgfmath@def{atan}{866}{40.89256} \pgfmath@def{atan}{867}{40.92528} +\pgfmath@def{atan}{868}{40.95798} \pgfmath@def{atan}{869}{40.99064} +\pgfmath@def{atan}{870}{41.02326} \pgfmath@def{atan}{871}{41.05586} +\pgfmath@def{atan}{872}{41.08842} \pgfmath@def{atan}{873}{41.12095} +\pgfmath@def{atan}{874}{41.15345} \pgfmath@def{atan}{875}{41.18592} +\pgfmath@def{atan}{876}{41.21836} \pgfmath@def{atan}{877}{41.25076} +\pgfmath@def{atan}{878}{41.28313} \pgfmath@def{atan}{879}{41.31547} +\pgfmath@def{atan}{880}{41.34777} \pgfmath@def{atan}{881}{41.38005} +\pgfmath@def{atan}{882}{41.41229} \pgfmath@def{atan}{883}{41.44450} +\pgfmath@def{atan}{884}{41.47668} \pgfmath@def{atan}{885}{41.50882} +\pgfmath@def{atan}{886}{41.54094} \pgfmath@def{atan}{887}{41.57302} +\pgfmath@def{atan}{888}{41.60507} \pgfmath@def{atan}{889}{41.63709} +\pgfmath@def{atan}{890}{41.66908} \pgfmath@def{atan}{891}{41.70103} +\pgfmath@def{atan}{892}{41.73296} \pgfmath@def{atan}{893}{41.76485} +\pgfmath@def{atan}{894}{41.79671} \pgfmath@def{atan}{895}{41.82854} +\pgfmath@def{atan}{896}{41.86034} \pgfmath@def{atan}{897}{41.89210} +\pgfmath@def{atan}{898}{41.92383} \pgfmath@def{atan}{899}{41.95554} +\pgfmath@def{atan}{900}{41.98721} \pgfmath@def{atan}{901}{42.01885} +\pgfmath@def{atan}{902}{42.05046} \pgfmath@def{atan}{903}{42.08203} +\pgfmath@def{atan}{904}{42.11358} \pgfmath@def{atan}{905}{42.14509} +\pgfmath@def{atan}{906}{42.17657} \pgfmath@def{atan}{907}{42.20802} +\pgfmath@def{atan}{908}{42.23944} \pgfmath@def{atan}{909}{42.27083} +\pgfmath@def{atan}{910}{42.30219} \pgfmath@def{atan}{911}{42.33352} +\pgfmath@def{atan}{912}{42.36481} \pgfmath@def{atan}{913}{42.39607} +\pgfmath@def{atan}{914}{42.42731} \pgfmath@def{atan}{915}{42.45851} +\pgfmath@def{atan}{916}{42.48968} \pgfmath@def{atan}{917}{42.52082} +\pgfmath@def{atan}{918}{42.55193} \pgfmath@def{atan}{919}{42.58300} +\pgfmath@def{atan}{920}{42.61405} \pgfmath@def{atan}{921}{42.64507} +\pgfmath@def{atan}{922}{42.67605} \pgfmath@def{atan}{923}{42.70701} +\pgfmath@def{atan}{924}{42.73793} \pgfmath@def{atan}{925}{42.76882} +\pgfmath@def{atan}{926}{42.79968} \pgfmath@def{atan}{927}{42.83051} +\pgfmath@def{atan}{928}{42.86131} \pgfmath@def{atan}{929}{42.89208} +\pgfmath@def{atan}{930}{42.92282} \pgfmath@def{atan}{931}{42.95353} +\pgfmath@def{atan}{932}{42.98421} \pgfmath@def{atan}{933}{43.01485} +\pgfmath@def{atan}{934}{43.04547} \pgfmath@def{atan}{935}{43.07605} +\pgfmath@def{atan}{936}{43.10661} \pgfmath@def{atan}{937}{43.13713} +\pgfmath@def{atan}{938}{43.16763} \pgfmath@def{atan}{939}{43.19809} +\pgfmath@def{atan}{940}{43.22853} \pgfmath@def{atan}{941}{43.25893} +\pgfmath@def{atan}{942}{43.28930} \pgfmath@def{atan}{943}{43.31964} +\pgfmath@def{atan}{944}{43.34996} \pgfmath@def{atan}{945}{43.38024} +\pgfmath@def{atan}{946}{43.41049} \pgfmath@def{atan}{947}{43.44071} +\pgfmath@def{atan}{948}{43.47090} \pgfmath@def{atan}{949}{43.50106} +\pgfmath@def{atan}{950}{43.53119} \pgfmath@def{atan}{951}{43.56130} +\pgfmath@def{atan}{952}{43.59137} \pgfmath@def{atan}{953}{43.62141} +\pgfmath@def{atan}{954}{43.65142} \pgfmath@def{atan}{955}{43.68140} +\pgfmath@def{atan}{956}{43.71135} \pgfmath@def{atan}{957}{43.74127} +\pgfmath@def{atan}{958}{43.77116} \pgfmath@def{atan}{959}{43.80102} +\pgfmath@def{atan}{960}{43.83086} \pgfmath@def{atan}{961}{43.86066} +\pgfmath@def{atan}{962}{43.89043} \pgfmath@def{atan}{963}{43.92017} +\pgfmath@def{atan}{964}{43.94988} \pgfmath@def{atan}{965}{43.97957} +\pgfmath@def{atan}{966}{44.00922} \pgfmath@def{atan}{967}{44.03884} +\pgfmath@def{atan}{968}{44.06844} \pgfmath@def{atan}{969}{44.09800} +\pgfmath@def{atan}{970}{44.12754} \pgfmath@def{atan}{971}{44.15704} +\pgfmath@def{atan}{972}{44.18652} \pgfmath@def{atan}{973}{44.21597} +\pgfmath@def{atan}{974}{44.24538} \pgfmath@def{atan}{975}{44.27477} +\pgfmath@def{atan}{976}{44.30413} \pgfmath@def{atan}{977}{44.33346} +\pgfmath@def{atan}{978}{44.36276} \pgfmath@def{atan}{979}{44.39203} +\pgfmath@def{atan}{980}{44.42127} \pgfmath@def{atan}{981}{44.45048} +\pgfmath@def{atan}{982}{44.47966} \pgfmath@def{atan}{983}{44.50882} +\pgfmath@def{atan}{984}{44.53794} \pgfmath@def{atan}{985}{44.56704} +\pgfmath@def{atan}{986}{44.59610} \pgfmath@def{atan}{987}{44.62514} +\pgfmath@def{atan}{988}{44.65415} \pgfmath@def{atan}{989}{44.68313} +\pgfmath@def{atan}{990}{44.71208} \pgfmath@def{atan}{991}{44.74100} +\pgfmath@def{atan}{992}{44.76989} \pgfmath@def{atan}{993}{44.79876} +\pgfmath@def{atan}{994}{44.82759} \pgfmath@def{atan}{995}{44.85640} +\pgfmath@def{atan}{996}{44.88517} \pgfmath@def{atan}{997}{44.91392} +\pgfmath@def{atan}{998}{44.94264} \pgfmath@def{atan}{999}{44.97133} +\pgfmath@def{atan}{1000}{45.00000} + +\pgfmath@def{acos}{0}{90.00000} \pgfmath@def{acos}{1}{89.94270} +\pgfmath@def{acos}{2}{89.88540} \pgfmath@def{acos}{3}{89.82811} +\pgfmath@def{acos}{4}{89.77081} \pgfmath@def{acos}{5}{89.71352} +\pgfmath@def{acos}{6}{89.65622} \pgfmath@def{acos}{7}{89.59892} +\pgfmath@def{acos}{8}{89.54162} \pgfmath@def{acos}{9}{89.48433} +\pgfmath@def{acos}{10}{89.42703} \pgfmath@def{acos}{11}{89.36973} +\pgfmath@def{acos}{12}{89.31243} \pgfmath@def{acos}{13}{89.25513} +\pgfmath@def{acos}{14}{89.19783} \pgfmath@def{acos}{15}{89.14053} +\pgfmath@def{acos}{16}{89.08322} \pgfmath@def{acos}{17}{89.02592} +\pgfmath@def{acos}{18}{88.96862} \pgfmath@def{acos}{19}{88.91131} +\pgfmath@def{acos}{20}{88.85400} \pgfmath@def{acos}{21}{88.79670} +\pgfmath@def{acos}{22}{88.73939} \pgfmath@def{acos}{23}{88.68208} +\pgfmath@def{acos}{24}{88.62476} \pgfmath@def{acos}{25}{88.56745} +\pgfmath@def{acos}{26}{88.51014} \pgfmath@def{acos}{27}{88.45282} +\pgfmath@def{acos}{28}{88.39550} \pgfmath@def{acos}{29}{88.33818} +\pgfmath@def{acos}{30}{88.28086} \pgfmath@def{acos}{31}{88.22354} +\pgfmath@def{acos}{32}{88.16622} \pgfmath@def{acos}{33}{88.10889} +\pgfmath@def{acos}{34}{88.05156} \pgfmath@def{acos}{35}{87.99423} +\pgfmath@def{acos}{36}{87.93690} \pgfmath@def{acos}{37}{87.87957} +\pgfmath@def{acos}{38}{87.82223} \pgfmath@def{acos}{39}{87.76489} +\pgfmath@def{acos}{40}{87.70755} \pgfmath@def{acos}{41}{87.65021} +\pgfmath@def{acos}{42}{87.59286} \pgfmath@def{acos}{43}{87.53552} +\pgfmath@def{acos}{44}{87.47817} \pgfmath@def{acos}{45}{87.42081} +\pgfmath@def{acos}{46}{87.36346} \pgfmath@def{acos}{47}{87.30610} +\pgfmath@def{acos}{48}{87.24874} \pgfmath@def{acos}{49}{87.19138} +\pgfmath@def{acos}{50}{87.13401} \pgfmath@def{acos}{51}{87.07664} +\pgfmath@def{acos}{52}{87.01927} \pgfmath@def{acos}{53}{86.96190} +\pgfmath@def{acos}{54}{86.90452} \pgfmath@def{acos}{55}{86.84714} +\pgfmath@def{acos}{56}{86.78975} \pgfmath@def{acos}{57}{86.73237} +\pgfmath@def{acos}{58}{86.67497} \pgfmath@def{acos}{59}{86.61758} +\pgfmath@def{acos}{60}{86.56018} \pgfmath@def{acos}{61}{86.50278} +\pgfmath@def{acos}{62}{86.44538} \pgfmath@def{acos}{63}{86.38797} +\pgfmath@def{acos}{64}{86.33056} \pgfmath@def{acos}{65}{86.27314} +\pgfmath@def{acos}{66}{86.21572} \pgfmath@def{acos}{67}{86.15830} +\pgfmath@def{acos}{68}{86.10087} \pgfmath@def{acos}{69}{86.04344} +\pgfmath@def{acos}{70}{85.98601} \pgfmath@def{acos}{71}{85.92857} +\pgfmath@def{acos}{72}{85.87113} \pgfmath@def{acos}{73}{85.81368} +\pgfmath@def{acos}{74}{85.75623} \pgfmath@def{acos}{75}{85.69877} +\pgfmath@def{acos}{76}{85.64131} \pgfmath@def{acos}{77}{85.58385} +\pgfmath@def{acos}{78}{85.52638} \pgfmath@def{acos}{79}{85.46891} +\pgfmath@def{acos}{80}{85.41143} \pgfmath@def{acos}{81}{85.35395} +\pgfmath@def{acos}{82}{85.29646} \pgfmath@def{acos}{83}{85.23897} +\pgfmath@def{acos}{84}{85.18147} \pgfmath@def{acos}{85}{85.12397} +\pgfmath@def{acos}{86}{85.06646} \pgfmath@def{acos}{87}{85.00895} +\pgfmath@def{acos}{88}{84.95144} \pgfmath@def{acos}{89}{84.89392} +\pgfmath@def{acos}{90}{84.83639} \pgfmath@def{acos}{91}{84.77886} +\pgfmath@def{acos}{92}{84.72132} \pgfmath@def{acos}{93}{84.66378} +\pgfmath@def{acos}{94}{84.60623} \pgfmath@def{acos}{95}{84.54868} +\pgfmath@def{acos}{96}{84.49112} \pgfmath@def{acos}{97}{84.43355} +\pgfmath@def{acos}{98}{84.37598} \pgfmath@def{acos}{99}{84.31841} +\pgfmath@def{acos}{100}{84.26083} \pgfmath@def{acos}{101}{84.20324} +\pgfmath@def{acos}{102}{84.14564} \pgfmath@def{acos}{103}{84.08805} +\pgfmath@def{acos}{104}{84.03044} \pgfmath@def{acos}{105}{83.97283} +\pgfmath@def{acos}{106}{83.91521} \pgfmath@def{acos}{107}{83.85759} +\pgfmath@def{acos}{108}{83.79996} \pgfmath@def{acos}{109}{83.74232} +\pgfmath@def{acos}{110}{83.68468} \pgfmath@def{acos}{111}{83.62703} +\pgfmath@def{acos}{112}{83.56938} \pgfmath@def{acos}{113}{83.51171} +\pgfmath@def{acos}{114}{83.45405} \pgfmath@def{acos}{115}{83.39637} +\pgfmath@def{acos}{116}{83.33869} \pgfmath@def{acos}{117}{83.28100} +\pgfmath@def{acos}{118}{83.22330} \pgfmath@def{acos}{119}{83.16560} +\pgfmath@def{acos}{120}{83.10789} \pgfmath@def{acos}{121}{83.05018} +\pgfmath@def{acos}{122}{82.99245} \pgfmath@def{acos}{123}{82.93472} +\pgfmath@def{acos}{124}{82.87698} \pgfmath@def{acos}{125}{82.81924} +\pgfmath@def{acos}{126}{82.76149} \pgfmath@def{acos}{127}{82.70373} +\pgfmath@def{acos}{128}{82.64596} \pgfmath@def{acos}{129}{82.58819} +\pgfmath@def{acos}{130}{82.53040} \pgfmath@def{acos}{131}{82.47261} +\pgfmath@def{acos}{132}{82.41482} \pgfmath@def{acos}{133}{82.35701} +\pgfmath@def{acos}{134}{82.29920} \pgfmath@def{acos}{135}{82.24138} +\pgfmath@def{acos}{136}{82.18355} \pgfmath@def{acos}{137}{82.12571} +\pgfmath@def{acos}{138}{82.06786} \pgfmath@def{acos}{139}{82.01001} +\pgfmath@def{acos}{140}{81.95215} \pgfmath@def{acos}{141}{81.89428} +\pgfmath@def{acos}{142}{81.83640} \pgfmath@def{acos}{143}{81.77851} +\pgfmath@def{acos}{144}{81.72062} \pgfmath@def{acos}{145}{81.66272} +\pgfmath@def{acos}{146}{81.60480} \pgfmath@def{acos}{147}{81.54688} +\pgfmath@def{acos}{148}{81.48895} \pgfmath@def{acos}{149}{81.43102} +\pgfmath@def{acos}{150}{81.37307} \pgfmath@def{acos}{151}{81.31511} +\pgfmath@def{acos}{152}{81.25715} \pgfmath@def{acos}{153}{81.19917} +\pgfmath@def{acos}{154}{81.14119} \pgfmath@def{acos}{155}{81.08320} +\pgfmath@def{acos}{156}{81.02520} \pgfmath@def{acos}{157}{80.96719} +\pgfmath@def{acos}{158}{80.90917} \pgfmath@def{acos}{159}{80.85114} +\pgfmath@def{acos}{160}{80.79310} \pgfmath@def{acos}{161}{80.73505} +\pgfmath@def{acos}{162}{80.67699} \pgfmath@def{acos}{163}{80.61893} +\pgfmath@def{acos}{164}{80.56085} \pgfmath@def{acos}{165}{80.50276} +\pgfmath@def{acos}{166}{80.44466} \pgfmath@def{acos}{167}{80.38656} +\pgfmath@def{acos}{168}{80.32844} \pgfmath@def{acos}{169}{80.27031} +\pgfmath@def{acos}{170}{80.21218} \pgfmath@def{acos}{171}{80.15403} +\pgfmath@def{acos}{172}{80.09587} \pgfmath@def{acos}{173}{80.03770} +\pgfmath@def{acos}{174}{79.97953} \pgfmath@def{acos}{175}{79.92134} +\pgfmath@def{acos}{176}{79.86314} \pgfmath@def{acos}{177}{79.80493} +\pgfmath@def{acos}{178}{79.74671} \pgfmath@def{acos}{179}{79.68848} +\pgfmath@def{acos}{180}{79.63024} \pgfmath@def{acos}{181}{79.57198} +\pgfmath@def{acos}{182}{79.51372} \pgfmath@def{acos}{183}{79.45545} +\pgfmath@def{acos}{184}{79.39716} \pgfmath@def{acos}{185}{79.33886} +\pgfmath@def{acos}{186}{79.28056} \pgfmath@def{acos}{187}{79.22224} +\pgfmath@def{acos}{188}{79.16391} \pgfmath@def{acos}{189}{79.10556} +\pgfmath@def{acos}{190}{79.04721} \pgfmath@def{acos}{191}{78.98885} +\pgfmath@def{acos}{192}{78.93047} \pgfmath@def{acos}{193}{78.87208} +\pgfmath@def{acos}{194}{78.81368} \pgfmath@def{acos}{195}{78.75527} +\pgfmath@def{acos}{196}{78.69685} \pgfmath@def{acos}{197}{78.63841} +\pgfmath@def{acos}{198}{78.57997} \pgfmath@def{acos}{199}{78.52151} +\pgfmath@def{acos}{200}{78.46304} \pgfmath@def{acos}{201}{78.40455} +\pgfmath@def{acos}{202}{78.34606} \pgfmath@def{acos}{203}{78.28755} +\pgfmath@def{acos}{204}{78.22903} \pgfmath@def{acos}{205}{78.17050} +\pgfmath@def{acos}{206}{78.11195} \pgfmath@def{acos}{207}{78.05339} +\pgfmath@def{acos}{208}{77.99482} \pgfmath@def{acos}{209}{77.93624} +\pgfmath@def{acos}{210}{77.87764} \pgfmath@def{acos}{211}{77.81903} +\pgfmath@def{acos}{212}{77.76041} \pgfmath@def{acos}{213}{77.70178} +\pgfmath@def{acos}{214}{77.64313} \pgfmath@def{acos}{215}{77.58447} +\pgfmath@def{acos}{216}{77.52579} \pgfmath@def{acos}{217}{77.46711} +\pgfmath@def{acos}{218}{77.40841} \pgfmath@def{acos}{219}{77.34969} +\pgfmath@def{acos}{220}{77.29096} \pgfmath@def{acos}{221}{77.23222} +\pgfmath@def{acos}{222}{77.17347} \pgfmath@def{acos}{223}{77.11470} +\pgfmath@def{acos}{224}{77.05591} \pgfmath@def{acos}{225}{76.99712} +\pgfmath@def{acos}{226}{76.93831} \pgfmath@def{acos}{227}{76.87948} +\pgfmath@def{acos}{228}{76.82064} \pgfmath@def{acos}{229}{76.76179} +\pgfmath@def{acos}{230}{76.70292} \pgfmath@def{acos}{231}{76.64404} +\pgfmath@def{acos}{232}{76.58515} \pgfmath@def{acos}{233}{76.52624} +\pgfmath@def{acos}{234}{76.46731} \pgfmath@def{acos}{235}{76.40837} +\pgfmath@def{acos}{236}{76.34942} \pgfmath@def{acos}{237}{76.29045} +\pgfmath@def{acos}{238}{76.23147} \pgfmath@def{acos}{239}{76.17247} +\pgfmath@def{acos}{240}{76.11346} \pgfmath@def{acos}{241}{76.05443} +\pgfmath@def{acos}{242}{75.99538} \pgfmath@def{acos}{243}{75.93632} +\pgfmath@def{acos}{244}{75.87725} \pgfmath@def{acos}{245}{75.81816} +\pgfmath@def{acos}{246}{75.75906} \pgfmath@def{acos}{247}{75.69994} +\pgfmath@def{acos}{248}{75.64080} \pgfmath@def{acos}{249}{75.58165} +\pgfmath@def{acos}{250}{75.52248} \pgfmath@def{acos}{251}{75.46330} +\pgfmath@def{acos}{252}{75.40410} \pgfmath@def{acos}{253}{75.34489} +\pgfmath@def{acos}{254}{75.28566} \pgfmath@def{acos}{255}{75.22641} +\pgfmath@def{acos}{256}{75.16715} \pgfmath@def{acos}{257}{75.10787} +\pgfmath@def{acos}{258}{75.04857} \pgfmath@def{acos}{259}{74.98926} +\pgfmath@def{acos}{260}{74.92993} \pgfmath@def{acos}{261}{74.87059} +\pgfmath@def{acos}{262}{74.81123} \pgfmath@def{acos}{263}{74.75185} +\pgfmath@def{acos}{264}{74.69245} \pgfmath@def{acos}{265}{74.63304} +\pgfmath@def{acos}{266}{74.57361} \pgfmath@def{acos}{267}{74.51417} +\pgfmath@def{acos}{268}{74.45471} \pgfmath@def{acos}{269}{74.39523} +\pgfmath@def{acos}{270}{74.33573} \pgfmath@def{acos}{271}{74.27621} +\pgfmath@def{acos}{272}{74.21668} \pgfmath@def{acos}{273}{74.15713} +\pgfmath@def{acos}{274}{74.09757} \pgfmath@def{acos}{275}{74.03798} +\pgfmath@def{acos}{276}{73.97838} \pgfmath@def{acos}{277}{73.91876} +\pgfmath@def{acos}{278}{73.85912} \pgfmath@def{acos}{279}{73.79946} +\pgfmath@def{acos}{280}{73.73979} \pgfmath@def{acos}{281}{73.68010} +\pgfmath@def{acos}{282}{73.62039} \pgfmath@def{acos}{283}{73.56066} +\pgfmath@def{acos}{284}{73.50091} \pgfmath@def{acos}{285}{73.44115} +\pgfmath@def{acos}{286}{73.38136} \pgfmath@def{acos}{287}{73.32156} +\pgfmath@def{acos}{288}{73.26174} \pgfmath@def{acos}{289}{73.20190} +\pgfmath@def{acos}{290}{73.14204} \pgfmath@def{acos}{291}{73.08216} +\pgfmath@def{acos}{292}{73.02226} \pgfmath@def{acos}{293}{72.96235} +\pgfmath@def{acos}{294}{72.90241} \pgfmath@def{acos}{295}{72.84246} +\pgfmath@def{acos}{296}{72.78248} \pgfmath@def{acos}{297}{72.72249} +\pgfmath@def{acos}{298}{72.66248} \pgfmath@def{acos}{299}{72.60244} +\pgfmath@def{acos}{300}{72.54239} \pgfmath@def{acos}{301}{72.48232} +\pgfmath@def{acos}{302}{72.42223} \pgfmath@def{acos}{303}{72.36212} +\pgfmath@def{acos}{304}{72.30198} \pgfmath@def{acos}{305}{72.24183} +\pgfmath@def{acos}{306}{72.18166} \pgfmath@def{acos}{307}{72.12147} +\pgfmath@def{acos}{308}{72.06125} \pgfmath@def{acos}{309}{72.00102} +\pgfmath@def{acos}{310}{71.94077} \pgfmath@def{acos}{311}{71.88049} +\pgfmath@def{acos}{312}{71.82019} \pgfmath@def{acos}{313}{71.75988} +\pgfmath@def{acos}{314}{71.69954} \pgfmath@def{acos}{315}{71.63918} +\pgfmath@def{acos}{316}{71.57880} \pgfmath@def{acos}{317}{71.51840} +\pgfmath@def{acos}{318}{71.45798} \pgfmath@def{acos}{319}{71.39754} +\pgfmath@def{acos}{320}{71.33707} \pgfmath@def{acos}{321}{71.27658} +\pgfmath@def{acos}{322}{71.21608} \pgfmath@def{acos}{323}{71.15555} +\pgfmath@def{acos}{324}{71.09499} \pgfmath@def{acos}{325}{71.03442} +\pgfmath@def{acos}{326}{70.97382} \pgfmath@def{acos}{327}{70.91321} +\pgfmath@def{acos}{328}{70.85257} \pgfmath@def{acos}{329}{70.79190} +\pgfmath@def{acos}{330}{70.73122} \pgfmath@def{acos}{331}{70.67051} +\pgfmath@def{acos}{332}{70.60978} \pgfmath@def{acos}{333}{70.54903} +\pgfmath@def{acos}{334}{70.48826} \pgfmath@def{acos}{335}{70.42746} +\pgfmath@def{acos}{336}{70.36664} \pgfmath@def{acos}{337}{70.30579} +\pgfmath@def{acos}{338}{70.24493} \pgfmath@def{acos}{339}{70.18404} +\pgfmath@def{acos}{340}{70.12312} \pgfmath@def{acos}{341}{70.06218} +\pgfmath@def{acos}{342}{70.00122} \pgfmath@def{acos}{343}{69.94024} +\pgfmath@def{acos}{344}{69.87923} \pgfmath@def{acos}{345}{69.81820} +\pgfmath@def{acos}{346}{69.75714} \pgfmath@def{acos}{347}{69.69606} +\pgfmath@def{acos}{348}{69.63496} \pgfmath@def{acos}{349}{69.57383} +\pgfmath@def{acos}{350}{69.51268} \pgfmath@def{acos}{351}{69.45150} +\pgfmath@def{acos}{352}{69.39030} \pgfmath@def{acos}{353}{69.32908} +\pgfmath@def{acos}{354}{69.26783} \pgfmath@def{acos}{355}{69.20655} +\pgfmath@def{acos}{356}{69.14525} \pgfmath@def{acos}{357}{69.08393} +\pgfmath@def{acos}{358}{69.02258} \pgfmath@def{acos}{359}{68.96120} +\pgfmath@def{acos}{360}{68.89980} \pgfmath@def{acos}{361}{68.83837} +\pgfmath@def{acos}{362}{68.77692} \pgfmath@def{acos}{363}{68.71544} +\pgfmath@def{acos}{364}{68.65394} \pgfmath@def{acos}{365}{68.59241} +\pgfmath@def{acos}{366}{68.53086} \pgfmath@def{acos}{367}{68.46928} +\pgfmath@def{acos}{368}{68.40767} \pgfmath@def{acos}{369}{68.34604} +\pgfmath@def{acos}{370}{68.28438} \pgfmath@def{acos}{371}{68.22269} +\pgfmath@def{acos}{372}{68.16098} \pgfmath@def{acos}{373}{68.09924} +\pgfmath@def{acos}{374}{68.03748} \pgfmath@def{acos}{375}{67.97568} +\pgfmath@def{acos}{376}{67.91386} \pgfmath@def{acos}{377}{67.85202} +\pgfmath@def{acos}{378}{67.79014} \pgfmath@def{acos}{379}{67.72824} +\pgfmath@def{acos}{380}{67.66631} \pgfmath@def{acos}{381}{67.60436} +\pgfmath@def{acos}{382}{67.54237} \pgfmath@def{acos}{383}{67.48036} +\pgfmath@def{acos}{384}{67.41832} \pgfmath@def{acos}{385}{67.35626} +\pgfmath@def{acos}{386}{67.29416} \pgfmath@def{acos}{387}{67.23204} +\pgfmath@def{acos}{388}{67.16988} \pgfmath@def{acos}{389}{67.10770} +\pgfmath@def{acos}{390}{67.04550} \pgfmath@def{acos}{391}{66.98326} +\pgfmath@def{acos}{392}{66.92099} \pgfmath@def{acos}{393}{66.85870} +\pgfmath@def{acos}{394}{66.79637} \pgfmath@def{acos}{395}{66.73402} +\pgfmath@def{acos}{396}{66.67164} \pgfmath@def{acos}{397}{66.60923} +\pgfmath@def{acos}{398}{66.54679} \pgfmath@def{acos}{399}{66.48432} +\pgfmath@def{acos}{400}{66.42182} \pgfmath@def{acos}{401}{66.35929} +\pgfmath@def{acos}{402}{66.29673} \pgfmath@def{acos}{403}{66.23414} +\pgfmath@def{acos}{404}{66.17152} \pgfmath@def{acos}{405}{66.10887} +\pgfmath@def{acos}{406}{66.04619} \pgfmath@def{acos}{407}{65.98348} +\pgfmath@def{acos}{408}{65.92074} \pgfmath@def{acos}{409}{65.85796} +\pgfmath@def{acos}{410}{65.79516} \pgfmath@def{acos}{411}{65.73233} +\pgfmath@def{acos}{412}{65.66946} \pgfmath@def{acos}{413}{65.60657} +\pgfmath@def{acos}{414}{65.54364} \pgfmath@def{acos}{415}{65.48068} +\pgfmath@def{acos}{416}{65.41769} \pgfmath@def{acos}{417}{65.35467} +\pgfmath@def{acos}{418}{65.29161} \pgfmath@def{acos}{419}{65.22853} +\pgfmath@def{acos}{420}{65.16541} \pgfmath@def{acos}{421}{65.10226} +\pgfmath@def{acos}{422}{65.03908} \pgfmath@def{acos}{423}{64.97586} +\pgfmath@def{acos}{424}{64.91261} \pgfmath@def{acos}{425}{64.84933} +\pgfmath@def{acos}{426}{64.78602} \pgfmath@def{acos}{427}{64.72267} +\pgfmath@def{acos}{428}{64.65929} \pgfmath@def{acos}{429}{64.59588} +\pgfmath@def{acos}{430}{64.53244} \pgfmath@def{acos}{431}{64.46896} +\pgfmath@def{acos}{432}{64.40544} \pgfmath@def{acos}{433}{64.34190} +\pgfmath@def{acos}{434}{64.27832} \pgfmath@def{acos}{435}{64.21470} +\pgfmath@def{acos}{436}{64.15105} \pgfmath@def{acos}{437}{64.08737} +\pgfmath@def{acos}{438}{64.02365} \pgfmath@def{acos}{439}{63.95990} +\pgfmath@def{acos}{440}{63.89611} \pgfmath@def{acos}{441}{63.83229} +\pgfmath@def{acos}{442}{63.76844} \pgfmath@def{acos}{443}{63.70455} +\pgfmath@def{acos}{444}{63.64062} \pgfmath@def{acos}{445}{63.57666} +\pgfmath@def{acos}{446}{63.51266} \pgfmath@def{acos}{447}{63.44863} +\pgfmath@def{acos}{448}{63.38456} \pgfmath@def{acos}{449}{63.32045} +\pgfmath@def{acos}{450}{63.25631} \pgfmath@def{acos}{451}{63.19213} +\pgfmath@def{acos}{452}{63.12792} \pgfmath@def{acos}{453}{63.06367} +\pgfmath@def{acos}{454}{62.99938} \pgfmath@def{acos}{455}{62.93506} +\pgfmath@def{acos}{456}{62.87070} \pgfmath@def{acos}{457}{62.80630} +\pgfmath@def{acos}{458}{62.74187} \pgfmath@def{acos}{459}{62.67740} +\pgfmath@def{acos}{460}{62.61289} \pgfmath@def{acos}{461}{62.54834} +\pgfmath@def{acos}{462}{62.48376} \pgfmath@def{acos}{463}{62.41913} +\pgfmath@def{acos}{464}{62.35447} \pgfmath@def{acos}{465}{62.28977} +\pgfmath@def{acos}{466}{62.22504} \pgfmath@def{acos}{467}{62.16026} +\pgfmath@def{acos}{468}{62.09545} \pgfmath@def{acos}{469}{62.03059} +\pgfmath@def{acos}{470}{61.96570} \pgfmath@def{acos}{471}{61.90077} +\pgfmath@def{acos}{472}{61.83580} \pgfmath@def{acos}{473}{61.77079} +\pgfmath@def{acos}{474}{61.70574} \pgfmath@def{acos}{475}{61.64065} +\pgfmath@def{acos}{476}{61.57552} \pgfmath@def{acos}{477}{61.51035} +\pgfmath@def{acos}{478}{61.44514} \pgfmath@def{acos}{479}{61.37988} +\pgfmath@def{acos}{480}{61.31459} \pgfmath@def{acos}{481}{61.24926} +\pgfmath@def{acos}{482}{61.18389} \pgfmath@def{acos}{483}{61.11847} +\pgfmath@def{acos}{484}{61.05302} \pgfmath@def{acos}{485}{60.98752} +\pgfmath@def{acos}{486}{60.92199} \pgfmath@def{acos}{487}{60.85641} +\pgfmath@def{acos}{488}{60.79078} \pgfmath@def{acos}{489}{60.72512} +\pgfmath@def{acos}{490}{60.65941} \pgfmath@def{acos}{491}{60.59367} +\pgfmath@def{acos}{492}{60.52787} \pgfmath@def{acos}{493}{60.46204} +\pgfmath@def{acos}{494}{60.39616} \pgfmath@def{acos}{495}{60.33025} +\pgfmath@def{acos}{496}{60.26428} \pgfmath@def{acos}{497}{60.19828} +\pgfmath@def{acos}{498}{60.13223} \pgfmath@def{acos}{499}{60.06613} +\pgfmath@def{acos}{500}{60.00000} \pgfmath@def{acos}{501}{59.93381} +\pgfmath@def{acos}{502}{59.86759} \pgfmath@def{acos}{503}{59.80132} +\pgfmath@def{acos}{504}{59.73500} \pgfmath@def{acos}{505}{59.66864} +\pgfmath@def{acos}{506}{59.60224} \pgfmath@def{acos}{507}{59.53579} +\pgfmath@def{acos}{508}{59.46929} \pgfmath@def{acos}{509}{59.40275} +\pgfmath@def{acos}{510}{59.33617} \pgfmath@def{acos}{511}{59.26953} +\pgfmath@def{acos}{512}{59.20285} \pgfmath@def{acos}{513}{59.13613} +\pgfmath@def{acos}{514}{59.06936} \pgfmath@def{acos}{515}{59.00254} +\pgfmath@def{acos}{516}{58.93568} \pgfmath@def{acos}{517}{58.86876} +\pgfmath@def{acos}{518}{58.80180} \pgfmath@def{acos}{519}{58.73480} +\pgfmath@def{acos}{520}{58.66774} \pgfmath@def{acos}{521}{58.60064} +\pgfmath@def{acos}{522}{58.53349} \pgfmath@def{acos}{523}{58.46629} +\pgfmath@def{acos}{524}{58.39905} \pgfmath@def{acos}{525}{58.33175} +\pgfmath@def{acos}{526}{58.26441} \pgfmath@def{acos}{527}{58.19702} +\pgfmath@def{acos}{528}{58.12957} \pgfmath@def{acos}{529}{58.06208} +\pgfmath@def{acos}{530}{57.99454} \pgfmath@def{acos}{531}{57.92695} +\pgfmath@def{acos}{532}{57.85931} \pgfmath@def{acos}{533}{57.79162} +\pgfmath@def{acos}{534}{57.72388} \pgfmath@def{acos}{535}{57.65608} +\pgfmath@def{acos}{536}{57.58824} \pgfmath@def{acos}{537}{57.52035} +\pgfmath@def{acos}{538}{57.45240} \pgfmath@def{acos}{539}{57.38441} +\pgfmath@def{acos}{540}{57.31636} \pgfmath@def{acos}{541}{57.24826} +\pgfmath@def{acos}{542}{57.18010} \pgfmath@def{acos}{543}{57.11190} +\pgfmath@def{acos}{544}{57.04364} \pgfmath@def{acos}{545}{56.97533} +\pgfmath@def{acos}{546}{56.90697} \pgfmath@def{acos}{547}{56.83855} +\pgfmath@def{acos}{548}{56.77008} \pgfmath@def{acos}{549}{56.70156} +\pgfmath@def{acos}{550}{56.63298} \pgfmath@def{acos}{551}{56.56435} +\pgfmath@def{acos}{552}{56.49567} \pgfmath@def{acos}{553}{56.42693} +\pgfmath@def{acos}{554}{56.35813} \pgfmath@def{acos}{555}{56.28928} +\pgfmath@def{acos}{556}{56.22038} \pgfmath@def{acos}{557}{56.15141} +\pgfmath@def{acos}{558}{56.08240} \pgfmath@def{acos}{559}{56.01333} +\pgfmath@def{acos}{560}{55.94420} \pgfmath@def{acos}{561}{55.87501} +\pgfmath@def{acos}{562}{55.80577} \pgfmath@def{acos}{563}{55.73647} +\pgfmath@def{acos}{564}{55.66712} \pgfmath@def{acos}{565}{55.59770} +\pgfmath@def{acos}{566}{55.52823} \pgfmath@def{acos}{567}{55.45871} +\pgfmath@def{acos}{568}{55.38912} \pgfmath@def{acos}{569}{55.31947} +\pgfmath@def{acos}{570}{55.24977} \pgfmath@def{acos}{571}{55.18001} +\pgfmath@def{acos}{572}{55.11019} \pgfmath@def{acos}{573}{55.04030} +\pgfmath@def{acos}{574}{54.97036} \pgfmath@def{acos}{575}{54.90036} +\pgfmath@def{acos}{576}{54.83030} \pgfmath@def{acos}{577}{54.76018} +\pgfmath@def{acos}{578}{54.69000} \pgfmath@def{acos}{579}{54.61976} +\pgfmath@def{acos}{580}{54.54945} \pgfmath@def{acos}{581}{54.47909} +\pgfmath@def{acos}{582}{54.40866} \pgfmath@def{acos}{583}{54.33817} +\pgfmath@def{acos}{584}{54.26762} \pgfmath@def{acos}{585}{54.19701} +\pgfmath@def{acos}{586}{54.12633} \pgfmath@def{acos}{587}{54.05559} +\pgfmath@def{acos}{588}{53.98479} \pgfmath@def{acos}{589}{53.91392} +\pgfmath@def{acos}{590}{53.84299} \pgfmath@def{acos}{591}{53.77199} +\pgfmath@def{acos}{592}{53.70093} \pgfmath@def{acos}{593}{53.62981} +\pgfmath@def{acos}{594}{53.55862} \pgfmath@def{acos}{595}{53.48736} +\pgfmath@def{acos}{596}{53.41604} \pgfmath@def{acos}{597}{53.34466} +\pgfmath@def{acos}{598}{53.27320} \pgfmath@def{acos}{599}{53.20168} +\pgfmath@def{acos}{600}{53.13010} \pgfmath@def{acos}{601}{53.05844} +\pgfmath@def{acos}{602}{52.98672} \pgfmath@def{acos}{603}{52.91494} +\pgfmath@def{acos}{604}{52.84308} \pgfmath@def{acos}{605}{52.77115} +\pgfmath@def{acos}{606}{52.69916} \pgfmath@def{acos}{607}{52.62710} +\pgfmath@def{acos}{608}{52.55497} \pgfmath@def{acos}{609}{52.48276} +\pgfmath@def{acos}{610}{52.41049} \pgfmath@def{acos}{611}{52.33815} +\pgfmath@def{acos}{612}{52.26574} \pgfmath@def{acos}{613}{52.19326} +\pgfmath@def{acos}{614}{52.12070} \pgfmath@def{acos}{615}{52.04808} +\pgfmath@def{acos}{616}{51.97538} \pgfmath@def{acos}{617}{51.90261} +\pgfmath@def{acos}{618}{51.82976} \pgfmath@def{acos}{619}{51.75685} +\pgfmath@def{acos}{620}{51.68386} \pgfmath@def{acos}{621}{51.61080} +\pgfmath@def{acos}{622}{51.53766} \pgfmath@def{acos}{623}{51.46445} +\pgfmath@def{acos}{624}{51.39117} \pgfmath@def{acos}{625}{51.31781} +\pgfmath@def{acos}{626}{51.24437} \pgfmath@def{acos}{627}{51.17086} +\pgfmath@def{acos}{628}{51.09728} \pgfmath@def{acos}{629}{51.02361} +\pgfmath@def{acos}{630}{50.94987} \pgfmath@def{acos}{631}{50.87606} +\pgfmath@def{acos}{632}{50.80216} \pgfmath@def{acos}{633}{50.72819} +\pgfmath@def{acos}{634}{50.65414} \pgfmath@def{acos}{635}{50.58001} +\pgfmath@def{acos}{636}{50.50580} \pgfmath@def{acos}{637}{50.43152} +\pgfmath@def{acos}{638}{50.35715} \pgfmath@def{acos}{639}{50.28270} +\pgfmath@def{acos}{640}{50.20818} \pgfmath@def{acos}{641}{50.13357} +\pgfmath@def{acos}{642}{50.05888} \pgfmath@def{acos}{643}{49.98411} +\pgfmath@def{acos}{644}{49.90926} \pgfmath@def{acos}{645}{49.83432} +\pgfmath@def{acos}{646}{49.75930} \pgfmath@def{acos}{647}{49.68420} +\pgfmath@def{acos}{648}{49.60902} \pgfmath@def{acos}{649}{49.53375} +\pgfmath@def{acos}{650}{49.45839} \pgfmath@def{acos}{651}{49.38296} +\pgfmath@def{acos}{652}{49.30743} \pgfmath@def{acos}{653}{49.23182} +\pgfmath@def{acos}{654}{49.15613} \pgfmath@def{acos}{655}{49.08035} +\pgfmath@def{acos}{656}{49.00448} \pgfmath@def{acos}{657}{48.92852} +\pgfmath@def{acos}{658}{48.85248} \pgfmath@def{acos}{659}{48.77634} +\pgfmath@def{acos}{660}{48.70012} \pgfmath@def{acos}{661}{48.62381} +\pgfmath@def{acos}{662}{48.54741} \pgfmath@def{acos}{663}{48.47092} +\pgfmath@def{acos}{664}{48.39434} \pgfmath@def{acos}{665}{48.31767} +\pgfmath@def{acos}{666}{48.24091} \pgfmath@def{acos}{667}{48.16405} +\pgfmath@def{acos}{668}{48.08710} \pgfmath@def{acos}{669}{48.01006} +\pgfmath@def{acos}{670}{47.93293} \pgfmath@def{acos}{671}{47.85570} +\pgfmath@def{acos}{672}{47.77838} \pgfmath@def{acos}{673}{47.70096} +\pgfmath@def{acos}{674}{47.62345} \pgfmath@def{acos}{675}{47.54585} +\pgfmath@def{acos}{676}{47.46814} \pgfmath@def{acos}{677}{47.39034} +\pgfmath@def{acos}{678}{47.31244} \pgfmath@def{acos}{679}{47.23445} +\pgfmath@def{acos}{680}{47.15635} \pgfmath@def{acos}{681}{47.07816} +\pgfmath@def{acos}{682}{46.99987} \pgfmath@def{acos}{683}{46.92147} +\pgfmath@def{acos}{684}{46.84298} \pgfmath@def{acos}{685}{46.76439} +\pgfmath@def{acos}{686}{46.68569} \pgfmath@def{acos}{687}{46.60690} +\pgfmath@def{acos}{688}{46.52800} \pgfmath@def{acos}{689}{46.44899} +\pgfmath@def{acos}{690}{46.36989} \pgfmath@def{acos}{691}{46.29068} +\pgfmath@def{acos}{692}{46.21136} \pgfmath@def{acos}{693}{46.13194} +\pgfmath@def{acos}{694}{46.05241} \pgfmath@def{acos}{695}{45.97278} +\pgfmath@def{acos}{696}{45.89304} \pgfmath@def{acos}{697}{45.81319} +\pgfmath@def{acos}{698}{45.73323} \pgfmath@def{acos}{699}{45.65317} +\pgfmath@def{acos}{700}{45.57299} \pgfmath@def{acos}{701}{45.49271} +\pgfmath@def{acos}{702}{45.41231} \pgfmath@def{acos}{703}{45.33180} +\pgfmath@def{acos}{704}{45.25118} \pgfmath@def{acos}{705}{45.17045} +\pgfmath@def{acos}{706}{45.08961} \pgfmath@def{acos}{707}{45.00865} +\pgfmath@def{acos}{708}{44.92757} \pgfmath@def{acos}{709}{44.84638} +\pgfmath@def{acos}{710}{44.76508} \pgfmath@def{acos}{711}{44.68366} +\pgfmath@def{acos}{712}{44.60212} \pgfmath@def{acos}{713}{44.52046} +\pgfmath@def{acos}{714}{44.43869} \pgfmath@def{acos}{715}{44.35680} +\pgfmath@def{acos}{716}{44.27478} \pgfmath@def{acos}{717}{44.19265} +\pgfmath@def{acos}{718}{44.11039} \pgfmath@def{acos}{719}{44.02802} +\pgfmath@def{acos}{720}{43.94552} \pgfmath@def{acos}{721}{43.86289} +\pgfmath@def{acos}{722}{43.78014} \pgfmath@def{acos}{723}{43.69727} +\pgfmath@def{acos}{724}{43.61427} \pgfmath@def{acos}{725}{43.53115} +\pgfmath@def{acos}{726}{43.44790} \pgfmath@def{acos}{727}{43.36452} +\pgfmath@def{acos}{728}{43.28101} \pgfmath@def{acos}{729}{43.19737} +\pgfmath@def{acos}{730}{43.11360} \pgfmath@def{acos}{731}{43.02970} +\pgfmath@def{acos}{732}{42.94567} \pgfmath@def{acos}{733}{42.86151} +\pgfmath@def{acos}{734}{42.77721} \pgfmath@def{acos}{735}{42.69278} +\pgfmath@def{acos}{736}{42.60821} \pgfmath@def{acos}{737}{42.52351} +\pgfmath@def{acos}{738}{42.43867} \pgfmath@def{acos}{739}{42.35370} +\pgfmath@def{acos}{740}{42.26858} \pgfmath@def{acos}{741}{42.18333} +\pgfmath@def{acos}{742}{42.09793} \pgfmath@def{acos}{743}{42.01240} +\pgfmath@def{acos}{744}{41.92672} \pgfmath@def{acos}{745}{41.84090} +\pgfmath@def{acos}{746}{41.75493} \pgfmath@def{acos}{747}{41.66882} +\pgfmath@def{acos}{748}{41.58257} \pgfmath@def{acos}{749}{41.49617} +\pgfmath@def{acos}{750}{41.40962} \pgfmath@def{acos}{751}{41.32292} +\pgfmath@def{acos}{752}{41.23607} \pgfmath@def{acos}{753}{41.14908} +\pgfmath@def{acos}{754}{41.06193} \pgfmath@def{acos}{755}{40.97463} +\pgfmath@def{acos}{756}{40.88717} \pgfmath@def{acos}{757}{40.79956} +\pgfmath@def{acos}{758}{40.71180} \pgfmath@def{acos}{759}{40.62388} +\pgfmath@def{acos}{760}{40.53580} \pgfmath@def{acos}{761}{40.44756} +\pgfmath@def{acos}{762}{40.35916} \pgfmath@def{acos}{763}{40.27061} +\pgfmath@def{acos}{764}{40.18189} \pgfmath@def{acos}{765}{40.09300} +\pgfmath@def{acos}{766}{40.00396} \pgfmath@def{acos}{767}{39.91474} +\pgfmath@def{acos}{768}{39.82537} \pgfmath@def{acos}{769}{39.73582} +\pgfmath@def{acos}{770}{39.64611} \pgfmath@def{acos}{771}{39.55622} +\pgfmath@def{acos}{772}{39.46617} \pgfmath@def{acos}{773}{39.37594} +\pgfmath@def{acos}{774}{39.28554} \pgfmath@def{acos}{775}{39.19496} +\pgfmath@def{acos}{776}{39.10421} \pgfmath@def{acos}{777}{39.01328} +\pgfmath@def{acos}{778}{38.92218} \pgfmath@def{acos}{779}{38.83089} +\pgfmath@def{acos}{780}{38.73942} \pgfmath@def{acos}{781}{38.64777} +\pgfmath@def{acos}{782}{38.55594} \pgfmath@def{acos}{783}{38.46392} +\pgfmath@def{acos}{784}{38.37171} \pgfmath@def{acos}{785}{38.27932} +\pgfmath@def{acos}{786}{38.18673} \pgfmath@def{acos}{787}{38.09396} +\pgfmath@def{acos}{788}{38.00100} \pgfmath@def{acos}{789}{37.90784} +\pgfmath@def{acos}{790}{37.81448} \pgfmath@def{acos}{791}{37.72093} +\pgfmath@def{acos}{792}{37.62719} \pgfmath@def{acos}{793}{37.53324} +\pgfmath@def{acos}{794}{37.43909} \pgfmath@def{acos}{795}{37.34474} +\pgfmath@def{acos}{796}{37.25019} \pgfmath@def{acos}{797}{37.15542} +\pgfmath@def{acos}{798}{37.06046} \pgfmath@def{acos}{799}{36.96528} +\pgfmath@def{acos}{800}{36.86989} \pgfmath@def{acos}{801}{36.77429} +\pgfmath@def{acos}{802}{36.67848} \pgfmath@def{acos}{803}{36.58245} +\pgfmath@def{acos}{804}{36.48621} \pgfmath@def{acos}{805}{36.38974} +\pgfmath@def{acos}{806}{36.29305} \pgfmath@def{acos}{807}{36.19615} +\pgfmath@def{acos}{808}{36.09901} \pgfmath@def{acos}{809}{36.00165} +\pgfmath@def{acos}{810}{35.90406} \pgfmath@def{acos}{811}{35.80625} +\pgfmath@def{acos}{812}{35.70820} \pgfmath@def{acos}{813}{35.60991} +\pgfmath@def{acos}{814}{35.51139} \pgfmath@def{acos}{815}{35.41263} +\pgfmath@def{acos}{816}{35.31364} \pgfmath@def{acos}{817}{35.21440} +\pgfmath@def{acos}{818}{35.11491} \pgfmath@def{acos}{819}{35.01518} +\pgfmath@def{acos}{820}{34.91520} \pgfmath@def{acos}{821}{34.81497} +\pgfmath@def{acos}{822}{34.71449} \pgfmath@def{acos}{823}{34.61375} +\pgfmath@def{acos}{824}{34.51276} \pgfmath@def{acos}{825}{34.41150} +\pgfmath@def{acos}{826}{34.30999} \pgfmath@def{acos}{827}{34.20821} +\pgfmath@def{acos}{828}{34.10616} \pgfmath@def{acos}{829}{34.00385} +\pgfmath@def{acos}{830}{33.90126} \pgfmath@def{acos}{831}{33.79840} +\pgfmath@def{acos}{832}{33.69526} \pgfmath@def{acos}{833}{33.59184} +\pgfmath@def{acos}{834}{33.48814} \pgfmath@def{acos}{835}{33.38416} +\pgfmath@def{acos}{836}{33.27989} \pgfmath@def{acos}{837}{33.17533} +\pgfmath@def{acos}{838}{33.07047} \pgfmath@def{acos}{839}{32.96532} +\pgfmath@def{acos}{840}{32.85988} \pgfmath@def{acos}{841}{32.75413} +\pgfmath@def{acos}{842}{32.64807} \pgfmath@def{acos}{843}{32.54171} +\pgfmath@def{acos}{844}{32.43504} \pgfmath@def{acos}{845}{32.32806} +\pgfmath@def{acos}{846}{32.22076} \pgfmath@def{acos}{847}{32.11314} +\pgfmath@def{acos}{848}{32.00520} \pgfmath@def{acos}{849}{31.89693} +\pgfmath@def{acos}{850}{31.78833} \pgfmath@def{acos}{851}{31.67939} +\pgfmath@def{acos}{852}{31.57012} \pgfmath@def{acos}{853}{31.46051} +\pgfmath@def{acos}{854}{31.35056} \pgfmath@def{acos}{855}{31.24026} +\pgfmath@def{acos}{856}{31.12961} \pgfmath@def{acos}{857}{31.01860} +\pgfmath@def{acos}{858}{30.90724} \pgfmath@def{acos}{859}{30.79551} +\pgfmath@def{acos}{860}{30.68341} \pgfmath@def{acos}{861}{30.57095} +\pgfmath@def{acos}{862}{30.45811} \pgfmath@def{acos}{863}{30.34489} +\pgfmath@def{acos}{864}{30.23128} \pgfmath@def{acos}{865}{30.11729} +\pgfmath@def{acos}{866}{30.00291} \pgfmath@def{acos}{867}{29.88813} +\pgfmath@def{acos}{868}{29.77294} \pgfmath@def{acos}{869}{29.65736} +\pgfmath@def{acos}{870}{29.54136} \pgfmath@def{acos}{871}{29.42494} +\pgfmath@def{acos}{872}{29.30810} \pgfmath@def{acos}{873}{29.19084} +\pgfmath@def{acos}{874}{29.07315} \pgfmath@def{acos}{875}{28.95502} +\pgfmath@def{acos}{876}{28.83645} \pgfmath@def{acos}{877}{28.71743} +\pgfmath@def{acos}{878}{28.59796} \pgfmath@def{acos}{879}{28.47803} +\pgfmath@def{acos}{880}{28.35763} \pgfmath@def{acos}{881}{28.23677} +\pgfmath@def{acos}{882}{28.11542} \pgfmath@def{acos}{883}{27.99360} +\pgfmath@def{acos}{884}{27.87128} \pgfmath@def{acos}{885}{27.74847} +\pgfmath@def{acos}{886}{27.62516} \pgfmath@def{acos}{887}{27.50134} +\pgfmath@def{acos}{888}{27.37700} \pgfmath@def{acos}{889}{27.25214} +\pgfmath@def{acos}{890}{27.12675} \pgfmath@def{acos}{891}{27.00082} +\pgfmath@def{acos}{892}{26.87434} \pgfmath@def{acos}{893}{26.74731} +\pgfmath@def{acos}{894}{26.61973} \pgfmath@def{acos}{895}{26.49157} +\pgfmath@def{acos}{896}{26.36283} \pgfmath@def{acos}{897}{26.23351} +\pgfmath@def{acos}{898}{26.10359} \pgfmath@def{acos}{899}{25.97306} +\pgfmath@def{acos}{900}{25.84193} \pgfmath@def{acos}{901}{25.71017} +\pgfmath@def{acos}{902}{25.57778} \pgfmath@def{acos}{903}{25.44475} +\pgfmath@def{acos}{904}{25.31106} \pgfmath@def{acos}{905}{25.17671} +\pgfmath@def{acos}{906}{25.04169} \pgfmath@def{acos}{907}{24.90598} +\pgfmath@def{acos}{908}{24.76958} \pgfmath@def{acos}{909}{24.63247} +\pgfmath@def{acos}{910}{24.49464} \pgfmath@def{acos}{911}{24.35608} +\pgfmath@def{acos}{912}{24.21678} \pgfmath@def{acos}{913}{24.07672} +\pgfmath@def{acos}{914}{23.93588} \pgfmath@def{acos}{915}{23.79427} +\pgfmath@def{acos}{916}{23.65185} \pgfmath@def{acos}{917}{23.50863} +\pgfmath@def{acos}{918}{23.36457} \pgfmath@def{acos}{919}{23.21967} +\pgfmath@def{acos}{920}{23.07391} \pgfmath@def{acos}{921}{22.92728} +\pgfmath@def{acos}{922}{22.77975} \pgfmath@def{acos}{923}{22.63132} +\pgfmath@def{acos}{924}{22.48195} \pgfmath@def{acos}{925}{22.33164} +\pgfmath@def{acos}{926}{22.18036} \pgfmath@def{acos}{927}{22.02810} +\pgfmath@def{acos}{928}{21.87483} \pgfmath@def{acos}{929}{21.72053} +\pgfmath@def{acos}{930}{21.56518} \pgfmath@def{acos}{931}{21.40876} +\pgfmath@def{acos}{932}{21.25124} \pgfmath@def{acos}{933}{21.09260} +\pgfmath@def{acos}{934}{20.93281} \pgfmath@def{acos}{935}{20.77185} +\pgfmath@def{acos}{936}{20.60969} \pgfmath@def{acos}{937}{20.44630} +\pgfmath@def{acos}{938}{20.28165} \pgfmath@def{acos}{939}{20.11570} +\pgfmath@def{acos}{940}{19.94844} \pgfmath@def{acos}{941}{19.77982} +\pgfmath@def{acos}{942}{19.60981} \pgfmath@def{acos}{943}{19.43837} +\pgfmath@def{acos}{944}{19.26546} \pgfmath@def{acos}{945}{19.09105} +\pgfmath@def{acos}{946}{18.91509} \pgfmath@def{acos}{947}{18.73754} +\pgfmath@def{acos}{948}{18.55835} \pgfmath@def{acos}{949}{18.37748} +\pgfmath@def{acos}{950}{18.19487} \pgfmath@def{acos}{951}{18.01047} +\pgfmath@def{acos}{952}{17.82423} \pgfmath@def{acos}{953}{17.63609} +\pgfmath@def{acos}{954}{17.44598} \pgfmath@def{acos}{955}{17.25385} +\pgfmath@def{acos}{956}{17.05962} \pgfmath@def{acos}{957}{16.86322} +\pgfmath@def{acos}{958}{16.66457} \pgfmath@def{acos}{959}{16.46359} +\pgfmath@def{acos}{960}{16.26020} \pgfmath@def{acos}{961}{16.05430} +\pgfmath@def{acos}{962}{15.84580} \pgfmath@def{acos}{963}{15.63459} +\pgfmath@def{acos}{964}{15.42057} \pgfmath@def{acos}{965}{15.20360} +\pgfmath@def{acos}{966}{14.98357} \pgfmath@def{acos}{967}{14.76033} +\pgfmath@def{acos}{968}{14.53374} \pgfmath@def{acos}{969}{14.30364} +\pgfmath@def{acos}{970}{14.06986} \pgfmath@def{acos}{971}{13.83221} +\pgfmath@def{acos}{972}{13.59049} \pgfmath@def{acos}{973}{13.34447} +\pgfmath@def{acos}{974}{13.09392} \pgfmath@def{acos}{975}{12.83856} +\pgfmath@def{acos}{976}{12.57811} \pgfmath@def{acos}{977}{12.31225} +\pgfmath@def{acos}{978}{12.04060} \pgfmath@def{acos}{979}{11.76278} +\pgfmath@def{acos}{980}{11.47834} \pgfmath@def{acos}{981}{11.18676} +\pgfmath@def{acos}{982}{10.88748} \pgfmath@def{acos}{983}{10.57984} +\pgfmath@def{acos}{984}{10.26309} \pgfmath@def{acos}{985}{9.93636} +\pgfmath@def{acos}{986}{9.59863} \pgfmath@def{acos}{987}{9.24870} +\pgfmath@def{acos}{988}{8.88512} \pgfmath@def{acos}{989}{8.50614} +\pgfmath@def{acos}{990}{8.10961} \pgfmath@def{acos}{991}{7.69281} +\pgfmath@def{acos}{992}{7.25224} \pgfmath@def{acos}{993}{6.78328} +\pgfmath@def{acos}{994}{6.27958} \pgfmath@def{acos}{995}{5.73196} +\pgfmath@def{acos}{996}{5.12640} \pgfmath@def{acos}{997}{4.43922} +\pgfmath@def{acos}{998}{3.62430} \pgfmath@def{acos}{999}{2.56255} +\pgfmath@def{acos}{1000}{0.00000} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex new file mode 100644 index 00000000000..db2c38fa350 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex @@ -0,0 +1,265 @@ +% Copyright 2007 Mark Wibrow +% +% but subject to the LaTeX Project Public License +% (http://www.latex-project.org/lppl.txt) +% +% and the GNU Public License +% (http://www.gnu.org/licenses/gpl.txt) +% + +% This file defines utilities common to the \pgfmath files. +% +% Version 1.414213 29/9/2007 + +\def\pgfmathincluded{} + +% \pgfmath@ensureregister +% +% Ensure a control sequence exists as a TeX count/dimen register. +% +% #1 - count or dimen. +% #2 - a control sequence. +% +\newbox\pgfmath@box% +\def\pgfmath@ensureregister#1#2{% + \setbox\pgfmath@box\hbox\bgroup% In case #2 is a defined macro. Unlikely, but you never know... + \afterassignment\pgfmath@@ensureregister% + \noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@} + +\def\pgfmath@@ensureregister#1#2\pgfmath@#3#4#5\pgfmath@{% + \egroup% + \ifx#4c% + \ifx#1.% Already a count register. + \else% + \csname newcount\endcsname#3% This gets round \outer in plain TeX. + \fi% + \else% + \ifx#4d% + \ifx\let#1% Already a dimen register. + \else% + \csname newdimen\endcsname#3% + \fi% + \fi% + \fi% +} + +% Check registers exist. If not, create them. +% +\pgfmath@ensureregister{dimen}{\pgf@x} +\pgfmath@ensureregister{dimen}{\pgf@xa} +\pgfmath@ensureregister{dimen}{\pgf@xb} +\pgfmath@ensureregister{dimen}{\pgf@xc} + +\pgfmath@ensureregister{dimen}{\pgf@y} +\pgfmath@ensureregister{dimen}{\pgf@ya} +\pgfmath@ensureregister{dimen}{\pgf@yb} +\pgfmath@ensureregister{dimen}{\pgf@yc} + +\pgfmath@ensureregister{dimen}{\pgfutil@tempdima} +\pgfmath@ensureregister{dimen}{\pgfutil@tempdimb} + +\pgfmath@ensureregister{count}{\c@pgf@counta} +\pgfmath@ensureregister{count}{\c@pgf@countb} +\pgfmath@ensureregister{count}{\c@pgf@countc} +\pgfmath@ensureregister{count}{\c@pgf@countd} + +\pgfmath@ensureregister{count}{\pgfutil@tempcnta} +\pgfmath@ensureregister{count}{\pgfutil@tempcntb} + +% Alias for \pgfmath. +% +\let\pgfmath@x\pgf@x +\let\pgfmath@xa\pgf@xa +\let\pgfmath@xb\pgf@xb +\let\pgfmath@xc\pgf@xc + +\let\pgfmath@y\pgf@y +\let\pgfmath@ya\pgf@ya +\let\pgfmath@yb\pgf@yb +\let\pgfmath@yc\pgf@yc + +\let\pgfmath@tempdima\pgfutil@tempdima +\let\pgfmath@tempdima\pgfutil@tempdima + +\let\c@pgfmath@counta\c@pgf@counta +\let\c@pgfmath@countb\c@pgf@countb +\let\c@pgfmath@countc\c@pgf@countc +\let\c@pgfmath@countd\c@pgf@countd + +\let\pgfmath@tempcnta\pgfutil@tempcnta +\let\pgfmath@tempcntb\pgfutil@tempcntb + +% Now check if pgfutil and pgf@sys stuff exists. If it does, fine. +% Just \let pgfmath versions. If not, define pgfmath versions (Arghhh). +% + +% \...ifnextchar +% +\ifx\pgfutil@ifnextchar\pgfmath@undefined% + \long\def\pgfmath@ifnextchar#1#2#3{% + \let\pgfmath@reserved@d#1% + \def\pgfmath@reserved@a{#2}% + \def\pgfmath@reserved@b{#3}% + \futurelet\pgfmath@let@token\pgfmath@ifnch} + \def\pgfmath@ifnch{% + \ifx\pgfmath@let@token\pgfmath@sptoken% + \let\pgfmath@reserved@c\pgfmath@xifnch% + \else% + \ifx\pgfmath@let@token\pgfmath@reserved@d% + \let\pgfmath@reserved@c\pgfmath@reserved@a% + \else% + \let\pgfmath@reserved@c\pgfmath@reserved@b% + \fi% + \fi% + \pgfmath@reserved@c} + {% + \def\:{\global\let\pgfmath@sptoken= } \: + \def\:{\pgfmath@xifnch} \expandafter\gdef\: {\futurelet\pgfmath@let@token\pgfmath@ifnch} + }% +\else% + \let\pgfmath@ifnextchar\pgfutil@ifnextchar% + % Still need to define \pgfmath@sptoken (cannot \let). + {% + \def\:{\global\let\pgfmath@sptoken= } \: + }% +\fi% + +% \...ifundefined +% +\ifx\pgfutil@ifundefined\pgfmath@undefined% + \long\def\pgfmath@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax% + \expandafter\pgfmath@firstoftwo% + \else% + \expandafter\pgfmath@secondoftwo% + \fi}% +\else% + \let\pgfmath@ifundefined\pgfutil@ifundefined% +\fi% + +% \...selectfont +% +\ifx\pgfutil@selectfont\pgfmath@undefined% + \ifx\selectfont\pgfmath@undefined% + \let\pgfmath@selectfont\rm% Plain TeX and ConTeXt. + \else% + \let\pgfmath@selectfont\selectfont% LaTeX. + \fi% +\else% + \let\pgfmath@selectfont\pgfutil@selectfont% +\fi% + +% New definition easier than fussing around with let. +% +\newif\ifpgfmath@in@ +\def\pgfmath@in@#1#2{% + \def\pgfmath@in@@##1#1##2##3\pgfmath@in@@{% + \ifx\pgfmath@in@##2\pgfmath@in@false\else\pgfmath@in@true\fi}% + \pgfmath@in@@#2#1\pgfmath@in@\pgfmath@in@@} + + +% \...tonumber +% +\ifx\pgf@sys@tonumber\pgfmath@undefined% + {\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} + \def\pgfmath@tonumber#1{\expandafter\Pgf@geT\the#1} +\else% + \let\pgfmath@tonumber\pgf@sys@tonumber% +\fi% + + +% \PackageWarning and \PackageError +% +\ifx\PackageWarning\pgfmath@undefined + \def\pgfmath@PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% +\else% + \let\pgfmath@PackageWarning\PackageWarning% +\fi% +\ifx\PackageError\pgfmath@undefined + \def\pgfmath@PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\else% + \let\pgfmath@PackageError\PackageError% +\fi% + +\def\pgfmath@error#1#2{\pgfmath@PackageError{PGF Math}{#1}{#2}} +\def\pgfmath@warning#1{\pgfmath@PackageWarning{PGF Math}{#1}} + +% \pgfmath@pt +% +% Needed to test for 'pt' resulting from expansion using \the. +% +{\catcode`\p=12\catcode`\t=12\gdef\PgfmaTh@PT{pt}} +\edef\pgfmath@pt{\PgfmaTh@PT}% + +% \pgfmath@empty +% +% A handy macro. +% +\def\pgfmath@empty{} + +\def\pgfmath@firstoftwo#1#2{#1} +\def\pgfmath@secondoftwo#1#2{#2} + +% \pgfmath@gobbletilpgfmath@ +% +% Gobble stream until \pgfmath@ {which is undefined}. +% +\def\pgfmath@gobbletilpgfmath@#1\pgfmath@{} +\def\pgfmath@gobbleone#1{}% + + +% \pgfmathloop +% +% A version of the standard TeX and LaTeX +% \loop, with an additional macro \pgfmathcounter +% (which is *not* a TeX counter) which keeps +% track of the iterations. +% +\newif\ifpgfmathcontinueloop +\def\pgfmathloop#1\repeatpgfmathloop{% + \def\pgfmathcounter{1}% + \def\pgfmath@iterate{% + #1\relax% + {% Do this inside a group, just in case... + \c@pgfmath@counta\pgfmathcounter% + \advance\c@pgfmath@counta1\relax% + \xdef\pgfmathloop@temp{\the\c@pgfmath@counta}% + }% + \edef\pgfmathcounter{\pgfmathloop@temp}% + \expandafter\pgfmath@iterate\fi}% + \pgfmath@iterate\let\pgfmath@iterate\relax} +\let\repeatpgfmathloop\fi +\def\pgfmathbreakloop{\let\pgfmath@iterate\relax}% + +% \pgfmath@returnone +% +% \edef \pfgmathresult to the value of #1 after the end +% of a group, which *must directly follow*. +% +% #1 - a dimension representing a number or dimension. +% +% Changed by TT: made faster and simpler since it is used +% *heavily*. #1 must be something that can be assigned to a +% dimension. +% +\def\pgfmath@returnone#1\endgroup{% + \pgfmath@x#1% + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}% + \expandafter\endgroup\expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmath@temp}% +} + + +% \pgfmath@returntwo +% +% Removed by TT: not used. + + +% \pgfmath@smuggleone +% +% Smuggle a macro outside a group. +% +% Changed by TT: Speedup by insisting, that smuggleone is directly +% followed by \endgroup +% +\def\pgfmath@smuggleone#1\endgroup{% + \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}} diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg new file mode 100644 index 00000000000..659b541c539 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg @@ -0,0 +1,25 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgf.cfg,v 1.6 2008/01/13 15:30:04 tantau Exp $ + +% Default driver: +\ifx\pgfsysdriver\@undefined + \edef\pgfsysdriver{pgfsys-\Gin@driver} +\fi + + +% Uncomment the following if you use dvipdfm and plain tex: +% \def\pgfsysdriver{pgfsys-dvipdfm.def} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def new file mode 100644 index 00000000000..3a88a236de5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def @@ -0,0 +1,92 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf.def,v 1.8 2007/12/17 14:52:31 tantau Exp $ + + +% Common driver commands for all drivers that produce pdf + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{l}} +\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{m}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{c}} +\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgfsysprotocol@literal{re}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{h}} + +% Path usage: +\def\pgfsys@stroke{\pgfsysprotocol@literal{S}} +\def\pgfsys@closestroke{\pgfsysprotocol@literal{s}} +\def\pgfsys@fill{\ifpgfsys@eorule\pgfsysprotocol@literal{f*}\else\pgfsysprotocol@literal{f}\fi} +\def\pgfsys@fillstroke{\ifpgfsys@eorule\pgfsysprotocol@literal{B*}\else\pgfsysprotocol@literal{B}\fi} +\def\pgfsys@clipnext{\ifpgfsys@eorule\pgfsysprotocol@literal{W*}\else\pgfsysprotocol@literal{W}\fi} +\def\pgfsys@discardpath{\pgfsysprotocol@literal{n}} + +% Transformation: +\def\pgfsys@transformcm#1#2#3#4#5#6{% + \pgfsysprotocol@literalbuffered{#1 #2 #3 #4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{cm}} + +% Scopes +\def\pgfsys@beginscope{\pgfsysprotocol@literal{q}} +\def\pgfsys@endscope{\pgfsysprotocol@literal{Q}} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \pgfsysprotocol@literalbuffered{[}% + \pgfutil@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}% + \pgfsysprotocol@literalbuffered{]}% + \pgf@sys@bp{#2}\pgfsysprotocol@literal{d}} +\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{w}} +\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 M}} +\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 J}} +\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 J}} +\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 J}} +\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 j}} +\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 j}} +\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 j}} +\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 RG}} +\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 rg}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 K}} +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 k}} +\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 K}} +\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 k}} +\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{#1 G}} +\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{#1 g}} + +% Opacity +\def\pgf@sys@pdf@addtopageresources@extgs#1{\pgf@sys@fail{adding to page resources}} +\def\pgf@sys@pdf@readdtopageresources@extgs#1{}% not always used +\def\pgfsys@stroke@opacity#1{% + \expandafter\ifx\csname pgf@sys@pdf@so@#1\endcsname\relax% + % Hmm... define... + \expandafter\gdef\csname pgf@sys@pdf@so@#1\endcsname{/pgf@CA#1}% + \pgf@sys@pdf@addtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}% + \else% + \pgf@sys@pdf@readdtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}% + \fi% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}% +} +\def\pgfsys@fill@opacity#1{% + \expandafter\ifx\csname pgf@sys@pdf@fo@#1\endcsname\relax% + % Hmm... define... + \expandafter\gdef\csname pgf@sys@pdf@fo@#1\endcsname{/pgf@ca#1}% + \pgf@sys@pdf@addtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}% + \else% + \pgf@sys@pdf@readdtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}% + \fi% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}% +} + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def new file mode 100644 index 00000000000..75d06305bb1 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def @@ -0,0 +1,425 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-postscript.def,v 1.18 2008/02/07 19:25:41 tantau Exp $ + + +% Driver commands for postscript + +\newif\ifpgf@fillcolor +\newif\ifpgf@strokecolor +\newif\ifpgfsys@@clipnext + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{lineto}} +\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{moveto}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{curveto}} +\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#4}\pgf@sys@bp{#3}\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{pgfe}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{closepath}} + +% Path usage: +\def\pgfsys@stroke{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore eoclip newpath}% + \else% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore clip newpath}% + \fi% + \pgfsys@@clipnextfalse% + \else% + \ifpgf@strokecolor% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore newpath}% + \else% + \pgfsysprotocol@literal{pgfstr}% + \fi% + \fi} +\def\pgfsys@fill{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore eoclip newpath}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore clip newpath}% + \fi% + \pgfsys@@clipnextfalse% + \else% + \ifpgf@fillcolor% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore newpath}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore newpath}% + \fi% + \else% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{pgfeofill}% + \else% + \pgfsysprotocol@literal{pgffill}% + \fi% + \fi% + \fi} +\def\pgfsys@fillstroke{% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore gsave pgfsc pgfstr grestore}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore gsave pgfsc pgfstr grestore}% + \fi% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{eoclip}% + \else% + \pgfsysprotocol@literal{clip}% + \fi% + \pgfsys@@clipnextfalse% + \fi% + \pgfsysprotocol@literal{newpath}} +\def\pgfsys@clipnext{\pgfsys@@clipnexttrue} +\def\pgfsys@discardpath{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{eoclip}% + \else% + \pgfsysprotocol@literal{clip}% + \fi% + \pgfsys@@clipnextfalse% + \fi% + \pgfsysprotocol@literal{newpath}} + +% Transformation: +\def\pgfsys@transformshift#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{translate}} +\def\pgfsys@transformxyscale#1#2{\pgfsysprotocol@literal{#1 #2 scale}} +\def\pgfsys@transformcm#1#2#3#4#5#6{% + \pgfsysprotocol@literalbuffered{[#1 #2 #3 #4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{] concat}} + +% Scopes +\def\pgfsys@beginscope{\pgfsysprotocol@literal{save}} +\def\pgfsys@endscope{\pgfsysprotocol@literal{restore}} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \pgfsysprotocol@literalbuffered{[}% + \pgfutil@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}% + \pgfsysprotocol@literalbuffered{]}% + \pgf@sys@bp{#2}\pgfsysprotocol@literal{setdash}} +\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{pgfw}} +\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 setmiterlimit}} +\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 setlinecap}} +\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 setlinecap}} +\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 setlinecap}} +\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 setlinejoin}} +\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 setlinejoin}} +\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 setlinejoin}} +\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 setrgbcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 setrgbcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 setrgbcolor}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 #4 setcmykcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 #4 setcmykcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 #4 setcmykcolor}} +\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 0 setcmykcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 0 setcmykcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 0 setcmykcolor}} +\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{/pgfsc{#1 setgray}def}\pgf@strokecolortrue} +\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{/pgffc{#1 setgray}def}\pgf@fillcolortrue} +\def\pgfsys@color@gray#1{\pgfsys@color@reset\pgfsysprotocol@literal{#1 setgray}} +\def\pgfsysps@color@resetnow{\pgfsysprotocol@literal{/pgfsc{}def/pgffc{}def}\pgf@strokecolorfalse\pgf@fillcolorfalse}% +\def\pgfsys@color@reset{% + \ifpgfsys@color@reset@inorder% + \ifpgf@strokecolor% + \pgfsysps@color@resetnow% + \else% + \ifpgf@fillcolor% + \pgfsysps@color@resetnow% + \fi% + \fi% + \else% + \pgfsysps@color@resetnow% + \fi} + + +% Opacity + +\def\pgfsys@fill@opacity#1{% + \pgfsysprotocol@literal{#1 .pgfsetfillopacityalpha} +} +\def\pgfsys@stroke@opacity#1{% + \pgfsysprotocol@literal{#1 .pgfsetstrokeopacityalpha} +} + +% Objects +\newcount\pgf@objectcount +\def\pgfsys@defobject#1#2#3#4{% + \global\advance\pgf@objectcount by 1% + \expandafter\xdef\csname#1\endcsname{\the\pgf@objectcount}% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \pgf@sys@postscript@object{/pgf\csname#1\endcsname{gsave exec \pgfsys@@temp\space grestore} bind def}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsys@invoke{pgf\csname#1\endcsname}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp} + +% Shadings + +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathsetlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@max{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@max}{\the\pgf@xa}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfH \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathsetlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to\the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@max% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@xa}{\the\pgf@max}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfV \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{#2}% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@sys@bp@correct{\pgf@y}% + \pgf@xa=2\pgf@max% + \pgf@sys@bp@correct{\pgf@max}% + \advance\pgf@x by \pgf@max% + \advance\pgf@y by \pgf@max% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@invoke{% + \pgf@domb\space \pgf@sys@tonumber{\pgf@y} \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@max} pgfR1 + \pgf@psfuncs\space \pgf@firstcolor\space \pgf@doma\space pgfR2}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@functionalshading#1#2#3#4{% + {% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pgf@sys@bp@correct{\pgf@xb}% + \pgf@sys@bp@correct{\pgf@yb}% + \pgf@xc=-\pgf@xa% + \pgf@yc=-\pgf@ya% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@invoke{% + \pgf@sys@tonumber{\pgf@xc} \pgf@sys@tonumber{\pgf@yc} translate + 1.1 setlinewidth [] 0 setdash 0 setlinecap + /pgfproc {#4} bind def + \pgf@sys@tonumber{\pgf@ya} 1 \pgf@sys@tonumber{\pgf@yb} + { + \pgf@sys@tonumber{\pgf@xa} 1 \pgf@sys@tonumber{\pgf@xb} + { 1 index 2 copy pgfproc setrgbcolor moveto 1.1 0 rlineto stroke } + for + } + for + }% + \noexpand\pgfsys@endpurepicture + }\hfil}% + }% + }% +} + +% +% Patterns +% + + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \pgf@sys@bp@correct\pgf@xa% + \pgf@sys@bp@correct\pgf@ya% + \pgf@sys@bp@correct\pgf@xb% + \pgf@sys@bp@correct\pgf@yb% + \pgf@sys@bp@correct\pgf@xc% + \pgf@sys@bp@correct\pgf@yc% + \pgfsys@outerinvoke{ + save true setglobal globaldict begin /pgfpat#1 + { + \ifnum#9=0 [/Pattern /DeviceRGB] \else /Pattern \fi\space + setcolorspace + gsave + initgraphics + << + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /PaintProc + { begin 2 dict begin #8\space end end } bind + >> + matrix + makepattern + %/pgfpat#1\space exch def + grestore + setcolor + } bind def end restore + }% << +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \pgfsysprotocol@literal{/pgffc{#2 #3 #4 pgfpat#1}def}% +% [/Pattern /DeviceRGB] setcolorspace +% #2 #3 #4 pgfpat#1\space setcolor +% }def}% + \pgf@fillcolortrue% +} + +\def\pgfsys@setpatterncolored#1{% + \pgfsysprotocol@literal{/pgffc{pgfpat#1}def}%/Pattern setcolorspace +% pgfpat#1\space setcolor}def}% + \pgf@fillcolortrue% +} + + + +\def\pgfsys@atbegindocument{% + % Parameters to horizontal pre axishade: \pgf@domb x + \pgf@sys@postscript@header{/pgfH{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 moveto + dup 5 index lineto } bind def} bind def}% + + % Parameters to vertical pre axishade: \pgf@domb x + \pgf@sys@postscript@header{/pgfV{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 exch moveto dup 5 index + exch lineto } bind def} bind def}% + + % Parameters to axishade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \pgf@sys@postscript@header{/pgfA{ + /pgfdiff 8 index round cvi 8 index round cvi sub 2 mul 1 add def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + pgfheight 9 index 9 index 9 index 14 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfdir + stroke + 4 -1 roll 7 index add % red += incred + 4 -1 roll 6 index add % green += incgreen + 4 -1 roll 5 index add % blue += incblue + 4 -1 roll .5 sub % x += 0.5 + } repeat + mark 15 1 roll cleartomark exch pop % leave only start x on stack + }bind def } + + % Parameters to radialshade pre: \pgf@domb y x max + \pgf@sys@postscript@header{/pgfR1{ + newpath dup dup dup 0 360 arc clip newpath + dup /pgfendx exch def + /pgfendy exch def + 0.875 setlinewidth + [] 0 setdash + /pgfshade {pgfR} def + /pgfstartx exch def + /pgfstarty exch def + /pgfdiffx pgfendx pgfstartx sub def + /pgfdiffy pgfendy pgfstarty sub def + dup /pgfdomb exch def + }bind def } + + % Parameters to radialshade post: \pgf@firstcolor \pgf@doma + \pgf@sys@postscript@header{/pgfR2{ + newpath 0.5 add pgfcircx pgfcircy 3 2 roll 0 360 arc + setrgbcolor fill pop}bind def }% + + % Parameters to radialshade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \pgf@sys@postscript@header{/pgfR{ + /pgfdiff 8 index round cvi 8 index round cvi sub 4 mul 1 add def + /pgfcircx pgfstartx 9 index pgfdiffx pgfdomb div mul add def + /pgfcircy pgfstarty 9 index pgfdiffy pgfdomb div mul add def + /pgfcircxe pgfstartx 8 index pgfdiffx pgfdomb div mul add def + /pgfcircye pgfstarty 8 index pgfdiffy pgfdomb div mul add def + /pgfxstep pgfcircxe pgfcircx sub pgfdiff div def + /pgfystep pgfcircye pgfcircy sub pgfdiff div def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 8 index 8 index 8 index 13 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfcircx pgfcircy 2 index 0 360 arc closepath + stroke + 4 -1 roll 6 index add % red += incred + 4 -1 roll 5 index add % green += incgreen + 4 -1 roll 4 index add % blue += incblue + 4 -1 roll .25 sub % x += 0.25 + /pgfcircx pgfcircx pgfxstep add def + /pgfcircy pgfcircy pgfystep add def + } repeat + mark 14 1 roll cleartomark exch pop % leave only start x on stack + }bind def} +} + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def new file mode 100644 index 00000000000..fdf16a61210 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def @@ -0,0 +1,419 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-svg.def,v 1.20 2008/02/07 19:25:41 tantau Exp $ + + +% Driver commands for svg + + +% Helping functions: +\let\pgf@sys@svgpath=\pgfutil@empty +\def\pgf@sys@svgnum#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgf@sys@svgpath\temp}% + \xdef\pgf@sys@svgpath{\the\toks@}% + }% +} +\def\pgf@sys@addtosvgpath#1{\pgfutil@g@addto@macro\pgf@sys@svgpath{#1\space}} +\def\pgf@sys@flushsvgpath{\pgfsysprotocol@literal{\pgf@sys@svgpath}\global\let\pgf@sys@svgpath=\pgfutil@empty} +\def\pgf@sys@svg@gs#1{% + {\pgfsysprotocol@literal{\Hnewline }}\global\advance\pgf@sys@svg@scopecount by1\relax% +} +\newcount\pgf@sys@svg@objectcount +\let\Hnewline=\pgfutil@empty +\catcode`\%=12 +\def\pgf@sys@svg@percentchar{%} +\catcode`\%=14 + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@addtosvgpath{L }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@moveto#1#2{\pgf@sys@addtosvgpath{M }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@addtosvgpath{C }% + \pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}% + \pgf@sys@svgnum{#3}\pgf@sys@svgnum{#4}% + \pgf@sys@svgnum{#5}\pgf@sys@svgnum{#6}} +\def\pgfsys@rect#1#2#3#4{% + \pgfsys@moveto{#1}{#2}% + \pgf@sys@addtosvgpath{h }\pgf@sys@svgnum{#3}% + \pgf@sys@addtosvgpath{v }\pgf@sys@svgnum{#4}% + \pgf@sys@addtosvgpath{h }{\pgf@x=#3\pgf@x=-\pgf@x\pgf@sys@svgnum{\pgf@x}}% + \pgfsys@closepath} +\def\pgfsys@closepath{\pgf@sys@addtosvgpath{Z}} + +% Path usage: +\newif\ifpgf@sys@svg@clipnext +\def\pgf@sys@svg@possiblyclippedpath#1{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{ + \Hnewline \Hnewline } + \pgfsysprotocol@literal{\Hnewline }% + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \pgfsysprotocol@literal{\Hnewline } + \fi% +} +\def\pgfsys@stroke{\pgf@sys@svg@possiblyclippedpath{style="fill:none"}} +\def\pgfsys@fill{\pgf@sys@svg@possiblyclippedpath{style="stroke:none"}} +\def\pgfsys@fillstroke{\pgf@sys@svg@possiblyclippedpath{}} +\def\pgfsys@clipnext{\pgf@sys@svg@clipnexttrue} +\def\pgfsys@discardpath{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{ + \Hnewline \Hnewline } + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \global\let\pgf@sys@svgpath=\pgfutil@empty + \fi} + +% Fill rules: +\def\pgfsys@eoruletrue{\pgf@sys@svg@gs{fill-rule="evenodd"}} +\def\pgfsys@eorulefalse{\pgf@sys@svg@gs{fill-rule="nonzero"}} + +% Transparency: +\def\pgfsys@stroke@opacity#1{\pgf@sys@svg@gs{stroke-opacity="#1"}} +\def\pgfsys@fill@opacity#1{\pgf@sys@svg@gs{fill-opacity="#1"}} + +% Transformation: +\def\pgfsys@transformcm#1#2#3#4#5#6{% + {\pgf@x=#5\pgf@y=#6% + \pgf@sys@svg@gs{transform="matrix(#1,#2,#3,#4,\pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})"}}} + +% Scopes +\newcount\pgf@sys@svg@scopecount +\def\pgfsys@beginscope{% + \edef\pgf@sys@svg@thescopecount{\the\pgf@sys@svg@scopecount}% + \begingroup% + \pgf@sys@svg@scopecount=1\relax% + \pgfsysprotocol@literal{\Hnewline }% + } +\def\pgfsys@endscope{% + \loop% + \pgfsysprotocol@literal{\Hnewline }% + \advance\pgf@sys@svg@scopecount by-1\relax% + \ifnum\pgf@sys@svg@scopecount>0\relax% + \repeat% + \endgroup% + \global\pgf@sys@svg@scopecount=\pgf@sys@svg@thescopecount\relax% +} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \edef\pgf@test@dashpattern{#1}% + \ifx\pgf@test@dashpattern\pgfutil@empty% + \pgf@sys@svg@gs{stroke-dasharray="none" stroke-dashoffset="#2"}% + \else% + \pgf@sys@svg@gs{stroke-dasharray="#1" stroke-dashoffset="#2"}% + \fi} +\def\pgfsys@setlinewidth#1{\pgf@sys@svg@gs{stroke-width="#1"}} +\def\pgfsys@setmiterlimit#1{\pgf@sys@svg@gs{stroke-miterlimit="#1"}} +\def\pgfsys@buttcap{\pgf@sys@svg@gs{stroke-linecap="butt"}} +\def\pgfsys@roundcap{\pgf@sys@svg@gs{stroke-linecap="round"}} +\def\pgfsys@rectcap{\pgf@sys@svg@gs{stroke-linecap="square"}} +\def\pgfsys@miterjoin{\pgf@sys@svg@gs{stroke-linejoin="miter"}} +\def\pgfsys@roundjoin{\pgf@sys@svg@gs{stroke-linejoin="round"}} +\def\pgfsys@beveljoin{\pgf@sys@svg@gs{stroke-linejoin="bevel"}} + + +% +% Color management +% + +\def\XC@mcolor{\ifpgfpicture\pgfsetcolor{.}\fi} + +\def\pgf@sys@svg@color@rgb#1,#2,#3\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@cmy#1,#2,#3\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#4pt% + \pgf@xa=#1\pgf@xa% + \advance\pgf@xa by#4pt% + \advance\pgf@xa by-1pt% + \pgf@xa=-100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#4pt% + \pgf@xb=#2\pgf@xb% + \advance\pgf@xb by#4pt% + \advance\pgf@xb by-1pt% + \pgf@xb=-100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#4pt% + \pgf@xc=#3\pgf@xc% + \advance\pgf@xc by#4pt% + \advance\pgf@xc by-1pt% + \pgf@xc=-100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@gray#1\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar)}% + }% +} + +\def\pgf@sys@svg@gs@color#1{% + \ifpgfpicture\pgf@sys@svg@gs{#1}\fi% +} + +\def\pgfsys@color@rgb@stroke#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@rgb@fill#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@fill#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@stroke#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@fill#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@stroke#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@fill#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} + + +% Shadings: +\def\pgf@sys@svg@shading@stops{% + % Step 1: Compute 1/\pgf@sys@shading@end@pos + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + % Step 2: Insert stops. + \expandafter\pgf@sys@svg@shading@dostops\pgf@sys@shading@ranges% + % dummy for end: + {{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@rgb}{\pgf@sys@shading@end@rgb}}% + {}% end +} +\def\pgf@sys@svg@shading@dostops#1{% + \edef\pgf@test{#1}% + \ifx\pgf@test\pgfutil@empty% + \else% + \expandafter\pgf@sys@svg@shading@dostop\pgf@test% + \expandafter\pgf@sys@svg@shading@dostops% + \fi% +} +\def\pgf@sys@svg@shading@dostop#1#2#3#4{% + % #1 start pos + % #2 end pos + % #3 start rgb + % #4 end rgb + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% +} +\def\pgf@sys@svg@shading@dorgb#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@addtostops{\pgf@sys@svg@prepared}% +} + +\let\pgf@sys@svg@thestops=\pgfutil@empty +\def\pgf@sys@svg@addtostops#1{% + \edef\pgf@temp{#1}% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\pgf@sys@svg@thestops + \expandafter\expandafter\expandafter{\expandafter\pgf@sys@svg@thestops\expandafter\space\pgf@temp}% +} + + +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + }% + }% +} + +\def\pgfsys@functionalshading#1#2#3#4{% + \pgf@sys@fail{functional shadings}% + \expandafter\gdef\csname @pgfshading#1!\endcsname{% + \let\pgf@sys@svg@sh@defs\relax% + \let\pgf@sys@svg@sh\relax% + \let\pgf@sys@svg@pos\pgfpointorigin% + }% +} + +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@y}{\the\pgf@x}}% + }% + }% +} + +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@process{#2}% + % Divide by 2\pgf@sys@shading@end@pos% + \pgf@x=8\pgf@x% + \divide\pgf@x by \c@pgf@counta\relax% + \pgf@y=8\pgf@y% + \divide\pgf@y by \c@pgf@counta\relax% + \advance\pgf@x by.5pt% + \advance\pgf@y by.5pt% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@xa=\pgf@sys@shading@end@pos% + \pgf@xb=2\pgf@xa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@xb}}% + }% + }% +} + + +% Patterns + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \ifnum#9=1\relax% + % Colored. That's easy: + \pgfsysprotocol@literal{ + + #8 + }% + \else% + % Uncolored. Yikes! + \pgfsysprotocol@literal{ + + + #8 + }% + \fi% +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@color@rgb#2,#3,#4\relax% + \pgfsysprotocol@literal{ + + + } + \pgf@sys@svg@gs@color{fill="url(\#pgfupat\the\pgf@sys@svg@objectcount)"}% +} + +\def\pgfsys@setpatterncolored#1{% + \pgf@sys@svg@gs@color{fill="url(\#pgfpat#1)"}% +} + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def new file mode 100644 index 00000000000..05f647fc796 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def @@ -0,0 +1,392 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvi.def,v 1.5 2007/06/07 07:41:11 tantau Exp $ + +% Driver commands for pure, ultra-portable dvi, in the tradition of +% old-style LaTeX pictures. +% +% Do not expect magic from this file + + +\newtoks\pgf@sys@dvi@path +\def\pgf@sys@dvi@addtopath#1{\pgf@sys@dvi@path\expandafter{\the\pgf@sys@dvi@path#1}} + +% Placing an object: +\def\pgf@sys@dvi@put#1#2#3{% + {% + \setbox\pgf@hbox=\hbox{\raise#2\hbox to0pt{\kern#1\relax#3\hss}}% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \box\pgf@hbox% + }% +} + +\def\pgf@sys@dvi@drawrect#1#2#3#4{% + {% + \pgf@x=#1% + \pgf@y=#2% + \pgf@xa=#3% + \pgf@ya=#4% + \ifdim\pgf@xa<0pt% + \advance\pgf@x by\pgf@xa% + \pgf@xa=-\pgf@xa% + \fi% + \ifdim\pgf@ya<0pt% + \advance\pgf@y by\pgf@ya% + \pgf@ya=-\pgf@ya% + \fi% + \pgf@sys@dvi@put{\pgf@x}{\pgf@y}{\vrule width\pgf@xa height\pgf@ya}% + }% +} + +\def\pgf@sys@dvi@bezier{% + {% + % First iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + \pgf@xb=\pgf@time@t\pgf@xb\advance\pgf@xb by\pgf@time@s\pgf@xc% + \pgf@yb=\pgf@time@t\pgf@yb\advance\pgf@yb by\pgf@time@s\pgf@yc% + % Second iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + % Third iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + % + \advance\pgf@x by-.5\pgf@sys@dvi@linewidth% + \advance\pgf@y by-.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@sys@dvi@linewidth}{\pgf@sys@dvi@linewidth}% + }% +} + +\def\pgf@sys@dvi@drawcurve#1#2#3#4#5#6#7#8{% + {% + \pgf@x=#1% + \pgf@y=#2% + \pgf@xa=#3% + \pgf@ya=#4% + \pgf@xb=#5% + \pgf@yb=#6% + \pgf@xc=#7% + \pgf@yc=#8% + % Compute number of steps: + \pgfutil@tempdima=\pgf@x% + \advance\pgfutil@tempdima by-\pgf@xa% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdimb=-\pgfutil@tempdima% + \else% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@y% + \advance\pgfutil@tempdima by-\pgf@ya% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@xb% + \advance\pgfutil@tempdima by-\pgf@xc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@yb% + \advance\pgfutil@tempdima by-\pgf@yc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@x% + \advance\pgfutil@tempdima by-\pgf@xc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@y% + \advance\pgfutil@tempdima by-\pgf@yc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempcnta=\pgfutil@tempdimb% + \ifdim\pgf@sys@dvi@linewidth>0.3pt% + \pgfutil@tempdimb=0.15pt% + \else% + \ifdim\pgf@sys@dvi@linewidth<0.05pt% + \pgfutil@tempdimb=.025pt% + \else% + \pgfutil@tempdimb=.5\pgf@sys@dvi@linewidth% + \fi% + \fi% + \pgfutil@tempcntb=\pgfutil@tempdimb% + \divide\pgfutil@tempcnta by\pgfutil@tempcntb\relax% + \ifnum\pgfutil@tempcnta>0\relax% + \pgfutil@tempcntb=0\relax% + \loop% + {% + \pgfutil@tempdima=\the\pgfutil@tempcntb pt% + \pgfutil@tempdimb=\the\pgfutil@tempcnta pt% + \advance\pgfutil@tempdimb by-\pgfutil@tempdima\relax% + \divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% + \divide\pgfutil@tempdimb by\pgfutil@tempcnta\relax% + \edef\pgf@time@t{\pgf@sys@tonumber{\pgfutil@tempdima}}% + \edef\pgf@time@s{\pgf@sys@tonumber{\pgfutil@tempdimb}}% + \pgf@sys@dvi@bezier% + }% + \advance\pgfutil@tempcntb by1\relax + \ifnum\pgfutil@tempcntb<\pgfutil@tempcnta% + {\def\pgf@time@t{1}\def\pgf@time@s{0}\pgf@sys@dvi@bezier}% + \repeat% + \fi% + }% +} + +% Text: +\def\pgfsys@hbox#1{% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \pgf@sys@dvi@put{\pgf@sys@dvi@pt@x}{\pgf@sys@dvi@pt@y}{\box#1}% +} + + + +% Literals: + +\def\pgfsys@invoke#1{#1} + + +% Buffered path construction: + +\def\pgfsys@moveto#1#2{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@moveto{#1}{#2}}}} +\def\pgfsys@lineto#1#2{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@lineto{#1}{#2}}}} +\def\pgfsys@curveto#1#2#3#4#5#6{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@curveto{#1}{#2}{#3}{#4}{#5}{#6}}}} +\def\pgfsys@rect#1#2#3#4{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@rect{#1}{#2}{#3}{#4}}}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@closepath}}} + + +% Scoping +\def\pgfsys@beginscope{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@beginscope}}% +\def\pgfsys@endscope{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@endscope}}% + +\def\pgf@sys@dvi@beginscope{% + % Save current stuff... + \edef\pgf@sys@dvi@return{% + \global\pgf@sys@dvi@linewidth=\the\pgf@sys@dvi@linewidth% + \global\pgf@sys@dvi@pt@x=\the\pgf@sys@dvi@pt@x% + \global\pgf@sys@dvi@pt@y=\the\pgf@sys@dvi@pt@y% + \gdef\noexpand\pgf@sys@dvi@pt@aa{\pgf@sys@dvi@pt@aa}% + \gdef\noexpand\pgf@sys@dvi@pt@ab{\pgf@sys@dvi@pt@ab}% + \gdef\noexpand\pgf@sys@dvi@pt@ba{\pgf@sys@dvi@pt@ba}% + \gdef\noexpand\pgf@sys@dvi@pt@bb{\pgf@sys@dvi@pt@bb}% + }% + \begingroup% + \ignorespaces% +} + +\def\pgf@sys@dvi@endscope{% + \endgroup% + \pgf@sys@dvi@return% +} + + + +% Line width + +\newdimen\pgf@sys@dvi@linewidth +\pgf@sys@dvi@linewidth=0.4pt + +\def\pgfsys@setlinewidth#1{\global\pgf@sys@dvi@linewidth=#1\relax} + + +% Transformation matrix + +\newdimen\pgf@sys@dvi@pt@x +\newdimen\pgf@sys@dvi@pt@y + +\def\pgf@sys@dvi@pt@aa{1.0} \def\pgf@sys@dvi@pt@ab{0.0} +\def\pgf@sys@dvi@pt@ba{0.0} \def\pgf@sys@dvi@pt@bb{1.0} + +\def\pgf@sys@dvi@pos@transform#1#2{% + \pgf@pt@temp=#1% + #1=\pgf@sys@dvi@pt@aa#1% + \advance#1 by\pgf@sys@dvi@pt@ba#2% + #2=\pgf@sys@dvi@pt@bb#2% + \advance#2 by\pgf@sys@dvi@pt@ab\pgf@pt@temp% + \advance#1 by\pgf@sys@dvi@pt@x% + \advance#2 by\pgf@sys@dvi@pt@y% +} + +\def\pgf@sys@dvi@transformcm#1#2#3#4#5#6{% + {% + \pgf@xc=#5% + \pgf@yc=#6% + % + \pgf@x=#1pt% + \pgf@y=#2pt% + % + \pgf@xa=\pgf@sys@dvi@pt@aa\pgf@x% + \advance\pgf@xa by \pgf@sys@dvi@pt@ba\pgf@y% + % + \pgf@ya=\pgf@sys@dvi@pt@ab\pgf@x% + \advance\pgf@ya by \pgf@sys@dvi@pt@bb\pgf@y% + % + \pgf@x=#3pt% + \pgf@y=#4pt% + % + \pgf@xb=\pgf@sys@dvi@pt@aa\pgf@x% + \advance\pgf@xb by \pgf@sys@dvi@pt@ba\pgf@y% + % + \pgf@yb=\pgf@sys@dvi@pt@ab\pgf@x% + \advance\pgf@yb by \pgf@sys@dvi@pt@bb\pgf@y% + % + \pgf@x=\pgf@sys@dvi@pt@aa\pgf@xc% + \advance\pgf@x by\pgf@sys@dvi@pt@ba\pgf@yc% + \advance\pgf@x by\pgf@sys@dvi@pt@x% + % + \pgf@y=\pgf@sys@dvi@pt@ab\pgf@xc% + \advance\pgf@y by\pgf@sys@dvi@pt@bb\pgf@yc% + \advance\pgf@y by\pgf@sys@dvi@pt@y% + % + \global\pgf@sys@dvi@pt@x=\pgf@x% + \global\pgf@sys@dvi@pt@y=\pgf@y% + \xdef\pgf@sys@dvi@pt@aa{\pgf@sys@tonumber{\pgf@xa}}% + \xdef\pgf@sys@dvi@pt@ab{\pgf@sys@tonumber{\pgf@ya}}% + \xdef\pgf@sys@dvi@pt@ba{\pgf@sys@tonumber{\pgf@xb}}% + \xdef\pgf@sys@dvi@pt@bb{\pgf@sys@tonumber{\pgf@yb}}% + }% +} + +\def\pgfsys@transformcm#1#2#3#4#5#6{% + {% + \pgf@x=#5\relax% + \pgf@y=#6\relax% + \pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@transformcm{#1}{#2}{#3}{#4}{\the\pgf@x}{\the\pgf@y}}% + }% +} + + +% Stroking + +\def\pgfsys@stroke{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@stroke}}% + + +\def\pgf@sys@dvi@stroke{% + \let\pgf@sys@dvi@moveto=\pgf@sys@dvi@moveto@stroke% + \let\pgf@sys@dvi@lineto=\pgf@sys@dvi@lineto@stroke% + \let\pgf@sys@dvi@curveto=\pgf@sys@dvi@curveto@stroke% + \let\pgf@sys@dvi@rect=\pgf@sys@dvi@rect@stroke% + \let\pgf@sys@dvi@closepath=\pgf@sys@dvi@closepath@stroke% + {\the\pgf@sys@dvi@path}% + \pgf@sys@dvi@path{}% +} + +\def\pgf@sys@dvi@moveto@stroke#1#2{% + % These two store the current position: + \pgf@xc=#1\relax% + \pgf@yc=#2\relax% + % These two store the last moveto: + \pgf@xb=\pgf@xc% + \pgf@yb=\pgf@yc% +} + +\def\pgf@sys@dvi@lineto@stroke#1#2{% + {% + \pgf@xa=#1\relax% + \pgf@ya=#2\relax% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \pgf@sys@dvi@pos@transform{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@pos@transform{\pgf@x}{\pgf@y}% + % Now, we need to draw a line from (x/y) to (xa/ya) + % + % Horizontal? + \ifdim\pgf@y=\pgf@ya% + % Ok, that should be easy... + \pgf@xb=\pgf@xa% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@y by-0.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@xb}{\pgf@sys@dvi@linewidth}% + \else% + \ifdim\pgf@x=\pgf@xa% + % Ok, also easy... + \pgf@yb=\pgf@ya% + \advance\pgf@yb by-\pgf@y% + \advance\pgf@x by-0.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@sys@dvi@linewidth}{\pgf@yb}% + \else% + \edef\pgf@marshal{\noexpand\pgf@sys@dvi@drawcurve{\the\pgf@x}{\the\pgf@y}{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@marshal% + \fi% + \fi% + }% + % Remember: + \pgf@xc=#1\relax% + \pgf@yc=#2\relax% +} + + +\def\pgf@sys@dvi@curveto@stroke#1#2#3#4#5#6{% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \pgf@xa=#1% + \pgf@ya=#2% + \pgf@xb=#3% + \pgf@yb=#4% + \pgf@xc=#5% + \pgf@yc=#6% + {% + \pgf@sys@dvi@pos@transform{\pgf@x}{\pgf@y}% + \pgf@sys@dvi@pos@transform{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@pos@transform{\pgf@xb}{\pgf@yb}% + \pgf@sys@dvi@pos@transform{\pgf@xc}{\pgf@yc}% + \pgf@sys@dvi@drawcurve{\pgf@x}{\pgf@y}{\pgf@xa}{\pgf@ya}{\pgf@xb}{\pgf@yb}{\pgf@xc}{\pgf@yc}% + }% +} + +\def\pgf@sys@dvi@closepath@stroke{% + \pgf@sys@dvi@lineto@stroke{\pgf@xc}{\pgf@yc}% +} + +\def\pgf@sys@dvi@rect@stroke#1#2#3#4{% + \pgf@x=#1\relax% + \pgf@y=#2\relax% + \pgf@xa=#3\relax% + \pgf@ya=#4\relax% + \advance\pgf@xa by\pgf@x% + \advance\pgf@ya by\pgf@y% + \pgf@sys@dvi@moveto@stroke{\pgf@x}{\pgf@y}% + \pgf@sys@dvi@lineto@stroke{\pgf@xa}{\pgf@y}% + \pgf@sys@dvi@lineto@stroke{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@lineto@stroke{\pgf@x}{\pgf@ya}% + \pgf@sys@dvi@closepath@stroke% +} + + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def new file mode 100644 index 00000000000..16edebc350b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def @@ -0,0 +1,40 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfm.def,v 1.18 2007/12/17 14:52:31 tantau Exp $ + +% Driver commands for dvipdfm + +% +% Load common pdf and pdf in dvi commands: +% +\input pgfsys-common-pdf.def +\input pgfsys-common-pdf-via-dvi.def + +% +% dvipdfm-specific stuff: +% + + + +% +% Position tracking (needs pdftex >= 1.40.0-alpha-20051205 in dvi mode) +% +\ifx\pdftexversion\@undefined +\else + \ifnum\pdftexversion>139 + \pgf@sys@pdf@dvi@tracker + \fi +\fi + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def new file mode 100644 index 00000000000..af868df5fc4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def @@ -0,0 +1,126 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvips.def,v 1.19 2007/12/12 16:57:17 tantau Exp $ + +% Driver commands for dvips + +\def\pgfsys@invoke#1{\special{ps:: #1}} +\def\pgfsys@outerinvoke#1{\special{ps: #1}} +\def\pgf@sys@postscript@header#1{\AtBeginDvi{\special{! #1}}} +\def\pgf@sys@postscript@object#1{\special{! #1}} + + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% dvips-specific stuff: +% + +\def\pgfsys@beginpicture{\special{ps: }\special{ps::[begin]}\pgfsys@invoke{pgfo}} +\def\pgfsys@endpicture{\pgfsys@invoke{pgfc}\special{ps::[end]}} +\def\pgfsys@hbox#1{% + \pgfsys@invoke{pgfs}% + \special{ps::[end]}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \special{ps::[begin]}% + \pgfsys@invoke{pgfr}% +} +\def\pgfsys@begininvisible{% + \special{ps::[begin]}% + \pgfsys@invoke{gsave nulldevice}% + \special{ps::[end]}} +\def\pgfsys@endinvisible{% + \special{ps::[begin]}% + \pgfsys@invoke{grestore}% + \special{ps::[end]}% +} +\def\pgfsys@color@unstacked#1{\special{ps: \XC@usecolor{#1}}} +\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:} + +\def\pgfsys@papersize#1#2{% + \expandafter\gdef\expandafter\pgfsys@atbegindocument\expandafter{\pgfsys@atbegindocument\special{papersize=#1,#2}}} + +\expandafter\gdef\expandafter\pgfsys@atbegindocument\expandafter{\pgfsys@atbegindocument% + \pgf@sys@postscript@header{ + /pgfsc{}bind def% stroke color is empty by default + /pgffc{}bind def% fill color is empty by default + /pgfstr{stroke}bind def% + /pgffill{fill}bind def% + /pgfeofill{eofill}bind def% + /pgfe{a dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle + /pgfw{setlinewidth}bind def% setlinewidth + /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale + magscale{1 DVImag div dup scale}if + pgfx neg pgfy neg translate pgffoa .setopacityalpha}bind def% save + /pgfr{pgfsd restore}bind def %restore + userdict begin% + /pgfo{pgfsd /pgfx currentpoint /pgfy exch def def @beginspecial}bind def %open + /pgfc{newpath @endspecial pgfpd}bind def %close + /pgfsd{globaldict /pgfdelta /delta where {pop delta} {0} ifelse put}bind def% save delta + /pgfpd{/delta globaldict /pgfdelta get def}bind def % put delta + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.pgfsetfillopacityalpha{/pgffoa exch def + /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore}bind def + /pgfeofill{gsave pgffoa .setopacityalpha eofill 1 .setopacityalpha newpath eofill grestore}bind def}bind def + /.pgfsetstrokeopacityalpha{/pgfsoa exch def + /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore}bind def}bind def + /pgffoa 1 def + /pgfsoa 1 def + end + }% +} + +\AtBeginDocument{ % needed for plain TeX + \pgfsys@atbegindocument + \let\pgfsys@atbegindocument=\pgfutil@empty +} + + + +% +% Position tracking (needs pdftex >= 1.40 in dvi mode) +% +\ifx\pdftexversion\@undefined +\else + \ifnum\pdftexversion>139 + +\def\pgfsys@markposition#1{% + \pdfsavepos% + \edef\pgf@temp{#1}% + \expandafter\write\expandafter\pgfutil@auxout\expandafter{% + \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}% +} + +\def\pgfsyspdfmark#1#2#3{% + \expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{\pgfqpoint{#2sp}{#3sp}}% +} + +\def\pgfsys@getposition#1#2{% + \edef\pgf@marshal{\let\noexpand#2=\expandafter\noexpand\csname pgf@sys@pdf@mark@pos@#1\endcsname}% + \pgf@marshal% +} + +\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin} + + \fi +\fi + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def new file mode 100644 index 00000000000..c9881df5737 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def @@ -0,0 +1,395 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-pdftex.def,v 1.20 2007/12/20 10:56:53 tantau Exp $ + + +% Driver commands for pdf + +% +% Load common pdf commands: +% +\input pgfsys-common-pdf.def + +% +% pdftex-specific stuff: +% +\def\pgfsys@invoke#1{\pdfliteral{#1}} + +\def\pgfsys@hboxsynced#1{% + {% + \pgfsys@beginscope% + \setbox\pgf@hbox=\hbox{% + \hskip\pgf@pt@x% + \raise\pgf@pt@y\hbox{% + \pgf@pt@x=0pt% + \pgf@pt@y=0pt% + \pgflowlevelsynccm% + \pgfsys@hbox#1}% + \hss% + }% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \box\pgf@hbox% + \pgfsys@endscope% + }% +} + + +% Page resources (they are kept in objects and only written at the +% very end) + +\pdfobj reserveobjnum +\edef\pgf@sys@pdf@extgs@objnum{\the\pdflastobj} + +\pdfobj reserveobjnum +\edef\pgf@sys@pdf@pattern@objnum{\the\pdflastobj} + +\immediate \pdfobj {<< /pgfprgb [/Pattern /DeviceRGB] >>}%<< +\edef\pgf@sys@pdf@cs@objnum{\the\pdflastobj} + +\def\pgf@sys@pdf@possible@resources{% + /ColorSpace \pgf@sys@pdf@cs@objnum\space 0 R + /Pattern \pgf@sys@pdf@pattern@objnum\space 0 R + /ExtGState \pgf@sys@pdf@extgs@objnum\space 0 R +} + +{ + \edef\temp{ + \pgf@sys@pdf@possible@resources + } + \expandafter\global\expandafter\pdfpageresources\expandafter{\temp} +} + +\expandafter\pgfutil@everybye\expandafter{% + \the\pgfutil@everybye% + \immediate \pdfobj useobjnum \pgf@sys@pdf@extgs@objnum {<<\pgf@sys@pgf@resource@list@extgs>>}%<< + \immediate \pdfobj useobjnum \pgf@sys@pdf@pattern@objnum {<<\pgf@sys@pgf@resource@list@patterns>>}%<< +} + +\let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty% +\let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty% + +\def\pgf@sys@pdf@addtopageresources@extgs#1{% + \xdef\pgf@sys@pgf@resource@list@extgs{\pgf@sys@pgf@resource@list@extgs\space#1}% +} + +\def\pgf@sys@pdf@addtopageresources@patterns#1{% + \xdef\pgf@sys@pgf@resource@list@patterns{\pgf@sys@pgf@resource@list@patterns\space#1}% +} + + +\def\pgfsys@imagesuffixlist{.pdf:.jpg:.jpeg:.png:} +\def\pgfsys@defineimage{% width, height, page number + \ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{ width \pgf@imagewidth }\fi% + \ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{ height \pgf@imageheight }\fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{ page \pgf@imagepage }\fi% + \ifx\pdfximage\@undefined% old version of pdflatex + \ifx\pgf@imagepage\pgfutil@empty\else% + \PackageWarning{pgf}{Page selection not supported. Ignoring + page selection}% + \fi% + \setbox\pgfutil@tempboxa=\hbox{% + \pdfimage \pgf@imageheight \pgf@imagewidth {\pgf@filename}}% + \pdfform\pgfutil@tempboxa% + \edef\pgf@image{\noexpand\pdfrefform\the\pdflastform}% + \else% new version + {\pdfximage \pgf@imageheight \pgf@imagewidth attr + {\pgf@imageinterpolate\space\pgf@imagemask} \pgf@imagepage + {\pgf@filename}}% + \edef\pgf@image{\noexpand\pdfrefximage\the\pdflastximage}% + \fi +}% +\def\pgfsys@definemask{% + \ifx\pgf@maskmatte\pgfutil@empty% + \else% + \edef\pgf@maskmatte{/Matte [\pgf@maskmatte]}% + \fi% + \edef\pgf@attr{{\pgf@maskmatte\space /Decode [1 0]}}% + \immediate\pdfximage attr \pgf@attr {\pgf@filename}% + \edef\pgf@mask{\the\pdflastximage}% +} +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathparse{#2}% + \setbox\pgfutil@tempboxa=\hbox to\pgf@max{\vbox to\pgfmathresult pt{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{\pgf@max}{#2}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@doma\space0 \pgf@domb\space0] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathparse{#2}% + \setbox\pgfutil@tempboxa=\hbox to\pgfmathresult pt{\vbox to\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{#2}{\pgf@max}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [0 \pgf@doma\space0 \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setbox\pgfutil@tempboxa=\hbox to2\pgf@max{\vbox to2\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}% + \advance\pgf@xa by \pgf@x% + \advance\pgf@ya by \pgf@y% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@sys@bp@correct{\pgf@y}% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 3 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [true false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +}% +\def\pgfsys@functionalshading#1#2#3#4{% + {% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \setbox\pgfutil@tempboxa=\hbox to\pgf@x{\vbox to\pgf@y{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pgf@sys@bp@correct{\pgf@xb}% + \pgf@sys@bp@correct{\pgf@yb}% + \pgf@xc=-\pgf@xa% + \pgf@yc=-\pgf@ya% + % Now build the function + \pdfobj + stream + attr + { + /FunctionType 4 + /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] + /Range [0 1 0 1 0 1] + } + {{#4}}% + \edef\pgf@temp@num{\the\pdflastobj}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 1 + /ColorSpace /DeviceRGB + /Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}] + /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] + /Function \pgf@temp@num\space 0 R + >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \leavevmode% + \noexpand\pdfrefxform\the\pdflastxform% + \noexpand\pdfrefobj\pgf@temp@num% + }% + }% +} + + + +% Patterns + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \pgf@sys@bp@correct\pgf@xa% + \pgf@sys@bp@correct\pgf@ya% + \pgf@sys@bp@correct\pgf@xb% + \pgf@sys@bp@correct\pgf@yb% + \pgf@sys@bp@correct\pgf@xc% + \pgf@sys@bp@correct\pgf@yc% + % Now create the pattern object: + \immediate\pdfobj stream + attr + { + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /Resources << >> %<< + } + {#8}% + \pgf@sys@pdf@addtopageresources@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}% +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \pgfsysprotocol@literal{/pgfprgb cs #2 #3 #4 /pgfpat#1\space scn}% +} + +\def\pgfsys@setpatterncolored#1{% + \pgfsysprotocol@literal{/Pattern cs /pgfpat#1\space scn}% +} + + +\def\pgfsys@papersize#1#2{% + \pdfpageheight#2% + \pdfpagewidth#1} + + + % XForm version, crashes ghostview. + %\def\pgfsys@defobject#1#2#3#4{% + % \pgf@process{#2} + % \setbox\pgfobjectbox\hbox{\raise-\pgf@y\hbox{\hskip-\pgf@x\relax#4}} + % \pgf@process{#3} + % \pgf@xa=\pgf@x + % \pgf@ya=\pgf@y + % \pgf@process{#2} + % \advance\pgf@xa by-\pgf@x + % \advance\pgf@ya by-\pgf@y + % \wd\pgfobjectbox=\pgf@xa + % \dp\pgfobjectbox=0pt + % \ht\pgfobjectbox=\pgf@ya + % \pdfxform\pgfobjectbox + % \expandafter\xdef\csname#1\endcsname{\the\pdflastxform} + % \expandafter\xdef\csname pgf@trans#1\endcsname + % {{\pgfget x}{\pgfget y}}} + %\def\pgfsys@useobject#1#2{% + % \setbox\pgfobjectbox\hbox{\pdfrefxform \csname#1\endcsname}% + % \dp\pgfobjectbox=0pt% + % \ht\pgfobjectbox=0pt% + % \wd\pgfobjectbox=0pt% + % \pgfsys@discardpath% + % \pgfsys@beginscope% + % #2% + % \edef\pgf@temp{{1}{0}{0}{1}\csname pgf@trans#1\endcsname}% + % \expandafter\pgfsys@transform\pgf@temp% + % \box\pgfobjectbox% + % \pgfsys@endscope} + + + +% +% Position tracking +% +\def\pgfsys@markposition#1{% + \pdfsavepos% + \edef\pgf@temp{#1}% + \expandafter\write\expandafter\pgfutil@auxout\expandafter{% + \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}% +} + +\def\pgfsyspdfmark#1#2#3{% + \expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{\pgfqpoint{#2sp}{#3sp}}% +} + +\def\pgfsys@getposition#1#2{% + \edef\pgf@marshal{\let\noexpand#2=\expandafter\noexpand\csname pgf@sys@pdf@mark@pos@#1\endcsname}% + \pgf@marshal% +} + +\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin} + + +% +% Opacity masks +% +\def\pgfsys@fadingfrombox#1#2{% + {% + \pgf@x=-.5\wd#2% + \pgf@y=-.5\ht#2% + \advance\pgf@y by.5\dp#2% + \expandafter\xdef\csname pgfsmasktrans@#1\endcsname{% + \noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% + \pdfxform resources { \pgf@sys@pdf@possible@resources } #2% + \expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pdflastxform}% + }% +} +\def\pgfsys@usefading#1#2#3#4#5#6#7{% + \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax% + \PackageError{pgf}{Undefined fading '#1'}{}% + \else% + {% + \expandafter\ifx\csname pgfsmaks@#1\endcsname\relax% + \pgf@sys@pdf@install@mask{#1}% + \fi% + \pgftransformreset% + \pgftransformcm{#2}{#3}{#4}{#5}{\pgfpoint{#6}{#7}}% + \csname pgfsmasktrans@#1\endcsname% + {% + \pgflowlevelsynccm% + \pgfsys@invoke{/pgfsmask\csname pgfsmask@#1\endcsname\space gs}% + }% + \pgftransforminvert% + \pgflowlevelsynccm% + }% + \fi +} + +\def\pgf@sys@pdf@install@mask#1{% + \setbox\pgfutil@tempboxa=\hbox{\pdfrefxform\csname pgfsmaskxform@#1\endcsname} + \immediate\pdfxform% + attr { + /Group + << + /S /Transparency + /CS /DeviceGray + >> + }% << + \pgfutil@tempboxa% + \pgf@sys@pdf@addtopageresources@extgs{% + /pgfsmask\the\pdflastxform\space + << + /SMask + << + /S /Luminosity + /G \the\pdflastxform\space 0 R + >> + >> } %<< + \expandafter\xdef\csname pgfsmask@#1\endcsname{\the\pdflastxform}% +} + +% +% Transparency groups +% +\def\pgfsys@transparencygroupfrombox#1{% + \pdfxform + attr { /Group << /S /Transparency >> } %<< + resources { \pgf@sys@pdf@possible@resources } + #1% + \setbox#1=\hbox{\pdfrefxform\pdflastxform}% +} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def new file mode 100644 index 00000000000..76202d4c842 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def @@ -0,0 +1,193 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.16 2008/02/07 19:25:41 tantau Exp $ + + +\RequirePackage{xcolor} + + +% Driver commands for tex4ht + +% +% Load common pdf commands: +% +\input pgfsys-common-svg.def + +% +% tex4ht-specific stuff: +% +\def\pgfsys@invoke#1{\pgf@sys@fail{svg code in preamble}} +\def\pgfsys@body@invoke#1{\HCode{#1}} + +\newcount\pgf@sys@svg@picnum + + +\def\pgfsys@beginpicture{% + \Configure{[]}{$}{$} + \Configure{()}{$}{$} + \Configure{$$}{}{}{}%$$ + \Configure{$}{}{}{}%$ + \Configure{SUB}{\HCode{}}{\HCode{}} + \Configure{SUP}{\HCode{}}{\HCode{}} + \Configure{SUBSUP}{}{}{} + \Configure{htf} + {0}{+}{}{} +} +\def\pgfsys@endpicture{% + % undo: + \Configure{htf}{0}{+}{}{} +} + +\def\pgfsys@typesetpicturebox#1{% + \global\advance\pgf@sys@svg@picnum by 1\relax% + % Ok, compute width/height + \pgf@xa=\pgf@picminx% + \pgf@ya=\pgf@picminy% + \pgf@xb=\pgf@picmaxx% + \pgf@yb=\pgf@picmaxy% + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@y<1pt% + \pgf@y=1pt% + \fi% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfsysprotocol@flushcurrentprotocol% + \HCode{

SVG-Viewer needed.

}% + \special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}% + \pgfsys@invoke{\Hnewline \Hnewline }% + \pgfmathsetlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% + \pgfsys@invoke{\Hnewline \Hnewline }% + \special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}% +} + +\def\pgfsys@hbox#1{% + \pgf@x=.5\wd#1% + \ifx\tikz@textcolor\relax% + \else% + \ifx\tikz@textcolor\pgfutil@empty% + \pgfsetfillcolor{.}% + \else% + \pgfsetfillcolor{\tikz@textcolor}% + \fi% + \fi% tweak for TikZ + \HCode{\Hnewline }% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \HCode{\Hnewline }% +} + +\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi} + +\def\pgfsys@shadingoutsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} +\def\pgfsys@shadinginsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} + +\def\pgfsys@body@shadingoutsidepgfpicture#1{% + \begingroup% + #1% + \setbox\pgfpic=\hbox to0pt{% + \pgfsys@beginpicture% + \pgfsys@beginscope% + \pgf@sys@svg@sh@defs% + \pgf@sys@svg@sh% + \pgfsys@endscope% + \pgfsys@endpicture% + \hss% + }% + \pgf@process{\pgf@sys@svg@pos}% + \pgf@picminx=0pt% + \pgf@picminy=0pt% + \pgf@picmaxx=\pgf@x% + \pgf@picmaxy=\pgf@y% + \def\pgf@shift@baseline{0pt}% + \pgfsys@typesetpicturebox\pgfpic% + \endgroup% +} + +\def\pgfsys@body@shadinginsidepgfpicture#1{% + #1% + \pgf@sys@svg@sh@defs% hmmm.... + \pgf@process{\pgf@sys@svg@pos} + \pgf@xa=-.5\pgf@x% + \pgf@ya=-.5\pgf@y% + \pgfsysprotocol@literal{\Hnewline}% + \pgf@sys@svg@sh% + \pgfsysprotocol@literal{\Hnewline}% +} + +% Protect against color.4ht evil meddling with xcolor: +\let\pgf@xcolor@declaredcolor=\@declaredcolor +\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor + +\AtBeginDocument{ + \let\pgfsys@invoke=\pgfsys@body@invoke + \let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture + \let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture + \let\pgf@texht@declaredcolor=\@declaredcolor + \let\pgf@texht@undeclaredcolor=\@undeclaredcolor + \def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi} + \def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi} + \ConfigureEnv{pgfpicture}{}{}{}{} +} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def new file mode 100644 index 00000000000..5e3aa27258c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def @@ -0,0 +1,87 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-textures.def,v 1.5 2007/12/12 16:57:17 tantau Exp $ + + +% Driver commands for textures driver + + +\def\pgfsys@invoke#1{\special{rawpostscript #1}} +\def\pgf@sys@postscript@header#1{\special{prepostscript #1}} +\def\pgf@sys@postscript@object#1{\special{rawpostscript #1}} + + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% textures-specific stuff: +% + +\def\pgfsys@beginpicture{% + \special{rawpostscript save}% + \special{rawpostscript save pgfgetcoords}% + \special{postscript}% here come the coordinates + \special{rawpostscript restore}% + \special{rawpostscript pgfbeginpicture}} +\def\pgfsys@endpicture{\special{rawpostscript restore}} +\def\pgfsys@hbox#1{% + \pgfsys@invoke{save pgfbeginhbox}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1% + \pgfsys@invoke{restore}% +} +\def\pgfsys@begininvisible{% + \special{rawpostscript gsave nulldevice}% +} +\def\pgfsys@endinvisible{% + \special{rawpostscript grestore}% +} +\def\pgfsys@color@unstacked#1{\special{rawpostscript \XC@usecolor{#1}}} + +\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:} + +\AtBeginDocument{ + % Always present specials. + \special{prepostscript + /pgfsc{}bind def% stroke color is empty by default + /pgffc{}bind def% fill color is empty by default + /pgfe{moveto dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle + /pgfstr{stroke}bind def% + /pgffill{fill}bind def% + /pgfeofill{eofill}bind def% + /pgfw{setlinewidth}bind def% setlinewidth + /pgfgetcoords{/sps{globaldict begin /pgfgy exch def /pgfgx exch def + end pop pop}def/eps{}def userdict begin}bind def + /pgfbeginpicture{/pgfx pgfgx def /pgfy pgfgy def pgfx pgfy translate 1 1 72.27 72 div mul2 neg scale}bind def + /pgfbeginhbox{1 1 72 72.27 div mul2 neg scale + pgfx neg pgfy neg translate + pgffoa .setopacityalpha}bind def% save + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.pgfsetfillopacityalpha{/pgffoa exch def + /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore}bind def + /pgfeofill{gsave pgffoa .setopacityalpha eofill1 .setopacityalpha newpath eofill grestore}bind def}bind def + /.pgfsetstrokeopacityalpha{/pgfsoa exch def + /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore}bind def}bind def + /pgffoa 1 def + /pgfsoa 1 def + } +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def new file mode 100644 index 00000000000..742b4a6fef3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def @@ -0,0 +1,99 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-vtex.def,v 1.8 2007/12/12 16:57:17 tantau Exp $ + + +% Driver commands for vtex + +% Invoking things: +\def\pgfsys@invoke#1{\special{pS: grestore #1 gsave}} % to protect against things happeing in between +\def\pgfsys@outerinvoke#1{\special{pS: #1}} +\def\pgf@sys@postscript@header#1{\special{pS: #1}} +\def\pgf@sys@postscript@object#1{\special{pS: #1}} + + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% vtex-specific stuff: +% + + +% Starting and ending a picture: +\def\pgfsys@beginpicture{\special{pS: + save + /pgfx currentpoint /pgfy exch def def + currentpoint translate + gsave}% + \let\set@color=\pgf@sys@vtex@set@color% + \let\reset@color=\pgf@sys@vtex@reset@color% +} +\def\pgf@sys@vtex@setcolor#1{% + \pgfutil@colorlet{pgf@tempcolor}{#1}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@sys@vtex@@setcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@sys@vtex@@setcolor#1#2#3#4#5{% + \pgfsysps@color@resetnow% + \expandafter\ifx\csname pgfsys@color@#4\endcsname\relax% + \PackageError{pgfbase}{Unsupported color model `#4'. Sorry}{}% + \else% + \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4\endcsname}% + \pgf@uncomma#5,,% + \pgf@colmarshal% + \fi} +\def\pgf@sys@vtex@set@color{\pgf@sys@vtex@setcolor{.}\aftergroup\reset@color} +\def\pgf@sys@vtex@reset@color{\pgf@sys@vtex@setcolor{.}} +\def\pgfsys@endpicture{\special{pS: + newpath + grestore + newpath + restore}} + +% Graphics: +\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:.pdf:} + +% Starting and ending a box: +\def\pgfsys@hbox#1{% + \pgfsys@invoke{save pgfx neg pgfy neg translate}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \pgfsys@invoke{restore}% +} + +\def\pgfsys@color@unstacked#1{\special{pS: \XC@usecolor{#1}}} + +\def\pgfsys@fill@opacity#1{\pgf@sys@fail{opacity}} +\def\pgfsys@stroke@opacity#1{\pgf@sys@fail{opacity}} + +\AtBeginDocument{ + % Always present specials. + \special{pS: + /pgfsc{} bind def% stroke color is empty by default + /pgffc{} bind def% fill color is empty by default + /pgfstr{stroke} bind def% + /pgffill{fill} bind def% + /pgfeofill{eofill} bind def% + /pgfe{moveto dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath} bind def% rectangle + /pgfw{setlinewidth} bind def % setlinewidth + } +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex new file mode 100644 index 00000000000..e568c4c8c90 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -0,0 +1,905 @@ +% 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. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys.code.tex,v 1.31 2008/02/07 19:25:41 tantau Exp $ + + +% Load key mechanism +\input pgfkeys.code.tex + +% "pgf" is a family +\pgfkeys{/pgf/.is family} +\def\pgfset{\pgfqkeys{/pgf}} + +% +% The following conversion functions are used to convert from TeX +% dimensions to postscript/pdf points. +% +{\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} + +\def\pgf@sys@tonumber#1{\expandafter\Pgf@geT\the#1} + +\def\pgf@sys@bp@correct#1{#1=0.99627#1} + +\def\pgf@sys@bp#1{% + {% + \pgf@x=#1\relax% + \pgf@x=0.99627\pgf@x% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} +\def\pgf@sys@pt#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} + + +% internal dimensions that are always present when pgsys is loaded. +\newdimen\pgf@x +\newdimen\pgf@y +\newdimen\pgf@xa +\newdimen\pgf@ya +\newdimen\pgf@xb +\newdimen\pgf@yb +\newdimen\pgf@xc +\newdimen\pgf@yc + +% internal counters that are alwyas present when pgfsys is loaded +\newcount\c@pgf@counta +\newcount\c@pgf@countb +\newcount\c@pgf@countc +\newcount\c@pgf@countd + + +% The following \if decides, whether even-odd filling and clipping is +% to be used or normal the non-zero winding number rule. See the +% pdf-documentation for details on what these rules are. + +\newif\ifpgfsys@eorule + + + +% In the following dummy definitions of the pgf system commands are +% given. The individual drivers must overwrite these definitions, +% preferably all of them. If some system command is used that has not +% been overwritten, the command fails with a warning. +% +% In some cases, some pgf system commands are just shorthands for a +% series of more complicated commands. In this case, a default +% implementation is given in this file, but a driver may choose to +% overwrite this default implementation with a more effecient +% version. For example, a closestroke is the same as a closepath +% followed by a stroking, but in pdf there is a special shorthand for +% this. So, the pdf driver overwrites \pgfsys@closestroke, while the +% postscript driver does not. +% +% The commands for which default implementations are available are +% given at the end. + +\def\pgf@sys@fail#1{% + \expandafter\ifx\csname pgf@sys@fail@#1\endcsname\pgfutil@empty% + \else% + \expandafter\global\expandafter\let\csname pgf@sys@fail@#1\endcsname=\pgfutil@empty% + \PackageWarning{pgf}{% + Your graphic driver \pgfsysdriver\space does not support #1. This warning is given only once}% + \fi% +} + + + +\def\pgfsys@invoke{\pgf@sys@fail{invoking specials}} +% This command is used whenever some literal text needs to be inserted +% into the resulting .pdf, .ps, or .dvi file. Note that most +% \pgfsys@xxxx commands will not directly call this command, but, +% rather, use the protocolling mechanism to record their literal +% text. It is then left to the discretion of the protocolling +% mechansim to insert the literal text at some appropriate, later +% time. +% +% This command should only be called when \pgfsys@beginpicture has +% been called previously and when the picture has not been suspended +% using \pgfsys@beginhbox. + + +\def\pgfsys@outerinvoke{\pgfsys@invoke} +% This command can be used to insert protocolled graphic commands +% outside any picture. This is extremely dangerous, but sometimes +% useful. By default, this command does the same as inside pictures. + + + +% +% +% Path construction commands +% +% + +\def\pgfsys@moveto#1#2{\pgf@sys@fail{path constructions}} +% This command is used to start a path at a specific point (#1bp,#2bp) +% or to move the current point of the current path to (#1bp,#2bp) +% without drawing anything upon stroking (the current path is +% `interrupted'). +% +% Here (and in the following) the coordinates are in TeX's big points +% (bp), unless the coordinate system has been scaled. A big point is +% 1/72 inches. Note that TeX's point pt is 1/72.27 inches. +% +% Example: +% +% \pgfsys@moveto{10}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% This will draw a line from (10bp,10bp) to the origin of the picture. + +\def\pgfsys@lineto#1#2{\pgf@sys@fail{path constructions}} +% Continue the current path to (#1bp,#2bp) with a line. + +\def\pgfsys@curveto#1#2#3#4#5#6{\pgf@sys@fail{path constructions}} +% Continue the current path with a bezier curver to (#5bp,#6bp). The +% control points of the curve are at (#1bp,#2bp) and (#3bp,#4bp). + +\def\pgfsys@rect#1#2#3#4{\pgf@sys@fail{path constructions}} +% Append a rectangle to the current path whose lower left corner is at +% (#1bp,#2bp) and whose width/height is given by (#3bp,#4bp). +% +% This command can be `mapped back' to moveto and lineto commands, but +% it is included since pdf has a special, quick version of this command. + +\def\pgfsys@closepath{\pgf@sys@fail{path constructions}} +% Close the current path. This results in joining the current point of +% the path with the point specified by the last moveto +% operation. Typically, this is preferable over using lineto to the +% last point specified by a moveto, since the line starting at this +% point and the line ending at this point will be smoothly joined by +% closepath. +% +% Example: +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@closepath +% \pgfsys@stroke +% +% versus +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% The difference between the above will be that in the second triangle +% the corner at the origin will be wrong; it will just be the overlay +% of two lines going in different directions, not a sharp pointed +% corner. + + + + + + +% +% +% Stroking and filling commands +% +% + +\def\pgfsys@stroke{\pgf@sys@fail{path usage}} +% Stroke the current path (as if it were drawn with a pen). A number +% of so-called graphic state parameters influence this, which can be +% set in different ways: +% +% - linewidth +% The `thickness' of the line. A width of 0 is the thinnest width +% renderable on the device. On a high-resolution printer this may +% become invisible and should be avoided. A good choice is 0.4pt, +% which is the default. +% +% - stroke color +% This special color is used for stroking. If it is not set, the +% current color is used. +% +% - cap +% The cap describes how the endings of lines a drawn. A round cap +% adds a little half circle to these endings. A butt cap ends the +% lines exactly at the end (or start) point without anything +% added. A rectangular cap ends the lines like the butt cap, but the +% lines protrude over the endpoint by the line thickness. (See also +% the pdf or postscript manual). If the path has been closed, no cap +% is drawn. +% +% - join +% This describes how a bend (a join) in a path is rendered. A round +% join draws bends using small arcs. A bevel join just draws the two +% lines and then fills the join minimally so that it becomes +% convex. A miter join extends the lines so that they form a single +% sharp corner, but only up to a certain miter limit. (See the pdf +% or postscript manual once more). +% +% - dash +% The line may be dashed according to a dashing pattern. +% +% - clipping area +% If a clipping area is established, only those parts of the path +% that are inside the clipping area will be drawn. +% +% In addition to stroking a path, the path may also be used for +% clipping after it has been stroked. This will happen if the +% \pgfsys@clipnext is used prior to this command, see there for +% details. + +\def\pgfsys@fill{\pgf@sys@fail{path usage}} +% This command fills the area surrounded by the current path. If the +% path has not yet been closed, it is closed prior to filling. The +% path itself is not stroked. For self-intersecting paths or paths +% consisting of multiple parts, the nonzero winding number rule is +% used to determine whether a point is inside or outside the +% path, except if \ifpgfsys@eorule holds -- in which case the even-odd +% rule should be used. (See the pdf or postscript manual for details.) +% +% The following graphic state parameters influence the filling: +% +% - fill color +% If the fill color is not especially set, the current color is +% used. +% +% - clipping area +% If a clipping area is established, only those parts of the filling +% area that are inside the clipping area will be drawn. +% +% In addition to filling the path, the path will also be used for +% clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@fillstroke{\pgf@sys@fail{path usage}} +% First, the path is filled, then the path is stroked. If the fill and +% stroke colors are the same (or if they are not specified and the +% current color is used), this yields almost the same as a +% \pgfsys@fill. However, due to the line thickness of the stroked +% path, the fillstroked area will be slightly larger. +% +% In addition to stroking and filling the path, the path will also be +% used for clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@clipnext{\pgf@sys@fail{path usage}} +% This command should be issued after a path has been constructed, but +% before it has been stroked and/or filled or discarded. When the +% command is used, the next stroking/filling/discarding command will +% first be executed normally. Then, afterwards, the just-used path +% will be used for subsequent clipping. If there has already been a +% clipping region, this region is intersected with the new clipping +% path (the clipping cannot get bigger). The nonzero winding number +% rule is used to determine whether a point is inside or outside the +% clipping area or the even-odd rule, depending on whether +% \ifpgfsys@eorule holds. + +\def\pgfsys@discardpath{\pgf@sys@fail{path usage}} +% Normally, this command should `throw away' the current path. +% However, after \pgfsys@clipnext has been called, the current path +% should subsequently be used for clipping. See \pgfsys@clipnext for +% details. + + + + + +% +% +% Stroking options +% +% +\def\pgfsys@setlinewidth#1{\pgf@sys@fail{setting the line width}} +% Sets the width of lines, when stroked, to #1bp. + +\def\pgfsys@buttcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a butt cap. See \pgfsys@stroke. + +\def\pgfsys@roundcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a round cap. See \pgfsys@stroke. + +\def\pgfsys@rectcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a rectangular cap. See \pgfsys@stroke. + +\def\pgfsys@miterjoin{\pgf@sys@fail{setting the line join}} +% Sets the join to a miter join. See \pgfsys@stroke. + +\def\pgfsys@setmiterlimit#1{\pgf@sys@fail{setting the line cap}} +% Sets the miter limit of lines to #1. See the pdf or postscript +% documentation. + +\def\pgfsys@roundjoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a round join. See \pgfsys@stroke. + +\def\pgfsys@beveljoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a bevel join. See \pgfsys@stroke. + +\def\pgfsys@setdash#1#2{\pgf@sys@fail{setting the dashing pattern}} +% Sets the dashing patter. #1 should be a list of lengths given in big +% points (bp) separated by spaces. #2 should be a single value given +% in bp. +% +% The list of values in #1 is used to determine the lengths of the +% `on' phases of the dashing and of the `off' phases. For example, if +% #1 is `3 4', then the dashing pattern is `3bp on followed by 4bp +% off, followed by 3bp on, followed by 4bp off, and so on'. A pattern +% of `.5 4 3 1.5' means `.5bp on, 4bp off, 3bp on, 1.5bp off, .5bp on, +% ...'. If the number of entries is odd, the last one is used twice, +% so `3' means `3bp on, 3bp off, 3bp on, 3bp off,...'. An empty list +% means `always on'. +% +% The second argument determines the `phase' of the pattern. For +% example, for a pattern of `3 4' and a phase of `1', the pattern +% would start: `2bp on, 4bp off, 3bp on, 4bp off, 3bp on, 4bp off...'. + + + + + +% +% +% Color stuff +% +% + +\def\pgfsys@color@rgb@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given rgb tuple +% (numbers between 0 and 1). +% +% Example: Make stroked text dark red: \pgfsys@color@rgb@stroke{0.5}{0}{0} +% +% The special stroking color is only used if the stroking color has +% been set since the last \pgfutil@color command. Thus, each \pgfutil@color command +% should reset both the stroking and filling colors. + +\def\pgfsys@color@rgb@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given rgb tuple +% (numbers between 0 and 1). This color may be different from the +% stroking color. + +\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@rgb@stroke{#1}{#2}{#3}\pgfsys@color@rgb@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. This is a +% ``low-level'' version of the \pgfutil@color command. It is currently only +% used by the plain tex version to support colors. + +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@cmyk@stroke{#1}{#2}{#3}{#4}\pgfsys@color@cmyk@fill{#1}{#2}{#3}{#4}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@cmy@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@cmy@stroke{#1}{#2}{#3}\pgfsys@color@cmy@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@gray@stroke#1{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray@fill#1{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray#1{\pgfsys@color@gray@stroke{#1}\pgfsys@color@gray@fill{#1}} +% Sets the color used for filling and stroking operations. + +\newif\ifpgfsys@color@reset@inorder +% This if decides whether the color resetting of the +% \pgfsys@color@reset command may assume that all color commands are +% given ``in order.'' This means that this command will not be called, +% say, at the beginning of a box that is later inserted at a point +% where a fill color was actively set. This may allow the command to +% produce more compact code when it ``knows'' that no special fill or +% stroke color has been set. +\pgfsys@color@reset@inordertrue + + +\def\pgfsys@color@reset{} +% This command will be called when the \pgfutil@color command is used. It +% should purge any internal settings of stroking and filling +% color. After this call, till the next use of a command like +% \pgfsys@color@rgb@fill, the current color installed by the \pgfutil@color +% command should be used. + +\def\pgfsys@color@unstacked#1{} +% This slightly obscure command causes the color stack to be +% tricked. When called, this command should set the current color to +% #1 without causing any change in the color stack. + + + +% +% +% Coordinate system transformations +% +% + +\def\pgfsys@transformcm#1#2#3#4#5#6{\pgf@sys@fail{transformations}} +% Perform a concatenation of the low-level current transformation +% matrix with the matrix given by the values #1 to #6. The +% transformation matrix is a transformation on a homogeneous +% 2D-coordinate system. See the pdf or postscript manual for details. + + + + +% +% +% Graphic state saving and restoring. +% +% + +\def\pgfsys@beginscope{\pgf@sys@fail{scoping}} +% Saves the current graphic state on a graphic state stack. All +% changes to the graphic state parameters mentioned for \pgfsys@stroke +% and \pgfsys@fill will be local to the current graphic state and will +% the old values will be restored after endscope is used. +% +% WARNING: pdf and postscript differ with respect to the question of +% whether the current path is part of the graphic state or not. For +% this reason, you should never use this command unless the path is +% currently empty. For example, it might be a good idea to use +% discardpath prior to calling this command. + +\def\pgfsys@endscope{\pgf@sys@fail{scoping}} +% Restores the last saved graphic state. + + + + +% +% +% Special commands +% +% + +\def\pgfsys@imagesuffixlist{} +% A list of suffixes, separated by `:', that will be tried when +% searching for an image. + + + +% +% +% Transparency +% +% + +\def\pgfsys@stroke@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of stroking operations. 1 means fully opaque, 0 +% means fully transparent. + +\def\pgfsys@fill@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of filling operations. 1 means fully opaque, 0 +% means fully transparent. + +\def\pgfsys@transparencygroupfrombox#1{\pgf@sys@fail{transparency groups}} +% This takes a TeX box and converts it into a transparency +% group. This means that any transparency settings apply to the box as +% a whole. For instance, if a box contains two overlapping black +% circles and you draw them normally with 50% transparency, then the +% overlap will be darker than the rest. By comparison, if the circles +% are part of a transparency group, the overlap will get the same +% color as the rest. + +\def\pgfsys@definemask{\pgf@sys@fail{image masks}} +% This command declares a mask for usage with images. It works similar +% to \pgfsys@defineimage: Certain macros are set when the command is +% called. The result should be to set the macro \pgf@mask to a pdf +% object count that can subsequently be used as a soft mask. The +% following macros will be set when this command is invoked: +% +% - \pgf@filename +% File name of the mask to be defined. +% +% - \pgf@maskmatte +% The so-called matte of the mask (see the pdf documentation for +% details). The matte is a color specification consisting of 1, 3 or +% 4 numbers between 0 and 1. The number of numbers depends on the +% number of color channels in the image (not in the mask!). It will +% be assumed that the image has been preblended with this color. + +\def\pgfsys@fadingfrombox#1#2{\pgf@sys@fail{fadings}} +% Declares an fading named #1. The parameter #2 must be a +% box. Its contents luminosity determines the opacity of the resulting +% mask. + +\def\pgfsys@usefading#1#2#3#4#5#6#7{\pgf@sys@fail{fadings}} +% Installs a previously declared fading #1 in the current graphics +% state. Parameters #2 to #7 specify a transformation cm that should +% be applied to the mask before it is used. + + + +% +% +% Shading commands +% +% + +\def\pgfsys@horishading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Declares a horizontal shading for later use. The effect of this +% command should be the definition of a macro called `@pgfshading#1!' +% (or \csname @pdfshading#1!\endcsname, to be precise). When invoked, +% this new macro should insert a shading at the current position. +% +% #1 is the name of the shading, which is also used in the output +% macro name. #2 is the height of the shading and must be given as a +% TeX dimension like `2cm' or `10pt'. #3 is a shading color +% specification as specified in the pgfuserguide. The shading +% specification implicitly fixes the width of the shading. +% +% When `@pgfshading#1!' is invoked, it should insert a box of height +% #2 and the width implicit in the shading declaration. + +\def\pgfsys@vertshading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Like horishading, only for vertical shadings. This time, the height +% of the shading is implicit in #3 and the width is given as #2. + +\def\pgfsys@radialshading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Declares a radial shading. Like the previous macros, this command +% should setup the macro `@pgfshading#1!', which upon invocation +% should insert a radial shading whose size is implicit in #3. +% +% The parameter #2 is a pgf point specification if the starting point +% of the shading. See the pgfuserguide for details. + +\def\pgfsys@functionalshading#1#2#3#4{\pgf@sys@fail{shadings (functional)}\pgf@sys@noshading{#1}} +% Declares a shading using a PostScript-like function that provides a +% color for each point. Like the previous macros, this command +% should setup the macro `@pgfshading#1!' so that it will produce a +% box containing the desired shading. +% +% Parameter #1 is the name of the shading. Parameter #4 is a +% Postscript-like function (type 4 function of the PDF specification) +% as described in Section 3.9.4 of the PDF Specification version 1.7. +% Parameter #2 and #3 are pgf point specifications that specifies the +% lower left and upper right coordinate. +% +% When function #4 is evaluated, the coordinate of the current +% point will be on the (virtual) PostScript stack in bp units. After +% the function has been evaluated, the stack should consist of three +% numbers (not integers! - the Apple PDF renderer is broken in this +% regard, so add cvr's at the end if needed) that represent the red, +% green, and blue components of the color. +% +% A buggy #4 will result is *totally unpredictable chaos* during +% rendering. + +\def\pgf@sys@noshading#1{\expandafter\global\expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@empty} + + + + +% +% +% Pattern stuff +% +% + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{\pgf@sys@fail{patterns}} +% This command declares a new colored or uncolored pattern. Uncolored +% patterns have no inherent color, the color is provided when they are +% set. Colored patters have an inherent color. +% #1 = name of the pattern (must be a plain suffix for use in +% postscript/pdf/etc.) +% #2 to #5 = four coordinates describing the corners of a bounding box +% of pattern cells +% #6 = x-step +% #7 = y-step +% #8 = pattern code +% #9 = 0 if uncolored patter, 1 if colored pattern. + +\def\pgfsys@setpatternuncolored#1#2#3#4{\pgf@sys@fail{patterns}} +% Sets an uncolored pattern #1 as filling color. The numbers #2, #3, +% #4 must be an rgb-value to be used as the color of the pattern. + +\def\pgfsys@setpatterncolored#1{\pgf@sys@fail{patterns}} +% Sets an colored pattern #1 as filling color. + + +% +% +% Page size stuff +% +% +\def\pgfsys@papersize#1#2{\pgf@sys@fail{papersize}} +% This command sets the paper size in a portable way. +% #1 = width +% #2 = height + + + +% +% +% Position tracking commands +% +% + +% Marks the current position on the page. This position can later be +% referenced using \pgfsys@getposition +\def\pgfsys@markposition#1{\pgf@sys@fail{marking the current position}} + +% Sets #2 to a pgfpoint macro that returns the position #1 is +% returned in a coordinate system where the x-axis goes right and the +% y-axis goes up. The origin of this coordinate system may or may not +% lie in the lower left corner; you should shift the coordinate system +% to the position "pgfpageorigin" to make sure that the origin is at +% the lower left corner. Typically, getting this position +% requires two runs of TeX. On the first run, the macro will be set to +% \relax, indicating that the position is not available. +% +% If #1 is set to the special position "pgfpageorigin", the position +% of the the lower left page corner is returned. + +\def\pgfsys@getposition#1#2{\let#2=\relax} + + + +% +% +% Commands having a default implementation. These commands only need +% not be implemented by drivers if this results in a better +% preformance. +% +% + + +\def\pgfsys@shadingoutsidepgfpicture#1{% + #1% +} +% This command gets the definition of a shading (@pgfshadingxxxx!) as +% an argument and should insert this shading into the normal text. +% +% This command has a default implementation. + + +\def\pgfsys@shadinginsidepgfpicture#1{% + \pgf@makehbox{#1}% + \setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\lower.5\ht\pgf@hbox\hbox{\box\pgf@hbox}}% + \pgfqbox{\pgf@hbox}% +} +% This command works like \pgfsys@shadingoutsidepgfpicture, only it is +% called when a shading should be inserted inside a picture. This +% command should insert the shading centered on the origin (which will +% typically have been low-level translated somewhere else.) +% +% This command has a default implementation. + + + + + +\def\pgfsys@closestroke{\pgfsys@closepath\pgfsys@stroke} +% This command should have the same effect as first closing the path +% and then stroking it. + + +\def\pgfsys@transformshift#1#2{\pgfsys@transformcm{1}{0}{0}{1}{#1}{#2}} +% This command will change the origin of the low-level coordinate +% system to (#1bp,#2bp). + +\def\pgfsys@transformxyscale#1#2{\pgfsys@transformcm{#1}{0}{0}{#2}{0bp}{0bp}} +% This command will scale the low-level coordinate system (and +% everything that is drawn) by a factor of #1 in x-directed and #2 in +% y-direction. Note that this applies to everything, including +% lines. So a scaled line will have a different width and may even +% have a different width when going along the x-axis and when going +% along the y-axis, if the scaling is different in these directions. + +\def\pgfsys@hbox#1{% + \pgfsys@beginscope% + \setbox#1=\hbox{\box#1}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1% + \pgfsys@endscope% +} +% Called to insert a TeX hbox into a pgfpicture. + +\def\pgfsys@hboxsynced#1{% + {\pgfsys@beginscope\pgflowlevelsynccm\pgfsys@hbox#1\pgfsys@endscope}% +} +% Called to insert a TeX hbox into a pgfpicture, but with the current +% coordinate transformation matrix synced with the canvas +% transformation matrix. +% +% In essence, this command does the same as if you first said +% \pgflowlevelsynccm and then \pgfsys@hbox. However, a driver may +% choose to use a ``TeX-translation'' for the translation part of the +% transformation cm. This will ensure that hyperlinks ``survive'' at +% least translations. + +\def\pgfsys@beginpicture{} +% Called at the beginning of a pgfpicture. Used to setup things. + +\def\pgfsys@endpicture{} +% Called at the end of a pgfpicture. + +\def\pgfsys@typesetpicturebox#1{% + \pgfmathsetlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% +} +% Called after a picture has been typeset in box #1. This +% command should insert the box into the normal TeX code. The box #1 +% will still be a ``raw'' box that contains only the \special's. The +% job of this command is to resize and shift this box according to the +% baseline shift and the size of the box. +% +% This command has a default implementation. + +\def\pgfsys@beginpurepicture{\pgfsys@beginpicture} +% This version of the beginpicture command can be used for pictures +% that are guaranteed not to contain any hboxes. In this case, a +% driver might provide a more compact version of the command. + +\def\pgfsys@endpurepicture{\pgfsys@endpicture} +% Called at the end of a ``pure'' pgfpicture. + +\def\pgfsys@defineimage{% + \ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{width=\pgf@imagewidth,}\fi% + \ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{height=\pgf@imageheight,}\fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi% + \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth]{\pgf@filename}}% +} +% Called, when an image should be defined. +% +% This command does not take any parameters. Instead, certain macros +% will be preinstalled with appropriate values when this command is +% invoked. These are: +% +% - \pgf@filename +% File name of the image to be defined. +% +% - \pgf@imagewidth +% Will be set to the desired (scaled) width of the image. +% +% - \pgf@imageheight +% Will be set to the desired (scaled) height of the image. +% +% If this macro and also the height macro are empty, the image +% should have its `natural' size. +% +% If exactly only of them is specified, the undefined value the +% image is scaled so that the aspect ratio is kept. +% +% If both are set, the image is scaled in both directions +% independently, possibly changing the aspect ratio. +% +% +% The following macros presumable mostly make sense for drivers that +% can handle pdf: +% +% - \pgf@imagepage +% The desired page number to be extracted from a multi-page +% `image'. +% +% - \pgf@imagemask +% If set, it will be set to `/SMask x 0 R', where x is the pdf +% object number of a soft mask to be applied to the image. +% +% - \pgf@imageinterpolate +% If set, it will be set to `/Interpolate true' or `/Interpolate +% false', indicating whether the image should be interpolated in +% pdf. +% +% +% The command should now setup the macro \pgf@image such that calling +% this macro will result in typesetting the image. Thus, \pgf@image is +% the `return value' of the command. + + +\def\pgfsys@defobject#1#2#3#4{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \expandafter\global\expandafter\let\csname #1\endcsname=\pgfsys@@temp% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Declares an object for later use. The idea is that the object can be +% precached in some way and then be rendered more quickly when used +% several times. For example, an arrow head might be defined and +% prerendered in this way. +% +% The parameter #1 is the name for later use. #2 and #3 are pgf points +% specifying a bounding box for the object. #4 is the code for the +% object. The code may only contain protocollable code. + + +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \expandafter\pgfsysprotocol@setcurrentprotocol\csname #1\endcsname% + \pgfsysprotocol@invokecurrentprotocol% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Renders a previously declared object. The first parameter is the +% name of the the object. The second parameter is extra code that +% should be executed right *before* the object is rendered. Typically, +% this will be some transformation code. + + +\def\pgfsys@begininvisible{\pgfsys@transformcm{1}{0}{0}{1}{2000bp}{2000bp}} +% Between this command and the closing endinvisible, all output should +% be suppressed. Nothing should be drawn at all, which includes all +% paths, images and shadings. + +\def\pgfsys@endinvisible{\pgfsys@transformcm{1}{0}{0}{1}{-2000bp}{-2000bp}} +% Ends the invisibilty section, unless invisibility blocks have been +% nested. In this case, only the `last' one restores visibility. + + +\def\pgfsys@atbegindocument{} +% This command will be executed at the begin of the document. If for +% whatever reason this is not done, you may wish to execute this +% command yourself. It will setup certain specials that need to be +% inserted into the resulting .pdf/.ps/.xxx file. + + + + + +% Discern the driver: +\input pgf.cfg + +\PackageInfo{pgfsys}{Driver file for pgf: \pgfsysdriver} +\pgfutil@InputIfFileExists{\pgfsysdriver}{}{% + \PackageError{pgfsys}{Driver file ``\pgfsysdriver'' not found.}{}} + + + +% This will insert always-present-specials at the beginning of the +% code. +\AtBeginDocument{ + \pgfsys@atbegindocument + \let\pgfsys@atbegindocument=\pgfutil@empty +} + + + +% Read aux file in plain and context mode: + +\pgfutil@aux@read@hook + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex new file mode 100644 index 00000000000..b34ae3bcdc7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex @@ -0,0 +1,70 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsysprotocol.code.tex,v 1.4 2006/10/16 22:32:59 tantau Exp $ + + + +% This package provides the pgf system protcol layer. Protocolling is +% used to record a bunch of graphic operations so that they can be +% reused quickly at a later point. +% +% Basically, all ``recordable'' \pgfsys@xxxx commands call +% \pgfsysprotocol@protocol for their protocolable literal +% specials. The literal text will either be stored in the current +% protocol. At a later point (actually, normally this happens +% immediately afterwards), the accumulated protocolled text is invoked +% using pgfsys@invokeprotocol. + + + +\let\pgfsysprotocol@currentprotocol=\pgfutil@empty +\newif\ifpgfsysprotocol@buffered + + +% Add to the protocol buffered +\def\pgfsysprotocol@literalbuffered#1{% + \edef\pgfsysprotocol@temp{{#1\space}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfsysprotocol@currentprotocol\pgfsysprotocol@temp% +} + +% Add to the protocol +\def\pgfsysprotocol@literal#1{% + \pgfsysprotocol@literalbuffered{#1}% + \ifpgfsysprotocol@buffered% + \else% + \pgfsysprotocol@flushcurrentprotocol% + \fi% +} + +% Getting and setting the current protocol +\def\pgfsysprotocol@getcurrentprotocol#1{% + \let#1=\pgfsysprotocol@currentprotocol% +} + +\def\pgfsysprotocol@setcurrentprotocol#1{% + \global\let\pgfsysprotocol@currentprotocol=#1% +} + + +% Invoking the current protocol +\def\pgfsysprotocol@invokecurrentprotocol{% + \ifx\pgfsysprotocol@currentprotocol\pgfutil@empty% + \else% + \expandafter\pgfsys@invoke\expandafter{\pgfsysprotocol@currentprotocol}% + \fi% +} + +\def\pgfsysprotocol@flushcurrentprotocol{% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex new file mode 100644 index 00000000000..86c7e5691b4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex @@ -0,0 +1,209 @@ +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsyssoftpath.code.tex,v 1.6 2008/01/23 13:15:28 tantau Exp $ + + +% This package provides the pgf system path abstraction layer. This +% layer is used to construct paths first ``abstractly.'' These +% abstract paths can still be modified, before they are ``made +% concrete.'' +% +% An abstract path consists of a sequence of basic building blocks, +% each of which is a tuple consisting of two numbers (specifying a +% coordinate) and a token. Possible tokens are: +% +% 1. moveto +% 2. lineto +% 3. rectcorner +% 4. rectsize +% 5. curvetosupporta +% 6. curvetosupportb +% 7. curveto +% 8. closepath +% 9. specialround +% +% A curveto must always be preceeded by a curvetosupporta and a +% curvetosupportb. A non-empty path must always begin with a +% moveto. The coordinates of a closepath are non-specified, currently, +% but they might be set to the coordinate of the path segment start, +% in the future. + + +% Access to the current path: +% +% Lots of stuff is added to the current path and it can get very long +% (containing literally tens of thousands of tokens). For such macros, +% adding things using a simple "g@addtomacro" takes more and more +% time, resulting in quadratic runtime. To avoid this, ideally, one +% would collect things in an array and then use a divide and conquer +% merger. A simple intermediate solution is the following, implemented +% here: We have the path and two buffers. New tokens are added to the +% first buffer, which is quite small. When it overflow, its contents +% is added to the second buffer, which is large. If that buffer +% overflow, the contents is finally added to the main path (which can +% have arbitrary length). Whenever the main path is set or read, the +% buffers are flushed. +% +% Because of this buffering, it is imperative that the main path is +% accessed only vie appropriate interface macros. + + + +% The current path +\let\pgfsyssoftpath@thepath=\pgfutil@empty +\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty +\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty +\newcount\pgfsyssoftpath@smallbuffer@items +\newcount\pgfsyssoftpath@bigbuffer@items + +\def\pgfsyssoftpath@flushbuffers{% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% +} + +% Getting and setting the current path +\def\pgfsyssoftpath@getcurrentpath#1{% + \pgfsyssoftpath@flushbuffers% + \let#1=\pgfsyssoftpath@thepath% +} + +\def\pgfsyssoftpath@setcurrentpath#1{% + \global\let\pgfsyssoftpath@thepath=#1% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% +} + + +% Invoking the current path (slightly optimized) +\def\pgfsyssoftpath@invokecurrentpath{% + \pgfsyssoftpath@thepath% + \pgfsyssoftpath@bigbuffer% + \pgfsyssoftpath@smallbuffer% +} + +\def\pgfsyssoftpath@flushcurrentpath{% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% +} + +% Add an item at the end +\def\pgfsyssoftpath@addtocurrentpath#1{% + \global\advance\pgfsyssoftpath@smallbuffer@items by1\relax% + \ifnum\pgfsyssoftpath@smallbuffer@items<40\relax% good number? + \expandafter\gdef\expandafter\pgfsyssoftpath@smallbuffer\expandafter{\pgfsyssoftpath@smallbuffer#1}% + \else% + \pgfsyssoftpath@smalloverflow{#1}% + \fi% +} +\def\pgfsyssoftpath@smalloverflow#1{% + \global\advance\pgfsyssoftpath@bigbuffer@items by1\relax% + \ifnum\pgfsyssoftpath@smallbuffer@items<30\relax% good number? + \expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\pgfsyssoftpath@bigbuffer% + \expandafter\expandafter\expandafter{\expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer#1}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty% + \global\pgfsyssoftpath@smallbuffer@items0\relax% + \else% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgfsyssoftpath@thepath + \expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer#1}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% + \fi% +} + + + +\def\pgfsyssoftpath@lastmoveto{{0pt}{0pt}} + +\newif\ifpgfsyssoftpathmovetorelevant +\pgfsyssoftpathmovetorelevanttrue + +% Add a moveto element to the current path +\def\pgfsyssoftpath@moveto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% + \ifpgfsyssoftpathmovetorelevant% + \xdef\pgfsyssoftpath@lastmoveto{{#1}{#2}}% + \fi% +} + +% Add a lineto element to the current path +\def\pgfsyssoftpath@lineto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@linetotoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add curveto elements to the current path +\def\pgfsyssoftpath@curveto#1#2#3#4#5#6{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@curvetosupportatoken{#1}{#2}% + \noexpand\pgfsyssoftpath@curvetosupportbtoken{#3}{#4}% + \noexpand\pgfsyssoftpath@curvetotoken{#5}{#6}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add rectanlge elements to the current path +\def\pgfsyssoftpath@rect#1#2#3#4{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@rectcornertoken{#1}{#2}% + \noexpand\pgfsyssoftpath@rectsizetoken{#3}{#4}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add closepath element to the current path +\def\pgfsyssoftpath@closepath{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@closepathtoken\pgfsyssoftpath@lastmoveto% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add special element to the current path +\def\pgfsyssoftpath@specialround#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@specialroundtoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Marshallers +\def\pgfsyssoftpath@movetotoken#1#2{\pgfsys@moveto{#1}{#2}} +\def\pgfsyssoftpath@linetotoken#1#2{\pgfsys@lineto{#1}{#2}} +\def\pgfsyssoftpath@rectcornertoken#1#2#3#4#5{\pgfsys@rect{#1}{#2}{#4}{#5}} % #3 = \pgfsyssoftpath@rectsizetoken +\def\pgfsyssoftpath@curvetosupportatoken#1#2#3#4#5#6#7#8{\pgfsys@curveto{#1}{#2}{#4}{#5}{#7}{#8}} +\def\pgfsyssoftpath@closepathtoken#1#2{\pgfsys@closepath} +\let\pgfsyssoftpath@specialroundtoken=\pgfutil@gobbletwo + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex new file mode 100644 index 00000000000..7cd2e4e1127 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex @@ -0,0 +1,717 @@ +% 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/utilities/pgfcalendar.code.tex,v 1.11 2007/07/23 21:23:14 tantau Exp $ + + +% Translation stuff + +\ifx\translate\@undefined + \def\translate#1{#1} +\fi + +% Load month dictionary, if possible + +\ifx\usedictionary\@undefined +\else + \usedictionary{translator-months-dictionary} +\fi + + + + +% Typeset a calendar +% +% #1 = prefix for the calendar nodes +% #2 = begin date in ISO format +% #3 = end date in ISO format +% #4 = date rendering code +% +% Description: +% +% First note that this macro need not be called inside a pgfpicture +% (even though it often will be). You can use it to typeset +% calendars also using packages other than pgf. You do not even need +% to load pgf to use this file. +% +% A calendar is typeset as follows: You specify a range of dates (by +% providing a begin and an end date). Then, for each date the code #4 +% is executed. When the code is called, lots of information about the +% current date (like its day of week) is available. The job of +% #4 is to render the date. Typically, this is done by placing nodes +% somewhere, but the function could do other things as well. +% It is also the job of #4 to position the calendar correctly. +% +% The different calls of #4 are not surrounded by TeX groups (though +% you can do so yourself, of course). This means that settings can +% accumulate between different calls, which is often desirable and +% useful. +% +% Inside #4 code, different macros can be access: +% +% \pgfcalendarprefix +% The parameter #1. This prefix is recomended for nodes inside the +% calendar, but you have to use it yourself explicitly. +% +% \pgfcalendarbeginiso +% Start date of range being typeset in ISO format (like 2006-01-10) +% +% \pgfcalendarbeginjulian +% Julian day number of start date begin typeset +% +% \pgfcalendarendiso +% End date of range begin typeset +% +% \pgfcalendarendjulian +% Same as Julian day number +% +% \pgfcalendarcurrentjulian (a TeX-count) +% Julian day number of day to be rendered/considered +% +% \pgfcalendarcurrentweekday +% Weekday (0 = Monday) of day to be checked +% +% \pgfcalendarcurrentyear +% Year of day to be checked +% +% \pgfcalendarcurrentmonth +% Month of day to be chjeck +% +% \pgfcalendarcurrentday +% Day of monath of day to be checked +% +% +% Inside the \pgfcalendar macro the macro \ifdate is available, which +% has the same effect as \pgfcalendarifdate{\pgfcalendarcurrentjulian} +% (only faster). This means that you +% can write, say, \ifdate{Monday}{current date is a Monday}{Not a Monday}. +% +% Example: +% +% \begin{tikzpicture} +% \pgfcalendar{cal}{2007-01-20}{2007-02-10} +% {\node[anchor=base] {\pgfcalendaronday}; \pgftransformyshift{-1.5em}} +% \end{tikzpicture} +% +% \pgfcalendar{cal}{2007-01-20}{2007-02-10}{ \pgfcalendaronday\ } + +\long\def\pgfcalendar#1#2#3#4{% + \begingroup% + % Setup local \ifdate + \let\ifdate=\pgfcalendar@local@ifdate% + % Let's start with computing start and end dates... + \def\pgfcalendarprefix{#1}% + \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginiso{#2}% + \pgfcalendardatetojulian{#3}{\pgfutil@tempcnta}% + \edef\pgfcalendarendjulian{\the\pgfutil@tempcnta}% + \advance\pgfutil@tempcnta by1\relax% + \edef\pgfcalendarendjulianplus{\the\pgfutil@tempcnta}% + \edef\pgfcalendarendiso{#3}% + % + % Start main loop + % + \loop% + \ifnum\pgfcalendarcurrentjulian<\pgfcalendarendjulianplus\relax% + % Setup information about current date + \pgfcalendarjuliantodate{\pgfcalendarcurrentjulian}% + {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}% + \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweekday{\the\pgfutil@tempcntb}% + % Render: + #4% + % Advance day: + \advance\pgfcalendarcurrentjulian by1\relax% + \repeat% + \endgroup% +} + +\newcount\pgfcalendarcurrentjulian + +\def\pgfcalendar@local@ifdate{% + \let\pgfcalendarifdatejulian=\pgfcalendarcurrentjulian% + \let\pgfcalendarifdateyear=\pgfcalendarcurrentyear% + \let\pgfcalendarifdatemonth=\pgfcalendarcurrentmonth% + \let\pgfcalendarifdateday=\pgfcalendarcurrentday% + \let\pgfcalendarifdateweekday=\pgfcalendarcurrentweekday% + \pgfcalendar@launch@ifdate% +} + + + +% Execute on specific kinds of dates +% +% #1 = ISO-format date +% #2 = date specification +% #3 = code +% +% Description: +% +% The given code #3 is execute on every day that matches the date +% specification #2. This specification is a comma-separated list of +% key-value pairs with the path /pgf/calendar. The code for a +% key-value should check whether the given day matches its +% specification. If so, it should set \pgfcalendarmatches to true. +% +% When the key-value code is executed, the following macros will have +% been setup: +% +% \pgfcalendarifdatejulian +% Julian day number of day to be checked +% +% \pgfcalendarifdateweekday +% Weekday (0 = Monday) of day to be checked +% +% \pgfcalendarifdateyear +% Year of day to be checked +% +% \pgfcalendarifdatemonth +% Month of day to be chjeck +% +% \pgfcalendarifdateday +% Day of month of day to be checked +% +% The setting of these macros will persist after the call, so a +% sideeffect of callling this macro is to setup these macros. +% +% By setting \ifpgfcalendar@do@not@recompute to false, the computation +% of the year, month etc. is suppressed. +% +% Examples: +% +% \pgfcalendarifdate{2007-01-10}{all}{} +% % Simply setup the macros +% +% \pgfcalendarifdate{2007-01-10}{mondays}{Is a monday} +% +% \pgfcalendarifdate{\mydate}{date=05-01}{\mydate is a Worker's Day} + +\def\pgfcalendarifdate#1#2#3#4{% + \pgfcalendardatetojulian{#1}{\pgfutil@tempcnta}% + \pgfcalendarjuliantodate{\pgfutil@tempcnta} + {\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + % Compute info about date + \pgfcalendarjuliantoweekday{\pgfutil@tempcnta}{\pgfutil@tempcntb}% + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + % + \pgfcalendar@launch@ifdate{#2}{#3}{#4}% +} + + +\long\def\pgfcalendar@launch@ifdate#1#2#3{% + % When this macro is called, the pgfcalendarifdatexxxx macros must + % be setup correctly + % + % Set match to false + \pgfcalendarmatchesfalse% + \pgfqkeys{/pgf/calendar}{#1}% + \ifpgfcalendarmatches% + #2% + \else% + #3% + \fi% +} + +\newif\ifpgfcalendarmatches + + +% Keys for matching + +\pgfkeys{/pgf/calendar/all/.code=\pgfcalendarmatchestrue} + +\pgfkeys{/pgf/calendar/Monday/.code={\ifnum\pgfcalendarifdateweekday=0\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Tuesday/.code={\ifnum\pgfcalendarifdateweekday=1\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Wednesday/.code={\ifnum\pgfcalendarifdateweekday=2\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Thursday/.code={\ifnum\pgfcalendarifdateweekday=3\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Friday/.code={\ifnum\pgfcalendarifdateweekday=4\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Saturday/.code={\ifnum\pgfcalendarifdateweekday=5\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Sunday/.code={\ifnum\pgfcalendarifdateweekday=6\relax\pgfcalendarmatchestrue\fi}} + +\pgfkeys{/pgf/calendar/workday/.code={\ifnum\pgfcalendarifdateweekday<5\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/weekend/.code={\ifnum\pgfcalendarifdateweekday>4\relax\pgfcalendarmatchestrue\fi}} + +\pgfkeys{/pgf/calendar/equals/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian=\pgfutil@tempcnta\relax% + \pgfcalendarmatchestrue% + \fi}% +} + +\pgfkeys{/pgf/calendar/day of month/.cd,.value required,.code={\ifnum#1=\pgfcalendarifdateday\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/end of month/.cd,.default=1,.code={% + % Tricky and expensive ... do only if necessary + \ifpgfcalendarmatches% + \else% sigh + {% + \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax% + \advance\pgfutil@tempcnta by#1\relax% + \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgf@dummy}{\pgf@dummy}{\pgf@cal@temp}% + \global\let\pgf@cal@temp=\pgf@cal@temp% + }% + \ifnum\pgf@cal@temp=1\relax\pgfcalendarmatchestrue\fi% + \fi}% +} + +\pgfkeys{/pgf/calendar/at least/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian<\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% +}} + +\pgfkeys{/pgf/calendar/at most/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian>\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% +}} + +\pgfkeys{/pgf/calendar/between/.cd,.value required,.code args={#1and#2}{% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian<\pgfutil@tempcnta\relax% + \else% + \pgfcalendar@special@datetojulian{#2}% + \ifnum\pgfcalendarifdatejulian>\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% + \fi% +}} + +\def\pgfcalendar@special@datetojulian#1{% + \edef\pgf@temp{#1}% + \expandafter\pgfcalendar@special@split@test\pgf@temp-\relax{#1}% +} + +\def\pgfcalendar@special@split@test#1-#2-#3\relax#4{% + \def\pgf@temp{#3}% + \ifx\pgf@temp\pgfutil@empty% + \def\pgf@temp{\pgfcalendarifdateyear-#1-#2}% + \else% + \def\pgf@temp{#4}% + \fi% + \pgfcalendardatetojulian{\pgf@temp}{\pgfutil@tempcnta}% +} + + +% Suggested name for nodes inside a calendar +% +% Description: +% +% It is suggested that (main) nodes (if present) in a calendar should +% get this name. +% +% Example: +% +% \pgfcalendar{cal}{2007-01-20}{2007-02-10}{} +% { \node[anchor=base] (\pgfcalendarsuggestedname) {\pgfcalendarifdateday}; +% \pgftransformyshift{-1.5em} } +% +% \draw (cal-2007-01-30) -- (cal-2007-02-08); + +\def\pgfcalendarsuggestedname{% + \ifx\pgfcalendarprefix\pgfutil@empty\else\pgfcalendarprefix-% + \pgfcalendarcurrentyear-\pgfcalendarcurrentmonth-\pgfcalendarcurrentday\fi% +} + + + +% +% +% Date conversion functions +% +% + + + +% Convert a date to the Julian day number (number of days since +% January 1st, -4712) +% +% #1 = date specification +% #2 = counter that should be set to the number of days +% +% Description: +% +% The conversion is taken from the Wikipedia entry on Julian days. +% +% The date specification works as follows: +% +% - It starts with a year. Use \year for the current year (the year +% the file is being typeset). +% - Next comes a hyphen. +% - Next comes a month (number). Use \month for the current month. +% - Next comes a hyphen. +% - Next comes either a day of month (number, use \day for current +% day) or "last". The keyword "last" refers the last day of the +% month. Thus, 2006-01-last is the same as 2006-01-31 and +% 2000-02-last is the same as 2002-02-29. +% - Next may come a plus sign, followed by a number (positive or +% negative). This will adjust the date by the given number of +% days. Thus, 2006-01-31+1 is the same as 2006-02-01 and +% 2006-02-01+-2 is the same as 2006-01-30. And \year-\month-day+1 is +% tomorrow. You may add a space before the +. +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} + +\def\pgfcalendardatetojulian#1#2{\edef\pgf@temp{#1}\expandafter\pgfcalendar@datetojulian\pgf@temp+/{#2}} +\def\pgfcalendar@datetojulian#1-#2-#3+#4/#5{% + {% + % + % Store year, month and days. + % + \count1=#1\relax% + \count2=#2\relax% + % If #3=="last", then calculate first day of next month + \edef\pgf@temp{#3}% + \ifx\pgf@temp\pgfcalendar@last@text% + \advance\count2 by1\relax% + \count3=1\relax% + \else% + \count3=#3\relax% + \fi% + % + % Store offset + % + \edef\pgf@@temp{#4}% + \ifx\pgf@@temp\pgfutil@empty% + \count8=0\relax% + \else% + \pgfcalendar@unpack#4% + \fi% + % + % + % 4) a = \lfloor (14-month) /12 \rfloor + % + \ifnum\count2<3\relax% + \count4=1\relax% + \else% + \count4=0\relax% + \fi% + % + % 5) y = year + 4800 - a + % + \count5=\count1\relax% + \advance\count5 by 4800\relax% + \advance\count5 by-\count4\relax% + % + % 6) m = month + 12a - 3 + % + \count6=\count2\relax% + \count0=\count4\relax% + \multiply\count0 by12\relax + \advance\count6 by\count0\relax% + \advance\count6 by-3\relax% + % + % 7) jdn = day + \floor{(153 m+2)/5} + 365y + \floor{y/4} - + % \floor{y/100} + \florr{y/400} - 32045 + % + \count7=\count3\relax% + % + \floor{(153 m+2)/5} : + \count0=\count6\relax% + \multiply\count0 by 153\relax% + \advance\count0 by 2\relax% + \divide\count0 by 5\relax% + \advance\count7 by \count0\relax% + % + 365y : + \count0=\count5% + \multiply\count0by365\relax% + \advance\count7 by\count0\relax% + % + \floor{y/4} + \count0=\count5\relax% + \divide\count0 by 4\relax% + \advance\count7 by\count0% + % - \floor{y/100} + \count0=\count5\relax% + \divide\count0 by 100\relax% + \advance\count7 by-\count0\relax% + % + \floor{y/400} + \count0=\count5\relax% + \divide\count0 by 400\relax% + \advance\count7 by\count0% + % - 32045 + \advance\count7 by-32045\relax% + % + % Undo "last" advance + \ifx\pgf@temp\pgfcalendar@last@text% + \advance\count7by-1\relax% + \fi% + % Add offset + \advance\count7by\count8\relax% + \expandafter% + }% + \expandafter#5\the\count7\relax% +} +\def\pgfcalendar@last@text{last} +\def\pgfcalendar@unpack#1+{% + \count8=#1\relax% +} + +% Convert Julian day number date. +% +% #1 = the number of Julian days +% #2 = a macro in which the year should be stored. +% #3 = a macro in which the month should be stored. +% #4 = a macro in which the day should be stored. +% +% Formula used: +% +% 1) J = Julian day number +% 2) j = J + 32044 +% 3) g = j div 146097 +% 4) dg = j mod 146097 +% 5) c = (dg div 36524 + 1) * 3 div 4 +% 6) dc = dg - c * 36524 +% 7) b = dc div 1461 +% 8) db = dc mod 1461 +% 9) a = (db div 365 + 1) * 3 div 4 +% 10)da = db - a * 365 +% 11)y = g * 400 + c * 100 + b * 4 + a +% 12)m = (da * 5 + 308) div 153 - 2 +% 13)d = da - (m + 4) * 153 div 5 + 122 +% 14)Y = y - 4800 + (m + 2) div 12 +% 15)M = (m + 2) mod 12 + 1 +% 16)D = d + 1 +% +% Example +% +% \pgfcalendarjuliantodate{\mynumber}{\myyear}{\mymonth}{\myday} + +\def\pgfcalendarjuliantodate#1#2#3#4{% + {% + % 1) J = Julian day number + \count1=#1\relax% + % 2) j = J + 32044 + \count2=\count1\relax% + \advance\count2 by 32044\relax% + % 3) g = j div 146097 + \count3=\count2\relax% + \divide\count3 by 146097\relax% + % 4) dg = j mod 146097 + \count4=\count3\relax% + \multiply\count4 by-146097\relax% + \advance\count4 by\count2\relax% + % 5) c = (dg div 36524 + 1) * 3 div 4 + \count5=\count4\relax% + \divide\count5 by36524\relax% + \advance\count5 by1\relax% + \multiply\count5 by3\relax% + \divide\count5 by4\relax% + % 6) dc = dg - c * 36524 + \count6=\count4\relax% + \count0=\count5\relax% + \multiply\count0 by-36524\relax% + \advance\count6 by\count0\relax% + % 7) b = dc div 1461 + \count7=\count6\relax% + \divide\count7 by1461\relax% + % 8) db = dc mod 1461 + \count8=\count7\relax% + \multiply\count8 by-1461\relax% + \advance\count8 by\count6\relax% + % 9) a = (db div 365 + 1) * 3 div 4 + \count9=\count8\relax% + \divide\count9 by 365\relax% + \advance\count9 by 1\relax% + \multiply\count9 by3\relax% + \divide\count9 by4\relax% + % 10)da = db - a * 365 + \count10=\count8\relax% + \count0=\count9\relax% + \multiply\count0 by-365\relax% + \advance\count10 by\count0\relax% + % 11)y = g * 400 + c * 100 + b * 4 + a + \count11=\count3\relax% + \multiply\count11 by400\relax% + \count0=\count5\relax% + \multiply\count0 by100\relax% + \advance\count11 by\count0\relax% + \count0=\count7\relax% + \multiply\count0 by4\relax% + \advance\count11 by\count0\relax% + \advance\count11 by\count9\relax% + % 12)m = (da * 5 + 308) div 153 - 2 + \count12=\count10\relax% + \multiply\count12 by5\relax% + \advance\count12 by 308\relax% + \divide\count12 by 153\relax% + \advance\count12 by -2\relax% + % 13)d = - (m + 4) * 153 div 5 + 122 + da + \count13=\count12\relax% + \advance\count13 by 4\relax% + \multiply\count13 by153\relax% + \divide\count13 by5\relax% + \count13=-\count13\relax% + \advance\count13 by 122\relax% + \advance\count13 by \count10\relax% + % 14)Y = (m + 2) div 12 + y - 4800 + \count14=\count12\relax% + \advance\count14 by 2\relax% + \divide\count14 by12\relax% + \advance\count14 by\count11\relax% + \advance\count14 by-4800\relax% + % 15)M = (m + 2) mod 12 + 1 + \count15=\count12\relax% + \advance\count15 by2\relax% + \count0=\count15\relax% + \divide\count0 by12\relax% + \multiply\count0 by12\relax% + \advance\count15 by-\count0\relax% + \advance\count15 by1\relax% + % 16)D = d + 1 + \count16=\count13% + \advance\count16by 1\relax% + % + \xdef\pgf@temp@year{\the\count14}% + \xdef\pgf@temp@month{\ifnum\count15<10 0\fi\the\count15}% + \xdef\pgf@temp@day{\ifnum\count16<10 0\fi\the\count16}% + }% + \let#2=\pgf@temp@year% + \let#3=\pgf@temp@month% + \let#4=\pgf@temp@day% +} + + + +% Returns the day of week as a number between 0 = Monday and 6 = +% Sunday +% +% #1 = a Julian day number +% #2 = a counter into which the weekday should be put. +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} +% \pgfcalendarjuliantoweekday{\mycount}{\myweekday} + +\def\pgfcalendarjuliantoweekday#1#2{% + {% + \pgfutil@tempcnta=#1\relax% + #2=\pgfutil@tempcnta% + \divide#2by7\relax% + \multiply#2by-7\relax% + \advance#2by\pgfutil@tempcnta\relax% + \expandafter% + }% + \expandafter#2\the#2\relax% +} + + + +% Converts a day of week into a weekday name (long or short) +% +% #1 = a number representing a weekday (0=Monday) +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} +% \pgfcalendarjuliantoweekday{\mycount}{\myweekday} +% October 1st, 2006 was a \pgfcalendarweekdayname{\myweekday} + +\def\pgfcalendarweekdayname#1{% + \translate{\ifcase#1Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\or Sunday\fi}% +} + +\def\pgfcalendarweekdayshortname#1{% + \translate{\ifcase#1Mon\or Tue\or Wed\or Thu\or Fri\or Sat\or Sun\fi}% +} + + +% Converts a month of year number into a month name (long or short) +% +% #1 = a number representing a month (1=January) +% +% Example: +% +% \pgfcalendarmonthname + +\def\pgfcalendarmonthname#1{% + \translate{\ifcase#1\or January\or February\or March\or April\or + May\or June\or July\or August\or September\or October\or + November\or December\fi}% +} + +\def\pgfcalendarmonthshortname#1{% + \translate{\ifcase#1\or Jan\or Feb\or Mar\or Apr\or + May\or Jun\or Jul\or Aug\or Sep\or Oct\or + Nov\or Dec\fi}% +} + + + + + + +% Macro for easy typesetting of days, etc. +% +% #1 = kind selection +% #2 = length and representation selection +% +% Description: +% +% Replaces the shorthand according to the following rules: The +% first letter of the shorthand describes the kind of +% shorthand. Possible kinds are: +% +% d = day of current date (in an invocation of \pgfcalendar) +% m = month of current date +% y = year of current date +% w = week day of current date +% +% The second parameter determines how the kind is represented: +% +% - = shortest possible numerical way (allowed only for d, m, y) +% = = same, but always of the same length (padded with blanks as +% needed, allowed only for d, m, y) +% 0 = numerical representation for d and m padded with leading zeros. +% t = textual representation (allowed only for d, m, w) +% . = abbreviated textual representation (allowed only for d, m, w) +% +% It is adivsed that you say, for example, +% \let\%=\pgfcalendarshorthand. +% +% With this setting, you can typeset an ISO-date by saying \%y0-\%m0-\%d0. +% For another example, on 2007-02-09, which is a +% Friday, you can write "\%wt, \%mt \%d-, \%y0" to get "Friday, February 9, 2007" + +\def\pgfcalendarshorthand#1#2{\csname pgfcalendar@shorthand@#1#2\endcsname} +\expandafter\def\csname pgfcalendar@shorthand@d-\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentday\relax\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@d=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentday\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@d0\endcsname{% + \pgfcalendarcurrentday} +\expandafter\def\csname pgfcalendar@shorthand@m-\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentmonth\relax\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@m=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentmonth\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@m0\endcsname{% + \pgfcalendarcurrentmonth} +\expandafter\def\csname pgfcalendar@shorthand@y-\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@y=\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@y0\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@w.\endcsname{% + \pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}} +\expandafter\def\csname pgfcalendar@shorthand@wt\endcsname{% + \pgfcalendarweekdayname{\pgfcalendarcurrentweekday}} +\expandafter\def\csname pgfcalendar@shorthand@m.\endcsname{% + \pgfcalendarmonthshortname{\pgfcalendarcurrentmonth}} +\expandafter\def\csname pgfcalendar@shorthand@mt\endcsname{% + \pgfcalendarmonthname{\pgfcalendarcurrentmonth}} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex new file mode 100644 index 00000000000..ff53e5e182f --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex @@ -0,0 +1,32 @@ +% Copyright 2007 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. +% +% In addition to the above licenses, this particular file may also be +% directly inlined into other documents and this copyright notice may +% be removed. Additionally, when you inline this file, you may modify +% it as needed and you may remove comments. +% +% This file is intended to be distributed or even inlined into a file +% when a document needs to be typeset on a system that does not have +% pgf/TikZ installed. + +% "environment" for reading an external graphic. Note that there are +% no (!) braces around the "name" of the environment +% +% #1 = name of the graphics file +% +% Example: +% +% \beginpgfgraphicnamed{mygraph} +% \begin{tikzpicture} +% ... +% \end{tikzpicture} +% \endpgfgraphicnamed + +\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\includegraphics{#1}} diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex new file mode 100644 index 00000000000..46a62f31767 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex @@ -0,0 +1,236 @@ +% 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. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.8 2007/11/07 23:21:48 tantau Exp $ + + + +\newdimen\pgffor@iter +\newdimen\pgffor@skip +\newif\ifpgffor@continue + +\let\pgffor@beginhook=\pgfutil@empty +\let\pgffor@endhook=\pgfutil@empty +\let\pgffor@afterhook=\pgfutil@empty + +\def\pgffor@emptyvalues{, \pgffor@stop,}% + +\def\foreach#1in{% + \def\pgffor@var{#1}% + \pgfutil@ifnextchar\bgroup{\pgffor@normal@list}{\pgffor@macro@list}} +\def\pgffor@macro@list#1{% + \expandafter\pgffor@normal@list\expandafter{#1}} +\def\pgffor@normal@list#1{% + \def\pgffor@values{#1, \pgffor@stop,}% + \ifx\pgffor@values\pgffor@emptyvalues + \def\pgffor@values{\pgffor@stop,}% + \fi% + \let\pgffor@body\pgfutil@empty% + \global\pgffor@continuetrue% + \pgffor@collectbody} + +\def\pgffor@collectbody{% + \pgfutil@ifnextchar\foreach{\pgffor@collectforeach}{% + \pgfutil@ifnextchar\bgroup{\pgffor@collectargument}{\pgffor@collectsemicolon}}% +} + +\def\pgffor@collectforeach\foreach#1in{% + \pgfutil@ifnextchar\bgroup{\pgffor@collectforeach@normal{#1}}{\pgffor@collectforeach@macro{#1}}} +\def\pgffor@collectforeach@macro#1#2{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in#2}% + \pgffor@collectbody% +} +\def\pgffor@collectforeach@normal#1#2{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in{#2}}% + \pgffor@collectbody% +} + +\long\def\pgffor@collectargument#1{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body{#1}}% + \pgffor@iterate% +} + + +\def\pgffor@collectsemicolon{% + \let\pgffor@next=\pgffor@collectnormalsemicolon% + \ifnum\the\catcode`\;=\active\relax% + \let\pgffor@next=\pgffor@collectactivesemicolon% + \fi% + \pgffor@next% +} + +\def\pgffor@collectnormalsemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% +} + +{ + \catcode`\;=\active + + \gdef\pgffor@collectactivesemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% + } +} + +\def\pgffor@iterate{% + \let\pgffor@last\pgfutil@empty% + \let\pgffor@prevlast\pgfutil@empty% + \expandafter\pgffor@scan\pgffor@values} + +\def\pgffor@stop{\pgffor@stop}% +\def\pgffor@dots{...}% + +\def\pgffor@scan{\pgfutil@ifnextchar({\pgffor@scanround}{\pgffor@scanone}} +\def\pgffor@scanround(#1)#2,{\def\pgffor@value{(#1)}\pgffor@scanned} +\def\pgffor@scanone#1,{\def\pgffor@value{#1}\pgffor@scanned} + +\def\pgffor@scanned{% + \ifx\pgffor@value\pgffor@stop% + \let\pgffor@next=\pgffor@after% done! + \else% + \ifx\pgffor@value\pgffor@dots% + \let\pgffor@next=\pgffor@handledots% + \else% + \let\pgffor@next=\pgffor@handlevalue% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@scan% done! + \fi% + \fi% + \pgffor@next} + +\def\pgffor@after{% + \global\pgffor@continuetrue% + \pgffor@afterhook} + +\def\pgffor@handlevalue{% + \let\pgffor@prevlast\pgffor@last% + \let\pgffor@last\pgffor@value% + \pgffor@invokebody% + \pgffor@scan% +} + +\def\pgffor@invokebody{% + \begingroup% + \expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}% + \ifpgfutil@in@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@value//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@value}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% +} + + +\def\pgffor@multiassign#1/#2/\relax{% + \def\pgffor@currentvar{#1}% + \def\pgffor@rest{#2}% + \ifx\pgffor@currentvar\pgffor@stop% + \let\pgffor@next=\relax% + \else% + \let\pgffor@next=\pgffor@multiassignrest% + \fi% + \pgffor@next% +} + +\def\pgffor@multiassignrest{\expandafter\pgffor@multiassignfinal\pgffor@valuerest} +\def\pgffor@multiassignfinal#1/#2/\relax{% + \def\pgffor@test{#2}% + \ifx\pgffor@test\pgfutil@empty% + \def\pgffor@valuerest{#1//\relax}% repeat + \else% + \def\pgffor@valuerest{#2/\relax}% + \fi% + \expandafter\def\pgffor@currentvar{#1}% + \expandafter\pgffor@multiassign\pgffor@rest/\relax% +} + + + + +\def\pgffor@handledots{% + \ifx\pgffor@last\pgfutil@empty% + \PackageError{pgffor}{``...'' not allowed without prior value}{}% + \fi% + \pgffor@dotsscanend% +} +\def\pgffor@dotsscanend#1,{% + \def\pgffor@dotsend{#1}% + % calculate skip% + \ifx\pgffor@prevlast\pgfutil@empty% + \ifdim\pgffor@dotsend pt>\pgffor@last pt% + \pgffor@skip=1pt% + \else% + \pgffor@skip=-1pt% + \fi% + \else% + \pgffor@skip=\pgffor@last pt% + \pgffor@iter=\pgffor@prevlast pt% + \advance\pgffor@skip by-\pgffor@iter% + \fi% + \pgffor@iter=\pgffor@last pt% + % do loop + \pgffor@loop% +} + +\def\pgffor@loop{% + \advance\pgffor@iter by\pgffor@skip% + \let\pgffor@next=\pgffor@doloop% + \ifdim\pgffor@skip<0pt% + \ifdim\pgffor@iter<\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \else% + \ifdim\pgffor@iter>\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@endloop% done! + \fi% + \pgffor@next% +} + +\def\pgffor@endloop{% + \pgffor@scan% +} + +{\catcode`\p=12\catcode`\t=12\gdef\Pgffor@geT#1pt{#1}} + +\def\pgffor@doloop{% + \begingroup% + \edef\pgffor@temp{\expandafter\Pgffor@geT\the\pgffor@iter}% + \edef\pgffor@incheck{{.0/}{\pgffor@temp/}}% + \expandafter\pgfutil@in@\pgffor@incheck% + \ifpgfutil@in@% + \expandafter\pgffor@strip\pgffor@temp% + \fi% + \expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}% + \ifpgfutil@in@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% + \pgffor@loop% +} + +\def\pgffor@strip#1.0{\def\pgffor@temp{#1}} + + +\def\breakforeach{\global\pgffor@continuefalse} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex new file mode 100644 index 00000000000..97727fdbeb7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex @@ -0,0 +1,95 @@ +% 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. + + + +% The purpose of this file is to define the command +% \ProvidesPackageRCS, which should be followed by an RCS id +% string. This command will also be available in plain TeX, where it +% prints out a message to the log. + + +\def\pgfversion{2.00} +\def\pgftypesetversion{\oldstylenums{2}.\oldstylenums{00}} + + +\ifx\pgfrcsloaded\undefined +\def\pgfrcsloaded{} + +\edef\pgfrcsatcode{\the\catcode`\@} +\catcode`\@=11 + +% Get date and version from RCS Ids +\def\pgf@parseid $#1: #2.#3,v #4 #5/#6/#7 #8${% + \pgf@parsercsfile$#2/$ + \def\pgf@rcssuffix{#3} + \def\pgf@rcsrevision{#4} + \def\pgf@rcsdate{#5/#6/#7} +} +\def\pgf@parsercsfile$#1/#2${ + \def\pgf@temp{#2} + \ifx\pgf@temp\pgfutil@empty + \def\pgf@rcsfile{#1} + \else + \pgf@parsercsfile$#2$ + \fi} + +\def\ProvidesFileRCS{% + \def\pgfrcs@marshal{\ProvidesFile{\pgf@rcsfile.\pgf@rcssuffix}}% + \pgfrcs@parserest% +} + +\def\ProvidesPackageRCS{% + \def\pgfrcs@marshal{\ProvidesPackage{\pgf@rcsfile}}% + \pgfrcs@parserest% +} + +\def\pgfrcs@parserest{% + \def\pgf@rcsadditional{}% + \afterassignment\pgfrcs@checkforoptional\let\next=} + +\def\pgfrcs@checkforoptional{% + \ifx\next[% + \let\next=\pgfrcs@getoptional% + \else + \let\next=\pgfrcs@package% + \fi% + \next}%} + +\def\pgfrcs@getoptional#1] ${% + \def\pgf@rcsadditional{#1}% + \pgfrcs@package% +} + +\def\pgfrcs@package#1${ + \pgf@parseid $#1$ + \pgfrcs@marshal[\pgf@rcsdate\space\pgf@rcsadditional\space(rcs-revision \pgf@rcsrevision)] +} + +\def\ProvidesClassRCS $#1$ [#2]{% + \pgf@parseid $#1$ + \ProvidesClass{\pgf@rcsfile}[\pgf@rcsdate\space#2\space (rcs-revision \pgf@rcsrevision)] +} + +\ifx\ProvidesPackage\@undefined + % plain tex + \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}} +\fi + +\ifx\ProvidesFile\@undefined + % plain tex + \def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}} +\fi + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.21 2008/02/20 11:00:42 tantau Exp $ + +\catcode`\@=\pgfrcsatcode + +\fi + diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex new file mode 100644 index 00000000000..29c27b499c7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex @@ -0,0 +1,133 @@ +% 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. + + +% +% This file provides utitiliy commands that are used throughout pgf. +% +% For most commands, the definition of these commands is just given +% below. We cannot use the LaTeX definition of these commands since +% LaTeX may not be the current format and since LaTeX packages tend to +% redefine these commands. +% +% For some commands the actual definition of the format (like latex or +% context) is to be preferred over the generic definition below. In +% this case, the definition of the format is installed when the file +% pgfutil-XXXX.tex is read, where XXXX is the format name (latex, +% plain, or context). + + + +\catcode`\@=11\relax + + +% Simple stuff + +\long\def\pgfutil@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfutil@firstofone#1{#1} +\def\pgfutil@firstoftwo#1#2{#1} +\def\pgfutil@secondoftwo#1#2{#2} +\def\pgfutil@empty{} +\def\pgfutil@gobble#1{} +\def\pgfutil@gobbletwo#1#2{} +\def\pgfutil@namedef#1{\expandafter\def\csname #1\endcsname} +\def\pgfutil@namelet#1{\expandafter\pgfutil@@namelet\csname#1\endcsname} +\def\pgfutil@@namelet#1#2{\expandafter\let\expandafter#1\csname#2\endcsname} +\long\def\pgfutil@g@addto@macro#1#2{% + \begingroup + \toks@\expandafter{#1#2}% + \xdef#1{\the\toks@}% + \endgroup} +\newif\ifpgfutil@tempswa + +% pgfutil@ifnextchar + +\long\def\pgfutil@ifnextchar#1#2#3{% + \let\pgfutil@reserved@d=#1% + \def\pgfutil@reserved@a{#2}% + \def\pgfutil@reserved@b{#3}% + \futurelet\pgfutil@let@token\pgfutil@ifnch} +\def\pgfutil@ifnch{% + \ifx\pgfutil@let@token\pgfutil@sptoken + \let\pgfutil@reserved@c\pgfutil@xifnch + \else + \ifx\pgfutil@let@token\pgfutil@reserved@d + \let\pgfutil@reserved@c\pgfutil@reserved@a + \else + \let\pgfutil@reserved@c\pgfutil@reserved@b + \fi + \fi + \pgfutil@reserved@c} +{% + \def\:{\global\let\pgfutil@sptoken= } \: + \def\:{\pgfutil@xifnch} \expandafter\gdef\: {\futurelet\pgfutil@let@token\pgfutil@ifnch} +} + +% pgfutil@in@ + +\newif\ifpgfutil@in@ +\def\pgfutil@in@#1#2{% + \def\pgfutil@in@@##1#1##2##3\pgfutil@in@@{% + \ifx\pgfutil@in@##2\pgfutil@in@false\else\pgfutil@in@true\fi}% + \pgfutil@in@@#2#1\pgfutil@in@\pgfutil@in@@} + + +% pgfutil@for + +\def\pgfutil@nnil{\pgfutil@nil} +\def\pgfutil@fornoop#1\@@#2#3{} +\long\def\pgfutil@for#1:=#2\do#3{% + \expandafter\def\expandafter\pgfutil@fortmp\expandafter{#2}% + \ifx\pgfutil@fortmp\pgfutil@empty \else + \expandafter\pgfutil@forloop#2,\pgfutil@nil,\pgfutil@nil\@@#1{#3}\fi} +\long\def\pgfutil@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\pgfutil@nnil \else + #5\def#4{#2}\ifx #4\pgfutil@nnil \else#5\pgfutil@iforloop #3\@@#4{#5}\fi\fi} +\long\def\pgfutil@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\pgfutil@nnil + \expandafter\pgfutil@fornoop \else + #4\relax\expandafter\pgfutil@iforloop\fi#2\@@#3{#4}} +\def\pgfutil@tfor#1:={\pgfutil@tf@r#1 } +\long\def\pgfutil@tf@r#1#2\do#3{\def\pgfutil@fortmp{#2}\ifx\pgfutil@fortmp\space\else + \pgfutil@tforloop#2\pgfutil@nil\pgfutil@nil\@@#1{#3}\fi} +\long\def\pgfutil@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\pgfutil@nnil + \expandafter\pgfutil@fornoop \else + #4\relax\expandafter\pgfutil@tforloop\fi#2\@@#3{#4}} + + +% pgfutil@IfFileExists + +\chardef\pgfutil@inputcheck0 +\def\pgfutil@IfFileExists#1#2#3{% + \openin\pgfutil@inputcheck#1 % + \ifeof\pgfutil@inputcheck + #3\relax + \else + #2\relax + \fi + \closein\pgfutil@inputcheck} + +\def\pgfutil@InputIfFileExists#1#2#3{\pgfutil@IfFileExists{#1}{\input #1\relax#2}{#3}}% + + +% aux-read-hook + +\let\pgfutil@aux@read@hook=\relax + + +% Tokens for the end of the typesetting -- they will be added at the +% end of every job (hopefully...). + +\newtoks\pgfutil@everybye + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def new file mode 100644 index 00000000000..784cb59cdc9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def @@ -0,0 +1,245 @@ +% 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. + + + + +% The aux files, needed for reading back coordinates +\def\pgfutil@aux@read@hook{ + \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} + \csname newwrite\endcsname\pgfutil@auxout + \csname openout\endcsname\pgfutil@auxout\jobname.pgf +} + +% XColor-like support for ConTeXt + +\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil} + +\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}} +\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}} + +\pgfutil@definecolor{white}{gray}{1} +\pgfutil@definecolor{black}{gray}{0} +\pgfutil@definecolor{gray}{gray}{0.5} +\pgfutil@definecolor{red}{rgb}{1,0,0} +\pgfutil@definecolor{green}{rgb}{0,1,0} +\pgfutil@definecolor{blue}{rgb}{0,0,1} +\pgfutil@definecolor{cyan}{rgb}{0,1,1} +\pgfutil@definecolor{magenta}{rgb}{1,0,1} +\pgfutil@definecolor{yellow}{rgb}{1,1,0} +\pgfutil@definecolor{orange}{rgb}{1,0.5,0} +\pgfutil@definecolor{violet}{rgb}{0.5,0,0.5} +\pgfutil@definecolor{purple}{rgb}{0.75,0,0.25} +\pgfutil@definecolor{brown}{rgb}{0.75,0.5,0.25} + +\def\pgfutil@color#1{% + \pgfutil@colorlet{.}{#1}% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% + \aftergroup\pgfutil@reset@color% +} + +\def\pgfutil@extractcolorspec#1#2{% + \def#2{{#1}}% +} + +\def\pgfutil@convertcolorspec#1#2#3{% + \edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}% +} + +\let\pgfutil@doifcolorelse=\doifcolorelse + + +\def\pgfutil@reset@color{% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% +} +\expandafter\def\csname\string\color@.\endcsname{\xcolor@{}{}{rgb}{0,0,0}} + +\def\pgfutil@colorlet#1#2{% + \edef\pgf@marshal{#2}% + \expandafter\pgfutil@in@\expandafter!\expandafter{\pgf@marshal}% + \ifpgfutil@in@% + % compute mixture + {% + \expandafter\pgfutil@emu@mix\pgf@marshal!white!\@nil% + \xdef\pgf@marshal{\noexpand\def\expandafter\noexpand\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{}{}{rgb}{\pgf@sys@tonumber\pgf@xa,\pgf@sys@tonumber\pgf@xb,\pgf@sys@tonumber\pgf@xc}}}% + }% + \pgf@marshal% + \else% + \expandafter\ifx\csname\string\color@#2\endcsname\relax% + \pgfutil@registercolor{#2}% + \fi% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% + \expandafter\noexpand\csname\string\color@#2\endcsname}% + \pgf@marshal% + \fi% +} +\def\pgfutil@emu@mix#1!#2!#3!#4\@nil{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \pgfutil@registercolor{#1}% + \fi% + \expandafter\ifx\csname\string\color@#3\endcsname\relax% + \pgfutil@registercolor{#3}% + \fi% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#1\endcsname% + \pgf@ya=\pgf@xa% + \pgf@yb=\pgf@xb% + \pgf@yc=\pgf@xc% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#3\endcsname% + \c@pgf@counta=#2\relax% + \c@pgf@countb=100\relax% + \advance\c@pgf@countb by-\c@pgf@counta\relax% + \pgf@xa=\c@pgf@countb\pgf@xa% + \advance\pgf@xa by\c@pgf@counta\pgf@ya% + \divide\pgf@xa by 100\relax% + \pgf@xb=\c@pgf@countb\pgf@xb% + \advance\pgf@xb by\c@pgf@counta\pgf@yb% + \divide\pgf@xb by 100\relax% + \pgf@xc=\c@pgf@countb\pgf@xc% + \advance\pgf@xc by\c@pgf@counta\pgf@yc% + \divide\pgf@xc by 100\relax% +} +\def\pgfutil@emu@unpack#1#2#3#4#5{% + \pgfutil@emu@@unpack#5\@nil% +} +\def\pgfutil@emu@@unpack#1,#2,#3\@nil{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + +\def\pgfutil@emu@select#1#2#3#4#5{#5} + + +\def\pgfutil@registercolor#1{% + \edef\pgf@temp{\PDFcolor{#1}}% + \edef\pgf@marshal{\noexpand\pgfutil@in@{ g}{\pgf@temp}}% + \pgf@marshal% + \ifpgfutil@in@% + \expandafter\pgfutil@context@parse@gray\pgf@temp{#1}% + \else% + \edef\pgf@marshal{\noexpand\pgfutil@in@{ rg}{\pgf@temp}}% + \pgf@marshal% + \ifpgfutil@in@% + \expandafter\pgfutil@context@parse@rgb\pgf@temp{#1}% + \else% + \PackageError{pgf}{Color #1 has an unsupported color model.}{}% + \pgfutil@definecolor{#1}{gray}{0} + \fi% + \fi% +} + +\def\pgfutil@context@parse@gray#1 g#2{% + \pgfutil@definecolor{#2}{gray}{#1} +} + +\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4{% + \pgfutil@definecolor{#4}{rgb}{#1,#2,#3} +} + + + +% pgfutil@minipage + +\def\pgfutil@minipage[#1]#2{% + \hbox to#2\bgroup% + \hsize=#2\relax% + \vbox\bgroup\leavevmode% +} +\def\pgfutil@endminipage{\egroup\egroup} + + + +% Driver detector (how should we do this in ConTeXt?) : + +\ifx\pdfoutput\@undefined\newcount\pdfoutput\fi +\ifx\pdfoutput\relax\newcount\pdfoutput\fi +\ifcase\pdfoutput% + \gdef\Gin@driver{dvips.def}% +\else% + \gdef\Gin@driver{pdftex.def}% +\fi% + + + +% Global colors + +\let\pgfutil@globalcolorsfalse=\relax +\let\pgfutil@globalcolorstrue=\relax + + + +% Font stuff + +\def\pgfutil@font@tiny{\tfxx} % How to do this correctly? +\def\pgfutil@font@scriptsize{\tfxx} +\def\pgfutil@font@footnotesize{\tfx} +\def\pgfutil@font@small{\tfx} +\def\pgfutil@font@normalsize{\tf} +\def\pgfutil@font@large{\tfa} +\def\pgfutil@font@Large{\tfb} +\def\pgfutil@font@huge{\tfc} +\def\pgfutil@font@Huge{\tfc} + +\def\pgfutil@font@itshape{\it} +\def\pgfutil@font@bfseries{\bf} + +\let\pgfutil@font@normalfont=\rm + +\let\pgfutil@selectfont=\rm + + +% Extra counters, registers, boxes + +\newcount\pgfutil@tempcnta +\newcount\pgfutil@tempcntb + +\newbox\pgfutil@tempboxa + +\newdimen\pgfutil@tempdima +\newdimen\pgfutil@tempdimb + + +% Module stuff + +\def\pgfutil@usemodule#1{\usemodule[#1]} + + + +% End of job stuff + +\appendtoks \the\pgfutil@everybye \to \everybye + + + + +% The following is still messy and needs to be cleanup up (everything +% prefixed by pgfutil@): + +\def\PackageInfo#1#2{} +\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\long\def\AtBeginDocument#1{#1}% +\long\def\AtBeginDvi#1{#1}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def new file mode 100644 index 00000000000..b50830db666 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def @@ -0,0 +1,64 @@ +% 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. + + +\catcode`\@=11\relax + +\let\pgfutil@auxout=\@auxout +\let\pgfutil@tempcnta=\@tempcnta +\let\pgfutil@tempcntb=\@tempcntb + +\def\pgfutil@definecolor{\definecolor} +\def\pgfutil@color{\color} +\def\pgfutil@colorlet{\colorlet} +\def\pgfutil@extractcolorspec{\extractcolorspec} +\def\pgfutil@convertcolorspec{\convertcolorspec} + +\def\pgfutil@globalcolorsfalse{\let\ifglobalcolors\iffalse} +\def\pgfutil@globalcolorstrue{\let\ifglobalcolors\iftrue} + +\let\pgfutil@minipage=\minipage +\let\pgfutil@endminipage=\endminipage + +\def\pgfutil@doifcolorelse#1#2#3{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \let\pgf@next=\pgfutil@secondoftwo% + \else + \let\pgf@next=\pgfutil@firstoftwo% + \fi% + \pgf@next{#2}{#3}% +} + +\def\pgfutil@font@tiny{\tiny} +\def\pgfutil@font@scriptsize{\scriptsize} +\def\pgfutil@font@footnotesize{\footnotesize} +\def\pgfutil@font@small{\small} +\def\pgfutil@font@normalsize{\normalsize} +\def\pgfutil@font@large{\large} +\def\pgfutil@font@Large{\Large} +\def\pgfutil@font@huge{\huge} +\def\pgfutil@font@Huge{\Huge} + +\def\pgfutil@font@itshape{\itshape} +\def\pgfutil@font@bfseries{\bfseries} + +\def\pgfutil@font@normalfont{\normalfont} + +\def\pgfutil@usemodule#1{\usepackage{#1}} + +\let\pgfutil@selectfont=\selectfont + +\let\pgfutil@tempboxa=\@tempboxa + +\let\pgfutil@tempdima=\@tempdima +\let\pgfutil@tempdimb=\@tempdimb + +\AtEndDocument{\the\pgfutil@everybye} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def new file mode 100644 index 00000000000..9128021faa7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def @@ -0,0 +1,226 @@ +% 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. + + + + + +% The aux files, needed for reading back coordinates +\def\pgfutil@aux@read@hook{ + \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} + \csname newwrite\endcsname\pgfutil@auxout + \csname openout\endcsname\pgfutil@auxout\jobname.pgf +} + + +% XColor-like support for plain TeX + +\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil} + +\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}} +\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}} + +\pgfutil@definecolor{white}{gray}{1} +\pgfutil@definecolor{black}{gray}{0} +\pgfutil@definecolor{gray}{gray}{0.5} +\pgfutil@definecolor{red}{rgb}{1,0,0} +\pgfutil@definecolor{green}{rgb}{0,1,0} +\pgfutil@definecolor{blue}{rgb}{0,0,1} +\pgfutil@definecolor{cyan}{rgb}{0,1,1} +\pgfutil@definecolor{magenta}{rgb}{1,0,1} +\pgfutil@definecolor{yellow}{rgb}{1,1,0} +\pgfutil@definecolor{orange}{rgb}{1,0.5,0} +\pgfutil@definecolor{violet}{rgb}{0.5,0,0.5} +\pgfutil@definecolor{purple}{rgb}{0.75,0,0.25} +\pgfutil@definecolor{brown}{rgb}{0.75,0.5,0.25} + +\def\pgfutil@color#1{% + \pgfutil@colorlet{.}{#1}% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% + \aftergroup\pgfutil@reset@color% +} + +\def\pgfutil@extractcolorspec#1#2{% + \def#2{{#1}}% +} + +\def\pgfutil@convertcolorspec#1#2#3{% + \edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}% +} + + +\def\pgfutil@doifcolorelse#1#2#3{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \let\pgf@next=\pgfutil@secondoftwo% + \else + \let\pgf@next=\pgfutil@firstoftwo% + \fi% + \pgf@next{#2}{#3}% +} + + +\def\pgfutil@reset@color{% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% +} +\expandafter\def\csname\string\color@.\endcsname{\xcolor@{}{}{rgb}{0,0,0}} + +\def\pgfutil@colorlet#1#2{% + \edef\pgf@marshal{#2}% + \expandafter\pgfutil@in@\expandafter!\expandafter{\pgf@marshal}% + \ifpgfutil@in@% + % compute mixture + {% + \expandafter\pgfutil@emu@mix\pgf@marshal!white!\@nil% + \xdef\pgf@marshal{\noexpand\def\expandafter\noexpand\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{}{}{rgb}{\pgf@sys@tonumber\pgf@xa,\pgf@sys@tonumber\pgf@xb,\pgf@sys@tonumber\pgf@xc}}}% + }% + \pgf@marshal% + \else% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% + \expandafter\noexpand\csname\string\color@#2\endcsname}% + \pgf@marshal% + \fi% +} +\def\pgfutil@emu@mix#1!#2!#3!#4\@nil{% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#1\endcsname% + \pgf@ya=\pgf@xa% + \pgf@yb=\pgf@xb% + \pgf@yc=\pgf@xc% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#3\endcsname% + \c@pgf@counta=#2\relax% + \c@pgf@countb=100\relax% + \advance\c@pgf@countb by-\c@pgf@counta\relax% + \pgf@xa=\c@pgf@countb\pgf@xa% + \advance\pgf@xa by\c@pgf@counta\pgf@ya% + \divide\pgf@xa by 100\relax% + \pgf@xb=\c@pgf@countb\pgf@xb% + \advance\pgf@xb by\c@pgf@counta\pgf@yb% + \divide\pgf@xb by 100\relax% + \pgf@xc=\c@pgf@countb\pgf@xc% + \advance\pgf@xc by\c@pgf@counta\pgf@yc% + \divide\pgf@xc by 100\relax% +} +\def\pgfutil@emu@unpack#1#2#3#4#5{% + \pgfutil@emu@@unpack#5\@nil% +} +\def\pgfutil@emu@@unpack#1,#2,#3\@nil{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + +\def\pgfutil@emu@select#1#2#3#4#5{#5} + + + +\let\definecolor=\pgfutil@definecolor +\let\color=\pgfutil@color +\let\colorlet=\pgfutil@colorlet +\let\extractcolorspec=\pgfutil@extractcolorspec +\let\convertcolorspec=\pgfutil@convertcolorspec + + + + +% pgfutil@minipage + +\def\pgfutil@minipage[#1]#2{% + \hbox to#2\bgroup% + \hsize=#2\relax% + \vbox\bgroup\leavevmode% +} +\def\pgfutil@endminipage{\egroup\egroup} + + + +% Driver detector (not so good): + +\ifx\pdfoutput\@undefined\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifx\pdfoutput\relax\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifcase\pdfoutput% + \gdef\Gin@driver{dvips.def}% +\else% + \gdef\Gin@driver{pdftex.def}% +\fi% + + +% Global colors + +\let\pgfutil@globalcolorsfalse=\relax +\let\pgfutil@globalcolorstrue=\relax + + + +% Font stuff + +\def\pgfutil@font@tiny{\fam\z@\fiverm} % How to do this correctly? +\def\pgfutil@font@scriptsize{\fam\z@\sevenrm} +\def\pgfutil@font@footnotesize{\rm} +\def\pgfutil@font@small{\fam\z@\ninerm} +\def\pgfutil@font@normalsize{\rm} +\def\pgfutil@font@large{\rm} +\def\pgfutil@font@Large{\rm} +\def\pgfutil@font@huge{\rm} +\def\pgfutil@font@Huge{\rm} + +\def\pgfutil@font@itshape{\it} +\def\pgfutil@font@bfseries{\bf} + +\let\pgfutil@font@normalfont=\rm + +\let\pgfutil@selectfont=\rm + + +% Extra counters, registers, boxes + +\newcount\pgfutil@tempcnta +\newcount\pgfutil@tempcntb + +\newbox\pgfutil@tempboxa + +\newdimen\pgfutil@tempdima +\newdimen\pgfutil@tempdimb + + +% Module stuff + +\def\pgfutil@usemodule#1{\input #1.tex} + + + +% End of file stuff + +\let\pgfutil@origend=\end +\def\end{\the\pgfutil@everybye\pgfutil@origend} + + +% The following is still messy and needs to be cleanup up (everything +% prefixed by pgfutil@): + +\def\PackageInfo#1#2{} +\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\long\def\AtBeginDocument#1{#1}% +\long\def\AtBeginDvi#1{#1}% + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty new file mode 100644 index 00000000000..ad5c9b2ad4f --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty @@ -0,0 +1,39 @@ +% 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. + + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/basiclayer/pgf.sty,v 1.12 2008/01/15 17:17:22 tantau Exp $ + +\def\pgf@draft{} +\DeclareOption{draft}{\def\pgf@draft{\pgf@draftmodetrue}} + +% the following obsolete stuff is loaded by default: +\def\pgf@obsolete{\RequirePackage{pgfcomp-version-0-65,pgfcomp-version-1-18}} + +\DeclareOption{version=0.65}{} % obsolete stuff is loaded +\DeclareOption{version=0.96}{\def\pgf@obsolete{\RequirePackage{pgfcomp-version-1-18}}} % less obsolete stuff is loaded +\DeclareOption{version=1.18}{\def\pgf@obsolete{\RequirePackage{pgfcomp-version-1-18}}} % less obsolete stuff is loaded +\DeclareOption{version=latest}{\def\pgf@obsolete{}} % no obsolete stuff is loaded + +\ProcessOptions + +\RequirePackage{pgfcore} + +\usepgfmodule{shapes,plot} + +%\RequirePackage{pgfbasesnakes} +%\RequirePackage{pgfbasedecorations} +%\RequirePackage{pgfbasematrix} + +\pgf@obsolete +\pgf@draft + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseimage.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseimage.sty new file mode 100644 index 00000000000..0785efc1cd8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseimage.sty @@ -0,0 +1,15 @@ +% 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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaselayers.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaselayers.sty new file mode 100644 index 00000000000..0785efc1cd8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaselayers.sty @@ -0,0 +1,15 @@ +% 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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasematrix.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasematrix.sty new file mode 100644 index 00000000000..6ae9ba0fb59 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasematrix.sty @@ -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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{matrix} instead} + +\usepgfmodule{matrix} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasepatterns.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasepatterns.sty new file mode 100644 index 00000000000..0785efc1cd8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasepatterns.sty @@ -0,0 +1,15 @@ +% 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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseplot.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseplot.sty new file mode 100644 index 00000000000..8f40563ceca --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseplot.sty @@ -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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{plot} instead} + +\usepgfmodule{plot} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseshapes.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseshapes.sty new file mode 100644 index 00000000000..1829c521c54 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbaseshapes.sty @@ -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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{shapes} instead} + +\usepgfmodule{shapes} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasesnakes.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasesnakes.sty new file mode 100644 index 00000000000..8995a463d3d --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfbasesnakes.sty @@ -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. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{decorations} instead} + +\usepgfmodule{decorations} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty new file mode 100644 index 00000000000..813747920d9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty @@ -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. + +\RequirePackage{graphicx} +\RequirePackage{pgfsys} +\RequirePackage{keyval} +\RequirePackage{xcolor} + +\input{pgfcore.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfarrows.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfarrows.sty new file mode 100644 index 00000000000..2c0a90b4fa5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfarrows.sty @@ -0,0 +1,19 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfarrows.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $ + +\RequirePackage{pgf} + +\PackageWarning{pgfarrows}{This package is obsolete. pgf.sty will load + arrow management automatically} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfautomata.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfautomata.sty new file mode 100644 index 00000000000..965fa30fed7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfautomata.sty @@ -0,0 +1,315 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfautomata.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $ + + +\RequirePackage{pgf} + +\PackageWarning{pgfautomata}{This package is obsolete.} + +\ProcessOptions + +% +% Package for drawing finite automata. +% + + +\newdimen\pgf@stateradius +\newdimen\pgf@mooreradius +\newdimen\pgf@doublethickness +\newdimen\pgf@statebackoff + + + + +% Automaton environment - setup of certain drawing parameters like arrows. +% +% Example: +% +% \begin{pgfpicture}{-2cm}{-2cm}{2cm}{2cm}% +% \begin{pgfautomaton} +% \pgfstaterejecting{q1}{\pgforigin}{$q_1$} +% \pgfstateaccepting{q2}{\pgfstaterelative[east]{q1}{1cm}}{$q_2$} +% \pgfstateaccepting{q3}{\pgfstaterelative[east]{q2}{1cm}}{$q_3$} +% +% \pgfstateconnect{q1}{q2}[.5]{$0$} +% \pgfstateconnect{q2}{q3}[.5]{$1$} +% \pgfstateloop{q1}{90}{$1$} +% \pgfstateloop{q2}{90}{$1$} +% \end{pgfautomaton} +% \end{pgfpicture} + +\def\pgfautomaton{\begin{pgfscope}% + \pgfsetendarrow{\pgfarrowto}% + \pgfnodesetsepend{4pt}\ignorespaces} +\def\endpgfautomaton{\end{pgfscope}} + + + +% Set the outer state radius to #1. +% +% #1 = new state radius. +% +% Example: +% +% \pgfsetstateradius{10pt} + +\def\pgfsetstateradius#1{\setlength\pgf@stateradius{#1}\ignorespaces} + +\pgfsetstateradius{1em} + + + +% Set the state radius for Moore states to #1. +% +% #1 = new state radius. +% +% Example: +% +% \pgfsetstatemooreradius{10pt} + +\def\pgfsetstatemooreradius#1{\setlength\pgf@mooreradius{#1}\ignorespaces} + +\pgfsetstatemooreradius{2em} + + + +% Set the distance between the outer and the inner circle in an +% accepting state. +% +% #1 = new distance radius. +% +% Example: +% +% \pgfsetstatecircledistance{1.2pt} + +\def\pgfsetstatecircledistance#1{\setlength\pgf@doublethickness{#1}\ignorespaces} + +\pgfsetstatecircledistance{1.6pt} + + + +% Set the distance between a connecting line and a label to #1. +% +% #1 = new distance +% +% Example: +% +% \pgfsetstatelabeldistance{4pt} + +\def\pgfsetstatelabeldistance#1{\setlength\pgf@statebackoff{#1}\ignorespaces} + +\pgfsetstatelabeldistance{4pt} + + +% Draws an accepting state #1 with name #3 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% +% Example: +% +% \pgfstateaccepting{q1}{\pgfxy(1,1)}{$q_1$} + +\def\pgfstateaccepting#1#2#3{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@stateradius}% + \pgfputat{#2}{\pgfbox[center,center]{#3}}% + {% + \pgf@xa=\pgf@stateradius% + \advance\pgf@xa by-\pgf@doublethickness% + \pgfcircle[stroke]{#2}{\pgf@xa}}\ignorespaces} + + +% Draws a rejecting state #1 with name #3 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% +% Example: +% +% \pgfstaterejecting{q2}{\pgfstatedirection[n]{q1}}{$q_2$} + +\def\pgfstaterejecting#1#2#3{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@stateradius}% + \pgfputat{#2}{\pgfbox[center,center]{#3}}\ignorespaces} + + +% Draws a Moore state #1 with name #3 and output #4 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% #4 = an output text +% +% Example: +% +% \pgfstatemoore{q}{\pgfxy(1,1)}{$q_1$}{$0,1$} + +\def\pgfstatemoore#1#2#3#4{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@mooreradius}% + \begin{pgftranslate}{#2}% + \begin{pgfscope}% + \pgfsetdash{{2pt}{1pt}}{0pt}% + \pgfmoveto{\pgfpoint{-\pgf@mooreradius}{0cm}}% + \pgflineto{\pgfpoint{\pgf@mooreradius}{0cm}}% + \pgfqstroke% + \end{pgfscope}% + \pgfputat{\pgfpoint{0cm}{0.4\pgf@mooreradius}}{\pgfbox[center,base]{#3}}% + \pgfputat{\pgfpoint{0cm}{-0.2\pgf@mooreradius}}{\pgfbox[center,top]{#4}}% + \end{pgftranslate}\ignorespaces} + + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a fraction of the distance between the two +% #4 = a label +% +% Example: +% +% \pgfstateconnect{q1}{q2}[.5]{$0$} + +\def\pgfstateconnect#1#2[#3]#4{% + \pgfnodeconnline{#1}{#2}% + \pgfnodelabel{#1}{#2}[#3][\pgf@statebackoff]% + {\pgfbox[center,bottom]{#4}}\ignorespaces} + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a fraction of the distance between the two +% #4 = a label +% +% Example: +% +% \pgfstateconnectrotated{q1}{q2}[.5]{$0$} + +\def\pgfstateconnectrotated#1#2[#3]#4{% + \pgfnodeconnline{#1}{#2}% + \pgfnodelabelrotated{#1}{#2}[#3][\pgf@statebackoff]% + {\pgfbox[center,bottom]{#4}}\ignorespaces} + + + +% Connect state #1 with itself with label #3 and a loop going in +% direction #2. +% +% #1 = a state +% #2 = an angle +% #3 = a label +% +% Example: +% +% \pgfstateloop{q1}{90}{$0$} + +\def\pgfstateloop#1#2#3{% + \c@pgf@counta=#2\relax% + \c@pgf@countb=#2\relax% + \advance\c@pgf@counta by15\relax% + \advance\c@pgf@countb by-15\relax% + \pgfnodeconncurve{#1}{#1}{\the\c@pgf@counta}{\the\c@pgf@countb}{2\pgf@stateradius}{2\pgf@stateradius}% + \pgfputat{\pgfnodeborder{#1}{#2}{2.25\pgf@stateradius}}{\pgfbox[center,center]{#3}}\ignorespaces} + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a start angle +% #4 = an end angle +% +% Example: +% +% \pgfstatecurve{q1}{q2}{10}{-10} + +\def\pgfstatecurve#1#2#3#4{% + \pgfnodeconncurve{#1}{#2}{#3}{#4}{2\pgf@stateradius}{2\pgf@stateradius}\ignorespaces} + + + +% Give a position relative to some state. +% +% #1 = a direction +% #2 = a state +% #3 = a distance +% +% Example: +% +% \pgfstaterelative[east]{q2}{1cm} + +\def\pgfstaterelative{\pgfnoderelative} + + + +% Draw an initial state by drawing an inleading line. +% +% #1 = a state +% #2 = a direction leading into the state (n,s,e,w) +% #3 = a label (for example ``start'') +% +% Example: +% +% \pgfstateinitial{q1}[w]{start} + +\def\pgfstateinitial#1[#2]#3{{% + \pgfmoveto{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{-2pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + \pgflineto{\pgfnodeborder{#1}{\pgfdirection{#2}}{\pgf@nodesepend}}% + \pgfstroke% + \edef\temp{[\csname pgf@statepos\pgfdirection{#2}\endcsname]}% + \pgfputat{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{0pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + {\expandafter\pgfbox\temp{#3}}}\ignorespaces} + +\expandafter\def\csname pgf@statepos0\endcsname{left,center} +\expandafter\def\csname pgf@statepos90\endcsname{center,bottom} +\expandafter\def\csname pgf@statepos180\endcsname{right,center} +\expandafter\def\csname pgf@statepos270\endcsname{center,top} + + + +% Draw an final state by drawing an outleading line. +% +% #1 = a state +% #2 = a direction leading out of the state (valid directions are +% n,s,e,w) +% #3 = a label (for example ``exit'') +% +% Example: +% +% \pgfstatefinal{q1}[right]{accept} + +\def\pgfstatefinal#1[#2]#3{{% + \pgfmoveto{\pgfnodeborder{#1}{\pgfdirection{#2}}{\pgf@nodesepstart}}% + \pgflineto{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{-\pgf@nodesepend}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + \pgfstroke% + \edef\tempb{[\csname pgf@statepos\pgfdirection{#2}\endcsname]}% + \pgfputat{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{0pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + {\expandafter\pgfbox\tempb{#3}}}\ignorespaces} + + + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty new file mode 100644 index 00000000000..09f6fda3149 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty @@ -0,0 +1,719 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfcomp-version-0-65.sty,v 1.7 2007/07/03 07:52:35 tantau Exp $ + +\def\pgfdirection#1{\csname pgf@direction#1\endcsname} + +\def\pgf@directionn{90} +\def\pgf@directionnorth{90} +\def\pgf@directionabove{90} +\def\pgf@directions{270} +\def\pgf@directionsouth{270} +\def\pgf@directionbelow{270} +\def\pgf@directionw{180} +\def\pgf@directionwest{180} +\def\pgf@directionleft{180} +\def\pgf@directione{0} +\def\pgf@directioneast{0} +\def\pgf@directionright{0} +\def\pgf@directionne{45} +\def\pgf@directionse{315} +\def\pgf@directionnw{135} +\def\pgf@directionsw{-135} + + +\def\pgfpictureboxed#1#2#3#4{% + \pgfpicture{#1}{#2}{#3}{#4}% + \pgfmoveto{\pgfpoint{#1}{#2}}% + \pgflineto{\pgfpoint{#1}{#4}}% + \pgflineto{\pgfpoint{#3}{#4}}% + \pgflineto{\pgfpoint{#3}{#2}}% + \pgfclosestroke\ignorespaces} +\def\endpgfpictureboxed{\endpgfpicture} + +\def\pgfxyline(#1,#2)(#3,#4){% + \pgfmoveto{\pgfxy(#1,#2)}% + \pgflineto{\pgfxy(#3,#4)}% + \pgfstroke} + +\def\pgfxycurve(#1,#2)(#3,#4)(#5,#6)(#7,#8){% + \pgfmoveto{\pgfxy(#1,#2)}% + \pgfbezier{\pgfxy(#3,#4)}{\pgfxy(#5,#6)}{\pgfxy(#7,#8)}% + \pgfstroke} + +\def\pgfline#1#2{% + \pgfmoveto{#1}% + \pgflineto{#2}% + \pgfstroke} + +\let\pgflineto=\pgfpathlineto +\let\pgfmoveto=\pgfpathmoveto +\let\pgfcurveto=\pgfpathcurveto +\let\pgfbezier=\pgfpathcurveto +\let\pgfarc=\pgfpatharc + +\def\pgfzerocircle#1{\pgfcircle{\pgforigin}{#1}} +\def\pgfzeroellipse#1#2{\pgfellipse{\pgforigin}{#1}{#2}} +\def\pgfeofill{{\pgfseteorule\pgfsys@flushpath\pgfsys@fill}\pgf@resetpathsizes\ignorespaces} +\def\pgfeofillstroke{{\pgfseteorule\pgfsys@flushpath\pgfsys@fillstroke}\pgf@resetpathsizes\ignorespaces} +\def\pgf@perform@eofill{\pgfeofill} +\def\pgf@perform@eofillstroke{\pgfeofillstroke} +\let\pgfdiff=\pgfpointdiff +\let\pgfrelative=\pgfpointadd +\let\pgfpartway=\pgfpointlineattime +\let\pgfbackoff=\pgfpointlineatdistance +\def\pgflabel#1#2#3#4{% + % First, calculate base point + \pgfpointlineattime{#1}{#2}{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgf@process{\pgfpointnormalised{}}% x/y = normalised vector + \setlength\pgf@ya{#4}% + \pgf@xa=-\pgf@ya\relax% + \pgf@xa=\pgf@sys@tonumber{\pgf@y}\pgf@xa% + \pgf@ya=\pgf@sys@tonumber{\pgf@x}\pgf@ya% + \pgf@x=\pgf@xb\relax% + \pgf@y=\pgf@yb\relax% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \ignorespaces} +\let\pgfnormalise=\pgfpointnormalised +\let\pgfpolar=\pgfpointpolar +\let\pgforigin=\pgfpointorigin +\let\pgfclosepath=\pgfpathclose + +\def\pgfxy(#1,#2){\pgfpointxy{#1}{#2}} +\def\pgfxyz(#1,#2,#3){\pgfpointxyz{#1}{#2}{#3}} +\newcommand\pgfgrid[3][]{\pgfpathgrid[#1]{#2}{#3}\pgfqstroke} +\newcommand\pgfellipse[4][]{% + \pgfpathellipse{#2}{#3}{#4}% + \csname pgf@perform@#1\endcsname\ignorespaces +} +\newcommand\pgfcircle[3][]{\pgfellipse[#1]{#2}{\pgfpoint{#3}{0pt}}{\pgfpoint{0pt}{#3}}} +\newcommand\pgfrect[3][]{% + \pgfpathrectangle{#2}{#3}% + \csname pgf@perform@#1\endcsname% +} +\def\pgf@perform@stroke{\pgfqstroke} +\def\pgf@perform@fill{\pgffill} +\def\pgf@perform@fillstroke{\pgffillstroke} +\def\pgf@perform@clip{\pgfclip} + +\def\pgfsincos#1{% + \pgfmathparse{#1}% + \pgfmathcos@{#1}\pgf@y\pgfmathresult pt% + \pgfmathsin@{#1}\pgf@x\pgfmathresult pt% +} + +\let\pgfdegree=\pgfsincos + +\newenvironment{pgfmagnify}[2]{\pgflowlevelscope{\pgftransformcm{#1}{0}{0}{#2}{\pgfpointorigin}}}{\endpgflowlevelscope} +\newenvironment{pgftranslate}[1]{\pgflowlevelscope{\pgftransformshift{#1}}}{\endpgflowlevelscope} +\newcommand{\pgftranslateto}[1]{\pgflowlevel{\pgftransformshift{#1}}} +\newenvironment{pgfrotateby}[1]{% + \pgf@process{#1}% + \pgf@xa=-\pgf@x% + \edef\pgf@temp{\noexpand\pgflowlevelscope{\noexpand\pgftransformcm{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@y}}{\noexpand\pgfpointorigin}}}% + \pgf@temp} +{\endpgflowlevelscope} + +\long\def\pgfputat#1#2{\begin{pgftranslate}{#1}#2\end{pgftranslate}} +\def\pgfputlabelrotated#1#2#3#4#5{% + \pgflabel{#1}{#2}{#3}{#4}% + \pgfputat{}{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgfnormalise{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgfsys@transformcm{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{0pt}{0pt}% + #5}% + \ignorespaces} +\def\pgfqcurveto#1#2#3#4#5#6{\pgfpathqcurveto{#1bp}{#2bp}{#3bp}{#4bp}{#5bp}{#6bp}} +\let\pgfqbezier=\pgfqcurveto +\def\pgfqlineto#1#2{\pgfpathqlineto{#1bp}{#2bp}} +\def\pgfqmoveto#1#2{\pgfpathqmoveto{#1bp}{#2bp}} +\let\pgfqstroke=\pgfusepathqstroke + +\def\pgfstroke{\pgfusepath{stroke}} +\def\pgfclip{\pgfusepath{clip}} +\def\pgffill{\pgfusepath{fill}} +\def\pgfclosestroke{\pgfpathclose\pgfusepath{stroke}} +\def\pgffillstroke{\pgfusepath{fill,stroke}} +\def\pgfstrokeclip{\pgfusepath{clip,stroke}} +\def\pgffillclip{\pgfusepath{clip,stroke}} +\def\pgfclosestrokeclip{\pgfpathclose\pgfusepath{stroke,clip}} +\def\pgffillstrokeclip{\pgfusepath{stroke,fill,clip}} +\def\pgfclearendarrow{\pgfsetendarrow{}} +\def\pgfclearstartarrow{\pgfsetstartarrow{}} + +\def\pgfputarrow#1#2#3{\pgflowlevelobj{\pgftransformarrow{#1}{#2}}{\pgfsys@setdash{}{0pt}#3}} + +\def\pgfsetstartarrow#1{\def\pgf@startarrow{#1}\def\pgf@shorten@start{\pgf@x=0.0pt}} +\def\pgfsetendarrow#1{\def\pgf@endarrow{#1}\def\pgf@shorten@end{\pgf@x=0.0pt}} + +\def\pgfdefarrow#1#2#3#4{% + \pgfdefobject{pgf@#1}{#2}{#3}{\pgfsys@setlinewidth{1bp}#4}% + \expandafter\gdef\csname#1\endcsname{% + \pgf@x=\pgflinewidth% + \pgf@y=\pgflinewidth% + \pgfuseobjectmagnify{pgf@#1}\ignorespaces}} +\def\pgfdefarrowabs#1#2#3#4{% + \pgfdefobject{pgf@#1}{#2}{#3}{\pgfarrowlinewidthscale{1}#4}% + \expandafter\gdef\csname#1\endcsname{% + \pgfuseobject{pgf@#1}\ignorespaces} + } +\def\pgfarrowlinewidthscale#1{\pgfsys@setlinewidth{#1bp}\ignorespaces} +\pgfdefarrow{pgfarrowsingle}{\pgfpoint{-7pt}{-5pt}}{\pgfpoint{3pt}{5pt}}{% + \pgfqmoveto{2}{0} + \pgfqlineto{-6}{4} + \pgfqlineto{-3}{0} + \pgfqlineto{-6}{-4} + \pgfusepathqfill} +\def\pgfarrowswap#1{\pgflowlevelobj{\pgftransformxscale{-1}}{#1}} +\def\pgfarrowcombine#1#2{% + #1% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#2}} +\def\pgfarrowcombineloose#1#2{#1\pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#2}} +\def\pgfarrowdouble#1{\pgfarrowcombine{#1}{#1}} +\def\pgfarrowtriple#1{% + #1% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#1}% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#1}} +\pgfdefarrow{pgfarrowto}{\pgfpoint{-4pt}{-5pt}}{\pgfpoint{2pt}{5pt}}{% + \pgfarrowlinewidthscale{0.8} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfqmoveto{-3}{4} + \pgfqcurveto{-2.75}{2.5}{0}{0.25}{0.75}{0} + \pgfqcurveto{0}{-0.25}{-2.75}{-2.5}{-3}{-4} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowbar}{\pgfpoint{-1pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{0}{-5} + \pgfqlineto{0}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowsquare}{\pgfpoint{-4pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-3}{-5} + \pgfqlineto{0}{-5} + \pgfqlineto{0}{5} + \pgfqlineto{-3}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowround}{\pgfpoint{-3pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-2}{-5} + \pgfqcurveto{1}{-3}{1}{3}{-2}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowpointed}{\pgfpoint{-6pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-4.5}{-5} + \pgfqlineto{0.5}{0} + \pgfqlineto{-4.5}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowdot}{\pgfpoint{-7pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{% + \pgfsys@transformshift{-2.5bp}{0bp}% + \pgfsetdash{}{0pt} + \pgfpathqcircle{3bp} + \pgfusepathqfillstroke} +\pgfdefarrow{pgfarrowdiamond}{\pgfpoint{-12pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{1}{0} + \pgfqlineto{-5}{3} + \pgfqlineto{-11}{0} + \pgfqlineto{-5}{-3} + \pgfpathclose + \pgfusepathqfillstroke} +\def\pgfarrowcircle#1{% + \pgfsetdash{}{0pt} + \setlength\pgf@xa{#1}% + \pgf@xb=\pgf@xa% + \advance\pgf@xa by-0.5\pgflinewidth + \begin{pgflowlevelscope}{\pgftransformshift{\pgfpoint{-\pgf@xa}{0pt}}}% + \pgfpathqcircle{\pgf@sys@tonumber{\pgf@xb}bp} + \pgfusepathqfillstroke + \end{pgflowlevelscope}} +\def\pgfarrowtriangle#1{% + \pgfsetdash{}{0pt} + \begin{pgfscope}% + \setlength\pgf@xa{#1}% + \pgf@ya=0.577\pgf@xa% + \advance\pgf@xb by-\pgflinewidth% + \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgflinewidth}{0pt}}% + \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}}% + \pgfpathclose% + \pgfusepathqfillstroke% + \end{pgfscope}} +\def\pgfarrowlargepointed#1{% + \pgfsetdash{}{0pt} + \begin{pgfscope}% + \setlength\pgf@xa{#1}% + \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@xa}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@xa}} + \pgfusepathqstroke + \end{pgfscope}} + +\newcommand\pgfcorner[3][sw]{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \ifdim\pgf@xa<\pgf@x% + \pgf@xb=\pgf@x% + \pgf@x=\pgf@xa% + \pgf@xa=\pgf@xb% + \fi% + \ifdim\pgf@ya<\pgf@y% + \pgf@yb=\pgf@y% + \pgf@y=\pgf@ya% + \pgf@ya=\pgf@yb% + \fi% + \csname pgf@corner@#1\endcsname\relax% +} +\def\pgf@corner@se{\pgf@x=\pgf@xa} +\def\pgf@corner@ne{\pgf@x=\pgf@xa\pgf@y=\pgf@ya} +\def\pgf@corner@nw{\pgf@y=\pgf@ya} +\def\pgf@corner@sw{} +\def\pgf@corner@s{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa} +\def\pgf@corner@n{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa\pgf@y=\pgf@ya} +\def\pgf@corner@w{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya} +\def\pgf@corner@e{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya\pgf@x=\pgf@xa} + +% Defines a circle node of name #1 at position #3 of radius #4. +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a point +% #4 = a radius +% +% Example: +% +% \pgfnodecircle{mynode}[stroke]{\pgfxy(1,1)}{2cm} + +\def\pgfnodecircle#1[#2]#3#4{% + \pgf@process{#3}% + \expandafter\def\csname pgfno@#1\endcsname{\pgf@backoffcircle{#4}}% + \expandafter\def\csname pgfnob@#1\endcsname{\pgf@anglecircle{#4}}% + \expandafter\edef\csname pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@x}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@y}pt}% + \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual% + \else% + \pgfcircle[#2]{\csname pgfnom@#1\endcsname}{#4}% + \fi\ignorespaces} + +\def\pgf@@virtual{} + + +% Defines a rectangular node of name #1 with center at position #3 and +% width/height vector #4 +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a center +% #4 = width/height vector +% +% Example: +% +% \pgfnoderect{mynode}[stroke]{\pgfxy(1,1)}{\pgfxy(2,2)} + +\def\pgfnoderect#1[#2]#3#4{% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#4}% + \pgf@x=.5\pgf@x% + \pgf@y=.5\pgf@y% + \expandafter\edef\csname pgfno@#1\endcsname{\noexpand\pgf@backoffrect% + {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}% + \expandafter\edef\csname pgfnob@#1\endcsname{\noexpand\pgf@anglerect% + {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}% + \expandafter\edef\csname + pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}% + \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual% + \else% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \edef\pgf@temp{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}% + \pgfrect[#2]{\pgf@temp}{#4}% + \fi\ignorespaces} + + +% Defines a rectangular node of name #1 with center at position #3 +% contaning a box #4 +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a center +% #4 = TeX text that will be boxed +% #5 = a horizontal border offset +% #6 = a vertical border offset +% +% Example: +% +% \pgfnodebox{mynode}[stroke]{\pgfxy(1,1)}{start}{2pt}{2pt} + +\def\pgfnodebox#1[#2]#3#4#5#6{% + \pgf@makehbox{#4}% + \pgf@x=\wd\pgf@hbox% + \pgf@y=\ht\pgf@hbox% + \advance\pgf@y by \dp\pgf@hbox% + \addtolength\pgf@x{#5}% + \addtolength\pgf@x{#5}% + \addtolength\pgf@y{#6}% + \addtolength\pgf@y{#6}% + \edef\pgf@boxsize{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \csname pgf@haligncompcenter\endcsname% + \csname pgf@valigncompcenter\endcsname% + \wd\pgf@hbox=0pt% + \pgfputat{#3}{% + \pgfsys@hbox\pgf@hbox}% + \pgfnoderect{#1}[#2]{#3}{\pgf@boxsize}\ignorespaces} + + + + +% Retrieves the center of #1. +% +% #1 = a node name +% +% Example: +% +% \pgfpathmoveto{\pgfnodecenter{mynode}} + +\def\pgfnodecenter#1{% + \expandafter\ifx\csname pgfnom@#1\endcsname\relax% + \GenericError{\space\space\space\@spaces\@spaces\@spaces}% + {PGF Error: Node "#1" undefined.}{}{\@ehc}% + \pgfpoint{0pt}{0pt}% + \else\csname pgfnom@#1\endcsname\fi\ignorespaces} + + + +% Returns a position relative to the center of #1. +% +% #1 = a node name +% #2 = a direction (see \pgfdirection) +% #3 = a distance +% +% Example: +% +% \pgfpathmoveto{\pgfnoderelative{mynode}[north]{1cm}} + +\def\pgfnoderelative#1[#2]#3{% + \pgfrelative{\pgfnodecenter{#1}}{\pgfpolar{\pgfdirection{#2}}{#3}}\ignorespaces} + + + +% Retrieves a border point of #1 at angle #2 and distance #3 from +% border. +% +% #1 = a node name +% #2 = an angle +% #3 = a distance from the border +% +% Example: +% +% \pgfpathmoveto{\pgfnodeborder{first}{30}{0pt}} +% \pgfpathlineto{\pgfnodeborder{second}{180}{2pt}} +% \pgfstroke + +\def\pgfnodeborder#1#2#3{% + \csname pgfnob@#1\endcsname{#3}{#2}{\pgfnodecenter{#1}}\ignorespaces} + + + +% Gives the beginning of a connection of #2 and #3, taking a +% separation distance of #1 into account. +% +% #1 = a separation distance +% #2 = a node name +% #3 = a second node name +% +% Example: +% +% \pgfpathmoveto{\pgfnodeconnstart{first}{second}} +% \pgfpathlineto{\pgfnodeconnstart{second}{first}} + +\def\pgfnodeconnstart[#1]#2#3{% + \csname pgfno@#2\endcsname[#1]{\pgfnodecenter{#2}}{\pgfnodecenter{#3}}% + \ignorespaces} + + + +\newdimen\pgf@nodesepstart +\newdimen\pgf@nodesepend + +% Sets the node separation for starts of lines. +% +% #1 = a distance +% +% Example: +% +% \pgfnodesetsepstart{2pt} + +\def\pgfnodesetsepstart#1{\setlength\pgf@nodesepstart{#1}\ignorespaces} + +\pgfnodesetsepstart{0pt} + + +% Sets the node separation for end of lines. +% +% #1 = a distance +% +% Example: +% +% \pgfnodesetsepend{2pt} + +\def\pgfnodesetsepend#1{\setlength\pgf@nodesepend{#1}\ignorespaces} + +\pgfnodesetsepend{0pt} + + + + +% Draws a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% +% Example: +% +% \pgfnodeconnline{first}{second} + +\def\pgfnodeconnline#1#2{% + \pgfpathmoveto{\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + \pgfpathlineto{\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + \pgfstroke% + \ignorespaces} + + + +% Draws a curve from #1 to #2. The starting angle at #1 is #3 and the +% length to the first support point is #5. The starting angle at #2 +% is #4 and the length to the second support point is #6. +% +% #1 = a node name +% #2 = a second node name +% #3 = angle at first node +% #4 = angle at second node +% #5 = distance to support point at first node +% #6 = distance to support point at second node +% +% Example: +% +% \pgfnodeconncurve{first}{second}{10}{-10}{1cm}{1cm} + +\def\pgfnodeconncurve#1#2#3#4#5#6{% + \pgfpathmoveto{\pgfnodeborder{#1}{#3}{\pgf@nodesepstart}}% + \pgfpathcurveto{\pgfnodeborder{#1}{#3}{#5}}{\pgfnodeborder{#2}{#4}{#6}}% + {\pgfnodeborder{#2}{#4}{\pgf@nodesepend}}% + \pgfstroke\ignorespaces} + + + + +% Put a label on a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% #3 = fraction of way from #1 to #2 +% #4 = vertical offset +% #5 = label +% +% Example: +% +% \pgfnodelabel{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}} + +\def\pgfnodelabel#1#2[#3][#4]#5{% + \pgfputat{\pgflabel% + {#3}% + {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + {#4}}% + {#5}\ignorespaces} + + +% Put a rotated label on a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% #3 = fraction of way from #1 to #2 +% #4 = vertical offset +% #5 = label +% +% Example: +% +% \pgfnodelabelrotated{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}} + +\def\pgfnodelabelrotated#1#2[#3][#4]#5{% + \pgfputlabelrotated% + {#3}% + {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + {#4}% + {#5}\ignorespaces} + + + +% Internals + +\def\pgf@backoffcircle#1[#2]#3#4{% + % Calculate backoff for a circle of radius + % #1 and offset separation #2. #3 is the center of the circle, #4 + % is the target point. + \setlength\pgf@x{#1}% + \addtolength\pgf@x{#2}% + \edef\pgf@temp{{\pgf@sys@tonumber{\pgf@x}pt}}% + \expandafter\pgfbackoff\pgf@temp{#3}{#4}\ignorespaces} + +\def\pgf@mult#1#2#3{#1=#2#3} + +\def\pgf@anglecircle#1#2#3#4{% + % Calculate border point. #1 is radius, #2 is additional backoff, #3 + % is an angle, #4 is the center of the circle. + \pgfsincos{#3}% + \setlength\pgf@xa{#1}% + \addtolength\pgf@xa{#2}% + \pgf@ya=\pgf@xa\relax% + \pgf@mult{\pgf@xa}{\pgf@sys@tonumber{\pgf@x}}{\pgf@xa}% + \pgf@mult{\pgf@ya}{\pgf@sys@tonumber{\pgf@y}}{\pgf@ya}% + \pgf@process{#4}% + \advance\pgf@y by\pgf@xa\relax% + \advance\pgf@x by\pgf@ya\ignorespaces} + +\def\pgf@backoffrect#1#2[#3]#4#5{% + % Calculate backoff for a rect with half width #1, + % half height #2, offset separation #3. #4 is the center of the rect, #5 + % is the target point. + \pgfdiff{#4}{#5}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \setlength\pgf@xb{#1}% + \setlength\pgf@yb{#2}% + \addtolength\pgf@xb{#3}% + \addtolength\pgf@yb{#3}% + \ifnum\pgf@xa<0\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifnum\pgf@ya<0\relax% + \pgf@y=-\pgf@y% + \fi% + \c@pgf@counta=\pgf@x% + \c@pgf@countb=\pgf@y% + \divide\c@pgf@counta by 256\relax% + \divide\c@pgf@countb by 256\relax% + \ifnum\c@pgf@countb<\c@pgf@counta% + \ifnum\c@pgf@counta<1\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@y=16\pgf@y% + \divide\pgf@y by \c@pgf@counta% + \pgf@y=16\pgf@y% + \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}% + \ifnum\pgf@y<\pgf@yb% + \pgf@x=\pgf@xb% + \else% rats, calculate intersection on upper side + \ifnum\c@pgf@countb<1\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@x=16\pgf@x% + \divide\pgf@x by \c@pgf@countb% + \pgf@x=16\pgf@x% + \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}% + \pgf@y=\pgf@yb% + \fi% + \fi% + \fi% + \else% + \ifnum\c@pgf@countb<1\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@x=16\pgf@x% + \divide\pgf@x by \c@pgf@countb% + \pgf@x=16\pgf@x% + \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}% + \ifnum\pgf@x<\pgf@xb% + \pgf@y=\pgf@yb% + \else% + \ifnum\c@pgf@counta<1\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@y=16\pgf@y% + \divide\pgf@y by \c@pgf@counta% + \pgf@y=16\pgf@y% + \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}% + \pgf@x=\pgf@xb% + \fi% + \fi% + \fi% + \fi% + \ifnum\pgf@xa<0\relax\pgf@x=-\pgf@x\fi% + \ifnum\pgf@ya<0\relax\pgf@y=-\pgf@y\fi% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#4}% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya\ignorespaces} + +\def\pgf@anglerect#1#2#3#4#5{% + % Calculate border point. #1/#2 is half width/height, #3 is additional backoff, #4 + % is an angle, #5 is the center of the rect. + \pgfsincos{#4}% + \pgf@xa=100\pgf@x% + \pgf@ya=100\pgf@y% + \pgf@process{#5}% + \advance\pgf@x by\pgf@ya% + \advance\pgf@y by\pgf@xa% + \edef\pgf@temp{{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}}% + \expandafter\pgf@caller\pgf@temp{#1}{#2}{#3}{#5}\ignorespaces} + +\def\pgf@caller#1#2#3#4#5{\pgf@backoffrect{#2}{#3}[#4]{#5}{#1}} + +\long\def\pgfbox[#1,#2]#3{% + \pgf@makehbox{#3}% + \csname pgf@haligncomp#1\endcsname% + \csname pgf@valigncomp#2\endcsname% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \pgfqbox{\pgf@hbox}% + \ignorespaces} + +\def\pgf@haligncompleft{}% do nothing +\def\pgf@haligncompcenter{\setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\box\pgf@hbox}} +\def\pgf@haligncompright{\setbox\pgf@hbox=\hbox{\hskip-\wd\pgf@hbox\box\pgf@hbox}} +\def\pgf@valigncompbase{}% do nothing +\def\pgf@valigncompbottom{\setbox\pgf@hbox=\hbox{\raise\dp\pgf@hbox\box\pgf@hbox}} +\def\pgf@valigncompcenter{% + \setbox\pgf@hbox=\hbox{\raise.5\dp\pgf@hbox\hbox{\lower.5\ht\pgf@hbox\box\pgf@hbox}}}% +\def\pgf@valigncomptop{\setbox\pgf@hbox=\hbox{\lower\ht\pgf@hbox\box\pgf@hbox}} + + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfheaps.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfheaps.sty new file mode 100644 index 00000000000..9d4a1324025 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfheaps.sty @@ -0,0 +1,107 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfheaps.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $ + +\RequirePackage{pgf} + +\PackageWarning{pgfheaps}{This package is obsolete.} + +\ProcessOptions + +% +% Package for drawing heap diagrams. +% + +\newdimen\pgf@heapx +\newdimen\pgf@heapy + + + + +% Construct the path of a heap. +% +% #1 = Position of heap label. +% #2 = Position of left base +% #3 = Position of right base +% +% Example: +% +% \pgfheappath{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)} +% \pgffill + +\def\pgfheappath#1#2#3{% + \pgfdiff{#2}{#3}% + \pgf@heapx=-.25\pgf@x% + \pgf@heapy=-.25\pgf@y% + \pgfmoveto{#2}% + \pgfbezier% + {\pgfpartway{0.5}{#2}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}% + {\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}% + {#1}% + \pgf@heapx=-\pgf@heapx% + \pgf@heapy=-\pgf@heapy% + \pgfbezier% + {\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}% + {\pgfpartway{0.5}{#3}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}% + {#3}% + \ignorespaces} + + +% Draw a heap label. +% +% #1 = Position of heap label. +% #2 = Label text. +% +% Example: +% +% \pgfheaplabel{\pgfxy(1,0)}{Class P} + +\def\pgfheaplabel#1#2{% + \setbox\pgf@hbox=\hbox{\pgfinterruptpicture#2\endpgfinterruptpicture}% + \pgf@heapy=\ht\pgf@hbox% + \pgfputat{\pgfrelative{#1}{\pgfpoint{0pt}{-2\pgf@heapy}}}{\pgfbox[center,base]{#2}}% + \ignorespaces} + + +% Draw a labeled heap. +% +% #1 = Position of heap label. +% #2 = Position of left base +% #3 = Position of right base +% #4 = Label text. +% +% Example: +% +% \pgfheaplabeled{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)}{Class P} + +\def\pgfheaplabeled#1#2#3#4{% + \pgfheaplabel{#1}{#4}% + \pgfheappath{#1}{#2}{#3}% + \pgfstroke% + \ignorespaces} + + + +% Draw a labeled heap. +% +% #1 = Height of the label +% #2 = Left and right extension of the base. +% #3 = Label text. +% +% Example: +% +% \pgfheaplabeledcentered{1cm}{1cm}{Class P} + +\def\pgfheaplabeledcentered#1#2#3{% + \pgfheaplabeled{\pgfpoint{0pt}{#1}}{\pgfpoint{-#2}{0pt}}{\pgfpoint{#2}{0pt}}{#3}\ignorespaces} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryarrows.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryarrows.sty new file mode 100644 index 00000000000..875bbf02641 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryarrows.sty @@ -0,0 +1,16 @@ +% 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. + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{arrows} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryarrows.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryautomata.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryautomata.sty new file mode 100644 index 00000000000..29d6655da3a --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryautomata.sty @@ -0,0 +1,16 @@ +% 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. + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{automata} instead} + +\RequirePackage{pgfcore} + +\input{pgflibrarytikzautomata.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplothandlers.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplothandlers.sty new file mode 100644 index 00000000000..1510046e7d0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplothandlers.sty @@ -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. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{plothandlers} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryplothandlers.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplotmarks.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplotmarks.sty new file mode 100644 index 00000000000..2f1ca05e07d --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryplotmarks.sty @@ -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. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{plotmarks} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryplotmarks.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryshapes.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryshapes.sty new file mode 100644 index 00000000000..c11f25ff009 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibraryshapes.sty @@ -0,0 +1,18 @@ +% 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. + + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{shapes} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryshapes.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarysnakes.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarysnakes.sty new file mode 100644 index 00000000000..5d0484f7c79 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarysnakes.sty @@ -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. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{snakes} instead} + +\RequirePackage{pgfcore} + +\input{pgflibrarysnakes.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikzbackgrounds.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikzbackgrounds.sty new file mode 100644 index 00000000000..584f81434fd --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikzbackgrounds.sty @@ -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. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{backgrounds} instead} + +\RequirePackage{tikz} + +\input{pgflibrarytikzbackgrounds.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikztrees.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikztrees.sty new file mode 100644 index 00000000000..6a6f05d624f --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgflibrarytikztrees.sty @@ -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. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{trees} instead} + +\RequirePackage{tikz} + +\input{pgflibrarytikztrees.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfnodes.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfnodes.sty new file mode 100644 index 00000000000..1308cc761b2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfnodes.sty @@ -0,0 +1,19 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfnodes.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $ + +\RequirePackage{pgf} + +\PackageWarning{pgfnodes}{This package is obsolete. pgf.sty will load + node management automatically} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/compatibility/pgfshade.sty b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfshade.sty new file mode 100644 index 00000000000..373fbb06837 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/compatibility/pgfshade.sty @@ -0,0 +1,19 @@ +% 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. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfshade.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $ + +\RequirePackage{pgf} + +\PackageWarning{pgfshade}{This package is obsolete. pgf.sty will load + shade management automatically} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/frontendlayer/pgfpict2e.sty b/Master/texmf-dist/tex/latex/pgf/frontendlayer/pgfpict2e.sty new file mode 100644 index 00000000000..830fa0c6428 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/frontendlayer/pgfpict2e.sty @@ -0,0 +1,112 @@ +% 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. + +\ProvidesPackage{pgfpict2e}[2004/11/28 ver 0.01] + +\RequirePackage{pgfcore} + +\def\pgf@pict@line(#1,#2)#3{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfsetroundcap% + \pgfpathqmoveto{0}{0}% + \ifnum#1=0\relax% + \pgf@xa=0pt\relax% + \pgf@ya=#3\unitlength\relax% + \else% + \pgf@y=#2\unitlength% + \divide\pgf@y by#1\relax% + \pgf@xa=#3\unitlength\relax% + \pgf@ya=#3\pgf@y\relax% + \fi% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfusepath{stroke}% + \pgfsys@endpurepicture% +}% + +\def\line(#1,#2)#3{{\pgfsetarrows{-}\pgf@pict@line(#1,#2){#3}}}% +\def\vector(#1,#2)#3{{\pgfsetarrows{-latex}\pgf@pict@line(#1,#2){#3}}}% + +\def\@circle#1{{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgf@x=#1\unitlength% + \pgfpathqcircle{.5\pgf@x}% + \pgfusepathqstroke% + \pgfsys@endpurepicture}} + +\def\@dot#1{{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgf@x=#1\unitlength% + \pgfpathqcircle{.5\pgf@x}% + \pgfusepathqfill% + \pgfsys@endpurepicture}} + + +\def\oval{\pgfutil@ifnextchar[{\pgfpictIIe@oval}{\pgfpictIIe@oval[20pt]}} +\def\pgfpictIIe@oval[#1](#2,#3){\pgfutil@ifnextchar[{\pgfpictIIe@@oval[#1](#2,#3)}{\pgfpictIIe@@oval[#1](#2,#3)[]}} +\def\pgfpictIIe@@oval[#1](#2,#3)[#4]{{% + \pgfsys@beginpurepicture% + \@tfor\reserved@a:=#4\do{\csname pgfpictIIe@clip\reserved@a\endcsname}% + \pgf@x=#2\unitlength% + \pgf@y=#3\unitlength% + \pgf@x=-.5\pgf@x% + \pgf@y=-.5\pgf@y% + \pgfsys@transformshift{\the\pgf@x}{\the\pgf@y}% + \pgfsetlinewidth{\@wholewidth}% + \pgf@ya=#3\unitlength% + \advance\pgf@ya by-#1\relax% + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@ya}}% + \pgfpatharc{180}{90}{#1}% + \pgf@xa=#2\unitlength% + \advance\pgf@xa by-#1\relax% + \pgfpathlineto{\pgfpoint{\pgf@xa}{#3\unitlength}}% + \pgfpatharc{90}{0}{#1}% + \pgfpathlineto{\pgfpoint{#2\unitlength}{#1}}% + \pgfpatharc{0}{-90}{#1}% + \pgfpathlineto{\pgfpoint{#1}{0pt}}% + \pgfpatharc{-90}{-180}{#1}% + \pgfpathclose% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} +\def\pgfpictIIe@clipr{\pgfpathrectangle{\pgfpoint{0pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipl{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipt{\pgfpathrectangle{\pgfpoint{-1000pt}{0pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipb{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}} + + +\renewcommand\bezier[1]{\pgfpictIIe@qbezier} +\renewcommand\qbezier[1][]{\pgfpictIIe@qbezier} +\def\pgfpictIIe@qbezier(#1,#2)(#3,#4)(#5,#6){{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}% + \pgfpathcurveto% + {\pgfpointmid{0.66666666}{\pgfpoint{#1\unitlength}{#2\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}% + {\pgfpointmid{0.66666666}{\pgfpoint{#5\unitlength}{#6\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}% + {\pgfpoint{#5\unitlength}{#6\unitlength}}%% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} +\newcommand\cbezier[1][]{\pgfpictIIe@cbezier} +\def\pgfpictIIe@cbezier(#1,#2)(#3,#4)(#5,#6)(#7,#8){{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}% + \pgfpathcurveto% + {\pgfpoint{#3\unitlength}{#4\unitlength}}% + {\pgfpoint{#5\unitlength}{#6\unitlength}}% + {\pgfpoint{#7\unitlength}{#8\unitlength}}%% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty b/Master/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty new file mode 100644 index 00000000000..d3b8ed6e7f0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty @@ -0,0 +1,15 @@ +% 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. + + +\RequirePackage{pgf,pgffor} % calc and xkeyval have been removed! + +\input{tikz.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/math/pgfmath.sty b/Master/texmf-dist/tex/latex/pgf/math/pgfmath.sty new file mode 100644 index 00000000000..b8092306e25 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/math/pgfmath.sty @@ -0,0 +1,12 @@ +% Copyright 2007 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. + +\input{pgfmath.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty b/Master/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty new file mode 100644 index 00000000000..2e2eab766e2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty @@ -0,0 +1,16 @@ +% 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. + +\RequirePackage{pgfrcs} + +\input{pgfsys.code.tex} +\input{pgfsyssoftpath.code.tex} +\input{pgfsysprotocol.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty b/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty new file mode 100644 index 00000000000..d694a2d2324 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty @@ -0,0 +1,14 @@ +% 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. + +\RequirePackage{pgfrcs} + +\input{pgfcalendar.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/pgffor.sty b/Master/texmf-dist/tex/latex/pgf/utilities/pgffor.sty new file mode 100644 index 00000000000..4a4dbc9c0d9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/utilities/pgffor.sty @@ -0,0 +1,14 @@ +% 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. + +\RequirePackage{pgfrcs} + +\input{pgffor.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/pgfpages.sty b/Master/texmf-dist/tex/latex/pgf/utilities/pgfpages.sty new file mode 100644 index 00000000000..2d29926b63c --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/utilities/pgfpages.sty @@ -0,0 +1,1047 @@ +% 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. + +\ProvidesPackage{pgfpages}[2004/11/05 ver 0.01] + +\RequirePackage{pgfcore,calc} + +\newcount\pgf@logicalpages +\newcount\pgf@firstshipout +\newcount\pgf@lastshipout +\newcount\pgf@currentshipout +\newcount\pgf@cpn +\newcount\pgf@shipoutnextto +\newdimen\pgfphysicalheight +\newdimen\pgfphysicalwidth + +\pgf@shipoutnextto=0\relax +\pgf@logicalpages=0\relax +\pgf@firstshipout=1\relax +\pgf@lastshipout=1\relax +\pgf@currentshipout=1\relax +\pgfphysicalheight=\paperheight +\pgfphysicalwidth=\paperwidth + +\newif\ifpgfphysicalpageempty +\newif\ifpgf@holdingphysicalpage + +\pgfphysicalpageemptytrue +\pgf@holdingphysicalpagefalse + + +% Define a layout +% +% #1 = layout name +% #2 = code before options have been set +% #2 = code after options have been set +% +% Example: +% +% \pgfpagesdeclarelayout{resize to}{ +% \pgfpagesphysicalpageoptions{logical pages=1,physical height=\pgfpageoptionheight,physical width=\pgfpageoptionwidth} +% \pgfpageslogicalpageoptions{1}{resized width=\pgfphysicalwidth,% +% resized height=\pgfphysicalheight,center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}}} + +\newcommand\pgfpagesdeclarelayout[3]{ + \expandafter\newcommand\csname pgfpages@layoutbefore@#1\endcsname{#2} + \expandafter\newcommand\csname pgfpages@layout@#1\endcsname{#3}} + + +% Use a layout +% +% #1 = layout name +% #2 = options +% +% Example: +% +% \pgfpagesuselayout{resize to}[a4paper] + +\def\pgfpagesuselayout#1{\pgfutil@ifnextchar[{\pgf@pagelayout{#1}}{\pgf@pagelayout{#1}[]}} +\def\pgf@pagelayout#1[#2]{ + \csname pgfpages@layoutbefore@#1\endcsname + \setkeys{pgfpagesuselayoutoption}{#2} + \pgfutil@ifundefined{pgfpages@layout@#1}{ + \PackageError{pgfpages}{Page layout `#1' undefined.}{} + } + { + \csname pgfpages@layout@#1\endcsname + } +} + + +% Predefined options + +\define@key{pgfpagesuselayoutoption}{physical paper width}% +{\def\pgfpageoptionwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{physical paper height}% +{\def\pgfpageoptionheight{#1}} + +\define@key{pgfpagesuselayoutoption}{a0paper}[]% +{\def\pgfpageoptionheight{1189mm} \def\pgfpageoptionwidth{841mm}} + +\define@key{pgfpagesuselayoutoption}{a1paper}[]% +{\def\pgfpageoptionheight{841mm} \def\pgfpageoptionwidth{594mm}} + +\define@key{pgfpagesuselayoutoption}{a2paper}[]% +{\def\pgfpageoptionheight{594mm} \def\pgfpageoptionwidth{420mm}} + +\define@key{pgfpagesuselayoutoption}{a3paper}[]% +{\def\pgfpageoptionheight{420mm} \def\pgfpageoptionwidth{297mm}} + +\define@key{pgfpagesuselayoutoption}{a4paper}[]% +{\def\pgfpageoptionheight{297mm} \def\pgfpageoptionwidth{210mm}} + +\define@key{pgfpagesuselayoutoption}{a5paper}[]% +{\def\pgfpageoptionheight{210mm} \def\pgfpageoptionwidth{148mm}} + +\define@key{pgfpagesuselayoutoption}{a6paper}[]% +{\def\pgfpageoptionheight{148mm} \def\pgfpageoptionwidth{105mm}} + +\define@key{pgfpagesuselayoutoption}{letterpaper}[]% +{\def\pgfpageoptionheight{11in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{legalpaper}[]% +{\def\pgfpageoptionheight{14in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{executivepaper}[]% +{\def\pgfpageoptionheight{10.5in}\def\pgfpageoptionwidth{7.25in}} + +\define@key{pgfpagesuselayoutoption}{landscape}[]% +{ + \let\pgf@temp=\pgfpageoptionwidth + \let\pgfpageoptionwidth=\pgfpageoptionheight + \let\pgfpageoptionheight=\pgf@temp +} + +\define@key{pgfpagesuselayoutoption}{border shrink}% +{\def\pgfpageoptionborder{#1}} + +\define@key{pgfpagesuselayoutoption}{corner width}% +{\def\pgfpageoptioncornerwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{odd numbered pages right}[]% +{\def\pgfpageoptionfirstshipout{2}} + +\define@key{pgfpagesuselayoutoption}{second right}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second left}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second top}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second bottom}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + + + +% Predefined layouts + +\pgfpagesdeclarelayout{rounded corners} +{ + \def\pgfpageoptioncornerwidth{10pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1 + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},% + corner width=\pgfpageoptioncornerwidth% + }% +} + +\pgfpagesdeclarelayout{resize to} +{ + \def\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + resized width=\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + border shrink=\pgfpageoptionborder,% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% +} + +\pgfpagesdeclarelayout{two screens with lagging second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1,% + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=1% + }% +} + +\pgfpagesdeclarelayout{two screens with optional second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1% + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=2% + }% +} + +\pgfpagesdeclarelayout{2 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionfirstshipout{1} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{4 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=4,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% +} + + +\pgfpagesdeclarelayout{8 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=8,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{16 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=16,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{9} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{10} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{11} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{12} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{13} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{14} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{15} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{16} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% +} + + +% Change/set main option +% +% #1 = options +% +% Options: +% +% logical pages = number of logical pages per physical page +% logical shipouts = number of shipouts needed to fill a physical page +% (may be less than the number of logical pages, +% if some logical pages are calculated +% automatically) +% current logical shipout = number of logical shipout that will come +% next. +% +% Example: +% +% \pgfpagesphysicalpageoptions{logical pages=2,logical shipouts=1} + +\newcommand\pgfpagesphysicalpageoptions[1]{% + \pgf@lastshipout=0\relax% + \pgf@currentshipout=0\relax% + \setkeys{pgfpages@main}{#1}% + \ifnum\pgf@lastshipout=0\relax%not set + \pgf@lastshipout=\pgf@logicalpages% + \fi% + \ifnum\pgf@currentshipout=0\relax%not set + \pgf@currentshipout=\pgf@firstshipout% + \fi% +} + + +\define@key{pgfpages@main}{logical pages}{\pgf@logicalpages=#1\relax} +\define@key{pgfpages@main}{first logical shipout}{\pgf@firstshipout=#1\relax} +\define@key{pgfpages@main}{last logical shipout}{\pgf@lastshipout=#1\relax} +\define@key{pgfpages@main}{current logical shipout}{\pgf@currentshipout=#1\relax} +\define@key{pgfpages@main}{physical height}{\pgfphysicalheight=#1\relax} +\define@key{pgfpages@main}{physical width}{\pgfphysicalwidth=#1\relax} + + + +% Setup/change parameters of a logical page. You must call this +% macro for each logical page. +% +% #1 = logical page number +% #2 = options +% +% Options: +% +% original height = height of the logical page (\paperheight at point of +% first invocation by default) +% original width = width of the logical page (\paperwidth by default) +% resized height = height of the logical page after resizing +% resized width = width of the logical page after resizing +% border shrink = length that is subtracted from resized height and +% resized width +% border code = pgf commands to be used for drawing a border (a +% path with the border set will already have been +% set) +% rounded corners = clip the frame against a rectangle of the size of +% the frame with corners of the given radius +% scale = factor by which the page is enlarged/shrunk +% center = center of the logical page in the physical page +% rotation = degree by which the page is rotated around its center +% xscale = scale only x-axis (use -1 to flip along y-axis) +% yscale = scale only y-axis (use -1 to flip along x-axis) +% copy from = copy the contents from this logical page of the +% previous physical page, if no contents is specified +% +% If more than one of the three options ``resized height'', ``resized +% width'' and ``scale'' are given, the smallest resulting scaling +% wins. +% +% Example: +% +% \pgfpageslogicalpageoptions{1}{scale=0.5,center=\pgfpoint{0cm}{2cm}} + +\newcommand\pgfpageslogicalpageoptions[2]{% + \pgf@cpn=#1\relax% + \expandafter\ifx\csname pgfpages@box@#1\endcsname\relax% + \expandafter\newbox\csname pgfpages@box@#1\endcsname% + \edef\pgf@temp{% + \noexpand\pgf@psetcurrent{height}{\the\paperheight}% + \noexpand\pgf@psetcurrent{width}{\the\paperwidth}% + }% + \pgf@temp% + \fi% + \setkeys{pgfpages@page}{#2}% + \pgf@calculateresizes{height}% + \pgf@calculateresizes{width}% + \pgfsetupphysicalpagesizes% +} + +\def\pgf@epset#1#2#3{\expandafter\edef\csname pgfpages@p@#1@#2\endcsname{#3}} +\def\pgf@epsetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{#1}{#2}} +\def\pgf@pset#1#2#3{\expandafter\def\csname pgfpages@p@#1@#2\endcsname{#3}} +\def\pgf@pget#1#2{\csname pgfpages@p@#1@#2\endcsname} +\def\pgf@psetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{#1}{#2}} +\def\pgf@pgetcurrent#1{\pgf@pget{\the\pgf@cpn}} + +\define@key{pgfpages@page}{scale}{\pgf@epsetcurrent{scale}{#1}} +\define@key{pgfpages@page}{xscale}{\pgf@epsetcurrent{xscale}{#1}} +\define@key{pgfpages@page}{yscale}{\pgf@epsetcurrent{yscale}{#1}} +\define@key{pgfpages@page}{original height}{\pgf@epsetcurrent{height}{#1}} +\define@key{pgfpages@page}{original width}{\pgf@epsetcurrent{width}{#1}} +\define@key{pgfpages@page}{resized height}{\pgf@epsetcurrent{reheight}{#1}} +\define@key{pgfpages@page}{resized width}{\pgf@epsetcurrent{rewidth}{#1}} +\define@key{pgfpages@page}{center}{\pgf@psetcurrent{center}{#1}} +\define@key{pgfpages@page}{rotation}{\pgf@epsetcurrent{rotation}{#1}} +\define@key{pgfpages@page}{copy from}{\pgf@epsetcurrent{copy}{#1}} +\define@key{pgfpages@page}{border shrink}{\pgf@epsetcurrent{border}{#1}} +\define@key{pgfpages@page}{border code}{\pgf@psetcurrent{bordercode}{#1}} +\define@key{pgfpages@page}{corner width}{\pgf@psetcurrent{cornerwidth}{#1}} + +\def\pgf@calculateresizes#1{% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @re#1\endcsname\relax% + \else% + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @re#1\endcsname\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @border\endcsname\relax% + \else% + \expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @border\endcsname\relax% + \advance\pgfutil@tempdima by-2\pgfutil@tempdimb\relax% + \fi% + \expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @#1\endcsname\relax% + \pgfutil@tempcnta=\pgfutil@tempdimb% + \divide\pgfutil@tempcnta by 65536\relax% + \ifnum\pgfutil@tempcnta=0\relax% + \pgfutil@tempcnta=1\relax% + \fi% + \divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @scale\endcsname\relax% + \pgfutil@tempdimb=10000pt% + \else% + \expandafter\pgfutil@tempdimb\expandafter=\csname pgfpages@p@\the\pgf@cpn @scale\endcsname pt\relax% + \fi% + \ifdim\pgfutil@tempdima<\pgfutil@tempdimb% + \edef\pgf@temp{{scale}{\expandafter\Pgf@geT\the\pgfutil@tempdima}}% + \expandafter\pgf@psetcurrent\pgf@temp% + \fi% + \fi% +} + + + +% Shipout a physical page immediately +% +% Example: +% +% \pgfshipoutphysicalpage + +\newcommand\pgfshipoutphysicalpage{% + \ifnum\pgf@logicalpages>0\relax% + \pgfpages@buildshipoutbox% + \pgfpages@shipoutshipoutbox% + \pgfpages@performcopying% + \global\pgfphysicalpageemptytrue% + \global\pgf@holdingphysicalpagefalse% + \fi% +} + +\newbox\pgfpages@shipoutbox + +\def\pgfpages@buildshipoutbox{% + \setbox\pgfpages@shipoutbox=\vbox{{% + \set@typeset@protect% + \offinterlineskip% + \pgfsys@beginpicture% + \pgf@cpn=1\relax% + \loop% + \setbox0=\hbox to \csname pgfpages@p@\the\pgf@cpn @width\endcsname{% + \hskip1in% + \vbox to \csname pgfpages@p@\the\pgf@cpn @height\endcsname% + {\vskip1in\offinterlineskip\expandafter\copy\csname + pgfpages@box@\the\pgf@cpn\endcsname\vss}\hss}% + \pgfsys@beginscope% + % Translate lower left corner + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @center\endcsname\relax% + \else% + \pgflowlevel{\pgftransformshift{\csname pgfpages@p@\the\pgf@cpn @center\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @scale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformscale{\csname pgfpages@p@\the\pgf@cpn @scale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @xscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformxscale{\csname pgfpages@p@\the\pgf@cpn @xscale\endcsname}{1}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @yscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformyscale{\csname pgfpages@p@\the\pgf@cpn @yscale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @rotation\endcsname\relax% + \pgfscope% + \else% + \pgflowlevel{\pgftransformrotate{\csname pgfpages@p@\the\pgf@cpn @rotation\endcsname}}% + \fi% + \pgfutil@tempdima=\csname pgfpages@p@\the\pgf@cpn @width\endcsname\relax% + \pgfutil@tempdimb=\csname pgfpages@p@\the\pgf@cpn @height\endcsname\relax% + \pgflowlevel{\pgftransformshift{\pgfpoint{-.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}}% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @bordercode\endcsname\relax% + \else% + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfpoint{\wd0}{0pt}}% + \pgfpathlineto{\pgfpoint{\wd0}{\ht0}}% + \pgfpathlineto{\pgfpoint{0pt}{\ht0}}% + \pgfpathclose% + {\csname pgfpages@p@\the\pgf@cpn @bordercode\endcsname}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @cornerwidth\endcsname\relax% + \else% + { + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @cornerwidth\endcsname\relax% + \color{black} + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfusepath{fill}% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfutil@tempdima}} + \pgfpathcurveto{\pgfpoint{0pt}{0.555\pgfutil@tempdima}}{\pgfpoint{.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{0pt}} + \pgfpathlineto{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}} + \pgfpathcurveto{\pgfpoint{\wd0-.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\wd0}{.555\pgfutil@tempdima}}{\pgfpoint{\wd0}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\wd0}{\ht0-\pgfutil@tempdima}} + \pgfpathcurveto{\pgfpoint{\wd0}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{\wd0-.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0}} + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\ht0}} + \pgfpathcurveto{\pgfpoint{.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{0pt}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}} + \pgfpathclose + \pgfusepath{clip} + \color{white} + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\wd0}{\ht0}} + \pgfusepath{fill} + } + \fi% + \ht0=0pt% + \wd0=0pt% + \dp0=0pt% + \pgfsys@hbox0% + \endpgfscope% + \pgfsys@endscope% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% + \pgfsys@endpicture% + }}% +} + + +\def\pgfpages@shipoutshipoutbox{% + \begingroup + \let \protect \noexpand + \@resetactivechars + \global\let\@@if@newlist\if@newlist + \global\@newlistfalse + \@parboxrestore + \pgfpages@originalshipout% + \hbox{% + \hskip-1in% + \vbox to \pgfphysicalheight{% + \vss\box\pgfpages@shipoutbox% + \vskip1in% + }}% + \endgroup% +} + +\def\pgfpages@performcopying{ + \pgf@cpn=1\relax% copy first + \loop% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @copy\endcsname\relax + \else% + \edef\pgf@temp{\noexpand\global\noexpand\setbox\csname pgfpages@box@% + \the\pgf@cpn\endcsname=\noexpand\copy\csname pgfpages@box@\csname + pgfpages@p@\the\pgf@cpn @copy\endcsname\endcsname}% + \pgf@temp% + \fi% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% + \pgf@cpn=1\relax% then void + \loop% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @copy\endcsname\relax + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@cpn\endcsname=\box\voidb@x% + \else% + \fi% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% +} + + + +% Save original shipout commands +% +% Example: +% +% \pgfhookintoshipout + +\newcommand\pgfhookintoshipout{ + \let\pgfpages@originalshipout=\shipout + \let\shipout=\pgfpages@interceptshipout +} + +\def\pgfpages@interceptshipout{% + \ifnum\pgf@shipoutnextto>0\relax + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttestnext% + \pgfpagesshipoutlogicalpage{\the\pgf@shipoutnextto}% + }% + \else% + \ifpgf@holdingphysicalpage% shipout physical page now + {\pgfshipoutphysicalpage}% + \fi% + \ifnum\pgf@logicalpages=0\relax + \def\pgf@next{\pgfpages@originalshipout}% + \else% + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@currentshipout\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttest% + \pgfpagesshipoutlogicalpage{\the\pgf@currentshipout}% + }% + \fi% + \fi% + \pgf@next% +} + +\def\pgfpages@shipouttest{% + \ifvoid\csname pgfpages@box@\the\pgf@currentshipout\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@shipouttestnext{% + \ifvoid\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@preparenextshipout{% + \ifnum\pgf@shipoutnextto=0\relax% + \global\advance\pgf@currentshipout by 1\relax% + \else% + \global\pgf@shipoutnextto=0\relax% + \fi% + \ifnum\pgf@currentshipout>\pgf@lastshipout\relax% + \global\pgf@currentshipout=\pgf@firstshipout\relax% + \global\pgf@holdingphysicalpagetrue% + \fi% +} + + + +% Shipout a logical page +% +% #1 = logical page number +% +% The command should be followed by a box. This box will become the +% contents of the logical page. +% +% Example: +% +% \pgfpagesshipoutlogicalpage{0}\vbox{Hi!} + +\newcommand\pgfpagesshipoutlogicalpage[1]{% + \global\pgfphysicalpageemptyfalse% + \expandafter\global\expandafter\setbox\csname pgfpages@box@#1\endcsname=} + + + +% Finish current page and shipout next page to a specific logical page. +% +% #1 = logical page number +% +% When the current page has been typset, it will be become the given +% logical page. This command ``interrupts'' the normal order of +% logical pages. +% +% Example: +% +% \pgfpagesuselayout{two screens with optional second} +% +% Text for main page.\clearpage +% +% \pgfpagescurrentpagewillbelogicalpage{2} +% +% Text that goes to second page +% +% \clearpage +% +% Text for main page. + +\newcommand\pgfpagescurrentpagewillbelogicalpage[1]{% + \global\pgf@shipoutnextto=#1\relax% +} + + +% Setup the physical page sizes +% +% Example: +% +% \pgfsetupphysicalpagesizes + +\newcommand\pgfsetupphysicalpagesizes{% + % The following code was send to me by Rolf Niepraschk + \ifx\Gin@driver\pgfutil@empty\else% + \filename@parse{\Gin@driver}\@tempswafalse% + \def\reserved@a{dvips}% + \ifx\filename@base\reserved@a\@tempswatrue\fi% + \def\reserved@a{dvipdfm}% + \ifx\filename@base\reserved@a\@tempswatrue\fi% + \if@tempswa% + \AtBeginDvi{% + \special{papersize=\the\pgfphysicalwidth,\the\pgfphysicalheight}}% + \fi% + \def\reserved@a{pdftex}% + \ifx\filename@base\reserved@a + \pdfpagewidth\pgfphysicalwidth\pdfpageheight\pgfphysicalheight% + \fi% + \def\reserved@a{vtex}% + \ifx\filename@base\reserved@a + \mediawidth\pgfphysicalwidth\mediaheight\pgfphysicalheight% + \fi% + \fi +} + + +% +% Start/End setup +% +\AtBeginDocument +{ + \pgfhookintoshipout + \pgfsetupphysicalpagesizes +} +\AtEndDocument +{ + \clearpage + \ifpgfphysicalpageempty + \else + \pgfshipoutphysicalpage + \fi +} + diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty b/Master/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty new file mode 100644 index 00000000000..05db9decaea --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty @@ -0,0 +1,15 @@ +% 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. + +\input pgfutil-common.tex +\input pgfutil-latex.def + +\input{pgfrcs.code.tex} + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/xxcolor.sty b/Master/texmf-dist/tex/latex/pgf/utilities/xxcolor.sty new file mode 100644 index 00000000000..7c2d666b8fc --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf/utilities/xxcolor.sty @@ -0,0 +1,108 @@ +% 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. + +\ProvidesPackage{xxcolor}[2003/10/24 ver 0.1] +\NeedsTeXFormat{LaTeX2e}[1995/12/01] + +\RequirePackage{xcolor} + + + +% Command \newcolormixin{\somecommand} +% +% Description: +% +% After this command has been called, you can assign a partial color +% specification to \somecommand. Every time a color is set, the +% partial color specification in \somecommand will be applied to the +% current color. +% +% Examples: +% +% \newcolormixin\mymixin +% \def\mymixin{!50!white} +% +% \newcolormixin\anothermixin +% \def\anothermixin{!50!red} + +\def\newcolormixin#1{% + \expandafter\def\csname XC@mixin@\the\XC@nummixins\endcsname{#1}% + \advance\XC@nummixins\@ne% + \ifx#1\@undefined\def#1{}\fi} + +\newcount\XC@nummixins +\newcount\XC@countmixins + + +% Command \applycolormixins{colorname} +% +% Description: +% +% Applies all color mixins that have been defined using \newcolormixin +% to the color named colorname. +% +% Examples: +% +% \applycolormixins{mycolor} + +\def\applycolormixins#1{% + \XC@countmixins=0\relax% + \loop% + \ifnum\XC@countmixins<\XC@nummixins% + \colorlet{#1}{#1\csname XC@mixin@\the\XC@countmixins\endcsname}% + \advance\XC@countmixins\@ne\relax% + \repeat% +} + + +% Internal: + +\ifx\XC@mcolor\relax + \let\XC@mcolor\@empty +\fi + +\g@addto@macro\XC@mcolor{% + \ifnum\XC@nummixins>0% + \pgfutil@namelet{\string\color@XC@mixtmp}{\string\color@.}% + \applycolormixins{XC@mixtmp}% + \pgfutil@namelet{current@color}{\string\color@XC@mixtmp}% + \fi% +} + + + +% Environment colormixin +% +% #1 = full xcolor specification after the first ! ("white" may not be +% omitted) +% +% Description: +% +% Inside the environment, all colors get the specified mixin. May be +% nested. +% +% Examples: +% +% \color{red}This is red. +% \begin{colormixin}{25!black} +% This is dark red. +% \color{blue} +% This is dark blue. +% \end{colormixin} +% This is normal red once more. + +\newcolormixin\colorcurrentmixin + +\newenvironment{colormixin}[1]% +{\edef\colorcurrentmixin{!#1\colorcurrentmixin}\color{.}}{} + +\def\pgfalternateextension{\colorcurrentmixin} + +\endinput + diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgf.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgf.tex new file mode 100644 index 00000000000..4c4e4c60de6 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgf.tex @@ -0,0 +1,28 @@ +% 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. + + +\edef\pgfatcode{\the\catcode`\@} +\catcode`\@=11 + + +\input pgfrcs.tex +\ProvidesPackageRCS $Header: /cvsroot/pgf/pgf/plain/pgf/basiclayer/pgf.tex,v 1.10 2008/01/15 17:17:22 tantau Exp $ + +\input pgfcore.tex + +\usepgfmodule{shapes,plot} + +%\input pgfbasesnakes.tex +%\input pgfbasedecorations.tex +%\input pgfbasematrix.tex + +\catcode`\@=\pgfatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseimage.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseimage.tex new file mode 100644 index 00000000000..675ac960c4f --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseimage.tex @@ -0,0 +1,20 @@ +% 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. + + +\edef\pgfbaseimageatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\catcode`\@=\pgfbaseimageatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaselayers.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaselayers.tex new file mode 100644 index 00000000000..626c89d5a87 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaselayers.tex @@ -0,0 +1,20 @@ +% 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. + + +\edef\pgfbaselayersatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\catcode`\@=\pgfbaselayersatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasematrix.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasematrix.tex new file mode 100644 index 00000000000..a860a1a7bcc --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasematrix.tex @@ -0,0 +1,22 @@ +% 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. + + +\edef\pgfbasematrixatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{matrix} instead} + +\usepgfmodule{matrix} + +\catcode`\@=\pgfbasematrixatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasepatterns.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasepatterns.tex new file mode 100644 index 00000000000..3b14b0a3a3f --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasepatterns.tex @@ -0,0 +1,20 @@ +% 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. + + +\edef\pgfbasepatternsatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\catcode`\@=\pgfbasepatternsatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseplot.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseplot.tex new file mode 100644 index 00000000000..ef56ce8715e --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseplot.tex @@ -0,0 +1,22 @@ +% 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. + + +\edef\pgfbaseplotatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{plot} instead} + +\usepgfmodule{plot} + +\catcode`\@=\pgfbaseplotatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseshapes.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseshapes.tex new file mode 100644 index 00000000000..94fa7a28884 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbaseshapes.tex @@ -0,0 +1,22 @@ +% 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. + + +\edef\pgfbaseshapesatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{shapes} instead} + +\usepgfmodule{shapes} + +\catcode`\@=\pgfbaseshapesatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasesnakes.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasesnakes.tex new file mode 100644 index 00000000000..7902e02bf31 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfbasesnakes.tex @@ -0,0 +1,22 @@ +% 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. + + +\edef\pgfbasesnakesatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfcore.tex + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{decorations} instead} + +\usepgfmodule{decorations} + +\catcode`\@=\pgfbasesnakesatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfcore.tex b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfcore.tex new file mode 100644 index 00000000000..590120a96c5 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/basiclayer/pgfcore.tex @@ -0,0 +1,23 @@ +% 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. + + +\ifx\pgfcoreincluded\undefined +\def\pgfcoreincluded{} + +\edef\pgfcoreatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfsys.tex +\input pgfcore.code.tex +\catcode`\@=\pgfcoreatcode + +\fi + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/frontendlayer/tikz.tex b/Master/texmf-dist/tex/plain/pgf/frontendlayer/tikz.tex new file mode 100644 index 00000000000..30aa11fa074 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/frontendlayer/tikz.tex @@ -0,0 +1,23 @@ +% 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. + +% This file is tikz.tex + +\edef\tikzatcode{\the\catcode`\@} +\catcode`\@=11 + +%\input xkeyval.tex % no longer used/needed + +\input pgf.tex +\input pgffor.tex +\input tikz.code.tex + +\catcode`\@=\tikzatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/math/pgfmath.tex b/Master/texmf-dist/tex/plain/pgf/math/pgfmath.tex new file mode 100644 index 00000000000..b26fbc8c356 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/math/pgfmath.tex @@ -0,0 +1,23 @@ +% Copyright 2007 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. + + +\ifx\pgfmathincluded\undefined +\def\pgfmathincluded{} + +\edef\pgfmathatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfsys.tex +\input pgfmath.code.tex +\catcode`\@=\pgfmathatcode + +\fi + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/systemlayer/pgfsys.tex b/Master/texmf-dist/tex/plain/pgf/systemlayer/pgfsys.tex new file mode 100644 index 00000000000..1ca8bba3581 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/systemlayer/pgfsys.tex @@ -0,0 +1,28 @@ +% 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. + +% This file is pgfsys.tex + +\ifx\pgfsysincluded\undefined +\def\pgfsysincluded{} + +\edef\pgfsysatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfrcs.tex + +\input pgfsys.code.tex +\input pgfsyssoftpath.code.tex +\input pgfsysprotocol.code.tex + +\catcode`\@=\pgfsysatcode\relax + +\fi + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/utilities/pgfcalendar.tex b/Master/texmf-dist/tex/plain/pgf/utilities/pgfcalendar.tex new file mode 100644 index 00000000000..768357527ae --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/utilities/pgfcalendar.tex @@ -0,0 +1,18 @@ +% 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. + +\edef\pgfcalendaratcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfrcs.tex +\input pgfcalendar.code.tex + +\catcode`\@=\pgfcalendaratcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/utilities/pgffor.tex b/Master/texmf-dist/tex/plain/pgf/utilities/pgffor.tex new file mode 100644 index 00000000000..4b5e8177135 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/utilities/pgffor.tex @@ -0,0 +1,18 @@ +% 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. + +\edef\pgfforatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfrcs.tex +\input pgffor.code.tex + +\catcode`\@=\pgfforatcode + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgf/utilities/pgfrcs.tex b/Master/texmf-dist/tex/plain/pgf/utilities/pgfrcs.tex new file mode 100644 index 00000000000..6d8928dc078 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgf/utilities/pgfrcs.tex @@ -0,0 +1,26 @@ +% 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. + + +\ifx\pgfrcsincluded\undefined +\def\pgfrcsincluded{} + +\edef\pgfrcsatcode{\the\catcode`\@} +\catcode`\@=11 + +\input pgfutil-common.tex +\input pgfutil-plain.def + +\input pgfrcs.code.tex + +\catcode`\@=\pgfrcsatcode + +\fi + +\endinput -- cgit v1.2.3