diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries')
43 files changed, 17299 insertions, 16901 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex index 7eb1b719329..da124ee8401 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex @@ -7,9 +7,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex,v 1.3 2008/11/12 23:39:37 tantau Exp $ +\ProvidesFileRCS{pgflibrarydatavisualization.barcharts.code.tex} -\usepgfmodule{datavisualization} +\usepgfmodule{datavisualization}% % @@ -18,22 +18,22 @@ \pgfooclass{candle stick visualizer} -{ - \attribute attribute; - \attribute offset; - \attribute use path rise=\pgfsetfillcolor{white}\pgfusepath{fill,stroke}; - \attribute use path fall=\pgfsetfillcolor{black}\pgfusepath{fill,stroke}; - \attribute use path wick=\pgfusepath{stroke}; - +{% + \attribute attribute;% + \attribute offset;% + \attribute use path rise=\pgfsetfillcolor{white}\pgfusepath{fill,stroke};% + \attribute use path fall=\pgfsetfillcolor{black}\pgfusepath{fill,stroke};% + \attribute use path wick=\pgfusepath{stroke};% + \method candle stick visualizer(#1) { \pgfooeset{attribute}{#1} \pgfoothis.set stick width(4pt) - } + }% \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,visualize,visualize datapoint signal) - } + }% \method set stick width(#1) { \pgfmathparse{#1} @@ -53,15 +53,15 @@ \pgf@y=\pgf@dv@lib@w\pgf@xa% \edef\pgf@dv@lib@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% \pgfoolet{offset}\pgf@dv@lib@temp - } + }% \method set use path rise(#1) { \pgfooset{use path rise}{#1} - } + }% \method set use path fall(#1) { \pgfooset{use path fall}{#1} - } + }% \method visualize() { { @@ -122,14 +122,14 @@ \else \pgfoovalueof{use path fall} \fi - \end{pgfscope} + \end{pgfscope}% \fi } - } + }% \newif\ifpgf@dv@lib@cs@skip \newif\ifpgf@dv@lib@rise -} +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex index ae62fd31839..540901936fe 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex @@ -7,9 +7,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex,v 1.4 2011/03/14 23:17:52 tantau Exp $ +\ProvidesFileRCS{pgflibrarydatavisualization.formats.functions.code.tex} -\usepgfmodule{datavisualization} +\usepgfmodule{datavisualization}% @@ -36,27 +36,27 @@ % % Additionally, the variables and functions stored in the keys % /pgf/data/vars and /pgf/data/funcs will also be used, the format for -% them is the same as above. +% them is the same as above. % % The <name> is always the name of a (data point) attribute. Inside % the <body> it can be accessed using the \value macro, which is % defined locally, here. % -% Newlines are not importants, everything is gathered into a single +% Newlines are not important, everything is gathered into a single % line, the semicolons are used to detect the beginnings and ends of % declarations. % % With everything setup in this way, for each variable, the variable -% ranges throught the values between start and end, either with the +% ranges through the values between start and end, either with the % given step or the given number of samples. If neither is given, the % current value of /pgf/data visualization/samples is used. If there % are multiple variables, they all range over their respective -% intervals independently. Thus, "var x = [0,1]; var y = [0:1];", +% intervals independently. Thus, "var x = [0,1]; var y = [0:1];", % assuming samples=25, gives you 625 data points. % % As the variables range over their respective values, the functions % are evaluated using the function stored in /pgf/data/evaluator. By -% default this is set to \pgfmathparse, but +% default this is set to \pgfmathparse, but % you can use a different parser, if you like. % % Example: @@ -104,15 +104,15 @@ \expandafter\pgf@lib@dv@func@parse \pgf@lib@dv@collector\pgf@stop% \let\value\pgf@lib@dv@getval \pgf@lib@dv@parsed\pgfdatapoint\pgfutil@gobble\pgf@stop% -} +}% \pgfkeys{ /pgf/data/vars/.initial=, /pgf/data/funcs/.initial=, /pgf/data/evaluator/.initial=\pgfmathparse, - /pgf/data/samples/.initial=25} + /pgf/data/samples/.initial=25}% -\def\pgf@lib@dv@getval#1{\pgfkeysvalueof{/data point/#1}} +\def\pgf@lib@dv@getval#1{\pgfkeysvalueof{/data point/#1}}% \def\pgf@lib@dv@func@parse{% \pgfutil@ifnextchar\pgf@stop{% done @@ -125,17 +125,17 @@ \pgf@lib@dv@func% }% }% -} +}% \def\pgf@lib@dv@func func #1 =#2;{% \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@eval@func{#1}{#2}} \pgf@lib@dv@func@parse% -} -\def\pgf@lib@dv@var var #1 :{\pgfutil@ifnextchar\bgroup{\pgf@lib@dv@var@group{#1}}{\pgf@lib@dv@var@int{#1}}} +}% +\def\pgf@lib@dv@var var #1 :{\pgfutil@ifnextchar\bgroup{\pgf@lib@dv@var@group{#1}}{\pgf@lib@dv@var@int{#1}}}% \def\pgf@lib@dv@var@group#1#2;{% \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@group@var{#1}{#2}}% \pgf@lib@dv@func@parse% -} +}% \def\pgf@lib@dv@var@int#1#2[#3:#4]{% \pgfutil@ifnextchar s{% \pgf@lib@dv@samplesorsteps{#1}{#3}{#4}% @@ -144,22 +144,22 @@ \pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#3}{#4}{\pgfkeysvalueof{/pgf/data/samples}}}% \expandafter\pgf@lib@dv@func@parse\pgfutil@gobble% } -} +}% \def\pgf@lib@dv@samplesorsteps#1#2#3s{% \pgfutil@ifnextchar t{% step \pgf@lib@dv@step{#1}{#2}{#3}% }{% sample \pgf@lib@dv@samples{#1}{#2}{#3}% }% -} +}% \def\pgf@lib@dv@step#1#2#3tep#4;{% \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@step@var{#1}{#2}{#3}{#4}}% \pgf@lib@dv@func@parse% -} +}% \def\pgf@lib@dv@samples#1#2#3amples#4;{% \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#2}{#3}{#4}}% \pgf@lib@dv@func@parse% -} +}% % % Executer... @@ -172,7 +172,7 @@ \pgfmathparse{\pgfmathresult/(#4-1)}% \let\pgf@lib@dv@temp=\pgfmathresult% \pgf@lib@dv@step@var{#1}{#2}{#3}{\pgf@lib@dv@temp}% -} +}% \def\pgf@lib@dv@step@var#1#2#3#4#5\pgf@stop{% {% @@ -191,19 +191,19 @@ \pgfkeyslet{/data point/#1}{\pgfmathresult}% \repeatpgfmathloop%% }% -} +}% \def\pgf@lib@dv@group@var#1#2#3\pgf@stop{% \foreach \pgf@lib@dv@iterator in {#2} {% \pgfkeyslet{/data point/#1}{\pgf@lib@dv@iterator}% #3\pgf@stop% }% -} +}% \def\pgf@lib@dv@eval@func#1#2{% \pgfkeysvalueof{/pgf/data/evaluator}{#2}% - \pgfkeyslet{/data point/#1}{\pgfmathresult}% -} + \pgfkeyslet{/data point/#1}{\pgfmathresult}% +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex index 36e51541cee..f56ebe3e7f0 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex @@ -7,35 +7,35 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex,v 1.4 2011/02/22 22:07:24 tantau Exp $ +\ProvidesFileRCS{pgflibrarydatavisualization.polar.code.tex} -\usepgfmodule{datavisualization} +\usepgfmodule{datavisualization}% % This file defines code for doing plots involving polar % coordinates. This includes not only standard polar plots, but also -% pie charts. +% pie charts. \pgfooclass{polar transformer} -{ - % Class plor mapper +{% + % Class polar mapper % % A polar mapper is used to transform attributes given as (2d) polar % coordinates to canvas coordinates. Note that no special ranges % can be specified and that the angle must be given in degrees. You % can, however, use a standard mapper to change these things. - - \attribute angle; + + \attribute angle;% % The attribute from which the angle is read. - - \attribute radius; + + \attribute radius;% % The attribute from which the radius is read. - - \attribute unit vector 0 degrees; + + \attribute unit vector 0 degrees;% % The unit vector 0 degrees - - \attribute unit vector 90 degrees; + + \attribute unit vector 90 degrees;% % The unit vector 90 degrees @@ -52,7 +52,7 @@ \pgfooset{radius}{#2} \pgfooset{unit vector 0 degrees}{#3} \pgfooset{unit vector 90 degrees}{#4} - } + }% % Method \method default connects() { @@ -60,18 +60,18 @@ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,transform,transform datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,path,path signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,direction,direction signal) - } + }% % Getters \method get angle attribute(#1) { \pgfooget{angle}{#1} - } + }% \method get radius attribute(#1) { \pgfooget{radius}{#1} - } + }% + - % Slot % % This slot should be connected to the transform datapoint @@ -105,10 +105,10 @@ \fi% \fi% \fi% - } + }% + - % Reaction to the path signal % % Here is what we do: When a pgfdvpathmoveto is done, the radius and @@ -118,9 +118,9 @@ % the lineto is caught and replaced by an arc from the previous % position to the new position. - \attribute prev angle; - \attribute prev radius; - + \attribute prev angle;% + \attribute prev radius;% + \method path(#1) {% \ifpgfdvhandled% \else% @@ -160,7 +160,7 @@ % No matter what, record the current position \pgfooeset{prev angle}{\pgfkeysvalueof{/data point/\pgfoovalueof{angle}}} \pgfooeset{prev radius}{\pgfkeysvalueof{/data point/\pgfoovalueof{radius}}} - } + }% % Method % @@ -191,10 +191,8 @@ \fi% \fi% \fi\fi% - } -} + }% +}% \endinput - - diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex index 5cf633d0c59..369a0ecbd09 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % Parameters @@ -22,12 +22,12 @@ /pgf/decoration/foot angle/.initial=10, % What animal? /pgf/decoration/foot of/.initial=human, -} +}% \pgfdeclaredecoration{footprints}{left} -{ +{% \state{left}[width=\pgfkeysvalueof{/pgf/decoration/stride length}/2,next state=right] { \pgftransformyshift{\pgfkeysvalueof{/pgf/decoration/foot sep}/2} @@ -35,7 +35,7 @@ \pgftransformscale{\pgfmathresult} \pgftransformrotate{\pgfkeysvalueof{/pgf/decoration/foot angle}} \csname pgf@lib@foot@of@\pgfkeysvalueof{/pgf/decoration/foot of}\endcsname - } + }% \state{right}[width=\pgfkeysvalueof{/pgf/decoration/stride length}/2,next state=left] { \pgftransformyscale{-1} @@ -44,23 +44,23 @@ \pgftransformscale{\pgfmathresult} \pgftransformrotate{\pgfkeysvalueof{/pgf/decoration/foot angle}} \csname pgf@lib@foot@of@\pgfkeysvalueof{/pgf/decoration/foot of}\endcsname - } -} + }% +}% -% Actual footprints. +% Actual footprints. % % A footprint must be name \pgf@lib@foot@of@XXX, be a left foot and % should fill a rectangle of (0,0) rectangle (1pt,1pt) (more or less) -% and point right. +% and point right. % \def\pgf@lib@foot@of@gnome{ % Coordinates from a Gnome logo on wikimedia commons. LGPL % license... Unknown author. - % + % % Flip and rotate \pgftransformcm{0}{-1}{-1}{0}{\pgfqpoint{1pt}{0.8pt}} \pgftransformscale{0.83333} @@ -68,23 +68,23 @@ \pgfpathcurveto{\pgfqpoint{.61466pt}{0pt}}{\pgfqpoint{.56851pt}{.35041pt}}{\pgfqpoint{.70691pt}{.35041pt}} \pgfpathcurveto{\pgfqpoint{.84529pt}{.35041pt}}{\pgfqpoint{1.10671pt}{0pt}}{\pgfqpoint{.86068pt}{0pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.45217pt}{.30699pt}} \pgfpathcurveto{\pgfqpoint{.52586pt}{.31149pt}}{\pgfqpoint{.60671pt}{.02577pt}}{\pgfqpoint{.46821pt}{.04374pt}} \pgfpathcurveto{\pgfqpoint{.32976pt}{.06171pt}}{\pgfqpoint{.37845pt}{.30249pt}}{\pgfqpoint{.45217pt}{.30699pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.11445pt}{.48453pt}} \pgfpathcurveto{\pgfqpoint{.16686pt}{.46146pt}}{\pgfqpoint{.1212pt}{.23581pt}}{\pgfqpoint{.03208pt}{.29735pt}} \pgfpathcurveto{\pgfqpoint{-.057pt}{.3589pt}}{\pgfqpoint{.06204pt}{.50759pt}}{\pgfqpoint{.11445pt}{.48453pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.26212pt}{.36642pt}} \pgfpathcurveto{\pgfqpoint{.32451pt}{.3537pt}}{\pgfqpoint{.32793pt}{.09778pt}}{\pgfqpoint{.21667pt}{.14369pt}} \pgfpathcurveto{\pgfqpoint{.10539pt}{.18961pt}}{\pgfqpoint{.19978pt}{.37916pt}}{\pgfqpoint{.26212pt}{.36642pt}} \pgfpathlineto{\pgfqpoint{.26212pt}{.36642pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.58791pt}{.93913pt}} \pgfpathcurveto{\pgfqpoint{.59898pt}{1.02367pt}}{\pgfqpoint{.52589pt}{1.06542pt}}{\pgfqpoint{.45431pt}{1.01092pt}} \pgfpathcurveto{\pgfqpoint{.22644pt}{.83743pt}}{\pgfqpoint{.8316pt}{.75088pt}}{\pgfqpoint{.79171pt}{.51386pt}} @@ -94,7 +94,7 @@ \pgfpathcurveto{\pgfqpoint{.8358pt}{.82589pt}}{\pgfqpoint{.57867pt}{.8686pt}}{\pgfqpoint{.58791pt}{.93913pt}} \pgfpathlineto{\pgfqpoint{.58791pt}{.93913pt}} \pgfpathclose -} +}% @@ -118,14 +118,14 @@ \pgfpathcurveto{\pgfqpoint{-3.4844pt}{2.9162pt}}{\pgfqpoint{-2.6164pt}{1.654pt}}{\pgfqpoint{-1.454pt}{1.3886pt}} \pgfpathcurveto{\pgfqpoint{-1.0876pt}{1.305pt}}{\pgfqpoint{-1.0296pt}{1.3066pt}}{\pgfqpoint{-.886pt}{1.652pt}} \pgfpathclose -} +}% \expandafter\def\csname pgf@lib@foot@of@felis silvestris\endcsname{ % Coordinates derived from vector image created by Mark Wibrow, based % on the forefoot of `felis silvestris' shown in % Pearson, B. and Burton, J. A. (1980), `Wild Animals', Collins, 155. - % + % \pgftransformcm{0}{.1}{.1}{0}{\pgfqpoint{.48pt}{.5pt}} \pgfpathmoveto{\pgfqpoint{2.7312pt}{-1.992pt}} \pgfpathcurveto{\pgfqpoint{1.8716pt}{-1.4226pt}}{\pgfqpoint{2.1404pt}{.0436pt}}{\pgfqpoint{.9202pt}{.0436pt}} @@ -151,30 +151,30 @@ \pgfpathcurveto{\pgfqpoint{2.8534pt}{.7868pt}}{\pgfqpoint{3.4658pt}{1.2838pt}}{\pgfqpoint{3.6872pt}{2.0152pt}} \pgfpathcurveto{\pgfqpoint{3.9084pt}{2.7466pt}}{\pgfqpoint{3.655pt}{3.4358pt}}{\pgfqpoint{3.1212pt}{3.5542pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{-.6182pt}{5.0456pt}} \pgfpathcurveto{\pgfqpoint{-1.2132pt}{5.0456pt}}{\pgfqpoint{-1.6956pt}{4.3104pt}}{\pgfqpoint{-1.6956pt}{3.4038pt}} \pgfpathcurveto{\pgfqpoint{-1.6956pt}{2.4972pt}}{\pgfqpoint{-1.2132pt}{1.7618pt}}{\pgfqpoint{-.6182pt}{1.7618pt}} \pgfpathcurveto{\pgfqpoint{-.0232pt}{1.7618pt}}{\pgfqpoint{.4592pt}{2.4972pt}}{\pgfqpoint{.4592pt}{3.4038pt}} \pgfpathcurveto{\pgfqpoint{.4592pt}{4.3104pt}}{\pgfqpoint{-.0232pt}{5.0456pt}}{\pgfqpoint{-.6182pt}{5.0456pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{-4.1176pt}{1.8248pt}} \pgfpathcurveto{\pgfqpoint{-4.6334pt}{1.7534pt}}{\pgfqpoint{-4.9806pt}{1.0312pt}}{\pgfqpoint{-4.8928pt}{.212pt}} \pgfpathcurveto{\pgfqpoint{-4.8052pt}{-.6072pt}}{\pgfqpoint{-4.3158pt}{-1.2136pt}}{\pgfqpoint{-3.8pt}{-1.1422pt}} \pgfpathcurveto{\pgfqpoint{-3.2842pt}{-1.0708pt}}{\pgfqpoint{-2.9372pt}{-.3486pt}}{\pgfqpoint{-3.0248pt}{.4706pt}} \pgfpathcurveto{\pgfqpoint{-3.1126pt}{1.2898pt}}{\pgfqpoint{-3.6018pt}{1.8962pt}}{\pgfqpoint{-4.1176pt}{1.8248pt}} \pgfpathclose -} +}% \def\pgf@lib@foot@of@human{% % Coordinates derived from vector image created by Mark Wibrow. \pgftransformcm{0}{.5}{.5}{0}{\pgfqpoint{.48pt}{.2pt}} - % + % % Draw main part of foot. - % + % \pgfpathmoveto{\pgfqpoint{.20175pt}{-.72633pt}} \pgfpathcurveto{\pgfqpoint{.16314pt}{-.88194pt}}{\pgfqpoint{.07386pt}{-1.0167pt}}{\pgfqpoint{-.08385pt}{-1.0167pt}} \pgfpathcurveto{\pgfqpoint{-.24153pt}{-1.0167pt}}{\pgfqpoint{-.36942pt}{-.84897pt}}{\pgfqpoint{-.36942pt}{-.72633pt}} @@ -189,7 +189,7 @@ \pgfpathclose % % Draw toe.s - % + % \pgfpathmoveto{\pgfqpoint{-.27138pt}{1.01451pt}} \pgfpathcurveto{\pgfqpoint{-.21198pt}{1.01451pt}}{\pgfqpoint{-.1638pt}{.94509pt}}{\pgfqpoint{-.1638pt}{.8595pt}} \pgfpathcurveto{\pgfqpoint{-.1638pt}{.77388pt}}{\pgfqpoint{-.21198pt}{.70446pt}}{\pgfqpoint{-.27138pt}{.70446pt}} @@ -210,21 +210,21 @@ \pgfpathcurveto{\pgfqpoint{.0453pt}{.66699pt}}{\pgfqpoint{.02019pt}{.70602pt}}{\pgfqpoint{.0264pt}{.74874pt}} \pgfpathcurveto{\pgfqpoint{.03261pt}{.79149pt}}{\pgfqpoint{.0678pt}{.82176pt}}{\pgfqpoint{.10497pt}{.81636pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.24054pt}{.70842pt}} \pgfpathcurveto{\pgfqpoint{.27513pt}{.70842pt}}{\pgfqpoint{.30318pt}{.67686pt}}{\pgfqpoint{.30318pt}{.63795pt}} \pgfpathcurveto{\pgfqpoint{.30318pt}{.59904pt}}{\pgfqpoint{.27513pt}{.56751pt}}{\pgfqpoint{.24054pt}{.56751pt}} \pgfpathcurveto{\pgfqpoint{.20598pt}{.56751pt}}{\pgfqpoint{.17793pt}{.59904pt}}{\pgfqpoint{.17793pt}{.63795pt}} \pgfpathcurveto{\pgfqpoint{.17793pt}{.67686pt}}{\pgfqpoint{.20598pt}{.70842pt}}{\pgfqpoint{.24054pt}{.70842pt}} \pgfpathclose - % + % \pgfpathmoveto{\pgfqpoint{.35973pt}{.57501pt}} \pgfpathcurveto{\pgfqpoint{.3918pt}{.57501pt}}{\pgfqpoint{.41781pt}{.54852pt}}{\pgfqpoint{.41781pt}{.51585pt}} \pgfpathcurveto{\pgfqpoint{.41781pt}{.48318pt}}{\pgfqpoint{.3918pt}{.45669pt}}{\pgfqpoint{.35973pt}{.45669pt}} \pgfpathcurveto{\pgfqpoint{.32769pt}{.45669pt}}{\pgfqpoint{.30168pt}{.48318pt}}{\pgfqpoint{.30168pt}{.51585pt}} \pgfpathcurveto{\pgfqpoint{.30168pt}{.54852pt}}{\pgfqpoint{.32769pt}{.57501pt}}{\pgfqpoint{.35973pt}{.57501pt}} \pgfpathclose -} +}% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex index 22c9d8d1b27..2327c770295 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex @@ -7,12 +7,12 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% \pgfdeclaredecoration{Koch curve type 1}{init} -{ +{% \state{init}[width=\pgfdecoratedinputsegmentremainingdistance] { \pgfpathlineto{\pgfpoint{.33333\pgfdecoratedinputsegmentremainingdistance}{0pt}} @@ -20,11 +20,11 @@ \pgfpathlineto{\pgfpoint{.66666\pgfdecoratedinputsegmentremainingdistance}{.33333\pgfdecoratedinputsegmentremainingdistance}} \pgfpathlineto{\pgfpoint{.66666\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} - } -} + }% +}% \pgfdeclaredecoration{Koch curve type 2}{init} -{ +{% \state{init}[width=\pgfdecoratedinputsegmentremainingdistance] { \pgfpathlineto{\pgfpoint{.25\pgfdecoratedinputsegmentremainingdistance}{0pt}} @@ -35,31 +35,31 @@ \pgfpathlineto{\pgfpoint{.75\pgfdecoratedinputsegmentremainingdistance}{-.25\pgfdecoratedinputsegmentremainingdistance}} \pgfpathlineto{\pgfpoint{.75\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} - } -} + }% +}% \pgfdeclaredecoration{Koch snowflake}{init} -{ +{% \state{init}[width=\pgfdecoratedinputsegmentremainingdistance] { \pgfpathlineto{\pgfpoint{.3333\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathlineto{\pgfpoint{.5\pgfdecoratedinputsegmentremainingdistance}{0.2886751347\pgfdecoratedinputsegmentremainingdistance}} \pgfpathlineto{\pgfpoint{.6666\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} - } -} + }% +}% \pgfdeclaredecoration{Cantor set}{init} -{ +{% \state{init}[width=\pgfdecoratedinputsegmentremainingdistance] { \pgfpathlineto{\pgfpoint{.3333\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathmoveto{\pgfpoint{.6666\pgfdecoratedinputsegmentremainingdistance}{0pt}} \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} - } -} + }% +}% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex index 546301c4d07..6a17dbe3c0a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % A marking decoration is used to add markings (which are just pgf @@ -16,37 +16,37 @@ \pgfkeys{ /pgf/decoration/reset marks/.code=\let\pgf@lib@dec@mark@marks\pgfutil@empty, /pgf/decoration/mark/.code=\pgf@lib@dec@parsemark#1\pgf@lib@dec@stop, -} +}% \let\pgf@lib@dec@mark@marks=\pgfutil@empty -\def\pgf@lib@dec@parsemark{\pgfutil@ifnextchar b{\pgf@lib@dec@parsebetween}{\pgf@lib@dec@parseat}} +\def\pgf@lib@dec@parsemark{\pgfutil@ifnextchar b{\pgf@lib@dec@parsebetween}{\pgf@lib@dec@parseat}}% \def\pgf@lib@dec@parseat at position#1with#2\pgf@lib@dec@stop{% \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@lib@dec@mark@marks% \pgf@lib@dec@domark{#1}{#2}% }% -} +}% \def\pgf@lib@dec@parsebetween between positions#1and#2step#3with#4\pgf@lib@dec@stop{% \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@lib@dec@mark@marks% \pgf@lib@dec@dobetweenmark{#1}{#2}{#3}{#4}% }% -} +}% \def\pgf@lib@dec@arrowhead#1#2{% \pgftransformxscale{#1} \pgfarrowdraw{#2}% -} +}% \def\pgf@lib@dec@doarrowhead#1{% \pgf@lib@dec@arrowhead{1}{#1}% -} +}% \def\pgf@lib@dec@doarrowheadrev#1{% \pgf@lib@dec@arrowhead{-1}{#1}% -} +}% \pgfdeclaredecoration{markings}{init} -{ +{% \state{init} [ width=0pt, @@ -56,8 +56,8 @@ }, next state=pre ] - {} - + {}% + \state{pre} [ width=0pt, @@ -69,11 +69,11 @@ }, next state=skipper ] - {} + {}% \state{skipper}[width=\pgf@lib@dec@computed@width-\pgfdecoratedcompleteddistance-1sp, - next state=\pgf@lib@dec@next@state]{} - + next state=\pgf@lib@dec@next@state]{}% + \state{main} [ width=1sp, @@ -104,15 +104,15 @@ \else% \pgfpathlineto{\pgfpointdecoratedpathlast} \fi% - } -} + }% +}% \def\pgf@lib@dec@domark#1#2#3\pgf@lib@dec@mark@last{% \def\pgf@lib@dec@mark@marks{#3}% \pgf@lib@dec@parsenum{#1}% \def\pgf@lib@dec@computed@action{#2}% \def\pgf@lib@dec@next@state{main}% -} +}% \def\pgf@lib@dec@dobetweenmark#1#2#3#4#5\pgf@lib@dec@mark@last{% @@ -124,7 +124,7 @@ % Skip! #5\pgf@lib@dec@mark@last% \else% - % + % \pgf@lib@dec@parsenum{#3}% \pgfmathparse{\pgf@lib@dec@mark@start+\pgf@lib@dec@computed@width}% % Update entry in mark list @@ -134,7 +134,7 @@ \def\pgf@lib@dec@computed@action{#4}% \def\pgf@lib@dec@next@state{main}% \fi% -} +}% \def\pgf@lib@dec@parsenum#1{% @@ -145,28 +145,28 @@ \else% \pgfmathparse{\pgfmathresult pt}% \fi% - \else% + \else% \ifdim\pgfmathresult pt<0pt\relax% \pgfmathparse{\pgfdecoratedpathlength\pgfmathresult*\pgfdecoratedpathlength}% \else% \pgfmathparse{\pgfmathresult*\pgfdecoratedpathlength}% \fi% \fi% - \edef\pgf@lib@dec@computed@width{\pgfmathresult pt}% -} + \edef\pgf@lib@dec@computed@width{\pgfmathresult pt}% +}% \def\pgf@lib@dec@mark@last{% \def\pgf@lib@dec@next@state{final}% -} +}% % % If you set the mark connection node inside a mark picture, the -% output path will contain a line to this node +% output path will contain a line to this node % \pgfkeys{/pgf/decoration/mark connection node/.store in=\pgf@lib@mark@node, - /pgf/decoration/mark connection node=} + /pgf/decoration/mark connection node=}% \def\pgf@lib@mark@connect@node{% % Line to "left" end of the node \pgfpathlineto{\pgfpointshapeborder{\pgf@lib@mark@node}{\pgfqpoint{-1pt}{0pt}}} @@ -175,4 +175,4 @@ }% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex index a6052489796..3f628da582d 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex @@ -7,12 +7,12 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % % These decorations "morph" paths. That means that the -% orginal characteristic of the path is kept and the number of +% original characteristic of the path is kept and the number of % subpaths remains the same -- only, the lines are slightly offset or % changed by the decoration. For instance a line might be turned into % a squiggly line or a snaking line or a bumping line. @@ -28,31 +28,31 @@ % zigzag decoration. % -\pgfdeclaredecoration{zigzag}{up from center}{ +\pgfdeclaredecoration{zigzag}{up from center}{% \state{up from center}[width=+.5\pgfdecorationsegmentlength, next state=big down] { \pgfpathlineto{\pgfqpoint{.25\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} - } + }% \state{big down}[switch if less than=+.5\pgfdecorationsegmentlength to center finish, width=+.5\pgfdecorationsegmentlength, next state=big up] { \pgfpathlineto{\pgfqpoint{.25\pgfdecorationsegmentlength}{-\pgfdecorationsegmentamplitude}} - } + }% \state{big up}[switch if less than=+.5\pgfdecorationsegmentlength to center finish, width=+.5\pgfdecorationsegmentlength, next state=big down] { \pgfpathlineto{\pgfqpoint{.25\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} - } + }% \state{center finish}[width=0pt, next state=final]{ \pgfpathlineto{\pgfpointorigin} - } + }% \state{final} { \pgfpathlineto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -62,17 +62,17 @@ % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength \pgfdeclaredecoration{saw}{initial} -{ +{% \state{initial}[auto end on length=+\pgfdecorationsegmentlength, auto corner on length=+\pgfdecorationsegmentlength, width=+\pgfdecorationsegmentlength] { \pgfpathlineto{\pgfqpoint{\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} \pgfpathlineto{\pgfqpoint{\pgfdecorationsegmentlength}{0pt}} - } + }% \state{final} - {} -} + {}% +}% @@ -84,10 +84,10 @@ % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength \pgfdeclaredecoration{random steps}{start} -{ - \state{start}[width=+0pt,next state=step,persistent precomputation=\pgfdecoratepathhascornerstrue]{} +{% + \state{start}[width=+0pt,next state=step,persistent precomputation=\pgfdecoratepathhascornerstrue]{}% \state{step}[auto end on length=1.5\pgfdecorationsegmentlength, - auto corner on length=1.5\pgfdecorationsegmentlength, + auto corner on length=1.5\pgfdecorationsegmentlength, width=+\pgfdecorationsegmentlength] { \pgfpathlineto{ @@ -95,29 +95,29 @@ {\pgfpoint{\pgfdecorationsegmentlength}{0pt}} {\pgfpoint{rand*\pgfdecorationsegmentamplitude}{rand*\pgfdecorationsegmentamplitude}} } - } + }% \state{final} - {} -} + {}% +}% % Meta-decoration line zigzag -\pgfdeclaremetadecoration{straight zigzag}{line to}{ +\pgfdeclaremetadecoration{straight zigzag}{line to}{% \state{line to}[width=\pgfmetadecorationsegmentlength, next state=zigzag] { \decoration{curveto} - } + }% \state{zigzag}[width=\pgfmetadecorationsegmentlength, next state=line to] { \decoration{zigzag} - } + }% \state{final} { \decoration{curveto} - } -} + }% +}% @@ -138,7 +138,7 @@ % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentaspect \pgfdeclaredecoration{bent}{bent} -{ +{% \state{bent}[width=+\pgfdecoratedinputsegmentremainingdistance] { \pgfpathcurveto @@ -146,44 +146,44 @@ {\pgfpointadd{\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} {\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}{\pgfdecorationsegmentamplitude}}} {\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}} - } + }% \state{final} - {} -} + {}% +}% % decoration snake % -% This decoration produces a hopefully optically pleasing squiggly snake. +% This decoration produces a hopefully optically pleasing squiggly snake. % % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength \pgfdeclaredecoration{snake}{initial} -{ +{% \state{initial}[switch if less than=+.625\pgfdecorationsegmentlength to final, width=+.3125\pgfdecorationsegmentlength, next state=down] - { + { \pgfpathcurveto {\pgfqpoint{.125\pgfdecorationsegmentlength}{0pt}} {\pgfqpoint{.1875\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} {\pgfqpoint{.3125\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} - } + }% \state{down}[switch if less than=+.8125\pgfdecorationsegmentlength to end down, width=+.5\pgfdecorationsegmentlength, next state=up] { \pgfpathcosine{\pgfqpoint{.25\pgfdecorationsegmentlength}{-1\pgfdecorationsegmentamplitude}} \pgfpathsine{\pgfqpoint{.25\pgfdecorationsegmentlength}{-1\pgfdecorationsegmentamplitude}} - } + }% \state{up}[switch if less than=+.8125\pgfdecorationsegmentlength to end up, width=+.5\pgfdecorationsegmentlength, next state=down] { \pgfpathcosine{\pgfqpoint{.25\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} \pgfpathsine{\pgfqpoint{.25\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} - } + }% \state{end down}[width=+.3125\pgfdecorationsegmentlength, next state=final] { @@ -191,7 +191,7 @@ {\pgfqpoint{.125\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} {\pgfqpoint{.1875\pgfdecorationsegmentlength}{0pt}} {\pgfqpoint{.3125\pgfdecorationsegmentlength}{0pt}} - } + }% \state{end up}[width=+.3125\pgfdecorationsegmentlength, next state=final] { @@ -199,12 +199,12 @@ {\pgfqpoint{.125\pgfdecorationsegmentlength}{-\pgfdecorationsegmentamplitude}} {\pgfqpoint{.1875\pgfdecorationsegmentlength}{0pt}} {\pgfqpoint{.3125\pgfdecorationsegmentlength}{0pt}} - } + }% \state{final} { \pgfpathlineto{\pgfpointdecoratedpathlast} - } -} + }% +}% % coil decoration @@ -212,7 +212,7 @@ % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength, \pgfdeclaredecoration{coil}{coil} -{ +{% \state{coil}[switch if less than=% 1.5\pgfdecorationsegmentlength+% \pgfdecorationsegmentaspect\pgfdecorationsegmentamplitude+% @@ -235,7 +235,7 @@ {\pgfpoint@oncoil{0.445}{-1 }{10}} {\pgfpoint@oncoil{0 }{-0.555}{11}} {\pgfpoint@oncoil{0 }{ 0 }{12}} - } + }% \state{last}[width=.5\pgfdecorationsegmentlength+% \pgfdecorationsegmentaspect\pgfdecorationsegmentamplitude+% \pgfdecorationsegmentaspect\pgfdecorationsegmentamplitude,next state=final] @@ -248,12 +248,12 @@ {\pgfpoint@oncoil{1.555}{ 1 }{4}} {\pgfpoint@oncoil{2 }{ 0.555}{5}} {\pgfpoint@oncoil{2 }{ 0 }{6}} - } + }% \state{final} { \pgfpathlineto{\pgfpointdecoratedpathlast} - } -} + }% +}% \def\pgfpoint@oncoil#1#2#3{% \pgf@x=#1\pgfdecorationsegmentamplitude% @@ -261,7 +261,7 @@ \pgf@y=#2\pgfdecorationsegmentamplitude% \pgf@xa=0.083333333333\pgfdecorationsegmentlength% \advance\pgf@x by#3\pgf@xa% -} +}% % bumps decoration @@ -269,7 +269,7 @@ % Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength \pgfdeclaredecoration{bumps}{initial} -{ +{% \state{initial}[auto end on length=+.51\pgfdecorationsegmentlength, auto corner on length=+.51\pgfdecorationsegmentlength, width=+.5\pgfdecorationsegmentlength] @@ -282,18 +282,13 @@ {\pgfqpoint{.38875\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentlength}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentlength}{0\pgfdecorationsegmentamplitude}} - } + }% \state{final} { \pgfpathlineto{\pgfpointdecoratedpathlast} - } -} - - - - - + }% +}% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex index e618ac996cf..10f8371c470 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % @@ -34,19 +34,19 @@ % Parameters: \pgfdecorationsegmentlength, \pgfdecorationsegmentamplitude \pgfdeclaredecoration{ticks}{ticks} -{ +{% \state{ticks}[width=+\pgfdecorationsegmentlength] { \pgfpathmoveto{\pgfqpoint{0pt}{\pgfdecorationsegmentamplitude}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgfdecorationsegmentamplitude}} - } + }% \state{final} { \pgfpathmoveto{\pgfqpoint{0pt}{\pgfdecorationsegmentamplitude}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgfdecorationsegmentamplitude}} \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -55,9 +55,9 @@ % Parameters: \pgfdecorationsegmentangle, \pgfdecorationsegmentlength \pgfdeclaredecoration{expanding waves}{initial} -{ +{% \state{initial}[width=+\pgfdecorationsegmentlength,next state=wave] - {} + {}% \state{wave}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] @@ -67,7 +67,7 @@ {\pgfqpoint{-\pgfdecoratedcompleteddistance}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}% - } + }% \state{last}[width=+0pt,next state=final] { \pgfpathmoveto{ @@ -75,19 +75,19 @@ {\pgfqpoint{-\pgfdecoratedcompleteddistance}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}% - } + }% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% % waves decoration \pgfdeclaredecoration{waves}{wave} -{ +{% \state{wave}[width=\pgfdecorationsegmentlength] { \pgftransformxshift{+\pgfdecorationsegmentlength} @@ -96,12 +96,12 @@ {\pgfqpoint{-\pgfkeysvalueof{/pgf/decoration/start radius}}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}% - } + }% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -110,23 +110,23 @@ % Parameters: \pgfdecorationsegmentlength, \pgfdecorationsegmentamplitude, \pgfdecorationsegmentangle \pgfdeclaredecoration{border}{tick} -{ +{% \state{tick}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecorationsegmentamplitude}} - } + }% \state{last}[width=+\pgfdecorationsegmentamplitude,next state=final] { \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecorationsegmentamplitude}} - } + }% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -138,78 +138,91 @@ % Parameters: \pgfdecorationsegmentamplitude \pgfdeclaredecoration{brace}{brace} -{ +{% \state{brace}[width=+\pgfdecoratedremainingdistance,next state=final] { + \pgf@yc=\pgfdecorationsegmentaspect\pgfdecoratedremainingdistance + \ifdim2\pgfdecorationsegmentamplitude>\pgf@yc + \pgf@yc=0.5\pgf@yc + \else + \pgf@yc=\pgfdecorationsegmentamplitude + \fi + \pgf@xc=\pgfdecorationsegmentaspect\pgfdecoratedremainingdistance + \advance\pgf@xc-\pgfdecoratedremainingdistance + \ifdim-2\pgfdecorationsegmentamplitude<\pgf@xc + \pgf@xc=-0.5\pgf@xc + \else + \pgf@xc=\pgfdecorationsegmentamplitude + \fi \pgfpathmoveto{\pgfpointorigin} \pgfpathcurveto - {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} - {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} - {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{.15\pgf@yc}{.3\pgfdecorationsegmentamplitude}} + {\pgfqpoint{.5\pgf@yc}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{\pgf@yc}{.5\pgfdecorationsegmentamplitude}} { \pgftransformxshift{+\pgfdecorationsegmentaspect\pgfdecoratedremainingdistance} - \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} + \pgfpathlineto{\pgfqpoint{-\pgf@yc}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto - {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} - {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} - {\pgfqpoint{0\pgfdecorationsegmentamplitude}{1\pgfdecorationsegmentamplitude}} + {\pgfqpoint{-.5\pgf@yc}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{-.15\pgf@yc}{.7\pgfdecorationsegmentamplitude}} + {\pgfqpoint{0\pgf@yc}{1\pgfdecorationsegmentamplitude}} \pgfpathcurveto - {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} - {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} - {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{.15\pgf@xc}{.7\pgfdecorationsegmentamplitude}} + {\pgfqpoint{.5\pgf@xc}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{\pgf@xc}{.5\pgfdecorationsegmentamplitude}} } { \pgftransformxshift{+\pgfdecoratedremainingdistance} - \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} + \pgfpathlineto{\pgfqpoint{-\pgf@xc}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto - {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} - {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} + {\pgfqpoint{-.5\pgf@xc}{.5\pgfdecorationsegmentamplitude}} + {\pgfqpoint{-.15\pgf@xc}{.3\pgfdecorationsegmentamplitude}} {\pgfqpoint{0pt}{0pt}} } - } + }% \state{final} - {} -} + {}% +}% % show path construction decoration % -\pgfdeclaredecoration{show path construction}{check for moveto}{ - \state{check for moveto}[width=0pt, next state=segment, - persistent precomputation={% - \begingroup% - \pgf@lib@decoraions@installinputsegmentpoints% - \ifx\pgfdecorationpreviousinputsegment\pgfdecorationinputsegmentmoveto% - \pgfdecoratedinputsegmentmovetocode% - \fi% - \endgroup% - }]{} - \state{segment}[width=\pgfdecoratedinputsegmentremainingdistance, next state=check for moveto, - persistent precomputation={% - \begingroup% - \pgf@lib@decoraions@installinputsegmentpoints% - \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname% - \endgroup% - }]{} - \state{final}{% - \egroup% - \begingroup% - \pgf@lib@decoraions@installinputsegmentpoints% - \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname% - \endgroup% - \bgroup% - } -} +\pgfdeclaredecoration{show path construction}{check for moveto}{% + \state{check for moveto}[width=0pt, next state=segment, + persistent precomputation={% + \begingroup% + \pgf@lib@decoraions@installinputsegmentpoints% + \ifx\pgfdecorationpreviousinputsegment\pgfdecorationinputsegmentmoveto% + \pgfdecoratedinputsegmentmovetocode% + \fi% + \endgroup% + }]{}% + \state{segment}[width=\pgfdecoratedinputsegmentremainingdistance, next state=check for moveto, + persistent precomputation={% + \begingroup% + \pgf@lib@decoraions@installinputsegmentpoints% + \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname% + \endgroup% + }]{}% + \state{final}{% + \egroup% + \begingroup% + \pgf@lib@decoraions@installinputsegmentpoints% + \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname% + \endgroup% + \bgroup% + }% +}% \pgfkeys{ - /pgf/decoration/.cd, - moveto code/.code=\def\pgfdecoratedinputsegmentmovetocode{#1}, - lineto code/.code=\def\pgfdecoratedinputsegmentlinetocode{#1}, - curveto code/.code=\def\pgfdecoratedinputsegmentcurvetocode{#1}, - closepath code/.code=\def\pgfdecoratedinputsegmentclosepathcode{#1} -} + /pgf/decoration/.cd, + moveto code/.code=\def\pgfdecoratedinputsegmentmovetocode{#1}, + lineto code/.code=\def\pgfdecoratedinputsegmentlinetocode{#1}, + curveto code/.code=\def\pgfdecoratedinputsegmentcurvetocode{#1}, + closepath code/.code=\def\pgfdecoratedinputsegmentclosepathcode{#1} +}% \let\pgfdecoratedinputsegmentmovetocode\pgfutil@empty% \let\pgfdecoratedinputsegmentlinetocode\pgfutil@empty% @@ -217,11 +230,11 @@ \let\pgfdecoratedinputsegmentclosepathcode\pgfutil@empty% \def\pgf@lib@decoraions@installinputsegmentpoints{% - \let\pgfpointdecoratedinputsegmentfirst\pgf@decorate@inputsegment@first% - \let\pgfpointdecoratedinputsegmentlast\pgf@decorate@inputsegment@last% - \let\pgfpointdecoratedinputsegmentsupporta\pgf@decorate@inputsegment@supporta% - \let\pgfpointdecoratedinputsegmentsupportb\pgf@decorate@inputsegment@supportb% -} + \let\pgfpointdecoratedinputsegmentfirst\pgf@decorate@inputsegment@first% + \let\pgfpointdecoratedinputsegmentlast\pgf@decorate@inputsegment@last% + \let\pgfpointdecoratedinputsegmentsupporta\pgf@decorate@inputsegment@supporta% + \let\pgfpointdecoratedinputsegmentsupportb\pgf@decorate@inputsegment@supportb% +}% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex index 8cf75a739bd..6b1571518b6 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % Options for shape decorations @@ -44,9 +44,9 @@ shape start height=#1, shape end height=#1 } -} +}% -\def\pgf@lib@shapedecoration@sep{.25cm, between centers} +\def\pgf@lib@shapedecoration@sep{.25cm, between centers}% \newif\ifpgfshapedecorationsloped \pgfshapedecorationslopedtrue \newif\ifpgfshapedecorationscaled @@ -57,13 +57,13 @@ % triangle decoration \pgfdeclaredecoration{triangles}{init} -{ +{% \state{init}[width=+0pt,next state=triangle,persistent precomputation={ \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start width}} \edef\pgf@lib@dec@ssw{\pgfmathresult pt} \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start height}/2} \edef\pgf@lib@dec@ssh{\pgfmathresult pt} - }]{} + }]{}% \state{triangle}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { @@ -71,7 +71,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{0pt}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@lib@dec@ssh}} \pgfpathclose - } + }% \state{last}[switch if less than=\pgf@lib@dec@ssw to skip, width=\pgfdecoratedremainingdistance,next state=final] { @@ -79,14 +79,14 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{0pt}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@lib@dec@ssh}} \pgfpathclose - } + }% \state{skip}[width=\pgfdecoratedremainingdistance] - {} + {}% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -94,13 +94,13 @@ % crosses decoration \pgfdeclaredecoration{crosses}{init} -{ +{% \state{init}[width=+0pt,next state=crosses,persistent precomputation={ \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start width}/2} \edef\pgf@lib@dec@ssw{\pgfmathresult pt} \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start height}/2} \edef\pgf@lib@dec@ssh{\pgfmathresult pt} - }]{} + }]{}% \state{crosses}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { @@ -108,18 +108,18 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} - } + }% \state{last}[width=+\pgfdecoratedremainingdistance] { \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} - } + }% \state{final}{ \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -128,14 +128,14 @@ % The shape background decoration % -% The shape background decoration adds repeated instances of +% The shape background decoration adds repeated instances of % the background path of a specified shape along the path. The shape % must have been declared by \pgfdeclareshape. If a shape has % specialized keys (e.g. the number of points on a star, or the apex -% angle the isosceles triangle), these can be specified in the usual manner. +% angle the isosceles triangle), these can be specified in the usual manner. % -% The sepatation between shapes in the path can be specified and can -% be between the center of the shape or the border of the shape. +% The separation between shapes in the path can be specified and can +% be between the center of the shape or the border of the shape. % % The height and width of the shape can be independently or % simultaneously scaled (linearly) along the path. It is also @@ -148,52 +148,52 @@ \edef\pgf@lib@shapedecoration@initialise{0pt}% \pgfdeclaredecoration{shape backgrounds}{initialise} -{ +{% \state{initialise} [ width=+\pgf@lib@shapedecoration@initialise, next state=shape, persistent precomputation= { - % + % % \egroup ends the group started by the automaton before executing - % a decoration state. This prevents the need for (most) \global variables. - % - % + % a decoration state. This prevents the need for (most) \global variables. + % + % % Check the shape exists. - % + % \pgfutil@ifundefined{pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}}{% \pgferror{I do not know the shape `\pgfkeysvalueof{/pgf/decoration/shape}', - so I cannot use it in a decoration. Check if its library been loaded or if you + so I cannot use it in a decoration. Check if its library been loaded or if you simply mistyped the name}}{}% - % + % % Calculate a `default' path size. - % + % \pgfinterruptpath% \pgfinterruptboundingbox% \pgftransformreset% \pgf@relevantforpicturesizetrue% - % + % % This size of this shape is unimportant, but it should % be just large/small enough to avoid huge errors when - % calculting the scaling factors later on. - % + % calculating the scaling factors later on. + % \pgfkeys{/pgf/inner sep=50pt, /pgf/minimum size=1pt}% Arbitrary lengths. \setbox\pgfnodeparttextbox\hbox{}% Assume shape does nothing special if box is empty. - \let\pgf@sh@savedmacros\pgfutil@empty% + \let\pgf@sh@savedmacros\pgfutil@empty% \let\pgf@sh@savedpoints\pgfutil@empty% \csname pgf@sh@s@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% \pgf@sh@savedpoints% \pgf@sh@savedmacros% - % - % Save the macros and pionts. - % + % + % Save the macros and points. + % \expandafter\gdef\expandafter\pgf@lib@shapedecoration@points\expandafter{\pgf@sh@savedpoints}% \expandafter\gdef\expandafter\pgf@lib@shapedecoration@macros\expandafter{\pgf@sh@savedmacros}% - \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% - % + \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% + % % Save the dimensions of the shape path. - % + % \pgf@x\pgf@picmaxx% \pgf@y\pgf@picmaxy% \advance\pgf@x-\pgf@picminx% @@ -204,52 +204,52 @@ }% \endpgfinterruptboundingbox% \endpgfinterruptpath% - % + % \edef\pgf@lib@shapedecoration@beforeshape{0pt}% \edef\pgf@lib@shapedecoration@aftershape{0pt}% - % + % \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape start width}}% \edef\pgf@lib@shapedecoration@startwidth{\the\pgf@x}% \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% \pgf@x-\pgf@x% \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape end width}}% \edef\pgf@lib@shapedecoration@widthchange{\the\pgf@x}% - % + % \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/decoration/shape start height}}% \edef\pgf@lib@shapedecoration@initialheight{\the\pgf@y}% \edef\pgf@lib@shapedecoration@height{\the\pgf@y}% \pgf@y-\pgf@y% \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/decoration/shape end height}}% \edef\pgf@lib@shapedecoration@heightchange{\the\pgf@y}% - % + % % Calculate the sep. - % + % \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% - % + % % Not spreading, so easy: - % + % \def\pgf@lib@shapedecoration@borderstext{between borders}% \afterassignment\pgf@lib@shapedecoration@setkeyword% \expandafter\pgf@x\pgf@lib@shapedecoration@sep,\pgf@stop% \edef\pgf@lib@shapedecoration@sep{\the\pgf@x}% \else% - % + % % Spreading (a bit of a nuiscence actually). - % + % \def\pgf@lib@shapedecoration@borderstext{by borders}% \afterassignment\pgf@lib@shapedecoration@setkeyword% \expandafter\c@pgf@counta\pgf@lib@shapedecoration@spread,\pgf@stop% \ifpgf@lib@shapedecoration@betweenborders% - % + % % Ok. The required sep between borders is: - % + % % (r -(n-1)((a+b)/2))/(n-1) - % + % % r = decoration length (here, the remaining distance) % a = initial width % b = end width % n = the number of shapes - % + % \ifnum\c@pgf@counta>1\relax% \advance\c@pgf@counta-1\relax% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape start width}}% @@ -263,11 +263,11 @@ \advance\pgf@x\pgfdecoratedremainingdistance% \divide\pgf@x\c@pgf@counta% \pgf@x.9999\pgf@x% Hackery to control some native TeX inaccuracies. - % + % % Unfortunately if the shape is scaled, and evenly spread by borders, - % it is necessary to do something a bit different to control for + % it is necessary to do something a bit different to control for % (most) inaccuracies. - % + % \ifpgfshapedecorationscaled% \pgf@xa\pgf@lib@shapedecoration@widthchange\relax% \divide\pgf@xa\c@pgf@counta% @@ -285,9 +285,9 @@ \fi% \fi% \else% - % + % % Between centers. - % + % \pgf@x\pgfdecoratedremainingdistance% \ifnum\c@pgf@counta>1\relax% \advance\c@pgf@counta-1\relax% @@ -305,7 +305,7 @@ \edef\pgf@lib@shapedecoration@sep{\the\pgf@x}% \fi% }] - {} + {}% \state{before shape} [ width=\pgf@lib@shapedecoration@beforeshape-1sp, @@ -315,50 +315,50 @@ \ifpgfshapedecorationscaled% \ifpgf@lib@shapedecoration@betweenborders% \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% - % + % % Not so straightforward. The required ratio is given by - % + % % R = (c+W/2)/(c+r-.5*w) - % + % % c = completed distance % r = remaining distance % W = initial width % w = the change in width (i.e., end - start) - % + % \pgf@x\pgfdecoratedcompleteddistance% \advance\pgf@x\pgfdecoratedremainingdistance% \pgf@xa\pgf@lib@shapedecoration@startwidth\relax% \pgf@xa.5\pgf@xa% \advance\pgf@xa\pgfdecoratedcompleteddistance% c+W/2 - % + % \pgf@xb\pgf@lib@shapedecoration@widthchange\relax% \pgf@xb-.5\pgf@xb% \advance\pgf@xb\pgf@x% c+r-.5*w - % + % \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@xb}}% \fi% \else% - % - % Easy peasy. The required ratio is - % + % + % Easy peasy. The required ratio is + % % R = c / (c+r) - % + % \pgf@y\pgfdecoratedcompleteddistance% \advance\pgf@y\pgfdecoratedremainingdistance% \pgfmathdivide@{\pgfmath@tonumber{\pgfdecoratedcompleteddistance}}{\pgfmath@tonumber{\pgf@y}}% \fi% - % + % % Get the new width. - % + % \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% \pgf@x\pgf@lib@shapedecoration@widthchange\relax% \pgf@x\pgfmathresult\pgf@x% \advance\pgf@x\pgf@lib@shapedecoration@startwidth\relax% \else% \ifpgf@lib@shapedecoration@betweenborders% - % - % Specical case when decoration is scaled, and evenly spread by borders. - % + % + % Special case when decoration is scaled, and evenly spread by borders. + % \pgf@x\pgf@lib@shapedecoration@width\relax% \advance\pgf@x\pgf@lib@shapedecoration@specialwidth\relax% \pgf@xa\pgf@x% @@ -372,15 +372,15 @@ \fi% \fi% \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% - % + % % New height = R*h + H - % + % \pgf@y\pgf@lib@shapedecoration@heightchange\relax% \pgf@y\pgfmathresult\pgf@y% \advance\pgf@y\pgf@lib@shapedecoration@initialheight\relax% \edef\pgf@lib@shapedecoration@height{\the\pgf@y}% \fi% - % + % \ifpgf@lib@shapedecoration@betweenborders% \pgf@x\pgf@lib@shapedecoration@width\relax% \pgf@x.5\pgf@x% @@ -389,16 +389,16 @@ \def\pgf@lib@shapedecoration@beforeshape{0pt}% \fi% }] - {} + {}% \state{shape}[width=+0sp,next state=after shape] { \ifpgfshapedecorationsloped% \else% \pgftransformrotate{-\pgfdecoratedangle}% \fi% - % + % % Scale the path when it is actually drawn. - % + % \pgf@lib@shapedecoration@shapepathsize% \pgfutil@tempdima\pgf@x% \pgfutil@tempdimb\pgf@y% @@ -406,14 +406,14 @@ \pgf@xb\pgfutil@tempdima% \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@xb}}% \expandafter\pgftransformxscale\expandafter{\pgfmathresult}% - % + % \pgf@ya\pgf@lib@shapedecoration@height\relax% \pgf@yb\pgfutil@tempdimb% \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@yb}}% \expandafter\pgftransformyscale\expandafter{\pgfmathresult}% - % + % % Move to the center anchor. - % + % \pgf@lib@shapedecoration@points% \pgf@lib@shapedecoration@macros% \pgftransformshift{% @@ -421,11 +421,11 @@ \pgf@x-\pgf@x% \pgf@y-\pgf@y% }% - % + % % And draw the shape path. - % + % \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% - } + }% \state{after shape} [ width=\pgf@lib@shapedecoration@aftershape-1sp, @@ -441,28 +441,28 @@ \fi% } ] - {} + {}% \state{sep}[width=\pgf@lib@shapedecoration@sep,next state=before shape, persistent precomputation=\def\pgf@lib@shapedecoration@beforeshape{0pt}] - {} + {}% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast}% - } -} + }% +}% \def\pgf@lib@shapedecoration@setkeyword,{% \pgfutil@ifnextchar\pgf@stop{\def\pgf@temp{}\pgf@lib@@@shapedecoration@setkeyword}{\pgf@lib@@shapedecoration@setkeyword}% -} -\def\pgf@lib@@shapedecoration@setkeyword#1,{\def\pgf@temp{#1}\pgf@lib@@@shapedecoration@setkeyword} +}% +\def\pgf@lib@@shapedecoration@setkeyword#1,{\def\pgf@temp{#1}\pgf@lib@@@shapedecoration@setkeyword}% \def\pgf@lib@@@shapedecoration@setkeyword\pgf@stop{% \ifx\pgf@temp\pgf@lib@shapedecoration@borderstext% \pgf@lib@shapedecoration@betweenborderstrue% \else% \pgf@lib@shapedecoration@betweenbordersfalse% \fi% -} +}% -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex index b13f3ce0199..4d31c46fcfc 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex @@ -7,138 +7,141 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % Options for text decorations \pgfkeys{ - /pgf/decoration/.cd, - text/.store in=\pgfdecorationtext,% - text color/.store in=\pgf@lib@decorationtextcolor,% - text format delimiters/.code={\expandafter\pgfsetdecoratetextformatdelimiters#1}, - text align/.code={\pgfkeys{/pgf/decoration/text align/.cd,#1}}, - text align/.cd, - align/.initial=left, - left/.style={/pgf/decoration/text align/align=left}, - right/.style={/pgf/decoration/text align/align=right}, - center/.style={/pgf/decoration/text align/align=center}, - left indent/.initial=0pt, - right indent/.initial=0pt, - fit to path/.is if=pgf@lib@dec@text@fit, - fit to path stretching spaces/.default=true, - fit to path stretching spaces/.code={% - \csname pgf@lib@dec@text@fit#1\endcsname% - \csname pgf@lib@dec@text@stretch@spaces#1\endcsname% - }% -} + /pgf/decoration/.cd, + text/.store in=\pgfdecorationtext,% + text color/.store in=\pgf@lib@decorationtextcolor,% + text format delimiters/.code={\expandafter\pgfsetdecoratetextformatdelimiters#1}, + text align/.code={\pgfkeys{/pgf/decoration/text align/.cd,#1}}, + text align/.cd, + align/.initial=left, + left/.style={/pgf/decoration/text align/align=left}, + right/.style={/pgf/decoration/text align/align=right}, + center/.style={/pgf/decoration/text align/align=center}, + left indent/.initial=0pt, + right indent/.initial=0pt, + fit to path/.is if=pgf@lib@dec@text@fit, + fit to path stretching spaces/.default=true, + fit to path stretching spaces/.code={% + \csname pgf@lib@dec@text@fit#1\endcsname% + \csname pgf@lib@dec@text@stretch@spaces#1\endcsname% + }% +}% \newif\ifpgf@lib@dec@text@scan@space \newif\ifpgf@lib@dec@text@stretch@spaces \newif\ifpgf@lib@dec@text@fit -\def\pgf@lib@decorationtextcolor{black} +\def\pgf@lib@decorationtextcolor{black}% -\def\pgf@lib@dec@text@left@text{left} -\def\pgf@lib@dec@text@right@text{right} -\def\pgf@lib@dec@text@right@center{center} +\def\pgf@lib@dec@text@left@text{left}% +\def\pgf@lib@dec@text@right@text{right}% +\def\pgf@lib@dec@text@right@center{center}% % Decorates a path with a text. The path is removed during this % process -\pgfdeclaredecoration{text along path}{initial}{ -\state{initial}[width=+0pt, next state=left indent, - persistent precomputation={% - \edef\pgf@lib@dec@text@indent@left{\pgfkeysvalueof{/pgf/decoration/text align/left indent}}% - \edef\pgf@lib@dec@text@indent@right{\pgfkeysvalueof{/pgf/decoration/text align/right indent}}% - \edef\pgf@lib@dec@text@align{\pgfkeysvalueof{/pgf/decoration/text align/align}}% - \pgfdecoratedremainingdistance=\pgfdecoratedpathlength% - \advance\pgfdecoratedremainingdistance by-\pgf@lib@dec@text@indent@right\relax% - \edef\pgfdecoratedpathlength{\the\pgfdecoratedremainingdistance}% - \pgf@lib@dec@text@getwidth% - \pgf@x=\pgf@lib@dec@text@width\relax% - \pgf@y=\pgfdecoratedremainingdistance% - \ifpgf@lib@dec@text@fit% - \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax% - \advance\pgf@y by-\pgf@x% - \ifpgf@lib@dec@text@stretch@spaces% - \def\pgf@lib@dec@text@character@shift{0pt}% - \divide\pgf@y by\pgf@lib@dec@space@count\relax% - \edef\pgf@lib@dec@text@space@shift{\the\pgf@y}% - \else% - \c@pgf@counta=\pgf@lib@dec@character@count\relax% - \advance\c@pgf@counta by-1\relax% - \divide\pgf@y by\c@pgf@counta\relax% - \edef\pgf@lib@dec@text@character@shift{\the\pgf@y}% - \def\pgf@lib@dec@text@space@shift{0pt}% - \fi% - \ifdim\pgf@y<0pt\relax% - \pgf@lib@dec@text@fitfalse% - \pgf@lib@dec@text@stretch@spacesfalse% - \def\pgf@lib@dec@text@character@shift{0pt}% - \def\pgf@lib@dec@text@space@shift{0pt}% - \fi% - \else% - \def\pgf@lib@dec@text@character@shift{0pt}% - \def\pgf@lib@dec@text@space@shift{0pt}% - \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@left@text% - \else% - \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@right@text% - \advance\pgf@y by-\pgf@x% - \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}% - \else% - \advance\pgf@y by-\pgf@x% - \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax% - \pgf@y=0.5\pgf@y% - \advance\pgf@y by\pgf@lib@dec@text@indent@left\relax% - \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}% - \fi% - \fi% - \fi% - \let\pgfdecorationrestoftext=\pgfdecorationtext% - }]{} -\state{left indent}[width=+\pgf@lib@dec@text@indent@left, next state=scan]{} +\pgfdeclaredecoration{text along path}{initial}{% + \state{initial}[ + width=+0pt, next state=left indent, + persistent precomputation={% + \edef\pgf@lib@dec@text@indent@left{\pgfkeysvalueof{/pgf/decoration/text align/left indent}}% + \edef\pgf@lib@dec@text@indent@right{\pgfkeysvalueof{/pgf/decoration/text align/right indent}}% + \edef\pgf@lib@dec@text@align{\pgfkeysvalueof{/pgf/decoration/text align/align}}% + \pgfdecoratedremainingdistance=\pgfdecoratedpathlength% + \advance\pgfdecoratedremainingdistance by-\pgf@lib@dec@text@indent@right\relax% + \edef\pgfdecoratedpathlength{\the\pgfdecoratedremainingdistance}% + \pgf@lib@dec@text@getwidth% + \pgf@x=\pgf@lib@dec@text@width\relax% + \pgf@y=\pgfdecoratedremainingdistance% + \ifpgf@lib@dec@text@fit% + \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax% + \advance\pgf@y by-\pgf@x% + \ifpgf@lib@dec@text@stretch@spaces% + \def\pgf@lib@dec@text@character@shift{0pt}% + \divide\pgf@y by\pgf@lib@dec@space@count\relax% + \edef\pgf@lib@dec@text@space@shift{\the\pgf@y}% + \else% + \c@pgf@counta=\pgf@lib@dec@character@count\relax% + \advance\c@pgf@counta by-1\relax% + \divide\pgf@y by\c@pgf@counta\relax% + \edef\pgf@lib@dec@text@character@shift{\the\pgf@y}% + \def\pgf@lib@dec@text@space@shift{0pt}% + \fi% + \ifdim\pgf@y<0pt\relax% + \pgf@lib@dec@text@fitfalse% + \pgf@lib@dec@text@stretch@spacesfalse% + \def\pgf@lib@dec@text@character@shift{0pt}% + \def\pgf@lib@dec@text@space@shift{0pt}% + \fi% + \else% + \def\pgf@lib@dec@text@character@shift{0pt}% + \def\pgf@lib@dec@text@space@shift{0pt}% + \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@left@text% + \else% + \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@right@text% + \advance\pgf@y by-\pgf@x% + \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}% + \else% + \advance\pgf@y by-\pgf@x% + \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax% + \pgf@y=0.5\pgf@y% + \advance\pgf@y by\pgf@lib@dec@text@indent@left\relax% + \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}% + \fi% + \fi% + \fi% + \let\pgfdecorationrestoftext=\pgfdecorationtext% + }]{}% +\state{left indent}[width=+\pgf@lib@dec@text@indent@left, next state=scan]{}% % -\state{scan}[width=+0pt, next state=before typeset, - persistent precomputation={ - \pgf@lib@dec@text@scanchar% - \ifvoid\pgf@lib@dec@text@box% - \setbox\pgf@lib@dec@text@box\hbox{}% - \wd\pgf@lib@dec@text@box16383pt\relax% - \fi% - }]{} +\state{scan}[ + width=+0pt, + next state=before typeset, + persistent precomputation={ + \pgf@lib@dec@text@scanchar% + \ifvoid\pgf@lib@dec@text@box% + \setbox\pgf@lib@dec@text@box\hbox{}% + \wd\pgf@lib@dec@text@box16383pt\relax% + \fi% +}]{}% % -\state{before typeset}[width=+.5\wd\pgf@lib@dec@text@box, next state=typeset]{} +\state{before typeset}[width=+.5\wd\pgf@lib@dec@text@box, next state=typeset]{}% % \state{typeset}[width=+0pt, next state=after typeset] {% \pgftransformxshift{+-.5\wd\pgf@lib@dec@text@box}% \setbox\pgf@hbox\hbox{\copy\pgf@lib@dec@text@box}% \pgfqboxsynced\pgf@hbox% -} +}% \state{after typeset}[width=+.5\wd\pgf@lib@dec@text@box, next state=shift, - persistent precomputation={% - \ifpgf@lib@dec@text@fit% - \ifpgf@lib@dec@text@stretch@spaces% - \ifpgf@lib@dec@text@scan@space% - \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@space@shift% - \else% - \def\pgf@lib@dec@text@shift{0pt}% - \fi% - \else% - \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@character@shift% - \fi% - \else% - \def\pgf@lib@dec@text@shift{0pt}% - \fi% - }]{} -\state{shift}[width=+\pgf@lib@dec@text@shift, next state=scan]{} -\state{final}{} -} + persistent precomputation={% + \ifpgf@lib@dec@text@fit% + \ifpgf@lib@dec@text@stretch@spaces% + \ifpgf@lib@dec@text@scan@space% + \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@space@shift% + \else% + \def\pgf@lib@dec@text@shift{0pt}% + \fi% + \else% + \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@character@shift% + \fi% + \else% + \def\pgf@lib@dec@text@shift{0pt}% + \fi% + }]{}% +\state{shift}[width=+\pgf@lib@dec@text@shift, next state=scan]{}% +\state{final}{}% +}% % \pgfsetdecoratetextformatdelimiters -% +% % Set the delimiters for formatting in the text decoration. % NB: Catcodes for delimiters should be 11 or 12. % @@ -153,18 +156,18 @@ % \def\pgfdecoratetext{The [\it]very[+\color{green}]green[] sprouts.} % \def\pgfsetdecoratetextformatdelimiters#1#2{% - \def\pgf@lib@dec@text@formatchar{#1}% - \def\pgf@test{#2}% - \ifx\pgf@test\pgfutil@empty% - \def\pgf@lib@dec@text@collectformat##1#1{% - \pgf@lib@dec@text@@collectformat##1\pgf@stop}% - \else% - \def\pgf@lib@dec@text@collectformat##1#2{% - \pgf@lib@dec@text@@collectformat##1\pgf@stop}% - \fi% -} - -\pgfsetdecoratetextformatdelimiters{|}{} + \def\pgf@lib@dec@text@formatchar{#1}% + \def\pgf@test{#2}% + \ifx\pgf@test\pgfutil@empty% + \def\pgf@lib@dec@text@collectformat##1#1{% + \pgf@lib@dec@text@@collectformat##1\pgf@stop}% + \else% + \def\pgf@lib@dec@text@collectformat##1#2{% + \pgf@lib@dec@text@@collectformat##1\pgf@stop}% + \fi% +}% + +\pgfsetdecoratetextformatdelimiters{|}{}% \newbox\pgf@lib@dec@text@box \newif\ifpgf@lib@decorate@textmathmode @@ -174,174 +177,181 @@ \let\pgf@lib@dec@text@format=\pgfutil@empty \def\pgf@lib@dec@text@scanchar{% - \pgf@lib@dec@text@scan@spacefalse% - \ifx\pgfdecorationrestoftext\pgfutil@empty% - \let\pgf@lib@dec@text@char\pgfutil@empty% - \setbox\pgf@lib@dec@text@box\box\pgfutil@voidb@x% - \let\pgf@next\relax% - \else% - \let\pgf@next\pgf@lib@dec@text@@scanchar% - \fi% - \pgf@next} - + \pgf@lib@dec@text@scan@spacefalse% + \ifx\pgfdecorationrestoftext\pgfutil@empty% + \let\pgf@lib@dec@text@char\pgfutil@empty% + \setbox\pgf@lib@dec@text@box\box\pgfutil@voidb@x% + \let\pgf@next\relax% + \else\ifx\pgfdecorationrestoftext\pgf@lib@dec@mathshift% + \ifpgf@lib@decorate@textmathmode% + \pgf@lib@decorate@textmathmodefalse% + \fi% + \let\pgf@lib@dec@text@char\pgfutil@empty% + \setbox\pgf@lib@dec@text@box\box\pgfutil@voidb@x% + \let\pgf@next\relax% + \else + \let\pgf@next\pgf@lib@dec@text@@scanchar% + \fi\fi% + \pgf@next}% + \def\pgf@lib@dec@text@@scanchar{% - \expandafter\pgf@lib@dec@text@@@scanchar\pgfdecorationrestoftext\pgf@stop} + \expandafter\pgf@lib@dec@text@@@scanchar\pgfdecorationrestoftext\pgf@stop}% \def\pgf@lib@dec@text@@@scanchar{% - \futurelet\pgf@lib@dec@lettoken% - \pgf@lib@dec@text@@@@scanchar} - + \futurelet\pgf@lib@dec@lettoken% + \pgf@lib@dec@text@@@@scanchar}% + \def\pgf@lib@dec@text@@@@scanchar{% - \ifx\pgf@lib@dec@lettoken\pgfutil@sptoken% - \let\pgf@next\pgf@lib@dec@text@insertspace% - \else% - \let\pgf@next\pgf@lib@dec@text@@@@@scanchar% - \fi% - \pgf@next} + \ifx\pgf@lib@dec@lettoken\pgfutil@sptoken% + \let\pgf@next\pgf@lib@dec@text@insertspace% + \else% + \let\pgf@next\pgf@lib@dec@text@@@@@scanchar% + \fi% + \pgf@next}% \def\pgf@lib@dec@text@@@@@scanchar{% - \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@collectgroup}% - {\pgf@lib@dec@text@@@@@@scanchar}} - + \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@collectgroup}% + {\pgf@lib@dec@text@@@@@@scanchar}}% + \def\pgf@lib@dec@text@collectgroup#1{% - \def\pgf@lib@dec@text@char{#1}% - \pgf@lib@dec@text@collectrestoftext} - + \def\pgf@lib@dec@text@char{#1}% + \pgf@lib@dec@text@collectrestoftext}% + \def\pgf@lib@dec@text@@@@@@scanchar#1{% - \ifx#1\pgf@stop% - \pgf@lib@dec@text@box\box\pgfutil@voidb@x% - \let\pgf@next\pgf@lib@dec@text@endoftext% - \else% - \def\pgf@lib@dec@text@char{#1}% - \ifx#1\space% - \let\pgf@next\pgf@lib@dec@text@collectrestoftext% - \else% - \ifx#1\ % - \let\pgf@next\pgf@lib@dec@text@collectrestoftext% - \else% - \ifx\pgf@lib@dec@text@char\pgf@lib@dec@text@formatchar% - \let\pgf@next\pgf@lib@dec@text@collectformat% - \else% - \expandafter\ifcat\noexpand#1\relax% - \let\pgf@next\pgf@lib@dec@text@expandcs% - \else% - \ifnum\catcode`#1=3\relax% - \ifpgf@lib@decorate@textmathmode% - \pgf@lib@decorate@textmathmodefalse% - \else% - \pgf@lib@decorate@textmathmodetrue% - \fi% - \let\pgf@next\pgf@lib@dec@text@@@scanchar% - \else% - \let\pgf@next\pgf@lib@dec@text@collectrestoftext% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \pgf@next% -} + \ifx#1\pgf@stop% + \pgf@lib@dec@text@box\box\pgfutil@voidb@x% + \let\pgf@next\pgf@lib@dec@text@endoftext% + \else% + \def\pgf@lib@dec@text@char{#1}% + \ifx#1\space% + \let\pgf@next\pgf@lib@dec@text@collectrestoftext% + \else% + \ifx#1\ % + \let\pgf@next\pgf@lib@dec@text@collectrestoftext% + \else% + \ifx\pgf@lib@dec@text@char\pgf@lib@dec@text@formatchar% + \let\pgf@next\pgf@lib@dec@text@collectformat% + \else% + \expandafter\ifcat\noexpand#1\relax% + \let\pgf@next\pgf@lib@dec@text@expandcs% + \else% + \ifnum\catcode`#1=3\relax% + \ifpgf@lib@decorate@textmathmode% + \pgf@lib@decorate@textmathmodefalse% + \else% + \pgf@lib@decorate@textmathmodetrue% + \fi% + \let\pgf@next\pgf@lib@dec@text@@@scanchar% + \else% + \let\pgf@next\pgf@lib@dec@text@collectrestoftext% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \pgf@next% +}% \def\pgf@lib@dec@text@@collectformat{% - \pgfutil@ifnextchar+{\pgf@lib@dec@text@addtoformat}{\pgf@lib@dec@text@setformat}} - + \pgfutil@ifnextchar+{\pgf@lib@dec@text@addtoformat}{\pgf@lib@dec@text@setformat}}% + \def\pgf@lib@dec@text@setformat#1\pgf@stop{% - \def\pgf@lib@dec@text@format{#1}% - \pgf@lib@dec@text@@@scanchar% -} + \def\pgf@lib@dec@text@format{#1}% + \pgf@lib@dec@text@@@scanchar% +}% \def\pgf@lib@dec@text@addtoformat+#1\pgf@stop{% - \expandafter\def\expandafter\pgf@lib@dec@text@format\expandafter{\pgf@lib@dec@text@format#1}% - \pgf@lib@dec@text@@@scanchar% -} + \expandafter\def\expandafter\pgf@lib@dec@text@format\expandafter{\pgf@lib@dec@text@format#1}% + \pgf@lib@dec@text@@@scanchar% +}% \def\pgf@lib@dec@text@insertspace{% - \pgf@lib@dec@text@scan@spacetrue% - \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@@insertspacegrp}% - {\pgf@lib@dec@text@@insertspace}} - + \pgf@lib@dec@text@scan@spacetrue% + \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@@insertspacegrp}% + {\pgf@lib@dec@text@@insertspace}}% + \def\pgf@lib@dec@text@@insertspacegrp#1{% - \pgf@lib@dec@text@@@@@@scanchar\space{#1}} - + \pgf@lib@dec@text@@@@@@scanchar\space{#1}}% + \def\pgf@lib@dec@text@@insertspace#1{% - \pgf@lib@dec@text@@@@@@scanchar\space#1} - + \pgf@lib@dec@text@@@@@@scanchar\space#1}% + \def\pgf@lib@dec@text@expandcs{% - \expandafter\expandafter\expandafter\pgf@lib@dec@text@@@@@scanchar% - \pgf@lib@dec@text@char} + \expandafter\expandafter\expandafter\pgf@lib@dec@text@@@@@scanchar% + \pgf@lib@dec@text@char}% \def\pgf@lib@dec@text@endoftext{% - \let\pgfdecoraterestoftext\pgfutil@empty% - \let\pgf@lib@dec@text@char\pgfutil@empty% -} + \let\pgfdecorationrestoftext\pgfutil@empty% + \let\pgf@lib@dec@text@char\pgfutil@empty% +}% \def\pgf@lib@dec@text@collectrestoftext{% - \pgf@lib@dec@text@dobox% - \futurelet\pgf@lib@dec@text@lettoken% - \pgf@lib@dec@text@@collectrestoftext} + \pgf@lib@dec@text@dobox% + \futurelet\pgf@lib@dec@text@lettoken% + \pgf@lib@dec@text@@collectrestoftext}% \def\pgf@lib@dec@text@@collectrestoftext{% - \ifx\bgroup\pgf@lib@dec@text@lettoken% - \let\pgf@next\pgf@lib@dec@text@@@collectrestoftextgrp% - \else% - \let\pgf@next\pgf@lib@dec@text@@@collectrestoftext% - \fi% - \pgf@next} - + \ifx\bgroup\pgf@lib@dec@text@lettoken% + \let\pgf@next\pgf@lib@dec@text@@@collectrestoftextgrp% + \else% + \let\pgf@next\pgf@lib@dec@text@@@collectrestoftext% + \fi% + \pgf@next}% + \def\pgf@lib@dec@text@@@collectrestoftextgrp#1#2\pgf@stop{\def\pgfdecorationrestoftext{{#1}#2}% -} +}% -\def\pgf@lib@dec@text@@@collectrestoftext#1\pgf@stop{\def\pgfdecorationrestoftext{#1}} +\def\pgf@lib@dec@text@@@collectrestoftext#1\pgf@stop{\def\pgfdecorationrestoftext{#1}}% {% - \catcode`\$3 % - \gdef\pgf@lib@dec@mathshift{$}% - \catcode`\$9 $% For editors with annoying syntax highlighting. + \catcode`\$3 % + \gdef\pgf@lib@dec@mathshift{$}% + \catcode`\$9 $% For editors with annoying syntax highlighting. }% \def\pgf@lib@dec@text@dobox{% - \setbox\pgf@lib@dec@text@box\hbox{% - \pgfinterruptpicture% - \begingroup% - \pgfsetcolor{\pgf@lib@decorationtextcolor}% - \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi% - \pgf@lib@dec@text@format\relax% - \pgf@lib@dec@text@char% - \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi% - \endgroup% - \endpgfinterruptpicture% - }% -} + \setbox\pgf@lib@dec@text@box\hbox{% + \pgfinterruptpicture% + \begingroup% + \pgfsetcolor{\pgf@lib@decorationtextcolor}% + \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi% + \pgf@lib@dec@text@format\relax% + \pgf@lib@dec@text@char% + \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi% + \endgroup% + \endpgfinterruptpicture% + }% +}% \def\pgf@lib@dec@text@getwidth{% - \begingroup% - \let\c@pgf@lib@dec@characters=\c@pgf@counta% - \let\c@pgf@lib@dec@spaces=\c@pgf@countb% - \let\pgfdecorationrestoftext=\pgfdecorationtext% - \c@pgf@lib@dec@spaces=0\relax% - \c@pgf@lib@dec@characters=0\relax% - \pgfmathloop% - \pgf@lib@dec@text@scanchar% - \ifvoid\pgf@lib@dec@text@box% - \else% - \setbox\pgf@hbox=\hbox{{% - \unhbox\pgf@hbox% - \unhbox\pgf@lib@dec@text@box% - }}% - \advance\c@pgf@lib@dec@characters by1\relax% - \ifpgf@lib@dec@text@scan@space% - \advance\c@pgf@lib@dec@spaces by1\relax% - \fi% - \repeatpgfmathloop% - \global\pgf@x=\the\wd\pgf@hbox% - \xdef\pgf@lib@dec@temp{\the\c@pgf@lib@dec@characters}% - \xdef\pgf@lib@dec@@temp{\the\c@pgf@lib@dec@spaces}% - \endgroup% - \edef\pgf@lib@dec@text@width{\the\pgf@x}% - \let\pgf@lib@dec@character@count=\pgf@lib@dec@temp% - \let\pgf@lib@dec@space@count=\pgf@lib@dec@@temp% -} - - - -\endinput
\ No newline at end of file + \begingroup% + \let\c@pgf@lib@dec@characters=\c@pgf@counta% + \let\c@pgf@lib@dec@spaces=\c@pgf@countb% + \let\pgfdecorationrestoftext=\pgfdecorationtext% + \c@pgf@lib@dec@spaces=0\relax% + \c@pgf@lib@dec@characters=0\relax% + \pgfmathloop% + \pgf@lib@dec@text@scanchar% + \ifvoid\pgf@lib@dec@text@box% + \else% + \setbox\pgf@hbox=\hbox{{% + \unhbox\pgf@hbox% + \unhbox\pgf@lib@dec@text@box% + }}% + \advance\c@pgf@lib@dec@characters by1\relax% + \ifpgf@lib@dec@text@scan@space% + \advance\c@pgf@lib@dec@spaces by1\relax% + \fi% + \repeatpgfmathloop% + \global\pgf@x=\the\wd\pgf@hbox% + \xdef\pgf@lib@dec@temp{\the\c@pgf@lib@dec@characters}% + \xdef\pgf@lib@dec@@temp{\the\c@pgf@lib@dec@spaces}% + \endgroup% + \edef\pgf@lib@dec@text@width{\the\pgf@x}% + \let\pgf@lib@dec@character@count=\pgf@lib@dec@temp% + \let\pgf@lib@dec@space@count=\pgf@lib@dec@@temp% +}% + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua index 8fc963d8b9e..3eecaf99c0a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua @@ -7,7 +7,7 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more details. -- --- $Id: functions.lua,v 1.3 2015/05/10 20:34:13 cfeuersaenger Exp $ +-- $Id$ -- local pgfluamathfunctions = pgfluamathfunctions or {} diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua index 55066b45aad..30eff2e6992 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua @@ -8,7 +8,7 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more details. -- --- $Id: parser.lua,v 1.1 2014/12/27 14:11:49 cfeuersaenger Exp $ +-- $Id$ -- -- usage: -- @@ -48,7 +48,7 @@ local integer_pattern = S("+-")^-1 * positive_integer_pattern local positive_integer_or_decimal_pattern = positive_integer_pattern * ( P(".") * one_digit_pattern^0)^-1 + (P(".") * one_digit_pattern^1) local integer_or_decimal_pattern = S("+-")^-1 * positive_integer_or_decimal_pattern -local fpu_pattern = R"15" * P"Y" * positive_integer_or_decimal_pattern * P"e" * P("-")^-1 * R("09")^1 * P"]" +local fpu_pattern = R"05" * P"Y" * positive_integer_or_decimal_pattern * P"e" * S("+-")^-1 * R("09")^1 * P"]" local unbounded_pattern = P"inf" + P"INF" + P"nan" + P"NaN" + P"Inf" local number_pattern = C(unbounded_pattern + fpu_pattern + integer_or_decimal_pattern * (S"eE" * integer_pattern + C(tex_unit))^-1) @@ -77,7 +77,8 @@ local comma_pattern = P(",") * space_pattern ---------------- local TermOp = C(S("+-")) * space_pattern -local RelationalOp = C( P"==" + P"!=" + P"<=" + P">=" + P"<" + P">" ) * space_pattern +local EqualityOp = C( P"==" + P"!=" ) * space_pattern +local RelationalOp = C( P"<=" + P">=" + P"<" + P">" ) * space_pattern local FactorOp = C(S("*/")) * space_pattern -- Grammar @@ -141,6 +142,9 @@ local prefix_operator_pattern = (prefix_operator * space_pattern * Cg(Prefix) ) -- apparently, we need to distinghuish between <expr> ! and <expr> != <expr2>: local postfix_operator = C( S"r!" - P"!=" ) + C(P"^") * space_pattern * pow_exponent +pgfluamathfunctions.functionMustBeEvaluatedInTeX = function() + error("The function in this context cannot be evaluated by LUA because it depends on TeX macros.") +end local ternary_eval = pgfluamathfunctions.ifthenelse @@ -170,11 +174,18 @@ local function postfix_eval(prefix, op, arg) return result end -local function relational_eval(v1, op, v2) +local function equality_eval(v1, op, v2) local fct if (op == "==") then fct = pgfluamathfunctions.equal elseif (op == "!=") then fct = pgfluamathfunctions.notequal - elseif (op == "<") then fct = pgfluamathfunctions.less + else + error("This function must not be invoked for operator "..op) + end + return fct(v1,v2) +end +local function relational_eval(v1, op, v2) + local fct + if (op == "<") then fct = pgfluamathfunctions.less elseif (op == ">") then fct = pgfluamathfunctions.greater elseif (op == ">=") then fct = pgfluamathfunctions.notless elseif (op == "<=") then fct = pgfluamathfunctions.notgreater @@ -264,6 +275,7 @@ local initialRule = V"initial" local Summand = V"Summand" local Relational = V"Relational" +local Equality = V"Equality" local LogicalOr = V"LogicalOr" local LogicalAnd = V"LogicalAnd" @@ -299,11 +311,11 @@ local G = P{ "initialRule", initialRule = space_pattern* Exp * -1; -- ternary operator (or chained ternary operators): -- FIXME : is this chaining a good idea!? - Exp = Cf( Relational * Cg(P"?" * space_pattern * Relational * P":" *space_pattern * Relational )^0, ternary_eval) ; - -- FIXME : do we really allow something like " 1 == 1 != 2" ? I would prefer (1==1) != 2 !? - Relational = Cf(LogicalOr * Cg(RelationalOp * LogicalOr)^0, relational_eval); + Exp = Cf( LogicalOr * Cg(P"?" * space_pattern * LogicalOr * P":" *space_pattern * LogicalOr )^0, ternary_eval) ; LogicalOr = Cf(LogicalAnd * (P"||" * space_pattern * LogicalAnd)^0, pgfluamathfunctions.orPGF); - LogicalAnd = Cf(Summand * (P"&&" * space_pattern * Summand)^0, pgfluamathfunctions.andPGF); + LogicalAnd = Cf(Equality * (P"&&" * space_pattern * Equality)^0, pgfluamathfunctions.andPGF); + Equality = Cf(Relational * Cg(EqualityOp * Relational)^0, equality_eval); + Relational = Cf(Summand * Cg(RelationalOp * Summand)^0, relational_eval); Summand = Cf(Term * Cg(TermOp * Term)^0, eval) ; Term = Cf(Prefix * Cg(FactorOp * Prefix)^0, eval); Prefix = prefix_operator_pattern + Postfix; diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex index 1d7a5227dd6..c559a0cc1ba 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex @@ -8,7 +8,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. % -% $Id: pgflibraryluamath.code.tex,v 1.20 2015/06/05 06:23:21 cfeuersaenger Exp $ +% $Id$ % % % This is a library for a LUA math parser and LUA math operations. @@ -76,49 +76,70 @@ % Patch some configuration macros such that the modifications are % available in LUA as well: \pgfkeys{ - /pgf/trig format/deg/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("deg")}\aftergroup\pgfmath@settrigformat}, - /pgf/trig format/rad/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("rad")}\aftergroup\pgfmath@settrigformat}, + /pgf/trig format/deg/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("deg")}\aftergroup\pgfmath@settrigformat}, + /pgf/trig format/rad/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("rad")}\aftergroup\pgfmath@settrigformat}, } % ... and reactivate the key: \pgfmathiftrigonometricusesdeg{% - \pgfkeys{/pgf/trig format/deg}% + \pgfkeys{/pgf/trig format/deg}% }{% - \pgfkeys{/pgf/trig format/rad}% + \pgfkeys{/pgf/trig format/rad}% }% % re-activates the current trig format. This is important after a TeX % group has been closed. \def\pgfmath@settrigformat{% - \pgfmathiftrigonometricusesdeg{% - \directlua{pgfluamathfunctions.setTrigFormat("deg")}% - }{% - \directlua{pgfluamathfunctions.setTrigFormat("rad")}% - }% + \pgfmathiftrigonometricusesdeg{% + \directlua{pgfluamathfunctions.setTrigFormat("deg")}% + }{% + \directlua{pgfluamathfunctions.setTrigFormat("rad")}% + }% }% \let\pgfmathsetseed@pgfbasic = \pgfmathsetseed \def\pgfmathsetseed#1{% - \pgfmathsetseed@pgfbasic{#1}% - \directlua{pgfluamathfunctions.setRandomSeed(pgfluamathfunctions.tonumber("\pgfmathresult"))}% + \pgfmathsetseed@pgfbasic{#1}% + \directlua{pgfluamathfunctions.setRandomSeed(pgfluamathfunctions.tonumber("\pgfmathresult"))}% }% % Patch 'declare function' such that it communicates the function % directly to LUA. \let\pgfmathnotifynewdeclarefunction@orig=\pgfmathnotifynewdeclarefunction \def\pgfmathnotifynewdeclarefunction#1#2#3{% - \pgfmathnotifynewdeclarefunction@orig{#1}{#2}{#3}% - \directlua{pgfluamathparser.pushLocalExpressionFunction(% - "\pgfutil@luaescapestring{#1}",% - #2,% - "\pgfutil@luaescapestring{#3}")}% - % - % ensure that the local function is removed at the end of the - % scope. To this end, we maintain a stack on the LUA side. - \aftergroup\pgfluamathparse@pop@local@function + \pgfmathnotifynewdeclarefunction@orig{#1}{#2}{#3}% + % + % we have to check if '#3' contains control sequences. + % this is highly tricky as it may contain '#1'... + \begingroup + \toks0={#3}% + \xdef\pgf@marshal@glob{\the\toks0 }% + \endgroup + \pgfutil@command@to@string\pgf@marshal@glob\pgf@marshal + \expandafter\pgfutilifcontainsmacro\expandafter{\pgf@marshal}{% + \def\pgf@temp{1}% + }{% + \def\pgf@temp{0}% + }% + \if1\pgf@temp + % let lua produce an error when evaluating this function -- we cannot possibly expand the macro to its current state: + \directlua{pgfluamathparser.pushLocalExpressionFunction(% + "\pgfutil@luaescapestring{#1}",% + #2,% + "functionMustBeEvaluatedInTeX")}% + \else + \directlua{pgfluamathparser.pushLocalExpressionFunction(% + "\pgfutil@luaescapestring{#1}",% + #2,% + "\pgfutil@luaescapestring{#3}")}% + \fi + % + % ensure that the local function is removed at the end of the + % scope. To this end, we maintain a stack on the LUA side. + \aftergroup\pgfluamathparse@pop@local@function }% \def\pgfluamathparse@pop@local@function{% - \directlua{pgfluamathparser.popLocalExpressionFunction()}% + \directlua{pgfluamathparser.popLocalExpressionFunction()}% }% % End of luatex stuff @@ -147,7 +168,7 @@ % LUA (defined only in TeX) % - some special cases which simply haven't been added to the LUA % parser (yet). -% At the time of this writing, this includes +% At the time of this writing, this includes % -- arrays created via '{}' and indexed with '[]' % -- strings with "<str>" % -- 'scalar' function @@ -163,13 +184,13 @@ \pgfluamath@checkuninstallcmd% \pgfluamath@install% \pgfluamathcomputationactivetrue - \fi} + \fi}% \def\pgfluamath@makecomputationinactive{% \ifpgfluamathcomputationactive \pgfluamath@uninstall% \pgfluamathcomputationactivefalse - \fi} + \fi}% \let\pgfluamath@pgfmathparse\pgfmathparse \def\pgfluamath@makeparseractive{% @@ -177,14 +198,18 @@ \else \let\pgfluamath@pgfmathparse\pgfmathparse \let\pgfmathparse\pgfluamathparse + \let\pgfmath@iftrue=\pgfmathluamath@iftrue \pgfluamathparseractivetrue - \fi} + \fi}% + +\let\pgfmath@iftrue@basic=\pgfmath@iftrue \def\pgfluamath@makeparserinactive{% \ifpgfluamathparseractive \let\pgfmathparse\pgfluamath@pgfmathparse + \let\pgfmath@iftrue=\pgfmath@iftrue@basic \pgfluamathparseractivefalse - \fi} + \fi}% \pgfqkeys{/pgf}{% % Enable lua-side computation of \pgfmathresult @@ -223,23 +248,23 @@ luamath library}% \fi }, - luamath/output format/.is choice, - luamath/output format/fixed/.code= {\def\pgfluamath@outputformat@choice{0}}, - % returns results for use in the FPU - luamath/output format/float/.code= {\def\pgfluamath@outputformat@choice{1}}, - luamath/output format/fixed, - % this is merely useful for debugging purposes, I guess. - luamath/show error message/.is if=pgfluamathshowerrormessage, - luamath/enable TeX fallback/.is choice, - luamath/enable TeX fallback/true/.code={\pgfluamathenableTeXfallbacktrue\pgfluamathshowerrormessagefalse}, - luamath/enable TeX fallback/false/.code={\pgfluamathenableTeXfallbackfalse\pgfluamathshowerrormessagetrue}, - luamath/enable TeX fallback/.default=true, - luamath/enable TeX fallback=true, -} + luamath/output format/.is choice, + luamath/output format/fixed/.code= {\def\pgfluamath@outputformat@choice{0}}, + % returns results for use in the FPU + luamath/output format/float/.code= {\def\pgfluamath@outputformat@choice{1}}, + luamath/output format/fixed, + % this is merely useful for debugging purposes, I guess. + luamath/show error message/.is if=pgfluamathshowerrormessage, + luamath/enable TeX fallback/.is choice, + luamath/enable TeX fallback/true/.code={\pgfluamathenableTeXfallbacktrue\pgfluamathshowerrormessagefalse}, + luamath/enable TeX fallback/false/.code={\pgfluamathenableTeXfallbackfalse\pgfluamathshowerrormessagetrue}, + luamath/enable TeX fallback/.default=true, + luamath/enable TeX fallback=true, +}% \def\pgfluamath@uninstall@appendcmd#1{% \expandafter\gdef\expandafter\pgfluamath@uninstall\expandafter{% - \pgfluamath@uninstall #1}} + \pgfluamath@uninstall #1}}% % If the uninstall command is already assembled, it will skip the % uninstall assemblation. @@ -252,7 +277,7 @@ \def\pgfluamath@uninstall@appendcmd##1{}% \def\pgfluamath@prepareuninstallcmd##1{}% }% -} +}% % This assembles an uninstall command globally ON FIRST USAGE. % See \pgfmathfloat@plots@checkuninstallcmd @@ -262,18 +287,19 @@ \expandafter\gdef\expandafter\pgfluamath@uninstall\expandafter{% \pgfluamath@uninstall \expandafter\let\expandafter#1\csname pgfluamath@backup@\string#1\endcsname}% -} +}% \def\pgfluamath@install@function#1=#2{% \pgfluamath@prepareuninstallcmd{#1}% \let#1=#2% -} +}% \def\pgfluamath@install{% \pgfluamath@install@function\pgfmathadd@=\pgfluamathadd@% \pgfluamath@install@function\pgfmathsubtract@=\pgfluamathsubtract@% \pgfluamath@install@function\pgfmathneg@=\pgfluamathneg@% \pgfluamath@install@function\pgfmathmultiply@=\pgfluamathmultiply@% + \pgfmathfloat@install\pgfmath@iftrue=\pgfmathluamath@iftrue% \pgfluamath@install@function\pgfmathdivide@=\pgfluamathdivide@% % \pgfluamath@install@function\pgfmathdiv@=\pgfluamathdiv@% \pgfluamath@install@function\pgfmathfactorial@=\pgfluamathfactorial@% @@ -349,87 +375,106 @@ % \pgfluamath@install@function@unimplemented{notequal}% \pgfluamath@install@function\pgfmathreciprocal=\pgfluamathreciprocal% \pgfluamath@install@function\pgfpointnormalised=\pgfluamathpointnormalised -} +}% \def\pgfluamathgetresult#1{% - \edef\pgfmathresult{\pgfutil@directlua{tex.print(-1,#1)}}} + \edef\pgfmathresult{\pgfutil@directlua{tex.print(-1,#1)}}}% + +\def\pgfmathluamath@iftrue{% + \if 0\pgfluamath@outputformat@choice + \let\pgfmathluamath@@iftrue@v=\pgfluamathone + \else + \let\pgfmathluamath@@iftrue@v=\pgfluamathfloatone + \fi + \pgfmathluamath@iftrue@ +}% +\def\pgfluamathone{1.0}% +\def\pgfluamathfloatone{1Y1.0e+00]}% +\def\pgfmathluamath@iftrue@#1#2{% + \ifx\pgfmathresult\pgfmathluamath@@iftrue@v + \def\pgfmath@next{#1}% + \else + \def\pgfmath@next{#2}% + \fi + \pgfmath@next +}% \def\pgfluamathpi@{% - \pgfluamathgetresult{pgfluamathfunctions.pi()}} + \pgfluamathgetresult{pgfluamathfunctions.pi()}}% \def\pgfluamathe@{% - \pgfluamathgetresult{pgfluamathfunctions.e()}} + \pgfluamathgetresult{pgfluamathfunctions.e()}}% \def\pgfluamathadd@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.add(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.add(#1,#2)}}% \def\pgfluamathsubtract@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.substract(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.substract(#1,#2)}}% \def\pgfluamathneg@#1{% - \pgfluamathgetresult{pgfluamathfunctions.neg(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.neg(#1)}}% \def\pgfluamathmultiply@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.multiply(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.multiply(#1,#2)}}% \def\pgfluamathdivide@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.divide(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.divide(#1,#2)}}% \def\pgfluamathabs@#1{% - \pgfluamathgetresult{pgfluamathfunctions.abs(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.abs(#1)}}% \def\pgfluamathround@#1{% - \pgfluamathgetresult{pgfluamathfunctions.round(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.round(#1)}}% \def\pgfluamathfloor@#1{% - \pgfluamathgetresult{pgfluamathfunctions.floor(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.floor(#1)}}% \def\pgfluamathceil@#1{% - \pgfluamathgetresult{pgfluamathfunctions.ceil(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.ceil(#1)}}% \def\pgfluamathgcd@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.gcd(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.gcd(#1,#2)}}% \def\pgfluamathisprime@#1{% - \pgfluamathgetresult{pgfluamathfunctions.isprime(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.isprime(#1)}}% \def\pgfluamathmax@#1{% \pgfluamathgetresult{% - math.max(pgfluamathfunctions.split_braces_to_explist("#1"))}} + math.max(pgfluamathfunctions.split_braces_to_explist("#1"))}}% \def\pgfluamathmin@#1{% \pgfluamathgetresult{% - math.min(pgfluamathfunctions.split_braces_to_explist("#1"))}} + math.min(pgfluamathfunctions.split_braces_to_explist("#1"))}}% \def\pgfluamathsin@#1{% - \pgfluamathgetresult{pgfluamathfunctions.Sin(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.Sin(#1)}}% \def\pgfluamathcos@#1{% - \pgfluamathgetresult{pgfluamathfunctions.Cos(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.Cos(#1)}}% \def\pgfluamathtan@#1{% - \pgfluamathgetresult{pgfluamathfunctions.Tan(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.Tan(#1)}}% \def\pgfluamathmod@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.mod(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.mod(#1,#2)}}% \def\pgfluamathMod@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.Mod(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.Mod(#1,#2)}}% \def\pgfluamathrad@#1{% - \pgfluamathgetresult{pgfluamathfunctions.rad(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.rad(#1)}}% \def\pgfluamathdeg@#1{% - \pgfluamathgetresult{pgfluamathfunctions.deg(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.deg(#1)}}% \def\pgfluamathatan@#1{% - \pgfluamathgetresult{pgfluamathfunctions.aTan(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.aTan(#1)}}% \def\pgfluamathatantwo@#1#2{% - \pgfluamathgetresult{pgfluamathfunctions.aTan2(#1,#2)}} + \pgfluamathgetresult{pgfluamathfunctions.aTan2(#1,#2)}}% \def\pgfluamathasin@#1{% - \pgfluamathgetresult{pgfluamathfunctions.aSin(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.aSin(#1)}}% \def\pgfluamathacos@#1{% - \pgfluamathgetresult{pgfluamathfunctions.aCos(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.aCos(#1)}}% \def\pgfluamathcot@#1{% - \pgfluamathgetresult{1/pgfluamathfunctions.Tan(#1)}} + \pgfluamathgetresult{1/pgfluamathfunctions.Tan(#1)}}% \def\pgfluamathsec@#1{% - \pgfluamathgetresult{1/pgfluamathfunctions.Cos(#1)}} + \pgfluamathgetresult{1/pgfluamathfunctions.Cos(#1)}}% \def\pgfluamathcosec@#1{% - \pgfluamathgetresult{1/pgfluamathfunctions.Sin(#1)}} + \pgfluamathgetresult{1/pgfluamathfunctions.Sin(#1)}}% \def\pgfluamathexp@#1{% - \pgfluamathgetresult{pgfluamathfunctions.exp(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.exp(#1)}}% \def\pgfluamathln@#1{% - \pgfluamathgetresult{pgfluamathfunctions.log(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.log(#1)}}% \def\pgfluamathlogten@#1{% - \pgfluamathgetresult{pgfluamathfunctions.log10(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.log10(#1)}}% \def\pgfluamathsqrt@#1{% - \pgfluamathgetresult{pgfluamathfunctions.sqrt(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.sqrt(#1)}}% \def\pgfluamathrnd@{% - \pgfluamathgetresult{pgfluamathfunctions.rnd()}} + \pgfluamathgetresult{pgfluamathfunctions.rnd()}}% \def\pgfluamathrand@{% - \pgfluamathgetresult{pgfluamathfunctions.rand(-1,1)}} + \pgfluamathgetresult{pgfluamathfunctions.rand(-1,1)}}% \def\pgfluamathfactorial@#1{% - \pgfluamathgetresult{pgfluamathfunctions.factorial(#1)}} + \pgfluamathgetresult{pgfluamathfunctions.factorial(#1)}}% \def\pgfluamathreciprocal#1{% - \pgfluamathgetresult{1/#1}} + \pgfluamathgetresult{1/#1}}% % \pgfluamath@install@function\pgfmath@pi=\pgfluamathpi@% % \pgfluamath@install@function\pgfmathpi=\pgfluamathpi@% % \pgfluamath@install@function\pgfmathe@=\pgfluamathe@% @@ -463,7 +508,7 @@ \pgfutil@directlua{% pgfluamathfunctions.pointnormalised(% \pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})}% - \ignorespaces} + \ignorespaces}% % Parser @@ -478,7 +523,7 @@ % LUA (defined only in TeX) % - some special cases which simply haven't been added to the LUA % parser (yet). -% At the time of this writing, this includes +% At the time of this writing, this includes % -- arrays created via '{}' and indexed with '[]' % -- strings with "<str>" % -- 'scalar' function @@ -497,17 +542,17 @@ \def\pgfluamathparse#1{% \pgfluamathusedTeXfallbackfalse \pgfutil@directlua{pgfluamathparser.texCallParser( - "\pgfutil@luaescapestring{#1}", - \pgfluamath@outputformat@choice, - \ifpgfluamathshowerrormessage true\else false\fi)% + "\pgfutil@luaescapestring{#1}", + \pgfluamath@outputformat@choice, + \ifpgfluamathshowerrormessage true\else false\fi)% }% \ifx\pgfmathresult\pgfutil@empty - \ifpgfluamathenableTeXfallback - \pgfluamathusedTeXfallbacktrue - \pgfluamath@pgfmathparse{#1}% - \fi + \ifpgfluamathenableTeXfallback + \pgfluamathusedTeXfallbacktrue + \pgfluamath@pgfmathparse{#1}% + \fi \fi -} +}% \catcode`\"=\pgfliblua@oldcatcodedoublequote \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 index 9c4a48aeaca..92d2f1e6864 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex @@ -7,7 +7,7 @@ % % 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.16 2013/09/23 18:04:35 tantau Exp $ +\ProvidesFileRCS{pgflibraryarrows.code.tex} % A square bracket shaped arrow @@ -32,10 +32,10 @@ \pgfpathlineto{\pgfqpoint{0pt}{\pgfutil@tempdima}} \pgfpathlineto{\pgfqpoint{-.5\pgfutil@tempdimb}{\pgfutil@tempdima}} \pgfusepathqstroke -} -\pgfdeclarearrow{name=[-], means=square bracket} +}% +\pgfdeclarearrow{name=[-], means=square bracket}% -\pgfarrowsdeclarereversed{]}{[}{[}{]} +\pgfarrowsdeclarereversed{]}{[}{[}{]}% % A round bracket shaped arrow @@ -60,9 +60,9 @@ {\pgfqpoint{.25\pgfutil@tempdima}{.5\pgfutil@tempdima}} {\pgfqpoint{-.5\pgfutil@tempdima}{\pgfutil@tempdima}} \pgfusepathqstroke -} +}% -\pgfarrowsdeclarereversed{)}{(}{(}{)} +\pgfarrowsdeclarereversed{)}{(}{(}{)}% @@ -88,9 +88,9 @@ \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} +\pgfarrowsdeclarereversed{angle 90 reversed}{angle 90 reversed}{angle 90}{angle 90}% \pgfarrowsdeclare{angle 60}{angle 60} @@ -112,9 +112,9 @@ \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} +\pgfarrowsdeclarereversed{angle 60 reversed}{angle 60 reversed}{angle 60}{angle 60}% @@ -137,9 +137,9 @@ \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} +\pgfarrowsdeclarereversed{angle 45 reversed}{angle 45 reversed}{angle 45}{angle 45}% @@ -160,7 +160,7 @@ \pgfsetdash{}{+0pt} \pgfpathcircle{\pgfqpoint{-3\pgfutil@tempdima}{0pt}}{+4.5\pgfutil@tempdima} \pgfusepathqfillstroke -} +}% % An open dot shaped arrow @@ -179,7 +179,7 @@ \pgfsetdash{}{+0pt} \pgfpathcircle{\pgfqpoint{4.5\pgfutil@tempdima}{0bp}}{4.5\pgfutil@tempdima} \pgfusepathqstroke -} +}% @@ -205,7 +205,7 @@ \pgfpathlineto{\pgfqpoint{-6\pgfutil@tempdima}{-4\pgfutil@tempdima}} \pgfpathclose \pgfusepathqfillstroke -} +}% \pgfarrowsdeclare{open diamond}{open diamond}%{{-.5bp}{14.5bp}} { @@ -226,7 +226,7 @@ \pgfpathlineto{\pgfqpoint{7\pgfutil@tempdima}{-4\pgfutil@tempdima}} \pgfpathclose \pgfusepathqstroke -} +}% % A square shaped arrow @@ -250,7 +250,7 @@ \pgfpathlineto{\pgfqpoint{1\arrowsize}{-4\arrowsize}} \pgfpathclose \pgfusepathqfillstroke -} +}% % A open square shaped arrow \pgfarrowsdeclare{open square}{open square}%{{-.5bp}{8.5bp}} @@ -273,7 +273,7 @@ \pgfpathlineto{\pgfqpoint{8\arrowsize}{-4\arrowsize}} \pgfpathclose \pgfusepathqstroke -} +}% @@ -298,9 +298,9 @@ \pgfpathlineto{\pgfqpoint{-5.5\pgfutil@tempdima}{6\pgfutil@tempdima}} \pgfpathclose \pgfusepathqfillstroke -} +}% -\pgfarrowsdeclarereversed{triangle 90 reversed}{triangle 90 reversed}{triangle 90}{triangle 90} +\pgfarrowsdeclarereversed{triangle 90 reversed}{triangle 90 reversed}{triangle 90}{triangle 90}% \pgfarrowsdeclare{triangle 60}{triangle 60} @@ -322,9 +322,9 @@ \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} +\pgfarrowsdeclarereversed{triangle 60 reversed}{triangle 60 reversed}{triangle 60}{triangle 60}% @@ -348,9 +348,9 @@ \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} +\pgfarrowsdeclarereversed{triangle 45 reversed}{triangle 45 reversed}{triangle 45}{triangle 45}% @@ -373,9 +373,9 @@ \pgfpathlineto{\pgfqpoint{0\pgfutil@tempdima}{6\pgfutil@tempdima}} \pgfpathclose \pgfusepathqstroke -} +}% -\pgfarrowsdeclare{open triangle 90 reversed}{open triangle 90 reversed} +\pgfarrowsdeclare{open triangle 90 reversed}{open triangle 90 reversed}% { \pgfutil@tempdima=0.5pt% \advance\pgfutil@tempdima by.25\pgflinewidth% @@ -393,7 +393,7 @@ \pgfpathlineto{\pgfqpoint{6\pgfutil@tempdima}{6\pgfutil@tempdima}} \pgfpathclose \pgfusepathqstroke -} +}% @@ -415,7 +415,7 @@ \pgfpathlineto{\pgfpointadd{\pgfqpoint{7.794\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-150}{9\pgfutil@tempdima}}} \pgfpathclose \pgfusepathqstroke -} +}% @@ -437,7 +437,7 @@ \pgfpathlineto{\pgfqpointpolar{-30}{9\pgfutil@tempdima}} \pgfpathclose \pgfusepathqstroke -} +}% @@ -459,7 +459,7 @@ \pgfpathlineto{\pgfpointadd{\pgfqpoint{9.205\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-157}{10\pgfutil@tempdima}}} \pgfpathclose \pgfusepathqstroke -} +}% @@ -481,11 +481,11 @@ \pgfpathlineto{\pgfqpointpolar{-23}{10\pgfutil@tempdima}} \pgfpathclose \pgfusepathqstroke -} +}% -% A less fleshy variant of LaTeX's orginal arrow type +% A less fleshy variant of LaTeX's ordinal arrow type \pgfarrowsdeclare{latex'}{latex'} { @@ -512,9 +512,9 @@ {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} \pgfpathclose \pgfusepathqfill -} +}% -\pgfarrowsdeclarereversed{latex' reversed}{latex' reversed}{latex'}{latex'} +\pgfarrowsdeclarereversed{latex' reversed}{latex' reversed}{latex'}{latex'}% % A rounded variant of the stealth arrow @@ -548,9 +548,9 @@ {\pgfqpoint{2\pgfutil@tempdima}{0\pgfutil@tempdima}} \pgfpathclose \pgfusepathqfillstroke -} +}% -\pgfarrowsdeclarereversed{stealth' reversed}{stealth' reversed}{stealth'}{stealth'} +\pgfarrowsdeclarereversed{stealth' reversed}{stealth' reversed}{stealth'}{stealth'}% @@ -583,7 +583,7 @@ {\pgfqpoint{0.5\pgfutil@tempdima}{-0.125\pgflinewidth}} \pgfpathlineto{\pgfqpoint{0pt}{-0.125\pgflinewidth}} \pgfusepathqstroke -} +}% \pgfarrowsdeclare{right to}{right to} @@ -613,7 +613,7 @@ {\pgfqpoint{0.5\pgfutil@tempdima}{0.125\pgflinewidth}} \pgfpathlineto{\pgfqpoint{0pt}{0.125\pgflinewidth}} \pgfusepathqstroke -} +}% @@ -645,7 +645,7 @@ \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} { @@ -673,7 +673,7 @@ \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% -} +}% @@ -697,9 +697,9 @@ \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} +\pgfarrowsdeclarereversed{left hook reversed}{left hook reversed}{left hook}{left hook}% @@ -723,9 +723,9 @@ \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} +\pgfarrowsdeclarereversed{right hook reversed}{right hook reversed}{right hook}{right hook}% % Hooks in both directions @@ -751,9 +751,9 @@ \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} +\pgfarrowsdeclarereversed{hooks reversed}{hooks reversed}{hooks}{hooks}% % An arrow that looks like a serif of the computer modern font @@ -778,15 +778,15 @@ \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}} + {\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 -} +}% @@ -800,7 +800,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0pt}} \pgfusepathqstroke -} +}% % Butt cap @@ -813,7 +813,7 @@ \pgfpathmoveto{\pgfqpoint{-.1\pgflinewidth}{0pt}} \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0pt}} \pgfusepathqstroke -} +}% @@ -829,7 +829,7 @@ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}} \pgfpathclose \pgfusepathqfill -} +}% % reversed 90 degrees cap @@ -844,7 +844,7 @@ \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0\pgflinewidth}} \pgfpathclose \pgfusepathqfill -} +}% @@ -867,7 +867,7 @@ \pgfpathlineto{\pgfqpoint{1.5\pgflinewidth}{0\pgflinewidth}} \pgfpathclose \pgfusepathqfill -} +}% \pgfarrowsdeclare{fast cap reversed}{fast cap reversed} @@ -887,7 +887,7 @@ \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{0\pgflinewidth}} \pgfpathclose \pgfusepathqfill -} +}% @@ -929,7 +929,7 @@ {\pgfpoint{-.75\pgfutil@tempdima}{-1.25\pgfutil@tempdima}} {\pgfpoint{-1.4\pgfutil@tempdima}{-2.65\pgfutil@tempdima}} \pgfusepathqstroke -} +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex index 80b2573a0c4..af509c1af64 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex @@ -7,14 +7,14 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.meta.code.tex,v 1.13 2015/05/13 21:19:11 cfeuersaenger Exp $ +\ProvidesFileRCS{pgflibraryarrows.meta.code.tex} -% -% -% Meta keys -% +% +% +% Meta keys +% % @@ -67,7 +67,7 @@ angle'/.code={ \pgfarrowsaddtolateoptions{\pgfarrows@angle@setup@prime{#1}}% }, - % + % line cap/.is choice, line cap/butt/.code=\pgfarrowsaddtooptions{\pgfarrowroundcapfalse}, line cap/round/.code=\pgfarrowsaddtooptions{\pgfarrowroundcaptrue}, @@ -76,14 +76,10 @@ line join/round/.code=\pgfarrowsaddtooptions{\pgfarrowroundjointrue}, round/.style={line cap=round,line join=round}, sharp/.style={line cap=butt,line join=miter}, -} - - - - +}% % % -% Classificaiton of arrow tips: +% Classification of arrow tips: % % % Barbs @@ -93,7 +89,7 @@ % typically going backward. They cannot be filled, only stroked % % A special case are the arrows mimicking the tip at the end of a -% \rightarrow command. +% \rightarrow command. % % % Geometric @@ -151,7 +147,7 @@ \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter % Set ends \ifpgfarrowroundjoin - \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth} + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth} \else \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by\pgf@xc\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi} \fi @@ -205,12 +201,11 @@ \ifpgfarrowroundjoin j\fi% \ifpgfarrowroundcap c\fi% }, -} - - - +}% +% +% % Hooks are barbs that consist of an arc going forward from the line -% end and curving back by a given angle speficied using the |arc| +% end and curving back by a given angle specified using the |arc| % key. \pgfkeys{ @@ -219,9 +214,9 @@ \pgfmathparse{#1}% \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\def\expandafter\pgfarrowarc\expandafter{\pgfmathresult}} } -} +}% -\def\pgfarrowarc{180} +\def\pgfarrowarc{180}% \pgfdeclarearrow{ name = Hooks, @@ -247,7 +242,7 @@ \pgfarrowsupperhullpoint{-\pgfarrowlength}{.25\pgfarrowwidth} \else \pgfarrowsupperhullpoint{\ifpgfarrowroundcap-.5\pgfarrowlinewidth\else0pt\fi}{.25\pgfarrowwidth} - \pgfarrowsupperhullpoint{\ifpgfarrowroundcap-.5\pgfarrowlinewidth\else0pt\fi}{.5\pgfarrowwidth} + \pgfarrowsupperhullpoint{\ifpgfarrowroundcap-.5\pgfarrowlinewidth\else0pt\fi}{.5\pgfarrowwidth} \fi \fi % Adjust width and length: Take line thickness into account: @@ -261,9 +256,9 @@ % There are four different intervals for the values of % \pgfarrowsarc that give rise to four different settings of tip % ends and so on: - % - % Case 1: 0 <= Angle < 90 - % + % + % Case 1: 0 <= Angle < 90 + % \ifdim\pgfarrowarc pt<90pt% % Tip end is given by sin(pgfarrowarc)*length \pgfmathsin@{\pgfarrowarc} @@ -280,7 +275,7 @@ \else \ifpgfarrowroundcap\pgfarrowssetbackend{-.5\pgfarrowlinewidth}\fi% \fi% - \else% + \else% \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}% \pgfarrowssetbackend{-\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth}% \fi\fi\fi% @@ -289,14 +284,14 @@ \else% \ifpgfarrowharpoon \pgfarrowssetlineend{0pt} - \else + \else \pgfarrowssetlineend{.25\pgfarrowlinewidth} \fi \fi % Adjust arc: \pgf@x\pgfarrowarc pt% \advance\pgf@x by-90pt% - \edef\pgfarrowarc{\pgf@sys@tonumber\pgf@x}% + \edef\pgfarrowarc{\pgf@sys@tonumber\pgf@x}% % The following are needed in the code: \pgfarrowssavethe\pgfarrowlinewidth \pgfarrowssavethe\pgfarrowlength @@ -332,7 +327,7 @@ \ifpgfarrowroundjoin j\fi% \ifpgfarrowroundcap c\fi% }, -} +}% \pgfdeclarearrow{ @@ -363,7 +358,7 @@ \ifdim\pgfarrowarc pt>90pt \ifdim\pgfarrowarc pt<120pt \pgfarrowsupperhullpoint{\pgfmathresultx\pgfarrowlength}{.5\pgfarrowwidth} - \else + \else \pgfarrowsupperhullpoint{-.5\pgfarrowlength}{.5\pgfarrowwidth} \ifdim\pgfarrowarc pt>150pt \pgfarrowsupperhullpoint{-\pgfarrowlength}{.25\pgfarrowwidth} @@ -377,7 +372,7 @@ \ifpgfarrowharpoon \pgfutil@tempswatrue \fi - \ifpgfutil@tempswa + \ifpgfutil@tempswa \pgf@xa.5\pgfarrowwidth\advance\pgf@xa by-\pgfarrowlinewidth% \pgf@ya\pgfarrowlength\advance\pgf@ya by-\pgfarrowlinewidth% \pgfarrowsupperhullpoint{\pgfmathresultx\pgf@ya}{\pgfmathresulty\pgf@xa} @@ -435,7 +430,7 @@ \ifpgfarrowroundcap c\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% @@ -451,7 +446,7 @@ }, bending mode=polar, setup code = { - % Two useful numbers... + % Two useful numbers... \pgfutil@tempswafalse% \pgfutil@tempswbfalse% \pgfutil@tempdima\pgfarrowlength\advance\pgfutil@tempdima by-\pgfarrowinset\ifdim\pgfutil@tempdima<.5\pgfarrowlinewidth\pgfutil@tempdima.5\pgfarrowlinewidth\pgfutil@tempswatrue\fi% @@ -519,7 +514,7 @@ \ifpgfarrowroundjoin j\fi% \ifpgfarrowroundcap c\fi% }, -} +}% % Math barbs that resemble \rightarrow in different fonts: @@ -528,7 +523,7 @@ % The original default arrow head used in TikZ. It is modeled on an % old version of the \rightarrow head of the *old* Computer Modern -% fonts. +% fonts. \pgfdeclarearrow{ name = Classical TikZ Rightarrow, @@ -538,7 +533,7 @@ line width = 0pt 0.8 1, round }, - setup code = + setup code = { \ifpgfarrowharpoon\pgfarrowroundjointrue\fi % inner length: @@ -585,11 +580,11 @@ \pgfarrowsupperhullpoint{-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by.5\pgfarrowlinewidth}% % Lower end: \ifpgfarrowharpoon - \pgfarrowshullpoint{\pgfutil@tempdima\advance\pgf@x by-\pgflinewidth}{-.5\pgflinewidth}% + \pgfarrowshullpoint{\pgfutil@tempdima\advance\pgf@x by-\pgflinewidth}{-.5\pgflinewidth}% \pgfarrowshullpoint{-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by-.5\pgflinewidth}% \fi }, - drawing code = + drawing code = { \pgfsetdash{}{+0pt} \edef\pgf@orig@linewidth{\the\pgflinewidth} @@ -605,7 +600,7 @@ \pgfpathcurveto {\pgfqpoint{0.066666\pgfutil@tempdima}{0.3125\pgfutil@tempdimb}} {\pgfqpoint{.8\pgfutil@tempdima}{0.03125\pgfutil@tempdimb}} - {\pgfqpoint{\pgfutil@tempdima}{0pt}} + {\pgfqpoint{\pgfutil@tempdima}{0pt}} \pgfpathcurveto {\pgfqpoint{.8\pgfutil@tempdima}{-.03125\pgfutil@tempdimb}} {\pgfqpoint{0.066666\pgfutil@tempdima}{-.3125\pgfutil@tempdimb}} @@ -622,7 +617,7 @@ \ifpgfarrowroundjoin j\fi% \ifpgfarrowroundcap c\fi% }, -} +}% \def\pgf@arrows@old@tikz@harpoon{ \ifpgfarrowreversed @@ -640,7 +635,7 @@ {\pgfqpoint{0.8\pgfutil@tempdima\advance\pgf@x by-.5\pgflinewidth}{-0.125\pgflinewidth}} \pgfusepathqstroke \fi -} +}% \def\pgf@arrows@old@tikz@harpoon@reversed{ \pgfpathcurveto {\pgfqpoint{0.066666\pgfutil@tempdima}{0.3125\pgfutil@tempdimb}} @@ -658,7 +653,7 @@ \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima\advance\pgf@x by0.6\pgflinewidth}{0pt}} \pgfpathlineto{\pgfqpoint{\pgfutil@tempdima}{0pt}} \pgfusepathqstroke -} +}% % An approximation to the new (past 1992) Computer Modern math arrow @@ -673,7 +668,7 @@ line width = 0pt 1 1, round }, - setup code = + setup code = { % inner length: \pgfutil@tempdima\pgfarrowlength @@ -720,11 +715,11 @@ \pgfarrowsupperhullpoint{-\pgfutil@tempdima\advance\pgf@x by-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by.5\pgfarrowlinewidth}% % Lower end: \ifpgfarrowharpoon - \pgfarrowshullpoint{-\pgfarrowlinewidth}{-.5\pgfarrowlinewidth}% + \pgfarrowshullpoint{-\pgfarrowlinewidth}{-.5\pgfarrowlinewidth}% \pgfarrowshullpoint{-\pgfutil@tempdima\advance\pgf@x by-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by-.5\pgfarrowlinewidth}% \fi }, - drawing code = + drawing code = { \pgfsetdash{}{+0pt} \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi @@ -739,7 +734,7 @@ \ifpgfarrowharpoon \pgfpathlineto {\pgfqpoint{\ifpgfarrowreversed.5\else-\fi\pgfarrowlinewidth}{0pt}} - \else + \else \pgfpathcurveto {\pgfqpoint{-0.41019\pgfutil@tempdima}{-0.05833333\pgfutil@tempdimb}} {\pgfqpoint{-0.81731\pgfutil@tempdima}{-.2\pgfutil@tempdimb}} @@ -756,7 +751,7 @@ \ifpgfarrowroundjoin j\fi% \ifpgfarrowroundcap c\fi% }, -} +}% @@ -796,20 +791,20 @@ \pgfusepathqstroke }, parameters = {\the\pgfarrowlength} -} +}% % % -% Geomatric arrow tips +% Geometric arrow tips % % % Generic "latex-like" arrow tip. This is the basic arrow tip used in -% latex's picture environment. You can configure its length and width. +% latex's picture environment. You can configure its length and width. \pgfdeclarearrow{ name = Latex, @@ -852,7 +847,7 @@ \pgfarrowssetlineend{0pt} \fi \ifpgfarrowroundjoin - \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth} + \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth} \else \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth\ifpgfarrowharpoon\advance\pgf@x by1.5\pgf@xa\fi} \fi @@ -882,7 +877,7 @@ {\pgfqpoint{0pt}{\pgfutil@tempdimb}} \ifpgfarrowharpoon \pgfpathlineto {\pgfpointorigin} - \else + \else \pgfpathlineto {\pgfqpoint{0pt}{-\pgfutil@tempdimb}} \pgfpathcurveto {\pgfqpoint{.337381\pgfutil@tempdima}{-.519480\pgfutil@tempdimb}} {\pgfqpoint{.877192\pgfutil@tempdima}{-.077922\pgfutil@tempdimb}} @@ -899,7 +894,7 @@ \ifpgfarrowopen o\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% @@ -960,7 +955,7 @@ \advance\pgf@x by1pt% \pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}% \pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is inset miter - \pgf@yc.5\pgf@yc% + \pgf@yc.5\pgf@yc% % Inner length (pgfutil@tempdima) is now arrowlength - front miter - back miter \pgfutil@tempdima\pgfarrowlength% \advance\pgfutil@tempdima by-\pgf@xc% @@ -969,7 +964,7 @@ \advance\pgfutil@tempdimb by-\pgf@yb% % harpoon miter correction \ifpgfarrowroundjoin - \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} + \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} \else \pgfarrowssetbackend{0pt} \fi @@ -987,7 +982,7 @@ \fi \fi \ifpgfarrowroundjoin - \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by.5\pgfarrowlinewidth} + \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by.5\pgfarrowlinewidth} \else \pgfarrowssettipend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi} \fi @@ -1027,7 +1022,7 @@ \ifpgfarrowopen o\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% @@ -1037,7 +1032,7 @@ name = Kite, defaults = { length = +3.6pt +5.4, - width' = +0pt +0.5, + width' = +0pt +0.5, inset' = +0pt 0.25, line width = +0pt 1 1, }, @@ -1108,7 +1103,7 @@ \advance\pgfutil@tempdimb by\pgf@yb% % Set back end \ifpgfarrowroundjoin - \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} + \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} \else \pgfarrowssetbackend{0pt} \fi @@ -1119,7 +1114,7 @@ \pgfarrowssetlineend{\pgf@yc\advance\pgf@x by\pgflinewidth\advance\pgf@x by-\pgfarrowlinewidth} \fi \ifpgfarrowroundjoin - \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth} + \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth} \else \pgfarrowssettipend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi} \fi @@ -1158,7 +1153,7 @@ \ifpgfarrowopen o\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% @@ -1213,7 +1208,7 @@ \ifpgfarrowopen o\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% % A simple rectangle shape @@ -1283,7 +1278,7 @@ \ifpgfarrowopen o\fi% \ifpgfarrowroundjoin j\fi% }, -} +}% % Round cap @@ -1332,7 +1327,7 @@ \pgfusepathqfill }, parameters = {\the\pgfarrowlength} -} +}% @@ -1359,7 +1354,7 @@ \pgfusepathqfill }, parameters = {\the\pgfarrowlength} -} +}% @@ -1375,7 +1370,7 @@ \edef\pgf@marshal{\noexpand\pgfarrowsaddtooptions{\noexpand\pgfarrowslinewidthdependent{+0pt}{\pgf@sys@tonumber\pgf@x}{0}\pgfarrowlength\pgf@x}} \pgf@marshal } -} +}% \pgfdeclarearrow{ @@ -1420,7 +1415,7 @@ \pgfusepathqfill }, parameters = {\the\pgfarrowlength} -} +}% @@ -1451,7 +1446,7 @@ \pgfusepathqfill }, parameters = {\the\pgfarrowlength,\the\pgfarrowinset} -} +}% \pgfdeclarearrow{ @@ -1492,7 +1487,7 @@ \pgfusepathqfill }, parameters = {\the\pgfarrowlength,\the\pgfarrowinset} -} +}% @@ -1510,12 +1505,12 @@ \pgfmathparse{#1}% \expandafter\pgf@lib@meta@strip@dot\pgfmathresult.\relax% } -} +}% \def\pgf@lib@meta@strip@dot#1.#2\relax{% \pgfarrowsaddtooptions{\def\pgfarrown{#1}}% -} +}% -\def\pgfarrown{4} +\def\pgfarrown{4}% \pgfdeclarearrow{ name = Rays, @@ -1531,7 +1526,7 @@ \pgf@xa\pgfarrow@inc pt% \ifodd\pgfarrown\pgf@ya.25\pgf@xa\else\pgf@ya.5\pgf@xa\fi% \pgfmathsincos@{\pgf@sys@tonumber\pgf@ya}% - \pgf@x.5\pgfarrowlength% + \pgf@x.5\pgfarrowlength% \pgf@xa\pgfmathresultx\pgf@x% \ifpgfarrowroundcap \advance\pgf@xa by.5\pgfarrowlinewidth @@ -1542,7 +1537,7 @@ \fi% \pgfarrowssettipend{\pgf@xa} \pgfarrowssetbackend{-\pgf@xa} - % Hull is alwyas 8-point hull, except for tip + % Hull is always 8-point hull, except for tip % The following are needed in the code: \pgfarrowsupperhullpoint{\pgf@xa}{.25\pgfarrowwidth} \pgfarrowsupperhullpoint{.25\pgfarrowlength}{.5\pgfarrowwidth\ifpgfarrowroundcap\advance\pgf@y by.5\pgfarrowlinewidth\fi} @@ -1575,7 +1570,7 @@ \pgfpathlineto{\pgfpointorigin} \ifpgfarrowharpoon\ifdim\pgf@ya>\pgf@xa\else{\pgfsettransform\pgf@temp@trans\pgfpathlineto{\pgfqpoint{-.5\pgflinewidth}{0pt}}}\fi\fi \advance\pgf@ya by\pgf@xa\relax% - \pgfutil@repeat% + \pgfutil@repeat% } \pgfusepathqstroke }, @@ -1587,7 +1582,7 @@ \ifpgfarrowharpoon h\fi% \ifpgfarrowroundcap c\fi% } -} +}% @@ -1604,7 +1599,7 @@ Bar /.tip = {Tee Barb[length=+0pt]}, Bracket /.tip = {Tee Barb[inset'=+0pt +1,length=+0.75pt +1]}, Parenthesis /.tip = {Arc Barb[arc=+120,length=+1.725pt +2.3]} -} +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex index b6d1728363d..166ed875333 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex @@ -7,10 +7,10 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex,v 1.3 2013/09/23 18:04:36 tantau Exp $ +\ProvidesFileRCS{pgflibraryarrows.spaced.code.tex} -\usepgflibrary{arrows} +\usepgflibrary{arrows}% % This library offers "spaced" versions of existing arrows, where a @@ -21,71 +21,71 @@ % original name of the arrow. -\pgfarrowsdeclarecombine*{spaced to}{spaced to}{to}{to}{space}{space} -\pgfarrowsdeclarecombine*{spaced to reversed}{spaced to reversed}{to reversed}{to reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced implies}{spaced implies}{implies}{implies}{space}{space} -\pgfarrowsdeclarecombine*{spaced latex}{spaced latex}{latex}{latex}{space}{space} -\pgfarrowsdeclarecombine*{spaced latex reversed}{spaced latex reversed}{latex reversed}{latex reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced latex'}{spaced latex'}{latex'}{latex'}{space}{space} -\pgfarrowsdeclarecombine*{spaced latex' reversed}{spaced latex' reversed}{latex' reversed}{latex' reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced stealth}{spaced stealth}{stealth}{stealth}{space}{space} -\pgfarrowsdeclarecombine*{spaced stealth reversed}{spaced stealth reversed}{stealth reversed}{stealth reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced stealth'}{spaced stealth'}{stealth'}{stealth'}{space}{space} -\pgfarrowsdeclarecombine*{spaced stealth' reversed}{spaced stealth' reversed}{stealth' reversed}{stealth' reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 90}{spaced triangle 90}{triangle 90}{triangle 90}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 90 reversed}{spaced triangle 90 reversed}{triangle 90 reversed}{triangle 90 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 60}{spaced triangle 60}{triangle 60}{triangle 60}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 60 reversed}{spaced triangle 60 reversed}{triangle 60 reversed}{triangle 60 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 45}{spaced triangle 45}{triangle 45}{triangle 45}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 45 reversed}{spaced triangle 45 reversed}{triangle 45 reversed}{triangle 45 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 90}{spaced open triangle 90}{open triangle 90}{open triangle 90}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 90 reversed}{spaced open triangle 90 reversed}{open triangle 90 reversed}{open triangle 90 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 60}{spaced open triangle 60}{open triangle 60}{open triangle 60}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 60 reversed}{spaced open triangle 60 reversed}{open triangle 60 reversed}{open triangle 60 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 45}{spaced open triangle 45}{open triangle 45}{open triangle 45}{space}{space} -\pgfarrowsdeclarecombine*{spaced open triangle 45 reversed}{spaced open triangle 45 reversed}{open triangle 45 reversed}{open triangle 45 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 90}{spaced angle 90}{angle 90}{angle 90}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 90 reversed}{spaced angle 90 reversed}{angle 90 reversed}{angle 90 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 60}{spaced angle 60}{angle 60}{angle 60}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 60 reversed}{spaced angle 60 reversed}{angle 60 reversed}{angle 60 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 45}{spaced angle 45}{angle 45}{angle 45}{space}{space} -\pgfarrowsdeclarecombine*{spaced angle 45 reversed}{spaced angle 45 reversed}{angle 45 reversed}{angle 45 reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced hooks}{spaced hooks}{hooks}{hooks}{space}{space} -\pgfarrowsdeclarecombine*{spaced hooks reversed}{spaced hooks reversed}{hooks reversed}{hooks reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced o}{spaced o}{o}{o}{space}{space} -\pgfarrowsdeclarecombine*{spaced *}{spaced *}{*}{*}{space}{space} -\pgfarrowsdeclarecombine*{spaced diamond}{spaced diamond}{diamond}{diamond}{space}{space} -\pgfarrowsdeclarecombine*{spaced open diamond}{spaced open diamond}{open diamond}{open diamond}{space}{space} -\pgfarrowsdeclarecombine*{spaced square}{spaced square}{square}{square}{space}{space} -\pgfarrowsdeclarecombine*{spaced open square}{spaced open square}{open square}{open square}{space}{space} -\pgfarrowsdeclarecombine*{spaced serif cm}{spaced serif cm}{serif cm}{serif cm}{space}{space} -\pgfarrowsdeclarecombine*{spaced left to}{spaced left to}{left to}{left to}{space}{space} -\pgfarrowsdeclarecombine*{spaced left to reversed}{spaced left to reversed}{left to reversed}{left to reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced right to}{spaced right to}{right to}{right to}{space}{space} -\pgfarrowsdeclarecombine*{spaced right to reversed}{spaced right to reversed}{right to reversed}{right to reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced left hook}{spaced left hook}{left hook}{left hook}{space}{space} -\pgfarrowsdeclarecombine*{spaced left hook reversed}{spaced left hook reversed}{left hook reversed}{left hook reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced right hook}{spaced right hook}{right hook}{right hook}{space}{space} -\pgfarrowsdeclarecombine*{spaced right hook reversed}{spaced right hook reversed}{right hook reversed}{right hook reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced round cap}{spaced round cap}{round cap}{round cap}{space}{space} -\pgfarrowsdeclarecombine*{spaced butt cap}{spaced butt cap}{butt cap}{butt cap}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 90 cap}{spaced triangle 90 cap}{triangle 90 cap}{triangle 90 cap}{space}{space} -\pgfarrowsdeclarecombine*{spaced triangle 90 cap reversed}{spaced triangle 90 cap reversed}{triangle 90 cap reversed}{triangle 90 cap reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced fast cap}{spaced fast cap}{fast cap}{fast cap}{space}{space} -\pgfarrowsdeclarecombine*{spaced fast cap reversed}{spaced fast cap reversed}{fast cap reversed}{fast cap reversed}{space}{space} -\pgfarrowsdeclarecombine*{spaced (}{spaced )}{(}{)}{space}{space} -\pgfarrowsdeclarecombine*{spaced )}{spaced (}{)}{(}{space}{space} -\pgfarrowsdeclarecombine*{spaced |}{spaced |}{|}{|}{space}{space} +\pgfarrowsdeclarecombine*{spaced to}{spaced to}{to}{to}{space}{space}% +\pgfarrowsdeclarecombine*{spaced to reversed}{spaced to reversed}{to reversed}{to reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced implies}{spaced implies}{implies}{implies}{space}{space}% +\pgfarrowsdeclarecombine*{spaced latex}{spaced latex}{latex}{latex}{space}{space}% +\pgfarrowsdeclarecombine*{spaced latex reversed}{spaced latex reversed}{latex reversed}{latex reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced latex'}{spaced latex'}{latex'}{latex'}{space}{space}% +\pgfarrowsdeclarecombine*{spaced latex' reversed}{spaced latex' reversed}{latex' reversed}{latex' reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced stealth}{spaced stealth}{stealth}{stealth}{space}{space}% +\pgfarrowsdeclarecombine*{spaced stealth reversed}{spaced stealth reversed}{stealth reversed}{stealth reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced stealth'}{spaced stealth'}{stealth'}{stealth'}{space}{space}% +\pgfarrowsdeclarecombine*{spaced stealth' reversed}{spaced stealth' reversed}{stealth' reversed}{stealth' reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 90}{spaced triangle 90}{triangle 90}{triangle 90}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 90 reversed}{spaced triangle 90 reversed}{triangle 90 reversed}{triangle 90 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 60}{spaced triangle 60}{triangle 60}{triangle 60}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 60 reversed}{spaced triangle 60 reversed}{triangle 60 reversed}{triangle 60 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 45}{spaced triangle 45}{triangle 45}{triangle 45}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 45 reversed}{spaced triangle 45 reversed}{triangle 45 reversed}{triangle 45 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 90}{spaced open triangle 90}{open triangle 90}{open triangle 90}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 90 reversed}{spaced open triangle 90 reversed}{open triangle 90 reversed}{open triangle 90 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 60}{spaced open triangle 60}{open triangle 60}{open triangle 60}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 60 reversed}{spaced open triangle 60 reversed}{open triangle 60 reversed}{open triangle 60 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 45}{spaced open triangle 45}{open triangle 45}{open triangle 45}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open triangle 45 reversed}{spaced open triangle 45 reversed}{open triangle 45 reversed}{open triangle 45 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 90}{spaced angle 90}{angle 90}{angle 90}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 90 reversed}{spaced angle 90 reversed}{angle 90 reversed}{angle 90 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 60}{spaced angle 60}{angle 60}{angle 60}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 60 reversed}{spaced angle 60 reversed}{angle 60 reversed}{angle 60 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 45}{spaced angle 45}{angle 45}{angle 45}{space}{space}% +\pgfarrowsdeclarecombine*{spaced angle 45 reversed}{spaced angle 45 reversed}{angle 45 reversed}{angle 45 reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced hooks}{spaced hooks}{hooks}{hooks}{space}{space}% +\pgfarrowsdeclarecombine*{spaced hooks reversed}{spaced hooks reversed}{hooks reversed}{hooks reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced o}{spaced o}{o}{o}{space}{space}% +\pgfarrowsdeclarecombine*{spaced *}{spaced *}{*}{*}{space}{space}% +\pgfarrowsdeclarecombine*{spaced diamond}{spaced diamond}{diamond}{diamond}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open diamond}{spaced open diamond}{open diamond}{open diamond}{space}{space}% +\pgfarrowsdeclarecombine*{spaced square}{spaced square}{square}{square}{space}{space}% +\pgfarrowsdeclarecombine*{spaced open square}{spaced open square}{open square}{open square}{space}{space}% +\pgfarrowsdeclarecombine*{spaced serif cm}{spaced serif cm}{serif cm}{serif cm}{space}{space}% +\pgfarrowsdeclarecombine*{spaced left to}{spaced left to}{left to}{left to}{space}{space}% +\pgfarrowsdeclarecombine*{spaced left to reversed}{spaced left to reversed}{left to reversed}{left to reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced right to}{spaced right to}{right to}{right to}{space}{space}% +\pgfarrowsdeclarecombine*{spaced right to reversed}{spaced right to reversed}{right to reversed}{right to reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced left hook}{spaced left hook}{left hook}{left hook}{space}{space}% +\pgfarrowsdeclarecombine*{spaced left hook reversed}{spaced left hook reversed}{left hook reversed}{left hook reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced right hook}{spaced right hook}{right hook}{right hook}{space}{space}% +\pgfarrowsdeclarecombine*{spaced right hook reversed}{spaced right hook reversed}{right hook reversed}{right hook reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced round cap}{spaced round cap}{round cap}{round cap}{space}{space}% +\pgfarrowsdeclarecombine*{spaced butt cap}{spaced butt cap}{butt cap}{butt cap}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 90 cap}{spaced triangle 90 cap}{triangle 90 cap}{triangle 90 cap}{space}{space}% +\pgfarrowsdeclarecombine*{spaced triangle 90 cap reversed}{spaced triangle 90 cap reversed}{triangle 90 cap reversed}{triangle 90 cap reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced fast cap}{spaced fast cap}{fast cap}{fast cap}{space}{space}% +\pgfarrowsdeclarecombine*{spaced fast cap reversed}{spaced fast cap reversed}{fast cap reversed}{fast cap reversed}{space}{space}% +\pgfarrowsdeclarecombine*{spaced (}{spaced )}{(}{)}{space}{space}% +\pgfarrowsdeclarecombine*{spaced )}{spaced (}{)}{(}{space}{space}% +\pgfarrowsdeclarecombine*{spaced |}{spaced |}{|}{|}{space}{space}% \pgfdeclarearrow{ name = spaced [-spaced ], means = square bracket[].space -} +}% \pgfdeclarearrow{ name = spaced ]-spaced [, means = square bracket[reversed].space -} +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex index 2ae9eb00e5a..42217aadf30 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex @@ -7,11 +7,11 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarycurvilinear.code.tex,v 1.4 2015/05/14 14:43:05 cfeuersaenger Exp $ +\ProvidesFileRCS{pgflibrarycurvilinear.code.tex} % % This file defines commands for computing points in curvilinear -% coordinate systems. +% coordinate systems. % @@ -24,7 +24,7 @@ % precomputations are done; subsequent calls to % \pgfpointcurvilinearxxx based on this Bezier curve will be % relatively quick. -% +% @@ -51,7 +51,7 @@ % speed against precision. Also note that the results will only be % best near the start of the curve and may be far off near the end if % that end is degenerate (second control point very near to end -% point). +% point). % % Example: % @@ -60,7 +60,7 @@ % {\pgfpoint{5.5mm}{10mm}} % {\pgfpoint{10mm}{5.5mm}} % {\pgfpoint{10mm}{0mm}} % nearly a quarter circle -% \pgfpointcurvilinearbezierorthogonal{5mm}{5mm} +% \pgfpointcurvilinearbezierorthogonal{5mm}{5mm} % % should be 5mm along the circle, put at % % distance 15mm from the origin (5mm from the circle line). @@ -145,7 +145,7 @@ \let\pgf@curvilinear@comp@d\pgf@curvilinear@comp@d@initial% \let\pgf@curvilinear@comp@e\pgf@curvilinear@comp@e@initial% \let\pgf@curvilinear@point\pgf@curvilinear@curve@point% -} +}% \newdimen\pgf@curvilinear@time@a \newdimen\pgf@curvilinear@length@a \newdimen\pgf@curvilinear@length@b @@ -158,10 +158,10 @@ \let\pgf@curvilinear@quot@a\pgfmathresult% \let\pgf@curvilinear@comp@a\pgf@curvilinear@comp@a@cont% \pgf@curvilinear@comp@a@cont% -} +}% \def\pgf@curvilinear@comp@a@cont{% \pgf@x\pgf@curvilinear@quot@a\pgf@x% -} +}% \def\pgf@curvilinear@comp@b@initial{% \pgf@y=\pgf@curvilinear@length@b% @@ -174,11 +174,11 @@ \edef\pgf@curvilinear@correct@b{\pgf@sys@tonumber\pgf@y}% \let\pgf@curvilinear@comp@b\pgf@curvilinear@comp@b@cont% \pgf@curvilinear@comp@b@cont% -} +}% \def\pgf@curvilinear@comp@b@cont{% \pgf@x\pgf@curvilinear@quot@b\pgf@x% \advance\pgf@x by\pgf@curvilinear@correct@b pt% -} +}% \def\pgf@curvilinear@comp@c@initial{% \pgf@y=\pgf@curvilinear@length@c% @@ -192,11 +192,11 @@ \edef\pgf@curvilinear@correct@c{\pgf@sys@tonumber\pgf@y}% \let\pgf@curvilinear@comp@c\pgf@curvilinear@comp@c@cont% \pgf@curvilinear@comp@c@cont% -} +}% \def\pgf@curvilinear@comp@c@cont{% \pgf@x\pgf@curvilinear@quot@c\pgf@x% \advance\pgf@x by\pgf@curvilinear@correct@c pt% -} +}% \def\pgf@curvilinear@comp@d@initial{% \pgf@y=\pgf@curvilinear@length@d% @@ -210,11 +210,11 @@ \edef\pgf@curvilinear@correct@d{\pgf@sys@tonumber\pgf@y}% \let\pgf@curvilinear@comp@d\pgf@curvilinear@comp@d@cont% \pgf@curvilinear@comp@d@cont% -} +}% \def\pgf@curvilinear@comp@d@cont{% \pgf@x\pgf@curvilinear@quot@d\pgf@x% \advance\pgf@x by\pgf@curvilinear@correct@d pt% -} +}% \def\pgf@curvilinear@comp@e@initial{% \pgfmathmultiply@{8}{\pgf@sys@tonumber\pgf@curvilinear@time@a}% @@ -222,20 +222,20 @@ \let\pgf@curvilinear@quot@e\pgfmathresult% \let\pgf@curvilinear@comp@e\pgf@curvilinear@comp@e@cont% \pgf@curvilinear@comp@e@cont% -} +}% \def\pgf@curvilinear@comp@e@cont{% \pgf@x\pgf@curvilinear@quot@e\pgf@x% -} +}% % Convert a distance into a time -% +% % #1 = a distance -% +% % Description: % % After having called \pgfsetcurvilinearbeziercurve, you can use this -% macro to convert a distance into a time along the curve set in that +% macro to convert a distance into a time along the curve set in that % command. The result will be stored in \pgf@x. It will only be % reasonably precise for small nonnegative #1 (in particular, #1 % should not be more than about half the length of the curve). @@ -255,7 +255,7 @@ \else% \pgf@curvilinear@comp@e% \fi\fi% -} +}% @@ -279,7 +279,7 @@ % % In addition to setting \pgf@x and \pgf@y, \pgf@xa/ya will be set to % a tangent along the curve at the given point and \pgf@xb/yb to a -% tanget orthogonal to the curve. +% tangent orthogonal to the curve. \def\pgfpointcurvilinearbezierorthogonal#1#2{% \pgfmathsetmacro\pgf@curvilinear@yfactor{#2}% @@ -296,7 +296,7 @@ \pgf@y\pgf@curvilinear@yfactor\pgf@y% \advance\pgf@x by\pgf@xc% \advance\pgf@y by\pgf@yc% -} +}% \def\pgf@diff@curvi@ac{% \pgf@curvilinear@line@a% @@ -313,7 +313,7 @@ \fi\fi\fi\fi% \pgf@xb-\pgf@xb% \pgf@yb-\pgf@yb% -} +}% @@ -330,13 +330,13 @@ % we compute that point at distance d along the Bezier curve B. Let % B(d) be this point. Then, we rotate this point around the start of % the curve (B(0)) by r degrees. -% +% % As an example, consider a triangle with one tip at the origin and % the other tips as (4cm,3cm) and (4cm,-3cm). Then this triangle would be % transformed as follows: We take the first 5cm of the Bezier curve % and rotate it by roughly 37 degrees to the left and by 37 degrees to % the right. -% +% % Note that this command is pretty expensive. \def\pgfpointcurvilinearbezierpolar#1#2{% @@ -373,7 +373,7 @@ }% \pgf@curvilinear@line@a% }% -} +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfadings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfadings.code.tex index 39fca783437..8d25f73b37d 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfadings.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfadings.code.tex @@ -7,51 +7,51 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryfadings.code.tex,v 1.3 2008/02/07 19:25:41 tantau Exp $ +\ProvidesFileRCS{pgflibraryfadings.code.tex} % Axial fadings \pgfdeclarehorizontalshading{pgf@lib@fade@east}{100bp} {color(0bp)=(pgftransparent!0); color(25bp)=(pgftransparent!0); - color(75bp)=(pgftransparent!100); color(100bp)=(pgftransparent!100)} + color(75bp)=(pgftransparent!100); color(100bp)=(pgftransparent!100)}% \pgfdeclarehorizontalshading{pgf@lib@fade@west}{100bp} {color(0bp)=(pgftransparent!100); color(25bp)=(pgftransparent!100); - color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)} + color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}% \pgfdeclareverticalshading{pgf@lib@fade@north}{100bp} {color(0bp)=(pgftransparent!0); color(25bp)=(pgftransparent!0); - color(75bp)=(pgftransparent!100); color(100bp)=(pgftransparent!100)} + color(75bp)=(pgftransparent!100); color(100bp)=(pgftransparent!100)}% \pgfdeclareverticalshading{pgf@lib@fade@south}{100bp} {color(0bp)=(pgftransparent!100); color(25bp)=(pgftransparent!100); - color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)} + color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}% -\pgfdeclarefading{east}{\pgfuseshading{pgf@lib@fade@east}} -\pgfdeclarefading{west}{\pgfuseshading{pgf@lib@fade@west}} -\pgfdeclarefading{north}{\pgfuseshading{pgf@lib@fade@north}} -\pgfdeclarefading{south}{\pgfuseshading{pgf@lib@fade@south}} +\pgfdeclarefading{east}{\pgfuseshading{pgf@lib@fade@east}}% +\pgfdeclarefading{west}{\pgfuseshading{pgf@lib@fade@west}}% +\pgfdeclarefading{north}{\pgfuseshading{pgf@lib@fade@north}}% +\pgfdeclarefading{south}{\pgfuseshading{pgf@lib@fade@south}}% % Circular fadings \pgfdeclareradialshading{tikz@lib@fade@circle@10}{\pgfpointorigin}{ color(0pt)=(pgftransparent!0); color(22.5bp)=(pgftransparent!0); - color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)} -\pgfdeclarefading{circle with fuzzy edge 10 percent}{\pgfuseshading{tikz@lib@fade@circle@10}} + color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)}% +\pgfdeclarefading{circle with fuzzy edge 10 percent}{\pgfuseshading{tikz@lib@fade@circle@10}}% \pgfdeclareradialshading{tikz@lib@fade@circle@15}{\pgfpointorigin}{ color(0pt)=(pgftransparent!0); color(21.25bp)=(pgftransparent!0); - color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)} -\pgfdeclarefading{circle with fuzzy edge 15 percent}{\pgfuseshading{tikz@lib@fade@circle@15}} + color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)}% +\pgfdeclarefading{circle with fuzzy edge 15 percent}{\pgfuseshading{tikz@lib@fade@circle@15}}% \pgfdeclareradialshading{tikz@lib@fade@circle@20}{\pgfpointorigin}{ color(0pt)=(pgftransparent!0); color(20bp)=(pgftransparent!0); - color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)} -\pgfdeclarefading{circle with fuzzy edge 20 percent}{\pgfuseshading{tikz@lib@fade@circle@20}} + color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)}% +\pgfdeclarefading{circle with fuzzy edge 20 percent}{\pgfuseshading{tikz@lib@fade@circle@20}}% \pgfdeclareradialshading{tikz@lib@fade@fuzzy@15}{\pgfpointorigin}{ color(0pt)=(pgftransparent!100); color(21.25bp)=(pgftransparent!100); color(23.125bp)=(pgftransparent!0); - color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)} -\pgfdeclarefading{fuzzy ring 15 percent}{\pgfuseshading{tikz@lib@fade@fuzzy@15}} + color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)}% +\pgfdeclarefading{fuzzy ring 15 percent}{\pgfuseshading{tikz@lib@fade@fuzzy@15}}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex index 50a7521f826..b860192f45c 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex @@ -9,131 +9,132 @@ \pgfkeys{/pgf/.cd, - fixed point arithmetic/.code={% - \pgfmathfp@plots@install% - \pgfmathfp@parser@install% - \let\pgfmathparse=\pgfmathfpparse% - \pgfkeys{/pgf/fixed point/.cd, #1}% - },% - fixed point/.cd, - scale results/.code={% - \pgfmathfpparse{#1}% - \let\pgfmathfpscale=\pgfmathresult% - }% -} - -\def\pgfmathfpscale{1} + fixed point arithmetic/.code={% + \pgfmathfp@plots@install% + \pgfmathfp@parser@install% + \let\pgfmathparse=\pgfmathfpparse% + \pgfkeys{/pgf/fixed point/.cd, #1}% + },% + fixed point/.cd, + scale results/.code={% + \pgfmathfpparse{#1}% + \let\pgfmathfpscale=\pgfmathresult% + }% +}% + +\def\pgfmathfpscale{1}% \def\pgfmathfpparse{% - \begingroup% - \let\pgfmathpostparse=\relax% - \pgfmath@catcodes% - \pgfmath@quickparsefalse% - \pgfmathfpparse@} + \begingroup% + \let\pgfmathpostparse=\relax% + \pgfmath@catcodes% + \pgfmath@quickparsefalse% + \pgfmathfpparse@}% \def\pgfmathfpparse@#1{% - \edef\pgfmathfp@expression{#1}% - \expandafter\pgfmathfpparse@@\pgfmathfp@expression\pgfmathfp@} + \edef\pgfmathfp@expression{#1}% + \expandafter\pgfmathfpparse@@\pgfmathfp@expression\pgfmathfp@}% -\def\pgfmathfp@char@asterisk{*} +\def\pgfmathfp@char@asterisk{*}% \def\pgfmathfpparse@@#1#2\pgfmathfp@{% - \def\pgfmathfp@test{#1}% - \ifx\pgfmathfp@test\pgfmathfp@char@asterisk% - \edef\pgfmathfp@expression{\pgfmathfpscale#1#2}% - \else% - \edef\pgfmathfp@expression{#1#2}% - \fi% - \expandafter\pgfmathparse@\expandafter{\pgfmathfp@expression}% - % \endgroup provided by \pgfpathmarse@end -} + \def\pgfmathfp@test{#1}% + \ifx\pgfmathfp@test\pgfmathfp@char@asterisk% + \edef\pgfmathfp@expression{\pgfmathfpscale#1#2}% + \else% + \edef\pgfmathfp@expression{#1#2}% + \fi% + \expandafter\pgfmathparse@\expandafter{\pgfmathfp@expression}% + % \endgroup provided by \pgfpathmarse@end +}% % Crude handling of file plots % \pgfkeys{/pgf/fixed point/.cd, scale file plot x/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalex{\pgfmathresult*}, scale file plot y/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscaley{\pgfmathresult*}, - scale file plot z/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalez{\pgfmathresult*} -} + scale file plot z/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalez{\pgfmathresult*}, +}% \def\pgfmathfp@plots@install{% - \let\pgfmathfpplotscalex=\pgfutil@empty - \let\pgfmathfpplotscaley=\pgfutil@empty - \let\pgfmathfpplotscalez=\pgfutil@empty - \let\pgf@parsexyline=\pgfmathfp@parsexyline% - \let\pgf@parsexyzline=\pgfmathfp@parsexyzline% -} + \let\pgfmathfpplotscalex=\pgfutil@empty + \let\pgfmathfpplotscaley=\pgfutil@empty + \let\pgfmathfpplotscalez=\pgfutil@empty + \let\pgf@parsexyline=\pgfmathfp@parsexyline% + \let\pgf@parsexyzline=\pgfmathfp@parsexyzline% +}% \def\pgfmathfp@parsexyline#1 #2 #3\pgf@stop{% - \edef\pgfmathfp@marshal{% - \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}}% - }% - \pgfmathfp@marshal% -} + \edef\pgfmathfp@marshal{% + \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}}% + }% + \pgfmathfp@marshal% +}% \def\pgfmathfp@parsexyzline#1 #2 #3 #4\pgf@stop{% - \edef\pgfmathfp@marshal{% - \noexpand\pgfplotstreampoint{% - \noexpand\pgfpointxyz{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}{\pgfmathfpplotscalez#3}% - }% - }% - \pgfmathfp@marshal% -} - -% + \edef\pgfmathfp@marshal{% + \noexpand\pgfplotstreampoint{% + \noexpand\pgfpointxyz{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}{\pgfmathfpplotscalez#3}% + }% + }% + \pgfmathfp@marshal% +}% + +% \def\pgfmathfp@parser@install{% - % - \expandafter\ifx\csname FP@version\endcsname\relax% - \pgferror{You need to say `\string\usepackage{fp}' to use % - fixed point arithmetic}% - \else% - % - % Don't want messages. - % - \FPmessagesfalse% - \FPdebugfalse% - % - % Install float commands... - % - \let\pgfmathadd@=\pgfmathfpadd@% - \let\pgfmathsubtract@=\pgfmathfpsubtract@% - \let\pgfmathmultiply@=\pgfmathfpmultiply@% - \let\pgfmathdivide@=\pgfmathfpdivide@% - \let\pgfmathabs@=\pgfmathfpabs@% - \let\pgfmathround@=\pgfmathfpround@% - \let\pgfmathfloor@=\pgfmathfpfloor@% - \let\pgfmathceil@=\pgfmathfpceil@% - \let\pgfmathmod@=\pgfmathfpmod@% - \let\pgfmathmax@=\pgfmathfpmax@% - \let\pgfmathmin@=\pgfmathfpmin@% - \let\pgfmathsin@=\pgfmathfpsin@% - \let\pgfmathcos@=\pgfmathfpcos@% - \let\pgfmathtan@=\pgfmathfptan@% - \let\pgfmathdeg@=\pgfmathfpdeg@% - \let\pgfmathrad@=\pgfmathfprad@% - \let\pgfmathatan@=\pgfmathfpatan@% - \let\pgfmathasin@=\pgfmathfpasin@% - \let\pgfmathacos@=\pgfmathfpacos@% - \let\pgfmathcot@=\pgfmathfpcot@% - \let\pgfmathsec@=\pgfmathfpsec@% - \let\pgfmathcosec@=\pgfmathfpcosec@% - \let\pgfmathpow@=\pgfmathfppow@% - \let\pgfmathexp@=\pgfmathfpexp@% - \let\pgfmathln@=\pgfmathfpln@% - \let\pgfmathsqrt@=\pgfmathfpsqrt@% - \let\pgfmath@pi=\pgfmathfppi@% - \let\pgfmathveclen@=\pgfmathfpveclen@% - \let\pgfmathe@=\pgfmathfpe@% - % - \let\pgfmathlessthan@=\pgfmathfplessthan@% - \let\pgfmathgreaterthan@=\pgfmathfpgreaterthan@% - \let\pgfmathequalto@=\pgfmathfpequalto@% - % - \let\pgfmathrnd=\pgfmathfprnd% - \let\pgfmathrand=\pgfmathfprand% - \let\pgfmathsetseed=\pgfmathfpsetseed% - % - \let\pgfmathscientific=\pgfmathfpscientific% - \fi% + % + \expandafter\ifx\csname FP@version\endcsname\relax% + \pgferror{You need to say `\string\usepackage{fp}' to use % + fixed point arithmetic}% + \else% + % + % Don't want messages. + % + \FPmessagesfalse% + \FPdebugfalse% + % + % Install float commands... + % + \let\pgfmathadd@=\pgfmathfpadd@% + \let\pgfmathsubtract@=\pgfmathfpsubtract@% + \let\pgfmathmultiply@=\pgfmathfpmultiply@% + \let\pgfmathdivide@=\pgfmathfpdivide@% + \let\pgfmathabs@=\pgfmathfpabs@% + \let\pgfmathneg@=\pgfmathfpneg@% + \let\pgfmathround@=\pgfmathfpround@% + \let\pgfmathfloor@=\pgfmathfpfloor@% + \let\pgfmathceil@=\pgfmathfpceil@% + \let\pgfmathmod@=\pgfmathfpmod@% + \let\pgfmathmax@=\pgfmathfpmax@% + \let\pgfmathmin@=\pgfmathfpmin@% + \let\pgfmathsin@=\pgfmathfpsin@% + \let\pgfmathcos@=\pgfmathfpcos@% + \let\pgfmathtan@=\pgfmathfptan@% + \let\pgfmathdeg@=\pgfmathfpdeg@% + \let\pgfmathrad@=\pgfmathfprad@% + \let\pgfmathatan@=\pgfmathfpatan@% + \let\pgfmathasin@=\pgfmathfpasin@% + \let\pgfmathacos@=\pgfmathfpacos@% + \let\pgfmathcot@=\pgfmathfpcot@% + \let\pgfmathsec@=\pgfmathfpsec@% + \let\pgfmathcosec@=\pgfmathfpcosec@% + \let\pgfmathpow@=\pgfmathfppow@% + \let\pgfmathexp@=\pgfmathfpexp@% + \let\pgfmathln@=\pgfmathfpln@% + \let\pgfmathsqrt@=\pgfmathfpsqrt@% + \let\pgfmath@pi=\pgfmathfppi@% + \let\pgfmathveclen@=\pgfmathfpveclen@% + \let\pgfmathe@=\pgfmathfpe@% + % + \let\pgfmathlessthan@=\pgfmathfplessthan@% + \let\pgfmathgreaterthan@=\pgfmathfpgreaterthan@% + \let\pgfmathequalto@=\pgfmathfpequalto@% + % + \let\pgfmathrnd=\pgfmathfprnd% + \let\pgfmathrand=\pgfmathfprand% + \let\pgfmathsetseed=\pgfmathfpsetseed% + % + \let\pgfmathscientific=\pgfmathfpscientific% + \fi% }% \def\pgfmathfpe@{let\pgfmathresult=\FPe}% @@ -143,495 +144,513 @@ % Scientific notation. \def\pgfmathfpscientific#1#2{% - \begingroup% - \FPpow\pgfmathresult{10}{#2}\unskip% Needed. - \FPmul\pgfmathresult{#1}{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPpow\pgfmathresult{10}{#2}\unskip% Needed. + \FPmul\pgfmathresult{#1}{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % Comparison stuff... % lessthan % \def\pgfmathfplessthan#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfplessthan@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfplessthan@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfplessthan@#1#2{% - \begingroup% - \FPiflt{#1}{#2}% - \def\pgfmathresult{1.0}% - \else% - \def\pgfmathresult{0.0}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPiflt{#1}{#2}% + \def\pgfmathresult{1.0}% + \else% + \def\pgfmathresult{0.0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % greaterthan % \def\pgfmathfpgreaterthan#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpgreaterthan@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpgreaterthan@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpgreaterthan@#1#2{% - \begingroup% - \FPifgt{#1}{#2}% - \def\pgfmathresult{1.0}% - \else% - \def\pgfmathresult{0.0}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPifgt{#1}{#2}% + \def\pgfmathresult{1.0}% + \else% + \def\pgfmathresult{0.0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % equalto % \def\pgfmathfpequalto#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpequalto@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpequalto@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpequalto@#1#2{% - \begingroup% - \FPifeq{#1}{#2}% - \def\pgfmathresult{1.0}% - \else% - \def\pgfmathresult{0.0}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} - - + \begingroup% + \FPifeq{#1}{#2}% + \def\pgfmathresult{1.0}% + \else% + \def\pgfmathresult{0.0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% + + % Basic arithmetic stuff... % add % \def\pgfmathfpadd#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpadd@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpadd@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpadd@#1#2{% - \begingroup% - \FPadd\pgfmathresult{#1}{#2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPadd\pgfmathresult{#1}{#2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % subtract % \def\pgfmathfpsubtract#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpsubtract@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpsubtract@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpsubtract@#1#2{% - \begingroup% - \FPsub\pgfmathresult{#1}{#2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPsub\pgfmathresult{#1}{#2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % multiply % \def\pgfmathfpmultiply#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpmultiply@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpmultiply@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpmultiply@#1#2{% - \begingroup% - \FPmul\pgfmathresult{#1}{#2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{#2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % divide % \def\pgfmathfpdivide#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpdivide@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpdivide@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpdivide@#1#2{% - \begingroup% - \FPdiv\pgfmathresult{#1}{#2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPdiv\pgfmathresult{#1}{#2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % abs % \def\pgfmathfpabs#1{% - \pgfmathfpparse{#1}% - \pgfmathfpabs@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpabs@{\pgfmathresult}% +}% \def\pgfmathfpabs@#1{% - \begingroup% - \FPabs\pgfmathresult{#1}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPabs\pgfmathresult{#1}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% + +% neg +% +\def\pgfmathfpneg#1{% + \pgfmathfpparse{#1}% + \pgfmathfpneg@{\pgfmathresult}% +}% +\def\pgfmathfpneg@#1{% + \begingroup% + \FPneg\pgfmathresult{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup% +}% % round % \def\pgfmathfpround#1{% - \pgfmathfpparse{#1}% - \pgfmathfpround@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpround@{\pgfmathresult}% +}% \def\pgfmathfpround@#1{% - \begingroup% - \FPround\pgfmathresult{#1}{0}% - \edef\pgfmathresult{\pgfmathresult.0}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPround\pgfmathresult{#1}{0}% + \edef\pgfmathresult{\pgfmathresult.0}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % floor % \def\pgfmathfpfloor#1{% - \pgfmathfpparse{#1}% - \pgfmathfpfloor@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpfloor@{\pgfmathresult}% +}% \def\pgfmathfpfloor@#1{% - \begingroup% - \FPtrunc\pgfmathresult{#1}{0}% - \FPifneg{#1}% - \FPsub\pgfmathresult{\pgfmathresult}{1}% - \fi% - \edef\pgfmathresult{\pgfmathresult.0}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPtrunc\pgfmathresult{#1}{0}% + \FPifneg{#1}% + \FPsub\pgfmathresult{\pgfmathresult}{1}% + \fi% + \edef\pgfmathresult{\pgfmathresult.0}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % ceil % \def\pgfmathfpceil#1{% - \pgfmathfpparse{#1}% - \pgfmathfpceil@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpceil@{\pgfmathresult}% +}% \def\pgfmathfpceil@#1{% - \begingroup% - \FPtrunc\pgfmathresult{#1}{0}% - \FPifpos{#1}% - \FPadd\pgfmathresult{\pgfmathresult}{1}% - \fi% - \edef\pgfmathresult{\pgfmathresult.0}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPtrunc\pgfmathresult{#1}{0}% + \FPifpos{#1}% + \FPadd\pgfmathresult{\pgfmathresult}{1}% + \fi% + \edef\pgfmathresult{\pgfmathresult.0}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % mod % \def\pgfmathfpmod#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpmod@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpmod@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpmod@#1#2{% - \begingroup% - \FPdiv\pgfmathresult{#1}{#2}% - \FPtrunc\pgfmathresult{\pgfmathresult}{0}% - \FPmul\pgfmathresult{\pgfmathresult}{#2}% - \FPsub\pgfmathresult{#1}{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPdiv\pgfmathresult{#1}{#2}% + \FPtrunc\pgfmathresult{\pgfmathresult}{0}% + \FPmul\pgfmathresult{\pgfmathresult}{#2}% + \FPsub\pgfmathresult{#1}{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % max % \def\pgfmathfpmax#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpmax@{\pgfmathresult}{\pgfmath@result}% -} -\def\pgfmathfpmax@#1#2{% - \begingroup% - \FPifgt{#1}{#2}% - \def\pgfmathresult{#1}% - \else% - \def\pgfmathresult{#2}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpmax@@{\pgfmathresult}{\pgfmath@result}% +}% +\def\pgfmathfpmax@#1{% + \pgfmathfpmax@@#1% +}% +\def\pgfmathfpmax@@#1#2{% + \begingroup% + \FPifgt{#1}{#2}% + \def\pgfmathresult{#1}% + \else% + \def\pgfmathresult{#2}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % min % \def\pgfmathfpmin#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpmin@{\pgfmathresult}{\pgfmath@result}% -} -\def\pgfmathfpmin@#1#2{% - \begingroup% - \FPiflt{#1}{#2}% - \def\pgfmathresult{#1}% - \else% - \def\pgfmathresult{#2}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpmin@@{\pgfmathresult}{\pgfmath@result}% +}% +\def\pgfmathfpmin@#1{% + \pgfmathfpmin@@#1% +}% +\def\pgfmathfpmin@@#1#2{% + \begingroup% + \FPiflt{#1}{#2}% + \def\pgfmathresult{#1}% + \else% + \def\pgfmathresult{#2}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % Functions... % pow % \def\pgfmathfppow#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfppow@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfppow@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfppow@#1#2{% - \begingroup% - \FPpow\pgfmathresult{#1}{#2}\unskip% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPpow\pgfmathresult{#1}{#2}\unskip% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % exp % \def\pgfmathfpexp#1{% - \pgfmathfpparse{#1}% - \pgfmathfpexp@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpexp@{\pgfmathresult}% +}% \def\pgfmathfpexp@#1{% - \begingroup% - \FPexp\pgfmathresult{#1}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPexp\pgfmathresult{#1}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % ln % \def\pgfmathfpln#1{% - \pgfmathfpparse{#1}% - \pgfmathfpln@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpln@{\pgfmathresult}% +}% \def\pgfmathfpln@#1{% - \begingroup% - \FPln\pgfmathresult{#1}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPln\pgfmathresult{#1}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % sqrt % \def\pgfmathfpsqrt#1{% - \pgfmathfpparse{#1}% - \pgfmathfpsqrt@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpsqrt@{\pgfmathresult}% +}% \def\pgfmathfpsqrt@#1{% - \begingroup% - \FProot\pgfmathresult{#1}{2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FProot\pgfmathresult{#1}{2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % veclen % \def\pgfmathfpveclen#1#2{% - \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% - \pgfmathfpparse{#1}% - \pgfmathfpveclen@{\pgfmathresult}{\pgfmath@result}% -} + \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% + \pgfmathfpparse{#1}% + \pgfmathfpveclen@{\pgfmathresult}{\pgfmath@result}% +}% \def\pgfmathfpveclen@#1#2{% - \begingroup% - \FPmul\pgfmath@result{#1}{#1}% - \FPmul\pgfmath@@result{#2}{#2}% - \FPadd\pgfmathresult{\pgfmath@result}{\pgfmath@@result}% - \FProot\pgfmathresult{\pgfmathresult}{2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmath@result{#1}{#1}% + \FPmul\pgfmath@@result{#2}{#2}% + \FPadd\pgfmathresult{\pgfmath@result}{\pgfmath@@result}% + \FProot\pgfmathresult{\pgfmathresult}{2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % Trigonometric stuff... % sin % \def\pgfmathfpsin#1{% - \pgfmathfpparse{#1}% - \pgfmathfpsin@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpsin@{\pgfmathresult}% +}% \def\pgfmathfpsin@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPsin\pgfmathresult{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPsin\pgfmathresult{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % cos % \def\pgfmathfpcos#1{% - \pgfmathfpparse{#1}% - \pgfmathfpcos@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpcos@{\pgfmathresult}% +}% \def\pgfmathfpcos@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPcos\pgfmathresult{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPcos\pgfmathresult{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % tan % \def\pgfmathfptan#1{% - \pgfmathfpparse{#1}% - \pgfmathfptan@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfptan@{\pgfmathresult}% +}% \def\pgfmathfptan@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPtan\pgfmathresult{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPtan\pgfmathresult{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % acos % \def\pgfmathfpacos#1{% - \pgfmathfpparse{#1}% - \pgfmathfpacos@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpacos@{\pgfmathresult}% +}% \def\pgfmathfpacos@#1{% - \begingroup% - \FParccos\pgfmathresult{#1}% - \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FParccos\pgfmathresult{#1}% + \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % asin % \def\pgfmathfpasin#1{% - \pgfmathfpparse{#1}% - \pgfmathfpasin@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpasin@{\pgfmathresult}% +}% \def\pgfmathfpasin@#1{% - \begingroup% - \FParcsin\pgfmathresult{#1}% - \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FParcsin\pgfmathresult{#1}% + \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % atan % \def\pgfmathfpatan#1{% - \pgfmathfpparse{#1}% - \pgfmathfpatan@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpatan@{\pgfmathresult}% +}% \def\pgfmathfpatan@#1{% - \begingroup% - \FParctan\pgfmathresult{#1}% - \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FParctan\pgfmathresult{#1}% + \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % cot % \def\pgfmathfpcot#1{% - \pgfmathfpparse{#1}% - \pgfmathfpcot@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpcot@{\pgfmathresult}% +}% \def\pgfmathfpcot@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPcot\pgfmathresult{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPcot\pgfmathresult{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % sec % \def\pgfmathfpsec#1{% - \pgfmathfpparse{#1}% - \pgfmathfpsec@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpsec@{\pgfmathresult}% +}% \def\pgfmathfpsec@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPcos\pgfmathresult{\pgfmathresult}% - \FPdiv\pgfmathresult{1}{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPcos\pgfmathresult{\pgfmathresult}% + \FPdiv\pgfmathresult{1}{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % cosec % \def\pgfmathfpcosec#1{% - \pgfmathfpparse{#1}% - \pgfmathfpcosec@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpcosec@{\pgfmathresult}% +}% \def\pgfmathfpcosec@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.017453292519943295}% - \FPsin\pgfmathresult{\pgfmathresult}% - \FPdiv\pgfmathresult{1}{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.017453292519943295}% + \FPsin\pgfmathresult{\pgfmathresult}% + \FPdiv\pgfmathresult{1}{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % deg % \def\pgfmathfpdeg#1{% - \pgfmathfpparse{#1}% - \pgfmathfpdeg@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfpdeg@{\pgfmathresult}% +}% \def\pgfmathfpdeg@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{57.295779513082320885}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{57.295779513082320885}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % rad % \def\pgfmathfprad#1{% - \pgfmathfpparse{#1}% - \pgfmathfprad@{\pgfmathresult}% -} + \pgfmathfpparse{#1}% + \pgfmathfprad@{\pgfmathresult}% +}% \def\pgfmathfprad@#1{% - \begingroup% - \FPmul\pgfmathresult{#1}{0.01745329251994325}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPmul\pgfmathresult{#1}{0.01745329251994325}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % Random stuff... \def\pgfmathfpsetseed#1{% - \pgfmathfpparse{#1}% - \afterassignment\pgfmath@gobbletilpgfmath@% - \FPseed\pgfmathresult\relax\pgfmath@% -} + \pgfmathfpparse{#1}% + \afterassignment\pgfmath@gobbletilpgfmath@% + \FPseed\pgfmathresult\relax\pgfmath@% +}% % rnd % \def\pgfmathfprnd{% - \begingroup% - \FPrandom\pgfmathresult% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \FPrandom\pgfmathresult% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% % rand % \def\pgfmathfprand{% - \begingroup% - \FPrandom\pgfmathresult% - \FPmul\pgfmathresult{2}{\pgfmathresult}% - \FPsub\pgfmathresult{\pgfmathresult}{1}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} - + \begingroup% + \FPrandom\pgfmathresult% + \FPmul\pgfmathresult{2}{\pgfmathresult}% + \FPsub\pgfmathresult{\pgfmathresult}{1}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex index 00ce27705f8..d976f99205e 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex @@ -13,114 +13,125 @@ % public macro which invokes '#1' if the fpu is installed and ready and '#2' % otherwise. \def\pgflibraryfpuifactive#1#2{% - \ifpgfmathfloatparseactive - #1% - \else - #2% - \fi + \ifpgfmathfloatparseactive + #1% + \else + #2% + \fi }% \pgfqkeys{/pgf}{ - % enable the FPU parser if it is not yet active - % - % It will be deactivated after the current TeX group - fpu/.is choice, - fpu/true/.code={% - \ifpgfmathfloatparseactive - \else - \pgfutil@ifundefined{pgfmathdeclarefunction}{% - % Ohoh - we are running on a TeX distribution with - % PGF 2.00 which doesn't have the new math engine. - % I can provide special treatment here, provided that - % all float commands are still able to run (that means - % more information needs to be copied from the pgf cvs - % to pgf 2.00 - for example pgfmathfloat.code.tex). - % - % I employ this to work with pgfplots and pgf 2.00 - % using all new features. - \pgfmathfloat@parser@install@pgf@two@null@null% - }{% - \pgfmathfloat@parser@install% - }% - \pgfmathfloatparseactivetrue - % improve compatibility with Marks FP library: - \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}% - \fi - },% - fpu/false/.code={% - \ifpgfmathfloatparseactive - \pgfmathfloat@uninstall% - \pgfmathfloatparseactivefalse - \fi - },% - fpu/.default=true, - % Use this to introduce a result scaling. - % Every expression in which the prefix '*' occurs - % will be multiplied with the result and converted to fixed point - % representation. - fpu/scale results/.code={% - \ifpgfmathfloatparseactive - \pgfmathparse{#1}% - \else - \pgfmathfloatparsenumber{#1}% - \fi - \let\pgfmathfloatscale=\pgfmathresult% - },% - % determines the output format of each complete expression parsing - % process. If 'scale results' is active, 'fixed' is assumed - % automatically. - fpu/output format/.is choice, - fpu/output format/float/.code= {\let\pgfmathfloatparse@output=\relax}, - fpu/output format/sci/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}}, - fpu/output format/fixed/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}}, - fpu/output format/float, - fpu/rel thresh/.code={% - \pgfmathfloatparsenumber{#1}% - \let\pgfmathfloat@relthresh=\pgfmathresult - }, - fpu/rel thresh=1e-4, -} + % enable the FPU parser if it is not yet active + % + % It will be deactivated after the current TeX group + fpu/.is choice, + fpu/true/.code={% + \ifpgfmathfloatparseactive + \else + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % Ohoh - we are running on a TeX distribution with + % PGF 2.00 which doesn't have the new math engine. + % I can provide special treatment here, provided that + % all float commands are still able to run (that means + % more information needs to be copied from the pgf cvs + % to pgf 2.00 - for example pgfmathfloat.code.tex). + % + % I employ this to work with pgfplots and pgf 2.00 + % using all new features. + \pgfmathfloat@parser@install@pgf@two@null@null% + }{% + \pgfmathfloat@parser@install% + }% + \pgfmathfloatparseactivetrue + % improve compatibility with Marks FP library: + \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}% + \fi + },% + fpu/false/.code={% + \ifpgfmathfloatparseactive + \pgfmathfloat@uninstall% + \pgfmathfloatparseactivefalse + \fi + },% + fpu/.default=true, + % Use this to introduce a result scaling. + % Every expression in which the prefix '*' occurs + % will be multiplied with the result and converted to fixed point + % representation. + fpu/scale results/.code={% + \ifpgfmathfloatparseactive + \pgfmathparse{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \fi + \let\pgfmathfloatscale=\pgfmathresult% + },% + % determines the output format of each complete expression parsing + % process. If 'scale results' is active, 'fixed' is assumed + % automatically. + fpu/output format/.is choice, + fpu/output format/float/.code= {% + \def\pgfmathfloatparse@output@choice{Y}% + \let\pgfmathfloatparse@output=\relax + }, + fpu/output format/sci/.code= {% + \def\pgfmathfloatparse@output@choice{S}% + \def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}% + }, + fpu/output format/fixed/.code= {% + \def\pgfmathfloatparse@output@choice{F}% + \def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}% + }, + fpu/output format/float, + fpu/rel thresh/.code={% + \pgfmathfloatparsenumber{#1}% + \let\pgfmathfloat@relthresh=\pgfmathresult + }, + fpu/rel thresh=1e-4, +}% \pgfmathfloatcreate{1}{1.0}{0}\let\pgfmathfloatscale=\pgfmathresult +\let\pgfmathfloatone=\pgfmathresult + % This is the replacement parser invocation. % It does two things which are different to \pgfmathparse: -% 1. it disables any dimension dependand scalings, +% 1. it disables any dimension dependent scalings, % 2. it implements the 'scale results' feature. \def\pgfmathfloatparse{% - \begingroup% - % disable any dimension-dependant scalings: - \let\pgfmathpostparse=\relax% - \pgfmath@catcodes% - \pgfmath@quickparsefalse% - \pgfmathfloatparse@} + \begingroup% + % disable any dimension-dependant scalings: + \let\pgfmathpostparse=\relax% + \pgfmath@catcodes% + \pgfmath@quickparsefalse% + \pgfmathfloatparse@}% % for pgf 2.00 : \def\pgfmathfloatparse@pgf@two@null@null{% - \pgfmath@quickparsefalse% - \pgfmathfloatparse@} + \pgfmath@quickparsefalse% + \pgfmathfloatparse@}% \def\pgfmathfloatparse@#1{% - \edef\pgfmathfloat@expression{#1}% - \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@ - \ifpgfmathfloat@scaleactive - \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale} - \pgfmathfloattofixed{\pgfmathresult}% - \else - \pgfmathfloatparse@output - \fi -} - -\def\pgfmathfloat@char@asterisk{*} + \edef\pgfmathfloat@expression{#1}% + \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@ + \ifpgfmathfloat@scaleactive + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale} + \pgfmathfloattofixed{\pgfmathresult}% + \else + \pgfmathfloatparse@output + \fi +}% + +\def\pgfmathfloat@char@asterisk{*}% \def\pgfmathfloatparse@@#1#2\pgfmathfloat@{% - \def\pgfmathfloat@test{#1}% - \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk% - \def\pgfmathfloat@expression{#2}% - \pgfmathfloat@scaleactivetrue - \fi% - \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}% - % \endgroup provided by \pgfpathmarse@end -} + \def\pgfmathfloat@test{#1}% + \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk% + \def\pgfmathfloat@expression{#2}% + \pgfmathfloat@scaleactivetrue + \fi% + \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}% + % \endgroup provided by \pgfpathmarse@end +}% % Crude handling of file plots % @@ -128,268 +139,308 @@ scale file plot x/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalex{\pgfmathresult*}, scale file plot y/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscaley{\pgfmathresult*}, scale file plot z/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalez{\pgfmathresult*} -} +}% \def\pgfmathfloat@uninstall@appendcmd#1{% - \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}% }% % If the uninstall command is already assembled, it will skip the % uninstall assemblation. \def\pgfmathfloat@plots@checkuninstallcmd{% - \pgfutil@ifundefined{pgfmathfloat@uninstall}{% - \global\let\pgfmathfloat@uninstall=\pgfutil@empty - }{% - % We already HAVE an uninstall command (prepared globally). - % So: don't waste time assembling one! - \def\pgfmathfloat@uninstall@appendcmd##1{}% - \def\pgfmathfloat@prepareuninstallcmd##1{}% - }% + \pgfutil@ifundefined{pgfmathfloat@uninstall}{% + \global\let\pgfmathfloat@uninstall=\pgfutil@empty + }{% + % We already HAVE an uninstall command (prepared globally). + % So: don't waste time assembling one! + \def\pgfmathfloat@uninstall@appendcmd##1{}% + \def\pgfmathfloat@prepareuninstallcmd##1{}% + }% }% % This assembles an uninstall command globally ON FIRST USAGE. % See \pgfmathfloat@plots@checkuninstallcmd \def\pgfmathfloat@prepareuninstallcmd#1{% - % and store backup information (globally - I don't want to do that - % all the time when the FPU is used!): - \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1% - \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall - \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname% - }% -} + % and store backup information (globally - I don't want to do that + % all the time when the FPU is used!): + \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall + \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname% + }% +}% \def\pgfmathfloat@install#1=#2{% - \pgfmathfloat@prepareuninstallcmd{#1}% - \let#1=#2% -} + \pgfmathfloat@prepareuninstallcmd{#1}% + \let#1=#2% +}% \def\pgfmathfloat@install@csname#1#2{% - \expandafter\pgfmathfloat@prepareuninstallcmd\csname #1\endcsname% - \pgfutil@namelet{#1}{#2}% -} + \expandafter\pgfmathfloat@prepareuninstallcmd\csname #1\endcsname% + \pgfutil@namelet{#1}{#2}% +}% \def\pgfmathfloat@install@unimplemented#1{% - \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname% - \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% -} + \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath#1@\endcsname% + \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% +}% \def\pgfmathfloat@plots@install{% - \let\pgfmathfloatplotscalex=\pgfutil@empty - \let\pgfmathfloatplotscaley=\pgfutil@empty - \let\pgfmathfloatplotscalez=\pgfutil@empty - \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline% - \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline% -} + \let\pgfmathfloatplotscalex=\pgfutil@empty + \let\pgfmathfloatplotscaley=\pgfutil@empty + \let\pgfmathfloatplotscalez=\pgfutil@empty + \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline% + \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline% +}% \def\pgfmathfloat@parsexyline#1 #2 #3\pgf@stop{% - \edef\pgfmathfloat@marshal{% - \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}% - }% - \pgfmathfloat@marshal% -} + \edef\pgfmathfloat@marshal{% + \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}% + }% + \pgfmathfloat@marshal% +}% \def\pgfmathfloat@parsexyzline#1 #2 #3 #4\pgf@stop{% \edef\pgfmathfloat@marshal{% - \noexpand\pgfplotstreampoint{% - \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}% - }% - }% - \pgfmathfloat@marshal% -} - -% + \noexpand\pgfplotstreampoint{% + \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}% + }% + }% + \pgfmathfloat@marshal% +}% + +% \def\pgfmathfloat@parser@install@functions{% - % Install float commands... - % - \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@% - \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@% - \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@% - \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@% - \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@% - \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@% - \pgfmathfloat@install\pgfmathsign@=\pgfmathfloatsign@% - \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@% - \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@% - \pgfmathfloat@install\pgfmathceil@=\pgfmathfloatceil@ - \pgfmathfloat@install\pgfmathint@=\pgfmathfloatint@ - \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@% - \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@% - \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@% - \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@% - \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@% - \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@% - \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@% - \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@% - \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@% - \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@% - \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@% - \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@% - \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@% - \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@% - \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@% - \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@% - \pgfmathfloat@install@csname{pgfmathlog10@}{pgfmathfloatlog10@}% - \pgfmathfloat@install@csname{pgfmathlog2@}{pgfmathfloatlog2@}% - \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@% - \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@% - \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@% - \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@% - \pgfmathfloat@install\pgfmathe=\pgfmathfloate@% - \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@% - \pgfmathfloat@install\pgfmathnotless@=\pgfmathfloatnotless@% - \pgfmathfloat@install\pgfmathnotgreater@=\pgfmathfloatnotgreater@% - \pgfmathfloat@install\pgfmathless@=\pgfmathfloatlessthan@% - \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@% - \pgfmathfloat@install\pgfmathgreater@=\pgfmathfloatgreaterthan@% - \pgfmathfloat@install\pgfmathifthenelse@=\pgfmathfloatifthenelse@% - \pgfmathfloat@install\pgfmathequal@=\pgfmathfloatequal@% - \pgfmathfloat@install\pgfmathequalto@=\pgfmathfloatequal@% - \pgfmathfloat@install\pgfmathnotequal@=\pgfmathfloatnotequal@% - \pgfmathfloat@install\pgfmathnotequalto@=\pgfmathfloatnotequal@% - \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@ - \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ - \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ - \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ - \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd@ - \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ - \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ - \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ - \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@ - \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@ - \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@ - \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@ - \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@ - \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@ - \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@ - \pgfmathfloat@install\pgfmathveclen@=\pgfmathfloatveclen@ - \pgfmathfloat@install\pgfmathcosh@=\pgfmathfloatcosh@ - \pgfmathfloat@install\pgfmathsinh@=\pgfmathfloatsinh@ - \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@ - \expandafter\pgfmathfloat@install\csname pgfmathatan2@\endcsname=\pgfmathfloatatantwo@ - \pgfmathfloat@install@unimplemented{frac}% - \pgfmathfloat@install@unimplemented{random}% - \pgfmathfloat@install@unimplemented{setseed}% - \pgfmathfloat@install@unimplemented{Mod}% - \pgfmathfloat@install@unimplemented{real}% -% \pgfmathfloat@install@unimplemented{height}% - % - % - \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific% -} + % Install float commands... + % + \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@% + \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@% + \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@% + \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@% + \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@% + \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@% + \pgfmathfloat@install\pgfmathsign@=\pgfmathfloatsign@% + \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@% + \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@% + \pgfmathfloat@install\pgfmathceil@=\pgfmathfloatceil@ + \pgfmathfloat@install\pgfmathint@=\pgfmathfloatint@ + \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@% + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@% + \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@% + \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@% + \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@% + \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@% + \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@% + \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@% + \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@% + \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@% + \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@% + \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@% + \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@% + \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@% + \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@% + \pgfmathfloat@install@csname{pgfmathlog10@}{pgfmathfloatlog10@}% + \pgfmathfloat@install@csname{pgfmathlog2@}{pgfmathfloatlog2@}% + \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@% + \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathe=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@% + \pgfmathfloat@install\pgfmathnotless@=\pgfmathfloatnotless@% + \pgfmathfloat@install\pgfmathnotgreater@=\pgfmathfloatnotgreater@% + \pgfmathfloat@install\pgfmathless@=\pgfmathfloatlessthan@% + \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@% + \pgfmathfloat@install\pgfmathgreater@=\pgfmathfloatgreaterthan@% + \pgfmathfloat@install\pgfmathifthenelse@=\pgfmathfloatifthenelse@% + \pgfmathfloat@install\pgfmathequal@=\pgfmathfloatequal@% + \pgfmathfloat@install\pgfmathequalto@=\pgfmathfloatequal@% + \pgfmathfloat@install\pgfmathnotequal@=\pgfmathfloatnotequal@% + \pgfmathfloat@install\pgfmathnotequalto@=\pgfmathfloatnotequal@% + \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@ + \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ + \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd@ + \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ + \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ + \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ + \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@ + \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@ + \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@ + \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@ + \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@ + \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@ + \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@ + \pgfmathfloat@install\pgfmathveclen@=\pgfmathfloatveclen@ + \pgfmathfloat@install\pgfmathcosh@=\pgfmathfloatcosh@ + \pgfmathfloat@install\pgfmathsinh@=\pgfmathfloatsinh@ + \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@ + \pgfmathfloat@install\pgfmath@iftrue=\pgfmathfloat@iftrue% + \expandafter\pgfmathfloat@install\csname pgfmathatan2@\endcsname=\pgfmathfloatatantwo@ + \pgfmathfloat@install@unimplemented{isprime}% + \pgfmathfloat@install@unimplemented{iseven}% + \pgfmathfloat@install@unimplemented{isodd}% + \pgfmathfloat@install@unimplemented{gcd}% + \pgfmathfloat@install@unimplemented{frac}% + \pgfmathfloat@install@unimplemented{random}% + \pgfmathfloat@install@unimplemented{setseed}% + \pgfmathfloat@install@unimplemented{Mod}% + \pgfmathfloat@install@unimplemented{div}% + \pgfmathfloat@install@unimplemented{real}% +% \pgfmathfloat@install@unimplemented{height}% + % + % + \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific% +}% + +\def\pgfmathfloat@iftrue{% + \if Y\pgfmathfloatparse@output@choice + \let\pgfmathfloat@@iftrue@v=\pgfmathfloatone + \let\pgfmathfloat@@iftrue@next=\pgfmathfloat@iftrue@ + \else + \if S\pgfmathfloatparse@output@choice + \def\pgfmathfloat@@iftrue@v{1.0e0}% + \let\pgfmathfloat@@iftrue@next=\pgfmathfloat@iftrue@ + \else + \def\pgfmath@next{\pgfutilifstartswith{1.0}}% + \expandafter\pgfmath@next\expandafter{\pgfmathresult}{% + \ifdim\pgfmathresult pt=1.0pt % + \let\pgfmathfloat@@iftrue@next=\pgfutil@firstoftwo + \else + \let\pgfmathfloat@@iftrue@next=\pgfutil@secondoftwo + \fi + }{% + \let\pgfmathfloat@@iftrue@next=\pgfutil@secondoftwo + }% + \fi + \fi + \pgfmathfloat@@iftrue@next% +}% +\def\pgfmathfloat@iftrue@{% + \ifx\pgfmathresult\pgfmathfloat@@iftrue@v + \let\pgfmath@next=\pgfutil@firstoftwo + \else + \let\pgfmath@next=\pgfutil@secondoftwo + \fi + \pgfmath@next% +}% \def\pgfmathfloat@parser@install{% - \pgfmathfloat@plots@checkuninstallcmd - \pgfmathfloat@plots@install% - \pgfmathfloat@parser@install@functions - % - % - % - % The following methods actually enable the parser to work with - % the internal floating point number representation. - % - % The idea is as follows: - % 1. Every operand must be given in internal float representation. - % 2. The internal float repr can be distinguished by a normal - % number. This is accomplished by introducing a new "exponent" - % token. - % 3. The stack-push-operation checks whether the argument is a - % float. If not, it is parsed properly before pushing it. - \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}% - \pgfmathfloat@uninstall@appendcmd{% - \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax - }% - \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent% - \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand - \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand - \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent - % - \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse% - %\pgfmathfloat@install\pgfmathparse@trynumber@token=\pgfmathfloat@parse@trynumber@token - \pgfmathfloat@install\pgfmathparse@expression@is@number=\pgfmathfloat@parse@expression@is@number + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + % + % + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}% + \pgfmathfloat@uninstall@appendcmd{% + \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax + }% + \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand + \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse% + %\pgfmathfloat@install\pgfmathparse@trynumber@token=\pgfmathfloat@parse@trynumber@token + \pgfmathfloat@install\pgfmathparse@expression@is@number=\pgfmathfloat@parse@expression@is@number }% % This here might bring speed improvements... if implemented % correctly. -% However, this heuristics might fail in cases like "1+1" vs "1e+1" ... +% However, this heuristics might fail in cases like "1+1" vs "1e+1" ... %\def\pgfmathfloat@parse@trynumber@token{numericfpu} %\pgfmath@tokens@make{numericfpu}{eE+-Y.0123456789} \def\pgfmathfloat@parse@expression@is@number{% - \pgfmathfloatparsenumber{\pgfmath@expression}% + \pgfmathfloatparsenumber{\pgfmath@expression}% \pgfmath@smuggleone\pgfmathresult% \endgroup \ignorespaces }% \def\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG#1{% - \edef\pgfmathfloat@loc@TMPa{% - \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{% - \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname% - \noexpand\expandafter\noexpand\pgfmath@parse@}% - \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% - \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}% - \noexpand\pgfmath@postfunction% - }% - }% - \pgfmathfloat@loc@TMPa + \edef\pgfmathfloat@loc@TMPa{% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{% + \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname% + \noexpand\expandafter\noexpand\pgfmath@parse@}% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% + \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}% + \noexpand\pgfmath@postfunction% + }% + }% + \pgfmathfloat@loc@TMPa }% \def\pgfmathfloat@parser@install@pgf@two@null@null{% - \pgfmathfloat@plots@checkuninstallcmd - \pgfmathfloat@plots@install% - \pgfmathfloat@parser@install@functions - \let\pgfmathrand@=\pgfmath@basic@rand@ - \let\pgfmathrnd@=\pgfmath@basic@rnd@ - \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% - \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{tanh}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{sinh}% - \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{cosh}% - % - % The following methods actually enable the parser to work with - % the internal floating point number representation. - % - % The idea is as follows: - % 1. Every operand must be given in internal float representation. - % 2. The internal float repr can be distinguished by a normal - % number. This is accomplished by introducing a new "exponent" - % token. - % 3. The stack-push-operation checks whether the argument is a - % float. If not, it is parsed properly before pushing it. - \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint% - \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand - \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand - \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null - \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null - \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null - \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null - \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup - % - \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null% + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + \let\pgfmathrand@=\pgfmath@basic@rand@ + \let\pgfmathrnd@=\pgfmath@basic@rnd@ + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{tanh}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{sinh}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{cosh}% + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand + \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null + \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null + \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null% }% \pgfutil@ifundefined{pgfmathdeclarefunction}{% - % BACKWARDS COMPATIBILITY: We have PGF 2.00 : - \def\pgfmathdeclarepseudoconstant#1#2{% - \begingroup - \toks0=\expandafter{\csname pgfmath#1@\endcsname}% - \toks1={\pgfmath@postfunction}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% - \xdef\pgfmathfloat@glob@TMPb{\the\toks0 }% - \endgroup - \expandafter\let\csname pgfmath@parsefunction@#1\endcsname=\pgfmathfloat@glob@TMP - \expandafter\let\csname pgfmath#1\endcsname=\pgfmathfloat@glob@TMPb - \expandafter\def\csname pgfmath#1@\endcsname{#2}% - }% - \let\pgfmathredeclarepseudoconstant=\pgfmathdeclarepseudoconstant + % BACKWARDS COMPATIBILITY: We have PGF 2.00 : + \def\pgfmathdeclarepseudoconstant#1#2{% + \begingroup + \toks0=\expandafter{\csname pgfmath#1@\endcsname}% + \toks1={\pgfmath@postfunction}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \xdef\pgfmathfloat@glob@TMPb{\the\toks0 }% + \endgroup + \expandafter\let\csname pgfmath@parsefunction@#1\endcsname=\pgfmathfloat@glob@TMP + \expandafter\let\csname pgfmath#1\endcsname=\pgfmathfloat@glob@TMPb + \expandafter\def\csname pgfmath#1@\endcsname{#2}% + }% + \let\pgfmathredeclarepseudoconstant=\pgfmathdeclarepseudoconstant }{% - \pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{% - \def\pgfmathdeclarepseudoconstant#1#2{\pgfmathdeclarefunction*{#1}{0}{#2}} - }{}% + \pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{% + \def\pgfmathdeclarepseudoconstant#1#2{\pgfmathdeclarefunction*{#1}{0}{#2}} + }{}% }% -\pgfmathdeclarepseudoconstant{inf}{\def\pgfmathresult{inf}} -\pgfmathdeclarepseudoconstant{infty}{\def\pgfmathresult{inf}} -\pgfmathdeclarepseudoconstant{nan}{\def\pgfmathresult{nan}} -\pgfmathdeclarepseudoconstant{NaN}{\def\pgfmathresult{nan}} +\pgfmathdeclarepseudoconstant{inf}{\def\pgfmathresult{inf}}% +\pgfmathdeclarepseudoconstant{INF}{\def\pgfmathresult{inf}}% +\pgfmathdeclarepseudoconstant{Inf}{\def\pgfmathresult{inf}}% +\pgfmathdeclarepseudoconstant{infty}{\def\pgfmathresult{inf}}% +\pgfmathdeclarepseudoconstant{nan}{\def\pgfmathresult{nan}}% +\pgfmathdeclarepseudoconstant{NaN}{\def\pgfmathresult{nan}}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -400,54 +451,54 @@ % for pgf2.00 : \def\pgfmathfloat@parsedecimalpoint@pgf@two@null@null#1{% - \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float - \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null% - \else - \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}% - \fi - \pgfmath@next -} + \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float + \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null% + \else + \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}% + \fi + \pgfmath@next +}% % for pgf2.00: \def\pgfmathfloat@return@float@pgf@two@null@null#1]{% - \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}% - \let\pgfmath@resulttemp=\pgfmathresult - \pgfmath@parseoperator% + \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}% + \let\pgfmath@resulttemp=\pgfmathresult + \pgfmath@parseoperator% }% % for pgf2.00: \def\pgfmathfloat@endparse@pgf@two@null@null#1\pgfmath@empty{% \pgfmath@processalloperations% \pgfmath@stackpop{\pgfmathresult}% - % delete the final unit scalings + % delete the final unit scalings \pgfmath@smuggleone{\pgfmathresult}% \endgroup% \ignorespaces% -} +}% % for pgf2.00: \def\pgfmathfloat@endparsegroup@pgf@two@null@null{% - \pgfmath@processalloperations% - \pgfmath@stackpop{\pgfmathresult}% - % eliminated register usage here... - \pgfmath@smuggleone{\pgfmathresult}% - \endgroup% - \pgfmath@parsepostgroup% -} + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + % eliminated register usage here... + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \pgfmath@parsepostgroup% +}% % for pgf2.00: \def\pgfmathfloat@postfunction@pgf@two@null@null{% - \let\pgfmath@parsepostgroup\pgfmath@parseoperator% - \ifnum\pgfmath@sign1<0 - \pgfmathfloatneg@{\pgfmathresult}% - \let\pgfmath@sign\pgfutil@empty - \fi - \pgfmath@parseoperator} + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator}% % for pgf2.00: \def\pgfmathfloat@@parseoperandgroup{% - \let\pgfmath@postparsegroup\pgfmath@parseoperator% - \ifnum\pgfmath@sign1<0 - \pgfmathfloatneg@{\pgfmathresult}% - \let\pgfmath@sign\pgfutil@empty - \fi - \pgfmath@parseoperator% -} + \let\pgfmath@postparsegroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator% +}% @@ -456,71 +507,71 @@ % PRECONDITION: % either -% <number>e -% ^ -% -> read the exponent. +% <number>e +% ^ +% -> read the exponent. % or % <sign>\pgfmathfloat@POSTFLAGSCHAR % ^ % -> we have a parsed floating point number -> read it. \def\pgfmathfloat@parse@float@or@exponent{% - \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR% - % Ok, we actually HAVE a pre-parsed floating point number! - % Return it. - \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next - \else - % We have a standard number in scientific format. Parse it. - \expandafter\pgfmath@basic@parse@exponent - \fi + \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR% + % Ok, we actually HAVE a pre-parsed floating point number! + % Return it. + \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next + \else + % We have a standard number in scientific format. Parse it. + \expandafter\pgfmath@basic@parse@exponent + \fi }% \def\pgfmathfloat@return@float#1]{% - \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}% - \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% - \pgfmath@parse@@operator% + \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \pgfmath@parse@@operator% }% % This extends the functionality of the basic level operand stack: it % assures every element on the stack is a float. \def\pgfmathfloat@stack@push@operand#1{% - \pgfutil@ifnextchar\bgroup{% - \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty - \pgfmathfloat@stack@push@operand@list - }{% - \pgfmathfloat@stack@push@operand@single - }% - #1\relax + \pgfutil@ifnextchar\bgroup{% + \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty + \pgfmathfloat@stack@push@operand@list + }{% + \pgfmathfloat@stack@push@operand@single + }% + #1\relax }% \def\pgfmathfloat@stack@push@operand@single#1\relax{% - \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}% - \ifpgfutil@in@ - \pgfmath@basic@stack@push@operand{#1}% - \else - \pgfmathfloatparsenumber{#1}% - \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% - \fi + \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \pgfmath@basic@stack@push@operand{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \fi }% \def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}% \def\pgfmathfloat@stack@push@operand@list#1{% - \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}% - \ifpgfutil@in@ - \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{% - \pgfmathfloat@stack@push@operand@list@{#1}% - }% - \else - \pgfmathfloatparsenumber{#1}% - \begingroup - \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}% - \toks1=\expandafter{\pgfmathresult}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}% - \endgroup - \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP - \fi - \pgfutil@ifnextchar\relax{% - \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}% - \pgfmathfloat@stack@push@operand@GOBBLE - }{% - \pgfmathfloat@stack@push@operand@list - }% + \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{% + \pgfmathfloat@stack@push@operand@list@{#1}% + }% + \else + \pgfmathfloatparsenumber{#1}% + \begingroup + \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \toks1=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}% + \endgroup + \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP + \fi + \pgfutil@ifnextchar\relax{% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \pgfmathfloat@stack@push@operand@GOBBLE + }{% + \pgfmathfloat@stack@push@operand@list + }% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -582,200 +633,200 @@ \let\pgfmath@basic@false@=\pgfmathfalse@ \def\pgfmathfloatscientific#1#2{% - \edef\pgfmathresult{#1e#2}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}% -} + \edef\pgfmathresult{#1e#2}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}% +}% % Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. -% +% % It also sets the boolean \ifpgfmathfloatcomparison (globally). \def\pgfmathfloatlessthan@#1#2{% %\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% - \global\pgfmathfloatcomparisonfalse - \begingroup - \edef\pgfmathfloat@loc@TMPa{#1}% - \edef\pgfmathfloat@loc@TMPb{#2}% - \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPa\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPb\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E - \ifcase\pgfmathfloat@a@S - % x = 0 -> (x<y <=> y >0) - \ifcase\pgfmathfloat@b@S - % y = 0 - \or% y > 0 - \global\pgfmathfloatcomparisontrue - \or% y < 0 - \or% y = nan - \or% y = + infty - \global\pgfmathfloatcomparisontrue - \or% y = -infty - \fi - \or - % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) - \ifcase\pgfmathfloat@b@S - % y = 0 - \or% y>0: - \pgfmathfloatlessthan@positive - \or% y < 0 - \or% y = nan - \or% y = + infty - \global\pgfmathfloatcomparisontrue - \or% y = -infty - \fi - \or - % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) - \ifcase\pgfmathfloat@b@S - % y = 0 - \global\pgfmathfloatcomparisontrue - \or%y > 0 - \global\pgfmathfloatcomparisontrue - \or% 'y<0': - \pgfmathfloatgreaterthan@positive - \or% y = nan - \or% y = + infty - \global\pgfmathfloatcomparisontrue - \or% y = -infty - \fi - \or - % x = nan. - \or - % x = +infty - \or - % x = -infty - \ifnum\pgfmathfloat@b@S=3 - \else - \global\pgfmathfloatcomparisontrue - \fi - \fi - \endgroup - \ifpgfmathfloatcomparison - \def\pgfmathresult{1.0}% - \else - \def\pgfmathresult{0.0}% - \fi -} + \global\pgfmathfloatcomparisonfalse + \begingroup + \edef\pgfmathfloat@loc@TMPa{#1}% + \edef\pgfmathfloat@loc@TMPb{#2}% + \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPa\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPb\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \ifcase\pgfmathfloat@a@S + % x = 0 -> (x<y <=> y >0) + \ifcase\pgfmathfloat@b@S + % y = 0 + \or% y > 0 + \global\pgfmathfloatcomparisontrue + \or% y < 0 + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty + \fi + \or + % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) + \ifcase\pgfmathfloat@b@S + % y = 0 + \or% y>0: + \pgfmathfloatlessthan@positive + \or% y < 0 + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty + \fi + \or + % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) + \ifcase\pgfmathfloat@b@S + % y = 0 + \global\pgfmathfloatcomparisontrue + \or%y > 0 + \global\pgfmathfloatcomparisontrue + \or% 'y<0': + \pgfmathfloatgreaterthan@positive + \or% y = nan + \or% y = + infty + \global\pgfmathfloatcomparisontrue + \or% y = -infty + \fi + \or + % x = nan. + \or + % x = +infty + \or + % x = -infty + \ifnum\pgfmathfloat@b@S=3 + \else + \global\pgfmathfloatcomparisontrue + \fi + \fi + \endgroup + \ifpgfmathfloatcomparison + \def\pgfmathresult{1.0}% + \else + \def\pgfmathresult{0.0}% + \fi +}% \let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ \let\pgfmathfloatless@=\pgfmathfloatlessthan@ -% ! (#1 < #2) <=> (#1 >= #2) +% ! (#1 < #2) <=> (#1 >= #2) \def\pgfmathfloatnotless@#1#2{% - \pgfmathfloatless@{#1}{#2}% - \ifpgfmathfloatcomparison - \def\pgfmathresult{0.0}% - \else - \def\pgfmathresult{1.0}% - \fi -}% -% ! (#1 > #2) <=> (#1 <= #2) + \pgfmathfloatless@{#1}{#2}% + \ifpgfmathfloatcomparison + \def\pgfmathresult{0.0}% + \else + \def\pgfmathresult{1.0}% + \fi +}% +% ! (#1 > #2) <=> (#1 <= #2) \def\pgfmathfloatnotgreater@#1#2{% - \pgfmathfloatless@{#2}{#1}% - \ifpgfmathfloatcomparison - \def\pgfmathresult{0.0}% - \else - \def\pgfmathresult{1.0}% - \fi + \pgfmathfloatless@{#2}{#1}% + \ifpgfmathfloatcomparison + \def\pgfmathresult{0.0}% + \else + \def\pgfmathresult{1.0}% + \fi }% % compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] \def\pgfmathfloatlessthan@positive{% - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +}% % compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] \def\pgfmathfloatgreaterthan@positive{% - \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} - - -\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}} + \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +}% + + +\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}}% \let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@ \let\pgfmathfloatgreater@=\pgfmathfloatgreaterthan@ \def\pgfmathfloatmax@#1{% - \begingroup - \pgfmathfloatcreate{2}{1.0}{2147483644}% - \let\pgfmathmaxsofar=\pgfmathresult - \pgfmathfloatmax@@#1{}% + \begingroup + \pgfmathfloatcreate{2}{1.0}{2147483644}% + \let\pgfmathmaxsofar=\pgfmathresult + \pgfmathfloatmax@@#1{}% }% \def\pgfmathfloatmax@@#1{% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \expandafter\pgfmathfloatmax@@@% - \else% - \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}% - \ifpgfmathfloatcomparison - \edef\pgfmathmaxsofar{#1}% - \fi - \expandafter\pgfmathfloatmax@@% - \fi% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmax@@@% + \else% + \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}% + \ifpgfmathfloatcomparison + \edef\pgfmathmaxsofar{#1}% + \fi + \expandafter\pgfmathfloatmax@@% + \fi% }% \def\pgfmathfloatmax@@@{% - \let\pgfmathresult=\pgfmathmaxsofar - \pgfmath@smuggleone{\pgfmathresult}% - \endgroup + \let\pgfmathresult=\pgfmathmaxsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup }% \def\pgfmathfloatmin@#1{% - \begingroup - \pgfmathfloatcreate{1}{1.0}{2147483644}% - \let\pgfmathminsofar=\pgfmathresult - \pgfmathfloatmin@@#1{}% + \begingroup + \pgfmathfloatcreate{1}{1.0}{2147483644}% + \let\pgfmathminsofar=\pgfmathresult + \pgfmathfloatmin@@#1{}% }% \def\pgfmathfloatmin@@#1{% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \expandafter\pgfmathfloatmin@@@% - \else% - \pgfmathfloatlessthan{#1}{\pgfmathminsofar}% - \ifpgfmathfloatcomparison - \edef\pgfmathminsofar{#1}% - \fi - \expandafter\pgfmathfloatmin@@% - \fi% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmin@@@% + \else% + \pgfmathfloatlessthan{#1}{\pgfmathminsofar}% + \ifpgfmathfloatcomparison + \edef\pgfmathminsofar{#1}% + \fi + \expandafter\pgfmathfloatmin@@% + \fi% }% \def\pgfmathfloatmin@@@{% - \let\pgfmathresult=\pgfmathminsofar - \pgfmath@smuggleone{\pgfmathresult}% - \endgroup + \let\pgfmathresult=\pgfmathminsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup }% \def\pgfmathfloatmaxtwo#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#2}% - \else - \edef\pgfmathresult{#1}% - \fi -} + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +}% \let\pgfmathfloatmax=\pgfmathfloatmaxtwo \def\pgfmathfloatmintwo#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#1}% - \else - \edef\pgfmathresult{#2}% - \fi -} + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +}% \let\pgfmathfloatmin=\pgfmathfloatmintwo -% Renormalizes #1 to extended precision mantisse, meaning +% Renormalizes #1 to extended precision mantissa, meaning % 100 <= m < 1000 % instead of 1 <= m < 10. -% +% % The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantissas. % % The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). @@ -788,30 +839,30 @@ % \pgfmathfloattoextentedprecision@a. It also provides exponent and % sign of #1 in output arguments and may be used to increase speed. \def\pgfmathfloattoextentedprecision#1{% - \begingroup - \pgfmathfloattoextentedprecision@a{#1}% - \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloattoextentedprecision@a{#1}% + \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1}% + \edef\pgfmathresult{#1}% }% \def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2.#3}% + \edef\pgfmathresult{#1#2.#3}% }% \def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2#3.#4}% + \edef\pgfmathresult{#1#2#3.#4}% }% \def\pgfmathfloattoextentedprecision@@three#1.#2#3#4#5\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2#3#4.#5}% + \edef\pgfmathresult{#1#2#3#4.#5}% }% % Sets extended precision to 10^#1. % % The different choices are -% +% % - 0: normalization 0 <= m < 1 (disable extended precision) % - 1: normalization 10 <= m < 100 % - 2: normalization 100 <= m < 1000 (default) @@ -821,19 +872,19 @@ % % This setting applies to \pgfmathfloattoextentedprecision and friends. \def\pgfmathfloatsetextprecision#1{% - \ifcase#1\relax - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero - \def\pgfmathfloatextprec@shift{0}% - \or - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one - \def\pgfmathfloatextprec@shift{1}% - \or - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two - \def\pgfmathfloatextprec@shift{2}% - \else - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three - \def\pgfmathfloatextprec@shift{3}% - \fi + \ifcase#1\relax + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero + \def\pgfmathfloatextprec@shift{0}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one + \def\pgfmathfloatextprec@shift{1}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two + \def\pgfmathfloatextprec@shift{2}% + \else + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three + \def\pgfmathfloatextprec@shift{3}% + \fi }% \pgfmathfloatsetextprecision{2}% @@ -842,143 +893,143 @@ % % INPUT: % #1 normalized floating point number. Maybe a macro (it will be expanded ONCE) -% +% % OUTPUT: -% - \pgfmathresult : the mantisse in extended precision +% - \pgfmathresult : the mantissa in extended precision % - \pgfmathfloat@a@S : the sign of #1 % - \pgfmathfloat@a@E : the exponent of #1, adjusted for extended precision % - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed. % \def\pgfmathfloattoextentedprecision@a#1{% - \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S<3 - \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI - \fi + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S<3 + \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI + \fi }% % Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. \def\pgfmathfloattoextentedprecision@b#1{% - \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@S<3 - \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \fi + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@S<3 + \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI + \fi }% % Addition of two floating point numbers using 8 significant digits. \def\pgfmathfloatadd@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#2}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - % Shift lesser mantisse to fit the larger one: - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% - \else - \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% - \fi - % add them! - \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloattoextentedprecision@b{#2}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#2}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + % Shift lesser mantisse to fit the larger one: + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% + \else + \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% + \fi + % add them! + \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % #1= floating point number % #2= TeX code to execute if #1 == 0 % #3= TeX code to execute if #1 != 0 \def\pgfmathfloatifzero#1#2#3{% - \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa - \if\pgfmathfloat@loc@TMPa0 #2\else#3\fi + \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa + \if\pgfmathfloat@loc@TMPa0 #2\else#3\fi }% \def\pgfmathfloatiffinite#1#2#3{% - \pgfmathfloatgetflagstomacro{#1}\pgfmathfloatiffinite@ - \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi + \pgfmathfloatgetflagstomacro{#1}\pgfmathfloatiffinite@ + \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi }% \def\pgfmathfloatifthenelse@#1#2#3{% - \pgfmathfloatifflags{#1}{0}{% - \edef\pgfmathresult{#3}%% - }{% - \edef\pgfmathresult{#2}% - }% -} + \pgfmathfloatifflags{#1}{0}{% + \edef\pgfmathresult{#3}%% + }{% + \edef\pgfmathresult{#2}% + }% +}% \def\pgfmathfloatequal@#1#2{% - \pgfmathfloatifapproxequalrel{#1}{#2}{% - \def\pgfmathresult{1}% - \pgfmathfloatcomparisontrue - }{% - \def\pgfmathresult{0}% - \pgfmathfloatcomparisonfalse - }% -} + \pgfmathfloatifapproxequalrel{#1}{#2}{% + \def\pgfmathresult{1}% + \pgfmathfloatcomparisontrue + }{% + \def\pgfmathresult{0}% + \pgfmathfloatcomparisonfalse + }% +}% \let\pgfmathfloatequalto@=\pgfmathfloatequal@ \def\pgfmathfloatnotequal@#1#2{% - \pgfmathfloatifapproxequalrel{#1}{#2}{% - \def\pgfmathresult{0}% - \pgfmathfloatcomparisonfalse - }{% - \def\pgfmathresult{1}% - \pgfmathfloatcomparisontrue - }% -} + \pgfmathfloatifapproxequalrel{#1}{#2}{% + \def\pgfmathresult{0}% + \pgfmathfloatcomparisonfalse + }{% + \def\pgfmathresult{1}% + \pgfmathfloatcomparisontrue + }% +}% \let\pgfmathfloatnotequalto@=\pgfmathfloatnotequal@ % Computes the relative error between #1 and #2 (assuming #2 != 0) and % invokes #3 if the relative error is below `/pgf/fpu/rel thresh' and % #4 if that is not the case. \long\def\pgfmathfloatifapproxequalrel#1#2#3#4{% - \begingroup - \pgfmathfloatparsenumber{#1}% - \let\pgfmathfloatarga=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\pgfmathfloatargb=\pgfmathresult - \pgfmathfloatrelerror@\pgfmathfloatarga\pgfmathfloatargb - \let\pgfmathfloatarga=\pgfmathresult - \pgfmathfloatlessthan@\pgfmathfloatarga\pgfmathfloat@relthresh - \ifpgfmathfloatcomparison - \def\pgfmathfloat@loc@TMPa{#3}% - \else - \def\pgfmathfloat@loc@TMPa{#4}% - \fi - \expandafter\endgroup - \pgfmathfloat@loc@TMPa + \begingroup + \pgfmathfloatparsenumber{#1}% + \let\pgfmathfloatarga=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\pgfmathfloatargb=\pgfmathresult + \pgfmathfloatrelerror@\pgfmathfloatarga\pgfmathfloatargb + \let\pgfmathfloatarga=\pgfmathresult + \pgfmathfloatlessthan@\pgfmathfloatarga\pgfmathfloat@relthresh + \ifpgfmathfloatcomparison + \def\pgfmathfloat@loc@TMPa{#3}% + \else + \def\pgfmathfloat@loc@TMPa{#4}% + \fi + \expandafter\endgroup + \pgfmathfloat@loc@TMPa }% % Invokes code '#3' if the flags of the floating point number '#1' @@ -993,227 +1044,227 @@ % \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}% % it also supports #2=u which means 'unbounded' \def\pgfmathfloatifflags#1#2#3#4{% - \if#2-% - \pgfmathfloatifflags{#1}{2}{#3}{#4}% - \else - \if#2+% - \pgfmathfloatifflags{#1}{1}{#3}{#4}% - \else - \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa - \if#2u% - \ifnum\pgfmathfloat@loc@TMPa>2 - #3\relax - \else - #4\relax - \fi - \else - \if\pgfmathfloat@loc@TMPa#2% - #3\relax - \else - #4\relax - \fi - \fi - \fi - \fi -}% - -% #1=mantisse which needs to be shifted (with smaller exponent) + \if#2-% + \pgfmathfloatifflags{#1}{2}{#3}{#4}% + \else + \if#2+% + \pgfmathfloatifflags{#1}{1}{#3}{#4}% + \else + \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa + \if#2u% + \ifnum\pgfmathfloat@loc@TMPa>2 + #3\relax + \else + #4\relax + \fi + \else + \if\pgfmathfloat@loc@TMPa#2% + #3\relax + \else + #4\relax + \fi + \fi + \fi + \fi +}% + +% #1=mantissa which needs to be shifted (with smaller exponent) % #2=smaller exponent % #3=larger exponent -% +% % ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. \def\pgfmathfloatadd@shift#1#2#3{% - \pgf@xa=#1 pt% - \pgfmathfloat@a@S=#3\relax - \advance\pgfmathfloat@a@S by-#2\relax - \ifcase\pgfmathfloat@a@S - \or - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10000\relax - \else - \pgf@xa=0pt% - \fi - #2=#3\relax - \edef#1{\pgf@sys@tonumber\pgf@xa}% -} + \pgf@xa=#1 pt% + \pgfmathfloat@a@S=#3\relax + \advance\pgfmathfloat@a@S by-#2\relax + \ifcase\pgfmathfloat@a@S + \or + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10000\relax + \else + \pgf@xa=0pt% + \fi + #2=#3\relax + \edef#1{\pgf@sys@tonumber\pgf@xa}% +}% \let\pgfmathfloatadd=\pgfmathfloatadd@ % Subtracts two floating point numbers. \def\pgfmathfloatsubtract@#1#2{% - \begingroup - \edef\pgfmathresult{#2}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \or - \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \or - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \else - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \edef\pgfmathresult{#2}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \or + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \or + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \else + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ % Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. -% +% % Use this method if #2 is small number. \def\pgfmathfloatmultiplyfixed@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}% - % renormalize product. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}% + % renormalize product. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ \def\pgfmathfloatmultiply@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \else - \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatsetextprecision{1}% + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloattoextentedprecision@b{#2}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \else + \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatmultiply=\pgfmathfloatmultiply@ @@ -1221,237 +1272,290 @@ % % It employs the basic math engine internally to divide mantissas. \def\pgfmathfloatdivide@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which) - \edef\pgfmathfloat@arga{#1}% - \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \edef\pgfmathfloat@argb{#2}% - \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E - % renormalize. This is the only part were an expensive float routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - % And re-insert the proper sign: - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which) + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \edef\pgfmathfloat@argb{#2}% + \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E + % renormalize. This is the only part were an expensive float routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + % And re-insert the proper sign: + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatdivide=\pgfmathfloatdivide@ \def\pgfmathfloatreciprocal@#1{% - \begingroup - % FIXME optimize - \edef\pgfmathfloat@loc@TMPa{#1}% - \pgfmathfloatcreate{1}{1.0}{0}% - \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + % FIXME optimize + \edef\pgfmathfloat@loc@TMPa{#1}% + \pgfmathfloatcreate{1}{1.0}{0}% + \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % Computes sqrt(#1) in floating point arithmetics. % % It employs sqrt( m * 10^e ) = sqrt(m) * sqrt(10^e). \def\pgfmathfloatsqrt@#1{% - \begingroup - \pgfmathfloatsetextprecision{3}% - \edef\pgfmathfloat@arga{#1}% - \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \or% + - \pgfmath@basic@sqrt@{\pgfmathfloat@arga}% - \ifodd\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@E>0 - \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10) - \else - \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1) - \fi - \fi - \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e) - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}% - \pgfmathfloatqparsenumber{\pgfmathfloat@arga}% - \or% - - \pgfmathfloatcreate{3}{0.0}{0}% - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \or% +infty - \pgfmathfloatcreate{4}{0.0}{0}% - \or% -infty - \pgfmathfloatcreate{3}{0.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatsetextprecision{3}% + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \or% + + \pgfmath@basic@sqrt@{\pgfmathfloat@arga}% + \ifodd\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@E>0 + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10) + \else + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1) + \fi + \fi + \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e) + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}% + \pgfmathfloatqparsenumber{\pgfmathfloat@arga}% + \or% - + \pgfmathfloatcreate{3}{0.0}{0}% + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \or% +infty + \pgfmathfloatcreate{4}{0.0}{0}% + \or% -infty + \pgfmathfloatcreate{3}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatsqrt=\pgfmathfloatsqrt@ % Returns the integer part of the floating point number #1. % -% The result is returned as floating point as well. +% The result is returned as floating point as well. % % This operation is not limited to TeX's range of count registers (it % works symbolly) % % @see \pgfmathfloattoint +% POSTCONDITION: \pgfmathresult contains the result and +% \pgfmathfloatintwasnoop=1 if there was nothing to do +% \pgfmathfloatintwasnoop=0 if there where non-zero digits after the period +% \pgfmathfloatintwasnoop=2 if there where digits after the period. The digits will be stored in \pgfmathfloatintremainder in this case. \def\pgfmathfloatint@#1{% - \begingroup - \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - % 0: nothing to do. - \or% + - \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \or% - - \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \else - % nothing to do - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \edef\pgfmathfloatint@input{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathfloatint@input\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \gdef\pgfmathfloatintwasnoop{1}% + \gdef\pgfmathfloatintremainder{}% + \ifcase\pgfmathfloat@a@S + % 0: nothing to do. + \or% + + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or% - + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \else + % nothing to do + \fi + %\message{ XXXXX int(\pgfmathfloatint@input) = \pgfmathresult -> was no op = \pgfmathfloatintwasnoop\space (remainder \pgfmathfloatintremainder)^^J}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatint@@#1.{% - \ifnum\pgfmathfloat@a@E<0 - \pgfmathfloat@a@S=0 - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0 - \expandafter\pgfmathfloatint@@loop@gobble - \else - \pgfmathfloat@a@Mtok={#1.}% - \pgfmathfloat@b@E=\pgfmathfloat@a@E - \expandafter\pgfmathfloatint@@loop - \fi + \ifnum\pgfmathfloat@a@E<0 + \pgfmathfloat@a@S=0 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \gdef\pgfmathfloatintwasnoop{0}% + \expandafter\pgfmathfloatint@@loop@gobble + \else + \pgfmathfloat@a@Mtok={#1.}% + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \expandafter\pgfmathfloatint@@loop + \fi }% \def\pgfmathfloatint@@loop#1{% - \def\pgfmathfloatint@@loop@{#1}% - \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI - \let\pgfmathfloatint@@loop@next=\relax - \else - \ifnum\pgfmathfloat@b@E=0 - \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop@gobble - \else - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \advance\pgfmathfloat@b@E by-1 - \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop - \fi - \fi - \pgfmathfloatint@@loop@next -}% -\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{}% + \def\pgfmathfloatint@@loop@{#1}% + \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI + \gdef\pgfmathfloatintwasnoop{1}% + \let\pgfmathfloatint@@loop@next=\relax + \else + \ifnum\pgfmathfloat@b@E=0 + \def\pgfmathfloatint@@loop@next{\pgfmathfloatint@@loop@gobble#1}% + \else + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \advance\pgfmathfloat@b@E by-1 + \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop + \fi + \fi + \pgfmathfloatint@@loop@next +}% +\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{% + \if0\pgfmathfloatintwasnoop + \else + \gdef\pgfmathfloatintwasnoop{2}% + \gdef\pgfmathfloatintremainder{#1}% + \fi +}% \let\pgfmathfloatint=\pgfmathfloatint@ \def\pgfmathfloatfloor#1{% - \edef\pgfmathfloat@loc@TMPa{#1}% - \pgfmathfloatcreate{2}{5.0}{-1}% -0.5 - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathfloatadd@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% - \expandafter\pgfmathfloatround@\expandafter{\pgfmathresult}% -} + \edef\pgfmath@orig{#1}% + \pgfmathfloatint@{#1}% + \pgfmathfloatifflags{\pgfmath@orig}{2}{% + \let\pgfmath@trunc=\pgfmathresult + \ifcase\pgfmathfloatintwasnoop\relax + % ah - we stripped something! Round DOWN + \pgfmathfloatcreate{2}{1.0}{0}% -1 + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfmath@trunc}% + \or + % was no-op + \let\pgfmathresult=\pgfmath@trunc + \else + % ok, we have to inspect the remainder: + \pgfmathfloatparsenumber{0.\pgfmathfloatintremainder}% + \pgfmathfloatifflags{\pgfmathresult}{1}{% + % ah - we stripped a non-zero remainder! Round DOWN + \pgfmathfloatcreate{2}{1.0}{0}% -1 + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfmath@trunc}% + }{% + % was no-op + \let\pgfmathresult=\pgfmath@trunc + }% + \fi + }{}% +}% \let\pgfmathfloatfloor@=\pgfmathfloatfloor \def\pgfmathfloatceil#1{% - \edef\pgfmathfloat@loc@TMPa{#1}% - \pgfmathfloatcreate{1}{5.0}{-1}% +0.5 - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathfloatadd@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% - \expandafter\pgfmathfloatround@\expandafter{\pgfmathresult}% -} + \edef\pgfmath@orig{#1}% + \pgfmathfloatint@{#1}% + \pgfmathfloatifflags{\pgfmath@orig}{1}{% + \let\pgfmath@trunc=\pgfmathresult + \ifcase\pgfmathfloatintwasnoop\relax + % ah - we stripped something! Round UP + \pgfmathfloatcreate{1}{1.0}{0}% +1 + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfmath@trunc}% + \or + % was no-op + \let\pgfmathresult=\pgfmath@trunc + \else + % ok, we have to inspect the remainder: + \pgfmathfloatparsenumber{0.\pgfmathfloatintremainder}% + \pgfmathfloatifflags{\pgfmathresult}{1}{% + % ah - we stripped a non-zero remainder! Round UP + \pgfmathfloatcreate{1}{1.0}{0}% +1 + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfmath@trunc}% + }{% + % was no-op + \let\pgfmathresult=\pgfmath@trunc + }% + \fi + }{}% +}% \let\pgfmathfloatceil@=\pgfmathfloatceil \def\pgfmathfloat@notimplemented#1{% - \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit :-(}{}% - \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit}{}% + \pgfmathfloatcreate{0}{0.0}{0}% }% % Divides or multiplies the input number by 10^#4 using an arithmetic @@ -1465,150 +1569,161 @@ % \pgfmathfloatshift{11e3}{4}% % -> pgfmathresult = 11e7 \def\pgfmathfloatshift@#1#2{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \advance\pgfmathfloat@a@E by#2\relax - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \advance\pgfmathfloat@a@E by#2\relax + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% \let\pgfmathfloatshift=\pgfmathfloatshift@ % Defines \pgfmathresult to be |#1|, the absolute value of the % normalized floating point number #1. \def\pgfmathfloatabs@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - % 0: do nothing. - \or - % +: ok, is positive. - \or - % -: multiply with -1: - \pgfmathfloat@a@S=1 - \or - % nan: do nothing. - \or - % +infty: ok. - \or - % -infty: multiply with -1: - \pgfmathfloat@a@S=4 - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: do nothing. + \or + % +: ok, is positive. + \or + % -: multiply with -1: + \pgfmathfloat@a@S=1 + \or + % nan: do nothing. + \or + % +infty: ok. + \or + % -infty: multiply with -1: + \pgfmathfloat@a@S=4 + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % % Defines \pgfmathresult to be sign(#1) \def\pgfmathfloatsign@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - % 0: - \pgfmathfloatcreate{0}{0.0}{0}% - \or - % +: ok, is positive. - \pgfmathfloatcreate{1}{1.0}{0}% - \or - % -: - \pgfmathfloatcreate{2}{1.0}{0}% - \or - % nan: do nothing. - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \or - % +infty:. - \pgfmathfloatcreate{1}{1.0}{0}% - \or - % -infty: - \pgfmathfloatcreate{2}{1.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: + \pgfmathfloatcreate{0}{0.0}{0}% + \or + % +: ok, is positive. + \pgfmathfloatcreate{1}{1.0}{0}% + \or + % -: + \pgfmathfloatcreate{2}{1.0}{0}% + \or + % nan: do nothing. + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % +infty:. + \pgfmathfloatcreate{1}{1.0}{0}% + \or + % -infty: + \pgfmathfloatcreate{2}{1.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatsign=\pgfmathfloatsign@ % Computes the absolute error |#1 - #2| into \pgfmathresult. \def\pgfmathfloatabserror@#1#2{% - \pgfmathfloatsubtract@{#1}{#2}% - \pgfmathfloatabs@{\pgfmathresult}% + \pgfmathfloatsubtract@{#1}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% }% \let\pgfmathfloatabserror=\pgfmathfloatabserror@ % Computes the relative error |#1 - #2|/|#2| into \pgfmathresult, % assuming #2 != 0. \def\pgfmathfloatrelerror@#1#2{% - \pgfmathfloatsubtract@{#1}{#2}% - \let\pgfmathfloat@subtract=\pgfmathresult - \pgfmathfloatifflags{#2}{0}{% - \let\pgfmathresult=\pgfmathfloat@subtract - }{% - \pgfmathfloatdivide@{\pgfmathfloat@subtract}{#2}% - }% - \pgfmathfloatabs@{\pgfmathresult}% + \pgfmathfloatsubtract@{#1}{#2}% + \let\pgfmathfloat@subtract=\pgfmathresult + \pgfmathfloatifflags{#2}{0}{% + \let\pgfmathresult=\pgfmathfloat@subtract + }{% + \pgfmathfloatdivide@{\pgfmathfloat@subtract}{#2}% + }% + \pgfmathfloatabs@{\pgfmathresult}% }% \let\pgfmathfloatrelerror=\pgfmathfloatrelerror@ % Computes \pgfmathresult = #1 mod #2 using truncated division. % \def\pgfmathfloatmod@#1#2{% - \begingroup - \pgfmathfloatdivide@{#1}{#2}% - \pgfmathfloatint@{\pgfmathresult}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} + \begingroup + \pgfmathfloattoint{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloattoint{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \c@pgfmath@counta=\pgfmathfloat@loc@TMPa\relax + \divide\c@pgfmath@counta by\pgfmathfloat@loc@TMPb\relax + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + % + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% \let\pgfmathfloatmod=\pgfmathfloatmod@ % A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already % known. This may be faster. \def\pgfmathfloatmodknowsinverse@#1#2#3{% - \begingroup - \pgfmathfloatmultiply@{#1}{#3}% - \pgfmathfloatint@{\pgfmathresult}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} + \pgfmathfloatmod@{#1}{#2}% + %-------------------------------------------------- + % \begingroup + % % FIXME : is this function correct? \pgfmathfloatmod had a + % % rounding flaw... + % \pgfmathfloatmultiply@{#1}{#3}% + % \pgfmathfloatint@{\pgfmathresult}% + % \let\pgfmathfloat@loc@TMPa=\pgfmathresult + % \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + % \let\pgfmathfloat@loc@TMPb=\pgfmathresult + % \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + % \pgfmath@smuggleone\pgfmathresult + % \endgroup + %-------------------------------------------------- +}% \let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@ \def\pgfmathfloatpi@{% - \pgfmathfloatcreate{1}{3.14159265358979}{0}% + \pgfmathfloatcreate{1}{3.14159265358979}{0}% }% \let\pgfmathfloatpi=\pgfmathfloatpi@ \def\pgfmathfloate@{% - \pgfmathfloatcreate{1}{2.71828182845905}{0}% -} + \pgfmathfloatcreate{1}{2.71828182845905}{0}% +}% \let\pgfmathfloate=\pgfmathfloate@ % Converts #1 from radians to degrees. \def\pgfmathfloatdeg@#1{% - \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax - % Lazy evaluation: - \pgfmathfloatcreate{1}{5.72957795130823}{1}% - \global\let\pgfmfltdeg@factor=\pgfmathresult - \fi - \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor% -} + \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{5.72957795130823}{1}% + \global\let\pgfmfltdeg@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor% +}% \let\pgfmathfloatdeg=\pgfmathfloatdeg@ % Converts #1 from degree to radians. \def\pgfmathfloatrad@#1{% - \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax - % Lazy evaluation: - \pgfmathfloatcreate{1}{1.74532925199433}{-2}% - \global\let\pgfmfltrad@factor=\pgfmathresult - \fi - \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor% -} + \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{1.74532925199433}{-2}% + \global\let\pgfmfltrad@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor% +}% \let\pgfmathfloatrad=\pgfmathfloatrad@ % Computes #1(#2) where #1 is a trigonometric function, i.e. @@ -1616,167 +1731,167 @@ % % #1 is a one-argument macro which assigns \pgfmathresult. \def\pgfmathfloatTRIG@#1#2{% - \if0\pgfmath@trig@format@choice - % trig format=deg - \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax% - % Lazy evaluation: - \pgfmathfloatcreate{1}{3.6}{2}% - \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult - \pgfmathfloatcreate{1}{2.77777777777778}{-3}% - \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult - \fi - \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}% - \else - % trig format=rad - \expandafter\ifx\csname pgfmathfloatTRIG@rad@NUM\endcsname\relax% - % Lazy evaluation: - \pgfmathfloatcreate{1}{6.28318530717959}{0}% - \global\let\pgfmathfloatTRIG@rad@NUM=\pgfmathresult - \pgfmathfloatcreate{1}{1.59154943091895}{-1}% - \global\let\pgfmathfloatTRIG@rad@NUM@INV=\pgfmathresult - \fi - \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@rad@NUM}{\pgfmathfloatTRIG@rad@NUM@INV}% - \fi - \pgfmathfloattofixed@{\pgfmathresult}% - \expandafter#1\expandafter{\pgfmathresult}% - \pgfmathfloatparsenumber{\pgfmathresult}% -}% - -\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}} + \if0\pgfmath@trig@format@choice + % trig format=deg + \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax% + % Lazy evaluation: + \pgfmathfloatcreate{1}{3.6}{2}% + \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult + \pgfmathfloatcreate{1}{2.77777777777778}{-3}% + \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult + \fi + \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}% + \else + % trig format=rad + \expandafter\ifx\csname pgfmathfloatTRIG@rad@NUM\endcsname\relax% + % Lazy evaluation: + \pgfmathfloatcreate{1}{6.28318530717959}{0}% + \global\let\pgfmathfloatTRIG@rad@NUM=\pgfmathresult + \pgfmathfloatcreate{1}{1.59154943091895}{-1}% + \global\let\pgfmathfloatTRIG@rad@NUM@INV=\pgfmathresult + \fi + \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@rad@NUM}{\pgfmathfloatTRIG@rad@NUM@INV}% + \fi + \pgfmathfloattofixed@{\pgfmathresult}% + \expandafter#1\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% +}% + +\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}}% \let\pgfmathfloatsin=\pgfmathfloatsin@ -\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}} +\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}}% \let\pgfmathfloatcos=\pgfmathfloatcos@ \def\pgfmathfloattan@#1{% - % compute sin(#1) / cos(#1) - \begingroup - \pgfmathfloatcos@{#1}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatsin@{#1}% - \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} + % compute sin(#1) / cos(#1) + \begingroup + \pgfmathfloatcos@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatsin@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% \let\pgfmathfloattan=\pgfmathfloattan@ \def\pgfmathfloatcot@#1{% - % compute cos(#1) / sin(#1) - \begingroup - \pgfmathfloatsin@{#1}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatcos@{#1}% - \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + % compute cos(#1) / sin(#1) + \begingroup + \pgfmathfloatsin@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatcos@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatcot=\pgfmathfloatcot@ \def\pgfmathfloatatan@#1{% - \begingroup - \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax% - \pgfmathfloatcreate{1}{1.6}{4}% - \global\let\pgfmathfloatatan@TMP=\pgfmathresult - \pgfmathfloatcreate{2}{1.6}{4}% - \global\let\pgfmathfloatatan@TMPB=\pgfmathresult - \fi - \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}% - \ifpgfmathfloatcomparison - \pgfmathiftrigonometricusesdeg{% - \pgfmathfloatcreate{1}{9.0}{1}% - }{% - \pgfmathfloatcreate{1}{1.570796326794}{0}% - }% - \else - \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}% - \ifpgfmathfloatcomparison - \pgfmathiftrigonometricusesdeg{% - \pgfmathfloatcreate{2}{9.0}{1}% - }{% - \pgfmathfloatcreate{2}{1.570796326794}{0}% - }% - \else - \pgfmathfloattofixed@{#1}% - \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}% - \pgfmathfloatparsenumber{\pgfmathresult}% - \fi - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax% + \pgfmathfloatcreate{1}{1.6}{4}% + \global\let\pgfmathfloatatan@TMP=\pgfmathresult + \pgfmathfloatcreate{2}{1.6}{4}% + \global\let\pgfmathfloatatan@TMPB=\pgfmathresult + \fi + \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}% + \ifpgfmathfloatcomparison + \pgfmathiftrigonometricusesdeg{% + \pgfmathfloatcreate{1}{9.0}{1}% + }{% + \pgfmathfloatcreate{1}{1.570796326794}{0}% + }% + \else + \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}% + \ifpgfmathfloatcomparison + \pgfmathiftrigonometricusesdeg{% + \pgfmathfloatcreate{2}{9.0}{1}% + }{% + \pgfmathfloatcreate{2}{1.570796326794}{0}% + }% + \else + \pgfmathfloattofixed@{#1}% + \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloatatan=\pgfmathfloatatan@ \def\pgfmathfloatatantwo#1#2{% % Note: first parameter is y (!), second is x (!) \begingroup% - \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice - \def\pgfmath@trig@format@choice{0}% - % - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E - \ifnum\pgfmathfloat@a@S=0 - % ok, #1 = 0. Substitute by 1e-16 such that the next \ifnum catches it: - \pgfmathfloat@a@E=-16 % - \fi - % - \ifnum\pgfmathfloat@a@E<-3 % - \ifnum\pgfmathfloat@b@S=2 % - % #2 < 0 - \pgfmathfloatcreate{1}{1.8}{2}% +180 - \else - \ifnum\pgfmathfloat@b@S=1 % - % #2 >0 - \pgfmathfloatcreate{0}{0.0}{0}% - \else - % + or - 90, just use the sign of #1: - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{9.0}{1}% - \fi - \fi + \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice + \def\pgfmath@trig@format@choice{0}% + % + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \ifnum\pgfmathfloat@a@S=0 + % ok, #1 = 0. Substitute by 1e-16 such that the next \ifnum catches it: + \pgfmathfloat@a@E=-16 % + \fi + % + \ifnum\pgfmathfloat@a@E<-3 % + \ifnum\pgfmathfloat@b@S=2 % + % #2 < 0 + \pgfmathfloatcreate{1}{1.8}{2}% +180 + \else + \ifnum\pgfmathfloat@b@S=1 % + % #2 >0 + \pgfmathfloatcreate{0}{0.0}{0}% + \else + % + or - 90, just use the sign of #1: + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{9.0}{1}% + \fi + \fi \else% \pgfmathfloatabs@{#1}\let\pgfmath@tempa\pgfmathresult% \pgfmathfloatabs@{#2}\let\pgfmath@tempb\pgfmathresult% - \pgfmathfloatgreaterthan@{\pgfmath@tempa}{\pgfmath@tempb}% - \ifpgfmathfloatcomparison + \pgfmathfloatgreaterthan@{\pgfmath@tempa}{\pgfmath@tempb}% + \ifpgfmathfloatcomparison \pgfmathfloatdivide@{#2}{\pgfmath@tempa}% \expandafter\pgfmathfloatatan@\expandafter{\pgfmathresult}% - \let\pgfmath@tempa=\pgfmathresult - \pgfmathfloatcreate{1}{9.0}{1}% - \let\pgfmath@tempb=\pgfmathresult - \pgfmathfloatsubtract@{\pgfmath@tempb}{\pgfmath@tempa}% + \let\pgfmath@tempa=\pgfmathresult + \pgfmathfloatcreate{1}{9.0}{1}% + \let\pgfmath@tempb=\pgfmathresult + \pgfmathfloatsubtract@{\pgfmath@tempb}{\pgfmath@tempa}% \else% \pgfmathfloatdivide@{\pgfmath@tempa}{#2}% \expandafter\pgfmathfloatatan@\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloatifflags\expandafter{\pgfmathresult}{2}{% - \let\pgfmath@tempa=\pgfmathresult - \pgfmathfloatcreate{1}{1.8}{2}% - \let\pgfmath@tempb=\pgfmathresult - \pgfmathfloatadd@{\pgfmath@tempa}{\pgfmath@tempb}% - }{}% + \expandafter\pgfmathfloatifflags\expandafter{\pgfmathresult}{2}{% + \let\pgfmath@tempa=\pgfmathresult + \pgfmathfloatcreate{1}{1.8}{2}% + \let\pgfmath@tempb=\pgfmathresult + \pgfmathfloatadd@{\pgfmath@tempa}{\pgfmath@tempb}% + }{}% \fi% - % - \pgfmathfloatifflags{#1}{-}{% - % #1 < 0: - \pgfmathfloatmultiplyfixed@{\pgfmathresult}{-1}% - }{}% + % + \pgfmathfloatifflags{#1}{-}{% + % #1 < 0: + \pgfmathfloatmultiplyfixed@{\pgfmathresult}{-1}% + }{}% \fi% - \if1\pgfmath@trig@format@choice@@ - % trig format=rad - \pgfmathfloat@scale@deg@to@rad\pgfmathresult - \fi + \if1\pgfmath@trig@format@choice@@ + % trig format=rad + \pgfmathfloat@scale@deg@to@rad\pgfmathresult + \fi \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \endgroup% }% \let\pgfmathfloatatantwo@=\pgfmathfloatatantwo \expandafter\let\csname pgfmathfloatatan2\endcsname=\pgfmathfloatatantwo \expandafter\let\csname pgfmathfloatatan2@\endcsname=\pgfmathfloatatantwo@ \def\pgfmathfloat@scale@deg@to@rad#1{% - \edef\pgfmathfloat@loc@TMPb{#1}% - \pgfmathfloatcreate{1}{1.74532925199433}{-2}% = pi / 180 - \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@loc@TMPb}% + \edef\pgfmathfloat@loc@TMPb{#1}% + \pgfmathfloatcreate{1}{1.74532925199433}{-2}% = pi / 180 + \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@loc@TMPb}% }% -\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}% \let\pgfmathfloatsec=\pgfmathfloatsec@ -\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}% \let\pgfmathfloatcosec=\pgfmathfloatcosec@ % Expands #2 using \edef and invokes #1 with the resulting string. @@ -1788,33 +1903,33 @@ % will invoke % \pgfmathexp@{7.9} \def\pgfmathlog@invoke@expanded#1#2{% - \edef\pgfmath@resulttemp{#2}% - \expandafter#1\pgfmath@resulttemp -} + \edef\pgfmath@resulttemp{#2}% + \expandafter#1\pgfmath@resulttemp +}% \def\pgfmathfloatln@#1{% - \pgfmathlog@float{#1}% - \ifx\pgfmathresult\pgfutil@empty - \pgfmathfloatcreate{3}{0.0}{0}% - \else - \pgfmathfloatparsenumber{\pgfmathresult}% - \fi -} + \pgfmathlog@float{#1}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi +}% \let\pgfmathfloatln=\pgfmathfloatln@ \expandafter\def\csname pgfmathfloatlog10@\endcsname#1{% - \pgfmathfloatln@{#1}% - \let\pgfmathfloat@log@e=\pgfmathresult - \pgfmathfloatcreate{1}{4.34294481903252}{-1}% 1/ln(10) - \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@e}% + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@log@e=\pgfmathresult + \pgfmathfloatcreate{1}{4.34294481903252}{-1}% 1/ln(10) + \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@e}% }% \pgfutil@namelet{pgfmathfloatlog10}{pgfmathfloatlog10@}% \expandafter\def\csname pgfmathfloatlog2@\endcsname#1{% - \pgfmathfloatln@{#1}% - \let\pgfmathfloat@log@e=\pgfmathresult - \pgfmathfloatcreate{1}{1.44269504088896}{0}% 1/ln(2) - \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@e}% + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@log@e=\pgfmathresult + \pgfmathfloatcreate{1}{1.44269504088896}{0}% 1/ln(2) + \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@e}% }% \pgfutil@namelet{pgfmathfloatlog2}{pgfmathfloatlog2@}% @@ -1827,7 +1942,7 @@ % % This allows numbers such at 10000000 or 5.23e-10 to be represented % properly, although TeX-registers would produce overflow/underflow -% errors in these cases. +% errors in these cases. % % The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y % @@ -1837,315 +1952,315 @@ % 2. it returns the result as fixed point number % Use \pgfmathln@ instead! \def\pgfmathlog@#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathlog@float{\pgfmathresult}% -} + \pgfmathfloatparsenumber{#1}% + \pgfmathlog@float{\pgfmathresult}% +}% \let\pgfmathlog=\pgfmathlog@ \def\pgfmathlog@float#1{% - \begingroup% - % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S=1 - % Now, compute log(#1) = log(M) + E*log(10) - \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}% - \pgfmathfloat@b@M=\pgfmathresult pt% - \pgfmathfloat@a@M=2.302585pt% = log(10) - \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax - \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% - \else - \let\pgfmathresult=\pgfutil@empty% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup% -} + \begingroup% + % compute #1 = M*10^E with normalised mantissa M = [+-]*[1-9].XXXXX + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S=1 + % Now, compute log(#1) = log(M) + E*log(10) + \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}% + \pgfmathfloat@b@M=\pgfmathresult pt% + \pgfmathfloat@a@M=2.302585pt% = log(10) + \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax + \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% + \else + \let\pgfmathresult=\pgfutil@empty% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup% +}% % Computes exp(#1) in floating point. % -% The algorithm employs the identity +% The algorithm employs the identity % exp(x) = exp(x - log(10^k) + log(10^k) % = 10^k exp( x - k*log 10 ) -% with k choosen such that exp( x - k*log10) can be computed with the +% with k chosen such that exp( x - k*log10) can be computed with the % basic level math engine. % % The precision (relative error) is between 10^{-4} and 10^{-6}. For % #1 = 700, it is even 10^{-3}. I will need to improve that someday. \def\pgfmathfloatexp@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - % #1 = 0: - \pgfmathfloatcreate{1}{1.0}{0}% - \or% #1 > 0 - \pgfmathfloatexp@@{#1}% - \or% #1 < 0 - \pgfmathfloatexp@@{#1}% - \else - \edef\pgfmathresult{#1}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % #1 = 0: + \pgfmathfloatcreate{1}{1.0}{0}% + \or% #1 > 0 + \pgfmathfloatexp@@{#1}% + \or% #1 < 0 + \pgfmathfloatexp@@{#1}% + \else + \edef\pgfmathresult{#1}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatexp@@#1{% - % Employ the identity - % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10)) - % - % I'd like to have x - k*log(10) <= 1 - % => compute k := int( (x - 1) * 1/log(10) ) - % that should suffice since \pgfmathexp@ should be - % accurate enough for those numbers. - % - % please note that we can do all this in TeX registers. - % exp(700) is almost the maximum of double precision - % anyway, and exp(16000) is certainly the largest we will - % ever need. - \pgfmathfloattofixed@{#1}% - \pgf@xa=\pgfmathresult pt - \pgf@xa=0.434294481\pgf@xa\relax - \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% - \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax - \pgf@xa=2.302585092pt - \multiply\pgf@xa by-\pgfmathfloat@k\relax - \advance\pgf@xa by\pgfmathresult pt - \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% + % Employ the identity + % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10)) + % + % I'd like to have x - k*log(10) <= 1 + % => compute k := int( (x - 1) * 1/log(10) ) + % that should suffice since \pgfmathexp@ should be + % accurate enough for those numbers. + % + % please note that we can do all this in TeX registers. + % exp(700) is almost the maximum of double precision + % anyway, and exp(16000) is certainly the largest we will + % ever need. + \pgfmathfloattofixed@{#1}% + \pgf@xa=\pgfmathresult pt + \pgf@xa=0.434294481\pgf@xa\relax + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% + \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax + \pgf@xa=2.302585092pt + \multiply\pgf@xa by-\pgfmathfloat@k\relax + \advance\pgf@xa by\pgfmathresult pt + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% %\message{computing exp(\pgfmathresult) = 10^\pgfmathfloat@k * exp(\pgfmathfloat@loc@TMPa)...}% - \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}% -} + \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}% +}% % determine 'k'. This is a heuristics. The exponential series % converges best for |x| <= 1. However, the fixed point arithmetics % for tex results in best results for large |x|. Well, I'll need to % tune this here. \def\pgfmathfloatexp@@toint#1.#2\relax{% - \c@pgf@counta=#1\relax - \ifnum\c@pgf@counta<0 + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 \advance\c@pgf@counta by-1 % FIXME . this is a test for optimizations. - \c@pgf@countb=#2\relax - \ifnum\c@pgf@countb>0 - \advance\c@pgf@counta by-1 - \fi - \fi - \edef\pgfmathfloat@k{\the\c@pgf@counta}% + \c@pgf@countb=#2\relax + \ifnum\c@pgf@countb>0 + \advance\c@pgf@counta by-1 + \fi + \fi + \edef\pgfmathfloat@k{\the\c@pgf@counta}% }% \let\pgfmathfloatexp=\pgfmathfloatexp@ \def\pgfmathfloatround@#1{% - \begingroup - \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov - \pgfmathfloattofixed{#1}% - \pgfmathroundto{\pgfmathresult}% - \pgfmathfloatparsenumber{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov + \pgfmathfloattofixed{#1}% + \pgfmathroundto{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatneg@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S\relax - % 0: - \edef\pgfmathresult{#1}% - \or - % +: - \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \or - % -: - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \or - % nan: - \edef\pgfmathresult{#1}% - \or - % +infty: - \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \or - % -infty: - \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % 0: + \edef\pgfmathresult{#1}% + \or + % +: + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -: + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % nan: + \edef\pgfmathresult{#1}% + \or + % +infty: + \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -infty: + \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatpow@#1#2{% - \begingroup% - \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S\relax - % #1 ^ 0 = 1 - \pgfmathfloatcreate{1}{1.0}{0}% - \or - % #2 > 0 - \pgfmathfloatpow@@{#1}{#2}% - \or - % #2 < 0 - \pgfmathfloatpow@@{#1}{#2}% - \or - % #2 = nan - \edef\pgfmathresult{#2}% - \or - % #2 = inf - \edef\pgfmathresult{#2}% - \or - % #2 = -inf - \pgfmathfloatcreate{0}{0.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup% + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % #1 ^ 0 = 1 + \pgfmathfloatcreate{1}{1.0}{0}% + \or + % #2 > 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 < 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 = nan + \edef\pgfmathresult{#2}% + \or + % #2 = inf + \edef\pgfmathresult{#2}% + \or + % #2 = -inf + \pgfmathfloatcreate{0}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % computes #1^#2 % PRECONDITIONS % - #2 is positive. \def\pgfmathfloatpow@@#1#2{% - \pgfmathfloattofixed@{#2}% - \afterassignment\pgfmath@x% - \expandafter\c@pgfmath@counta\pgfmathresult pt\relax% - \ifdim\pgfmath@x=0pt % - % loop "manually"; we have an integer exponent! - \ifnum\c@pgfmath@counta<0 - \pgfmathfloatreciprocal@{#1}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \c@pgfmath@counta=-\c@pgfmath@counta - \else - \edef\pgfmathfloat@loc@TMPa{#1}% - \fi - \pgfmathfloatcreate{1}{1.0}{0}% - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \pgfmathloop - \ifnum\c@pgfmath@counta>0\relax% - \ifodd\c@pgfmath@counta% - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}% - \let\pgfmathfloat@loc@TMPb=\pgfmathresult - \fi - \ifnum\c@pgfmath@counta>1\relax% - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \fi% - \divide\c@pgfmath@counta by2\relax% - \repeatpgfmathloop% - \else - \pgfmathfloatgetflags{#1}\c@pgfmath@counta - \ifnum0=\c@pgfmath@counta - % ah: 0^x - \pgfmathfloatgetflags{#2}\c@pgfmath@counta - \ifnum0=\c@pgfmath@counta - % ah: 0^0 - \pgfmathfloatcreate{1}{1.0}{0}% - \else - % ah: 0^x with x!=0: - \pgfmathfloatcreate{0}{0.0}{0}% - \fi - \else - % employ #1^#2 = exp( #2 * ln(#1) ) - \pgfmathfloatln@{#1}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \edef\pgfmathfloat@loc@TMPb{#2}% - \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% - \pgfmathfloatexp@{\pgfmathresult}% - \fi - \fi -} + \pgfmathfloattofixed@{#2}% + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\pgfmathresult pt\relax% + \ifdim\pgfmath@x=0pt % + % loop "manually"; we have an integer exponent! + \ifnum\c@pgfmath@counta<0 + \pgfmathfloatreciprocal@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \c@pgfmath@counta=-\c@pgfmath@counta + \else + \edef\pgfmathfloat@loc@TMPa{#1}% + \fi + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \ifodd\c@pgfmath@counta% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \fi + \ifnum\c@pgfmath@counta>1\relax% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi% + \divide\c@pgfmath@counta by2\relax% + \repeatpgfmathloop% + \else + \pgfmathfloatgetflags{#1}\c@pgfmath@counta + \ifnum0=\c@pgfmath@counta + % ah: 0^x + \pgfmathfloatgetflags{#2}\c@pgfmath@counta + \ifnum0=\c@pgfmath@counta + % ah: 0^0 + \pgfmathfloatcreate{1}{1.0}{0}% + \else + % ah: 0^x with x!=0: + \pgfmathfloatcreate{0}{0.0}{0}% + \fi + \else + % employ #1^#2 = exp( #2 * ln(#1) ) + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \edef\pgfmathfloat@loc@TMPb{#2}% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% + \pgfmathfloatexp@{\pgfmathresult}% + \fi + \fi +}% \def\pgfmathfloat@definemethodfrombasic@NOARG#1{% - \pgfutil@ifundefined{pgfmath@basic@#1@}{% - \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% - }{}% - \edef\pgfmathfloat@glob@TMP{% - \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname - \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% - }% - \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% - \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP{% + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% }% \def\pgfmathfloat@definemethodfrombasic@ONEARG#1{% - \pgfutil@ifundefined{pgfmath@basic@#1@}{% - \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% - }{}% - \edef\pgfmathfloat@glob@TMP##1{% - \noexpand\pgfmathfloattofixed{##1}% - \noexpand\expandafter - \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% - {\noexpand\pgfmathresult}% - \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% - }% - \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% - \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1{% + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% }% \def\pgfmathfloat@definemethodfrombasic@TWOARGS#1{% - \pgfutil@ifundefined{pgfmath@basic@#1@}{% - \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% - }{}% - \edef\pgfmathfloat@glob@TMP##1##2{% - \noexpand\pgfmathfloattofixed{##2}% - \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult - \noexpand\pgfmathfloattofixed{##1}% - \noexpand\expandafter - \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% - {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}% - \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% - }% - \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% - \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% -}% -\pgfmathfloat@definemethodfrombasic@NOARG{rand} -\pgfmathfloat@definemethodfrombasic@NOARG{rnd} -\pgfmathfloat@definemethodfrombasic@NOARG{false} -\pgfmathfloat@definemethodfrombasic@NOARG{true} -% arcsin, arccos -\pgfmathfloat@definemethodfrombasic@ONEARG{asin} -\pgfmathfloat@definemethodfrombasic@ONEARG{acos} -\pgfmathfloat@definemethodfrombasic@ONEARG{not} -\pgfmathfloat@definemethodfrombasic@ONEARG{hex} -\pgfmathfloat@definemethodfrombasic@ONEARG{Hex} -\pgfmathfloat@definemethodfrombasic@ONEARG{oct} -\pgfmathfloat@definemethodfrombasic@ONEARG{bin} -\pgfmathfloat@definemethodfrombasic@TWOARGS{and} -\pgfmathfloat@definemethodfrombasic@TWOARGS{or} + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1##2{% + \noexpand\pgfmathfloattofixed{##2}% + \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\pgfmathfloat@definemethodfrombasic@NOARG{rand}% +\pgfmathfloat@definemethodfrombasic@NOARG{rnd}% +\pgfmathfloat@definemethodfrombasic@NOARG{false}% +\pgfmathfloat@definemethodfrombasic@NOARG{true}% +% arcsin, arccos +\pgfmathfloat@definemethodfrombasic@ONEARG{asin}% +\pgfmathfloat@definemethodfrombasic@ONEARG{acos}% +\pgfmathfloat@definemethodfrombasic@ONEARG{not}% +\pgfmathfloat@definemethodfrombasic@ONEARG{hex}% +\pgfmathfloat@definemethodfrombasic@ONEARG{Hex}% +\pgfmathfloat@definemethodfrombasic@ONEARG{oct}% +\pgfmathfloat@definemethodfrombasic@ONEARG{bin}% +\pgfmathfloat@definemethodfrombasic@TWOARGS{and}% +\pgfmathfloat@definemethodfrombasic@TWOARGS{or}% \pgfutil@ifundefined{pgfmathdeclarefunction}{% - % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: - \let\pgfmath@basic@rand=\pgfmathrand - \let\pgfmath@basic@rand@=\pgfmathrand@ - \def\pgfmathfloatrand@{% - \pgfmath@basic@rand - \pgfmathfloatparsenumber{\pgfmathresult}% - }% - \let\pgfmathfloatrand=\pgfmathfloatrand@% - % - % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: - \let\pgfmath@basic@rnd=\pgfmathrnd - \let\pgfmath@basic@rnd@=\pgfmathrnd@ - \def\pgfmathfloatrnd@{% - \pgfmath@basic@rnd - \pgfmathfloatparsenumber{\pgfmathresult}% - }% - \let\pgfmathfloatrnd=\pgfmathfloatrnd@% -}{} + % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rand=\pgfmathrand + \let\pgfmath@basic@rand@=\pgfmathrand@ + \def\pgfmathfloatrand@{% + \pgfmath@basic@rand + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + \let\pgfmathfloatrand=\pgfmathfloatrand@% + % + % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rnd=\pgfmathrnd + \let\pgfmath@basic@rnd@=\pgfmathrnd@ + \def\pgfmathfloatrnd@{% + \pgfmath@basic@rnd + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + \let\pgfmathfloatrnd=\pgfmathfloatrnd@% +}{}% % Implements the factorial of '#1'. % This does only work if '#1 < 2^32'. \def\pgfmathfloatfactorial@#1{% - \begingroup - \pgfmathfloattofixed{#1}% - % collect integer part into a 32 bit register: - \afterassignment\pgfmath@gobbletilpgfmath@% - \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@% - \pgfmathfloatcreate{1}{1.0}{0}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathloop - \ifnum\c@pgfmath@counta<2 % - \else - \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% - \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \advance\c@pgfmath@counta by-1\relax% - \repeatpgfmathloop - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloattofixed{#1}% + % collect integer part into a 32 bit register: + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@% + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta<2 % + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \advance\c@pgfmath@counta by-1\relax% + \repeatpgfmathloop + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % Implements the vector length of a 2D vector. @@ -2153,60 +2268,60 @@ % ATTENTION: this does NOT use the improved code of the basic layer! % It simply computed sqrt( #1^2 + #2^2 )! \def\pgfmathfloatveclen@#1#2{% - \begingroup - \edef\pgfmathfloat@@a{#1}% - \pgfmathfloatmultiply@{\pgfmathfloat@@a}{\pgfmathfloat@@a}% - \let\pgfmathfloat@@a=\pgfmathresult - % - \edef\pgfmathfloat@@b{#2}% - \pgfmathfloatmultiply@{\pgfmathfloat@@b}{\pgfmathfloat@@b}% - \let\pgfmathfloat@@b=\pgfmathresult - % - \pgfmathfloatadd@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% - \pgfmathfloatsqrt@{\pgfmathresult}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \edef\pgfmathfloat@@a{#1}% + \pgfmathfloatmultiply@{\pgfmathfloat@@a}{\pgfmathfloat@@a}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \edef\pgfmathfloat@@b{#2}% + \pgfmathfloatmultiply@{\pgfmathfloat@@b}{\pgfmathfloat@@b}% + \let\pgfmathfloat@@b=\pgfmathresult + % + \pgfmathfloatadd@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% + \pgfmathfloatsqrt@{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatcosh@#1{% - \begingroup - \pgfmathfloatexp@{#1}% - \let\pgfmathfloat@@a=\pgfmathresult - % - \pgfmathfloatneg@{#1}% - \pgfmathfloatexp@{\pgfmathresult}% - % - \pgfmathfloatadd@{\pgfmathresult}{\pgfmathfloat@@a}% - \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% - % - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatexp@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatneg@{#1}% + \pgfmathfloatexp@{\pgfmathresult}% + % + \pgfmathfloatadd@{\pgfmathresult}{\pgfmathfloat@@a}% + \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloatsinh@#1{% - \begingroup - \pgfmathfloatexp@{#1}% - \let\pgfmathfloat@@a=\pgfmathresult - % - \pgfmathfloatneg@{#1}% - \pgfmathfloatexp@{\pgfmathresult}% - % - \pgfmathfloatsubtract@{\pgfmathfloat@@a}{\pgfmathresult}% - \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% - % - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatexp@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatneg@{#1}% + \pgfmathfloatexp@{\pgfmathresult}% + % + \pgfmathfloatsubtract@{\pgfmathfloat@@a}{\pgfmathresult}% + \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloattanh@#1{% - \begingroup - \pgfmathfloatsinh@{#1}% - \let\pgfmathfloat@@a=\pgfmathresult - % - \pgfmathfloatcosh@{#1}% - \let\pgfmathfloat@@b=\pgfmathresult - % - \pgfmathfloatdivide@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% - % - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatsinh@{#1}% + \let\pgfmathfloat@@a=\pgfmathresult + % + \pgfmathfloatcosh@{#1}% + \let\pgfmathfloat@@b=\pgfmathresult + % + \pgfmathfloatdivide@{\pgfmathfloat@@a}{\pgfmathfloat@@b}% + % + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex index 41c0d1cdc19..7de4a2b9e97 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex @@ -11,7 +11,7 @@ % Experimentally, it performed well while computing ~12 intersections of two % plots, each with 600 samples. It failed when the number of samples exceeded 700. -\usepgflibrary{fpu} +\usepgflibrary{fpu}% \newcount\pgf@intersect@solutions @@ -19,28 +19,28 @@ \newif\ifpgf@intersect@sort@by@second@path \def\pgfintersectionsortbyfirstpath{% - \pgf@intersect@sorttrue% - \pgf@intersect@sort@by@second@pathfalse% -} + \pgf@intersect@sorttrue% + \pgf@intersect@sort@by@second@pathfalse% +}% \def\pgfintersectionsortbysecondpath{% - \pgf@intersect@sorttrue% - \pgf@intersect@sort@by@second@pathtrue% -} + \pgf@intersect@sorttrue% + \pgf@intersect@sort@by@second@pathtrue% +}% % #1: the index. It starts at 1 and ends with \pgfintersectionsolutions (inclusive). % Invalid values will implicitly result in the origin. \def\pgfpointintersectionsolution#1{% - \ifnum#1<1\relax% - \pgfpoint@intersect@solution@orgin% - \else% - \ifnum#1>\pgfintersectionsolutions\relax% - \pgfpoint@intersect@solution@orgin% - \else% - \csname pgfpoint@intersect@solution@#1\endcsname% - \fi% - \fi% -} + \ifnum#1<1\relax% + \pgfpoint@intersect@solution@orgin% + \else% + \ifnum#1>\pgfintersectionsolutions\relax% + \pgfpoint@intersect@solution@orgin% + \else% + \csname pgfpoint@intersect@solution@#1\endcsname% + \fi% + \fi% +}% % Gets the segment indices of solution #1. % @@ -51,27 +51,27 @@ % Example: \pgfintersectiongetsolutionsegmentindices{0}{\first}{\second} % % -> \first may be 0 if point #0 is in the 0'th segment -% -> \second may be 42 if point #0 is in the 42'th segment +% -> \second may be 42 if point #0 is in the 42'th segment % % The "segment index" is actually close to the "time" of the solution. % If a solution is at "time" 42.2, it will have segment index 42. \def\pgfintersectiongetsolutionsegmentindices#1#2#3{% - \ifnum#1<1\relax% - \let#2=\pgfutil@empty - \let#3=\pgfutil@empty - \else% - \ifnum#1>\pgfintersectionsolutions\relax% - \let#2=\pgfutil@empty - \let#3=\pgfutil@empty - \else% - \def\pgf@temp##1##2##3##4{% - \edef#2{##1}% - \edef#3{##2}% - }% - \expandafter\let\expandafter\pgf@tempb\csname pgf@intersect@solution@props@#1\endcsname - \expandafter\pgf@temp\pgf@tempb - \fi% - \fi% + \ifnum#1<1\relax% + \let#2=\pgfutil@empty + \let#3=\pgfutil@empty + \else% + \ifnum#1>\pgfintersectionsolutions\relax% + \let#2=\pgfutil@empty + \let#3=\pgfutil@empty + \else% + \def\pgf@temp##1##2##3##4{% + \edef#2{##1}% + \edef#3{##2}% + }% + \expandafter\let\expandafter\pgf@tempb\csname pgf@intersect@solution@props@#1\endcsname + \expandafter\pgf@temp\pgf@tempb + \fi% + \fi% }% % Gets the time indices of solution #1. @@ -96,37 +96,37 @@ % \pgfintersectiongetsolutionsegmentindices (which is a % "coarse-grained" time). \def\pgfintersectiongetsolutiontimes#1#2#3{% - \ifnum#1<1\relax% - \let#2=\pgfutil@empty - \let#3=\pgfutil@empty - \else% - \ifnum#1>\pgfintersectionsolutions\relax% - \let#2=\pgfutil@empty - \let#3=\pgfutil@empty - \else% - \def\pgf@temp##1##2##3##4{% - \edef#2{##3}% - \edef#3{##4}% - % - % check for fallback to segment indices: - \ifx#2\pgfutil@empty \edef#2{##1}\fi - \ifx#3\pgfutil@empty \edef#3{##2}\fi - }% - \expandafter\let\expandafter\pgf@tempb\csname pgf@intersect@solution@props@#1\endcsname - \expandafter\pgf@temp\pgf@tempb - \fi% - \fi% + \ifnum#1<1\relax% + \let#2=\pgfutil@empty + \let#3=\pgfutil@empty + \else% + \ifnum#1>\pgfintersectionsolutions\relax% + \let#2=\pgfutil@empty + \let#3=\pgfutil@empty + \else% + \def\pgf@temp##1##2##3##4{% + \edef#2{##3}% + \edef#3{##4}% + % + % check for fallback to segment indices: + \ifx#2\pgfutil@empty \edef#2{##1}\fi + \ifx#3\pgfutil@empty \edef#3{##2}\fi + }% + \expandafter\let\expandafter\pgf@tempb\csname pgf@intersect@solution@props@#1\endcsname + \expandafter\pgf@temp\pgf@tempb + \fi% + \fi% }% \def\pgfpoint@intersect@solution@orgin{% - \begingroup% - \pgftransforminvert% - \pgfpointorigin% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x=\pgf@x% - \global\pgf@y=\pgf@y% - \endgroup% -} + \begingroup% + \pgftransforminvert% + \pgfpointorigin% + \pgf@pos@transform@glob + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + \endgroup% +}% % #1 code which assigns the first path using \pgfsetpath. % #2 code which assigns the second path using \pgfsetpath. @@ -134,262 +134,262 @@ % On output, the points, their properties, and the number of points are set. % Use \pgfintersectionsolutions which expands to the number of intersections \long\def\pgfintersectionofpaths#1#2{% - \begingroup% - \pgfinterruptpath% - #1% - \pgfgetpath\pgf@intersect@path@a% - \global\let\pgf@intersect@path@temp=\pgf@intersect@path@a% - \endpgfinterruptpath% - \endgroup% - \let\pgf@intersect@path@a=\pgf@intersect@path@temp% - % - \begingroup% - \pgfinterruptpath% - #2% - \pgfgetpath\pgf@intersect@path@b% - \global\let\pgf@intersect@path@temp=\pgf@intersect@path@b% - \endpgfinterruptpath% - \endgroup% - \let\pgf@intersect@path@b=\pgf@intersect@path@temp% - % - \pgf@intersect@solutions=0\relax% - \pgf@intersect@path@reset@a - % - \ifpgf@intersect@sort@by@second@path% - \let\pgf@intersect@temp=\pgf@intersect@path@a% - \let\pgf@intersect@path@a=\pgf@intersect@path@b% - \let\pgf@intersect@path@b=\pgf@intersect@temp% - \fi% - % - \pgfprocessround\pgf@intersect@path@a\pgf@intersect@path@a% - \pgfprocessround\pgf@intersect@path@b\pgf@intersect@path@b% - % - \let\pgf@intersect@token@after=\pgf@intersect@path@process@a% - \expandafter\pgf@intersectionofpaths\pgf@intersect@path@a\pgf@stop% - \edef\pgfintersectionsolutions{\the\pgf@intersect@solutions}% - \pgfmathloop% - \ifnum\pgfmathcounter>\pgfintersectionsolutions\relax% - \else% - \pgfutil@namelet{pgfpoint@intersect@solution@\pgfmathcounter}% - {pgfpoint@g@intersect@solution@\pgfmathcounter}% - \edef\pgf@marshal{\noexpand\pgf@intersection@set@properties{\csname pgfpoint@g@intersect@solution@\pgfmathcounter @props\endcsname}}% - \pgf@marshal - \ifpgf@intersect@sort% - \pgfutil@namelet{pgf@intersect@solution@\pgfmathcounter @time@a}% - {pgf@g@intersect@solution@\pgfmathcounter @time@a}% - \fi% - \repeatpgfmathloop% - \ifpgf@intersect@sort% - \pgfintersectionsolutionsortbytime% - \fi% -} + \begingroup% + \pgfinterruptpath% + #1% + \pgfgetpath\pgf@intersect@path@a% + \global\let\pgf@intersect@path@temp=\pgf@intersect@path@a% + \endpgfinterruptpath% + \endgroup% + \let\pgf@intersect@path@a=\pgf@intersect@path@temp% + % + \begingroup% + \pgfinterruptpath% + #2% + \pgfgetpath\pgf@intersect@path@b% + \global\let\pgf@intersect@path@temp=\pgf@intersect@path@b% + \endpgfinterruptpath% + \endgroup% + \let\pgf@intersect@path@b=\pgf@intersect@path@temp% + % + \pgf@intersect@solutions=0\relax% + \pgf@intersect@path@reset@a + % + \ifpgf@intersect@sort@by@second@path% + \let\pgf@intersect@temp=\pgf@intersect@path@a% + \let\pgf@intersect@path@a=\pgf@intersect@path@b% + \let\pgf@intersect@path@b=\pgf@intersect@temp% + \fi% + % + \pgfprocessround\pgf@intersect@path@a\pgf@intersect@path@a% + \pgfprocessround\pgf@intersect@path@b\pgf@intersect@path@b% + % + \let\pgf@intersect@token@after=\pgf@intersect@path@process@a% + \expandafter\pgf@intersectionofpaths\pgf@intersect@path@a\pgf@stop% + \edef\pgfintersectionsolutions{\the\pgf@intersect@solutions}% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgfintersectionsolutions\relax% + \else% + \pgfutil@namelet{pgfpoint@intersect@solution@\pgfmathcounter}% + {pgfpoint@g@intersect@solution@\pgfmathcounter}% + \edef\pgf@marshal{\noexpand\pgf@intersection@set@properties{\csname pgfpoint@g@intersect@solution@\pgfmathcounter @props\endcsname}}% + \pgf@marshal + \ifpgf@intersect@sort% + \pgfutil@namelet{pgf@intersect@solution@\pgfmathcounter @time@a}% + {pgf@g@intersect@solution@\pgfmathcounter @time@a}% + \fi% + \repeatpgfmathloop% + \ifpgf@intersect@sort% + \pgfintersectionsolutionsortbytime% + \fi% +}% \def\pgf@intersection@set@properties#1{% - \pgfutil@namedef{pgf@intersect@solution@props@\pgfmathcounter}{#1}% + \pgfutil@namedef{pgf@intersect@solution@props@\pgfmathcounter}{#1}% }% % #1 a global name prefix to store properties. \def\pgf@intersection@store@properties#1{% - % we store the time offsets as well and make them available programmatically: - % note that \pgf@intersect@time@a and \pgf@intersect@time@b may be empty. - % - % However, \pgf@intersect@time@offset and - % \pgf@intersect@time@offset@b are *always* valid. In fact,they - % resemble a part of the time: it holds - % 0 <= \pgf@intersect@time@a < 1 - % and \pgf@intersect@time@offset > 0. - % - % If we have an intersection in segment 42 of path A, - % \pgf@intersect@time@offset will be 42. The time inside of that - % segment is given as number in the interval [0,1]. If it is 0.3, - % the total time will be 42.3 and that number will be stored as - % \pgf@intersect@time@a. - % - \expandafter\xdef\csname #1@props\endcsname{{\pgf@intersect@time@offset}{\pgf@intersect@time@offset@b}{\pgf@intersect@time@a}{\pgf@intersect@time@b}}% -} + % we store the time offsets as well and make them available programmatically: + % note that \pgf@intersect@time@a and \pgf@intersect@time@b may be empty. + % + % However, \pgf@intersect@time@offset and + % \pgf@intersect@time@offset@b are *always* valid. In fact,they + % resemble a part of the time: it holds + % 0 <= \pgf@intersect@time@a < 1 + % and \pgf@intersect@time@offset > 0. + % + % If we have an intersection in segment 42 of path A, + % \pgf@intersect@time@offset will be 42. The time inside of that + % segment is given as number in the interval [0,1]. If it is 0.3, + % the total time will be 42.3 and that number will be stored as + % \pgf@intersect@time@a. + % + \expandafter\xdef\csname #1@props\endcsname{{\pgf@intersect@time@offset}{\pgf@intersect@time@offset@b}{\pgf@intersect@time@a}{\pgf@intersect@time@b}}% +}% \def\pgf@intersectionofpaths#1{% - \ifx#1\pgf@stop% - \let\pgf@intersect@next=\relax% - \else% - \ifx#1\pgfsyssoftpath@movetotoken% - \let\pgf@intersect@next=\pgf@intersect@token@moveto% - \else% - \ifx#1\pgfsyssoftpath@linetotoken% - \let\pgf@intersect@next=\pgf@intersect@token@lineto% - \else% - \ifx#1\pgfsyssoftpath@closepathtoken% - \let\pgf@intersect@next=\pgf@intersect@token@lineto% - \else% - \ifx#1\pgfsyssoftpath@curvetosupportatoken% - \let\pgf@intersect@next=\pgf@intersect@token@curveto% - \else% - \ifx#1\pgfsyssoftpath@rectcornertoken% - \let\pgf@intersect@next=\pgf@intersect@token@rect% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \pgf@intersect@next} + \ifx#1\pgf@stop% + \let\pgf@intersect@next=\relax% + \else% + \ifx#1\pgfsyssoftpath@movetotoken% + \let\pgf@intersect@next=\pgf@intersect@token@moveto% + \else% + \ifx#1\pgfsyssoftpath@linetotoken% + \let\pgf@intersect@next=\pgf@intersect@token@lineto% + \else% + \ifx#1\pgfsyssoftpath@closepathtoken% + \let\pgf@intersect@next=\pgf@intersect@token@lineto% + \else% + \ifx#1\pgfsyssoftpath@curvetosupportatoken% + \let\pgf@intersect@next=\pgf@intersect@token@curveto% + \else% + \ifx#1\pgfsyssoftpath@rectcornertoken% + \let\pgf@intersect@next=\pgf@intersect@token@rect% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \pgf@intersect@next}% \def\pgf@intersect@token@moveto#1#2{% - \def\pgfpoint@intersect@start{\pgfqpoint{#1}{#2}}% - \pgf@intersectionofpaths% -} + \def\pgfpoint@intersect@start{\pgfqpoint{#1}{#2}}% + \pgf@intersectionofpaths% +}% \def\pgf@intersect@token@lineto#1#2{% - \def\pgfpoint@intersect@end{\pgfqpoint{#1}{#2}}% - \def\pgf@intersect@type{line}% - \pgf@intersect@token@after% -} + \def\pgfpoint@intersect@end{\pgfqpoint{#1}{#2}}% + \def\pgf@intersect@type{line}% + \pgf@intersect@token@after% +}% \def\pgf@intersect@token@curveto#1#2\pgfsyssoftpath@curvetosupportbtoken#3#4\pgfsyssoftpath@curvetotoken#5#6{% - \def\pgfpoint@intersect@firstsupport{\pgfqpoint{#1}{#2}}% - \def\pgfpoint@intersect@secondsupport{\pgfqpoint{#3}{#4}}% - \def\pgfpoint@intersect@end{\pgfqpoint{#5}{#6}}% - \def\pgf@intersect@type{curve}% - \pgf@intersect@token@after% -} + \def\pgfpoint@intersect@firstsupport{\pgfqpoint{#1}{#2}}% + \def\pgfpoint@intersect@secondsupport{\pgfqpoint{#3}{#4}}% + \def\pgfpoint@intersect@end{\pgfqpoint{#5}{#6}}% + \def\pgf@intersect@type{curve}% + \pgf@intersect@token@after% +}% \def\pgf@intersect@token@rect#1#2\pgfsyssoftpath@rectsizetoken#3#4{% - \pgf@xa=#1\relax% - \advance\pgf@xa by#3\relax% - \pgf@ya=#2\relax% - \advance\pgf@ya by#4\relax% - \edef\pgf@marshal{% - \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}% - \noexpand\pgfsyssoftpath@linetotoken{#1}{\the\pgf@ya}% - \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{\the\pgf@ya}% - \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{#2}% - \noexpand\pgfsyssoftpath@closepathtoken{#1}{#2}% - }% - \expandafter\pgf@intersectionofpaths\pgf@marshal% -} + \pgf@xa=#1\relax% + \advance\pgf@xa by#3\relax% + \pgf@ya=#2\relax% + \advance\pgf@ya by#4\relax% + \edef\pgf@marshal{% + \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}% + \noexpand\pgfsyssoftpath@linetotoken{#1}{\the\pgf@ya}% + \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{\the\pgf@ya}% + \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{#2}% + \noexpand\pgfsyssoftpath@closepathtoken{#1}{#2}% + }% + \expandafter\pgf@intersectionofpaths\pgf@marshal% +}% \def\pgf@intersect@path@process@a{% - \pgf@intersect@path@getpoints@a% - \let\pgf@intersect@token@after=\pgf@intersect@path@process@b% - \pgf@intersect@path@reset@b - \expandafter\pgf@intersectionofpaths\pgf@intersect@path@b\pgf@stop% - \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@a% - \let\pgf@intersect@token@after=\pgf@intersect@path@process@a% - \c@pgf@counta=\pgf@intersect@time@offset\relax% - \advance\c@pgf@counta by1\relax% - \edef\pgf@intersect@time@offset{\the\c@pgf@counta}% - \pgf@intersectionofpaths% -} + \pgf@intersect@path@getpoints@a% + \let\pgf@intersect@token@after=\pgf@intersect@path@process@b% + \pgf@intersect@path@reset@b + \expandafter\pgf@intersectionofpaths\pgf@intersect@path@b\pgf@stop% + \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@a% + \let\pgf@intersect@token@after=\pgf@intersect@path@process@a% + \c@pgf@counta=\pgf@intersect@time@offset\relax% + \advance\c@pgf@counta by1\relax% + \edef\pgf@intersect@time@offset{\the\c@pgf@counta}% + \pgf@intersectionofpaths% +}% \def\pgf@intersect@path@reset@a{% - \def\pgf@intersect@time@offset{0}% - \def\pgf@intersect@time@a{}% + \def\pgf@intersect@time@offset{0}% + \def\pgf@intersect@time@a{}% }% \def\pgf@intersect@path@reset@b{% - \def\pgf@intersect@time@offset@b{0}% - \def\pgf@intersect@time@b{}% + \def\pgf@intersect@time@offset@b{0}% + \def\pgf@intersect@time@b{}% }% \def\pgf@intersect@path@getpoints@a{% - \let\pgfpoint@intersect@start@a=\pgfpoint@intersect@start% - \let\pgfpoint@intersect@end@a=\pgfpoint@intersect@end% - \let\pgfpoint@intersect@firstsupport@a=\pgfpoint@intersect@firstsupport% - \let\pgfpoint@intersect@secondsupport@a=\pgfpoint@intersect@secondsupport% - \let\pgf@intersect@type@a=\pgf@intersect@type% -} + \let\pgfpoint@intersect@start@a=\pgfpoint@intersect@start% + \let\pgfpoint@intersect@end@a=\pgfpoint@intersect@end% + \let\pgfpoint@intersect@firstsupport@a=\pgfpoint@intersect@firstsupport% + \let\pgfpoint@intersect@secondsupport@a=\pgfpoint@intersect@secondsupport% + \let\pgf@intersect@type@a=\pgf@intersect@type% +}% \def\pgf@intersect@path@process@b{% - \pgf@intersect@path@getpoints@b% - \csname pgf@intersect@\pgf@intersect@type@a @and@\pgf@intersect@type@b\endcsname% - \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@b% - \c@pgf@counta=\pgf@intersect@time@offset@b\relax% - \advance\c@pgf@counta by1\relax% - \edef\pgf@intersect@time@offset@b{\the\c@pgf@counta}% - \pgf@intersectionofpaths} + \pgf@intersect@path@getpoints@b% + \csname pgf@intersect@\pgf@intersect@type@a @and@\pgf@intersect@type@b\endcsname% + \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@b% + \c@pgf@counta=\pgf@intersect@time@offset@b\relax% + \advance\c@pgf@counta by1\relax% + \edef\pgf@intersect@time@offset@b{\the\c@pgf@counta}% + \pgf@intersectionofpaths}% \def\pgf@intersect@path@getpoints@b{% - \let\pgfpoint@intersect@start@b=\pgfpoint@intersect@start% - \let\pgfpoint@intersect@end@b=\pgfpoint@intersect@end% - \let\pgfpoint@intersect@firstsupport@b=\pgfpoint@intersect@firstsupport% - \let\pgfpoint@intersect@secondsupport@b=\pgfpoint@intersect@secondsupport% - \let\pgf@intersect@type@b=\pgf@intersect@type% -} + \let\pgfpoint@intersect@start@b=\pgfpoint@intersect@start% + \let\pgfpoint@intersect@end@b=\pgfpoint@intersect@end% + \let\pgfpoint@intersect@firstsupport@b=\pgfpoint@intersect@firstsupport% + \let\pgfpoint@intersect@secondsupport@b=\pgfpoint@intersect@secondsupport% + \let\pgf@intersect@type@b=\pgf@intersect@type% +}% \def\pgf@intersect@line@and@line{% - \pgf@intersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% - {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% + \pgf@intersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% + {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% }% \def\pgf@intersect@line@and@curve{% - \pgf@intersectionoflineandcurve% - {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% - {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}% - {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% -} + \pgf@intersectionoflineandcurve% + {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% + {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}% + {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% +}% \def\pgf@intersect@curve@and@line{% - \pgf@intersectionofcurveandline% - {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}% - {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% - {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% -} + \pgf@intersectionofcurveandline% + {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}% + {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% + {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% +}% \def\pgf@intersect@curve@and@curve{% - \pgf@intersectionofcurves% - {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}% - {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% - {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}% - {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% -} + \pgf@intersectionofcurves% + {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}% + {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}% + {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}% + {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}% +}% \def\pgfintersectionoflines#1#2#3#4{% - \pgf@intersect@solutions=0\relax% - \pgf@intersectionoflines{#1}{#2}{#3}{#4}% -} + \pgf@intersect@solutions=0\relax% + \pgf@intersectionoflines{#1}{#2}{#3}{#4}% +}% \def\pgf@intersectionoflines#1#2#3#4{% - \pgf@iflinesintersect{#1}{#2}{#3}{#4}% - {% - \pgfextract@process\pgf@intersect@solution@candidate{% - \pgfpointintersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% - {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% - }% - \pgf@ifsolution@duplicate{\pgf@intersect@solution@candidate}{% - % ah - we a duplicate. Apparently, we have a hit on an - % endpoint. - }{% - \global\advance\pgf@intersect@solutions by1\relax% - \expandafter\global\expandafter\let\csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname=\pgf@intersect@solution@candidate - \ifpgf@intersect@sort% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}}% - \edef\pgf@marshal{% - \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}% - }% - \pgf@marshal% - \let\pgf@intersect@length@a=\pgfmathresult% - \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}% - \edef\pgf@marshal{% - \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - }% - \pgf@marshal% - \pgfmathdivide@{\pgfmathresult}{\pgf@intersect@length@a}% - \pgf@x=\pgfmathresult pt\relax% - \advance\pgf@x by\pgf@intersect@time@offset pt\relax% - \edef\pgf@intersect@time@a{\pgfmath@tonumber{\pgf@x}}% - \expandafter\global\expandafter\let\csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname= - \pgf@intersect@time@a - \else - \let\pgf@intersect@time@a=\pgfutil@empty - \fi% - \let\pgf@intersect@time@b=\pgfutil@empty - \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% - }% - % - }{}% -} + \pgf@iflinesintersect{#1}{#2}{#3}{#4}% + {% + \pgfextract@process\pgf@intersect@solution@candidate{% + \pgfpointintersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% + {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% + }% + \pgf@ifsolution@duplicate{\pgf@intersect@solution@candidate}{% + % ah - we a duplicate. Apparently, we have a hit on an + % endpoint. + }{% + \global\advance\pgf@intersect@solutions by1\relax% + \expandafter\global\expandafter\let\csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname=\pgf@intersect@solution@candidate + \ifpgf@intersect@sort% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}}% + \edef\pgf@marshal{% + \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}% + }% + \pgf@marshal% + \let\pgf@intersect@length@a=\pgfmathresult% + \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}% + \edef\pgf@marshal{% + \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + }% + \pgf@marshal% + \pgfmathdivide@{\pgfmathresult}{\pgf@intersect@length@a}% + \pgf@x=\pgfmathresult pt\relax% + \advance\pgf@x by\pgf@intersect@time@offset pt\relax% + \edef\pgf@intersect@time@a{\pgfmath@tonumber{\pgf@x}}% + \expandafter\global\expandafter\let\csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname= + \pgf@intersect@time@a + \else + \let\pgf@intersect@time@a=\pgfutil@empty + \fi% + \let\pgf@intersect@time@b=\pgfutil@empty + \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% + }% + % + }{}% +}% % Test if two lines L1 and L2 intersect. % @@ -410,395 +410,395 @@ % % t = |x4-x3 x3-x1| / |x4-x3 x2-x1| % |y4-y3 y3-y1| |y4-y3 y2-y1| -% +% % with 0<=s,t<=1 -% +% % s and t do not need to be calculated: % % Let s = A / C and t = B / C -% +% % Then 0<=s<=1 if !(C=0) && ((A=0) || ((A>0) && !(C<A)) || ((A<0) && !(C>A))) % 0<=t<=1 if !(C=0) && ((B=0) || ((B>0) && !(C<B)) || ((B<0) && !(C>B))) -% +% \newif\ifpgf@s \newif\ifpgf@t \def\pgfiflinesintersect#1#2#3#4{% - \begingroup% - \pgf@iflinesintersect{\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% - {\aftergroup\pgfutil@firstoftwo}{\aftergroup\pgfutil@secondoftwo}% - \endgroup% -} + \begingroup% + \pgf@iflinesintersect{\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% + {\aftergroup\pgfutil@firstoftwo}{\aftergroup\pgfutil@secondoftwo}% + \endgroup% +}% \def\pgf@iflinesintersect#1#2#3#4{% - #4\relax% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - #3\relax% - \advance\pgf@xc by-\pgf@x% - \advance\pgf@yc by-\pgf@y% - \pgf@xb=\pgf@x% - \pgf@yb=\pgf@y% - #2\relax% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - #1\relax% - \advance\pgf@xa by-\pgf@x% - \advance\pgf@ya by-\pgf@y% - \advance\pgf@xb by-\pgf@x% - \advance\pgf@yb by-\pgf@y% - % - % xc = x4-x3; yc=y4-y3; - % xb = x3-x1; yb=y3-y1; - % xa = x2-x1; ya=y2-y1; - % - % - % Normalise a little. 16384 may not be a robust choice. - % - \c@pgf@counta=\pgf@xa\divide\c@pgf@counta by16384\relax% - \c@pgf@countb=\pgf@xb\divide\c@pgf@countb by16384\relax% - \c@pgf@countc=\pgf@ya\divide\c@pgf@countc by16384\relax% - \c@pgf@countd=\pgf@yb\divide\c@pgf@countd by16384\relax% - \multiply\c@pgf@counta by\c@pgf@countd% - \multiply\c@pgf@countc by\c@pgf@countb% - \advance\c@pgf@counta by-\c@pgf@countc% - \pgfutil@tempcnta=\c@pgf@counta% - % - \c@pgf@counta=\pgf@xc\divide\c@pgf@counta by16384\relax% - \c@pgf@countc=\pgf@yc\divide\c@pgf@countc by16384\relax% - \multiply\c@pgf@countd by\c@pgf@counta% - \multiply\c@pgf@countb by\c@pgf@countc% - \advance\c@pgf@countd by-\c@pgf@countb% - \pgfutil@tempcntb=\c@pgf@countd% - % - \c@pgf@countb=\pgf@xa\divide\c@pgf@countb by16384\relax% - \c@pgf@countd=\pgf@ya\divide\c@pgf@countd by16384\relax% - \multiply\c@pgf@counta by\c@pgf@countd% - \multiply\c@pgf@countc by\c@pgf@countb% - \advance\c@pgf@counta by-\c@pgf@countc% - % - \pgf@sfalse% - \pgf@tfalse% - \ifnum\c@pgf@counta=0\relax% - \else% - \ifnum\pgfutil@tempcnta=0\relax% - \pgf@strue% - \else% - \ifnum\pgfutil@tempcnta>0\relax% - \ifnum\c@pgf@counta<\pgfutil@tempcnta% - \else% - \pgf@strue% - \fi% - \else% - \ifnum\c@pgf@counta>\pgfutil@tempcnta% - \else% - \pgf@strue% - \fi% - \fi% - \fi% - \ifnum\pgfutil@tempcntb=0\relax% - \pgf@ttrue% - \else% - \ifnum\pgfutil@tempcntb>0\relax% - \ifnum\c@pgf@counta<\pgfutil@tempcntb% - \else% - \pgf@ttrue% - \fi% - \else% - \ifnum\c@pgf@counta>\pgfutil@tempcntb% - \else% - \pgf@ttrue% - \fi% - \fi% - \fi% - \fi% - \let\pgf@intersect@next=\pgfutil@secondoftwo% - \ifpgf@s% - \ifpgf@t% - \let\pgf@intersect@next=\pgfutil@firstoftwo% - \fi% - \fi% - \pgf@intersect@next% -} + #4\relax% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + #3\relax% + \advance\pgf@xc by-\pgf@x% + \advance\pgf@yc by-\pgf@y% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + #2\relax% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + #1\relax% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + % + % xc = x4-x3; yc=y4-y3; + % xb = x3-x1; yb=y3-y1; + % xa = x2-x1; ya=y2-y1; + % + % + % Normalise a little. 16384 may not be a robust choice. + % + \c@pgf@counta=\pgf@xa\divide\c@pgf@counta by16384\relax% + \c@pgf@countb=\pgf@xb\divide\c@pgf@countb by16384\relax% + \c@pgf@countc=\pgf@ya\divide\c@pgf@countc by16384\relax% + \c@pgf@countd=\pgf@yb\divide\c@pgf@countd by16384\relax% + \multiply\c@pgf@counta by\c@pgf@countd% + \multiply\c@pgf@countc by\c@pgf@countb% + \advance\c@pgf@counta by-\c@pgf@countc% + \pgfutil@tempcnta=\c@pgf@counta% + % + \c@pgf@counta=\pgf@xc\divide\c@pgf@counta by16384\relax% + \c@pgf@countc=\pgf@yc\divide\c@pgf@countc by16384\relax% + \multiply\c@pgf@countd by\c@pgf@counta% + \multiply\c@pgf@countb by\c@pgf@countc% + \advance\c@pgf@countd by-\c@pgf@countb% + \pgfutil@tempcntb=\c@pgf@countd% + % + \c@pgf@countb=\pgf@xa\divide\c@pgf@countb by16384\relax% + \c@pgf@countd=\pgf@ya\divide\c@pgf@countd by16384\relax% + \multiply\c@pgf@counta by\c@pgf@countd% + \multiply\c@pgf@countc by\c@pgf@countb% + \advance\c@pgf@counta by-\c@pgf@countc% + % + \pgf@sfalse% + \pgf@tfalse% + \ifnum\c@pgf@counta=0\relax% + \else% + \ifnum\pgfutil@tempcnta=0\relax% + \pgf@strue% + \else% + \ifnum\pgfutil@tempcnta>0\relax% + \ifnum\c@pgf@counta<\pgfutil@tempcnta% + \else% + \pgf@strue% + \fi% + \else% + \ifnum\c@pgf@counta>\pgfutil@tempcnta% + \else% + \pgf@strue% + \fi% + \fi% + \fi% + \ifnum\pgfutil@tempcntb=0\relax% + \pgf@ttrue% + \else% + \ifnum\pgfutil@tempcntb>0\relax% + \ifnum\c@pgf@counta<\pgfutil@tempcntb% + \else% + \pgf@ttrue% + \fi% + \else% + \ifnum\c@pgf@counta>\pgfutil@tempcntb% + \else% + \pgf@ttrue% + \fi% + \fi% + \fi% + \fi% + \let\pgf@intersect@next=\pgfutil@secondoftwo% + \ifpgf@s% + \ifpgf@t% + \let\pgf@intersect@next=\pgfutil@firstoftwo% + \fi% + \fi% + \pgf@intersect@next% +}% \def\pgfintersectionoflineandcurve#1#2#3#4#5#6{% - \pgf@intersect@solutions=0\relax% - \pgf@intersectionoflineandcurve{#1}{#2}{#3}{#4}{#5}{#6}% -} + \pgf@intersect@solutions=0\relax% + \pgf@intersectionoflineandcurve{#1}{#2}{#3}{#4}{#5}{#6}% +}% \def\pgf@intersectionoflineandcurve#1#2#3#4#5#6{% - \pgf@intersectionofcurves% - {\pgf@process{#1}}% - {% - \pgf@process{% - \pgfpointadd{#1\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% - {#2\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% - }% - }% - {% - \pgf@process{% - \pgfpointadd{#1\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% - {#2\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% - }% - }% - {\pgf@process{#2}}% - {\pgf@process{#3}}% - {\pgf@process{#4}}% - {\pgf@process{#5}}% - {\pgf@process{#6}}% + \pgf@intersectionofcurves% + {\pgf@process{#1}}% + {% + \pgf@process{% + \pgfpointadd{#1\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% + {#2\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% + }% + }% + {% + \pgf@process{% + \pgfpointadd{#1\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% + {#2\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% + }% + }% + {\pgf@process{#2}}% + {\pgf@process{#3}}% + {\pgf@process{#4}}% + {\pgf@process{#5}}% + {\pgf@process{#6}}% }% \def\pgf@intersectionofcurveandline#1#2#3#4#5#6{% - \pgf@intersectionofcurves% - {\pgf@process{#1}}% - {\pgf@process{#2}}% - {\pgf@process{#3}}% - {\pgf@process{#4}}% - {\pgf@process{#5}}% - {% - \pgf@process{% - \pgfpointadd{#5\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% - {#6\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% - }% - }% - {% - \pgf@process{% - \pgfpointadd{#5\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% - {#6\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% - }% - }% - {\pgf@process{#6}}% + \pgf@intersectionofcurves% + {\pgf@process{#1}}% + {\pgf@process{#2}}% + {\pgf@process{#3}}% + {\pgf@process{#4}}% + {\pgf@process{#5}}% + {% + \pgf@process{% + \pgfpointadd{#5\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% + {#6\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% + }% + }% + {% + \pgf@process{% + \pgfpointadd{#5\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}% + {#6\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}% + }% + }% + {\pgf@process{#6}}% }% -\def\pgfintersectiontolerance{0.1pt} -\def\pgfintersectiontolerancefactor{0.1} +\def\pgfintersectiontolerance{0.1pt}% +\def\pgfintersectiontolerancefactor{0.1}% % Find the intersections of two bezier curves. -% +% % #1 - #4 = curve 1. % #5 - #8 = curve 2. % #9 = the solution number. % -% There is no guarantee of ordering of solutions. If there are +% There is no guarantee of ordering of solutions. If there are % no solutions, the origin is returned. % \def\pgfpointintersectionofcurves#1#2#3#4#5#6#7#8#9{% - \pgf@intersect@solutions=0\relax% - \pgf@intersectionofcurves% - {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% - {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}% - \pgfpointintersectionsolution{#9}% -} + \pgf@intersect@solutions=0\relax% + \pgf@intersectionofcurves% + {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% + {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}% + \pgfpointintersectionsolution{#9}% +}% % Return any intersection points of two curves C1 and C2. % No order can be guaranteed for the solutions. % -% #1, #2, #3, #4 - the points on C1 +% #1, #2, #3, #4 - the points on C1 % #5, #6, #7, #8 - the points on C2 % % Returns: % % \pgf@intersect@solutions - the number of solutions. -% \pgfpointintersectionsolution{<S>} - the point for soultion S. +% \pgfpointintersectionsolution{<S>} - the point for solution S. % % (Sort of) use: % -% intersection(C1,C2) -% S = {}; -% intersection'(C1,C2); -% return S; -% -% intersection'(C1,C2) -% B1 = boundingbox(C1); -% B2 = boundingbox(C2); -% if intersect(B1,B2) -% if (B1.width < q) and (B1.height < q) and +% intersection(C1,C2) +% S = {}; +% intersection'(C1,C2); +% return S; +% +% intersection'(C1,C2) +% B1 = boundingbox(C1); +% B2 = boundingbox(C2); +% if intersect(B1,B2) +% if (B1.width < q) and (B1.height < q) and % (B2.width < q) and (B2.height < q) -% S = S + {average_of_all_points(B1,B2)}; \\ is there a better choice? -% else -% Q = subdivideLeft(C1); -% R = subdivideRight(C1); -% intersection'(C2,Q); -% intersection'(C2,R); +% S = S + {average_of_all_points(B1,B2)}; \\ is there a better choice? +% else +% Q = subdivideLeft(C1); +% R = subdivideRight(C1); +% intersection'(C2,Q); +% intersection'(C2,R); % % where q is a small value (tolerance). % \def\pgfintersectionofcurves#1#2#3#4#5#6#7#8{% - \pgf@intersect@solutions=0\relax% - \pgf@intersectionofcurves% - {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% - {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}% + \pgf@intersect@solutions=0\relax% + \pgf@intersectionofcurves% + {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}% + {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}% }% \def\pgf@intersectionofcurves#1#2#3#4#5#6#7#8{% - \begingroup% - \dimendef\pgf@time@a=2\relax% - \dimendef\pgf@time@aa=4\relax% - \dimendef\pgf@time@b=6\relax% - \dimendef\pgf@time@bb=8\relax% - \pgf@time@a=0pt\relax% - \pgf@time@aa=1pt\relax% - \pgf@time@b=0pt\relax% - \pgf@time@bb=1pt\relax% - \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% - \let\pgf@curve@subdivde@after=\pgf@@intersectionofcurves% - \pgf@@intersectionofcurves{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% - \endgroup% -} + \begingroup% + \dimendef\pgf@time@a=2\relax% + \dimendef\pgf@time@aa=4\relax% + \dimendef\pgf@time@b=6\relax% + \dimendef\pgf@time@bb=8\relax% + \pgf@time@a=0pt\relax% + \pgf@time@aa=1pt\relax% + \pgf@time@b=0pt\relax% + \pgf@time@bb=1pt\relax% + \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% + \let\pgf@curve@subdivde@after=\pgf@@intersectionofcurves% + \pgf@@intersectionofcurves{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% + \endgroup% +}% \def\pgf@@intersectionofcurves#1#2#3#4#5#6#7#8{% - \pgf@intersect@boundingbox@reset% - \pgf@intersect@boundingbox@update{#1}% - \pgf@intersect@boundingbox@update{#2}% - \pgf@intersect@boundingbox@update{#3}% - \pgf@intersect@boundingbox@update{#4}% - % (\pgf@xa, \pgf@ya) is lower-left - % (\pgf@xb, \pgf@yb) is upper-right - \edef\pgf@intersect@boundingbox@b{% - \noexpand\pgf@x=\the\pgf@xa% - \noexpand\pgf@y=\the\pgf@ya% - \noexpand\pgf@xa=\the\pgf@xb% - \noexpand\pgf@ya=\the\pgf@yb% - }% - \pgf@intersect@boundingbox@reset% - \pgf@intersect@boundingbox@update{#5}% - \pgf@intersect@boundingbox@update{#6}% - \pgf@intersect@boundingbox@update{#7}% - \pgf@intersect@boundingbox@update{#8}% - \edef\pgf@intersect@boundingbox@a{% - \noexpand\pgf@xb=\the\pgf@xa% - \noexpand\pgf@yb=\the\pgf@ya% - \noexpand\pgf@xc=\the\pgf@xb% - \noexpand\pgf@yc=\the\pgf@yb% - }% - \pgf@intersect@boundingbox@a% - \pgf@intersect@boundingbox@b% - % check if the two bounding boxes overlap: - \ifdim\pgf@xa<\pgf@xb% - \else% - \ifdim\pgf@x>\pgf@xc% - \else% - \ifdim\pgf@ya<\pgf@yb% - \else% - \ifdim\pgf@y>\pgf@yc% - \else% - % compute DIFFERENCE vectors: - \advance\pgf@xc by-\pgf@xb% - \advance\pgf@yc by-\pgf@yb% - \advance\pgf@xa by-\pgf@x% - \advance\pgf@ya by-\pgf@y% - \let\pgf@intersect@subdivde=\relax% - % check if both difference vectors are point wise - % less than tolerance (i.e. |v|_infty < eps ). - % That means that both bounding boxes are "small enough" - \ifdim\pgf@xc<\pgfintersectiontolerance\relax% - \ifdim\pgf@xa<\pgfintersectiontolerance\relax% - \ifdim\pgf@yc<\pgfintersectiontolerance\relax% - \ifdim\pgf@ya<\pgfintersectiontolerance\relax% - \pgfextract@process\pgf@intersect@solution@candidate{% - % set (x,y) = mean(the 4 points of the two bounding boxes): - \pgf@intersect@boundingbox@a% - \pgf@intersect@boundingbox@b% - \pgf@x=0.25\pgf@x% - \advance\pgf@x by0.25\pgf@xa% - \advance\pgf@x by0.25\pgf@xb% - \advance\pgf@x by0.25\pgf@xc% - \pgf@y=0.25\pgf@y% - \advance\pgf@y by0.25\pgf@ya% - \advance\pgf@y by0.25\pgf@yb% - \advance\pgf@y by0.25\pgf@yc% - }% - % We must avoid duplicate solutions. - \let\pgf@intersect@subdivde=\pgf@stop% - \pgf@ifsolution@duplicate\pgf@intersect@solution@candidate{}% - {% - \global\advance\pgf@intersect@solutions by1\relax% - \begingroup - \advance\pgf@time@a by\pgf@time@aa% - \divide\pgf@time@a by2\relax% - \advance\pgf@time@a by\pgf@intersect@time@offset pt\relax% - \edef\pgf@intersect@time@a{\pgfmath@tonumber{\pgf@time@a}}% - % - \advance\pgf@time@b by\pgf@time@bb% - \divide\pgf@time@b by2\relax% - \advance\pgf@time@b by\pgf@intersect@time@offset@b pt\relax% - \edef\pgf@intersect@time@b{\pgfmath@tonumber{\pgf@time@b}}% - % - \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% - \expandafter\global\expandafter\let% - \csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname=% - \pgf@intersect@solution@candidate% - \ifpgf@intersect@sort% - \expandafter\xdef% - \csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname% - {\pgf@intersect@time@a}% - \fi% - \endgroup - }% - \fi% - \fi% - \fi% - \fi% - \ifx\pgf@intersect@subdivde\pgf@stop% - \else% - \pgf@intersect@subdivide@curve{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% - \fi% - \fi% - \fi% - \fi% - \fi% -} + \pgf@intersect@boundingbox@reset% + \pgf@intersect@boundingbox@update{#1}% + \pgf@intersect@boundingbox@update{#2}% + \pgf@intersect@boundingbox@update{#3}% + \pgf@intersect@boundingbox@update{#4}% + % (\pgf@xa, \pgf@ya) is lower-left + % (\pgf@xb, \pgf@yb) is upper-right + \edef\pgf@intersect@boundingbox@b{% + \noexpand\pgf@x=\the\pgf@xa% + \noexpand\pgf@y=\the\pgf@ya% + \noexpand\pgf@xa=\the\pgf@xb% + \noexpand\pgf@ya=\the\pgf@yb% + }% + \pgf@intersect@boundingbox@reset% + \pgf@intersect@boundingbox@update{#5}% + \pgf@intersect@boundingbox@update{#6}% + \pgf@intersect@boundingbox@update{#7}% + \pgf@intersect@boundingbox@update{#8}% + \edef\pgf@intersect@boundingbox@a{% + \noexpand\pgf@xb=\the\pgf@xa% + \noexpand\pgf@yb=\the\pgf@ya% + \noexpand\pgf@xc=\the\pgf@xb% + \noexpand\pgf@yc=\the\pgf@yb% + }% + \pgf@intersect@boundingbox@a% + \pgf@intersect@boundingbox@b% + % check if the two bounding boxes overlap: + \ifdim\pgf@xa<\pgf@xb% + \else% + \ifdim\pgf@x>\pgf@xc% + \else% + \ifdim\pgf@ya<\pgf@yb% + \else% + \ifdim\pgf@y>\pgf@yc% + \else% + % compute DIFFERENCE vectors: + \advance\pgf@xc by-\pgf@xb% + \advance\pgf@yc by-\pgf@yb% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \let\pgf@intersect@subdivde=\relax% + % check if both difference vectors are point wise + % less than tolerance (i.e. |v|_infty < eps ). + % That means that both bounding boxes are "small enough" + \ifdim\pgf@xc<\pgfintersectiontolerance\relax% + \ifdim\pgf@xa<\pgfintersectiontolerance\relax% + \ifdim\pgf@yc<\pgfintersectiontolerance\relax% + \ifdim\pgf@ya<\pgfintersectiontolerance\relax% + \pgfextract@process\pgf@intersect@solution@candidate{% + % set (x,y) = mean(the 4 points of the two bounding boxes): + \pgf@intersect@boundingbox@a% + \pgf@intersect@boundingbox@b% + \pgf@x=0.25\pgf@x% + \advance\pgf@x by0.25\pgf@xa% + \advance\pgf@x by0.25\pgf@xb% + \advance\pgf@x by0.25\pgf@xc% + \pgf@y=0.25\pgf@y% + \advance\pgf@y by0.25\pgf@ya% + \advance\pgf@y by0.25\pgf@yb% + \advance\pgf@y by0.25\pgf@yc% + }% + % We must avoid duplicate solutions. + \let\pgf@intersect@subdivde=\pgf@stop% + \pgf@ifsolution@duplicate\pgf@intersect@solution@candidate{}% + {% + \global\advance\pgf@intersect@solutions by1\relax% + \begingroup + \advance\pgf@time@a by\pgf@time@aa% + \divide\pgf@time@a by2\relax% + \advance\pgf@time@a by\pgf@intersect@time@offset pt\relax% + \edef\pgf@intersect@time@a{\pgfmath@tonumber{\pgf@time@a}}% + % + \advance\pgf@time@b by\pgf@time@bb% + \divide\pgf@time@b by2\relax% + \advance\pgf@time@b by\pgf@intersect@time@offset@b pt\relax% + \edef\pgf@intersect@time@b{\pgfmath@tonumber{\pgf@time@b}}% + % + \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% + \expandafter\global\expandafter\let% + \csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname=% + \pgf@intersect@solution@candidate% + \ifpgf@intersect@sort% + \expandafter\xdef% + \csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname% + {\pgf@intersect@time@a}% + \fi% + \endgroup + }% + \fi% + \fi% + \fi% + \fi% + \ifx\pgf@intersect@subdivde\pgf@stop% + \else% + \pgf@intersect@subdivide@curve{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% + \fi% + \fi% + \fi% + \fi% + \fi% +}% \def\pgf@intersect@subdivide@curve@b#1#2#3#4#5#6#7#8{% - \begingroup% - \advance\pgf@time@bb by\pgf@time@b\relax% - \divide\pgf@time@bb by2\relax% - \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a% - \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% - \endgroup% - \begingroup% - \advance\pgf@time@b by\pgf@time@bb\relax% - \divide\pgf@time@b by2\relax% - \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a% - \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% - \endgroup% -} + \begingroup% + \advance\pgf@time@bb by\pgf@time@b\relax% + \divide\pgf@time@bb by2\relax% + \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a% + \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% + \endgroup% + \begingroup% + \advance\pgf@time@b by\pgf@time@bb\relax% + \divide\pgf@time@b by2\relax% + \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a% + \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% + \endgroup% +}% \def\pgf@intersect@subdivide@curve@a#1#2#3#4#5#6#7#8{% - \begingroup% - \advance\pgf@time@aa by\pgf@time@a\relax% - \divide\pgf@time@aa by2\relax% - \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% - \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% - \endgroup% - \begingroup% - \advance\pgf@time@a by\pgf@time@aa\relax% - \divide\pgf@time@a by2\relax% - \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% - \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% - \endgroup% -} + \begingroup% + \advance\pgf@time@aa by\pgf@time@a\relax% + \divide\pgf@time@aa by2\relax% + \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% + \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% + \endgroup% + \begingroup% + \advance\pgf@time@a by\pgf@time@aa\relax% + \divide\pgf@time@a by2\relax% + \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b% + \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}% + \endgroup% +}% \def\pgf@intersect@boundingbox@reset{% - \pgf@xa=16000pt\relax% - \pgf@ya=16000pt\relax% - \pgf@xb=-16000pt\relax% - \pgf@yb=-16000pt\relax% -} + \pgf@xa=16000pt\relax% + \pgf@ya=16000pt\relax% + \pgf@xb=-16000pt\relax% + \pgf@yb=-16000pt\relax% +}% \def\pgf@intersect@boundingbox@update#1{% - #1\relax% - \ifdim\pgf@x<\pgf@xa\pgf@xa=\pgf@x\fi% - \ifdim\pgf@y<\pgf@ya\pgf@ya=\pgf@y\fi% - \ifdim\pgf@x>\pgf@xb\pgf@xb=\pgf@x\fi% - \ifdim\pgf@y>\pgf@yb\pgf@yb=\pgf@y\fi% -} + #1\relax% + \ifdim\pgf@x<\pgf@xa\pgf@xa=\pgf@x\fi% + \ifdim\pgf@y<\pgf@ya\pgf@ya=\pgf@y\fi% + \ifdim\pgf@x>\pgf@xb\pgf@xb=\pgf@x\fi% + \ifdim\pgf@y>\pgf@yb\pgf@yb=\pgf@y\fi% +}% % The following subroutines are part of a conversion from pgfbasic % math to FPU. This transition is necessary due to the restricted @@ -810,114 +810,114 @@ % The following routines constitute the "adapter": \def\pgf@float@adapter@setxy{% - \pgfmathfloatparsenumber{\pgf@sys@tonumber\pgf@x}\let\pgf@fpu@x=\pgfmathresult - \pgfmathfloatparsenumber{\pgf@sys@tonumber\pgf@y}\let\pgf@fpu@y=\pgfmathresult + \pgfmathfloatparsenumber{\pgf@sys@tonumber\pgf@x}\let\pgf@fpu@x=\pgfmathresult + \pgfmathfloatparsenumber{\pgf@sys@tonumber\pgf@y}\let\pgf@fpu@y=\pgfmathresult }% \def\pgf@float@adapter@mult#1=#2*#3{% - \pgfmathfloatmultiplyfixed@{#3}{#2}% - \let#1=\pgfmathresult + \pgfmathfloatmultiplyfixed@{#3}{#2}% + \let#1=\pgfmathresult }% \def\pgf@float@adapter@advance#1by#2*#3{% - \pgfmathfloatmultiplyfixed@{#3}{#2}% - \let\pgfutil@temp=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfutil@temp}% - \let#1=\pgfmathresult + \pgfmathfloatmultiplyfixed@{#3}{#2}% + \let\pgfutil@temp=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfutil@temp}% + \let#1=\pgfmathresult }% \def\pgf@float@adapter@tostring#1{% - \pgfmathfloattofixed{#1}\edef#1{\pgfmathresult pt }% + \pgfmathfloattofixed{#1}\edef#1{\pgfmathresult pt }% }% \def\pgf@curve@subdivide@left#1#2#3#4{% - % - % The left curve (from t=0 to t=.5) - % - \begingroup - #1\relax% - \pgfutil@tempdima=\pgf@x% - \pgfutil@tempdimb=\pgf@y% - \pgf@float@adapter@setxy - \pgf@float@adapter@mult\pgf@fpu@xa=.5*\pgf@fpu@x \pgf@float@adapter@mult\pgf@fpu@ya=.5*\pgf@fpu@y% - \pgf@float@adapter@mult\pgf@fpu@xb=.25*\pgf@fpu@x \pgf@float@adapter@mult\pgf@fpu@yb=.25*\pgf@fpu@y% - \pgf@float@adapter@mult\pgf@fpu@xc=.125*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@yc=.125*\pgf@fpu@y% - #2\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@fpu@xa by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.5*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xb by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.5*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xc by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.375*\pgf@fpu@y% - #3\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@fpu@xb by.25*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.25*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xc by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.375*\pgf@fpu@y% - #4\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@fpu@xc by.125*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.125*\pgf@fpu@y% - % - \pgf@float@adapter@tostring\pgf@fpu@xa - \pgf@float@adapter@tostring\pgf@fpu@ya - \pgf@float@adapter@tostring\pgf@fpu@xb - \pgf@float@adapter@tostring\pgf@fpu@yb - \pgf@float@adapter@tostring\pgf@fpu@xc - \pgf@float@adapter@tostring\pgf@fpu@yc - \edef\pgf@marshal{% - \noexpand\pgf@curve@subdivde@after% - {\noexpand\pgf@x=\the\pgfutil@tempdima\noexpand\pgf@y=\the\pgfutil@tempdimb}% - {\noexpand\pgf@x=\pgf@fpu@xa\noexpand\pgf@y=\pgf@fpu@ya}% - {\noexpand\pgf@x=\pgf@fpu@xb\noexpand\pgf@y=\pgf@fpu@yb} - {\noexpand\pgf@x=\pgf@fpu@xc\noexpand\pgf@y=\pgf@fpu@yc}% - }% - \expandafter - \endgroup - \pgf@marshal% -} + % + % The left curve (from t=0 to t=.5) + % + \begingroup + #1\relax% + \pgfutil@tempdima=\pgf@x% + \pgfutil@tempdimb=\pgf@y% + \pgf@float@adapter@setxy + \pgf@float@adapter@mult\pgf@fpu@xa=.5*\pgf@fpu@x \pgf@float@adapter@mult\pgf@fpu@ya=.5*\pgf@fpu@y% + \pgf@float@adapter@mult\pgf@fpu@xb=.25*\pgf@fpu@x \pgf@float@adapter@mult\pgf@fpu@yb=.25*\pgf@fpu@y% + \pgf@float@adapter@mult\pgf@fpu@xc=.125*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@yc=.125*\pgf@fpu@y% + #2\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@fpu@xa by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.5*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xb by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.5*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xc by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.375*\pgf@fpu@y% + #3\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@fpu@xb by.25*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.25*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xc by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.375*\pgf@fpu@y% + #4\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@fpu@xc by.125*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yc by.125*\pgf@fpu@y% + % + \pgf@float@adapter@tostring\pgf@fpu@xa + \pgf@float@adapter@tostring\pgf@fpu@ya + \pgf@float@adapter@tostring\pgf@fpu@xb + \pgf@float@adapter@tostring\pgf@fpu@yb + \pgf@float@adapter@tostring\pgf@fpu@xc + \pgf@float@adapter@tostring\pgf@fpu@yc + \edef\pgf@marshal{% + \noexpand\pgf@curve@subdivde@after% + {\noexpand\pgf@x=\the\pgfutil@tempdima\noexpand\pgf@y=\the\pgfutil@tempdimb}% + {\noexpand\pgf@x=\pgf@fpu@xa\noexpand\pgf@y=\pgf@fpu@ya}% + {\noexpand\pgf@x=\pgf@fpu@xb\noexpand\pgf@y=\pgf@fpu@yb} + {\noexpand\pgf@x=\pgf@fpu@xc\noexpand\pgf@y=\pgf@fpu@yc}% + }% + \expandafter + \endgroup + \pgf@marshal% +}% \def\pgf@curve@subdivide@right#1#2#3#4{% - % - % The right curve (from t=0.5 to t=1) - % - \begingroup - #1\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@mult\pgf@float@tmpa=.125*\pgf@fpu@x\pgf@float@adapter@mult\pgf@float@tmpb=.125*\pgf@fpu@y% - #2\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@float@tmpa by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.375*\pgf@fpu@y% - \pgf@float@adapter@mult\pgf@fpu@xa=.25*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@ya=.25*\pgf@fpu@y% - #3\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@float@tmpa by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.375*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xa by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.5*\pgf@fpu@y% - \pgf@float@adapter@mult\pgf@fpu@xb=.5*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@yb=.5*\pgf@fpu@y% - #4\relax% - \pgf@float@adapter@setxy - \pgf@float@adapter@advance\pgf@float@tmpa by.125*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.125*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xa by.25*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.25*\pgf@fpu@y% - \pgf@float@adapter@advance\pgf@fpu@xb by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.5*\pgf@fpu@y% - \let\pgf@fpu@xc=\pgf@fpu@x\let\pgf@fpu@yc=\pgf@fpu@y% - % - \pgf@float@adapter@tostring\pgf@float@tmpa - \pgf@float@adapter@tostring\pgf@float@tmpb - \pgf@float@adapter@tostring\pgf@fpu@xa - \pgf@float@adapter@tostring\pgf@fpu@ya - \pgf@float@adapter@tostring\pgf@fpu@xb - \pgf@float@adapter@tostring\pgf@fpu@yb - \pgf@float@adapter@tostring\pgf@fpu@xc - \pgf@float@adapter@tostring\pgf@fpu@yc - \edef\pgf@marshal{% - \noexpand\pgf@curve@subdivde@after% - {\noexpand\pgf@x=\pgf@float@tmpa\noexpand\pgf@y=\pgf@float@tmpb}% - {\noexpand\pgf@x=\pgf@fpu@xa\noexpand\pgf@y=\pgf@fpu@ya} - {\noexpand\pgf@x=\pgf@fpu@xb\noexpand\pgf@y=\pgf@fpu@yb} - {\noexpand\pgf@x=\pgf@fpu@xc\noexpand\pgf@y=\pgf@fpu@yc}% - }% - \expandafter - \endgroup - \pgf@marshal% -} + % + % The right curve (from t=0.5 to t=1) + % + \begingroup + #1\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@mult\pgf@float@tmpa=.125*\pgf@fpu@x\pgf@float@adapter@mult\pgf@float@tmpb=.125*\pgf@fpu@y% + #2\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@float@tmpa by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.375*\pgf@fpu@y% + \pgf@float@adapter@mult\pgf@fpu@xa=.25*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@ya=.25*\pgf@fpu@y% + #3\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@float@tmpa by.375*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.375*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xa by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.5*\pgf@fpu@y% + \pgf@float@adapter@mult\pgf@fpu@xb=.5*\pgf@fpu@x\pgf@float@adapter@mult\pgf@fpu@yb=.5*\pgf@fpu@y% + #4\relax% + \pgf@float@adapter@setxy + \pgf@float@adapter@advance\pgf@float@tmpa by.125*\pgf@fpu@x\pgf@float@adapter@advance\pgf@float@tmpb by.125*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xa by.25*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@ya by.25*\pgf@fpu@y% + \pgf@float@adapter@advance\pgf@fpu@xb by.5*\pgf@fpu@x\pgf@float@adapter@advance\pgf@fpu@yb by.5*\pgf@fpu@y% + \let\pgf@fpu@xc=\pgf@fpu@x\let\pgf@fpu@yc=\pgf@fpu@y% + % + \pgf@float@adapter@tostring\pgf@float@tmpa + \pgf@float@adapter@tostring\pgf@float@tmpb + \pgf@float@adapter@tostring\pgf@fpu@xa + \pgf@float@adapter@tostring\pgf@fpu@ya + \pgf@float@adapter@tostring\pgf@fpu@xb + \pgf@float@adapter@tostring\pgf@fpu@yb + \pgf@float@adapter@tostring\pgf@fpu@xc + \pgf@float@adapter@tostring\pgf@fpu@yc + \edef\pgf@marshal{% + \noexpand\pgf@curve@subdivde@after% + {\noexpand\pgf@x=\pgf@float@tmpa\noexpand\pgf@y=\pgf@float@tmpb}% + {\noexpand\pgf@x=\pgf@fpu@xa\noexpand\pgf@y=\pgf@fpu@ya} + {\noexpand\pgf@x=\pgf@fpu@xb\noexpand\pgf@y=\pgf@fpu@yb} + {\noexpand\pgf@x=\pgf@fpu@xc\noexpand\pgf@y=\pgf@fpu@yc}% + }% + \expandafter + \endgroup + \pgf@marshal% +}% % A solution S1 is considered a duplicate of S2, if -% +% % |x1 - x2|f < q and |y1 - y2|f < q % % where q is a small value (tolerance). @@ -925,32 +925,32 @@ % #1 - the solution. % \def\pgf@ifsolution@duplicate#1{% - #1% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \let\pgf@intersect@next=\pgfutil@secondoftwo% - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@intersect@solutions\relax% - \else% - \pgf@ifsolution@duplicate@{\pgfmathcounter}% - \repeatpgfmathloop% - \pgf@intersect@next% -} + #1% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \let\pgf@intersect@next=\pgfutil@secondoftwo% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@intersect@solutions\relax% + \else% + \pgf@ifsolution@duplicate@{\pgfmathcounter}% + \repeatpgfmathloop% + \pgf@intersect@next% +}% \def\pgf@ifsolution@duplicate@#1{% - \pgf@process{\csname pgfpoint@g@intersect@solution@#1\endcsname}% - \advance\pgf@x by-\pgf@xa% - \advance\pgf@y by-\pgf@ya% - \ifdim\pgf@x<0pt\relax\pgf@x=-\pgf@x\fi% - \ifdim\pgf@y<0pt\relax\pgf@y=-\pgf@y\fi% - % - \pgf@x=\pgfintersectiontolerancefactor\pgf@x% - \pgf@y=\pgfintersectiontolerancefactor\pgf@y% - \ifdim\pgf@x<\pgfintersectiontolerance\relax% - \ifdim\pgf@y<\pgfintersectiontolerance\relax% - \let\pgf@intersect@next=\pgfutil@firstoftwo% - \fi% - \fi% + \pgf@process{\csname pgfpoint@g@intersect@solution@#1\endcsname}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@x<0pt\relax\pgf@x=-\pgf@x\fi% + \ifdim\pgf@y<0pt\relax\pgf@y=-\pgf@y\fi% + % + \pgf@x=\pgfintersectiontolerancefactor\pgf@x% + \pgf@y=\pgfintersectiontolerancefactor\pgf@y% + \ifdim\pgf@x<\pgfintersectiontolerance\relax% + \ifdim\pgf@y<\pgfintersectiontolerance\relax% + \let\pgf@intersect@next=\pgfutil@firstoftwo% + \fi% + \fi% }% \newif\ifpgf@intersect@solutions@sortfinish @@ -958,35 +958,35 @@ % Sort solutions according to their time index. % \def\pgfintersectionsolutionsortbytime{% - \pgf@intersect@solutions@sortfinishtrue% - \pgfmathloop% - \ifnum\pgfmathcounter<\pgfintersectionsolutions\relax% - \pgfutil@tempcnta=\pgfmathcounter% - \advance\pgfutil@tempcnta by1\relax% - \ifdim\csname pgf@intersect@solution@\pgfmathcounter @time@a\endcsname pt>% - \csname pgf@intersect@solution@\the\pgfutil@tempcnta @time@a\endcsname pt\relax% - \pgf@intersect@solutions@sortfinishfalse% - % - \pgfintersectionsolutionsortbytime@swap{pgfpoint@intersect@solution@\pgfmathcounter}% - {pgfpoint@intersect@solution@\the\pgfutil@tempcnta}% - % - \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@\pgfmathcounter @time@a}% - {pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}% - % - \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@props@\pgfmathcounter}% - {pgf@intersect@solution@props@\the\pgfutil@tempcnta}% - \fi% - \repeatpgfmathloop% - \ifpgf@intersect@solutions@sortfinish% - \else% - \expandafter\pgfintersectionsolutionsortbytime% - \fi% -} + \pgf@intersect@solutions@sortfinishtrue% + \pgfmathloop% + \ifnum\pgfmathcounter<\pgfintersectionsolutions\relax% + \pgfutil@tempcnta=\pgfmathcounter% + \advance\pgfutil@tempcnta by1\relax% + \ifdim\csname pgf@intersect@solution@\pgfmathcounter @time@a\endcsname pt>% + \csname pgf@intersect@solution@\the\pgfutil@tempcnta @time@a\endcsname pt\relax% + \pgf@intersect@solutions@sortfinishfalse% + % + \pgfintersectionsolutionsortbytime@swap{pgfpoint@intersect@solution@\pgfmathcounter}% + {pgfpoint@intersect@solution@\the\pgfutil@tempcnta}% + % + \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@\pgfmathcounter @time@a}% + {pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}% + % + \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@props@\pgfmathcounter}% + {pgf@intersect@solution@props@\the\pgfutil@tempcnta}% + \fi% + \repeatpgfmathloop% + \ifpgf@intersect@solutions@sortfinish% + \else% + \expandafter\pgfintersectionsolutionsortbytime% + \fi% +}% \def\pgfintersectionsolutionsortbytime@swap#1#2{% - \pgfutil@namelet{pgf@intersect@temp}{#1}% - \pgfutil@namelet{#1}{#2}% - \pgfutil@namelet{#2}{pgf@intersect@temp}% + \pgfutil@namelet{pgf@intersect@temp}{#1}% + \pgfutil@namelet{#1}{#2}% + \pgfutil@namelet{#2}{pgf@intersect@temp}% }% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex index ab6a067835e..bec0c855cda 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex @@ -14,210 +14,216 @@ \newif\ifpgf@lsystem@randomize@angle \pgfkeys{/pgf/lindenmayer system/.cd,% - step/.code={\pgfmathsetlength\pgflsystemstep{#1}},% - randomize step percent/.code={% - \pgfmathparse{#1}% - \let\pgflsystemrandomizesteppercent=\pgfmathresult% - \ifdim\pgfmathresult pt=0pt\relax% - \pgf@lsystem@randomize@stepfalse% - \else% - \pgf@lsystem@randomize@steptrue% - \fi% - },% - left angle/.code={\pgfmathparse{#1}\let\pgflsystemleftangle=\pgfmathresult},% - right angle/.code={\pgfmathparse{#1}\let\pgflsystemrightangle=\pgfmathresult},% - angle/.style={/pgf/lindenmayer system/left angle=#1, /pgf/lindenmayer system/right angle=#1},% - randomize angle percent/.code={% - \pgfmathparse{#1}% - \let\pgflsystemrandomizeanglepercent=\pgfmathresult% - \ifdim\pgfmathresult pt=0pt\relax% - \pgf@lsystem@randomize@anglefalse% - \else% - \pgf@lsystem@randomize@angletrue% - \fi% - }% -} + step/.code={\pgfmathsetlength\pgflsystemstep{#1}},% + randomize step percent/.code={% + \pgfmathparse{#1}% + \let\pgflsystemrandomizesteppercent=\pgfmathresult% + \ifdim\pgfmathresult pt=0pt\relax% + \pgf@lsystem@randomize@stepfalse% + \else% + \pgf@lsystem@randomize@steptrue% + \fi% + },% + left angle/.code={\pgfmathparse{#1}\let\pgflsystemleftangle=\pgfmathresult},% + right angle/.code={\pgfmathparse{#1}\let\pgflsystemrightangle=\pgfmathresult},% + angle/.style={/pgf/lindenmayer system/left angle=#1, /pgf/lindenmayer system/right angle=#1},% + randomize angle percent/.code={% + \pgfmathparse{#1}% + \let\pgflsystemrandomizeanglepercent=\pgfmathresult% + \ifdim\pgfmathresult pt=0pt\relax% + \pgf@lsystem@randomize@anglefalse% + \else% + \pgf@lsystem@randomize@angletrue% + \fi% + }% +}% \pgfkeys{/pgf/lindenmayer system/.cd, - step=5pt,% - randomize step percent=0,% - angle=90,% - randomize angle percent=0% -} + step=5pt,% + randomize step percent=0,% + angle=90,% + randomize angle percent=0% +}% \long\def\pgfdeclarelindenmayersystem#1#2{% - \pgfutil@ifundefined{pgf@lsystem@#1}% - {% - \begingroup% - \edef\pgf@lsystem@name{#1}% - \expandafter\global\expandafter\let\csname pgf@lsystem@#1\endcsname=\pgf@lsystem@name% - \let\symbol=\pgf@lsystem@symbol% - \let\rule=\pgf@lsystem@rule% - #2% - \endgroup% - }% - {\pgferror{Lindenmayer system `#1' is already defined}}% -} + \pgfutil@ifundefined{pgf@lsystem@#1}% + {% + \begingroup% + \edef\pgf@lsystem@name{#1}% + \expandafter\global\expandafter\let\csname pgf@lsystem@#1\endcsname=\pgf@lsystem@name% + \let\symbol=\pgf@lsystem@symbol% + \let\rule=\pgf@lsystem@rule% + #2% + \endgroup% + }% + {\pgferror{Lindenmayer system `#1' is already defined}}% +}% \def\pgf@lsystem@symbol#1#2{% - \expandafter\gdef\csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname{#2}% -} + \expandafter\gdef\csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname{#2}% +}% -\def\pgf@lsystem@rule#1{\expandafter\pgf@lsystem@rule@#1\pgf@stop} -\def\pgf@lsystem@rule@#1{\def\pgf@lsystem@rule@head{#1}\pgf@lsystem@rule@@} +\def\pgf@lsystem@rule#1{\expandafter\pgf@lsystem@rule@#1\pgf@stop}% +\def\pgf@lsystem@rule@#1{\def\pgf@lsystem@rule@head{#1}\pgf@lsystem@rule@@}% \def\pgf@lsystem@rule@@#1->{% Now some `fooling around' to deal with unwanted spaces. - \let\pgf@lsystem@rule@body=\pgfutil@empty% - \pgfutil@ifnextchar x{\pgf@lsystem@rule@@@}{\pgf@lsystem@rule@@@}} + \let\pgf@lsystem@rule@body=\pgfutil@empty% + \pgfutil@ifnextchar x{\pgf@lsystem@rule@@@}{\pgf@lsystem@rule@@@}}% \def\pgf@lsystem@rule@@@#1{% - \ifx#1\pgf@stop% - \expandafter\global\expandafter\let% - \csname pgf@lsystem@\pgf@lsystem@name @rule@\pgf@lsystem@rule@head\endcsname=\pgf@lsystem@rule@body% - \else% - \edef\pgf@lsystem@rule@body{\pgf@lsystem@rule@body#1}% - \expandafter\pgf@lsystem@rule@@@% - \fi% -} + \ifx#1\pgf@stop% + \expandafter\global\expandafter\let% + \csname pgf@lsystem@\pgf@lsystem@name @rule@\pgf@lsystem@rule@head\endcsname=\pgf@lsystem@rule@body% + \else% + \edef\pgf@lsystem@rule@body{\pgf@lsystem@rule@body#1}% + \expandafter\pgf@lsystem@rule@@@% + \fi% +}% \def\pgflindenmayersystem#1#2#3{% - \begingroup% - \edef\pgf@lsystem@name{#1}% - \edef\pgf@lsystem@axiom{#2}% - \pgfmathtruncatemacro\pgf@lsystem@order{#3}% - % - \let\pgf@lsystem@current@symbol=\relax% - % - \c@pgf@lsystem@iteration=0\relax% - % - \ifnum\pgf@lsystem@order=0\relax% - \expandafter\pgf@lsystem@draw\pgf@lsystem@axiom\pgf@stop - \let\pgf@lsystem@next=\pgf@lsystem@end% - \else% - \let\pgf@lsystem@next=\pgf@lsystem@run% - \fi% - \expandafter\pgf@lsystem@next\pgf@lsystem@axiom\pgf@lsystem@stop% -} + \begingroup% + \edef\pgf@lsystem@name{#1}% + \edef\pgf@lsystem@axiom{#2}% + \pgfmathtruncatemacro\pgf@lsystem@order{#3}% + % + \let\pgf@lsystem@current@symbol=\relax% + % + \c@pgf@lsystem@iteration=0\relax% + % + \ifnum\pgf@lsystem@order=0\relax% + \expandafter\pgf@lsystem@draw\pgf@lsystem@axiom\pgf@stop + \let\pgf@lsystem@next=\pgf@lsystem@end% + \else% + \let\pgf@lsystem@next=\pgf@lsystem@run% + \fi% + \expandafter\pgf@lsystem@next\pgf@lsystem@axiom\pgf@lsystem@stop% +}% \def\pgf@lsystem@run#1{% - \ifx#1\pgf@lsystem@stop% - \def\pgf@lsystem@token{\pgf@lsystem@stop}% - \let\pgf@lsystem@next=\pgf@lsystem@end% - \else% - \ifx#1\pgf@stop% - \advance\c@pgf@lsystem@iteration by-1\relax% - \let\pgf@system@token=\pgfutil@empty% - \let\pgf@lsystem@next=\pgf@lsystem@run% - \else% - % Does #1 appear on the RHS of a rule...? - \expandafter\let\expandafter\pgf@lsystem@token\expandafter=% - \csname pgf@lsystem@\pgf@lsystem@name @rule@#1\endcsname% - \ifx\pgf@lsystem@token\relax% - % ...nope. So draw it straight away. - \pgf@lsystem@draw#1\pgf@stop% - \let\pgf@lsystem@token=\pgfutil@empty% - \else% - % ...yep. So, if the order has been reached draw the LHS - % immediately. Otherwise add the LHS to the token stream - % and continue. - \advance\c@pgf@lsystem@iteration by1\relax% - \ifnum\c@pgf@lsystem@iteration=\pgf@lsystem@order% - \expandafter\pgf@lsystem@draw\pgf@lsystem@token \pgf@stop% - \advance\c@pgf@lsystem@iteration by-1\relax% - \let\pgf@lsystem@token=\pgfutil@empty% - \else% - \expandafter\def\expandafter\pgf@lsystem@token\expandafter{\pgf@lsystem@token \pgf@stop}% - \fi% - \fi% - \let\pgf@lsystem@next=\pgf@lsystem@run% - \fi% - \fi% - \expandafter\pgf@lsystem@next\pgf@lsystem@token} - -\def\pgf@lsystem@end#1\pgf@lsystem@stop{\endgroup} + \ifx#1\pgf@lsystem@stop% + \def\pgf@lsystem@token{\pgf@lsystem@stop}% + \let\pgf@lsystem@next=\pgf@lsystem@end% + \else% + \ifx#1\pgf@stop% + \advance\c@pgf@lsystem@iteration by-1\relax% + \let\pgf@system@token=\pgfutil@empty% + \let\pgf@lsystem@next=\pgf@lsystem@run% + \else% + % Does #1 appear on the RHS of a rule...? + \expandafter\let\expandafter\pgf@lsystem@token\expandafter=% + \csname pgf@lsystem@\pgf@lsystem@name @rule@#1\endcsname% + \ifx\pgf@lsystem@token\relax% + % ...nope. So draw it straight away. + \pgf@lsystem@draw#1\pgf@stop% + \let\pgf@lsystem@token=\pgfutil@empty% + \else% + % ...yep. So, if the order has been reached draw the LHS + % immediately. Otherwise add the LHS to the token stream + % and continue. + \advance\c@pgf@lsystem@iteration by1\relax% + \ifnum\c@pgf@lsystem@iteration=\pgf@lsystem@order% + \expandafter\pgf@lsystem@draw\pgf@lsystem@token \pgf@stop% + \advance\c@pgf@lsystem@iteration by-1\relax% + \let\pgf@lsystem@token=\pgfutil@empty% + \else% + \expandafter\def\expandafter\pgf@lsystem@token\expandafter{\pgf@lsystem@token \pgf@stop}% + \fi% + \fi% + \let\pgf@lsystem@next=\pgf@lsystem@run% + \fi% + \fi% + \expandafter\pgf@lsystem@next\pgf@lsystem@token}% + +\def\pgf@lsystem@end#1\pgf@lsystem@stop{\endgroup}% \def\pgf@lsystem@draw#1{% - \ifx#1\pgf@stop% - \let\pgf@lsystem@next=\relax% - \else% - \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=% - \csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname% - \ifx\pgf@lsystem@current@symbol\relax% Try a default symbol. - \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=% - \csname pgf@lsystem@symbol@default@#1\endcsname% - \fi% - \let\pgf@lsystem@next=\pgf@lsystem@@draw% - \fi% - \pgf@lsystem@next} + \ifx#1\pgf@stop% + \let\pgf@lsystem@next=\relax% + \else% + \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=% + \csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname% + \ifx\pgf@lsystem@current@symbol\relax% Try a default symbol. + \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=% + \csname pgf@lsystem@symbol@default@#1\endcsname% + \fi% + \let\pgf@lsystem@next=\pgf@lsystem@@draw% + \fi% + \pgf@lsystem@next}% \def\pgf@lsystem@@draw{% - \edef\pgflsystemcurrentstep{\the\pgflsystemstep}% - \let\pgflsystemcurrentrightangle=\pgflsystemrightangle% - \let\pgflsystemcurrentrightangle=\pgflsystemleftangle% - \pgf@lsystem@current@symbol% - \pgf@lsystem@draw} - -\expandafter\def\csname pgf@lsystem@symbol@default@F\endcsname{\pgflsystemdrawforward} -\expandafter\def\csname pgf@lsystem@symbol@default@f\endcsname{\pgflsystemmoveforward} -\expandafter\def\csname pgf@lsystem@symbol@default@+\endcsname{\pgflsystemturnleft} -\expandafter\def\csname pgf@lsystem@symbol@default@-\endcsname{\pgflsystemturnright} -\expandafter\def\csname pgf@lsystem@symbol@default@[\endcsname{\pgflsystemsavestate} -\expandafter\def\csname pgf@lsystem@symbol@default@]\endcsname{\pgflsystemrestorestate} + \edef\pgflsystemcurrentstep{\the\pgflsystemstep}% + \let\pgflsystemcurrentrightangle=\pgflsystemrightangle% + \let\pgflsystemcurrentrightangle=\pgflsystemleftangle% + \pgf@lsystem@current@symbol% + \pgf@lsystem@draw}% + +\expandafter\def\csname +pgf@lsystem@symbol@default@F\endcsname{\pgflsystemdrawforward}% +\expandafter\def\csname +pgf@lsystem@symbol@default@f\endcsname{\pgflsystemmoveforward}% +\expandafter\def\csname +pgf@lsystem@symbol@default@+\endcsname{\pgflsystemturnleft}% +\expandafter\def\csname +pgf@lsystem@symbol@default@-\endcsname{\pgflsystemturnright}% +\expandafter\def\csname +pgf@lsystem@symbol@default@[\endcsname{\pgflsystemsavestate}% +\expandafter\def\csname +pgf@lsystem@symbol@default@]\endcsname{\pgflsystemrestorestate}% \def\pgflsystemradonmizestep{% - \ifpgf@lsystem@randomize@step% - \pgfmathrand% - \pgf@x=\pgflsystemrandomizesteppercent pt\relax% - \pgf@x=\pgfmathresult\pgf@x% - \divide\pgf@x by20\relax% - \advance\pgf@x by\pgflsystemstep\relax% - \edef\pgflsystemcurrentstep{\the\pgf@x}% - \else% - \edef\pgflsystemcurrentstep{\the\pgflsystemstep}% - \fi% -} + \ifpgf@lsystem@randomize@step% + \pgfmathrand% + \pgf@x=\pgflsystemrandomizesteppercent pt\relax% + \pgf@x=\pgfmathresult\pgf@x% + \divide\pgf@x by20\relax% + \advance\pgf@x by\pgflsystemstep\relax% + \edef\pgflsystemcurrentstep{\the\pgf@x}% + \else% + \edef\pgflsystemcurrentstep{\the\pgflsystemstep}% + \fi% +}% \def\pgflsystemdrawforward{% - \pgflsystemradonmizestep - \pgftransformxshift{+\pgflsystemcurrentstep}% - \pgfpathlineto{\pgfpointorigin}} + \pgflsystemradonmizestep + \pgftransformxshift{+\pgflsystemcurrentstep}% + \pgfpathlineto{\pgfpointorigin}}% \def\pgflsystemmoveforward{% - \pgflsystemradonmizestep - \pgftransformxshift{+\pgflsystemcurrentstep}% - \pgfpathmoveto{\pgfpointorigin}} + \pgflsystemradonmizestep + \pgftransformxshift{+\pgflsystemcurrentstep}% + \pgfpathmoveto{\pgfpointorigin}}% \def\pgflsystemranomizerightangle{% - \ifpgf@lsystem@randomize@angle% - \pgf@x=\pgflsystemrandomizeanglepercent pt\relax% - \divide\pgf@x by20\relax% - \pgfmathrand% - \pgf@x=\pgfmathresult\pgf@x% - \advance\pgf@x by\pgflsystemrightangle pt\relax% - \edef\pgflsystemcurrentrightangle{\pgfmath@tonumber{\pgf@x}}% - \else% - \let\pgflsystemcurrentrightangle=\pgflsystemrightangle% - \fi% -} + \ifpgf@lsystem@randomize@angle% + \pgf@x=\pgflsystemrandomizeanglepercent pt\relax% + \divide\pgf@x by20\relax% + \pgfmathrand% + \pgf@x=\pgfmathresult\pgf@x% + \advance\pgf@x by\pgflsystemrightangle pt\relax% + \edef\pgflsystemcurrentrightangle{\pgfmath@tonumber{\pgf@x}}% + \else% + \let\pgflsystemcurrentrightangle=\pgflsystemrightangle% + \fi% +}% \def\pgflsystemranomizeleftangle{% - \ifpgf@lsystem@randomize@angle% - \pgf@x=\pgflsystemrandomizeanglepercent pt\relax% - \divide\pgf@x by20\relax% - \pgfmathrand% - \pgf@x=\pgfmathresult\pgf@x% - \advance\pgf@x by\pgflsystemleftangle pt\relax% - \edef\pgflsystemcurrentleftangle{\pgfmath@tonumber{\pgf@x}}% - \else% - \let\pgflsystemcurrentleftangle=\pgflsystemleftangle% - \fi% -} + \ifpgf@lsystem@randomize@angle% + \pgf@x=\pgflsystemrandomizeanglepercent pt\relax% + \divide\pgf@x by20\relax% + \pgfmathrand% + \pgf@x=\pgfmathresult\pgf@x% + \advance\pgf@x by\pgflsystemleftangle pt\relax% + \edef\pgflsystemcurrentleftangle{\pgfmath@tonumber{\pgf@x}}% + \else% + \let\pgflsystemcurrentleftangle=\pgflsystemleftangle% + \fi% +}% \def\pgflsystemturnright{% - \pgflsystemranomizerightangle - \pgftransformrotate{-\pgflsystemcurrentrightangle}} + \pgflsystemranomizerightangle + \pgftransformrotate{-\pgflsystemcurrentrightangle}}% \def\pgflsystemturnleft{% - \pgflsystemranomizeleftangle - \pgftransformrotate{\pgflsystemcurrentleftangle}} + \pgflsystemranomizeleftangle + \pgftransformrotate{\pgflsystemcurrentleftangle}}% -\def\pgflsystemsavestate{\begingroup} -\def\pgflsystemrestorestate{\endgroup\pgfpathmoveto{\pgfpointorigin}} +\def\pgflsystemsavestate{\begingroup}% +\def\pgflsystemrestorestate{\endgroup\pgfpathmoveto{\pgfpointorigin}}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex index acfc3fa7b2e..908d7490030 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex @@ -7,80 +7,80 @@ % % 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.13 2008/03/03 13:52:35 tantau Exp $ +\ProvidesFileRCS{pgflibrarypatterns.code.tex} % 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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}% + \pgfpathcircle{\pgfqpoint{1.5pt}{1.5pt}}{.5pt}% + \pgfusepath{fill}% +}% @@ -88,61 +88,61 @@ % 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} -} +{% + \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}} +{% + \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}} + \pgfpathmoveto{\pgfqpointpolar{-30}{1mm}}% + \pgfpathlineto{\pgfqpointpolar{-270}{1mm}}% + \pgfpathlineto{\pgfqpointpolar{-150}{1mm}}% \pgfpathclose% - \pgfsetnonzerorule - \pgfusepath{fill} -} + \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} -} +{% + \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} -} +{% + \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{2mm}{2mm}}% + \pgfpathrectangle{\pgfqpoint{2mm}{2mm}}{\pgfqpoint{2mm}{2mm}}% + \pgfusepath{fill}% +}% @@ -150,117 +150,115 @@ \pgfdeclarepatterninherentlycolored{checkerboard light gray} {\pgfpointorigin}{\pgfqpoint{4mm}{4mm}}{\pgfqpoint{4mm}{4mm}}% -{ - \pgfsetfillcolor{black!10} +{% +% \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} -} + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -} +{% + \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} -\pgfutil@colorlet{pgf@darklightsteelblue}{black!50!pgf@lightsteelblue} +{% + \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}% +\pgfutil@colorlet{pgf@darklightsteelblue}{black!50!pgf@lightsteelblue}% \pgfdeclarepatterninherentlycolored{crosshatch dots light steel blue} {\pgfpointorigin}{\pgfpoint{8pt}{8pt}} {\pgfpoint{8pt}{8pt}} -{ - \pgfsetfillcolor{pgf@lightsteelblue} - \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{8pt}{8pt}} - \pgfusepath{fill} - \pgfsetfillcolor{pgf@darklightsteelblue!10} - \pgfpathcircle{\pgfpoint{2pt}{1.75pt}}{1pt} - \pgfpathcircle{\pgfpoint{6pt}{5.75pt}}{1pt} - \pgfusepath{fill} - \pgfsetfillcolor{pgf@darklightsteelblue!70} - \pgfpathcircle{\pgfpoint{2pt}{2.25pt}}{1pt} - \pgfpathcircle{\pgfpoint{6pt}{6.25pt}}{1pt} - \pgfusepath{fill} -} - - +{% + \pgfsetfillcolor{pgf@lightsteelblue}% + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}% + \pgfusepath{fill}% + \pgfsetfillcolor{pgf@darklightsteelblue!10}% + \pgfpathcircle{\pgfpoint{2pt}{1.75pt}}{1pt}% + \pgfpathcircle{\pgfpoint{6pt}{5.75pt}}{1pt}% + \pgfusepath{fill}% + \pgfsetfillcolor{pgf@darklightsteelblue!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/pgflibrarypatterns.meta.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.meta.code.tex index 467fa1fee46..d3a381524ae 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.meta.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.meta.code.tex @@ -7,8 +7,8 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\def\pgf@pat@type@uncolored{0} -\def\pgf@pat@type@colored{1} +\def\pgf@pat@type@uncolored{0}% +\def\pgf@pat@type@colored{1}% \newif\ifpgf@pat@makepatternimmutable \pgfkeys{/pgf/patterns/.cd, @@ -43,29 +43,29 @@ top right=\pgfpointorigin, tile size=\pgfpointorigin, tile transformation=, - code=, + code=, set up code=, -} +}% -\def\pgf@pat@name@prefix{pgf@pattern@name@meta@} +\def\pgf@pat@name@prefix{pgf@pattern@name@meta@}% \def\pgfifpatternundefined#1{% \pgfutil@ifundefined{\pgf@pat@name@prefix#1}% -} +}% \def\pgf@pat@adddef@to@macro#1#2{% \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter#1% \expandafter\expandafter\expandafter{\expandafter#1\expandafter% \def\expandafter#2\expandafter{#2}}% -} +}% \def\pgf@pat@addto@macro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}}% \def\pgf@pat@process#1{% \pgf@process{#1}% -} +}% \def\pgf@pat@doifnotempty#1{% \ifx#1\pgfutil@empty% @@ -74,12 +74,12 @@ \let\pgf@pat@next=#1% \fi% \pgf@pat@next% -} +}% -\def\pgf@pat@processtransformations#1{#1} +\def\pgf@pat@processtransformations#1{#1}% \def\pgf@pat@processpoint#1{% \pgf@process{#1}% -} +}% \def\pgfdeclarepattern#1{% @@ -89,7 +89,7 @@ \pgfkeys{/pgf/patterns/.cd, #1}% \pgf@declarepattern% \endgroup% -} +}% \def\pgf@declarepattern{% \pgfifpatternundefined{\pgf@pat@name}{% \ifx\pgf@pat@parameters\pgfutil@empty% @@ -97,7 +97,7 @@ \pgf@pat@declare% \edef\pgf@marshal{% \noexpand\pgf@pat@addto@macro\noexpand\pgf@pat@options{,number ..=\pgf@pattern@number}}% - \pgf@marshal% + \pgf@marshal% \fi% % It is a bit inefficient that all the options for % immutable patterns are saved when only the type @@ -106,7 +106,7 @@ }{% \pgferror{Pattern `\pgf@pat@name' already defined}% }% -} +}% \let\pgf@pat@declarebefore=\pgfutil@empty \let\pgf@pat@declareafter=\pgfutil@empty \let\pgf@pat@codebefore=\pgfutil@empty @@ -133,7 +133,7 @@ \pgf@pat@doifnotempty\pgf@pat@codebefore \pgf@pat@code% \pgf@pat@doifnotempty\pgf@pat@codeafter% - \pgfsys@endscope% + \pgfsys@endscope% \endpgfinterruptboundingbox% \pgfsysprotocol@getcurrentprotocol\pgf@pattern@code% \global\let\pgf@pattern@code=\pgf@pattern@code% @@ -153,7 +153,7 @@ \pgf@pat@processtransformations\pgf@pat@transformation% \pgfgettransformentries\aa\ab\ba\bb\shiftx\shifty% \global\edef\pgf@pattern@matrix{{\aa}{\ab}{\ba}{\bb}{\shiftx}{\shifty}}% - \endgroup% + \endgroup% % Now, build a name for the pattern \pgfutil@tempcnta=\pgf@pattern@number\relax% \advance\pgfutil@tempcnta by1\relax% @@ -163,39 +163,39 @@ {\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}{\the\pgf@xc}{\the\pgf@yc}\pgf@pattern@matrix{\pgf@pattern@code}{\pgf@pat@type}}% }% \pgf@marshal% - \pgfsysprotocol@setcurrentprotocol\pgf@pattern@temp% - } + \pgfsysprotocol@setcurrentprotocol\pgf@pattern@temp% +}% \def\pgf@pat@checkname#1{% - \pgf@pat@@checkname#1[]\pgf@patstop} + \pgf@pat@@checkname#1[]\pgf@patstop}% \def\pgf@pat@@checkname#1[#2]#3\pgf@patstop{% \def\pgf@pat@onlinename{#1}% \def\pgf@pat@onlineoptions{#2}% -} +}% \def\pgf@pat@unravel#1/{% - \pgfutil@ifnextchar\pgf@stop{\def\pgf@pat@unravelled{#1}}{\pgf@pat@unravel}} + \pgfutil@ifnextchar\pgf@stop{\def\pgf@pat@unravelled{#1}}{\pgf@pat@unravel}}% \pgfkeys{/handlers/.pattern/.code={% \expandafter\expandafter\expandafter\pgf@pat@unravel\pgfkeyscurrentpath/\pgf@stop% \pgfpatternalias{#1}{\pgf@pat@unravelled}% -}} +}}% \def\pgfpatternalias#1#2{% \begingroup% \pgf@pat@checkname{#1}% \expandafter\let\expandafter\pgf@pat@options\expandafter=% \csname\pgf@pat@name@prefix\pgf@pat@onlinename\endcsname% - \pgf@pat@macroaskeys{/pgf/patterns/.cd}{\pgf@pat@options}% + \pgf@pat@macroaskeys{/pgf/patterns/.cd}{\pgf@pat@options}% \pgfutil@toks@\expandafter{\pgf@pat@onlineoptions}% \edef\pgf@pat@tmp{append to defaults={\the\pgfutil@toks@}}% \expandafter\pgf@pat@addto@macro\expandafter\pgf@pat@options\expandafter{\expandafter,\pgf@pat@tmp}% \pgf@pat@addto@macro\pgf@pat@options{,name=#2}% \expandafter\global\expandafter\let\csname\pgf@pat@name@prefix#2\endcsname=\pgf@pat@options% \endgroup% -} +}% \let\pgfsetfillpattern@old=\pgfsetfillpattern @@ -204,7 +204,7 @@ \pgfutil@toks@\expandafter{#2}% \edef\pgf@marshal{\noexpand\pgfkeys{#1, \the\pgfutil@toks@}}% \pgf@marshal% -} +}% \def\pgfsetfillpattern#1#2{% \pgf@pat@checkname{#1}% \pgfutil@ifundefined{\pgf@pat@name@prefix\pgf@pat@onlinename}{% @@ -246,7 +246,7 @@ \pgfsys@setpatterncolored{\pgf@pat@number}% \fi% }% -} +}% \def\pgf@pat@setpatternuncolored#1#2{% \pgfutil@colorlet{pgf@tempcolor}{#2}% @@ -254,10 +254,10 @@ \pgfutil@extractcolorspec{pgf@tempcolor}{\pgf@tempcolor}% \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% \expandafter\pgf@pat@set@fill@patternuncolored\pgf@rgbcolor\relax{#1}% -} +}% \def\pgf@pat@set@fill@patternuncolored#1,#2,#3\relax#4{% \pgfsys@setpatternuncolored{#4}{#1}{#2}{#3}% -} +}% %%% Local Variables: diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex index 38ccd94d0b9..3f0fc8d268d 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex @@ -7,7 +7,7 @@ % % 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.20 2013/08/31 13:02:59 ludewich Exp $ +\ProvidesFileRCS{pgflibraryplothandlers.code.tex} % This handler converts each plot stream command into a curveto @@ -25,13 +25,13 @@ point macro=\pgf@plot@curveto@handler@initial, jump macro=\pgf@plot@smooth@next@moveto, end macro=\pgf@plot@curveto@handler@finish -} +}% \def\pgf@plot@smooth@next@moveto{% \pgf@plot@curveto@handler@finish% \global\pgf@plot@startedfalse% \global\let\pgf@plotstreampoint\pgf@plot@curveto@handler@initial% -} +}% \def\pgf@plot@curveto@handler@initial#1{% \pgf@process{#1}% @@ -41,14 +41,14 @@ \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}% @@ -79,20 +79,20 @@ \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. +% will result in a tighter curve. Default is 0.5. % % Example: % @@ -101,8 +101,8 @@ \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} + \edef\pgf@plottension{\pgf@sys@tonumber\pgf@x}}% +\pgfsetplottension{0.5}% % This handler converts the plot stream command into a curveto @@ -118,13 +118,13 @@ point macro=\pgf@plot@closedcurve@handler@initial, end macro=\pgf@plot@closedcurve@handler@finish, jump macro=\pgf@plot@closedsmooth@next@moveto -} +}% \def\pgf@plot@closedsmooth@next@moveto{% \pgf@plot@closedcurve@handler@finish% \global\pgf@plot@startedfalse% \global\let\pgf@plotstreampoint\pgf@plot@closedcurve@handler@initial% -} +}% \def\pgf@plot@closedcurve@handler@initial#1{% \pgf@process{#1}% @@ -133,14 +133,14 @@ \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% @@ -170,7 +170,7 @@ \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}% @@ -201,7 +201,7 @@ \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 @@ -266,7 +266,7 @@ {\pgf@marshal}% \pgfpathclose% \fi% -} +}% @@ -274,7 +274,7 @@ % This handler converts each point in a stream into a line from the % $y$-axis to the given points coordinate, resulting in a -% ``comb.'' +% ``comb.'' % % Example: % @@ -285,7 +285,7 @@ start macro=\pgfplotxzerolevelstreamstart, point macro=\pgf@plot@xcomb@handler, end macro=\pgfplotxzerolevelstreamend, -} +}% \def\pgf@plot@xcomb@handler#1{% \pgf@process{#1}% @@ -297,12 +297,12 @@ \pgf@yb=\pgf@x \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\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.'' +% ``comb.'' % % Example: % @@ -313,7 +313,7 @@ start macro=\pgfplotyzerolevelstreamstart, point macro=\pgf@plot@ycomb@handler, end macro=\pgfplotyzerolevelstreamend -} +}% \def\pgf@plot@ycomb@handler#1{% \pgf@process{#1}% @@ -325,23 +325,23 @@ \pgf@yb=\pgf@x \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% -} +}% % PGF Bar or comb plots usually draw something from zero to the current plot's coordinate. -% +% % The 'zero' offset can be changed using an input stream. % % There are two such streams which can be configured independently. % The first one returns "zeros" for coordinate x, the second one % returns "zeros" for coordinate y. -% +% % \pgfplotxzerolevelstreamstart % \pgfplotxzerolevelstreamnext % assigns \pgf@x globally % \pgfplotxzerolevelstreamnext % \pgfplotxzerolevelstreamnext % \pgfplotxzerolevelstreamend % -% and +% and % \pgfplotyzerolevelstreamstart % \pgfplotyzerolevelstreamnext % assigns \pgf@x globally % \pgfplotyzerolevelstreamend @@ -351,43 +351,43 @@ \def\pgfplotxzerolevelstreamnext{\pgf@plotxzerolevelstreamnext} \def\pgfplotyzerolevelstreamstart{\pgf@plotyzerolevelstreamstart}% \def\pgfplotyzerolevelstreamend{\pgf@plotyzerolevelstreamend}% -\def\pgfplotyzerolevelstreamnext{\pgf@plotyzerolevelstreamnext} +\def\pgfplotyzerolevelstreamnext{\pgf@plotyzerolevelstreamnext}% % This zero level stream always returns '#1' (a dimension). \def\pgfplotxzerolevelstreamconstant#1{% - \edef\pgfplotxzerolevelstreamconstant@val{#1}% - \def\pgf@plotxzerolevelstreamstart{% - \global\let\pgf@plotxzerolevelstreamend=\relax - \gdef\pgf@plotxzerolevelstreamnext{\global\pgf@x=\pgfplotxzerolevelstreamconstant@val\relax}% - }% + \edef\pgfplotxzerolevelstreamconstant@val{#1}% + \def\pgf@plotxzerolevelstreamstart{% + \global\let\pgf@plotxzerolevelstreamend=\relax + \gdef\pgf@plotxzerolevelstreamnext{\global\pgf@x=\pgfplotxzerolevelstreamconstant@val\relax}% + }% }% \pgfplotxzerolevelstreamconstant{0pt}% % This zero level stream always returns '#1'. \def\pgfplotyzerolevelstreamconstant#1{% - \edef\pgfplotyzerolevelstreamconstant@val{#1}% - \def\pgf@plotyzerolevelstreamstart{% - \global\let\pgf@plotyzerolevelstreamend=\relax - \gdef\pgf@plotyzerolevelstreamnext{\global\pgf@x=\pgfplotyzerolevelstreamconstant@val\relax}% - }% + \edef\pgfplotyzerolevelstreamconstant@val{#1}% + \def\pgf@plotyzerolevelstreamstart{% + \global\let\pgf@plotyzerolevelstreamend=\relax + \gdef\pgf@plotyzerolevelstreamnext{\global\pgf@x=\pgfplotyzerolevelstreamconstant@val\relax}% + }% }% \pgfplotyzerolevelstreamconstant{0pt}% -\def\pgfplotbarwidth{\pgfkeysvalueof{/pgf/bar width}} -\def\pgfplotbarshift{\pgfkeysvalueof{/pgf/bar shift}} +\def\pgfplotbarwidth{\pgfkeysvalueof{/pgf/bar width}}% +\def\pgfplotbarshift{\pgfkeysvalueof{/pgf/bar shift}}% \pgfqkeys{/pgf}{% - bar width/.initial=10pt, - bar shift/.initial=0pt, - bar interval width/.initial=1, - bar interval shift/.initial=0.5, - % - % hook which is executed right before a new bar is begun. - at begin bar/.initial=, - % hook which is executed right after a bar path has been finished. - % In this context, the bar's path has not been used. - at end bar/.initial=, -} + bar width/.initial=10pt, + bar shift/.initial=0pt, + bar interval width/.initial=1, + bar interval shift/.initial=0.5, + % + % hook which is executed right before a new bar is begun. + at begin bar/.initial=, + % hook which is executed right after a bar path has been finished. + % In this context, the bar's path has not been used. + at end bar/.initial=, +}% % This handler places a rectangle at each point in the plot stream, a % rectangle which touches the x-axis at one end and the current point @@ -412,7 +412,7 @@ }, end macro=\pgfplotyzerolevelstreamend, point macro=\pgf@plot@ybar@handler -} +}% \def\pgf@plot@ybar@handler#1{% \pgfkeysvalueof{/pgf/at begin bar}% @@ -428,10 +428,10 @@ \pgf@yb=\pgf@x \advance\pgf@ya by-\pgf@yb \pgfpathrectangle - {\pgfqpoint{\pgf@xc}{\pgf@yb}}% - {\pgfqpoint{\pgf@xb}{\pgf@ya}}% + {\pgfqpoint{\pgf@xc}{\pgf@yb}}% + {\pgfqpoint{\pgf@xb}{\pgf@ya}}% \pgfkeysvalueof{/pgf/at end bar}% -} +}% % This handler places a rectangle at each point in the plot stream, a % rectangle which touches the y-axis at one end and the current point @@ -455,7 +455,7 @@ }, end macro=\pgfplotxzerolevelstreamend, point macro=\pgf@plot@xbar@handler -} +}% \def\pgf@plot@xbar@handler#1{% \pgfkeysvalueof{/pgf/at begin bar}% @@ -471,23 +471,23 @@ \pgf@yb=\pgf@x \advance\pgf@ya by-\pgf@yb \pgfpathrectangle - {\pgfqpoint{\pgf@yb}{\pgf@xc}}% - {\pgfqpoint{\pgf@ya}{\pgf@xb}}% + {\pgfqpoint{\pgf@yb}{\pgf@xc}}% + {\pgfqpoint{\pgf@ya}{\pgf@xb}}% \pgfkeysvalueof{/pgf/at end bar}% -} +}% % This handler is a variant of \pgfplothandlerybar which works with % intervals instead of points. -% +% % Bars are drawn between successive input coordinates and the width is % determined relatively to the interval length. % % It looks like this: % -% |---| |-----| -% | | | | -% | | | | -% | | | | +% |---| |-----| +% | | | | +% | | | | +% | | | | % (X)------(X)-----------(X) % % where (X) denotes the x-axis offsets of input coordinates. @@ -519,14 +519,14 @@ }, end macro=\pgfplotyzerolevelstreamend, point macro=\pgf@plot@ybarinterval@handler@first -} +}% \def\pgf@plot@ybarinterval@handler@first#1{% \pgf@process{#1}% \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@x}% \xdef\pgf@plot@barinterval@bar{\the\pgf@y}% \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler% -} +}% \def\pgf@plot@ybarinterval@handler#1{% \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% @@ -545,10 +545,10 @@ \pgf@yb=\pgf@x \advance\pgf@ya by-\pgf@yb \pgfpathrectangle - {\pgfqpoint{\pgf@xc}{\pgf@yb}}% - {\pgfqpoint{\pgf@xb}{\pgf@ya}}% + {\pgfqpoint{\pgf@xc}{\pgf@yb}}% + {\pgfqpoint{\pgf@xb}{\pgf@ya}}% \pgfkeysvalueof{/pgf/at end bar}% -} +}% % Like \pgfplothandlerybarinterval but for xbar. \pgfdeclareplothandler{\pgfplothandlerxbarinterval}{}{% @@ -561,14 +561,14 @@ }, end macro=\pgfplotxzerolevelstreamend, point macro=\pgf@plot@xbarinterval@handler@first -} +}% \def\pgf@plot@xbarinterval@handler@first#1{% \pgf@process{#1}% \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@y}% \xdef\pgf@plot@barinterval@bar{\the\pgf@x}% \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler% -} +}% \def\pgf@plot@xbarinterval@handler#1{% \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% @@ -587,10 +587,10 @@ \pgf@yb=\pgf@x \advance\pgf@ya by-\pgf@yb \pgfpathrectangle - {\pgfqpoint{\pgf@yb}{\pgf@xc}}% - {\pgfqpoint{\pgf@ya}{\pgf@xb}}% + {\pgfqpoint{\pgf@yb}{\pgf@xc}}% + {\pgfqpoint{\pgf@ya}{\pgf@xb}}% \pgfkeysvalueof{/pgf/at end bar}% -} +}% % This handler is very similar to \pgfplothandlerlineto, but it @@ -609,14 +609,14 @@ \pgfdeclareplothandler{\pgfplothandlerconstantlineto}{}{% point macro=\pgf@plot@const@line@handler -} +}% \def\pgf@plot@const@line@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler@@% -} +}% \def\pgf@plot@const@line@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -625,11 +625,11 @@ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}% -} +}% % A variant of \pgfplothandlerconstantlineto which places its mark on % the right line ends. -% +% % |---x % ---x | % |--x @@ -642,14 +642,14 @@ \pgfdeclareplothandler{\pgfplothandlerconstantlinetomarkright}{}{% point macro=\pgf@plot@const@line@mark@right@handler -} +}% \def\pgf@plot@const@line@mark@right@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler@@% -} +}% \def\pgf@plot@const@line@mark@right@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -658,7 +658,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@yb}{\pgf@ya}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}% -} +}% % A variant of \pgfplothandlerconstantlineto which places its mark on % the middle of the line segment. @@ -676,14 +676,14 @@ \pgfdeclareplothandler{\pgfplothandlerconstantlinetomarkmid}{}{% point macro=\pgf@plot@const@line@mark@mid@handler -} +}% \def\pgf@plot@const@line@mark@mid@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@mid@handler@@% -} +}% \def\pgf@plot@const@line@mark@mid@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -695,7 +695,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@ya}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% -} +}% % This handler is in fact a variant of \pgfplothandlerconstantlineto, % but it does not draw vertical lines. It produces a sequence of @@ -703,7 +703,7 @@ % each right end: % % ---x -% ---x +% ---x % ---x % --x % @@ -714,14 +714,14 @@ \pgfdeclareplothandler{\pgfplothandlerjumpmarkright}{}{% point macro=\pgf@plot@jumpmarkright@handler -} +}% \def\pgf@plot@jumpmarkright@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler@@% -} +}% \def\pgf@plot@jumpmarkright@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -730,7 +730,7 @@ \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}% -} +}% % This handler is in fact a variant of \pgfplothandlerconstantlineto, % but it does not draw vertical lines. It produces a sequence of @@ -738,7 +738,7 @@ % each left end: % % x--- -% x--- +% x--- % x--- % x-- % @@ -749,13 +749,13 @@ \pgfdeclareplothandler{\pgfplothandlerjumpmarkleft}{}{% point macro=\pgf@plot@jumpmarkleft@handler -} +}% \def\pgf@plot@jumpmarkleft@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler@@% -} +}% \def\pgf@plot@jumpmarkleft@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -764,7 +764,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}% -} +}% % This handler is in fact a variant of % \pgfplothandlerconstantlinetomarkmid, @@ -772,8 +772,8 @@ % line-to and move-to operations such that plot marks are placed like % % ----x -% -% --x-- +% +% --x-- % --x---- % x-- % @@ -784,14 +784,14 @@ \pgfdeclareplothandler{\pgfplothandlerjumpmarkmid}{}{% point macro=\pgf@plot@jump@mark@mid@handler -} +}% \def\pgf@plot@jump@mark@mid@handler#1{% \pgf@process{#1}% \xdef\pgf@plot@const@line@handler@last{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgf@plot@first@action{}% \global\let\pgf@plotstreampoint=\pgf@plot@jump@mark@mid@handler@@% -} +}% \def\pgf@plot@jump@mark@mid@handler@@#1{% \pgf@process{#1}% \pgf@xa=\pgf@x @@ -803,7 +803,7 @@ \pgfpathmoveto{\pgfqpoint{\pgf@xc}{\pgf@ya}}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \xdef\pgf@plot@const@line@handler@last{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% -} +}% % This handler converts each point in a stream into a line from the @@ -816,7 +816,7 @@ \pgfdeclareplothandler{\pgfplothandlerpolarcomb}{}{% point macro=\pgf@plot@polarcomb@handler -} +}% \def\pgf@plot@polarcomb@handler#1{% \pgf@process{#1}% @@ -824,12 +824,12 @@ \pgf@ya=\pgf@y% \pgfpathmoveto{\pgfpointorigin}% \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% -} +}% -% This handler draws a given mark at each point. +% 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). @@ -853,15 +853,15 @@ \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax% }, point macro=\pgf@plot@mark@handler -} +}% \newcount\pgf@plot@mark@count -\def\pgf@plot@mark@phase{0} +\def\pgf@plot@mark@phase{0}% \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 @@ -873,12 +873,12 @@ % % \pgfsetplotmarkrepeat{2} -\def\pgfsetplotmarkrepeat#1{\def\pgf@plot@mark@repeat{#1}} -\pgfsetplotmarkrepeat{1} +\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. +% 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. % @@ -886,8 +886,8 @@ % % \pgfsetplotmarkphase{3} -\def\pgfsetplotmarkphase#1{\def\pgf@plot@mark@phase{#1}} -\pgfsetplotmarkphase{1} +\def\pgfsetplotmarkphase#1{\def\pgf@plot@mark@phase{#1}}% +\pgfsetplotmarkphase{1}% @@ -918,7 +918,7 @@ \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax% }, point macro=\pgf@plot@mark@handler -} +}% % \def\pgfplothandlermarklisted#1#2{% % \let\pgf@plot@mark@list=\pgfutil@empty% @@ -928,7 +928,7 @@ % \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. @@ -940,7 +940,7 @@ % % \pgfdeclareplotmark{*}{\pgfpathcircle{\pgfpointorigin}{2pt}\pgfusepathqfill} -\def\pgfdeclareplotmark#1#2{\expandafter\def\csname pgf@plot@mark@#1\endcsname{#2}} +\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, @@ -950,7 +950,7 @@ % % \pgfsetplotmarksize{1pt} -\def\pgfsetplotmarksize#1{\pgfmathsetlength\pgfplotmarksize{#1}} +\def\pgfsetplotmarksize#1{\pgfmathsetlength\pgfplotmarksize{#1}}% \newdimen\pgfplotmarksize \pgfplotmarksize=2pt @@ -964,7 +964,7 @@ % % \pgfuseplotmark{*} -\def\pgfuseplotmark#1{\csname pgf@plot@mark@#1\endcsname} +\def\pgfuseplotmark#1{\csname pgf@plot@mark@#1\endcsname}% % A stroke-filled circle mark @@ -973,38 +973,38 @@ {% \pgfpathellipse{\pgfpointorigin}{\pgfqpoint{\pgfplotmarksize}{0sp}}{\pgfqpoint{0sp}{\pgfplotmarksize}}% \pgfusepathqfillstroke -} +}% % A plus-sign like mark \pgfdeclareplotmark{+} {% - \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}} - \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}} - \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}} - \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}} + \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}} + \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 -% This handler turns creates a series of straight line segements +% This handler turns creates a series of straight line segments % between consecutive points, but leaving /pgf/gap around stream point % space. % @@ -1013,16 +1013,16 @@ % \pgfplothandlergaplineto % \pgfplotxyfile{mytable} -\pgfkeys{/pgf/gap around stream point/.initial=1.5pt} +\pgfkeys{/pgf/gap around stream point/.initial=1.5pt}% \pgfdeclareplothandler{\pgfplothandlergaplineto}{}{% point macro=\pgf@plot@gap@lineto@handler@initial, jump macro=\pgf@plot@gap@next@moveto -} +}% \def\pgf@plot@gap@next@moveto{% \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler@initial% -} +}% \def\pgf@plot@gap@lineto@handler@initial#1{% \pgf@process{#1}% @@ -1030,7 +1030,7 @@ \pgf@ya=\pgf@y% \xdef\pgf@plot@gap@lineto@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler% -} +}% \def\pgf@plot@gap@lineto@handler#1{% % Ok, compute normalized line vector @@ -1046,7 +1046,7 @@ \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@lineto@next}}% \global\let\pgf@plot@gap@lineto@last=\pgf@plot@gap@lineto@next% -} +}% @@ -1065,13 +1065,13 @@ jump macro=\pgf@plot@gapcycle@next@moveto, end macro=\pgf@plot@gap@cycle@handler@finish, start={\global\let\pgf@plot@gap@cycle@first\relax} -} +}% \def\pgf@plot@gapcycle@next@moveto{% \pgf@plot@gap@cycle@handler@finish% \global\let\pgf@plot@gap@cycle@first=\relax% \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler@initial% -} +}% \def\pgf@plot@gap@cycle@handler@initial#1{% \pgf@process{#1}% @@ -1080,7 +1080,7 @@ \xdef\pgf@plot@gap@cycle@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% \global\let\pgf@plot@gap@cycle@first=\pgf@plot@gap@cycle@last% \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler% -} +}% \def\pgf@plot@gap@cycle@handler#1{% % Ok, compute normalized line vector @@ -1096,14 +1096,14 @@ \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@cycle@next}}% \global\let\pgf@plot@gap@cycle@last=\pgf@plot@gap@cycle@next% -} +}% \def\pgf@plot@gap@cycle@handler@finish{% \ifx\pgf@plot@gap@cycle@first\relax% \else \pgf@plot@gap@cycle@handler{\pgf@plot@gap@cycle@first}% \fi -} +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex index b64138dabf3..24bc7b8de72 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex @@ -7,7 +7,7 @@ % % 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.14 2015/08/03 10:04:36 cfeuersaenger Exp $ +\ProvidesFileRCS{pgflibraryplotmarks.code.tex} % A stroked circle mark @@ -16,7 +16,7 @@ {% \pgfpathellipse{\pgfpointorigin}{\pgfqpoint{\pgfplotmarksize}{0sp}}{\pgfqpoint{0sp}{\pgfplotmarksize}}% \pgfusepathqstroke -} +}% % A Mercedes-line star @@ -30,7 +30,7 @@ \pgfpathmoveto{\pgfqpointpolar{-150}{\pgfplotmarksize}}% \pgfpathlineto{\pgfpointorigin}% \pgfusepathqstroke -} +}% \pgfdeclareplotmark{Mercedes star flipped} {% @@ -41,7 +41,7 @@ \pgfpathmoveto{\pgfqpointpolar{150}{\pgfplotmarksize}}% \pgfpathlineto{\pgfpointorigin}% \pgfusepathqstroke -} +}% @@ -57,7 +57,7 @@ \pgfpathmoveto{\pgfqpointpolar{-30}{\pgfplotmarksize}}% \pgfpathlineto{\pgfqpointpolar{-210}{\pgfplotmarksize}}% \pgfusepathqstroke -} +}% % A five-pointed star mark @@ -70,7 +70,7 @@ \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}% \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}% \pgfusepathqstroke -} +}% % An 10-pointed star mark @@ -83,7 +83,7 @@ \pgfpathmoveto{\pgfqpointpolar{234}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}% \pgfpathmoveto{\pgfqpointpolar{162}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}% \pgfusepathqstroke -} +}% % An \oplus mark @@ -96,7 +96,7 @@ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}% \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfusepathqstroke -} +}% \pgfdeclareplotmark{oplus*} {% @@ -106,7 +106,7 @@ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}% \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfusepathqfillstroke -} +}% % An \otimes mark @@ -119,7 +119,7 @@ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}% \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}% \pgfusepathqstroke -} +}% \pgfdeclareplotmark{otimes*} {% @@ -129,7 +129,7 @@ \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}}% \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}}% \pgfusepathqfillstroke -} +}% % A vertical bar mark @@ -139,7 +139,7 @@ \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}}% \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfusepathqstroke -} +}% @@ -150,7 +150,7 @@ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}% \pgfusepathqstroke -} +}% % A square stroked mark @@ -159,7 +159,7 @@ {% \pgfpathrectangle{\pgfqpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfqpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}% \pgfusepathqstroke -} +}% % A square stroked-filled mark @@ -167,7 +167,7 @@ {% \pgfpathrectangle{\pgfqpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfqpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}% \pgfusepathqfillstroke -} +}% % A triangle mark @@ -179,7 +179,7 @@ \pgfpathlineto{\pgfqpointpolar{-150}{\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A stroke-filled triangle mark @@ -191,7 +191,7 @@ \pgfpathlineto{\pgfqpointpolar{-150}{\pgfplotmarksize}}% \pgfpathclose \pgfusepathqfillstroke -} +}% @@ -205,7 +205,7 @@ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}% \pgfpathclose \pgfusepathqstroke -} +}% % A stroke-filled diamond-shaped mark @@ -218,7 +218,7 @@ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}% \pgfpathclose \pgfusepathqfillstroke -} +}% @@ -233,7 +233,7 @@ \pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A stroke-filled pentagon-shaped mark @@ -246,7 +246,7 @@ \pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}% \pgfpathclose \pgfusepathqfillstroke -} +}% \newif\ifpgfmarktext@usetikznode \pgfkeys{ @@ -254,7 +254,7 @@ /pgf/text mark style/.initial=, /pgf/text mark as node/.is if=pgfmarktext@usetikznode, /pgf/text mark as node/.default=true, - % + % % backw. compat: the extra search path confuses the '.unknown' % handlers, so this here is deprecated: /pgf/text mark/style/.style={/pgf/text mark style={#1}},% @@ -270,17 +270,17 @@ \else \expandafter\pgftext\expandafter[\pgfmarktext@style]{\pgfmarktext@}% \fi -} +}% -\pgfkeysdef{/pgf/mark color}{\def\pgf@mark@color{#1}} +\pgfkeysdef{/pgf/mark color}{\def\pgf@mark@color{#1}}% \let\pgf@mark@color\pgfutil@empty \def\pgf@set@mark@color{% - \ifx\pgf@mark@color\pgfutil@empty - \pgfsys@color@rgb@fill{1}{1}{1}% - \else - \pgfsetfillcolor{\pgf@mark@color}% - \fi + \ifx\pgf@mark@color\pgfutil@empty + \pgfsys@color@rgb@fill{1}{1}{1}% + \else + \pgfsetfillcolor{\pgf@mark@color}% + \fi }% \def\pgf@mark@color@none{none}% @@ -289,44 +289,44 @@ % created by Tomek \pgfdeclareplotmark{halfcircle}{% - \ifx\pgf@mark@color@none\pgf@mark@color - \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto - {\pgfqpoint{-\pgfplotmarksize}{0pt}}% - \pgfpatharc{180}{360}{\pgfplotmarksize}% - \pgfusepathqfill - \endpgfscope% - \fi - \pgfpathmoveto - {\pgfqpoint{-\pgfplotmarksize}{0pt}}% - \pgfpathlineto - {\pgfqpoint{\pgfplotmarksize}{0pt}}% - \pgfpathcircle{\pgfpointorigin}% - {\pgfplotmarksize}% - \pgfusepathqstroke -} + \ifx\pgf@mark@color@none\pgf@mark@color + \else + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto + {\pgfqpoint{-\pgfplotmarksize}{0pt}}% + \pgfpatharc{180}{360}{\pgfplotmarksize}% + \pgfusepathqfill + \endpgfscope% + \fi + \pgfpathmoveto + {\pgfqpoint{-\pgfplotmarksize}{0pt}}% + \pgfpathlineto + {\pgfqpoint{\pgfplotmarksize}{0pt}}% + \pgfpathcircle{\pgfpointorigin}% + {\pgfplotmarksize}% + \pgfusepathqstroke +}% \pgfdeclareplotmark{halfcircle*}{% \pgfpathmoveto {\pgfqpoint{\pgfplotmarksize}{0pt}}% \pgfpatharc{0}{180}{\pgfplotmarksize}% \pgfpathclose \pgfusepathqfill - \ifx\pgf@mark@color@none\pgf@mark@color - \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto - {\pgfqpoint{-\pgfplotmarksize}{0pt}}% - \pgfpatharc{180}{360}{\pgfplotmarksize}% - \pgfusepathqfill - \endpgfscope% - \fi - \pgfpathcircle{\pgfpointorigin}% - {\pgfplotmarksize}% - \pgfusepathqstroke -} + \ifx\pgf@mark@color@none\pgf@mark@color + \else + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto + {\pgfqpoint{-\pgfplotmarksize}{0pt}}% + \pgfpatharc{180}{360}{\pgfplotmarksize}% + \pgfusepathqfill + \endpgfscope% + \fi + \pgfpathcircle{\pgfpointorigin}% + {\pgfplotmarksize}% + \pgfusepathqstroke +}% % A half-down-filled and half-up-filled-white diamond-shaped mark % created by Magnus Tewes @@ -338,13 +338,13 @@ \pgfusepathqfill \ifx\pgf@mark@color@none\pgf@mark@color \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}% - \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% - \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}% - \pgfusepathqfill - \endpgfscope + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}% + \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% + \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}% + \pgfusepathqfill + \endpgfscope \fi \pgfpathmoveto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}% \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% @@ -352,7 +352,7 @@ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A half-down-filled and half-up-filled-white tilted-squared-shaped mark % created by Magnus Tewes @@ -364,13 +364,13 @@ \pgfusepathqfill \ifx\pgf@mark@color@none\pgf@mark@color \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% - \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% - \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}% - \pgfusepathqfill - \endpgfscope + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% + \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% + \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}% + \pgfusepathqfill + \endpgfscope \fi \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% @@ -378,7 +378,7 @@ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A half-right-filled and half-up-filled-white tilted-squared-shaped mark % created by Magnus Tewes @@ -390,13 +390,13 @@ \pgfusepathqfill \ifx\pgf@mark@color@none\pgf@mark@color \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% - \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}% - \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% - \pgfusepathqfill - \endpgfscope + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% + \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}% + \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% + \pgfusepathqfill + \endpgfscope \fi \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% @@ -404,7 +404,7 @@ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A half-left-filled and half-up-filled-white tilted-squared-shaped mark % created by Magnus Tewes @@ -416,13 +416,13 @@ \pgfusepathqfill \ifx\pgf@mark@color@none\pgf@mark@color \else - \pgfscope - \pgf@set@mark@color - \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% - \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}% - \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% - \pgfusepathqfill - \endpgfscope + \pgfscope + \pgf@set@mark@color + \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% + \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}% + \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% + \pgfusepathqfill + \endpgfscope \fi \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}% \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}% @@ -430,7 +430,7 @@ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}% \pgfpathclose \pgfusepathqstroke -} +}% % A stroke-filled heart-shaped mark @@ -447,7 +447,7 @@ \pgfpathcurveto{\pgfqpoint{.5\pgfplotmarksize}{-1.165\pgfplotmarksize}}{\pgfqpoint{0pt}{-1.66\pgfplotmarksize}}{\pgfqpoint{0pt}{-1.75\pgfplotmarksize}}% \pgfpathclose \pgfusepathqfillstroke -} +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex index ea1f469abe8..fe98a5f3f2e 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex @@ -1,19 +1,19 @@ %-------------------------------------------- % % TeX profiling library -% +% % Copyright 2010 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. -% +% % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % You should have received a copy of the GNU General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. % @@ -31,38 +31,38 @@ \else % Raise an error \pgferror{% - Library 'profiler' can only be used with pdftex Rev. >= 1.671 + Library 'profiler' can only be used with pdftex Rev. >= 1.671 because it needs the \string\pdfelapsedtime\space command or with luatex}% \global\let\pgfutil@pdfelapsedtime=\c@pgf@counta \fi}{% % We run pdftex. That's ok. - \let\pgfutil@pdfelapsedtime\pdfelapsedtime} + \let\pgfutil@pdfelapsedtime\pdfelapsedtime}% % Defines a new profiler entry named `#1'. % % This allocates a set of counters. \def\pgfprofilenew#1{% - \pgfutil@ifundefined{c@pgfprofile@elapsedtotal@#1}{% - \expandafter\gdef\csname c@pgfprofile@elapsedtotal@#1\endcsname{0}% - \expandafter\gdef\csname c@pgfprofile@elapsedself@#1\endcsname{0}% - \expandafter\gdef\csname c@pgfprofile@numinvocations@#1\endcsname{0}% - \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}% - \expandafter\gdef\csname c@pgfprofile@semaphor@#1\endcsname{0}% - \expandafter\gdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{0}% - \pgfprofile@all@registered@list@add{#1}% - }{% - % it is already defined and registered. Shouldn't hurt, might - % even be a good feature. - }% + \pgfutil@ifundefined{c@pgfprofile@elapsedtotal@#1}{% + \expandafter\gdef\csname c@pgfprofile@elapsedtotal@#1\endcsname{0}% + \expandafter\gdef\csname c@pgfprofile@elapsedself@#1\endcsname{0}% + \expandafter\gdef\csname c@pgfprofile@numinvocations@#1\endcsname{0}% + \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}% + \expandafter\gdef\csname c@pgfprofile@semaphor@#1\endcsname{0}% + \expandafter\gdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{0}% + \pgfprofile@all@registered@list@add{#1}% + }{% + % it is already defined and registered. Shouldn't hurt, might + % even be a good feature. + }% }% \def\pgfprofile@TeX@DIALECT@toenvironment@begin#1{\csname #1\endcsname}% \def\pgfprofile@TeX@DIALECT@toenvironment@end#1{\csname end#1\endcsname}% \def\pgfprofile@@to@pgfretval#1{% - \expandafter\let\expandafter\pgfretval#1% + \expandafter\let\expandafter\pgfretval#1% }% % Defines a new profiler entry for the environment `#1'. @@ -77,33 +77,33 @@ % \pgfprofilenewforenvironment[<profiler entry name>]{<environment name>} \def\pgfprofilenewforenvironment{\pgfutil@ifnextchar[{\pgfprofilenewforenvironment@}{\pgfprofilenewforenvironment@[]}}% \def\pgfprofilenewforenvironment@[#1]#2{% - \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}% - \ifx\pgfretval\relax - \pgferror{\string\pgfprofilenewforenvironment{#2} doesn't work: the environment `#2' is (not yet?) known or not known in this context}{}% - \else - \expandafter\global\expandafter\let\csname pgfprofile@orig@begin@#2\endcsname=\pgfretval - \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@end{#2}% - \expandafter\global\expandafter\let\csname pgfprofile@orig@end@#2\endcsname=\pgfretval - % - \def\pgfprofile@temp{#1}% - \ifx\pgfprofile@temp\pgfutil@empty - \pgfprofilenewforenvironment@@{\pgfprofileenv #2}{#2}% - \else - \pgfprofilenewforenvironment@@{#1}{#2}% - \fi - \fi + \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}% + \ifx\pgfretval\relax + \pgferror{\string\pgfprofilenewforenvironment{#2} doesn't work: the environment `#2' is (not yet?) known or not known in this context}{}% + \else + \expandafter\global\expandafter\let\csname pgfprofile@orig@begin@#2\endcsname=\pgfretval + \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@end{#2}% + \expandafter\global\expandafter\let\csname pgfprofile@orig@end@#2\endcsname=\pgfretval + % + \def\pgfprofile@temp{#1}% + \ifx\pgfprofile@temp\pgfutil@empty + \pgfprofilenewforenvironment@@{\pgfprofileenv #2}{#2}% + \else + \pgfprofilenewforenvironment@@{#1}{#2}% + \fi + \fi }% \def\pgfprofilenewforenvironment@@#1#2{% - \pgfprofilenew{#1}% - \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}{% - \pgfprofilestart{#1}% - \csname pgfprofile@orig@begin@#2\endcsname - }% - \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@end{#2}{% - \csname pgfprofile@orig@end@#2\endcsname - \pgfprofileend{#1}% - }% -} + \pgfprofilenew{#1}% + \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}{% + \pgfprofilestart{#1}% + \csname pgfprofile@orig@begin@#2\endcsname + }% + \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@end{#2}{% + \csname pgfprofile@orig@end@#2\endcsname + \pgfprofileend{#1}% + }% +}% \def\pgfprofilecs{<CS>}% @@ -113,10 +113,10 @@ % % This calls \pgfprofilenew and enhances the control sequence with % support for timings. -% +% % #1: the control sequence (with backslash!) % #2: the number of arguments (see below). -% +% % The following commands are supported: % - commands which take one (optional) argument in square brackets, % - commands which take one (optional) argument in square brackets @@ -124,32 +124,32 @@ % curly braces (use an empty argument for '#2' in this case), % - commands which take one (optional) argument in square brackets % and *exactly* #2 arguments afterwards. -\def\pgfprofilenewforcommand{\pgfutil@ifnextchar[{\pgfprofilenewforcommand@}{\pgfprofilenewforcommand@[]}} +\def\pgfprofilenewforcommand{\pgfutil@ifnextchar[{\pgfprofilenewforcommand@}{\pgfprofilenewforcommand@[]}}% \def\pgfprofilenewforcommand@[#1]#2#3{% - \def\pgfprofile@temp{#3}% - \ifx\pgfprofile@temp\pgfutil@empty - \pgfprofilenewforcommandpattern[#1]{#2}{<autocheck>}{}% - \else - \ifcase#3\relax - \pgfprofilenewforcommandpattern[#1]{#2}{}{}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1}{{##1}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2}{{##1}{##2}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3}{{##1}{##2}{##3}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4}{{##1}{##2}{##3}{##4}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5}{{##1}{##2}{##3}{##4}{##5}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6}{{##1}{##2}{##3}{##4}{##5}{##6}}% - \or - \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6##7}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% - \else - \pgferror{library 'profiler' can't replace control sequences with '#3' arguments automatically, sorry.}{}% - \fi - \fi + \def\pgfprofile@temp{#3}% + \ifx\pgfprofile@temp\pgfutil@empty + \pgfprofilenewforcommandpattern[#1]{#2}{<autocheck>}{}% + \else + \ifcase#3\relax + \pgfprofilenewforcommandpattern[#1]{#2}{}{}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1}{{##1}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2}{{##1}{##2}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3}{{##1}{##2}{##3}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4}{{##1}{##2}{##3}{##4}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5}{{##1}{##2}{##3}{##4}{##5}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6}{{##1}{##2}{##3}{##4}{##5}{##6}}% + \or + \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6##7}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% + \else + \pgferror{library 'profiler' can't replace control sequences with '#3' arguments automatically, sorry.}{}% + \fi + \fi }% % \pgfprofilenewforcommandpattern[<profile entry name>]{<\CS>}{<definition pattern>}{<invocation pattern>} @@ -159,137 +159,137 @@ % % \def\mymacro##1\to##2\in##3{ .... } % \pgfprofilenewforcommandpattern{\mymacro}{##1\to##2\in##3}{{##1}\to{##2}\in{##3}} -\def\pgfprofilenewforcommandpattern{\pgfutil@ifnextchar[{\pgfprofilenewforcommandpattern@}{\pgfprofilenewforcommandpattern@[]}} +\def\pgfprofilenewforcommandpattern{\pgfutil@ifnextchar[{\pgfprofilenewforcommandpattern@}{\pgfprofilenewforcommandpattern@[]}}% \def\pgfprofilenewforcommandpattern@[#1]#2#3#4{% - \def\pgfprofile@known{1}% - \ifx#2\undefined - \def\pgfprofile@known{0}% - \else - \ifx#2\relax - \def\pgfprofile@known{0}% - \fi - \fi - \if\pgfprofile@known0% - \pgferror{\string\pgfprofilenewforcommandpattern{\string#2} doesn't work: the command `\string#2' is (not yet?) known or not known in this context}% - \else - \begingroup - \pgfprofile@cs@to@name{#2}% - \let\pgfprofilenew@cmdname=\pgfretval - % - \def\pgfprofile@temp{#1}% - \ifx\pgfprofile@temp\pgfutil@empty - \edef\pgfprofilenew@profilerentryname{\pgfprofilecs\pgfprofilenew@cmdname}% - \else - \edef\pgfprofilenew@profilerentryname{#1}% - \fi - \expandafter\global\expandafter\let\csname pgfprofile@name@for@\pgfprofilenew@cmdname\endcsname=\pgfprofilenew@profilerentryname - \pgfprofilenew{\pgfprofilenew@profilerentryname}% - \expandafter\gdef\csname b@pgfprofile@show@\pgfprofilenew@profilerentryname\endcsname{0}% - % - \expandafter\global\expandafter\let\csname pgfprofile@orig@\pgfprofilenew@cmdname\endcsname=#2% - \toks0={#3}% - \edef\pgfprofile@temp{\the\toks0}%% - \def\pgfprofile@tempb{<autocheck>}% - \ifx\pgfprofile@temp\pgfprofile@tempb - \expandafter\global\expandafter\let\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname=\pgfprofileinvokecommand@uptoonearg - \else - \expandafter\gdef\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname#3{% - \pgfprofile@invokeorig{#4}% - }% - \fi - \xdef#2{\noexpand\pgfprofileinvokecommand{\pgfprofilenew@cmdname}}% - \endgroup - \fi + \def\pgfprofile@known{1}% + \ifx#2\undefined + \def\pgfprofile@known{0}% + \else + \ifx#2\relax + \def\pgfprofile@known{0}% + \fi + \fi + \if\pgfprofile@known0% + \pgferror{\string\pgfprofilenewforcommandpattern{\string#2} doesn't work: the command `\string#2' is (not yet?) known or not known in this context}% + \else + \begingroup + \pgfprofile@cs@to@name{#2}% + \let\pgfprofilenew@cmdname=\pgfretval + % + \def\pgfprofile@temp{#1}% + \ifx\pgfprofile@temp\pgfutil@empty + \edef\pgfprofilenew@profilerentryname{\pgfprofilecs\pgfprofilenew@cmdname}% + \else + \edef\pgfprofilenew@profilerentryname{#1}% + \fi + \expandafter\global\expandafter\let\csname pgfprofile@name@for@\pgfprofilenew@cmdname\endcsname=\pgfprofilenew@profilerentryname + \pgfprofilenew{\pgfprofilenew@profilerentryname}% + \expandafter\gdef\csname b@pgfprofile@show@\pgfprofilenew@profilerentryname\endcsname{0}% + % + \expandafter\global\expandafter\let\csname pgfprofile@orig@\pgfprofilenew@cmdname\endcsname=#2% + \toks0={#3}% + \edef\pgfprofile@temp{\the\toks0}%% + \def\pgfprofile@tempb{<autocheck>}% + \ifx\pgfprofile@temp\pgfprofile@tempb + \expandafter\global\expandafter\let\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname=\pgfprofileinvokecommand@uptoonearg + \else + \expandafter\gdef\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname#3{% + \pgfprofile@invokeorig{#4}% + }% + \fi + \xdef#2{\noexpand\pgfprofileinvokecommand{\pgfprofilenew@cmdname}}% + \endgroup + \fi }% \def\pgfprofileshowinvocationsfor#1{% - \pgfutil@ifundefined{b@pgfprofile@show@#1}{% - \pgferror{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}% - }{% - \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}% - \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{0}% - }% + \pgfutil@ifundefined{b@pgfprofile@show@#1}{% + \pgferror{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}% + }{% + \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}% + \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{0}% + }% }% \def\pgfprofileshowinvocationsexpandedfor#1{% - \pgfutil@ifundefined{b@pgfprofile@show@#1}{% - \pgferror{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}% - }{% - \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}% - \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{1}% - }% + \pgfutil@ifundefined{b@pgfprofile@show@#1}{% + \pgferror{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}% + }{% + \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}% + \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{1}% + }% }% -\def\pgfprofile@no@optional@arg@text{<noarg>} +\def\pgfprofile@no@optional@arg@text{<noarg>}% \def\pgfprofileinvokecommand#1{% - \pgfutil@ifnextchar[{\pgfprofileinvokecommand@{#1}}{\pgfprofileinvokecommand@{#1}[<noarg>]}% + \pgfutil@ifnextchar[{\pgfprofileinvokecommand@{#1}}{\pgfprofileinvokecommand@{#1}[<noarg>]}% }% \def\pgfprofileinvokecommand@#1[#2]{% - \def\pgfprofileinvokecommand@cs{#1}% - \def\pgfprofileinvokecommand@optarg{#2}% - \edef\pgfprofileinvokecommand@profilerentryname{\csname pgfprofile@name@for@#1\endcsname}% - \csname pgfprofile@repl@#1\endcsname% + \def\pgfprofileinvokecommand@cs{#1}% + \def\pgfprofileinvokecommand@optarg{#2}% + \edef\pgfprofileinvokecommand@profilerentryname{\csname pgfprofile@name@for@#1\endcsname}% + \csname pgfprofile@repl@#1\endcsname% }% % #1 contains ALL arguments, including any braces. \def\pgfprofile@invokeorig#1{% - % re-insert the control sequence name and the optional argument: - % this wasn't possible directly. - \begingroup - \toks1=\expandafter{\pgfprofileinvokecommand@optarg}% - \toks2={#1}% - \toks3=\expandafter{\csname pgfprofile@orig@\pgfprofileinvokecommand@cs\endcsname}% - % - \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text - % no [] argument after original command: - \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3 \the\toks2 }%% - \else - \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3[\the\toks1]\the\toks2 }% - \fi - \if1\csname b@pgfprofile@show@\pgfprofileinvokecommand@profilerentryname\endcsname - \pgfprofile@orig@show - \fi - \endgroup - \edef\pgfprofile@temp{{\pgfprofileinvokecommand@cs}{\pgfprofileinvokecommand@profilerentryname}}% - \expandafter\pgfprofile@invokeorig@\pgfprofile@temp% + % re-insert the control sequence name and the optional argument: + % this wasn't possible directly. + \begingroup + \toks1=\expandafter{\pgfprofileinvokecommand@optarg}% + \toks2={#1}% + \toks3=\expandafter{\csname pgfprofile@orig@\pgfprofileinvokecommand@cs\endcsname}% + % + \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text + % no [] argument after original command: + \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3 \the\toks2 }%% + \else + \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3[\the\toks1]\the\toks2 }% + \fi + \if1\csname b@pgfprofile@show@\pgfprofileinvokecommand@profilerentryname\endcsname + \pgfprofile@orig@show + \fi + \endgroup + \edef\pgfprofile@temp{{\pgfprofileinvokecommand@cs}{\pgfprofileinvokecommand@profilerentryname}}% + \expandafter\pgfprofile@invokeorig@\pgfprofile@temp% }% \def\pgfprofile@orig@show{% - \toks4=\expandafter{\csname\pgfprofileinvokecommand@cs\endcsname}% - \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text - \def\pgfprofile@orig@show@args{\the\toks2 }% - \else - \def\pgfprofile@orig@show@args{[\the\toks1] \the\toks2 }% - \fi - \if1\csname b@pgfprofile@show@edef@\pgfprofileinvokecommand@profilerentryname\endcsname - \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}% - \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}% - \fi - \immediate\write16{pgflibraryprofiler: calling - \#\csname c@pgfprofile@numinvocations@\pgfprofileinvokecommand@profilerentryname\endcsname\space - (\the\toks4 \pgfprofile@orig@show@args)}% + \toks4=\expandafter{\csname\pgfprofileinvokecommand@cs\endcsname}% + \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text + \def\pgfprofile@orig@show@args{\the\toks2 }% + \else + \def\pgfprofile@orig@show@args{[\the\toks1] \the\toks2 }% + \fi + \if1\csname b@pgfprofile@show@edef@\pgfprofileinvokecommand@profilerentryname\endcsname + \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}% + \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}% + \fi + \pgf@typeout{pgflibraryprofiler: calling + \#\csname c@pgfprofile@numinvocations@\pgfprofileinvokecommand@profilerentryname\endcsname\space + (\the\toks4 \pgfprofile@orig@show@args)}% }% % #1: control sequence name (without backslash) % #2: profiler entry name \def\pgfprofile@invokeorig@#1#2{% - % this check should avoid save stack impact - \pgfprofileifisrunning{#2}{% - \pgfprofile@invokeorig@doitfinally% - }{% - \pgfprofilestart{#2}% - \pgfprofile@invokeorig@doitfinally% - \pgfprofileend{#2}% - }% + % this check should avoid save stack impact + \pgfprofileifisrunning{#2}{% + \pgfprofile@invokeorig@doitfinally% + }{% + \pgfprofilestart{#2}% + \pgfprofile@invokeorig@doitfinally% + \pgfprofileend{#2}% + }% }% \def\pgfprofileinvokecommand@uptoonearg{% - \pgfutil@ifnextchar\bgroup{\pgfprofileinvokecommand@onearg}{\pgfprofileinvokecommand@noarg}% + \pgfutil@ifnextchar\bgroup{\pgfprofileinvokecommand@onearg}{\pgfprofileinvokecommand@noarg}% }% \def\pgfprofileinvokecommand@onearg#1{% - \pgfprofile@invokeorig{{#1}}% + \pgfprofile@invokeorig{{#1}}% }% \def\pgfprofileinvokecommand@noarg{% - \pgfprofile@invokeorig{}% + \pgfprofile@invokeorig{}% }% @@ -302,51 +302,51 @@ % result in the same result as if just one \pgfprofilestart command % has been issued. \def\pgfprofilestart#1{% - \pgfprofileifisrunning{#1}{% - \relax - }{% - \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{\the\pgfutil@pdfelapsedtime}% - \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}% - \pgfprofile@advance{c@pgfprofile@numinvocations@#1}{1}% - \pgfprofilestackpush{#1}% - }% - \pgfprofile@advance{c@pgfprofile@semaphor@#1}{1}% + \pgfprofileifisrunning{#1}{% + \relax + }{% + \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{\the\pgfutil@pdfelapsedtime}% + \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}% + \pgfprofile@advance{c@pgfprofile@numinvocations@#1}{1}% + \pgfprofilestackpush{#1}% + }% + \pgfprofile@advance{c@pgfprofile@semaphor@#1}{1}% }% % Stops / Interrupts timing of the profiler entry named `#1'. \def\pgfprofileend#1{% - \pgfprofile@advance{c@pgfprofile@semaphor@#1}{-1}% - \pgfprofileifisrunning{#1}{% - \relax - }{% - \begingroup - \c@pgf@countb=\pgfutil@pdfelapsedtime\relax - \advance\c@pgf@countb by-\csname c@pgfprofile@elapsed@at@start@#1\endcsname\relax - % - \pgfprofilestackpop\pgfretval - \edef\pgfprofile@temp{#1}% - \ifx\pgfprofile@temp\pgfretval - \else - \immediate\write16{pgflibraryprofiler WARNING: possible error in self time computation...}% - \fi - \pgfprofilestackifempty{% - \relax - }{% - \pgfprofilestacktop\pgfretval - \pgfprofile@advance{c@pgfprofile@subtractforself@\pgfretval}{\c@pgf@countb}% - }% - % - \pgfprofile@advance{c@pgfprofile@elapsedtotal@#1}{\c@pgf@countb}% - \advance\c@pgf@countb by-\csname c@pgfprofile@subtractforself@#1\endcsname\relax - \pgfprofile@advance{c@pgfprofile@elapsedself@#1}{\c@pgf@countb}% - \endgroup - }% + \pgfprofile@advance{c@pgfprofile@semaphor@#1}{-1}% + \pgfprofileifisrunning{#1}{% + \relax + }{% + \begingroup + \c@pgf@countb=\pgfutil@pdfelapsedtime\relax + \advance\c@pgf@countb by-\csname c@pgfprofile@elapsed@at@start@#1\endcsname\relax + % + \pgfprofilestackpop\pgfretval + \edef\pgfprofile@temp{#1}% + \ifx\pgfprofile@temp\pgfretval + \else + \pgf@typeout{pgflibraryprofiler WARNING: possible error in self time computation...}% + \fi + \pgfprofilestackifempty{% + \relax + }{% + \pgfprofilestacktop\pgfretval + \pgfprofile@advance{c@pgfprofile@subtractforself@\pgfretval}{\c@pgf@countb}% + }% + % + \pgfprofile@advance{c@pgfprofile@elapsedtotal@#1}{\c@pgf@countb}% + \advance\c@pgf@countb by-\csname c@pgfprofile@subtractforself@#1\endcsname\relax + \pgfprofile@advance{c@pgfprofile@elapsedself@#1}{\c@pgf@countb}% + \endgroup + }% }% % invokes '#2' if '#1' is currently running and '#3' if not. \def\pgfprofileifisrunning#1#2#3{% - \ifnum\csname c@pgfprofile@semaphor@#1\endcsname=0 \def\pgfprofileifisrunning@next{#3}\else \def\pgfprofileifisrunning@next{#2}\fi - \pgfprofileifisrunning@next + \ifnum\csname c@pgfprofile@semaphor@#1\endcsname=0 \def\pgfprofileifisrunning@next{#3}\else \def\pgfprofileifisrunning@next{#2}\fi + \pgfprofileifisrunning@next }% % Sets the profiler entry whose total time is used to compute all @@ -355,50 +355,50 @@ % Stops all running timings and postprocesses them. \def\pgfprofilepostprocess{% - \begingroup - % - % prepare files. - \c@pgf@countb=\time - \divide\c@pgf@countb by60 - \c@pgf@countd=\c@pgf@countb - \multiply\c@pgf@countd by60 - \c@pgf@countc=\time - \advance\c@pgf@countc by-\c@pgf@countd - \immediate\openout\w@pgf@writea=\jobname.profiler.\the\year-\pgfprofiletotwodigitstr\month-\pgfprofiletotwodigitstr\day_\pgfprofiletotwodigitstr\c@pgf@countb h_\pgfprofiletotwodigitstr\c@pgf@countc m.dat - \immediate\write\w@pgf@writea{% - \pgfprofile@percent relative values are measured against the totaltime of `\pgfprofile@rel'.% - }% - \immediate\write16{pgflibraryprofiler: relative values are measured against the totaltime of `\pgfprofile@rel'.}% - \immediate\write\w@pgf@writea{% - profilerentry\pgfprofile@TAB - totaltime[s]\pgfprofile@TAB - totaltime[percent]\pgfprofile@TAB - selftime[s]\pgfprofile@TAB - selftime[percent]\pgfprofile@TAB - numinvocations\pgfprofile@TAB}% - % - % - % compute main time and prepare computation of relative times: - \pgfprofileifisrunning{\pgfprofile@rel}{% - \pgfprofileend{\pgfprofile@rel}% - }{}% - \pgf@xa=\csname c@pgfprofile@elapsedtotal@\pgfprofile@rel\endcsname sp - \edef\pgfprofiletotaltime{\pgf@sys@tonumber\pgf@xa}% - \pgfmathreciprocal@{\pgfprofiletotaltime}% - \let\pgfprofiletotaltime@inv=\pgfmathresult - % - % postprocess each of them: - \pgfprofile@all@registered@list@foreach{% - \pgfprofileifisrunning{##1}{% - \pgfprofileend{##1}% - }{}% - \pgfprofilepostprocess@single{##1}% - }% - \immediate\write\w@pgf@writea{% - \pgfprofile@percent\space vim: ts=40 nowrap nostartofline - }% - \immediate\closeout\w@pgf@writea - \endgroup + \begingroup + % + % prepare files. + \c@pgf@countb=\time + \divide\c@pgf@countb by60 + \c@pgf@countd=\c@pgf@countb + \multiply\c@pgf@countd by60 + \c@pgf@countc=\time + \advance\c@pgf@countc by-\c@pgf@countd + \immediate\openout\w@pgf@writea=\jobname.profiler.\the\year-\pgfprofiletotwodigitstr\month-\pgfprofiletotwodigitstr\day_\pgfprofiletotwodigitstr\c@pgf@countb h_\pgfprofiletotwodigitstr\c@pgf@countc m.dat + \immediate\write\w@pgf@writea{% + \pgfprofile@percent relative values are measured against the totaltime of `\pgfprofile@rel'.% + }% + \pgf@typeout{pgflibraryprofiler: relative values are measured against the totaltime of `\pgfprofile@rel'.}% + \immediate\write\w@pgf@writea{% + profilerentry\pgfprofile@TAB + totaltime[s]\pgfprofile@TAB + totaltime[percent]\pgfprofile@TAB + selftime[s]\pgfprofile@TAB + selftime[percent]\pgfprofile@TAB + numinvocations\pgfprofile@TAB}% + % + % + % compute main time and prepare computation of relative times: + \pgfprofileifisrunning{\pgfprofile@rel}{% + \pgfprofileend{\pgfprofile@rel}% + }{}% + \pgf@xa=\csname c@pgfprofile@elapsedtotal@\pgfprofile@rel\endcsname sp + \edef\pgfprofiletotaltime{\pgf@sys@tonumber\pgf@xa}% + \pgfmathreciprocal@{\pgfprofiletotaltime}% + \let\pgfprofiletotaltime@inv=\pgfmathresult + % + % postprocess each of them: + \pgfprofile@all@registered@list@foreach{% + \pgfprofileifisrunning{##1}{% + \pgfprofileend{##1}% + }{}% + \pgfprofilepostprocess@single{##1}% + }% + \immediate\write\w@pgf@writea{% + \pgfprofile@percent\space vim: ts=40 nowrap nostartofline + }% + \immediate\closeout\w@pgf@writea + \endgroup }% {% @@ -415,116 +415,116 @@ \catcode`\%=12 \gdef\pgfprofile@percent{%}} \def\pgfprofilepostprocess@single#1{% - \begingroup - \pgf@xa=\csname c@pgfprofile@elapsedtotal@#1\endcsname sp - \pgf@xb=\csname c@pgfprofile@elapsedself@#1\endcsname sp - \pgf@ya=\pgfprofiletotaltime@inv\pgf@xa - \pgf@yb=\pgfprofiletotaltime@inv\pgf@xb - \multiply\pgf@ya by100 - \multiply\pgf@yb by100 - \edef\pgfprofilecur@total{\pgf@sys@tonumber\pgf@xa}% - \edef\pgfprofilecur@self{\pgf@sys@tonumber\pgf@xb}% - \edef\pgfprofilecur@total@rel{\pgf@sys@tonumber\pgf@ya}% - \edef\pgfprofilecur@self@rel{\pgf@sys@tonumber\pgf@yb}% - \immediate\write16{ - pgflibraryprofiler(#1) - \pgfprofile@lbrace - total time=\pgfprofilecur@total sec; (\pgfprofilecur@total@rel\pgfprofile@percent) - self time=\pgfprofilecur@self sec; (\pgfprofilecur@self@rel\pgfprofile@percent) - invocations=\csname c@pgfprofile@numinvocations@#1\endcsname; - \pgfprofile@rbrace - }% - \immediate\write\w@pgf@writea{% - #1\pgfprofile@TAB - \pgfprofilecur@total\pgfprofile@TAB - \pgfprofilecur@total@rel\pgfprofile@TAB - \pgfprofilecur@self\pgfprofile@TAB - \pgfprofilecur@self@rel\pgfprofile@TAB - \csname c@pgfprofile@numinvocations@#1\endcsname\pgfprofile@TAB - }% - \endgroup + \begingroup + \pgf@xa=\csname c@pgfprofile@elapsedtotal@#1\endcsname sp + \pgf@xb=\csname c@pgfprofile@elapsedself@#1\endcsname sp + \pgf@ya=\pgfprofiletotaltime@inv\pgf@xa + \pgf@yb=\pgfprofiletotaltime@inv\pgf@xb + \multiply\pgf@ya by100 + \multiply\pgf@yb by100 + \edef\pgfprofilecur@total{\pgf@sys@tonumber\pgf@xa}% + \edef\pgfprofilecur@self{\pgf@sys@tonumber\pgf@xb}% + \edef\pgfprofilecur@total@rel{\pgf@sys@tonumber\pgf@ya}% + \edef\pgfprofilecur@self@rel{\pgf@sys@tonumber\pgf@yb}% + \pgf@typeout{ + pgflibraryprofiler(#1) + \pgfprofile@lbrace + total time=\pgfprofilecur@total sec; (\pgfprofilecur@total@rel\pgfprofile@percent) + self time=\pgfprofilecur@self sec; (\pgfprofilecur@self@rel\pgfprofile@percent) + invocations=\csname c@pgfprofile@numinvocations@#1\endcsname; + \pgfprofile@rbrace + }% + \immediate\write\w@pgf@writea{% + #1\pgfprofile@TAB + \pgfprofilecur@total\pgfprofile@TAB + \pgfprofilecur@total@rel\pgfprofile@TAB + \pgfprofilecur@self\pgfprofile@TAB + \pgfprofilecur@self@rel\pgfprofile@TAB + \csname c@pgfprofile@numinvocations@#1\endcsname\pgfprofile@TAB + }% + \endgroup }% % Invokes '#2' for each element of the command separated list '#1'. % the current list element is available as '#1' inside of '#2'. \long\def\pgfprofileforeachentryinCSV#1#2{% - \long\def\pgfprofileinvokeforeach@@##1{#2}% - \pgfprofileforeachentryinCSVisterminated@loop#1,\pgfeov + \long\def\pgfprofileinvokeforeach@@##1{#2}% + \pgfprofileforeachentryinCSVisterminated@loop#1,\pgfeov }% \long\def\pgfprofileforeachentryinCSVisterminated@loop{% - \pgfutil@ifnextchar\pgfeov{\pgfutil@gobble}{\pgfprofileforeachentryinCSV@next}% + \pgfutil@ifnextchar\pgfeov{\pgfutil@gobble}{\pgfprofileforeachentryinCSV@next}% }% \long\def\pgfprofileforeachentryinCSV@next#1,{% - \pgfprofileinvokeforeach@@{#1}% - \pgfprofileforeachentryinCSVisterminated@loop% + \pgfprofileinvokeforeach@@{#1}% + \pgfprofileforeachentryinCSVisterminated@loop% }% -\xdef\pgfprofile@all@registered@list{} -\xdef\pgfprofile@currently@running@list{} +\xdef\pgfprofile@all@registered@list{}% +\xdef\pgfprofile@currently@running@list{}% \def\pgfprofile@all@registered@list@add#1{% - \ifx\pgfprofile@all@registered@list\pgfutil@empty - \xdef\pgfprofile@all@registered@list{#1}% - \else - \xdef\pgfprofile@all@registered@list{\pgfprofile@all@registered@list,#1}% - \fi + \ifx\pgfprofile@all@registered@list\pgfutil@empty + \xdef\pgfprofile@all@registered@list{#1}% + \else + \xdef\pgfprofile@all@registered@list{\pgfprofile@all@registered@list,#1}% + \fi }% \def\pgfprofile@all@registered@list@foreach#1{% - \expandafter\pgfprofileforeachentryinCSV\expandafter{\pgfprofile@all@registered@list}{#1}% + \expandafter\pgfprofileforeachentryinCSV\expandafter{\pgfprofile@all@registered@list}{#1}% }% \def\pgfprofile@advance#1#2{% - \begingroup - \c@pgf@counta=\csname #1\endcsname\relax - \advance\c@pgf@counta by#2\relax - \expandafter\xdef\csname #1\endcsname{\the\c@pgf@counta}% - \endgroup + \begingroup + \c@pgf@counta=\csname #1\endcsname\relax + \advance\c@pgf@counta by#2\relax + \expandafter\xdef\csname #1\endcsname{\the\c@pgf@counta}% + \endgroup }% \def\pgfprofile@cs@to@name@#1#2\relax{\def\pgfretval{#2}} % defines '\pgfretval' to be the control sequences name of '#1' *without* the backslash. \def\pgfprofile@cs@to@name#1{% - \expandafter\pgfprofile@cs@to@name@\string#1\relax + \expandafter\pgfprofile@cs@to@name@\string#1\relax }% \newcount\c@pgfprofile@stacktop \c@pgfprofile@stacktop=-1 \def\pgfprofilestackpush#1{% - \global\advance\c@pgfprofile@stacktop by1 - \expandafter\xdef\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname{#1}% + \global\advance\c@pgfprofile@stacktop by1 + \expandafter\xdef\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname{#1}% }% % pops the current stack top to macro #1 \def\pgfprofilestackpop#1{% - \pgfprofilestacktop#1% - \global\advance\c@pgfprofile@stacktop by-1 + \pgfprofilestacktop#1% + \global\advance\c@pgfprofile@stacktop by-1 }% % returns the stack's top to macro #1 \def\pgfprofilestacktop#1{% - \expandafter\let\expandafter#1\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname + \expandafter\let\expandafter#1\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname }% \def\pgfprofilestackifempty#1#2{% - \ifnum\c@pgfprofile@stacktop<0 #1\else #2\fi + \ifnum\c@pgfprofile@stacktop<0 #1\else #2\fi }% -\def\pgfprofiletotwodigitstr#1{\ifnum#1<10 0\the#1\else\the#1\fi} +\def\pgfprofiletotwodigitstr#1{\ifnum#1<10 0\the#1\else\the#1\fi}% -\pgfprofilenew{main job} -\pgfprofilestart{main job} +\pgfprofilenew{main job}% +\pgfprofilestart{main job}% \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@main job\endcsname{0}% -\pgfprofilesetrel{main job} +\pgfprofilesetrel{main job}% \pgfutil@ifundefined{AtEndDocument}{% - % no latex. ok. + % no latex. ok. }{% - % do latex specific stuff: - \pgfprofilenew{preamble} - \pgfprofilestart{preamble} - \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@preamble\endcsname{0}% - \AtBeginDocument{\pgfprofileend{preamble}}% - % - \AtEndDocument{\pgfprofilepostprocess}% + % do latex specific stuff: + \pgfprofilenew{preamble} + \pgfprofilestart{preamble} + \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@preamble\endcsname{0}% + \AtBeginDocument{\pgfprofileend{preamble}}% + % + \AtEndDocument{\pgfprofilepostprocess}% }% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex index 285f6d21772..22aa92ffb35 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryshadings.code.tex,v 1.2 2008/10/29 23:06:34 tantau Exp $ +\ProvidesFileRCS{pgflibraryshadings.code.tex} % @@ -20,7 +20,7 @@ {} { % x y 2 copy % ... x y x y - 2 copy abs exch abs add 0.0001 ge + 2 copy abs exch abs add 0.0001 ge {atan 360.0 div} % ... x y heading; heading being in %the interval [0, 1.0] { pop } % silently deal with error: return @@ -58,7 +58,7 @@ 1 index mul % Q P i H' S V T 7 2 roll % V T Q P i H' S pop pop % V T Q P i - %%% + %%% % end of BLOCK B. The rest is just stack manipulation dup 0.5 le % TEST II [ i == 0 ] { % BLOCK C [ take stack to V T P ] @@ -92,7 +92,7 @@ ifelse % for III } ifelse % for II -} +}% \pgfdeclarefunctionalshading{color wheel black center} {\pgfpoint{-50bp}{-50bp}} @@ -100,7 +100,7 @@ {} { % x y 2 copy % ... x y x y - 2 copy abs exch abs add 0.0001 ge + 2 copy abs exch abs add 0.0001 ge {atan 360.0 div} % ... x y heading; heading being in %the interval [0, 1.0] { pop } % silently deal with error: return @@ -138,7 +138,7 @@ 1 index mul % Q P i H' S V T 7 2 roll % V T Q P i H' S pop pop % V T Q P i - %%% + %%% % end of BLOCK B. The rest is just stack manipulation dup 0.5 le % TEST II [ i == 0 ] { % BLOCK C [ take stack to V T P ] @@ -172,20 +172,20 @@ ifelse % for III } ifelse % for II -} +}% \pgfdeclarefunctionalshading{color wheel} {\pgfpoint{-50bp}{-50bp}} {\pgfpoint{50bp}{50bp}} {} { % x y - 2 copy abs exch abs add 0.0001 ge + 2 copy abs exch abs add 0.0001 ge {atan 360.0 div} % ... x y heading; heading being in %the interval [0, 1.0] { pop } % silently deal with error: return % arbitrary heading of zero for origin ifelse % because we will use it for 'Hue' - 1.0 1.0 % ... H S V + 1.0 1.0 % ... H S V % C version to use as model: % H' = H * 6 % i = floor(H') @@ -208,7 +208,7 @@ 1 index mul % Q P i H' S V T 7 2 roll % V T Q P i H' S pop pop % V T Q P i - %%% + %%% % end of BLOCK B. The rest is just stack manipulation dup 0.5 le % TEST II [ i == 0 ] { % BLOCK C [ take stack to V T P ] @@ -242,17 +242,17 @@ ifelse % for III } ifelse % for II -} +}% % % A bilinear interpolation. % -\colorlet{lower left}{white} -\colorlet{lower right}{white} -\colorlet{upper left}{white} -\colorlet{upper right}{white} +\colorlet{lower left}{white}% +\colorlet{lower right}{white}% +\colorlet{upper left}{white}% +\colorlet{upper right}{white}% \pgfdeclarefunctionalshading[lower left,lower right,upper left,upper right]{bilinear interpolation} {\pgfpointorigin} @@ -264,13 +264,13 @@ 25 sub 50 div exch 25 sub 50 div 2 copy % Calculate y/100 x/100. % 100 div exch 100 div 2 copy % Calculate y/100 x/100. neg 1 add exch neg 1 add % Calculate 1-y/100 1-x/100. - 3 1 roll 2 copy exch 5 2 roll 6 copy 6 copy % Set up stack. + 3 1 roll 2 copy exch 5 2 roll 6 copy 6 copy % Set up stack. \pgf@lib@shadings@llred mul exch \pgf@lib@shadings@lrred mul add mul % Process red component. 4 1 roll \pgf@lib@shadings@urred mul exch \pgf@lib@shadings@ulred mul add mul add 13 1 roll - \pgf@lib@shadings@llgreen mul exch \pgf@lib@shadings@lrgreen mul add mul % Process green component. + \pgf@lib@shadings@llgreen mul exch \pgf@lib@shadings@lrgreen mul add mul % Process green component. 4 1 roll \pgf@lib@shadings@urgreen mul exch \pgf@lib@shadings@ulgreen mul add mul add @@ -279,7 +279,7 @@ 4 1 roll \pgf@lib@shadings@urblue mul exch \pgf@lib@shadings@ulblue mul add mul add -} +}% % @@ -293,7 +293,7 @@ 12.5 div exch 12.5 div exch 1 index 1 index % Stack: c_r c_i z_r z_i - % Formula: z' = z^2 + c = (z_r + i z_i)^2 + c_r + i c_i + % Formula: z' = z^2 + c = (z_r + i z_i)^2 + c_r + i c_i % = (z_r^2 - z_i^2 + c_r) + i (2 z_r z_i + c_i) % % First iteration @@ -402,8 +402,8 @@ } { pop pop 1000.0 1000.0 } ifelse % Compute distance dup mul exch - dup mul + dup mul add sqrt dup 4 1 roll 2 gt { pop pop 2.0 exch div 1.0 exch sub dup dup} {pop pop 0.0 0.0 0.0} ifelse -} +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex index 90f26eb7211..f964dca2751 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex @@ -7,10 +7,10 @@ % % 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.25 2013/07/15 12:05:34 tantau Exp $ +\ProvidesFileRCS{pgflibrarysnakes.code.tex} -\pgfwarning{Snakes have been superseded by decorations. Use the decoration libraries instead of the snakes library} +\pgfwarning{Snakes have been superseded by decorations. Use the decoration libraries instead of the snakes library}% -\usepgflibrary{decorations.pathmorphing,decorations.pathreplacing,decorations.shapes} +\usepgflibrary{decorations.pathmorphing,decorations.pathreplacing,decorations.shapes}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex index a385cf199f5..59ea0915460 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex @@ -7,10 +7,10 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarysvg.path.code.tex,v 1.7 2013/09/23 18:04:36 tantau Exp $ +\ProvidesFileRCS{pgflibrarysvg.path.code.tex} -\usepgfmodule{parser} +\usepgfmodule{parser}% @@ -25,7 +25,7 @@ % issues a sequences of appropriate \pgfpath commands for this % path. For a description of the compressed svg path syntax, see a % book on svg. -% +% % The notion of a pixel used by svg makes no sense in pgf (actually % it does not really make sense in svg either, but never mind), and % instead of pixels "pt" is used as the basic unit. Use coordinate @@ -34,13 +34,13 @@ % Example: % % \pgfpathsvg{M10 20 L 30-20 0 1} -% +% % % this has the same effect as -% +% % \pgfpathmoveto{\pgfpoint{10pt}{20pt}} % \pgfpathlineto{\pgfpint{30pt}{-20pt}} % \pgfpathlineto{\pgfpint{0pt}{1pt}} -% +% \def\pgfpathsvg#1{% \let\pgf@lib@svg@finish@prev\relax% @@ -52,7 +52,7 @@ \pgf@lib@svg@last@y\pgf@y% \let\pgf@lib@svg@num=\pgfutil@empty% \pgfparserparse{svgpath}#1"% -} +}% @@ -72,12 +72,12 @@ % previous control points. This is done in the following two % variables. If they are empty, there was no previous control point of % the desired kind, in which case the specification prescribes that -% the start point is used. +% the start point is used. -\def\pgf@lib@svg@clear@bezier@quad{ +\def\pgf@lib@svg@clear@bezier@quad{% \let\pgf@lib@svg@bezier@last=\pgfutil@empty \let\pgf@lib@svg@quad@last=\pgfutil@empty -} +}% \pgf@lib@svg@clear@bezier@quad % @@ -90,7 +90,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@moveto} -} +}% \def\pgf@lib@svg@moveto{% \pgf@lib@svg@clear@bezier@quad% @@ -98,7 +98,7 @@ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{1}pt% \pgfpathmoveto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto} -} +}% % Handle a relative moveto: @@ -107,7 +107,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@moveto@rel} -} +}% \def\pgf@lib@svg@moveto@rel{% \pgf@lib@svg@clear@bezier@quad% @@ -115,7 +115,7 @@ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{1}pt% \pgfpathmoveto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel} -} +}% % Handle a lineto: @@ -124,7 +124,7 @@ { \pgf@lib@svg@finish@prev% \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto} -} +}% \def\pgf@lib@svg@lineto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -135,7 +135,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto}% \fi -} +}% % Handle a relative lineto: @@ -144,7 +144,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel} -} +}% \def\pgf@lib@svg@lineto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -155,7 +155,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel}% \fi -} +}% % Handle a closepath: @@ -163,12 +163,12 @@ \pgfparserdef{svgpath}{all}{the letter Z} { \pgf@lib@svg@closepath -} +}% \pgfparserdef{svgpath}{all}{the letter z} { \pgf@lib@svg@closepath -} +}% \def\pgf@lib@svg@closepath{ \pgf@lib@svg@finish@prev @@ -176,12 +176,12 @@ \let\pgf@lib@svg@finish@prev=\relax \pgf@lib@svg@clear@bezier@quad% \pgfparserswitch{initial}% -} +}% % Ignore spaces if no other rules says differently: -\pgfparserdef{svgpath}{all}{blank space \space}{} +\pgfparserdef{svgpath}{all}{blank space \space}{}% @@ -192,7 +192,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto} -} +}% \def\pgf@lib@svg@hlineto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -202,13 +202,13 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter h} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto@rel} -} +}% \def\pgf@lib@svg@hlineto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -218,7 +218,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto@rel} \fi -} +}% % Handle a horizontal lineto: @@ -227,7 +227,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto} -} +}% \def\pgf@lib@svg@vlineto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -237,13 +237,13 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter v} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto@rel} -} +}% \def\pgf@lib@svg@vlineto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -253,7 +253,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}% \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto@rel} \fi -} +}% @@ -264,7 +264,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto} -} +}% \def\pgf@lib@svg@curveto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -283,14 +283,14 @@ % Go on \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter c} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto@rel} -} +}% \def\pgf@lib@svg@curveto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -308,7 +308,7 @@ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{5}pt% \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto@rel} \fi -} +}% @@ -318,7 +318,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@smooth} -} +}% \def\pgf@lib@svg@curveto@smooth{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -351,14 +351,14 @@ % Go on \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@smooth} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter s} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@rel@smooth} -} +}% \def\pgf@lib@svg@curveto@rel@smooth{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -383,7 +383,7 @@ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}% % Clear quadratic last point and save new last control point: \let\pgf@lib@svg@quad@last=\pgfutil@empty% - \pgf@process{\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}} + \pgf@process{\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}} \edef\pgf@lib@svg@bezier@last{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% % update \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{2}pt% @@ -391,7 +391,7 @@ % Go on \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@rel@smooth} \fi -} +}% @@ -402,7 +402,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto} -} +}% \def\pgf@lib@svg@quad@curveto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -420,14 +420,14 @@ % Go on \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter q} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto@rel} -} +}% \def\pgf@lib@svg@quad@curveto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -444,7 +444,7 @@ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{3}pt% \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto@rel} \fi -} +}% @@ -453,7 +453,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@smooth} -} +}% \def\pgf@lib@svg@quad@curveto@smooth{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -485,14 +485,14 @@ % Go on \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@smooth} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter t} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@rel@smooth} -} +}% \def\pgf@lib@svg@quad@curveto@rel@smooth{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -524,7 +524,7 @@ % Go on \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@rel@smooth} \fi -} +}% @@ -534,7 +534,7 @@ { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto} -} +}% \def\pgf@lib@svg@arcto{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -553,13 +553,13 @@ % Go on \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto} \fi -} +}% \pgfparserdef{svgpath}{all}{the letter a} { \pgf@lib@svg@finish@prev \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto@rel} -} +}% \def\pgf@lib@svg@arcto@rel{% \ifnum\pgf@lib@svg@count=0\relax% nothing read @@ -578,7 +578,7 @@ % Go on \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto@rel} \fi -} +}% @@ -590,7 +590,7 @@ { \pgf@lib@svg@finish@prev \pgfparserswitch{final} -} +}% @@ -610,26 +610,26 @@ \fi #2 } -} +}% -\def\pgf@lib@svg@get@num#1{\csname pgf@lib@svg@num@#1\endcsname} +\def\pgf@lib@svg@get@num#1{\csname pgf@lib@svg@num@#1\endcsname}% \pgfparserdef{svgpath}{num}{the character ,} { \pgf@lib@svg@handle@spacer -} +}% \pgfparserdef{svgpath}{num}{\meaning\pgfutil@sptoken} { \pgf@lib@svg@handle@spacer -} +}% \pgfparserdef{svgpath}{num}{the character -} { \pgf@lib@svg@handle@spacer \def\pgf@lib@svg@num{-}% -} +}% \def\pgf@lib@svg@handle@spacer{ \ifx\pgf@lib@svg@num\pgfutil@empty% @@ -642,44 +642,40 @@ \fi \let\pgf@lib@svg@num=\pgfutil@empty% \fi -} +}% % Handle digits \pgfparserdef{svgpath}{all}{the character .} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num.}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num.}}% \pgfparserdef{svgpath}{all}{the character 0} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num0}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num0}}% \pgfparserdef{svgpath}{all}{the character 1} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num1}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num1}}% \pgfparserdef{svgpath}{all}{the character 2} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num2}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num2}}% \pgfparserdef{svgpath}{all}{the character 3} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num3}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num3}}% \pgfparserdef{svgpath}{all}{the character 4} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num4}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num4}}% \pgfparserdef{svgpath}{all}{the character 5} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num5}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num5}}% \pgfparserdef{svgpath}{all}{the character 6} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num6}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num6}}% \pgfparserdef{svgpath}{all}{the character 7} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num7}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num7}}% \pgfparserdef{svgpath}{all}{the character 8} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num8}} +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num8}}% \pgfparserdef{svgpath}{all}{the character 9} -{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num9}} - - - - +{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num9}}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytimelines.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytimelines.code.tex new file mode 100644 index 00000000000..dd9b38fdc46 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytimelines.code.tex @@ -0,0 +1,197 @@ +% Copyright 2015 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{pgflibrarytimelines.code.tex} + + +% We need the animation module: + +\usepgfmodule{animations}% + + +% Starts a fixed timeline +% +% Description: +% +% A (fixed) timeline defines for a specific number of seconds how a +% different objects are animated. In contrast to a dynamic timeline, +% the animation must be fixed beforehand, that is, in a fixed timeline +% you can specify things like "be there after 2s and there after 4s +% and be red after 5s" but not "be there after that other animation +% has finished and then stay there until another animation has +% finished or something has been clicked". Note that while a fixed +% timeline describes a fixed sequence of animations, the starting +% point of the timeline may depend for instance on when some button is +% clicked; only when the timeline's animation gets started there is +% nothing dynamic about it till its end (a timeline may be ended +% prematurely, however). +% +% This command allows you to start a timeline. Once the timeline has +% been started, you can call the following macro repeatedly: +% +% \pgftimelineentry{time}{object}{attribute}{value} +% +% The time is some time when the given attribute should have the given +% value. The important thing is that the entries need not come in any +% specific order; it is the job of the timeline library to sort them +% into a sensible order. +% +% At the end of the timeline, you will have specified for a whole +% bunch of objects and attributes their values at certain time +% points. The macro \pgftimelineend will now call \pgfanimateattribute +% for all attributes and objects mentioned in the timeline. +% +% +% Internally, pgf keeps track of all objects in a timeline and all +% attributes and sorts the times using a simple insertion sort (which +% will be fastest when the times are given in increasing order as +% happens most of the time). + +\def\pgftimelinebegin{% + \pgf@timeline@todo@saved=\pgf@timeline@todo% + \begingroup% + \advance\pgf@timeline@depth by1\relax% + \pgf@timeline@todo{}% +}% + +\newcount\pgf@timeline@depth +\newtoks\pgf@timeline@todo +\newtoks\pgf@timeline@todo@saved + + +% Ends a timeline +% +% Description: +% +% This command will scan \pgfanimateattribute for the objects and +% attributes mentioned in the timeline. + +\def\pgftimelineend{% + \the\pgf@timeline@todo% + \endgroup% + \global\pgf@timeline@todo=\pgf@timeline@todo@saved% +}% + + +% Adds an entry to a timeline +% +% #1 = a time (evaluated using \pgfparsetime) +% #2 = an object (a "whom" in the sense of pgfmoduleanimations, will +% be expanded) +% #3 = an attribute (in the sense of pgfmoduleanimations, will be expanded) +% #4 = a value +% +% Description: +% +% Adds a new entry to the timeline. For a fixed #1, several calls to +% this macro allow you to specify a key frame by specifying the +% different values of the different attributes of the different +% objects in the key frame. + +\def\pgftimelineentry#1#2#3#4{% + \begingroup% + \pgfparsetime{#1}% + \edef\pgf@timeline@whom{#2}% + \edef\pgf@timeline@attr{#3}% + \expandafter\let\expandafter\pgf@timeline@entry\csname pgf@tl@\pgf@timeline@whom @\pgf@timeline@attr @\the\pgf@timeline@depth\endcsname% + \ifx\pgf@timeline@entry\relax% + \edef\pgf@timeline@entry{\noexpand\pgf@timeline@setup{\pgf@timeline@whom}{\pgf@timeline@attr}}% + \fi% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@timeline@entry\expandafter\expandafter\expandafter% + {\expandafter\pgf@timeline@entry\expandafter\pgf@timeline@doentry\expandafter{\pgftimeresult}{#4}}% + \expandafter\global\expandafter\let\csname pgf@tl@\pgf@timeline@whom @\pgf@timeline@attr @\the\pgf@timeline@depth\endcsname\pgf@timeline@entry% + \global\pgf@timeline@todo\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgf@timeline@todo\expandafter\pgf@timeline@handle\csname pgf@tl@\pgf@timeline@whom @\pgf@timeline@attr @\the\pgf@timeline@depth\endcsname}% + \endgroup% +}% + + +\newtoks\pgf@timeline@sort@toks +\countdef\pgf@timeline@sort@count=0\relax% +\countdef\pgf@timeline@count@down=1\relax% +\countdef\pgf@timeline@count@down@next=2\relax% + +% Handles one entry in a timeline + +\def\pgf@timeline@handle#1{% + \ifx#1\relax% + \else% + % Do an inserting sort. The time is kept in the dimension registers + % 1 to n, the value in the token registers 1 to n. + {% + \pgf@timeline@sort@count=1\relax% + #1% will start a group + % Now we collect the toks: + \pgf@timeline@count@down=1\relax% + \pgf@timeline@sort@toks{}% + \pgfutil@loop% + \ifnum\pgf@timeline@count@down<\pgf@timeline@sort@count\relax% + \edef\pgf@temp{\the\pgf@timeline@sort@toks\noexpand\pgf@timeline@donow{\the\dimen\pgf@timeline@count@down}{\the\toks\pgf@timeline@count@down}}% + \pgf@timeline@sort@toks\expandafter{\pgf@temp}% + \advance\pgf@timeline@count@down by1\relax% + \pgfutil@repeat% + % Do computations now + \pgf@timeline@compute@duration% + % + \edef\pgf@temp{\noexpand\pgf@timeline@call@attribute{\pgf@timeline@whom}{\pgf@timeline@attr}{\the\pgf@timeline@sort@toks}} + \expandafter% + \endgroup% + \pgf@temp% + }% + \global\let#1\relax% cleanup + \fi% +}% + +\def\pgf@timeline@compute@duration{% + \advance\pgf@timeline@sort@count by-1\relax% + \pgfmathparse{\the\dimen\pgf@timeline@sort@count}% + \global\let\pgf@timeline@duration\pgfmathresult% +}% + + +\def\pgf@timeline@setup#1#2{% + \def\pgf@timeline@whom{#1}% + \def\pgf@timeline@attr{#2}% + \begingroup% +}% + +\def\pgf@timeline@doentry#1#2{% + \dimen\pgf@timeline@sort@count=#1pt\relax% + \toks\pgf@timeline@sort@count{#2}% + \pgf@timeline@count@down\pgf@timeline@sort@count\relax% + \pgfutil@loop% + \ifnum\pgf@timeline@count@down>1\relax% + \pgf@timeline@count@down@next\pgf@timeline@count@down% + \advance\pgf@timeline@count@down@next by-1\relax% + \ifdim\dimen\pgf@timeline@count@down<\dimen\pgf@timeline@count@down@next\relax% + % Swap: + \toks0=\toks\pgf@timeline@count@down% + \dimen0=\dimen\pgf@timeline@count@down% + \toks\pgf@timeline@count@down=\toks\pgf@timeline@count@down@next% + \dimen\pgf@timeline@count@down=\dimen\pgf@timeline@count@down@next% + \toks\pgf@timeline@count@down@next=\toks0\relax% + \dimen\pgf@timeline@count@down@next=\dimen0\relax% + \pgf@timeline@count@down\pgf@timeline@count@down@next\relax% + \else% + \pgf@timeline@count@down1\relax% + \fi% + \pgfutil@repeat% + \advance\pgf@timeline@sort@count by1\relax% +}% + + +\def\pgf@timeline@call@attribute#1#2#3{% + \pgfanimateattributecode{#2}{\pgfkeys{/pgf/animation/whom={#1},/pgf/animation/duration=\pgf@timeline@duration}#3}% +}% + +\def\pgf@timeline@donow#1#2{% + \pgfkeys{/pgf/animation/key time={#1/\pgf@timeline@duration}}% + \pgfkeys{/pgf/animation/value={#2}}% +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex index e79634a06ea..62b1a260299 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex @@ -13,20 +13,20 @@ % \pgfdeclareshape{var resistor IEC} -{ - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] +{% + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -54,9 +54,9 @@ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yc}}% \pgfutil@repeat% \advance\pgf@xb by-.1pt% - \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% - } -} + \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% + }% +}% @@ -65,7 +65,7 @@ % \pgfdeclareshape{inductor IEC} -{ +{% \savedanchor\northeast{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -75,7 +75,7 @@ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=\pgf@ya% \advance\pgf@y by\pgf@yb% - } + }% \savedanchor\southwest{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -83,19 +83,19 @@ \advance\pgf@x by -.5\pgf@xb% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% \pgf@y=-\pgf@ya% - } - - \anchor{center}{\pgfpointorigin} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} + }% + + \anchor{center}{\pgfpointorigin}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% \anchorborder{% \ifdim\pgf@y<0pt% @@ -112,8 +112,8 @@ \pgf@yc=\pgf@y% \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}% \fi% - } - + }% + \backgroundpath{ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}} \pgf@xa=-\pgf@x \pgf@ya=0pt @@ -127,12 +127,12 @@ \pgfutil@loop% \advance\pgf@xa by2\pgf@xc\relax% \ifdim\pgf@xa<\pgf@xb% - \pgfpatharc{180}{0}{\pgf@xc}% + \pgfpatharc{180}{0}{\pgf@xc}% \pgfutil@repeat% \advance\pgf@xb by-.1pt% - \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}% - } -} + \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}% + }% +}% @@ -142,20 +142,20 @@ % \pgfdeclareshape{capacitor IEC} -{ - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] +{% + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -166,8 +166,8 @@ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}} \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% @@ -177,20 +177,20 @@ % \pgfdeclareshape{ground IEC} -{ - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] +{% + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -213,8 +213,8 @@ \advance\pgf@yb by-\pgf@yc \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% @@ -224,20 +224,20 @@ % \pgfdeclareshape{battery IEC} -{ - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] +{% + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -253,8 +253,8 @@ \advance\pgf@yb by-\pgf@yc \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% % @@ -263,20 +263,20 @@ \pgfdeclareshape{breakdown diode IEC} -{ - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] +{% + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -295,9 +295,9 @@ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} \pgfpathclose - } + }% + - \beforebackgroundpath{ { \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -311,7 +311,7 @@ \pgfusepathqstroke \pgf@xc=.5\pgf@xa \advance\pgf@xc by.5\pgf@xb - \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}} + \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}} \pgf@yc=.5\pgf@yb \advance\pgf@yc by-.5\pgf@ya \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}} @@ -321,8 +321,8 @@ \pgfpathlineto{\pgfqpoint{.5pt}{1pt}} \pgfusepathqstroke } - } -} + }% +}% @@ -339,7 +339,7 @@ \pgfdeclareshape{generic circle IEC} -{ +{% % This shape is a generic circle, to which you can add something to % the before background path using the key % /pgf/generic circle IEC/before background @@ -347,31 +347,31 @@ % setup such that the circle's center is at the origin and that the % position \pgfpoint{1pt}{0pt} lies exactly on the top of the circle % (and, there, on the middle of the line). - - \inheritsavedanchors[from=circle ee] - \inheritanchorborder[from=circle ee] - \inheritanchor[from=circle ee]{north} - \inheritanchor[from=circle ee]{north west} - \inheritanchor[from=circle ee]{north east} - \inheritanchor[from=circle ee]{center} - \inheritanchor[from=circle ee]{west} - \inheritanchor[from=circle ee]{east} - \inheritanchor[from=circle ee]{south} - \inheritanchor[from=circle ee]{south west} - \inheritanchor[from=circle ee]{south east} - \inheritanchor[from=circle ee]{input} - \inheritanchor[from=circle ee]{output} - \inheritbackgroundpath[from=circle ee] - + + \inheritsavedanchors[from=circle ee]% + \inheritanchorborder[from=circle ee]% + \inheritanchor[from=circle ee]{north}% + \inheritanchor[from=circle ee]{north west}% + \inheritanchor[from=circle ee]{north east}% + \inheritanchor[from=circle ee]{center}% + \inheritanchor[from=circle ee]{west}% + \inheritanchor[from=circle ee]{east}% + \inheritanchor[from=circle ee]{south}% + \inheritanchor[from=circle ee]{south west}% + \inheritanchor[from=circle ee]{south east}% + \inheritanchor[from=circle ee]{input}% + \inheritanchor[from=circle ee]{output}% + \inheritbackgroundpath[from=circle ee]% + \beforebackgroundpath{ { \centerpoint% \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% - \pgftransformshift{} + \pgftransformshift{} \pgfutil@tempdima=\radius% - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \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% @@ -380,8 +380,8 @@ \pgftransformscale{\pgf@sys@tonumber{\pgfutil@tempdima}} \pgfkeysvalueof{/pgf/generic circle IEC/before background} } - } -} + }% +}% @@ -390,28 +390,28 @@ % \pgfdeclareshape{generic diode IEC} -{ +{% % This shape is a generic diode, to which you can add something to % the before background path using the key % /pgf/generic diode IEC/before background % When this key is invoked, the transformation matrix will have been - % setup such that the center is at the tip of the diode. The + % setup such that the center is at the tip of the diode. The % position \pgfpoint{1pt}{0pt} lies exactly on the top of the - % (suggested) line before the diode. - - \inheritsavedanchors[from=rectangle ee] - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] + % (suggested) line before the diode. + + \inheritsavedanchors[from=rectangle ee]% + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \backgroundpath{ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -427,9 +427,9 @@ \advance\pgf@yc by .5\pgf@yb \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}} \pgfpathclose - } + }% + - \beforebackgroundpath{ { \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} @@ -441,31 +441,31 @@ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}} \pgfusepathqstroke - \pgftransformshift{\pgfqpoint{\pgf@xb}{\pgf@yc}} + \pgftransformshift{\pgfqpoint{\pgf@xb}{\pgf@yc}} \pgf@yc=.5\pgf@yb \advance\pgf@yc by-.5\pgf@ya \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}} \pgfkeysvalueof{/pgf/generic diode IEC/before background} } - } -} + }% +}% \pgfkeys{ /pgf/generic circle IEC/before background/.initial=, /pgf/generic diode IEC/before background/.initial=, -} +}% % -% Concacts +% Contacts % \pgfdeclareshape{make contact IEC} -{ +{% \savedanchor\northeast{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -475,7 +475,7 @@ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=\pgf@ya% \advance\pgf@y by\pgf@yb% - } + }% \savedanchor\southwest{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -483,23 +483,23 @@ \advance\pgf@x by -.5\pgf@xb% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% \pgf@y=-\pgf@ya% - } - - \anchor{center}{\pgfpointorigin} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} + }% + + \anchor{center}{\pgfpointorigin}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% \anchorborder{% \ifdim\pgf@y<0pt% - % tricky... simpilfy to the origin... + % tricky... simplify to the origin... \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% \pgf@process{\southwest}% @@ -512,8 +512,8 @@ \pgf@yc=\pgf@y% \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}% \fi% - } - + }% + \backgroundpath{ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}} \pgf@xa=-\pgf@x \pgf@ya=0pt @@ -521,17 +521,17 @@ % Start point \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% % -% Concacts +% Contacts % \pgfdeclareshape{var make contact IEC} -{ +{% \savedanchor\northeast{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -541,7 +541,7 @@ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=\pgf@ya% \advance\pgf@y by\pgf@yb% - } + }% \savedanchor\southwest{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -551,23 +551,23 @@ \pgf@y=-\pgf@ya% \pgf@xc=0.083333\pgf@x% \advance\pgf@y by\pgf@xc% - } - - \anchor{center}{\pgfpointorigin} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} + }% + + \anchor{center}{\pgfpointorigin}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% \anchorborder{% \ifdim\pgf@y<0pt% - % tricky... simpilfy to the origin... + % tricky... simplify to the origin... \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% \pgf@process{\southwest}% @@ -579,8 +579,8 @@ \pgf@yc=\pgf@y% \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}% \fi% - } - + }% + \backgroundpath{ \pgf@process{\pgfpointadd{\northeast}{ \pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}} @@ -600,13 +600,13 @@ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xa}{0pt}}{% \pgfpointscale{\pgfutil@tempdima}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% \pgfdeclareshape{break contact IEC} -{ +{% \savedanchor\northeast{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -616,7 +616,7 @@ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=\pgf@ya% \advance\pgf@y by\pgf@yb% - } + }% \savedanchor\southwest{% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% @@ -624,23 +624,23 @@ \advance\pgf@x by -.5\pgf@xb% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% \pgf@y=-\pgf@ya% - } - - \anchor{center}{\pgfpointorigin} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} + }% + + \anchor{center}{\pgfpointorigin}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% \anchorborder{% \ifdim\pgf@y<0pt% - % tricky... simpilfy to the origin... + % tricky... simplify to the origin... \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% \pgf@process{\southwest}% @@ -653,8 +653,8 @@ \pgf@yc=\pgf@y% \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}% \fi% - } - + }% + \backgroundpath{ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}} \pgf@xa=-\pgf@x \pgf@ya=0pt @@ -669,12 +669,11 @@ \advance\pgf@xb by-\pgf@xc \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} - } -} + }% +}% \endinput - diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex index 30ecbff3c4d..4cfa4eed7d6 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex @@ -16,25 +16,25 @@ % and an "output" anchor have been added at the left and right end. \pgfdeclareshape{rectangle ee} -{ - \inheritsavedanchors[from=rectangle] - \inheritanchorborder[from=rectangle] - \inheritanchor[from=rectangle]{north} - \inheritanchor[from=rectangle]{north west} - \inheritanchor[from=rectangle]{north east} - \inheritanchor[from=rectangle]{center} - \inheritanchor[from=rectangle]{west} - \inheritanchor[from=rectangle]{east} - \inheritanchor[from=rectangle]{mid} - \inheritanchor[from=rectangle]{mid west} - \inheritanchor[from=rectangle]{mid east} - \inheritanchor[from=rectangle]{base} - \inheritanchor[from=rectangle]{base west} - \inheritanchor[from=rectangle]{base east} - \inheritanchor[from=rectangle]{south} - \inheritanchor[from=rectangle]{south west} - \inheritanchor[from=rectangle]{south east} - \inheritbackgroundpath[from=rectangle] +{% + \inheritsavedanchors[from=rectangle]% + \inheritanchorborder[from=rectangle]% + \inheritanchor[from=rectangle]{north}% + \inheritanchor[from=rectangle]{north west}% + \inheritanchor[from=rectangle]{north east}% + \inheritanchor[from=rectangle]{center}% + \inheritanchor[from=rectangle]{west}% + \inheritanchor[from=rectangle]{east}% + \inheritanchor[from=rectangle]{mid}% + \inheritanchor[from=rectangle]{mid west}% + \inheritanchor[from=rectangle]{mid east}% + \inheritanchor[from=rectangle]{base}% + \inheritanchor[from=rectangle]{base west}% + \inheritanchor[from=rectangle]{base east}% + \inheritanchor[from=rectangle]{south}% + \inheritanchor[from=rectangle]{south west}% + \inheritanchor[from=rectangle]{south east}% + \inheritbackgroundpath[from=rectangle]% % New: \anchor{input}{ \pgf@process{\northeast}% @@ -42,57 +42,57 @@ \pgf@process{\southwest}% \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% - } + }% \anchor{output}{% \pgf@process{\southwest}% \pgf@ya=.5\pgf@y% \pgf@process{\northeast}% \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% - } -} + }% +}% \pgfdeclareshape{circle ee} -{ - \inheritsavedanchors[from=circle] - \inheritanchorborder[from=circle] - \inheritanchor[from=circle]{north} - \inheritanchor[from=circle]{north west} - \inheritanchor[from=circle]{north east} - \inheritanchor[from=circle]{center} - \inheritanchor[from=circle]{west} - \inheritanchor[from=circle]{east} - \inheritanchor[from=circle]{mid} - \inheritanchor[from=circle]{mid west} - \inheritanchor[from=circle]{mid east} - \inheritanchor[from=circle]{base} - \inheritanchor[from=circle]{base west} - \inheritanchor[from=circle]{base east} - \inheritanchor[from=circle]{south} - \inheritanchor[from=circle]{south west} - \inheritanchor[from=circle]{south east} - \inheritbackgroundpath[from=circle] +{% + \inheritsavedanchors[from=circle]% + \inheritanchorborder[from=circle]% + \inheritanchor[from=circle]{north}% + \inheritanchor[from=circle]{north west}% + \inheritanchor[from=circle]{north east}% + \inheritanchor[from=circle]{center}% + \inheritanchor[from=circle]{west}% + \inheritanchor[from=circle]{east}% + \inheritanchor[from=circle]{mid}% + \inheritanchor[from=circle]{mid west}% + \inheritanchor[from=circle]{mid east}% + \inheritanchor[from=circle]{base}% + \inheritanchor[from=circle]{base west}% + \inheritanchor[from=circle]{base east}% + \inheritanchor[from=circle]{south}% + \inheritanchor[from=circle]{south west}% + \inheritanchor[from=circle]{south east}% + \inheritbackgroundpath[from=circle]% % New: - \anchor{input}{\centerpoint\advance\pgf@x by-\radius} - \anchor{output}{\centerpoint\advance\pgf@x by\radius} -} + \anchor{input}{\centerpoint\advance\pgf@x by-\radius}% + \anchor{output}{\centerpoint\advance\pgf@x by\radius}% +}% % % Current direction indicator. This shape uses the current setting of % the current direction arrow tip for the arrow. The shape is a -% rectangle around the arrow tip. +% rectangle around the arrow tip. % \pgfdeclareshape{direction ee} -{ +{% \savedanchor\northeast{ \pgf@x=0pt% % Height is given by minimum height/2 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=.5\pgf@y - } + }% \savedanchor\southwest{ % Left border is given by left extend \pgfarrowtotallength{\pgfkeysvalueof{/pgf/direction ee arrow}}% @@ -100,20 +100,20 @@ % Height is given by minimum height/2 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=-.5\pgf@y - } - - \inheritanchor[from=rectangle ee]{center} - \inheritanchor[from=rectangle ee]{north} - \inheritanchor[from=rectangle ee]{south} - \inheritanchor[from=rectangle ee]{east} - \inheritanchor[from=rectangle ee]{west} - \inheritanchor[from=rectangle ee]{north east} - \inheritanchor[from=rectangle ee]{north west} - \inheritanchor[from=rectangle ee]{south east} - \inheritanchor[from=rectangle ee]{south west} - \inheritanchor[from=rectangle ee]{input} - \inheritanchor[from=rectangle ee]{output} - \inheritanchorborder[from=rectangle ee] + }% + + \inheritanchor[from=rectangle ee]{center}% + \inheritanchor[from=rectangle ee]{north}% + \inheritanchor[from=rectangle ee]{south}% + \inheritanchor[from=rectangle ee]{east}% + \inheritanchor[from=rectangle ee]{west}% + \inheritanchor[from=rectangle ee]{north east}% + \inheritanchor[from=rectangle ee]{north west}% + \inheritanchor[from=rectangle ee]{south east}% + \inheritanchor[from=rectangle ee]{south west}% + \inheritanchor[from=rectangle ee]{input}% + \inheritanchor[from=rectangle ee]{output}% + \inheritanchorborder[from=rectangle ee]% \nodeparts{}% no text \behindbackgroundpath{ @@ -124,7 +124,7 @@ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}} \pgfusepathqstroke - } + }% \beforebackgroundpath{ { @@ -132,19 +132,19 @@ \pgfarrowdraw{\pgfkeysvalueof{/pgf/direction ee arrow}}% \pgfsys@endscope } - } -} + }% +}% \pgfkeys{ /pgf/direction ee arrow/.initial=direction ee, -} +}% % Special arrow for ee directions: \pgfarrowsdeclare{direction ee}{direction ee} -{ +{% \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}% \pgfutil@tempdima=.5\pgfutil@tempdima \pgfarrowsleftextend{+-\pgfutil@tempdima} @@ -159,13 +159,12 @@ \pgfpathlineto{\pgfqpoint{-0.5\pgfutil@tempdima}{-0.38268343237\pgfutil@tempdima}} \pgfpathclose \pgfusepathqfillstroke -} +}% -\pgfsetarrowoptions{direction ee}{4pt} +\pgfsetarrowoptions{direction ee}{4pt}% \endinput - diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex index e137e113cdc..9b964996d70 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgflibrary{shapes.gates.logic} +\usepgflibrary{shapes.gates.logic}% \pgfkeys{/pgf/.cd, and gate IEC symbol/.initial=$\char`\&$, @@ -20,14 +20,14 @@ buffer gate IEC symbol/.initial=1, logic gate IEC symbol align/.initial=top, logic gate IEC symbol color/.initial=% no value -} +}% \pgfkeys{/pgf/logic gate IEC symbol align/.cd, top/.code=\pgftransformyshift{\innerhalfheight}, bottom/.code=\pgftransformyshift{-\innerhalfheight}, left/.code=\pgftransformxshift{-\innerhalfwidth}, - right/.code=\pgftransformxshift{\innerhalfwidth} -} + right/.code=\pgftransformxshift{\innerhalfwidth}, +}% \def\pgf@lib@sh@logicgates@IEC@foregroundpath#1{% \dimensions% @@ -45,7 +45,7 @@ \pgfkeysvalueof{/pgf/#1 gate IEC symbol}% }% }% -} +}% \def\pgf@lib@sh@logicgates@dimensions@IEC#1{% @@ -135,13 +135,13 @@ \multiply\pgfutil@tempdima#1\relax% \advance\pgf@y\halfheight% \advance\pgf@y-\pgfutil@tempdima% -} +}% % Shape and gate IEC % -\pgfdeclareshape{and gate IEC}{ +\pgfdeclareshape{and gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. % @@ -165,25 +165,25 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{and}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } + }% \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint} + \anchor{mid}{\midpoint}% \anchor{mid west}{% \dimensions% \midpoint% @@ -192,7 +192,7 @@ \dimensions% \midpoint% \advance\pgf@x\halfwidth}% - \anchor{base}{\basepoint} + \anchor{base}{\basepoint}% \anchor{base west}{% \dimensions% \basepoint% @@ -209,7 +209,7 @@ \anchor{north west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y\halfheight}% \anchor{south east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y-\halfheight}% \anchor{south west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y-\halfheight}% - \anchor{output}{\dimensions\centerpoint\advance\pgf@x\halfwidth} + \anchor{output}{\dimensions\centerpoint\advance\pgf@x\halfwidth}% \backgroundpath{% \dimensions% \pgf@xc\halfwidth% @@ -241,19 +241,19 @@ \advance\pgf@yc-\pgfutil@tempdima% \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% {% - \pgfpathcircle{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\invertedradius}% + \pgfpathcircle{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\invertedradius}% }% \fi% \repeatpgfmathloop% }% - } - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{and}} + }% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{and}}% \anchorborder{% \pgfextract@process\externalpoint{}% \dimensions% \pgfpointadd{\centerpoint}{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}% - }% -} + }% +}% @@ -261,7 +261,7 @@ % Shape nand gate IEC % -\pgfdeclareshape{nand gate IEC}{ +\pgfdeclareshape{nand gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. % @@ -285,43 +285,43 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{nand}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% \anchor{output}{% \csname pgf@anchor@and gate IEC@east\endcsname% \advance\pgf@x\invertedradius% \advance\pgf@x\outerinvertedradius% - } + }% \backgroundpath{% \csname pgf@sh@bg@and gate IEC\endcsname% \pgfpathcircle{% @@ -329,10 +329,10 @@ \advance\pgf@x\halfwidth% \advance\pgf@x\invertedradius% }{+\invertedradius}% - } - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nand}} - \inheritanchorborder[from=and gate IEC] -} + }% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nand}}% + \inheritanchorborder[from=and gate IEC]% +}% @@ -340,7 +340,7 @@ % Shape or gate IEC % -\pgfdeclareshape{or gate IEC}{ +\pgfdeclareshape{or gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. % @@ -364,43 +364,43 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{or}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{or}} - \inheritanchorborder[from=and gate IEC] -} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=and gate IEC]{output}% + \inheritbackgroundpath[from=and gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{or}}% + \inheritanchorborder[from=and gate IEC]% +}% @@ -408,7 +408,7 @@ % Shape nor gate IEC % -\pgfdeclareshape{nor gate IEC}{ +\pgfdeclareshape{nor gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. % @@ -432,43 +432,43 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{nor}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output}% - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nor}} - \inheritanchorborder[from=and gate IEC] -} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=nand gate IEC]{output}%% + \inheritbackgroundpath[from=nand gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nor}}% + \inheritanchorborder[from=and gate IEC]% +}% @@ -476,7 +476,7 @@ % Shape xor gate IEC % -\pgfdeclareshape{xor gate IEC}{ +\pgfdeclareshape{xor gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{2}% Maximum 1024 (!) inputs. % @@ -500,43 +500,43 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{xor}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xor}} - \inheritanchorborder[from=and gate IEC] -} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=and gate IEC]{output}% + \inheritbackgroundpath[from=and gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xor}}% + \inheritanchorborder[from=and gate IEC]% +}% @@ -544,7 +544,7 @@ % Shape xnor gate IEC % -\pgfdeclareshape{xnor gate IEC}{ +\pgfdeclareshape{xnor gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. % @@ -568,50 +568,50 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{xnor}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output} - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xnor}} - \inheritanchorborder[from=and gate IEC] -} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=nand gate IEC]{output}% + \inheritbackgroundpath[from=nand gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xnor}}% + \inheritanchorborder[from=and gate IEC]% +}% % Shape buffer gate IEC % -\pgfdeclareshape{buffer gate IEC}{ +\pgfdeclareshape{buffer gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1}% Maximum 1 input. % @@ -629,43 +629,43 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{xor}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{buffer}} - \inheritanchorborder[from=and gate IEC] -} + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=and gate IEC]{output}% + \inheritbackgroundpath[from=and gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{buffer}}% + \inheritanchorborder[from=and gate IEC]% +}% @@ -673,7 +673,7 @@ % Shape not gate IEC % -\pgfdeclareshape{not gate IEC}{ +\pgfdeclareshape{not gate IEC}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate IEC\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1}% % @@ -692,42 +692,42 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } + }% \savedmacro\dimensions{% \pgf@lib@sh@logicgates@dimensions@IEC{not}% - } + }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output} - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{not}} - \inheritanchorborder[from=and gate IEC] -} - -\endinput
\ No newline at end of file + }% + \inheritanchor[from=and gate IEC]{center}% + \inheritanchor[from=and gate IEC]{mid}% + \inheritanchor[from=and gate IEC]{mid west}% + \inheritanchor[from=and gate IEC]{mid east}% + \inheritanchor[from=and gate IEC]{base}% + \inheritanchor[from=and gate IEC]{base west}% + \inheritanchor[from=and gate IEC]{base east}% + \inheritanchor[from=and gate IEC]{north}% + \inheritanchor[from=and gate IEC]{south}% + \inheritanchor[from=and gate IEC]{east}% + \inheritanchor[from=and gate IEC]{west}% + \inheritanchor[from=and gate IEC]{north east}% + \inheritanchor[from=and gate IEC]{north west}% + \inheritanchor[from=and gate IEC]{south east}% + \inheritanchor[from=and gate IEC]{south west}% + \inheritanchor[from=nand gate IEC]{output}% + \inheritbackgroundpath[from=nand gate IEC]% + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{not}}% + \inheritanchorborder[from=and gate IEC]% +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex index f941abd2647..3a496324f81 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgflibrary{shapes.gates.logic} +\usepgflibrary{shapes.gates.logic}% \newif\ifpgfgateanchorsuseboundingrectangle% @@ -17,160 +17,160 @@ % \pgfkeys{ /pgf/logic gate anchors use bounding box/.is if=pgfgateanchorsuseboundingrectangle,% -} +}% -% An internal macro for calculating internal dimensions of +% An internal macro for calculating internal dimensions of % the US + CDH gates (excluding and gate US and nand gate US). % \def\pgf@lib@sh@logicgates@dimensions@orUS{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - % - % Adjust the height for the number of inputs. - % - \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% - \advance\c@pgf@counta1\relax% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@ya\pgflinewidth% - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}% - \pgf@yb.5\pgf@yb% - \ifdim\pgf@ya<\pgf@yb% - \pgf@ya\pgf@yb% - \fi% - \multiply\pgf@ya\c@pgf@counta% - \ifdim\pgf@y<\pgf@ya% - \pgf@y\pgf@ya% - \fi% - % - \ifdim\pgf@x>\pgf@y% - \pgf@y\pgf@x% - \else% - \pgf@x\pgf@y% - \fi% - % - % Adjust for minimum height and width. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<.5\pgf@ya% - \pgf@y.5\pgf@ya% - \fi% - \pgf@xb\pgf@x% - \advance\pgf@xb1.732051\pgf@y% 2y*cos(30) - \ifdim\pgf@xb<\pgf@xa% - \pgf@xb\pgf@xa% - \pgf@x0.366025\pgf@xb% xb / (1 + 2*cos(30)) - \fi% - % - \ifdim\pgf@x>\pgf@y% - \pgf@y\pgf@x% - \else% - \pgf@x\pgf@y% - \fi% - \edef\halfside{\the\pgf@x}% - \addtosavedmacro\halfside% - % - % Take into account the outer sep. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \edef\outerxsep{\the\pgf@xa}% - \edef\outerysep{\the\pgf@ya}% - \addtosavedmacro\outerxsep% - \addtosavedmacro\outerysep% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - % - \edef\halfwidth{\the\pgf@x}% - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfwidth% - \addtosavedmacro\halfheight% - % - \pgfextract@process\tipanchor{% - \advance\pgf@x-\pgf@xa% - \advance\pgf@y-\pgf@ya% - \pgf@x-.16666\pgf@x% - \pgf@yb2.0\pgf@y% - \advance\pgf@x.866025\pgf@yb% - \advance\pgf@x1.154701\pgf@xa% - \pgf@y0pt% - }% - \addtosavedmacro\tipanchor% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + % + % Adjust the height for the number of inputs. + % + \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% + \advance\c@pgf@counta1\relax% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@ya\pgflinewidth% + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}% + \pgf@yb.5\pgf@yb% + \ifdim\pgf@ya<\pgf@yb% + \pgf@ya\pgf@yb% + \fi% + \multiply\pgf@ya\c@pgf@counta% + \ifdim\pgf@y<\pgf@ya% + \pgf@y\pgf@ya% + \fi% + % + \ifdim\pgf@x>\pgf@y% + \pgf@y\pgf@x% + \else% + \pgf@x\pgf@y% + \fi% + % + % Adjust for minimum height and width. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \pgf@xb\pgf@x% + \advance\pgf@xb1.732051\pgf@y% 2y*cos(30) + \ifdim\pgf@xb<\pgf@xa% + \pgf@xb\pgf@xa% + \pgf@x0.366025\pgf@xb% xb / (1 + 2*cos(30)) + \fi% + % + \ifdim\pgf@x>\pgf@y% + \pgf@y\pgf@x% + \else% + \pgf@x\pgf@y% + \fi% + \edef\halfside{\the\pgf@x}% + \addtosavedmacro\halfside% + % + % Take into account the outer sep. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \edef\outerxsep{\the\pgf@xa}% + \edef\outerysep{\the\pgf@ya}% + \addtosavedmacro\outerxsep% + \addtosavedmacro\outerysep% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + % + \edef\halfwidth{\the\pgf@x}% + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfwidth% + \addtosavedmacro\halfheight% + % + \pgfextract@process\tipanchor{% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + \pgf@x-.16666\pgf@x% + \pgf@yb2.0\pgf@y% + \advance\pgf@x.866025\pgf@yb% + \advance\pgf@x1.154701\pgf@xa% + \pgf@y0pt% + }% + \addtosavedmacro\tipanchor% }% -% An internal macro for calculating internal dimensions of +% An internal macro for calculating internal dimensions of % the and gate US and nand gate US. % \def\pgf@lib@sh@logicgates@dimensions@andUS{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - % - % Adjust the height for the number of inputs. - % - \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% - \advance\c@pgf@counta1\relax% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@ya\pgflinewidth% - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}% - \pgf@yb.5\pgf@yb% - \ifdim\pgf@ya<\pgf@yb% - \pgf@ya\pgf@yb% - \fi% - \multiply\pgf@ya\c@pgf@counta% - \ifdim\pgf@y<\pgf@ya% - \pgf@y\pgf@ya% - \fi% - % - \ifdim\pgf@x>\pgf@y% - \pgf@y\pgf@x% - \else% - \pgf@x\pgf@y% - \fi% - % - % Adjust for minimum height and width. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<.5\pgf@ya% - \pgf@y.5\pgf@ya% - \fi% - \pgf@xb2.5\pgf@x% - \ifdim\pgf@xb<\pgf@xa% - \pgf@xb\pgf@xa% - \pgf@x0.4\pgf@xb% - \fi% - % - \ifdim\pgf@x>\pgf@y% - \pgf@y\pgf@x% - \else% - \pgf@x\pgf@y% - \fi% - \edef\halfside{\the\pgf@x}% - \addtosavedmacro\halfside% - % - % Take into account the outer sep. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \edef\outerxsep{\the\pgf@xa}% - \edef\outerysep{\the\pgf@ya}% - \addtosavedmacro\outerxsep% - \addtosavedmacro\outerysep% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - % - \edef\halfwidth{\the\pgf@x}% - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfwidth% - \addtosavedmacro\halfheight% - % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + % + % Adjust the height for the number of inputs. + % + \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% + \advance\c@pgf@counta1\relax% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@ya\pgflinewidth% + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate input sep}}% + \pgf@yb.5\pgf@yb% + \ifdim\pgf@ya<\pgf@yb% + \pgf@ya\pgf@yb% + \fi% + \multiply\pgf@ya\c@pgf@counta% + \ifdim\pgf@y<\pgf@ya% + \pgf@y\pgf@ya% + \fi% + % + \ifdim\pgf@x>\pgf@y% + \pgf@y\pgf@x% + \else% + \pgf@x\pgf@y% + \fi% + % + % Adjust for minimum height and width. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \pgf@xb2.5\pgf@x% + \ifdim\pgf@xb<\pgf@xa% + \pgf@xb\pgf@xa% + \pgf@x0.4\pgf@xb% + \fi% + % + \ifdim\pgf@x>\pgf@y% + \pgf@y\pgf@x% + \else% + \pgf@x\pgf@y% + \fi% + \edef\halfside{\the\pgf@x}% + \addtosavedmacro\halfside% + % + % Take into account the outer sep. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \edef\outerxsep{\the\pgf@xa}% + \edef\outerysep{\the\pgf@ya}% + \addtosavedmacro\outerxsep% + \addtosavedmacro\outerysep% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + % + \edef\halfwidth{\the\pgf@x}% + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfwidth% + \addtosavedmacro\halfheight% + % }% @@ -178,25 +178,25 @@ % both and gates and nand gates, and also the not gate and buffer. % \def\pgf@lib@sh@logicgate@AND@inputanchor#1{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-.166666\pgf@xa% - \advance\pgf@x-\halfwidth% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% - \advance\pgf@x-\invertedradius% - \advance\pgf@x-\outerinvertedradius% - \fi% - % - \pgfutil@tempdima\halfside% - \multiply\pgfutil@tempdima2\relax% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \multiply\pgfutil@tempdima#1\relax% - \advance\pgf@y\halfside% - \advance\pgf@y-\pgfutil@tempdima% -} + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-.166666\pgf@xa% + \advance\pgf@x-\halfwidth% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% + \advance\pgf@x-\invertedradius% + \advance\pgf@x-\outerinvertedradius% + \fi% + % + \pgfutil@tempdima\halfside% + \multiply\pgfutil@tempdima2\relax% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \multiply\pgfutil@tempdima#1\relax% + \advance\pgf@y\halfside% + \advance\pgf@y-\pgfutil@tempdima% +}% @@ -204,235 +204,235 @@ % Shape and gate US % \pgfdeclareshape{and gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@and gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@and gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{An and gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \csname pgf@anchor@and gate US@east\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{mid west}{% - \csname pgf@anchor@and gate US@west\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{base}{\basepoint}% - \anchor{base east}{% - \csname pgf@anchor@and gate US@east\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{base west}{% - \csname pgf@anchor@and gate US@west\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{east}{% - \dimensions% - \pgf@xa\halfwidth% - \pgf@xb\pgf@xa% - \advance\pgf@xb-\outerxsep% - \centerpoint% - \advance\pgf@x.333333\pgf@xb% - \advance\pgf@x\pgf@xa% - } - \anchor{output}{\csname pgf@anchor@and gate US@east\endcsname} - \anchor{north east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@nand gate US@east\endcsname% - \advance\pgf@y\halfheight% - \else - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\pgf@xa% - \advance\pgf@xb-\outerxsep% - \centerpoint% - \advance\pgf@x.333333\pgf@xb% - \advance\pgf@x.707106\pgf@xa% - \advance\pgf@y.707106\pgf@ya% - \fi% - } - \anchor{south east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@nand gate US@east\endcsname% - \advance\pgf@y-\halfheight% - \else - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\pgf@xa% - \advance\pgf@xb-\outerxsep% - \centerpoint% - \advance\pgf@x.333333\pgf@xb% - \advance\pgf@x.707106\pgf@xa% - \advance\pgf@y-.707106\pgf@ya% - \fi% - } - \anchor{north}{% - \dimensions% - \centerpoint% - \advance\pgf@y\halfheight% - } - \anchor{south}{% - \dimensions% - \centerpoint% - \advance\pgf@y-\halfheight% - } - \anchor{south west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@y-\halfheight% - } - \anchor{north west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@y\halfheight% - } - \anchor{west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - } - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - \pgf@xb.333333\pgf@xc% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% - {% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% - \pgfpathclose% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@xa\halfside% - \pgf@x-1.16666\pgf@xa% - \advance\pgf@x-.5\pgflinewidth% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - }% - \anchorborder{% - \pgfextract@process\externalpoint{}% - \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - \dimensions% - \pgf@xb\halfside% - \pgf@xc1.66666\pgf@xb% - \advance\pgf@xc\outerxsep% - \pgf@yc\halfheight% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@north west\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@x.333333\pgf@xb% - }% - {0}{90}{+\halfwidth and +\halfheight}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}% - {\centerpoint\advance\pgf@x-\pgf@xc\advance\pgf@y\pgf@yc}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}% - \ifdim\externalangle pt>\pgfmathresult pt\relax% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@x.333333\pgf@xb% - }% - {270}{360}{+\halfwidth and +\halfheight}% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@south west\endcsname}% - \ifdim\externalangle pt>\pgfmathresult pt\relax% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}% - {\csname pgf@anchor@and gate US@south west\endcsname}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@and gate US@north west\endcsname}% - {\csname pgf@anchor@and gate US@south west\endcsname}% - \fi% - \fi% - \fi% - } -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@and gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@and gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An and gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \csname pgf@anchor@and gate US@east\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{mid west}{% + \csname pgf@anchor@and gate US@west\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \csname pgf@anchor@and gate US@east\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{base west}{% + \csname pgf@anchor@and gate US@west\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{east}{% + \dimensions% + \pgf@xa\halfwidth% + \pgf@xb\pgf@xa% + \advance\pgf@xb-\outerxsep% + \centerpoint% + \advance\pgf@x.333333\pgf@xb% + \advance\pgf@x\pgf@xa% + }% + \anchor{output}{\csname pgf@anchor@and gate US@east\endcsname}% + \anchor{north east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@nand gate US@east\endcsname% + \advance\pgf@y\halfheight% + \else + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\pgf@xa% + \advance\pgf@xb-\outerxsep% + \centerpoint% + \advance\pgf@x.333333\pgf@xb% + \advance\pgf@x.707106\pgf@xa% + \advance\pgf@y.707106\pgf@ya% + \fi% + }% + \anchor{south east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@nand gate US@east\endcsname% + \advance\pgf@y-\halfheight% + \else + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\pgf@xa% + \advance\pgf@xb-\outerxsep% + \centerpoint% + \advance\pgf@x.333333\pgf@xb% + \advance\pgf@x.707106\pgf@xa% + \advance\pgf@y-.707106\pgf@ya% + \fi% + }% + \anchor{north}{% + \dimensions% + \centerpoint% + \advance\pgf@y\halfheight% + }% + \anchor{south}{% + \dimensions% + \centerpoint% + \advance\pgf@y-\halfheight% + }% + \anchor{south west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@y-\halfheight% + }% + \anchor{north west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@y\halfheight% + }% + \anchor{west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + }% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + \pgf@xb.333333\pgf@xc% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% + {% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% + \pgfpathclose% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@xa\halfside% + \pgf@x-1.16666\pgf@xa% + \advance\pgf@x-.5\pgflinewidth% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \dimensions% + \pgf@xb\halfside% + \pgf@xc1.66666\pgf@xb% + \advance\pgf@xc\outerxsep% + \pgf@yc\halfheight% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@north west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@x.333333\pgf@xb% + }% + {0}{90}{+\halfwidth and +\halfheight}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y\pgf@yc}% + {\centerpoint\advance\pgf@x-\pgf@xc\advance\pgf@y\pgf@yc}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@x.333333\pgf@xb% + }% + {270}{360}{+\halfwidth and +\halfheight}% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@and gate US@south west\endcsname}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\centerpoint\advance\pgf@x.333333\pgf@xb\advance\pgf@y-\pgf@yc}% + {\csname pgf@anchor@and gate US@south west\endcsname}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@and gate US@north west\endcsname}% + {\csname pgf@anchor@and gate US@south west\endcsname}% + \fi% + \fi% + \fi% + }% +}% @@ -441,512 +441,512 @@ % Shape nand gate US % \pgfdeclareshape{nand gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@nand gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@nand gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{A nand gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \inheritanchor[from=and gate US]{mid} - \inheritanchor[from=and gate US]{mid east} - \inheritanchor[from=and gate US]{mid west} - \inheritanchor[from=and gate US]{base} - \inheritanchor[from=and gate US]{base east} - \inheritanchor[from=and gate US]{base west} - \anchor{output}{% - \dimensions - \pgfpointadd{\centerpoint}{% - \pgf@xa\halfside% - \pgf@x1.33333\pgf@xa% - \advance\pgf@x\invertedradius% - \advance\pgf@x\outerinvertedradius% - \advance\pgf@x\outerxsep% - \pgf@y0pt% - }% - } - \inheritanchor[from=and gate US]{east} - \inheritanchor[from=and gate US]{north east} - \inheritanchor[from=and gate US]{south east} - \inheritanchor[from=and gate US]{north} - \inheritanchor[from=and gate US]{south} - \inheritanchor[from=and gate US]{south west} - \inheritanchor[from=and gate US]{north west} - \inheritanchor[from=and gate US]{west} - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - \pgf@xb.333333\pgf@xc% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% - {% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% - \pgfpathclose% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@xa\halfside% - \pgf@x-1.166666\pgf@xa% - \advance\pgf@x-.5\pgflinewidth% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - % - % Draw the output inverter. - % - {% - \pgfpathcircle{% - \pgf@x1.33333\pgf@xc% - \advance\pgf@x\outerinvertedradius% - \pgf@y0pt% - }{+\invertedradius}% - }% - }% - } - \inheritanchorborder[from=and gate US] -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@nand gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@nand gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{A nand gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@andUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \inheritanchor[from=and gate US]{mid}% + \inheritanchor[from=and gate US]{mid east}% + \inheritanchor[from=and gate US]{mid west}% + \inheritanchor[from=and gate US]{base}% + \inheritanchor[from=and gate US]{base east}% + \inheritanchor[from=and gate US]{base west}% + \anchor{output}{% + \dimensions + \pgfpointadd{\centerpoint}{% + \pgf@xa\halfside% + \pgf@x1.33333\pgf@xa% + \advance\pgf@x\invertedradius% + \advance\pgf@x\outerinvertedradius% + \advance\pgf@x\outerxsep% + \pgf@y0pt% + }% + }% + \inheritanchor[from=and gate US]{east}% + \inheritanchor[from=and gate US]{north east}% + \inheritanchor[from=and gate US]{south east}% + \inheritanchor[from=and gate US]{north}% + \inheritanchor[from=and gate US]{south}% + \inheritanchor[from=and gate US]{south west}% + \inheritanchor[from=and gate US]{north west}% + \inheritanchor[from=and gate US]{west}% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + \pgf@xb.333333\pgf@xc% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yc}}% + {% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% + \pgfpathclose% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@xa\halfside% + \pgf@x-1.166666\pgf@xa% + \advance\pgf@x-.5\pgflinewidth% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + % + % Draw the output inverter. + % + {% + \pgfpathcircle{% + \pgf@x1.33333\pgf@xc% + \advance\pgf@x\outerinvertedradius% + \pgf@y0pt% + }{+\invertedradius}% + }% + }% + }% + \inheritanchorborder[from=and gate US]% +}% % Internal macro for calculation input anchors. Used by % or, nor xnor gates (US). % \def\pgf@lib@sh@logicgate@OR@inputanchor#1{% - \dimensions% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - % - \pgfutil@tempdima\halfside% - \multiply\pgfutil@tempdima2\relax% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \multiply\pgfutil@tempdima#1\relax% - \pgf@yc\pgf@ya% - \advance\pgf@yc-\pgfutil@tempdima% - % - \pgf@xb\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@xc-1.166666\pgf@ya% - \advance\pgf@xc-.866025\pgf@xb% - \advance\pgf@xc\pgfmathresult\pgf@yb% - \advance\pgf@xc\halflinewidth% - \advance\pgf@xc-\outerxsep% - % - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% - \advance\pgf@xc-\invertedradius% - \advance\pgf@xc-\outerinvertedradius% - \fi% - % - \centerpoint% - \advance\pgf@x\pgf@xc% - \advance\pgf@y\pgf@yc% -} + \dimensions% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + % + \pgfutil@tempdima\halfside% + \multiply\pgfutil@tempdima2\relax% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \multiply\pgfutil@tempdima#1\relax% + \pgf@yc\pgf@ya% + \advance\pgf@yc-\pgfutil@tempdima% + % + \pgf@xb\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@xc-1.166666\pgf@ya% + \advance\pgf@xc-.866025\pgf@xb% + \advance\pgf@xc\pgfmathresult\pgf@yb% + \advance\pgf@xc\halflinewidth% + \advance\pgf@xc-\outerxsep% + % + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% + \advance\pgf@xc-\invertedradius% + \advance\pgf@xc-\outerinvertedradius% + \fi% + % + \centerpoint% + \advance\pgf@x\pgf@xc% + \advance\pgf@y\pgf@yc% +}% % Shape or gate US % \pgfdeclareshape{or gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@or gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@or gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{An or gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\halflinewidth{% - \pgf@x.5\pgflinewidth% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \csname pgf@anchor@or gate US@east\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{mid west}{% - \csname pgf@anchor@or gate US@north west\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{base}{\basepoint}% - \anchor{base east}{% - \csname pgf@anchor@or gate US@east\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{base west}{% - \csname pgf@anchor@or gate US@north west\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{east}{% - \dimensions% - \pgfpointadd{\centerpoint}{\tipanchor}% - } - \anchor{output}{\csname pgf@anchor@or gate US@east\endcsname} - \anchor{north east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \tipanchor% - \pgf@xa\pgf@x% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\halfheight% - \else% - \centerpoint% - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\halfside% - \advance\pgf@x-.166666\pgf@xb% - \advance\pgf@xa\pgf@xb% - \advance\pgf@x.5\pgf@xa% - \advance\pgf@y-\pgf@xb% - \advance\pgf@ya\pgf@xb% - \advance\pgf@y.866025\pgf@ya% - \fi% - } - \anchor{south east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \tipanchor% - \pgf@xa\pgf@x% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y-\halfheight% - \else - \centerpoint% - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\halfside% - \advance\pgf@x-.166666\pgf@xb% - \advance\pgf@xa\pgf@xb% - \advance\pgf@x.5\pgf@xa% - \advance\pgf@y\pgf@xb% - \advance\pgf@ya\pgf@xb% - \advance\pgf@y-.866025\pgf@ya% - \fi% - } - \anchor{north}{% - \dimensions% - \centerpoint% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y\halfheight% - \else% - \pgf@ya\halfheight% - \advance\pgf@y.993043\pgf@ya% - \fi% - } - \anchor{south}{% - \dimensions% - \centerpoint% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y-\halfheight% - \else% - \pgf@ya\halfheight% - \advance\pgf@y-.993043\pgf@ya% - \fi% - } - \anchor{south west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \pgf@xa\outerxsep% - \advance\pgf@x-1.732050\pgf@xa% - \advance\pgf@y-\halfheight% - } - \anchor{north west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \pgf@xa\outerxsep% - \advance\pgf@x-1.732050\pgf@xa% - \advance\pgf@y\halfheight% - } - \anchor{west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \else% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@x0.267949\pgf@xa% - \fi% - } - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \pgfpatharc{-30}{0}{+\pgf@yc}% - } - {% - \pgf@yc2.0\pgf@yc% - \pgfpatharc{0}{30}{+\pgf@yc}% - }% - \pgfpathclose% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - \pgf@xa\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \let\sineangle\pgfmathresult% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@x-1.166666\pgf@ya% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x\pgfmathresult\pgf@yb% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - }% - \anchorborder{% - \pgfextract@process\externalpoint{}% - \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \pgf@xb\pgf@x% - \pgf@yb\pgf@y% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - \dimensions% - \pgf@xc\halfside% - % - \pgf@xc-.166666\pgf@xc% - \ifdim\pgf@xa<\pgf@xc% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@or gate US@north west\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@or gate US@north\endcsname% - }% - {\csname pgf@anchor@or gate US@north west\endcsname}% - \else% - \pgfmathsubtract@{360}{\pgfmathresult}% - \ifdim\externalangle pt>\pgfmathresult pt\relax% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@or gate US@south\endcsname% - }% - {\csname pgf@anchor@or gate US@south west\endcsname}% - \else% - \ifdim\pgf@ya>\pgf@yb% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \advance\pgf@yc-\outerxsep% - \pgfextract@process\point{% - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.166666\pgf@xa% - \pgf@xa2.0\pgf@xa% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x-\outerxsep% - }% - {0}{90}{+\pgf@yc}% - }% - \else% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \advance\pgf@yc-\outerxsep% - \pgfextract@process\point{% - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.166666\pgf@xa% - \pgf@xa2.0\pgf@xa% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x-\outerxsep% - }% - {270}{360}{+\pgf@yc}% - }% - \fi% - \fi% - \fi% - \else% - \ifdim\pgf@y=0pt\relax% - \csname pgf@anchor@and gate US@east\endcsname% - \else% - \pgf@xc\halfwidth% - \advance\pgf@xc\halfside% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \pgf@xb\halfside% - \pgf@xb-.166666\pgf@xb% - \ifdim\pgf@ya<0pt% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y\halfside% - \advance\pgf@x\pgf@xb% - }% - {270}{330}{+\pgf@yc}% - \else% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y-\halfside% - \advance\pgf@x\pgf@xb% - }% - {30}{90}{+\pgf@xc and +\pgf@yc}% - \fi% - \fi% - \fi% - }% -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@or gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@or gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An or gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\halflinewidth{% + \pgf@x.5\pgflinewidth% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \csname pgf@anchor@or gate US@east\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{mid west}{% + \csname pgf@anchor@or gate US@north west\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \csname pgf@anchor@or gate US@east\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{base west}{% + \csname pgf@anchor@or gate US@north west\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{east}{% + \dimensions% + \pgfpointadd{\centerpoint}{\tipanchor}% + }% + \anchor{output}{\csname pgf@anchor@or gate US@east\endcsname}% + \anchor{north east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \tipanchor% + \pgf@xa\pgf@x% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\halfheight% + \else% + \centerpoint% + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\halfside% + \advance\pgf@x-.166666\pgf@xb% + \advance\pgf@xa\pgf@xb% + \advance\pgf@x.5\pgf@xa% + \advance\pgf@y-\pgf@xb% + \advance\pgf@ya\pgf@xb% + \advance\pgf@y.866025\pgf@ya% + \fi% + }% + \anchor{south east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \tipanchor% + \pgf@xa\pgf@x% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y-\halfheight% + \else + \centerpoint% + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\halfside% + \advance\pgf@x-.166666\pgf@xb% + \advance\pgf@xa\pgf@xb% + \advance\pgf@x.5\pgf@xa% + \advance\pgf@y\pgf@xb% + \advance\pgf@ya\pgf@xb% + \advance\pgf@y-.866025\pgf@ya% + \fi% + }% + \anchor{north}{% + \dimensions% + \centerpoint% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y\halfheight% + \else% + \pgf@ya\halfheight% + \advance\pgf@y.993043\pgf@ya% + \fi% + }% + \anchor{south}{% + \dimensions% + \centerpoint% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y-\halfheight% + \else% + \pgf@ya\halfheight% + \advance\pgf@y-.993043\pgf@ya% + \fi% + }% + \anchor{south west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \pgf@xa\outerxsep% + \advance\pgf@x-1.732050\pgf@xa% + \advance\pgf@y-\halfheight% + }% + \anchor{north west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \pgf@xa\outerxsep% + \advance\pgf@x-1.732050\pgf@xa% + \advance\pgf@y\halfheight% + }% + \anchor{west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \else% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@x0.267949\pgf@xa% + \fi% + }% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \pgfpatharc{-30}{0}{+\pgf@yc}% + } + {% + \pgf@yc2.0\pgf@yc% + \pgfpatharc{0}{30}{+\pgf@yc}% + }% + \pgfpathclose% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + \pgf@xa\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \let\sineangle\pgfmathresult% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@x-1.166666\pgf@ya% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x\pgfmathresult\pgf@yb% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \dimensions% + \pgf@xc\halfside% + % + \pgf@xc-.166666\pgf@xc% + \ifdim\pgf@xa<\pgf@xc% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@or gate US@north west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@or gate US@north\endcsname% + }% + {\csname pgf@anchor@or gate US@north west\endcsname}% + \else% + \pgfmathsubtract@{360}{\pgfmathresult}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@or gate US@south\endcsname% + }% + {\csname pgf@anchor@or gate US@south west\endcsname}% + \else% + \ifdim\pgf@ya>\pgf@yb% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \advance\pgf@yc-\outerxsep% + \pgfextract@process\point{% + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.166666\pgf@xa% + \pgf@xa2.0\pgf@xa% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x-\outerxsep% + }% + {0}{90}{+\pgf@yc}% + }% + \else% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \advance\pgf@yc-\outerxsep% + \pgfextract@process\point{% + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.166666\pgf@xa% + \pgf@xa2.0\pgf@xa% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x-\outerxsep% + }% + {270}{360}{+\pgf@yc}% + }% + \fi% + \fi% + \fi% + \else% + \ifdim\pgf@y=0pt\relax% + \csname pgf@anchor@and gate US@east\endcsname% + \else% + \pgf@xc\halfwidth% + \advance\pgf@xc\halfside% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \pgf@xb\halfside% + \pgf@xb-.166666\pgf@xb% + \ifdim\pgf@ya<0pt% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y\halfside% + \advance\pgf@x\pgf@xb% + }% + {270}{330}{+\pgf@yc}% + \else% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y-\halfside% + \advance\pgf@x\pgf@xb% + }% + {30}{90}{+\pgf@xc and +\pgf@yc}% + \fi% + \fi% + \fi% + }% +}% @@ -954,154 +954,154 @@ % Shape nor gate US % \pgfdeclareshape{nor gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@nor gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@nor gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{A nor gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\halflinewidth{% - \pgf@x.5\pgflinewidth% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=or gate US]{center} - \inheritanchor[from=or gate US]{mid} - \inheritanchor[from=or gate US]{mid east} - \inheritanchor[from=or gate US]{mid west} - \inheritanchor[from=or gate US]{base} - \inheritanchor[from=or gate US]{base east} - \inheritanchor[from=or gate US]{base west} - \inheritanchor[from=or gate US]{east} - \inheritanchor[from=or gate US]{north east} - \inheritanchor[from=or gate US]{south east} - \inheritanchor[from=or gate US]{north} - \inheritanchor[from=or gate US]{south} - \inheritanchor[from=or gate US]{south west} - \inheritanchor[from=or gate US]{north west} - \inheritanchor[from=or gate US]{west} - \anchor{output}{% - \dimensions% - \centerpoint% - \pgf@xc\halfside% - \pgf@yc\pgf@xc% - \advance\pgf@x-.166666\pgf@xc% - \pgf@yc2.0\pgf@yc% - \advance\pgf@x.866025\pgf@yc% - \advance\pgf@x\outerinvertedradius% - \advance\pgf@x\invertedradius% - \advance\pgf@x\outerxsep% - }% - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \pgfpatharc{-30}{0}{+\pgf@yc}% - } - {% - \pgf@yc2.0\pgf@yc% - \pgfpatharc{0}{30}{+\pgf@yc}% - }% - \pgfpathclose% - % Draw the output inverter. - % - {% - \pgfpathcircle{% - \pgf@x-.166666\pgf@xc% - \pgf@yc2.0\pgf@yc% - \advance\pgf@x.866025\pgf@yc% - \advance\pgf@x\outerinvertedradius% - \pgf@y0pt% - }{+\invertedradius}% - }% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - \pgf@xa\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \let\sineangle\pgfmathresult% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@x-1.166666\pgf@ya% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x\pgfmathresult\pgf@yb% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - }% - \inheritanchorborder[from=or gate US] -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@nor gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@nor gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@OR@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{A nor gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\halflinewidth{% + \pgf@x.5\pgflinewidth% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \inheritanchor[from=or gate US]{center}% + \inheritanchor[from=or gate US]{mid}% + \inheritanchor[from=or gate US]{mid east}% + \inheritanchor[from=or gate US]{mid west}% + \inheritanchor[from=or gate US]{base}% + \inheritanchor[from=or gate US]{base east}% + \inheritanchor[from=or gate US]{base west}% + \inheritanchor[from=or gate US]{east}% + \inheritanchor[from=or gate US]{north east}% + \inheritanchor[from=or gate US]{south east}% + \inheritanchor[from=or gate US]{north}% + \inheritanchor[from=or gate US]{south}% + \inheritanchor[from=or gate US]{south west}% + \inheritanchor[from=or gate US]{north west}% + \inheritanchor[from=or gate US]{west}% + \anchor{output}{% + \dimensions% + \centerpoint% + \pgf@xc\halfside% + \pgf@yc\pgf@xc% + \advance\pgf@x-.166666\pgf@xc% + \pgf@yc2.0\pgf@yc% + \advance\pgf@x.866025\pgf@yc% + \advance\pgf@x\outerinvertedradius% + \advance\pgf@x\invertedradius% + \advance\pgf@x\outerxsep% + }% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \pgfpatharc{-30}{0}{+\pgf@yc}% + } + {% + \pgf@yc2.0\pgf@yc% + \pgfpatharc{0}{30}{+\pgf@yc}% + }% + \pgfpathclose% + % Draw the output inverter. + % + {% + \pgfpathcircle{% + \pgf@x-.166666\pgf@xc% + \pgf@yc2.0\pgf@yc% + \advance\pgf@x.866025\pgf@yc% + \advance\pgf@x\outerinvertedradius% + \pgf@y0pt% + }{+\invertedradius}% + }% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + \pgf@xa\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \let\sineangle\pgfmathresult% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@x-1.166666\pgf@ya% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x\pgfmathresult\pgf@yb% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + }% + \inheritanchorborder[from=or gate US]% +}% @@ -1109,42 +1109,42 @@ % xor and xnor gates (US). % \def\pgf@lib@sh@logicgate@XOR@inputanchor#1{% - \dimensions% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - % - \pgfutil@tempdima\halfside% - \multiply\pgfutil@tempdima2\relax% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \multiply\pgfutil@tempdima#1\relax% - \pgf@yc\pgf@ya% - \advance\pgf@yc-\pgfutil@tempdima% - % - \pgf@xb\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@xc-1.166666\pgf@ya% - \advance\pgf@xc-.866025\pgf@xb% - \advance\pgf@xc\pgfmathresult\pgf@yb% - \advance\pgf@xc\halflinewidth% - \advance\pgf@xc-\outerxsep% - % - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% - \advance\pgf@xc-\invertedradius% - \advance\pgf@xc-\outerinvertedradius% - \fi% - % - \centerpoint% - \advance\pgf@x\pgf@xc% - \advance\pgf@y\pgf@yc% - \pgf@xa\halfside% - \advance\pgf@x-.333333\pgf@xa% -} + \dimensions% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + % + \pgfutil@tempdima\halfside% + \multiply\pgfutil@tempdima2\relax% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \multiply\pgfutil@tempdima#1\relax% + \pgf@yc\pgf@ya% + \advance\pgf@yc-\pgfutil@tempdima% + % + \pgf@xb\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@xc-1.166666\pgf@ya% + \advance\pgf@xc-.866025\pgf@xb% + \advance\pgf@xc\pgfmathresult\pgf@yb% + \advance\pgf@xc\halflinewidth% + \advance\pgf@xc-\outerxsep% + % + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% + \advance\pgf@xc-\invertedradius% + \advance\pgf@xc-\outerinvertedradius% + \fi% + % + \centerpoint% + \advance\pgf@x\pgf@xc% + \advance\pgf@y\pgf@yc% + \pgf@xa\halfside% + \advance\pgf@x-.333333\pgf@xa% +}% @@ -1153,330 +1153,330 @@ % Shape xor gate US % \pgfdeclareshape{xor gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{2}% - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@xor gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@xor gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{An xor gate must have at two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\halflinewidth{% - \pgf@x.5\pgflinewidth% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \inheritanchor[from=or gate US]{mid east} - \anchor{mid west}{% - \csname pgf@anchor@xor gate US@north west\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{base}{\basepoint}% - \inheritanchor[from=or gate US]{base east} - \anchor{base west}{% - \csname pgf@anchor@xor gate US@north west\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \inheritanchor[from=or gate US]{base} - \inheritanchor[from=or gate US]{output} - \inheritanchor[from=or gate US]{east} - \inheritanchor[from=or gate US]{north east} - \inheritanchor[from=or gate US]{south east} - \inheritanchor[from=or gate US]{north} - \inheritanchor[from=or gate US]{south} - \anchor{south west}{% - \dimensions% - \pgf@xa\halfside% - \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x - \pgf@xb\halfside% - \pgf@xb2.0\pgf@xb% - \advance\pgf@xb-\halflinewidth% - \advance\pgf@xa.866025\pgf@xb% - \pgf@ya.5\pgf@xb% - \centerpoint% - \advance\pgf@x\pgf@xa% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y-\halfheight% - \else% - \advance\pgf@y-\pgf@ya% - \fi% - } - \anchor{north west}{% - \dimensions% - \pgf@xa\halfside% - \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x - \pgf@xb\halfside% - \pgf@xb2.0\pgf@xb% - \advance\pgf@xb-\halflinewidth% - \advance\pgf@xa.866025\pgf@xb% - \pgf@ya.5\pgf@xb% - \centerpoint% - \advance\pgf@x\pgf@xa% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y\halfheight% - \else% - \advance\pgf@y\pgf@ya% - \fi% - } - \anchor{west}{% - \dimensions% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - % - \pgf@xb\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{0}{\pgfmath@tonumber{\pgf@yb}}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@xc-1.166666\pgf@ya% - \advance\pgf@xc-.866025\pgf@xb% - \advance\pgf@xc\pgfmathresult\pgf@yb% - \advance\pgf@xc\halflinewidth% - \advance\pgf@xc-\outerxsep% - % - \centerpoint% - \advance\pgf@x\pgf@xc% - \pgf@xa\halfside% - \advance\pgf@x-.333333\pgf@xa% - \ifpgfgateanchorsuseboundingrectangle% - \pgf@xa2.0\pgf@xa% - \advance\pgf@x-0.133974\pgf@xa% - \fi% - } - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - {% - \pgf@yc2.66666\pgf@yc% - \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}% - } - {% - \pgf@yc2.66666\pgf@yc% - \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}% - }% - \pgfpathclose% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - \pgf@xa\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@x-1.5\pgf@ya% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x\pgfmathresult\pgf@yb% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - % - % Now, some fooling around to stop the `tail' being filled. - % Technically it still is, but it isn't visible. - % - \pgf@xc\halfside% - \pgf@yc\halfside% - \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}% - \pgf@yc2.0\pgf@yc% - \pgfmathloop% - \ifnum\pgfmathcounter<61\relax% - {% - \pgfextract@process\point{% - \pgfpointadd{% - \pgf@x\halfside% - \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x - \pgf@y0pt% - }{% - \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}% - }% - }% - \pgfpathlineto{\point}% - \pgfpathmoveto{\point}% - } - \repeatpgfmathloop% - }% - }% - \anchorborder{% - \pgfextract@process\externalpoint{}% - \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \pgf@xb\pgf@x% - \pgf@yb\pgf@y% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - \dimensions% - \pgf@xc\halfside% - % - \pgf@xc-.166666\pgf@xc% - \ifdim\pgf@xa<\pgf@xc% - \pgfmathanglebetweenpoints{\centerpoint}% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@xor gate US@north west\endcsname% - }% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@xor gate US@north\endcsname% - }% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@xor gate US@north west\endcsname% - }% - \else% - \pgfmathsubtract@{360}{\pgfmathresult}% - \ifdim\externalangle pt>\pgfmathresult pt\relax% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@xor gate US@south\endcsname% - }% - {% - \pgfgateanchorsuseboundingrectangletrue% - \csname pgf@anchor@xor gate US@south west\endcsname% - }% - \else% - \ifdim\pgf@ya>\pgf@yb% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \advance\pgf@yc-\outerxsep% - \pgf@process{% - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.166666\pgf@xa% - \pgf@xa2.0\pgf@xa% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@x-.166666\pgf@xa% - }% - {0}{90}{+\pgf@yc}% - }% - \else% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \advance\pgf@yc-\outerxsep% - \pgf@process{% - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.166666\pgf@xa% - \pgf@xa2.0\pgf@xa% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@x-.166666\pgf@xa% - }% - {270}{360}{+\pgf@yc}% - }% - \fi% - \fi% - \fi% - \else% - \ifdim\pgf@y=0pt\relax% - \csname pgf@anchor@and gate US@east\endcsname% - \else% - \pgf@xc\halfwidth% - \advance\pgf@xc\halfside% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \pgf@xb\halfside% - \pgf@xb-.166666\pgf@xb% - \ifdim\pgf@ya<0pt% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y\halfside% - \advance\pgf@x\pgf@xb% - }% - {270}{330}{+\pgf@yc}% - \else% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y-\halfside% - \advance\pgf@x\pgf@xb% - }% - {30}{90}{+\pgf@xc and +\pgf@yc}% - \fi% - \fi% - \fi% - }% -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{2}% + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@xor gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@xor gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An xor gate must have at two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\halflinewidth{% + \pgf@x.5\pgflinewidth% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \inheritanchor[from=or gate US]{mid east}% + \anchor{mid west}{% + \csname pgf@anchor@xor gate US@north west\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{base}{\basepoint}% + \inheritanchor[from=or gate US]{base east}% + \anchor{base west}{% + \csname pgf@anchor@xor gate US@north west\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \inheritanchor[from=or gate US]{base}% + \inheritanchor[from=or gate US]{output}% + \inheritanchor[from=or gate US]{east}% + \inheritanchor[from=or gate US]{north east}% + \inheritanchor[from=or gate US]{south east}% + \inheritanchor[from=or gate US]{north}% + \inheritanchor[from=or gate US]{south}% + \anchor{south west}{% + \dimensions% + \pgf@xa\halfside% + \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x + \pgf@xb\halfside% + \pgf@xb2.0\pgf@xb% + \advance\pgf@xb-\halflinewidth% + \advance\pgf@xa.866025\pgf@xb% + \pgf@ya.5\pgf@xb% + \centerpoint% + \advance\pgf@x\pgf@xa% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y-\halfheight% + \else% + \advance\pgf@y-\pgf@ya% + \fi% + }% + \anchor{north west}{% + \dimensions% + \pgf@xa\halfside% + \pgf@xa-3.232051\pgf@xa% (7/6 + 2*cos(30) + 1/3) * x + \pgf@xb\halfside% + \pgf@xb2.0\pgf@xb% + \advance\pgf@xb-\halflinewidth% + \advance\pgf@xa.866025\pgf@xb% + \pgf@ya.5\pgf@xb% + \centerpoint% + \advance\pgf@x\pgf@xa% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y\halfheight% + \else% + \advance\pgf@y\pgf@ya% + \fi% + }% + \anchor{west}{% + \dimensions% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + % + \pgf@xb\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{0}{\pgfmath@tonumber{\pgf@yb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@xc-1.166666\pgf@ya% + \advance\pgf@xc-.866025\pgf@xb% + \advance\pgf@xc\pgfmathresult\pgf@yb% + \advance\pgf@xc\halflinewidth% + \advance\pgf@xc-\outerxsep% + % + \centerpoint% + \advance\pgf@x\pgf@xc% + \pgf@xa\halfside% + \advance\pgf@x-.333333\pgf@xa% + \ifpgfgateanchorsuseboundingrectangle% + \pgf@xa2.0\pgf@xa% + \advance\pgf@x-0.133974\pgf@xa% + \fi% + }% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + {% + \pgf@yc2.66666\pgf@yc% + \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}% + } + {% + \pgf@yc2.66666\pgf@yc% + \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}% + }% + \pgfpathclose% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + \pgf@xa\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@x-1.5\pgf@ya% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x\pgfmathresult\pgf@yb% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + % + % Now, some fooling around to stop the `tail' being filled. + % Technically it still is, but it isn't visible. + % + \pgf@xc\halfside% + \pgf@yc\halfside% + \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}% + \pgf@yc2.0\pgf@yc% + \pgfmathloop% + \ifnum\pgfmathcounter<61\relax% + {% + \pgfextract@process\point{% + \pgfpointadd{% + \pgf@x\halfside% + \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x + \pgf@y0pt% + }{% + \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}% + }% + }% + \pgfpathlineto{\point}% + \pgfpathmoveto{\point}% + } + \repeatpgfmathloop% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \dimensions% + \pgf@xc\halfside% + % + \pgf@xc-.166666\pgf@xc% + \ifdim\pgf@xa<\pgf@xc% + \pgfmathanglebetweenpoints{\centerpoint}% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@xor gate US@north west\endcsname% + }% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@xor gate US@north\endcsname% + }% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@xor gate US@north west\endcsname% + }% + \else% + \pgfmathsubtract@{360}{\pgfmathresult}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@xor gate US@south\endcsname% + }% + {% + \pgfgateanchorsuseboundingrectangletrue% + \csname pgf@anchor@xor gate US@south west\endcsname% + }% + \else% + \ifdim\pgf@ya>\pgf@yb% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \advance\pgf@yc-\outerxsep% + \pgf@process{% + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.166666\pgf@xa% + \pgf@xa2.0\pgf@xa% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@x-.166666\pgf@xa% + }% + {0}{90}{+\pgf@yc}% + }% + \else% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \advance\pgf@yc-\outerxsep% + \pgf@process{% + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.166666\pgf@xa% + \pgf@xa2.0\pgf@xa% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@x-.166666\pgf@xa% + }% + {270}{360}{+\pgf@yc}% + }% + \fi% + \fi% + \fi% + \else% + \ifdim\pgf@y=0pt\relax% + \csname pgf@anchor@and gate US@east\endcsname% + \else% + \pgf@xc\halfwidth% + \advance\pgf@xc\halfside% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \pgf@xb\halfside% + \pgf@xb-.166666\pgf@xb% + \ifdim\pgf@ya<0pt% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y\halfside% + \advance\pgf@x\pgf@xb% + }% + {270}{330}{+\pgf@yc}% + \else% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y-\halfside% + \advance\pgf@x\pgf@xb% + }% + {30}{90}{+\pgf@xc and +\pgf@yc}% + \fi% + \fi% + \fi% + }% +}% @@ -1484,167 +1484,167 @@ % Shape xnor gate US % \pgfdeclareshape{xnor gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{2}% - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@xnor gate US@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@xnor gate US@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{An xnor gate must have two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\halflinewidth{% - \pgf@x.5\pgflinewidth% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \inheritanchor[from=xor gate US]{mid east} - \inheritanchor[from=xor gate US]{mid west} - \anchor{base}{\basepoint}% - \inheritanchor[from=xor gate US]{base east} - \inheritanchor[from=xor gate US]{base west} - \inheritanchor[from=xor gate US]{base} - \inheritanchor[from=nor gate US]{output} - \inheritanchor[from=xor gate US]{east} - \inheritanchor[from=xor gate US]{north east} - \inheritanchor[from=xor gate US]{south east} - \inheritanchor[from=xor gate US]{north} - \inheritanchor[from=xor gate US]{south} - \inheritanchor[from=xor gate US]{south west} - \inheritanchor[from=xor gate US]{north west} - \inheritanchor[from=xor gate US]{west} - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - {% - \pgf@yc2.66666\pgf@yc% - \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}% - } - {% - \pgf@yc2.66666\pgf@yc% - \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}% - }% - \pgfpathclose% - % - % Draw the output inverter. - % - {% - \pgfpathcircle{% - \pgf@x-.166666\pgf@xc% - \pgf@yc2.0\pgf@yc% - \advance\pgf@x.866025\pgf@yc% - \advance\pgf@x\outerinvertedradius% - \pgf@y0pt% - }{+\invertedradius}% - }% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@ya\halfside% - \pgf@yb2.0\pgf@ya% - \pgf@xa\pgf@yb% - \advance\pgf@yb-\halflinewidth% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - % - \pgf@x-1.5\pgf@ya% - \advance\pgf@x-.866025\pgf@xa% - \advance\pgf@x\pgfmathresult\pgf@yb% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - % - % Now, some fooling around to stop the `tail' being filled. - % - \pgf@xc\halfside% - \pgf@yc\halfside% - \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}% - \pgf@yc2.0\pgf@yc% - \pgfmathloop% - \ifnum\pgfmathcounter<61\relax% - {% - \pgfextract@process\point{% - \pgfpointadd{% - \pgf@x\halfside% - \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x - \pgf@y0pt% - }{% - \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}% - }% - }% - \pgfpathlineto{\point}% - \pgfpathmoveto{\point}% - } - \repeatpgfmathloop% - }% - }% - \inheritanchorborder[from=xor gate US] -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{2}% + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@xnor gate US@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@xnor gate US@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@XOR@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An xnor gate must have two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\halflinewidth{% + \pgf@x.5\pgflinewidth% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \inheritanchor[from=xor gate US]{mid east}% + \inheritanchor[from=xor gate US]{mid west}% + \anchor{base}{\basepoint}%% + \inheritanchor[from=xor gate US]{base east}% + \inheritanchor[from=xor gate US]{base west}% + \inheritanchor[from=xor gate US]{base}% + \inheritanchor[from=nor gate US]{output}% + \inheritanchor[from=xor gate US]{east}% + \inheritanchor[from=xor gate US]{north east}% + \inheritanchor[from=xor gate US]{south east}% + \inheritanchor[from=xor gate US]{north}% + \inheritanchor[from=xor gate US]{south}% + \inheritanchor[from=xor gate US]{south west}% + \inheritanchor[from=xor gate US]{north west}% + \inheritanchor[from=xor gate US]{west}% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + {% + \pgf@yc2.66666\pgf@yc% + \pgfpatharc{-22}{0}{+1.166666\pgf@yc and +\pgf@yc}% + } + {% + \pgf@yc2.66666\pgf@yc% + \pgfpatharc{0}{22}{+1.166666\pgf@yc and +\pgf@yc}% + }% + \pgfpathclose% + % + % Draw the output inverter. + % + {% + \pgfpathcircle{% + \pgf@x-.166666\pgf@xc% + \pgf@yc2.0\pgf@yc% + \advance\pgf@x.866025\pgf@yc% + \advance\pgf@x\outerinvertedradius% + \pgf@y0pt% + }{+\invertedradius}% + }% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@ya\halfside% + \pgf@yb2.0\pgf@ya% + \pgf@xa\pgf@yb% + \advance\pgf@yb-\halflinewidth% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@yb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + % + \pgf@x-1.5\pgf@ya% + \advance\pgf@x-.866025\pgf@xa% + \advance\pgf@x\pgfmathresult\pgf@yb% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + % + % Now, some fooling around to stop the `tail' being filled. + % + \pgf@xc\halfside% + \pgf@yc\halfside% + \pgfpathmoveto{\pgfqpoint{-1.5\pgf@xc}{-\pgf@yc}}% + \pgf@yc2.0\pgf@yc% + \pgfmathloop% + \ifnum\pgfmathcounter<61\relax% + {% + \pgfextract@process\point{% + \pgfpointadd{% + \pgf@x\halfside% + \pgf@x-3.232051\pgf@x% (7/6 + 2*cos(30) + 1/3) * x + \pgf@y0pt% + }{% + \pgfpointpolar{\pgfmathcounter-30}{+\pgf@yc}% + }% + }% + \pgfpathlineto{\point}% + \pgfpathmoveto{\point}% + } + \repeatpgfmathloop% + }% + }% + \inheritanchorborder[from=xor gate US]% +}% @@ -1655,7 +1655,7 @@ % \pgfdeclareshape{not gate US}{% \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1}% + \pgf@lib@sh@logicgate@parseinputs{1}% \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% \pgferror{A not gate must have one input}% \fi% @@ -1670,21 +1670,21 @@ \saveddimen\outerinvertedradius{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+0.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt% - } + }% \anchor{center}{\centerpoint}% \anchor{mid}{\midpoint}% \anchor{mid east}{% @@ -1692,14 +1692,14 @@ \pgfutil@tempdima\pgf@y% \csname pgf@anchor@not gate US@east\endcsname% \pgf@y\pgfutil@tempdima% - } + }% \anchor{mid west}{% \dimensions% \pgf@xc\halfside% \pgf@xc-.833333\pgf@xc% \advance\pgf@xc-\outerxsep% \midpoint% - \advance\pgf@x\pgf@xc% + \advance\pgf@x\pgf@xc% }% \anchor{base}{\basepoint}% \anchor{base east}{% @@ -1707,16 +1707,16 @@ \pgfutil@tempdima\pgf@y% \csname pgf@anchor@not gate US@east\endcsname% \pgf@y\pgfutil@tempdima% - } + }% \anchor{base west}{% \dimensions% \pgf@xc\halfside% \pgf@xc-.833333\pgf@xc% \advance\pgf@xc-\outerxsep% \basepoint% - \advance\pgf@x\pgf@xc% + \advance\pgf@x\pgf@xc% }% - \inheritanchor[from=and gate US]{base} + \inheritanchor[from=and gate US]{base}% \anchor{output}{% \dimensions% \pgf@xc\halfside% @@ -1727,7 +1727,7 @@ \advance\pgf@x\invertedradius% \advance\pgf@x\outerinvertedradius% \advance\pgf@x\outerxsep% - } + }% \anchor{east}{% \dimensions% \tipanchor% @@ -1749,11 +1749,11 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \fi% - } + }% \anchor{south}{% \dimensions% \ifpgfgateanchorsuseboundingrectangle% @@ -1768,17 +1768,17 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \fi% - } + }% \anchor{south east}{% \dimensions% \ifpgfgateanchorsuseboundingrectangle% \csname pgf@anchor@not gate US@south west\endcsname% \pgf@ya\pgf@y% - \pgf@process{% + \pgf@process{% \dimensions% \tipanchor% \pgf@xa\pgf@x% @@ -1793,17 +1793,17 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \fi% - } + }% \anchor{north east}{% \dimensions% \ifpgfgateanchorsuseboundingrectangle% \csname pgf@anchor@not gate US@north west\endcsname% \pgf@ya\pgf@y% - \pgf@process{% + \pgf@process{% \dimensions% \tipanchor% \pgf@xa\pgf@x% @@ -1818,11 +1818,11 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \fi% - } + }% \anchor{south west}{% \dimensions% \pgf@xa\halfside% @@ -1831,7 +1831,7 @@ \advance\pgf@x-\outerxsep% \advance\pgf@y-1.166666\pgf@xa% \pgf@ya\outerysep% - \advance\pgf@y-1.565\pgf@ya% Selected by trial and error. + \advance\pgf@y-1.565\pgf@ya% Selected by trial and error. }% \anchor{north west}{% \dimensions% @@ -1841,7 +1841,7 @@ \advance\pgf@x-\outerxsep% \advance\pgf@y1.166666\pgf@xa% \pgf@ya\outerysep% - \advance\pgf@y1.565\pgf@ya% Selected by trial and error. + \advance\pgf@y1.565\pgf@ya% Selected by trial and error. }% \anchor{input}{% \dimensions% @@ -1856,7 +1856,7 @@ \advance\pgf@xc-\outerxsep% \centerpoint% \advance\pgf@x\pgf@xc% - } + }% \backgroundpath{% \dimensions% \pgf@xc\halfwidth% @@ -1869,9 +1869,9 @@ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}% \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}% \pgfpathlineto{\tipanchor}% - % + % % Draw the output inverter. - % + % {% \pgfpathcircle{% \pgf@x-.166666\pgf@xc% @@ -1879,11 +1879,11 @@ \advance\pgf@x.866025\pgf@yc% \advance\pgf@x\outerinvertedradius% \pgf@y0pt% - }{+\invertedradius}% + }{+\invertedradius}% }% - % + % % Draw the input. - % + % \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname% {% \pgfpathcircle{% @@ -1892,15 +1892,15 @@ \advance\pgf@x-.5\pgflinewidth% \advance\pgf@x-\invertedradius% \pgf@y0pt% - }{+\invertedradius}% + }{+\invertedradius}% }% - \fi% + \fi% }% }% \anchorborder{% \pgf@lib@gates@not@buffer@border{not gate US} - } -} + }% +}% \def\pgf@lib@gates@not@buffer@border#1{ \pgfextract@process\externalpoint{}% @@ -1922,9 +1922,9 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \else% \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@south west\endcsname}% \ifdim\externalangle pt<\pgfmathresult pt% @@ -1938,9 +1938,9 @@ \pgfpointadd{\centerpoint}{% \tipanchor% \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% + \advance\pgf@x2.350943\pgf@xa% }% - }% + }% \fi% \fi% \fi% @@ -1948,8 +1948,8 @@ }% -\def\pgf@lib@zero@text{0.0} -\def\pgf@lib@onehundredeighty@text{180.0} +\def\pgf@lib@zero@text{0.0}% +\def\pgf@lib@onehundredeighty@text{180.0}% @@ -1957,569 +1957,569 @@ % Shape buffer gate US. % \pgfdeclareshape{buffer gate US}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate US\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1}% - \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% - \pgferror{A buffer gate must have one input}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\halflinewidth{% - \pgf@x.5\pgflinewidth% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \midpoint% - \pgfutil@tempdima\pgf@y% - \csname pgf@anchor@buffer gate US@east\endcsname% - \pgf@y\pgfutil@tempdima% - } - \anchor{mid west}{% - \dimensions% - \pgf@xc\halfside% - \pgf@xc-.833333\pgf@xc% - \advance\pgf@xc-\outerxsep% - \midpoint% - \advance\pgf@x\pgf@xc% - }% - \anchor{base}{\basepoint}% - \anchor{base east}{% - \basepoint% - \pgfutil@tempdima\pgf@y% - \csname pgf@anchor@buffer gate US@east\endcsname% - \pgf@y\pgfutil@tempdima% - } - \inheritanchor[from=not gate US]{base west} - \inheritanchor[from=and gate US]{base} - \anchor{output}{\csname pgf@anchor@buffer gate US@east\endcsname} - \anchor{east}{% - \dimensions% - \pgfpointadd{\centerpoint}{% - \tipanchor% - \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% - }% - }% - \anchor{north}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@not gate US@north west\endcsname% - \pgf@ya\pgf@y% - \centerpoint% - \pgf@y\pgf@ya% - \else% - \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}% - {\csname pgf@anchor@buffer gate US@north west\endcsname}% - {% - \pgfpointadd{\centerpoint}{% - \tipanchor% - \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% - }% - }% - \fi% - } - \anchor{south}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@not gate US@south west\endcsname% - \pgf@ya\pgf@y% - \centerpoint% - \pgf@y\pgf@ya% - \else% - \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}% - {\csname pgf@anchor@not gate US@south west\endcsname}% - {% - \pgfpointadd{\centerpoint}{% - \tipanchor% - \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% - }% - }% - \fi% - } - \anchor{south east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@not gate US@south west\endcsname% - \pgfutil@tempdima\pgf@y% - \csname pgf@anchor@buffer gate US@east\endcsname% - \pgf@y\pgfutil@tempdima% - \else% - \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}% - {\csname pgf@anchor@buffer gate US@south west\endcsname}% - {% - \pgfpointadd{\centerpoint}{% - \tipanchor% - \pgf@xc\outerxsep% - \advance\pgf@x2.350943\pgf@xc% - }% - }% - \fi% - } - \anchor{north east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \csname pgf@anchor@not gate US@north west\endcsname% - \pgfutil@tempdima\pgf@y% - \csname pgf@anchor@buffer gate US@east\endcsname% - \pgf@y\pgfutil@tempdima% - \else% - \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}% - {\csname pgf@anchor@buffer gate US@north west\endcsname}% - {% - \pgfpointadd{\centerpoint}{% - \tipanchor% - \pgf@xa\outerxsep% - \advance\pgf@x2.350943\pgf@xa% - }% - }% - \fi% - } - \inheritanchor[from=not gate US]{south west} - \inheritanchor[from=not gate US]{north west} - \inheritanchor[from=not gate US]{input} - \inheritanchor[from=not gate US]{west} - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\tipanchor}% - \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}% - \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}% - \pgfpathclose% - % - % Draw the input. - % - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname% - {% - \pgfpathcircle{% - \pgf@xa\halfside% - \pgf@x-.833333\pgf@xa% - \advance\pgf@x-.5\pgflinewidth% - \advance\pgf@x-\invertedradius% - \pgf@y0pt% - }{+\invertedradius}% - }% - \fi% - }% - }% + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate US\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1}% + \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% + \pgferror{A buffer gate must have one input}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\halflinewidth{% + \pgf@x.5\pgflinewidth% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \midpoint% + \pgfutil@tempdima\pgf@y% + \csname pgf@anchor@buffer gate US@east\endcsname% + \pgf@y\pgfutil@tempdima% + }% + \anchor{mid west}{% + \dimensions% + \pgf@xc\halfside% + \pgf@xc-.833333\pgf@xc% + \advance\pgf@xc-\outerxsep% + \midpoint% + \advance\pgf@x\pgf@xc% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \basepoint% + \pgfutil@tempdima\pgf@y% + \csname pgf@anchor@buffer gate US@east\endcsname% + \pgf@y\pgfutil@tempdima% + }% + \inheritanchor[from=not gate US]{base west}% + \inheritanchor[from=and gate US]{base}% + \anchor{output}{\csname pgf@anchor@buffer gate US@east\endcsname}% + \anchor{east}{% + \dimensions% + \pgfpointadd{\centerpoint}{% + \tipanchor% + \pgf@xa\outerxsep% + \advance\pgf@x2.350943\pgf@xa% + }% + }% + \anchor{north}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@not gate US@north west\endcsname% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@y\pgf@ya% + \else% + \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}% + {\csname pgf@anchor@buffer gate US@north west\endcsname}% + {% + \pgfpointadd{\centerpoint}{% + \tipanchor% + \pgf@xa\outerxsep% + \advance\pgf@x2.350943\pgf@xa% + }% + }% + \fi% + }% + \anchor{south}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@not gate US@south west\endcsname% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@y\pgf@ya% + \else% + \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}% + {\csname pgf@anchor@not gate US@south west\endcsname}% + {% + \pgfpointadd{\centerpoint}{% + \tipanchor% + \pgf@xa\outerxsep% + \advance\pgf@x2.350943\pgf@xa% + }% + }% + \fi% + }% + \anchor{south east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@not gate US@south west\endcsname% + \pgfutil@tempdima\pgf@y% + \csname pgf@anchor@buffer gate US@east\endcsname% + \pgf@y\pgfutil@tempdima% + \else% + \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}% + {\csname pgf@anchor@buffer gate US@south west\endcsname}% + {% + \pgfpointadd{\centerpoint}{% + \tipanchor% + \pgf@xc\outerxsep% + \advance\pgf@x2.350943\pgf@xc% + }% + }% + \fi% + }% + \anchor{north east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \csname pgf@anchor@not gate US@north west\endcsname% + \pgfutil@tempdima\pgf@y% + \csname pgf@anchor@buffer gate US@east\endcsname% + \pgf@y\pgfutil@tempdima% + \else% + \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}% + {\csname pgf@anchor@buffer gate US@north west\endcsname}% + {% + \pgfpointadd{\centerpoint}{% + \tipanchor% + \pgf@xa\outerxsep% + \advance\pgf@x2.350943\pgf@xa% + }% + }% + \fi% + }% + \inheritanchor[from=not gate US]{south west}% + \inheritanchor[from=not gate US]{north west}% + \inheritanchor[from=not gate US]{input}% + \inheritanchor[from=not gate US]{west}% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\tipanchor}% + \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}% + \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}% + \pgfpathclose% + % + % Draw the input. + % + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname% + {% + \pgfpathcircle{% + \pgf@xa\halfside% + \pgf@x-.833333\pgf@xa% + \advance\pgf@x-.5\pgflinewidth% + \advance\pgf@x-\invertedradius% + \pgf@y0pt% + }{+\invertedradius}% + }% + \fi% + }% + }% \anchorborder{% \pgf@lib@gates@not@buffer@border{buffer gate US} - } -} + }% +}% \pgfdeclareshape{and gate CDH}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate CDH\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@and gate CDH@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@and gate CDH@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{An and gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \csname pgf@anchor@and gate CDH@east\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{mid west}{% - \csname pgf@anchor@and gate CDH@west\endcsname% - \pgf@xa\pgf@x% - \midpoint% - \pgf@x\pgf@xa} - \anchor{base}{\basepoint}% - \anchor{base east}{% - \csname pgf@anchor@and gate CDH@east\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{base west}{% - \csname pgf@anchor@and gate CDH@west\endcsname% - \pgf@xa\pgf@x% - \basepoint% - \pgf@x\pgf@xa} - \anchor{east}{% - \dimensions% - \pgfpointadd{\centerpoint}{\tipanchor}% - } - \anchor{output}{\csname pgf@anchor@and gate CDH@east\endcsname} - \anchor{north east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \tipanchor% - \pgf@xa\pgf@x% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\halfheight% - \else% - \centerpoint% - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\halfside% - \advance\pgf@x-.166666\pgf@xb% - \advance\pgf@xa\pgf@xb% - \advance\pgf@x.5\pgf@xa% - \advance\pgf@y-\pgf@xb% - \advance\pgf@ya\pgf@xb% - \advance\pgf@y.866025\pgf@ya% - \fi% - } - \anchor{south east}{% - \dimensions% - \ifpgfgateanchorsuseboundingrectangle% - \tipanchor% - \pgf@xa\pgf@x% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y-\halfheight% - \else - \centerpoint% - \pgf@xa\halfwidth% - \pgf@ya\halfheight% - \pgf@xb\halfside% - \advance\pgf@x-.166666\pgf@xb% - \advance\pgf@xa\pgf@xb% - \advance\pgf@x.5\pgf@xa% - \advance\pgf@y\pgf@xb% - \advance\pgf@ya\pgf@xb% - \advance\pgf@y-.866025\pgf@ya% - \fi% - } - \anchor{north}{% - \dimensions% - \centerpoint% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y\halfheight% - \else% - \pgf@ya\halfheight% - \advance\pgf@y.993043\pgf@ya% - \fi% - } - \anchor{south}{% - \dimensions% - \centerpoint% - \ifpgfgateanchorsuseboundingrectangle% - \advance\pgf@y-\halfheight% - \else% - \pgf@ya\halfheight% - \advance\pgf@y-.993043\pgf@ya% - \fi% - } - \anchor{south west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@y-\halfheight% - } - \anchor{north west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - \advance\pgf@y\halfheight% - } - \anchor{west}{% - \dimensions% - \centerpoint% - \pgf@xa\halfside% - \advance\pgf@x-1.16666\pgf@xa% - \advance\pgf@x-\outerxsep% - } - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% - \pgfpathclose% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@xa\halfside% - \pgf@x-1.16666\pgf@xa% - \advance\pgf@x-.5\pgflinewidth% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - }% - \anchorborder{% - \pgfextract@process\externalpoint{}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \dimensions% - \pgf@xb\halfside% - % - \pgf@xb-.166666\pgf@xb% - \ifdim\pgf@xa<\pgf@xb% - \pgfpointadd{\centerpoint}{% - \pgfpointborderrectangle{\externalpoint}{% - \pgf@xc\halfside% - \pgf@xc.166666\pgf@xc% - \advance\pgf@xc\halfwidth% - \pgfqpoint{\pgf@xc}{\halfheight}% - }% - }% - \else% - \ifdim\pgf@y=0pt\relax% - \csname pgf@anchor@and gate CDH@east\endcsname% - \else% - \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% - \pgf@xc\halfwidth% - \advance\pgf@xc\halfside% - \pgf@yc\halfheight% - \advance\pgf@yc\halfside% - \ifdim\pgf@ya<0pt% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y\halfside% - \advance\pgf@x\pgf@xb% - }% - {270}{330}{+\pgf@yc}% - \else% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \advance\pgf@y-\halfside% - \advance\pgf@x\pgf@xb% - }% - {30}{90}{+\pgf@xc and +\pgf@yc}% - \fi% - \fi% - \fi% - } -} + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate CDH\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@and gate CDH@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@and gate CDH@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An and gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \csname pgf@anchor@and gate CDH@east\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{mid west}{% + \csname pgf@anchor@and gate CDH@west\endcsname% + \pgf@xa\pgf@x% + \midpoint% + \pgf@x\pgf@xa}% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \csname pgf@anchor@and gate CDH@east\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{base west}{% + \csname pgf@anchor@and gate CDH@west\endcsname% + \pgf@xa\pgf@x% + \basepoint% + \pgf@x\pgf@xa}% + \anchor{east}{% + \dimensions% + \pgfpointadd{\centerpoint}{\tipanchor}% + }% + \anchor{output}{\csname pgf@anchor@and gate CDH@east\endcsname}% + \anchor{north east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \tipanchor% + \pgf@xa\pgf@x% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\halfheight% + \else% + \centerpoint% + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\halfside% + \advance\pgf@x-.166666\pgf@xb% + \advance\pgf@xa\pgf@xb% + \advance\pgf@x.5\pgf@xa% + \advance\pgf@y-\pgf@xb% + \advance\pgf@ya\pgf@xb% + \advance\pgf@y.866025\pgf@ya% + \fi% + }% + \anchor{south east}{% + \dimensions% + \ifpgfgateanchorsuseboundingrectangle% + \tipanchor% + \pgf@xa\pgf@x% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y-\halfheight% + \else + \centerpoint% + \pgf@xa\halfwidth% + \pgf@ya\halfheight% + \pgf@xb\halfside% + \advance\pgf@x-.166666\pgf@xb% + \advance\pgf@xa\pgf@xb% + \advance\pgf@x.5\pgf@xa% + \advance\pgf@y\pgf@xb% + \advance\pgf@ya\pgf@xb% + \advance\pgf@y-.866025\pgf@ya% + \fi% + }% + \anchor{north}{% + \dimensions% + \centerpoint% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y\halfheight% + \else% + \pgf@ya\halfheight% + \advance\pgf@y.993043\pgf@ya% + \fi% + }% + \anchor{south}{% + \dimensions% + \centerpoint% + \ifpgfgateanchorsuseboundingrectangle% + \advance\pgf@y-\halfheight% + \else% + \pgf@ya\halfheight% + \advance\pgf@y-.993043\pgf@ya% + \fi% + }% + \anchor{south west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@y-\halfheight% + }% + \anchor{north west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + \advance\pgf@y\halfheight% + }% + \anchor{west}{% + \dimensions% + \centerpoint% + \pgf@xa\halfside% + \advance\pgf@x-1.16666\pgf@xa% + \advance\pgf@x-\outerxsep% + }% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% + \pgfpathclose% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@xa\halfside% + \pgf@x-1.16666\pgf@xa% + \advance\pgf@x-.5\pgflinewidth% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \dimensions% + \pgf@xb\halfside% + % + \pgf@xb-.166666\pgf@xb% + \ifdim\pgf@xa<\pgf@xb% + \pgfpointadd{\centerpoint}{% + \pgfpointborderrectangle{\externalpoint}{% + \pgf@xc\halfside% + \pgf@xc.166666\pgf@xc% + \advance\pgf@xc\halfwidth% + \pgfqpoint{\pgf@xc}{\halfheight}% + }% + }% + \else% + \ifdim\pgf@y=0pt\relax% + \csname pgf@anchor@and gate CDH@east\endcsname% + \else% + \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}% + \pgf@xc\halfwidth% + \advance\pgf@xc\halfside% + \pgf@yc\halfheight% + \advance\pgf@yc\halfside% + \ifdim\pgf@ya<0pt% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y\halfside% + \advance\pgf@x\pgf@xb% + }% + {270}{330}{+\pgf@yc}% + \else% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \advance\pgf@y-\halfside% + \advance\pgf@x\pgf@xb% + }% + {30}{90}{+\pgf@xc and +\pgf@yc}% + \fi% + \fi% + \fi% + }% +}% \pgfdeclareshape{nand gate CDH}{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate CDH\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@nand gate CDH@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@nand gate CDH@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \pgferror{A nand gate must have at least two inputs}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS} - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \inheritanchor[from=and gate CDH]{mid east} - \inheritanchor[from=and gate CDH]{mid west} - \anchor{base}{\basepoint}% - \inheritanchor[from=and gate CDH]{base east} - \inheritanchor[from=and gate CDH]{base west} - \anchor{output}{% - \dimensions - \pgfpointadd{\centerpoint}{% - \pgf@xa\halfside% - \pgf@x-.166666\pgf@xa% - \pgf@xb2.0\pgf@xa% - \advance\pgf@x.866025\pgf@xb% - \advance\pgf@x\invertedradius% - \advance\pgf@x\outerinvertedradius% - \advance\pgf@x\outerxsep% - \pgf@y0pt% - }% - } - \inheritanchor[from=and gate CDH]{east} - \inheritanchor[from=and gate CDH]{north east} - \inheritanchor[from=and gate CDH]{south east} - \inheritanchor[from=and gate CDH]{north} - \inheritanchor[from=and gate CDH]{south} - \inheritanchor[from=and gate CDH]{south west} - \inheritanchor[from=and gate CDH]{north west} - \inheritanchor[from=and gate CDH]{west} - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \advance\pgf@xc-\outerxsep% - \advance\pgf@yc-\outerysep% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% - }% - \pgf@marshal% - } - {% - \pgf@yc2.0\pgf@yc% - \edef\pgf@marshal{% - \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% - }% - \pgf@marshal% - } - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% - \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% - \pgfpathclose% - % - % Draw the output inverter. - % - {% - \pgfpathcircle{% - \pgf@x-.166666\pgf@xc% - \pgf@yc2.0\pgf@yc% - \advance\pgf@x.866025\pgf@yc% - \advance\pgf@x\outerinvertedradius% - \pgf@y0pt% - }{+\invertedradius}% - }% - % - % Draw the inputs. - % - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{% - \pgf@xa\halfside% - \pgf@x-1.16666\pgf@xa% - \advance\pgf@x-.5\pgflinewidth% - \advance\pgf@x-\invertedradius% - \pgf@y\pgf@yc% - }{+\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - }% - \inheritanchorborder[from=and gate CDH] -}
\ No newline at end of file + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate CDH\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@nand gate CDH@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@nand gate CDH@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@AND@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{A nand gate must have at least two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + }% + \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \inheritanchor[from=and gate CDH]{mid east}% + \inheritanchor[from=and gate CDH]{mid west}% + \anchor{base}{\basepoint}%% + \inheritanchor[from=and gate CDH]{base east}% + \inheritanchor[from=and gate CDH]{base west}% + \anchor{output}{% + \dimensions + \pgfpointadd{\centerpoint}{% + \pgf@xa\halfside% + \pgf@x-.166666\pgf@xa% + \pgf@xb2.0\pgf@xa% + \advance\pgf@x.866025\pgf@xb% + \advance\pgf@x\invertedradius% + \advance\pgf@x\outerinvertedradius% + \advance\pgf@x\outerxsep% + \pgf@y0pt% + }% + }% + \inheritanchor[from=and gate CDH]{east}% + \inheritanchor[from=and gate CDH]{north east}% + \inheritanchor[from=and gate CDH]{south east}% + \inheritanchor[from=and gate CDH]{north}% + \inheritanchor[from=and gate CDH]{south}% + \inheritanchor[from=and gate CDH]{south west}% + \inheritanchor[from=and gate CDH]{north west}% + \inheritanchor[from=and gate CDH]{west}% + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \advance\pgf@xc-\outerxsep% + \advance\pgf@yc-\outerysep% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-.16666\pgf@xc}{\pgf@yc}}% + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{90}{30}{\the\pgf@yc}% + }% + \pgf@marshal% + } + {% + \pgf@yc2.0\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpatharc{-30}{-90}{\the\pgf@yc}% + }% + \pgf@marshal% + } + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{-\pgf@yc}}% + \pgfpathlineto{\pgfqpoint{-1.16666\pgf@xc}{\pgf@yc}}% + \pgfpathclose% + % + % Draw the output inverter. + % + {% + \pgfpathcircle{% + \pgf@x-.166666\pgf@xc% + \pgf@yc2.0\pgf@yc% + \advance\pgf@x.866025\pgf@yc% + \advance\pgf@x\outerinvertedradius% + \pgf@y0pt% + }{+\invertedradius}% + }% + % + % Draw the inputs. + % + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{% + \pgf@xa\halfside% + \pgf@x-1.16666\pgf@xa% + \advance\pgf@x-.5\pgflinewidth% + \advance\pgf@x-\invertedradius% + \pgf@y\pgf@yc% + }{+\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + }% + \inheritanchorborder[from=and gate CDH]% +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex index 72d6a6d22ba..68005a61478 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex @@ -13,8 +13,8 @@ \pgfkeys{/pgf/.cd,% logic gate input sep/.initial=0.125cm, logic gate inputs/.initial={normal,normal},% - logic gate inverted radius/.initial=2pt -} + logic gate inverted radius/.initial=2pt, +}% % Internal macro for parsing inputs. @@ -31,19 +31,19 @@ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@short% \fi% \pgf@lib@sh@next% -} -\def\pgf@lib@sh@itext{i} -\def\pgf@lib@sh@invertedtext{inverted} -\def\pgf@lib@sh@atchar{@} -\def\pgf@lib@sh@gobbletilat#1@{} -\def\pgf@lib@sh@gobbletilatcomma#1@,{} +}% +\def\pgf@lib@sh@itext{i}% +\def\pgf@lib@sh@invertedtext{inverted}% +\def\pgf@lib@sh@atchar{@}% +\def\pgf@lib@sh@gobbletilat#1@{}% +\def\pgf@lib@sh@gobbletilatcomma#1@,{}% % -% The `short' version for input specifcation is an extension of +% The `short' version for input specification is an extension of % ideas due to Juergen Werber and Christoph Bartoschek. % \def\pgf@lib@sh@logicgate@parseinputs@short{% \expandafter\pgf@lib@sh@logicgate@parseinputs@@short\pgf@lib@sh@temp @% -} +}% \def\pgf@lib@sh@logicgate@parseinputs@@short#1{% \def\pgf@lib@sh@tmp{#1}% \ifx\pgf@lib@sh@tmp\pgf@lib@sh@atchar% @@ -61,17 +61,17 @@ \else% \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{% \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}% - \fi% + \fi% \let\pgf@lib@sh@next=\pgf@lib@sh@logicgate@parseinputs@@short% \fi% \fi% \pgf@lib@sh@next% -} +}% \def\pgf@lib@sh@logicgate@parseinputs@long{% \expandafter\pgf@lib@sh@logicgate@parseinputs@@long\pgf@lib@sh@temp,@,% -} +}% \def\pgf@lib@sh@logicgate@parseinputs@@long#1,{% \def\pgf@lib@sh@tmp{#1}% \ifx\pgf@lib@sh@tmp\pgf@lib@sh@atchar% @@ -90,16 +90,14 @@ \else% \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{% \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}% - \fi% + \fi% \let\pgf@lib@sh@next=\pgf@lib@sh@logicgate@parseinputs@@@long% \fi% \fi% \pgf@lib@sh@next% -} +}% \def\pgf@lib@sh@logicgate@parseinputs@@@long{% \pgfutil@ifnextchar x{\pgf@lib@sh@logicgate@parseinputs@@long}% {\pgf@lib@sh@logicgate@parseinputs@@long}% -} +}% \fi% - - diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex index 39f90d6f2e6..0859687f9d4 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $ +\ProvidesFileRCS{pgflibraryshapes.arrows.code.tex} % keys for shape single arrow @@ -17,531 +17,532 @@ % /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} + 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}% - }% -} + \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}% + }% +}% @@ -555,504 +556,505 @@ % /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} + 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}% - }% -} + \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}% + }% +}% @@ -1061,1298 +1063,1299 @@ % 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} + \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,} + \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% -} + \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}% -} + \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}% + \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 +% /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 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}% - } -} + \saveddimen\shaftwidth{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box shaft width}}% + }% + % + % Calculate far the arrows extend from the center of the node. + % + \savedmacro\arrowboxpoints{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<.5\pgf@xa% + \pgf@x.5\pgf@xa% + \fi% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + % + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + % + \edef\halfboxwidth{\the\pgf@x}% + \edef\halfboxheight{\the\pgf@y}% + \pgfextract@process\arrowboxcorner{}% + \addtosavedmacro\arrowboxcorner% + % + \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxwidth}% + {\pgfkeysvalueof{/pgf/arrow box west arrow}}% + \edef\westextend{\the\pgf@x}% + \addtosavedmacro\westextend% + % + \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxwidth}% + {\pgfkeysvalueof{/pgf/arrow box east arrow}}% + \edef\eastextend{\the\pgf@x}% + \addtosavedmacro\eastextend% + % + \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxheight}% + {\pgfkeysvalueof{/pgf/arrow box north arrow}}% + \edef\northextend{\the\pgf@x}% + \addtosavedmacro\northextend% + % + \pgf@lib@arrowbox@parsearrowlength\pgf@x{\halfboxheight}% + {\pgfkeysvalueof{/pgf/arrow box south arrow}}% + \edef\southextend{\the\pgf@x}% + \addtosavedmacro\southextend% + }% + \saveddimen\arrowheadextend{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head extend}}% + }% + \saveddimen\arrowheadindent{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head indent}}% + }% + % + % Calculate the `miter' angle for the outer sep at the arrow tip. + % + \savedmacro\arrowtipmiterangle{% + \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\arrowtipmiterangle\pgfmathresult% + }% + % + % Calculate the `miter' angle for the outer sep at the point just + % before the arrow tip. + % + \savedmacro\arrowheadangles{% + % + % Calculate the `miter' angle and its cosecant at the arrow tip... + % + \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\arrowtipmiterangle\pgfmathresult% + \addtosavedmacro\arrowtipmiterangle% + \pgfmathcosec@{\arrowtipmiterangle}% + \let\cosecarrowtipmiterangle\pgfmathresult% + \addtosavedmacro\cosecarrowtipmiterangle% + % + % ...before the arrow head... + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/arrow box head extend}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/arrow box head indent}}% + \ifdim\pgf@y=0pt\relax% + \def\pgfmathresult{90}% + \else% + \ifdim\pgf@y<0pt\relax% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \pgfmathatan@{\pgfmathresult}% + \pgfmathadd@{\pgfmathresult}{180}% + \else% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \pgfmathatan@{\pgfmathresult}% + \fi% + \fi% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\beforearrowheadmiterangle\pgfmathresult% + \addtosavedmacro\beforearrowheadmiterangle% + \pgfmathcosec@{\beforearrowheadmiterangle}% + \let\cosecbeforearrowheadmiterangle\pgfmathresult% + \addtosavedmacro\cosecbeforearrowheadmiterangle% + % + % ...and before the arrow tip. + % + \pgfutil@tempdima-\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima90pt\relax% + \pgfutil@tempdimb\beforearrowheadmiterangle pt\relax% + \pgfutil@tempdimb2.0\pgfutil@tempdimb% + \advance\pgfutil@tempdimb-90pt\relax% + \advance\pgfutil@tempdima\pgfutil@tempdimb% + \divide\pgfutil@tempdima2\relax% + \edef\beforearrowtipmiterangle{\pgfmath@tonumber{\pgfutil@tempdima}}% + \addtosavedmacro\beforearrowtipmiterangle% + \pgfmathcosec@{\beforearrowtipmiterangle}% + \let\cosecbeforearrowtipmiterangle\pgfmathresult% + \addtosavedmacro\cosecbeforearrowtipmiterangle% + }% + \saveddimen\outerxsep{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + }% + \saveddimen\outerysep{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer ysep}}% + }% + % + % Calculate the (path) point immediately prior to an arrow tip. + % + \savedanchor\beforearrowtip{% + \pgfmathparse{\pgfkeysvalueof{/pgf/arrow box tip angle}}% + \pgfmathdivide@{\pgfmathresult}{2}% + \pgfmathcot@{\pgfmathresult}% + \let\cothalfangle\pgfmathresult% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/arrow box shaft width}}% + \pgf@y.5\pgf@y% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/arrow box head extend}}% + \pgf@y\pgf@y% + \pgf@x\cothalfangle\pgf@y% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt\relax% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5ex}% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \let\pgf@lib@shapes@arrowbox@referencepoint\midpoint% + \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{\eastextend}{0pt}}; + \else% + \arrowboxcorner% + \pgf@xa\pgf@x% + \midpoint% + \advance\pgf@x\pgf@xa% + \fi% + }% + \anchor{mid west}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \let\pgf@lib@shapes@arrowbox@referencepoint\midpoint% + \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{-\westextend}{0pt}}; + \else% + \arrowboxcorner% + \pgf@xa\pgf@x% + \midpoint% + \advance\pgf@x-\pgf@xa% + \fi% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \let\pgf@lib@shapes@arrowbox@referencepoint\basepoint% + \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{\eastextend}{0pt}}; + \else% + \arrowboxcorner% + \pgf@xa\pgf@x% + \basepoint% + \advance\pgf@x\pgf@xa% + \fi% + }% + \anchor{base west}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \let\pgf@lib@shapes@arrowbox@referencepoint\basepoint% + \csname pgf@anchor@arrow box@border\endcsname{\pgfqpoint{-\westextend}{0pt}}; + \else% + \arrowboxcorner% + \pgf@xa\pgf@x% + \basepoint% + \advance\pgf@x-\pgf@xa% + \fi% + }% + \anchor{north}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \csname pgf@anchor@arrow box@north arrow tip\endcsname% + \else% + \pgfpointadd{\centerpoint}{\arrowboxcorner}% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@y\pgf@ya% + \fi% + }% + \anchor{south}{% + \arrowboxpoints% + \ifdim\southextend>0pt\relax% + \csname pgf@anchor@arrow box@south arrow tip\endcsname% + \else% + \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@y-\pgf@y}% + \pgf@ya\pgf@y% + \centerpoint% + \pgf@y\pgf@ya% + \fi% + }% + \anchor{east}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \csname pgf@anchor@arrow box@east arrow tip\endcsname% + \else% + \pgfpointadd{\centerpoint}{\arrowboxcorner}% + \pgf@xa\pgf@x% + \centerpoint% + \pgf@x\pgf@xa% + \fi% + }% + \anchor{west}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \csname pgf@anchor@arrow box@west arrow tip\endcsname% + \else% + \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x}% + \pgf@xa\pgf@x% + \centerpoint% + \pgf@x\pgf@xa% + \fi% + }% + \anchor{north east}{% + \arrowboxpoints% + \pgfpointadd{\centerpoint}{\arrowboxcorner}% + }% + \anchor{north west}{% + \arrowboxpoints% + \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x}% + }% + \anchor{south west}{% + \arrowboxpoints% + \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@x-\pgf@x\pgf@y-\pgf@y}% + }% + \anchor{south east}{% + \arrowboxpoints% + \pgfpointadd{\centerpoint}{\arrowboxcorner\pgf@y-\pgf@y}% + }% + \anchor{before east arrow}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + \advance\pgf@y\outerysep\relax% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{before east arrow head}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{before east arrow tip}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + }% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{east arrow tip}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \centerpoint% + \advance\pgf@x\eastextend\relax% + \pgf@xa\outerxsep\relax% + \pgfmathcosec@{\arrowtipmiterangle}% + \advance\pgf@x\pgfmathresult\pgf@xa% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{after east arrow tip}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + }% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{after east arrow head}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{after east arrow}{% + \arrowboxpoints% + \ifdim\eastextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + \advance\pgf@y\outerysep\relax% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + % + \anchor{before west arrow}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@x-\pgf@x% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + \advance\pgf@y\outerysep\relax% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{before west arrow head}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\westextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgf@x-\pgf@x% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{before west arrow tip}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\westextend\relax% + }% + \pgf@x-\pgf@x% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{west arrow tip}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \centerpoint% + \advance\pgf@x-\westextend\relax% + \pgf@xa\outerxsep\relax% + \pgfmathcosec@{\arrowtipmiterangle}% + \advance\pgf@x-\pgfmathresult\pgf@xa% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{after west arrow tip}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\westextend\relax% + }% + \pgf@x-\pgf@x% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{after west arrow head}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima180pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\westextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgf@x-\pgf@x% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + \anchor{after west arrow}{% + \arrowboxpoints% + \ifdim\westextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + \advance\pgf@y\outerysep\relax% + \pgf@x-\pgf@x% + }% + \else% + \csname pgf@anchor@arrow box@west\endcsname% + \fi% + }% + % + \anchor{before north arrow}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + \advance\pgf@x-\outerxsep\relax% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{before north arrow head}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima270pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{before north arrow tip}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-90pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y-\pgf@xa% + \advance\pgf@y\northextend\relax% + }% + \pgf@x-\pgf@x% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{north arrow tip}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \centerpoint% + \advance\pgf@y\northextend\relax% + \pgf@ya\outerysep\relax% + \pgfmathcosec@{\arrowtipmiterangle}% + \advance\pgf@y\pgfmathresult\pgf@ya% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{after north arrow tip}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-90pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y-\pgf@xa% + \advance\pgf@y\northextend\relax% + }% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{after north arrow head}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima270pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \pgf@x-\pgf@x% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + \anchor{after north arrow}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + \advance\pgf@x\outerxsep\relax% + }% + \else% + \csname pgf@anchor@arrow box@north\endcsname% + \fi% + }% + % + \anchor{before south arrow}{% + \arrowboxpoints% + \ifdim\southextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + \advance\pgf@x\outerxsep\relax% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + \anchor{before south arrow head}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima270pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \pgf@x-\pgf@x% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + \anchor{before south arrow tip}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-90pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y-\pgf@xa% + \advance\pgf@y\northextend\relax% + }% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + \anchor{south arrow tip}{% + \arrowboxpoints% + \ifdim\southextend>0pt\relax% + \centerpoint% + \advance\pgf@y-\southextend\relax% + \pgf@ya\outerysep\relax% + \pgfmathcosec@{\arrowtipmiterangle}% + \advance\pgf@y-\pgfmathresult\pgf@ya% + \else% + \csname pgf@anchor@arrow box@east\endcsname% + \fi% + }% + \anchor{after south arrow tip}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima\arrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima\beforearrowtipmiterangle pt\relax% + \advance\pgfutil@tempdima-90pt\relax% + \pgfutil@tempdimb\outerxsep\relax% + \pgfutil@tempdimb\cosecbeforearrowtipmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y-\pgf@xa% + \advance\pgf@y\northextend\relax% + }% + \pgf@x-\pgf@x% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + \anchor{after south arrow head}{% + \arrowboxpoints% + \ifdim\northextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointadd{% + \arrowheadangles% + \pgfutil@tempdima-\beforearrowheadmiterangle pt\relax% + \advance\pgfutil@tempdima270pt\relax% + \pgfutil@tempdimb\outerysep\relax% + \pgfutil@tempdimb\cosecbeforearrowheadmiterangle\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }% + {% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + \anchor{after south arrow}{% + \arrowboxpoints% + \ifdim\southextend>0pt\relax% + \pgfpointadd{\centerpoint}{% + \arrowboxcorner% + \pgf@x-\shaftwidth\relax% + \pgf@x.5\pgf@x% + \advance\pgf@x-\outerxsep\relax% + \pgf@y-\pgf@y% + }% + \else% + \csname pgf@anchor@arrow box@south\endcsname% + \fi% + }% + % + \backgroundpath{% + \arrowboxpoints% + \pgfextract@process\arrowboxcorner{% + \arrowboxcorner% + \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% + }% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\arrowboxcorner}% + \ifdim\eastextend>0pt\relax% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + }% + \pgfpathlineto{% + \pgf@x\eastextend\relax% + \pgf@y0pt\relax% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + \pgf@y-\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@x-\pgf@x% + \advance\pgf@x\eastextend\relax% + \advance\pgf@x\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y-.5\pgf@y% + }% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@y\shaftwidth\relax% + \pgf@y-.5\pgf@y% + }% + \fi% + \pgfpathlineto{\arrowboxcorner\pgf@y-\pgf@y}% + \ifdim\southextend>0pt\relax% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + \pgf@y-\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@y\pgf@x% + \advance\pgf@y-\southextend\relax% + \advance\pgf@y-\arrowheadindent\relax% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@xa\pgf@y% + \pgf@y\pgf@x% + \advance\pgf@y-\southextend\relax% + \pgf@x\pgf@xa% + }% + \pgfpathlineto{% + \pgf@x0pt\relax% + \pgf@y-\southextend\relax% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@xa\pgf@y% + \pgf@y\pgf@x% + \advance\pgf@y-\southextend\relax% + \pgf@x-\pgf@xa% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@y\pgf@x% + \advance\pgf@y-\southextend\relax% + \advance\pgf@y-\arrowheadindent\relax% + \pgf@x\shaftwidth\relax% + \pgf@x-.5\pgf@x% + }% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x-.5\pgf@x% + \pgf@y-\pgf@y% + }% + \fi% + \pgfpathlineto{\arrowboxcorner\pgf@x-\pgf@x\pgf@y-\pgf@y}% + \ifdim\westextend>0pt\relax% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x-\pgf@x + \pgf@y\shaftwidth\relax% + \pgf@y-.5\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \advance\pgf@x-\westextend\relax% + \advance\pgf@x-\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y-.5\pgf@y% + }% + \pgfpathlineto{% + \beforearrowtip% + \advance\pgf@x-\westextend\relax% + \pgf@y-\pgf@y% + }% + \pgfpathlineto{% + \pgf@x-\westextend\relax% + \pgf@y0pt\relax% + }% + \pgfpathlineto{% + \beforearrowtip% + \advance\pgf@x-\westextend\relax% + }% + \pgfpathlineto{% + \beforearrowtip% + \advance\pgf@x-\westextend\relax% + \advance\pgf@x-\arrowheadindent\relax% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x-\pgf@x% + \pgf@y\shaftwidth\relax% + \pgf@y.5\pgf@y% + }% + \fi% + \pgfpathlineto{\arrowboxcorner\pgf@x-\pgf@x}% + \ifdim\northextend>0pt\relax% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x-.5\pgf@x% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x\shaftwidth\relax% + \pgf@x-.5\pgf@x% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@xa\pgf@y% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \pgf@x-\pgf@xa% + }% + \pgfpathlineto{% + \pgf@x0pt\relax% + \pgf@y\northextend\relax% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@xa\pgf@y% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \pgf@x\pgf@xa% + }% + \pgfpathlineto{% + \beforearrowtip% + \pgf@y-\pgf@x% + \advance\pgf@y\northextend\relax% + \advance\pgf@y\arrowheadindent\relax% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \pgfpathlineto{% + \arrowboxcorner% + \pgf@x\shaftwidth\relax% + \pgf@x.5\pgf@x% + }% + \fi% + \pgfpathclose% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \pgfutil@ifundefined{pgf@lib@shapes@arrowbox@referencepoint}% + {\let\referencepoint\centerpoint}{\let\referencepoint\pgf@lib@shapes@arrowbox@referencepoint}% + \pgfextract@process\externalpoint{% + \pgfpointadd{\referencepoint}{\externalpoint}% + }% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@north\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@north east\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before east arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{east arrow tip}% + \def\secondpoint{before east arrow tip}% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before east arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{before east arrow head}% + \def\secondpoint{before east arrow}% + \else% + \def\firstpoint{before east arrow}% + \def\secondpoint{north east}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after north arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after north arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{north east}% + \def\secondpoint{after north arrow}% + \else% + \def\firstpoint{after north arrow}% + \def\secondpoint{after north arrow head}% + \fi% + \else% + \def\firstpoint{after north arrow tip}% + \def\secondpoint{north arrow tip}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@north west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before north arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{north arrow tip}% + \def\secondpoint{before north arrow tip}% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before north arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{before north head}% + \def\secondpoint{before north arrow}% + \else% + \def\firstpoint{before north arrow}% + \def\secondpoint{north west}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after west arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after west arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{north west}% + \def\secondpoint{after west arrow}% + \else% + \def\firstpoint{after west arrow}% + \def\secondpoint{after west arrow head}% + \fi% + \else% + \def\firstpoint{after west arrow tip}% + \def\secondpoint{west arrow tip}% + \fi% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@south arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@south west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before west arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{west arrow tip}% + \def\secondpoint{before west arrow tip}% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before west arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{before west arrow head}% + \def\secondpoint{before west arrow}% + \else% + \def\firstpoint{before west arrow}% + \def\secondpoint{south west}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after south arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after south arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{south west}% + \def\secondpoint{after south arrow}% + \else% + \def\firstpoint{after south arrow}% + \def\secondpoint{after south arrow head}% + \fi% + \else% + \def\firstpoint{after south arrow tip}% + \def\secondpoint{south arrow tip}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@south east\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before south arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{south arrow tip}% + \def\secondpoint{before south arrow tip}% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@before south arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{before south arrow head}% + \def\secondpoint{before south arrow}% + \else% + \def\firstpoint{before south arrow}% + \def\secondpoint{south east}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after east arrow tip\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}% + {\csname pgf@anchor@arrow box@after east arrow\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \def\firstpoint{south east}% + \def\secondpoint{after east arrow}% + \else% + \def\firstpoint{after east arrow}% + \def\secondpoint{after east arrow head}% + \fi% + \else% + \def\firstpoint{after east arrow tip}% + \def\secondpoint{east arrow tip}% + \fi% + \fi% + \fi% + \fi% + \pgfpointintersectionoflines{\referencepoint}{\externalpoint}% + {\csname pgf@anchor@arrow box@\firstpoint\endcsname}% + {\csname pgf@anchor@arrow box@\secondpoint\endcsname}% + }% +}% + + - - \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex index cfa1d80d442..4cf4b1346b8 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex @@ -7,83 +7,83 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgflibrary{shapes.symbols} +\usepgflibrary{shapes.symbols}% % Keys for callouts % % Common to all callouts: -% /pgf/callout absolute pointer -% /pgf/callout relative pointer +% /pgf/callout absolute pointer +% /pgf/callout relative pointer % % ellipse callout only: -% /pgf/callout pointer arc +% /pgf/callout pointer arc % -% rectangle callout only: -% /pgf/callout pointer width +% rectangle callout only: +% /pgf/callout pointer width % % cloud callout only: -% /pgf/callout pointer start size -% /pgf/callout pointer end size -% /pgf/callout pointer segments +% /pgf/callout pointer start size +% /pgf/callout pointer end size +% /pgf/callout pointer segments % \newif\ifpgf@lib@callout@absolutepointer \pgfkeys{/pgf/.cd, - callout pointer arc/.initial=15, - callout pointer width/.initial=.25cm, - callout pointer start size/.initial=.2 of callout, - callout pointer end size/.initial=.1 of callout, - callout pointer segments/.initial=2, - callout absolute pointer/.code={\pgf@lib@callout@makeabsolutepointer{#1}}, - callout relative pointer/.code={\pgf@lib@callout@makerelativepointer{#1}}, - callout pointer shorten/.initial=0cm -} + callout pointer arc/.initial=15, + callout pointer width/.initial=.25cm, + callout pointer start size/.initial=.2 of callout, + callout pointer end size/.initial=.1 of callout, + callout pointer segments/.initial=2, + callout absolute pointer/.code={\pgf@lib@callout@makeabsolutepointer{#1}}, + callout relative pointer/.code={\pgf@lib@callout@makerelativepointer{#1}}, + callout pointer shorten/.initial=0cm, +}% \def\pgf@lib@callout@makeabsolutepointer#1{% - \pgf@lib@callout@absolutepointertrue% - {% - \pgftransformshift{#1}% - \pgfmultipartnode{coordinate}{center}{pgf@lib@callout@pointer}{}% - }% -} + \pgf@lib@callout@absolutepointertrue% + {% + \pgftransformshift{#1}% + \pgfmultipartnode{coordinate}{center}{pgf@lib@callout@pointer}{}% + }% +}% \def\pgf@lib@callout@makerelativepointer#1{% - \pgf@lib@callout@absolutepointerfalse% - \def\pgf@lib@callout@relativepointer{#1}% -} -\pgfkeys{/pgf/callout relative pointer=\pgfpointpolar{300}{.5cm}} + \pgf@lib@callout@absolutepointerfalse% + \def\pgf@lib@callout@relativepointer{#1}% +}% +\pgfkeys{/pgf/callout relative pointer=\pgfpointpolar{300}{.5cm}}% % Shape ellipse callout % % \pgfdeclareshape{ellipse callout}{% - \savedmacro\ellipsecalloutpoints{% - % - % Get the larger of the outer sep. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x>\pgf@y% - \edef\outersep{\the\pgf@x}% - \else% - \edef\outersep{\the\pgf@y}% - \fi% - \addtosavedmacro\outersep% - % - % Calculate the node dimensions... - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% + \savedmacro\ellipsecalloutpoints{% + % + % Get the larger of the outer sep. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x>\pgf@y% + \edef\outersep{\the\pgf@x}% + \else% + \edef\outersep{\the\pgf@y}% + \fi% + \addtosavedmacro\outersep% + % + % Calculate the node dimensions... + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% \pgf@x1.4142136\pgf@x% \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% \ifdim\pgf@x<.5\pgf@xa% \pgf@x.5\pgf@xa% \fi% % - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y.5\dp\pgfnodeparttextbox% \pgf@y1.4142136\pgf@y% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% @@ -105,177 +105,177 @@ % \addtosavedmacro\xradius% \addtosavedmacro\xpathradius% - \addtosavedmacro\yradius% + \addtosavedmacro\yradius% \addtosavedmacro\ypathradius% - % - \pgfmathsetmacro\pointerarc{\pgfkeysvalueof{/pgf/callout pointer arc}}% - \addtosavedmacro\pointerarc% - % - \pgfextract@process\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - % - % Get the realtive pointer. - % - \ifpgf@lib@callout@absolutepointer% - \else% - \pgfextract@process\calloutpointer{% - \pgfextract@process\borderpoint{% - \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}{\pgfqpoint{\xpathradius}{\ypathradius}}% - }% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% - \let\pointerangle\pgfmathresult% - \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - \edef\pointerradius{\pgfmathresult pt}% - \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - \addtosavedmacro\calloutpointer% - \pgf@lib@callouts@shortenpointer% - \pgf@lib@ellipsecallout@getpoints% - \addtosavedmacro\calloutpointeranchor% - \addtosavedmacro\beforecalloutangle% - \addtosavedmacro\aftercalloutangle% - \fi% + % + \pgfmathsetmacro\pointerarc{\pgfkeysvalueof{/pgf/callout pointer arc}}% + \addtosavedmacro\pointerarc% + % + \pgfextract@process\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + % + % Get the relative pointer. + % + \ifpgf@lib@callout@absolutepointer% + \else% + \pgfextract@process\calloutpointer{% + \pgfextract@process\borderpoint{% + \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}{\pgfqpoint{\xpathradius}{\ypathradius}}% + }% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% + \let\pointerangle\pgfmathresult% + \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \edef\pointerradius{\pgfmathresult pt}% + \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + \addtosavedmacro\calloutpointer% + \pgf@lib@callouts@shortenpointer% + \pgf@lib@ellipsecallout@getpoints% + \addtosavedmacro\calloutpointeranchor% + \addtosavedmacro\beforecalloutangle% + \addtosavedmacro\aftercalloutangle% + \fi% }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } + }% \savedanchor\midpoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@y{+.5ex}% - } + }% \savedanchor\basepoint{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y0pt\relax% - } + }% \anchor{center}{\centerpoint}% \anchor{mid}{\midpoint}% \anchor{mid east}{% - \ellipsecalloutpoints% - \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x\xradius}{\midpoint}% - {\centerpoint}{270}{450}{\xradius and \yradius}% + \ellipsecalloutpoints% + \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x\xradius}{\midpoint}% + {\centerpoint}{270}{450}{\xradius and \yradius}% }% \anchor{mid west}{% - \ellipsecalloutpoints% - \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x-\xradius}{\midpoint}% - {\centerpoint}{90}{270}{\xradius and \yradius}% + \ellipsecalloutpoints% + \pgfmathpointintersectionoflineandarc{\midpoint\advance\pgf@x-\xradius}{\midpoint}% + {\centerpoint}{90}{270}{\xradius and \yradius}% }% \anchor{base}{\basepoint}% \anchor{base east}{% - \ellipsecalloutpoints% - \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x\xradius}{\basepoint}% - {\centerpoint}{270}{450}{\xradius and \yradius}% + \ellipsecalloutpoints% + \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x\xradius}{\basepoint}% + {\centerpoint}{270}{450}{\xradius and \yradius}% }% \anchor{base west}{% - \ellipsecalloutpoints% - \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x-\xradius}{\basepoint}% - {\centerpoint}{90}{270}{\xradius and \yradius}% + \ellipsecalloutpoints% + \pgfmathpointintersectionoflineandarc{\basepoint\advance\pgf@x-\xradius}{\basepoint}% + {\centerpoint}{90}{270}{\xradius and \yradius}% }% \anchor{north}{% - \ellipsecalloutpoints% - \centerpoint% - \advance\pgf@y\yradius\relax% - } + \ellipsecalloutpoints% + \centerpoint% + \advance\pgf@y\yradius\relax% + }% \anchor{south}{% - \ellipsecalloutpoints% - \centerpoint% - \advance\pgf@y-\yradius\relax% - } + \ellipsecalloutpoints% + \centerpoint% + \advance\pgf@y-\yradius\relax% + }% \anchor{east}{% - \ellipsecalloutpoints% - \centerpoint% - \advance\pgf@x\xradius\relax% - } + \ellipsecalloutpoints% + \centerpoint% + \advance\pgf@x\xradius\relax% + }% \anchor{west}{% - \ellipsecalloutpoints% - \centerpoint% - \advance\pgf@x-\xradius\relax% - } + \ellipsecalloutpoints% + \centerpoint% + \advance\pgf@x-\xradius\relax% + }% \anchor{north west}{% - \ellipsecalloutpoints% - \pgf@xa\xradius\relax% - \pgf@ya\yradius\relax% - \centerpoint% - \advance\pgf@y0.7071067\pgf@ya% - \advance\pgf@x-0.7071067\pgf@xa% - } + \ellipsecalloutpoints% + \pgf@xa\xradius\relax% + \pgf@ya\yradius\relax% + \centerpoint% + \advance\pgf@y0.7071067\pgf@ya% + \advance\pgf@x-0.7071067\pgf@xa% + }% \anchor{north east}{% - \ellipsecalloutpoints% - \pgf@xa\xradius\relax% - \pgf@ya\yradius\relax% - \centerpoint% - \advance\pgf@y0.7071067\pgf@ya% - \advance\pgf@x0.7071067\pgf@xa% - } + \ellipsecalloutpoints% + \pgf@xa\xradius\relax% + \pgf@ya\yradius\relax% + \centerpoint% + \advance\pgf@y0.7071067\pgf@ya% + \advance\pgf@x0.7071067\pgf@xa% + }% \anchor{south west}{% - \ellipsecalloutpoints% - \pgf@xa\xradius\relax% - \pgf@ya\yradius\relax% - \centerpoint% - \advance\pgf@y-0.7071067\pgf@ya% - \advance\pgf@x-0.7071067\pgf@xa% - } + \ellipsecalloutpoints% + \pgf@xa\xradius\relax% + \pgf@ya\yradius\relax% + \centerpoint% + \advance\pgf@y-0.7071067\pgf@ya% + \advance\pgf@x-0.7071067\pgf@xa% + }% \anchor{south east}{% - \ellipsecalloutpoints% - \pgf@xa\xradius\relax% - \pgf@ya\yradius\relax% - \centerpoint% - \advance\pgf@y-0.7071067\pgf@ya% - \advance\pgf@x0.7071067\pgf@xa% - } + \ellipsecalloutpoints% + \pgf@xa\xradius\relax% + \pgf@ya\yradius\relax% + \centerpoint% + \advance\pgf@y-0.7071067\pgf@ya% + \advance\pgf@x0.7071067\pgf@xa% + }% \anchor{pointer}{% - \ellipsecalloutpoints% - \calloutpointeranchor% - }% + \ellipsecalloutpoints% + \calloutpointeranchor% + }% \backgroundpath{% - \ellipsecalloutpoints% - \ifpgf@lib@callout@absolutepointer% - \pgfextract@process\calloutpointer{% - \pgfpointanchor{pgf@lib@callout@pointer}{center}% - }% - \pgf@lib@callouts@shortenpointer% - \pgf@lib@ellipsecallout@getpoints% - \calloutpointeranchor% - \ifx\pgf@node@name\pgfutil@empty% - \else% - \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% - \edef\pgf@sh@@@temp{% - \noexpand\def\noexpand\calloutpointeranchor{% - \noexpand\pgf@x\the\pgf@x% - \noexpand\pgf@y\the\pgf@y% - }% - }% - \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp} - \fi% - \fi% - \pgfpathmoveto{\calloutpointer}% - \pgfpathlineto{\aftercalloutpointer}% - \ifdim\aftercalloutangle pt<\beforecalloutangle pt\relax% - \pgfpatharc{\aftercalloutangle}{\beforecalloutangle}{\xpathradius and \ypathradius}% - \else% - \pgfpatharc{\aftercalloutangle}{360}{\xpathradius and \ypathradius}% - \pgfpatharc{0}{\beforecalloutangle}{\xpathradius and \ypathradius}% - \fi% - \pgfpathclose% - }% + \ellipsecalloutpoints% + \ifpgf@lib@callout@absolutepointer% + \pgfextract@process\calloutpointer{% + \pgfpointanchor{pgf@lib@callout@pointer}{center}% + }% + \pgf@lib@callouts@shortenpointer% + \pgf@lib@ellipsecallout@getpoints% + \calloutpointeranchor% + \ifx\pgf@node@name\pgfutil@empty% + \else% + \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% + \edef\pgf@sh@@@temp{% + \noexpand\def\noexpand\calloutpointeranchor{% + \noexpand\pgf@x\the\pgf@x% + \noexpand\pgf@y\the\pgf@y% + }% + }% + \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp} + \fi% + \fi% + \pgfpathmoveto{\calloutpointer}% + \pgfpathlineto{\aftercalloutpointer}% + \ifdim\aftercalloutangle pt<\beforecalloutangle pt\relax% + \pgfpatharc{\aftercalloutangle}{\beforecalloutangle}{\xpathradius and \ypathradius}% + \else% + \pgfpatharc{\aftercalloutangle}{360}{\xpathradius and \ypathradius}% + \pgfpatharc{0}{\beforecalloutangle}{\xpathradius and \ypathradius}% + \fi% + \pgfpathclose% + }% \anchorborder{% - \pgfextract@process\externalpoint{}% - \ellipsecalloutpoints% - \pgfpointadd{\pgfpointborderellipse{\externalpoint}{\pgfpoint{\xradius}{\yradius}}% - }{\centerpoint}% + \pgfextract@process\externalpoint{}% + \ellipsecalloutpoints% + \pgfpointadd{\pgfpointborderellipse{\externalpoint}{\pgfpoint{\xradius}{\yradius}}% + }{\centerpoint}% }% -} +}% % Internal macro for calculating the points for the % ellipse callout pointer. @@ -289,334 +289,334 @@ % \ypathradius - the y radius of the ellipse. % \def\pgf@lib@ellipsecallout@getpoints{% - \pgfextract@process\borderpoint{% - \pgfpointborderellipse{% - \centerpoint% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \calloutpointer% - \advance\pgf@x-\pgf@xa% - \advance\pgf@y-\pgf@ya% - }{\pgfqpoint{\xpathradius}{\ypathradius}}% - }% - \pgfmathangleonellipse{\borderpoint}{\xpathradius and \ypathradius}% - \pgfutil@tempdima\pointerarc pt\relax% - \pgfutil@tempdimb\pgfmathresult pt\relax% - \advance\pgfutil@tempdimb-.5\pgfutil@tempdima% - \ifdim\pgfutil@tempdimb<0pt\relax% - \advance\pgfutil@tempdimb360pt\relax% - \fi% - \edef\beforecalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}% - \advance\pgfutil@tempdimb\pgfutil@tempdima% - \ifdim\pgfutil@tempdimb<360pt\relax% - \else% - \advance\pgfutil@tempdimb-360pt\relax% - \fi% - \edef\aftercalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}% - % - \pgfextract@process\beforecalloutpointer{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{\beforecalloutangle}{\xpathradius and \ypathradius}% - }% - }% - \pgfextract@process\aftercalloutpointer{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{\aftercalloutangle}{\xpathradius and \ypathradius}% - }% - }% - % - % Calculate the pointer anchor. - % - \pgf@lib@callouts@pointeranchor% -} + \pgfextract@process\borderpoint{% + \pgfpointborderellipse{% + \centerpoint% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \calloutpointer% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + }{\pgfqpoint{\xpathradius}{\ypathradius}}% + }% + \pgfmathangleonellipse{\borderpoint}{\xpathradius and \ypathradius}% + \pgfutil@tempdima\pointerarc pt\relax% + \pgfutil@tempdimb\pgfmathresult pt\relax% + \advance\pgfutil@tempdimb-.5\pgfutil@tempdima% + \ifdim\pgfutil@tempdimb<0pt\relax% + \advance\pgfutil@tempdimb360pt\relax% + \fi% + \edef\beforecalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}% + \advance\pgfutil@tempdimb\pgfutil@tempdima% + \ifdim\pgfutil@tempdimb<360pt\relax% + \else% + \advance\pgfutil@tempdimb-360pt\relax% + \fi% + \edef\aftercalloutangle{\pgfmath@tonumber{\pgfutil@tempdimb}}% + % + \pgfextract@process\beforecalloutpointer{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{\beforecalloutangle}{\xpathradius and \ypathradius}% + }% + }% + \pgfextract@process\aftercalloutpointer{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{\aftercalloutangle}{\xpathradius and \ypathradius}% + }% + }% + % + % Calculate the pointer anchor. + % + \pgf@lib@callouts@pointeranchor% +}% -% If the callout pointer is very pointed and stroked, the anchor will be +% If the callout pointer is very pointed and stroked, the anchor will be % miles away from the end of the pointer which will (typically) be -% bevelled. +% bevelled. % Using outer sep=0pt is one solution, however, another is provided % using this special key: % % /pgf/callout pointer anchor aspect -% +% % which takes a value from 0 (ignore any outer sep) to 1 (use % the full outer sep). -\pgfkeys{/pgf/callout pointer anchor aspect/.initial=1} +\pgfkeys{/pgf/callout pointer anchor aspect/.initial=1}% % Internal macro for calculating the anchor for the callout pointer. % % Requires the following to be set up (points are anti-clockwise) % -% \beforecalloutpointer - point on the border before the callout pointer -% \calloutpointer +% \beforecalloutpointer - point on the border before the callout pointer +% \calloutpointer % \aftercalloutpointer - point on the border after the callout pointer % \outersep - the largest of the outer xsep or ysep. % \def\pgf@lib@callouts@pointeranchor{% - \pgfutil@tempdimb\outersep\relax% - % - \pgfmathanglebetweenlines{\calloutpointer}{\aftercalloutpointer}{\calloutpointer}{\beforecalloutpointer}% - \pgfmathdivide@{\pgfmathresult}{2}% - \pgfutil@tempdima\pgfmathresult pt\relax% - \pgfmathcosec@{\pgfmathresult}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \pgfmathanglebetweenpoints{\calloutpointer}{\aftercalloutpointer}% - \advance\pgfutil@tempdima\pgfmathresult pt\relax% - \advance\pgfutil@tempdima180pt\relax% - % - \pgfextract@process\calloutpointeranchor{% - \pgfpointadd{% - \pgfmathparse{\pgfkeysvalueof{/pgf/callout pointer anchor aspect}}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% - }{% - \calloutpointer% - }% - }% + \pgfutil@tempdimb\outersep\relax% + % + \pgfmathanglebetweenlines{\calloutpointer}{\aftercalloutpointer}{\calloutpointer}{\beforecalloutpointer}% + \pgfmathdivide@{\pgfmathresult}{2}% + \pgfutil@tempdima\pgfmathresult pt\relax% + \pgfmathcosec@{\pgfmathresult}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \pgfmathanglebetweenpoints{\calloutpointer}{\aftercalloutpointer}% + \advance\pgfutil@tempdima\pgfmathresult pt\relax% + \advance\pgfutil@tempdima180pt\relax% + % + \pgfextract@process\calloutpointeranchor{% + \pgfpointadd{% + \pgfmathparse{\pgfkeysvalueof{/pgf/callout pointer anchor aspect}}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + }{% + \calloutpointer% + }% + }% }% \def\pgf@lib@callouts@shortenpointer{% - \pgfextract@process\calloutpointer{% - \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}% - \let\angle\pgfmathresult% - \pgfmathsin@{\angle}% - \let\sinpointerangle\pgfmathresult% - \pgfmathcos@{\angle}% - \let\cospointerangle\pgfmathresult% - \pgfpointadd{\calloutpointer}{% - \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/callout pointer shorten}}% - \pgf@x\cospointerangle\pgfutil@tempdima% - \pgf@y\sinpointerangle\pgfutil@tempdima% - }% - }% + \pgfextract@process\calloutpointer{% + \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}% + \let\angle\pgfmathresult% + \pgfmathsin@{\angle}% + \let\sinpointerangle\pgfmathresult% + \pgfmathcos@{\angle}% + \let\cospointerangle\pgfmathresult% + \pgfpointadd{\calloutpointer}{% + \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/callout pointer shorten}}% + \pgf@x\cospointerangle\pgfutil@tempdima% + \pgf@y\sinpointerangle\pgfutil@tempdima% + }% + }% }% - + \pgfdeclareshape{rectangle callout}{% - \savedmacro\rectanglecalloutpoints{% - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@x<.5\pgf@xa% - \pgf@x.5\pgf@xa% - \fi% - \edef\xtemp{\the\pgf@x}% - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - % - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<.5\pgf@ya% - \pgf@y.5\pgf@ya% - \fi% - \edef\ytemp{\the\pgf@y}% - \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - % - \edef\xlength{\the\pgf@x}% - \edef\ylength{\the\pgf@y}% - \addtosavedmacro\xlength% - \addtosavedmacro\ylength% - % - \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}% - \addtosavedmacro\pointerwidth% - % - \pgfextract@process\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - % - % Process the relative callout pointer. - % - \ifpgf@lib@callout@absolutepointer% - \else% - \pgfextract@process\calloutpointer{% - \pgfextract@process\borderpoint{% - \expandafter\pgfpointborderrectangle\expandafter{\pgf@lib@callout@relativepointer}% - {\pgfqpoint{\xtemp}{\ytemp}}% - }% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% - \let\pointerangle\pgfmathresult% - \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - \edef\pointerradius{\pgfmathresult pt}% - \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgf@lib@callouts@shortenpointer% - \addtosavedmacro\calloutpointer% - \pgf@lib@rectanglecallout@pointer% - \addtosavedmacro\calloutpointeranchor% - \addtosavedmacro\beforecalloutpointer% - \addtosavedmacro\aftercalloutpointer% - \addtosavedmacro\firstpoint% - \addtosavedmacro\secondpoint% - \addtosavedmacro\thirdpoint% - \addtosavedmacro\fourthpoint% - \fi% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt\relax% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5em}% - } - \anchor{center}{\centerpoint} - \anchor{mid}{\midpoint} - \anchor{mid east}{% - \rectanglecalloutpoints% - \midpoint% - \advance\pgf@x\xlength\relax% - } - \anchor{mid west}{% - \rectanglecalloutpoints% - \midpoint% - \advance\pgf@x-\xlength\relax% - } - \anchor{base}{\basepoint} - \anchor{base east}{% - \rectanglecalloutpoints% - \basepoint% - \advance\pgf@x\xlength\relax% - } - \anchor{base west}{% - \rectanglecalloutpoints% - \basepoint% - \advance\pgf@x-\xlength\relax% - } - \anchor{north}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@y\ylength\relax% - }% - \anchor{south}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@y-\ylength\relax% - }% - \anchor{east}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x\xlength\relax% - }% - \anchor{west}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x-\xlength\relax% - }% - \anchor{north east}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x\xlength\relax% - \advance\pgf@y\ylength\relax% - }% - \anchor{south west}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x-\xlength\relax% - \advance\pgf@y-\ylength\relax% - }% - \anchor{south east}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x\xlength\relax% - \advance\pgf@y-\ylength\relax% - }% - \anchor{north west}{% - \rectanglecalloutpoints% - \centerpoint% - \advance\pgf@x-\xlength\relax% - \advance\pgf@y\ylength\relax% - }% - \anchor{pointer}{% - \rectanglecalloutpoints% - \calloutpointeranchor% - }% - \backgroundpath{% - \rectanglecalloutpoints% - \pgf@x\xlength\relax% - \pgf@y\ylength\relax% - \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% - \edef\xtemp{\the\pgf@x}% - \edef\ytemp{\the\pgf@y}% - % - % The absolute pointer must be calculated here because the - % anchor of the shape (which is calculated after the saved - % macros and points) affects how the pointer joins the - % main rectangle. - % - \ifpgf@lib@callout@absolutepointer% - \pgfextract@process\calloutpointer{% - \pgfpointanchor{pgf@lib@callout@pointer}{center}% - }% - \pgf@lib@callouts@shortenpointer% - \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}% - \pgf@lib@rectanglecallout@pointer% - % - % \pgf@node@name = the shape name (from \pgfmultipartnode) - % - \ifx\pgf@node@name\pgfutil@empty% - \else% - % - % Now hack an extra saved anchor \calloutpointeranchor, - % with the new anchor for the callout pointer. - % - \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% - \edef\pgf@sh@@@temp{% - \noexpand\def\noexpand\calloutpointeranchor{% - \noexpand\pgf@x\the\pgf@x% - \noexpand\pgf@y\the\pgf@y% - }% - }% - \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}% - \fi% - \fi% - {% - \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% - \pgfpathmoveto{\beforecalloutpointer}% - }% - \pgfpathlineto{\calloutpointer}% - {% - \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% - \pgfpathlineto{\aftercalloutpointer}% - }% - {% - \pgftransformshift{\centerpoint}% - \pgfpathlineto{\firstpoint}% - \pgfpathlineto{\secondpoint}% - \pgfpathlineto{\thirdpoint}% - \pgfpathlineto{\fourthpoint}% - {% - \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% - \pgfpathclose% - }% - } - } - \anchorborder{% - \pgfextract@process\externalpoint{}% - \rectanglecalloutpoints% - \pgfpointadd{\centerpoint}% - {% - \pgfpointborderrectangle{\pgfpointadd{\centerpoint}{\externalpoint}}% - {\pgfqpoint{\xlength}{\ylength}}% - }% - }% -} + \savedmacro\rectanglecalloutpoints{% + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<.5\pgf@xa% + \pgf@x.5\pgf@xa% + \fi% + \edef\xtemp{\the\pgf@x}% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + % + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \edef\ytemp{\the\pgf@y}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + % + \edef\xlength{\the\pgf@x}% + \edef\ylength{\the\pgf@y}% + \addtosavedmacro\xlength% + \addtosavedmacro\ylength% + % + \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}% + \addtosavedmacro\pointerwidth% + % + \pgfextract@process\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + % + % Process the relative callout pointer. + % + \ifpgf@lib@callout@absolutepointer% + \else% + \pgfextract@process\calloutpointer{% + \pgfextract@process\borderpoint{% + \expandafter\pgfpointborderrectangle\expandafter{\pgf@lib@callout@relativepointer}% + {\pgfqpoint{\xtemp}{\ytemp}}% + }% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% + \let\pointerangle\pgfmathresult% + \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \edef\pointerradius{\pgfmathresult pt}% + \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgf@lib@callouts@shortenpointer% + \addtosavedmacro\calloutpointer% + \pgf@lib@rectanglecallout@pointer% + \addtosavedmacro\calloutpointeranchor% + \addtosavedmacro\beforecalloutpointer% + \addtosavedmacro\aftercalloutpointer% + \addtosavedmacro\firstpoint% + \addtosavedmacro\secondpoint% + \addtosavedmacro\thirdpoint% + \addtosavedmacro\fourthpoint% + \fi% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt\relax% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5em}% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \rectanglecalloutpoints% + \midpoint% + \advance\pgf@x\xlength\relax% + }% + \anchor{mid west}{% + \rectanglecalloutpoints% + \midpoint% + \advance\pgf@x-\xlength\relax% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \rectanglecalloutpoints% + \basepoint% + \advance\pgf@x\xlength\relax% + }% + \anchor{base west}{% + \rectanglecalloutpoints% + \basepoint% + \advance\pgf@x-\xlength\relax% + }% + \anchor{north}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@y\ylength\relax% + }% + \anchor{south}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@y-\ylength\relax% + }% + \anchor{east}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x\xlength\relax% + }% + \anchor{west}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x-\xlength\relax% + }% + \anchor{north east}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x\xlength\relax% + \advance\pgf@y\ylength\relax% + }% + \anchor{south west}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x-\xlength\relax% + \advance\pgf@y-\ylength\relax% + }% + \anchor{south east}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x\xlength\relax% + \advance\pgf@y-\ylength\relax% + }% + \anchor{north west}{% + \rectanglecalloutpoints% + \centerpoint% + \advance\pgf@x-\xlength\relax% + \advance\pgf@y\ylength\relax% + }% + \anchor{pointer}{% + \rectanglecalloutpoints% + \calloutpointeranchor% + }% + \backgroundpath{% + \rectanglecalloutpoints% + \pgf@x\xlength\relax% + \pgf@y\ylength\relax% + \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% + \edef\xtemp{\the\pgf@x}% + \edef\ytemp{\the\pgf@y}% + % + % The absolute pointer must be calculated here because the + % anchor of the shape (which is calculated after the saved + % macros and points) affects how the pointer joins the + % main rectangle. + % + \ifpgf@lib@callout@absolutepointer% + \pgfextract@process\calloutpointer{% + \pgfpointanchor{pgf@lib@callout@pointer}{center}% + }% + \pgf@lib@callouts@shortenpointer% + \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}% + \pgf@lib@rectanglecallout@pointer% + % + % \pgf@node@name = the shape name (from \pgfmultipartnode) + % + \ifx\pgf@node@name\pgfutil@empty% + \else% + % + % Now hack an extra saved anchor \calloutpointeranchor, + % with the new anchor for the callout pointer. + % + \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% + \edef\pgf@sh@@@temp{% + \noexpand\def\noexpand\calloutpointeranchor{% + \noexpand\pgf@x\the\pgf@x% + \noexpand\pgf@y\the\pgf@y% + }% + }% + \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}% + \fi% + \fi% + {% + \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% + \pgfpathmoveto{\beforecalloutpointer}% + }% + \pgfpathlineto{\calloutpointer}% + {% + \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% + \pgfpathlineto{\aftercalloutpointer}% + }% + {% + \pgftransformshift{\centerpoint}% + \pgfpathlineto{\firstpoint}% + \pgfpathlineto{\secondpoint}% + \pgfpathlineto{\thirdpoint}% + \pgfpathlineto{\fourthpoint}% + {% + \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}% + \pgfpathclose% + }% + } + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \rectanglecalloutpoints% + \pgfpointadd{\centerpoint}% + {% + \pgfpointborderrectangle{\pgfpointadd{\centerpoint}{\externalpoint}}% + {\pgfqpoint{\xlength}{\ylength}}% + }% + }% +}% @@ -632,145 +632,145 @@ % \pointerwidth - the width of the pointer. % \def\pgf@lib@rectanglecallout@pointer{% - % - % Ensure that the pointer never connects to the main shape - % too near to a corner. This is done for two reasons: - % 1. It can look ugly. - % 2. If the corners are rounded, a mess can result. - % - \pgfextract@process\borderpoint{% - \pgfpointborderrectangle{% - \centerpoint% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \calloutpointer% - \advance\pgf@x-\pgf@xa% - \advance\pgf@y-\pgf@ya% - }{\pgfqpoint{\xtemp}{\ytemp}}% - }% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% - \let\borderangle\pgfmathresult% - % - \pgfutil@tempdima\pointerwidth\relax% - \pgf@xa\xtemp\relax% - \advance\pgf@xa-\pgfutil@tempdima% - \pgf@ya\ytemp\relax% - \advance\pgf@ya-\pgfutil@tempdima% - % - \pgf@process{% - \pgfutil@ifundefined{pgf@corner@arc}{\pgfpointorigin}{% - \expandafter\pgfqpoint\pgf@corner@arc}% - }% - \advance\pgf@xa-\pgf@x% - \advance\pgf@ya-\pgf@y% - % - \borderpoint% - \pgf@xb\pgf@x% - \pgf@yb\pgf@y% - % - \pgf@xc0pt\relax% - \pgf@yc0pt\relax% - % - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{\ytemp}}% - \ifdim\borderangle pt<\pgfmathresult pt\relax% - \pgf@yc.5\pgfutil@tempdima% - \ifdim\pgf@yb>\pgf@ya% - \pgf@yb\pgf@ya% - \fi% - % - % Establish the order for drawing the rectangle corners. - % - \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% - \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% - \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% - \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% - \else% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{\ytemp}}% - \ifdim\borderangle pt<\pgfmathresult pt\relax% - \pgf@xc-.5\pgfutil@tempdima% - \ifdim\pgf@xb>\pgf@xa% - \pgf@xb\pgf@xa% - \else% - \ifdim\pgf@xb<-\pgf@xa% - \pgf@xb-\pgf@xa% - \fi% - \fi% - \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% - \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% - \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% - \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% - \else% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{-\ytemp}}% - \ifdim\borderangle pt<\pgfmathresult pt\relax% - \pgf@yc-.5\pgfutil@tempdima% - \ifdim\pgf@yb>\pgf@ya% - \pgf@yb\pgf@ya% - \else% - \ifdim\pgf@yb<-\pgf@ya% - \pgf@yb-\pgf@ya% - \fi% - \fi% - \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% - \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% - \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% - \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% - \else% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{-\ytemp}}% - \ifdim\borderangle pt<\pgfmathresult pt\relax% - \pgf@xc.5\pgfutil@tempdima% - \ifdim\pgf@xb>\pgf@xa% - \pgf@xb\pgf@xa% - \else% - \ifdim\pgf@xb<-\pgf@xa% - \pgf@xb-\pgf@xa% - \fi% - \fi% - \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% - \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% - \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% - \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% - \else% - \pgf@yc.5\pgfutil@tempdima% - \ifdim\pgf@yb<-\pgf@ya% - \pgf@yb-\pgf@ya% - \fi% - \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% - \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% - \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% - \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% - \fi% - \fi% - \fi% - \fi% - \pgfextract@process\beforecalloutpointer{% - \centerpoint% - \advance\pgf@x\pgf@xb% - \advance\pgf@y\pgf@yb% - \advance\pgf@x-\pgf@xc% - \advance\pgf@y-\pgf@yc% - }% - \pgfextract@process\aftercalloutpointer{% - \centerpoint% - \advance\pgf@x\pgf@xb% - \advance\pgf@y\pgf@yb% - \advance\pgf@x\pgf@xc% - \advance\pgf@y\pgf@yc% - }% - % - % Now calculate the pointer anchor. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x>\pgf@y% - \edef\outersep{\the\pgf@x}% - \else% - \edef\outersep{\the\pgf@y}% - \fi% - \pgf@lib@callouts@pointeranchor% -} + % + % Ensure that the pointer never connects to the main shape + % too near to a corner. This is done for two reasons: + % 1. It can look ugly. + % 2. If the corners are rounded, a mess can result. + % + \pgfextract@process\borderpoint{% + \pgfpointborderrectangle{% + \centerpoint% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \calloutpointer% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + }{\pgfqpoint{\xtemp}{\ytemp}}% + }% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% + \let\borderangle\pgfmathresult% + % + \pgfutil@tempdima\pointerwidth\relax% + \pgf@xa\xtemp\relax% + \advance\pgf@xa-\pgfutil@tempdima% + \pgf@ya\ytemp\relax% + \advance\pgf@ya-\pgfutil@tempdima% + % + \pgf@process{% + \pgfutil@ifundefined{pgf@corner@arc}{\pgfpointorigin}{% + \expandafter\pgfqpoint\pgf@corner@arc}% + }% + \advance\pgf@xa-\pgf@x% + \advance\pgf@ya-\pgf@y% + % + \borderpoint% + \pgf@xb\pgf@x% + \pgf@yb\pgf@y% + % + \pgf@xc0pt\relax% + \pgf@yc0pt\relax% + % + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{\ytemp}}% + \ifdim\borderangle pt<\pgfmathresult pt\relax% + \pgf@yc.5\pgfutil@tempdima% + \ifdim\pgf@yb>\pgf@ya% + \pgf@yb\pgf@ya% + \fi% + % + % Establish the order for drawing the rectangle corners. + % + \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% + \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% + \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% + \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% + \else% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{\ytemp}}% + \ifdim\borderangle pt<\pgfmathresult pt\relax% + \pgf@xc-.5\pgfutil@tempdima% + \ifdim\pgf@xb>\pgf@xa% + \pgf@xb\pgf@xa% + \else% + \ifdim\pgf@xb<-\pgf@xa% + \pgf@xb-\pgf@xa% + \fi% + \fi% + \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% + \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% + \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% + \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% + \else% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{-\xtemp}{-\ytemp}}% + \ifdim\borderangle pt<\pgfmathresult pt\relax% + \pgf@yc-.5\pgfutil@tempdima% + \ifdim\pgf@yb>\pgf@ya% + \pgf@yb\pgf@ya% + \else% + \ifdim\pgf@yb<-\pgf@ya% + \pgf@yb-\pgf@ya% + \fi% + \fi% + \edef\firstpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% + \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% + \edef\thirdpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% + \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% + \else% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfqpoint{\xtemp}{-\ytemp}}% + \ifdim\borderangle pt<\pgfmathresult pt\relax% + \pgf@xc.5\pgfutil@tempdima% + \ifdim\pgf@xb>\pgf@xa% + \pgf@xb\pgf@xa% + \else% + \ifdim\pgf@xb<-\pgf@xa% + \pgf@xb-\pgf@xa% + \fi% + \fi% + \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% + \edef\secondpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% + \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% + \edef\fourthpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% + \else% + \pgf@yc.5\pgfutil@tempdima% + \ifdim\pgf@yb<-\pgf@ya% + \pgf@yb-\pgf@ya% + \fi% + \edef\firstpoint{\noexpand\pgfqpoint{\xtemp}{\ytemp}}% + \edef\secondpoint{\noexpand\pgfqpoint{-\xtemp}{\ytemp}}% + \edef\thirdpoint{\noexpand\pgfqpoint{-\xtemp}{-\ytemp}}% + \edef\fourthpoint{\noexpand\pgfqpoint{\xtemp}{-\ytemp}}% + \fi% + \fi% + \fi% + \fi% + \pgfextract@process\beforecalloutpointer{% + \centerpoint% + \advance\pgf@x\pgf@xb% + \advance\pgf@y\pgf@yb% + \advance\pgf@x-\pgf@xc% + \advance\pgf@y-\pgf@yc% + }% + \pgfextract@process\aftercalloutpointer{% + \centerpoint% + \advance\pgf@x\pgf@xb% + \advance\pgf@y\pgf@yb% + \advance\pgf@x\pgf@xc% + \advance\pgf@y\pgf@yc% + }% + % + % Now calculate the pointer anchor. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x>\pgf@y% + \edef\outersep{\the\pgf@x}% + \else% + \edef\outersep{\the\pgf@y}% + \fi% + \pgf@lib@callouts@pointeranchor% +}% -% Internal macro for parsing the size of +% Internal macro for parsing the size of % the cloud callout pointer. % % \pgf@x and \pgf@y should be set up as the @@ -779,173 +779,173 @@ % \pgf@xa and \pgf@ya are returned appropriately. % \def\pgf@lib@callout@setpointersize#1{% - \edef\pgf@lib@callout@temp{#1}% - \edef\pgf@marshall{\noexpand\pgfutil@in@{of callout}{\pgf@lib@callout@temp}}% - \pgf@marshall% - \ifpgfutil@in@% - \expandafter\pgf@xa\expandafter\pgf@lib@callout@setpointerrelativesize% - \pgf@lib@callout@temp\pgf@lib@stop\pgf@x% - \expandafter\pgf@ya\expandafter\pgf@lib@callout@setpointerrelativesize% - \pgf@lib@callout@temp\pgf@lib@stop\pgf@y% - \else% - \edef\pgf@marshall{\noexpand\pgfutil@in@{and}{\pgf@lib@callout@temp}}% - \pgf@marshall% - \ifpgfutil@in@% - \expandafter\pgf@lib@callout@setpointerbothsizes\pgf@lib@callout@temp\pgf@lib@stop% - \else% - \pgfmathsetlength\pgf@xa{#1}% - \pgfmathsetlength\pgf@ya{#1}% - \fi% - \fi% -} + \edef\pgf@lib@callout@temp{#1}% + \edef\pgf@marshall{\noexpand\pgfutil@in@{of callout}{\pgf@lib@callout@temp}}% + \pgf@marshall% + \ifpgfutil@in@% + \expandafter\pgf@xa\expandafter\pgf@lib@callout@setpointerrelativesize% + \pgf@lib@callout@temp\pgf@lib@stop\pgf@x% + \expandafter\pgf@ya\expandafter\pgf@lib@callout@setpointerrelativesize% + \pgf@lib@callout@temp\pgf@lib@stop\pgf@y% + \else% + \edef\pgf@marshall{\noexpand\pgfutil@in@{and}{\pgf@lib@callout@temp}}% + \pgf@marshall% + \ifpgfutil@in@% + \expandafter\pgf@lib@callout@setpointerbothsizes\pgf@lib@callout@temp\pgf@lib@stop% + \else% + \pgfmathsetlength\pgf@xa{#1}% + \pgfmathsetlength\pgf@ya{#1}% + \fi% + \fi% +}% \def\pgf@lib@callout@setpointerrelativesize#1of callout#2\pgf@lib@stop{#1}% \def\pgf@lib@callout@setpointerbothsizes#1and#2\pgf@lib@stop{% - \pgfmathsetlength\pgf@xa{#2}% - \pgfmathsetlength\pgf@ya{#2}% -} + \pgfmathsetlength\pgf@xa{#2}% + \pgfmathsetlength\pgf@ya{#2}% +}% % Shape: cloud callout. % \pgfdeclareshape{cloud callout}{% - \savedanchor\calloutpointer{% - \pgfutil@ifundefined{pgf@sh@s@cloud}{% - \pgferror{I cannot find the cloud shape. Please load the `symbol shapes' library}}{}% - \pgf@sh@s@cloud% - \pgf@sh@savedmacros% - % - \pgfextract@process\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \ifpgf@lib@callout@absolutepointer% - \else% - \pgfextract@process\calloutpointer{% - \pgfextract@process\borderpoint{% - \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}% - {\pgfqpoint{\xouterradius}{\youterradius}}% - }% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% - \let\pointerangle\pgfmathresult% - \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - \edef\pointerradius{\pgfmathresult pt}% - \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgf@lib@callouts@shortenpointer% - \fi% - } - \anchor{pointer}{% - \calloutpointer% - }% - \inheritsavedanchors[from=cloud] - \inheritanchor[from=cloud]{center} - \inheritanchor[from=cloud]{base} - \inheritanchor[from=cloud]{mid} - \inheritanchor[from=cloud]{north} - \inheritanchor[from=cloud]{south} - \inheritanchor[from=cloud]{east} - \inheritanchor[from=cloud]{west} - \inheritanchor[from=cloud]{north east} - \inheritanchor[from=cloud]{south west} - \inheritanchor[from=cloud]{south east} - \inheritanchor[from=cloud]{north west} - \inheritanchorborder[from=cloud] - \backgroundpath{% - \pgf@sh@bg@cloud% - \ifpgf@lib@callout@absolutepointer% - \pgfextract@process\calloutpointer{% - \pgfpointanchor{pgf@lib@callout@pointer}{center}% - }% - \ifx\pgf@node@name\pgfutil@empty% - \else% - \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% - \edef\pgf@sh@@@temp{% - \noexpand\def\noexpand\calloutpointeranchor{% - \noexpand\pgf@x\the\pgf@x% - \noexpand\pgf@y\the\pgf@y% - }% - }% - \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp} - \fi% - \fi% - % - \pgfextract@process\borderpoint{% - \pgfpointadd{% - \pgfpointborderellipse{\pgfpointdiff{\centerpoint}{\calloutpointer}}% - {\pgfqpoint{\xouterradius}{\youterradius}}% - }{\centerpoint}% - }% - \pgf@lib@callouts@shortenpointer% - \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}% - \let\angle\pgfmathresult% - \pgfmathsin@{\angle}% - \let\sinpointerangle\pgfmathresult% - \pgfmathcos@{\angle}% - \let\cospointerangle\pgfmathresult% - % - \pgf@x\xouterradius\relax% - \pgf@x2.0\pgf@x% - \pgf@y\yinnerradius\relax% - \pgf@y2.0\pgf@y% - \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer start size}}% - \pgf@xb\pgf@xa% - \pgf@yb\pgf@ya% - \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer end size}}% - \advance\pgf@xb-\pgf@xa% - \advance\pgf@yb-\pgf@ya% - % - \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/callout pointer segments}}% - \divide\pgf@xb\c@pgf@counta% - \divide\pgf@yb\c@pgf@counta% - % - \pgf@process{\pgfpointdiff{\borderpoint}{\calloutpointer}}% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - \pgfutil@tempdima\pgfmathresult pt\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - % - \pgfutil@tempdimb0pt\relax% - \pgfmathloop% - \ifnum\pgfmathcounter>\c@pgf@counta% - \else% - {% - \pgf@xa.5\pgf@xa% - \pgf@ya.5\pgf@ya% - \edef\tempxradius{\the\pgf@xa}% - \edef\tempyradius{\the\pgf@ya}% - \pgfpathellipse% - {% - \calloutpointer% - \advance\pgf@x\cospointerangle\pgfutil@tempdimb% - \advance\pgf@y\sinpointerangle\pgfutil@tempdimb% - }% - {\pgfqpoint{\tempxradius}{0pt}}{\pgfqpoint{0pt}{\tempyradius}}% - }% - \advance\pgf@xa\pgf@xb% - \advance\pgf@ya\pgf@yb% - \advance\pgfutil@tempdimb\pgfutil@tempdima% - \repeatpgfmathloop% - }% - % - % Hack the puff anchors for the callout. - % - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@cloud callout\endcsname{% - \c@pgf@counta\puffs\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \pgfutil@ifundefined{pgf@anchor@cloud callout@puff\space\the\c@pgf@counta}{% - \expandafter\xdef\csname pgf@anchor@cloud callout@puff\space\the\c@pgf@counta\endcsname{% - \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}% - }% - }{\c@pgf@counta0\relax}% - \advance\c@pgf@counta-1\relax% - \repeatpgfmathloop% - }% -} + \savedanchor\calloutpointer{% + \pgfutil@ifundefined{pgf@sh@s@cloud}{% + \pgferror{I cannot find the cloud shape. Please load the `symbol shapes' library}}{}% + \pgf@sh@s@cloud% + \pgf@sh@savedmacros% + % + \pgfextract@process\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \ifpgf@lib@callout@absolutepointer% + \else% + \pgfextract@process\calloutpointer{% + \pgfextract@process\borderpoint{% + \expandafter\pgfpointborderellipse\expandafter{\pgf@lib@callout@relativepointer}% + {\pgfqpoint{\xouterradius}{\youterradius}}% + }% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\borderpoint}% + \let\pointerangle\pgfmathresult% + \expandafter\pgf@process\expandafter{\pgf@lib@callout@relativepointer}% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \edef\pointerradius{\pgfmathresult pt}% + \pgfpointadd{\borderpoint}{\pgfqpointpolar{\pointerangle}{\pointerradius}}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgf@lib@callouts@shortenpointer% + \fi% + }% + \anchor{pointer}{% + \calloutpointer% + }% + \inheritsavedanchors[from=cloud]% + \inheritanchor[from=cloud]{center}% + \inheritanchor[from=cloud]{base}% + \inheritanchor[from=cloud]{mid}% + \inheritanchor[from=cloud]{north}% + \inheritanchor[from=cloud]{south}% + \inheritanchor[from=cloud]{east}% + \inheritanchor[from=cloud]{west}% + \inheritanchor[from=cloud]{north east}% + \inheritanchor[from=cloud]{south west}% + \inheritanchor[from=cloud]{south east}% + \inheritanchor[from=cloud]{north west}% + \inheritanchorborder[from=cloud]% + \backgroundpath{% + \pgf@sh@bg@cloud% + \ifpgf@lib@callout@absolutepointer% + \pgfextract@process\calloutpointer{% + \pgfpointanchor{pgf@lib@callout@pointer}{center}% + }% + \ifx\pgf@node@name\pgfutil@empty% + \else% + \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@node@name\noexpand\endcsname}% + \edef\pgf@sh@@@temp{% + \noexpand\def\noexpand\calloutpointeranchor{% + \noexpand\pgf@x\the\pgf@x% + \noexpand\pgf@y\the\pgf@y% + }% + }% + \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp} + \fi% + \fi% + % + \pgfextract@process\borderpoint{% + \pgfpointadd{% + \pgfpointborderellipse{\pgfpointdiff{\centerpoint}{\calloutpointer}}% + {\pgfqpoint{\xouterradius}{\youterradius}}% + }{\centerpoint}% + }% + \pgf@lib@callouts@shortenpointer% + \pgfmathanglebetweenpoints{\calloutpointer}{\centerpoint}% + \let\angle\pgfmathresult% + \pgfmathsin@{\angle}% + \let\sinpointerangle\pgfmathresult% + \pgfmathcos@{\angle}% + \let\cospointerangle\pgfmathresult% + % + \pgf@x\xouterradius\relax% + \pgf@x2.0\pgf@x% + \pgf@y\yinnerradius\relax% + \pgf@y2.0\pgf@y% + \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer start size}}% + \pgf@xb\pgf@xa% + \pgf@yb\pgf@ya% + \pgf@lib@callout@setpointersize{\pgfkeysvalueof{/pgf/callout pointer end size}}% + \advance\pgf@xb-\pgf@xa% + \advance\pgf@yb-\pgf@ya% + % + \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/callout pointer segments}}% + \divide\pgf@xb\c@pgf@counta% + \divide\pgf@yb\c@pgf@counta% + % + \pgf@process{\pgfpointdiff{\borderpoint}{\calloutpointer}}% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \pgfutil@tempdima\pgfmathresult pt\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + % + \pgfutil@tempdimb0pt\relax% + \pgfmathloop% + \ifnum\pgfmathcounter>\c@pgf@counta% + \else% + {% + \pgf@xa.5\pgf@xa% + \pgf@ya.5\pgf@ya% + \edef\tempxradius{\the\pgf@xa}% + \edef\tempyradius{\the\pgf@ya}% + \pgfpathellipse% + {% + \calloutpointer% + \advance\pgf@x\cospointerangle\pgfutil@tempdimb% + \advance\pgf@y\sinpointerangle\pgfutil@tempdimb% + }% + {\pgfqpoint{\tempxradius}{0pt}}{\pgfqpoint{0pt}{\tempyradius}}% + }% + \advance\pgf@xa\pgf@xb% + \advance\pgf@ya\pgf@yb% + \advance\pgfutil@tempdimb\pgfutil@tempdima% + \repeatpgfmathloop% + }% + % + % Hack the puff anchors for the callout. + % + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@cloud callout\endcsname{% + \c@pgf@counta\puffs\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \pgfutil@ifundefined{pgf@anchor@cloud callout@puff\space\the\c@pgf@counta}{% + \expandafter\xdef\csname pgf@anchor@cloud callout@puff\space\the\c@pgf@counta\endcsname{% + \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}% + }% + }{\c@pgf@counta0\relax}% + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop% + }% +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex index fc0b1d20aa5..ee41b301abc 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex @@ -7,14 +7,14 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $ +\ProvidesFileRCS{pgflibraryshapes.code.tex} % Only the following are loaded by default and only for historical -% reasons. +% reasons. -\usepgflibrary{shapes.geometric} -\usepgflibrary{shapes.misc} -\usepgflibrary{shapes.symbols} +\usepgflibrary{shapes.geometric}% +\usepgflibrary{shapes.misc}% +\usepgflibrary{shapes.symbols}% % Further libraries should be included directly diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex index ae7ec0f3c4e..08ef867ff0e 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex @@ -7,87 +7,87 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $ +\ProvidesFileRCS{pgflibraryshapes.geometric.code.tex} \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'' - % + % + % Calculate ``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'' - % + % + % Calculate ``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 - % + % + % Adjust height, 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}}% + % + \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{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} @@ -95,7 +95,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by-\pgf@xa% \pgfmathsetlength\pgf@y{.5ex} - } + }% \anchor{base west} {% \pgf@process{\radius} @@ -103,7 +103,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by-\pgf@xa% \pgf@y=0pt - } + }% \anchor{north west} { \pgf@process{\radius} @@ -112,7 +112,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by-0.707107\pgf@xa \advance\pgf@y by0.707107\pgf@ya - } + }% \anchor{south west} { \pgf@process{\radius} @@ -121,14 +121,14 @@ \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} @@ -136,7 +136,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by\pgf@xa% \pgfmathsetlength\pgf@y{.5ex} - } + }% \anchor{base east} {% \pgf@process{\radius} @@ -144,7 +144,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by\pgf@xa% \pgf@y=0pt - } + }% \anchor{north east} { \pgf@process{\radius} @@ -153,7 +153,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by0.707107\pgf@xa \advance\pgf@y by0.707107\pgf@ya - } + }% \anchor{south east} { \pgf@process{\radius} @@ -162,7 +162,7 @@ \pgf@process{\centerpoint} \advance\pgf@x by0.707107\pgf@xa \advance\pgf@y by-0.707107\pgf@ya - } + }% \anchorborder{ \edef\pgf@marshal{% \noexpand\pgfpointborderellipse @@ -175,7 +175,7 @@ \centerpoint% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% - } + }% % % Background path @@ -185,13 +185,13 @@ \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}}% + \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}}% - } -} + }% +}% @@ -209,14 +209,14 @@ % /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} - }% -} - + 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}% @@ -226,13 +226,13 @@ \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}} -} + \edef\pgfshapeaspectinverse{\pgf@sys@tonumber{\pgfutil@tempdima}}% +}% -\pgfsetshapeaspect{1} +\pgfsetshapeaspect{1}% \pgfdeclareshape{diamond} -{ +{% \savedanchor\outernortheast{% % % Calculate width and height of the inner rectangle @@ -255,13 +255,13 @@ % Check against minimum height/width % \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \pgf@xb=.5\pgf@xb% + \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% + \pgf@yb=.5\pgf@yb% \ifdim\pgf@y<\pgf@yb% % yes, too small. Enlarge... \pgf@y=\pgf@yb% @@ -273,12 +273,12 @@ \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 @@ -288,18 +288,18 @@ \anchor{mid}{% \pgf@process{\text}% \pgf@x=0pt% - \pgfmathsetlength\pgf@ya{.5ex} + \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} + }% + \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% @@ -320,7 +320,7 @@ {\noexpand\pgfqpoint{0pt}{\the\pgf@y}}% }% \pgf@process{\pgf@marshal}% - } + }% % % Background path @@ -338,8 +338,8 @@ \pgfpathlineto{\pgfqpoint{-\pgf@xc}{0pt}}% \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@yc}}% \pgfpathclose% - } -} + }% +}% @@ -356,571 +356,569 @@ % /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 -} + 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 compatibility with 1.18 +}% % Shape star. % -\pgfdeclareshape{star}{ - \savedmacro\totalstarpoints{% - \pgfmathsetcounter{pgf@counta}{\pgfkeysvalueof{/pgf/star points}}% - \multiply\c@pgf@counta2\relax% - \edef\totalstarpoints{\the\c@pgf@counta}% - } - \savedmacro\anglestep{% - \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/star points}}% - \let\anglestep\pgfmathresult% - } - \savedmacro\calculateradii{% - % - % Get the node dimensions. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - \ifdim\pgf@y>\pgf@x% - \pgf@x\pgf@y% - \fi% - % - % Calculate the incircle radius. - % - \pgf@x1.41421\pgf@x% - \edef\innerradius{\the\pgf@x}% - % - % Calculate the circumcircle radius. - % - % Use the star point height or the star point ratio? - % - \ifpgf@lib@shapes@starouterradiususesratio% - \pgfmathparse{\pgfkeysvalueof{/pgf/star point ratio}}% - \expandafter\pgf@x\pgfmathresult\pgf@x% - \else% - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/star point height}}% - \fi% - \pgf@xc\pgf@x% - % - % Accommodate the larger of the minimum height/width. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@ya>\pgf@xa% - \pgf@xa\pgf@ya% - \fi% - \ifdim\pgf@x<.5\pgf@xa% - \pgf@x.5\pgf@xa% - \fi% - \edef\outerradius{\the\pgf@x}% - % - % If the outer radius has been enlarged, adjust the inner radius... - % - \ifdim\pgf@x>\pgf@xc% - % - % ...using the star point ratio, or... - % - \ifpgf@lib@shapes@starouterradiususesratio% - \pgfmathreciprocal{\pgfkeysvalueof{/pgf/star point ratio}}% - \pgf@xa\pgfmathresult\pgf@x\relax% - \edef\innerradius{\the\pgf@xa}% - \else% - % - % The star point height. - % - \pgf@xa\pgf@x\relax% - \pgfmathaddtolength\pgf@xa{-\pgfkeysvalueof{/pgf/star point height}}% - \edef\innerradius{\the\pgf@xa}% - \fi% - \fi% - \edef\outerradius{\the\pgf@x}% - % - % Now calculate the anchor radii from the outer sep. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@ya>\pgf@xa% - \pgf@xa\pgf@ya% - \fi - % - % Take into account the miter length... - % - \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/star points}}% - \let\angletofirstpoint\pgfmathresult% - \pgfmathmultiply@{\angletofirstpoint}{2}% - \let\angletosecondpoint\pgfmathresult% - % - % ...for the outer radius... - % - \pgfmathanglebetweenlines% - {\pgfqpointpolar{\angletofirstpoint}{\outerradius}}% - {\pgfqpointpolar{\angletosecondpoint}{\innerradius}}% - {\pgfqpointpolar{\angletofirstpoint}{\outerradius}}% - {\pgfqpointpolar{0}{\innerradius}}% - \pgfmathdivide@{\pgfmathresult}{2}% - \pgfmathcosec@{\pgfmathresult}% - \pgf@x\outerradius\relax% - \advance\pgf@x\pgfmathresult\pgf@xa% - \edef\anchorouterradius{\the\pgf@x}% - % - % ...and for the inner radius. - % - \pgfmathanglebetweenlines% - {\pgfqpointpolar{\angletofirstpoint}{\innerradius}}% - {\pgfqpointpolar{0}{\outerradius}}% - {\pgfqpointpolar{\angletofirstpoint}{\innerradius}}% - {\pgfqpointpolar{\angletosecondpoint}{\outerradius}}% - \pgfmathdivide@{\pgfmathresult}{2}% - \pgfmathcosec@{\pgfmathresult}% - \pgf@x\innerradius\relax% - \advance\pgf@x\pgfmathresult\pgf@xa% - \edef\anchorinnerradius{\the\pgf@x}% - % - % Save all radii. - % - \addtosavedmacro{\innerradius}% - \addtosavedmacro{\outerradius}% - \addtosavedmacro{\anchorinnerradius}% - \addtosavedmacro{\anchorouterradius}% - } - \savedmacro\startangle{% - \pgfmathadd{90}{\pgfkeysvalueof{/pgf/shape border rotate}}% - \let\startangle\pgfmathresult% - } - % - % Saved anchors. - % - \savedanchor{\centerpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \savedanchor{\midpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - % - % Other anchors. - % -% - % Other anchors. - % - \anchor{center}{\centerpoint}% - \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base}{\centerpoint\pgf@y=0pt}% - \anchor{north}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{\anchorouterradius}}}% - \anchor{south}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{-\anchorouterradius}}}% - \anchor{east}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{0pt}}}% - \anchor{west}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{0pt}}}% - \anchor{north east}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{\anchorouterradius}}}% - \anchor{north west}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{\anchorouterradius}}}% - \anchor{south east}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{-\anchorouterradius}}}% - \anchor{south west}{% - \calculateradii% - \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{-\anchorouterradius}}}% - % - % Background path. - % - \backgroundpath{% - \calculateradii% - \let\angle\startangle% - \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\startangle}{\outerradius}}}% - \pgfmathloop% - \pgfmathadd@{\angle}{\anglestep}% - \let\angle\pgfmathresult% - \ifnum\pgfmathcounter=\totalstarpoints% - \pgfpathclose% - \else% - \ifodd\pgfmathcounter - \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\innerradius}}}% - \else% - \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\outerradius}}}% - \fi% - \repeatpgfmathloop% - }% - % - % Define points on the anchor border. - % - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Adjust the location of the external - % point relative to \centerpoint. - % - \centerpoint% - \pgf@xa\externalx\relax% - \pgf@ya\externaly\relax% - \advance\pgf@xa\pgf@x% - \advance\pgf@ya\pgf@y% - \edef\externalx{\the\pgf@xa}% - \edef\externaly{\the\pgf@ya}% - % - % Get the angle of the external point to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - % - % Locate the appropriate sides on the star border... - % - \pgfmathsubtract@{\pgfmathresult}{\startangle}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \pgfmathdivide@{\pgfmathresult}{\anglestep}% - \pgfmathfloor@{\pgfmathresult}% - \afterassignment\pgfmath@gobbletilpgfmath@ - \c@pgf@counta\pgfmathresult\relax\pgfmath@ - \pgfmathmultiply@{\pgfmathresult}{\anglestep}% - \pgfmathadd@{\pgfmathresult}{\startangle}% - \let\firstangle\pgfmathresult% - \pgfmathadd@{\pgfmathresult}{\anglestep}% - \let\secondangle\pgfmathresult% - \calculateradii% - % - % ...and thus, the point on the star border. - % - \ifodd\c@pgf@counta - \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\firstangle}{+\anchorinnerradius}}% - }% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\secondangle}{+\anchorouterradius}}% - }% - \else% - \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\firstangle}{+\anchorouterradius}}% - }% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\secondangle}{+\anchorinnerradius}}% - }% - \fi% - } - % - % Some hackery. This is needed if a star is positioned using - % a `...point <n+1>' anchor, where n is the maximum number of - % points of any previously drawn star. - % - \pgfutil@g@addto@macro\pgf@sh@s@star{% - \c@pgf@counta\totalstarpoints\relax% - \divide\c@pgf@counta2\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \c@pgf@countb\c@pgf@counta\relax% - \advance\c@pgf@countb-1\relax% - \pgfutil@ifundefined{pgf@anchor@star@inner point\space\the\c@pgf@counta}{% - \expandafter\xdef\csname pgf@anchor@star@inner point\space\the\c@pgf@counta\endcsname{% - \noexpand\calculateradii% - \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}% - \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% - \noexpand\let\noexpand\angle\noexpand\pgfmathresult% - \noexpand\pgfpointadd{\noexpand\centerpoint}% - {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorinnerradius}}% - }% - \expandafter\xdef\csname pgf@anchor@star@outer point\space\the\c@pgf@counta\endcsname{% - \noexpand\calculateradii% - \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}% - \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% - \noexpand\let\noexpand\angle\noexpand\pgfmathresult% - \noexpand\pgfpointadd{\noexpand\centerpoint}% - {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorouterradius}}% - }% - }{\c@pgf@counta0\relax}% - \advance\c@pgf@counta-1\relax% - \repeatpgfmathloop% - }% -} +\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. + % + \anchor{center}{\centerpoint}% + \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}}% + \anchor{base}{\centerpoint\pgf@y=0pt}% + \anchor{north}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{\anchorouterradius}}}% + \anchor{south}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{0pt}{-\anchorouterradius}}}% + \anchor{east}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{0pt}}}% + \anchor{west}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{0pt}}}% + \anchor{north east}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{\anchorouterradius}}}% + \anchor{north west}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{\anchorouterradius}}}% + \anchor{south east}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{\anchorouterradius}{-\anchorouterradius}}}% + \anchor{south west}{% + \calculateradii% + \csname pgf@anchor@star@border\endcsname{\pgfqpoint{-\anchorouterradius}{-\anchorouterradius}}}% + % + % Background path. + % + \backgroundpath{% + \calculateradii% + \let\angle\startangle% + \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\startangle}{\outerradius}}}% + \pgfmathloop% + \pgfmathadd@{\angle}{\anglestep}% + \let\angle\pgfmathresult% + \ifnum\pgfmathcounter=\totalstarpoints% + \pgfpathclose% + \else% + \ifodd\pgfmathcounter + \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\innerradius}}}% + \else% + \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\outerradius}}}% + \fi% + \repeatpgfmathloop% + }% + % + % Define points on the anchor border. + % + \anchorborder{% + % + % Save x and y. + % + \edef\externalx{\the\pgf@x}% + \edef\externaly{\the\pgf@y}% + % + % Adjust the location of the external + % point relative to \centerpoint. + % + \centerpoint% + \pgf@xa\externalx\relax% + \pgf@ya\externaly\relax% + \advance\pgf@xa\pgf@x% + \advance\pgf@ya\pgf@y% + \edef\externalx{\the\pgf@xa}% + \edef\externaly{\the\pgf@ya}% + % + % Get the angle of the external point to the \centerpoint. + % + \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + % + % Locate the appropriate sides on the star border... + % + \pgfmathsubtract@{\pgfmathresult}{\startangle}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \pgfmathdivide@{\pgfmathresult}{\anglestep}% + \pgfmathfloor@{\pgfmathresult}% + \afterassignment\pgfmath@gobbletilpgfmath@ + \c@pgf@counta\pgfmathresult\relax\pgfmath@ + \pgfmathmultiply@{\pgfmathresult}{\anglestep}% + \pgfmathadd@{\pgfmathresult}{\startangle}% + \let\firstangle\pgfmathresult% + \pgfmathadd@{\pgfmathresult}{\anglestep}% + \let\secondangle\pgfmathresult% + \calculateradii% + % + % ...and thus, the point on the star border. + % + \ifodd\c@pgf@counta + \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}% + {% + \pgfpointadd{\centerpoint}% + {\pgfqpointpolar{+\firstangle}{+\anchorinnerradius}}% + }% + {% + \pgfpointadd{\centerpoint}% + {\pgfqpointpolar{+\secondangle}{+\anchorouterradius}}% + }% + \else% + \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}% + {% + \pgfpointadd{\centerpoint}% + {\pgfqpointpolar{+\firstangle}{+\anchorouterradius}}% + }% + {% + \pgfpointadd{\centerpoint}% + {\pgfqpointpolar{+\secondangle}{+\anchorinnerradius}}% + }% + \fi% + }% + % + % Some hackery. This is needed if a star is positioned using + % a `...point <n+1>' anchor, where n is the maximum number of + % points of any previously drawn star. + % + \pgfutil@g@addto@macro\pgf@sh@s@star{% + \c@pgf@counta\totalstarpoints\relax% + \divide\c@pgf@counta2\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \c@pgf@countb\c@pgf@counta\relax% + \advance\c@pgf@countb-1\relax% + \pgfutil@ifundefined{pgf@anchor@star@inner point\space\the\c@pgf@counta}{% + \expandafter\xdef\csname pgf@anchor@star@inner point\space\the\c@pgf@counta\endcsname{% + \noexpand\calculateradii% + \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% + \noexpand\let\noexpand\angle\noexpand\pgfmathresult% + \noexpand\pgfpointadd{\noexpand\centerpoint}% + {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorinnerradius}}% + }% + \expandafter\xdef\csname pgf@anchor@star@outer point\space\the\c@pgf@counta\endcsname{% + \noexpand\calculateradii% + \noexpand\pgfmathmultiply@{\the\c@pgf@countb}{\noexpand\anglestep}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{2}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% + \noexpand\let\noexpand\angle\noexpand\pgfmathresult% + \noexpand\pgfpointadd{\noexpand\centerpoint}% + {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorouterradius}}% + }% + }{\c@pgf@counta0\relax}% + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop% + }% +}% % Keys for shape regular polygon % -% /pgf/regular polygon sides +% /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 -} + regular polygon sides/.initial=5, + regular polygon rotate/.style={/pgf/shape border rotate=#1}% For compatibility with 1.18 +}% % Shape Regular Polygon. % -\pgfdeclareshape{regular polygon}{ - \savedmacro\sides{% - \pgfmathtruncatemacro\sides{\pgfkeysvalueof{/pgf/regular polygon sides}}% - } - \savedmacro\anglestep{% - \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/regular polygon sides}}% - \let\anglestep\pgfmathresult% - } - \savedmacro\calculateradii{% - % - % Get the node dimensions. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - \ifdim\pgf@y>\pgf@x% - \pgf@x\pgf@y% - \fi% - % - % Calculate i, the incircle radius - % - \pgf@x1.41421\pgf@x% - % - % Calculate r, the polygon radius - % - % r = i / cos(360 / s / 2) - % - % (s = polygon sides) - % - \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/regular polygon sides}}% - \pgfmathsec@{\pgfmathresult}% - \pgf@x\pgfmathresult\pgf@x% - % - % Accommodate the minimum width/height. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@ya>\pgf@xa% - \pgf@xa\pgf@ya% - \fi% - \ifdim\pgf@x<.5\pgf@xa% - \pgf@x.5\pgf@xa% - \fi% - \edef\radius{\the\pgf@x}% - % - % Now calculate the anchor radius from the outer sep. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@ya>\pgf@xa% - \pgf@xa\pgf@ya% - \fi - % - % Take into account the miter length. - % - % m = o / sin (90 - (360 / s / 2)) - % - % (o = outer sep, s = sides) - % - \pgfmathdivide{180}{\pgfkeysvalueof{/pgf/regular polygon sides}}% - \pgfmathsubtract@{90}{\pgfmathresult}% - \pgfmathcosec@{\pgfmathresult}% - \advance\pgf@x\pgfmathresult\pgf@xa% - \edef\anchorradius{\the\pgf@x}% - % - % Save both radii. - % - \addtosavedmacro{\radius}% - \addtosavedmacro{\anchorradius}% - } - \savedmacro\startangle{% - \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/regular polygon sides}}% - \let\anglestep\pgfmathresult% - \pgfmathtruncatemacro\sides{\pgfkeysvalueof{/pgf/regular polygon sides}}% - \expandafter\ifodd\sides\relax% - \edef\pgfmathresult{90}% - \else% - \pgfmathdivide@{\anglestep}{2}% - \pgfmathsubtract@{90}{\pgfmathresult}% - \fi% - \pgfmathadd{\pgfmathresult}{\pgfkeysvalueof{/pgf/shape border rotate}}% - \let\startangle\pgfmathresult% - } - % - % Saved anchors. - % - \savedanchor{\centerpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \savedanchor{\midpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - % - % Other anchors. - % - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{base}{\centerpoint\pgf@y=0pt}% - \anchor{north}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{0pt}{\anchorradius}}}% - \anchor{south}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{0pt}{-\anchorradius}}}% - \anchor{east}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{0pt}}}% - \anchor{west}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{0pt}}}% - \anchor{north east}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{\anchorradius}}}% - \anchor{north west}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{\anchorradius}}}% - \anchor{south east}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{\anchorradius}{-\anchorradius}}}% - \anchor{south west}{% - \calculateradii% - \csname pgf@anchor@regular polygon@border\endcsname{\pgfqpoint{-\anchorradius}{-\anchorradius}}}% - % - % Background path. - % - \backgroundpath{% - \calculateradii% - \pgfpathmoveto{% - \pgfpointadd{\centerpoint}{\pgfqpointpolar{\startangle}{\radius}}% - }% - \let\angle\startangle% - \pgfmathloop% - \ifnum\pgfmathcounter=\sides\relax% - \pgfpathclose% - \else% - \pgfmathadd@{\angle}{\anglestep}% - \let\angle\pgfmathresult% - \pgfpathlineto{% - \pgfpointadd{\centerpoint}{\pgfqpointpolar{\angle}{\radius}}% - }% - \repeatpgfmathloop% - }% - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Adjust the location of the external - % point relative to \centerpoint. - % - \centerpoint% - \pgf@xa\externalx\relax% - \pgf@ya\externaly\relax% - \advance\pgf@xa\pgf@x% - \advance\pgf@ya\pgf@y% - \edef\externalx{\the\pgf@xa}% - \edef\externaly{\the\pgf@ya}% - % - % Get the angle of the external point to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - % - % Locate the appropriate sides on the polygon border... - % - \pgfmathsubtract@{\pgfmathresult}{\startangle}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \pgfmathdivide@{\pgfmathresult}{\anglestep}% - \pgfmathfloor@{\pgfmathresult}% - \pgfmathmultiply@{\pgfmathresult}{\anglestep}% - \pgfmathadd@{\pgfmathresult}{\startangle}% - \let\firstangle\pgfmathresult% - \pgfmathadd@{\pgfmathresult}{\anglestep}% - \let\secondangle\pgfmathresult% - \calculateradii% - % - % ...and thus, the point on the polygon border. - % - \pgfpointintersectionoflines{\centerpoint}{\pgfpoint{+\externalx}{+\externaly}}% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\firstangle}{+\anchorradius}}% - }% - {% - \pgfpointadd{\centerpoint}% - {\pgfqpointpolar{+\secondangle}{+\anchorradius}}% - }% - } - % - % More hackery for when the recuglar polygon is positioned using - % a `corner <n+1>' or `side <n+1>' anchor, where n is the maximum - % number of sides of any previously drawn regular polygon. - % - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@regular polygon\endcsname{% - \c@pgf@counta\sides\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \pgfutil@ifundefined{pgf@anchor@regular polygon@corner\space\the\c@pgf@counta}{% - % - % ...(manually \xdef as \gdef is normally used by \anchor)... - % - \expandafter\xdef\csname pgf@anchor@regular polygon@corner\space\the\c@pgf@counta\endcsname{% - \noexpand\calculateradii% - \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}% - \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% - \noexpand\let\noexpand\angle\noexpand\pgfmathresult% - \noexpand\pgfpointadd{\noexpand\centerpoint}% - {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorradius}}% - }% - \expandafter\xdef\csname pgf@anchor@regular polygon@side\space\the\c@pgf@counta\endcsname{% - \noexpand\calculateradii% - \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}% - \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% - \noexpand\let\noexpand\firstangle\noexpand\pgfmathresult% - \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}% - \noexpand\let\noexpand\secondangle\noexpand\pgfmathresult% - \noexpand\pgfpointlineattime{0.5}% - {\noexpand\pgfpointadd{\noexpand\centerpoint}% - {\noexpand\pgfqpointpolar{\noexpand\firstangle}{\noexpand\anchorradius}}}% - {\noexpand\pgfpointadd{\noexpand\centerpoint}% - {\noexpand\pgfqpointpolar{\noexpand\secondangle}{\noexpand\anchorradius}}}% - }% - }{\c@pgf@counta0\relax}% - \advance\c@pgf@counta-1\relax% - \repeatpgfmathloop% - }% -} +\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 rectangular polygon is positioned using + % a `corner <n+1>' or `side <n+1>' anchor, where n is the maximum + % number of sides of any previously drawn regular polygon. + % + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@regular polygon\endcsname{% + \c@pgf@counta\sides\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \pgfutil@ifundefined{pgf@anchor@regular polygon@corner\space\the\c@pgf@counta}{% + % + % ...(manually \xdef as \gdef is normally used by \anchor)... + % + \expandafter\xdef\csname pgf@anchor@regular polygon@corner\space\the\c@pgf@counta\endcsname{% + \noexpand\calculateradii% + \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% + \noexpand\let\noexpand\angle\noexpand\pgfmathresult% + \noexpand\pgfpointadd{\noexpand\centerpoint}% + {\noexpand\pgfqpointpolar{\noexpand\angle}{\noexpand\anchorradius}}% + }% + \expandafter\xdef\csname pgf@anchor@regular polygon@side\space\the\c@pgf@counta\endcsname{% + \noexpand\calculateradii% + \noexpand\pgfmathsubtract@{\the\c@pgf@counta}{1}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{\noexpand\anglestep}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\startangle}% + \noexpand\let\noexpand\firstangle\noexpand\pgfmathresult% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{\noexpand\anglestep}% + \noexpand\let\noexpand\secondangle\noexpand\pgfmathresult% + \noexpand\pgfpointlineattime{0.5}% + {\noexpand\pgfpointadd{\noexpand\centerpoint}% + {\noexpand\pgfqpointpolar{\noexpand\firstangle}{\noexpand\anchorradius}}}% + {\noexpand\pgfpointadd{\noexpand\centerpoint}% + {\noexpand\pgfqpointpolar{\noexpand\secondangle}{\noexpand\anchorradius}}}% + }% + }{\c@pgf@counta0\relax}% + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop% + }% +}% @@ -930,15 +928,15 @@ % /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% -} + 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 @@ -946,1394 +944,1394 @@ % 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}% - }% -} +\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}% + }% + % + % Calculate 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% - } -} +\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 -} + 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}}% - }% -} +\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}}% + }% +}% @@ -2342,654 +2340,654 @@ % % \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% - }% -} + 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}% +\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 radius 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 vertices + % 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}% - } -} + \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 *inversely 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}% + }% +}% @@ -2999,545 +2997,545 @@ % \pgfkeys{/pgf/.cd, - dart tip angle/.initial=45, - dart tail angle/.initial=135 -} + 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}% - }% -} + \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 background 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 *inversely 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 *inversely 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}% + }% +}% @@ -3545,476 +3543,476 @@ % % /pgf/circular sector angle : the angle at the center of the sector. % -\pgfkeys{/pgf/circular sector angle/.initial=60} +\pgfkeys{/pgf/circular sector angle/.initial=60}% % Shape circular sector % \pgfdeclareshape{circular sector}{% - \savedmacro\installcircularsectorparameters{% - % - % Define a \centerpoint, \basepoint and \midpoint. - % - \pgfextract@process\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - % - % Get the larger of the outer sep. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x<\pgf@y% - \pgf@x\pgf@y% - \fi% - \edef\outersep{\the\pgf@x}% - % - % Half of the sector angle is more useful. - % - \pgfmathmod{\pgfkeysvalueof{/pgf/circular sector angle}}{360}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \let\angle\pgfmathresult% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\halfangle\pgfmathresult% - % - % Get some useful trigonometric stuff. - % - \pgfmathsin@{\halfangle}% - \let\sinehalfangle\pgfmathresult% - \pgfmathreciprocal@{\pgfmathresult}% - \let\cosechalfangle\pgfmathresult% - \pgfmathabs@{\halfangle}% - \pgfmathcos@{\pgfmathresult}% - \let\coshalfangle\pgfmathresult% - \pgf@x\pgfmathresult pt\relax% - \pgf@x\cosechalfangle\pgf@x% - \edef\cothalfangle{\pgfmath@tonumber{\pgf@x}}% - % - % Calculate the miter length at the center, - % according to the outer sep. - % - \pgf@x\outersep\relax% - \pgf@x\cosechalfangle\pgf@x% - \edef\centermiter{\the\pgf@x}% - % - % Get the start and end angles of the arc. - % - \pgfmathsubtract@{180}{\halfangle}% - \let\startangle\pgfmathresult% - \pgfmathadd@{180}{\halfangle}% - \let\endangle\pgfmathresult% - % - % Get (half) the node dimensions. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - % - % Calculate the radius of the sector and the `center offset', - % which is the distance between the center of the node and the - % center of the sector. - % - \ifpgfshapeborderusesincircle% - % - % Get the rotation. - % - \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}% - % - % Calculate the incircle radius. - % - \ifdim\pgf@x<\pgf@y% - \pgf@x\pgf@y% - \fi% - \pgf@x1.41421\pgf@x% - \pgf@xa\cosechalfangle\pgf@x% - % - % xa is the radius, xb the offset. - % - \pgf@xb\pgf@xa% - \advance\pgf@xa\pgf@x% - \else% - % - % Get the rotation (with rounding). - % - \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}% - \afterassignment\pgfmath@gobbletilpgfmath@% - \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@% - \advance\c@pgf@counta45\relax% - \divide\c@pgf@counta90\relax% - \multiply\c@pgf@counta90\relax% - \ifnum\c@pgf@counta<0\relax% - \advance\c@pgf@counta360\relax% - \fi% - \edef\rotate{\the\c@pgf@counta}% - % - % Swap the height and width for relevant angles. - % - \ifnum\c@pgf@counta=90\relax% - \pgf@xc\pgf@x% - \pgf@x\pgf@y% - \pgf@y\pgf@xc% - \else% - \ifnum\c@pgf@counta=270\relax% - \pgf@xc\pgf@x% - \pgf@x\pgf@y% - \pgf@y\pgf@xc% - \fi% - \fi% - % - % xa is the radius, xb the offset. - % - \pgf@xa\cosechalfangle\pgf@y% - \pgf@xa\coshalfangle\pgf@xa% - \advance\pgf@xa\pgf@x% - \pgf@xb\pgf@xa% - \advance\pgf@xa\pgf@x% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@y}}% - \pgf@xa\pgfmathresult pt\relax% - \fi% - % - % Adjust for minimum height and width. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% - \pgf@x.5\pgf@x% - \pgfmathsec@{\halfangle}% - \pgf@xc\pgfmathresult\pgf@xb% - \ifdim\pgf@xc<0pt\relax% - \pgf@xc-\pgf@xc% - \fi% - \ifdim\pgf@xc<\pgf@x% - \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xc}}% - \pgf@xc\pgfmathresult\pgf@x% Increase by ratio. - \pgf@xa\pgfmath@tonumber{\pgf@xc}\pgf@xa% - \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb% - \fi% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@xa<\pgf@y% - \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xa}}% - \pgf@xc\pgfmathresult\pgf@y% Increase by ratio. - \pgf@xa\pgf@y% - \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb% - \fi% - \edef\centeroffset{\the\pgf@xb}% - \edef\radius{\the\pgf@xa}% - % - % Calculate the radius at sector border and the arc corners. - % - \advance\pgf@xa\outersep\relax% - \edef\borderradius{\the\pgf@xa}% - \pgf@x\outersep\relax% - \pgf@x\cosechalfangle\pgf@x% - \pgf@x\coshalfangle\pgf@x% - \advance\pgf@xa\pgf@x% - \edef\cornerradius{\the\pgf@xa}% - % - % Calculate the *unrotated* points for the background path. - % - \pgfextract@process\sectorcenter{% - \centerpoint% - \advance\pgf@x\centeroffset% - }% - \pgfextract@process\arcstart{% - \pgfqpointpolar{\startangle}{\radius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \sectorcenter% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Calculate the *unrotated* points for the anchor border. - % - \pgfextract@process\sectorcenterborder{% - \sectorcenter% - \advance\pgf@x\centermiter\relax% - }% - \pgfextract@process\arcstartborder{% - \pgfqpointpolar{\startangle}{\borderradius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \sectorcenter% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfextract@process\arcendborder{% - \pgfqpointpolar{\endangle}{\borderradius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \sectorcenter% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfextract@process\arcstartcorner{% - \pgfqpointpolar{\startangle}{\cornerradius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \sectorcenterborder% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfextract@process\arcendcorner{% - \pgfqpointpolar{\endangle}{\cornerradius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \sectorcenterborder% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Calculate the *unrotated* corner angles to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\sectorcenterborder}% - \let\angletosectorcenterborder\pgfmathresult% - \pgfmathanglebetweenpoints{\centerpoint}{\arcstartborder}% - \let\angletoarcstartborder\pgfmathresult% - \pgfmathanglebetweenpoints{\centerpoint}{\arcendborder}% - \let\angletoarcendborder\pgfmathresult% - \pgfmathanglebetweenpoints{\centerpoint}{\arcstartcorner}% - \let\angletoarcstartcorner\pgfmathresult% - \pgfmathanglebetweenpoints{\centerpoint}{\arcendcorner}% - \let\angletoarcendcorner\pgfmathresult% - % - % Rotate the background path points around the note center. - % - \pgfextract@process\sectorcenter{% - \pgfmathrotatepointaround{\sectorcenter}{\centerpoint}{\rotate}% - }% - \pgfextract@process\arcstart{% - \pgfmathrotatepointaround{\arcstart}{\centerpoint}{\rotate}% - }% - % - % Rotate the border points around the note center. - % - \pgfextract@process\sectorcenterborder{% - \pgfmathrotatepointaround{\sectorcenterborder}{\centerpoint}{\rotate}% - }% - \pgfextract@process\arcstartborder{% - \pgfmathrotatepointaround{\arcstartborder}{\centerpoint}{\rotate}% - }% - \pgfextract@process\arcendborder{% - \pgfmathrotatepointaround{\arcendborder}{\centerpoint}{\rotate}% - }% - \pgfextract@process\arcstartcorner{% - \pgfmathrotatepointaround{\arcstartcorner}{\centerpoint}{\rotate}% - }% - \pgfextract@process\arcendcorner{% - \pgfmathrotatepointaround{\arcendcorner}{\centerpoint}{\rotate}% - }% - % - % Add the rotation to the start and end angles. - % - \pgfmathadd@{\startangle}{\rotate}% - \let\startangle\pgfmathresult% - \pgfmathadd@{\endangle}{\rotate}% - \let\endangle\pgfmathresult% - % - % Save everything. - % - % NB \addtosavedmacro is currently experimental. May get changed. - % - \addtosavedmacro{\rotate}% - \addtosavedmacro{\centeroffset}% - % - \addtosavedmacro{\radius}% - \addtosavedmacro{\borderradius}% - \addtosavedmacro{\cornerradius}% - % - \addtosavedmacro{\endangle}% - \addtosavedmacro{\startangle}% - % - \addtosavedmacro{\sectorcenter}% - \addtosavedmacro{\arcstart}% - % - \addtosavedmacro{\sectorcenterborder}% - \addtosavedmacro{\arcstartborder}% - \addtosavedmacro{\arcendborder}% - \addtosavedmacro{\arcstartcorner}% - \addtosavedmacro{\arcendcorner}% - % - \addtosavedmacro{\angletosectorcenterborder}% - \addtosavedmacro{\angletoarcstartborder}% - \addtosavedmacro{\angletoarcendborder}% - \addtosavedmacro{\angletoarcstartcorner}% - \addtosavedmacro{\angletoarcendcorner}% - }% - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt\relax% - }% - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - \anchor{center}{\centerpoint} - \anchor{base}{\basepoint} - \anchor{mid}{\midpoint} - \anchor{arc start}{% - \installcircularsectorparameters% - \arcstartcorner% - } - \anchor{arc end}{% - \installcircularsectorparameters% - \arcendcorner% - } - \anchor{sector center}{% - \installcircularsectorparameters% - \sectorcenterborder% - } - \anchor{arc center}{% - \installcircularsectorparameters% - \pgfmathadd@{\rotate}{180}% - \let\angle\pgfmathresult% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpointpolar{\angle}{\cornerradius}}% - } - \anchor{north}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{\cornerradius}}% - } - \anchor{south}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{-\cornerradius}}% - } - \anchor{east}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{0pt}}% - } - \anchor{west}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{0pt}}% - } - \anchor{north west}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{\cornerradius}}% - } - \anchor{south west}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{-\cornerradius}}% - } - \anchor{north east}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{\cornerradius}}% - } - \anchor{south east}{% - \installcircularsectorparameters% - \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{-\cornerradius}}% - } - \backgroundpath{% - \installcircularsectorparameters% - \pgfpathmoveto{\sectorcenter}% - \pgfpathlineto{\arcstart}% - \ifdim\endangle pt>360pt\relax% - \ifdim\startangle pt>360pt\relax% - \pgfpatharc{\startangle}{\endangle}{\radius}% - \else% - \pgfpatharc{\startangle}{360}{\radius}% - \pgfpatharc{0}{\endangle}{\radius}% - \fi% - \else% - \pgfpatharc{\startangle}{\endangle}{\radius}% - \fi% - \pgfpathclose% - }% - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Adjust the location of the external point relative to \centerpoint. - % - \centerpoint% - \pgf@xa\externalx\relax% - \pgf@ya\externaly\relax% - \advance\pgf@xa\pgf@x% - \advance\pgf@ya\pgf@y% - \edef\externalx{\the\pgf@xa}% - \edef\externaly{\the\pgf@ya}% - % - % Install the required points and angles. - % - \installcircularsectorparameters% - % - % Get the angle of the external point to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - \let\externalangle\pgfmathresult% - % - % *Subtract* the rotation from the external angle. - % - \pgfmathsubtract@{\pgfmathresult}{\rotate}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \let\angle\pgfmathresult% - % - % Determine if the line will cross the sector arc. - % - \ifdim\angle pt>\angletoarcendcorner pt\relax% - \let\firstpoint\arcendcorner% - \let\secondpoint\sectorcenterborder% - \else% - \ifdim\angle pt>\angletoarcendborder pt\relax% - \let\firstpoint\arcendborder% - \let\secondpoint\arcendcorner% - \else% - \ifdim\angle pt>\angletoarcstartborder pt\relax% - \let\firstpoint\pgfutil@empty% - \let\secondpoint\pgfutil@empty% - \else% - \ifdim\angle pt>\angletoarcstartcorner pt\relax% - \let\firstpoint\arcstartborder - \let\secondpoint\arcstartcorner - \else% - \let\firstpoint\sectorcenterborder% - \let\secondpoint\arcstartcorner% - \fi% - \fi% - \fi% - \fi% - \ifx\firstpoint\pgfutil@empty - % - % Calculate the angle from the centre of the semicircle to the - % point on the semicircle arc which intersects the line from - % the external point to the reference point... - % - \pgfmathanglebetweenlines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - {\sectorcenter}{\centerpoint}% - \pgfmathsin@{\pgfmathresult}% - \let\sineangle\pgfmathresult% - \pgf@x\borderradius\relax% - \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@x}}% - \let\reciprocalradius\pgfmathresult% - \pgf@x\centeroffset\relax% - \pgf@x\sineangle\pgf@x% - \pgf@x\reciprocalradius\pgf@x% - \pgfmathasin@{\pgfmath@tonumber{\pgf@x}}% - \pgf@x\pgfmathresult pt\relax% - \advance\pgf@x\externalangle pt\relax% - \edef\angle{\pgfmath@tonumber{\pgf@x}}% - % - % ...and thus the point on the border. - % - \pgfpointadd{\sectorcenter}{\pgfqpointpolar{\angle}{\borderradius}}% - \else% - % - % Calculate the the point where the semicircle chord intersects - % the line from the external point to the reference point. - % - \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - {\firstpoint}{\secondpoint}% - \fi% - }% -} + \savedmacro\installcircularsectorparameters{% + % + % Define a \centerpoint, \basepoint and \midpoint. + % + \pgfextract@process\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + % + % Get the larger of the outer sep. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x<\pgf@y% + \pgf@x\pgf@y% + \fi% + \edef\outersep{\the\pgf@x}% + % + % Half of the sector angle is more useful. + % + \pgfmathmod{\pgfkeysvalueof{/pgf/circular sector angle}}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\angle\pgfmathresult% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\halfangle\pgfmathresult% + % + % Get some useful trigonometric stuff. + % + \pgfmathsin@{\halfangle}% + \let\sinehalfangle\pgfmathresult% + \pgfmathreciprocal@{\pgfmathresult}% + \let\cosechalfangle\pgfmathresult% + \pgfmathabs@{\halfangle}% + \pgfmathcos@{\pgfmathresult}% + \let\coshalfangle\pgfmathresult% + \pgf@x\pgfmathresult pt\relax% + \pgf@x\cosechalfangle\pgf@x% + \edef\cothalfangle{\pgfmath@tonumber{\pgf@x}}% + % + % Calculate the miter length at the center, + % according to the outer sep. + % + \pgf@x\outersep\relax% + \pgf@x\cosechalfangle\pgf@x% + \edef\centermiter{\the\pgf@x}% + % + % Get the start and end angles of the arc. + % + \pgfmathsubtract@{180}{\halfangle}% + \let\startangle\pgfmathresult% + \pgfmathadd@{180}{\halfangle}% + \let\endangle\pgfmathresult% + % + % Get (half) the node dimensions. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + % + % Calculate the radius of the sector and the `center offset', + % which is the distance between the center of the node and the + % center of the sector. + % + \ifpgfshapeborderusesincircle% + % + % Get the rotation. + % + \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}% + % + % Calculate the incircle radius. + % + \ifdim\pgf@x<\pgf@y% + \pgf@x\pgf@y% + \fi% + \pgf@x1.41421\pgf@x% + \pgf@xa\cosechalfangle\pgf@x% + % + % xa is the radius, xb the offset. + % + \pgf@xb\pgf@xa% + \advance\pgf@xa\pgf@x% + \else% + % + % Get the rotation (with rounding). + % + \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@% + \advance\c@pgf@counta45\relax% + \divide\c@pgf@counta90\relax% + \multiply\c@pgf@counta90\relax% + \ifnum\c@pgf@counta<0\relax% + \advance\c@pgf@counta360\relax% + \fi% + \edef\rotate{\the\c@pgf@counta}% + % + % Swap the height and width for relevant angles. + % + \ifnum\c@pgf@counta=90\relax% + \pgf@xc\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xc% + \else% + \ifnum\c@pgf@counta=270\relax% + \pgf@xc\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xc% + \fi% + \fi% + % + % xa is the radius, xb the offset. + % + \pgf@xa\cosechalfangle\pgf@y% + \pgf@xa\coshalfangle\pgf@xa% + \advance\pgf@xa\pgf@x% + \pgf@xb\pgf@xa% + \advance\pgf@xa\pgf@x% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@y}}% + \pgf@xa\pgfmathresult pt\relax% + \fi% + % + % Adjust for minimum height and width. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% + \pgf@x.5\pgf@x% + \pgfmathsec@{\halfangle}% + \pgf@xc\pgfmathresult\pgf@xb% + \ifdim\pgf@xc<0pt\relax% + \pgf@xc-\pgf@xc% + \fi% + \ifdim\pgf@xc<\pgf@x% + \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xc}}% + \pgf@xc\pgfmathresult\pgf@x% Increase by ratio. + \pgf@xa\pgfmath@tonumber{\pgf@xc}\pgf@xa% + \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb% + \fi% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@xa<\pgf@y% + \pgfmathreciprocal{\pgfmath@tonumber{\pgf@xa}}% + \pgf@xc\pgfmathresult\pgf@y% Increase by ratio. + \pgf@xa\pgf@y% + \pgf@xb\pgfmath@tonumber{\pgf@xc}\pgf@xb% + \fi% + \edef\centeroffset{\the\pgf@xb}% + \edef\radius{\the\pgf@xa}% + % + % Calculate the radius at sector border and the arc corners. + % + \advance\pgf@xa\outersep\relax% + \edef\borderradius{\the\pgf@xa}% + \pgf@x\outersep\relax% + \pgf@x\cosechalfangle\pgf@x% + \pgf@x\coshalfangle\pgf@x% + \advance\pgf@xa\pgf@x% + \edef\cornerradius{\the\pgf@xa}% + % + % Calculate the *unrotated* points for the background path. + % + \pgfextract@process\sectorcenter{% + \centerpoint% + \advance\pgf@x\centeroffset% + }% + \pgfextract@process\arcstart{% + \pgfqpointpolar{\startangle}{\radius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \sectorcenter% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Calculate the *unrotated* points for the anchor border. + % + \pgfextract@process\sectorcenterborder{% + \sectorcenter% + \advance\pgf@x\centermiter\relax% + }% + \pgfextract@process\arcstartborder{% + \pgfqpointpolar{\startangle}{\borderradius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \sectorcenter% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfextract@process\arcendborder{% + \pgfqpointpolar{\endangle}{\borderradius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \sectorcenter% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfextract@process\arcstartcorner{% + \pgfqpointpolar{\startangle}{\cornerradius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \sectorcenterborder% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfextract@process\arcendcorner{% + \pgfqpointpolar{\endangle}{\cornerradius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \sectorcenterborder% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Calculate the *unrotated* corner angles to the \centerpoint. + % + \pgfmathanglebetweenpoints{\centerpoint}{\sectorcenterborder}% + \let\angletosectorcenterborder\pgfmathresult% + \pgfmathanglebetweenpoints{\centerpoint}{\arcstartborder}% + \let\angletoarcstartborder\pgfmathresult% + \pgfmathanglebetweenpoints{\centerpoint}{\arcendborder}% + \let\angletoarcendborder\pgfmathresult% + \pgfmathanglebetweenpoints{\centerpoint}{\arcstartcorner}% + \let\angletoarcstartcorner\pgfmathresult% + \pgfmathanglebetweenpoints{\centerpoint}{\arcendcorner}% + \let\angletoarcendcorner\pgfmathresult% + % + % Rotate the background path points around the note center. + % + \pgfextract@process\sectorcenter{% + \pgfmathrotatepointaround{\sectorcenter}{\centerpoint}{\rotate}% + }% + \pgfextract@process\arcstart{% + \pgfmathrotatepointaround{\arcstart}{\centerpoint}{\rotate}% + }% + % + % Rotate the border points around the note center. + % + \pgfextract@process\sectorcenterborder{% + \pgfmathrotatepointaround{\sectorcenterborder}{\centerpoint}{\rotate}% + }% + \pgfextract@process\arcstartborder{% + \pgfmathrotatepointaround{\arcstartborder}{\centerpoint}{\rotate}% + }% + \pgfextract@process\arcendborder{% + \pgfmathrotatepointaround{\arcendborder}{\centerpoint}{\rotate}% + }% + \pgfextract@process\arcstartcorner{% + \pgfmathrotatepointaround{\arcstartcorner}{\centerpoint}{\rotate}% + }% + \pgfextract@process\arcendcorner{% + \pgfmathrotatepointaround{\arcendcorner}{\centerpoint}{\rotate}% + }% + % + % Add the rotation to the start and end angles. + % + \pgfmathadd@{\startangle}{\rotate}% + \let\startangle\pgfmathresult% + \pgfmathadd@{\endangle}{\rotate}% + \let\endangle\pgfmathresult% + % + % Save everything. + % + % NB \addtosavedmacro is currently experimental. May get changed. + % + \addtosavedmacro{\rotate}% + \addtosavedmacro{\centeroffset}% + % + \addtosavedmacro{\radius}% + \addtosavedmacro{\borderradius}% + \addtosavedmacro{\cornerradius}% + % + \addtosavedmacro{\endangle}% + \addtosavedmacro{\startangle}% + % + \addtosavedmacro{\sectorcenter}% + \addtosavedmacro{\arcstart}% + % + \addtosavedmacro{\sectorcenterborder}% + \addtosavedmacro{\arcstartborder}% + \addtosavedmacro{\arcendborder}% + \addtosavedmacro{\arcstartcorner}% + \addtosavedmacro{\arcendcorner}% + % + \addtosavedmacro{\angletosectorcenterborder}% + \addtosavedmacro{\angletoarcstartborder}% + \addtosavedmacro{\angletoarcendborder}% + \addtosavedmacro{\angletoarcstartcorner}% + \addtosavedmacro{\angletoarcendcorner}% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt\relax% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5ex}% + }% + \anchor{center}{\centerpoint}% + \anchor{base}{\basepoint}% + \anchor{mid}{\midpoint}% + \anchor{arc start}{% + \installcircularsectorparameters% + \arcstartcorner% + }% + \anchor{arc end}{% + \installcircularsectorparameters% + \arcendcorner% + }% + \anchor{sector center}{% + \installcircularsectorparameters% + \sectorcenterborder% + }% + \anchor{arc center}{% + \installcircularsectorparameters% + \pgfmathadd@{\rotate}{180}% + \let\angle\pgfmathresult% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpointpolar{\angle}{\cornerradius}}% + }% + \anchor{north}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{\cornerradius}}% + }% + \anchor{south}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{0pt}{-\cornerradius}}% + }% + \anchor{east}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{0pt}}% + }% + \anchor{west}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{0pt}}% + }% + \anchor{north west}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{\cornerradius}}% + }% + \anchor{south west}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{-\cornerradius}{-\cornerradius}}% + }% + \anchor{north east}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{\cornerradius}}% + }% + \anchor{south east}{% + \installcircularsectorparameters% + \csname pgf@anchor@circular sector@border\endcsname{\pgfqpoint{\cornerradius}{-\cornerradius}}% + }% + \backgroundpath{% + \installcircularsectorparameters% + \pgfpathmoveto{\sectorcenter}% + \pgfpathlineto{\arcstart}% + \ifdim\endangle pt>360pt\relax% + \ifdim\startangle pt>360pt\relax% + \pgfpatharc{\startangle}{\endangle}{\radius}% + \else% + \pgfpatharc{\startangle}{360}{\radius}% + \pgfpatharc{0}{\endangle}{\radius}% + \fi% + \else% + \pgfpatharc{\startangle}{\endangle}{\radius}% + \fi% + \pgfpathclose% + }% + \anchorborder{% + % + % Save x and y. + % + \edef\externalx{\the\pgf@x}% + \edef\externaly{\the\pgf@y}% + % + % Adjust the location of the external point relative to \centerpoint. + % + \centerpoint% + \pgf@xa\externalx\relax% + \pgf@ya\externaly\relax% + \advance\pgf@xa\pgf@x% + \advance\pgf@ya\pgf@y% + \edef\externalx{\the\pgf@xa}% + \edef\externaly{\the\pgf@ya}% + % + % Install the required points and angles. + % + \installcircularsectorparameters% + % + % Get the angle of the external point to the \centerpoint. + % + \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + \let\externalangle\pgfmathresult% + % + % *Subtract* the rotation from the external angle. + % + \pgfmathsubtract@{\pgfmathresult}{\rotate}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\angle\pgfmathresult% + % + % Determine if the line will cross the sector arc. + % + \ifdim\angle pt>\angletoarcendcorner pt\relax% + \let\firstpoint\arcendcorner% + \let\secondpoint\sectorcenterborder% + \else% + \ifdim\angle pt>\angletoarcendborder pt\relax% + \let\firstpoint\arcendborder% + \let\secondpoint\arcendcorner% + \else% + \ifdim\angle pt>\angletoarcstartborder pt\relax% + \let\firstpoint\pgfutil@empty% + \let\secondpoint\pgfutil@empty% + \else% + \ifdim\angle pt>\angletoarcstartcorner pt\relax% + \let\firstpoint\arcstartborder + \let\secondpoint\arcstartcorner + \else% + \let\firstpoint\sectorcenterborder% + \let\secondpoint\arcstartcorner% + \fi% + \fi% + \fi% + \fi% + \ifx\firstpoint\pgfutil@empty + % + % Calculate the angle from the centre of the semicircle to the + % point on the semicircle arc which intersects the line from + % the external point to the reference point... + % + \pgfmathanglebetweenlines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + {\sectorcenter}{\centerpoint}% + \pgfmathsin@{\pgfmathresult}% + \let\sineangle\pgfmathresult% + \pgf@x\borderradius\relax% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@x}}% + \let\reciprocalradius\pgfmathresult% + \pgf@x\centeroffset\relax% + \pgf@x\sineangle\pgf@x% + \pgf@x\reciprocalradius\pgf@x% + \pgfmathasin@{\pgfmath@tonumber{\pgf@x}}% + \pgf@x\pgfmathresult pt\relax% + \advance\pgf@x\externalangle pt\relax% + \edef\angle{\pgfmath@tonumber{\pgf@x}}% + % + % ...and thus the point on the border. + % + \pgfpointadd{\sectorcenter}{\pgfqpointpolar{\angle}{\borderradius}}% + \else% + % + % Calculate the the point where the semicircle chord intersects + % the line from the external point to the reference point. + % + \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + {\firstpoint}{\secondpoint}% + \fi% + }% +}% @@ -4023,397 +4021,397 @@ % /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. +% /pgf/cylinder body fill : Custom color for the cylinder body. % \newif\ifpgfcylinderusescustomfill \pgfkeys{/pgf/.cd, - cylinder uses custom fill/.is if=pgfcylinderusescustomfill, - cylinder end fill/.initial=white, - cylinder body fill/.initial=white -} + 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% - } -} + \savedmacro\getcylinderpoints{% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgf@x\pgf@xc% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgf@y\pgf@yc% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + \ifpgfshapeborderusesincircle% + \pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}% + \ifdim\pgf@x<\pgf@y% + \pgf@x\pgf@y% + \else% + \pgf@y\pgf@x% + \fi% + \pgf@x1.414213\pgf@x% + \pgf@y1.414213\pgf@y% + \else% + \pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \pgfmathsetcount\c@pgf@counta{+\pgfmathresult}% + \advance\c@pgf@counta45\relax% + \divide\c@pgf@counta90\relax% + \multiply\c@pgf@counta90\relax% + \edef\rotate{\the\c@pgf@counta}% + \ifnum\c@pgf@counta=90\relax% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xa% + \pgf@yc\pgf@xc% + \else% + \ifnum\c@pgf@counta=270\relax% + \pgf@xa\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xa% + \pgf@yc\pgf@xc% + \fi% + \fi% + \fi% + \addtosavedmacro\rotate% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfutil@tempdima\pgfshapeaspect\pgf@ya% + \pgfutil@tempdimb\pgf@ya% + % + % Adjust for minimum height. + % + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgfutil@tempdimb<.5\pgf@xc\relax% + \pgfutil@tempdimb.5\pgf@xc% + \pgf@ya\pgfutil@tempdimb% + \fi% + % + % Calculate how far the node contents can extend into the cylinder bottom. + % + \pgf@yb\pgfutil@tempdimb% + \advance\pgf@yb-\pgf@yc% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yb}}{\pgfmath@tonumber{\pgfutil@tempdimb}}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + \let\angle\pgfmathresult% + \pgf@xb\pgfmathresult\pgfutil@tempdima% + % + % Adjust for minimum width. + % + \pgf@x.5\pgflinewidth% + \advance\pgf@x2.0\pgf@xa% + \advance\pgf@x3.0\pgfutil@tempdima% + \advance\pgf@x-\pgf@xb% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<\pgf@xc% + \advance\pgf@xc-\pgf@x% + \advance\pgf@xa.5\pgf@xc% + \fi% + % + % Add the larger of the outer sep to the radii. + % + \pgf@x\pgfutil@tempdima\relax% + \pgf@y\pgfutil@tempdimb\relax% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xc>\pgf@yc% + \advance\pgf@x\pgf@xc% + \advance\pgf@y\pgf@xc% + \edef\outersep{\the\pgf@xc}% + \else% + \advance\pgf@x\pgf@yc% + \advance\pgf@y\pgf@yc% + \edef\outersep{\the\pgf@yc}% + \fi% + \edef\xradius{\the\pgf@x}% + \edef\yradius{\the\pgf@y}% + \addtosavedmacro\xradius% + \addtosavedmacro\yradius% + \addtosavedmacro\outersep% + % + \pgfextract@process\cylindercenter{% + \pgf@x\pgfutil@tempdima% + \advance\pgf@x.5\pgflinewidth% + \advance\pgf@x\pgf@xb% + \pgf@x.5\pgf@x% + \pgf@y0pt% + }% + \addtosavedmacro\cylindercenter% + % + \pgfextract@process\beforetop{% + \pgf@x\pgf@xa% + \advance\pgf@x\pgfutil@tempdima% + \advance\pgf@x.5\pgflinewidth% + \pgf@y\pgf@ya% + }% + \pgfextract@process\afterbottom{% + \pgf@x-\pgf@xa% + \advance\pgf@x\pgf@xb% + \pgf@y\pgf@ya% + }% + \addtosavedmacro\beforetop% + \addtosavedmacro\afterbottom% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}% + \pgfextract@process\beforetopanchor{% + \beforetop% + \advance\pgf@y\pgf@yc% + }% + \pgfextract@process\afterbottomanchor{% + \afterbottom% + \advance\pgf@y\pgf@yc% + }% + \addtosavedmacro\beforetopanchor% + \addtosavedmacro\afterbottomanchor% + % + \beforetopanchor% + \advance\pgf@x\xradius\relax% + \ifdim\pgf@x>\pgf@y% + \edef\externalradius{\the\pgf@x}% + \else% + \edef\externalradius{\the\pgf@y}% + \fi% + \addtosavedmacro\externalradius% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{shape center}{% + \getcylinderpoints% + \pgfmathrotatepointaround{\pgfpointadd{\cylindercenter}{\centerpoint}}% + {\centerpoint}{\rotate}% + }% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \getcylinderpoints% + \let\pgf@cylinder@referencepoint\midpoint% + \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}% + }% + \anchor{mid west}{% + \getcylinderpoints% + \let\pgf@cylinder@referencepoint\midpoint% + \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \getcylinderpoints% + \let\pgf@cylinder@referencepoint\basepoint% + \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}% + }% + \anchor{base west}{% + \getcylinderpoints% + \let\pgf@cylinder@referencepoint\basepoint% + \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}% + }% + \anchor{north}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{0pt}{\externalradius}}% + }% + \anchor{south}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{0pt}{-\externalradius}}% + }% + \anchor{east}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{0pt}}% + }% + \anchor{west}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{0pt}}% + }% + \anchor{north east}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{\externalradius}}% + }% + \anchor{south west}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{-\externalradius}}% + }% + \anchor{south east}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{\externalradius}{-\externalradius}}% + }% + \anchor{north west}{% + \getcylinderpoints% + \pgf@anchor@cylinder@border{\pgfqpoint{-\externalradius}{\externalradius}}% + }% + \anchor{before top}{% + \getcylinderpoints% + \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}{\centerpoint}{\rotate}% + }% + \anchor{top}{% + \getcylinderpoints% + \pgfmathrotatepointaround{% + \pgfpointadd{% + \beforetop% + \pgf@y0pt\relax% + \advance\pgf@x\xradius\relax% + }{\centerpoint}}{\centerpoint}{\rotate}% + }% + \anchor{after top}{% + \getcylinderpoints% + \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}% + }% + \anchor{before bottom}{% + \getcylinderpoints% + \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}% + }% + \anchor{bottom}{% + \getcylinderpoints% + \pgfmathrotatepointaround{% + \pgfpointadd{% + \afterbottom% + \pgf@y0pt\relax% + \advance\pgf@x-\xradius\relax% + }{\centerpoint}}{\centerpoint}{\rotate}% + }% + \anchor{after bottom}{% + \getcylinderpoints% + \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}{\centerpoint}{\rotate}% + }% + \backgroundpath{% + \getcylinderpoints% + {% + \pgf@x\xradius\relax% + \advance\pgf@x-\outersep\relax% + \edef\xradius{\the\pgf@x}% + \pgf@y\yradius\relax% + \advance\pgf@y-\outersep\relax% + \edef\yradius{\the\pgf@y}% + \pgftransformshift{\centerpoint}% + \pgftransformrotate{\rotate}% + \pgfpathmoveto{\afterbottom}% + \pgfpatharc{90}{270}{\xradius and \yradius}% + \pgfpathlineto{\beforetop\pgf@y-\pgf@y}% + \pgfpatharc{-90}{90}{\xradius and \yradius}% + \pgfpathclose% + \pgfpathmoveto{\beforetop}% + \pgfpatharc{90}{270}{\xradius and \yradius}% + }% + }% + \behindbackgroundpath{% + \ifpgfcylinderusescustomfill% + \getcylinderpoints% + \pgf@x\xradius\relax% + \advance\pgf@x-\outersep\relax% + \edef\xradius{\the\pgf@x}% + \pgf@y\yradius\relax% + \advance\pgf@y-\outersep\relax% + \edef\yradius{\the\pgf@y}% + {% + \pgftransformshift{\centerpoint}% + \pgftransformrotate{\rotate}% + \pgfpathmoveto{\afterbottom}% + \pgfpatharc{90}{270}{\xradius and \yradius}% + \pgfpathlineto{\beforetop\pgf@y-\pgf@y}% + \pgfpatharc{270}{90}{\xradius and \yradius}% + \pgfpathclose% + \expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/cylinder body fill}}% + \pgfusepath{fill}% + % + \pgfpathmoveto{\beforetop}% + \pgfpatharc{90}{-270}{\xradius and \yradius}% + \pgfpathclose + \expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/cylinder end fill}}% + \pgfusepath{fill}% + }% + \fi% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \getcylinderpoints% + \pgfutil@ifundefined{pgf@cylinder@referencepoint}{\let\referencepoint\centerpoint}{% + \let\referencepoint\pgf@cylinder@referencepoint}% + \pgfextract@process\externalpoint{% + \externalpoint% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \referencepoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \pgfmathsubtract@{\pgfmathresult}{\rotate}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\externalangle\pgfmathresult% + % + \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor}{\centerpoint}}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor}{\centerpoint}}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathrotatepointaround{% + \pgfmathpointintersectionoflineandarc% + {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}% + {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}% + {% + \beforetop% + \pgf@xa\pgf@x% + \centerpoint% + \advance\pgf@x\pgf@xa% + }% + {0}{90}{\xradius and \yradius}% + }{\centerpoint}{\rotate}% + \else% + \pgfpointintersectionoflines{% + \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}% + {\centerpoint}{\rotate}}{% + \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}% + {\centerpoint}{\rotate}}% + {\referencepoint}{\externalpoint}% + \fi% + \else% + \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}% + \ifdim\externalangle pt>\pgfmathresult pt\relax% + \pgfmathrotatepointaround{% + \pgfmathpointintersectionoflineandarc% + {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}% + {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}% + {% + \beforetop% + \pgf@xa\pgf@x% + \centerpoint + \advance\pgf@x\pgf@xa% + }% + {270}{360}{\xradius and \yradius}% + }{\centerpoint}{\rotate}% + \else% + \pgfpointintersectionoflines{% + \pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}% + {\centerpoint}{\rotate}}{% + \pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}% + {\centerpoint}{\rotate}}% + {\referencepoint}{\externalpoint}% + \fi% + \else% + \pgfmathrotatepointaround{% + \pgfmathpointintersectionoflineandarc% + {\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}% + {\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}% + {% + \afterbottom% + \pgf@xa\pgf@x% + \centerpoint + \advance\pgf@x\pgf@xa% + }% + {90}{270}{\xradius and \yradius}% + }{\centerpoint}{\rotate}% + \fi% + \fi% + }% +}% diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex index 5466b1a27f2..fe64c707c1a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex @@ -7,28 +7,28 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex,v 1.5 2013/07/18 14:15:25 tantau Exp $ +\ProvidesFileRCS{pgflibraryshapes.misc.code.tex} \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} +{% + \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 @@ -39,440 +39,440 @@ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}} \pgfsetarrowsstart{} \pgfsetarrowsend{} - } -} + }% +}% \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} +{% + \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} \pgfsetarrowsstart{} \pgfsetarrowsend{} - } -} + }% +}% % Rounded rectangle \pgfkeys{/pgf/.cd, - rounded rectangle west arc/.initial=convex, - rounded rectangle east arc/.initial=convex, - rounded rectangle left arc/.style={/pgf/rounded rectangle west arc=#1},% - rounded rectangle right arc/.style={/pgf/rounded rectangle east arc=#1},% - rounded rectangle arc length/.initial=180% + rounded rectangle west arc/.initial=convex, + rounded rectangle east arc/.initial=convex, + rounded rectangle left arc/.style={/pgf/rounded rectangle west arc=#1},% + rounded rectangle right arc/.style={/pgf/rounded rectangle east arc=#1},% + rounded rectangle arc length/.initial=180% }% \def\pgf@lib@sh@misc@rr@text@concave{concave}% \def\pgf@lib@sh@misc@rr@text@convex{convex}% \pgfdeclareshape{rounded rectangle}{% - \savedmacro\westarc{% - \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}% - } - \savedmacro\eastarc{% - \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}% - } - \savedmacro\roundedrectanglepoints{% - % - % Get half the arc angle, a. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}% - \pgf@x=.5\pgf@x% - \edef\halfarcangle{\pgfmath@tonumber{\pgf@x}}% - \addtosavedmacro\halfarcangle% - % - % Get the (half) node dimensions x & y. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \edef\innerxsep{\the\pgf@x}% - \pgf@xa=0.5\wd\pgfnodeparttextbox% - \edef\halftextwidth{\the\pgf@xa}% - \addtosavedmacro\halftextwidth% - \advance\pgf@x by\pgf@xa% - % - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \edef\innerysep{\the\pgf@y}% - \pgf@ya=.5\ht\pgfnodeparttextbox% - \advance\pgf@ya by.5\dp\pgfnodeparttextbox% - \edef\halftextheight{\the\pgf@ya}% - \addtosavedmacro\halftextheight% - \advance\pgf@y by\pgf@ya% - % - % Adjust for minimum height - % - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<.5\pgf@yb% - \pgf@y=.5\pgf@yb% - \fi% - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfheight% - % - % Calculate the radius of the arc ends. - % - \pgfmathcosec@{\halfarcangle}% - \pgf@ya=\pgfmathresult\pgf@y% - \edef\radius{\the\pgf@ya}% - \addtosavedmacro\radius% - % - % Arc width = r - r*cos(a/2). - % - \pgfmathcos@{\halfarcangle}% - \pgf@xa=\pgf@ya% - \advance\pgf@xa by-\pgfmathresult\pgf@ya% - % - % When the node contents are pushed inside a convex arc, - % the resulting chord has a height r - r*cos(asin(0.5*h/r)). - % - \pgfmathdivide{\halftextheight}{\radius}% - \pgfmathasin@{\pgfmathresult}% - \pgfmathcos@{\pgfmathresult}% - \pgf@xb=\pgf@ya% - \advance\pgf@xb by-\pgfmathresult\pgf@ya% - % - % Adjust for minimum width. - % - \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}% - \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}% - % - \pgfutil@tempdima=2.0\pgf@x% x still holds the half width. - \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% - \advance\pgfutil@tempdima by\pgf@xa% - \else% - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \advance\pgfutil@tempdima by\pgf@xb% - \fi% - \fi% - % - \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% - \advance\pgfutil@tempdima by\pgf@xa% - \else% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \advance\pgfutil@tempdima by\pgf@xb% - \fi% - \fi% - % - \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgfutil@tempdima<\pgfutil@tempdimb% - \advance\pgfutil@tempdimb by-\pgfutil@tempdima% - \divide\pgfutil@tempdimb by2\relax% - \edef\xoffset{\the\pgfutil@tempdimb}% - \else% - \let\xoffset=\innerxsep% - \fi% - % - % The node is made wider if convex arcs overlap. - % - \pgf@x=\halftextwidth\relax% - \advance\pgf@x by\xoffset\relax% - \pgf@xc=\pgf@ya% - \advance\pgf@xc by-\pgf@xb% - \ifdim\pgf@xc>\pgf@x\relax% - \advance\pgf@xc by-\pgf@x% - \advance\pgf@xc by\xoffset\relax% - \edef\xoffset{\the\pgf@xc}% - \fi% - \addtosavedmacro\xoffset% - % - \pgf@x=\halftextwidth\relax% - \advance\pgf@x by\xoffset\relax% - \edef\halfwidth{\the\pgf@x}% - \addtosavedmacro\halfwidth% - % - \edef\arcwidth{\the\pgf@xa}% - \addtosavedmacro\arcwidth% - % - \edef\chordwidth{\the\pgf@xb}% - \addtosavedmacro\chordwidth% - % - \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}% - \addtosavedmacro\outerxsep% - \addtosavedmacro\outerysep% - % - % calculate some horizontal adjustments made for the default miter - % drawn when an arc meets the north or south side of the node path. - % - \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero. - \def\concavexshift{0pt}% - \else% - % For a concave arc: outer xsep * cosec((90-a/2)/2)*cos((90-a/2)/2). - \pgfmathsubtract@{90}{\halfarcangle}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\angletemp=\pgfmathresult% - \pgf@x=\outerxsep\relax% - \pgfmathcosec@{\angletemp}% - \pgf@x=\pgfmathresult\pgf@x% - \pgfmathcos@{\angletemp}% - \pgf@x=\pgfmathresult\pgf@x% - \edef\concavexshift{\the\pgf@x}% - \fi% - \addtosavedmacro\concavexshift% - % - \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero. - \def\convexxshift{0pt}% - \else% - % For a convex arc: outer xsep * cosec((90+a/2)/2)*cos((90+a/2)/2). - \pgfmathadd@{90}{\halfarcangle}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\angletemp=\pgfmathresult% - \pgf@x=\outerxsep\relax% - \pgfmathcosec@{\angletemp}% - \pgf@x=\pgfmathresult\pgf@x% - \pgfmathcos@{\angletemp}% - \pgf@x=\pgfmathresult\pgf@x% - \edef\convexxshift{\the\pgf@x}% - \fi% - \addtosavedmacro\convexxshift% - }% - \saveddimen\halflinewidth{\pgf@x.5\pgflinewidth}% - \savedanchor\centerpoint{% - \pgf@x=.5\wd\pgfnodeparttextbox% - \pgf@y=.5\ht\pgfnodeparttextbox% - \advance\pgf@y by-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x=.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x=.5\wd\pgfnodeparttextbox% - \pgf@y=0pt\relax% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid west}{% - \csname pgf@anchor@rounded rectangle@west\endcsname% - \pgf@xc=\pgf@x% - \midpoint% - \pgf@x=\pgf@xc% - }% - \anchor{mid east}{% - \csname pgf@anchor@rounded rectangle@east\endcsname% - \pgf@xc=\pgf@x% - \midpoint% - \pgf@x=\pgf@xc% - }% - \anchor{base}{\basepoint}% - \anchor{base west}{% - \csname pgf@anchor@rounded rectangle@west\endcsname% - \pgf@xc=\pgf@x% - \basepoint% - \pgf@x=\pgf@xc% - }% - \anchor{base east}{% - \csname pgf@anchor@rounded rectangle@east\endcsname% - \pgf@xc=\pgf@x% - \basepoint% - \pgf@x=\pgf@xc% - }% - \anchor{north}{% - \roundedrectanglepoints% - \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{\halfheight+\outerysep}}% - }% - \anchor{south}{% - \roundedrectanglepoints% - \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{-\halfheight-\outerysep}}% - }% - \anchor{west}{% - \roundedrectanglepoints% - \pgfpointadd{\centerpoint}{% - \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% - \pgfpoint{-\halfwidth-\arcwidth-\concavexshift}{+0pt}% - \else% - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpoint{-\halfwidth-\chordwidth-\outerxsep}{+0pt}% - \else% - \pgfpoint{-\halfwidth-\outerxsep}{+0pt}% - \fi% - \fi% - }% - }% - \anchor{north west}{% - \roundedrectanglepoints% - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}% - \else% - \csname pgf@anchor@rounded rectangle@west\endcsname% - \fi% - \pgf@xc=\pgf@x% - \csname pgf@anchor@rounded rectangle@north\endcsname% - \pgf@x=\pgf@xc% - }% - \anchor{south west}{% - \roundedrectanglepoints% - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}% - \else% - \csname pgf@anchor@rounded rectangle@west\endcsname% - \fi% - \pgf@xc=\pgf@x% - \csname pgf@anchor@rounded rectangle@south\endcsname% - \pgf@x=\pgf@xc% - }% - \anchor{east}{% - \roundedrectanglepoints% - \pgfpointadd{\centerpoint}{% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% - \pgfpoint{\halfwidth+\arcwidth+\concavexshift}{+0pt}% - \else% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpoint{\halfwidth+\chordwidth+\outerxsep}{+0pt}% - \else% - \pgfpoint{\halfwidth+\outerxsep}{+0pt}% - \fi% - \fi% - }% - }% - \anchor{north east}{% - \roundedrectanglepoints% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}% - \else% - \csname pgf@anchor@rounded rectangle@east\endcsname% - \fi% - \pgf@xc=\pgf@x% - \csname pgf@anchor@rounded rectangle@north\endcsname% - \pgf@x=\pgf@xc% - }% - \anchor{south east}{% - \roundedrectanglepoints% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}% - \else% - \csname pgf@anchor@rounded rectangle@east\endcsname% - \fi% - \pgf@xc=\pgf@x% - \csname pgf@anchor@rounded rectangle@south\endcsname% - \pgf@x=\pgf@xc% - }% - \backgroundpath{% - {% - \roundedrectanglepoints% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfpoint{0pt}{\halfheight}}% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% - \pgfpathlineto{\pgfpoint{\halfwidth+\arcwidth}{+\halfheight}}% - \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{+\radius}% - \else% - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpathlineto{\pgfpoint{\halfwidth+\chordwidth-\arcwidth}{+\halfheight}}% - \pgfpatharc{+\halfarcangle}{+-\halfarcangle}{+\radius}% - \else% - \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}% - \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}% - \fi% - \fi% - \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% - \pgfpathlineto{\pgfpoint{-\halfwidth-\arcwidth}{+-\halfheight}}% - \pgfpatharc{+-\halfarcangle}{+\halfarcangle}{+\radius}% - \else% - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \pgfpathlineto{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth}{+-\halfheight}}% - \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{+\radius}% - \else% - \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}% - \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}% - \fi% - \fi% - \pgfpathclose% - }% - } - \anchorborder{% - \pgfextract@process\externalpoint{% - \pgfextract@process\externalpoint{}% - \pgfpointadd{\centerpoint}{\externalpoint}% - }% - \roundedrectanglepoints% - % - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle=\pgfmathresult% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - % Between north east and east. - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfextract@process\arccenter{% - \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}% - }% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {\arccenter}{0}{\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}% - \else% - \pgfpointintersectionoflines% - {\csname pgf@anchor@rounded rectangle@north east\endcsname}% - {\csname pgf@anchor@rounded rectangle@south east\endcsname}% - {\externalpoint}{\centerpoint}% - \fi% - \else% - % Between north west and north east. - \pgfpointintersectionoflines% - {\csname pgf@anchor@rounded rectangle@north east\endcsname}% - {\csname pgf@anchor@rounded rectangle@north west\endcsname}% - {\externalpoint}{\centerpoint}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - % Between south west and north west. - \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% - \pgfextract@process\arccenter{% - \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\radius}{+0pt}}% - }% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {\arccenter}{180-\halfarcangle}{180+\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}% - \else% - \pgfpointintersectionoflines% - {\csname pgf@anchor@rounded rectangle@north west\endcsname}% - {\csname pgf@anchor@rounded rectangle@south west\endcsname}% - {\externalpoint}{\centerpoint}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - % Between south east and south west. - \pgfpointintersectionoflines% - {\csname pgf@anchor@rounded rectangle@south east\endcsname}% - {\csname pgf@anchor@rounded rectangle@south west\endcsname}% - {\externalpoint}{\centerpoint}% - \else% - % Between east and south east. - \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% - \pgfextract@process\arccenter{% - \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}% - }% - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {\arccenter}{360-\halfarcangle}{360}{\radius+\outerxsep and \radius+\outerysep}% - \else% - \pgfpointintersectionoflines% - {\csname pgf@anchor@rounded rectangle@north east\endcsname}% - {\csname pgf@anchor@rounded rectangle@south east\endcsname}% - {\externalpoint}{\centerpoint}% - \fi% - \fi% - \fi% - \fi% - } -} + \savedmacro\westarc{% + \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}% + }% + \savedmacro\eastarc{% + \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}% + }% + \savedmacro\roundedrectanglepoints{% + % + % Get half the arc angle, a. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}% + \pgf@x=.5\pgf@x% + \edef\halfarcangle{\pgfmath@tonumber{\pgf@x}}% + \addtosavedmacro\halfarcangle% + % + % Get the (half) node dimensions x & y. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \edef\innerxsep{\the\pgf@x}% + \pgf@xa=0.5\wd\pgfnodeparttextbox% + \edef\halftextwidth{\the\pgf@xa}% + \addtosavedmacro\halftextwidth% + \advance\pgf@x by\pgf@xa% + % + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \edef\innerysep{\the\pgf@y}% + \pgf@ya=.5\ht\pgfnodeparttextbox% + \advance\pgf@ya by.5\dp\pgfnodeparttextbox% + \edef\halftextheight{\the\pgf@ya}% + \addtosavedmacro\halftextheight% + \advance\pgf@y by\pgf@ya% + % + % Adjust for minimum height + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<.5\pgf@yb% + \pgf@y=.5\pgf@yb% + \fi% + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfheight% + % + % Calculate the radius of the arc ends. + % + \pgfmathcosec@{\halfarcangle}% + \pgf@ya=\pgfmathresult\pgf@y% + \edef\radius{\the\pgf@ya}% + \addtosavedmacro\radius% + % + % Arc width = r - r*cos(a/2). + % + \pgfmathcos@{\halfarcangle}% + \pgf@xa=\pgf@ya% + \advance\pgf@xa by-\pgfmathresult\pgf@ya% + % + % When the node contents are pushed inside a convex arc, + % the resulting chord has a height r - r*cos(asin(0.5*h/r)). + % + \pgfmathdivide{\halftextheight}{\radius}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathcos@{\pgfmathresult}% + \pgf@xb=\pgf@ya% + \advance\pgf@xb by-\pgfmathresult\pgf@ya% + % + % Adjust for minimum width. + % + \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}% + \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}% + % + \pgfutil@tempdima=2.0\pgf@x% x still holds the half width. + \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% + \advance\pgfutil@tempdima by\pgf@xa% + \else% + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \advance\pgfutil@tempdima by\pgf@xb% + \fi% + \fi% + % + \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% + \advance\pgfutil@tempdima by\pgf@xa% + \else% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \advance\pgfutil@tempdima by\pgf@xb% + \fi% + \fi% + % + \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgfutil@tempdima<\pgfutil@tempdimb% + \advance\pgfutil@tempdimb by-\pgfutil@tempdima% + \divide\pgfutil@tempdimb by2\relax% + \edef\xoffset{\the\pgfutil@tempdimb}% + \else% + \let\xoffset=\innerxsep% + \fi% + % + % The node is made wider if convex arcs overlap. + % + \pgf@x=\halftextwidth\relax% + \advance\pgf@x by\xoffset\relax% + \pgf@xc=\pgf@ya% + \advance\pgf@xc by-\pgf@xb% + \ifdim\pgf@xc>\pgf@x\relax% + \advance\pgf@xc by-\pgf@x% + \advance\pgf@xc by\xoffset\relax% + \edef\xoffset{\the\pgf@xc}% + \fi% + \addtosavedmacro\xoffset% + % + \pgf@x=\halftextwidth\relax% + \advance\pgf@x by\xoffset\relax% + \edef\halfwidth{\the\pgf@x}% + \addtosavedmacro\halfwidth% + % + \edef\arcwidth{\the\pgf@xa}% + \addtosavedmacro\arcwidth% + % + \edef\chordwidth{\the\pgf@xb}% + \addtosavedmacro\chordwidth% + % + \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}% + \addtosavedmacro\outerxsep% + \addtosavedmacro\outerysep% + % + % calculate some horizontal adjustments made for the default miter + % drawn when an arc meets the north or south side of the node path. + % + \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero. + \def\concavexshift{0pt}% + \else% + % For a concave arc: outer xsep * cosec((90-a/2)/2)*cos((90-a/2)/2). + \pgfmathsubtract@{90}{\halfarcangle}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\angletemp=\pgfmathresult% + \pgf@x=\outerxsep\relax% + \pgfmathcosec@{\angletemp}% + \pgf@x=\pgfmathresult\pgf@x% + \pgfmathcos@{\angletemp}% + \pgf@x=\pgfmathresult\pgf@x% + \edef\concavexshift{\the\pgf@x}% + \fi% + \addtosavedmacro\concavexshift% + % + \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero. + \def\convexxshift{0pt}% + \else% + % For a convex arc: outer xsep * cosec((90+a/2)/2)*cos((90+a/2)/2). + \pgfmathadd@{90}{\halfarcangle}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\angletemp=\pgfmathresult% + \pgf@x=\outerxsep\relax% + \pgfmathcosec@{\angletemp}% + \pgf@x=\pgfmathresult\pgf@x% + \pgfmathcos@{\angletemp}% + \pgf@x=\pgfmathresult\pgf@x% + \edef\convexxshift{\the\pgf@x}% + \fi% + \addtosavedmacro\convexxshift% + }% + \saveddimen\halflinewidth{\pgf@x.5\pgflinewidth}% + \savedanchor\centerpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=0pt\relax% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid west}{% + \csname pgf@anchor@rounded rectangle@west\endcsname% + \pgf@xc=\pgf@x% + \midpoint% + \pgf@x=\pgf@xc% + }% + \anchor{mid east}{% + \csname pgf@anchor@rounded rectangle@east\endcsname% + \pgf@xc=\pgf@x% + \midpoint% + \pgf@x=\pgf@xc% + }% + \anchor{base}{\basepoint}% + \anchor{base west}{% + \csname pgf@anchor@rounded rectangle@west\endcsname% + \pgf@xc=\pgf@x% + \basepoint% + \pgf@x=\pgf@xc% + }% + \anchor{base east}{% + \csname pgf@anchor@rounded rectangle@east\endcsname% + \pgf@xc=\pgf@x% + \basepoint% + \pgf@x=\pgf@xc% + }% + \anchor{north}{% + \roundedrectanglepoints% + \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{\halfheight+\outerysep}}% + }% + \anchor{south}{% + \roundedrectanglepoints% + \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{-\halfheight-\outerysep}}% + }% + \anchor{west}{% + \roundedrectanglepoints% + \pgfpointadd{\centerpoint}{% + \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% + \pgfpoint{-\halfwidth-\arcwidth-\concavexshift}{+0pt}% + \else% + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpoint{-\halfwidth-\chordwidth-\outerxsep}{+0pt}% + \else% + \pgfpoint{-\halfwidth-\outerxsep}{+0pt}% + \fi% + \fi% + }% + }% + \anchor{north west}{% + \roundedrectanglepoints% + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}% + \else% + \csname pgf@anchor@rounded rectangle@west\endcsname% + \fi% + \pgf@xc=\pgf@x% + \csname pgf@anchor@rounded rectangle@north\endcsname% + \pgf@x=\pgf@xc% + }% + \anchor{south west}{% + \roundedrectanglepoints% + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}% + \else% + \csname pgf@anchor@rounded rectangle@west\endcsname% + \fi% + \pgf@xc=\pgf@x% + \csname pgf@anchor@rounded rectangle@south\endcsname% + \pgf@x=\pgf@xc% + }% + \anchor{east}{% + \roundedrectanglepoints% + \pgfpointadd{\centerpoint}{% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% + \pgfpoint{\halfwidth+\arcwidth+\concavexshift}{+0pt}% + \else% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpoint{\halfwidth+\chordwidth+\outerxsep}{+0pt}% + \else% + \pgfpoint{\halfwidth+\outerxsep}{+0pt}% + \fi% + \fi% + }% + }% + \anchor{north east}{% + \roundedrectanglepoints% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}% + \else% + \csname pgf@anchor@rounded rectangle@east\endcsname% + \fi% + \pgf@xc=\pgf@x% + \csname pgf@anchor@rounded rectangle@north\endcsname% + \pgf@x=\pgf@xc% + }% + \anchor{south east}{% + \roundedrectanglepoints% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}% + \else% + \csname pgf@anchor@rounded rectangle@east\endcsname% + \fi% + \pgf@xc=\pgf@x% + \csname pgf@anchor@rounded rectangle@south\endcsname% + \pgf@x=\pgf@xc% + }% + \backgroundpath{% + {% + \roundedrectanglepoints% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfpoint{0pt}{\halfheight}}% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave% + \pgfpathlineto{\pgfpoint{\halfwidth+\arcwidth}{+\halfheight}}% + \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{+\radius}% + \else% + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpathlineto{\pgfpoint{\halfwidth+\chordwidth-\arcwidth}{+\halfheight}}% + \pgfpatharc{+\halfarcangle}{+-\halfarcangle}{+\radius}% + \else% + \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}% + \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}% + \fi% + \fi% + \ifx\westarc\pgf@lib@sh@misc@rr@text@concave% + \pgfpathlineto{\pgfpoint{-\halfwidth-\arcwidth}{+-\halfheight}}% + \pgfpatharc{+-\halfarcangle}{+\halfarcangle}{+\radius}% + \else% + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \pgfpathlineto{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth}{+-\halfheight}}% + \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{+\radius}% + \else% + \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}% + \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}% + \fi% + \fi% + \pgfpathclose% + }% + }% + \anchorborder{% + \pgfextract@process\externalpoint{% + \pgfextract@process\externalpoint{}% + \pgfpointadd{\centerpoint}{\externalpoint}% + }% + \roundedrectanglepoints% + % + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle=\pgfmathresult% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + % Between north east and east. + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfextract@process\arccenter{% + \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}% + }% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {\arccenter}{0}{\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}% + \else% + \pgfpointintersectionoflines% + {\csname pgf@anchor@rounded rectangle@north east\endcsname}% + {\csname pgf@anchor@rounded rectangle@south east\endcsname}% + {\externalpoint}{\centerpoint}% + \fi% + \else% + % Between north west and north east. + \pgfpointintersectionoflines% + {\csname pgf@anchor@rounded rectangle@north east\endcsname}% + {\csname pgf@anchor@rounded rectangle@north west\endcsname}% + {\externalpoint}{\centerpoint}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + % Between south west and north west. + \ifx\westarc\pgf@lib@sh@misc@rr@text@convex% + \pgfextract@process\arccenter{% + \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\radius}{+0pt}}% + }% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {\arccenter}{180-\halfarcangle}{180+\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}% + \else% + \pgfpointintersectionoflines% + {\csname pgf@anchor@rounded rectangle@north west\endcsname}% + {\csname pgf@anchor@rounded rectangle@south west\endcsname}% + {\externalpoint}{\centerpoint}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + % Between south east and south west. + \pgfpointintersectionoflines% + {\csname pgf@anchor@rounded rectangle@south east\endcsname}% + {\csname pgf@anchor@rounded rectangle@south west\endcsname}% + {\externalpoint}{\centerpoint}% + \else% + % Between east and south east. + \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex% + \pgfextract@process\arccenter{% + \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}% + }% + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {\arccenter}{360-\halfarcangle}{360}{\radius+\outerxsep and \radius+\outerysep}% + \else% + \pgfpointintersectionoflines% + {\csname pgf@anchor@rounded rectangle@north east\endcsname}% + {\csname pgf@anchor@rounded rectangle@south east\endcsname}% + {\externalpoint}{\centerpoint}% + \fi% + \fi% + \fi% + \fi% + }% +}% @@ -483,74 +483,74 @@ % /pgf/chamfered rectangle xsep : set the extent of the x chamferling. % /pgf/chamfered rectangle ysep : set the extent of the y chamferling. -\pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners} -\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners} +\pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}% +\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}% \def\pgf@lib@sh@misc@cr@chamferall{chamfer all}% -\def\pgf@lib@sh@misc@cr@chamfer{chamfer} +\def\pgf@lib@sh@misc@cr@chamfer{chamfer}% \let\pgf@lib@sh@misc@cr@corners\pgf@lib@sh@misc@cr@chamferall \def\pgf@lib@sh@misc@cr@getcorners{% - \let\northeastcorner\pgfutil@empty% - \let\southeastcorner\pgfutil@empty% - \let\southwestcorner\pgfutil@empty% - \let\northwestcorner\pgfutil@empty% - \expandafter\pgfutil@in@\expandafter{\pgf@lib@sh@misc@cr@corners}{chamfer all}% - \ifpgfutil@in@% - \let\northeastcorner\pgf@lib@sh@misc@cr@round% - \let\southeastcorner\pgf@lib@sh@misc@cr@round% - \let\southwestcorner\pgf@lib@sh@misc@cr@round% - \let\northwestcorner\pgf@lib@sh@misc@cr@round% - \let\pgf@next\relax% - \else% - \let\pgf@next\pgf@lib@sh@misc@cr@parsecorners% - \fi% - \pgf@next} + \let\northeastcorner\pgfutil@empty% + \let\southeastcorner\pgfutil@empty% + \let\southwestcorner\pgfutil@empty% + \let\northwestcorner\pgfutil@empty% + \expandafter\pgfutil@in@\expandafter{\pgf@lib@sh@misc@cr@corners}{chamfer all}% + \ifpgfutil@in@% + \let\northeastcorner\pgf@lib@sh@misc@cr@round% + \let\southeastcorner\pgf@lib@sh@misc@cr@round% + \let\southwestcorner\pgf@lib@sh@misc@cr@round% + \let\northwestcorner\pgf@lib@sh@misc@cr@round% + \let\pgf@next\relax% + \else% + \let\pgf@next\pgf@lib@sh@misc@cr@parsecorners% + \fi% + \pgf@next}% \def\pgf@lib@sh@misc@cr@parsecorners{% - \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@lib@sh@misc@cr@corners,\pgf@stop,% -} - + \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@lib@sh@misc@cr@corners,\pgf@stop,% +}% + \def\pgf@@chamferedrectangle@parsecorners#1,{% - \ifx#1\pgf@stop% - \let\pgf@next\relax% - \else% - \pgfutil@in@{@#1@}{@north east@@top left@}% - \ifpgfutil@in@% - \let\northeastcorner\pgf@lib@sh@misc@cr@chamfer% - \else% - \pgfutil@in@{@#1@}{@south east@@bottom right@}% - \ifpgfutil@in@% - \let\southeastcorner\pgf@lib@sh@misc@cr@chamfer% - \else% - \pgfutil@in@{@#1@}{@south west@@bottom left@}% - \ifpgfutil@in@% - \let\southwestcorner\pgf@lib@sh@misc@cr@chamfer% - \else% - \pgfutil@in@{@#1@}{@north west@@top right@}% - \ifpgfutil@in@% - \let\northwestcorner\pgf@lib@sh@misc@cr@round% - \fi% - \fi% - \fi% - \fi% - \let\pgf@next\pgf@@@chamferedrectangle@parsecorners% - \fi% - \pgf@next% -} + \ifx#1\pgf@stop% + \let\pgf@next\relax% + \else% + \pgfutil@in@{@#1@}{@north east@@top left@}% + \ifpgfutil@in@% + \let\northeastcorner\pgf@lib@sh@misc@cr@chamfer% + \else% + \pgfutil@in@{@#1@}{@south east@@bottom right@}% + \ifpgfutil@in@% + \let\southeastcorner\pgf@lib@sh@misc@cr@chamfer% + \else% + \pgfutil@in@{@#1@}{@south west@@bottom left@}% + \ifpgfutil@in@% + \let\southwestcorner\pgf@lib@sh@misc@cr@chamfer% + \else% + \pgfutil@in@{@#1@}{@north west@@top right@}% + \ifpgfutil@in@% + \let\northwestcorner\pgf@lib@sh@misc@cr@round% + \fi% + \fi% + \fi% + \fi% + \let\pgf@next\pgf@@@chamferedrectangle@parsecorners% + \fi% + \pgf@next% +}% \def\pgf@@@chamferedrectangle@parsecorners{% - \pgfutil@ifnextchar x{\pgf@@chamferedrectangle@parsecorners}{\pgf@@chamferedrectangle@parsecorners}% + \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% -} + 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}% -} + /pgf/chamfered rectangle xsep=#1,/pgf/chamfered rectangle ysep=#1}% +}% @@ -559,569 +559,569 @@ % % \pgfdeclareshape{chamfered rectangle}{% - \savedmacro\getchamferedrectanglepoints{% - \pgf@lib@sh@misc@cr@getcorners% - % - % Get the node dimensions. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya.5\ht\pgfnodeparttextbox% - \advance\pgf@ya.5\dp\pgfnodeparttextbox% - % - % Get chamfer stuff. - % - \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/chamfered rectangle angle}}% - \ifdim\pgfutil@tempdima<89pt\relax% - \ifdim\pgfutil@tempdima<1pt\relax% - \pgfutil@tempdima1pt\relax% - \fi% - \else% - \pgfutil@tempdima89pt\relax% - \fi% - \pgfutil@tempdima-\pgfutil@tempdima% - \advance\pgfutil@tempdima90pt\relax% - \pgfmathtan@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \let\tanangle\pgfmathresult% - \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \let\cotangle\pgfmathresult% - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/chamfered rectangle xsep}}% - \pgf@yc\tanangle\pgf@xb% - \ifdim\pgf@yc>\pgf@ya% - \pgf@yc\pgf@ya% - \pgf@xb\cotangle\pgf@yc% - \fi% - \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/chamfered rectangle ysep}}% - \pgf@xc\cotangle\pgf@yb% - \ifdim\pgf@xc>\pgf@xa% - \pgf@xc\pgf@xa% - \pgf@yb\tanangle\pgf@xc% - \fi% - % - % Check for minimum width and height% - % - \pgfutil@tempdima\pgf@xa% - \advance\pgfutil@tempdima\pgf@xb% - \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb% - \pgf@xa.5\pgfutil@tempdimb% - \advance\pgf@xa-\pgf@xb% - \fi% - \pgfutil@tempdima\pgf@ya% - \advance\pgfutil@tempdima\pgf@yb% - \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb% - \pgf@ya.5\pgfutil@tempdimb% - \advance\pgf@ya-\pgf@yb% - \fi% - % - % Define the background path points. - % - \pgfextract@process\centerpoint{% - \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% - \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% - }% - \pgfextract@process\beforenortheast{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@x\pgf@xb% - \advance\pgf@y\pgf@ya% - \advance\pgf@y-\pgf@yc% - }% - \pgfextract@process\northeast{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - \ifx\northeastcorner\pgfutil@empty% - \advance\pgf@x\pgf@xb% - \advance\pgf@y\pgf@yb% - \fi% - }% - \pgfextract@process\afternortheast{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@x-\pgf@xc% - \advance\pgf@y\pgf@ya% - \advance\pgf@y\pgf@yb% - }% - \pgfextract@process\northwest{% - \centerpoint% - \advance\pgf@x-\pgf@xa% - \advance\pgf@y\pgf@ya% - \ifx\northwestcorner\pgfutil@empty% - \advance\pgf@x-\pgf@xb% - \advance\pgf@y\pgf@yb% - \fi% - }% - \pgfextract@process\beforesouthwest{% - \centerpoint% - \advance\pgf@x-\pgf@xa% - \advance\pgf@x-\pgf@xb% - \advance\pgf@y-\pgf@ya% - \advance\pgf@y\pgf@yc% - }% - \pgfextract@process\southwest{% - \centerpoint% - \advance\pgf@x-\pgf@xa% - \advance\pgf@y-\pgf@ya% - \ifx\southwestcorner\pgfutil@empty% - \advance\pgf@x-\pgf@xb% - \advance\pgf@y-\pgf@yb% - \fi% - }% - \pgfextract@process\aftersouthwest{% - \centerpoint% - \advance\pgf@x-\pgf@xa% - \advance\pgf@x\pgf@xc% - \advance\pgf@y-\pgf@ya% - \advance\pgf@y-\pgf@yb% - }% - \pgfextract@process\southeast{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y-\pgf@ya% - \ifx\southeastcorner\pgfutil@empty% - \advance\pgf@x\pgf@xb% - \advance\pgf@y-\pgf@yb% - \fi% - }% - % - % Calculate the `miter' vectors. - % - \pgfmathanglebetweenlines{\beforenortheast}{\afternortheast}{\beforenortheast}% - {\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}% - \pgfutil@tempdima\pgfmathresult pt\relax% - \ifdim\pgfutil@tempdima>180pt\relax% - \advance\pgfutil@tempdima-180pt\relax% - \fi% - \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer xsep}}% - \ifdim\pgfutil@tempdima<90pt\relax% - \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \pgfutil@tempdima0pt\relax% - \else% - \pgfutil@tempdima.5\pgfutil@tempdima% - \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \pgfutil@tempdima-\pgfutil@tempdima% - \advance\pgfutil@tempdima90pt\relax% - \fi% - \pgfextract@process\before@ne@anchor{% - \beforenortheast% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfutil@tempdima-\pgfutil@tempdima% - \advance\pgfutil@tempdima180pt\relax% - \pgfextract@process\before@sw@anchor{% - \beforesouthwest% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - \pgfmathanglebetweenlines{\afternortheast}{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}% - {\afternortheast}{\beforenortheast}% - \pgfutil@tempdima\pgfmathresult pt\relax% - \ifdim\pgfutil@tempdima>270pt\relax% - \advance\pgfutil@tempdima-270pt\relax% - \fi% - \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgfutil@tempdima<90pt\relax% - \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \pgfutil@tempdima90pt\relax% - \else% - \pgfutil@tempdima.5\pgfutil@tempdima% - \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% - \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% - \fi% - % - \pgfextract@process\after@ne@anchor{% - \afternortheast% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfutil@tempdima-\pgfutil@tempdima% - \advance\pgfutil@tempdima180pt\relax% - \pgfextract@process\after@sw@anchor{% - \aftersouthwest - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \addtosavedmacro\before@ne@anchor% - \addtosavedmacro\after@ne@anchor% - \addtosavedmacro\before@sw@anchor% - \addtosavedmacro\after@sw@anchor% - \pgfextract@process\ne@anchor{% - \ifx\northeastcorner\pgfutil@empty% - \northeast% - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \else% - \pgfpointlineattime{0.5}{\before@ne@anchor}{\after@ne@anchor}% - \fi% - }% - \pgfextract@process\nw@anchor{% - \ifx\northwestcorner\pgfutil@empty% - \northwest% - \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \else% - \pgfpointlineattime{0.5}{% - \before@ne@anchor% - \pgf@ya\pgf@y - \before@sw@anchor% - \pgf@y\pgf@ya% - }{% - \after@ne@anchor% - \pgf@ya\pgf@y - \after@sw@anchor% - \pgf@y\pgf@ya% - }% - \fi% - }% - \pgfextract@process\sw@anchor{% - \ifx\southwestcorner\pgfutil@empty% - \southwest% - \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% - \else% - \pgfpointlineattime{0.5}{\before@sw@anchor}{\after@sw@anchor}% - \fi% - }% - \pgfextract@process\se@anchor{% - \ifx\southeastcorner\pgfutil@empty% - \southeast% - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% - \else% - \pgfpointlineattime{0.5}{% - \before@ne@anchor% - \pgf@xa\pgf@x - \before@sw@anchor% - \pgf@x\pgf@xa% - }{% - \after@ne@anchor% - \pgf@xa\pgf@x - \after@sw@anchor% - \pgf@x\pgf@xa% - }% - \fi% - }% - \addtosavedmacro\ne@anchor% - \addtosavedmacro\nw@anchor% - \addtosavedmacro\sw@anchor% - \addtosavedmacro\se@anchor% - }% - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - }% - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \getchamferedrectanglepoints% - \midpoint% - \pgf@ya\pgf@y% - \pgf@process{% - \before@sw@anchor% - \pgf@ya\pgf@y% - \before@ne@anchor% - \pgf@y\pgf@ya - }% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}% - \else% - \pgf@process{\before@ne@anchor}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor}% - \else% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor}% - {\after@ne@anchor}% - \fi% - \fi% - }% - \anchor{mid west}{% - \getchamferedrectanglepoints% - \midpoint% - \pgf@ya\pgf@y% - \pgf@process{\before@sw@anchor}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor}{\after@sw@anchor}% - \else% - \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor}% - \else% - \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}% - \fi% - \fi% - }% - \anchor{base}{\basepoint}% - \anchor{base east}{% - \getchamferedrectanglepoints% - \basepoint% - \pgf@ya\pgf@y% - \pgf@process{% - \before@sw@anchor% - \pgf@ya\pgf@y% - \before@ne@anchor% - \pgf@y\pgf@ya - }% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}% - \else% - \pgf@process{\before@ne@anchor}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor}% - \else% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor}% - {\after@ne@anchor}% - \fi% - \fi% - }% - \anchor{base west}{% - \getchamferedrectanglepoints% - \basepoint% - \pgf@ya\pgf@y% - \pgf@process{\before@sw@anchor}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor}{\after@sw@anchor}% - \else% - \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - \ifdim\pgf@ya<\pgf@y% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@sw@anchor}% - \else% - \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}% - \fi% - \fi% - }% - \anchor{before north east}{\getchamferedrectanglepoints\before@ne@anchor}% - \anchor{north east}{\getchamferedrectanglepoints\ne@anchor}% - \anchor{after north east}{\getchamferedrectanglepoints\after@ne@anchor}% - \anchor{north}{% - \getchamferedrectanglepoints% - \centerpoint% - \pgf@xa\pgf@x% - \after@ne@anchor% - \pgf@x\pgf@xa}% - \anchor{before north west}{% - \getchamferedrectanglepoints% - \after@sw@anchor% - \pgf@xa\pgf@x% - \after@ne@anchor% - \pgf@x\pgf@xa}% - \anchor{north west}{\getchamferedrectanglepoints\nw@anchor}% - \anchor{after north west}{% - \getchamferedrectanglepoints% - \before@sw@anchor% - \pgf@xa\pgf@x% - \before@ne@anchor% - \pgf@x\pgf@xa}% - \anchor{west}{% - \getchamferedrectanglepoints% - \centerpoint% - \pgf@ya\pgf@y% - \before@sw@anchor% - \pgf@y\pgf@ya}% - \anchor{before south west}{\getchamferedrectanglepoints\before@sw@anchor}% - \anchor{south west}{\getchamferedrectanglepoints\sw@anchor}% - \anchor{after south west}{\getchamferedrectanglepoints\after@sw@anchor}% - \anchor{south}{% - \getchamferedrectanglepoints% - \centerpoint% - \pgf@xa\pgf@x% - \after@sw@anchor% - \pgf@x\pgf@xa}% - \anchor{before south east}{% - \getchamferedrectanglepoints% - \after@sw@anchor% - \pgf@ya\pgf@y% - \after@ne@anchor% - \pgf@y\pgf@ya}% - \anchor{south east}{\getchamferedrectanglepoints\se@anchor}% - \anchor{after south east}{% - \getchamferedrectanglepoints% - \before@sw@anchor% - \pgf@ya\pgf@y% - \before@ne@anchor% - \pgf@y\pgf@ya}% - \anchor{east}{% - \getchamferedrectanglepoints% - \centerpoint% - \pgf@ya\pgf@y% - \before@ne@anchor% - \pgf@y\pgf@ya}% - \backgroundpath{% - \pgfpathmoveto{\beforenortheast}% - \pgfpathlineto{\northeast}% - \pgfpathlineto{\afternortheast}% - \pgfpathlineto{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}% - \pgfpathlineto{\northwest}% - \pgfpathlineto{\beforesouthwest\pgf@xa\pgf@x\beforenortheast\pgf@x\pgf@xa}% - \pgfpathlineto{\beforesouthwest}% - \pgfpathlineto{\southwest}% - \pgfpathlineto{\aftersouthwest}% - \pgfpathlineto{\aftersouthwest\pgf@ya\pgf@y\afternortheast\pgf@y\pgf@ya}% - \pgfpathlineto{\southeast}% - \pgfpathlineto{\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}% - \pgfpathclose% - } - \anchorborder{% - \pgfextract@process\externalpoint{% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - \getchamferedrectanglepoints% - \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% west. - \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% north. - \pgfmathanglebetweenpoints{\centerpoint}{\ne@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% north east. - \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% before north east. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}{\before@ne@anchor}% - \else% - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\before@ne@anchor}{\ne@anchor}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% after north east. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\ne@anchor}{\after@ne@anchor}% - \else% - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\after@ne@anchor}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - \fi% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\nw@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% north west. - \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% before north west. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - \else% - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% - {\nw@anchor}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% after north west. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\nw@anchor}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% - \else% - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% - {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}% - \fi% - \fi% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% south. - \pgfmathanglebetweenpoints{\centerpoint}{\sw@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% south west. - \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% before south west. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}% - {\before@sw@anchor}% - \else% - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\before@sw@anchor}{\sw@anchor}% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% after south west. - \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\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% - }% -} + \savedmacro\getchamferedrectanglepoints{% + \pgf@lib@sh@misc@cr@getcorners% + % + % Get the node dimensions. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya.5\ht\pgfnodeparttextbox% + \advance\pgf@ya.5\dp\pgfnodeparttextbox% + % + % Get chamfer stuff. + % + \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/chamfered rectangle angle}}% + \ifdim\pgfutil@tempdima<89pt\relax% + \ifdim\pgfutil@tempdima<1pt\relax% + \pgfutil@tempdima1pt\relax% + \fi% + \else% + \pgfutil@tempdima89pt\relax% + \fi% + \pgfutil@tempdima-\pgfutil@tempdima% + \advance\pgfutil@tempdima90pt\relax% + \pgfmathtan@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \let\tanangle\pgfmathresult% + \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \let\cotangle\pgfmathresult% + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/chamfered rectangle xsep}}% + \pgf@yc\tanangle\pgf@xb% + \ifdim\pgf@yc>\pgf@ya% + \pgf@yc\pgf@ya% + \pgf@xb\cotangle\pgf@yc% + \fi% + \pgfmathcot@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/chamfered rectangle ysep}}% + \pgf@xc\cotangle\pgf@yb% + \ifdim\pgf@xc>\pgf@xa% + \pgf@xc\pgf@xa% + \pgf@yb\tanangle\pgf@xc% + \fi% + % + % Check for minimum width and height% + % + \pgfutil@tempdima\pgf@xa% + \advance\pgfutil@tempdima\pgf@xb% + \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb% + \pgf@xa.5\pgfutil@tempdimb% + \advance\pgf@xa-\pgf@xb% + \fi% + \pgfutil@tempdima\pgf@ya% + \advance\pgfutil@tempdima\pgf@yb% + \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgfutil@tempdima<.5\pgfutil@tempdimb% + \pgf@ya.5\pgfutil@tempdimb% + \advance\pgf@ya-\pgf@yb% + \fi% + % + % Define the background path points. + % + \pgfextract@process\centerpoint{% + \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% + \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% + }% + \pgfextract@process\beforenortheast{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@x\pgf@xb% + \advance\pgf@y\pgf@ya% + \advance\pgf@y-\pgf@yc% + }% + \pgfextract@process\northeast{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + \ifx\northeastcorner\pgfutil@empty% + \advance\pgf@x\pgf@xb% + \advance\pgf@y\pgf@yb% + \fi% + }% + \pgfextract@process\afternortheast{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@x-\pgf@xc% + \advance\pgf@y\pgf@ya% + \advance\pgf@y\pgf@yb% + }% + \pgfextract@process\northwest{% + \centerpoint% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y\pgf@ya% + \ifx\northwestcorner\pgfutil@empty% + \advance\pgf@x-\pgf@xb% + \advance\pgf@y\pgf@yb% + \fi% + }% + \pgfextract@process\beforesouthwest{% + \centerpoint% + \advance\pgf@x-\pgf@xa% + \advance\pgf@x-\pgf@xb% + \advance\pgf@y-\pgf@ya% + \advance\pgf@y\pgf@yc% + }% + \pgfextract@process\southwest{% + \centerpoint% + \advance\pgf@x-\pgf@xa% + \advance\pgf@y-\pgf@ya% + \ifx\southwestcorner\pgfutil@empty% + \advance\pgf@x-\pgf@xb% + \advance\pgf@y-\pgf@yb% + \fi% + }% + \pgfextract@process\aftersouthwest{% + \centerpoint% + \advance\pgf@x-\pgf@xa% + \advance\pgf@x\pgf@xc% + \advance\pgf@y-\pgf@ya% + \advance\pgf@y-\pgf@yb% + }% + \pgfextract@process\southeast{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y-\pgf@ya% + \ifx\southeastcorner\pgfutil@empty% + \advance\pgf@x\pgf@xb% + \advance\pgf@y-\pgf@yb% + \fi% + }% + % + % Calculate the `miter' vectors. + % + \pgfmathanglebetweenlines{\beforenortheast}{\afternortheast}{\beforenortheast}% + {\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}% + \pgfutil@tempdima\pgfmathresult pt\relax% + \ifdim\pgfutil@tempdima>180pt\relax% + \advance\pgfutil@tempdima-180pt\relax% + \fi% + \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer xsep}}% + \ifdim\pgfutil@tempdima<90pt\relax% + \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \pgfutil@tempdima0pt\relax% + \else% + \pgfutil@tempdima.5\pgfutil@tempdima% + \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \pgfutil@tempdima-\pgfutil@tempdima% + \advance\pgfutil@tempdima90pt\relax% + \fi% + \pgfextract@process\before@ne@anchor{% + \beforenortheast% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfutil@tempdima-\pgfutil@tempdima% + \advance\pgfutil@tempdima180pt\relax% + \pgfextract@process\before@sw@anchor{% + \beforesouthwest% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + \pgfmathanglebetweenlines{\afternortheast}{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}% + {\afternortheast}{\beforenortheast}% + \pgfutil@tempdima\pgfmathresult pt\relax% + \ifdim\pgfutil@tempdima>270pt\relax% + \advance\pgfutil@tempdima-270pt\relax% + \fi% + \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgfutil@tempdima<90pt\relax% + \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \pgfutil@tempdima90pt\relax% + \else% + \pgfutil@tempdima.5\pgfutil@tempdima% + \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}% + \pgfutil@tempdimb\pgfmathresult\pgfutil@tempdimb% + \fi% + % + \pgfextract@process\after@ne@anchor{% + \afternortheast% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfqpointpolar{\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfutil@tempdima-\pgfutil@tempdima% + \advance\pgfutil@tempdima180pt\relax% + \pgfextract@process\after@sw@anchor{% + \aftersouthwest + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfqpointpolar{-\pgfmath@tonumber{\pgfutil@tempdima}}{\the\pgfutil@tempdimb}% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \addtosavedmacro\before@ne@anchor% + \addtosavedmacro\after@ne@anchor% + \addtosavedmacro\before@sw@anchor% + \addtosavedmacro\after@sw@anchor% + \pgfextract@process\ne@anchor{% + \ifx\northeastcorner\pgfutil@empty% + \northeast% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \else% + \pgfpointlineattime{0.5}{\before@ne@anchor}{\after@ne@anchor}% + \fi% + }% + \pgfextract@process\nw@anchor{% + \ifx\northwestcorner\pgfutil@empty% + \northwest% + \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \else% + \pgfpointlineattime{0.5}{% + \before@ne@anchor% + \pgf@ya\pgf@y + \before@sw@anchor% + \pgf@y\pgf@ya% + }{% + \after@ne@anchor% + \pgf@ya\pgf@y + \after@sw@anchor% + \pgf@y\pgf@ya% + }% + \fi% + }% + \pgfextract@process\sw@anchor{% + \ifx\southwestcorner\pgfutil@empty% + \southwest% + \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% + \else% + \pgfpointlineattime{0.5}{\before@sw@anchor}{\after@sw@anchor}% + \fi% + }% + \pgfextract@process\se@anchor{% + \ifx\southeastcorner\pgfutil@empty% + \southeast% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% + \else% + \pgfpointlineattime{0.5}{% + \before@ne@anchor% + \pgf@xa\pgf@x + \before@sw@anchor% + \pgf@x\pgf@xa% + }{% + \after@ne@anchor% + \pgf@xa\pgf@x + \after@sw@anchor% + \pgf@x\pgf@xa% + }% + \fi% + }% + \addtosavedmacro\ne@anchor% + \addtosavedmacro\nw@anchor% + \addtosavedmacro\sw@anchor% + \addtosavedmacro\se@anchor% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5ex}% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \getchamferedrectanglepoints% + \midpoint% + \pgf@ya\pgf@y% + \pgf@process{% + \before@sw@anchor% + \pgf@ya\pgf@y% + \before@ne@anchor% + \pgf@y\pgf@ya% + }% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}% + \else% + \pgf@process{\before@ne@anchor}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor}% + \else% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor}% + {\after@ne@anchor}% + \fi% + \fi% + }% + \anchor{mid west}{% + \getchamferedrectanglepoints% + \midpoint% + \pgf@ya\pgf@y% + \pgf@process{\before@sw@anchor}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor}{\after@sw@anchor}% + \else% + \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor}% + \else% + \pgfpointintersectionoflines{\midpoint}{\midpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}% + \fi% + \fi% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \getchamferedrectanglepoints% + \basepoint% + \pgf@ya\pgf@y% + \pgf@process{% + \before@sw@anchor% + \pgf@ya\pgf@y% + \before@ne@anchor% + \pgf@y\pgf@ya% + }% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\after@sw@anchor\pgf@ya\pgf@y\after@ne@anchor\pgf@y\pgf@ya}% + \else% + \pgf@process{\before@ne@anchor}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor}% + \else% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor}% + {\after@ne@anchor}% + \fi% + \fi% + }% + \anchor{base west}{% + \getchamferedrectanglepoints% + \basepoint% + \pgf@ya\pgf@y% + \pgf@process{\before@sw@anchor}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor}{\after@sw@anchor}% + \else% + \pgf@process{\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + \ifdim\pgf@ya<\pgf@y% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@sw@anchor}% + \else% + \pgfpointintersectionoflines{\basepoint}{\basepoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\before@ne@anchor\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + {\after@ne@anchor\pgf@ya\pgf@y\after@sw@anchor\pgf@y\pgf@ya}% + \fi% + \fi% + }% + \anchor{before north east}{\getchamferedrectanglepoints\before@ne@anchor}% + \anchor{north east}{\getchamferedrectanglepoints\ne@anchor}% + \anchor{after north east}{\getchamferedrectanglepoints\after@ne@anchor}% + \anchor{north}{% + \getchamferedrectanglepoints% + \centerpoint% + \pgf@xa\pgf@x% + \after@ne@anchor% + \pgf@x\pgf@xa}% + \anchor{before north west}{% + \getchamferedrectanglepoints% + \after@sw@anchor% + \pgf@xa\pgf@x% + \after@ne@anchor% + \pgf@x\pgf@xa}% + \anchor{north west}{\getchamferedrectanglepoints\nw@anchor}% + \anchor{after north west}{% + \getchamferedrectanglepoints% + \before@sw@anchor% + \pgf@xa\pgf@x% + \before@ne@anchor% + \pgf@x\pgf@xa}% + \anchor{west}{% + \getchamferedrectanglepoints% + \centerpoint% + \pgf@ya\pgf@y% + \before@sw@anchor% + \pgf@y\pgf@ya}% + \anchor{before south west}{\getchamferedrectanglepoints\before@sw@anchor}% + \anchor{south west}{\getchamferedrectanglepoints\sw@anchor}% + \anchor{after south west}{\getchamferedrectanglepoints\after@sw@anchor}% + \anchor{south}{% + \getchamferedrectanglepoints% + \centerpoint% + \pgf@xa\pgf@x% + \after@sw@anchor% + \pgf@x\pgf@xa}% + \anchor{before south east}{% + \getchamferedrectanglepoints% + \after@sw@anchor% + \pgf@ya\pgf@y% + \after@ne@anchor% + \pgf@y\pgf@ya}% + \anchor{south east}{\getchamferedrectanglepoints\se@anchor}% + \anchor{after south east}{% + \getchamferedrectanglepoints% + \before@sw@anchor% + \pgf@ya\pgf@y% + \before@ne@anchor% + \pgf@y\pgf@ya}% + \anchor{east}{% + \getchamferedrectanglepoints% + \centerpoint% + \pgf@ya\pgf@y% + \before@ne@anchor% + \pgf@y\pgf@ya}% + \backgroundpath{% + \pgfpathmoveto{\beforenortheast}% + \pgfpathlineto{\northeast}% + \pgfpathlineto{\afternortheast}% + \pgfpathlineto{\aftersouthwest\pgf@xa\pgf@x\afternortheast\pgf@x\pgf@xa}% + \pgfpathlineto{\northwest}% + \pgfpathlineto{\beforesouthwest\pgf@xa\pgf@x\beforenortheast\pgf@x\pgf@xa}% + \pgfpathlineto{\beforesouthwest}% + \pgfpathlineto{\southwest}% + \pgfpathlineto{\aftersouthwest}% + \pgfpathlineto{\aftersouthwest\pgf@ya\pgf@y\afternortheast\pgf@y\pgf@ya}% + \pgfpathlineto{\southeast}% + \pgfpathlineto{\beforesouthwest\pgf@ya\pgf@y\beforenortheast\pgf@y\pgf@ya}% + \pgfpathclose% + }% + \anchorborder{% + \pgfextract@process\externalpoint{% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \getchamferedrectanglepoints% + \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@ya\pgf@y\before@sw@anchor\pgf@y\pgf@ya}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% west. + \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% north. + \pgfmathanglebetweenpoints{\centerpoint}{\ne@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% north east. + \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% before north east. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}{\before@ne@anchor}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\before@ne@anchor}{\ne@anchor}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% after north east. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\ne@anchor}{\after@ne@anchor}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\after@ne@anchor}{\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\nw@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% north west. + \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% before north west. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\centerpoint\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\after@sw@anchor\pgf@xa\pgf@x\after@ne@anchor\pgf@x\pgf@xa}% + {\nw@anchor}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% after north west. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\nw@anchor}{\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\before@sw@anchor\pgf@xa\pgf@x\before@ne@anchor\pgf@x\pgf@xa}% + {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}% + \fi% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% south. + \pgfmathanglebetweenpoints{\centerpoint}{\sw@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% south west. + \pgfmathanglebetweenpoints{\centerpoint}{\before@sw@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% before south west. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\before@sw@anchor\pgf@xa\pgf@x\centerpoint\pgf@x\pgf@xa}% + {\before@sw@anchor}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\before@sw@anchor}{\sw@anchor}% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% after south west. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\sw@anchor}{\after@sw@anchor}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\after@sw@anchor}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\se@anchor}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% south east. + \pgfmathanglebetweenpoints{\centerpoint}{\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% before south east. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% + {\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\after@ne@anchor\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}{\se@anchor} + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% after south east. + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\se@anchor}{\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}% + \else% + \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% + {\before@ne@anchor\pgf@xa\pgf@x\before@sw@anchor\pgf@x\pgf@xa}% + {\centerpoint\pgf@ya\pgf@y\before@ne@anchor\pgf@y\pgf@ya}% + \fi% + \fi% + \fi% + \fi% + }% +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex index 15d7baf090c..2866923c529 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex,v 1.2 2010/01/07 01:12:23 vibrovski Exp $ +\ProvidesFileRCS{pgflibraryshapes.multipart.code.tex} \newbox\pgfnodepartlowerbox @@ -21,11 +21,11 @@ % Parts: text, lower \pgfdeclareshape{circle split} -{ +{% % % Node parts % - \nodeparts{text,lower} + \nodeparts{text,lower}% % % Anchors @@ -46,44 +46,44 @@ \advance\pgf@y by-.5\pgflinewidth% \advance\pgf@y by-\dp\pgfnodeparttextbox% \advance\pgf@y by-.5\pgflinewidth% - } - + }% + \saveddimen\radius{% - % - % Caculate ``height radius'' + % + % Calculate ``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% + % + % 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'' - % + % + % Calculate ``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% @@ -105,73 +105,73 @@ \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}}% + % 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}}% + % + % Now, add larger of outer separations. + % + \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} + % + \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] + \inheritbackgroundpath[from=circle]% \beforebackgroundpath{ \pgfutil@tempdima=\radius% - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \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% + \advance\pgfutil@tempdima by-.5\pgflinewidth% \pgfsetshortenstart{0pt}% \pgfsetshortenend{0pt}% - \pgfsetarrows{-}% + \pgfsetarrows{-}% \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-1\pgfutil@tempdima}{0pt}}}% \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}% \pgfusepath{stroke}% - } -} + }% +}% % @@ -181,7 +181,7 @@ \pgfdeclareshape{circle solidus}{% % Node parts - \nodeparts{text,lower}% + \nodeparts{text,lower}% % Anchors % solidus slants at 45 degrees % text placement minimizes the required radius, @@ -297,23 +297,23 @@ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{0.437\pgfutil@tempdima}{0.437\pgfutil@tempdima}}}% \pgfusepath{stroke}% }% -} +}% \def\pgf@lib@sh@newbox{\csname newbox\endcsname}% Get round outer. \def\pgf@lib@sh@toalpha#1{% - \ifcase#1\relax% - \or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten% - \or eleven\or twelve\or thirteen\or fourteen\or fifteen% - \or sixteen\or seventeen\or eighteen\or nineteen\or twenty% - \else% - twenty% - \fi% -} + \ifcase#1\relax% + \or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten% + \or eleven\or twelve\or thirteen\or fourteen\or fifteen% + \or sixteen\or seventeen\or eighteen\or nineteen\or twenty% + \else% + twenty% + \fi% +}% -\def\pgf@lib@sh@getalpha#1#2{\expandafter\edef\expandafter#1\expandafter{\pgf@lib@sh@toalpha{#2}}} +\def\pgf@lib@sh@getalpha#1#2{\expandafter\edef\expandafter#1\expandafter{\pgf@lib@sh@toalpha{#2}}}% \newbox\pgfnodeparttwobox \newbox\pgfnodepartthreebox @@ -325,25 +325,25 @@ \let\pgfnodepartfourthbox=\pgfnodepartfourbox \def\pgf@lib@sh@allocateboxes#1{% - \c@pgf@counta=#1\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>4\relax% - \pgfutil@ifundefined{pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box}% - {% - \expandafter\pgf@lib@sh@newbox\csname pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box\endcsname% - }% - {}% - \advance\c@pgf@counta by-1\relax% - \repeatpgfmathloop% -} + \c@pgf@counta=#1\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>4\relax% + \pgfutil@ifundefined{pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box}% + {% + \expandafter\pgf@lib@sh@newbox\csname pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box\endcsname% + }% + {}% + \advance\c@pgf@counta by-1\relax% + \repeatpgfmathloop% +}% -\def\pgf@lib@sh@rs@lefttext{left} -\def\pgf@lib@sh@rs@righttext{right} -\def\pgf@lib@sh@rs@centertext{center} -\def\pgf@lib@sh@rs@bottomtext{bottom} -\def\pgf@lib@sh@rs@toptext{top} -\def\pgf@lib@sh@rs@basetext{base} -\def\pgf@lib@sh@rs@nonetext{none} +\def\pgf@lib@sh@rs@lefttext{left}% +\def\pgf@lib@sh@rs@righttext{right}% +\def\pgf@lib@sh@rs@centertext{center}% +\def\pgf@lib@sh@rs@bottomtext{bottom}% +\def\pgf@lib@sh@rs@toptext{top}% +\def\pgf@lib@sh@rs@basetext{base}% +\def\pgf@lib@sh@rs@nonetext{none}% \newif\ifpgfrectanglesplithorizontal @@ -353,900 +353,902 @@ \let\pgf@lib@sh@rs@every@emptypart=\pgfutil@empty \let\pgf@lib@sh@rs@every@part=\pgfutil@empty -\def\pgf@lib@sh@rs@list@fill{none} +\def\pgf@lib@sh@rs@list@fill{none}% \pgfkeys{/pgf/.cd, - rectangle split parts/.initial=4, - rectangle split part align/.initial=center, - rectangle split horizontal/.is if=pgfrectanglesplithorizontal, - rectangle split ignore empty parts/.is if=pgfrectanglesplitignoreemptyparts, - rectangle split empty part width/.code={% - \pgfmathsetlength\pgf@x{#1} - \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width\the\pgf@x height0ptdepth0pt\relax}% - \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% - \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% - \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% - },% - rectangle split empty part width=1ex, - rectangle split empty part height/.code={% - \pgfmathsetlength\pgf@x{#1} - \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight\the\pgf@x depth0pt\relax}% - \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% - \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% - \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% - },% - rectangle split empty part height=1ex, - rectangle split empty part depth/.code={% - \pgfmathsetlength\pgf@x{#1} - \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight0ptdepth\the\pgf@x\relax}% - \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% - \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% - \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% - },% - rectangle split empty part depth=0ex, - rectangle split every empty part/.store in=\pgf@lib@sh@rs@every@emptypart, - rectangle split part fill/.code=\def\pgf@lib@sh@rs@list@fill{#1}\pgfrectanglesplitusecustomfilltrue, - rectangle split uses custom fill/.is if=pgfrectanglesplitusecustomfill, - rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits, - rectangle split allocate boxes/.code=\pgf@lib@sh@allocateboxes{#1} -} + rectangle split parts/.initial=4, + rectangle split part align/.initial=center, + rectangle split horizontal/.is if=pgfrectanglesplithorizontal, + rectangle split ignore empty parts/.is if=pgfrectanglesplitignoreemptyparts, + rectangle split empty part width/.code={% + \pgfmathsetlength\pgf@x{#1} + \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width\the\pgf@x height0ptdepth0pt\relax}% + \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% + \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% + \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% + },% + rectangle split empty part width=1ex, + rectangle split empty part height/.code={% + \pgfmathsetlength\pgf@x{#1} + \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight\the\pgf@x depth0pt\relax}% + \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% + \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% + \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% + },% + rectangle split empty part height=1ex, + rectangle split empty part depth/.code={% + \pgfmathsetlength\pgf@x{#1} + \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight0ptdepth\the\pgf@x\relax}% + \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}% + \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{% + \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}% + },% + rectangle split empty part depth=0ex, + rectangle split every empty part/.store in=\pgf@lib@sh@rs@every@emptypart, + rectangle split part fill/.code=\def\pgf@lib@sh@rs@list@fill{#1}\pgfrectanglesplitusecustomfilltrue, + rectangle split uses custom fill/.is if=pgfrectanglesplitusecustomfill, + rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits, + rectangle split allocate boxes/.code=\pgf@lib@sh@allocateboxes{#1}, +}% \def\pgf@lib@sh@rs@process@list#1#2{% - \c@pgf@counta=1\relax% - \c@pgf@countb=#2\relax% - \edef\pgf@lib@sh@rs@temp{#1}% - \expandafter\pgf@lib@sh@rs@@process@list\pgf@lib@sh@rs@temp,\pgf@stop,} + \c@pgf@counta=1\relax% + \c@pgf@countb=#2\relax% + \edef\pgf@lib@sh@rs@temp{#1}% + \expandafter\pgf@lib@sh@rs@@process@list\pgf@lib@sh@rs@temp,\pgf@stop, +}% \def\pgf@lib@sh@rs@@process@list{% - \pgfutil@ifnextchar x{\pgf@lib@sh@rs@@@process@list}% - {\pgf@lib@sh@rs@@@process@list}} - + \pgfutil@ifnextchar x{\pgf@lib@sh@rs@@@process@list}% + {\pgf@lib@sh@rs@@@process@list} +}% + \def\pgf@lib@sh@rs@@@process@list#1,{% - \ifx#1\pgf@stop% - \let\pgf@next\pgf@lib@sh@rs@@@@process@list% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\c@pgf@counta}% - \def\pgf@lib@sh@rs@lastalign{#1}% - \pgfutil@namedef{pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item}{#1}% - \let\pgf@next\pgf@lib@sh@rs@@process@list% - \advance\c@pgf@counta by1\relax% - \fi% - \pgf@next} + \ifx#1\pgf@stop% + \let\pgf@next\pgf@lib@sh@rs@@@@process@list% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\c@pgf@counta}% + \def\pgf@lib@sh@rs@lastalign{#1}% + \pgfutil@namedef{pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item}{#1}% + \let\pgf@next\pgf@lib@sh@rs@@process@list% + \advance\c@pgf@counta by1\relax% + \fi% + \pgf@next}% \def\pgf@lib@sh@rs@@@@process@list{% - \pgfmathloop% - \ifnum\c@pgf@counta>\c@pgf@countb% - \else% - \expandafter\edef\csname pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item\endcsname% - {\pgf@lib@sh@rs@lastalign}% - \advance\c@pgf@counta by1\relax% - \repeatpgfmathloop% -} + \pgfmathloop% + \ifnum\c@pgf@counta>\c@pgf@countb% + \else% + \expandafter\edef\csname pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item\endcsname% + {\pgf@lib@sh@rs@lastalign}% + \advance\c@pgf@counta by1\relax% + \repeatpgfmathloop% +}% -\pgf@lib@sh@allocateboxes{20} +\pgf@lib@sh@allocateboxes{20}% \pgfdeclareshape{rectangle split}{% - \savedmacro\rectanglesplitparameters{% - \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/rectangle split parts}}% - \edef\parts{\the\c@pgf@counta}% - \addtosavedmacro\parts% - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \edef\innerxsep{\the\pgf@x}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \edef\innerysep{\the\pgf@y}% - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \edef\outerxsep{\the\pgf@x}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \edef\outerysep{\the\pgf@y}% - \addtosavedmacro\outerxsep% - \addtosavedmacro\outerysep% - % - \pgf@x=0pt\relax% Widest box. - \pgf@y=0pt\relax% Tallest box. - % - \pgfutil@tempdima=0pt\relax% Maximum box height. - \pgfutil@tempdimb=0pt\relax% Maximum box depth. - % - % Get the dimensions of the boxes... - % - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\let\expandafter\pgf@lib@sh@box\expandafter=% - \csname pgfnodepart\pgf@lib@sh@rs@number box\endcsname% - \pgf@xa=\wd\pgf@lib@sh@box% - \pgf@ya=\ht\pgf@lib@sh@box% - \pgf@yb=\dp\pgf@lib@sh@box% - % - % Test to see if the box is empty... - % - \expandafter\def\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname{\relax}% - \ifdim\pgf@xa=0pt\relax% - \ifdim\pgf@ya=0pt\relax% - \ifdim\pgf@yb=0pt\relax% - % - % ...It is. So... - % - \ifpgfrectanglesplitignoreemptyparts% - % - % ...flag this if we are ignoring parts... - % - \expandafter\let\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% - \else% - % - % ...otherwise insert the code for every empty part. - % - \setbox\pgf@lib@sh@box=\hbox{{\pgf@lib@sh@rs@every@emptypart}}% - \pgf@xa=\wd\pgf@lib@sh@box% - \pgf@ya=\ht\pgf@lib@sh@box% - \pgf@yb=\dp\pgf@lib@sh@box% - \fi% - \fi% - \fi% - \fi% - \expandafter\edef\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname{\the\pgf@xa}% - \expandafter\edef\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname{\the\pgf@ya}% - \expandafter\edef\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname{\the\pgf@yb}% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname% - % - % ...saving the widest box... - % - \ifdim\pgf@xa>\pgf@x% - \pgf@x=\pgf@xa% - \fi% - % - % ...the maximum height and depth... - % - \ifdim\pgf@ya>\pgfutil@tempdima% - \pgfutil@tempdima=\pgf@ya% - \fi% - \ifdim\pgf@yb>\pgfutil@tempdimb% - \pgfutil@tempdimb=\pgf@yb% - \fi% - % - % ...and the tallest box. - % - \pgf@yc=\pgfutil@tempdima% - \advance\pgf@yc by\pgfutil@tempdimb% - \ifdim\pgf@yc>\pgf@y% - \pgf@y=\pgf@yc% - \fi% - \repeatpgfmathloop% - % - \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}% - \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}% - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% - \advance\pgf@x by-\innerxsep\relax% - \advance\pgf@x by-\innerxsep\relax% - \pgf@xa=\pgf@x% - \advance\pgf@xa by-\pgf@lib@sh@rs@max@width\relax% - \ifdim\pgf@xa>0pt\relax% - \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}% - \fi% - % - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% - \advance\pgf@y by-\innerysep\relax% - \advance\pgf@y by-\innerysep\relax% - \pgf@ya=\pgf@y% - \advance\pgf@ya by-\pgf@lib@sh@rs@max@totalheight\relax% - \ifdim\pgf@ya>0pt\relax% - \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}% - \fi% - % - % Get the alignment of each node part box. - % - \pgf@lib@sh@rs@process@list{\pgfkeysvalueof{/pgf/rectangle split part align}}{\parts}% - % - % Are we splitting horizontally or vertically? - % - \ifpgfrectanglesplithorizontal% - % - % Calculate the origins of each node part box. - % - \pgf@x=0pt\relax% - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \ifpgfrectanglesplitignoreemptyparts% - \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=% - \pgf@lib@sh@rs@lastanchor% - \fi% - \fi% - % - % Adjust for alignment. - % - \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% - \pgf@lib@sh@rs@bottomtext% - \pgf@y=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% - \else% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% - \pgf@lib@sh@rs@toptext% - \pgf@y=-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@y by\pgf@lib@sh@rs@max@totalheight\relax% - \else% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% - \pgf@lib@sh@rs@basetext% - \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% - \advance\pgf@y by-\pgfutil@tempdima% - \advance\pgf@y by\pgfutil@tempdimb% - \divide\pgf@y by2\relax% - \else% - \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% - \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@y by\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% - \divide\pgf@y by2\relax% - \fi% - \fi% - \fi% - % - % Re-adjust as the first box is at the origin. - % - \ifnum\pgfmathcounter=1\relax% - \edef\pgf@lib@sh@rs@yoffset{\the\pgf@y}% - \pgf@y=0pt\relax% - \pgfextract@process\pgf@lib@sh@rs@anchor@one{}% - \addtosavedmacro\pgf@lib@sh@rs@anchor@one% - \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one% - \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% - \else - \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax% - \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax% - \advance\pgf@x by\innerxsep\relax% - \advance\pgf@x by\pgflinewidth% - \advance\pgf@x by\innerxsep\relax% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}% - \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \fi% - \fi% - \repeatpgfmathloop% - % - % Calculate some anchors. - % - \pgfextract@process\northeast{% - \pgf@lib@sh@rs@lastanchor% - \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax% - \advance\pgf@x by\innerxsep\relax% - \advance\pgf@x by\outerxsep\relax% - \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% - \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax% - \advance\pgf@y by\innerysep\relax% - \advance\pgf@y by\outerysep\relax% - }% - \addtosavedmacro\northeast% - \pgfextract@process\southwest{% - \pgf@lib@sh@rs@anchor@one% - \advance\pgf@x by-\innerxsep\relax% - \advance\pgf@x by-\outerxsep\relax% - \pgf@y=-\pgf@lib@sh@rs@yoffset\relax% - \advance\pgf@y by-\innerysep\relax% - \advance\pgf@y by-\outerysep\relax% - }% - \addtosavedmacro\southwest% - % - \pgfextract@process\centerpoint{% - \pgfpointadd{\southwest}{\northeast}% - \divide\pgf@x by2\relax% - \divide\pgf@y by2\relax% - }% - \addtosavedmacro\centerpoint% - % - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \else% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \pgf@xa=\pgf@x% - \pgf@xb=\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@xa by0.5\pgf@xb% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname{% - \southwest% - \pgf@x=\pgf@xa% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname{% - \northeast% - \pgf@x=\pgf@xa% - }% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname% - \ifnum\pgfmathcounter=\parts% - \else% - \advance\pgf@xa by0.5\pgf@xb% - \advance\pgf@xa by\innerxsep\relax% - \advance\pgf@xa by.5\pgflinewidth% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname{% - \southwest% - \pgf@x=\pgf@xa% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname{% - \northeast% - \pgf@x=\pgf@xa% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{% - \centerpoint% - \pgf@x=\pgf@xa% - }% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname% - \fi% - \fi% - \repeatpgfmathloop% - \else% - % - % Calculate the origins of each node part box. - % - \pgf@y=0pt\relax% - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \ifpgfrectanglesplitignoreemptyparts% - \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=% - \pgf@lib@sh@rs@lastanchor% - \fi% - \fi% - % - % Adjust for alignment. - % - \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% - \pgf@lib@sh@rs@lefttext% - \pgf@x=0pt\relax% - \else% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% - \pgf@lib@sh@rs@righttext% - \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax% - \else% - \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax% - \divide\pgf@x by2\relax% - \fi% - \fi% - % - % Re-adjust as the first box is at the origin. - % - \ifnum\pgfmathcounter=1\relax% - \edef\pgf@lib@sh@rs@xoffset{\the\pgf@x}% - \pgf@x=0pt\relax% - \pgfextract@process\pgf@lib@sh@rs@anchor@one{}% - \addtosavedmacro\pgf@lib@sh@rs@anchor@one% - \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one% - \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% - \else - \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax% - \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax% - \advance\pgf@y by-\innerysep\relax% - \advance\pgf@y by-\pgflinewidth% - \advance\pgf@y by-\innerysep\relax% - \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}% - \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \fi% - \fi% - \repeatpgfmathloop% - % - % Calculate some anchors. - % - \pgfextract@process\northeast{% - \pgf@x=\pgf@lib@sh@rs@max@width\relax% - \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax% - \advance\pgf@x by\innerxsep\relax% - \advance\pgf@x by\outerxsep\relax% - \pgf@y=\pgf@lib@sh@rs@height@one\relax% - \advance\pgf@y by\innerysep\relax% - \advance\pgf@y by\outerysep\relax% - \advance\pgf@y by.5\pgflinewidth% - }% - \addtosavedmacro\northeast% - \pgfextract@process\southwest{% - \pgf@lib@sh@rs@lastanchor% - \pgf@x=-\pgf@lib@sh@rs@xoffset\relax% - \advance\pgf@x by-\innerxsep\relax% - \advance\pgf@x by-\outerxsep\relax% - \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax% - \advance\pgf@y by-\innerysep\relax% - \advance\pgf@y by-\outerysep\relax% - \advance\pgf@y by-.5\pgflinewidth% - }% - \addtosavedmacro\southwest% - % - \pgfextract@process\centerpoint{% - \pgfpointadd{\southwest}{\northeast}% - \divide\pgf@x by2\relax% - \divide\pgf@y by2\relax% - }% - \addtosavedmacro\centerpoint% - % - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \else% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \pgf@ya=\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@y by0.5\pgf@ya% - \pgf@ya=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@y by-0.5\pgf@ya% - \pgf@ya=\pgf@y% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname{% - \southwest% - \pgf@y=\pgf@ya% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname{% - \northeast% - \pgf@y=\pgf@ya% - }% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname% - \ifnum\pgfmathcounter=\parts% - \else% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% - \pgf@ya=\pgf@y% - \advance\pgf@ya by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% - \advance\pgf@ya by-\innerysep\relax% - \advance\pgf@ya by-.5\pgflinewidth% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname{% - \southwest% - \pgf@y=\pgf@ya% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname{% - \northeast% - \pgf@y=\pgf@ya% - }% - \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{% - \centerpoint% - \pgf@y=\pgf@ya% - }% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname% - \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname% - \fi% - \fi% - \repeatpgfmathloop% - \fi% - }% - \savedanchor\basepoint{% - \pgf@x=0.5\wd\pgfnodeparttextbox% - \pgf@y=0pt\relax% - } - \savedanchor\midpoint{% - \pgf@x=0.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \anchor{center}{% - \rectanglesplitparameters% - \centerpoint% - }% - \anchor{base}{\basepoint} - \anchor{base east}{% - \rectanglesplitparameters% - \northeast% - \pgf@y=0pt\relax% - }% - \anchor{base west}{% - \rectanglesplitparameters% - \southwest% - \pgf@y=0pt\relax% - }% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \rectanglesplitparameters% - \northeast% - \pgf@xa=\pgf@x% - \midpoint% - \pgf@x=\pgf@xa% - }% - \anchor{mid west}{% - \rectanglesplitparameters% - \southwest% - \pgf@xa=\pgf@x% - \midpoint% - \pgf@x=\pgf@xa% - }% - \anchor{north}{% - \rectanglesplitparameters% - \centerpoint% - \pgf@xa=\pgf@x% - \northeast% - \pgf@x=\pgf@xa% - } - \anchor{south}{% - \rectanglesplitparameters% - \centerpoint% - \pgf@xa=\pgf@x% - \southwest% - \pgf@x=\pgf@xa% - } - \anchor{east}{% - \rectanglesplitparameters% - \centerpoint% - \pgf@ya=\pgf@y% - \northeast% - \pgf@y=\pgf@ya% - } - \anchor{west}{% - \rectanglesplitparameters% - \centerpoint% - \pgf@ya=\pgf@y% - \southwest% - \pgf@y=\pgf@ya% - } - \anchor{north east}{% - \rectanglesplitparameters% - \northeast% - } - \anchor{north west}{% - \rectanglesplitparameters% - \northeast% - \pgf@ya=\pgf@y% - \southwest% - \pgf@y=\pgf@ya% - } - \anchor{south west}{% - \rectanglesplitparameters% - \southwest% - } - \anchor{south east}{% - \rectanglesplitparameters% - \southwest% - \pgf@ya=\pgf@y% - \northeast% - \pgf@y=\pgf@ya% - } - \behindbackgroundpath{% - \ifpgfrectanglesplitusecustomfill% - \pgf@lib@sh@rs@process@list{\pgf@lib@sh@rs@list@fill}{\parts}% - {% - \ifpgfrectanglesplithorizontal% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% - \csname pgf@anchor@rectangle split@south west\endcsname% - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - \ifnum\pgfmathcounter=\parts% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% - \csname pgf@anchor@rectangle split@north east\endcsname% - \else% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% - \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split north\endcsname% - \fi% - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \else% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext% - \else% - \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% - \pgf@lib@sh@rs@fill@bottomleft% - \advance\pgf@y by\outerysep\relax% - \ifnum\pgfmathcounter=1\relax% - \advance\pgf@x by\outerxsep\relax% - \fi% - }% - \pgfextract@process\pgf@lib@sh@rs@fill@topright{% - \pgf@lib@sh@rs@fill@topright% - \advance\pgf@y by-\outerysep\relax% - \ifnum\pgfmathcounter=\parts\relax% - \advance\pgf@x by-\outerxsep\relax% - \fi% - }% - \ifnum\pgfmathcounter>1\relax% - \begingroup\pgfsetcornersarced{\pgfpointorigin}% - \fi% - \pgfpathmoveto{% - \pgf@lib@sh@rs@fill@topright% - \pgf@xa=\pgf@x% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@x=\pgf@xa% - }% - \pgfpathlineto{\pgf@lib@sh@rs@fill@bottomleft}% - \pgfpathlineto{% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@xa=\pgf@x% - \pgf@lib@sh@rs@fill@topright% - \pgf@x=\pgf@xa% - }% - \ifnum\pgfmathcounter>1\relax% - \endgroup% - \fi% - \ifnum\pgfmathcounter<\parts% - \begingroup\pgfsetcornersarced{\pgfpointorigin}% - \fi% - \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}% - \pgfpathclose% - \ifnum\pgfmathcounter<\parts% - \endgroup% - \fi% - \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% - \pgfusepath{fill}% - \fi% - \fi% - \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@ya=\pgf@y% - \pgf@lib@sh@rs@fill@topright% - \pgf@y=\pgf@ya% - \advance\pgf@y by-\outerysep% - }% - \repeatpgfmathloop% - \else% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% - \csname pgf@anchor@rectangle split@north east\endcsname% - \pgfmathloop% - \ifnum\pgfmathcounter>\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - \ifnum\pgfmathcounter=\parts% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% - \csname pgf@anchor@rectangle split@south west\endcsname% - \else% - \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% - \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split west\endcsname% - \fi% - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \else% - \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext% - \else% - \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% - \pgf@lib@sh@rs@fill@bottomleft% - \advance\pgf@x by\outerxsep\relax% - \ifnum\parts=1\relax% - \advance\pgf@y by\outerysep\relax% - \else% - \ifnum\pgfmathcounter=\parts - \advance\pgf@y by\outerysep\relax% - \fi% - \fi% - }% - \pgfextract@process\pgf@lib@sh@rs@fill@topright{% - \pgf@lib@sh@rs@fill@topright% - \advance\pgf@x by-\outerxsep\relax% - \ifnum\parts=1\relax% - \advance\pgf@y by-\outerysep\relax% - \else% - \ifnum\pgfmathcounter=1\relax% - \advance\pgf@y by-\outerysep\relax% - \fi% - \fi% - }% - \pgfpathmoveto{\pgf@lib@sh@rs@fill@bottomleft}% - \ifnum\pgfmathcounter>1\relax% - \begingroup\pgfsetcornersarced{\pgfpointorigin}% - \fi% - \pgfpathlineto{% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@xa=\pgf@x% - \pgf@lib@sh@rs@fill@topright% - \pgf@x=\pgf@xa% - }% - \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}% - \ifnum\pgfmathcounter>1\relax% - \endgroup%% - \fi% - \ifnum\pgfmathcounter<\parts% - \begingroup\pgfsetcornersarced{\pgfpointorigin}% - \fi% - \pgfpathlineto{% - \pgf@lib@sh@rs@fill@topright% - \pgf@xa=\pgf@x% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@x=\pgf@xa% - }% - \pgfpathclose% - \ifnum\pgfmathcounter<\parts% - \endgroup% - \fi% - \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% - \pgfusepath{fill}% - \fi% - \fi% - \pgfextract@process\pgf@lib@sh@rs@fill@topright{% - \pgf@lib@sh@rs@fill@topright% - \pgf@xa=\pgf@x% - \pgf@lib@sh@rs@fill@bottomleft% - \pgf@x=\pgf@xa% - \advance\pgf@x by\outerxsep\relax% - }% - \repeatpgfmathloop% - \fi% - }% - \fi% - }% - \backgroundpath{% - \begingroup% - \pgfextract@process\southwest{% - \southwest% - \advance\pgf@x by\outerxsep\relax% - \advance\pgf@y by\outerysep\relax% - }% - \pgfextract@process\northeast{% - \northeast% - \advance\pgf@x by-\outerxsep\relax% - \advance\pgf@y by-\outerysep\relax% - }% - \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}% - \endgroup% - \ifpgfrectanglesplitdrawsplits% - \pgfmathloop% - \ifnum\pgfmathcounter=\parts% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - % - \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% - \else% - \pgfpathmoveto{% - \ifpgfrectanglesplithorizontal% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname% - \advance\pgf@y by-\outerysep\relax% - \else% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname% - \advance\pgf@x by-\outerxsep\relax% - \fi% - }% - \pgfpathlineto{% - \ifpgfrectanglesplithorizontal% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname% - \advance\pgf@y by\outerysep\relax% - \else% - \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname% - \advance\pgf@x by\outerxsep\relax% - \fi% - }% - \fi% - \repeatpgfmathloop% - \fi% - }% - \anchorborder{% - \pgfutil@tempdima\pgf@x% - \pgfutil@tempdimb\pgf@y% - \rectanglesplitparameters% - \pgfpointdiff{\southwest}{\northeast}% - \pgf@x.5\pgf@x% - \pgf@y.5\pgf@y% - \edef\pgf@marshall{% - \noexpand\pgfpointborderrectangle{% - \noexpand\pgfqpoint{\the\pgfutil@tempdima}{\the\pgfutil@tempdimb}% - }% - {% - \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}% - }% + \savedmacro\rectanglesplitparameters{% + \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/rectangle split parts}}% + \edef\parts{\the\c@pgf@counta}% + \addtosavedmacro\parts% + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \edef\innerxsep{\the\pgf@x}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \edef\innerysep{\the\pgf@y}% + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \edef\outerxsep{\the\pgf@x}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \edef\outerysep{\the\pgf@y}% + \addtosavedmacro\outerxsep% + \addtosavedmacro\outerysep% + % + \pgf@x=0pt\relax% Widest box. + \pgf@y=0pt\relax% Tallest box. + % + \pgfutil@tempdima=0pt\relax% Maximum box height. + \pgfutil@tempdimb=0pt\relax% Maximum box depth. + % + % Get the dimensions of the boxes... + % + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\let\expandafter\pgf@lib@sh@box\expandafter=% + \csname pgfnodepart\pgf@lib@sh@rs@number box\endcsname% + \pgf@xa=\wd\pgf@lib@sh@box% + \pgf@ya=\ht\pgf@lib@sh@box% + \pgf@yb=\dp\pgf@lib@sh@box% + % + % Test to see if the box is empty... + % + \expandafter\def\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname{\relax}% + \ifdim\pgf@xa=0pt\relax% + \ifdim\pgf@ya=0pt\relax% + \ifdim\pgf@yb=0pt\relax% + % + % ...It is. So... + % + \ifpgfrectanglesplitignoreemptyparts% + % + % ...flag this if we are ignoring parts... + % + \expandafter\let\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% + \else% + % + % ...otherwise insert the code for every empty part. + % + \setbox\pgf@lib@sh@box=\hbox{{\pgf@lib@sh@rs@every@emptypart}}% + \pgf@xa=\wd\pgf@lib@sh@box% + \pgf@ya=\ht\pgf@lib@sh@box% + \pgf@yb=\dp\pgf@lib@sh@box% + \fi% + \fi% + \fi% + \fi% + \expandafter\edef\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname{\the\pgf@xa}% + \expandafter\edef\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname{\the\pgf@ya}% + \expandafter\edef\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname{\the\pgf@yb}% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname% + % + % ...saving the widest box... + % + \ifdim\pgf@xa>\pgf@x% + \pgf@x=\pgf@xa% + \fi% + % + % ...the maximum height and depth... + % + \ifdim\pgf@ya>\pgfutil@tempdima% + \pgfutil@tempdima=\pgf@ya% + \fi% + \ifdim\pgf@yb>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgf@yb% + \fi% + % + % ...and the tallest box. + % + \pgf@yc=\pgfutil@tempdima% + \advance\pgf@yc by\pgfutil@tempdimb% + \ifdim\pgf@yc>\pgf@y% + \pgf@y=\pgf@yc% + \fi% + \repeatpgfmathloop% + % + \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}% + \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}% + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% + \advance\pgf@x by-\innerxsep\relax% + \advance\pgf@x by-\innerxsep\relax% + \pgf@xa=\pgf@x% + \advance\pgf@xa by-\pgf@lib@sh@rs@max@width\relax% + \ifdim\pgf@xa>0pt\relax% + \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}% + \fi% + % + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% + \advance\pgf@y by-\innerysep\relax% + \advance\pgf@y by-\innerysep\relax% + \pgf@ya=\pgf@y% + \advance\pgf@ya by-\pgf@lib@sh@rs@max@totalheight\relax% + \ifdim\pgf@ya>0pt\relax% + \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}% + \fi% + % + % Get the alignment of each node part box. + % + \pgf@lib@sh@rs@process@list{\pgfkeysvalueof{/pgf/rectangle split part align}}{\parts}% + % + % Are we splitting horizontally or vertically? + % + \ifpgfrectanglesplithorizontal% + % + % Calculate the origins of each node part box. + % + \pgf@x=0pt\relax% + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \ifpgfrectanglesplitignoreemptyparts% + \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=% + \pgf@lib@sh@rs@lastanchor% + \fi% + \fi% + % + % Adjust for alignment. + % + \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% + \pgf@lib@sh@rs@bottomtext% + \pgf@y=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% + \else% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% + \pgf@lib@sh@rs@toptext% + \pgf@y=-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@y by\pgf@lib@sh@rs@max@totalheight\relax% + \else% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% + \pgf@lib@sh@rs@basetext% + \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% + \advance\pgf@y by-\pgfutil@tempdima% + \advance\pgf@y by\pgfutil@tempdimb% + \divide\pgf@y by2\relax% + \else% + \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% + \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@y by\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% + \divide\pgf@y by2\relax% + \fi% + \fi% + \fi% + % + % Re-adjust as the first box is at the origin. + % + \ifnum\pgfmathcounter=1\relax% + \edef\pgf@lib@sh@rs@yoffset{\the\pgf@y}% + \pgf@y=0pt\relax% + \pgfextract@process\pgf@lib@sh@rs@anchor@one{}% + \addtosavedmacro\pgf@lib@sh@rs@anchor@one% + \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one% + \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% + \else + \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax% + \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax% + \advance\pgf@x by\innerxsep\relax% + \advance\pgf@x by\pgflinewidth% + \advance\pgf@x by\innerxsep\relax% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}% + \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \fi% + \fi% + \repeatpgfmathloop% + % + % Calculate some anchors. + % + \pgfextract@process\northeast{% + \pgf@lib@sh@rs@lastanchor% + \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax% + \advance\pgf@x by\innerxsep\relax% + \advance\pgf@x by\outerxsep\relax% + \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax% + \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax% + \advance\pgf@y by\innerysep\relax% + \advance\pgf@y by\outerysep\relax% + }% + \addtosavedmacro\northeast% + \pgfextract@process\southwest{% + \pgf@lib@sh@rs@anchor@one% + \advance\pgf@x by-\innerxsep\relax% + \advance\pgf@x by-\outerxsep\relax% + \pgf@y=-\pgf@lib@sh@rs@yoffset\relax% + \advance\pgf@y by-\innerysep\relax% + \advance\pgf@y by-\outerysep\relax% + }% + \addtosavedmacro\southwest% + % + \pgfextract@process\centerpoint{% + \pgfpointadd{\southwest}{\northeast}% + \divide\pgf@x by2\relax% + \divide\pgf@y by2\relax% + }% + \addtosavedmacro\centerpoint% + % + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \else% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \pgf@xa=\pgf@x% + \pgf@xb=\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@xa by0.5\pgf@xb% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname{% + \southwest% + \pgf@x=\pgf@xa% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname{% + \northeast% + \pgf@x=\pgf@xa% + }% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname% + \ifnum\pgfmathcounter=\parts% + \else% + \advance\pgf@xa by0.5\pgf@xb% + \advance\pgf@xa by\innerxsep\relax% + \advance\pgf@xa by.5\pgflinewidth% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname{% + \southwest% + \pgf@x=\pgf@xa% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname{% + \northeast% + \pgf@x=\pgf@xa% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{% + \centerpoint% + \pgf@x=\pgf@xa% + }% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname% + \fi% + \fi% + \repeatpgfmathloop% + \else% + % + % Calculate the origins of each node part box. + % + \pgf@y=0pt\relax% + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty% + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \ifpgfrectanglesplitignoreemptyparts% + \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=% + \pgf@lib@sh@rs@lastanchor% + \fi% + \fi% + % + % Adjust for alignment. + % + \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% + \pgf@lib@sh@rs@lefttext% + \pgf@x=0pt\relax% + \else% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname% + \pgf@lib@sh@rs@righttext% + \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax% + \else% + \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax% + \divide\pgf@x by2\relax% + \fi% + \fi% + % + % Re-adjust as the first box is at the origin. + % + \ifnum\pgfmathcounter=1\relax% + \edef\pgf@lib@sh@rs@xoffset{\the\pgf@x}% + \pgf@x=0pt\relax% + \pgfextract@process\pgf@lib@sh@rs@anchor@one{}% + \addtosavedmacro\pgf@lib@sh@rs@anchor@one% + \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one% + \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% + \else + \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax% + \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax% + \advance\pgf@y by-\innerysep\relax% + \advance\pgf@y by-\pgflinewidth% + \advance\pgf@y by-\innerysep\relax% + \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}% + \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \fi% + \fi% + \repeatpgfmathloop% + % + % Calculate some anchors. + % + \pgfextract@process\northeast{% + \pgf@x=\pgf@lib@sh@rs@max@width\relax% + \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax% + \advance\pgf@x by\innerxsep\relax% + \advance\pgf@x by\outerxsep\relax% + \pgf@y=\pgf@lib@sh@rs@height@one\relax% + \advance\pgf@y by\innerysep\relax% + \advance\pgf@y by\outerysep\relax% + \advance\pgf@y by.5\pgflinewidth% + }% + \addtosavedmacro\northeast% + \pgfextract@process\southwest{% + \pgf@lib@sh@rs@lastanchor% + \pgf@x=-\pgf@lib@sh@rs@xoffset\relax% + \advance\pgf@x by-\innerxsep\relax% + \advance\pgf@x by-\outerxsep\relax% + \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax% + \advance\pgf@y by-\innerysep\relax% + \advance\pgf@y by-\outerysep\relax% + \advance\pgf@y by-.5\pgflinewidth% + }% + \addtosavedmacro\southwest% + % + \pgfextract@process\centerpoint{% + \pgfpointadd{\southwest}{\northeast}% + \divide\pgf@x by2\relax% + \divide\pgf@y by2\relax% + }% + \addtosavedmacro\centerpoint% + % + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \else% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \pgf@ya=\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@y by0.5\pgf@ya% + \pgf@ya=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@y by-0.5\pgf@ya% + \pgf@ya=\pgf@y% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname{% + \southwest% + \pgf@y=\pgf@ya% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname{% + \northeast% + \pgf@y=\pgf@ya% + }% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname% + \ifnum\pgfmathcounter=\parts% + \else% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname% + \pgf@ya=\pgf@y% + \advance\pgf@ya by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax% + \advance\pgf@ya by-\innerysep\relax% + \advance\pgf@ya by-.5\pgflinewidth% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname{% + \southwest% + \pgf@y=\pgf@ya% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname{% + \northeast% + \pgf@y=\pgf@ya% + }% + \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{% + \centerpoint% + \pgf@y=\pgf@ya% + }% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname% + \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname% + \fi% + \fi% + \repeatpgfmathloop% + \fi% + }% + \savedanchor\basepoint{% + \pgf@x=0.5\wd\pgfnodeparttextbox% + \pgf@y=0pt\relax% + }% + \savedanchor\midpoint{% + \pgf@x=0.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + }% + \anchor{center}{% + \rectanglesplitparameters% + \centerpoint% + }% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \rectanglesplitparameters% + \northeast% + \pgf@y=0pt\relax% + }% + \anchor{base west}{% + \rectanglesplitparameters% + \southwest% + \pgf@y=0pt\relax% + }% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \rectanglesplitparameters% + \northeast% + \pgf@xa=\pgf@x% + \midpoint% + \pgf@x=\pgf@xa% + }% + \anchor{mid west}{% + \rectanglesplitparameters% + \southwest% + \pgf@xa=\pgf@x% + \midpoint% + \pgf@x=\pgf@xa% + }% + \anchor{north}{% + \rectanglesplitparameters% + \centerpoint% + \pgf@xa=\pgf@x% + \northeast% + \pgf@x=\pgf@xa% + }% + \anchor{south}{% + \rectanglesplitparameters% + \centerpoint% + \pgf@xa=\pgf@x% + \southwest% + \pgf@x=\pgf@xa% + }% + \anchor{east}{% + \rectanglesplitparameters% + \centerpoint% + \pgf@ya=\pgf@y% + \northeast% + \pgf@y=\pgf@ya% + }% + \anchor{west}{% + \rectanglesplitparameters% + \centerpoint% + \pgf@ya=\pgf@y% + \southwest% + \pgf@y=\pgf@ya% + }% + \anchor{north east}{% + \rectanglesplitparameters% + \northeast% + }% + \anchor{north west}{% + \rectanglesplitparameters% + \northeast% + \pgf@ya=\pgf@y% + \southwest% + \pgf@y=\pgf@ya% + }% + \anchor{south west}{% + \rectanglesplitparameters% + \southwest% + }% + \anchor{south east}{% + \rectanglesplitparameters% + \southwest% + \pgf@ya=\pgf@y% + \northeast% + \pgf@y=\pgf@ya% + }% + \behindbackgroundpath{% + \ifpgfrectanglesplitusecustomfill% + \pgf@lib@sh@rs@process@list{\pgf@lib@sh@rs@list@fill}{\parts}% + {% + \ifpgfrectanglesplithorizontal% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% + \csname pgf@anchor@rectangle split@south west\endcsname% + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + \ifnum\pgfmathcounter=\parts% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% + \csname pgf@anchor@rectangle split@north east\endcsname% + \else% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% + \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split north\endcsname% + \fi% + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \else% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext% + \else% + \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% + \pgf@lib@sh@rs@fill@bottomleft% + \advance\pgf@y by\outerysep\relax% + \ifnum\pgfmathcounter=1\relax% + \advance\pgf@x by\outerxsep\relax% + \fi% + }% + \pgfextract@process\pgf@lib@sh@rs@fill@topright{% + \pgf@lib@sh@rs@fill@topright% + \advance\pgf@y by-\outerysep\relax% + \ifnum\pgfmathcounter=\parts\relax% + \advance\pgf@x by-\outerxsep\relax% + \fi% + }% + \ifnum\pgfmathcounter>1\relax% + \begingroup\pgfsetcornersarced{\pgfpointorigin}% + \fi% + \pgfpathmoveto{% + \pgf@lib@sh@rs@fill@topright% + \pgf@xa=\pgf@x% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@x=\pgf@xa% + }% + \pgfpathlineto{\pgf@lib@sh@rs@fill@bottomleft}% + \pgfpathlineto{% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@xa=\pgf@x% + \pgf@lib@sh@rs@fill@topright% + \pgf@x=\pgf@xa% + }% + \ifnum\pgfmathcounter>1\relax% + \endgroup% + \fi% + \ifnum\pgfmathcounter<\parts% + \begingroup\pgfsetcornersarced{\pgfpointorigin}% + \fi% + \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}% + \pgfpathclose% + \ifnum\pgfmathcounter<\parts% + \endgroup% + \fi% + \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% + \pgfusepath{fill}% + \fi% + \fi% + \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@ya=\pgf@y% + \pgf@lib@sh@rs@fill@topright% + \pgf@y=\pgf@ya% + \advance\pgf@y by-\outerysep% + }% + \repeatpgfmathloop% + \else% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=% + \csname pgf@anchor@rectangle split@north east\endcsname% + \pgfmathloop% + \ifnum\pgfmathcounter>\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + \ifnum\pgfmathcounter=\parts% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% + \csname pgf@anchor@rectangle split@south west\endcsname% + \else% + \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=% + \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split west\endcsname% + \fi% + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \else% + \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext% + \else% + \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{% + \pgf@lib@sh@rs@fill@bottomleft% + \advance\pgf@x by\outerxsep\relax% + \ifnum\parts=1\relax% + \advance\pgf@y by\outerysep\relax% + \else% + \ifnum\pgfmathcounter=\parts + \advance\pgf@y by\outerysep\relax% + \fi% + \fi% + }% + \pgfextract@process\pgf@lib@sh@rs@fill@topright{% + \pgf@lib@sh@rs@fill@topright% + \advance\pgf@x by-\outerxsep\relax% + \ifnum\parts=1\relax% + \advance\pgf@y by-\outerysep\relax% + \else% + \ifnum\pgfmathcounter=1\relax% + \advance\pgf@y by-\outerysep\relax% + \fi% + \fi% + }% + \pgfpathmoveto{\pgf@lib@sh@rs@fill@bottomleft}% + \ifnum\pgfmathcounter>1\relax% + \begingroup\pgfsetcornersarced{\pgfpointorigin}% + \fi% + \pgfpathlineto{% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@xa=\pgf@x% + \pgf@lib@sh@rs@fill@topright% + \pgf@x=\pgf@xa% + }% + \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}% + \ifnum\pgfmathcounter>1\relax% + \endgroup%% + \fi% + \ifnum\pgfmathcounter<\parts% + \begingroup\pgfsetcornersarced{\pgfpointorigin}% + \fi% + \pgfpathlineto{% + \pgf@lib@sh@rs@fill@topright% + \pgf@xa=\pgf@x% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@x=\pgf@xa% + }% + \pgfpathclose% + \ifnum\pgfmathcounter<\parts% + \endgroup% + \fi% + \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% + \pgfusepath{fill}% + \fi% + \fi% + \pgfextract@process\pgf@lib@sh@rs@fill@topright{% + \pgf@lib@sh@rs@fill@topright% + \pgf@xa=\pgf@x% + \pgf@lib@sh@rs@fill@bottomleft% + \pgf@x=\pgf@xa% + \advance\pgf@x by\outerxsep\relax% + }% + \repeatpgfmathloop% + \fi% + }% + \fi% + }% + \backgroundpath{% + \begingroup% + \pgfextract@process\southwest{% + \southwest% + \advance\pgf@x by\outerxsep\relax% + \advance\pgf@y by\outerysep\relax% + }% + \pgfextract@process\northeast{% + \northeast% + \advance\pgf@x by-\outerxsep\relax% + \advance\pgf@y by-\outerysep\relax% + }% + \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}% + \endgroup% + \ifpgfrectanglesplitdrawsplits% + \pgfmathloop% + \ifnum\pgfmathcounter=\parts% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + % + \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty% + \else% + \pgfpathmoveto{% + \ifpgfrectanglesplithorizontal% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname% + \advance\pgf@y by-\outerysep\relax% + \else% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname% + \advance\pgf@x by-\outerxsep\relax% + \fi% + }% + \pgfpathlineto{% + \ifpgfrectanglesplithorizontal% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname% + \advance\pgf@y by\outerysep\relax% + \else% + \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname% + \advance\pgf@x by\outerxsep\relax% + \fi% + }% + \fi% + \repeatpgfmathloop% + \fi% + }% + \anchorborder{% + \pgfutil@tempdima\pgf@x% + \pgfutil@tempdimb\pgf@y% + \rectanglesplitparameters% + \pgfpointdiff{\southwest}{\northeast}% + \pgf@x.5\pgf@x% + \pgf@y.5\pgf@y% + \edef\pgf@marshall{% + \noexpand\pgfpointborderrectangle{% + \noexpand\pgfqpoint{\the\pgfutil@tempdima}{\the\pgfutil@tempdimb}% + }% + {% + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}% + }% + }% + \pgf@marshall% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Hackery to install the correct number of node parts. + % + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@rectangle split\endcsname{% + \let\pgf@lib@sh@rs@temp=\pgfutil@empty% + \pgfmathloop% + \ifnum\pgfmathcounter=\parts% + \expandafter\edef\csname pgf@sh@boxes@rectangle split\endcsname% + {\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter}}% + \else% + \edef\pgf@lib@sh@rs@temp{\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter},}% + \repeatpgfmathloop% }% - \pgf@marshall% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Hackery to install the correct number of node parts. - % - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@rectangle split\endcsname{% - \let\pgf@lib@sh@rs@temp=\pgfutil@empty% - \pgfmathloop% - \ifnum\pgfmathcounter=\parts% - \expandafter\edef\csname pgf@sh@boxes@rectangle split\endcsname% - {\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter}}% - \else% - \edef\pgf@lib@sh@rs@temp{\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter},}% - \repeatpgfmathloop% - }% -} +}% \pgfutil@for\pgf@lib@sh@rs@temp:={one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty}\do{% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp}{\noexpand\pgf@lib@sh@rs@anchor@one}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split}% - {\noexpand\centerpoint}% - {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split north\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north}% - {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}% - {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split south\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south}% - {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space north\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north}% - {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space south\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south}% - {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split east\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east}% - {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}% - {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split west\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west}% - {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space east\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east}% - {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east\noexpand\endcsname}% - }% - \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space west\endcsname{% - \noexpand\rectanglesplitparameters% - \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west}% - {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}% - {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west\noexpand\endcsname}% - }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp}{\noexpand\pgf@lib@sh@rs@anchor@one}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split}% + {\noexpand\centerpoint}% + {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split north\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north}% + {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}% + {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split south\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south}% + {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space north\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north}% + {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space south\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south}% + {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split east\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east}% + {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}% + {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split west\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west}% + {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space east\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east}% + {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east\noexpand\endcsname}% + }% + \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space west\endcsname{% + \noexpand\rectanglesplitparameters% + \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west}% + {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}% + {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west\noexpand\endcsname}% + }% }% -\pgfutil@namelet{pgf@anchor@rectangle split@text east}{pgf@anchor@rectangle split@one east} -\pgfutil@namelet{pgf@anchor@rectangle split@text west}{pgf@anchor@rectangle split@one west} -\pgfutil@namelet{pgf@anchor@rectangle split@text split}{pgf@anchor@rectangle split@one split} -\pgfutil@namelet{pgf@anchor@rectangle split@text split east}{pgf@anchor@rectangle split@one split east} -\pgfutil@namelet{pgf@anchor@rectangle split@text split west}{pgf@anchor@rectangle split@one split west} +\pgfutil@namelet{pgf@anchor@rectangle split@text east}{pgf@anchor@rectangle split@one east}% +\pgfutil@namelet{pgf@anchor@rectangle split@text west}{pgf@anchor@rectangle split@one west}% +\pgfutil@namelet{pgf@anchor@rectangle split@text split}{pgf@anchor@rectangle split@one split}% +\pgfutil@namelet{pgf@anchor@rectangle split@text split east}{pgf@anchor@rectangle split@one split east}% +\pgfutil@namelet{pgf@anchor@rectangle split@text split west}{pgf@anchor@rectangle split@one split west}% -\pgfutil@namelet{pgf@anchor@rectangle split@second}{pgf@anchor@rectangle split@two} -\pgfutil@namelet{pgf@anchor@rectangle split@second east}{pgf@anchor@rectangle split@two east} -\pgfutil@namelet{pgf@anchor@rectangle split@second west}{pgf@anchor@rectangle split@two west} -\pgfutil@namelet{pgf@anchor@rectangle split@second split}{pgf@anchor@rectangle split@two split} -\pgfutil@namelet{pgf@anchor@rectangle split@second split east}{pgf@anchor@rectangle split@two split east} -\pgfutil@namelet{pgf@anchor@rectangle split@second split west}{pgf@anchor@rectangle split@two split west} +\pgfutil@namelet{pgf@anchor@rectangle split@second}{pgf@anchor@rectangle split@two}% +\pgfutil@namelet{pgf@anchor@rectangle split@second east}{pgf@anchor@rectangle split@two east}% +\pgfutil@namelet{pgf@anchor@rectangle split@second west}{pgf@anchor@rectangle split@two west}% +\pgfutil@namelet{pgf@anchor@rectangle split@second split}{pgf@anchor@rectangle split@two split}% +\pgfutil@namelet{pgf@anchor@rectangle split@second split east}{pgf@anchor@rectangle split@two split east}% +\pgfutil@namelet{pgf@anchor@rectangle split@second split west}{pgf@anchor@rectangle split@two split west}% -\pgfutil@namelet{pgf@anchor@rectangle split@third}{pgf@anchor@rectangle split@three} -\pgfutil@namelet{pgf@anchor@rectangle split@third east}{pgf@anchor@rectangle split@three east} -\pgfutil@namelet{pgf@anchor@rectangle split@third west}{pgf@anchor@rectangle split@three west} -\pgfutil@namelet{pgf@anchor@rectangle split@third split}{pgf@anchor@rectangle split@three split} -\pgfutil@namelet{pgf@anchor@rectangle split@third split east}{pgf@anchor@rectangle split@three split east} -\pgfutil@namelet{pgf@anchor@rectangle split@third split west}{pgf@anchor@rectangle split@three split west} +\pgfutil@namelet{pgf@anchor@rectangle split@third}{pgf@anchor@rectangle split@three}% +\pgfutil@namelet{pgf@anchor@rectangle split@third east}{pgf@anchor@rectangle split@three east}% +\pgfutil@namelet{pgf@anchor@rectangle split@third west}{pgf@anchor@rectangle split@three west}% +\pgfutil@namelet{pgf@anchor@rectangle split@third split}{pgf@anchor@rectangle split@three split}% +\pgfutil@namelet{pgf@anchor@rectangle split@third split east}{pgf@anchor@rectangle split@three split east}% +\pgfutil@namelet{pgf@anchor@rectangle split@third split west}{pgf@anchor@rectangle split@three split west}% -\pgfutil@namelet{pgf@anchor@rectangle split@fourth}{pgf@anchor@rectangle split@four} -\pgfutil@namelet{pgf@anchor@rectangle split@fourth east}{pgf@anchor@rectangle split@four east} -\pgfutil@namelet{pgf@anchor@rectangle split@fourth west}{pgf@anchor@rectangle split@four west} -\pgfutil@namelet{pgf@anchor@rectangle split@fourth split}{pgf@anchor@rectangle split@four split} -\pgfutil@namelet{pgf@anchor@rectangle split@fourth split east}{pgf@anchor@rectangle split@four split east} -\pgfutil@namelet{pgf@anchor@rectangle split@fourth split west}{pgf@anchor@rectangle split@four split west} +\pgfutil@namelet{pgf@anchor@rectangle split@fourth}{pgf@anchor@rectangle split@four}% +\pgfutil@namelet{pgf@anchor@rectangle split@fourth east}{pgf@anchor@rectangle split@four east}% +\pgfutil@namelet{pgf@anchor@rectangle split@fourth west}{pgf@anchor@rectangle split@four west}% +\pgfutil@namelet{pgf@anchor@rectangle split@fourth split}{pgf@anchor@rectangle split@four split}% +\pgfutil@namelet{pgf@anchor@rectangle split@fourth split east}{pgf@anchor@rectangle split@four split east}% +\pgfutil@namelet{pgf@anchor@rectangle split@fourth split west}{pgf@anchor@rectangle split@four split west}% @@ -1254,101 +1256,101 @@ % 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% - }% -} + \nodeparts{text,lower}% + \savedanchor\radii{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgf@y2.0\pgf@y% + \advance\pgf@y.5\pgflinewidth% + \pgf@xa.5\wd\pgfnodeparttextbox% + \pgf@xb.5\wd\pgfnodepartlowerbox% + \advance\pgf@xa\pgf@x% + \advance\pgf@xb\pgf@x% + \pgf@ya\ht\pgfnodeparttextbox% + \advance\pgf@ya\dp\pgfnodeparttextbox% + \pgf@yb\ht\pgfnodepartlowerbox% + \advance\pgf@yb\dp\pgfnodepartlowerbox% + \advance\pgf@ya\pgf@y% + \advance\pgf@yb\pgf@y% + \ifdim\pgf@xa>\pgf@xb% + \pgf@x1.414213\pgf@xa% + \else% + \pgf@x1.414213\pgf@xb% + \fi% + \ifdim\pgf@ya>\pgf@yb% + \pgf@y1.414213\pgf@ya% + \else% + \pgf@y1.414213\pgf@yb% + \fi% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xa% + \pgf@x.5\pgf@xa% + \fi% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + }% + \savedanchor\lower{% + \pgf@x-.5\wd\pgfnodepartlowerbox% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgf@y-2.0\pgf@y% + \advance\pgf@y-\pgflinewidth% + \advance\pgf@y-\dp\pgfnodeparttextbox% + \advance\pgf@y-\ht\pgfnodepartlowerbox% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y-\dp\pgfnodeparttextbox% + \advance\pgf@y-.5\pgflinewidth% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt\relax% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{.5ex}% + }% + \anchor{center}{\centerpoint}% + \anchor{lower}{\lower}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x\pgf@xa}% + \anchor{mid west}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x-\pgf@xa}% + \anchor{base}{\basepoint}% + \anchor{base east}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x\pgf@xa}% + \anchor{base west}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x-\pgf@xa}% + \anchor{north}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt}}% + \anchor{south}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt\pgf@y-\pgf@y}}% + \anchor{east}{\pgfpointadd{\centerpoint}{\radii\pgf@y0pt}}% + \anchor{west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-\pgf@x\pgf@y0pt}}% + \anchor{north west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y0.707106\pgf@y}}% + \anchor{south west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y-0.707106\pgf@y}}% + \anchor{north east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y0.707106\pgf@y}}% + \anchor{south east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y-0.707106\pgf@y}}% + \backgroundpath{% + \radii% + \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}% + \pgfutil@tempdima\pgf@x% + \pgfutil@tempdimb\pgf@y% + \pgfpathellipse{\centerpoint}{\pgfqpoint{\the\pgfutil@tempdima}{0pt}}{\pgfqpoint{0pt}{\the\pgfutil@tempdimb}}% + \pgfpathmoveto{\centerpoint\advance\pgf@x-\pgfutil@tempdima}% + \pgfpathlineto{\centerpoint\advance\pgf@x\pgfutil@tempdima}% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \radii% + \edef\pgf@marshal{% + \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}% + {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\centerpoint}% + }% + \pgf@marshal% + }% +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex index efa492cc024..a6e925346d6 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex @@ -7,35 +7,35 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex,v 1.6 2013/09/11 06:15:59 vibrovski Exp $ +\ProvidesFileRCS{pgflibraryshapes.symbols.code.tex} \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] +{% + \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}}% + \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% @@ -45,37 +45,37 @@ \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0.707107\pgfutil@tempdima}{0.707107\pgfutil@tempdima}}} \pgfsetarrowsstart{} \pgfsetarrowsend{} - } -} + }% +}% \pgfdeclareshape{correct 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] +{% + \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}}% + \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% @@ -85,8 +85,8 @@ \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{-0.707107\pgfutil@tempdima}{0.707107\pgfutil@tempdima}}} \pgfsetarrowsstart{} \pgfsetarrowsend{} - } -} + }% +}% @@ -107,31 +107,31 @@ \fi% \pgfkeyslet{/pgf/random starburst}{\pgfmathresult}% }% -} -\pgfkeys{/pgf/random starburst=100} +}% +\pgfkeys{/pgf/random starburst=100}% -\pgfkeys{/pgf/starburst point height/.value required} +\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 point height=.5cm}% -\pgfkeys{/pgf/starburst points/.value required} +\pgfkeys{/pgf/starburst points/.value required}% \pgfkeys{/pgf/starburst points/.code={% \pgfmathtruncatemacro\pgfmathresult{#1}% \pgfkeyslet{/pgf/starburst points}{\pgfmathresult}% - }% + }% }% -\pgfkeys{/pgf/starburst points=17} +\pgfkeys{/pgf/starburst points=17}% \pgfdeclareshape{starburst}{% \savedmacro\anglestep{% \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}% \let\anglestep\pgfmathresult% - } + }% \savedmacro\calculatestarburstpoints{% % % Get the angle step. @@ -162,11 +162,11 @@ \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}% + \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}% @@ -215,15 +215,15 @@ \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% + \pgf@xa\pgf@x% \pgfmathsetlength\pgf@xb{+\pgfkeysvalueof{/pgf/starburst point height}}% \advance\pgf@xa\pgf@xb% \pgfmathsetlength\pgf@xc{+\pgfkeysvalueof{/pgf/minimum width}}% @@ -231,14 +231,14 @@ \pgf@x.5\pgf@xc% \advance\pgf@x-\pgf@xb% \fi% - \pgf@ya\pgf@y% + \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% + \fi% \edef\xinnerradius{\the\pgf@x}% \edef\yinnerradius{\the\pgf@y}% \addtosavedmacro{\xinnerradius}% @@ -255,9 +255,9 @@ % % Set the seed for the random number generator. % - \pgfmathsetseed{\pgfkeysvalueof{/pgf/random starburst}}% + \pgfmathsetseed{\pgfkeysvalueof{/pgf/random starburst}}% % - % Now create the points on the shape and also + % Now create the points on the shape and also % the miter length and angle for each point. % \def\angle{90}% Start at the top. @@ -270,7 +270,7 @@ % 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}% @@ -280,8 +280,8 @@ % % Cycle the point definitions. % - \let\firstpoint\secondpoint% - \let\secondpoint\thirdpoint% + \let\firstpoint\secondpoint% + \let\secondpoint\thirdpoint% \ifnum\pgfmathcounter>\looppoints% \else% \ifnum\pgfmathcounter>\totalpoints% @@ -324,14 +324,14 @@ \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% + \fi% % % It is only possible to do the miter calculations if three points are defined. % @@ -376,12 +376,12 @@ \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. + % Rotate 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}% + \expandafter\addtosavedmacro\expandafter{\csname borderpoint@\the\c@pgf@countb @\endcsname}% % % Now create the anchors. % @@ -405,7 +405,7 @@ \fi% \fi% \pgfmathadd@{\angle}{\anglestep}% - \pgfmathmod@{\pgfmathresult}{360}% + \pgfmathmod@{\pgfmathresult}{360}% \let\angle\pgfmathresult% \advance\c@pgf@counta1\relax% \ifnum\c@pgf@counta>\totalpoints% @@ -416,7 +416,7 @@ \c@pgf@countb1\relax% \fi% \repeatpgfmathloop% - } + }% \savedanchor\centerpoint{% \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% @@ -430,42 +430,42 @@ \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% \pgf@y0pt\relax% }% - \anchor{center}{\centerpoint} - \anchor{base}{\basepoint} - \anchor{mid}{\midpoint} + \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{% + }% + \backgroundpath{% \calculatestarburstpoints% \pgfmathloop% \ifnum\pgfmathcounter>\totalpoints% @@ -479,8 +479,8 @@ %\pgfmathrotatepointaround{\csname point@\pgfmathcounter @\endcsname}{\centerpoint}{\rotate}}% \csname point@\pgfmathcounter @\endcsname} \repeatpgfmathloop% - \pgfpathclose% - } + \pgfpathclose% + }% \anchorborder{% % % Save x and y. @@ -488,7 +488,7 @@ \edef\externalx{\the\pgf@x}% \edef\externaly{\the\pgf@y}% % - % Adjust the location of the external + % Adjust the location of the external % point relative to \centerpoint. % \centerpoint% @@ -544,9 +544,9 @@ \c@pgf@counta\pgfmathcounter% \else% \ifdim\externalangle pt<\csname angletoborderpoint@\pgfmathcounter @\endcsname pt\relax% - \c@pgf@counta\pgfmathcounter% + \c@pgf@counta\pgfmathcounter% \fi% - \fi% + \fi% \repeatpgfmathloop% \edef\first{\the\c@pgf@counta}% \advance\c@pgf@counta-1\relax% @@ -561,7 +561,7 @@ \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% {\csname borderpoint@\first @\endcsname}{\csname borderpoint@\second @\endcsname}% }% -} +}% @@ -578,7 +578,7 @@ cloud puffs/.initial=10, cloud puff arc/.initial=150, cloud ignores aspect/.is if=pgfcloudignoresaspect, - cloud anchors use ellipse/.is if=pgfcloudanchorsuseellipse + cloud anchors use ellipse/.is if=pgfcloudanchorsuseellipse, }% @@ -586,12 +586,12 @@ % \pgfkeys{/pgf/.cd, aspect/.code={\pgfsetshapeaspect{#1}},% this for tikz... - shape aspect/.initial=1,% but this is consistent with other pgfset stuff. + 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}% @@ -601,11 +601,11 @@ \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}} -} + \edef\pgfshapeaspectinverse{\pgf@sys@tonumber{\pgfutil@tempdima}}% +}% + +\pgfsetshapeaspect{1}% -\pgfsetshapeaspect{1} -% % Shape cloud. % @@ -653,7 +653,7 @@ \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% @@ -667,7 +667,7 @@ % and the radius of that arc, is constant: % % g = .5 * sec((180-a)/2) - % + % \pgfmathsubtract{180}{\arc}% \pgfmathdivide@{\pgfmathresult}{2}% \let\tempangle\pgfmathresult% @@ -677,7 +677,7 @@ \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 + % 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) @@ -688,20 +688,20 @@ \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 + % Minimum size is applied to the circum-ellipse (i.e. the ellipse + % that passes through the extremities 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-ellipse (X and Y), + % is given by % - % X = 2(x*cos(p/2) + ky) + % X = 2(x*cos(p/2) + ky) % Y = 2(y*cos(p/2) + kx) - % + % % where: % k = sin(p/2)*((1-cos(a/2))/sin(a/2)) - % p = the angle between each puff (i.e. 360/<puffs>) + % p = the angle between each puff (i.e. 360/<puffs>) % a = the length of arc of the puff. - % + % \pgfmathdivide{\arc}{2}% \let\halfarcangle\pgfmathresult% \pgfmathcos@{\pgfmathresult}% @@ -747,10 +747,10 @@ \edef\youterradius{\the\pgf@ya}% \addtosavedmacro\youterradius% % - % Now recalculate `in-ellispe' radii: + % Now recalculate `in-ellipse' 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, + % 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% @@ -803,23 +803,23 @@ \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{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{base}{\basepoint}% \anchor{north}{% \getradii% \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{\youterradius}}% @@ -877,9 +877,9 @@ \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' + % 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, @@ -927,7 +927,7 @@ \pgfpointadd{\centerpoint}{% \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% }% - }% + }% \fi% % % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. @@ -944,7 +944,7 @@ \pgfmathcos@{\arcrotate}% \let\cosarcrotate\pgfmathresult% % - % Calculate the amount by which to scale the control + % 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% @@ -995,11 +995,11 @@ % % Get the second control point for the first arc (length a/2)... % - \pgfextract@process\controltwo{% + \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) + \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) % % ...scale, rotate and shift. % @@ -1032,7 +1032,7 @@ % % First control point for the second arc... % - \pgfextract@process\controlone{% + \pgfextract@process\controlone{% \pgf@x0.55228475pt\relax% \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) \pgf@y0.55228475pt\relax% @@ -1055,11 +1055,11 @@ % % Second control point for the second arc. % - \pgfextract@process\controltwo{% + \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) + \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) % % ...scale, rotate and shift. % @@ -1095,7 +1095,7 @@ % % Get the inner radii and trig. constants. % - \getradii% + \getradii% % % % @@ -1116,9 +1116,9 @@ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% \let\externalangle\pgfmathresult% % - % 1. Locate the correct puff: + % 1. Locate the correct puff: % - % Get end angle of the relavent puff arc. + % Get end angle of the relevant puff arc. % \pgfmathdivide@{\anglestep}{2}% \let\halfanglestep\pgfmathresult% @@ -1136,7 +1136,7 @@ \pgfmathadd@{\endangle}{\anglestep}% \let\endangle\pgfmathresult% % - % Calculate the `miter point'. This is the point between + % Calculate the `miter point'. This is the point between % each puff, and takes into account the outer sep. % \pgfextract@process\miterpoint{% @@ -1210,12 +1210,12 @@ \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. % @@ -1232,9 +1232,9 @@ \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. + % + % Essentially a binary search to find the angle on the circular + % arc, which provides the nearest estimate to the border point. % \let\s\halfcomplementarc% The start of the arc. \pgfmathadd@{\s}{\arc}% @@ -1247,7 +1247,7 @@ \pgfmathadd@{\e}{\s}% \pgfmathdivide@{\pgfmathresult}{2}% \let\p\pgfmathresult% The point halfway between \s and \e. - \ifdim\p pt=\s pt\relax% + \ifdim\p pt=\s pt\relax% \else% % % Get the point on the circular arc. @@ -1288,7 +1288,7 @@ \ifdim\pgfmathresult pt<\m pt\relax% \let\m\pgfmathresult% \let\n\p% - \fi% + \fi% \repeatpgfmathloop% % % Use the nearest estimate as the anchor angle. @@ -1304,8 +1304,8 @@ \fi% }% Again, Phew! % - % Now, a sneaky hack. This means an arbitrary `puff' anchors - % can be used for positiong the cloud shape. This is needed + % Now, a sneaky hack. This means an arbitrary `puff' anchors + % can be used for positioning the cloud shape. This is needed % if a cloud is positioned using the `puff <n+1>' anchor, where % n is the number of puffs of any previously drawn cloud. % @@ -1319,12 +1319,12 @@ }% }{\c@pgf@counta0\relax}% \advance\c@pgf@counta-1\relax% - \repeatpgfmathloop% + \repeatpgfmathloop% }% -} +}% % \pgf@sh@@cloudpuffanchor -% +% % Internal macro for calculating the anchors puff 1, puff 2, ... etc. % \def\pgf@sh@@cloudpuffanchor#1{% @@ -1352,7 +1352,7 @@ \pgfpointadd{\centerpoint}{% \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% }% - }% + }% % % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. % @@ -1365,11 +1365,11 @@ \pgfpointadd{\circlecenterpoint}{% \pgfqpointpolar{\anchorangle}{\outerarcradius}% }% -} +}% % \pgf@sh@cloudpuffparameters % -% Internal macro to calculate some common arc parameters which +% Internal macro to calculate some common arc parameters which % are required when calculating radii, drawing the background % path and calculating border anchors. % @@ -1411,7 +1411,7 @@ \pgfmathrotatepointaround{\circlecenterpoint}{\pgfpointorigin}{\arcslope}% }% }% -} +}% @@ -1427,7 +1427,7 @@ % \let\pgf@lib@sh@signal@direction=#2% \edef\pgf@lib@sh@temp{#1}% - \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop} + \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop}% \def\pgf@lib@sh@signal@@parsedirection#1\pgf@stop{% \pgfutil@in@{and}{#1}% @@ -1436,7 +1436,7 @@ \else% \pgf@lib@sh@signal@@@parsedirection#1 and #1\pgf@lib% \fi -} +}% \def\pgf@lib@sh@signal@@@parsedirection#1 and #2\pgf@lib{% \pgfutil@in@{nowhere}{#1}% \ifpgfutil@in@ @@ -1444,7 +1444,7 @@ \pgf@lib@sh@signal@@@@parsedirection{#1}% \pgf@lib@sh@signal@@@@parsedirection{#2}% \fi% -} +}% \def\pgf@lib@sh@signal@@@@parsedirection#1{% \pgfutil@in@{ #1 }{ east right }% \ifpgfutil@in@% @@ -1470,7 +1470,7 @@ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% \fi% -} +}% % Keys for signal shape: @@ -1478,8 +1478,8 @@ \pgfkeys{/pgf/.cd, signal pointer angle/.initial=90, signal to/.initial=east, - signal from/.initial=nowhere -} + signal from/.initial=nowhere, +}% \pgfdeclareshape{signal}{% \savedmacro\installsignalparameters{% @@ -1490,7 +1490,7 @@ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% % \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal from}}{\pgf@lib@sh@signal@from}% - \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}% + \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}% % % Define a centerpoint. % @@ -1531,7 +1531,7 @@ \fi% \pgf@yc=\pgf@y% % - % Calculate the miter due to the line width, at the pointer apex... + % Calculate the miter due to the line width, at the pointer apex... % \pgf@x=\cosechalfpointerangle\pgf@y% \edef\pointerapexmiter{\the\pgf@x}% @@ -1559,7 +1559,7 @@ \pgfmathsubtract@{90}{\halfpointerangle}% \pgfmathtan@{\pgfmathresult}% \pgf@xb=\pgfmathresult\pgf@ya% - % + % % ...and up. % \pgf@yb=\pgfmathresult\pgf@xa% @@ -1704,7 +1704,7 @@ \addtosavedmacro{\southeast}% \addtosavedmacro{\northwest}% % - % Calculate the `miter vectors' (i.e. +outer sep). + % Calculate the `miter vectors' (i.e. +outer sep). % \pgfextract@process\northmiter{% \pgf@x0pt% @@ -1749,7 +1749,7 @@ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% \pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}% \fi% - \fi% + \fi% \fi% \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% \pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}% @@ -1757,7 +1757,7 @@ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to% \pgfqpointpolar{\quarterpointerangle}{\tocornermiter}% \fi% - \fi% + \fi% }% \pgfextract@process\southeastmiter{% \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% @@ -1770,7 +1770,7 @@ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% \pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}% \fi% - \fi% + \fi% \fi% \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% \pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter} @@ -1778,7 +1778,7 @@ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% \pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}% \fi% - \fi% + \fi% }% \pgfextract@process\southwestmiter{% \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% @@ -1793,7 +1793,7 @@ \pgfmathadd@{\complementquarterpointerangle}{180}% \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% \fi% - \fi% + \fi% \fi% \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% \pgfmathadd@{\complementquarterpointerangle}{180}% @@ -1803,7 +1803,7 @@ \pgfmathadd@{\quarterpointerangle}{180}% \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% \fi% - \fi% + \fi% }% \pgfextract@process\northwestmiter{% \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% @@ -1818,7 +1818,7 @@ \pgfmathsubtract@{180}{\complementquarterpointerangle}% \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% \fi% - \fi% + \fi% \fi% \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% \pgfmathsubtract@{180}{\complementquarterpointerangle}% @@ -1828,7 +1828,7 @@ \pgfmathsubtract@{180}{\quarterpointerangle}% \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% \fi% - \fi% + \fi% }% \addtosavedmacro{\northmiter}% \addtosavedmacro{\southmiter}% @@ -1872,7 +1872,7 @@ \addtosavedmacro{\anchornortheast}% \addtosavedmacro{\anchorsouthwest}% \addtosavedmacro{\anchorsoutheast}% - \addtosavedmacro{\anchornorthwest}% + \addtosavedmacro{\anchornorthwest}% }% \savedanchor\centerpoint{% \pgf@x.5\wd\pgfnodeparttextbox% @@ -1912,7 +1912,7 @@ \let\secondpoint\anchornortheast% \fi% \pgfpointintersectionoflines{\basepoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% + {\firstpoint}{\secondpoint}% }% \anchor{base west}{% \installsignalparameters% @@ -1937,7 +1937,7 @@ \let\secondpoint\anchornorthwest% \fi% \pgfpointintersectionoflines{\basepoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% + {\firstpoint}{\secondpoint}% }% \anchor{mid}{\midpoint}% \anchor{mid east}{% @@ -1963,7 +1963,7 @@ \let\secondpoint\anchornortheast% \fi% \pgfpointintersectionoflines{\midpoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% + {\firstpoint}{\secondpoint}% }% \anchor{mid west}{% \installsignalparameters% @@ -1988,7 +1988,7 @@ \let\secondpoint\anchornorthwest% \fi% \pgfpointintersectionoflines{\midpoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% + {\firstpoint}{\secondpoint}% }% \anchor{north}{\installsignalparameters\anchornorth}% \anchor{south}{\installsignalparameters\anchorsouth}% @@ -2009,7 +2009,7 @@ \pgfpathlineto{\west}% \pgfpathlineto{\northwest}% \pgfpathclose% - } + }% \anchorborder{% % % Save x and y. @@ -2017,7 +2017,7 @@ \edef\externalx{\the\pgf@x}% \edef\externaly{\the\pgf@y}% % - % Adjust the location of the external + % Adjust the location of the external % point relative to \centerpoint. % \centerpoint% @@ -2105,14 +2105,14 @@ 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 -} + 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} +\def\pgf@lib@sh@inandouttext{in and out}% +\def\pgf@lib@sh@outandintext{out and in}% +\def\pgf@lib@sh@nonetext{none}% -\pgfdeclareshape{tape}{ +\pgfdeclareshape{tape}{% \savedmacro\tapedimensions{% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% \advance\pgf@x.5\wd\pgfnodeparttextbox% @@ -2159,7 +2159,7 @@ \ifx\bottombendstyle\pgf@lib@sh@nonetext% \else% \advance\pgf@y-\pgfutil@tempdima% - \fi% + \fi% % \pgfutil@tempdima3.414213\pgfutil@tempdima% 1 / (1-sin(45)) \edef\bendyradius{\the\pgfutil@tempdima}% @@ -2172,7 +2172,7 @@ \edef\innerbendyradius{\the\pgfutil@tempdima}% \addtosavedmacro\innerbendyradius% % - \pgfutil@tempdima0.707106\pgf@x% cos(45) + \pgfutil@tempdima0.707106\pgf@x% cos(45) \edef\bendxradius{\the\pgfutil@tempdima}% \addtosavedmacro\bendxradius% \advance\pgfutil@tempdima\outerxsep% @@ -2213,20 +2213,20 @@ \let\cothalfangleout\pgfmathresult% \addtosavedmacro\cothalfangleout% % - } + }% \savedanchor{\centerpoint}{% \pgf@x.5\wd\pgfnodeparttextbox% \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\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}% @@ -2236,30 +2236,30 @@ \anchor{base west}{\tapedimensions\basepoint\advance\pgf@x-\outerhalfwidth}% \anchor{north}{% \csname pgf@anchor@tape@north east\endcsname% - \pgf@ya\pgf@y% + \pgf@ya\pgf@y% \csname pgf@anchor@tape@north west\endcsname% - \advance\pgf@ya\pgf@y% + \advance\pgf@ya\pgf@y% \centerpoint% \pgf@y.5\pgf@ya% - } + }% \anchor{south}{% \csname pgf@anchor@tape@south east\endcsname% - \pgf@ya\pgf@y% + \pgf@ya\pgf@y% \csname pgf@anchor@tape@south west\endcsname% - \advance\pgf@ya\pgf@y% + \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% @@ -2268,15 +2268,15 @@ \pgf@yc\outerysep% \ifx\topbendstyle\pgf@lib@sh@inandouttext% \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfangleout\pgf@yc% + \advance\pgf@y\cothalfangleout\pgf@yc% \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% + \ifx\topbendstyle\pgf@lib@sh@outandintext% \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfanglein\pgf@yc% + \advance\pgf@y\cothalfanglein\pgf@yc% \else% \advance\pgf@y\pgf@yc% \fi% - \fi% + \fi% }% \anchor{north west}{% \tapedimensions% @@ -2286,15 +2286,15 @@ \pgf@yc\outerysep% \ifx\topbendstyle\pgf@lib@sh@inandouttext% \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfanglein\pgf@yc% + \advance\pgf@y\cothalfanglein\pgf@yc% \else% \ifx\topbendstyle\pgf@lib@sh@outandintext% \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfangleout\pgf@yc% + \advance\pgf@y\cothalfangleout\pgf@yc% \else% \advance\pgf@y\pgf@yc% \fi% - \fi% + \fi% }% \anchor{south east}{% \tapedimensions% @@ -2304,15 +2304,15 @@ \pgf@yc\outerysep% \ifx\topbendstyle\pgf@lib@sh@outandintext% \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfangleout\pgf@yc% + \advance\pgf@y-\cothalfangleout\pgf@yc% \else% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfanglein\pgf@yc% + \advance\pgf@y-\cothalfanglein\pgf@yc% \else% \advance\pgf@y-\pgf@yc% \fi% - \fi% + \fi% }% \anchor{south west}{% \tapedimensions% @@ -2322,24 +2322,24 @@ \pgf@yc\outerysep% \ifx\topbendstyle\pgf@lib@sh@outandintext% \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfanglein\pgf@yc% + \advance\pgf@y-\cothalfanglein\pgf@yc% \else% \ifx\topbendstyle\pgf@lib@sh@inandouttext% \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfangleout\pgf@yc% + \advance\pgf@y-\cothalfangleout\pgf@yc% \else% \advance\pgf@y-\pgf@yc% \fi% - \fi% + \fi% }% \backgroundpath{% \tapedimensions% % \pgf@xc\halfwidth% - \pgf@yc\halfheight% + \pgf@yc\halfheight% % \pgf@xc\bendxradius% - \pgf@yc\bendyradius% + \pgf@yc\bendyradius% {% \pgftransformshift{\centerpoint}% \pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}% @@ -2372,8 +2372,8 @@ \fi% \fi% \pgfpathclose% - }% - } + }% + }% \anchorborder{% \pgf@xa\pgf@x% \pgf@ya\pgf@y% @@ -2554,7 +2554,7 @@ \fi% \fi% }% -} +}% @@ -2568,36 +2568,36 @@ \pgfkeys{/pgf/.cd, magnifying glass handle angle/.initial=-45, - magnifying glass handle aspect/.initial=1.5 -} + magnifying glass handle aspect/.initial=1.5, +}% \pgfdeclareshape{magnifying glass} -{ - \inheritsavedanchors[from=circle] % this is nearly a circle - \inheritanchorborder[from=circle] - \inheritanchor[from=circle]{north} - \inheritanchor[from=circle]{north west} - \inheritanchor[from=circle]{north east} - \inheritanchor[from=circle]{center} - \inheritanchor[from=circle]{west} - \inheritanchor[from=circle]{east} - \inheritanchor[from=circle]{mid} - \inheritanchor[from=circle]{mid west} - \inheritanchor[from=circle]{mid east} - \inheritanchor[from=circle]{base} - \inheritanchor[from=circle]{base west} - \inheritanchor[from=circle]{base east} - \inheritanchor[from=circle]{south} - \inheritanchor[from=circle]{south west} - \inheritanchor[from=circle]{south east} - \inheritbackgroundpath[from=circle] +{% + \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}}% + \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% @@ -2609,16 +2609,16 @@ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima+\pgfutil@tempdima*(\pgfkeysvalueof{/pgf/magnifying glass handle aspect})}}} \pgfsetarrowsstart{} \pgfsetarrowsend{} - } -} + }% +}% \pgfkeys{% /pgf/magnetic tape tail/.initial=0.15, /pgf/magnetic tape tail extend/.initial=0cm, -} -\pgfdeclareshape{magnetic tape}{ - \nodeparts{text} +}% +\pgfdeclareshape{magnetic tape}{% + \nodeparts{text}% \savedmacro\installparameters{% % \pgf@x=0.5\wd\pgfnodeparttextbox% @@ -2651,8 +2651,8 @@ \pgfmathparse{max(\pgfkeysvalueof{/pgf/magnetic tape tail extend},0)}% \edef\tailextend{\pgfmathresult pt}% % - \pgfmathparse{min(max(\pgfkeysvalueof{/pgf/magnetic tape tail},0),1)}% - \pgf@xa=\pgfmathresult\pgf@x% + \pgfmathparse{min(max(\pgfkeysvalueof{/pgf/magnetic tape tail},0),1)}% + \pgf@xa=\pgfmathresult\pgf@x% \edef\tailheight{\the\pgf@xa}% % \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% @@ -2689,38 +2689,38 @@ \addtosavedmacro\tailtopangle% \addtosavedmacro\tailbottomangle% \addtosavedmacro\centerpoint% - } - \savedanchor{\base}{\pgfqpoint{0.5\wd\pgfnodeparttextbox}{0pt}} - \savedanchor{\mid}{\pgfqpoint{0.5\wd\pgfnodeparttextbox}{0pt}\pgfmathsetlength\pgf@y{.5ex}} + }% + \savedanchor{\base}{\pgfqpoint{0.5\wd\pgfnodeparttextbox}{0pt}}% + \savedanchor{\mid}{\pgfqpoint{0.5\wd\pgfnodeparttextbox}{0pt}\pgfmathsetlength\pgf@y{.5ex}}% \anchor{center}{\installparameters\centerpoint}% \addtosavedmacro\outerradius% - \anchor{base}{\base} - \anchor{mid}{\mid} - \anchor{base west}{\installparameters\pgfpointadd{\base}{\pgfqpoint{-\outerradius}{0pt}}} - \anchor{base east}{\installparameters\pgfpointadd{\base}{\pgfqpoint{\outerradius}{0pt}}} - \anchor{mid west}{\installparameters\pgfpointadd{\mid}{\pgfqpoint{-\outerradius}{0pt}}} - \anchor{mid east}{\installparameters\pgfpointadd{\mid}{\pgfqpoint{\outerradius}{0pt}}} + \anchor{base}{\base}% + \anchor{mid}{\mid}% + \anchor{base west}{\installparameters\pgfpointadd{\base}{\pgfqpoint{-\outerradius}{0pt}}}% + \anchor{base east}{\installparameters\pgfpointadd{\base}{\pgfqpoint{\outerradius}{0pt}}}% + \anchor{mid west}{\installparameters\pgfpointadd{\mid}{\pgfqpoint{-\outerradius}{0pt}}}% + \anchor{mid east}{\installparameters\pgfpointadd{\mid}{\pgfqpoint{\outerradius}{0pt}}}% \anchor{north}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\outerradius}}}% \anchor{north east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpointpolar{45}{\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpointpolar{45}{\outerradius}}}% \anchor{south}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\outerradius}}}% \anchor{south east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{-\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{-\outerradius}}}% \anchor{east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{0pt}}} + \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{0pt}}}% \anchor{south west}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpointpolar{225}{\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpointpolar{225}{\outerradius}}}% \anchor{west}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpoint{-\outerradius}{0pt}}} + \pgfpointadd{\centerpoint}{\pgfqpoint{-\outerradius}{0pt}}}% \anchor{north west}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfqpointpolar{135}{\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfqpointpolar{135}{\outerradius}}}% \anchor{tail east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight/2}}} + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight/2}}}% \anchor{tail south east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius}}} + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius}}}% \anchor{tail north east}{\installparameters% - \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight+\outersep}}} + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight+\outersep}}}% \backgroundpath{ % \installparameters% @@ -2733,7 +2733,7 @@ \pgfpathlineto{\pgfpoint{\radius+\tailextend}{-\radius+\tailheight}}% \pgfpathclose% }% - } + }% \anchorborder{% \pgfextract@process\externalpoint{}% \installparameters% @@ -2742,34 +2742,34 @@ \pgfpointadd{\centerpoint}{% \pgfpointborderellipse% {\externalpoint}% - {\pgfqpoint{\outerradius}{\outerradius}}% + {\pgfqpoint{\outerradius}{\outerradius}}% }% \else% \ifdim\pgfmathresult pt<\tailbottomangle pt\relax% \pgfpointadd{\centerpoint}{% \pgfpointintersectionoflines% {\externalpoint}{\pgfpointorigin}% - {\pgfqpoint{0pt}{-\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% + {\pgfqpoint{0pt}{-\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% }% \else% \ifdim\pgfmathresult pt<\tailtopangle pt\relax% \pgfpointadd{\centerpoint}{% \pgfpointintersectionoflines% {\externalpoint}{\pgfpointorigin}% - {\pgfqpoint{\outerradius}{\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% + {\pgfqpoint{\outerradius}{\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% }% \else% \pgfpointadd{\centerpoint}{% \pgfpointborderellipse% {\externalpoint}% - {\pgfqpoint{\outerradius}{\outerradius}}% + {\pgfqpoint{\outerradius}{\outerradius}}% }% \fi% \fi% \fi% - } -} + }% +}% % Local Variables: % tab-width: 2 -% End:
\ No newline at end of file +% End: |