diff options
author | Karl Berry <karl@freefriends.org> | 2014-02-27 00:01:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-02-27 00:01:50 +0000 |
commit | 90ae413a94da014dbf7a6a8ab584f7c668483a5a (patch) | |
tree | 4e0528a2b2fb2004988e7fc804ea2f1354f1f5d5 /Master/texmf-dist/tex/generic/pgf/libraries | |
parent | 800cc56380d1edfe567a6a66bef13e8950eb2b0c (diff) |
pgf 3.0.0
git-svn-id: svn://tug.org/texlive/trunk@33057 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries')
26 files changed, 7237 insertions, 3202 deletions
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 a5af1c95e17..ae62fd31839 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,7 +7,7 @@ % % 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.3 2008/12/09 00:12:10 tantau Exp $ +\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 $ \usepgfmodule{datavisualization} @@ -131,12 +131,17 @@ \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 :#2interval#3[#4:#5]{% +\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}{#4}{#5}% + \pgf@lib@dv@samplesorsteps{#1}{#3}{#4}% }{% \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{% - \pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#4}{#5}{\pgfkeysvalueof{/pgf/data/samples}}}% + \pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#3}{#4}{\pgfkeysvalueof{/pgf/data/samples}}}% \expandafter\pgf@lib@dv@func@parse\pgfutil@gobble% } } @@ -188,6 +193,13 @@ }% } +\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}% 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 f39adbbedaa..36e51541cee 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,7 +7,7 @@ % % 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.2 2008/11/24 18:31:22 tantau Exp $ +\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 $ \usepgfmodule{datavisualization} @@ -90,6 +90,10 @@ \fi \ifx\pgf@dv@radius\pgfutil@empty\else% \ifx\pgf@dv@radius\relax\else% + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@angle}% + \pgfdvmathexitbyscientificformat{\pgf@dv@angle}{\pgf@dv@val}% + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@radius}% + \pgfdvmathexitbyscientificformat{\pgf@dv@radius}{\pgf@dv@val}% \pgfmathsincos{\pgf@dv@angle}% \pgfmathmultiply{\pgfmathresultx}{\pgf@dv@radius}% \let\pgf@dv@polar@temp=\pgfmathresult @@ -126,15 +130,23 @@ \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}}\pgf@dv@current@rad \ifx\pgf@dv@current@rad\relax \else - \ifdim\pgf@dv@current@rad pt=\pgf@dv@prev@rad pt% + \ifx\pgf@dv@current@rad\pgf@dv@prev@rad% \pgfooget{prev angle}\pgf@dv@prev@angle \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@dv@current@angle \ifx\pgf@dv@current@angle\relax \else - \ifdim\pgf@dv@current@angle pt=\pgf@dv@prev@angle pt% + \ifx\pgf@dv@current@angle\pgf@dv@prev@angle% % do nothing \else% % Do arc: + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@prev@angle}% + \pgfdvmathexitbyscientificformat{\pgf@dv@prev@angle}{\pgf@dv@val}% + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@prev@rad}% + \pgfdvmathexitbyscientificformat{\pgf@dv@prev@rad}{\pgf@dv@val}% + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@current@angle}% + \pgfdvmathexitbyscientificformat{\pgf@dv@current@angle}{\pgf@dv@val}% + \pgfdvmathenter{\pgf@dv@val}{\pgf@dv@current@rad}% + \pgfdvmathexitbyscientificformat{\pgf@dv@current@rad}{\pgf@dv@val}% \pgfpatharcaxes{\pgf@dv@prev@angle}{\pgf@dv@current@angle} {\pgfpointscale{\pgf@dv@current@rad}{\pgfoovalueof{unit vector 0 degrees}}} {\pgfpointscale{\pgf@dv@current@rad}{\pgfoovalueof{unit vector 90 degrees}}}% @@ -157,32 +169,28 @@ % \method direction(#1) {% \ifx#1\pgfdvdirectionfromtoken - % Record angle and radius + % Record from angle and radius \xdef\pgf@dv@polar@from@angle{\pgfkeysvalueof{/data point/\pgfoovalueof{angle}}} \xdef\pgf@dv@polar@from@radius{\pgfkeysvalueof{/data point/\pgfoovalueof{radius}}} + \else\ifx#1\pgfdvdirectiontotoken% + % Record to angle and radius + \xdef\pgf@dv@polar@to@angle{\pgfkeysvalueof{/data point/\pgfoovalueof{angle}}} + \xdef\pgf@dv@polar@to@radius{\pgfkeysvalueof{/data point/\pgfoovalueof{radius}}} \else% - \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}}\pgf@dv@polar@to@radius - \ifx\pgf@dv@polar@to@radius\relax - \else - \ifdim\pgf@dv@polar@to@radius pt=\pgf@dv@polar@from@radius pt% - \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@dv@polar@to@angle - \ifx\pgf@dv@polar@to@angle\relax - \else - \ifdim\pgf@dv@polar@to@angle pt=\pgf@dv@polar@from@angle pt% - % do nothing - \else% - % Output vector that it orthogonal to start angle: - \ifdim\pgf@dv@polar@to@angle pt>\pgf@dv@polar@from@angle pt% - \pgf@process{\pgfpointpolar{\pgf@dv@polar@from@angle+90}{1pt}} - \else - \pgf@process{\pgfpointpolar{\pgf@dv@polar@from@angle-90}{1pt}} - \fi - \pgfdvhandledtrue - \fi% - \fi% + \ifx\pgf@dv@polar@from@radius\pgf@dv@polar@to@radius% + \pgfdvmathenter{\pgf@dv@a}{\pgf@dv@polar@from@angle}% + \pgfdvmathenter{\pgf@dv@b}{\pgf@dv@polar@to@angle}% + \pgfdvmathifless{\pgf@dv@a}{\pgf@dv@b}{\def\pgf@dv@temp@sign{+}}{\def\pgf@dv@temp@sign{-}}% + \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@temp% + \ifx\pgf@temp\relax% + \else% + \pgfdvmathenter{\pgf@dv@val}{\pgf@temp}% + \pgfdvmathexitbyscientificformat{\pgf@dv@polar@angle}{\pgf@dv@val}% + \pgf@process{\pgfpointpolar{\pgf@dv@polar@angle\pgf@dv@temp@sign90}{1pt}}% + \pgfdvhandledtrue% \fi% \fi% - \fi% + \fi\fi% } } 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 dcb98da9119..546301c4d07 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 @@ -14,7 +14,7 @@ % scopes, essentially) at certain positions of a path. \pgfkeys{ - /pgf/decoration/reset marks/.code=\let\pgf@lib@dec@mark@marks=\pgfutil@empty, + /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, } @@ -33,17 +33,8 @@ } \def\pgf@lib@dec@arrowhead#1#2{% - \expandafter\ifx\csname tikz@special@arrow@end#2\endcsname\relax% be nice to TikZ - \pgfsetarrowsend{#2} - \else% - \pgfsetarrowsend{\csname tikz@special@arrow@end#2\endcsname}% - \fi% - \pgf@x=0pt% - \pgf@shorten@end% - \pgftransformxshift{-\pgf@x} \pgftransformxscale{#1} - \pgflowlevelsynccm% - \pgflowlevelobj{}{\pgf@endarrow}% + \pgfarrowdraw{#2}% } \def\pgf@lib@dec@doarrowhead#1{% 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 6e1b25101bd..8cf75a739bd 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 @@ -163,9 +163,9 @@ % Check the shape exists. % \pgfutil@ifundefined{pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}}{% - \PackageError{PGF}{I do not know the shape `\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 - simply mistyped the name}{}}{}% + simply mistyped the name}}{}% % % Calculate a `default' path size. % 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 new file mode 100644 index 00000000000..b06695a87fa --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex @@ -0,0 +1,499 @@ +% Copyright 2011 by Christophe Jorssen and Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% $Id: pgflibraryluamath.code.tex,v 1.11 2012/03/06 16:06:09 cjorssen Exp $ +% +% !!! Warning: this library does not work with fpu!!! + +% ******************************************************************* +% Some luatex stuff. Should be put elsewhere (e.g. in +% pgfutil-luatex-engine). + +% We assume luatex version > 0.39: +% - \directlua <general text> will work +% - \directlua is the only luatex primitive that we can assume +% accessible without being prefixed by the format via +% tex.enableprimitives. +% Ideas taken from the ifluatex package (Heiko Oberdiek) +\let\pgfutil@ifluatex\iffalse +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax +\else + \expandafter\let\csname pgfutil@ifluatex\expandafter\endcsname + \csname iftrue\endcsname +\fi + +\pgfutil@ifluatex + \let\pgfutil@directlua\directlua + \pgfutil@directlua{% + tex.enableprimitives('pgfutil@',{'luaescapestring'})} +\else + \def\pgfutil@directlua#1{} + \def\pgfutil@luaescapestring#1{} +\fi + +% End of luatex stuff +% ******************************************************************* + +% Loading part: based on fpu library + +\newif\ifpgfluamathcomputationactive +\newif\ifpgfluamathparseractive + +\def\pgfluamath@makecomputationactive{% + \ifpgfluamathcomputationactive + \else + \pgfluamath@checkuninstallcmd% + \pgfluamath@install% + \pgfluamathcomputationactivetrue + \fi} + +\def\pgfluamath@makecomputationinactive{% + \ifpgfluamathcomputationactive + \pgfluamath@uninstall% + \pgfluamathcomputationactivefalse + \fi} + +\def\pgfluamath@makeparseractive{% + \ifpgfluamathparseractive + \else + \let\pgfluamath@pgfmathparse\pgfmathparse + \let\pgfmathparse\pgfluamathparse + \pgfluamathparseractivetrue + \fi} + +\def\pgfluamath@makeparserinactive{% + \ifpgfluamathparseractive + \let\pgfmathparse\pgfluamath@pgfmathparse + \pgfluamathparseractivefalse + \fi} + +\pgfqkeys{/pgf}{% + % Enable lua-side computation of \pgfmathresult + % (will be deactivated after the current TeX group) + luamath/.is choice, + luamath/only computation/.code={% + \pgfutil@ifluatex + \pgfluamath@makecomputationactive + \pgfluamath@makeparserinactive + \else + \pgfmath@error{Sorry, you need the luaTeX engine to use the + luamath library}% + \fi}, + luamath/parser and computation/.code={% + \pgfutil@ifluatex + \pgfluamath@makecomputationactive + \pgfluamath@makeparseractive + \else + \pgfmath@error{Sorry, you need the luaTeX engine to use the + luamath library}% + \fi}, + luamath/off/.code={% + \pgfluamath@makecomputationinactive + \pgfluamath@makeparserinactive}, + luamath/.default=only computation} + +\def\pgfluamath@uninstall@appendcmd#1{% + \expandafter\gdef\expandafter\pgfluamath@uninstall\expandafter{% + \pgfluamath@uninstall #1}} + +% If the uninstall command is already assembled, it will skip the +% uninstall assemblation. +\def\pgfluamath@checkuninstallcmd{% + \pgfutil@ifundefined{pgfluamath@uninstall}{% + \pgfutil@directlua{% + pgfluamathfunctions = require("pgfluamath.functions") + pgfluamathparser = require("pgfluamath.parser")} + \global\let\pgfluamath@uninstall=\pgfutil@empty + }{% + % We already HAVE an uninstall command (prepared globally). + % So: don't waste time assembling one! + \def\pgfluamath@uninstall@appendcmd##1{}% + \def\pgfluamath@prepareuninstallcmd##1{}% + }% +} + +% This assembles an uninstall command globally ON FIRST USAGE. +% See \pgfmathfloat@plots@checkuninstallcmd +\def\pgfluamath@prepareuninstallcmd#1{% + \expandafter\global\expandafter\let + \csname pgfluamath@backup@\string#1\endcsname=#1% + \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@% + \pgfluamath@install@function\pgfmathdivide@=\pgfluamathdivide@% + % \pgfluamath@install@function\pgfmathdiv@=\pgfluamathdiv@% + \pgfluamath@install@function\pgfmathfactorial@=\pgfluamathfactorial@% + \pgfluamath@install@function\pgfmathsqrt@=\pgfluamathsqrt@% + % \pgfluamath@install@function\pgfmathpow@=\pgfluamathpow@% + \pgfluamath@install@function\pgfmathe@=\pgfluamathe@% + \pgfluamath@install@function\pgfmathexp@=\pgfluamathexp@% + \pgfluamath@install@function\pgfmathln@=\pgfluamathln@% + \pgfluamath@install@function\pgfmathlogten@=\pgfluamathlogten@% + % \pgfluamath@install@function\pgfmathlogtwo@=\pgfluamathlogtwo@% + \pgfluamath@install@function\pgfmathabs@=\pgfluamathabs@% + \pgfluamath@install@function\pgfmathmod@=\pgfluamathmod@% + \pgfluamath@install@function\pgfmathMod@=\pgfluamathMod@% + \pgfluamath@install@function\pgfmathround@=\pgfluamathround@% + \pgfluamath@install@function\pgfmathfloor@=\pgfluamathfloor@% + \pgfluamath@install@function\pgfmathceil@=\pgfluamathceil@% + % \pgfluamath@install@function\pgfmathint@=\pgfluamathint@% + % \pgfluamath@install@function\pgfmathfrac@=\pgfluamathfrac@% + % \pgfluamath@install@function\pgfmathreal@=\pgfluamathreal@% + \pgfluamath@install@function\pgfmathgcd@=\pgfluamathgcd@% + \pgfluamath@install@function\pgfmathisprime@=\pgfluamathisprime@% + \pgfluamath@install@function\pgfmathpi@=\pgfluamathpi@% + \pgfluamath@install@function\pgfmathrad@=\pgfluamathrad@% + \pgfluamath@install@function\pgfmathdeg@=\pgfluamathdeg@% + \pgfluamath@install@function\pgfmathsin@=\pgfluamathsin@% + \pgfluamath@install@function\pgfmathcos@=\pgfluamathcos@% + \pgfluamath@install@function\pgfmathtan@=\pgfluamathtan@% + \pgfluamath@install@function\pgfmathsec@=\pgfluamathsec@% + \pgfluamath@install@function\pgfmathcosec@=\pgfluamathcosec@% + \pgfluamath@install@function\pgfmathcot@=\pgfluamathcot@% + \pgfluamath@install@function\pgfmathasin@=\pgfluamathasin@% + \pgfluamath@install@function\pgfmathacos@=\pgfluamathacos@% + \pgfluamath@install@function\pgfmathatan@=\pgfluamathatan@% + \pgfluamath@install@function\pgfmathatantwo@=\pgfluamathatantwo@% + \pgfluamath@install@function\pgfmathmax@=\pgfluamathmax@% + \pgfluamath@install@function\pgfmathmin@=\pgfluamathmin@% + % \pgfluamath@install@function\pgfmath@pi=\pgfluamathpi@% + % \pgfluamath@install@function\pgfmathpi=\pgfluamathpi@% + % \pgfluamath@install@function\pgfmathe@=\pgfluamathe@% + % \pgfluamath@install@function\pgfmathe=\pgfluamathe@% + % \pgfluamath@install@function\pgfmathlessthan@=\pgfluamathlessthan@% + % \pgfluamath@install@function\pgfmathless@=\pgfluamathlessthan@% + % \pgfluamath@install@function\pgfmathgreaterthan@=\pgfluamathgreaterthan@% + % \pgfluamath@install@function\pgfmathgreater@=\pgfluamathgreaterthan@% + % \pgfluamath@install@function\pgfmathpow@=\pgfluamathpow@ + \pgfluamath@install@function\pgfmathrand@=\pgfluamathrand@ + \pgfluamath@install@function\pgfmathrand=\pgfluamathrand@ + \pgfluamath@install@function\pgfmathrnd@=\pgfluamathrnd@ + \pgfluamath@install@function\pgfmathrnd=\pgfluamathrnd@ + % \pgfluamath@install@function\pgfmathtrue@=\pgfluamathtrue@ + % \pgfluamath@install@function\pgfmathfalse@=\pgfluamathfalse@ + % \pgfluamath@install@function\pgfmathnot@=\pgfluamathnot@ + % \pgfluamath@install@function\pgfmathhex@=\pgfluamathhex@ + % \pgfluamath@install@function\pgfmathHex@=\pgfluamathHex@ + % \pgfluamath@install@function\pgfmathoct@=\pgfluamathoct@ + % \pgfluamath@install@function\pgfmathbin@=\pgfluamathbin@ + % \pgfluamath@install@function\pgfmathand@=\pgfluamathand@ + % \pgfluamath@install@function\pgfmathor@=\pgfluamathor@ + % \pgfluamath@install@function\pgfmathfactorial@=\pgfluamathfactorial@ + % \pgfluamath@install@function\pgfmathveclen@=\pgfluamathveclen@ + % \pgfluamath@install@function\pgfmathcosh@=\pgfluamathcosh@ + % \pgfluamath@install@function\pgfmathsinh@=\pgfluamathsinh@ + % \pgfluamath@install@function\pgfmathtanh@=\pgfluamathtanh@ + % \pgfluamath@install@function@unimplemented{ceil}% + % \pgfluamath@install@function@unimplemented{frac}% + % \pgfluamath@install@function@unimplemented{log2}% + % \pgfluamath@install@function@unimplemented{log10}% + % \pgfluamath@install@function@unimplemented{equalto}% + % \pgfluamath@install@function@unimplemented{random}% + % \pgfluamath@install@function@unimplemented{setseed}% + % \pgfluamath@install@function@unimplemented{Mod}% + % \pgfluamath@install@function@unimplemented{real}% + % \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)}}} + +\def\pgfluamathpi@{% + \pgfluamathgetresult{pgfluamathfunctions.pi()}} +\def\pgfluamathe@{% + \pgfluamathgetresult{pgfluamathfunctions.e()}} +\def\pgfluamathadd@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.add(#1,#2)}} +\def\pgfluamathsubtract@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.substract(#1,#2)}} +\def\pgfluamathneg@#1{% + \pgfluamathgetresult{pgfluamathfunctions.neg(#1)}} +\def\pgfluamathmultiply@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.multiply(#1,#2)}} +\def\pgfluamathdivide@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.divide(#1,#2)}} +\def\pgfluamathabs@#1{% + \pgfluamathgetresult{pgfluamathfunctions.abs(#1)}} +\def\pgfluamathround@#1{% + \pgfluamathgetresult{pgfluamathfunctions.round(#1)}} +\def\pgfluamathfloor@#1{% + \pgfluamathgetresult{pgfluamathfunctions.floor(#1)}} +\def\pgfluamathceil@#1{% + \pgfluamathgetresult{pgfluamathfunctions.ceil(#1)}} +\def\pgfluamathgcd@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.gcd(#1,#2)}} +\def\pgfluamathisprime@#1{% + \pgfluamathgetresult{pgfluamathfunctions.isprime(#1)}} +\def\pgfluamathmax@#1{% + \pgfluamathgetresult{% + math.max(pgfluamathfunctions.split_braces_to_explist("#1"))}} +\def\pgfluamathmin@#1{% + \pgfluamathgetresult{% + math.min(pgfluamathfunctions.split_braces_to_explist("#1"))}} +\def\pgfluamathsin@#1{% + \pgfluamathgetresult{pgfluamathfunctions.Sin(#1)}} +\def\pgfluamathcos@#1{% + \pgfluamathgetresult{pgfluamathfunctions.Cos(#1)}} +\def\pgfluamathtan@#1{% + \pgfluamathgetresult{pgfluamathfunctions.Tan(#1)}} +\def\pgfluamathmod@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.mod(#1,#2)}} +\def\pgfluamathMod@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.Mod(#1,#2)}} +\def\pgfluamathrad@#1{% + \pgfluamathgetresult{pgfluamathfunctions.rad(#1)}} +\def\pgfluamathdeg@#1{% + \pgfluamathgetresult{pgfluamathfunctions.deg(#1)}} +\def\pgfluamathatan@#1{% + \pgfluamathgetresult{pgfluamathfunctions.aTan(#1)}} +\def\pgfluamathatantwo@#1#2{% + \pgfluamathgetresult{pgfluamathfunctions.aTan2(#1,#2)}} +\def\pgfluamathasin@#1{% + \pgfluamathgetresult{pgfluamathfunctions.aSin(#1)}} +\def\pgfluamathacos@#1{% + \pgfluamathgetresult{pgfluamathfunctions.aCos(#1)}} +\def\pgfluamathcot@#1{% + \pgfluamathgetresult{1/pgfluamathfunctions.Tan(#1)}} +\def\pgfluamathsec@#1{% + \pgfluamathgetresult{1/pgfluamathfunctions.Cos(#1)}} +\def\pgfluamathcosec@#1{% + \pgfluamathgetresult{1/pgfluamathfunctions.Sin(#1)}} +\def\pgfluamathexp@#1{% + \pgfluamathgetresult{pgfluamathfunctions.exp(#1)}} +\def\pgfluamathln@#1{% + \pgfluamathgetresult{pgfluamathfunctions.log(#1)}} +\def\pgfluamathlogten@#1{% + \pgfluamathgetresult{pgfluamathfunctions.log10(#1)}} +\def\pgfluamathsqrt@#1{% + \pgfluamathgetresult{pgfluamathfunctions.sqrt(#1)}} +\def\pgfluamathrnd@{% + \pgfluamathgetresult{pgfluamathfunctions.rnd()}} +\def\pgfluamathrand@{% + \pgfluamathgetresult{pgfluamathfunctions.rand(-1,1)}} +\def\pgfluamathfactorial@#1{% + \pgfluamathgetresult{pgfluamathfunctions.factorial(#1)}} +\def\pgfluamathreciprocal#1{% + \pgfluamathgetresult{1/#1}} +% \pgfluamath@install@function\pgfmath@pi=\pgfluamathpi@% +% \pgfluamath@install@function\pgfmathpi=\pgfluamathpi@% +% \pgfluamath@install@function\pgfmathe@=\pgfluamathe@% +% \pgfluamath@install@function\pgfmathe=\pgfluamathe@% +% \pgfluamath@install@function\pgfmathlessthan@=\pgfluamathlessthan@% +% \pgfluamath@install@function\pgfmathless@=\pgfluamathlessthan@% +% \pgfluamath@install@function\pgfmathgreaterthan@=\pgfluamathgreaterthan@% +% \pgfluamath@install@function\pgfmathgreater@=\pgfluamathgreaterthan@% +% \pgfluamath@install@function\pgfmathpow@=\pgfluamathpow@ +% \pgfluamath@install@function\pgfmathrand@=\pgfluamathrand@ +% \pgfluamath@install@function\pgfmathrand=\pgfluamathrand@ +% \pgfluamath@install@function\pgfmathrnd@=\pgfluamathrnd@ +% \pgfluamath@install@function\pgfmathrnd=\pgfluamathrnd@ +% \pgfluamath@install@function\pgfmathtrue@=\pgfluamathtrue@ +% \pgfluamath@install@function\pgfmathfalse@=\pgfluamathfalse@ +% \pgfluamath@install@function\pgfmathnot@=\pgfluamathnot@ +% \pgfluamath@install@function\pgfmathhex@=\pgfluamathhex@ +% \pgfluamath@install@function\pgfmathHex@=\pgfluamathHex@ +% \pgfluamath@install@function\pgfmathoct@=\pgfluamathoct@ +% \pgfluamath@install@function\pgfmathbin@=\pgfluamathbin@ +% \pgfluamath@install@function\pgfmathand@=\pgfluamathand@ +% \pgfluamath@install@function\pgfmathor@=\pgfluamathor@ +% \pgfluamath@install@function\pgfmathfactorial@=\pgfluamathfactorial@ +% \pgfluamath@install@function\pgfmathveclen@=\pgfluamathveclen@ +% \pgfluamath@install@function\pgfmathcosh@=\pgfluamathcosh@ +% \pgfluamath@install@function\pgfmathsinh@=\pgfluamathsinh@ +% \pgfluamath@install@function\pgfmathtanh@=\pgfluamathtanh@ + +\def\pgfluamathpointnormalised#1{% + \pgf@process{#1}% + \pgfutil@directlua{% + pgfluamathfunctions.pointnormalised(% + \pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})}% + \ignorespaces} + +% Parser + +\newif\ifpgfluamathunitsdeclared + +\def\pgfluamathparse#1{% + \pgfluamathunitsdeclaredfalse + % The following "two passes" (TeX -> lua -> TeX -> lua -> TeX) is + % required for chadef'ed named boxes. The parser + % adds \number in front of the box name (e.g. \mybox -> + % \number\mybox). Then this is expanded to the chardef'ed number via + % \edef expansion. + \edef\pgfluamath@temp{% + \pgfutil@directlua{% + % Double quotes " are needed here. On the lua side, single quotes + % ' are used. Take care to don't mix them. + pgfluamathparser.parse("\pgfutil@luaescapestring{#1}") + tex.sprint(parsed_expression)}}% + % We can now feed back the evaluator. + \edef\pgfluamathresult{% + \pgfutil@directlua{% + pgfluamathparser.eval('\pgfluamath@temp') + if pgfluamathparser.result == nil then + tex.print('nil') + else + tex.print(pgfluamathparser.result) + end}}% + \csname pgfluamathunitsdeclared\pgfutil@directlua{% + if pgfluamathparser.units_declared == true then + tex.print('true') + else + tex.print('false') + end}\endcsname + \ifpgfluamathparseractive + \let\pgfmathresult\pgfluamathresult + \let\ifpgfmathunitsdeclared=\ifpgfluamathunitsdeclared + \fi} + +\endinput +% NEW: CJ (06 March 2012) Work in progress +\documentclass{minimal} + +\usepackage{pgfmath} + +\makeatletter +\let\pgfutil@directlua\directlua + +\directlua{dofile('pgfmathparser.lua')} + +\def\pgfluamathdeclarefunction#1#2#3{% + \pgfutil@directlua{% + pgfluamath.declare_new_function('#1',#2,#3)}} + +\pgfluamathdeclarefunction{add}{2}{% + function (a,b) return a + b end} + +\pgfluamathdeclarefunction{substract}{2}{% + function (a,b) return a - (b) end} + +\pgfluamathdeclarefunction{neg}{1}{% + function (a) return -(a) end} + +\pgfluamathdeclarefunction{multiply}{2}{% + function (a,b) return a * b end} + +\pgfluamathdeclarefunction{divide}{2}{% + function (a,b) return a / b end} + +\pgfluamathdeclarefunction{pow}{2}{% + function (a,b) return math.pow(a,b) end} + +\pgfluamathdeclarefunction{deg}{1}{% + function (a) return math.deg(a) end} + +\pgfluamathdeclarefunction{ifthenelse}{3}{% + function (a,b,c) if a == 1 then return b else return c end end} + +\pgfluamathdeclarefunction{equal}{2}{% + function (a,b) if a == b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{greater}{2}{% + function (a,b) if a > b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{less}{2}{% + function (a,b) if a < b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{notequal}{2}{% + function (a,b) if a < b or a > b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{notless}{2}{% + function (a,b) if a >= b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{notgreater}{2}{% + function (a,b) if a <= b then return 1 else return 0 end end} + +\pgfluamathdeclarefunction{andPGF}{2}{% + function (a,b) if (a < 0 or a > 0) and (b < 0 or b > 0) then return + 1 else return 0 end end} + +\pgfluamathdeclarefunction{orPGF}{2}{% + function (a,b) if (a < 0 or a > 0) or (b < 0 or b > 0) then return 1 + else return 0 end end} + +\pgfluamathdeclarefunction{modulo}{2}{% + % This is the definition of the lua % modulo operator + % The % operator cannot be used here (catcode issue) + function (a,b) return a - math.floor(a/b)*b end} + +\pgfluamathdeclarefunction{int}{1}{% + function (a) return a - pgfluamath.defined_functions.modulo.code(a,1) end} + +\pgfluamathdeclarefunction{frac}{1}{% + function (a) return pgfluamath.defined_functions.modulo.code(a,1) end} + +\pgfluamathdeclarefunction{factorial}{1}{% + function (a) + a = math.abs(pgfluamath.defined_functions.int.code(a)) + if a == 1 then + return 1 + else + return a * pgfluamath.defined_functions.factorial.code(a-1) + end + end} + +\pgfluamathdeclarefunction{sqrt}{1}{% + function (a) return math.sqrt(a) end} + + + +\def\pgfluamathparseandresult#1{% + \pgfutil@directlua{% + local s = pgfluamath.transform_math_expr('#1',pgfluamath.defined_functions_pattern) + texio.write_nl('pgfluamath: parsed expression "' .. s .. '"') + loadstring('tex.sprint(-1,' .. s .. ')')()}} + +\makeatother +\begin{document} + +$\pgfluamathparseandresult{1+2} = 3$ + +$\pgfluamathparseandresult{2*3} = 6$ + +$\pgfluamathparseandresult{1--1} = 2$ + +$\pgfluamathparseandresult{6/2} = 3$ + +$\pgfluamathparseandresult{2^2} = 4$ + +$\pgfluamathparseandresult{1>2} = 0$ + +$\pgfluamathparseandresult{2>1} = 1$ + +$\pgfluamathparseandresult{1!=1} = 0$ + +$\pgfluamathparseandresult{1?2:3} = 2$ + +$\pgfluamathparseandresult{1.0||0} = 1$ + +$\pgfluamathparseandresult{1&&0} = 0$ + +$\pgfluamathparseandresult{sqrt(2)} = \pgfmathparse{sqrt(2)}\pgfmathresult$ + +%\pgfluamathparseandresult{{1,{2,3-7}[1],4}[1]^2} + +\end{document} +% Local Variables: +% TeX-engine: luatex +% End:
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.functions.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.functions.lua new file mode 100644 index 00000000000..fa3c1872a58 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.functions.lua @@ -0,0 +1,313 @@ +-- Copyright 2011 by Christophe Jorssen +-- +-- 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. +-- +-- $Id: pgfluamath.functions.lua,v 1.9 2013/07/25 10:39:34 tantau Exp $ +-- + +local pgfluamathfunctions = pgfluamathfunctions or {} + +local mathabs, mathacos, mathasin = math.abs, math.acos, math.asin +local mathatan, mathatan2, mathceil = math.atan, math.atan2, math.ceil +local mathcos, mathcosh, mathdeg = math.cos, math.cosh, math.deg +local mathexp, mathfloor, mathfmod = math.exp, math.floor, math.fmod +local mathfrexp, mathhuge, mathldexp = math.frexp, math.huge, math.ldexp +local mathlog, mathlog10, mathmax = math.log, math.log10, math.max +local mathmin, mathmodf, mathpi = math.min, math.modf, math.pi +local mathpow, mathrad, mathrandom = math.pow, math.rad, math.random +local mathrandomseed, mathsin = math.randomseed, math.sin +local mathsinh, mathsqrt, mathtanh = math.sinh, math.sqrt, math.tanh +local mathtan = math.tan + +function pgfluamathfunctions.add(x,y) + return x+y +end + +function pgfluamathfunctions.substract(x,y) + return x-y +end + +function pgfluamathfunctions.neg(x) + return -x +end + +function pgfluamathfunctions.multiply(x,y) + return x*y +end + +function pgfluamathfunctions.divide(x,y) + return x/y +end + +function pgfluamathfunctions.pow(x,y) + return mathpow(x,y) +end + +function pgfluamathfunctions.factorial(x) +-- TODO: x must be an integer + if x == 0 then + return 1 + else + return x * factorial(x-1) + end +end + +function pgfluamathfunctions.deg(x) + return mathdeg(x) +end + +function pgfluamathfunctions.ifthenelse(x,y,z) + if x~= 0 then + return y + else + return z + end +end + +function pgfluamathfunctions.equal(x,y) + if x == y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.greater(x,y) + if x > y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.less(x,y) + if x < y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.notequal(x,y) + if x ~= y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.notless(x,y) + if x >= y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.notgreater(x,y) + if x <= y then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.andPGF(x,y) + if (x ~= 0) and (y ~= 0) then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.orPGF(x,y) + if (x ~= 0) or (y ~= 0) then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.notPGF(x) + if x == 0 then + return 1 + else + return 0 + end +end + +function pgfluamathfunctions.pi() + return mathpi +end + +function pgfluamathfunctions.e() + return mathexp(1) +end + +function pgfluamathfunctions.abs(x) + return mathabs(x) +end + +function pgfluamathfunctions.floor(x) + return mathfloor(x) +end + +function pgfluamathfunctions.ceil(x) + return mathceil(x) +end + +function pgfluamathfunctions.exp(x) + return mathexp(x) +end + +function pgfluamathfunctions.log(x) + return mathlog(x) +end + +function pgfluamathfunctions.log10(x) + return mathlog10(x) +end + +function pgfluamathfunctions.sqrt(x) + return mathsqrt(x) +end + +function pgfluamathfunctions.rnd() + return mathrandom() +end + +function pgfluamathfunctions.rand() + return mathrandom(-1,1) +end + +function pgfluamathfunctions.deg(x) + return mathdeg(x) +end + +function pgfluamathfunctions.rad(x) + return mathrad(x) +end + +function pgfluamathfunctions.round(x) + if x<0 then + return -mathceil(mathabs(x)) + else + return mathceil(x) + end +end + +function pgfluamathfunctions.gcd(a, b) + if b == 0 then + return a + else + return gcd(b, a%b) + end +end + +function pgfluamathfunctions.isprime(a) + local ifisprime = true + if a == 1 then + ifisprime = false + elseif a == 2 then + ifisprime = true +-- if a > 2 then + else + local i, imax = 2, mathceil(mathsqrt(a)) + 1 + while ifisprime and (i < imax) do + if gcd(a,i) ~= 1 then + ifisprime = false + end + i = i + 1 + end + end + if ifisprime then + return 1 + else + return 0 + end +end + + +function pgfluamathfunctions.split_braces_to_explist(s) + -- (Thanks to mpg and zappathustra from fctt) + -- Make unpack available whatever lua version is used + -- (unpack in lua 5.1 table.unpack in lua 5.2) + local unpack = table.unpack or unpack + local t = {} + for i in s:gmatch('%b{}') do + table.insert(t, tonumber(i:sub(2, -2))) + end + return unpack(t) +end + +function pgfluamathfunctions.split_braces_to_table(s) + local t = {} + for i in s:gmatch('%b{}') do + table.insert(t, tonumber(i:sub(2, -2))) + end + return t +end + +function pgfluamathfunctions.mod(x,y) + if x/y < 0 then + return -(mathabs(x)%mathabs(y)) + else + return mathabs(x)%mathabs(y) + end +end + +function pgfluamathfunctions.Mod(x,y) + return mathabs(x)%mathabs(y) +end + +function pgfluamathfunctions.Sin(x) + return mathsin(mathrad(x)) +end + +function pgfluamathfunctions.Cos(x) + return mathcos(mathrad(x)) +end + +function pgfluamathfunctions.Tan(x) + return mathtan(mathrad(x)) +end + +function pgfluamathfunctions.aSin(x) + return mathdeg(mathasin(x)) +end + +function pgfluamathfunctions.aCos(x) + return mathdeg(mathacos(x)) +end + +function pgfluamathfunctions.aTan(x) + return mathdeg(mathatan(x)) +end + +function pgfluamathfunctions.aTan2(y,x) + return mathdeg(mathatan2(y,x)) +end + +function pgfluamathfunctions.pointnormalised (pgfx, pgfy) + local pgfx_normalised, pgfy_normalised + if pgfx == 0. and pgfy == 0. then + -- Orginal pgf macro gives this result + tex.dimen['pgf@x'] = "0pt" + tex.dimen['pgf@y'] = "1pt" + else + pgfx_normalised = pgfx/math.sqrt(pgfx^2 + pgfy^2) + pgfx_normalised = pgfx_normalised - pgfx_normalised%0.00001 + pgfy_normalised = pgfy/math.sqrt(pgfx^2 + pgfy^2) + pgfy_normalised = pgfy_normalised - pgfy_normalised%0.00001 + tex.dimen['pgf@x'] = tostring(pgfx_normalised) .. "pt" + tex.dimen['pgf@y'] = tostring(pgfy_normalised) .. "pt" + end + return nil +end + +return pgfluamathfunctions
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.parser.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.parser.lua new file mode 100644 index 00000000000..b059e334358 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgfluamath.parser.lua @@ -0,0 +1,647 @@ +-- Copyright 2011 by Christophe Jorssen and Mark Wibrow +-- +-- This file may be distributed and/or modified +-- +-- 1. under the LaTeX Project Public License and/or +-- 2. under the GNU Public License. +-- +-- See the file doc/generic/pgf/licenses/LICENSE for more details. +-- +-- $Id: pgfluamath.parser.lua,v 1.14 2012/04/29 20:36:29 ludewich Exp $ + +local pgfluamathparser = pgfluamathparser or {} + +require("pgfluamath.functions") + +-- lpeg is always present in luatex +local lpeg = require("lpeg") + +local S, P, R = lpeg.S, lpeg.P, lpeg.R +local C, Cc, Ct = lpeg.C, lpeg.Cc, lpeg.Ct +local Cf, Cg, Cs = lpeg.Cf, lpeg.Cg, lpeg.Cs +local V = lpeg.V + +local space_pattern = S(" \n\r\t")^0 + +local exponent_pattern = S("eE") + +local one_digit_pattern = R("09") +local positive_integer_pattern = one_digit_pattern^1 +local integer_pattern = P("-")^-1 * positive_integer_pattern +-- Valid positive decimals are |xxx.xxx|, |.xxx| and |xxx.| +local positive_decimal_pattern = (one_digit_pattern^1 * P(".") * + one_digit_pattern^1) + + (P(".") * one_digit_pattern^1) + + (one_digit_pattern^1 * P(".")) +local decimal_pattern = P("-")^-1 * positive_decimal_pattern +local float_pattern = decimal_pattern * exponent_pattern * integer_pattern +local number_pattern = float_pattern + decimal_pattern + integer_pattern + +local at_pattern = P("@") + +local underscore_pattern = P("_") + +local lower_letter_pattern = R("az") +local upper_letter_pattern = R("AZ") +local letter_pattern = lower_letter_pattern + upper_letter_pattern +local alphanum_pattern = letter_pattern + one_digit_pattern +local alphanum__pattern = alphanum_pattern + underscore_pattern +local alpha__pattern = letter_pattern + underscore_pattern + +local openparen_pattern = P("(") +local closeparen_pattern = P(")") +local opencurlybrace_pattern = P("{") +local closecurlybrace_pattern = P("}") +local openbrace_pattern = P("[") +local closebrace_pattern = P("]") + +-- local string = P('"') * C((1 - P('"'))^0) * P('"') + +local orop_pattern = P("||") +local andop_pattern = P("&&") + +local neqop_pattern = P("!=") + +local then_pattern = P("?") +local else_pattern = P(":") +local factorial_pattern = P("!") +local not_mark_pattern = P("!") +local radians_pattern = P("r") + +local comma_pattern = P(",") + +--[[ +local grammar = P { + -- "E" stands for expression + "ternary_logical_E", + ternary_logical_E = Cf(V("logical_or_E") * + Cg( then_mark * V("logical_or_E") * else_mark * V("logical_or_E"))^0,evalternary); + logical_or_E = Cf(V("logical_and_E") * Cg(orop * V("logical_and_E"))^0,evalbinary); + logical_and_E = Cf(V("equality_E") * Cg(andop * V("equality_E"))^0,evalbinary); + equality_E = Cf(V("relational_E") * + Cg((eqop * V("relational_E")) + (neqop * V("relational_E")))^0,evalbinary); + relational_E = Cf(V("additive_E") * Cg((lessop * V("additive_E")) + + (greatop * V("additive_E")) + + (lesseqop * V("additive_E")) + + (greateqop * V("additive_E")))^0,evalbinary); + additive_E = Cf(V("multiplicative_E") * Cg((addop * V("multiplicative_E")) + + (subop * V("multiplicative_E")))^0,evalbinary); + multiplicative_E = Cf(V("power_E") * Cg((mulop * V("power_E")) + + divop * V("power_E"))^0,evalbinary); + power_E = Cf(V("postfix_unary_E") * Cg(powop * V("postfix_unary_E"))^0,evalbinary); + postfix_unary_E = Cf(V("prefix_unary_E") * Cg(radians + factorial)^0,evalpostfixunary); + prefix_unary_E = Cf(Cg(not_mark + negop)^0 * V("E"),evalprefixunary), + E = string + float + decimal + integer / tonumber + + (openparen * V("ternary_logical_E") * closeparen) + + (func * param_beg * V("ternary_logical_E") * + (comma * V("ternary_logical_E"))^0 * param_end); +} + +local parser = space_pattern * grammar * -1 +--]] + +-- NOTE: \pgfmathparse{pi/3.14} will fail giving pgfluamathfunctions.pi()3.14 +-- (the / is missing, probably gobbled by one of the captures of the grammar). + +pgfluamathparser.transform_operands = P({ + 'transform_operands'; + + one_char = lpeg.P(1), + lowercase = lpeg.R('az'), + uppercase = lpeg.R('AZ'), + numeric = lpeg.R('09'), + dot = lpeg.P('.'), + exponent = lpeg.S('eE'), + sign_prefix = lpeg.S('-+'), + begingroup = lpeg.P('('), + endgroup = lpeg.P(')'), + backslash = lpeg.P'\\', + at = lpeg.P'@', + + alphabetic = lpeg.V'lowercase' + lpeg.V'uppercase', + alphanumeric = lpeg.V'alphabetic' + lpeg.V'numeric', + + integer = lpeg.V'numeric'^1, + real = lpeg.V'numeric'^0 * lpeg.V'dot' * lpeg.V'numeric'^1, + scientific = (lpeg.V'real' + lpeg.V'integer') * lpeg.V'exponent' * lpeg.V'sign_prefix'^0 * lpeg.V'integer', + + number = lpeg.V'scientific' + lpeg.V'real' + lpeg.V'integer', + function_name = lpeg.V('alphabetic') * lpeg.V('alphanumeric')^0, + + tex_cs = lpeg.V'backslash' * (lpeg.V'alphanumeric' + lpeg.V'at')^1, + tex_box_dimension_primative = lpeg.V'backslash' * (lpeg.P'wd' + lpeg.P'ht' + lpeg.P'dp'), + tex_register_primative = lpeg.V'backslash' * (lpeg.P'count' + lpeg.P'dimen'), + + tex_primative = lpeg.V'tex_box_dimension_primative' + lpeg.V'tex_register_primative', + tex_macro = -lpeg.V'tex_primative' * lpeg.V'tex_cs', + + tex_unit = + lpeg.P('pt') + lpeg.P('mm') + lpeg.P('cm') + lpeg.P('in') + + lpeg.P('ex') + lpeg.P('em') + lpeg.P('bp') + lpeg.P('pc') + + lpeg.P('dd') + lpeg.P('cc') + lpeg.P('sp'), + + tex_register_named = lpeg.C(lpeg.V'tex_macro'), + tex_register_numbered = lpeg.C(lpeg.V'tex_register_primative') * lpeg.C(lpeg.V'integer'), + tex_register_basic = lpeg.Cs(lpeg.Ct(lpeg.V'tex_register_numbered' + lpeg.V'tex_register_named') / pgfluamathparser.process_tex_register), + + tex_multiplier = lpeg.Cs((lpeg.V'tex_register_basic' + lpeg.C(lpeg.V'number')) / pgfluamathparser.process_muliplier), + + tex_box_width = lpeg.Cs(lpeg.P('\\wd') / 'width'), + tex_box_height = lpeg.Cs(lpeg.P('\\ht') / 'height'), + tex_box_depth = lpeg.Cs(lpeg.P('\\dp') / 'depth'), + tex_box_dimensions = lpeg.V'tex_box_width' + lpeg.V'tex_box_height' + lpeg.V'tex_box_depth', + tex_box_named = lpeg.Cs(lpeg.Ct(lpeg.V'tex_box_dimensions' * lpeg.C(lpeg.V'tex_macro')) / pgfluamathparser.process_tex_box_named), + tex_box_numbered = lpeg.Cs(lpeg.Ct(lpeg.V'tex_box_dimensions' * lpeg.C(lpeg.V'number')) / pgfluamathparser.process_tex_box_numbered), + tex_box_basic = lpeg.V'tex_box_named' + lpeg.V'tex_box_numbered', + + tex_register = lpeg.Cs(lpeg.V'tex_multiplier' * lpeg.V'tex_register_basic') + lpeg.V'tex_register_basic', + tex_box = lpeg.Cs(lpeg.Cs(lpeg.V'tex_multiplier') * lpeg.V'tex_box_basic') + lpeg.V'tex_box_basic', + tex_dimension = lpeg.Cs(lpeg.V'number' * lpeg.V'tex_unit' / pgfluamathparser.process_tex_dimension), + + tex_operand = lpeg.Cs(lpeg.V'tex_dimension' + lpeg.V'tex_box' + lpeg.V'tex_register'), + + function_name = lpeg.V'alphabetic' * (lpeg.V'alphanumeric'^1), + function_operand = lpeg.Cs(lpeg.Ct(lpeg.C(lpeg.V'function_name') * lpeg.C(lpeg.V'one_char') + lpeg.C(lpeg.V'function_name')) / pgfluamathparser.process_function), + + -- order is (always) important! + operands = lpeg.V'tex_operand' + lpeg.V'number' + lpeg.V'function_operand', + + transform_operands = lpeg.Cs((lpeg.V'operands' + 1)^0) + }) + +-- Namespaces will be searched in the following order. +pgfluamathparser.function_namespaces = { + 'pgfluamathfunctions', 'math', '_G'} + +pgfluamathparser.units_declared = false + +function pgfluamathparser.get_tex_box(box, dimension) + -- assume get_tex_box is only called when a dimension is required. + pgfluamathparser.units_declared = true + if dimension == 'width' then + return tex.box[box].width / 65536 -- return in points. + elseif dimension == 'height' then + return tex.box[box].height / 65536 + else + return tex.box[box].depth / 65536 + end +end + +function pgfluamathparser.get_tex_register(register) + -- register is a string which could be a count or a dimen. + if pcall(tex.getcount, register) then + return tex.count[register] + elseif pcall(tex.getdimen, register) then + pgfluamathparser.units_declared = true + return tex.dimen[register] / 65536 -- return in points. + else + pgfluamathparser.error = 'I do not know the TeX register "' .. register '"' + return nil + end + +end + +function pgfluamathparser.get_tex_count(count) + -- count is expected to be a number + return tex.count[tonumber(count)] +end + +function pgfluamathparser.get_tex_dimen(dimen) + -- dimen is expected to be a number + pgfluamathparser.units_declared = true + return tex.dimen[tonumber(dimen)] / 65536 +end + +function pgfluamathparser.get_tex_sp(dimension) + -- dimension should be a string + pgfluamathparser.units_declared = true + return tex.sp(dimension) / 65536 +end + + + +-- transform named box specification +-- e.g., \wd\mybox -> pgfluamathparser.get_tex_box["mybox"].width +-- +function pgfluamathparser.process_tex_box_named(box) + return 'pgfluamathparser.get_tex_box(\\number' .. box[2] .. ', "' .. box[1] .. '")' +end + +-- transform numbered box specification +-- e.g., \wd0 -> pgfluamathparser.get_tex_box["0"].width +-- +function pgfluamathparser.process_tex_box_numbered(box) + return 'pgfluamathparser.get_tex_box("' .. box[2] .. '", "' .. box[1] .. '")' +end + +-- transform a register +-- e.g., \mycount -> pgfluamathparser.get_tex_register["mycount"] +-- \dimen12 -> pgfluamathparser.get_tex_dimen[12] +-- +function pgfluamathparser.process_tex_register(register) + if register[2] == nil then -- a named register + return 'pgfluamathparser.get_tex_register("' .. register[1]:sub(2, register[1]:len()) .. '")' + else -- a numbered register + return 'pgfluamathparser.get_tex_' .. register[1]:sub(2, register[1]:len()) .. '(' .. register[2] .. ')' + end +end + +-- transform a 'multiplier' +-- e.g., 0.5 -> 0.5* (when followed by a box/register) +-- +function pgfluamathparser.process_muliplier(multiplier) + return multiplier .. '*' +end + +-- transform an explicit dimension to points +-- e.g., 1cm -> pgfluamathparser.get_tex_sp("1cm") +-- +function pgfluamathparser.process_tex_dimension(dimension) + return 'pgfluamathparser.get_tex_sp("' .. dimension .. '")' +end + +-- Check the type and 'namespace' of a function F. +-- +-- If F cannot be found as a Lua function or a Lua number in the +-- namespaces in containted in pgfluamathparser.function_namespaces +-- then an error results. +-- +-- if F is a Lua function and isn't followd by () (a requirement of Lua) +-- then the parentheses are inserted. +-- +-- e.g., random -> random() (if random is a function in the _G namespace) +-- pi -> math.pi (if pi is a constant that is only in the math namespace) +-- +function pgfluamathparser.process_function(function_table) + local function_name = function_table[1] + local char = function_table[2] + if (char == nil) then + char = '' + end + for _, namespace in pairs(pgfluamathparser.function_namespaces) do + local function_type = assert(loadstring('return type(' .. namespace .. '.' .. function_name .. ')'))() + if function_type == 'function' then + if not (char == '(') then + char = '()' + end + return namespace .. '.' .. function_name .. char + elseif function_type == 'number' then + return namespace .. '.' .. function_name .. char + end + end + pgfluamathparser.error = 'I don\'t know the function or constant \'' .. function_name .. '\'' +end + + +pgfluamathparser.remove_spaces = lpeg.Cs((lpeg.S' \n\t' / '' + 1)^0) + + +function pgfluamathparser.evaluate(expression) + assert(loadstring('pgfluamathparser._result=' .. expression))() + pgfluamathparser.result = pgfluamathparser._result +end + +function pgfluamathparser.parse(expression) + pgfluamathparser.write_to_log("Parsing expression:" .. expression) + pgfluamathparser.units_declared = false + + pgfluamathparser.error = nil + pgfluamathparser.result = nil + + -- Remove spaces + expression = pgfluamathparser.remove_spaces:match(expression) + + parsed_expression = + pgfluamathparser.transform_operands:match(expression) + pgfluamathparser.write_to_log("Transformed expression:" + .. parsed_expression) +end + +function pgfluamathparser.eval(expression) + pgfluamathparser.write_to_log("Evaluating expression:" .. expression) + pcall(pgfluamathparser.evaluate, expression) + pgfluamathparser.write_to_log("Result:" .. pgfluamathparser.result) + if pgfluamathparser.result == nil then + pgfluamathparser.error = "Sorry, I could not evaluate '" .. expression .. "'" + return nil + else + return pgfluamathparser.result + end +end + +pgfluamathparser.trace = true + +function pgfluamathparser.write_to_log (s) + if pgfluamathparser.trace then + texio.write_nl(s) + end +end + +return pgfluamathparser + +--[[ NEW: 2012/02/21, CJ, work in progress +-- We need 3 parsers (or 2, 2 and 3 could be merged) +-- (1) To get the number associated with a (\chardef'ed) box (e.g. +-- \ht\mybox -> \ht26) +-- This is part of a TeX ->(\directlua == \edef) -> lua -> (lpeg parser 1) +-- -> TeX -> (\directlua == \edef) +-- (2) To transform math and functions operands +-- (3) To transform units, dimen and count register + +-- TODO: strings delimited by "..." +-- TODO: units. \pgfmathparse{12+1cm}\pgfmathresult and \the\dimexpr 12pt+1cm\relax have the same result. Note: \pgfmathparse{(12+1)cm} won't work in plain pgfmath. +-- TODO: Parser 3 + + +pgfluamath = pgfluamath or {} + +pgfluamath.debug = true + +local lpeg = require('lpeg') +local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V +local C, Cc, Cs = lpeg.C, lpeg.Cc, lpeg.Cs +local Cf, Cg, Ct = lpeg.Cf, lpeg.Cg, lpeg.Ct +local match = lpeg.match + +local space = S(' \n\t') + +local lowercase = R('az') +local uppercase = R('AZ') +local alphabetic = lowercase + uppercase + +local digit = R('09') + +local alphanumeric = alphabetic + digit + +local dot = P('.') +local exponent = S('eE') +local sign_prefix = S('+-') + +local integer = digit^1 +local float = (digit^1 * dot * digit^0) + (digit^0 * dot * digit^1) +local scientific = (float + integer) * exponent * sign_prefix^-1 * integer + +local number = scientific + float + integer + +local at = P('@') + +local backslash = P('\\') + +local box_width = P('\\wd') +local box_height = P('\\ht') +local box_depth = P('\\dp') +local box_dimension = box_width + box_height + box_depth + +local tex_cs = backslash * (alphabetic + at)^1 + +local lparen = P('(') +local rparen = P(')') + +local lbrace = P('{') +local rbrace = P('}') + +local lbracket = P('[') +local rbracket = P(']') + +local thenop = P('?') +local elseop = P(':') + +local orop = P('||') +local andop = P('&&') + +local eqop = P('==') +local neqop = P('!=') + +local greaterop = P('>') +local lessop = P('<') +local greatereqop = P('>=') +local lesseqop = P('<=') + +local addop = P('+') +local subop = P('-') + +local mulop = P('*') +local divop = P('/') + +local powop = P('^') + +local radop = P('r') + +local notop = P('!') +local negop = P('-') + +local comma = P(',') + +function pgfluamath.namedbox_to_numberedbox (s) + -- Transforms '{\wd|\ht|\dp}\mybox' to '{\wd|\ht|\dp}\number\mybox' + local function transform (capture) + print('Captured ' .. capture) + return '\\number' .. capture + end + local dimension_of_a_named_box = + box_dimension * space^0 * (tex_cs / transform) + -- P(1) matches exactly one character + -- V(1) is the entry of the grammar with index 1. It defines the initial rule. + -- The manual says: + -- "If that entry is a string, it is assumed to be the name of the initial rule. + -- Otherwise, LPeg assumes that the entry 1 itself is the initial rule." + local grammar = + P({ + [1] = (dimension_of_a_named_box + P(1)) * V(1) + P(true) + }) + return print(match(Cs(grammar),s)) +end +--[[ +namedbox_to_numberedbox('test') +namedbox_to_numberedbox('\\test') +namedbox_to_numberedbox('\\wd\\test') +namedbox_to_numberedbox('\\wd\\test0') +namedbox_to_numberedbox('\\wd\\test01') +namedbox_to_numberedbox('\\wd\\test@t 012') +namedbox_to_numberedbox(' \\wd \\test012') +namedbox_to_numberedbox('\\wd\\test012\\test \\ht\\zozo0') +namedbox_to_numberedbox('\\wd0') +--]] + +-- Grammar (from lowest to highest precedence) +-- Need to adjust to the precedences in plain pgfmath parser +-- IfThenElse Expression +local ITE_E = V('ITE_E') +-- logical OR Expression +local OR_E = V('OR_E') +-- logical AND Expression +local AND_E = V('AND_E') +-- EQuality Expression +local EQ_E = V('EQ_E') +-- Relational EQuality Expression +local REQ_E = V('REQ_E') +-- ADDitive Expression +local ADD_E = V('ADD_E') +-- MULtiplicative Expression +local MUL_E = V('MUL_E') +-- POWer Expression +local POW_E = V('POW_E') +-- POSTfix Expression +local POST_E = V('POST_E') +-- PREfix Expression +local PRE_E = V('PRE_E') +-- ARRAY Expression +local ARRAY_E = V('ARRAY_E') +-- Expression +local E = V('E') + +function pgfluamath.transform_math_expr (s, f_patt) + if pgfluamath.debug then + texio.write_nl('pgfluamath: parsing expression "' .. s ..'"') + end + -- f_patt extends the grammar dynamically at the time of the call to the + -- parser. + -- The idea is to have a set of predefined acceptable functions (via e.g. + -- \pgfmathdeclarefunction) + if not f_patt then + -- P(false) is a pattern that always fails + -- (neutral element for the + operator on patterns) + f_patt = P(false) + end + local function transform_ITE(a, b, c) + if not b then + return a + else + return string.format('pgfluamath.defined_functions.ifthenelse.code(%s,%s,%s)', a, b, c) + end + end + local function transform_binary(a, b, c) + if not b then + return a + else + return string.format('pgfluamath.defined_functions.%s.code(%s,%s)', b, a, c) + end + end + local function transform_postunary(a, b) + if not b then + return a + else + return string.format('pgfluamath.defined_functions.%s.code(%s)', b, a) + end + end + local function transform_preunary(a, b) + if not b then + return a + else + return string.format('pgfluamath.defined_functions.%s.code(%s)', a, b) + end + end + local function transform_array(a, b) + -- One exception to the mimmic of plain pgfmath. I do not use the equivalent array function to transform the arrays because I don't know how to handle both cases {1,{2,3}[1],4}[1] and {1,{2,3},4}[1][1] with the parser and the array function. + -- So I convert a pgf array to a lua table. One can access one entry of the table like this ({1,2})[1] (note the parenthesis, ie {1,2}[1] won't work). + local s + if not b then + s = '{' + else + s = '({' + end + for i = 1,#a do + -- We change the index to fit with pgfmath plain convention (index starts at 0 while in lua index starts at 1) + s = s .. '[' .. tostring(i-1) .. ']=' .. a[i] + if i < #a then + s = s .. ',' + end + end + if b then + s = s .. '})' + for i = 1,#b do + s = s .. '[' .. b[i] .. ']' + end + else + s = s .. '}' + end + return s + end + local grammar = + lpeg.P({ + 'ITE_E', + ITE_E = (OR_E * (thenop * OR_E * elseop * OR_E)^-1) / transform_ITE, + OR_E = (AND_E * (orop * Cc('orPGF') * AND_E)^-1) / transform_binary, + AND_E = (EQ_E * (andop * Cc('andPGF') * EQ_E)^-1) / transform_binary, + EQ_E = (REQ_E * ((eqop * Cc('equal') + neqop * Cc('notequal')) * REQ_E)^-1) / transform_binary, + REQ_E = (ADD_E * ((lessop * Cc('less') + greaterop * Cc('greater') + lesseqop * Cc('notgreater') + greatereqop * Cc('notless')) * ADD_E)^-1) / transform_binary, + ADD_E = Cf(MUL_E * Cg((addop * Cc('add') + subop * Cc('substract')) * MUL_E)^0,transform_binary), + MUL_E = Cf(POW_E * Cg((mulop * Cc('multiply') + divop * Cc('divide')) * POW_E)^0,transform_binary), + POW_E = Cf(POST_E * Cg(powop * Cc('pow') * POST_E)^0,transform_binary), + POST_E = (PRE_E * (radop * Cc('rad'))^-1) / transform_postunary, + PRE_E = ((notop * Cc('notPGF') + negop * Cc('neg'))^-1 * E) / transform_preunary, + ARRAY_E = (lbrace * Ct(ITE_E * (comma * ITE_E)^0) * rbrace * Ct((lbracket * ITE_E * rbracket)^0)) / transform_array, + E = ((integer + float)^-1 * tex_cs^1) + f_patt + C(number) + (lparen * ITE_E * rparen) + ARRAY_E + lbrace * ITE_E * rbrace + }) + return lpeg.match(Cs(grammar),s) +end + +function pgfluamath.ptransform_math_expr(s, f_patt) + local st = pgfluamath.transform_math_expr(s, f_patt) + if st ~= nil then + return texio.write_nl(st) + end +end + +pgfluamath.defined_functions = {} +pgfluamath.defined_functions_pattern = P(false) + +function pgfluamath.declare_new_function (name, nargs, code) + -- nil is true + -- The function name CANNOT be a lua reserved word (so no 'and' nor 'or') + if pgfluamath.defined_functions[name] then + print('Function ' .. name .. ' is already defined. ' .. + 'I overwrite it!') + end + pgfluamath.defined_functions[name] = {['name'] = name, ['nargs'] = nargs, ['code'] = code} + + -- TODO + -- We need a function to dynamically (depending on the number of arguments) define a patten (in order to avoid the long ifcase-type structure). + local pattern + if nargs == 0 then + pattern = P(name) / function (s) return name .. '()' end + else if nargs == 1 then + pattern = ((P(name) * lparen * Cs(ITE_E) * rparen) / function (s) return 'pgfluamath.defined_functions.' .. name .. '.code(' .. s .. ')' end) + else if nargs == 2 then + pattern = (P(name) * lparen * Cs(ITE_E) * comma * Cs(ITE_E) * rparen / function (s1,s2) return 'pgfluamath.defined_functions.' .. name .. 'code(' .. s1 .. ',' .. s2 .. ')' end) + else if nargs == 3 then + pattern = (P(name) * lparen * Cs(ITE_E) * comma * Cs(ITE_E) * comma * Cs(ITE_E) * rparen / function (s1,s2,s3) return 'pgfluamath.defined_functions.' .. name .. 'code(' .. s1 .. ',' .. s2 .. ',' .. s3 .. ')' end) + end + end + end + end + -- TODO + -- This needs to be regenerated every time a new function is added, in conjunction with a sort of the table (see IMPORTANT below) + pgfluamath.defined_functions_pattern = pgfluamath.defined_functions_pattern + pattern +end + +-- IMPORTANT: for 'function' with *0* argument, the longest string, the first +-- ie declaring pi before pit won't work. +pgfluamath.declare_new_function('pit',0) +pgfluamath.declare_new_function('pi',0) +pgfluamath.declare_new_function('exp',1) +pgfluamath.declare_new_function('toto',1) +pgfluamath.declare_new_function('gauss',2) + +pgfluamath.ptransform_math_expr('exp(exp(1+1))',pgfluamath.defined_functions_pattern) + +pgfluamath.ptransform_math_expr('1?(2?3:4^5):gauss(6+toto(7),8+9>10?11:12))',pgfluamath.defined_functions_pattern) + +pgfluamath.ptransform_math_expr('!(1!=-2)>3?(4+5*6+7?8||9&&10:11):12^13r||14') +pgfluamath.ptransform_math_expr('-1^2\\test\\toto^3') +pgfluamath.ptransform_math_expr('{1,{2+3,4}[1],5}[2]+6') +pgfluamath.ptransform_math_expr('{1,{2+3,4},5}[1][1]') +pgfluamath.ptransform_math_expr('{1,{2,3},4}[1][1]') +pgfluamath.ptransform_math_expr('{1,{2,3}[1],4}[1]') + +--Loadstring: If it succeeds in converting the string to a *function*, it returns that function; otherwise, it returns nil and an error message. +toto = loadstring('texio.write_nl(' .. pgfluamath.transform_math_expr('{1,{2,3},4}[1][1]') .. ')') +toto() + +-- IMPORTANT NOTE!! +-- local function add (a,b) will fail within loadstring. Needs to be global. loadstring opens a new chunk that does not know the local variables of other chunks. + +--toto = loadstring('texio.write_nl(' .. pgfluamath.transform_math_expr('{1,{2,3E-1+7}[1],4}[1]') .. ')') +--toto() + +return pgfluamath 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 d91a83b111f..9c4a48aeaca 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex @@ -7,12 +7,12 @@ % % 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.9 2008/10/27 21:00:46 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.code.tex,v 1.16 2013/09/23 18:04:35 tantau Exp $ % A square bracket shaped arrow -\pgfarrowsdeclare{[}{]} +\pgfarrowsdeclare{square bracket}{square bracket} { \pgfutil@tempdima=1pt% \advance\pgfutil@tempdima by1.25\pgflinewidth% @@ -33,6 +33,7 @@ \pgfpathlineto{\pgfqpoint{-.5\pgfutil@tempdimb}{\pgfutil@tempdima}} \pgfusepathqstroke } +\pgfdeclarearrow{name=[-], means=square bracket} \pgfarrowsdeclarereversed{]}{[}{[}{]} @@ -148,7 +149,7 @@ { \pgfutil@tempdima=0.4pt% \advance\pgfutil@tempdima by.2\pgflinewidth% - \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb by\pgflinewidth + \pgfutil@tempdimb=7.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth \pgfarrowsleftextend{+-\pgfutil@tempdimb} \pgfutil@tempdimb=1.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth \pgfarrowsrightextend{+\pgfutil@tempdimb} @@ -234,7 +235,7 @@ { \arrowsize=0.4pt \advance\arrowsize by.275\pgflinewidth% - \pgfarrowsleftextend{+-\arrowsize} + \pgfarrowsleftextend{-7\arrowsize-.5\pgflinewidth} \advance\arrowsize by.5\pgflinewidth \pgfarrowsrightextend{+\arrowsize} } @@ -509,6 +510,7 @@ {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}} {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}} {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathclose \pgfusepathqfill } @@ -825,6 +827,7 @@ \pgfpathlineto{\pgfqpoint{\pgflinewidth}{0pt}} \pgfpathlineto{\pgfqpoint{.5\pgflinewidth}{-.5\pgflinewidth}} \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}} + \pgfpathclose \pgfusepathqfill } @@ -839,6 +842,7 @@ \pgfpathlineto{\pgfqpoint{-.1\pgflinewidth}{-.5\pgflinewidth}} \pgfpathlineto{\pgfqpoint{1\pgflinewidth}{-.5\pgflinewidth}} \pgfpathlineto{\pgfqpoint{0.5\pgflinewidth}{0\pgflinewidth}} + \pgfpathclose \pgfusepathqfill } @@ -904,12 +908,13 @@ { \pgfmathsetlength{\pgfutil@tempdima}{.25\pgflinewidth+.25*\pgfinnerlinewidth}% \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfinnerlinewidth}% - \pgfarrowsrightextend{2\pgfutil@tempdima+.5\pgfutil@tempdimb} - \pgfarrowsleftextend{1.3\pgfutil@tempdima+.5\pgfutil@tempdimb} + \pgfarrowsrightextend{2.06\pgfutil@tempdima+.5\pgfutil@tempdimb} + \pgfarrowsleftextend{-1.36\pgfutil@tempdima-.5\pgfutil@tempdimb} } { \pgfmathsetlength{\pgfutil@tempdima}{.25\pgflinewidth+.25*\pgfinnerlinewidth}% \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfinnerlinewidth}% + \pgftransformxshift{.06\pgfutil@tempdima} \pgfsetlinewidth{\pgfutil@tempdimb} \pgfsetdash{}{+0pt} \pgfsetroundcap 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 new file mode 100644 index 00000000000..77edfcd8dc6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex @@ -0,0 +1,1612 @@ +% Copyright 2013 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.meta.code.tex,v 1.12 2013/12/13 15:11:58 tantau Exp $ + + + +% +% +% Meta keys +% +% + + +\newdimen\pgfarrowinset +\newdimen\pgfarrowlength +\newdimen\pgfarrowwidth +\newdimen\pgfarrowlinewidth +\newif\ifpgfarrowroundcap +\newif\ifpgfarrowroundjoin + +\pgfarrowsaddtolengthscalelist\pgfarrowlength +\pgfarrowsaddtolengthscalelist\pgfarrowinset +\pgfarrowsaddtowidthscalelist\pgfarrowwidth + + +\pgfkeys{ + /pgf/arrow keys/.cd, + length/.code={% + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\pgfarrowslinewidthdependent\pgfarrowstheparameters\pgfarrowlength\pgf@x}% + }, + inset/.code={% + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslinewidthdependent\pgfarrowstheparameters\pgfarrowinset\pgf@x}% + }, + inset'/.code={ + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslengthdependent\pgfarrowstheparameters\pgfarrowinset}% + }, + line width/.code={% + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslinewidthdependent\pgfarrowstheparameters\pgfarrowlinewidth\pgf@x}% + }, + line width'/.code={ + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslengthdependent\pgfarrowstheparameters\pgfarrowlinewidth}% + }, + width/.code={% + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslinewidthdependent\pgfarrowstheparameters\pgfarrowwidth\pgf@x}% + }, + width'/.code={% + \pgfarrowsthreeparameters{#1}% + \expandafter\pgfarrowsaddtolateoptions\expandafter{\expandafter\pgfarrowslengthdependent\pgfarrowstheparameters\pgfarrowwidth}% + }, + angle/.code={% + \pgfarrowsfourparameters{#1}% + \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\pgfarrows@angle@setup\pgfarrowstheparameters}% + }, + angle'/.code={ + \pgfarrowsaddtolateoptions{\pgfarrows@angle@setup@prime{#1}}% + }, + % + line cap/.is choice, + line cap/butt/.code=\pgfarrowsaddtooptions{\pgfarrowroundcapfalse}, + line cap/round/.code=\pgfarrowsaddtooptions{\pgfarrowroundcaptrue}, + line join/.is choice, + line join/miter/.code=\pgfarrowsaddtooptions{\pgfarrowroundjoinfalse}, + 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: +% +% +% Barbs +% ----- +% +% These arrow tips consisting of stroked lines starting at the tip, +% 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. +% +% +% Geometric +% --------- +% +% The arrow tips have a geometric form like a triangle or a +% "stealth" fighter or a kite. They can be filled and/or stroked. +% +% +% Caps +% ---- +% +% These arrow tips have their width fixed to the line width and +% provide different ways of adding a "cap" to the end of a line. This +% allows one to use more than just the standard "round cap", "butt +% cap" and "rect cap" and, additionally, one can one kind of cap at +% one end and another at the other end. +% +% +% Other +% ----- +% +% Special purpose arrow tips. +% + + + +% +% +% Barbs arrow tips +% +% + + +% An Straight Barb yields a simple angle + +\pgfdeclarearrow{ + name = Straight Barb, + defaults = { + length = +1.5pt 2, + width' = +0pt 2, + line width = +0pt 1 1, + }, + setup code = { + % Compute front miter length: + \pgfmathdivide@\pgfarrowlength\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x4\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter + \pgf@xc.5\pgf@xc + \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter + % Set ends + \ifpgfarrowroundjoin + \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 + \pgfarrowssetvisualbackend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth} + \pgfarrowssetbackend{-.5\pgfarrowlinewidth} + % harpoon miter correction + \ifpgfarrowreversed + \pgfarrowssetlineend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by.5\pgfarrowlinewidth\fi} + \else + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth} + \fi + % The hull: + \ifpgfarrowroundjoin + \pgfarrowshullpoint{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}% + \else% + \ifpgfarrowharpoon + \pgfarrowshullpoint{\pgfarrowlength\advance\pgf@x by\pgf@xc\advance\pgf@x by\pgf@xa}{-.5\pgfarrowlinewidth}% + \else + \pgfarrowshullpoint{\pgfarrowlength\advance\pgf@x by\pgf@xc\advance\pgf@x by\pgf@xa}{0pt}% + \fi% + \fi + \pgfarrowsupperhullpoint{.5\pgfarrowlinewidth}{.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}% + \pgfarrowsupperhullpoint{-.5\pgfarrowlinewidth}{.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}% + \ifpgfarrowharpoon + \pgfarrowshullpoint{-.5\pgfarrowlinewidth}{-.5\pgfarrowlinewidth}% + \fi + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \pgfpathmoveto{\pgfqpoint{0pt}{.5\pgfarrowwidth}} + \pgfpathlineto{\pgfqpoint{\pgfarrowlength}{0pt}} + \ifpgfarrowharpoon + \pgfpathlineto{\pgfqpoint{\pgfarrowlength\advance\pgf@x by\ifpgfarrowreversed\else-\fi\pgfarrowlinewidth}{0pt}} + \else + \pgfpathlineto{\pgfqpoint{0pt}{-.5\pgfarrowwidth}} + \fi + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi% + \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| +% key. + +\pgfkeys{ + /pgf/arrow keys/.cd, + arc/.code={% + \pgfmathparse{#1}% + \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\def\expandafter\pgfarrowarc\expandafter{\pgfmathresult}} + } +} + +\def\pgfarrowarc{180} + +\pgfdeclarearrow{ + name = Hooks, + defaults = { + length = +0.75pt 1.25, + width' = +0pt 4 -1, + line width = +0pt 1 1, + }, + setup code = { + \ifpgfarrowharpoon + \pgfarrowshullpoint{.5\pgfarrowlength}{-.5\pgfarrowlinewidth} + \pgfarrowshullpoint{\pgfarrowlength}{-.5\pgfarrowlinewidth\advance\pgf@y by.125\pgfarrowwidth} + \fi + \ifdim\pgfarrowarc pt<90.1pt + \pgfarrowsupperhullpoint{0pt}{.25\pgfarrowwidth\ifpgfarrowroundcap\else\advance\pgf@y by-.25\pgfarrowlinewidth\fi} + \pgfarrowsupperhullpoint{\pgfarrowlength}{.25\pgfarrowwidth\ifpgfarrowroundcap\else\advance\pgf@y by-.25\pgfarrowlinewidth\fi} + \else% + \pgfarrowsupperhullpoint{\pgfarrowlength}{.375\pgfarrowwidth} + \pgfarrowsupperhullpoint{.5\pgfarrowlength}{.5\pgfarrowwidth} + \ifdim\pgfarrowarc pt>180pt + \pgfarrowsupperhullpoint{-.5\pgfarrowlength}{.5\pgfarrowwidth} + \pgfarrowsupperhullpoint{-\pgfarrowlength}{.375\pgfarrowwidth} + \pgfarrowsupperhullpoint{-\pgfarrowlength}{.25\pgfarrowwidth} + \else + \pgfarrowsupperhullpoint{\ifpgfarrowroundcap-.5\pgfarrowlinewidth\else0pt\fi}{.25\pgfarrowwidth} + \pgfarrowsupperhullpoint{\ifpgfarrowroundcap-.5\pgfarrowlinewidth\else0pt\fi}{.5\pgfarrowwidth} + \fi + \fi + % Adjust width and length: Take line thickness into account: + \advance\pgfarrowlength by-.5\pgfarrowlinewidth + \advance\pgfarrowwidth by-\pgfarrowlinewidth + \ifpgfarrowreversed + \ifpgfarrowroundjoin + \pgfarrowssetbackend{-.5\pgfarrowlinewidth} + \fi + \fi + % 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 + % + \ifdim\pgfarrowarc pt<90pt% + % Tip end is given by sin(pgfarrowarc)*length + \pgfmathsin@{\pgfarrowarc} + \pgfarrowssettipend{\pgfmathresult\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}% + \else\ifdim\pgfarrowarc pt<180pt% + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}% + \ifpgfarrowroundcap\pgfarrowssetbackend{-.5\pgfarrowlinewidth}\fi% + \else\ifdim\pgfarrowarc pt<270pt% + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}% + \ifdim\pgfarrowarc pt>180pt + % Back end is given by sin(pgfarrowarc)*length + \pgfmathsin@{\pgfarrowarc} + \pgfarrowssetbackend{\pgfmathresult\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth}% + \else + \ifpgfarrowroundcap\pgfarrowssetbackend{-.5\pgfarrowlinewidth}\fi% + \fi% + \else% + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by.5\pgfarrowlinewidth}% + \pgfarrowssetbackend{-\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth}% + \fi\fi\fi% + \ifpgfarrowreversed + \pgfarrowssetlineend{.5\pgfarrowlinewidth} + \else% + \ifpgfarrowharpoon + \pgfarrowssetlineend{0pt} + \else + \pgfarrowssetlineend{.25\pgfarrowlinewidth} + \fi + \fi + % Adjust arc: + \pgf@x\pgfarrowarc pt% + \advance\pgf@x by-90pt% + \edef\pgfarrowarc{\pgf@sys@tonumber\pgf@x}% + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + \pgfarrowssave\pgfarrowarc + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + {% + \pgftransformxscale{+\pgfarrowlength} + \pgftransformyscale{+.25\pgfarrowwidth} + \pgfpathmoveto{\pgfpointpolar{+\pgfarrowarc}{+1pt}\advance\pgf@y by1pt} + \pgfpatharc{\pgfarrowarc}{+-90}{+1pt} + \ifpgfarrowharpoon + \else + \pgfpatharc{+90}{+-\pgfarrowarc}{+1pt} + \fi + } + \ifpgfarrowharpoon\ifpgfarrowreversed + \pgfpathlineto{\pgfqpoint{\pgflinewidth}{0pt}} + \fi\fi + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \pgfarrowarc,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowroundjoin j\fi% + \ifpgfarrowroundcap c\fi% + }, +} + + +\pgfdeclarearrow{ + name = Arc Barb, + defaults = { + length = +1.5pt 2, + width' = +0pt 2, + line width = +0pt 1 1, + }, + setup code = { + % Adjust arc: + \pgf@x\pgfarrowarc pt% + \pgf@x.5\pgf@x% + \edef\pgfarrowarc{\pgf@sys@tonumber\pgf@x}% + % The tips: + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetvisualbackend{\pgfarrowlength} + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth} + % The hull: + \pgfarrowsupperhullpoint{\pgfarrowlength}{.25\pgfarrowwidth} + \ifpgfarrowharpoon\pgfarrowshullpoint{\pgfarrowlength}{-.5\pgflinewidth}\fi + \pgfmathsincos@{\pgfarrowarc}% + \pgf@xa.5\pgfarrowwidth% + \pgfarrowsupperhullpoint{\pgfmathresultx\pgfarrowlength}{\pgfmathresulty\pgf@xa} + \ifdim\pgfarrowarc pt>60pt + \pgfarrowsupperhullpoint{.5\pgfarrowlength}{\ifdim\pgfarrowarc pt<90pt\pgfmathresulty\pgf@xa\else.5\pgfarrowwidth\fi} + \fi + \ifdim\pgfarrowarc pt>90pt + \ifdim\pgfarrowarc pt<120pt + \pgfarrowsupperhullpoint{\pgfmathresultx\pgfarrowlength}{.5\pgfarrowwidth} + \else + \pgfarrowsupperhullpoint{-.5\pgfarrowlength}{.5\pgfarrowwidth} + \ifdim\pgfarrowarc pt>150pt + \pgfarrowsupperhullpoint{-\pgfarrowlength}{.25\pgfarrowwidth} + \fi + \fi + \fi + \pgfutil@tempswafalse + \ifdim\pgfarrowarc pt<90pt + \pgfutil@tempswatrue + \fi + \ifpgfarrowharpoon + \pgfutil@tempswatrue + \fi + \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} + \fi + % Compute back end + \ifpgfarrowroundcap + \pgf@y\pgfarrowlength + \advance\pgf@y by-.5\pgfarrowlinewidth + \pgf@x\pgfmathresultx\pgf@y% + \else + \ifdim\pgfarrowarc pt<90pt + \pgf@y\pgfarrowlength + \advance\pgf@y by-\pgfarrowlinewidth + \pgf@x\pgfmathresultx\pgf@y% + \else + \pgf@x\pgfmathresultx\pgfarrowlength% + \fi + \fi + \pgfarrowssetbackend{\pgf@x\ifpgfarrowroundcap\advance\pgf@x by-.5\pgfarrowlinewidth\fi} + % Adjust width and length: Take line thickness into account: + \advance\pgfarrowlength by-.5\pgfarrowlinewidth + \advance\pgfarrowwidth by-\pgfarrowlinewidth + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + \pgfarrowssave\pgfarrowarc + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + {% + \pgftransformxscale{+\pgfarrowlength} + \pgftransformyscale{+.5\pgfarrowwidth} + \pgfpathmoveto{\pgfpointpolar{+\pgfarrowarc}{+1pt}} + \ifpgfarrowharpoon + \pgfpatharc{+\pgfarrowarc}{0pt}{+1pt} + \else + \pgfpatharc{+\pgfarrowarc}{+-\pgfarrowarc}{+1pt} + \fi + } + \ifpgfarrowharpoon + \pgfpathlineto{\pgfqpoint{\pgfarrowlength\advance\pgf@x by\ifpgfarrowreversed\else-\fi.5\pgflinewidth}{0pt}} + \fi + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \pgfarrowarc,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowroundcap c\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + + + +% Tee Barb are barb arrows heads that look like a T + +\pgfdeclarearrow{ + name = Tee Barb, + defaults = { + length = +1.5pt 2, + width = +3pt 4, + inset' = +0pt .5, + line width = +0pt 1 1, + }, + bending mode=polar, + setup code = { + % 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% + \pgfutil@tempdimb-\pgfarrowinset\ifdim\pgfutil@tempdimb>-.5\pgfarrowlinewidth\pgfutil@tempdimb-.5\pgfarrowlinewidth\pgfutil@tempswbtrue\fi + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowwidth + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + % Infos: + \pgfarrowssettipend{\pgfutil@tempdima\ifpgfarrowroundcap\ifpgfutil@tempswa\else\advance\pgf@x by.5\pgfarrowlinewidth\fi\fi} + \pgfarrowssetvisualbackend{.5\pgfarrowlinewidth} + \pgfarrowssetbackend{\pgfutil@tempdimb\ifpgfarrowroundcap\ifpgfutil@tempswb\else\advance\pgf@x by-.5\pgfarrowlinewidth\fi\fi} + \pgfarrowssetlineend{\ifpgfarrowreversed\else-\fi.25\pgfarrowlinewidth}% + % The hull: + \pgfarrowsupperhullpoint{\pgfutil@tempdima\ifpgfarrowroundcap\ifpgfutil@tempswa\else\advance\pgf@x by.5\pgfarrowlinewidth\fi\fi}{.5\pgfarrowwidth}% + \pgfarrowsupperhullpoint{\pgfutil@tempdimb\ifpgfarrowroundcap\ifpgfutil@tempswb\else\advance\pgf@x by-.5\pgfarrowlinewidth\fi\fi}{.5\pgfarrowwidth}% + \ifpgfarrowharpoon + \pgfarrowshullpoint{.5\pgfarrowlinewidth}{-.5\pgfarrowlinewidth}% + \fi + }, + drawing code = { + \pgfsetdash{}{+0pt} + \pgf@yc\pgflinewidth% save... + \ifdim\pgflinewidth=\pgfarrowlinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \pgf@x\pgfutil@tempdima\advance\pgf@x by-.5\pgfarrowlinewidth% + \pgf@y\pgfutil@tempdimb\advance\pgf@y by.5\pgfarrowlinewidth% + % Case 1: No bar atop the I: + \ifdim\pgf@x=\pgf@y% + \pgfpathmoveto{\pgfqpoint{0pt}{.5\pgfarrowwidth}} + \pgfpathlineto{\pgfqpoint{0pt}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else-.5\pgfarrowwidth\fi}} + \else + % Case 2: Bar, but only in one direction: + \ifdim\pgfutil@tempdima=.5\pgfarrowlinewidth% + \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdimb}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{0pt}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \ifpgfarrowharpoon% + \pgfpathlineto{\pgfqpoint{0pt}{-.5\pgf@yc}}% + \else% + \pgfpathlineto{\pgfqpoint{0pt}{-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{\pgfutil@tempdimb}{-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}} + \fi + \else% Case 3: Complete I: + \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdimb}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{\pgfutil@tempdima}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \pgfpathmoveto{\pgfqpoint{0pt}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \ifpgfarrowharpoon% + \pgfpathlineto{\pgfqpoint{0pt}{-.5\pgf@yc}}% + \else% + \pgfpathlineto{\pgfqpoint{0pt}{-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}} + \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdimb}{-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{\pgfutil@tempdima}{-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth}} + \fi + \fi + \fi + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowwidth,% + \the\pgfarrowlength,% + \the\pgfarrowinset,% + \the\pgfarrowlinewidth,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowroundjoin j\fi% + \ifpgfarrowroundcap c\fi% + }, +} + + +% Math barbs that resemble \rightarrow in different fonts: + + + +% 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. + +\pgfdeclarearrow{ + name = Classical TikZ Rightarrow, + defaults = { + length = +1.05pt 1.925, + width' = +0pt 1.9237, + line width = 0pt 0.8 1, + round + }, + setup code = + { + \ifpgfarrowharpoon\pgfarrowroundjointrue\fi + % inner length: + \pgfutil@tempdima\pgfarrowlength + \advance\pgfutil@tempdima by-\pgfarrowlinewidth + \pgfutil@tempdimb\pgfarrowwidth + \advance\pgfutil@tempdimb by-\pgfarrowlinewidth + \ifpgfarrowroundjoin% + \else% + \pgfmathdivide@\pgfutil@tempdima\pgfutil@tempdimb% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x40.96\pgf@x% + \advance\pgf@x by1pt% \pgflinewidth^2 + (6.4 \pgftempdim@a / \pgfutil@tempdimb) \pgflinewidth^2 + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter + \pgf@xc.5\pgf@xc + \fi% + % The following are needed in the code: + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + % The extend: + \pgfarrowssettipend{\pgfutil@tempdima\ifpgfarrowroundjoin\advance\pgf@x by.5\pgfarrowlinewidth\else\advance\pgf@x by\pgf@xc\fi}% + \pgfarrowssetvisualbackend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth}% + \ifpgfarrowreversed% + \ifpgfarrowharpoon% + % A reversed arrow needs a slightly different line end: + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by.5\pgflinewidth}% + \else% + % A reversed arrow needs a slightly different line end: + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by-.25\pgflinewidth}% + \fi% + \else% + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by-.6\pgflinewidth}% + \fi% + \pgfarrowssetbackend{-.5\pgfarrowlinewidth}% + % The hull: + % Tip: + \pgfarrowshullpoint{\pgfutil@tempdima\ifpgfarrowroundjoin\advance\pgf@x by.5\pgfarrowlinewidth\else\advance\pgf@x by\pgf@xc\fi}{.5\pgfarrowlinewidth}% + \pgfarrowshullpoint{\pgfutil@tempdima\ifpgfarrowroundjoin\advance\pgf@x by.5\pgfarrowlinewidth\else\advance\pgf@x by\pgf@xc\fi}{-.5\pgfarrowlinewidth}% + % Upper end: + \pgfarrowsupperhullpoint{.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by.5\pgfarrowlinewidth}% + \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{-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by-.5\pgflinewidth}% + \fi + }, + drawing code = + { + \pgfsetdash{}{+0pt} + \edef\pgf@orig@linewidth{\the\pgflinewidth} + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \ifpgfarrowharpoon\pgfarrowroundjointrue\fi + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \pgfpathmoveto + {\pgfqpoint{0pt}{.5\pgfutil@tempdimb}} + \ifpgfarrowharpoon + \pgf@arrows@old@tikz@harpoon + \else + \pgfpathcurveto + {\pgfqpoint{0.066666\pgfutil@tempdima}{0.3125\pgfutil@tempdimb}} + {\pgfqpoint{.8\pgfutil@tempdima}{0.03125\pgfutil@tempdimb}} + {\pgfqpoint{\pgfutil@tempdima}{0pt}} + \pgfpathcurveto + {\pgfqpoint{.8\pgfutil@tempdima}{-.03125\pgfutil@tempdimb}} + {\pgfqpoint{0.066666\pgfutil@tempdima}{-.3125\pgfutil@tempdimb}} + {\pgfqpoint{0pt}{-.5\pgfutil@tempdimb}} + \pgfsetlinewidth{+\pgfarrowlinewidth} + \pgfusepathqstroke + \fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowroundjoin j\fi% + \ifpgfarrowroundcap c\fi% + }, +} + +\def\pgf@arrows@old@tikz@harpoon{ + \ifpgfarrowreversed + \pgf@arrows@old@tikz@harpoon@reversed + \else + \pgfpathcurveto + {\pgfqpoint{0.066666\pgfutil@tempdima}{0.3125\pgfutil@tempdimb}} + {\pgfqpoint{.8\pgfutil@tempdima}{0.03125\pgfutil@tempdimb}} + {\pgfqpoint{\pgfutil@tempdima}{0pt}} + \pgfpathcurveto + {\pgfqpoint{0.95\pgfutil@tempdima}{-0.125\pgflinewidth}} + {\pgfqpoint{0.933333\pgfutil@tempdima}{-0.125\pgflinewidth}} + {\pgfqpoint{0.933333\pgfutil@tempdima}{-0.125\pgflinewidth}} + \pgfpathlineto + {\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}} + {\pgfqpoint{.8\pgfutil@tempdima}{0.03125\pgfutil@tempdimb}} + {\pgfqpoint{\pgfutil@tempdima}{0.125\pgflinewidth}} + \pgfpathmoveto + {\pgfqpoint{0pt}{.5\pgfutil@tempdimb}} + \pgfpathcurveto + {\pgfqpoint{0.066666\pgfutil@tempdima}{0.3125\pgfutil@tempdimb}} + {\pgfqpoint{.8\pgfutil@tempdima}{0.03125\pgfutil@tempdimb}} + {\pgfqpoint{\pgfutil@tempdima}{-0.125\pgflinewidth}} + \pgfusepathqstroke + \pgfsetlinewidth{+\pgf@orig@linewidth} + \pgfsetroundcap + \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 +% heads. This would be a better version of "to", so consider saying +% to/.tips=Computer Modern Rightarrow + +\pgfdeclarearrow{ + name = Computer Modern Rightarrow, + defaults = { + length = +1.6pt 2.2, % 0pt 5.2 + width' = +0pt 2.096774, + line width = 0pt 1 1, + round + }, + setup code = + { + % inner length: + \pgfutil@tempdima\pgfarrowlength + \advance\pgfutil@tempdima by-\pgfarrowlinewidth + \pgfutil@tempdimb\pgfarrowwidth + \advance\pgfutil@tempdimb by-\pgfarrowlinewidth + % The following are needed in the code: + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + % Front miter: + \ifpgfarrowroundjoin% + \else% + \pgfmathdivide@\pgfutil@tempdima\pgfutil@tempdimb% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x49.44662\pgf@x% + \advance\pgf@x by1pt% \pgfarrowlinewidth^2 + (0.41019/0.0583333 \pgftempdim@a / \pgfutil@tempdimb) \pgfarrowlinewidth^2 + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter + \pgf@xc.5\pgf@xc + \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter + \pgf@xa3.51591\pgf@xa% xa is extra harpoon miter + \fi% + % The extend: + \pgfarrowssettipend{\ifpgfarrowroundjoin.5\pgfarrowlinewidth\else\pgf@xc\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}% + \pgfarrowssetvisualbackend{.5\pgfarrowlinewidth}% + \ifpgfarrowreversed% + \ifpgfarrowharpoon% + \pgfarrowssetlineend{.5\pgfarrowlinewidth}% + \else% + \pgfarrowssetlineend{-.5\pgfarrowlinewidth}% + \fi% + \else% + \pgfarrowssetlineend{-.5\pgfarrowlinewidth}% + \fi% + \pgfarrowssetbackend{-\pgfutil@tempdima\advance\pgf@x by-.5\pgfarrowlinewidth}% + % The hull: + % Tip: + \pgfarrowshullpoint{\ifpgfarrowroundjoin.5\pgfarrowlinewidth\else\pgf@xc\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{.5\pgfarrowlinewidth}% + \pgfarrowshullpoint{\ifpgfarrowroundjoin.5\pgfarrowlinewidth\else\pgf@xc\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{-.5\pgfarrowlinewidth}% + % Upper end: + \pgfarrowsupperhullpoint{-\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by.5\pgfarrowlinewidth}% + \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{-\pgfutil@tempdima\advance\pgf@x by-.5\pgfarrowlinewidth}{.5\pgfutil@tempdimb\advance\pgf@y by-.5\pgfarrowlinewidth}% + \fi + }, + drawing code = + { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \pgfpathmoveto + {\pgfqpoint{-\pgfutil@tempdima}{.5\pgfutil@tempdimb}} + \pgfpathcurveto + {\pgfqpoint{-0.81731\pgfutil@tempdima}{.2\pgfutil@tempdimb}} + {\pgfqpoint{-0.41019\pgfutil@tempdima}{0.05833333\pgfutil@tempdimb}} + {\pgfpointorigin} + \ifpgfarrowharpoon + \pgfpathlineto + {\pgfqpoint{\ifpgfarrowreversed.5\else-\fi\pgfarrowlinewidth}{0pt}} + \else + \pgfpathcurveto + {\pgfqpoint{-0.41019\pgfutil@tempdima}{-0.05833333\pgfutil@tempdimb}} + {\pgfqpoint{-0.81731\pgfutil@tempdima}{-.2\pgfutil@tempdimb}} + {\pgfqpoint{-\pgfutil@tempdima}{-.5\pgfutil@tempdimb}} + \fi + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi + \ifpgfarrowharpoon r\fi + \ifpgfarrowroundjoin j\fi% + \ifpgfarrowroundcap c\fi% + }, +} + + + +% The arrow tip of an \implies arrow, to be used with an inner +% line. Cannot be configured otherwise. + +\pgfdeclarearrow{ + name = Implies, + setup code = { + \pgf@xa\pgfinnerlinewidth + \pgfutil@tempdima.25\pgflinewidth + \advance\pgfutil@tempdima by.25\pgf@xa% + \pgfutil@tempdimb.5\pgflinewidth + \advance\pgfutil@tempdimb by-.5\pgf@xa% + \pgfarrowssettipend{2.06\pgfutil@tempdima\advance\pgf@x by.5\pgfutil@tempdimb} + \pgfarrowssetbackend{-1.36\pgfutil@tempdima\advance\pgf@x by.5\pgfutil@tempdimb} + \pgfarrowsupperhullpoint{-1.4\pgfutil@tempdima}{2.8\pgfutil@tempdima} + \pgfarrowsupperhullpoint{2\pgfutil@tempdima}{.5\pgfutil@tempdimb} + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + }, + drawing code = { + \pgftransformxshift{.06\pgfutil@tempdima} + \pgfsetlinewidth{\pgfutil@tempdimb} + \pgfsetdash{}{+0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{-1.4\pgfutil@tempdima}{2.65\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfpoint{-0.75\pgfutil@tempdima}{1.25\pgfutil@tempdima}} + {\pgfpoint{1\pgfutil@tempdima}{0.05\pgfutil@tempdima}} + {\pgfpoint{2\pgfutil@tempdima}{0pt}} + \pgfpathcurveto + {\pgfpoint{1\pgfutil@tempdima}{-0.05\pgfutil@tempdima}} + {\pgfpoint{-.75\pgfutil@tempdima}{-1.25\pgfutil@tempdima}} + {\pgfpoint{-1.4\pgfutil@tempdima}{-2.65\pgfutil@tempdima}} + \pgfusepathqstroke + }, + parameters = {\the\pgfarrowlength} +} + + + + +% +% +% Geomatric 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. + +\pgfdeclarearrow{ + name = Latex, + defaults = { + length = +3pt 4.5 .8,% +2.8pt 3 0.8, + width' = +0pt .75, + line width = +0pt 1 1, + }, + setup code = { + % Cap the line width at 1/4th distance from inset to tip + \pgf@x.2\pgfarrowlength + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + \pgfarrowssavethe\pgfarrowlinewidth% + % Compute front miter length: + \pgfmathdivide@\pgfarrowlength\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x9\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% + \pgf@xa\pgf@temp@quot\pgfarrowlinewidth + % Inner length (pgfutil@tempdima) is now arrowlength - front miter + % - 0.5 linewidth (back thickness) + \pgfutil@tempdima\pgfarrowlength% + \advance\pgfutil@tempdima by-.5\pgf@xc% + \advance\pgfutil@tempdima by-.5\pgfarrowlinewidth% + % harpoon miter correction + \pgfarrowssetbackend{-.5\pgfarrowlinewidth} + \ifpgfarrowreversed + \ifdim\pgfinnerlinewidth>0pt + \pgfarrowssetlineend{0pt} + \else + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by-.5\pgflinewidth} + \fi + \else + \pgfarrowssetlineend{0pt} + \fi + \ifpgfarrowroundjoin + \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 + % The following are needed in the code: + \pgfarrowssavethe\pgfutil@tempdima + % Now, compute back tip miter limit: + \pgf@process{\pgfpointnormalised{\pgfqpoint{.3\pgfarrowlength}{.2333333\pgfarrowwidth}}}% + \advance\pgf@y by1pt% + \pgf@yc\pgf@y\pgf@xc\pgf@x% + \pgfmathdivide@\pgf@yc\pgf@xc% + \pgfutil@tempdimb\pgfmathresult\pgfarrowlinewidth% + \pgfutil@tempdimb-.5\pgfutil@tempdimb% + \advance\pgfutil@tempdimb by.5\pgfarrowwidth% + \pgfarrowssavethe\pgfutil@tempdimb% + % The hull: + \pgfarrowshullpoint{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth\ifpgfarrowroundjoin\else\ifpgfarrowharpoon\advance\pgf@x by1.5\pgf@xa\fi\fi}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}% + \pgfarrowshullpoint{-.5\pgfarrowlinewidth}{.5\pgfarrowwidth\ifpgfarrowharpoon\advance\pgf@y by-.5\pgfarrowlinewidth\fi}% + \pgfarrowshullpoint{-.5\pgfarrowlinewidth}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else-.5\pgfarrowwidth\fi}% + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \pgfpathmoveto {\pgfqpoint{\pgfutil@tempdima}{0pt}} + \pgfpathcurveto {\pgfqpoint{.877192\pgfutil@tempdima}{.077922\pgfutil@tempdimb}} + {\pgfqpoint{.337381\pgfutil@tempdima}{.519480\pgfutil@tempdimb}} + {\pgfqpoint{0pt}{\pgfutil@tempdimb}} + \ifpgfarrowharpoon + \pgfpathlineto {\pgfpointorigin} + \else + \pgfpathlineto {\pgfqpoint{0pt}{-\pgfutil@tempdimb}} + \pgfpathcurveto {\pgfqpoint{.337381\pgfutil@tempdima}{-.519480\pgfutil@tempdimb}} + {\pgfqpoint{.877192\pgfutil@tempdima}{-.077922\pgfutil@tempdimb}} + {\pgfqpoint{\pgfutil@tempdima}{0pt}} + \fi + \pgfpathclose + \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + + + +% A basic stealth-fighter-like pointed arrow + +\pgfdeclarearrow{ + name = Stealth, + defaults = { + length = +3pt 4.5 .8, + width' = +0pt .75, + inset' = +0pt 0.325, + line width = +0pt 1 1, + }, + setup code = { + % Cap the line width at 1/4th distance from inset to tip + \pgf@x\pgfarrowlength + \advance\pgf@x by-\pgfarrowinset + \pgf@x.25\pgf@x + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + % Compute front miter length: + \pgfmathdivide@\pgfarrowlength\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x4\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter + \pgf@xc.5\pgf@xc + \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter + % Compute back miter length: + \pgf@ya.5\pgfarrowwidth% + \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowlength}{\pgfmath@tonumber\pgf@ya}% + \pgf@yb\pgfmathresult pt% + \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowinset}{\pgfmath@tonumber\pgf@ya}% + \pgf@ya\pgfmathresult pt% + \advance\pgf@yb by-\pgf@ya% + \pgf@yb.5\pgf@yb% half angle in yb + \pgfmathtan@{\pgf@yb}% + \pgfmathreciprocal@{\pgfmathresult}% + \pgf@yc\pgfmathresult\pgfarrowlinewidth% + \pgf@yc.5\pgf@yc% + \advance\pgf@ya by\pgf@yb% + \pgfmathsincos@{\pgf@ya}% + \pgf@ya\pgfmathresulty\pgf@yc% ya is the back miter + \pgf@yb\pgfmathresultx\pgf@yc% yb is the top miter + \ifdim\pgfarrowinset=0pt% + \pgf@ya.5\pgfarrowlinewidth% easy: back miter is half linewidth + \fi + % Compute inset miter length: + \pgfmathdivide@\pgfarrowinset\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x4\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is inset miter + \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% + \advance\pgfutil@tempdima by-\pgf@ya% + \pgfutil@tempdimb.5\pgfarrowwidth% + \advance\pgfutil@tempdimb by-\pgf@yb% + % harpoon miter correction + \ifpgfarrowroundjoin + \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} + \else + \pgfarrowssetbackend{0pt} + \fi + \ifpgfarrowharpoon + \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x + by\pgf@yc\advance\pgf@x by.5\pgfarrowlinewidth} + \else + \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x by\pgf@yc\advance\pgf@x by-.25\pgfarrowlinewidth} + \ifpgfarrowreversed + \ifdim\pgfinnerlinewidth>0pt + \pgfarrowssetlineend{\pgfarrowinset} + \else + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by-.25\pgfarrowlinewidth} + \fi + \fi + \fi + \ifpgfarrowroundjoin + \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 + % The hull: + \pgfarrowshullpoint{\pgfarrowlength\ifpgfarrowroundjoin\else\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}% + \pgfarrowsupperhullpoint{0pt}{.5\pgfarrowwidth}% + \pgfarrowshullpoint{\pgfarrowinset}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else 0pt\fi}% + % Adjust inset + \pgfarrowssetvisualbackend{\pgfarrowinset} + \advance\pgfarrowinset by\pgf@yc% + % The following are needed in the code: + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgf@ya + \pgfarrowssavethe\pgfarrowinset + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima\advance\pgf@x by\pgf@ya}{0pt}} + \pgfpathlineto{\pgfqpoint{\pgf@ya}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfqpoint{\pgfarrowinset}{0pt}} + \ifpgfarrowharpoon \else + \pgfpathlineto{\pgfqpoint{\pgf@ya}{-\pgfutil@tempdimb}} + \fi + \pgfpathclose + \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \the\pgfarrowinset,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + + + +% A Kite is like a Stealth, only the inset counts in the other direction + +\pgfdeclarearrow{ + name = Kite, + defaults = { + length = +3.6pt +5.4, + width' = +0pt +0.5, + inset' = +0pt 0.25, + line width = +0pt 1 1, + }, + setup code = { + % Cap the line width at 1/4th of the length + \pgf@x.4\pgfarrowlength + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + \pgf@x.4\pgfarrowwidth + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + % Compute front miter length: + \pgf@xa\pgfarrowlength% + \advance\pgf@xa by-\pgfarrowinset% + \pgfmathdivide@\pgf@xa\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x4\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter + \pgf@xc.5\pgf@xc + \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter + % Compute back miter length: + \pgfmathdivide@\pgfarrowinset\pgfarrowwidth% + \let\pgf@temp@quot\pgfmathresult% + \pgf@x\pgfmathresult pt% + \pgf@x\pgfmathresult\pgf@x% + \pgf@x4\pgf@x% + \advance\pgf@x by1pt% + \pgfmathsqrt@\pgf@x% + \pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is back miter + \pgf@yc.5\pgf@yc + \pgf@ya\pgf@temp@quot\pgfarrowlinewidth% ya is extra harpoon miter + % Compute top miter length: + {% + \pgfutil@tempdimb.5\pgfarrowwidth% + \pgfutil@tempdima\pgfarrowlength\advance\pgfutil@tempdima by-\pgfarrowinset% + \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfutil@tempdima}{\pgfmath@tonumber\pgfutil@tempdimb}% + \pgf@yb\pgfmathresult pt% + \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowinset}{\pgfmath@tonumber\pgfutil@tempdimb}% + \pgf@ya\pgfmathresult pt% + \advance\pgf@yb by\pgf@ya% + \pgf@yb.5\pgf@yb% half angle in yb + \ifdim\pgf@yb=45pt% + \def\pgfmathresult{1.414213}% + \else% + \pgfmathsin@{\pgf@yb}% + \pgfmathreciprocal@{\pgfmathresult}% + \fi% + \pgf@yc\pgfmathresult\pgfarrowlinewidth% + \pgf@yc.5\pgf@yc% + \pgf@ya-\pgf@ya% + \advance\pgf@ya by-90pt% + \advance\pgf@ya by\pgf@yb% + \pgfmathsincos@{\pgf@ya}% + \pgf@xb\pgfmathresultx\pgf@yc% ya is the back miter + \pgf@yb\pgfmathresulty\pgf@yc% yb is the top miter + \expandafter\expandafter\expandafter% + }\expandafter\expandafter\expandafter\pgf@xb\expandafter\the\expandafter\pgf@xb\expandafter\pgf@yb\the\pgf@yb% + % Inner length (pgfutil@tempdima) is now arrowlength - front miter - back miter + \pgfutil@tempdima\pgfarrowlength% + \advance\pgfutil@tempdima by-\pgf@xc% + \pgfutil@tempdimb.5\pgfarrowwidth% + \advance\pgfutil@tempdimb by\pgf@yb% + % Set back end + \ifpgfarrowroundjoin + \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth} + \else + \pgfarrowssetbackend{0pt} + \fi + % harpoon miter correction + \ifpgfarrowreversed + \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by-\pgflinewidth\advance\pgf@x by\pgfarrowlinewidth} + \else + \pgfarrowssetlineend{\pgf@yc\advance\pgf@x by\pgflinewidth\advance\pgf@x by-\pgfarrowlinewidth} + \fi + \ifpgfarrowroundjoin + \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by.5\pgfarrowlinewidth} + \else + \pgfarrowssettipend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi} + \fi + % The hull: + \pgfarrowshullpoint{\pgfarrowlength\ifpgfarrowroundjoin\else\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}% + \pgfarrowsupperhullpoint{\pgfarrowinset}{.5\pgfarrowwidth}% + \pgfarrowshullpoint{0pt}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}% + % Adjust the inset: + \advance\pgfarrowinset by\pgf@xb% + % The following are needed in the code: + \pgfarrowssavethe\pgfutil@tempdima + \pgfarrowssavethe\pgfutil@tempdimb + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgf@yc + \pgfarrowssavethe\pgfarrowinset + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{\pgfarrowlinewidth}\fi + \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima}{0pt}} + \pgfpathlineto{\pgfqpoint{\pgfarrowinset}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfqpoint{\pgf@yc}{0pt}} + \ifpgfarrowharpoon \else + \pgfpathlineto{\pgfqpoint{\pgfarrowinset}{-\pgfutil@tempdimb}} + \fi + \pgfpathclose + \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \the\pgfarrowinset,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + + + + +% A simple rectangle shape + +\pgfdeclarearrow{ + name = Square, + defaults = { + length = +2.12132pt +2.828427, + width' = +0pt +1, + line width = +0pt +1 +1, + }, + setup code = { + % Cap the line width at 1/2th of the length + \pgf@x.5\pgfarrowlength + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + \ifpgfarrowreversed + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth} + \else + \pgfarrowssetlineend{.5\pgfarrowlinewidth} + \fi + \pgfarrowssettipend{\pgfarrowlength} + % The hull: + \pgfarrowshullpoint{\pgfarrowlength}{.5\pgfarrowwidth} + \pgfarrowshullpoint{0pt}{.5\pgfarrowwidth} + \pgfarrowshullpoint{\pgfarrowlength}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else-.5\pgfarrowwidth\fi} + \pgfarrowshullpoint{0pt}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else-.5\pgfarrowwidth\fi} + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \pgfpathmoveto{\pgfqpoint{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{.5\pgfarrowlinewidth}{.5\pgfarrowwidth\advance\pgf@y by-.5\pgfarrowlinewidth}} + \pgfpathlineto{\pgfqpoint{.5\pgfarrowlinewidth}{\ifpgfarrowharpoon0pt\else-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth\fi}} + \pgfpathlineto{\pgfqpoint{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth}{\ifpgfarrowharpoon0pt\else-.5\pgfarrowwidth\advance\pgf@y by.5\pgfarrowlinewidth\fi}} + \pgfpathclose + \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + + +% A simple rectangle shape + +\pgfdeclarearrow{ + name = Circle, + defaults = { + length = +2.39365pt +3.191538, + width' = +0pt 1, + line width = +0pt 1 1, + }, + setup code = { + % Cap the line width at 1/2th of the length + \pgf@x.5\pgfarrowlength + \ifdim\pgf@x<\pgfarrowlinewidth + \pgfarrowlinewidth\pgf@x + \fi + \ifpgfarrowreversed + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by-.5\pgfarrowlinewidth} + \else + \pgfarrowssetlineend{.5\pgfarrowlinewidth} + \fi + \pgfarrowssettipend{\pgfarrowlength} + % The hull: + \pgfarrowsupperhullpoint{\pgfarrowlength}{.25\pgfarrowwidth} + \pgfarrowsupperhullpoint{.75\pgfarrowlength}{.5\pgfarrowwidth} + \pgfarrowsupperhullpoint{.25\pgfarrowlength}{.5\pgfarrowwidth} + \pgfarrowsupperhullpoint{0pt}{.25\pgfarrowwidth} + \ifpgfarrowharpoon% + \pgfarrowshullpoint{0pt}{-.5\pgfarrowlinewidth} + \pgfarrowshullpoint{\pgfarrowlength}{-.5\pgfarrowlinewidth} + \fi% + % The following are needed in the code: + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + \ifpgfarrowharpoon + \pgfpathmoveto{\pgfqpoint{\pgfarrowlength\advance\pgf@x + by-.5\pgfarrowlinewidth}{0pt}} + {% + \pgf@xa.5\pgfarrowlength + \advance\pgf@xa by-.5\pgfarrowlinewidth + \pgftransformxscale{+\the\pgf@xa} + \pgf@xa.5\pgfarrowwidth + \advance\pgf@xa by-.5\pgfarrowlinewidth + \pgftransformyscale{+\the\pgf@xa} + \pgfpatharc{0}{180}{1pt} + } + \pgfpathclose + \else% + \pgfpathellipse{\pgfqpoint{.5\pgfarrowlength}{0pt}}{\pgfqpoint{.5\pgfarrowlength\advance\pgf@x + by-.5\pgfarrowlinewidth}{0pt}}{\pgfqpoint{0pt}{.5\pgfarrowwidth\advance\pgf@y + by-.5\pgfarrowlinewidth}} + \fi + \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi% + }, +} + +% Round cap + +\pgfdeclarearrow{ + name = Round Cap, + defaults = { + length = +0pt .5 + }, + setup code = { + \ifpgfarrowreversed + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by.5\pgflinewidth} + \else + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetlineend{-.5\pgflinewidth} + \fi + \pgfarrowssavethe\pgfarrowlength + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowsupperhullpoint{\pgfarrowlength}{.5\pgflinewidth} + }, + drawing code = { + \ifpgfarrowreversed + \pgftransformxscale{-1} + \pgftransformxshift{-\pgfarrowlength} + \fi + \pgfutil@tempdima.5\pgflinewidth + \pgfpathmoveto {\pgfqpoint{-0.75\pgflinewidth}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \ifpgfarrowreversed + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{\pgfutil@tempdima}} + \begingroup + \pgftransformxshift{\pgfarrowlength} + \pgftransformxscale{-1} + \fi + \pgfpathcurveto {\pgfqpoint{0.55228475\pgfarrowlength}{\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{0.55228475\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{0pt}} + \pgfpathcurveto {\pgfqpoint{\pgfarrowlength}{-0.55228475\pgfutil@tempdima}} + {\pgfqpoint{0.55228475\pgfarrowlength}{-\pgfutil@tempdima}} + {\pgfqpoint{0pt}{-\pgfutil@tempdima}} + \ifpgfarrowreversed + \endgroup + \fi + \pgfpathlineto {\pgfqpoint{-.75\pgflinewidth}{-\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill + }, + parameters = {\the\pgfarrowlength} +} + + + +\pgfdeclarearrow{ + name = Butt Cap, + defaults = { + length = +0pt .5 + }, + setup code = { + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetlineend{-.5\pgflinewidth} + \pgfarrowssavethe\pgfarrowlength + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowsupperhullpoint{\pgfarrowlength}{.5\pgflinewidth} + }, + drawing code = { + \pgfutil@tempdima.5\pgflinewidth + \pgfpathmoveto {\pgfqpoint{-0.75\pgflinewidth}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{-\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{-.75\pgflinewidth}{-\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill + }, + parameters = {\the\pgfarrowlength} +} + + + +\pgfkeys{ + /pgf/arrow keys/.cd, + cap angle/.code={% + \pgfmathsetlength\pgf@x{#1}% + \pgf@x.5\pgf@x + \pgfmathtan@{\pgf@x}% + \pgfmathreciprocal@{\pgfmathresult}% + \pgf@x\pgfmathresult pt% + \pgf@x.5\pgf@x% + \edef\pgf@marshal{\noexpand\pgfarrowsaddtooptions{\noexpand\pgfarrowslinewidthdependent{+0pt}{\pgf@sys@tonumber\pgf@x}{0}\pgfarrowlength\pgf@x}} + \pgf@marshal + } +} + + +\pgfdeclarearrow{ + name = Triangle Cap, + defaults = { + length = +0pt .5 + }, + setup code = { + \ifpgfarrowreversed + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by.5\pgflinewidth} + \else + \pgfarrowssettipend{\pgfarrowlength} + \pgfarrowssetlineend{-.5\pgflinewidth} + \fi + \pgfarrowssavethe\pgfarrowlength + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowshullpoint{\pgfarrowlength}{0pt} + }, + drawing code = { + \ifpgfarrowreversed + \pgftransformxscale{-1} + \pgftransformxshift{-\pgfarrowlength} + \fi + \pgfutil@tempdima.5\pgflinewidth + \pgfpathmoveto {\pgfqpoint{-0.75\pgflinewidth}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \ifpgfarrowreversed + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{\pgfutil@tempdima}} + \begingroup + \pgftransformxshift{\pgfarrowlength} + \pgftransformxscale{-1} + \fi + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{0pt}} + \ifpgfarrowreversed + \endgroup + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{-\pgfutil@tempdima}} + \fi + \pgfpathlineto {\pgfqpoint{0pt}{-\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{-.75\pgflinewidth}{-\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill + }, + parameters = {\the\pgfarrowlength} +} + + + +\pgfdeclarearrow{ + name = Fast Triangle, + defaults = { + length = +0pt .5, + inset = +0pt .5, + }, + setup code = { + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by\pgfarrowinset} + \ifpgfarrowreversed\pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by\pgfarrowinset}\fi + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowinset + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowsupperhullpoint{\pgfarrowinset}{.5\pgflinewidth} + \pgfarrowshullpoint{\pgfarrowlength\advance\pgf@x by\pgfarrowinset}{0pt} + }, + drawing code = { + \pgfutil@tempdima.5\pgflinewidth + \pgfpathmoveto {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowinset}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowinset\advance\pgf@x by\pgfarrowlength}{0pt}} + \pgfpathlineto {\pgfqpoint{\pgfarrowinset}{-\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{0pt}{-\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowlength}{0pt}} + \pgfpathclose + \pgfusepathqfill + }, + parameters = {\the\pgfarrowlength,\the\pgfarrowinset} +} + + +\pgfdeclarearrow{ + name = Fast Round, + defaults = { + length = +0pt .5, + inset = +0pt .5, + }, + setup code = { + \pgfarrowssettipend{\pgfarrowlength\advance\pgf@x by\pgfarrowinset} + \ifpgfarrowreversed\pgfarrowssetlineend{\pgfarrowlength\advance\pgf@x by\pgfarrowinset}\fi + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowinset + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowsupperhullpoint{\pgfarrowlength\advance\pgf@x by\pgfarrowinset}{.5\pgflinewidth} + }, + drawing code = { + \pgfutil@tempdima.5\pgflinewidth + \pgfpathmoveto {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \pgfpathlineto {\pgfqpoint{\pgfarrowinset}{\pgfutil@tempdima}} + { + \pgftransformxshift{\pgfarrowinset} + \pgfpathcurveto{\pgfqpoint{0.55228475\pgfarrowlength}{\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{0.55228475\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{0pt}} + \pgfpathcurveto{\pgfqpoint{\pgfarrowlength}{-0.55228475\pgfutil@tempdima}} + {\pgfqpoint{0.55228475\pgfarrowlength}{-\pgfutil@tempdima}} + {\pgfqpoint{0pt}{-\pgfutil@tempdima}} + } + \pgfpathlineto {\pgfqpoint{0pt}{-\pgfutil@tempdima}} + \pgfpathcurveto {\pgfqpoint{0.55228475\pgfarrowlength}{-\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{-0.55228475\pgfutil@tempdima}} + {\pgfqpoint{\pgfarrowlength}{0pt}} + \pgfpathcurveto {\pgfqpoint{\pgfarrowlength}{0.55228475\pgfutil@tempdima}} + {\pgfqpoint{0.55228475\pgfarrowlength}{\pgfutil@tempdima}} + {\pgfqpoint{0pt}{\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill + }, + parameters = {\the\pgfarrowlength,\the\pgfarrowinset} +} + + + + +% +% +% Other arrow tips. +% +% + + +\pgfkeys{ + /pgf/arrow keys/.cd, + n/.code={% + \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} + +\pgfdeclarearrow{ + name = Rays, + defaults = { + length = +3pt 4, + width' = +0pt 1, + line width = +0pt 1 1, + }, + setup code = { + \pgfmathdivide@{360}{\pgfarrown}% + \let\pgfarrow@inc\pgfmathresult% + % Compute tips: + \pgf@xa\pgfarrow@inc pt% + \ifodd\pgfarrown\pgf@ya.25\pgf@xa\else\pgf@ya.5\pgf@xa\fi% + \pgfmathsincos@\pgf@ya% + \pgf@x.5\pgfarrowlength% + \pgf@xa\pgfmathresultx\pgf@x% + \ifpgfarrowroundcap + \advance\pgf@xa by.5\pgfarrowlinewidth + \else + \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgfmathresultx\pgfarrowlength}{\pgfmathresulty\pgfarrowwidth}}}% + \pgf@x.5\pgfarrowlinewidth% + \advance\pgf@xa by\pgf@sys@tonumber{\pgf@y}\pgf@x% + \fi% + \pgfarrowssettipend{\pgf@xa} + \pgfarrowssetbackend{-\pgf@xa} + % Hull is alwyas 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} + \pgfarrowsupperhullpoint{-.25\pgfarrowlength}{.5\pgfarrowwidth\ifpgfarrowroundcap\advance\pgf@y by.5\pgfarrowlinewidth\fi} + \pgfarrowsupperhullpoint{-\pgf@xa}{.25\pgfarrowwidth} + \ifpgfarrowharpoon + \pgfarrowshullpoint{-.5\pgfarrowlength\ifpgfarrowroundcap\advance\pgf@x by-.5\pgfarrowlinewidth\fi}{-.5\pgfarrowlinewidth} + \pgfarrowshullpoint{.5\pgfarrowlength\ifpgfarrowroundcap\advance\pgf@x by.5\pgfarrowlinewidth\fi}{-.5\pgfarrowlinewidth} + \fi + \pgfarrowssavethe\pgfarrowlinewidth + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + \pgfarrowssave\pgfarrow@inc + \pgfarrowssave\pgfarrown + }, + drawing code = { + \pgfsetdash{}{+0pt} + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi + {% + \pgfgettransform\pgf@temp@trans + \pgftransformxscale{+.5\pgfarrowlength} + \pgftransformyscale{+.5\pgfarrowwidth} + \pgf@xa\pgfarrow@inc pt% + \ifodd\pgfarrown\pgf@ya.25\pgf@xa\else\pgf@ya.5\pgf@xa\fi% + \ifpgfarrowharpoon\pgf@yb180pt\else\pgf@yb360pt\fi + \pgfutil@loop% + \ifdim\pgf@ya<\pgf@yb% + \pgfpathmoveto{\pgfpointpolar{+\pgf@ya}{+1pt}} + \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% + } + \pgfusepathqstroke + }, + parameters = { + \the\pgfarrowlinewidth,% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \pgfarrown,% + \ifpgfarrowharpoon h\fi% + \ifpgfarrowroundcap c\fi% + } +} + + + +% Shorthands and Aliases: + +\pgfkeys{ + LaTeX /.tip = {Latex}, + Triangle /.tip = {Stealth[inset=+0pt, angle=+60:+2.7pt +3.6]}, + Rectangle /.tip = {Square[length=+3pt +4.5,width'=+0pt +.5]}, + Ellipse /.tip = {Circle[length=+3.3pt +4.95, width'=+0pt +0.5]}, + Diamond /.tip = {Kite[inset'=+0pt .5]}, + Turned Square /.tip = {Kite[length=+3pt 4,width'= +0pt 1,inset'= +0pt 0.5]}, + To /.tip = {Computer Modern Rightarrow}, + 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]} +} + + + + +\endinput 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 new file mode 100644 index 00000000000..b6d1728363d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex @@ -0,0 +1,92 @@ +% Copyright 2012 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.spaced.code.tex,v 1.3 2013/09/23 18:04:36 tantau Exp $ + + +\usepgflibrary{arrows} + + +% This library offers "spaced" versions of existing arrows, where a +% bit of additional space is inserted at the tip. This often looks +% better than the normal arrow. +% +% These arrows are called "spaced whatever" where "whatever" is the +% 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} + +\pgfdeclarearrow{ + name = spaced [-spaced ], + means = square bracket[].space +} + +\pgfdeclarearrow{ + name = spaced ]-spaced [, + means = square bracket[reversed].space +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex new file mode 100644 index 00000000000..18fa1951b05 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarycurvilinear.code.tex @@ -0,0 +1,378 @@ +% Copyright 2013 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarycurvilinear.code.tex,v 1.3 2013/10/07 15:51:46 tantau Exp $ + +% +% This file defines commands for computing points in curvilinear +% coordinate systems. +% + + +% +% Curvilinear coordinate systems defined in terms of a Bezier curve. +% +% For the following coordinate systems, you must first provide a +% Bezier curve (using, as always, four points), which will be set for +% the current scope. When the curve is "installed" some expensive +% precomputations are done; subsequent calls to +% \pgfpointcurvilinearxxx based on this Bezier curve will be +% relatively quick. +% + + + +% Install a Bezier curve +% +% #1 = start point +% #2 = first control point +% #3 = second control point +% #4 = end point +% +% Description: +% +% Subsequent calls to functions like +% \pgfpointcurvilinearbezierorthogonal will be relative to the curve +% installed using this command. The main job of this macro is a +% precomputation for computing length along the curve. +% All lengths along the Bezier curve are approximated using a lookup table +% of four time/length points. For this, an approximate time for length +% 1pt is computed first, and then the length for twice this time, four +% times this time, and eight times this time are approximated. A +% distance-to-time conversion is then done by a linear interpolation +% of distance-to-time for these four points. Note that all of these +% computations are not particularly precise, but a compromise trading +% 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). +% +% Example: +% +% \pgfsetcurvilinearbeziercurve +% {\pgfpoint{0mm}{10mm}} +% {\pgfpoint{5.5mm}{10mm}} +% {\pgfpoint{10mm}{5.5mm}} +% {\pgfpoint{10mm}{0mm}} % nearly a quarter circle +% \pgfpointcurvilinearbezierorthogonal{5mm}{5mm} +% % should be 5mm along the circle, put at +% % distance 15mm from the origin (5mm from the circle line). + +\def\pgfsetcurvilinearbeziercurve#1#2#3#4{% + \pgf@process{#1}% + \edef\pgf@curvilinear@line@a{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@xa=-\pgf@x% + \pgf@ya=-\pgf@y% + \pgf@process{#2}% + \edef\pgf@curvilinear@line@b{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@xb=-\pgf@x% + \pgf@yb=-\pgf@y% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \let\pgf@curvilinear@lenab\pgfmathresult% + \pgf@process{#3}% + \edef\pgf@curvilinear@line@c{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@xc=-\pgf@x% + \pgf@yc=-\pgf@y% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \let\pgf@curvilinear@lenbc\pgfmathresult% + \pgf@process{#4}% + \edef\pgf@curvilinear@line@d{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \let\pgf@curvilinear@lencd\pgfmathresult + % + \pgf@x=\pgf@curvilinear@lenab pt% + \advance\pgf@x by\pgf@curvilinear@lenbc pt% + \advance\pgf@x by\pgf@curvilinear@lencd pt% + \pgfmathreciprocal@{\pgf@x}% + \pgf@curvilinear@time@a\pgfmathresult pt% + \pgf@process{\pgfpointcurveattime{\pgf@curvilinear@time@a}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}}% + \pgf@xb=-\pgf@x% + \pgf@yb=-\pgf@y% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \pgf@curvilinear@length@a\pgfmathresult pt% + \ifdim\pgf@curvilinear@length@a>1pt\relax% + % Ok, too large, let us make this smaller + \pgfmathdivide@{\pgf@curvilinear@time@a}{\pgf@curvilinear@length@a}% + \pgf@curvilinear@time@a\pgfmathresult pt% + \pgf@process{\pgfpointcurveattime{\pgf@curvilinear@time@a}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}} + \pgf@xb=-\pgf@x% + \pgf@yb=-\pgf@y% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \pgf@curvilinear@length@a\pgfmathresult pt% + \fi% + % Compute three positions: + \pgf@process{\pgfpointcurveattime{2\pgf@curvilinear@time@a}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}} + \pgf@xa=-\pgf@x% + \pgf@ya=-\pgf@y% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \pgf@curvilinear@length@b\pgfmathresult pt% + \advance\pgf@curvilinear@length@b by\pgf@curvilinear@length@a% + \pgf@process{\pgfpointcurveattime{4\pgf@curvilinear@time@a}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}} + \pgf@xb=-\pgf@x% + \pgf@yb=-\pgf@y% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \pgf@curvilinear@length@c\pgfmathresult pt% + \advance\pgf@curvilinear@length@c by\pgf@curvilinear@length@b% + \pgf@process{\pgfpointcurveattime{8\pgf@curvilinear@time@a}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}} + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \pgfmathveclen@{\pgf@x}{\pgf@y}% + \pgf@curvilinear@length@d\pgfmathresult pt% + \advance\pgf@curvilinear@length@d by\pgf@curvilinear@length@c% + \let\pgf@curvilinear@comp@a\pgf@curvilinear@comp@a@initial% + \let\pgf@curvilinear@comp@b\pgf@curvilinear@comp@b@initial% + \let\pgf@curvilinear@comp@c\pgf@curvilinear@comp@c@initial% + \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 +\newdimen\pgf@curvilinear@length@c +\newdimen\pgf@curvilinear@length@d + + +\def\pgf@curvilinear@comp@a@initial{% + \pgfmathdivide@\pgf@curvilinear@time@a\pgf@curvilinear@length@a% + \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% + \advance\pgf@y by-\pgf@curvilinear@length@a% + \pgfmathdivide@\pgf@curvilinear@time@a\pgf@y% + \let\pgf@curvilinear@quot@b\pgfmathresult% + \pgf@y\pgfmathresult\pgf@curvilinear@length@a% + \pgf@y-\pgf@y% + \advance\pgf@y by\pgf@curvilinear@time@a% + \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% + \advance\pgf@y by-\pgf@curvilinear@length@b% + \pgf@y.5\pgf@y% + \pgfmathdivide@\pgf@curvilinear@time@a\pgf@y% + \let\pgf@curvilinear@quot@c\pgfmathresult% + \pgf@y\pgf@curvilinear@quot@c\pgf@curvilinear@length@b% + \pgf@y-\pgf@y% + \advance\pgf@y by2\pgf@curvilinear@time@a% + \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% + \advance\pgf@y by-\pgf@curvilinear@length@c% + \pgf@y.25\pgf@y% + \pgfmathdivide@\pgf@curvilinear@time@a\pgf@y% + \let\pgf@curvilinear@quot@d\pgfmathresult% + \pgf@y\pgf@curvilinear@quot@d\pgf@curvilinear@length@c% + \pgf@y-\pgf@y% + \advance\pgf@y by4\pgf@curvilinear@time@a% + \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{% + \pgfmathdivide@{8\pgf@curvilinear@time@a}{\pgf@curvilinear@length@d}% + \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 +% 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). + +\def\pgfcurvilineardistancetotime#1{% + \pgfmathsetlength{\pgf@x}{#1}% + \ifdim\pgf@x<\pgf@curvilinear@length@c\relax% + \ifdim\pgf@x<\pgf@curvilinear@length@a\relax% + \pgf@curvilinear@comp@a% + \else\ifdim\pgf@x<\pgf@curvilinear@length@b\relax% + \pgf@curvilinear@comp@b% + \else% + \pgf@curvilinear@comp@c% + \fi\fi% + \else\ifdim\pgf@x<\pgf@curvilinear@length@d\relax% + \pgf@curvilinear@comp@d% + \else% + \pgf@curvilinear@comp@e% + \fi\fi% +} + + + +% Compute a "Bezier-orthogonal" point for use in a nonlinear transformation. +% +% #1 = x +% #2 = y +% +% Description: +% +% In this coordinate system, the x-axis "goes along" the Bezier curve +% installed using \pgfsetcurvilinearbeziercurve +% and the y-axis is always perpendicular to the (Bezier) curve at the +% given x-coordinate. Formally, given a pair (x,y), let B(x) be the point on +% the Bezier curve B at distance x from the start of the curve. Let +% T(x) be the tangent of B at B(x) and let P(x) be the (normalized) +% vector perpendicular to T(x). Then (x,y) would be mapped to B(x) + +% y*P(x). As an example, if B is a circle, then the corresponding +% curvilinear coordinate system is (essentially, except for an offset in +% the y value) the polar coordinate system. +% +% 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. + +\def\pgfpointcurvilinearbezierorthogonal#1#2{% + \pgfmathsetmacro\pgf@curvilinear@yfactor{#2}% + \pgfcurvilineardistancetotime{#1}% + \pgfpointcurveattime{\pgf@x}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d} + \pgf@xc\pgf@x% save + \pgf@yc\pgf@y% save + % compute normal: + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \ifdim\pgf@xb<0.0001pt\ifdim\pgf@xb>-0.0001pt\ifdim\pgf@yb<0.0001pt\ifdim\pgf@yb>-0.0001pt\pgf@diff@curvi@ac\fi\fi\fi\fi + \pgf@process{\pgfpointnormalised{\pgf@x=\pgf@yb\pgf@y=-\pgf@xb}} + \pgf@x\pgf@curvilinear@yfactor\pgf@x% + \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% + \pgf@xa\pgf@x\pgf@ya\pgf@y% + \pgf@curvilinear@line@c% + \pgf@xb\pgf@x\pgf@yb\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \ifdim\pgf@xb<0.0001pt\ifdim\pgf@xb>-0.0001pt\ifdim\pgf@yb<0.0001pt\ifdim\pgf@yb>-0.0001pt% still degenerate! + \pgf@curvilinear@line@d% + \pgf@xb\pgf@x\pgf@yb\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \fi\fi\fi\fi% + \pgf@xb-\pgf@xb% + \pgf@yb-\pgf@yb% +} + + + +% Compute a "Bezier-polar" point. +% +% #1 = x +% #2 = y +% +% Description: +% +% Let (r:d) be the point (x,y) in polar coordinates, that is, r is the +% angle and d the distance of (x,y) to the origin. The point returned +% by \pgfpointcurvilinearbezierpolar is now defined as follows: First, +% 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{% + \pgfmathsetlength\pgfutil@tempdima{#1}% + \pgfmathsetlength\pgfutil@tempdimb{#2}% + % Compute angle: + \pgfpointnormalised{\pgfqpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% + \ifdim\pgfutil@tempdimb=0pt\relax\ifdim\pgfutil@tempdima=0pt\pgf@x1pt\pgf@y0pt\fi\fi% + \ifdim\pgfutil@tempdima<0pt% + \pgf@x-\pgf@x% + \pgf@y-\pgf@y% + \fi% + \pgf@ya=-\pgf@y% + \pgfsettransformentries% + {\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + {\pgf@sys@tonumber\pgf@ya}{\pgf@sys@tonumber\pgf@x}{0pt}{0pt}% + \pgftransformshift{\pgfpointscale{-1}{\pgf@curvilinear@line@a}}% + \pgfmathveclen@{\pgfutil@tempdima}{\pgfutil@tempdimb}% + \ifdim\pgfutil@tempdima<0pt% + \edef\pgfmathresult{-\pgfmathresult}% + \fi% + \pgfcurvilineardistancetotime{\pgfmathresult}% + % Now, transform: + \pgf@process{% + \pgfpointadd{% + \pgfpointtransformed{% + \pgfpointcurveattime% + {\pgf@x}% + {\pgf@curvilinear@line@a}% + {\pgf@curvilinear@line@b}% + {\pgf@curvilinear@line@c}% + {\pgf@curvilinear@line@d}% + }% + }% + \pgf@curvilinear@line@a% + }% +} + + +\endinput 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 240eddf4435..f82f8640c4f 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex @@ -83,8 +83,8 @@ \def\pgfmathfp@parser@install{% % \expandafter\ifx\csname FP@version\endcsname\relax% - \PackageError{pgf}{You need to say `\string\usepackage{fp}' to use % - fixed point arithmetic}{}% + \pgferror{You need to say `\string\usepackage{fp}' to use % + fixed point arithmetic}% \else% % % Don't want messages. 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 cecc76d593e..dbaf9847cd1 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex @@ -157,11 +157,26 @@ \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname% }% } +\def\pgfmathfloat@prepareuninstallcmd@csname#1{% + % and store backup information (globally - I don't want to do that + % all the time when the FPU is used!): + {% + \globaldefs=1 + \pgfutil@namelet{pgfmathfloat@backup@#1}{#1}% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall + \pgfutil@namelet{#1}{pgfmathfloat@backup@#1}% + }% + }% +} \def\pgfmathfloat@install#1=#2{% \pgfmathfloat@prepareuninstallcmd{#1}% \let#1=#2% } +\def\pgfmathfloat@install@csname#1#2{% + \pgfmathfloat@prepareuninstallcmd@csname{#1}% + \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}}% @@ -216,15 +231,24 @@ \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@ @@ -246,14 +270,10 @@ \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@ \pgfmathfloat@install@unimplemented{ceil}% \pgfmathfloat@install@unimplemented{frac}% - \pgfmathfloat@install@unimplemented{log2}% - \pgfmathfloat@install@unimplemented{log10}% - \pgfmathfloat@install@unimplemented{equalto}% \pgfmathfloat@install@unimplemented{random}% \pgfmathfloat@install@unimplemented{setseed}% \pgfmathfloat@install@unimplemented{Mod}% \pgfmathfloat@install@unimplemented{real}% - \pgfmathfloat@install@unimplemented{notequal}% % \pgfmathfloat@install@unimplemented{atan2}% % \pgfmathfloat@install@unimplemented{height}% % @@ -551,6 +571,7 @@ \let\pgfmath@basic@lessthan@=\pgfmathlessthan@ \let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@ \let\pgfmath@basic@equalto@=\pgfmathequalto@ +\let\pgfmath@basic@equal@=\pgfmathequal@ \let\pgfmath@basic@true@=\pgfmathtrue@ \let\pgfmath@basic@false@=\pgfmathfalse@ @@ -628,6 +649,25 @@ \let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ \let\pgfmathfloatless@=\pgfmathfloatlessthan@ +% ! (#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) +\def\pgfmathfloatnotgreater@#1#2{% + \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 @@ -730,7 +770,7 @@ % 100 <= m < 1000 % instead of 1 <= m < 10. % -% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. +% 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). % @@ -885,6 +925,34 @@ \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi }% +\def\pgfmathfloatifthenelse@#1#2#3{% + \pgfmathfloatifflags{#1}{0}{% + \edef\pgfmathresult{#3}%% + }{% + \edef\pgfmathresult{#2}% + }% +} +\def\pgfmathfloatequal@#1#2{% + \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 + }% +} +\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 @@ -933,7 +1001,7 @@ #4\relax \fi \else - \if\pgfmathfloat@loc@TMPa#2 + \if\pgfmathfloat@loc@TMPa#2% #3\relax \else #4\relax @@ -1421,8 +1489,13 @@ % assuming #2 != 0. \def\pgfmathfloatrelerror@#1#2{% \pgfmathfloatsubtract@{#1}{#2}% - \pgfmathfloatdivide@{\pgfmathresult}{#2}% - \pgfmathfloatabs@{\pgfmathresult}% + \let\pgfmathfloat@subtract=\pgfmathresult + \pgfmathfloatifflags{#2}{0}{% + \let\pgfmathresult=\pgfmathfloat@subtract + }{% + \pgfmathfloatdivide@{\pgfmathfloat@subtract}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% + }% }% \let\pgfmathfloatrelerror=\pgfmathfloatrelerror@ @@ -1589,6 +1662,19 @@ } \let\pgfmathfloatln=\pgfmathfloatln@ +\expandafter\def\csname pgfmathfloatlog10@\endcsname#1{% + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@log@ten=\pgfmathresult + \pgfmathfloatcreate{1}{4.34294481903252}{-1}% 1/ln(10) + \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@ten}% +}% +\expandafter\def\csname pgfmathfloatlog2@\endcsname#1{% + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@log@two=\pgfmathresult + \pgfmathfloatcreate{1}{1.44269504088896}{0}% 1/ln(2) + \pgfmathfloatmultiply@{\pgfmathresult}{\pgfmathfloat@log@two}% +}% + % Computes log(x) into \pgfmathresult. % % This allows numbers such at 10000000 or 5.23e-10 to be represented @@ -1794,12 +1880,25 @@ \divide\c@pgfmath@counta by2\relax% \repeatpgfmathloop% \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}% + \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 } 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 698ec524ba8..b90e96c8b5a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex @@ -7,6 +7,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. +% Note: at the time of this writing, the library has quadratic runtime. +% Experimentally, it performed well while computing ~12 intersections of two +% plots, each with 600 samples. It failed when the number of samples exceeded 700. \newcount\pgf@intersect@solutions @@ -23,6 +26,8 @@ \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% @@ -35,6 +40,31 @@ \fi% } +% Gets the segment indices of solution #1. +% +% #1: the solution index (i.e. the same argument as in \pgfpointintersectionsolution) +% #2: [output] a macro name which will contain the segment index of the first path which contains the solution +% #3: [output] a macro name which will contain the segment index of the second path which contains the solution +% +% 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 +\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% + \edef#2{\csname pgf@intersect@solution@segment@a@#1\endcsname}% + \edef#3{\csname pgf@intersect@solution@segment@b@#1\endcsname}% + \fi% + \fi% +}% + \def\pgfpoint@intersect@solution@orgin{% \begingroup% \pgftransforminvert% @@ -45,6 +75,11 @@ \endgroup% } +% #1 code which assigns the first path using \pgfsetpath. +% #2 code which assigns the second path using \pgfsetpath. +% +% 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% @@ -72,6 +107,10 @@ \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}% @@ -80,6 +119,8 @@ \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}% @@ -90,6 +131,17 @@ \fi% } +\def\pgf@intersection@set@properties#1#2{% + \pgfutil@namedef{pgf@intersect@solution@segment@a@\pgfmathcounter}{#1}% + \pgfutil@namedef{pgf@intersect@solution@segment@b@\pgfmathcounter}{#2}% +}% + +% #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: + \expandafter\xdef\csname #1@props\endcsname{{\pgf@intersect@time@offset}{\pgf@intersect@time@offset@b}}% +} + \def\pgf@intersectionofpaths#1{% \ifx#1\pgf@stop% \let\pgf@intersect@next=\relax% @@ -152,6 +204,7 @@ \def\pgf@intersect@path@process@a{% \pgf@intersect@path@getpoints@a% \let\pgf@intersect@token@after=\pgf@intersect@path@process@b% + \def\pgf@intersect@time@offset@b{0}% \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% @@ -173,6 +226,9 @@ \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{% @@ -224,6 +280,8 @@ \pgfpointintersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}% {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}% }% + \pgf@intersection@store@properties{pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions}% + % \ifpgf@intersect@sort% \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% @@ -567,6 +625,7 @@ \pgf@ifsolution@duplicate\pgf@intersect@solution@candidate{}% {% \global\advance\pgf@intersect@solutions by1\relax% + \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% @@ -747,15 +806,16 @@ \csname pgf@intersect@solution@\the\pgfutil@tempcnta @time@a\endcsname pt\relax% \pgf@intersect@solutions@sortfinishfalse% % - \pgfutil@namelet{pgf@intersect@temp}{pgfpoint@intersect@solution@\pgfmathcounter}% - \pgfutil@namelet{pgfpoint@intersect@solution@\pgfmathcounter}% + \pgfintersectionsolutionsortbytime@swap{pgfpoint@intersect@solution@\pgfmathcounter}% {pgfpoint@intersect@solution@\the\pgfutil@tempcnta}% - \pgfutil@namelet{pgfpoint@intersect@solution@\the\pgfutil@tempcnta}{pgf@intersect@temp}% % - \pgfutil@namelet{pgf@intersect@temp}{pgf@intersect@solution@\pgfmathcounter @time@a}% - \pgfutil@namelet{pgf@intersect@solution@\pgfmathcounter @time@a}% + \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@\pgfmathcounter @time@a}% {pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}% - \pgfutil@namelet{pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}{pgf@intersect@temp}% + % + \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@segment@a@\pgfmathcounter}% + {pgf@intersect@solution@segment@a@\the\pgfutil@tempcnta}% + \pgfintersectionsolutionsortbytime@swap{pgf@intersect@solution@segment@b@\pgfmathcounter}% + {pgf@intersect@solution@segment@b@\the\pgfutil@tempcnta}% \fi% \repeatpgfmathloop% \ifpgf@intersect@solutions@sortfinish% @@ -764,4 +824,10 @@ \fi% } +\def\pgfintersectionsolutionsortbytime@swap#1#2{% + \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 d7bb3d9dd57..ab6a067835e 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex @@ -56,7 +56,7 @@ #2% \endgroup% }% - {\PackageError{pgf}{Lindenmayer system `#1' is already defined}{}}% + {\pgferror{Lindenmayer system `#1' is already defined}}% } \def\pgf@lsystem@symbol#1#2{% 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 5ab9e84a796..38ccd94d0b9 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex @@ -7,9 +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.15 2010/05/31 10:11:22 tantau Exp $ - -\newif\ifpgf@plot@started +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.20 2013/08/31 13:02:59 ludewich Exp $ % This handler converts each plot stream command into a curveto @@ -23,13 +21,16 @@ % \pgfplothandlercurveto % \pgfplotxyfile{mytable} -\def\pgfplothandlercurveto{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@initial% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgf@plot@curveto@handler@finish% - \global\pgf@plot@startedfalse% - }% +\pgfdeclareplothandler{\pgfplothandlercurveto}{}{% + 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{% @@ -113,12 +114,16 @@ % \pgfplothandlerclosedcurve % \pgfplotxyfile{mytable} -\def\pgfplothandlerclosedcurve{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@initial% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgf@plot@closedcurve@handler@finish% - }% +\pgfdeclareplothandler{\pgfplothandlerclosedcurve}{}{% + 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{% @@ -276,13 +281,10 @@ % \pgfplothandlerxcomb % \pgfplotxyfile{mytable} -\def\pgfplothandlerxcomb{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% - \pgfplotxzerolevelstreamstart - }% +\pgfdeclareplothandler{\pgfplothandlerxcomb}{}{% + start macro=\pgfplotxzerolevelstreamstart, + point macro=\pgf@plot@xcomb@handler, + end macro=\pgfplotxzerolevelstreamend, } \def\pgf@plot@xcomb@handler#1{% @@ -307,13 +309,10 @@ % \pgfplothandlerycomb % \pgfplotxyfile{mytable} -\def\pgfplothandlerycomb{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% - \pgfplotyzerolevelstreamstart - }% +\pgfdeclareplothandler{\pgfplothandlerycomb}{}{% + start macro=\pgfplotyzerolevelstreamstart, + point macro=\pgf@plot@ycomb@handler, + end macro=\pgfplotyzerolevelstreamend } \def\pgf@plot@ycomb@handler#1{% @@ -375,12 +374,19 @@ \pgfplotyzerolevelstreamconstant{0pt}% \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=, } % This handler places a rectangle at each point in the plot stream, a @@ -395,20 +401,21 @@ % % \pgfplothandlerybar % \pgfplotxyfile{mytable} -\def\pgfplothandlerybar{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@ybar@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% - \pgfmathparse{\pgfplotbarwidth}% - \xdef\pgfplotbarwidth@{\pgfmathresult pt}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% - \xdef\pgfplotbarshift@{\pgfmathresult pt}% - \pgfplotyzerolevelstreamstart - }% + +\pgfdeclareplothandler{\pgfplothandlerybar}{}{% + start={ + \pgfmathparse{\pgfplotbarwidth}% + \xdef\pgfplotbarwidth@{\pgfmathresult pt}% + \pgfmathparse{\pgfplotbarshift}% + \xdef\pgfplotbarshift@{\pgfmathresult pt}% + \pgfplotyzerolevelstreamstart + }, + end macro=\pgfplotyzerolevelstreamend, + point macro=\pgf@plot@ybar@handler } \def\pgf@plot@ybar@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@y \expandafter\pgf@xb\pgfplotbarwidth@\relax @@ -423,6 +430,7 @@ \pgfpathrectangle {\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 @@ -437,20 +445,20 @@ % % \pgfplothandlerxbar % \pgfplotxyfile{mytable} -\def\pgfplothandlerxbar{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@xbar@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% - \pgfmathparse{\pgfplotbarwidth}% - \xdef\pgfplotbarwidth@{\pgfmathresult pt}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% - \xdef\pgfplotbarshift@{\pgfmathresult pt}% - \pgfplotxzerolevelstreamstart - }% +\pgfdeclareplothandler{\pgfplothandlerxbar}{}{% + start={ + \pgfmathparse{\pgfplotbarwidth}% + \xdef\pgfplotbarwidth@{\pgfmathresult pt}% + \pgfmathparse{\pgfplotbarshift}% + \xdef\pgfplotbarshift@{\pgfmathresult pt}% + \pgfplotxzerolevelstreamstart + }, + end macro=\pgfplotxzerolevelstreamend, + point macro=\pgf@plot@xbar@handler } \def\pgf@plot@xbar@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@x \expandafter\pgf@xb\pgfplotbarwidth@\relax @@ -465,6 +473,7 @@ \pgfpathrectangle {\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 @@ -500,17 +509,16 @@ % % \pgfplothandlerybarinterval % \pgfplotxyfile{mytable} -\def\pgfplothandlerybarinterval{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler@first% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% - \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% - \xdef\pgfplotbarintervalshift@{\pgfmathresult}% - \pgfplotyzerolevelstreamstart - }% +\pgfdeclareplothandler{\pgfplothandlerybarinterval}{}{% + start={ + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% + \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% + \xdef\pgfplotbarintervalshift@{\pgfmathresult}% + \pgfplotyzerolevelstreamstart + }, + end macro=\pgfplotyzerolevelstreamend, + point macro=\pgf@plot@ybarinterval@handler@first } \def\pgf@plot@ybarinterval@handler@first#1{% @@ -520,6 +528,7 @@ \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler% } \def\pgf@plot@ybarinterval@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@plot@barinterval@bar \xdef\pgf@plot@barinterval@bar{\the\pgf@y}% @@ -538,20 +547,20 @@ \pgfpathrectangle {\pgfqpoint{\pgf@xc}{\pgf@yb}}% {\pgfqpoint{\pgf@xb}{\pgf@ya}}% + \pgfkeysvalueof{/pgf/at end bar}% } % Like \pgfplothandlerybarinterval but for xbar. -\def\pgfplothandlerxbarinterval{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler@first% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% - \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% - \xdef\pgfplotbarintervalshift@{\pgfmathresult}% - \pgfplotxzerolevelstreamstart - }% +\pgfdeclareplothandler{\pgfplothandlerxbarinterval}{}{% + start={ + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% + \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% + \xdef\pgfplotbarintervalshift@{\pgfmathresult}% + \pgfplotxzerolevelstreamstart + }, + end macro=\pgfplotxzerolevelstreamend, + point macro=\pgf@plot@xbarinterval@handler@first } \def\pgf@plot@xbarinterval@handler@first#1{% @@ -561,6 +570,7 @@ \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler% } \def\pgf@plot@xbarinterval@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@plot@barinterval@bar \xdef\pgf@plot@barinterval@bar{\the\pgf@x}% @@ -579,6 +589,7 @@ \pgfpathrectangle {\pgfqpoint{\pgf@yb}{\pgf@xc}}% {\pgfqpoint{\pgf@ya}{\pgf@xb}}% + \pgfkeysvalueof{/pgf/at end bar}% } @@ -595,13 +606,11 @@ % % \pgfplothandlerconstantlineto % \pgfplotxyfile{mytable} -\def\pgfplothandlerconstantlineto{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% + +\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}% @@ -630,13 +639,11 @@ % % \pgfplothandlerconstantlinetomarkright % \pgfplotxyfile{mytable} -\def\pgfplothandlerconstantlinetomarkright{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% + +\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}% @@ -653,6 +660,43 @@ \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. +% +% ----x +% | +% --x--- | +% | |--x---- +% x-- +% +% Example: +% +% \pgfplothandlerconstantlinetomarkmid +% \pgfplotxyfile{mytable} + +\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 + \pgf@ya=\pgf@y + \pgf@plot@const@line@handler@last + \pgf@xc=.5\pgf@xa + \advance\pgf@xc by.5\pgf@x + \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@y}}% + \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 % line-to and move-to operations such that plot marks are placed at @@ -667,13 +711,11 @@ % % \pgfplothandlerjumpmarkright % \pgfplotxyfile{mytable} -\def\pgfplothandlerjumpmarkright{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% + +\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}% @@ -704,12 +746,9 @@ % % \pgfplothandlerjumpmarkleft % \pgfplotxyfile{mytable} -\def\pgfplothandlerjumpmarkleft{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% + +\pgfdeclareplothandler{\pgfplothandlerjumpmarkleft}{}{% + point macro=\pgf@plot@jumpmarkleft@handler } \def\pgf@plot@jumpmarkleft@handler#1{% \pgf@process{#1}% @@ -727,6 +766,44 @@ \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}% } +% This handler is in fact a variant of +% \pgfplothandlerconstantlinetomarkmid, +% but it does not draw vertical lines. It produces a sequence of +% line-to and move-to operations such that plot marks are placed like +% +% ----x +% +% --x-- +% --x---- +% x-- +% +% Example: +% +% \pgfplothandlerjumpmarkmid +% \pgfplotxyfile{mytable} + +\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 + \pgf@ya=\pgf@y + \pgf@plot@const@line@handler@last + \pgf@xc=.5\pgf@xa + \advance\pgf@xc by.5\pgf@x + \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@y}}% + \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 @@ -737,12 +814,8 @@ % \pgfplothandlerpolarcomb % \pgfplotxyfile{mytable} -\def\pgfplothandlerpolarcomb{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@polarcomb@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% +\pgfdeclareplothandler{\pgfplothandlerpolarcomb}{}{% + point macro=\pgf@plot@polarcomb@handler } \def\pgf@plot@polarcomb@handler#1{% @@ -767,30 +840,24 @@ % \pgfplothandlermark{\pgfuseplotmark{*}} % \pgfplotxyfile{mytable} -\def\pgfplothandlermark#1{% - \pgf@plothandlermark{% - \ifnum\pgf@plot@mark@count<\pgf@plot@mark@repeat\relax% - \else% - \global\pgf@plot@mark@count=0\relax% - #1% - \fi% +\pgfdeclareplothandler{\pgfplothandlermark}{#1}{% + start={ + \def\pgf@plot@mark{% + \ifnum\pgf@plot@mark@count<\pgf@plot@mark@repeat\relax% + \else% + \global\pgf@plot@mark@count=0\relax% + #1% + \fi% }% + \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax% + \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@plothandlermark#1{% - \def\pgf@plot@mark{#1}% - \def\pgf@plotstreamstart{% - \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax% - \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax% - \global\let\pgf@plotstreampoint=\pgf@plot@mark@handler% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% -} - \def\pgf@plot@mark@handler#1{% \global\advance\pgf@plot@mark@count by1\relax% {\pgftransformshift{#1}\pgf@plot@mark}% @@ -837,16 +904,32 @@ % \pgfplothandlermarklisted{\pgfuseplotmark{*}}{1,2,4,...,9} % \pgfplotxyfile{mytable} -\def\pgfplothandlermarklisted#1#2{% - \let\pgf@plot@mark@list=\pgfutil@empty% - \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}} - \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}% - \pgf@plothandlermark{% - \edef\pgf@marshal{\noexpand\pgfutil@in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}% - \pgf@marshal% - \ifpgfutil@in@#1\fi}% +\pgfdeclareplothandler{\pgfplothandlermarklisted}{#1#2}{% + start={ + \let\pgf@plot@mark@list=\pgfutil@empty% + \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}} + \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}% + \def\pgf@plot@mark{% + \edef\pgf@marshal{\noexpand\pgfutil@in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}% + \pgf@marshal% + \ifpgfutil@in@#1\fi% + }% + \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax% + \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% +% \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}} +% \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}% +% \pgf@plothandlermark{% +% \edef\pgf@marshal{\noexpand\pgfutil@in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}% +% \pgf@marshal% +% \ifpgfutil@in@#1\fi}% +% } + % Define a new plot mark for use with \pgfplotmark. % @@ -888,7 +971,7 @@ \pgfdeclareplotmark{*} {% - \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathellipse{\pgfpointorigin}{\pgfqpoint{\pgfplotmarksize}{0sp}}{\pgfqpoint{0sp}{\pgfplotmarksize}}% \pgfusepathqfillstroke } @@ -932,12 +1015,13 @@ \pgfkeys{/pgf/gap around stream point/.initial=1.5pt} -\def\pgfplothandlergaplineto{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler@initial% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\relax% - }% +\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{% @@ -976,13 +1060,17 @@ % \pgfplothandlergapcycle % \pgfplotxyfile{mytable} -\def\pgfplothandlergapcycle{% - \def\pgf@plotstreamstart{% - \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler@initial% - \global\let\pgf@plotstreamspecial=\pgfutil@gobble% - \global\let\pgf@plotstreamend=\pgf@plot@gap@cycle@handler@finish% - \global\let\pgf@plot@gap@cycle@first=\relax% - }% +\pgfdeclareplothandler{\pgfplothandlergapcycle}{}{% + point macro=\pgf@plot@gap@cycle@handler@initial, + 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{% @@ -1020,3 +1108,7 @@ \endinput + +% Local Variables: +% tab-width: 2 +% End: 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 57df579e3f3..94862191a3a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.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/pgflibraryplotmarks.code.tex,v 1.12 2010/10/15 07:34:06 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplotmarks.code.tex,v 1.13 2013/07/20 13:56:18 ludewich Exp $ % A stroked circle mark \pgfdeclareplotmark{o} {% - \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathellipse{\pgfpointorigin}{\pgfqpoint{\pgfplotmarksize}{0sp}}{\pgfqpoint{0sp}{\pgfplotmarksize}}% \pgfusepathqstroke } 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 1043825d60f..ea1f469abe8 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex @@ -20,9 +20,24 @@ %-------------------------------------------- \pgfutil@ifundefined{pdfelapsedtime}{% - \PackageError{pgf}{library 'profiler' can only be used with pdftex Rev. >= 1.671 because it needs the \string\pdfelapsedtime\space command}{}% - \global\let\pdfelapsedtime=\c@pgf@counta -}{} + % Ok, \pdfelapsedtime is not defined. + % Maybe we run luatex? + \pgfutil@ifluatex + % Yes. So we emulate the primitive by a macro. + % (see http://tex.stackexchange.com/q/32507/8425) + \def\pgfutil@pdfelapsedtime{% + \numexpr\pgfutil@directlua{% + tex.print(math.floor((os.clock())*65536+0.5))}\relax} + \else + % Raise an error + \pgferror{% + 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} % Defines a new profiler entry named `#1'. @@ -64,7 +79,7 @@ \def\pgfprofilenewforenvironment@[#1]#2{% \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}% \ifx\pgfretval\relax - \PackageError{pgf}{\string\pgfprofilenewforenvironment{#2} doesn't work: the environment `#2' is (not yet?) known or not known in this context}{}% + \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}% @@ -132,7 +147,7 @@ \or \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6##7}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% \else - \PackageError{pgf}{library 'profiler' can't replace control sequences with '#3' arguments automatically, sorry.}% + \pgferror{library 'profiler' can't replace control sequences with '#3' arguments automatically, sorry.}{}% \fi \fi }% @@ -155,7 +170,7 @@ \fi \fi \if\pgfprofile@known0% - \PackageError{pgf}{\string\pgfprofilenewforcommandpattern{\string#2} doesn't work: the command `\string#2' is (not yet?) known or not known in this context}{}% + \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}% @@ -189,7 +204,7 @@ \def\pgfprofileshowinvocationsfor#1{% \pgfutil@ifundefined{b@pgfprofile@show@#1}{% - \PackageError{pgf}{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}{}% + \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}% @@ -197,7 +212,7 @@ }% \def\pgfprofileshowinvocationsexpandedfor#1{% \pgfutil@ifundefined{b@pgfprofile@show@#1}{% - \PackageError{pgf}{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}{}% + \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}% @@ -290,7 +305,7 @@ \pgfprofileifisrunning{#1}{% \relax }{% - \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{\the\pdfelapsedtime}% + \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}% @@ -305,7 +320,7 @@ \relax }{% \begingroup - \c@pgf@countb=\pdfelapsedtime\relax + \c@pgf@countb=\pgfutil@pdfelapsedtime\relax \advance\c@pgf@countb by-\csname c@pgfprofile@elapsed@at@start@#1\endcsname\relax % \pgfprofilestackpop\pgfretval 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 f6c89af3efe..90f26eb7211 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,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarysnakes.code.tex,v 1.24 2008/01/19 16:52:30 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarysnakes.code.tex,v 1.25 2013/07/15 12:05:34 tantau Exp $ -\PackageWarning{pgf}{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} 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 16d1b2eab0e..a385cf199f5 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,7 +7,7 @@ % % 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.6 2009/01/24 17:07:14 tantau Exp $ +\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 $ \usepgfmodule{parser} @@ -179,6 +179,10 @@ } +% Ignore spaces if no other rules says differently: + +\pgfparserdef{svgpath}{all}{blank space \space}{} + 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 ddf8a29f629..30ecbff3c4d 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 @@ -88,17 +88,14 @@ \pgfdeclareshape{direction ee} { \savedanchor\northeast{ - % Right border is given by right extend \pgf@x=0pt% - \csname pgf@arrow@right@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname % Height is given by minimum height/2 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}% \pgf@y=.5\pgf@y } \savedanchor\southwest{ % Left border is given by left extend - \pgf@x=0pt% - \csname pgf@arrow@left@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname + \pgfarrowtotallength{\pgfkeysvalueof{/pgf/direction ee arrow}}% \pgf@x=-\pgf@x% % Height is given by minimum height/2 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}% @@ -131,10 +128,8 @@ \beforebackgroundpath{ { - \pgfsetarrowsend{\pgfkeysvalueof{/pgf/direction ee arrow}} \pgfsys@beginscope - \pgflowlevelsynccm% - \pgflowlevelobj{}{\pgf@endarrow}% + \pgfarrowdraw{\pgfkeysvalueof{/pgf/direction ee arrow}}% \pgfsys@endscope } } 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 5b2beb2b0fb..e137e113cdc 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 @@ -10,131 +10,131 @@ \usepgflibrary{shapes.gates.logic} \pgfkeys{/pgf/.cd, - and gate IEC symbol/.initial=$\char`\&$, - nand gate IEC symbol/.initial=$\char`\&$, - or gate IEC symbol/.initial=$\geq1$, - nor gate IEC symbol/.initial=$\geq1$, - xor gate IEC symbol/.initial={$=1$}, - xnor gate IEC symbol/.initial={$=1$}, - not gate IEC symbol/.initial=1, - buffer gate IEC symbol/.initial=1, - logic gate IEC symbol align/.initial=top, - logic gate IEC symbol color/.initial=% no value + and gate IEC symbol/.initial=$\char`\&$, + nand gate IEC symbol/.initial=$\char`\&$, + or gate IEC symbol/.initial=$\geq1$, + nor gate IEC symbol/.initial=$\geq1$, + xor gate IEC symbol/.initial={$=1$}, + xnor gate IEC symbol/.initial={$=1$}, + not gate IEC symbol/.initial=1, + buffer gate IEC symbol/.initial=1, + logic gate IEC symbol align/.initial=top, + logic gate IEC symbol color/.initial=% no value } \pgfkeys{/pgf/logic gate IEC symbol align/.cd, - top/.code=\pgftransformyshift{\innerhalfheight}, - bottom/.code=\pgftransformyshift{-\innerhalfheight}, - left/.code=\pgftransformxshift{-\innerhalfwidth}, - right/.code=\pgftransformxshift{\innerhalfwidth} + top/.code=\pgftransformyshift{\innerhalfheight}, + bottom/.code=\pgftransformyshift{-\innerhalfheight}, + left/.code=\pgftransformxshift{-\innerhalfwidth}, + right/.code=\pgftransformxshift{\innerhalfwidth} } \def\pgf@lib@sh@logicgates@IEC@foregroundpath#1{% - \dimensions% - {% - \pgftransformshift{\centerpoint}% - \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate IEC symbol align}}% - \edef\pgf@lib@sh@@temp{/pgf/logic gate IEC symbol align/.cd, \pgf@lib@sh@temp}% - \expandafter\pgfkeys\expandafter{\pgf@lib@sh@@temp}% - \expandafter\pgftext\expandafter[\pgf@lib@sh@temp]{% - \pgfkeysgetvalue{/pgf/logic gate IEC symbol color}{\pgf@lib@sh@temp}% - \ifx\pgf@lib@sh@temp\pgfutil@empty% - \else% - \expandafter\color\expandafter{\pgf@lib@sh@temp}% - \fi% - \pgfkeysvalueof{/pgf/#1 gate IEC symbol}% - }% - }% -} + \dimensions% + {% + \pgftransformshift{\centerpoint}% + \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate IEC symbol align}}% + \edef\pgf@lib@sh@@temp{/pgf/logic gate IEC symbol align/.cd, \pgf@lib@sh@temp}% + \expandafter\pgfkeys\expandafter{\pgf@lib@sh@@temp}% + \expandafter\pgftext\expandafter[\pgf@lib@sh@temp]{% + \pgfkeysgetvalue{/pgf/logic gate IEC symbol color}{\pgf@lib@sh@temp}% + \ifx\pgf@lib@sh@temp\pgfutil@empty% + \else% + \expandafter\color\expandafter{\pgf@lib@sh@temp}% + \fi% + \pgfkeysvalueof{/pgf/#1 gate IEC symbol}% + }% + }% +} \def\pgf@lib@sh@logicgates@dimensions@IEC#1{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - % - % Adjust for the width of the gate symbol. - % - \setbox\pgf@hbox\hbox{{\pgfkeysvalueof{/pgf/#1 gate IEC symbol}}}% add braces as color-aftergroup-fix TT - \pgf@xa.5\wd\pgf@hbox% - \pgf@ya.5\ht\pgf@hbox% - \advance\pgf@ya.5\dp\pgf@hbox% - \ifdim\pgf@x<\pgf@xa% - \pgf@x\pgf@xa% - \fi% - \ifdim\pgf@y<\pgf@ya% - \pgf@y\pgf@ya% - \fi% - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - % - % Adjust for minimum height and width. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@x<.5\pgf@xa% - \pgf@x.5\pgf@xa% - \fi% - \ifdim\pgf@y<.5\pgf@ya% - \pgf@y.5\pgf@ya% - \fi% - % - % Adjust the height for the number of inputs. - % - \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% - \advance\c@pgf@counta1\relax% - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \pgf@yb2.0\pgf@yb% - \advance\pgf@yb\pgflinewidth% - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/logic gate input sep}}% - \edef\inputsep{\the\pgf@yc}% - \addtosavedmacro\inputsep% - \ifdim\pgf@yb<\pgf@yc% - \pgf@yb\pgf@yc% - \fi% - \multiply\pgf@yb\c@pgf@counta% - \ifdim\pgf@y<.5\pgf@yb% - \pgf@y.5\pgf@yb% - \fi% - % - \pgf@xa\pgf@y% - \pgfmathaddtolength\pgf@xa{-\pgfkeysvalueof{/pgf/inner xsep}}% - \edef\innerhalfwidth{\the\pgf@xa}% - \addtosavedmacro\innerhalfwidth% - % - \pgf@ya\pgf@y% - \pgfmathaddtolength\pgf@ya{-\pgfkeysvalueof{/pgf/inner ysep}}% - \edef\innerhalfheight{\the\pgf@ya}% - \addtosavedmacro\innerhalfheight% - % - % Take into account the outer sep. - % - \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - % - \edef\halfwidth{\the\pgf@x}% - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfwidth% - \addtosavedmacro\halfheight% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + % + % Adjust for the width of the gate symbol. + % + \setbox\pgf@hbox\hbox{{\pgfkeysvalueof{/pgf/#1 gate IEC symbol}}}% add braces as color-aftergroup-fix TT + \pgf@xa.5\wd\pgf@hbox% + \pgf@ya.5\ht\pgf@hbox% + \advance\pgf@ya.5\dp\pgf@hbox% + \ifdim\pgf@x<\pgf@xa% + \pgf@x\pgf@xa% + \fi% + \ifdim\pgf@y<\pgf@ya% + \pgf@y\pgf@ya% + \fi% + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + % + % Adjust for minimum height and width. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xa% + \pgf@x.5\pgf@xa% + \fi% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + % + % Adjust the height for the number of inputs. + % + \c@pgf@counta\pgf@lib@sh@logicgate@numinputs% + \advance\c@pgf@counta1\relax% + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \pgf@yb2.0\pgf@yb% + \advance\pgf@yb\pgflinewidth% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/logic gate input sep}}% + \edef\inputsep{\the\pgf@yc}% + \addtosavedmacro\inputsep% + \ifdim\pgf@yb<\pgf@yc% + \pgf@yb\pgf@yc% + \fi% + \multiply\pgf@yb\c@pgf@counta% + \ifdim\pgf@y<.5\pgf@yb% + \pgf@y.5\pgf@yb% + \fi% + % + \pgf@xa\pgf@x% + \pgfmathaddtolength\pgf@xa{-\pgfkeysvalueof{/pgf/inner xsep}}% + \edef\innerhalfwidth{\the\pgf@xa}% + \addtosavedmacro\innerhalfwidth% + % + \pgf@ya\pgf@y% + \pgfmathaddtolength\pgf@ya{-\pgfkeysvalueof{/pgf/inner ysep}}% + \edef\innerhalfheight{\the\pgf@ya}% + \addtosavedmacro\innerhalfheight% + % + % Take into account the outer sep. + % + \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + % + \edef\halfwidth{\the\pgf@x}% + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfwidth% + \addtosavedmacro\halfheight% }% \def\pgf@lib@sh@logicgate@IEC@inputanchor#1{% - \dimensions% - \centerpoint% - \advance\pgf@x-\halfwidth% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% - \advance\pgf@x-\invertedradius% - \advance\pgf@x-\outerinvertedradius% - \fi% - % - \pgfutil@tempdima\halfheight% - \multiply\pgfutil@tempdima2\relax% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \multiply\pgfutil@tempdima#1\relax% - \advance\pgf@y\halfheight% - \advance\pgf@y-\pgfutil@tempdima% + \dimensions% + \centerpoint% + \advance\pgf@x-\halfwidth% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-#1\endcsname% + \advance\pgf@x-\invertedradius% + \advance\pgf@x-\outerinvertedradius% + \fi% + % + \pgfutil@tempdima\halfheight% + \multiply\pgfutil@tempdima2\relax% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \multiply\pgfutil@tempdima#1\relax% + \advance\pgf@y\halfheight% + \advance\pgf@y-\pgfutil@tempdima% } @@ -142,117 +142,117 @@ % Shape and gate IEC % \pgfdeclareshape{and gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@and gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@and gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An and gate must have at least two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{and}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint} - \anchor{mid west}{% - \dimensions% - \midpoint% - \advance\pgf@x-\halfwidth}% - \anchor{mid east}{% - \dimensions% - \midpoint% - \advance\pgf@x\halfwidth}% - \anchor{base}{\basepoint} - \anchor{base west}{% - \dimensions% - \basepoint% - \advance\pgf@x-\halfwidth}% - \anchor{base east}{% - \dimensions% - \basepoint% - \advance\pgf@x\halfwidth}% - \anchor{north}{\dimensions\centerpoint\advance\pgf@y\halfheight}% - \anchor{south}{\dimensions\centerpoint\advance\pgf@y-\halfheight}% - \anchor{east}{\dimensions\centerpoint\advance\pgf@x\halfwidth}% - \anchor{west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth}% - \anchor{north east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y\halfheight}% - \anchor{north west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y\halfheight}% - \anchor{south east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y-\halfheight}% - \anchor{south west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y-\halfheight}% - \anchor{output}{\dimensions\centerpoint\advance\pgf@x\halfwidth} - \backgroundpath{% - \dimensions% - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - \pgfmathaddtolength\pgf@xc{-\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathaddtolength\pgf@yc{-\pgfkeysvalueof{/pgf/outer xsep}}% - {% - \pgftransformshift{\centerpoint}% - \pgfpathrectangle{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}% - {% - \pgf@xc2.0\pgf@xc% - \pgf@yc2.0\pgf@yc% - \pgfqpoint{\pgf@xc}{\pgf@yc}% - }% - \pgfpathclose% - % - % Draw inputs. - % - \pgf@xc-\halfwidth% - \advance\pgf@xc-\invertedradius% - \pgf@yc\halfheight% - \pgfutil@tempdima2.0\pgf@yc% - \c@pgf@counta\numinputs% - \advance\c@pgf@counta1\relax% - \divide\pgfutil@tempdima\c@pgf@counta% - \pgfmathloop% - \ifnum\pgfmathcounter>\numinputs% - \else% - \advance\pgf@yc-\pgfutil@tempdima% - \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% - {% - \pgfpathcircle{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\invertedradius}% - }% - \fi% - \repeatpgfmathloop% - }% - } - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{and}} - \anchorborder{% - \pgfextract@process\externalpoint{}% - \dimensions% - \pgfpointadd{\centerpoint}{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}% - }% + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@and gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@and gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@and gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \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@IEC{and}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint} + \anchor{mid west}{% + \dimensions% + \midpoint% + \advance\pgf@x-\halfwidth}% + \anchor{mid east}{% + \dimensions% + \midpoint% + \advance\pgf@x\halfwidth}% + \anchor{base}{\basepoint} + \anchor{base west}{% + \dimensions% + \basepoint% + \advance\pgf@x-\halfwidth}% + \anchor{base east}{% + \dimensions% + \basepoint% + \advance\pgf@x\halfwidth}% + \anchor{north}{\dimensions\centerpoint\advance\pgf@y\halfheight}% + \anchor{south}{\dimensions\centerpoint\advance\pgf@y-\halfheight}% + \anchor{east}{\dimensions\centerpoint\advance\pgf@x\halfwidth}% + \anchor{west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth}% + \anchor{north east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y\halfheight}% + \anchor{north west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y\halfheight}% + \anchor{south east}{\dimensions\centerpoint\advance\pgf@x\halfwidth\advance\pgf@y-\halfheight}% + \anchor{south west}{\dimensions\centerpoint\advance\pgf@x-\halfwidth\advance\pgf@y-\halfheight}% + \anchor{output}{\dimensions\centerpoint\advance\pgf@x\halfwidth} + \backgroundpath{% + \dimensions% + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + \pgfmathaddtolength\pgf@xc{-\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathaddtolength\pgf@yc{-\pgfkeysvalueof{/pgf/outer xsep}}% + {% + \pgftransformshift{\centerpoint}% + \pgfpathrectangle{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}% + {% + \pgf@xc2.0\pgf@xc% + \pgf@yc2.0\pgf@yc% + \pgfqpoint{\pgf@xc}{\pgf@yc}% + }% + \pgfpathclose% + % + % Draw inputs. + % + \pgf@xc-\halfwidth% + \advance\pgf@xc-\invertedradius% + \pgf@yc\halfheight% + \pgfutil@tempdima2.0\pgf@yc% + \c@pgf@counta\numinputs% + \advance\c@pgf@counta1\relax% + \divide\pgfutil@tempdima\c@pgf@counta% + \pgfmathloop% + \ifnum\pgfmathcounter>\numinputs% + \else% + \advance\pgf@yc-\pgfutil@tempdima% + \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-\pgfmathcounter\endcsname% + {% + \pgfpathcircle{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\invertedradius}% + }% + \fi% + \repeatpgfmathloop% + }% + } + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{and}} + \anchorborder{% + \pgfextract@process\externalpoint{}% + \dimensions% + \pgfpointadd{\centerpoint}{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}% + }% } @@ -262,76 +262,76 @@ % Shape nand gate IEC % \pgfdeclareshape{nand gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@nand gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@nand gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A nand gate must have at least two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{nand}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \anchor{output}{% - \csname pgf@anchor@and gate IEC@east\endcsname% - \advance\pgf@x\invertedradius% - \advance\pgf@x\outerinvertedradius% - } - \backgroundpath{% - \csname pgf@sh@bg@and gate IEC\endcsname% - \pgfpathcircle{% - \centerpoint% - \advance\pgf@x\halfwidth% - \advance\pgf@x\invertedradius% - }{+\invertedradius}% - } - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nand}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nand gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@nand gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@nand gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \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@IEC{nand}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \inheritanchor[from=and gate IEC]{center} + \inheritanchor[from=and gate IEC]{mid} + \inheritanchor[from=and gate IEC]{mid west} + \inheritanchor[from=and gate IEC]{mid east} + \inheritanchor[from=and gate IEC]{base} + \inheritanchor[from=and gate IEC]{base west} + \inheritanchor[from=and gate IEC]{base east} + \inheritanchor[from=and gate IEC]{north} + \inheritanchor[from=and gate IEC]{south} + \inheritanchor[from=and gate IEC]{east} + \inheritanchor[from=and gate IEC]{west} + \inheritanchor[from=and gate IEC]{north east} + \inheritanchor[from=and gate IEC]{north west} + \inheritanchor[from=and gate IEC]{south east} + \inheritanchor[from=and gate IEC]{south west} + \anchor{output}{% + \csname pgf@anchor@and gate IEC@east\endcsname% + \advance\pgf@x\invertedradius% + \advance\pgf@x\outerinvertedradius% + } + \backgroundpath{% + \csname pgf@sh@bg@and gate IEC\endcsname% + \pgfpathcircle{% + \centerpoint% + \advance\pgf@x\halfwidth% + \advance\pgf@x\invertedradius% + }{+\invertedradius}% + } + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nand}} + \inheritanchorborder[from=and gate IEC] } @@ -341,65 +341,65 @@ % Shape or gate IEC % \pgfdeclareshape{or gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@or gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@or gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An or gate must have at least two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{or}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{or}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@or gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@or gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@or gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \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\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] } @@ -409,65 +409,65 @@ % Shape nor gate IEC % \pgfdeclareshape{nor gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@nor gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@nor gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A nor gate must have at least two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{nor}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output}% - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{nor}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@nor gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@nor gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@nor gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \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\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] } @@ -477,65 +477,65 @@ % Shape xor gate IEC % \pgfdeclareshape{xor gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{2}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@xor gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@xor gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An xor gate must have two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{xor}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xor}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xor gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{2}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@xor gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@xor gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{An xor gate must have two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + } + \savedmacro\dimensions{% + \pgf@lib@sh@logicgates@dimensions@IEC{xor}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \inheritanchor[from=and gate IEC]{center} + \inheritanchor[from=and gate IEC]{mid} + \inheritanchor[from=and gate IEC]{mid west} + \inheritanchor[from=and gate IEC]{mid east} + \inheritanchor[from=and gate IEC]{base} + \inheritanchor[from=and gate IEC]{base west} + \inheritanchor[from=and gate IEC]{base east} + \inheritanchor[from=and gate IEC]{north} + \inheritanchor[from=and gate IEC]{south} + \inheritanchor[from=and gate IEC]{east} + \inheritanchor[from=and gate IEC]{west} + \inheritanchor[from=and gate IEC]{north east} + \inheritanchor[from=and gate IEC]{north west} + \inheritanchor[from=and gate IEC]{south east} + \inheritanchor[from=and gate IEC]{south west} + \inheritanchor[from=and gate IEC]{output} + \inheritbackgroundpath[from=and gate IEC] + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xor}} + \inheritanchorborder[from=and gate IEC] } @@ -545,65 +545,65 @@ % \pgfdeclareshape{xnor gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. - % - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% - \else% - \pgfutil@ifundefined{pgf@anchor@xnor gate IEC@input \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@xnor gate IEC@input \pgfmathcounter\endcsname{% - \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% - }% - }{}% - \repeatpgfmathloop% - \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A xnor gate must have two inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{xnor}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output} - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xnor}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@xnor gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1024}% Maximum 1024 (!) inputs. + % + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@lib@sh@logicgate@numinputs% + \else% + \pgfutil@ifundefined{pgf@anchor@xnor gate IEC@input \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@xnor gate IEC@input \pgfmathcounter\endcsname{% + \noexpand\pgf@lib@sh@logicgate@IEC@inputanchor{\pgfmathcounter}% + }% + }{}% + \repeatpgfmathloop% + \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% + \pgferror{A xnor gate must have two inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + } + \savedmacro\dimensions{% + \pgf@lib@sh@logicgates@dimensions@IEC{xnor}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \inheritanchor[from=and gate IEC]{center} + \inheritanchor[from=and gate IEC]{mid} + \inheritanchor[from=and gate IEC]{mid west} + \inheritanchor[from=and gate IEC]{mid east} + \inheritanchor[from=and gate IEC]{base} + \inheritanchor[from=and gate IEC]{base west} + \inheritanchor[from=and gate IEC]{base east} + \inheritanchor[from=and gate IEC]{north} + \inheritanchor[from=and gate IEC]{south} + \inheritanchor[from=and gate IEC]{east} + \inheritanchor[from=and gate IEC]{west} + \inheritanchor[from=and gate IEC]{north east} + \inheritanchor[from=and gate IEC]{north west} + \inheritanchor[from=and gate IEC]{south east} + \inheritanchor[from=and gate IEC]{south west} + \inheritanchor[from=nand gate IEC]{output} + \inheritbackgroundpath[from=nand gate IEC] + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{xnor}} + \inheritanchorborder[from=and gate IEC] } @@ -612,59 +612,59 @@ % Shape buffer gate IEC % \pgfdeclareshape{buffer gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1}% Maximum 1 input. - % - \expandafter\gdef\csname pgf@anchor@buffer gate IEC@input\endcsname{% - \pgf@lib@sh@logicgate@IEC@inputanchor{1}% - }% - \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% - \PackageError{PGF}{A buffer gate must have one inputs}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{xor}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=and gate IEC]{output} - \inheritbackgroundpath[from=and gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{buffer}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1}% Maximum 1 input. + % + \expandafter\gdef\csname pgf@anchor@buffer gate IEC@input\endcsname{% + \pgf@lib@sh@logicgate@IEC@inputanchor{1}% + }% + \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% + \pgferror{A buffer gate must have one inputs}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + } + \savedmacro\dimensions{% + \pgf@lib@sh@logicgates@dimensions@IEC{xor}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \inheritanchor[from=and gate IEC]{center} + \inheritanchor[from=and gate IEC]{mid} + \inheritanchor[from=and gate IEC]{mid west} + \inheritanchor[from=and gate IEC]{mid east} + \inheritanchor[from=and gate IEC]{base} + \inheritanchor[from=and gate IEC]{base west} + \inheritanchor[from=and gate IEC]{base east} + \inheritanchor[from=and gate IEC]{north} + \inheritanchor[from=and gate IEC]{south} + \inheritanchor[from=and gate IEC]{east} + \inheritanchor[from=and gate IEC]{west} + \inheritanchor[from=and gate IEC]{north east} + \inheritanchor[from=and gate IEC]{north west} + \inheritanchor[from=and gate IEC]{south east} + \inheritanchor[from=and gate IEC]{south west} + \inheritanchor[from=and gate IEC]{output} + \inheritbackgroundpath[from=and gate IEC] + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{buffer}} + \inheritanchorborder[from=and gate IEC] } @@ -674,60 +674,60 @@ % Shape not gate IEC % \pgfdeclareshape{not gate IEC}{ - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate IEC\endcsname{% - \pgf@lib@sh@logicgate@parseinputs{1}% - % - \pgfutil@ifundefined{pgf@anchor@not gate IEC@input}{% - \expandafter\gdef\csname pgf@anchor@not gate IEC@input\endcsname{% - \pgf@lib@sh@logicgate@IEC@inputanchor{1}% - }}{}% - \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% - \PackageError{PGF}{A not gate must have one input}{}% - \fi% - }% - \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% - \saveddimen\invertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - }% - \saveddimen\outerinvertedradius{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% - \advance\pgf@x.5\pgflinewidth% - } - \savedmacro\dimensions{% - \pgf@lib@sh@logicgates@dimensions@IEC{not}% - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \inheritanchor[from=and gate IEC]{center} - \inheritanchor[from=and gate IEC]{mid} - \inheritanchor[from=and gate IEC]{mid west} - \inheritanchor[from=and gate IEC]{mid east} - \inheritanchor[from=and gate IEC]{base} - \inheritanchor[from=and gate IEC]{base west} - \inheritanchor[from=and gate IEC]{base east} - \inheritanchor[from=and gate IEC]{north} - \inheritanchor[from=and gate IEC]{south} - \inheritanchor[from=and gate IEC]{east} - \inheritanchor[from=and gate IEC]{west} - \inheritanchor[from=and gate IEC]{north east} - \inheritanchor[from=and gate IEC]{north west} - \inheritanchor[from=and gate IEC]{south east} - \inheritanchor[from=and gate IEC]{south west} - \inheritanchor[from=nand gate IEC]{output} - \inheritbackgroundpath[from=nand gate IEC] - \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{not}} - \inheritanchorborder[from=and gate IEC] + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate IEC\endcsname{% + \pgf@lib@sh@logicgate@parseinputs{1}% + % + \pgfutil@ifundefined{pgf@anchor@not gate IEC@input}{% + \expandafter\gdef\csname pgf@anchor@not gate IEC@input\endcsname{% + \pgf@lib@sh@logicgate@IEC@inputanchor{1}% + }}{}% + \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% + \pgferror{A not gate must have one input}% + \fi% + }% + \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% + \saveddimen\invertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + }% + \saveddimen\outerinvertedradius{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}% + \advance\pgf@x.5\pgflinewidth% + } + \savedmacro\dimensions{% + \pgf@lib@sh@logicgates@dimensions@IEC{not}% + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \inheritanchor[from=and gate IEC]{center} + \inheritanchor[from=and gate IEC]{mid} + \inheritanchor[from=and gate IEC]{mid west} + \inheritanchor[from=and gate IEC]{mid east} + \inheritanchor[from=and gate IEC]{base} + \inheritanchor[from=and gate IEC]{base west} + \inheritanchor[from=and gate IEC]{base east} + \inheritanchor[from=and gate IEC]{north} + \inheritanchor[from=and gate IEC]{south} + \inheritanchor[from=and gate IEC]{east} + \inheritanchor[from=and gate IEC]{west} + \inheritanchor[from=and gate IEC]{north east} + \inheritanchor[from=and gate IEC]{north west} + \inheritanchor[from=and gate IEC]{south east} + \inheritanchor[from=and gate IEC]{south west} + \inheritanchor[from=nand gate IEC]{output} + \inheritbackgroundpath[from=nand gate IEC] + \foregroundpath{\pgf@lib@sh@logicgates@IEC@foregroundpath{not}} + \inheritanchorborder[from=and gate IEC] } \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex index ae857c6fd42..f941abd2647 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 @@ -217,7 +217,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An and gate must have at least two inputs}{}% + \pgferror{An and gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -454,7 +454,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A nand gate must have at least two inputs}{}% + \pgferror{A nand gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -619,7 +619,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An or gate must have at least two inputs}{}% + \pgferror{An or gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -967,7 +967,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A nor gate must have at least two inputs}{}% + \pgferror{A nor gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -1166,7 +1166,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An xor gate must have at two inputs}{}% + \pgferror{An xor gate must have at two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -1497,7 +1497,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An xnor gate must have two inputs}{}% + \pgferror{An xnor gate must have two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -1657,7 +1657,7 @@ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate US\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1}% \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% - \PackageError{PGF}{A not gate must have one input}{}% + \pgferror{A not gate must have one input}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -1960,7 +1960,7 @@ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@buffer gate US\endcsname{% \pgf@lib@sh@logicgate@parseinputs{1}% \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax% - \PackageError{PGF}{A buffer gate must have one input}{}% + \pgferror{A buffer gate must have one input}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -2153,7 +2153,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{An and gate must have at least two inputs}{}% + \pgferror{An and gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% @@ -2405,7 +2405,7 @@ }{}% \repeatpgfmathloop% \ifnum\pgf@lib@sh@logicgate@numinputs<2\relax% - \PackageError{PGF}{A nand gate must have at least two inputs}{}% + \pgferror{A nand gate must have at least two inputs}% \fi% }% \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}% 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 440681b7b87..cfa1d80d442 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 @@ -247,9 +247,9 @@ \pgf@lib@callouts@shortenpointer% \pgf@lib@ellipsecallout@getpoints% \calloutpointeranchor% - \ifx\pgf@test\pgfutil@empty% + \ifx\pgf@node@name\pgfutil@empty% \else% - \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}% + \edef\pgf@sh@@temp{\noexpand\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% @@ -568,15 +568,15 @@ \pgfmathsetlengthmacro\pointerwidth{\pgfkeysvalueof{/pgf/callout pointer width}}% \pgf@lib@rectanglecallout@pointer% % - % \pgf@test = the shape name (from \pgfmultipartnode) + % \pgf@node@name = the shape name (from \pgfmultipartnode) % - \ifx\pgf@test\pgfutil@empty% + \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@test\noexpand\endcsname}% + \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% @@ -809,7 +809,7 @@ \pgfdeclareshape{cloud callout}{% \savedanchor\calloutpointer{% \pgfutil@ifundefined{pgf@sh@s@cloud}{% - \PackageError{PGF}{I cannot find the cloud shape. Please load the `symbol shapes' library}{}}{}% + \pgferror{I cannot find the cloud shape. Please load the `symbol shapes' library}}{}% \pgf@sh@s@cloud% \pgf@sh@savedmacros% % @@ -862,9 +862,9 @@ \pgfextract@process\calloutpointer{% \pgfpointanchor{pgf@lib@callout@pointer}{center}% }% - \ifx\pgf@test\pgfutil@empty% + \ifx\pgf@node@name\pgfutil@empty% \else% - \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}% + \edef\pgf@sh@@temp{\noexpand\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% 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 a57b0cd4511..5466b1a27f2 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,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.misc.code.tex,v 1.3 2008/10/07 18:23:25 vibrovski Exp $ +\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 $ \pgfdeclareshape{cross out} @@ -37,6 +37,8 @@ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}} \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}} \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}} + \pgfsetarrowsstart{} + \pgfsetarrowsend{} } } @@ -63,6 +65,8 @@ \foregroundpath{ \pgfpathmoveto{\southwest} \pgfpathlineto{\northeast} + \pgfsetarrowsstart{} + \pgfsetarrowsend{} } } @@ -1085,7 +1089,7 @@ \pgfmathanglebetweenpoints{\centerpoint}{\after@sw@anchor}% \ifdim\externalangle pt<\pgfmathresult pt\relax% after south west. \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% - {\before@sw@anchor}{\after@sw@anchor}% + {\sw@anchor}{\after@sw@anchor}% \else% \pgfpointintersectionoflines{\centerpoint}{\externalpoint}% {\after@sw@anchor}{\centerpoint\pgf@xa\pgf@x\after@sw@anchor\pgf@x\pgf@xa}% 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 b419a8cb624..efa492cc024 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,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.symbols.code.tex,v 1.3 2009/10/27 23:03:12 tantau Exp $ +\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 $ \pgfdeclareshape{forbidden sign} { @@ -43,6 +43,48 @@ \fi% \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{-0.707107\pgfutil@tempdima}{-0.707107\pgfutil@tempdima}}} \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0.707107\pgfutil@tempdima}{0.707107\pgfutil@tempdima}}} + \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] + \foregroundpath{ + \centerpoint% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfutil@tempdima=\radius% + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb% + \advance\pgfutil@tempdima by-\pgf@yb% + \else% + \advance\pgfutil@tempdima by-\pgf@xb% + \fi% + \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0.707107\pgfutil@tempdima}{-0.707107\pgfutil@tempdima}}} + \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{-0.707107\pgfutil@tempdima}{0.707107\pgfutil@tempdima}}} + \pgfsetarrowsstart{} + \pgfsetarrowsend{} } } @@ -57,468 +99,468 @@ % /pgf/random starburst : The seed for the random number generator. % \pgfkeys{/pgf/random starburst/% - .code={% - \ifx\pgfkeysnovalue#1% - \pgfmathgeneratepseudorandomnumber% - \else% - \pgfmathtruncatemacro\pgfmathresult{#1}% - \fi% - \pgfkeyslet{/pgf/random starburst}{\pgfmathresult}% - }% + .code={% + \ifx\pgfkeysnovalue#1% + \pgfmathgeneratepseudorandomnumber% + \else% + \pgfmathtruncatemacro\pgfmathresult{#1}% + \fi% + \pgfkeyslet{/pgf/random starburst}{\pgfmathresult}% + }% } \pgfkeys{/pgf/random starburst=100} \pgfkeys{/pgf/starburst point height/.value required} \pgfkeys{/pgf/starburst point height/.code={% - \pgfmathparse{#1}% - \edef\pgfmathresult{\pgfmathresult pt}% - \pgfkeyslet{/pgf/starburst point height}{\pgfmathresult}% - }% + \pgfmathparse{#1}% + \edef\pgfmathresult{\pgfmathresult pt}% + \pgfkeyslet{/pgf/starburst point height}{\pgfmathresult}% + }% }% \pgfkeys{/pgf/starburst point height=.5cm} \pgfkeys{/pgf/starburst points/.value required} \pgfkeys{/pgf/starburst points/.code={% - \pgfmathtruncatemacro\pgfmathresult{#1}% - \pgfkeyslet{/pgf/starburst points}{\pgfmathresult}% - }% + \pgfmathtruncatemacro\pgfmathresult{#1}% + \pgfkeyslet{/pgf/starburst points}{\pgfmathresult}% + }% }% \pgfkeys{/pgf/starburst points=17} \pgfdeclareshape{starburst}{% - \savedmacro\anglestep{% - \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}% - \let\anglestep\pgfmathresult% - } - \savedmacro\calculatestarburstpoints{% - % - % Get the angle step. - % - \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}% - \let\anglestep\pgfmathresult% - % - % Get the total number of points. - % - \pgfmathsetcounter{pgf@counta}{\pgfkeysvalueof{/pgf/starburst points}}% - \multiply\c@pgf@counta2\relax% - \edef\totalpoints{\the\c@pgf@counta}% - \addtosavedmacro{\totalpoints}% - % - % Calculate the centerpoint. - % - \pgfextract@process\centerpoint{% - \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% - \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% - }% - % - % Get the larger of the outer sep. - % - \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x<\pgf@y% - \pgf@x\pgf@y% - \fi% - \edef\outersep{\the\pgf@x}% - % - % Get the node dimensions. - % - \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/inner xsep}}% - \pgfmathaddtolength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/inner ysep}}% - \pgfmathaddtolength\pgf@y{+.5\ht\pgfnodeparttextbox}% - \pgfmathaddtolength\pgf@y{+.5\dp\pgfnodeparttextbox}% - % - % Calculate the inner radii. - % - \ifpgfshapeborderusesincircle% - \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}% - % - % Use the incircle... - % - \ifdim\pgf@y>\pgf@x% - \pgf@x\pgf@y% - \fi% - \pgf@x1.41421\pgf@x% - \pgf@y\pgf@x% - \else% - % - % Get the rotation (with rounding). - % - \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}% - \pgfmathmod@{\rotate}{360}% - \afterassignment\pgfmath@gobbletilpgfmath@% - \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@% - \advance\c@pgf@counta45\relax% - \divide\c@pgf@counta90\relax% - \multiply\c@pgf@counta90\relax% - \ifnum\c@pgf@counta<0\relax% - \advance\c@pgf@counta360\relax% - \fi% - % - % Calculate the width and height of the node - % contents, according to any border rotation. - % - \ifnum\c@pgf@counta=90\relax% - \pgf@xc\pgf@x% - \pgf@x\pgf@y% - \pgf@y\pgf@xc% - \else% - \ifnum\c@pgf@counta=270\relax% - \pgf@xc\pgf@x% - \pgf@x\pgf@y% - \pgf@y\pgf@xc% - \fi% - \fi% - \edef\rotate{\the\c@pgf@counta}% - % - % ...or not. - % - \pgf@x=1.41421\pgf@x% - \pgf@y=1.41421\pgf@y% - \fi% - \addtosavedmacro{\rotate}% - % - % Adjust innerradius for minimum width and height. - % - \pgf@xa\pgf@x% - \pgfmathsetlength\pgf@xb{+\pgfkeysvalueof{/pgf/starburst point height}}% - \advance\pgf@xa\pgf@xb% - \pgfmathsetlength\pgf@xc{+\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@xa<.5\pgf@xc% - \pgf@x.5\pgf@xc% - \advance\pgf@x-\pgf@xb% - \fi% - \pgf@ya\pgf@y% - \pgfmathsetlength\pgf@yb{+\pgfkeysvalueof{/pgf/starburst point height}}% - \advance\pgf@ya\pgf@yb% - \pgfmathsetlength\pgf@yc{+\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@ya<.5\pgf@yc% - \pgf@y.5\pgf@yc% - \advance\pgf@y-\pgf@yb% - \fi% - \edef\xinnerradius{\the\pgf@x}% - \edef\yinnerradius{\the\pgf@y}% - \addtosavedmacro{\xinnerradius}% - \addtosavedmacro{\yinnerradius}% - % - % Calculate a radius outside the starburst. - % - \ifdim\pgf@y>\pgf@x% - \pgf@x\pgf@y% - \fi% - \pgfmathaddtolength\pgf@x{+\pgfkeysvalueof{/pgf/starburst point height}}% - \edef\externalradius{\the\pgf@x}% - \addtosavedmacro{\externalradius}% - % - % Set the seed for the random number generator. - % - \pgfmathsetseed{\pgfkeysvalueof{/pgf/random starburst}}% - % - % Now create the points on the shape and also - % the miter length and angle for each point. - % - \def\angle{90}% Start at the top. - % - % At point a, the miter length and angle are calculated for point b = a - 1. - % - \c@pgf@counta1\relax% - \c@pgf@countb0\relax% - % - % As 3 consecutive points are required to be defined for miter - % calculations, it is necessary to go over the first two points - % again. - % - \c@pgf@countc\totalpoints\relax% - \advance\c@pgf@countc2\relax% - \edef\looppoints{\the\c@pgf@countc}% - \let\secondpoint\pgfutil@empty% - \let\thirdpoint\pgfutil@empty% - \pgfmathloop% - % - % Cycle the point definitions. - % - \let\firstpoint\secondpoint% - \let\secondpoint\thirdpoint% - \ifnum\pgfmathcounter>\looppoints% - \else% - \ifnum\pgfmathcounter>\totalpoints% - \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname% - \else% - \ifodd\pgfmathcounter% - % - % An outer point. - % - \ifnum\pgfkeysvalueof{/pgf/random starburst}=0\relax% - \pgf@xa\pgfkeysvalueof{/pgf/starburst point height}\relax% - \else% - \pgf@x\pgfkeysvalueof{/pgf/starburst point height}\relax% - \pgf@xa.75\pgf@x% - \pgf@xb.25\pgf@x% - \pgfmathrnd% - \pgf@xa\pgfmathresult\pgf@xa% - \advance\pgf@xa\pgf@xb% - \fi% - \pgf@x\xinnerradius\relax% - \advance\pgf@x\pgf@xa% - \pgf@y\yinnerradius\relax% - \advance\pgf@y\pgf@xa% - \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{% - \pgfpointpolar{\angle}{\the\pgf@x and \the\pgf@y}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \else% - % - % An inner point. - % - \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{% - \pgfpointpolar{\angle}{\xinnerradius and \yinnerradius}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \fi% - % - % Add the points to the saved macro. - % - \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname% - \expandafter\addtosavedmacro\expandafter{\csname point@\the\c@pgf@counta @\endcsname}% - \fi% - % - % It is only possible to do the miter calculations if three points are defined. - % - \ifx\firstpoint\pgfutil@empty% - \else% - % - % Calculate the miter length... - % - \pgfmathanglebetweenlines{\secondpoint}{\thirdpoint}{\secondpoint}{\firstpoint}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\defaultmiterangle\pgfmathresult% - \pgfmathcosec@{\pgfmathresult}% - \pgf@x\outersep\relax% - \pgf@x\pgfmathresult\pgf@x% - \edef\miterlength{\the\pgf@x}% - % - % ...the miter angle... - % - \pgfmathanglebetweenlines{\firstpoint}{\secondpoint}{\firstpoint}{\thirdpoint}% - \pgfmathadd@{\pgfmathresult}{\defaultmiterangle}% - \pgfmathsubtract@{180}{\pgfmathresult}% - \let\angletemp\pgfmathresult% - \pgfmathanglebetweenpoints{\firstpoint}{\thirdpoint}% - \pgfmathsubtract@{180}{\pgfmathresult}% - \pgfmathsubtract@{\angletemp}{\pgfmathresult}% - \edef\miterangle{\pgfmathresult}% - % - % ...and thus the border point. - % - \pgfextract@process\borderpoint{% - \secondpoint% - \pgf@xa\pgf@x - \pgf@ya\pgf@y% - \pgfpointpolar{\miterangle}{\miterlength}% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Get the angle from the centerpoint to the *unrotated* border points. - % - \pgfmathanglebetweenpoints{\centerpoint}{\borderpoint}% - \expandafter\edef\csname angletoborderpoint@\the\c@pgf@countb @\endcsname{\pgfmathresult}% - \expandafter\addtosavedmacro\expandafter{\csname angletoborderpoint@\the\c@pgf@countb @\endcsname}% - % - % Rotatee the border points and save. - % - \expandafter\pgfextract@process\csname borderpoint@\the\c@pgf@countb @\endcsname{% - \pgfmathrotatepointaround{\borderpoint}{\centerpoint}{\rotate}% - }% - \expandafter\addtosavedmacro\expandafter{\csname borderpoint@\the\c@pgf@countb @\endcsname}% - % - % Now create the anchors. - % - \c@pgf@countc\c@pgf@countb% - \advance\c@pgf@countc1\relax% - \divide\c@pgf@countc2\relax% - \ifodd\c@pgf@countb\relax% - \pgfutil@ifundefined{pgf@anchor@starburst@outer point\space\the\c@pgf@countc}{% - \expandafter\xdef\csname pgf@anchor@starburst@outer point\space\the\c@pgf@countc\endcsname{% - \noexpand\calculatestarburstpoints% - \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname% - }% - }{}% - \else% - \pgfutil@ifundefined{pgf@anchor@starburst@inner point\space\the\c@pgf@countc}{% - \expandafter\xdef\csname pgf@anchor@starburst@inner point\space\the\c@pgf@countc\endcsname{% - \noexpand\calculatestarburstpoints% - \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname% - }% - }{}% - \fi% - \fi% - \pgfmathadd@{\angle}{\anglestep}% - \pgfmathmod@{\pgfmathresult}{360}% - \let\angle\pgfmathresult% - \advance\c@pgf@counta1\relax% - \ifnum\c@pgf@counta>\totalpoints% - \c@pgf@counta1\relax% - \fi% - \advance\c@pgf@countb1\relax% - \ifnum\c@pgf@countb>\totalpoints% - \c@pgf@countb1\relax% - \fi% - \repeatpgfmathloop% - } - \savedanchor\centerpoint{% - \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% - \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% - }% - \savedanchor\midpoint{% - \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - \savedanchor\basepoint{% - \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% - \pgf@y0pt\relax% - }% - \anchor{center}{\centerpoint} - \anchor{base}{\basepoint} - \anchor{mid}{\midpoint} - \anchor{north}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{\externalradius}}% - } - \anchor{south}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}% - } - \anchor{east}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{0pt}}% - } - \anchor{west}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}% - } - \anchor{north west}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}% - } - \anchor{south west}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}% - } - \anchor{north east}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}% - } - \anchor{south east}{% - \calculatestarburstpoints% - \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}% - } - \backgroundpath{% - \calculatestarburstpoints% - \pgfmathloop% - \ifnum\pgfmathcounter>\totalpoints% - \else% - \ifnum\pgfmathcounter=1\relax% - \let\starburstaction\pgfpathmoveto% - \else% - \let\starburstaction\pgfpathlineto% - \fi% - \starburstaction{% - %\pgfmathrotatepointaround{\csname point@\pgfmathcounter @\endcsname}{\centerpoint}{\rotate}}% - \csname point@\pgfmathcounter @\endcsname} - \repeatpgfmathloop% - \pgfpathclose% - } - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Adjust the location of the external - % point relative to \centerpoint. - % - \centerpoint% - \pgf@xa\externalx\relax% - \pgf@ya\externaly\relax% - \advance\pgf@xa\pgf@x% - \advance\pgf@ya\pgf@y% - \edef\externalx{\the\pgf@xa}% - \edef\externaly{\the\pgf@ya}% - % - % Get the starburst points. - % - \calculatestarburstpoints% - % - % Get the angle of the external point to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - \pgfmathsubtract@{\pgfmathresult}{\rotate}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \let\externalangle\pgfmathresult% - % - % Locate the appropriate sides on the starburst border... - % - \ifdim\externalangle pt<90pt\relax% - \c@pgf@counta0\relax% - \c@pgf@countb\totalpoints\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \else% - \ifdim\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt>90pt\relax% - \c@pgf@counta\c@pgf@countb% - \else% - \ifdim\externalangle pt>\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt\relax% - \c@pgf@counta\c@pgf@countb% - \fi% - \fi% - \advance\c@pgf@countb-1\relax% - \repeatpgfmathloop% - \edef\first{\the\c@pgf@counta}% - \advance\c@pgf@counta1\relax% - \ifnum\c@pgf@counta>\totalpoints\relax% - \c@pgf@counta1\relax% - \fi% - \edef\second{\the\c@pgf@counta}% - \else% - \c@pgf@counta0\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \else% - \ifdim\csname angletoborderpoint@\pgfmathcounter @\endcsname pt<90pt\relax% - \c@pgf@counta\pgfmathcounter% - \else% - \ifdim\externalangle pt<\csname angletoborderpoint@\pgfmathcounter @\endcsname pt\relax% - \c@pgf@counta\pgfmathcounter% - \fi% - \fi% - \repeatpgfmathloop% - \edef\first{\the\c@pgf@counta}% - \advance\c@pgf@counta-1\relax% - \ifnum\c@pgf@counta=0\relax% - \c@pgf@counta\totalpoints\relax% - \fi% - \edef\second{\the\c@pgf@counta}% - \fi% - % - % ...and thus, the point on the star border. - % - \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - {\csname borderpoint@\first @\endcsname}{\csname borderpoint@\second @\endcsname}% - }% + \savedmacro\anglestep{% + \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}% + \let\anglestep\pgfmathresult% + } + \savedmacro\calculatestarburstpoints{% + % + % Get the angle step. + % + \pgfmathdivide@{180}{\pgfkeysvalueof{/pgf/starburst points}}% + \let\anglestep\pgfmathresult% + % + % Get the total number of points. + % + \pgfmathsetcounter{pgf@counta}{\pgfkeysvalueof{/pgf/starburst points}}% + \multiply\c@pgf@counta2\relax% + \edef\totalpoints{\the\c@pgf@counta}% + \addtosavedmacro{\totalpoints}% + % + % Calculate the centerpoint. + % + \pgfextract@process\centerpoint{% + \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% + \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% + }% + % + % Get the larger of the outer sep. + % + \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x<\pgf@y% + \pgf@x\pgf@y% + \fi% + \edef\outersep{\the\pgf@x}% + % + % Get the node dimensions. + % + \pgfmathsetlength\pgf@x{+\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathaddtolength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgfmathsetlength\pgf@y{+\pgfkeysvalueof{/pgf/inner ysep}}% + \pgfmathaddtolength\pgf@y{+.5\ht\pgfnodeparttextbox}% + \pgfmathaddtolength\pgf@y{+.5\dp\pgfnodeparttextbox}% + % + % Calculate the inner radii. + % + \ifpgfshapeborderusesincircle% + \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}% + % + % Use the incircle... + % + \ifdim\pgf@y>\pgf@x% + \pgf@x\pgf@y% + \fi% + \pgf@x1.41421\pgf@x% + \pgf@y\pgf@x% + \else% + % + % Get the rotation (with rounding). + % + \pgfkeysgetvalue{/pgf/shape border rotate}{\rotate}% + \pgfmathmod@{\rotate}{360}% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgf@counta\pgfmathresult\relax\pgfmath@% + \advance\c@pgf@counta45\relax% + \divide\c@pgf@counta90\relax% + \multiply\c@pgf@counta90\relax% + \ifnum\c@pgf@counta<0\relax% + \advance\c@pgf@counta360\relax% + \fi% + % + % Calculate the width and height of the node + % contents, according to any border rotation. + % + \ifnum\c@pgf@counta=90\relax% + \pgf@xc\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xc% + \else% + \ifnum\c@pgf@counta=270\relax% + \pgf@xc\pgf@x% + \pgf@x\pgf@y% + \pgf@y\pgf@xc% + \fi% + \fi% + \edef\rotate{\the\c@pgf@counta}% + % + % ...or not. + % + \pgf@x=1.41421\pgf@x% + \pgf@y=1.41421\pgf@y% + \fi% + \addtosavedmacro{\rotate}% + % + % Adjust innerradius for minimum width and height. + % + \pgf@xa\pgf@x% + \pgfmathsetlength\pgf@xb{+\pgfkeysvalueof{/pgf/starburst point height}}% + \advance\pgf@xa\pgf@xb% + \pgfmathsetlength\pgf@xc{+\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@xa<.5\pgf@xc% + \pgf@x.5\pgf@xc% + \advance\pgf@x-\pgf@xb% + \fi% + \pgf@ya\pgf@y% + \pgfmathsetlength\pgf@yb{+\pgfkeysvalueof{/pgf/starburst point height}}% + \advance\pgf@ya\pgf@yb% + \pgfmathsetlength\pgf@yc{+\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@ya<.5\pgf@yc% + \pgf@y.5\pgf@yc% + \advance\pgf@y-\pgf@yb% + \fi% + \edef\xinnerradius{\the\pgf@x}% + \edef\yinnerradius{\the\pgf@y}% + \addtosavedmacro{\xinnerradius}% + \addtosavedmacro{\yinnerradius}% + % + % Calculate a radius outside the starburst. + % + \ifdim\pgf@y>\pgf@x% + \pgf@x\pgf@y% + \fi% + \pgfmathaddtolength\pgf@x{+\pgfkeysvalueof{/pgf/starburst point height}}% + \edef\externalradius{\the\pgf@x}% + \addtosavedmacro{\externalradius}% + % + % Set the seed for the random number generator. + % + \pgfmathsetseed{\pgfkeysvalueof{/pgf/random starburst}}% + % + % Now create the points on the shape and also + % the miter length and angle for each point. + % + \def\angle{90}% Start at the top. + % + % At point a, the miter length and angle are calculated for point b = a - 1. + % + \c@pgf@counta1\relax% + \c@pgf@countb0\relax% + % + % As 3 consecutive points are required to be defined for miter + % calculations, it is necessary to go over the first two points + % again. + % + \c@pgf@countc\totalpoints\relax% + \advance\c@pgf@countc2\relax% + \edef\looppoints{\the\c@pgf@countc}% + \let\secondpoint\pgfutil@empty% + \let\thirdpoint\pgfutil@empty% + \pgfmathloop% + % + % Cycle the point definitions. + % + \let\firstpoint\secondpoint% + \let\secondpoint\thirdpoint% + \ifnum\pgfmathcounter>\looppoints% + \else% + \ifnum\pgfmathcounter>\totalpoints% + \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname% + \else% + \ifodd\pgfmathcounter% + % + % An outer point. + % + \ifnum\pgfkeysvalueof{/pgf/random starburst}=0\relax% + \pgf@xa\pgfkeysvalueof{/pgf/starburst point height}\relax% + \else% + \pgf@x\pgfkeysvalueof{/pgf/starburst point height}\relax% + \pgf@xa.75\pgf@x% + \pgf@xb.25\pgf@x% + \pgfmathrnd% + \pgf@xa\pgfmathresult\pgf@xa% + \advance\pgf@xa\pgf@xb% + \fi% + \pgf@x\xinnerradius\relax% + \advance\pgf@x\pgf@xa% + \pgf@y\yinnerradius\relax% + \advance\pgf@y\pgf@xa% + \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{% + \pgfpointpolar{\angle}{\the\pgf@x and \the\pgf@y}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \else% + % + % An inner point. + % + \expandafter\pgfextract@process\csname point@\the\c@pgf@counta @\endcsname{% + \pgfpointpolar{\angle}{\xinnerradius and \yinnerradius}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \fi% + % + % Add the points to the saved macro. + % + \expandafter\let\expandafter\thirdpoint\csname point@\the\c@pgf@counta @\endcsname% + \expandafter\addtosavedmacro\expandafter{\csname point@\the\c@pgf@counta @\endcsname}% + \fi% + % + % It is only possible to do the miter calculations if three points are defined. + % + \ifx\firstpoint\pgfutil@empty% + \else% + % + % Calculate the miter length... + % + \pgfmathanglebetweenlines{\secondpoint}{\thirdpoint}{\secondpoint}{\firstpoint}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\defaultmiterangle\pgfmathresult% + \pgfmathcosec@{\pgfmathresult}% + \pgf@x\outersep\relax% + \pgf@x\pgfmathresult\pgf@x% + \edef\miterlength{\the\pgf@x}% + % + % ...the miter angle... + % + \pgfmathanglebetweenlines{\firstpoint}{\secondpoint}{\firstpoint}{\thirdpoint}% + \pgfmathadd@{\pgfmathresult}{\defaultmiterangle}% + \pgfmathsubtract@{180}{\pgfmathresult}% + \let\angletemp\pgfmathresult% + \pgfmathanglebetweenpoints{\firstpoint}{\thirdpoint}% + \pgfmathsubtract@{180}{\pgfmathresult}% + \pgfmathsubtract@{\angletemp}{\pgfmathresult}% + \edef\miterangle{\pgfmathresult}% + % + % ...and thus the border point. + % + \pgfextract@process\borderpoint{% + \secondpoint% + \pgf@xa\pgf@x + \pgf@ya\pgf@y% + \pgfpointpolar{\miterangle}{\miterlength}% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Get the angle from the centerpoint to the *unrotated* border points. + % + \pgfmathanglebetweenpoints{\centerpoint}{\borderpoint}% + \expandafter\edef\csname angletoborderpoint@\the\c@pgf@countb @\endcsname{\pgfmathresult}% + \expandafter\addtosavedmacro\expandafter{\csname angletoborderpoint@\the\c@pgf@countb @\endcsname}% + % + % Rotatee the border points and save. + % + \expandafter\pgfextract@process\csname borderpoint@\the\c@pgf@countb @\endcsname{% + \pgfmathrotatepointaround{\borderpoint}{\centerpoint}{\rotate}% + }% + \expandafter\addtosavedmacro\expandafter{\csname borderpoint@\the\c@pgf@countb @\endcsname}% + % + % Now create the anchors. + % + \c@pgf@countc\c@pgf@countb% + \advance\c@pgf@countc1\relax% + \divide\c@pgf@countc2\relax% + \ifodd\c@pgf@countb\relax% + \pgfutil@ifundefined{pgf@anchor@starburst@outer point\space\the\c@pgf@countc}{% + \expandafter\xdef\csname pgf@anchor@starburst@outer point\space\the\c@pgf@countc\endcsname{% + \noexpand\calculatestarburstpoints% + \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname% + }% + }{}% + \else% + \pgfutil@ifundefined{pgf@anchor@starburst@inner point\space\the\c@pgf@countc}{% + \expandafter\xdef\csname pgf@anchor@starburst@inner point\space\the\c@pgf@countc\endcsname{% + \noexpand\calculatestarburstpoints% + \noexpand\csname borderpoint@\the\c@pgf@countb @\noexpand\endcsname% + }% + }{}% + \fi% + \fi% + \pgfmathadd@{\angle}{\anglestep}% + \pgfmathmod@{\pgfmathresult}{360}% + \let\angle\pgfmathresult% + \advance\c@pgf@counta1\relax% + \ifnum\c@pgf@counta>\totalpoints% + \c@pgf@counta1\relax% + \fi% + \advance\c@pgf@countb1\relax% + \ifnum\c@pgf@countb>\totalpoints% + \c@pgf@countb1\relax% + \fi% + \repeatpgfmathloop% + } + \savedanchor\centerpoint{% + \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}% + \pgfmathaddtolength\pgf@y{+-.5\dp\pgfnodeparttextbox}% + }% + \savedanchor\midpoint{% + \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgfmathsetlength\pgf@y{+.5ex}% + }% + \savedanchor\basepoint{% + \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}% + \pgf@y0pt\relax% + }% + \anchor{center}{\centerpoint} + \anchor{base}{\basepoint} + \anchor{mid}{\midpoint} + \anchor{north}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{\externalradius}}% + } + \anchor{south}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{0pt}{-\externalradius}}% + } + \anchor{east}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{0pt}}% + } + \anchor{west}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{0pt}}% + } + \anchor{north west}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{\externalradius}}% + } + \anchor{south west}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{-\externalradius}{-\externalradius}}% + } + \anchor{north east}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{\externalradius}}% + } + \anchor{south east}{% + \calculatestarburstpoints% + \csname pgf@anchor@starburst@border\endcsname{\pgfqpoint{\externalradius}{-\externalradius}}% + } + \backgroundpath{% + \calculatestarburstpoints% + \pgfmathloop% + \ifnum\pgfmathcounter>\totalpoints% + \else% + \ifnum\pgfmathcounter=1\relax% + \let\starburstaction\pgfpathmoveto% + \else% + \let\starburstaction\pgfpathlineto% + \fi% + \starburstaction{% + %\pgfmathrotatepointaround{\csname point@\pgfmathcounter @\endcsname}{\centerpoint}{\rotate}}% + \csname point@\pgfmathcounter @\endcsname} + \repeatpgfmathloop% + \pgfpathclose% + } + \anchorborder{% + % + % Save x and y. + % + \edef\externalx{\the\pgf@x}% + \edef\externaly{\the\pgf@y}% + % + % Adjust the location of the external + % point relative to \centerpoint. + % + \centerpoint% + \pgf@xa\externalx\relax% + \pgf@ya\externaly\relax% + \advance\pgf@xa\pgf@x% + \advance\pgf@ya\pgf@y% + \edef\externalx{\the\pgf@xa}% + \edef\externaly{\the\pgf@ya}% + % + % Get the starburst points. + % + \calculatestarburstpoints% + % + % Get the angle of the external point to the \centerpoint. + % + \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + \pgfmathsubtract@{\pgfmathresult}{\rotate}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\externalangle\pgfmathresult% + % + % Locate the appropriate sides on the starburst border... + % + \ifdim\externalangle pt<90pt\relax% + \c@pgf@counta0\relax% + \c@pgf@countb\totalpoints\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \else% + \ifdim\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt>90pt\relax% + \c@pgf@counta\c@pgf@countb% + \else% + \ifdim\externalangle pt>\csname angletoborderpoint@\the\c@pgf@countb @\endcsname pt\relax% + \c@pgf@counta\c@pgf@countb% + \fi% + \fi% + \advance\c@pgf@countb-1\relax% + \repeatpgfmathloop% + \edef\first{\the\c@pgf@counta}% + \advance\c@pgf@counta1\relax% + \ifnum\c@pgf@counta>\totalpoints\relax% + \c@pgf@counta1\relax% + \fi% + \edef\second{\the\c@pgf@counta}% + \else% + \c@pgf@counta0\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \else% + \ifdim\csname angletoborderpoint@\pgfmathcounter @\endcsname pt<90pt\relax% + \c@pgf@counta\pgfmathcounter% + \else% + \ifdim\externalangle pt<\csname angletoborderpoint@\pgfmathcounter @\endcsname pt\relax% + \c@pgf@counta\pgfmathcounter% + \fi% + \fi% + \repeatpgfmathloop% + \edef\first{\the\c@pgf@counta}% + \advance\c@pgf@counta-1\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta\totalpoints\relax% + \fi% + \edef\second{\the\c@pgf@counta}% + \fi% + % + % ...and thus, the point on the star border. + % + \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + {\csname borderpoint@\first @\endcsname}{\csname borderpoint@\second @\endcsname}% + }% } @@ -533,22 +575,22 @@ \newif\ifpgfcloudignoresaspect% \pgfcloudignoresaspectfalse% \pgfkeys{/pgf/.cd, - cloud puffs/.initial=10, - cloud puff arc/.initial=150, - cloud ignores aspect/.is if=pgfcloudignoresaspect, - cloud anchors use ellipse/.is if=pgfcloudanchorsuseellipse + cloud puffs/.initial=10, + cloud puff arc/.initial=150, + cloud ignores aspect/.is if=pgfcloudignoresaspect, + cloud anchors use ellipse/.is if=pgfcloudanchorsuseellipse }% % If symbol library is loaded separately these need to be defined. % \pgfkeys{/pgf/.cd, - aspect/.code={\pgfsetshapeaspect{#1}},% this for tikz... - shape aspect/.initial=1,% but this is consistent with other pgfset stuff. - shape aspect/.code={% - \pgfkeys{/pgf/aspect=#1}% - \pgfkeyssetvalue{/pgf/shape aspect}{#1} - }% + 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{% @@ -568,717 +610,717 @@ % Shape cloud. % \pgfdeclareshape{cloud}{% - \savedmacro\getradii{% - \pgfmathtruncatemacro\puffs{\pgfkeysvalueof{/pgf/cloud puffs}}% - \addtosavedmacro\puffs% - \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/cloud puffs}}% - \let\anglestep\pgfmathresult% - \addtosavedmacro\anglestep% - \pgfmathsetmacro\arc{\pgfkeysvalueof{/pgf/cloud puff arc}}% - \addtosavedmacro\arc% - % - % x radius. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgf@x1.4142135\pgf@x% - % - % y radius. - % - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - \pgf@y1.4142135\pgf@y% - % - % Adjust for shape aspect. - % - \ifpgfcloudignoresaspect% - \pgf@xc\pgf@x% - \pgf@yc\pgf@y% - \else% - \pgf@xc\pgfshapeaspect\pgf@y% - \ifdim\pgf@xc<\pgf@x% - \pgf@xc\pgf@x% - \fi% - \pgf@yc\pgfshapeaspectinverse\pgf@xc% - \ifdim\pgf@yc<\pgf@y% - \pgf@yc\pgf@y% - \pgf@xc\pgfshapeaspect\pgf@y% - \fi% - \fi% - % - \edef\xinnerradius{\the\pgf@xc}% - \edef\yinnerradius{\the\pgf@yc}% - % - % Get the larger of the outer sep. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x<\pgf@y% - \pgf@x\pgf@y% - \fi% - \edef\outersep{\the\pgf@x}% - \addtosavedmacro\outersep% - % - % For a given cloud, with puff arc length a, the quotient of the - % distance between the start and end point of a puffs circular arc - % and the radius of that arc, is constant: - % - % g = .5 * sec((180-a)/2) - % - \pgfmathsubtract{180}{\arc}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\tempangle\pgfmathresult% - \pgfmathsec@{\pgfmathresult}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\arcradiusquotient\pgfmathresult% - \addtosavedmacro\arcradiusquotient% - % - % In addition, the quotient of the distance between the start and - % end point of a puffs circular arc and the height of that arc - % (ignoring rotation), is also constant: - % - % h = .5 * (1-sin((180-a)/2))/cos((180-a)/2) - % = g * (1 - sin((180-a)/2)) - \pgfmathsin@{\tempangle}% - \pgfmathsubtract@{1}{\pgfmathresult}% - \pgfmathmultiply@{\pgfmathresult}{\arcradiusquotient}% - \let\archeightquotient\pgfmathresult% - \addtosavedmacro\archeightquotient% - % - % Minimum size is applied to the circum-ellipse (i.e. the ellipse - % that passes through the extremeties of each puff). Thus, the - % relationship between the radii of the elliptical incircle ("inellipse"?) - % of the cloud (x and y) and the radii of the circum-ellispe (X and Y), - % is given by - % - % X = 2(x*cos(p/2) + ky) - % Y = 2(y*cos(p/2) + kx) - % - % where: - % k = sin(p/2)*((1-cos(a/2))/sin(a/2)) - % p = the angle between each puff (i.e. 360/<puffs>) - % a = the length of arc of the puff. - % - \pgfmathdivide{\arc}{2}% - \let\halfarcangle\pgfmathresult% - \pgfmathcos@{\pgfmathresult}% - \pgfmathsubtract@{1}{\pgfmathresult}% - \let\pgf@temp\pgfmathresult% - \pgfmathsin@{\halfarcangle}% - \pgfmathdivide@{\pgf@temp}{\pgfmathresult}% - \let\pgf@temp\pgfmathresult% - \pgfmathdivide@{\anglestep}{2}% - \pgfmathsin@{\pgfmathresult}% - \pgfmathmultiply@{\pgfmathresult}{\pgf@temp}% - \let\k\pgfmathresult% - % - \pgfmathdivide@{\anglestep}{2}% - \pgfmathcos@{\pgfmathresult}% - \let\coshalfanglestep\pgfmathresult% - % - % Calculate the actual radii of the circum-ellipse. - % - \pgf@x\xinnerradius\relax% - \pgf@y\yinnerradius\relax% - \pgf@xa\coshalfanglestep\pgf@x% - \advance\pgf@xa\k\pgf@y% - \pgf@ya\coshalfanglestep\pgf@y% - \advance\pgf@ya\k\pgf@x% - % - % Adjust for minimum height (Y'). - % - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@ya<.5\pgf@yb% - \pgf@ya.5\pgf@yb% - \fi% - % - % Adjust for minimum width (X'). - % - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@xa<.5\pgf@xb% - \pgf@xa.5\pgf@xb% - \fi% - % - \edef\xouterradius{\the\pgf@xa}% - \addtosavedmacro\xouterradius% - \edef\youterradius{\the\pgf@ya}% - \addtosavedmacro\youterradius% - % - % Now recalculate `in-ellispe' radii: - % - % x = (X'cos(p/2)-kY')/cos^2(p/2)-k^2, - % y = (Y'cos(p/2)-kX')/cos^2(p/2)-k^2, - % - \pgf@xc\k pt\relax% - \pgf@xc-\k\pgf@xc% - \pgf@yc\coshalfanglestep pt\relax% - \pgf@yc\coshalfanglestep\pgf@yc% - \advance\pgf@xc\pgf@yc\relax% - \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@xc}}% cos^2(p/2)-k^2 - % - \pgf@x\coshalfanglestep\pgf@xa% - \advance\pgf@x-\k\pgf@ya% - \pgf@x\pgfmathresult\pgf@x% - \pgf@y\coshalfanglestep\pgf@ya% - \advance\pgf@y-\k\pgf@xa% - \pgf@y\pgfmathresult\pgf@y% - % - \edef\xinnerradius{\the\pgf@x}% - \edef\yinnerradius{\the\pgf@y}% - \addtosavedmacro\xinnerradius% - \addtosavedmacro\yinnerradius% - % - % Get some useful trig. constants. - % - \pgfmathdivide@{\arc}{4}% - \let\quarterarc\pgfmathresult% - \pgfmathsubtract@{180}{\arc}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\halfcomplementarc\pgfmathresult% - % - \addtosavedmacro\arc% - \addtosavedmacro\quarterarc% - \addtosavedmacro\halfcomplementarc% - % - \pgfmathsec@{\halfcomplementarc}% 1/cos((180-a)/2) - \let\sechalfcomplementarc\pgfmathresult% - \pgfmathsin@{\halfcomplementarc}% sin((180-a)/2) - \let\sinhalfcomplementarc\pgfmathresult% - % - \addtosavedmacro\sechalfcomplementarc% - \addtosavedmacro\sinhalfcomplementarc% - % - \pgfmathsin@{\quarterarc}% sin(a/4) - \let\sinquarterarc\pgfmathresult% - \pgfmathcos@{\quarterarc}% cos(a/4) - \let\cosquarterarc\pgfmathresult% - \pgfmathreciprocal@{\cosquarterarc}% - \pgfmathmultiply@{\pgfmathresult}{\sinquarterarc}% tan(a/4) - \let\tanquarterarc\pgfmathresult% - % - \addtosavedmacro\sinquarterarc% - \addtosavedmacro\cosquarterarc% - \addtosavedmacro\tanquarterarc% - % - } - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - } - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint} - \anchor{mid}{\midpoint} - \anchor{base}{\basepoint} - \anchor{north}{% - \getradii% - \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{\youterradius}}% - }% - \anchor{south}{% - \getradii% - \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{-\youterradius}}% - }% - \anchor{east}{% - \getradii% - \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{\xouterradius}{0pt}}% - }% - \anchor{west}{% - \getradii% - \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{-\xouterradius}{0pt}}% - }% - \anchor{north west}{% - \getradii% - \pgfextract@process\pgf@sh{% - \pgf@x\xouterradius\relax% - \pgf@x-0.707106\pgf@x% - \pgf@y\youterradius\relax% - \pgf@y0.707106\pgf@y% - }% - \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% - }% - \anchor{north east}{% - \getradii% - \pgfextract@process\pgf@sh{% - \pgf@x\xouterradius\relax% - \pgf@x0.707106\pgf@x% - \pgf@y\youterradius\relax% - \pgf@y0.707106\pgf@y% - }% - \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% - }% - \anchor{south west}{% - \getradii% - \pgfextract@process\pgf@sh{% - \pgf@x\xouterradius\relax% - \pgf@x-0.707106\pgf@x% - \pgf@y\youterradius\relax% - \pgf@y-0.707106\pgf@y% - }% - \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% - }% - \anchor{south east}{% - \getradii% - \pgfextract@process\pgf@sh{% - \pgf@x\xouterradius\relax% - \pgf@x0.707106\pgf@x% - \pgf@y\youterradius\relax% - \pgf@y-0.707106\pgf@y% - }% - \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% - }% - % - % Each `puff' is a circular arc of length a, drawn using two a/2 - % arcs (a < 180), approximated by Bezier curves. - % Due to TeX rounding errors, it is sometimes necessary to `force' - % the arc to end at a specific point. So... - % - % @article{riskus2006, - % author = {Aleskus Ri\v{s}kus}, - % title = {Approximation of a cubic Bezier curve by circular arcs and vice versa}, - % journal = {Information Technology and Control}, - % year = {2006}, - % volume = {35}, - % number = {4} - % } - % - \backgroundpath{% - {% - \getradii% - % - % Get the start angle. - % - \pgfmathdivide@{\anglestep}{2}% - \pgfmathsubtract@{90}{\pgfmathresult}% - \let\angle\pgfmathresult% - % - % Calculate the first arc point. - % - \pgfextract@process\arcfirstpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% - }% - }% - \pgfpathmoveto{\arcfirstpoint}% - \let\arcendpoint\arcfirstpoint% - % - \pgfmathloop% - \ifnum\pgfmathcounter>\puffs\relax% - \else - \let\arcstartpoint\arcendpoint% - % - % Make sure beginning and end of path are exactly the same. - % - \ifnum\pgfmathcounter=\puffs\relax% - \let\arcendpoint\arcfirstpoint% - \else% - \pgfmathadd@{\angle}{\anglestep}% - \let\angle\pgfmathresult% - \pgfextract@process\arcendpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% - }% - }% - \fi% - % - % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. - % - \pgf@sh@getcloudpuffparameters% - % - % Get the rotation for the Bezier curve. - % - \pgfmathsubtract@{90}{\quarterarc}% - \pgfmathadd@{\pgfmathresult}{\arcslope}% - \let\arcrotate\pgfmathresult% - \pgfmathsin@{\arcrotate}% - \let\sinarcrotate\pgfmathresult% - \pgfmathcos@{\arcrotate}% - \let\cosarcrotate\pgfmathresult% - % - % Calculate the amount by which to scale the control - % points, in order to approximate an a/2 arc with radius x. - % - \pgf@x\arcradius\relax% - \pgf@x\tanquarterarc\pgf@x% tan(a/4) - \edef\controlscale{\pgfmath@tonumber{\pgf@x}}% - % - % Get the first control point for the first arc (length a/2)... - % - \pgfextract@process\controlone{% - % - % k = 0.552284745 (a `magic' number)... - % - \pgf@x0.55228475pt\relax% - \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) - \pgf@y0.55228475pt\relax% - \pgf@y\cosquarterarc\pgf@y% k * cos(a/2) - % - % ...scale the control points up... - % - \pgf@x\controlscale\pgf@x% - \pgf@y\controlscale\pgf@y% - % - % ...rotate... - % - \pgf@xa\cosarcrotate\pgf@x% - \advance\pgf@xa-\sinarcrotate\pgf@y% - \pgf@ya\cosarcrotate\pgf@y% - \advance\pgf@ya\sinarcrotate\pgf@x% - % - % ...and shift. - % - \arcstartpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Get the midpoint of the 150° arc. - % - \pgfextract@process\arcmidpoint{% - \pgfextract@process\arcmidpoint{% - \pgf@x-\halfchordlength\relax% - \pgf@y\segmentheight\relax% - }% - \pgfpointadd{\arcstartpoint}{% - \pgfmathrotatepointaround{\arcmidpoint}{\pgfpointorigin}{\arcslope}% - }% - }% - % - % Get the second control point for the first arc (length a/2)... - % - \pgfextract@process\controltwo{% - \pgf@x0.55228475pt\relax% - \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) - \pgf@y-0.55228475pt\relax% - \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) - % - % ...scale, rotate and shift. - % - \pgf@x\controlscale\pgf@x% - \pgf@y\controlscale\pgf@y% - % - \pgf@xa\cosarcrotate\pgf@x% - \advance\pgf@xa-\sinarcrotate\pgf@y% - \pgf@ya\cosarcrotate\pgf@y% - \advance\pgf@ya\sinarcrotate\pgf@x% - % - \arcmidpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - {% - \pgfsetcornersarced{\pgfpointorigin}% - \pgfpathcurveto{\controlone}{\controltwo}{\arcmidpoint}% - }% - % - % Do the same for the second arc... - % - \pgfmathadd@{\quarterarc}{90}% - \pgfmathadd@{\pgfmathresult}{\arcslope}% - \let\arcrotate\pgfmathresult% - \pgfmathsin@{\arcrotate}% - \let\sinarcrotate\pgfmathresult% - \pgfmathcos@{\arcrotate}% - \let\cosarcrotate\pgfmathresult% - % - % First control point for the second arc... - % - \pgfextract@process\controlone{% - \pgf@x0.55228475pt\relax% - \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) - \pgf@y0.55228475pt\relax% - \pgf@y\cosquarterarc\pgf@y% k * cos(a/2) - % - % ...scale, rotate and shift. - % - \pgf@x\controlscale\pgf@x% - \pgf@y\controlscale\pgf@y% - % - \pgf@xa\cosarcrotate\pgf@x% - \advance\pgf@xa-\sinarcrotate\pgf@y% - \pgf@ya\cosarcrotate\pgf@y% - \advance\pgf@ya\sinarcrotate\pgf@x% - % - \arcmidpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - % - % Second control point for the second arc. - % - \pgfextract@process\controltwo{% - \pgf@x0.55228475pt\relax% - \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) - \pgf@y-0.55228475pt\relax% - \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) - % - % ...scale, rotate and shift. - % - \pgf@x\controlscale\pgf@x% - \pgf@y\controlscale\pgf@y% - % - \pgf@xa\cosarcrotate\pgf@x% - \advance\pgf@xa-\sinarcrotate\pgf@y% - \pgf@ya\cosarcrotate\pgf@y% - \advance\pgf@ya\sinarcrotate\pgf@x% - % - \arcendpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfpathcurveto{\controlone}{\controltwo}{\arcendpoint}% - \repeatpgfmathloop% - \pgfpathclose% Phew! - }% - }% - % - % Calculate a point on the border of the cloud. This is a two-stage process: - % - % 1. Locate the correct puff. - % 2. Locate the angle on the circular arc which forms the puff. - % - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Get the inner radii and trig. constants. - % - \getradii% - % - % - % - \ifpgfcloudanchorsuseellipse% - \pgfpointadd{\centerpoint}{% - \pgfpointborderellipse{% - \pgfpoint{\externalx}{\externaly} - }{% - \pgfpoint{\xouterradius}{\youterradius} - }% - }% - \else% - \pgfextract@process\externalpoint{% - \centerpoint% - \advance\pgf@x\externalx\relax% - \advance\pgf@y\externaly\relax% - }% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - % - % 1. Locate the correct puff: - % - % Get end angle of the relavent puff arc. - % - \pgfmathdivide@{\anglestep}{2}% - \let\halfanglestep\pgfmathresult% - \pgfmathsubtract@{90}{\halfanglestep}% - \let\endangle\pgfmathresult% - \pgfmathloop% - \pgfmathsubtract@{\endangle}{\anglestep}% - \ifdim\pgfmathresult pt<-\anglestep pt\relax% - \else% - \let\endangle\pgfmathresult% - \repeatpgfmathloop% - \def\angle{0}% - \let\lastangle\angle% - \pgfmathloop% - \pgfmathadd@{\endangle}{\anglestep}% - \let\endangle\pgfmathresult% - % - % Calculate the `miter point'. This is the point between - % each puff, and takes into account the outer sep. - % - \pgfextract@process\miterpoint{% - % - \pgfextract@process\secondpoint{% - \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}% - }% - % - \pgfmathadd@{\endangle}{\anglestep}% - \let\angletemp\pgfmathresult% - \pgfextract@process\thirdpoint{% - \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}% - }% - % - \pgfmathsubtract@{\endangle}{\anglestep}% - \let\angletemp\pgfmathresult% - \pgfextract@process\firstpoint{% - \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}% - }% - % - \pgfmathanglebetweenpoints{\firstpoint}{\secondpoint}% - \let\anglealpha\pgfmathresult% - \pgfmathanglebetweenpoints{\secondpoint}{\thirdpoint}% - \let\anglebeta\pgfmathresult% - % - \pgfmathsubtract@{\anglebeta}{\anglealpha}% - \pgfmathdivide@{\pgfmathresult}{2}% - \pgfmathadd@{\pgfmathresult}{\halfcomplementarc}% - \pgfmathcosec@{\pgfmathresult}% - \pgf@x\outersep\relax% - \pgf@x\pgfmathresult\pgf@x% - \edef\miterradius{\the\pgf@x}% - % - \pgfmathadd@{\anglealpha}{\anglebeta}% - \pgfmathsubtract@{\pgfmathresult}{180}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\miterangle\pgfmathresult% - \pgfpointadd{\secondpoint}{% - \pgfqpointpolar{\miterangle}{\miterradius}% - }% - }% - % - % Get the angle of the miter point... - % - \pgfmathanglebetweenpoints{\pgfpointorigin}{\miterpoint}% - \let\angle\pgfmathresult% - \ifdim\angle pt<\lastangle pt\relax% Guard against 360° = 0° - \pgfmathadd@{\angle}{360}% - \let\angle\pgfmathresult% - \fi% - \let\lastangle\angle% - % - % ...and see if it is greater than the external point. - % - \ifdim\externalangle pt>\angle pt\relax% - \repeatpgfmathloop% - % - % Get the start angle of the relevant arc and ensure angles are in the range. - % - \pgfmathmod@{\endangle}{360}% - \let\endangle\pgfmathresult% - \pgfmathsubtract@{\endangle}{\anglestep}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathadd@{\pgfmathresult}{360}% - \fi% - \let\startangle\pgfmathresult% - % - % Now, get the start and end points of the arc. - % - \pgfextract@process\arcstartpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\startangle}{+\xinnerradius and +\yinnerradius}% - }% - }% - \pgfextract@process\arcendpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}% - }% - }% - % - % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. - % - \pgf@sh@getcloudpuffparameters% - % - % Hackery, for when an arc straddles 0°. - % - \ifdim\endangle pt<\startangle pt\relax% - \pgfmathadd@{\externalangle}{180}% - \pgfmathmod@{\pgfmathresult}{360}% - \let\x\pgfmathresult% - \else% - \let\x\externalangle% - \fi% - % - % 2. Locate the angle on the circular arc which forms the puff. - % - % Essentially a binary search to find the angle on the circular - % arc, which provides the nearset estimate to the border point. - % - \let\s\halfcomplementarc% The start of the arc. - \pgfmathadd@{\s}{\arc}% - \let\e\pgfmathresult% The end of the arc. - \pgfmathadd@{\e}{\s}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\n\pgfmathresult% The nearest estimate (default to middle of arc). - \def\m{360}% Measure of `nearness'. - \pgfmathloop% - \pgfmathadd@{\e}{\s}% - \pgfmathdivide@{\pgfmathresult}{2}% - \let\p\pgfmathresult% The point halfway between \s and \e. - \ifdim\p pt=\s pt\relax% - \else% - % - % Get the point on the circular arc. - % - \pgfmathadd@{\p}{\arcslope}% - \let\a\pgfmathresult% - \pgfextract@process\arcpoint{% - \pgfpointadd{\circlecenterpoint}{% - \pgfqpointpolar{\a}{\outerarcradius}% - }% - }% - % - % Find the angle between the node centre and the point on the arc. - % - \pgfmathanglebetweenpoints{\centerpoint}{\arcpoint}% - % - % Hackery, for when an arc straddles 0°. - % - \ifdim\endangle pt<\startangle pt\relax% - \pgfmathadd@{\pgfmathresult}{180}% - \pgfmathmod@{\pgfmathresult}{360}% - \fi% - \let\q\pgfmathresult% - \ifdim\x pt=\q pt% Found it! - \pgfmathbreakloop% Breaks after current iteration is complete. - \else - \ifdim\x pt<\q pt\relax% - \let\e\p% - \else% - \let\s\p% - \fi% - \fi% - \pgfmathsubtract@{\x}{\q}% - \pgfmathabs@{\pgfmathresult}% - % - % Save the estimate if it is better than any previous estimate. - % - \ifdim\pgfmathresult pt<\m pt\relax% - \let\m\pgfmathresult% - \let\n\p% - \fi% - \repeatpgfmathloop% - % - % Use the nearest estimate as the anchor angle. - % - \pgfmathadd@{\n}{\arcslope}% - \let\anchorangle\pgfmathresult% - % - % Finally, the required point. - % - \pgfpointadd{\circlecenterpoint}{% - \pgfqpointpolar{\anchorangle}{\outerarcradius}% - }% - \fi% - }% Again, Phew! - % - % Now, a sneaky hack. This means an arbitrary `puff' anchors - % can be used for positiong the cloud shape. This is needed - % if a cloud is positioned using the `puff <n+1>' anchor, where - % n is the number of puffs of any previously drawn cloud. - % - \pgfutil@g@addto@macro\pgf@sh@s@cloud{% - \c@pgf@counta\puffs\relax% - \pgfmathloop% - \ifnum\c@pgf@counta>0\relax% - \pgfutil@ifundefined{pgf@anchor@cloud@puff\space\the\c@pgf@counta}{% - \expandafter\xdef\csname pgf@anchor@cloud@puff\space\the\c@pgf@counta\endcsname{% - \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}% - }% - }{\c@pgf@counta0\relax}% - \advance\c@pgf@counta-1\relax% - \repeatpgfmathloop% - }% + \savedmacro\getradii{% + \pgfmathtruncatemacro\puffs{\pgfkeysvalueof{/pgf/cloud puffs}}% + \addtosavedmacro\puffs% + \pgfmathdivide{360}{\pgfkeysvalueof{/pgf/cloud puffs}}% + \let\anglestep\pgfmathresult% + \addtosavedmacro\anglestep% + \pgfmathsetmacro\arc{\pgfkeysvalueof{/pgf/cloud puff arc}}% + \addtosavedmacro\arc% + % + % x radius. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgf@x1.4142135\pgf@x% + % + % y radius. + % + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + \pgf@y1.4142135\pgf@y% + % + % Adjust for shape aspect. + % + \ifpgfcloudignoresaspect% + \pgf@xc\pgf@x% + \pgf@yc\pgf@y% + \else% + \pgf@xc\pgfshapeaspect\pgf@y% + \ifdim\pgf@xc<\pgf@x% + \pgf@xc\pgf@x% + \fi% + \pgf@yc\pgfshapeaspectinverse\pgf@xc% + \ifdim\pgf@yc<\pgf@y% + \pgf@yc\pgf@y% + \pgf@xc\pgfshapeaspect\pgf@y% + \fi% + \fi% + % + \edef\xinnerradius{\the\pgf@xc}% + \edef\yinnerradius{\the\pgf@yc}% + % + % Get the larger of the outer sep. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x<\pgf@y% + \pgf@x\pgf@y% + \fi% + \edef\outersep{\the\pgf@x}% + \addtosavedmacro\outersep% + % + % For a given cloud, with puff arc length a, the quotient of the + % distance between the start and end point of a puffs circular arc + % and the radius of that arc, is constant: + % + % g = .5 * sec((180-a)/2) + % + \pgfmathsubtract{180}{\arc}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\tempangle\pgfmathresult% + \pgfmathsec@{\pgfmathresult}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\arcradiusquotient\pgfmathresult% + \addtosavedmacro\arcradiusquotient% + % + % In addition, the quotient of the distance between the start and + % end point of a puffs circular arc and the height of that arc + % (ignoring rotation), is also constant: + % + % h = .5 * (1-sin((180-a)/2))/cos((180-a)/2) + % = g * (1 - sin((180-a)/2)) + \pgfmathsin@{\tempangle}% + \pgfmathsubtract@{1}{\pgfmathresult}% + \pgfmathmultiply@{\pgfmathresult}{\arcradiusquotient}% + \let\archeightquotient\pgfmathresult% + \addtosavedmacro\archeightquotient% + % + % Minimum size is applied to the circum-ellipse (i.e. the ellipse + % that passes through the extremeties of each puff). Thus, the + % relationship between the radii of the elliptical incircle ("inellipse"?) + % of the cloud (x and y) and the radii of the circum-ellispe (X and Y), + % is given by + % + % X = 2(x*cos(p/2) + ky) + % Y = 2(y*cos(p/2) + kx) + % + % where: + % k = sin(p/2)*((1-cos(a/2))/sin(a/2)) + % p = the angle between each puff (i.e. 360/<puffs>) + % a = the length of arc of the puff. + % + \pgfmathdivide{\arc}{2}% + \let\halfarcangle\pgfmathresult% + \pgfmathcos@{\pgfmathresult}% + \pgfmathsubtract@{1}{\pgfmathresult}% + \let\pgf@temp\pgfmathresult% + \pgfmathsin@{\halfarcangle}% + \pgfmathdivide@{\pgf@temp}{\pgfmathresult}% + \let\pgf@temp\pgfmathresult% + \pgfmathdivide@{\anglestep}{2}% + \pgfmathsin@{\pgfmathresult}% + \pgfmathmultiply@{\pgfmathresult}{\pgf@temp}% + \let\k\pgfmathresult% + % + \pgfmathdivide@{\anglestep}{2}% + \pgfmathcos@{\pgfmathresult}% + \let\coshalfanglestep\pgfmathresult% + % + % Calculate the actual radii of the circum-ellipse. + % + \pgf@x\xinnerradius\relax% + \pgf@y\yinnerradius\relax% + \pgf@xa\coshalfanglestep\pgf@x% + \advance\pgf@xa\k\pgf@y% + \pgf@ya\coshalfanglestep\pgf@y% + \advance\pgf@ya\k\pgf@x% + % + % Adjust for minimum height (Y'). + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@ya<.5\pgf@yb% + \pgf@ya.5\pgf@yb% + \fi% + % + % Adjust for minimum width (X'). + % + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@xa<.5\pgf@xb% + \pgf@xa.5\pgf@xb% + \fi% + % + \edef\xouterradius{\the\pgf@xa}% + \addtosavedmacro\xouterradius% + \edef\youterradius{\the\pgf@ya}% + \addtosavedmacro\youterradius% + % + % Now recalculate `in-ellispe' radii: + % + % x = (X'cos(p/2)-kY')/cos^2(p/2)-k^2, + % y = (Y'cos(p/2)-kX')/cos^2(p/2)-k^2, + % + \pgf@xc\k pt\relax% + \pgf@xc-\k\pgf@xc% + \pgf@yc\coshalfanglestep pt\relax% + \pgf@yc\coshalfanglestep\pgf@yc% + \advance\pgf@xc\pgf@yc\relax% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@xc}}% cos^2(p/2)-k^2 + % + \pgf@x\coshalfanglestep\pgf@xa% + \advance\pgf@x-\k\pgf@ya% + \pgf@x\pgfmathresult\pgf@x% + \pgf@y\coshalfanglestep\pgf@ya% + \advance\pgf@y-\k\pgf@xa% + \pgf@y\pgfmathresult\pgf@y% + % + \edef\xinnerradius{\the\pgf@x}% + \edef\yinnerradius{\the\pgf@y}% + \addtosavedmacro\xinnerradius% + \addtosavedmacro\yinnerradius% + % + % Get some useful trig. constants. + % + \pgfmathdivide@{\arc}{4}% + \let\quarterarc\pgfmathresult% + \pgfmathsubtract@{180}{\arc}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\halfcomplementarc\pgfmathresult% + % + \addtosavedmacro\arc% + \addtosavedmacro\quarterarc% + \addtosavedmacro\halfcomplementarc% + % + \pgfmathsec@{\halfcomplementarc}% 1/cos((180-a)/2) + \let\sechalfcomplementarc\pgfmathresult% + \pgfmathsin@{\halfcomplementarc}% sin((180-a)/2) + \let\sinhalfcomplementarc\pgfmathresult% + % + \addtosavedmacro\sechalfcomplementarc% + \addtosavedmacro\sinhalfcomplementarc% + % + \pgfmathsin@{\quarterarc}% sin(a/4) + \let\sinquarterarc\pgfmathresult% + \pgfmathcos@{\quarterarc}% cos(a/4) + \let\cosquarterarc\pgfmathresult% + \pgfmathreciprocal@{\cosquarterarc}% + \pgfmathmultiply@{\pgfmathresult}{\sinquarterarc}% tan(a/4) + \let\tanquarterarc\pgfmathresult% + % + \addtosavedmacro\sinquarterarc% + \addtosavedmacro\cosquarterarc% + \addtosavedmacro\tanquarterarc% + % + } + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5ex}% + } + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \anchor{center}{\centerpoint} + \anchor{mid}{\midpoint} + \anchor{base}{\basepoint} + \anchor{north}{% + \getradii% + \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{\youterradius}}% + }% + \anchor{south}{% + \getradii% + \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{0pt}{-\youterradius}}% + }% + \anchor{east}{% + \getradii% + \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{\xouterradius}{0pt}}% + }% + \anchor{west}{% + \getradii% + \csname pgf@anchor@cloud@border\endcsname{\pgfqpoint{-\xouterradius}{0pt}}% + }% + \anchor{north west}{% + \getradii% + \pgfextract@process\pgf@sh{% + \pgf@x\xouterradius\relax% + \pgf@x-0.707106\pgf@x% + \pgf@y\youterradius\relax% + \pgf@y0.707106\pgf@y% + }% + \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% + }% + \anchor{north east}{% + \getradii% + \pgfextract@process\pgf@sh{% + \pgf@x\xouterradius\relax% + \pgf@x0.707106\pgf@x% + \pgf@y\youterradius\relax% + \pgf@y0.707106\pgf@y% + }% + \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% + }% + \anchor{south west}{% + \getradii% + \pgfextract@process\pgf@sh{% + \pgf@x\xouterradius\relax% + \pgf@x-0.707106\pgf@x% + \pgf@y\youterradius\relax% + \pgf@y-0.707106\pgf@y% + }% + \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% + }% + \anchor{south east}{% + \getradii% + \pgfextract@process\pgf@sh{% + \pgf@x\xouterradius\relax% + \pgf@x0.707106\pgf@x% + \pgf@y\youterradius\relax% + \pgf@y-0.707106\pgf@y% + }% + \csname pgf@anchor@cloud@border\endcsname{\pgf@sh}% + }% + % + % Each `puff' is a circular arc of length a, drawn using two a/2 + % arcs (a < 180), approximated by Bezier curves. + % Due to TeX rounding errors, it is sometimes necessary to `force' + % the arc to end at a specific point. So... + % + % @article{riskus2006, + % author = {Aleskus Ri\v{s}kus}, + % title = {Approximation of a cubic Bezier curve by circular arcs and vice versa}, + % journal = {Information Technology and Control}, + % year = {2006}, + % volume = {35}, + % number = {4} + % } + % + \backgroundpath{% + {% + \getradii% + % + % Get the start angle. + % + \pgfmathdivide@{\anglestep}{2}% + \pgfmathsubtract@{90}{\pgfmathresult}% + \let\angle\pgfmathresult% + % + % Calculate the first arc point. + % + \pgfextract@process\arcfirstpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% + }% + }% + \pgfpathmoveto{\arcfirstpoint}% + \let\arcendpoint\arcfirstpoint% + % + \pgfmathloop% + \ifnum\pgfmathcounter>\puffs\relax% + \else + \let\arcstartpoint\arcendpoint% + % + % Make sure beginning and end of path are exactly the same. + % + \ifnum\pgfmathcounter=\puffs\relax% + \let\arcendpoint\arcfirstpoint% + \else% + \pgfmathadd@{\angle}{\anglestep}% + \let\angle\pgfmathresult% + \pgfextract@process\arcendpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% + }% + }% + \fi% + % + % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. + % + \pgf@sh@getcloudpuffparameters% + % + % Get the rotation for the Bezier curve. + % + \pgfmathsubtract@{90}{\quarterarc}% + \pgfmathadd@{\pgfmathresult}{\arcslope}% + \let\arcrotate\pgfmathresult% + \pgfmathsin@{\arcrotate}% + \let\sinarcrotate\pgfmathresult% + \pgfmathcos@{\arcrotate}% + \let\cosarcrotate\pgfmathresult% + % + % Calculate the amount by which to scale the control + % points, in order to approximate an a/2 arc with radius x. + % + \pgf@x\arcradius\relax% + \pgf@x\tanquarterarc\pgf@x% tan(a/4) + \edef\controlscale{\pgfmath@tonumber{\pgf@x}}% + % + % Get the first control point for the first arc (length a/2)... + % + \pgfextract@process\controlone{% + % + % k = 0.552284745 (a `magic' number)... + % + \pgf@x0.55228475pt\relax% + \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) + \pgf@y0.55228475pt\relax% + \pgf@y\cosquarterarc\pgf@y% k * cos(a/2) + % + % ...scale the control points up... + % + \pgf@x\controlscale\pgf@x% + \pgf@y\controlscale\pgf@y% + % + % ...rotate... + % + \pgf@xa\cosarcrotate\pgf@x% + \advance\pgf@xa-\sinarcrotate\pgf@y% + \pgf@ya\cosarcrotate\pgf@y% + \advance\pgf@ya\sinarcrotate\pgf@x% + % + % ...and shift. + % + \arcstartpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Get the midpoint of the 150� arc. + % + \pgfextract@process\arcmidpoint{% + \pgfextract@process\arcmidpoint{% + \pgf@x-\halfchordlength\relax% + \pgf@y\segmentheight\relax% + }% + \pgfpointadd{\arcstartpoint}{% + \pgfmathrotatepointaround{\arcmidpoint}{\pgfpointorigin}{\arcslope}% + }% + }% + % + % Get the second control point for the first arc (length a/2)... + % + \pgfextract@process\controltwo{% + \pgf@x0.55228475pt\relax% + \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) + \pgf@y-0.55228475pt\relax% + \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) + % + % ...scale, rotate and shift. + % + \pgf@x\controlscale\pgf@x% + \pgf@y\controlscale\pgf@y% + % + \pgf@xa\cosarcrotate\pgf@x% + \advance\pgf@xa-\sinarcrotate\pgf@y% + \pgf@ya\cosarcrotate\pgf@y% + \advance\pgf@ya\sinarcrotate\pgf@x% + % + \arcmidpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + {% + \pgfsetcornersarced{\pgfpointorigin}% + \pgfpathcurveto{\controlone}{\controltwo}{\arcmidpoint}% + }% + % + % Do the same for the second arc... + % + \pgfmathadd@{\quarterarc}{90}% + \pgfmathadd@{\pgfmathresult}{\arcslope}% + \let\arcrotate\pgfmathresult% + \pgfmathsin@{\arcrotate}% + \let\sinarcrotate\pgfmathresult% + \pgfmathcos@{\arcrotate}% + \let\cosarcrotate\pgfmathresult% + % + % First control point for the second arc... + % + \pgfextract@process\controlone{% + \pgf@x0.55228475pt\relax% + \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) + \pgf@y0.55228475pt\relax% + \pgf@y\cosquarterarc\pgf@y% k * cos(a/2) + % + % ...scale, rotate and shift. + % + \pgf@x\controlscale\pgf@x% + \pgf@y\controlscale\pgf@y% + % + \pgf@xa\cosarcrotate\pgf@x% + \advance\pgf@xa-\sinarcrotate\pgf@y% + \pgf@ya\cosarcrotate\pgf@y% + \advance\pgf@ya\sinarcrotate\pgf@x% + % + \arcmidpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + % + % Second control point for the second arc. + % + \pgfextract@process\controltwo{% + \pgf@x0.55228475pt\relax% + \pgf@x\sinquarterarc\pgf@x% k * sin(a/2) + \pgf@y-0.55228475pt\relax% + \pgf@y\cosquarterarc\pgf@y% -k * cos(a/2) + % + % ...scale, rotate and shift. + % + \pgf@x\controlscale\pgf@x% + \pgf@y\controlscale\pgf@y% + % + \pgf@xa\cosarcrotate\pgf@x% + \advance\pgf@xa-\sinarcrotate\pgf@y% + \pgf@ya\cosarcrotate\pgf@y% + \advance\pgf@ya\sinarcrotate\pgf@x% + % + \arcendpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfpathcurveto{\controlone}{\controltwo}{\arcendpoint}% + \repeatpgfmathloop% + \pgfpathclose% Phew! + }% + }% + % + % Calculate a point on the border of the cloud. This is a two-stage process: + % + % 1. Locate the correct puff. + % 2. Locate the angle on the circular arc which forms the puff. + % + \anchorborder{% + % + % Save x and y. + % + \edef\externalx{\the\pgf@x}% + \edef\externaly{\the\pgf@y}% + % + % Get the inner radii and trig. constants. + % + \getradii% + % + % + % + \ifpgfcloudanchorsuseellipse% + \pgfpointadd{\centerpoint}{% + \pgfpointborderellipse{% + \pgfpoint{\externalx}{\externaly} + }{% + \pgfpoint{\xouterradius}{\youterradius} + }% + }% + \else% + \pgfextract@process\externalpoint{% + \centerpoint% + \advance\pgf@x\externalx\relax% + \advance\pgf@y\externaly\relax% + }% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + % + % 1. Locate the correct puff: + % + % Get end angle of the relavent puff arc. + % + \pgfmathdivide@{\anglestep}{2}% + \let\halfanglestep\pgfmathresult% + \pgfmathsubtract@{90}{\halfanglestep}% + \let\endangle\pgfmathresult% + \pgfmathloop% + \pgfmathsubtract@{\endangle}{\anglestep}% + \ifdim\pgfmathresult pt<-\anglestep pt\relax% + \else% + \let\endangle\pgfmathresult% + \repeatpgfmathloop% + \def\angle{0}% + \let\lastangle\angle% + \pgfmathloop% + \pgfmathadd@{\endangle}{\anglestep}% + \let\endangle\pgfmathresult% + % + % Calculate the `miter point'. This is the point between + % each puff, and takes into account the outer sep. + % + \pgfextract@process\miterpoint{% + % + \pgfextract@process\secondpoint{% + \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}% + }% + % + \pgfmathadd@{\endangle}{\anglestep}% + \let\angletemp\pgfmathresult% + \pgfextract@process\thirdpoint{% + \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}% + }% + % + \pgfmathsubtract@{\endangle}{\anglestep}% + \let\angletemp\pgfmathresult% + \pgfextract@process\firstpoint{% + \pgfpointpolar{+\angletemp}{+\xinnerradius and +\yinnerradius}% + }% + % + \pgfmathanglebetweenpoints{\firstpoint}{\secondpoint}% + \let\anglealpha\pgfmathresult% + \pgfmathanglebetweenpoints{\secondpoint}{\thirdpoint}% + \let\anglebeta\pgfmathresult% + % + \pgfmathsubtract@{\anglebeta}{\anglealpha}% + \pgfmathdivide@{\pgfmathresult}{2}% + \pgfmathadd@{\pgfmathresult}{\halfcomplementarc}% + \pgfmathcosec@{\pgfmathresult}% + \pgf@x\outersep\relax% + \pgf@x\pgfmathresult\pgf@x% + \edef\miterradius{\the\pgf@x}% + % + \pgfmathadd@{\anglealpha}{\anglebeta}% + \pgfmathsubtract@{\pgfmathresult}{180}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\miterangle\pgfmathresult% + \pgfpointadd{\secondpoint}{% + \pgfqpointpolar{\miterangle}{\miterradius}% + }% + }% + % + % Get the angle of the miter point... + % + \pgfmathanglebetweenpoints{\pgfpointorigin}{\miterpoint}% + \let\angle\pgfmathresult% + \ifdim\angle pt<\lastangle pt\relax% Guard against 360� = 0� + \pgfmathadd@{\angle}{360}% + \let\angle\pgfmathresult% + \fi% + \let\lastangle\angle% + % + % ...and see if it is greater than the external point. + % + \ifdim\externalangle pt>\angle pt\relax% + \repeatpgfmathloop% + % + % Get the start angle of the relevant arc and ensure angles are in the range. + % + \pgfmathmod@{\endangle}{360}% + \let\endangle\pgfmathresult% + \pgfmathsubtract@{\endangle}{\anglestep}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathadd@{\pgfmathresult}{360}% + \fi% + \let\startangle\pgfmathresult% + % + % Now, get the start and end points of the arc. + % + \pgfextract@process\arcstartpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\startangle}{+\xinnerradius and +\yinnerradius}% + }% + }% + \pgfextract@process\arcendpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\endangle}{+\xinnerradius and +\yinnerradius}% + }% + }% + % + % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. + % + \pgf@sh@getcloudpuffparameters% + % + % Hackery, for when an arc straddles 0�. + % + \ifdim\endangle pt<\startangle pt\relax% + \pgfmathadd@{\externalangle}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \let\x\pgfmathresult% + \else% + \let\x\externalangle% + \fi% + % + % 2. Locate the angle on the circular arc which forms the puff. + % + % Essentially a binary search to find the angle on the circular + % arc, which provides the nearset estimate to the border point. + % + \let\s\halfcomplementarc% The start of the arc. + \pgfmathadd@{\s}{\arc}% + \let\e\pgfmathresult% The end of the arc. + \pgfmathadd@{\e}{\s}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\n\pgfmathresult% The nearest estimate (default to middle of arc). + \def\m{360}% Measure of `nearness'. + \pgfmathloop% + \pgfmathadd@{\e}{\s}% + \pgfmathdivide@{\pgfmathresult}{2}% + \let\p\pgfmathresult% The point halfway between \s and \e. + \ifdim\p pt=\s pt\relax% + \else% + % + % Get the point on the circular arc. + % + \pgfmathadd@{\p}{\arcslope}% + \let\a\pgfmathresult% + \pgfextract@process\arcpoint{% + \pgfpointadd{\circlecenterpoint}{% + \pgfqpointpolar{\a}{\outerarcradius}% + }% + }% + % + % Find the angle between the node centre and the point on the arc. + % + \pgfmathanglebetweenpoints{\centerpoint}{\arcpoint}% + % + % Hackery, for when an arc straddles 0�. + % + \ifdim\endangle pt<\startangle pt\relax% + \pgfmathadd@{\pgfmathresult}{180}% + \pgfmathmod@{\pgfmathresult}{360}% + \fi% + \let\q\pgfmathresult% + \ifdim\x pt=\q pt% Found it! + \pgfmathbreakloop% Breaks after current iteration is complete. + \else + \ifdim\x pt<\q pt\relax% + \let\e\p% + \else% + \let\s\p% + \fi% + \fi% + \pgfmathsubtract@{\x}{\q}% + \pgfmathabs@{\pgfmathresult}% + % + % Save the estimate if it is better than any previous estimate. + % + \ifdim\pgfmathresult pt<\m pt\relax% + \let\m\pgfmathresult% + \let\n\p% + \fi% + \repeatpgfmathloop% + % + % Use the nearest estimate as the anchor angle. + % + \pgfmathadd@{\n}{\arcslope}% + \let\anchorangle\pgfmathresult% + % + % Finally, the required point. + % + \pgfpointadd{\circlecenterpoint}{% + \pgfqpointpolar{\anchorangle}{\outerarcradius}% + }% + \fi% + }% Again, Phew! + % + % Now, a sneaky hack. This means an arbitrary `puff' anchors + % can be used for positiong the cloud shape. This is needed + % if a cloud is positioned using the `puff <n+1>' anchor, where + % n is the number of puffs of any previously drawn cloud. + % + \pgfutil@g@addto@macro\pgf@sh@s@cloud{% + \c@pgf@counta\puffs\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \pgfutil@ifundefined{pgf@anchor@cloud@puff\space\the\c@pgf@counta}{% + \expandafter\xdef\csname pgf@anchor@cloud@puff\space\the\c@pgf@counta\endcsname{% + \noexpand\pgf@sh@@cloudpuffanchor{\the\c@pgf@counta}% + }% + }{\c@pgf@counta0\relax}% + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop% + }% } % \pgf@sh@@cloudpuffanchor @@ -1286,43 +1328,43 @@ % Internal macro for calculating the anchors puff 1, puff 2, ... etc. % \def\pgf@sh@@cloudpuffanchor#1{% - \getradii% - \pgfmathdivide@{\anglestep}{2}% - \let\halfanglestep\pgfmathresult% - \c@pgf@counta#1\relax% - \advance\c@pgf@counta-1\relax% - \pgfmathmultiply@{\anglestep}{\the\c@pgf@counta}% - \pgfmathadd@{\pgfmathresult}{90}% - \pgfmathsubtract@{\pgfmathresult}{\halfanglestep}% - \let\angle\pgfmathresult% - % - % Calculate the first arc point. - % - \pgfextract@process\arcstartpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% - }% - }% - % - \pgfmathadd@{\angle}{\anglestep}% - \let\angle\pgfmathresult% - \pgfextract@process\arcendpoint{% - \pgfpointadd{\centerpoint}{% - \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% - }% - }% - % - % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. - % - \pgf@sh@getcloudpuffparameters% - % - % Calculate the point. - % - \pgfmathadd@{\arcslope}{90}% - \let\anchorangle\pgfmathresult% - \pgfpointadd{\circlecenterpoint}{% - \pgfqpointpolar{\anchorangle}{\outerarcradius}% - }% + \getradii% + \pgfmathdivide@{\anglestep}{2}% + \let\halfanglestep\pgfmathresult% + \c@pgf@counta#1\relax% + \advance\c@pgf@counta-1\relax% + \pgfmathmultiply@{\anglestep}{\the\c@pgf@counta}% + \pgfmathadd@{\pgfmathresult}{90}% + \pgfmathsubtract@{\pgfmathresult}{\halfanglestep}% + \let\angle\pgfmathresult% + % + % Calculate the first arc point. + % + \pgfextract@process\arcstartpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% + }% + }% + % + \pgfmathadd@{\angle}{\anglestep}% + \let\angle\pgfmathresult% + \pgfextract@process\arcendpoint{% + \pgfpointadd{\centerpoint}{% + \pgfpointpolar{+\angle}{+\xinnerradius and +\yinnerradius}% + }% + }% + % + % Get some useful cloud parameters from \arcstartpoint and \arcendpoint. + % + \pgf@sh@getcloudpuffparameters% + % + % Calculate the point. + % + \pgfmathadd@{\arcslope}{90}% + \let\anchorangle\pgfmathresult% + \pgfpointadd{\circlecenterpoint}{% + \pgfqpointpolar{\anchorangle}{\outerarcradius}% + }% } % \pgf@sh@cloudpuffparameters @@ -1333,11 +1375,11 @@ % \def\pgf@sh@getcloudpuffparameters{% % - % Calculate the angle to which the entire arc is sloped. - % - \pgfmathanglebetweenpoints{\arcendpoint}{\arcstartpoint}% - \let\arcslope\pgfmathresult% - % + % Calculate the angle to which the entire arc is sloped. + % + \pgfmathanglebetweenpoints{\arcendpoint}{\arcstartpoint}% + \let\arcslope\pgfmathresult% + % % Calculate the chord length and arc radius. % \pgfpointdiff{\arcendpoint}{\arcstartpoint}% @@ -1345,7 +1387,7 @@ \pgf@x\pgfmathresult pt\relax% \pgf@xa.5\pgf@x% \edef\halfchordlength{\the\pgf@xa}% - \pgf@x\arcradiusquotient\pgf@x% + \pgf@x\arcradiusquotient\pgf@x% \edef\arcradius{\the\pgf@x}% \pgf@xa\outersep\relax% \advance\pgf@xa\pgf@x% @@ -1382,671 +1424,671 @@ \def\pgf@lib@sh@signal@to{to}% \def\pgf@lib@sh@signal@parsedirection#1#2{% - % - \let\pgf@lib@sh@signal@direction=#2% - \edef\pgf@lib@sh@temp{#1}% - \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop} + % + \let\pgf@lib@sh@signal@direction=#2% + \edef\pgf@lib@sh@temp{#1}% + \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop} \def\pgf@lib@sh@signal@@parsedirection#1\pgf@stop{% - \pgfutil@in@{and}{#1}% - \ifpgfutil@in@% - \pgf@lib@sh@signal@@@parsedirection#1\pgf@lib% - \else% - \pgf@lib@sh@signal@@@parsedirection#1 and #1\pgf@lib% - \fi + \pgfutil@in@{and}{#1}% + \ifpgfutil@in@% + \pgf@lib@sh@signal@@@parsedirection#1\pgf@lib% + \else% + \pgf@lib@sh@signal@@@parsedirection#1 and #1\pgf@lib% + \fi } \def\pgf@lib@sh@signal@@@parsedirection#1 and #2\pgf@lib{% - \pgfutil@in@{nowhere}{#1}% - \ifpgfutil@in@ - \else% - \pgf@lib@sh@signal@@@@parsedirection{#1}% - \pgf@lib@sh@signal@@@@parsedirection{#2}% - \fi% + \pgfutil@in@{nowhere}{#1}% + \ifpgfutil@in@ + \else% + \pgf@lib@sh@signal@@@@parsedirection{#1}% + \pgf@lib@sh@signal@@@@parsedirection{#2}% + \fi% } \def\pgf@lib@sh@signal@@@@parsedirection#1{% - \pgfutil@in@{ #1 }{ east right }% - \ifpgfutil@in@% - \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@direction% - \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% - \fi% - \pgfutil@in@{ #1 }{ left west }% - \ifpgfutil@in@% - \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@direction% - \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% - \fi% - \pgfutil@in@{ #1 }{ above up north }% - \ifpgfutil@in@% - \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@direction% - \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% - \fi% - \pgfutil@in@{ #1 }{ below down south }% - \ifpgfutil@in@% - \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@direction% - \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% - \fi% + \pgfutil@in@{ #1 }{ east right }% + \ifpgfutil@in@% + \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@direction% + \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% + \fi% + \pgfutil@in@{ #1 }{ left west }% + \ifpgfutil@in@% + \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@direction% + \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% + \fi% + \pgfutil@in@{ #1 }{ above up north }% + \ifpgfutil@in@% + \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@direction% + \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% + \fi% + \pgfutil@in@{ #1 }{ below down south }% + \ifpgfutil@in@% + \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@direction% + \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% + \fi% } % Keys for signal shape: % \pgfkeys{/pgf/.cd, - signal pointer angle/.initial=90, - signal to/.initial=east, - signal from/.initial=nowhere + signal pointer angle/.initial=90, + signal to/.initial=east, + signal from/.initial=nowhere } \pgfdeclareshape{signal}{% - \savedmacro\installsignalparameters{% - % - \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% - \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% - % - \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal from}}{\pgf@lib@sh@signal@from}% - \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}% - % - % Define a centerpoint. - % - \pgfextract@process\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - % - % Get some useful trig. stuff - % - \pgfmathsetmacro\pointerangle{\pgfkeysvalueof{/pgf/signal pointer angle}}% - % - \pgfmathdivide@{\pointerangle}{2}% - \let\halfpointerangle=\pgfmathresult% - % - \pgfmathcosec@{\halfpointerangle}% - \let\cosechalfpointerangle=\pgfmathresult% - % - \pgfmathdivide@{\halfpointerangle}{2}% - \let\quarterpointerangle=\pgfmathresult% - % - \pgfmathcosec@{\quarterpointerangle}% - \let\cosecquarterpointerangle=\pgfmathresult% - % - \pgfmathsec@{\quarterpointerangle}% - \let\secquarterpointerangle=\pgfmathresult% - % - \pgfmathsubtract@{90}{\quarterpointerangle}% - \let\complementquarterpointerangle\pgfmathresult% - % - % Get the larger of the outer sep. - % - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@x>\pgf@y% - \pgf@y\pgf@x% - \fi% - \pgf@yc=\pgf@y% - % - % Calculate the miter due to the line width, at the pointer apex... - % - \pgf@x=\cosechalfpointerangle\pgf@y% - \edef\pointerapexmiter{\the\pgf@x}% - % - % ...at a corner by a `to' pointer (i.e. sticks out)... - % - \pgf@x=\secquarterpointerangle\pgf@y% - \edef\tocornermiter{\the\pgf@x}% - % - % ...at a corner by a `from' pointer (i.e. sticks in). - % - \pgf@x=\cosecquarterpointerangle\pgf@y - \edef\fromcornermiter{\the\pgf@x}% - % - % Get the (half) dimensions of the node. - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya.5\ht\pgfnodeparttextbox% - \advance\pgf@ya.5\dp\pgfnodeparttextbox% - % - % Get the distance a pointer sticks out to the side... - % - \pgfmathsubtract@{90}{\halfpointerangle}% - \pgfmathtan@{\pgfmathresult}% - \pgf@xb=\pgfmathresult\pgf@ya% - % - % ...and up. - % - \pgf@yb=\pgfmathresult\pgf@xa% - % - % Adjust for minimum height. - % - \pgfutil@tempdima=2.0\pgf@ya% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by\pgf@yb% - \fi% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgfutil@tempdima<\pgf@y% - \pgfutil@tempdima=\pgf@y% - % - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by-\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by-\pgf@yb% - \fi% - \pgf@ya=0.5\pgfutil@tempdima% - \pgfmathsubtract@{90}{\halfpointerangle}% - \pgfmathtan@{\pgfmathresult}% - \pgf@xb=\pgfmathresult\pgf@ya% - \fi% - % - % Adjust for minimum width. - % - \pgfutil@tempdima=2.0\pgf@xa% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by\pgf@xb% - \fi% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by\pgf@xb% - \fi% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgfutil@tempdima<\pgf@x% - \pgfutil@tempdima=\pgf@x% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by-\pgf@xb% - \fi% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% - \else% - \advance\pgfutil@tempdima by-\pgf@xb% - \fi% - \pgf@xa=0.5\pgfutil@tempdima% - \pgfmathsubtract@{90}{\halfpointerangle}% - \pgfmathtan@{\pgfmathresult}% - \pgf@yb=\pgfmathresult\pgf@xa% - \fi% - % - % So, define the points for the background path. - % - \pgfextract@process\north{% - \centerpoint% - \advance\pgf@y\pgf@ya% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to% - \advance\pgf@y\pgf@yb% - \fi% - }% - \pgfextract@process\south{% - \centerpoint% - \advance\pgf@y-\pgf@ya% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% - \advance\pgf@y-\pgf@yb% - \fi% - }% - \pgfextract@process\east{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% - \advance\pgf@x\pgf@xb% - \fi% - }% - \pgfextract@process\west{% - \centerpoint% - \advance\pgf@x-\pgf@xa% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% - \advance\pgf@x-\pgf@xb% - \fi% - }% - \pgfextract@process\northeast{% - \centerpoint% - \advance\pgf@y\pgf@ya% - \advance\pgf@x\pgf@xa% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% - \advance\pgf@y\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% - \advance\pgf@x\pgf@xb% - \fi% - }% - \pgfextract@process\southeast{% - \centerpoint% - \advance\pgf@y-\pgf@ya% - \advance\pgf@x\pgf@xa% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% - \advance\pgf@y-\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% - \advance\pgf@x\pgf@xb% - \fi% - }% - \pgfextract@process\southwest{% - \centerpoint% - \advance\pgf@y-\pgf@ya% - \advance\pgf@x-\pgf@xa% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% - \advance\pgf@y-\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% - \advance\pgf@x-\pgf@xb% - \fi% - }% - \pgfextract@process\northwest{% - \centerpoint% - \advance\pgf@y\pgf@ya% - \advance\pgf@x-\pgf@xa% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% - \advance\pgf@y\pgf@yb% - \fi% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% - \advance\pgf@x-\pgf@xb% - \fi% - }% - \addtosavedmacro{\north}% - \addtosavedmacro{\south}% - \addtosavedmacro{\east}% - \addtosavedmacro{\west}% - \addtosavedmacro{\northeast}% - \addtosavedmacro{\southwest}% - \addtosavedmacro{\southeast}% - \addtosavedmacro{\northwest}% - % - % Calculate the `miter vectors' (i.e. +outer sep). - % - \pgfextract@process\northmiter{% - \pgf@x0pt% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% - \pgf@y\pgf@yc% - \else% - \pgf@y\pointerapexmiter\relax% - \fi% - }% - \pgfextract@process\southmiter{% - \pgf@x0pt% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% - \pgf@y-\pgf@yc% - \else% - \pgf@y-\pointerapexmiter\relax% - \fi% - }% - \pgfextract@process\eastmiter{% - \pgf@y0pt% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% - \pgf@x\pgf@yc% - \else% - \pgf@x\pointerapexmiter\relax% - \fi% - }% - \pgfextract@process\westmiter{% - \pgf@y0pt% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% - \pgf@x-\pgf@yc% - \else% - \pgf@x-\pointerapexmiter\relax% - \fi% - }% - \pgfextract@process\northeastmiter{% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% - \pgf@x\pgf@yc - \pgf@y\pgf@yc% - \else - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% - \pgfqpointpolar{\quarterpointerangle}{\fromcornermiter} - \else% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% - \pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}% - \fi% - \fi% - \fi% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% - \pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}% - \else% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to% - \pgfqpointpolar{\quarterpointerangle}{\tocornermiter}% - \fi% - \fi% - }% - \pgfextract@process\southeastmiter{% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% - \pgf@x\pgf@yc% - \pgf@y\pgf@yc% - \else - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% - \pgfqpointpolar{-\quarterpointerangle}{\fromcornermiter} - \else% - \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% - \pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}% - \fi% - \fi% - \fi% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% - \pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter} - \else% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% - \pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}% - \fi% - \fi% - }% - \pgfextract@process\southwestmiter{% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% - \pgf@x-\pgf@yc - \pgf@y-\pgf@yc% - \else - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% - \pgfmathadd@{\quarterpointerangle}{180}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter} - \else% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% - \pgfmathadd@{\complementquarterpointerangle}{180}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% - \fi% - \fi% - \fi% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% - \pgfmathadd@{\complementquarterpointerangle}{180}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}% - \else% - \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% - \pgfmathadd@{\quarterpointerangle}{180}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% - \fi% - \fi% - }% - \pgfextract@process\northwestmiter{% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% - \pgf@x-\pgf@yc% - \pgf@y\pgf@yc% - \else - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% - \pgfmathsubtract@{180}{\quarterpointerangle}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter} - \else% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% - \pgfmathsubtract@{180}{\complementquarterpointerangle}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% - \fi% - \fi% - \fi% - \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% - \pgfmathsubtract@{180}{\complementquarterpointerangle}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}% - \else% - \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% - \pgfmathsubtract@{180}{\quarterpointerangle}% - \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% - \fi% - \fi% - }% - \addtosavedmacro{\northmiter}% - \addtosavedmacro{\southmiter}% - \addtosavedmacro{\eastmiter}% - \addtosavedmacro{\westmiter}% - \addtosavedmacro{\northeastmiter}% - \addtosavedmacro{\southeastmiter}% - \addtosavedmacro{\southwestmiter}% - \addtosavedmacro{\northwestmiter}% - % - % Now calculate the anchor points - % - \pgfextract@process\anchornorth{% - \pgfpointadd{\north}{\northmiter}% - }% - \pgfextract@process\anchorsouth{% - \pgfpointadd{\south}{\southmiter}% - }% - \pgfextract@process\anchoreast{% - \pgfpointadd{\east}{\eastmiter}% - }% - \pgfextract@process\anchorwest{% - \pgfpointadd{\west}{\westmiter}% - }% - \pgfextract@process\anchornortheast{% - \pgfpointadd{\northeast}{\northeastmiter}% - }% - \pgfextract@process\anchorsoutheast{% - \pgfpointadd{\southeast}{\southeastmiter}% - }% - \pgfextract@process\anchorsouthwest{% - \pgfpointadd{\southwest}{\southwestmiter}% - }% - \pgfextract@process\anchornorthwest{% - \pgfpointadd{\northwest}{\northwestmiter}% - }% - \addtosavedmacro{\anchornorth}% - \addtosavedmacro{\anchorsouth}% - \addtosavedmacro{\anchoreast}% - \addtosavedmacro{\anchorwest}% - \addtosavedmacro{\anchornortheast}% - \addtosavedmacro{\anchorsouthwest}% - \addtosavedmacro{\anchorsoutheast}% - \addtosavedmacro{\anchornorthwest}% - }% - \savedanchor\centerpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - }% - \savedanchor\basepoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - }% - \savedanchor\midpoint{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+.5ex}% - }% - \anchor{center}{\centerpoint}% - \anchor{base}{\basepoint}% - \anchor{base east}{% - \installsignalparameters% - \anchoreast% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \anchorsoutheast% - \ifdim\pgf@xa>\pgf@x% - \pgfutil@tempdima\pgf@xa% - \else% - \pgfutil@tempdima\pgf@x% - \fi% - \pgfextract@process\externalpoint{% - \basepoint% - \pgf@x\pgfutil@tempdima% - } - \basepoint% - \let\firstpoint\anchoreast% - \ifdim\pgf@y<\pgf@ya% - \let\secondpoint\anchorsoutheast% - \else% - \let\secondpoint\anchornortheast% - \fi% - \pgfpointintersectionoflines{\basepoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% - }% - \anchor{base west}{% - \installsignalparameters% - \anchorwest% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \anchorsouthwest% - \ifdim\pgf@xa<\pgf@x% - \pgfutil@tempdima\pgf@xa% - \else% - \pgfutil@tempdima\pgf@x% - \fi% - \pgfextract@process\externalpoint{% - \basepoint% - \pgf@x\pgfutil@tempdima% - } - \basepoint% - \let\firstpoint\anchorwest% - \ifdim\pgf@y<\pgf@ya% - \let\secondpoint\anchorsouthwest% - \else% - \let\secondpoint\anchornorthwest% - \fi% - \pgfpointintersectionoflines{\basepoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% - }% - \anchor{mid}{\midpoint}% - \anchor{mid east}{% - \installsignalparameters% - \anchoreast% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \anchorsoutheast% - \ifdim\pgf@xa>\pgf@x% - \pgfutil@tempdima\pgf@xa% - \else% - \pgfutil@tempdima\pgf@x% - \fi% - \pgfextract@process\externalpoint{% - \midpoint% - \pgf@x\pgfutil@tempdima% - } - \midpoint% - \let\firstpoint\anchoreast% - \ifdim\pgf@y<\pgf@ya% - \let\secondpoint\anchorsoutheast% - \else% - \let\secondpoint\anchornortheast% - \fi% - \pgfpointintersectionoflines{\midpoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% - }% - \anchor{mid west}{% - \installsignalparameters% - \anchorwest% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \anchorsouthwest% - \ifdim\pgf@xa<\pgf@x% - \pgfutil@tempdima\pgf@xa% - \else% - \pgfutil@tempdima\pgf@x% - \fi% - \pgfextract@process\externalpoint{% - \midpoint% - \pgf@x\pgfutil@tempdima% - } - \midpoint% - \let\firstpoint\anchorwest% - \ifdim\pgf@y<\pgf@ya% - \let\secondpoint\anchorsouthwest% - \else% - \let\secondpoint\anchornorthwest% - \fi% - \pgfpointintersectionoflines{\midpoint}{\externalpoint}% - {\firstpoint}{\secondpoint}% - }% - \anchor{north}{\installsignalparameters\anchornorth}% - \anchor{south}{\installsignalparameters\anchorsouth}% - \anchor{east}{\installsignalparameters\anchoreast}% - \anchor{west}{\installsignalparameters\anchorwest}% - \anchor{north east}{\installsignalparameters\anchornortheast}% - \anchor{south east}{\installsignalparameters\anchorsoutheast}% - \anchor{south west}{\installsignalparameters\anchorsouthwest}% - \anchor{north west}{\installsignalparameters\anchornorthwest}% - \backgroundpath{% - \installsignalparameters% - \pgfpathmoveto{\north}% - \pgfpathlineto{\northeast}% - \pgfpathlineto{\east}% - \pgfpathlineto{\southeast}% - \pgfpathlineto{\south}% - \pgfpathlineto{\southwest}% - \pgfpathlineto{\west}% - \pgfpathlineto{\northwest}% - \pgfpathclose% - } - \anchorborder{% - % - % Save x and y. - % - \edef\externalx{\the\pgf@x}% - \edef\externaly{\the\pgf@y}% - % - % Adjust the location of the external - % point relative to \centerpoint. - % - \centerpoint% - \pgf@xa\externalx\relax% - \pgf@ya\externaly\relax% - \advance\pgf@xa\pgf@x% - \advance\pgf@ya\pgf@y% - \edef\externalx{\the\pgf@xa}% - \edef\externaly{\the\pgf@ya}% - % - % Get the shape parameters. - % - \installsignalparameters% - % - % Get the angle of the external point to the \centerpoint. - % - \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - \let\externalangle\pgfmathresult% - % - % - % - \pgfmathanglebetweenpoints{\centerpoint}{\anchorwest}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathanglebetweenpoints{\centerpoint}{\anchornorth}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathanglebetweenpoints{\centerpoint}{\anchornortheast}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \let\firstpoint\anchoreast% - \let\secondpoint\anchornortheast% - \else% - \let\secondpoint\anchornortheast% - \let\firstpoint\anchornorth% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\anchornorthwest}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \let\firstpoint\anchornorth% - \let\secondpoint\anchornorthwest% - \else% - \let\secondpoint\anchornorthwest% - \let\firstpoint\anchorwest% - \fi% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouth}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouthwest}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \let\firstpoint\anchorwest% - \let\secondpoint\anchorsouthwest% - \else% - \let\secondpoint\anchorsouthwest% - \let\firstpoint\anchorsouth% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\anchorsoutheast}% - \ifdim\externalangle pt<\pgfmathresult pt\relax% - \let\firstpoint\anchorsouth% - \let\secondpoint\anchorsoutheast% - \else% - \let\secondpoint\anchorsoutheast% - \let\firstpoint\anchoreast% - \fi% - \fi% - \fi% - % - % Now locate the point. - % - \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% - {\firstpoint}{\secondpoint}% - }% + \savedmacro\installsignalparameters{% + % + \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere% + \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere% + % + \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal from}}{\pgf@lib@sh@signal@from}% + \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}% + % + % Define a centerpoint. + % + \pgfextract@process\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + % + % Get some useful trig. stuff + % + \pgfmathsetmacro\pointerangle{\pgfkeysvalueof{/pgf/signal pointer angle}}% + % + \pgfmathdivide@{\pointerangle}{2}% + \let\halfpointerangle=\pgfmathresult% + % + \pgfmathcosec@{\halfpointerangle}% + \let\cosechalfpointerangle=\pgfmathresult% + % + \pgfmathdivide@{\halfpointerangle}{2}% + \let\quarterpointerangle=\pgfmathresult% + % + \pgfmathcosec@{\quarterpointerangle}% + \let\cosecquarterpointerangle=\pgfmathresult% + % + \pgfmathsec@{\quarterpointerangle}% + \let\secquarterpointerangle=\pgfmathresult% + % + \pgfmathsubtract@{90}{\quarterpointerangle}% + \let\complementquarterpointerangle\pgfmathresult% + % + % Get the larger of the outer sep. + % + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@x>\pgf@y% + \pgf@y\pgf@x% + \fi% + \pgf@yc=\pgf@y% + % + % Calculate the miter due to the line width, at the pointer apex... + % + \pgf@x=\cosechalfpointerangle\pgf@y% + \edef\pointerapexmiter{\the\pgf@x}% + % + % ...at a corner by a `to' pointer (i.e. sticks out)... + % + \pgf@x=\secquarterpointerangle\pgf@y% + \edef\tocornermiter{\the\pgf@x}% + % + % ...at a corner by a `from' pointer (i.e. sticks in). + % + \pgf@x=\cosecquarterpointerangle\pgf@y + \edef\fromcornermiter{\the\pgf@x}% + % + % Get the (half) dimensions of the node. + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya.5\ht\pgfnodeparttextbox% + \advance\pgf@ya.5\dp\pgfnodeparttextbox% + % + % Get the distance a pointer sticks out to the side... + % + \pgfmathsubtract@{90}{\halfpointerangle}% + \pgfmathtan@{\pgfmathresult}% + \pgf@xb=\pgfmathresult\pgf@ya% + % + % ...and up. + % + \pgf@yb=\pgfmathresult\pgf@xa% + % + % Adjust for minimum height. + % + \pgfutil@tempdima=2.0\pgf@ya% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by\pgf@yb% + \fi% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgfutil@tempdima<\pgf@y% + \pgfutil@tempdima=\pgf@y% + % + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by-\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by-\pgf@yb% + \fi% + \pgf@ya=0.5\pgfutil@tempdima% + \pgfmathsubtract@{90}{\halfpointerangle}% + \pgfmathtan@{\pgfmathresult}% + \pgf@xb=\pgfmathresult\pgf@ya% + \fi% + % + % Adjust for minimum width. + % + \pgfutil@tempdima=2.0\pgf@xa% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by\pgf@xb% + \fi% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by\pgf@xb% + \fi% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgfutil@tempdima<\pgf@x% + \pgfutil@tempdima=\pgf@x% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by-\pgf@xb% + \fi% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% + \else% + \advance\pgfutil@tempdima by-\pgf@xb% + \fi% + \pgf@xa=0.5\pgfutil@tempdima% + \pgfmathsubtract@{90}{\halfpointerangle}% + \pgfmathtan@{\pgfmathresult}% + \pgf@yb=\pgfmathresult\pgf@xa% + \fi% + % + % So, define the points for the background path. + % + \pgfextract@process\north{% + \centerpoint% + \advance\pgf@y\pgf@ya% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to% + \advance\pgf@y\pgf@yb% + \fi% + }% + \pgfextract@process\south{% + \centerpoint% + \advance\pgf@y-\pgf@ya% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% + \advance\pgf@y-\pgf@yb% + \fi% + }% + \pgfextract@process\east{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% + \advance\pgf@x\pgf@xb% + \fi% + }% + \pgfextract@process\west{% + \centerpoint% + \advance\pgf@x-\pgf@xa% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% + \advance\pgf@x-\pgf@xb% + \fi% + }% + \pgfextract@process\northeast{% + \centerpoint% + \advance\pgf@y\pgf@ya% + \advance\pgf@x\pgf@xa% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% + \advance\pgf@y\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% + \advance\pgf@x\pgf@xb% + \fi% + }% + \pgfextract@process\southeast{% + \centerpoint% + \advance\pgf@y-\pgf@ya% + \advance\pgf@x\pgf@xa% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% + \advance\pgf@y-\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% + \advance\pgf@x\pgf@xb% + \fi% + }% + \pgfextract@process\southwest{% + \centerpoint% + \advance\pgf@y-\pgf@ya% + \advance\pgf@x-\pgf@xa% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% + \advance\pgf@y-\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% + \advance\pgf@x-\pgf@xb% + \fi% + }% + \pgfextract@process\northwest{% + \centerpoint% + \advance\pgf@y\pgf@ya% + \advance\pgf@x-\pgf@xa% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% + \advance\pgf@y\pgf@yb% + \fi% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% + \advance\pgf@x-\pgf@xb% + \fi% + }% + \addtosavedmacro{\north}% + \addtosavedmacro{\south}% + \addtosavedmacro{\east}% + \addtosavedmacro{\west}% + \addtosavedmacro{\northeast}% + \addtosavedmacro{\southwest}% + \addtosavedmacro{\southeast}% + \addtosavedmacro{\northwest}% + % + % Calculate the `miter vectors' (i.e. +outer sep). + % + \pgfextract@process\northmiter{% + \pgf@x0pt% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere% + \pgf@y\pgf@yc% + \else% + \pgf@y\pointerapexmiter\relax% + \fi% + }% + \pgfextract@process\southmiter{% + \pgf@x0pt% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere% + \pgf@y-\pgf@yc% + \else% + \pgf@y-\pointerapexmiter\relax% + \fi% + }% + \pgfextract@process\eastmiter{% + \pgf@y0pt% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% + \pgf@x\pgf@yc% + \else% + \pgf@x\pointerapexmiter\relax% + \fi% + }% + \pgfextract@process\westmiter{% + \pgf@y0pt% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% + \pgf@x-\pgf@yc% + \else% + \pgf@x-\pointerapexmiter\relax% + \fi% + }% + \pgfextract@process\northeastmiter{% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% + \pgf@x\pgf@yc + \pgf@y\pgf@yc% + \else + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% + \pgfqpointpolar{\quarterpointerangle}{\fromcornermiter} + \else% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% + \pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}% + \fi% + \fi% + \fi% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% + \pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}% + \else% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to% + \pgfqpointpolar{\quarterpointerangle}{\tocornermiter}% + \fi% + \fi% + }% + \pgfextract@process\southeastmiter{% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere% + \pgf@x\pgf@yc% + \pgf@y\pgf@yc% + \else + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from% + \pgfqpointpolar{-\quarterpointerangle}{\fromcornermiter} + \else% + \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to% + \pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}% + \fi% + \fi% + \fi% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% + \pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter} + \else% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% + \pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}% + \fi% + \fi% + }% + \pgfextract@process\southwestmiter{% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% + \pgf@x-\pgf@yc + \pgf@y-\pgf@yc% + \else + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% + \pgfmathadd@{\quarterpointerangle}{180}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter} + \else% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% + \pgfmathadd@{\complementquarterpointerangle}{180}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% + \fi% + \fi% + \fi% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from% + \pgfmathadd@{\complementquarterpointerangle}{180}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}% + \else% + \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to% + \pgfmathadd@{\quarterpointerangle}{180}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% + \fi% + \fi% + }% + \pgfextract@process\northwestmiter{% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere% + \pgf@x-\pgf@yc% + \pgf@y\pgf@yc% + \else + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from% + \pgfmathsubtract@{180}{\quarterpointerangle}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter} + \else% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% + \pgfmathsubtract@{180}{\complementquarterpointerangle}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% + \fi% + \fi% + \fi% + \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from% + \pgfmathsubtract@{180}{\complementquarterpointerangle}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}% + \else% + \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to% + \pgfmathsubtract@{180}{\quarterpointerangle}% + \expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}% + \fi% + \fi% + }% + \addtosavedmacro{\northmiter}% + \addtosavedmacro{\southmiter}% + \addtosavedmacro{\eastmiter}% + \addtosavedmacro{\westmiter}% + \addtosavedmacro{\northeastmiter}% + \addtosavedmacro{\southeastmiter}% + \addtosavedmacro{\southwestmiter}% + \addtosavedmacro{\northwestmiter}% + % + % Now calculate the anchor points + % + \pgfextract@process\anchornorth{% + \pgfpointadd{\north}{\northmiter}% + }% + \pgfextract@process\anchorsouth{% + \pgfpointadd{\south}{\southmiter}% + }% + \pgfextract@process\anchoreast{% + \pgfpointadd{\east}{\eastmiter}% + }% + \pgfextract@process\anchorwest{% + \pgfpointadd{\west}{\westmiter}% + }% + \pgfextract@process\anchornortheast{% + \pgfpointadd{\northeast}{\northeastmiter}% + }% + \pgfextract@process\anchorsoutheast{% + \pgfpointadd{\southeast}{\southeastmiter}% + }% + \pgfextract@process\anchorsouthwest{% + \pgfpointadd{\southwest}{\southwestmiter}% + }% + \pgfextract@process\anchornorthwest{% + \pgfpointadd{\northwest}{\northwestmiter}% + }% + \addtosavedmacro{\anchornorth}% + \addtosavedmacro{\anchorsouth}% + \addtosavedmacro{\anchoreast}% + \addtosavedmacro{\anchorwest}% + \addtosavedmacro{\anchornortheast}% + \addtosavedmacro{\anchorsouthwest}% + \addtosavedmacro{\anchorsoutheast}% + \addtosavedmacro{\anchornorthwest}% + }% + \savedanchor\centerpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + }% + \savedanchor\basepoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + }% + \savedanchor\midpoint{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+.5ex}% + }% + \anchor{center}{\centerpoint}% + \anchor{base}{\basepoint}% + \anchor{base east}{% + \installsignalparameters% + \anchoreast% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \anchorsoutheast% + \ifdim\pgf@xa>\pgf@x% + \pgfutil@tempdima\pgf@xa% + \else% + \pgfutil@tempdima\pgf@x% + \fi% + \pgfextract@process\externalpoint{% + \basepoint% + \pgf@x\pgfutil@tempdima% + } + \basepoint% + \let\firstpoint\anchoreast% + \ifdim\pgf@y<\pgf@ya% + \let\secondpoint\anchorsoutheast% + \else% + \let\secondpoint\anchornortheast% + \fi% + \pgfpointintersectionoflines{\basepoint}{\externalpoint}% + {\firstpoint}{\secondpoint}% + }% + \anchor{base west}{% + \installsignalparameters% + \anchorwest% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \anchorsouthwest% + \ifdim\pgf@xa<\pgf@x% + \pgfutil@tempdima\pgf@xa% + \else% + \pgfutil@tempdima\pgf@x% + \fi% + \pgfextract@process\externalpoint{% + \basepoint% + \pgf@x\pgfutil@tempdima% + } + \basepoint% + \let\firstpoint\anchorwest% + \ifdim\pgf@y<\pgf@ya% + \let\secondpoint\anchorsouthwest% + \else% + \let\secondpoint\anchornorthwest% + \fi% + \pgfpointintersectionoflines{\basepoint}{\externalpoint}% + {\firstpoint}{\secondpoint}% + }% + \anchor{mid}{\midpoint}% + \anchor{mid east}{% + \installsignalparameters% + \anchoreast% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \anchorsoutheast% + \ifdim\pgf@xa>\pgf@x% + \pgfutil@tempdima\pgf@xa% + \else% + \pgfutil@tempdima\pgf@x% + \fi% + \pgfextract@process\externalpoint{% + \midpoint% + \pgf@x\pgfutil@tempdima% + } + \midpoint% + \let\firstpoint\anchoreast% + \ifdim\pgf@y<\pgf@ya% + \let\secondpoint\anchorsoutheast% + \else% + \let\secondpoint\anchornortheast% + \fi% + \pgfpointintersectionoflines{\midpoint}{\externalpoint}% + {\firstpoint}{\secondpoint}% + }% + \anchor{mid west}{% + \installsignalparameters% + \anchorwest% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \anchorsouthwest% + \ifdim\pgf@xa<\pgf@x% + \pgfutil@tempdima\pgf@xa% + \else% + \pgfutil@tempdima\pgf@x% + \fi% + \pgfextract@process\externalpoint{% + \midpoint% + \pgf@x\pgfutil@tempdima% + } + \midpoint% + \let\firstpoint\anchorwest% + \ifdim\pgf@y<\pgf@ya% + \let\secondpoint\anchorsouthwest% + \else% + \let\secondpoint\anchornorthwest% + \fi% + \pgfpointintersectionoflines{\midpoint}{\externalpoint}% + {\firstpoint}{\secondpoint}% + }% + \anchor{north}{\installsignalparameters\anchornorth}% + \anchor{south}{\installsignalparameters\anchorsouth}% + \anchor{east}{\installsignalparameters\anchoreast}% + \anchor{west}{\installsignalparameters\anchorwest}% + \anchor{north east}{\installsignalparameters\anchornortheast}% + \anchor{south east}{\installsignalparameters\anchorsoutheast}% + \anchor{south west}{\installsignalparameters\anchorsouthwest}% + \anchor{north west}{\installsignalparameters\anchornorthwest}% + \backgroundpath{% + \installsignalparameters% + \pgfpathmoveto{\north}% + \pgfpathlineto{\northeast}% + \pgfpathlineto{\east}% + \pgfpathlineto{\southeast}% + \pgfpathlineto{\south}% + \pgfpathlineto{\southwest}% + \pgfpathlineto{\west}% + \pgfpathlineto{\northwest}% + \pgfpathclose% + } + \anchorborder{% + % + % Save x and y. + % + \edef\externalx{\the\pgf@x}% + \edef\externaly{\the\pgf@y}% + % + % Adjust the location of the external + % point relative to \centerpoint. + % + \centerpoint% + \pgf@xa\externalx\relax% + \pgf@ya\externaly\relax% + \advance\pgf@xa\pgf@x% + \advance\pgf@ya\pgf@y% + \edef\externalx{\the\pgf@xa}% + \edef\externaly{\the\pgf@ya}% + % + % Get the shape parameters. + % + \installsignalparameters% + % + % Get the angle of the external point to the \centerpoint. + % + \pgfmathanglebetweenpoints{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + \let\externalangle\pgfmathresult% + % + % + % + \pgfmathanglebetweenpoints{\centerpoint}{\anchorwest}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\centerpoint}{\anchornorth}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\centerpoint}{\anchornortheast}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \let\firstpoint\anchoreast% + \let\secondpoint\anchornortheast% + \else% + \let\secondpoint\anchornortheast% + \let\firstpoint\anchornorth% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\anchornorthwest}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \let\firstpoint\anchornorth% + \let\secondpoint\anchornorthwest% + \else% + \let\secondpoint\anchornorthwest% + \let\firstpoint\anchorwest% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouth}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \pgfmathanglebetweenpoints{\centerpoint}{\anchorsouthwest}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \let\firstpoint\anchorwest% + \let\secondpoint\anchorsouthwest% + \else% + \let\secondpoint\anchorsouthwest% + \let\firstpoint\anchorsouth% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\anchorsoutheast}% + \ifdim\externalangle pt<\pgfmathresult pt\relax% + \let\firstpoint\anchorsouth% + \let\secondpoint\anchorsoutheast% + \else% + \let\secondpoint\anchorsoutheast% + \let\firstpoint\anchoreast% + \fi% + \fi% + \fi% + % + % Now locate the point. + % + \pgfpointintersectionoflines{\centerpoint}{\pgfqpoint{\externalx}{\externaly}}% + {\firstpoint}{\secondpoint}% + }% }% @@ -2060,10 +2102,10 @@ % /pgf/tape bend bottom : Type of bend for south side. % /pgf/tape bend height : The height of the bends. \pgfkeys{/pgf/.cd, - tape bend top/.initial=in and out, - tape bend bottom/.initial=in and out, - tape bend/.style={/pgf/tape bend top=#1, /pgf/tape bend bottom=#1}, - tape bend height/.initial=5pt + tape bend top/.initial=in and out, + tape bend bottom/.initial=in and out, + tape bend/.style={/pgf/tape bend top=#1, /pgf/tape bend bottom=#1}, + tape bend height/.initial=5pt } \def\pgf@lib@sh@inandouttext{in and out} @@ -2071,447 +2113,447 @@ \def\pgf@lib@sh@nonetext{none} \pgfdeclareshape{tape}{ - \savedmacro\tapedimensions{% - \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y.5\dp\pgfnodeparttextbox% - % - \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}% - \addtosavedmacro\outerxsep% - \addtosavedmacro\outerysep% - % - \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/tape bend height}}% - \pgfutil@tempdima.5\pgfutil@tempdima% - \edef\halfbendheight{\the\pgfutil@tempdima}% - \addtosavedmacro\halfbendheight% - % - \pgfkeysgetvalue{/pgf/tape bend top}{\topbendstyle}% - \pgfkeysgetvalue{/pgf/tape bend bottom}{\bottombendstyle}% - \addtosavedmacro\topbendstyle% - \addtosavedmacro\bottombendstyle% - % - \ifx\topbendstyle\pgf@lib@sh@nonetext% - \else% - \advance\pgf@y\pgfutil@tempdima% - \fi% - \ifx\bottombendstyle\pgf@lib@sh@none% - \else% - \advance\pgf@y\pgfutil@tempdima% - \fi% - % - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@x<.5\pgf@xa% - \pgf@x.5\pgf@xa% - \fi% - \ifdim\pgf@y<.5\pgf@ya% - \pgf@y.5\pgf@ya% - \fi% - \ifx\topbendstyle\pgf@lib@sh@nonetext% - \else% - \advance\pgf@y-\pgfutil@tempdima% - \fi% - \ifx\bottombendstyle\pgf@lib@sh@nonetext% - \else% - \advance\pgf@y-\pgfutil@tempdima% - \fi% - % - \pgfutil@tempdima3.414213\pgfutil@tempdima% 1 / (1-sin(45)) - \edef\bendyradius{\the\pgfutil@tempdima}% - \addtosavedmacro\bendyradius% - \advance\pgfutil@tempdima\outerysep% - \edef\outerbendyradius{\the\pgfutil@tempdima}% - \addtosavedmacro\outerbendyradius% - \advance\pgfutil@tempdima-\outerysep% - \advance\pgfutil@tempdima-\outerysep% - \edef\innerbendyradius{\the\pgfutil@tempdima}% - \addtosavedmacro\innerbendyradius% - % - \pgfutil@tempdima0.707106\pgf@x% cos(45) - \edef\bendxradius{\the\pgfutil@tempdima}% - \addtosavedmacro\bendxradius% - \advance\pgfutil@tempdima\outerxsep% - \edef\outerbendxradius{\the\pgfutil@tempdima}% - \addtosavedmacro\outerbendxradius% - \advance\pgfutil@tempdima-\outerxsep% - \advance\pgfutil@tempdima-\outerxsep% - \edef\innerbendxradius{\the\pgfutil@tempdima}% - \addtosavedmacro\innerbendxradius% - % - \edef\halfwidth{\the\pgf@x}% - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfwidth% - \addtosavedmacro\halfheight% - % - \advance\pgf@x\outerxsep% - \edef\outerhalfwidth{\the\pgf@x}% - \addtosavedmacro\outerhalfwidth% - % - \pgf@xc\bendxradius% - \pgf@yc\bendyradius% - \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@xc}}% - \pgfmathatan{\pgfmathresult}% - \pgf@xc\pgfmathresult pt\relax% - \pgf@xc.5\pgf@xc% - \edef\halfangle{\pgfmath@tonumber{\pgf@xc}}% - \addtosavedmacro\halfangle% - % - \pgf@xc45pt\relax% - \advance\pgf@xc-\halfangle pt% - \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}% - \let\cothalfanglein\pgfmathresult% - \addtosavedmacro\cothalfanglein% - % - \pgf@xc90pt\relax% - \advance\pgf@xc-\halfangle pt% - \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}% - \let\cothalfangleout\pgfmathresult% - \addtosavedmacro\cothalfangleout% - % - } - \savedanchor{\centerpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y.5\ht\pgfnodeparttextbox% - \advance\pgf@y-.5\dp\pgfnodeparttextbox% - } - \savedanchor{\midpoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@y{+0.5ex}% - } - \savedanchor{\basepoint}{% - \pgf@x.5\wd\pgfnodeparttextbox% - \pgf@y0pt% - } - \anchor{center}{\centerpoint}% - \anchor{mid}{\midpoint}% - \anchor{mid east}{\tapedimensions\midpoint\advance\pgf@x\outerhalfwidth}% - \anchor{mid west}{\tapedimensions\midpoint\advance\pgf@x-\outerhalfwidth}% - \anchor{base}{\basepoint}% - \anchor{base east}{\tapedimensions\basepoint\advance\pgf@x\outerhalfwidth}% - \anchor{base west}{\tapedimensions\basepoint\advance\pgf@x-\outerhalfwidth}% - \anchor{north}{% - \csname pgf@anchor@tape@north east\endcsname% - \pgf@ya\pgf@y% - \csname pgf@anchor@tape@north west\endcsname% - \advance\pgf@ya\pgf@y% - \centerpoint% - \pgf@y.5\pgf@ya% - } - \anchor{south}{% - \csname pgf@anchor@tape@south east\endcsname% - \pgf@ya\pgf@y% - \csname pgf@anchor@tape@south west\endcsname% - \advance\pgf@ya\pgf@y% - \centerpoint% - \pgf@y.5\pgf@ya% - } - \anchor{east}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x\outerhalfwidth% - } - \anchor{west}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x-\outerhalfwidth% - } - \anchor{north east}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x\outerhalfwidth% - \advance\pgf@y\halfheight% - \pgf@yc\outerysep% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfangleout\pgf@yc% - \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfanglein\pgf@yc% - \else% - \advance\pgf@y\pgf@yc% - \fi% - \fi% - }% - \anchor{north west}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x-\outerhalfwidth% - \advance\pgf@y\halfheight% - \pgf@yc\outerysep% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfanglein\pgf@yc% - \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - \advance\pgf@y\halfbendheight% - \advance\pgf@y\cothalfangleout\pgf@yc% - \else% - \advance\pgf@y\pgf@yc% - \fi% - \fi% - }% - \anchor{south east}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x\outerhalfwidth% - \advance\pgf@y-\halfheight% - \pgf@yc\outerysep% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfangleout\pgf@yc% - \else% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfanglein\pgf@yc% - \else% - \advance\pgf@y-\pgf@yc% - \fi% - \fi% - }% - \anchor{south west}{% - \tapedimensions% - \centerpoint% - \advance\pgf@x-\outerhalfwidth% - \advance\pgf@y-\halfheight% - \pgf@yc\outerysep% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfanglein\pgf@yc% - \else% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - \advance\pgf@y-\halfbendheight% - \advance\pgf@y-\cothalfangleout\pgf@yc% - \else% - \advance\pgf@y-\pgf@yc% - \fi% - \fi% - }% - \backgroundpath{% - \tapedimensions% - % - \pgf@xc\halfwidth% - \pgf@yc\halfheight% - % - \pgf@xc\bendxradius% - \pgf@yc\bendyradius% - {% - \pgftransformshift{\centerpoint}% - \pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}% - \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}% - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}% - \pgfpatharc{225}{315}{\bendxradius and \bendyradius}% - \pgfpatharc{135}{45}{\bendxradius and \bendyradius}% - \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}% - \pgfpatharc{135}{45}{\bendxradius and \bendyradius}% - \pgfpatharc{225}{315}{\bendxradius and \bendyradius}% - \else% - \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}% - \fi% - \fi% - \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}% - \ifx\bottombendstyle\pgf@lib@sh@inandouttext% - \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}% - \pgfpatharc{45}{135}{\bendxradius and \bendyradius}% - \pgfpatharc{315}{225}{\bendxradius and \bendyradius}% - \else% - \ifx\bottombendstyle\pgf@lib@sh@outandintext% - \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}% - \pgfpatharc{315}{225}{\bendxradius and \bendyradius}% - \pgfpatharc{45}{135}{\bendxradius and \bendyradius}% - \else% - \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}% - \fi% - \fi% - \pgfpathclose% - }% - } - \anchorborder{% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfextract@process\externalpoint{% - \centerpoint% - \advance\pgf@x\pgf@xa% - \advance\pgf@y\pgf@ya% - }% - \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% - \let\externalangle\pgfmathresult% - \tapedimensions% - % - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north west\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt% - \ifdim\externalangle pt<90pt% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north east\endcsname}% - \ifdim\externalangle pt<\pgfmathresult pt% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@north east\endcsname}% - {\csname pgf@anchor@tape@south east\endcsname}% - \else% - % Between north and north east. - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - % in and out. - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x.5\pgf@xc% - \advance\pgf@y\halfheight% - \advance\pgf@y\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y-.707106\pgf@yc% - }% - {5}{175}{\outerbendxradius and \outerbendyradius}% - \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - % out and in. - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x.5\pgf@xc% - \advance\pgf@y\halfheight% - \advance\pgf@y\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y.707106\pgf@yc% - }% - {185}{355}{\innerbendxradius and \innerbendyradius}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@north east\endcsname}% - {\csname pgf@anchor@tape@north west\endcsname}% - \fi% - \fi% - \fi% - \else% - % Between north and north west. - \ifx\topbendstyle\pgf@lib@sh@inandouttext% - % in and out. - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x-.5\pgf@xc% - \advance\pgf@y\halfheight% - \advance\pgf@y\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y.707106\pgf@yc% - }% - {185}{355}{\innerbendxradius and \innerbendyradius}% - \else% - \ifx\topbendstyle\pgf@lib@sh@outandintext% - % out and in. - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x-.5\pgf@xc% - \advance\pgf@y\halfheight% - \advance\pgf@y\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y-.707106\pgf@yc% - }% - {5}{175}{\outerbendxradius and \outerbendyradius}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@north east\endcsname}% - {\csname pgf@anchor@tape@north west\endcsname}% - \fi% - \fi% - \fi% - \else% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south west\endcsname}% - \ifdim\externalangle pt>\pgfmathresult pt% - \ifdim\externalangle pt>270pt% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south east\endcsname}% - \ifdim\externalangle pt>\pgfmathresult pt% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@north east\endcsname}% - {\csname pgf@anchor@tape@south east\endcsname}% - \else% - % Between south and south east. - \ifx\bottombendstyle\pgf@lib@sh@inandouttext% - % in and out. - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x.5\pgf@xc% - \advance\pgf@y-\halfheight% - \advance\pgf@y-\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y-.707106\pgf@yc% - }% - {5}{175}{\innerbendxradius and \innerbendyradius}% - \else% - \ifx\bottombendstyle\pgf@lib@sh@outandintext% - % out and in. - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x.5\pgf@xc% - \advance\pgf@y-\halfheight% - \advance\pgf@y-\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y.707106\pgf@yc% - }% - {185}{355}{\outerbendxradius and \outerbendyradius}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@south east\endcsname}% - {\csname pgf@anchor@tape@south west\endcsname}% - \fi% - \fi% - \fi% - \else% - % Between south and south west. - \ifx\bottombendstyle\pgf@lib@sh@inandouttext% - % in and out. - \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x-.5\pgf@xc% - \advance\pgf@y-\halfheight% - \advance\pgf@y-\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y.707106\pgf@yc% - }% - {185}{355}{\outerbendxradius and \outerbendyradius}% - \else% - \ifx\bottombendstyle\pgf@lib@sh@outandintext% - % out and in. - \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% - {% - \centerpoint% - \pgf@xc\halfwidth% - \advance\pgf@x-.5\pgf@xc% - \advance\pgf@y-\halfheight% - \advance\pgf@y-\halfbendheight% - \pgf@yc\bendyradius% - \advance\pgf@y-.707106\pgf@yc% - }% - {5}{175}{\innerbendxradius and \innerbendyradius}% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@south east\endcsname}% - {\csname pgf@anchor@tape@south west\endcsname}% - \fi% - \fi% - \fi% - \else% - \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% - {\csname pgf@anchor@tape@north west\endcsname}% - {\csname pgf@anchor@tape@south west\endcsname}% - \fi% - \fi% - }% + \savedmacro\tapedimensions{% + \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y.5\dp\pgfnodeparttextbox% + % + \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}% + \addtosavedmacro\outerxsep% + \addtosavedmacro\outerysep% + % + \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/tape bend height}}% + \pgfutil@tempdima.5\pgfutil@tempdima% + \edef\halfbendheight{\the\pgfutil@tempdima}% + \addtosavedmacro\halfbendheight% + % + \pgfkeysgetvalue{/pgf/tape bend top}{\topbendstyle}% + \pgfkeysgetvalue{/pgf/tape bend bottom}{\bottombendstyle}% + \addtosavedmacro\topbendstyle% + \addtosavedmacro\bottombendstyle% + % + \ifx\topbendstyle\pgf@lib@sh@nonetext% + \else% + \advance\pgf@y\pgfutil@tempdima% + \fi% + \ifx\bottombendstyle\pgf@lib@sh@none% + \else% + \advance\pgf@y\pgfutil@tempdima% + \fi% + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xa% + \pgf@x.5\pgf@xa% + \fi% + \ifdim\pgf@y<.5\pgf@ya% + \pgf@y.5\pgf@ya% + \fi% + \ifx\topbendstyle\pgf@lib@sh@nonetext% + \else% + \advance\pgf@y-\pgfutil@tempdima% + \fi% + \ifx\bottombendstyle\pgf@lib@sh@nonetext% + \else% + \advance\pgf@y-\pgfutil@tempdima% + \fi% + % + \pgfutil@tempdima3.414213\pgfutil@tempdima% 1 / (1-sin(45)) + \edef\bendyradius{\the\pgfutil@tempdima}% + \addtosavedmacro\bendyradius% + \advance\pgfutil@tempdima\outerysep% + \edef\outerbendyradius{\the\pgfutil@tempdima}% + \addtosavedmacro\outerbendyradius% + \advance\pgfutil@tempdima-\outerysep% + \advance\pgfutil@tempdima-\outerysep% + \edef\innerbendyradius{\the\pgfutil@tempdima}% + \addtosavedmacro\innerbendyradius% + % + \pgfutil@tempdima0.707106\pgf@x% cos(45) + \edef\bendxradius{\the\pgfutil@tempdima}% + \addtosavedmacro\bendxradius% + \advance\pgfutil@tempdima\outerxsep% + \edef\outerbendxradius{\the\pgfutil@tempdima}% + \addtosavedmacro\outerbendxradius% + \advance\pgfutil@tempdima-\outerxsep% + \advance\pgfutil@tempdima-\outerxsep% + \edef\innerbendxradius{\the\pgfutil@tempdima}% + \addtosavedmacro\innerbendxradius% + % + \edef\halfwidth{\the\pgf@x}% + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfwidth% + \addtosavedmacro\halfheight% + % + \advance\pgf@x\outerxsep% + \edef\outerhalfwidth{\the\pgf@x}% + \addtosavedmacro\outerhalfwidth% + % + \pgf@xc\bendxradius% + \pgf@yc\bendyradius% + \pgfmathdivide@{\pgfmath@tonumber{\pgf@yc}}{\pgfmath@tonumber{\pgf@xc}}% + \pgfmathatan{\pgfmathresult}% + \pgf@xc\pgfmathresult pt\relax% + \pgf@xc.5\pgf@xc% + \edef\halfangle{\pgfmath@tonumber{\pgf@xc}}% + \addtosavedmacro\halfangle% + % + \pgf@xc45pt\relax% + \advance\pgf@xc-\halfangle pt% + \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}% + \let\cothalfanglein\pgfmathresult% + \addtosavedmacro\cothalfanglein% + % + \pgf@xc90pt\relax% + \advance\pgf@xc-\halfangle pt% + \pgfmathcot@{\pgfmath@tonumber{\pgf@xc}}% + \let\cothalfangleout\pgfmathresult% + \addtosavedmacro\cothalfangleout% + % + } + \savedanchor{\centerpoint}{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y.5\ht\pgfnodeparttextbox% + \advance\pgf@y-.5\dp\pgfnodeparttextbox% + } + \savedanchor{\midpoint}{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@y{+0.5ex}% + } + \savedanchor{\basepoint}{% + \pgf@x.5\wd\pgfnodeparttextbox% + \pgf@y0pt% + } + \anchor{center}{\centerpoint}% + \anchor{mid}{\midpoint}% + \anchor{mid east}{\tapedimensions\midpoint\advance\pgf@x\outerhalfwidth}% + \anchor{mid west}{\tapedimensions\midpoint\advance\pgf@x-\outerhalfwidth}% + \anchor{base}{\basepoint}% + \anchor{base east}{\tapedimensions\basepoint\advance\pgf@x\outerhalfwidth}% + \anchor{base west}{\tapedimensions\basepoint\advance\pgf@x-\outerhalfwidth}% + \anchor{north}{% + \csname pgf@anchor@tape@north east\endcsname% + \pgf@ya\pgf@y% + \csname pgf@anchor@tape@north west\endcsname% + \advance\pgf@ya\pgf@y% + \centerpoint% + \pgf@y.5\pgf@ya% + } + \anchor{south}{% + \csname pgf@anchor@tape@south east\endcsname% + \pgf@ya\pgf@y% + \csname pgf@anchor@tape@south west\endcsname% + \advance\pgf@ya\pgf@y% + \centerpoint% + \pgf@y.5\pgf@ya% + } + \anchor{east}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x\outerhalfwidth% + } + \anchor{west}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x-\outerhalfwidth% + } + \anchor{north east}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x\outerhalfwidth% + \advance\pgf@y\halfheight% + \pgf@yc\outerysep% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \advance\pgf@y\halfbendheight% + \advance\pgf@y\cothalfangleout\pgf@yc% + \else% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + \advance\pgf@y\halfbendheight% + \advance\pgf@y\cothalfanglein\pgf@yc% + \else% + \advance\pgf@y\pgf@yc% + \fi% + \fi% + }% + \anchor{north west}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x-\outerhalfwidth% + \advance\pgf@y\halfheight% + \pgf@yc\outerysep% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \advance\pgf@y\halfbendheight% + \advance\pgf@y\cothalfanglein\pgf@yc% + \else% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + \advance\pgf@y\halfbendheight% + \advance\pgf@y\cothalfangleout\pgf@yc% + \else% + \advance\pgf@y\pgf@yc% + \fi% + \fi% + }% + \anchor{south east}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x\outerhalfwidth% + \advance\pgf@y-\halfheight% + \pgf@yc\outerysep% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + \advance\pgf@y-\halfbendheight% + \advance\pgf@y-\cothalfangleout\pgf@yc% + \else% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \advance\pgf@y-\halfbendheight% + \advance\pgf@y-\cothalfanglein\pgf@yc% + \else% + \advance\pgf@y-\pgf@yc% + \fi% + \fi% + }% + \anchor{south west}{% + \tapedimensions% + \centerpoint% + \advance\pgf@x-\outerhalfwidth% + \advance\pgf@y-\halfheight% + \pgf@yc\outerysep% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + \advance\pgf@y-\halfbendheight% + \advance\pgf@y-\cothalfanglein\pgf@yc% + \else% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \advance\pgf@y-\halfbendheight% + \advance\pgf@y-\cothalfangleout\pgf@yc% + \else% + \advance\pgf@y-\pgf@yc% + \fi% + \fi% + }% + \backgroundpath{% + \tapedimensions% + % + \pgf@xc\halfwidth% + \pgf@yc\halfheight% + % + \pgf@xc\bendxradius% + \pgf@yc\bendyradius% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}% + \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}% + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}% + \pgfpatharc{225}{315}{\bendxradius and \bendyradius}% + \pgfpatharc{135}{45}{\bendxradius and \bendyradius}% + \else% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + \pgfpathlineto{\pgf@x-\halfwidth\pgf@y\halfheight\advance\pgf@y\halfbendheight}% + \pgfpatharc{135}{45}{\bendxradius and \bendyradius}% + \pgfpatharc{225}{315}{\bendxradius and \bendyradius}% + \else% + \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}% + \fi% + \fi% + \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}% + \ifx\bottombendstyle\pgf@lib@sh@inandouttext% + \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}% + \pgfpatharc{45}{135}{\bendxradius and \bendyradius}% + \pgfpatharc{315}{225}{\bendxradius and \bendyradius}% + \else% + \ifx\bottombendstyle\pgf@lib@sh@outandintext% + \pgfpathlineto{\pgf@x\halfwidth\pgf@y-\halfheight\advance\pgf@y-\halfbendheight}% + \pgfpatharc{315}{225}{\bendxradius and \bendyradius}% + \pgfpatharc{45}{135}{\bendxradius and \bendyradius}% + \else% + \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}% + \fi% + \fi% + \pgfpathclose% + }% + } + \anchorborder{% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfextract@process\externalpoint{% + \centerpoint% + \advance\pgf@x\pgf@xa% + \advance\pgf@y\pgf@ya% + }% + \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}% + \let\externalangle\pgfmathresult% + \tapedimensions% + % + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north west\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt% + \ifdim\externalangle pt<90pt% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@north east\endcsname}% + \ifdim\externalangle pt<\pgfmathresult pt% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@north east\endcsname}% + {\csname pgf@anchor@tape@south east\endcsname}% + \else% + % Between north and north east. + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + % in and out. + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x.5\pgf@xc% + \advance\pgf@y\halfheight% + \advance\pgf@y\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y-.707106\pgf@yc% + }% + {5}{175}{\outerbendxradius and \outerbendyradius}% + \else% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + % out and in. + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x.5\pgf@xc% + \advance\pgf@y\halfheight% + \advance\pgf@y\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y.707106\pgf@yc% + }% + {185}{355}{\innerbendxradius and \innerbendyradius}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@north east\endcsname}% + {\csname pgf@anchor@tape@north west\endcsname}% + \fi% + \fi% + \fi% + \else% + % Between north and north west. + \ifx\topbendstyle\pgf@lib@sh@inandouttext% + % in and out. + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x-.5\pgf@xc% + \advance\pgf@y\halfheight% + \advance\pgf@y\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y.707106\pgf@yc% + }% + {185}{355}{\innerbendxradius and \innerbendyradius}% + \else% + \ifx\topbendstyle\pgf@lib@sh@outandintext% + % out and in. + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x-.5\pgf@xc% + \advance\pgf@y\halfheight% + \advance\pgf@y\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y-.707106\pgf@yc% + }% + {5}{175}{\outerbendxradius and \outerbendyradius}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@north east\endcsname}% + {\csname pgf@anchor@tape@north west\endcsname}% + \fi% + \fi% + \fi% + \else% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south west\endcsname}% + \ifdim\externalangle pt>\pgfmathresult pt% + \ifdim\externalangle pt>270pt% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@tape@south east\endcsname}% + \ifdim\externalangle pt>\pgfmathresult pt% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@north east\endcsname}% + {\csname pgf@anchor@tape@south east\endcsname}% + \else% + % Between south and south east. + \ifx\bottombendstyle\pgf@lib@sh@inandouttext% + % in and out. + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x.5\pgf@xc% + \advance\pgf@y-\halfheight% + \advance\pgf@y-\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y-.707106\pgf@yc% + }% + {5}{175}{\innerbendxradius and \innerbendyradius}% + \else% + \ifx\bottombendstyle\pgf@lib@sh@outandintext% + % out and in. + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x.5\pgf@xc% + \advance\pgf@y-\halfheight% + \advance\pgf@y-\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y.707106\pgf@yc% + }% + {185}{355}{\outerbendxradius and \outerbendyradius}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@south east\endcsname}% + {\csname pgf@anchor@tape@south west\endcsname}% + \fi% + \fi% + \fi% + \else% + % Between south and south west. + \ifx\bottombendstyle\pgf@lib@sh@inandouttext% + % in and out. + \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x-.5\pgf@xc% + \advance\pgf@y-\halfheight% + \advance\pgf@y-\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y.707106\pgf@yc% + }% + {185}{355}{\outerbendxradius and \outerbendyradius}% + \else% + \ifx\bottombendstyle\pgf@lib@sh@outandintext% + % out and in. + \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}% + {% + \centerpoint% + \pgf@xc\halfwidth% + \advance\pgf@x-.5\pgf@xc% + \advance\pgf@y-\halfheight% + \advance\pgf@y-\halfbendheight% + \pgf@yc\bendyradius% + \advance\pgf@y-.707106\pgf@yc% + }% + {5}{175}{\innerbendxradius and \innerbendyradius}% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@south east\endcsname}% + {\csname pgf@anchor@tape@south west\endcsname}% + \fi% + \fi% + \fi% + \else% + \pgfpointintersectionoflines{\externalpoint}{\centerpoint}% + {\csname pgf@anchor@tape@north west\endcsname}% + {\csname pgf@anchor@tape@south west\endcsname}% + \fi% + \fi% + }% } @@ -2565,7 +2607,169 @@ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima}}} \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}} {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima+\pgfutil@tempdima*(\pgfkeysvalueof{/pgf/magnifying glass handle aspect})}}} + \pgfsetarrowsstart{} + \pgfsetarrowsend{} } } +\pgfkeys{% + /pgf/magnetic tape tail/.initial=0.15, + /pgf/magnetic tape tail extend/.initial=0cm, +} +\pgfdeclareshape{magnetic tape}{ + \nodeparts{text} + \savedmacro\installparameters{% + % + \pgf@x=0.5\wd\pgfnodeparttextbox% + \pgf@y=0.5\ht\pgfnodeparttextbox% + \advance\pgf@y by-0.5\dp\pgfnodeparttextbox% + \edef\centerpoint{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + % + \pgf@x=\wd\pgfnodeparttextbox% + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@x by2.0\pgf@xa% + \advance\pgf@y by2.0\pgf@ya% + \ifdim\pgf@y>\pgf@x% + \pgf@x=\pgf@y% + \fi% + \pgf@x=1.414213\pgf@x% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<\pgf@xa% + \pgf@x=\pgf@xa% + \fi% + \ifdim\pgf@x<\pgf@ya% + \pgf@x=\pgf@ya% + \fi% + \pgf@x=0.5\pgf@x% + \edef\radius{\the\pgf@x}% + % + \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% + \edef\tailheight{\the\pgf@xa}% + % + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xa<\pgf@ya% + \pgf@xa=\pgf@ya% + \fi% + \edef\outersep{\the\pgf@xa}% + % + \pgfmathparse{\outersep+\radius}% + \edef\outerradius{\pgfmathresult pt}% + % + \pgfmathparse{(\radius-\tailheight)/\radius}% + \pgfmathasin@{\pgfmathresult}% + \pgfmathadd@{-\pgfmathresult}{360}% + \let\tailangle=\pgfmathresult% + % + \pgfmathparse{\outerradius/(\outerradius+\tailextend)}% + \pgfmathatan@{\pgfmathresult}% + \pgfmathadd@{-\pgfmathresult}{360}% + \let\tailbottomangle=\pgfmathresult% + % + \pgfmathparse{(\outerradius-\outersep-\tailheight-\outersep)/(\outerradius+\tailextend)}% + \pgfmathatan@{\pgfmathresult}% + \pgfmathadd@{-\pgfmathresult}{360}% + \let\tailtopangle=\pgfmathresult% + % + \addtosavedmacro\radius% + \addtosavedmacro\outerradius% + \addtosavedmacro\outersep% + \addtosavedmacro\tailheight% + \addtosavedmacro\tailextend + \addtosavedmacro\tailangle% + \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}} + \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{north}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\outerradius}}} + \anchor{north east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpointpolar{45}{\outerradius}}} + \anchor{south}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\outerradius}}} + \anchor{south east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{-\outerradius}}} + \anchor{east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpoint{\outerradius}{0pt}}} + \anchor{south west}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpointpolar{225}{\outerradius}}} + \anchor{west}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpoint{-\outerradius}{0pt}}} + \anchor{north west}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfqpointpolar{135}{\outerradius}}} + \anchor{tail east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight/2}}} + \anchor{tail south east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius}}} + \anchor{tail north east}{\installparameters% + \pgfpointadd{\centerpoint}{\pgfpoint{\radius+\tailextend+\outersep}{-\outerradius+\outersep+\tailheight+\outersep}}} + \backgroundpath{ + % + \installparameters% + {% + \pgftransformshift{\centerpoint}% + \pgfpathmoveto{\pgfpointpolar{\tailangle}{\radius}}% + \pgfpatharc{\tailangle}{360}{\radius}% + \pgfpatharc{0}{270}{\radius}% + \pgfpathlineto{\pgfpoint{\radius+\tailextend}{-\radius}}% + \pgfpathlineto{\pgfpoint{\radius+\tailextend}{-\radius+\tailheight}}% + \pgfpathclose% + }% + } + \anchorborder{% + \pgfextract@process\externalpoint{}% + \installparameters% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\externalpoint} + \ifdim\pgfmathresult pt<270pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointborderellipse% + {\externalpoint}% + {\pgfqpoint{\outerradius}{\outerradius}}% + }% + \else% + \ifdim\pgfmathresult pt<\tailbottomangle pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointintersectionoflines% + {\externalpoint}{\pgfpointorigin}% + {\pgfqpoint{0pt}{-\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% + }% + \else% + \ifdim\pgfmathresult pt<\tailtopangle pt\relax% + \pgfpointadd{\centerpoint}{% + \pgfpointintersectionoflines% + {\externalpoint}{\pgfpointorigin}% + {\pgfqpoint{\outerradius}{\outerradius}}{\pgfqpoint{\outerradius}{-\outerradius}}% + }% + \else% + \pgfpointadd{\centerpoint}{% + \pgfpointborderellipse% + {\externalpoint}% + {\pgfqpoint{\outerradius}{\outerradius}}% + }% + \fi% + \fi% + \fi% + } +} + +% Local Variables: +% tab-width: 2 +% End:
\ No newline at end of file |