diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex | 2175 |
1 files changed, 1086 insertions, 1089 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex index 9834e91f0ec..c2bf2582a29 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex @@ -92,8 +92,8 @@ \long\def\pgfdeclaredecoration#1#2#3{% \let\pgf@mod@dec@next=\pgf@mod@dec@firstofone% \pgfifmetadecoration{#1}{% - \PackageError{pgf}{You cannot declare a decoration of the same - name as a meta-decoration}{}% + \pgferror{You cannot declare a decoration of the same + name as a meta-decoration}% \let\pgf@mod@dec@next=\pgfutil@gobble% }{}% \pgf@mod@dec@next @@ -141,8 +141,8 @@ \long\def\pgfdeclaremetadecoration#1#2#3{% \let\pgf@mod@dec@next=\pgf@mod@dec@firstofone% \pgfifdecoration{#1}{% - \PackageError{pgf}{You cannot declare a meta-decoration of the - same name as a decoration}{}% + \pgferror{You cannot declare a meta-decoration of the + same name as a decoration}% \let\pgf@mod@dec@next=\pgfutil@gobble% }{}% \pgf@mod@dec@next{% @@ -193,38 +193,38 @@ % % Example: % -% \pgfdeclaredecoration{circles}{red circles}{ -% \state{red circles}[width=10pt, repeat state=2, next state=blue circles] -% { -% \pgfmathparse{round(rnd*100)} -% \pgfsetstrokecolor{red!\pgfmathresult!brown} -% \pgfsetfillcolor{orange!\pgfmathresult!yellow} -% \pgfpathcircle{\pgfpointorigin}{2.5pt} -% \pgfusepath{stroke,fill} -% } -% \state{blue circles}[width=10pt, repeat state=1, next state=red circles] -% { -% \pgfmathparse{round(rnd*100)} -% \pgfsetstrokecolor{blue!\pgfmathresult!gray} -% \pgfsetfillcolor{blue!\pgfmathresult!white} -% \pgfpathcircle{\pgfpointorigin}{2.5pt} -% \pgfusepath{stroke,fill} -% } -% \state{final}{} -% } -% -% \pgfpicture -% \pgfdecoratepath{circles} -% { -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfpoint{0cm}{3cm}}{\pgfpoint{4cm}{0cm}}{\pgfpoint{4cm}{3cm}} -% } -% \endpgfpicture +% \pgfdeclaredecoration{circles}{red circles}{ +% \state{red circles}[width=10pt, repeat state=2, next state=blue circles] +% { +% \pgfmathparse{round(rnd*100)} +% \pgfsetstrokecolor{red!\pgfmathresult!brown} +% \pgfsetfillcolor{orange!\pgfmathresult!yellow} +% \pgfpathcircle{\pgfpointorigin}{2.5pt} +% \pgfusepath{stroke,fill} +% } +% \state{blue circles}[width=10pt, repeat state=1, next state=red circles] +% { +% \pgfmathparse{round(rnd*100)} +% \pgfsetstrokecolor{blue!\pgfmathresult!gray} +% \pgfsetfillcolor{blue!\pgfmathresult!white} +% \pgfpathcircle{\pgfpointorigin}{2.5pt} +% \pgfusepath{stroke,fill} +% } +% \state{final}{} +% } +% +% \pgfpicture +% \pgfdecoratepath{circles} +% { +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfpoint{0cm}{3cm}}{\pgfpoint{4cm}{0cm}}{\pgfpoint{4cm}{3cm}} +% } +% \endpgfpicture % \long\def\pgfdecoratepath#1#2{% - \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% - #2% - \endpgfdecoration} + \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% + #2% + \endpgfdecoration} @@ -240,37 +240,37 @@ % % Example: % -% \pgfdeclaredecoration{stars}{move}{ -% \state{move}[width=7.5pt, next state=star]{} -% \state{star}[width=7.5pt, next state=move] -% { -% \pgfmathparse{round(rnd*100)} -% \pgfsetfillcolor{yellow!\pgfmathresult!orange} -% \pgfsetstrokecolor{yellow!\pgfmathresult!red} -% \pgfmathparse{rnd*.75+.25} -% \pgftransformscale{\pgfmathresult} -% \pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}} -% } -% \state{final} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathlast} -% } -% } -% -% \pgfpicture -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfqpoint{0cm}{2cm}}{\pgfqpoint{3cm}{2cm}}{\pgfqpoint{3cm}{0cm}} -% \pgfpathcurveto{\pgfqpoint{3cm}{-3cm}}{\pgfqpoint{0cm}{0cm}}{\pgfqpoint{0cm}{-3cm}} -% \pgfpathcurveto{\pgfqpoint{0cm}{-5cm}}{\pgfqpoint{3cm}{-5cm}}{\pgfqpoint{3cm}{-3cm}} -% \pgfdecoratecurrentpath{stars} -% \endpgfpicture +% \pgfdeclaredecoration{stars}{move}{ +% \state{move}[width=7.5pt, next state=star]{} +% \state{star}[width=7.5pt, next state=move] +% { +% \pgfmathparse{round(rnd*100)} +% \pgfsetfillcolor{yellow!\pgfmathresult!orange} +% \pgfsetstrokecolor{yellow!\pgfmathresult!red} +% \pgfmathparse{rnd*.75+.25} +% \pgftransformscale{\pgfmathresult} +% \pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}} +% } +% \state{final} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathlast} +% } +% } +% +% \pgfpicture +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfqpoint{0cm}{2cm}}{\pgfqpoint{3cm}{2cm}}{\pgfqpoint{3cm}{0cm}} +% \pgfpathcurveto{\pgfqpoint{3cm}{-3cm}}{\pgfqpoint{0cm}{0cm}}{\pgfqpoint{0cm}{-3cm}} +% \pgfpathcurveto{\pgfqpoint{0cm}{-5cm}}{\pgfqpoint{3cm}{-5cm}}{\pgfqpoint{3cm}{-3cm}} +% \pgfdecoratecurrentpath{stars} +% \endpgfpicture % \def\pgfdecoratecurrentpath#1{% - \pgfgetpath\pgf@decorate@currentpath% - \pgfsetpath\pgfutil@empty% - \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% - \pgfsetpath\pgf@decorate@currentpath% - \endpgfdecoration} + \pgfgetpath\pgf@decorate@currentpath% + \pgfsetpath\pgfutil@empty% + \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% + \pgfsetpath\pgf@decorate@currentpath% + \endpgfdecoration} @@ -282,22 +282,22 @@ % Definitions: % % `existing path' -% - any unsed path exsiting prior to the environment. +% - any unsed path exsiting prior to the environment. % % `decorated path' -% - the path that is being decorated. +% - the path that is being decorated. % -% `decoration path' -% - any unused path left by the decoration automaton. +% `decoration path' +% - any unused path left by the decoration automaton. % % The action of the environment is as follows: % -% 1. Any existing path is saved. -% 2. Construction commands are executed forming the decorated path. -% 3. If the first command in the decorated path is not a `move to', +% 1. Any existing path is saved. +% 2. Construction commands are executed forming the decorated path. +% 3. If the first command in the decorated path is not a `move to', % the last known position from the exisiting path is inserted. -% 4. The saved existing path is reinstalled. -% 5. The decoration automaton is executed along the decorated path. +% 4. The saved existing path is reinstalled. +% 5. The decoration automaton is executed along the decorated path. % % Parameters: % @@ -322,142 +322,142 @@ % <before code> is executed just before the decoration automaton % starts and <after code> is executed just after the automaton stops. % If <before code> or <after code> are empty, they can be omitted. -% The macros \pgfdecoratedpathfirst and \pgfdecoratedpathlast +% The macros \pgfdecoratedpathfirst and \pgfdecoratedpathlast % will be set up as the first and last points on the current section % of the decorated path. % % When the environment exits, the following macros will be set up: % -% \pgfdecorateexistingpath -% - the existing path. +% \pgfdecorateexistingpath +% - the existing path. % -% \pgfdecoratedpath -% - the decorated path. +% \pgfdecoratedpath +% - the decorated path. % -% \pgfdecorationpath -% - any unused decoration path. +% \pgfdecorationpath +% - any unused decoration path. % -% \pgfpointdecoratedpathlast +% \pgfpointdecoratedpathlast % - the last point on the decorated path. % % Examples (require pgfdecorations library): % -% \pgfpicture -% \pgfdecoration -% { -% {lineto}{\pgfdecoratedpathlength/3}, -% {zigzag}{\pgfdecoratedpathlength/3}, -% {lineto}{\pgfdecoratedpathlength/3} -% } -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} -% \endpgfdecoration -% \pgfusepath{stroke} -% \endpgfpicture -% -% -% \pgfpicture -% \pgfdecoration -% { -% {lineto}{\pgfdecoratedpathlength/5}{}{\pgfusepath{stroke}}, -% {zigzag}{\pgfdecoratedpathlength/5} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathfirst} -% } -% { -% \pgfsetstrokecolor{red} -% \pgfusepath{stroke} -% }, -% {lineto}{\pgfdecoratedpathlength/5} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathfirst} -% } -% { -% \pgfsetstrokecolor{black} -% \pgfusepath{stroke} -% }, -% {zigzag}{\pgfdecoratedpathlength/5} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathfirst} -% } -% { -% \pgfsetstrokecolor{red} -% \pgfusepath{stroke} -% }, -% {lineto}{\pgfdecoratedpathlength/5} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathfirst} -% } -% { -% \pgfsetstrokecolor{black} -% \pgfusepath{stroke} -% } -% } -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} -% \endpgfdecoration -% -% \endpgfpicture -% -% -% -% \pgfdeclaredecoration{polygons}{move}{ -% \state{move}[width=7.5pt, next state=polygon]{} -% \state{polygon}[width=7.5pt, next state=move] -% { -% \pgfmathparse{round(rnd*100)} -% \pgfsetfillcolor{green!\pgfmathresult!yellow} -% \pgfsetstrokecolor{green!\pgfmathresult!brown} -% \pgfnode{regular polygon}{center}{}{}{\pgfusepath{stroke,fill}} -% } -% \state{final} -% { -% \pgfpathmoveto{\pgfpointdecoratedpathlast} -% } -% } -% -% \pgfpicture -% \pgfdecoration -% { -% {polygons}{45pt}, -% {lineto}{30pt} -% {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% { -% \pgfsetstrokecolor{yellow!50!orange} -% \pgfusepath{stroke} -% }, -% {polygons}{45pt}, -% {lineto}{30pt} -% {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% { -% \pgfsetstrokecolor{green!50!blue} -% \pgfusepath{stroke} -% }, -% {polygons}{\pgfdecoratedremainingdistance} -% } -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} -% \endpgfdecoration -% \endpgfpicture -% -% -% \pgfpicture -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} -% \pgfgetpath\temppath -% \pgfsetstrokecolor{red} -% \pgfusepath{stroke} -% -% \pgfset{decoration text={Here is some text all the way along this curve!}} -% \pgfdecoration{{text}{\pgfdecoratedremainingdistance}} -% \pgfsetpath\temppath -% \endpgfdecoration -% \endpgfpicture +% \pgfpicture +% \pgfdecoration +% { +% {lineto}{\pgfdecoratedpathlength/3}, +% {zigzag}{\pgfdecoratedpathlength/3}, +% {lineto}{\pgfdecoratedpathlength/3} +% } +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} +% \endpgfdecoration +% \pgfusepath{stroke} +% \endpgfpicture +% +% +% \pgfpicture +% \pgfdecoration +% { +% {lineto}{\pgfdecoratedpathlength/5}{}{\pgfusepath{stroke}}, +% {zigzag}{\pgfdecoratedpathlength/5} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathfirst} +% } +% { +% \pgfsetstrokecolor{red} +% \pgfusepath{stroke} +% }, +% {lineto}{\pgfdecoratedpathlength/5} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathfirst} +% } +% { +% \pgfsetstrokecolor{black} +% \pgfusepath{stroke} +% }, +% {zigzag}{\pgfdecoratedpathlength/5} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathfirst} +% } +% { +% \pgfsetstrokecolor{red} +% \pgfusepath{stroke} +% }, +% {lineto}{\pgfdecoratedpathlength/5} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathfirst} +% } +% { +% \pgfsetstrokecolor{black} +% \pgfusepath{stroke} +% } +% } +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} +% \endpgfdecoration +% +% \endpgfpicture +% +% +% +% \pgfdeclaredecoration{polygons}{move}{ +% \state{move}[width=7.5pt, next state=polygon]{} +% \state{polygon}[width=7.5pt, next state=move] +% { +% \pgfmathparse{round(rnd*100)} +% \pgfsetfillcolor{green!\pgfmathresult!yellow} +% \pgfsetstrokecolor{green!\pgfmathresult!brown} +% \pgfnode{regular polygon}{center}{}{}{\pgfusepath{stroke,fill}} +% } +% \state{final} +% { +% \pgfpathmoveto{\pgfpointdecoratedpathlast} +% } +% } +% +% \pgfpicture +% \pgfdecoration +% { +% {polygons}{45pt}, +% {lineto}{30pt} +% {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% { +% \pgfsetstrokecolor{yellow!50!orange} +% \pgfusepath{stroke} +% }, +% {polygons}{45pt}, +% {lineto}{30pt} +% {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% { +% \pgfsetstrokecolor{green!50!blue} +% \pgfusepath{stroke} +% }, +% {polygons}{\pgfdecoratedremainingdistance} +% } +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} +% \endpgfdecoration +% \endpgfpicture +% +% +% \pgfpicture +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} +% \pgfgetpath\temppath +% \pgfsetstrokecolor{red} +% \pgfusepath{stroke} +% +% \pgfset{decoration text={Here is some text all the way along this curve!}} +% \pgfdecoration{{text}{\pgfdecoratedremainingdistance}} +% \pgfsetpath\temppath +% \endpgfdecoration +% \endpgfpicture % \def\pgfdecoration#1{% \begingroup% \def\pgf@decorate@decorationlist{#1}% - \pgf@decoration@env% + \pgf@decoration@env% } \def\endpgfdecoration{% @@ -498,47 +498,47 @@ % % Example: % -% \pgfdeclaremetadecoration{fancy line}{line to}{ -% \state{line to}[width=1cm, next state=zigzag] -% { -% \decoration{lineto} -% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% \afterdecoration -% { -% \pgfsetstrokecolor{black} -% \pgfusepath{stroke} -% } -% } -% \state{zigzag}[width=2cm, next state=line to] -% { -% \decoration{zigzag} -% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% \afterdecoration -% { -% \pgfsetstrokecolor{red} -% \pgfusepath{stroke} -% } -% } -% \state{final} -% { -% \decoration{lineto} -% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% \afterdecoration -% { -% \pgfsetstrokecolor{black} -% \pgfusepath{stroke} -% } -% } -% } -% -% \pgfpicture -% \pgfmetadecoration{fancy line} -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathcurveto{\pgfqpoint{0cm}{2cm}}{\pgfqpoint{3cm}{2cm}}{\pgfqpoint{3cm}{0cm}} -% \pgfpathcurveto{\pgfqpoint{3cm}{-3cm}}{\pgfqpoint{0cm}{0cm}}{\pgfqpoint{0cm}{-3cm}} -% \pgfpathcurveto{\pgfqpoint{0cm}{-5cm}}{\pgfqpoint{3cm}{-5cm}}{\pgfqpoint{3cm}{-3cm}} -% \endpgfmetadecoration -% \endpgfpicture +% \pgfdeclaremetadecoration{fancy line}{line to}{ +% \state{line to}[width=1cm, next state=zigzag] +% { +% \decoration{lineto} +% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% \afterdecoration +% { +% \pgfsetstrokecolor{black} +% \pgfusepath{stroke} +% } +% } +% \state{zigzag}[width=2cm, next state=line to] +% { +% \decoration{zigzag} +% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% \afterdecoration +% { +% \pgfsetstrokecolor{red} +% \pgfusepath{stroke} +% } +% } +% \state{final} +% { +% \decoration{lineto} +% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% \afterdecoration +% { +% \pgfsetstrokecolor{black} +% \pgfusepath{stroke} +% } +% } +% } +% +% \pgfpicture +% \pgfmetadecoration{fancy line} +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathcurveto{\pgfqpoint{0cm}{2cm}}{\pgfqpoint{3cm}{2cm}}{\pgfqpoint{3cm}{0cm}} +% \pgfpathcurveto{\pgfqpoint{3cm}{-3cm}}{\pgfqpoint{0cm}{0cm}}{\pgfqpoint{0cm}{-3cm}} +% \pgfpathcurveto{\pgfqpoint{0cm}{-5cm}}{\pgfqpoint{3cm}{-5cm}}{\pgfqpoint{3cm}{-3cm}} +% \endpgfmetadecoration +% \endpgfpicture % \def\pgfmetadecoration#1{% \begingroup% @@ -550,47 +550,47 @@ } \def\endpgfmetadecoration{% - \pgf@decoration@endenv% - \ifx\pgfdecoratedpath\pgfutil@empty% - \else% - \let\pgfmetadecoratedpathlength\pgf@decorate@totalpathlength% - \def\pgfmetadecoratedinputsegmentremainingdistance{\pgfdecoratedremainingdistance}% - \def\pgfmetadecoratedinputsegmentcompleteddistance{\pgfdecoratedcompleteddistance}% - % - % Perform the meta decoration... - % - \expandafter\let\expandafter\pgf@metadecoration@current@state% - \csname pgf@metadecoration@@\pgf@metadecoration@name @initial\endcsname% - \pgf@metadecoration@run% - % - % ..until the final state. - % - \let\pgf@decorate@tempname\pgfutil@empty% - \let\pgf@decorate@tempbefore\pgfutil@empty% - \let\pgf@decorate@tempafter\pgfutil@empty% - \csname pgf@metadecoration@@\pgf@metadecoration@name @\pgf@metadecoration@current@state @code\endcsname% - \ifx\pgf@decorate@tempname\pgfutil@empty% - \def\pgf@decorate@tempname{moveto} - \fi% - \pgf@decorate@invoke{% - {\pgf@decorate@tempname}{\pgfdecoratedremainingdistance}% - {\pgf@decorate@tempbefore}{\pgf@decorate@tempafter}% - }% - \fi% - \pgfgetpath\pgfdecorationpath% - % - % Take stuff outside the group. - % - \global\let\pgf@decorate@decorationpathtemp\pgfdecorationpath% - \global\let\pgf@decorate@decoratedpathtemp\pgfdecoratedpath% - \global\let\pgf@decorate@existingpathtemp\pgfdecorateexistingpath% - \global\let\pgfpoint@decorated@pathlasttemp\pgfpoint@decorated@pathlast% - \endgroup% - % - % Are we in LaTeX? - % - \pgfutil@ifnextchar\@checkend{\aftergroup\pgf@decorate@installmacrosatend}% - {\pgf@decorate@installmacrosatend}% + \pgf@decoration@endenv% + \ifx\pgfdecoratedpath\pgfutil@empty% + \else% + \let\pgfmetadecoratedpathlength\pgf@decorate@totalpathlength% + \def\pgfmetadecoratedinputsegmentremainingdistance{\pgfdecoratedremainingdistance}% + \def\pgfmetadecoratedinputsegmentcompleteddistance{\pgfdecoratedcompleteddistance}% + % + % Perform the meta decoration... + % + \expandafter\let\expandafter\pgf@metadecoration@current@state% + \csname pgf@metadecoration@@\pgf@metadecoration@name @initial\endcsname% + \pgf@metadecoration@run% + % + % ..until the final state. + % + \let\pgf@decorate@tempname\pgfutil@empty% + \let\pgf@decorate@tempbefore\pgfutil@empty% + \let\pgf@decorate@tempafter\pgfutil@empty% + \csname pgf@metadecoration@@\pgf@metadecoration@name @\pgf@metadecoration@current@state @code\endcsname% + \ifx\pgf@decorate@tempname\pgfutil@empty% + \def\pgf@decorate@tempname{moveto} + \fi% + \pgf@decorate@invoke{% + {\pgf@decorate@tempname}{\pgfdecoratedremainingdistance}% + {\pgf@decorate@tempbefore}{\pgf@decorate@tempafter}% + }% + \fi% + \pgfgetpath\pgfdecorationpath% + % + % Take stuff outside the group. + % + \global\let\pgf@decorate@decorationpathtemp\pgfdecorationpath% + \global\let\pgf@decorate@decoratedpathtemp\pgfdecoratedpath% + \global\let\pgf@decorate@existingpathtemp\pgfdecorateexistingpath% + \global\let\pgfpoint@decorated@pathlasttemp\pgfpoint@decorated@pathlast% + \endgroup% + % + % Are we in LaTeX? + % + \pgfutil@ifnextchar\@checkend{\aftergroup\pgf@decorate@installmacrosatend}% + {\pgf@decorate@installmacrosatend}% } @@ -606,26 +606,26 @@ \let\pgfdecorationpath\pgfutil@empty% \let\pgfdecoratedpath\pgfutil@empty% \let\pgfpoint@decorated@pathlast\pgfpointorigin% - \edef\pgfpoint@decorate@existingpathlast{\pgf@x\the\pgf@path@lastx\pgf@y\the\pgf@path@lasty}% + \edef\pgfpoint@decorate@existingpathlast{\pgf@x\the\pgf@path@lastx\pgf@y\the\pgf@path@lasty}% % % Begin a group so transformations don't mess things up. % - \bgroup% + \bgroup% } \def\pgf@decorate@path@check@moveto#1{% - \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop} + \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop} \def\pgf@decorate@token@stop{\pgf@decorate@stop}% \def\pgf@decorate@path@@check@moveto#1#2#3#4\pgf@decorate@@stop#5#6{% - \def\pgf@decorate@temp{#4}% - \pgf@x=#2\relax% - \pgf@y=#3\relax% - \ifx\pgf@decorate@temp\pgf@decorate@token@stop% - #5% - \else% - #6% - \fi% + \def\pgf@decorate@temp{#4}% + \pgf@x=#2\relax% + \pgf@y=#3\relax% + \ifx\pgf@decorate@temp\pgf@decorate@token@stop% + #5% + \else% + #6% + \fi% } \def\pgf@decoration@endenv{% @@ -638,20 +638,20 @@ \pgfsetpath\pgfdecorateexistingpath% % \ifx\pgfdecoratedpath\pgfutil@empty% - \PackageError{PGF}{I cannot decorate an empty path}{}% + \pgferror{I cannot decorate an empty path}% \else% - % - % If the path consists of a single moveto token, make it - % a very small horizontal line. - % - \pgf@decorate@path@check@moveto\pgfdecoratedpath{% - \advance\pgf@x by0.0001pt\relax% - \edef\pgfdecoratedpath{% - \expandafter\noexpand\pgfdecoratedpath% - \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@x}{\the\pgf@y}% - }% - }% - {}% + % + % If the path consists of a single moveto token, make it + % a very small horizontal line. + % + \pgf@decorate@path@check@moveto\pgfdecoratedpath{% + \advance\pgf@x by0.0001pt\relax% + \edef\pgfdecoratedpath{% + \expandafter\noexpand\pgfdecoratedpath% + \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@x}{\the\pgf@y}% + }% + }% + {}% % % Remove special round tokens and get points. % @@ -668,7 +668,7 @@ % Reverse objects if necessary. % \ifpgf@decorate@inputsegmentobjects@reverse% - \pgf@decorate@inputsegmentobjects@reverse{\pgf@decorate@inputsegmentobjects}{\pgf@decorate@inputsegmentobjects}% + \pgf@decorate@inputsegmentobjects@reverse{\pgf@decorate@inputsegmentobjects}{\pgf@decorate@inputsegmentobjects}% \fi% % \let\pgf@decorated@remainingdistance\pgf@decorate@totalpathlength% @@ -687,13 +687,13 @@ \pgf@decorate@processnextinputsegmentobject% \pgf@decorate@distancetomove0pt\relax% \fi% -}% +}% \def\pgf@decorate@installmacrosatend{% - \let\pgfdecorationpath\pgf@decorate@decorationpathtemp% + \let\pgfdecorationpath\pgf@decorate@decorationpathtemp% \let\pgfdecoratedpath\pgf@decorate@decoratedpathtemp% \let\pgfdecorateexistingpath\pgf@decorate@existingpathtemp% \let\pgfpoint@decorated@pathlast\pgfpoint@decorated@pathlasttemp% @@ -710,18 +710,18 @@ % A version of \pgfutil@for which doesn't expand each value in #3. % \def\pgf@decorate@for#1:=#2\do#3{% - \def\pgf@decorate@for@var{#1}% - \def\pgf@decorate@for@action{#3}% - \expandafter\pgf@decorate@@for#2,\pgf@stop,} - + \def\pgf@decorate@for@var{#1}% + \def\pgf@decorate@for@action{#3}% + \expandafter\pgf@decorate@@for#2,\pgf@stop,} + \def\pgf@decorate@@for#1,{% - \ifx#1\pgf@stop% - \expandafter\let\pgf@decorate@for@var\pgfutil@empty% - \else% - \expandafter\def\pgf@decorate@for@var{#1}% - \pgf@decorate@for@action% - \expandafter\pgf@decorate@@for% - \fi% + \ifx#1\pgf@stop% + \expandafter\let\pgf@decorate@for@var\pgfutil@empty% + \else% + \expandafter\def\pgf@decorate@for@var{#1}% + \pgf@decorate@for@action% + \expandafter\pgf@decorate@@for% + \fi% } @@ -730,97 +730,97 @@ % #1 - {<name>}{<distance>}{<before code>}{<after code>} % \def\pgf@decorate@invoke#1{% - \pgf@decorate@@invoke#1\pgf@decorate@invoke\pgf@decorate@invoke\pgf@decorate@invoke\pgf@stop} - + \pgf@decorate@@invoke#1\pgf@decorate@invoke\pgf@decorate@invoke\pgf@decorate@invoke\pgf@stop} + \def\pgf@decorate@@invoke#1#2#3#4#5\pgf@stop{% - \pgfutil@ifundefined{pgf@decorate@@#1@initial}% - {% - \PackageError{PGF}{Unknown decoration `#1'}{}% - }% - {% - \def\pgf@decorate@name{#1}% - \ifx\pgf@decorate@invoke#3% - \let\pgf@decorate@beforecode\pgfutil@empty% - \else% - \def\pgf@decorate@beforecode{#3}% - \fi% - \ifx\pgf@decorate@invoke#4% - \let\pgf@decorate@aftercode\pgfutil@empty% - \else% - \def\pgf@decorate@aftercode{#4}% - \fi% - % - % Make remaining distance and the decorated path length `public'. - % - \pgfdecoratedremainingdistance\pgf@decorated@remainingdistance\relax% - \let\pgfdecoratedpathlength\pgf@decorate@totalpathlength% - % - \pgfmathsetlength\pgf@xa{#2}% - \ifdim\pgf@xa>\pgf@decorated@remainingdistance\relax% - \pgf@xa\pgf@decorated@remainingdistance\relax% - \fi% - \edef\pgf@decorate@currentpathlength{\the\pgf@xa}% - % - % Calculate the distance remaining to the end of the entire path. - % - \pgf@xa-\pgf@decorate@currentpathlength\relax% - \advance\pgf@xa\pgf@decorated@remainingdistance\relax% - \edef\pgf@decorated@remainingdistance{\the\pgf@xa}% - % - % Set up the macros and distances for the current section - % of the decorated path. - % - \let\pgfdecoratedpathlength\pgf@decorate@currentpathlength% - \pgfdecoratedremainingdistance\pgfdecoratedpathlength\relax% - \pgfdecoratedcompleteddistance0pt\relax% - % - % Execute user-defined code beore decoration. - % - \pgf@decorate@beforecode% - % - % Run the decoration... - % - \expandafter\let\expandafter\pgf@decorate@current@state% - \csname pgf@decorate@@\pgf@decorate@name @initial\endcsname% - \pgf@decorate@run% - % - % ...until the final state. - % - \ifdim\pgf@decorated@remainingdistance<1pt\relax% Should be =0pt, but need to control for inaccuracies. - \let\pgfpoint@decorated@pathlast\pgfpoint@decorated@totalpathlast% - \else% - % - % Set up \pgfpoint@decorated@pathlast if the end of - % the total decorated path has not been reached. - % - {% - \pgf@decorate@movealonginputsegment{\the\pgfdecoratedremainingdistance}% - \pgf@decorate@transformtoinputsegment% - \pgfpointorigin% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x\pgf@x% - \global\pgf@y\pgf@y% - }% - \edef\pgfpoint@decorated@pathlast{\pgf@x\the\pgf@x\pgf@y\the\pgf@y}% - \fi% - {% - \pgftransformreset% - \pgf@decorate@transformtoinputsegment% - \pgf@decorate@additionaltransform% - \csname pgf@decorate@@\pgf@decorate@name @final@code\endcsname% - }% - \pgf@decorate@movealonginputsegment{\the\pgfdecoratedremainingdistance}% - % - % Execute user-defined code after decoration. - % - \pgf@decorate@aftercode% - % - % Update the input segment objects. - % - \let\pgf@decorate@additionaltransform\pgfutil@empty% - \let\pgf@decorate@inputsegmentobjects\pgf@decorate@inputsegmentobjects@aftersplit% - \let\pgfpoint@decorated@pathfirst\pgfpoint@decorated@pathlast% - }% + \pgfutil@ifundefined{pgf@decorate@@#1@initial}% + {% + \pgferror{Unknown decoration `#1'}% + }% + {% + \def\pgf@decorate@name{#1}% + \ifx\pgf@decorate@invoke#3% + \let\pgf@decorate@beforecode\pgfutil@empty% + \else% + \def\pgf@decorate@beforecode{#3}% + \fi% + \ifx\pgf@decorate@invoke#4% + \let\pgf@decorate@aftercode\pgfutil@empty% + \else% + \def\pgf@decorate@aftercode{#4}% + \fi% + % + % Make remaining distance and the decorated path length `public'. + % + \pgfdecoratedremainingdistance\pgf@decorated@remainingdistance\relax% + \let\pgfdecoratedpathlength\pgf@decorate@totalpathlength% + % + \pgfmathsetlength\pgf@xa{#2}% + \ifdim\pgf@xa>\pgf@decorated@remainingdistance\relax% + \pgf@xa\pgf@decorated@remainingdistance\relax% + \fi% + \edef\pgf@decorate@currentpathlength{\the\pgf@xa}% + % + % Calculate the distance remaining to the end of the entire path. + % + \pgf@xa-\pgf@decorate@currentpathlength\relax% + \advance\pgf@xa\pgf@decorated@remainingdistance\relax% + \edef\pgf@decorated@remainingdistance{\the\pgf@xa}% + % + % Set up the macros and distances for the current section + % of the decorated path. + % + \let\pgfdecoratedpathlength\pgf@decorate@currentpathlength% + \pgfdecoratedremainingdistance\pgfdecoratedpathlength\relax% + \pgfdecoratedcompleteddistance0pt\relax% + % + % Execute user-defined code beore decoration. + % + \pgf@decorate@beforecode% + % + % Run the decoration... + % + \expandafter\let\expandafter\pgf@decorate@current@state% + \csname pgf@decorate@@\pgf@decorate@name @initial\endcsname% + \pgf@decorate@run% + % + % ...until the final state. + % + \ifdim\pgf@decorated@remainingdistance<1pt\relax% Should be =0pt, but need to control for inaccuracies. + \let\pgfpoint@decorated@pathlast\pgfpoint@decorated@totalpathlast% + \else% + % + % Set up \pgfpoint@decorated@pathlast if the end of + % the total decorated path has not been reached. + % + {% + \pgf@decorate@movealonginputsegment{\the\pgfdecoratedremainingdistance}% + \pgf@decorate@transformtoinputsegment% + \pgfpointorigin% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x\pgf@x% + \global\pgf@y\pgf@y% + }% + \edef\pgfpoint@decorated@pathlast{\pgf@x\the\pgf@x\pgf@y\the\pgf@y}% + \fi% + {% + \pgftransformreset% + \pgf@decorate@transformtoinputsegment% + \pgf@decorate@additionaltransform% + \csname pgf@decorate@@\pgf@decorate@name @final@code\endcsname% + }% + \pgf@decorate@movealonginputsegment{\the\pgfdecoratedremainingdistance}% + % + % Execute user-defined code after decoration. + % + \pgf@decorate@aftercode% + % + % Update the input segment objects. + % + \let\pgf@decorate@additionaltransform\pgfutil@empty% + \let\pgf@decorate@inputsegmentobjects\pgf@decorate@inputsegmentobjects@aftersplit% + \let\pgfpoint@decorated@pathfirst\pgfpoint@decorated@pathlast% + }% } @@ -832,25 +832,25 @@ % \pgfpointdecoratedpathfirst % \def\pgfpointdecoratedpathfirst{% - {% - \pgftransforminvert% - \pgfpoint@decorated@pathfirst% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x\pgf@x% - \global\pgf@y\pgf@y% - }% + {% + \pgftransforminvert% + \pgfpoint@decorated@pathfirst% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x\pgf@x% + \global\pgf@y\pgf@y% + }% }% % \pgfpointdecoratedpathlast % \def\pgfpointdecoratedpathlast{% - {% - \pgftransforminvert% - \pgfpoint@decorated@pathlast% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x\pgf@x% - \global\pgf@y\pgf@y% - }% + {% + \pgftransforminvert% + \pgfpoint@decorated@pathlast% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x\pgf@x% + \global\pgf@y\pgf@y% + }% }% % \pgfpointdecoratedinputsegmentfirst @@ -858,27 +858,27 @@ % The first point of the current sub-path. % \def\pgfpointdecoratedinputsegmentfirst{% - {% - \pgftransforminvert% - \pgf@decorate@inputsegment@first% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x\pgf@x% - \global\pgf@y\pgf@y% - }% -}% + {% + \pgftransforminvert% + \pgf@decorate@inputsegment@first% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x\pgf@x% + \global\pgf@y\pgf@y% + }% +}% % \pgfpointdecoratedinputsegmentlast % % The final point of the current sub-path. % \def\pgfpointdecoratedinputsegmentlast{% - {% - \pgftransforminvert% - \pgf@decorate@inputsegment@last% - \pgf@pos@transform{\pgf@x}{\pgf@y}% - \global\pgf@x\pgf@x% - \global\pgf@y\pgf@y% - }% + {% + \pgftransforminvert% + \pgf@decorate@inputsegment@last% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x\pgf@x% + \global\pgf@y\pgf@y% + }% }% @@ -887,7 +887,7 @@ % Run a normal decoration. % \def\pgf@decorate@run{% - \let\pgf@decorate@next\pgf@decorate@do@state% + \let\pgf@decorate@next\pgf@decorate@do@state% \ifx\pgf@decorate@current@state\pgf@final@text% \let\pgf@decorate@next\relax% \fi% @@ -931,10 +931,10 @@ % Next iteration. % \ifnum\pgf@decorate@repeatstate>0\relax% - \advance\pgf@decorate@repeatstate-1\relax% + \advance\pgf@decorate@repeatstate-1\relax% \else% - \pgf@decorate@repeatstate-1\relax% - \let\pgf@decorate@current@state\pgf@decorate@next@state% + \pgf@decorate@repeatstate-1\relax% + \let\pgf@decorate@current@state\pgf@decorate@next@state% \fi% \pgf@decorate@run% } @@ -1063,13 +1063,13 @@ \def\pgf@metadecoration@decoration#1{% - \edef\pgf@decorate@tempname{#1}% + \edef\pgf@decorate@tempname{#1}% } \def\pgf@metadecoration@beforedecoration#1{% - \def\pgf@decorate@tempbefore{#1}% + \def\pgf@decorate@tempbefore{#1}% } \def\pgf@metadecoration@afterdecoration#1{% - \def\pgf@decorate@tempafter{#1}% + \def\pgf@decorate@tempafter{#1}% } @@ -1078,7 +1078,7 @@ % Run a meta decoration. % \def\pgf@metadecoration@run{% - \let\pgf@metadecoration@next\pgf@metadecoration@do@state% + \let\pgf@metadecoration@next\pgf@metadecoration@do@state% \ifx\pgf@metadecoration@current@state\pgf@final@text% \let\pgf@metadecoration@next\relax% \fi% @@ -1086,7 +1086,7 @@ } \def\pgf@metadecoration@do@state{% - \let\pgf@metadecoration@next\relax% + \let\pgf@metadecoration@next\relax% \let\pgf@metadecoration@next@state\pgf@metadecoration@current@state% % % Set up some macros. @@ -1107,7 +1107,7 @@ } \def\pgf@metadecoration@do@code{% - % + % % Execute code. % \let\pgf@decorate@tempname\pgfutil@empty% @@ -1117,11 +1117,11 @@ \let\pgfpointmetadecoratedpathlast\pgfpointdecoratedpathlast% \csname pgf@metadecoration@@\pgf@metadecoration@name @\pgf@metadecoration@current@state @code\endcsname% \ifx\pgf@decorate@tempname\pgfutil@empty% - \def\pgf@decorate@tempname{moveto} - \fi% + \def\pgf@decorate@tempname{moveto} + \fi% \pgf@decorate@invoke{% - {\pgf@decorate@tempname}{\pgf@metadecoration@width}% - {\pgf@decorate@tempbefore}{\pgf@decorate@tempafter}% + {\pgf@decorate@tempname}{\pgf@metadecoration@width}% + {\pgf@decorate@tempbefore}{\pgf@decorate@tempafter}% }% % % Next iteration. @@ -1141,7 +1141,7 @@ \def\pgf@metadecoration@switch@if#1to #2\pgf@stop{% \ifx\pgf@metadecoration@next\relax% - \pgfmathsetlength\pgf@x{#1}% + \pgfmathsetlength\pgf@x{#1}% \ifdim\pgf@decorated@remainingdistance<\pgf@x% \def\pgf@metadecoration@current@state{#2}% \let\pgf@metadecoration@next\pgf@metadecoration@run% @@ -1151,7 +1151,7 @@ \def\pgf@metadecoration@switch@ifinputsegment#1to #2\pgf@stop{% \ifx\pgf@metadecoration@next\relax% - \pgfmathsetlength\pgf@x{#1}% + \pgfmathsetlength\pgf@x{#1}% \ifdim\pgfdecoratedinputsegmentremainingdistance<\pgf@x% \def\pgf@metadecoration@current@state{#2}% \let\pgf@metadecoration@next\pgf@metadecoration@run% @@ -1164,10 +1164,10 @@ % Move along the path by a specified distance. % \def\pgf@decorate@movealongpath#1{% - \pgfmathsetlength\pgf@decorate@distancetomove{#1}% - \advance\pgfdecoratedcompleteddistance\pgf@decorate@distancetomove% - \advance\pgfdecoratedremainingdistance-\pgf@decorate@distancetomove% - \pgf@decorate@@movealongpath% + \pgfmathsetlength\pgf@decorate@distancetomove{#1}% + \advance\pgfdecoratedcompleteddistance\pgf@decorate@distancetomove% + \advance\pgfdecoratedremainingdistance-\pgf@decorate@distancetomove% + \pgf@decorate@@movealongpath% } \def\pgf@decorate@@movealongpath{% \advance\pgfdecoratedinputsegmentcompleteddistance\pgf@decorate@distancetomove% @@ -1188,107 +1188,107 @@ } \def\pgf@decorate@@@movealongpath{% - % - % Move along input segment for real. - % - \pgf@decorate@movealonginputsegment{\the\pgf@decorate@distancetomove}% - \pgf@decorate@distancetomove0pt\relax% - % - % Grrr. Hacking to control some inaccuracies. - % - \ifdim\pgf@decorate@inputsegmenttime pt>1pt\relax% - \let\pgf@decorate@inputsegmenttimetemp\pgf@decorate@inputsegmenttime% - \pgf@decorate@processnextinputsegmentobject% - \pgf@x\pgf@decorate@inputsegmenttimetemp pt\relax% - \advance\pgf@x-1pt\relax% - \edef\pgf@decorate@inputsegmenttime{\pgfmath@tonumber{\pgf@x}}% - \ifx\pgf@decorate@currentinputsegmentobjects\pgfutil@empty% - \pgfdecoratedremainingdistance0pt\relax% - \fi% - \fi% + % + % Move along input segment for real. + % + \pgf@decorate@movealonginputsegment{\the\pgf@decorate@distancetomove}% + \pgf@decorate@distancetomove0pt\relax% + % + % Grrr. Hacking to control some inaccuracies. + % + \ifdim\pgf@decorate@inputsegmenttime pt>1pt\relax% + \let\pgf@decorate@inputsegmenttimetemp\pgf@decorate@inputsegmenttime% + \pgf@decorate@processnextinputsegmentobject% + \pgf@x\pgf@decorate@inputsegmenttimetemp pt\relax% + \advance\pgf@x-1pt\relax% + \edef\pgf@decorate@inputsegmenttime{\pgfmath@tonumber{\pgf@x}}% + \ifx\pgf@decorate@currentinputsegmentobjects\pgfutil@empty% + \pgfdecoratedremainingdistance0pt\relax% + \fi% + \fi% } % Return the next input segment object in a macro % \def\pgf@decorate@getnextinputsegmentobject#1{% - \ifx\pgf@decorate@currentinputsegmentobjects\pgfutil@empty% - \let\pgf@next\relax% - \else% - \def\pgf@decorate@temp{#1}% - \let\pgf@next\pgf@decorate@@getnextinputsegmentobject% - \fi% - \pgf@next% + \ifx\pgf@decorate@currentinputsegmentobjects\pgfutil@empty% + \let\pgf@next\relax% + \else% + \def\pgf@decorate@temp{#1}% + \let\pgf@next\pgf@decorate@@getnextinputsegmentobject% + \fi% + \pgf@next% } \def\pgf@decorate@@getnextinputsegmentobject{% - \expandafter\pgf@decorate@@@getnextinputsegmentobject\pgf@decorate@currentinputsegmentobjects\pgf@stop} + \expandafter\pgf@decorate@@@getnextinputsegmentobject\pgf@decorate@currentinputsegmentobjects\pgf@stop} \def\pgf@decorate@@@getnextinputsegmentobject#1#2\pgf@stop{% - \expandafter\def\pgf@decorate@temp{#1}% - \def\pgf@decorate@currentinputsegmentobjects{#2}} + \expandafter\def\pgf@decorate@temp{#1}% + \def\pgf@decorate@currentinputsegmentobjects{#2}} % Process the next input segment object. % \def\pgf@decorate@processnextinputsegmentobject{% - \let\pgfdecorationpreviousinputsegment\pgfdecoratecurrentinputsegment% - \let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject% - \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% - % - % If the current input segment object is a moveto, execute the - % object macro and get the next input segment object. - % - \pgf@decorate@is@closepath@false% - \pgf@decorate@currentinputsegmentobject% - \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% - \pgfpathmoveto{\pgf@decorate@inputsegment@first}% - \let\pgfdecorationpreviousinputsegment\pgfdecorationcurrentinputsegment% - \let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject% - \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% - \pgf@decorate@is@closepath@false% - \pgf@decorate@currentinputsegmentobject% - \fi% - % - % Teensy hack in case a path goes nowhere. - % - \ifdim\pgfdecoratedinputsegmentlength=0pt\relax% - \def\pgfdecoratedinputsegmentlength{0.05pt}% Arbitrary choice >0pt. - \fi% - \pgfdecoratedinputsegmentremainingdistance\pgfdecoratedinputsegmentlength\relax% - \pgfdecoratedinputsegmentcompleteddistance0pt\relax% - \def\pgf@decorate@inputsegmenttime{0}% - % - % Get the angle at the start of the input segment. - % - \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% - \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - \let\pgfdecoratedangle\pgfmathresult% - \let\pgfdecoratedinputsegmentstartangle\pgfmathresult% - \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% - \let\pgfdecoratedinputsegmentendangle\pgfmathresult% - \else% - \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}% - \let\pgfdecoratedangle\pgfmathresult% - \let\pgfdecoratedinputsegmentstartangle\pgfmathresult% - \let\pgfdecoratedinputsegmentendangle\pgfmathresult% - \fi% - % - % Get the angle to the next input segment. - % - \begingroup% - \pgf@decorate@nextinputsegmentobject% - \global\let\pgf@decorate@temp\pgfdecorationcurrentinputsegment% - \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% - \expandafter\pgf@decorate@currentinputsegmentobject% - \fi% - \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% - \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - \else% - \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}% - \fi% - \pgf@x-\pgfdecoratedangle pt\relax% - \advance\pgf@x\pgfmathresult pt\relax% - \edef\pgfdecoratedangletonextinputsegment{\the\pgf@x}% - \pgfmath@smuggleone\pgfdecoratedangletonextinputsegment% - \endgroup% - \let\pgfdecorationnextinputsegmentobject\pgf@decorate@temp% + \let\pgfdecorationpreviousinputsegment\pgfdecoratecurrentinputsegment% + \let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject% + \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% + % + % If the current input segment object is a moveto, execute the + % object macro and get the next input segment object. + % + \pgf@decorate@is@closepath@false% + \pgf@decorate@currentinputsegmentobject% + \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% + \pgfpathmoveto{\pgf@decorate@inputsegment@first}% + \let\pgfdecorationpreviousinputsegment\pgfdecorationcurrentinputsegment% + \let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject% + \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% + \pgf@decorate@is@closepath@false% + \pgf@decorate@currentinputsegmentobject% + \fi% + % + % Teensy hack in case a path goes nowhere. + % + \ifdim\pgfdecoratedinputsegmentlength=0pt\relax% + \def\pgfdecoratedinputsegmentlength{0.05pt}% Arbitrary choice >0pt. + \fi% + \pgfdecoratedinputsegmentremainingdistance\pgfdecoratedinputsegmentlength\relax% + \pgfdecoratedinputsegmentcompleteddistance0pt\relax% + \def\pgf@decorate@inputsegmenttime{0}% + % + % Get the angle at the start of the input segment. + % + \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% + \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + \let\pgfdecoratedangle\pgfmathresult% + \let\pgfdecoratedinputsegmentstartangle\pgfmathresult% + \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% + \let\pgfdecoratedinputsegmentendangle\pgfmathresult% + \else% + \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}% + \let\pgfdecoratedangle\pgfmathresult% + \let\pgfdecoratedinputsegmentstartangle\pgfmathresult% + \let\pgfdecoratedinputsegmentendangle\pgfmathresult% + \fi% + % + % Get the angle to the next input segment. + % + \begingroup% + \pgf@decorate@nextinputsegmentobject% + \global\let\pgf@decorate@temp\pgfdecorationcurrentinputsegment% + \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% + \expandafter\pgf@decorate@currentinputsegmentobject% + \fi% + \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% + \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + \else% + \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}% + \fi% + \pgf@x-\pgfdecoratedangle pt\relax% + \advance\pgf@x\pgfmathresult pt\relax% + \edef\pgfdecoratedangletonextinputsegment{\the\pgf@x}% + \pgfmath@smuggleone\pgfdecoratedangletonextinputsegment% + \endgroup% + \let\pgfdecorationnextinputsegmentobject\pgf@decorate@temp% } @@ -1315,56 +1315,55 @@ % Input segment object moveto. % \def\pgf@decorate@inputsegmentobject@moveto#1{% - \def\pgf@decorate@inputsegment@first{#1}% - \def\pgf@decorate@inputsegment@supporta{#1}% - \def\pgf@decorate@inputsegment@supportb{#1}% - \def\pgf@decorate@inputsegment@last{#1}% - \edef\pgf@decorate@lastmoveto{#1}% - \def\pgfdecoratedinputsegmentlength{0pt}% - \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% + \def\pgf@decorate@inputsegment@first{#1}% + \def\pgf@decorate@inputsegment@supporta{#1}% + \def\pgf@decorate@inputsegment@supportb{#1}% + \def\pgf@decorate@inputsegment@last{#1}% + \edef\pgf@decorate@lastmoveto{#1}% + \def\pgfdecoratedinputsegmentlength{0pt}% + \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% } % Input segment object lineto. % \def\pgf@decorate@inputsegmentobject@lineto#1#2#3{% - \def\pgfdecoratedinputsegmentlength{#1}% - \def\pgf@decorate@inputsegment@first{#2}% - \def\pgf@decorate@inputsegment@last{#3}% - % - % Supports should be defined like this, so if treated as a curve, - % equal time steps will correspond to equal distances. - % - \pgfpointdiff{#2}{#3}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfextract@process\pgf@decorate@inputsegment@supporta{% - \pgf@process{#2}% - \advance\pgf@x0.333333\pgf@xa% - \advance\pgf@y0.333333\pgf@ya% - }% - \pgfextract@process\pgf@decorate@inputsegment@supportb{% - \pgf@process{#2}% - \advance\pgf@x0.666666\pgf@xa% - \advance\pgf@y0.666666\pgf@ya% - }% - % - \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line% - \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line% - \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlineto% + \def\pgfdecoratedinputsegmentlength{#1}% + \def\pgf@decorate@inputsegment@first{#2}% + \def\pgf@decorate@inputsegment@last{#3}% + % + % Supports should be defined like this, so if treated as a curve, + % equal time steps will correspond to equal distances. + % + \pgfpointdiff{#2}{#3}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfextract@process\pgf@decorate@inputsegment@supporta{% + \pgf@process{#2}% + \advance\pgf@x0.333333\pgf@xa% + \advance\pgf@y0.333333\pgf@ya% + }% + \pgfextract@process\pgf@decorate@inputsegment@supportb{% + \pgf@process{#2}% + \advance\pgf@x0.666666\pgf@xa% + \advance\pgf@y0.666666\pgf@ya% + }% + \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line% + \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line% + \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlineto% } % Input segment object curveto. % \def\pgf@decorate@inputsegmentobject@curveto#1#2#3#4#5{% - \def\pgfdecoratedinputsegmentlength{#1}% - \def\pgf@decorate@inputsegment@first{#2}% - \def\pgf@decorate@inputsegment@supporta{#3}% - \def\pgf@decorate@inputsegment@supportb{#4}% - \def\pgf@decorate@inputsegment@last{#5}% - % - \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@curve% - \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@curve% - \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% + \def\pgfdecoratedinputsegmentlength{#1}% + \def\pgf@decorate@inputsegment@first{#2}% + \def\pgf@decorate@inputsegment@supporta{#3}% + \def\pgf@decorate@inputsegment@supportb{#4}% + \def\pgf@decorate@inputsegment@last{#5}% + % + \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@curve% + \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@curve% + \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% } % Input segment object closepath. @@ -1377,31 +1376,31 @@ \def\pgfdecoratedinputsegmentlength{#1}% \def\pgf@decorate@inputsegment@first{#2}% \def\pgf@decorate@inputsegment@last{#3}% - % - \pgfpointdiff{#2}{#3}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgfextract@process\pgf@decorate@inputsegment@supporta{% - \pgf@process{#2}% - \advance\pgf@x0.333333\pgf@xa% - \advance\pgf@y0.333333\pgf@ya% - }% - \pgfextract@process\pgf@decorate@inputsegment@supportb{% - \pgf@process{#2}% - \advance\pgf@x0.666666\pgf@xa% - \advance\pgf@y0.666666\pgf@ya% - }% - % + % + \pgfpointdiff{#2}{#3}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgfextract@process\pgf@decorate@inputsegment@supporta{% + \pgf@process{#2}% + \advance\pgf@x0.333333\pgf@xa% + \advance\pgf@y0.333333\pgf@ya% + }% + \pgfextract@process\pgf@decorate@inputsegment@supportb{% + \pgf@process{#2}% + \advance\pgf@x0.666666\pgf@xa% + \advance\pgf@y0.666666\pgf@ya% + }% + % \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line% \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line% - \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentclosepath% + \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentclosepath% } % Input segment object endofinputsegments. % \def\pgf@decorate@inputsegmentobject@endofinputsegments{% - \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlast% + \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlast% } @@ -1414,93 +1413,92 @@ % This macro controls how the automaton moves along a curve sub-path. % \def\pgf@decorate@movealonginputsegment@curve#1{% - \ifdim#1=0pt\relax% - \else% - \pgfpointcurveattime{\pgf@decorate@inputsegmenttime}% - {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \pgf@xb\pgf@decorate@inputsegmenttime pt\relax% - % - % Reduce the initial time step, depending on the length - % of the path. To do: Optimise this step (should also depend on #1). - % - \ifdim\pgf@decorate@currentpathlength<128pt\relax% - \pgf@yb.03125pt\relax% - \else% - \ifdim\pgf@decorate@currentpathlength<512pt\relax% - \pgf@yb.015625pt\relax% - \else% - \ifdim\pgf@decorate@currentpathlength<2048pt\relax% - \pgf@yb.00390625pt\relax% - \else% - \pgf@yb.0009765625pt\relax% - \fi% - \fi% - \fi% - \c@pgf@counta1\relax% - \pgfutil@tempdima0pt\relax% - \pgfmathloop% - \advance\pgf@xb\c@pgf@counta\pgf@yb% - % - % We would like to use \pgfpointcurveattime. However, we must not - % overuse \pgf@process or \pgfmath stuff within this loop, - % otherwise we increase the chances of save stack overflow. - % - \edef\pgf@decorate@temp{% - \pgf@xa\the\pgf@xa% - \pgf@xb\the\pgf@xb% - \pgf@ya\the\pgf@ya% - \pgf@yb\the\pgf@yb% - }% - % - \pgfpoint@decorate@curveattime{\pgfmath@tonumber{\pgf@xb}}% - {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% - % - \pgf@decorate@temp% - % - \pgf@xc\pgf@xa% - \pgf@yc\pgf@ya% - \pgf@xa\pgf@x% - \pgf@ya\pgf@y% - \advance\pgf@x-\pgf@xc% - \advance\pgf@y-\pgf@yc% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% - \pgfutil@tempdimb\pgfmathresult pt\relax% - \advance\pgfutil@tempdima\c@pgf@counta\pgfutil@tempdimb% - \ifnum\c@pgf@counta>0\relax% - \ifdim\pgfutil@tempdima>#1\relax% - \c@pgf@counta-\c@pgf@counta% - \pgf@yb.5\pgf@yb% - \fi% - \else% - \ifdim\pgfutil@tempdima<#1\relax% - \c@pgf@counta-\c@pgf@counta% - \pgf@yb.5\pgf@yb% - \fi% - \fi% - \ifdim\pgf@yb=0pt\relax% *Should* be OK. - \else% - \repeatpgfmathloop% - \edef\pgf@decorate@inputsegmenttime{\pgfmath@tonumber{\pgf@xb}}% - % - % Now calculate the angle at the new time on the curve. - % - % We can use \pgfpointcurveattime safely here. - % - \pgfpointcurveattime{\pgf@decorate@inputsegmenttime}% - {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% - \edef\pgf@marshal{% - \noexpand\pgfmathanglebetweenpoints% - {\pgf@x\the\pgf@xb\pgf@y\pgf@yb}% - {\pgf@x\the\pgf@xa\pgf@y\pgf@ya}% - }% - \pgf@marshal% - \let\pgfdecoratedangle\pgfmathresult% - \fi% + \ifdim#1=0pt\relax% + \else% + \pgfpointcurveattime{\pgf@decorate@inputsegmenttime}% + {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \pgf@xb\pgf@decorate@inputsegmenttime pt\relax% + % + % Reduce the initial time step, depending on the length + % of the path. To do: Optimise this step (should also depend on #1). + % + \ifdim\pgf@decorate@currentpathlength<128pt\relax% + \pgf@yb.03125pt\relax% + \else% + \ifdim\pgf@decorate@currentpathlength<512pt\relax% + \pgf@yb.015625pt\relax% + \else% + \ifdim\pgf@decorate@currentpathlength<2048pt\relax% + \pgf@yb.00390625pt\relax% + \else% + \pgf@yb.0009765625pt\relax% + \fi% + \fi% + \fi% + \c@pgf@counta1\relax% + \pgfutil@tempdima0pt\relax% + \pgfmathloop% + \advance\pgf@xb\c@pgf@counta\pgf@yb% + % + % We would like to use \pgfpointcurveattime. However, we must not + % overuse \pgf@process or \pgfmath stuff within this loop, + % otherwise we increase the chances of save stack overflow. + % + \edef\pgf@decorate@temp{% + \pgf@xa\the\pgf@xa% + \pgf@xb\the\pgf@xb% + \pgf@ya\the\pgf@ya% + \pgf@yb\the\pgf@yb% + }% + % + \pgfpoint@decorate@curveattime{\pgfmath@tonumber{\pgf@xb}}% + {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% + \pgf@decorate@temp% + % + \pgf@xc\pgf@xa% + \pgf@yc\pgf@ya% + \pgf@xa\pgf@x% + \pgf@ya\pgf@y% + \advance\pgf@x-\pgf@xc% + \advance\pgf@y-\pgf@yc% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \pgfutil@tempdimb\pgfmathresult pt\relax% + \advance\pgfutil@tempdima\c@pgf@counta\pgfutil@tempdimb% + \ifnum\c@pgf@counta>0\relax% + \ifdim\pgfutil@tempdima>#1\relax% + \c@pgf@counta-\c@pgf@counta% + \pgf@yb.5\pgf@yb% + \fi% + \else% + \ifdim\pgfutil@tempdima<#1\relax% + \c@pgf@counta-\c@pgf@counta% + \pgf@yb.5\pgf@yb% + \fi% + \fi% + \ifdim\pgf@yb=0pt\relax% *Should* be OK. + \else% + \repeatpgfmathloop% + \edef\pgf@decorate@inputsegmenttime{\pgfmath@tonumber{\pgf@xb}}% + % + % Now calculate the angle at the new time on the curve. + % + % We can use \pgfpointcurveattime safely here. + % + \pgfpointcurveattime{\pgf@decorate@inputsegmenttime}% + {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% + \edef\pgf@marshal{% + \noexpand\pgfmathanglebetweenpoints% + {\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb}% + {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}% + }% + \pgf@marshal% + \let\pgfdecoratedangle\pgfmathresult% + \fi% } % \pgfpoint@decorate@curveattime @@ -1549,141 +1547,140 @@ % Applies the necessary transform for a line sub-path. % \def\pgf@decorate@transformtoinputsegment@line{% - \pgftransformshift{% - \pgfpointadd{\pgf@decorate@inputsegment@first}% - {\pgfpointpolar{\pgfdecoratedangle}{\pgfdecoratedinputsegmentcompleteddistance}}% - }% - \pgftransformrotate{\pgfdecoratedangle}% + \pgftransformshift{% + \pgfpointlineatdistance{\pgfdecoratedinputsegmentcompleteddistance}{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last} + }% + \pgftransformrotate{\pgfdecoratedangle}% } % Applies the necessary transform for a curve sub-path. % \def\pgf@decorate@transformtoinputsegment@curve{% - \pgfslopedattimetrue% - \pgfallowupsidedownattimetrue% - \pgftransformcurveattime{\pgf@decorate@inputsegmenttime}% - {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% - {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% + \pgfslopedattimetrue% + \pgfallowupsidedownattimetrue% + \pgftransformcurveattime{\pgf@decorate@inputsegmenttime}% + {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% + {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% } -% \pgf@decorate@parsesoftpath -% -% Parses an instance of a soft path into intermediate line and curve -% sub-path objects which the decoration automaton can use to traverse +% \pgf@decorate@parsesoftpath +% +% Parses an instance of a soft path into intermediate line and curve +% sub-path objects which the decoration automaton can use to traverse % the decorated path. -% -% The soft path should be well formed and only contain `primative' -% soft path tokens, that is: moveto, lineto, curvetosupporta, -% curvetosupportb, curveto, rectcorner, rectsize, and closepath. -% (i.e., all specialround tokens should have removed using -% \pgfprocessround) -% -% The overall length of the path is also calculated and returned -% in the macro \pgfdecoratedpathlength. -% -% Parameters: -% -% #1 - a macro containing a well formed soft path. -% #2 - a macro to store the intermediate sub-path representations. -% -% Example: -% -% \pgfpathmoveto{\pgfpointorigin} -% \pgfpathlineto{\pgfpoint{0pt}{12pt}} -% \pgfpathlineto{\pgfpoint{12pt}{0pt}} -% \pgfgetpath\softpath -% -% \pgf@decorate@parsesoftpath{\softpath}{\parsedsoftpath} -% -% results in: -% -% \parsedsoftpath -> -% {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 0pt}{\pgf@x 0pt\pgf@y 12pt}} -% {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 12pt}{\pgf@x 12pt\pgf@y 12pt}} -% -% \pgfdecoratedpathlength -> -% 24pt +% +% The soft path should be well formed and only contain `primative' +% soft path tokens, that is: moveto, lineto, curvetosupporta, +% curvetosupportb, curveto, rectcorner, rectsize, and closepath. +% (i.e., all specialround tokens should have removed using +% \pgfprocessround) +% +% The overall length of the path is also calculated and returned +% in the macro \pgfdecoratedpathlength. +% +% Parameters: +% +% #1 - a macro containing a well formed soft path. +% #2 - a macro to store the intermediate sub-path representations. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{0pt}{12pt}} +% \pgfpathlineto{\pgfpoint{12pt}{0pt}} +% \pgfgetpath\softpath +% +% \pgf@decorate@parsesoftpath{\softpath}{\parsedsoftpath} +% +% results in: +% +% \parsedsoftpath -> +% {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 0pt}{\pgf@x 0pt\pgf@y 12pt}} +% {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 12pt}{\pgf@x 12pt\pgf@y 12pt}} +% +% \pgfdecoratedpathlength -> +% 24pt % \def\pgf@decorate@parsesoftpath#1#2{% - \def\pgf@decorate@inputsegmentobjectsmacro{#2}% - \let\pgf@decorate@inputsegmentobjects\pgfutil@empty% - \pgfutil@tempdima0pt\relax% - \let\pgfpoint@decorate@lastparsed\pgfpoint@decorate@existingpathlast% - \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@origin% - \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% - \let\pgfpoint@decorated@firstparsed\pgfutil@empty% - \expandafter\pgf@decorate@@parsesoftpath#1\pgf@stop% + \def\pgf@decorate@inputsegmentobjectsmacro{#2}% + \let\pgf@decorate@inputsegmentobjects\pgfutil@empty% + \pgfutil@tempdima0pt\relax% + \let\pgfpoint@decorate@lastparsed\pgfpoint@decorate@existingpathlast% + \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@origin% + \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% + \let\pgfpoint@decorated@firstparsed\pgfutil@empty% + \expandafter\pgf@decorate@@parsesoftpath#1\pgf@stop% } \def\pgf@decorate@@parsesoftpath#1{% - \ifx#1\pgf@stop% - \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% <- removes final moveto (may not be desirable). - \pgf@decorate@addtoinputsegmentobjects{\pgf@decorate@inputsegmentobject@endofinputsegments}% - \pgf@decorate@addtoinputsegmentobjects{\pgf@decorate@inputsegmentobject@endofinputsegments}% - \expandafter\let\pgf@decorate@inputsegmentobjectsmacro\pgf@decorate@inputsegmentobjects% - \edef\pgf@decorate@totalpathlength{\the\pgfutil@tempdima}% - \let\pgf@next\relax% - \else% - \ifx#1\pgfsyssoftpath@movetotoken% - \let\pgf@next\pgf@decorate@parsemoveto% - \else% - \ifx#1\pgfsyssoftpath@linetotoken% - \let\pgf@next\pgf@decorate@parselineto% - \else% - \ifx#1\pgfsyssoftpath@curvetosupportatoken% - \let\pgf@next\pgf@decorate@parsecurveto% - \else% - \ifx#1\pgfsyssoftpath@closepathtoken% - \let\pgf@next\pgf@decorate@parseclosepath% - \else% - \ifx#1\pgfsyssoftpath@rectcornertoken% - \let\pgf@next\pgf@decorate@parserect% - \else% - \PackageError{PGF}{Unrecognised soft path token `#1'}{}% - \fi% - \fi% - \fi% - \fi% - \fi% - \fi% - \pgf@next} + \ifx#1\pgf@stop% + \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% <- removes final moveto (may not be desirable). + \pgf@decorate@addtoinputsegmentobjects{\pgf@decorate@inputsegmentobject@endofinputsegments}% + \pgf@decorate@addtoinputsegmentobjects{\pgf@decorate@inputsegmentobject@endofinputsegments}% + \expandafter\let\pgf@decorate@inputsegmentobjectsmacro\pgf@decorate@inputsegmentobjects% + \edef\pgf@decorate@totalpathlength{\the\pgfutil@tempdima}% + \let\pgf@next\relax% + \else% + \ifx#1\pgfsyssoftpath@movetotoken% + \let\pgf@next\pgf@decorate@parsemoveto% + \else% + \ifx#1\pgfsyssoftpath@linetotoken% + \let\pgf@next\pgf@decorate@parselineto% + \else% + \ifx#1\pgfsyssoftpath@curvetosupportatoken% + \let\pgf@next\pgf@decorate@parsecurveto% + \else% + \ifx#1\pgfsyssoftpath@closepathtoken% + \let\pgf@next\pgf@decorate@parseclosepath% + \else% + \ifx#1\pgfsyssoftpath@rectcornertoken% + \let\pgf@next\pgf@decorate@parserect% + \else% + \pgferror{Unrecognised soft path token `#1'}% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \pgf@next} \def\pgf@decorate@addtoinputsegmentobjects#1{% - % - % If there is an input segment object waiting (i.e. a moveto), insert it here. - % - \ifx\pgf@decorate@queueinputsegmentobject\pgfutil@empty% - \else% - \let\pgf@decorate@temp\pgf@decorate@queueinputsegmentobject% - \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% - \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% - \fi% - \ifx\pgfpoint@decorated@firstparsed\pgfutil@empty% - #1% - \let\pgfpoint@decorated@firstparsed\pgf@decorate@inputsegment@first% - \fi% - \expandafter\def\expandafter\pgf@decorate@inputsegmentobjects\expandafter% - {\pgf@decorate@inputsegmentobjects{#1}}% -} - -% Convert \pgfsyssoftpath@movetotoken{<X>}{<Y>} into the following + % + % If there is an input segment object waiting (i.e. a moveto), insert it here. + % + \ifx\pgf@decorate@queueinputsegmentobject\pgfutil@empty% + \else% + \let\pgf@decorate@temp\pgf@decorate@queueinputsegmentobject% + \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% + \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% + \fi% + \ifx\pgfpoint@decorated@firstparsed\pgfutil@empty% + #1% + \let\pgfpoint@decorated@firstparsed\pgf@decorate@inputsegment@first% + \fi% + \expandafter\def\expandafter\pgf@decorate@inputsegmentobjects\expandafter% + {\pgf@decorate@inputsegmentobjects{#1}}% +} + +% Convert \pgfsyssoftpath@movetotoken{<X>}{<Y>} into the following % representation: -% -% \pgf@decorate@inputsegmentobject@moveto{\pgf@x X\pgf@y Y} +% +% \pgf@decorate@inputsegmentobject@moveto{\pgf@x X\pgf@y Y} % -% The moveto input segment object is not added immediately, so that -% only the last of multiple movetos is inserted. -% +% The moveto input segment object is not added immediately, so that +% only the last of multiple movetos is inserted. +% \def\pgf@decorate@parsemoveto#1#2{% - \def\pgf@decorate@queueinputsegmentobject{\pgf@decorate@inputsegmentobject@moveto{\pgf@x#1\pgf@y#2}}% - \def\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% - \pgf@decorate@@parsesoftpath% + \def\pgf@decorate@queueinputsegmentobject{\pgf@decorate@inputsegmentobject@moveto{\pgf@x#1\pgf@y#2}}% + \def\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% + \pgf@decorate@@parsesoftpath% } % Convert \pgfsyssoftpath@linetotoken{<X>}{<Y>} into the following @@ -1692,47 +1689,47 @@ % \pgf@decorate@inputsegmentobject@lineto{<length>}{\pgf@x <Last X> \pgf@y <Last Y}{\pgf@x <X> \pgf@y <Y>} % \def\pgf@decorate@parselineto#1#2{% - \pgf@decorate@linelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% - \advance\pgfutil@tempdima\pgfmathresult pt\relax% - \edef\pgf@decorate@temp{% - \noexpand\pgf@decorate@inputsegmentobject@lineto{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% - }% - \edef\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% - \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% - \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% - \pgf@decorate@@parsesoftpath% -} - + \pgf@decorate@linelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% + \advance\pgfutil@tempdima\pgfmathresult pt\relax% + \edef\pgf@decorate@temp{% + \noexpand\pgf@decorate@inputsegmentobject@lineto{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% + }% + \edef\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% + \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% + \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% + \pgf@decorate@@parsesoftpath% +} + % Convert \pgfsyssoftpath@curvetosupportatoken{<Xa>}{<Ya>}...etc % into the following representation: % % \pgf@decorate@inputsegmentobject@curveto{<length>}{\pgf@x <Last X> \pgf@y <Last Y} -% {\pgf@x <Xa> \pgf@y <Ya>}{\pgf@x <Xb> \pgf@y <Yb>}{\pgf@x <X> \pgf@y <Y>} +% {\pgf@x <Xa> \pgf@y <Ya>}{\pgf@x <Xb> \pgf@y <Yb>}{\pgf@x <X> \pgf@y <Y>} % \def\pgf@decorate@parsecurveto#1#2\pgfsyssoftpath@curvetosupportbtoken#3#4\pgfsyssoftpath@curvetotoken#5#6{% - \pgf@decorate@curvelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}{\pgf@x#3\pgf@y#4}{\pgf@x#5\pgf@y#6}% - \advance\pgfutil@tempdima\pgfmathresult pt\relax% - \edef\pgf@decorate@temp{% - \noexpand\pgf@decorate@inputsegmentobject@curveto{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}% - {\pgf@x#1\pgf@y#2}{\pgf@x#3\pgf@y#4}{\pgf@x#5\pgf@y#6}% - }% - \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% - \edef\pgfpoint@decorate@lastparsed{\pgf@x#5\pgf@y#6}% - \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% - \pgf@decorate@@parsesoftpath% + \pgf@decorate@curvelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}{\pgf@x#3\pgf@y#4}{\pgf@x#5\pgf@y#6}% + \advance\pgfutil@tempdima\pgfmathresult pt\relax% + \edef\pgf@decorate@temp{% + \noexpand\pgf@decorate@inputsegmentobject@curveto{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}% + {\pgf@x#1\pgf@y#2}{\pgf@x#3\pgf@y#4}{\pgf@x#5\pgf@y#6}% + }% + \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% + \edef\pgfpoint@decorate@lastparsed{\pgf@x#5\pgf@y#6}% + \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% + \pgf@decorate@@parsesoftpath% } \def\pgf@decorate@parseclosepath#1#2{% - \pgf@decorate@linelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% - \advance\pgfutil@tempdima\pgfmathresult pt\relax% - \edef\pgf@decorate@temp{% - \noexpand\pgf@decorate@inputsegmentobject@closepath{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% - }% - \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% - \edef\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% - \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% - \pgf@decorate@@parsesoftpath% + \pgf@decorate@linelength{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% + \advance\pgfutil@tempdima\pgfmathresult pt\relax% + \edef\pgf@decorate@temp{% + \noexpand\pgf@decorate@inputsegmentobject@closepath{\pgfmathresult pt}{\pgfpoint@decorate@lastparsed}{\pgf@x#1\pgf@y#2}% + }% + \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% + \edef\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% + \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% + \pgf@decorate@@parsesoftpath% } % Convert \pgfsyssoftpath@rectcornertoken{<X>}{<Y>}\pgfsyssoftpath@rectsizetoken{<Xa>}{<Ya>} @@ -1756,52 +1753,52 @@ % \newif\ifpgfdecoraterectangleclockwise \def\pgf@decorate@parserect#1#2\pgfsyssoftpath@rectsizetoken#3#4{% - % - % Subvert \pgf@decorate@parsesoftpath so parsing macros will - % return here instead of continuing to parse the soft path. - % - \let\pgf@decorate@orig@@parsesoftpath\pgf@decorate@@parsesoftpath% - \let\pgf@decorate@@parsesoftpath\relax% - \pgf@decorate@parsemoveto{#1}{#2}% - \pgf@xa#1\relax% - \pgf@ya#2\relax% - \ifpgfdecoraterectangleclockwise% - \advance\pgf@ya#4% - \pgf@yb\pgf@ya% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@xa#3% - \pgf@xb\pgf@xa% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@ya-#4% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@xa-#3% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parseclosepath\pgf@temp% - \else% - \advance\pgf@xa#3% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \pgf@xb\pgf@xa% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@ya#4% - \pgf@yb\pgf@ya% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@xa-#3% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parselineto\pgf@temp% - \advance\pgf@ya-#4% - \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% - \expandafter\pgf@decorate@parseclosepath\pgf@temp% - \fi% - % - % Restore the parsing. - % - \let\pgf@decorate@@parsesoftpath\pgf@decorate@orig@@parsesoftpath% - \edef\pgf@marshal{\noexpand\pgf@decorate@parsemoveto{\the\pgf@xb}{\the\pgf@yb}}% - \pgf@marshal% + % + % Subvert \pgf@decorate@parsesoftpath so parsing macros will + % return here instead of continuing to parse the soft path. + % + \let\pgf@decorate@orig@@parsesoftpath\pgf@decorate@@parsesoftpath% + \let\pgf@decorate@@parsesoftpath\relax% + \pgf@decorate@parsemoveto{#1}{#2}% + \pgf@xa#1\relax% + \pgf@ya#2\relax% + \ifpgfdecoraterectangleclockwise% + \advance\pgf@ya#4% + \pgf@yb\pgf@ya% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@xa#3% + \pgf@xb\pgf@xa% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@ya-#4% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@xa-#3% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parseclosepath\pgf@temp% + \else% + \advance\pgf@xa#3% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@xb\pgf@xa% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@ya#4% + \pgf@yb\pgf@ya% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@xa-#3% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parselineto\pgf@temp% + \advance\pgf@ya-#4% + \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\pgf@decorate@parseclosepath\pgf@temp% + \fi% + % + % Restore the parsing. + % + \let\pgf@decorate@@parsesoftpath\pgf@decorate@orig@@parsesoftpath% + \edef\pgf@marshal{\noexpand\pgf@decorate@parsemoveto{\the\pgf@xb}{\the\pgf@yb}}% + \pgf@marshal% } @@ -1812,8 +1809,8 @@ % Define \pgfmathresult as the distance between #1 and #2 (without units). % \def\pgf@decorate@linelength#1#2{% - \pgf@process{\pgfpointdiff{#1}{#2}}% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% + \pgf@process{\pgfpointdiff{#1}{#2}}% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% } % \pgf@decorate@curvelength @@ -1824,138 +1821,138 @@ % To approximate the length of the curve P (sort of) use: % % curveLength(P,q) -% Q = subdivideLeft(P); -% R = subdivideRight(P); +% Q = subdivideLeft(P); +% R = subdivideRight(P); % return curveLength'(Q,q) + curveLength'(R,q); % % curveLength'(P,q) -% <P1,P2,P3,P4> <- P; +% <P1,P2,P3,P4> <- P; % P' = P4 - P1; % x = P'.x(); -% y = P'.y(); +% y = P'.y(); % if (x < q) && (y < q) -% return |P'|; -% else% -% Q = subdivideLeft(P); -% R = subdivideRight(P); +% return |P'|; +% else% +% Q = subdivideLeft(P); +% R = subdivideRight(P); % return curveLength'(Q,q) + curveLength'(R,q); % % Where q is some small value (`tolerance'). % \newif\ifpgf@decorate@subdivide \def\pgf@decorate@curvelength#1#2#3#4{% - % - % Always begin with a subdivision in case #1 = #4. - % - \begingroup% - \pgf@decorate@recursive@subdividecurve@left{#1}{#2}{#3}{#4}% - \pgfutil@tempdimb\pgfmathresult pt\relax% - \pgf@decorate@recursive@subdividecurve@right{#1}{#2}{#3}{#4}% - \advance\pgfutil@tempdimb\pgfmathresult pt\relax% - \pgfmath@returnone\pgfutil@tempdimb% - \endgroup% -} - + % + % Always begin with a subdivision in case #1 = #4. + % + \begingroup% + \pgf@decorate@recursive@subdividecurve@left{#1}{#2}{#3}{#4}% + \pgfutil@tempdimb\pgfmathresult pt\relax% + \pgf@decorate@recursive@subdividecurve@right{#1}{#2}{#3}{#4}% + \advance\pgfutil@tempdimb\pgfmathresult pt\relax% + \pgfmath@returnone\pgfutil@tempdimb% + \endgroup% +} + \def\pgf@decorate@@curvelength#1#2#3#4{% - \begingroup% - \pgf@decorate@curvecordlength{#1}{#2}{#3}{#4}% - \ifpgf@decorate@subdivide% - \pgf@decorate@recursive@subdividecurve@left{#1}{#2}{#3}{#4}% - \pgfutil@tempdimb\pgfmathresult pt\relax% - \pgf@decorate@recursive@subdividecurve@right{#1}{#2}{#3}{#4}% - \advance\pgfutil@tempdimb\pgfmathresult pt\relax% - \expandafter\pgfmath@returnone\expandafter\pgfutil@tempdimb% - \else% - \expandafter\pgfmath@returnone\expandafter\pgfmathresult\expandafter p\expandafter t\expandafter% - \fi% - \endgroup% + \begingroup% + \pgf@decorate@curvecordlength{#1}{#2}{#3}{#4}% + \ifpgf@decorate@subdivide% + \pgf@decorate@recursive@subdividecurve@left{#1}{#2}{#3}{#4}% + \pgfutil@tempdimb\pgfmathresult pt\relax% + \pgf@decorate@recursive@subdividecurve@right{#1}{#2}{#3}{#4}% + \advance\pgfutil@tempdimb\pgfmathresult pt\relax% + \expandafter\pgfmath@returnone\expandafter\pgfutil@tempdimb% + \else% + \expandafter\pgfmath@returnone\expandafter\pgfmathresult\expandafter p\expandafter t\expandafter% + \fi% + \endgroup% } \def\pgf@decorate@curvelength@tolerance{1pt} \def\pgf@decorate@curvecordlength#1#2#3#4{% - % - % Calculate the curve cord vector. - % - #4\relax% - \pgf@xa\pgf@x\pgf@ya\pgf@y% - #1\relax% - \advance\pgf@xa-\pgf@x% - \advance\pgf@ya-\pgf@y% - \ifdim\pgf@xa<0pt\relax\pgf@xa-\pgf@xa\fi% - \ifdim\pgf@ya<0pt\relax\pgf@ya-\pgf@ya\fi% - % - % Always subdivide, unless... - % - \pgf@decorate@subdividetrue% - % - % The cord vector is small. - % - \ifdim\pgf@xa<\pgf@decorate@curvelength@tolerance\relax% - \ifdim\pgf@ya<\pgf@decorate@curvelength@tolerance\relax% - \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}% - \pgf@decorate@subdividefalse% - \fi% - \fi% + % + % Calculate the curve cord vector. + % + #4\relax% + \pgf@xa\pgf@x\pgf@ya\pgf@y% + #1\relax% + \advance\pgf@xa-\pgf@x% + \advance\pgf@ya-\pgf@y% + \ifdim\pgf@xa<0pt\relax\pgf@xa-\pgf@xa\fi% + \ifdim\pgf@ya<0pt\relax\pgf@ya-\pgf@ya\fi% + % + % Always subdivide, unless... + % + \pgf@decorate@subdividetrue% + % + % The cord vector is small. + % + \ifdim\pgf@xa<\pgf@decorate@curvelength@tolerance\relax% + \ifdim\pgf@ya<\pgf@decorate@curvelength@tolerance\relax% + \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}% + \pgf@decorate@subdividefalse% + \fi% + \fi% } \def\pgf@decorate@recursive@subdividecurve@left#1#2#3#4{% - {% - % - % The left curve (from t=0 to t=.5) - % - #1\relax% - \pgfutil@tempdima\pgf@x% - \pgfutil@tempdimb\pgf@y% - \pgf@xa.5\pgf@x\pgf@ya.5\pgf@y% - \pgf@xb.25\pgf@x\pgf@yb.25\pgf@y% - \pgf@xc.125\pgf@x\pgf@yc.125\pgf@y% - #2\relax% - \advance\pgf@xa.5\pgf@x\advance\pgf@ya.5\pgf@y% - \advance\pgf@xb.5\pgf@x\advance\pgf@yb.5\pgf@y% - \advance\pgf@xc.375\pgf@x\advance\pgf@yc.375\pgf@y% - #3\relax% - \advance\pgf@xb.25\pgf@x\advance\pgf@yb.25\pgf@y% - \advance\pgf@xc.375\pgf@x\advance\pgf@yc.375\pgf@y% - #4\relax% - \advance\pgf@xc.125\pgf@x\advance\pgf@yc.125\pgf@y% - \xdef\pgf@marshal{% - \noexpand\pgf@decorate@@curvelength% - {\pgf@x\the\pgfutil@tempdima\pgf@y\the\pgfutil@tempdimb}% - {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}{\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb} - {\pgf@x\the\pgf@xc\pgf@y\the\pgf@yc}% - }% - }% - \pgf@marshal% + {% + % + % The left curve (from t=0 to t=.5) + % + #1\relax% + \pgfutil@tempdima\pgf@x% + \pgfutil@tempdimb\pgf@y% + \pgf@xa.5\pgf@x\pgf@ya.5\pgf@y% + \pgf@xb.25\pgf@x\pgf@yb.25\pgf@y% + \pgf@xc.125\pgf@x\pgf@yc.125\pgf@y% + #2\relax% + \advance\pgf@xa.5\pgf@x\advance\pgf@ya.5\pgf@y% + \advance\pgf@xb.5\pgf@x\advance\pgf@yb.5\pgf@y% + \advance\pgf@xc.375\pgf@x\advance\pgf@yc.375\pgf@y% + #3\relax% + \advance\pgf@xb.25\pgf@x\advance\pgf@yb.25\pgf@y% + \advance\pgf@xc.375\pgf@x\advance\pgf@yc.375\pgf@y% + #4\relax% + \advance\pgf@xc.125\pgf@x\advance\pgf@yc.125\pgf@y% + \xdef\pgf@marshal{% + \noexpand\pgf@decorate@@curvelength% + {\pgf@x\the\pgfutil@tempdima\pgf@y\the\pgfutil@tempdimb}% + {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}{\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb} + {\pgf@x\the\pgf@xc\pgf@y\the\pgf@yc}% + }% + }% + \pgf@marshal% } \def\pgf@decorate@recursive@subdividecurve@right#1#2#3#4{% - {% - % - % The right curve (from t=0.5 to t=1) - % - #1\relax% - \pgfutil@tempdima.125\pgf@x\pgfutil@tempdimb.125\pgf@y% - #2\relax% - \advance\pgfutil@tempdima.375\pgf@x\advance\pgfutil@tempdimb.375\pgf@y% - \pgf@xa.25\pgf@x\pgf@ya.25\pgf@y% - #3\relax% - \advance\pgfutil@tempdima.375\pgf@x\advance\pgfutil@tempdimb.375\pgf@y% - \advance\pgf@xa.5\pgf@x\advance\pgf@ya.5\pgf@y% - \pgf@xb.5\pgf@x\pgf@yb.5\pgf@y% - #4\relax% - \advance\pgfutil@tempdima.125\pgf@x\advance\pgfutil@tempdimb.125\pgf@y% - \advance\pgf@xa.25\pgf@x\advance\pgf@ya.25\pgf@y% - \advance\pgf@xb.5\pgf@x\advance\pgf@yb.5\pgf@y% - \pgf@xc\pgf@x\pgf@yc\pgf@y% - \xdef\pgf@marshal{% - \noexpand\pgf@decorate@@curvelength% - {\pgf@x\the\pgfutil@tempdima\pgf@y\the\pgfutil@tempdimb}% - {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}{\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb} - {\pgf@x\the\pgf@xc\pgf@y\the\pgf@yc}% - }% - }% - \pgf@marshal% + {% + % + % The right curve (from t=0.5 to t=1) + % + #1\relax% + \pgfutil@tempdima.125\pgf@x\pgfutil@tempdimb.125\pgf@y% + #2\relax% + \advance\pgfutil@tempdima.375\pgf@x\advance\pgfutil@tempdimb.375\pgf@y% + \pgf@xa.25\pgf@x\pgf@ya.25\pgf@y% + #3\relax% + \advance\pgfutil@tempdima.375\pgf@x\advance\pgfutil@tempdimb.375\pgf@y% + \advance\pgf@xa.5\pgf@x\advance\pgf@ya.5\pgf@y% + \pgf@xb.5\pgf@x\pgf@yb.5\pgf@y% + #4\relax% + \advance\pgfutil@tempdima.125\pgf@x\advance\pgfutil@tempdimb.125\pgf@y% + \advance\pgf@xa.25\pgf@x\advance\pgf@ya.25\pgf@y% + \advance\pgf@xb.5\pgf@x\advance\pgf@yb.5\pgf@y% + \pgf@xc\pgf@x\pgf@yc\pgf@y% + \xdef\pgf@marshal{% + \noexpand\pgf@decorate@@curvelength% + {\pgf@x\the\pgfutil@tempdima\pgf@y\the\pgfutil@tempdimb}% + {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}{\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb} + {\pgf@x\the\pgf@xc\pgf@y\the\pgf@yc}% + }% + }% + \pgf@marshal% } @@ -1965,138 +1962,138 @@ % #2 - a macro holding the reversed input segment objects. % \def\pgf@decorate@inputsegmentobjects@reverse#1#2{% - \def\pgf@decorate@path@storein{#2}% - \def\pgf@decorate@inputsegments@@temp{}% - \expandafter\pgf@decorate@inputsegments@@reverse@pass@first#1\pgf@stop} + \def\pgf@decorate@path@storein{#2}% + \def\pgf@decorate@inputsegments@@temp{}% + \expandafter\pgf@decorate@inputsegments@@reverse@pass@first#1\pgf@stop} \def\pgf@decorate@inputsegments@@reverse@pass@first#1#2\pgf@stop{% - \def\pgf@decorate@temp{#1}% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter% - {\expandafter\pgf@decorate@temp\pgf@decorate@inputsegments@@temp}% - \def\pgf@decorate@test{#2} - \ifx\pgf@decorate@test\pgfutil@empty% - \def\pgf@decorate@next{% - \expandafter\pgf@decorate@inputsegmentobjects@reverse@pass@second\pgf@decorate@inputsegments@@temp\pgf@stop% - }% - \else% - \def\pgf@decorate@next{\pgf@decorate@inputsegments@@reverse@pass@first#2\pgf@stop}% - \fi% - \pgf@decorate@next% -} + \def\pgf@decorate@temp{#1}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter% + {\expandafter\pgf@decorate@temp\pgf@decorate@inputsegments@@temp}% + \def\pgf@decorate@test{#2} + \ifx\pgf@decorate@test\pgfutil@empty% + \def\pgf@decorate@next{% + \expandafter\pgf@decorate@inputsegmentobjects@reverse@pass@second\pgf@decorate@inputsegments@@temp\pgf@stop% + }% + \else% + \def\pgf@decorate@next{\pgf@decorate@inputsegments@@reverse@pass@first#2\pgf@stop}% + \fi% + \pgf@decorate@next% +} \def\pgf@decorate@inputsegmentobjects@reverse@pass@second#1#2#3\pgf@stop{% - \def\pgf@decorate@inputsegments@temp{#3}% - \def\pgf@decorate@inputsegments@@temp{}% - \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty - \let\pgf@decorate@last@object=\pgfutil@empty - \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue% - \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% - \expandafter\pgf@decorate@path@@reverse@pass@second\pgf@decorate@inputsegments@temp\pgf@stop}% + \def\pgf@decorate@inputsegments@temp{#3}% + \def\pgf@decorate@inputsegments@@temp{}% + \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty + \let\pgf@decorate@last@object=\pgfutil@empty + \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue% + \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% + \expandafter\pgf@decorate@path@@reverse@pass@second\pgf@decorate@inputsegments@temp\pgf@stop}% \def\pgf@decorate@path@@reverse@pass@second#1{% - \ifx#1\pgf@stop% - \expandafter\def\expandafter\pgf@decorate@inputsegments@@temp\expandafter{% - \pgf@decorate@inputsegments@@temp% - {\pgf@decorate@inputsegmentobject@endofinputsegments}% - {\pgf@decorate@inputsegmentobject@endofinputsegments} - }% - \expandafter\let\pgf@decorate@path@storein=\pgf@decorate@inputsegments@@temp% - \let\pgf@decorate@next=\relax% - \else% - \ifx#1\pgf@decorate@inputsegmentobject@moveto% - \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@moveto% - \else% - \ifx#1\pgf@decorate@inputsegmentobject@lineto% - \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@lineto% - \else% - \ifx#1\pgf@decorate@inputsegmentobject@curveto% - \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@curveto% - \else% - \ifx#1\pgf@decorate@inputsegmentobject@closepath% - \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@closepath% - \else% - \fi% - \fi% - \fi% - \fi% - \fi% - \pgf@decorate@next% + \ifx#1\pgf@stop% + \expandafter\def\expandafter\pgf@decorate@inputsegments@@temp\expandafter{% + \pgf@decorate@inputsegments@@temp% + {\pgf@decorate@inputsegmentobject@endofinputsegments}% + {\pgf@decorate@inputsegmentobject@endofinputsegments} + }% + \expandafter\let\pgf@decorate@path@storein=\pgf@decorate@inputsegments@@temp% + \let\pgf@decorate@next=\relax% + \else% + \ifx#1\pgf@decorate@inputsegmentobject@moveto% + \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@moveto% + \else% + \ifx#1\pgf@decorate@inputsegmentobject@lineto% + \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@lineto% + \else% + \ifx#1\pgf@decorate@inputsegmentobject@curveto% + \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@curveto% + \else% + \ifx#1\pgf@decorate@inputsegmentobject@closepath% + \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@closepath% + \else% + \fi% + \fi% + \fi% + \fi% + \fi% + \pgf@decorate@next% } \newif\ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting \def\pgf@decorate@inputsegmentobjects@reverse@moveto#1{% - \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting% - \edef\pgf@decorate@current@inputsegmentobject{% - {\noexpand\pgf@decorate@inputsegmentobject@closepath% - {\pgf@decorate@reverse@closepath@length}% - {\pgf@decorate@last}% - {#1}% - }% - }% - \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% - \else% - \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty% - \fi% - \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue% - \pgf@decorate@path@@@reverse@pass@second% + \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting% + \edef\pgf@decorate@current@inputsegmentobject{% + {\noexpand\pgf@decorate@inputsegmentobject@closepath% + {\pgf@decorate@reverse@closepath@length}% + {\pgf@decorate@last}% + {#1}% + }% + }% + \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% + \else% + \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty% + \fi% + \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue% + \pgf@decorate@path@@@reverse@pass@second% } \newif\ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting \def\pgf@decorate@inputsegmentobjects@reverse@closepath#1#2#3{% - \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingtrue% - \def\pgf@decorate@reverse@closepath@length{#1}% - \def\pgf@decorate@current@inputsegmentobject{}% - \pgf@decorate@inputsegmentobjects@reverse@lineto{#1}{#2}{#3}% + \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingtrue% + \def\pgf@decorate@reverse@closepath@length{#1}% + \def\pgf@decorate@current@inputsegmentobject{}% + \pgf@decorate@inputsegmentobjects@reverse@lineto{#1}{#2}{#3}% } \def\pgf@decorate@inputsegmentobjects@reverse@lineto#1#2#3#4{% - \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% - \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@moveto{#3}}}% - \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse% - \else% - \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty% - \fi% - \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}% - \ifx#4\pgf@decorate@inputsegmentobject@moveto% - \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting% - \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@closepath{#1}{#3}{#2}}}% - \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% - \else% - \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}% - \fi% - \fi% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - \pgf@decorate@current@inputsegmentobject\expandafter\expandafter\expandafter% - {\expandafter\pgf@decorate@current@inputsegmentobject\pgf@decorate@append@inputsegmentobject} - \def\pgf@decorate@last{#2}% - \pgf@decorate@path@@@reverse@pass@second#4% + \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% + \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@moveto{#3}}}% + \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse% + \else% + \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty% + \fi% + \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}% + \ifx#4\pgf@decorate@inputsegmentobject@moveto% + \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting% + \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@closepath{#1}{#3}{#2}}}% + \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse% + \else% + \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}% + \fi% + \fi% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + \pgf@decorate@current@inputsegmentobject\expandafter\expandafter\expandafter% + {\expandafter\pgf@decorate@current@inputsegmentobject\pgf@decorate@append@inputsegmentobject} + \def\pgf@decorate@last{#2}% + \pgf@decorate@path@@@reverse@pass@second#4% } \def\pgf@decorate@inputsegmentobjects@reverse@curveto#1#2#3#4#5{% - \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% - \def\pgf@decorate@current@inputsegmentobject{% - {\pgf@decorate@inputsegmentobject@moveto{#5}}% - {\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}% - }% - \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse% - \else% - \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}}% - \fi% - \def\pgf@decorate@last{#2}% - \pgf@decorate@path@@@reverse@pass@second% + \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% + \def\pgf@decorate@current@inputsegmentobject{% + {\pgf@decorate@inputsegmentobject@moveto{#5}}% + {\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}% + }% + \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse% + \else% + \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}}% + \fi% + \def\pgf@decorate@last{#2}% + \pgf@decorate@path@@@reverse@pass@second% } \def\pgf@decorate@path@@@reverse@pass@second{% - \ifx\pgf@decorate@current@inputsegmentobject\pgfutil@empty% - \else% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter% - {\expandafter\pgf@decorate@inputsegments@@temp\pgf@decorate@current@inputsegmentobject}% - \fi% - \pgf@decorate@path@@reverse@pass@second% + \ifx\pgf@decorate@current@inputsegmentobject\pgfutil@empty% + \else% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter% + {\expandafter\pgf@decorate@inputsegments@@temp\pgf@decorate@current@inputsegmentobject}% + \fi% + \pgf@decorate@path@@reverse@pass@second% }% |