diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex | 594 |
1 files changed, 416 insertions, 178 deletions
diff --git a/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex b/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex index 9214dfd6dd3..a3fa361d216 100644 --- a/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex +++ b/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex @@ -14,251 +14,489 @@ %% ---------------------------------------------------------------- %% \usepgflibrary{hobby} -\let\hobby@opts=\pgfutil@empty +\let\hobby@this@opts=\pgfutil@empty +\let\hobby@next@opts=\pgfutil@empty +\let\hobby@action=\pgfutil@empty +\let\hobby@path@name=\pgfutil@empty +\newif\ifhobby@externalise +\def\hobby@point@options{}% \tikzset{ curve through/.style={ to path={ \pgfextra{ - \expandafter\curvethrough\expandafter[\hobby@opts]{% + \expandafter\curvethrough\expandafter[\hobby@next@opts]{% (\tikztostart) .. #1 .. (\tikztotarget)% } } } }, - tension in/.code = {}, - tension out/.code = {}, - tension/.code = {}, - excess angle/.code = {}, - closed/.code = {% - \expandafter\def\expandafter\hobby@opts\expandafter{\hobby@opts% - closed=#1,disjoint=#1}% + tension in/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,tension in=#1}% + }, + tension out/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,tension out=#1}% + }, + tension/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,tension=#1}% + }, + excess angle/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,excess angle=#1}% + }, + break/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,break=#1}% + }, + blank/.code = {% + \expandafter\gdef\expandafter\hobby@point@options\expandafter% + {\hobby@point@options,blank=#1}% + }, + designated Hobby path/.initial={next}, + clear next Hobby path options/.code={% + \gdef\hobby@next@opts{}% + }, + clear this Hobby path options/.code={% + \gdef\hobby@this@opts{}% + }, + clear Hobby path options/.style={% + clear \pgfkeysvalueof{/tikz/designated Hobby path} Hobby path options + }, + add option to this Hobby path/.code={% + \expandafter\gdef\expandafter\hobby@this@opts\expandafter{\hobby@this@opts#1,}% + }, + add option to next Hobby path/.code={% + \expandafter\gdef\expandafter\hobby@next@opts\expandafter{\hobby@next@opts#1,}% + }, + add option to Hobby path/.style={% + add option to \pgfkeysvalueof{/tikz/designated Hobby path} Hobby path={#1}% + }, + closed/.style = {% + add option to Hobby path={closed=#1,disjoint=#1}% + }, + invert blank/.style = {% + add option to Hobby path={invert blank=#1}% }, closed/.default = true, + blank/.default = true, + break/.default = true, + invert blank/.default = true, in angle/.code = {% \pgfmathparse{#1*pi/180}% - \edef\@temp{ in angle=\pgfmathresult,}% - \expandafter\expandafter\expandafter% - \def% - \expandafter\expandafter\expandafter% - \hobby@opts% - \expandafter\expandafter\expandafter% - {\expandafter\hobby@opts\@temp}% + \edef\@temp{in angle=\pgfmathresult,}% + \pgfkeysalso{add option to Hobby path/.expand once=\@temp}% }, out angle/.code = {% \pgfmathparse{#1*pi/180}% - \edef\@temp{ out angle=\pgfmathresult,}% - \expandafter\expandafter\expandafter% - \def% - \expandafter\expandafter\expandafter% - \hobby@opts% - \expandafter\expandafter\expandafter% - {\expandafter\hobby@opts\@temp}% + \edef\@temp{out angle=\pgfmathresult,}% + \pgfkeysalso{add option to Hobby path/.expand once=\@temp}% }, - in curl/.code = {% - \expandafter\def\expandafter\hobby@opts\expandafter{\hobby@opts in curl=#1,}% + in curl/.style = {% + add option to Hobby path={in curl=#1}% }, out curl/.code = {% - \expandafter\def\expandafter\hobby@opts\expandafter{\hobby@opts out curl=#1,}% + add option to Hobby path={out curl=#1}% }, use Hobby shortcut/.code={% - \let\tikz@curveto@auto=\hobby@curveto@auto - } + \let\tikz@curveto@auto=\hobby@curveto@override + \global\let\hobby@curveto@delegate=\hobby@curveto@auto + }, + use quick Hobby shortcut/.code={% + \let\tikz@curveto@auto=\hobby@curveto@override + \global\let\hobby@curveto@delegate=\hobby@qcurveto@auto + }, + use previous Hobby path/.code={% + \pgfextra{\hobbyusepath{#1}} + }, + use previous Hobby path/.default={},% + save Hobby path/.code={% + \xdef\hobby@path@name{#1}% + }, + restore Hobby path/.code={% + \pgfextra{% + \hobbyinit\hobby@moveto\hobby@curveto\hobby@close + \hobbyrestorepath{#1}} + }, + restore and use Hobby path/.code 2 args={% + \pgfextra{% + \hobbyinit\hobby@moveto\hobby@curveto\hobby@close + \hobbyrestorepath{#1}% + \hobbyusepath{#2}% + } + }, + show Hobby path/.code={% + \pgfextra{\hobbyshowpath{#1}} + }, + Hobby action/.code={% + \expandafter\gdef\expandafter\hobby@action\expandafter{\hobby@action#1}% + }, + Hobby finish/.style={% + Hobby action=\hobby@finish% + }, + Hobby externalise/.is if=hobby@externalise, + Hobby externalize/.is if=hobby@externalise } \newcommand\curvethrough[2][]{% \hobbyinit\hobby@moveto\hobby@curveto\hobby@close \hobbysetparams{#1}% - \hobby@processpts{#2}% -} -\newcommand\hobby@processpts[1]{% - \pgfutil@in@{..}{#1}% - \ifpgfutil@in@% - \hobby@getonepoint #1 \relax - \let\hobby@next=\hobby@processpts - \else - \def\hobby@pt{#1}% - \def\hobby@rest{}% - \let\hobby@next=\hobbygenpath - \fi + \tikzset{designated Hobby path=this}% + \global\let\hobby@this@opts=\pgfutil@empty + \global\let\hobby@next@opts=\pgfutil@empty \let\tikz@scan@point@options=\pgfutil@empty - \expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\hobby@pt\relax + \def\hobby@point@options{}% + \tikz@scan@one@point\hobby@processpt #2 \relax% +} +\newcommand\hobby@processpt[1]{% + #1% \pgfmathsetmacro\hobby@x{\the\pgf@x/1cm}% \pgfmathsetmacro\hobby@y{\the\pgf@y/1cm}% - \expandafter\hobbyaddpoint\expandafter{\tikz@scan@point@options,% + \expandafter\hobbyaddpoint\expandafter{\hobby@point@options,% x = \hobby@x, y = \hobby@y}% - \expandafter\hobby@next\expandafter{\hobby@rest}% -} -\def\hobby@getonepoint#1..#2\relax{% - \def\hobby@pt{#1}% - \def\hobby@rest{#2}% -} + \def\hobby@point@options{}% + \let\tikz@scan@point@options=\pgfutil@empty + \pgfutil@ifnextchar\relax{% + \expandafter\hobbysetparams\expandafter{\hobby@this@opts}% + \ifhobby@externalise + \ifx\hobby@path@name\pgfutil@empty + \hobbygenusepath + \else + \hobbygenuseifnecpath{\hobby@path@name}% + \fi + \else + \hobbygenusepath + \fi + \ifx\hobby@path@name\pgfutil@empty + \else + \hobbysavepath{\hobby@path@name}% + \fi + \global\let\hobby@path@name=\pgfutil@empty + }{% + \pgfutil@ifnextchar.{% + \hobby@swallowdots}{% + \tikz@scan@one@point\hobby@processpt}}} +\def\hobby@swallowdots.{% + \pgfutil@ifnextchar.{% + \hobby@swallowdots}{% + \tikz@scan@one@point\hobby@processpt}} +\def\hobby@curveto@override{% + \hobby@curveto@delegate} \def\hobby@curveto@auto{% - \hobbyinit\pgfutil@gobble\hobby@curveto\hobby@close + \hobbyinit\hobby@moveto\hobby@curveto\hobby@close \pgfmathsetmacro\hobby@x{\the\tikz@lastx/1cm}% \pgfmathsetmacro\hobby@y{\the\tikz@lasty/1cm}% - \pgfutil@ifundefined{tikz@scan@point@options}{% - \hobbyaddpoint{x = \hobby@x, y = \hobby@y}% - }{% - \expandafter\hobbyaddpoint\expandafter{\tikz@scan@point@options,% + \expandafter\hobbysetparams\expandafter{\hobby@next@opts}% + \expandafter\hobbyaddpoint\expandafter{\hobby@point@options,% x = \hobby@x, y = \hobby@y}% - }% + \hobby@init@tikz@commands + \tikzset{designated Hobby path=this}% \let\tikz@scan@point@options=\pgfutil@empty + \global\let\hobby@action=\pgfutil@empty + \global\let\hobby@this@opts=\pgfutil@empty + \global\let\hobby@next@opts=\pgfutil@empty + \global\let\hobby@point@options=\pgfutil@empty \tikz@scan@one@point\hobby@addfromtikz} \def\hobby@addfromtikz#1{% #1% \tikz@make@last@position{#1}% \pgfmathsetmacro\hobby@x{\the\pgf@x/1cm}% \pgfmathsetmacro\hobby@y{\the\pgf@y/1cm}% - \expandafter\hobbyaddpoint\expandafter{\tikz@scan@point@options,% + \expandafter\hobbysetparams\expandafter{\hobby@this@opts}% + \expandafter\hobbyaddpoint\expandafter{\hobby@point@options,% x = \hobby@x, y = \hobby@y}% - \hobby@donext} -\def\hobby@donext{% - \pgfutil@ifnextchar.% - {\hobby@curveto@check}% - {\hobby@finish@auto}}% -\def\hobby@curveto@check..{% - \pgfutil@ifnextchar c% - {\hobby@maybefinish@auto}% - {\hobby@curveto@continue}}% -\def\hobby@maybefinish@auto c{% - \pgfutil@ifnextchar o% - {\hobby@finish@auto .. c}% - {\hobby@closeandfinish@auto}} -\def\hobby@closeandfinish@auto ycle{% - \hobbysetparams{closed=true,disjoint=true}% - \hobby@finish@auto% + \hobby@action + \global\let\hobby@this@opts=\pgfutil@empty + \global\let\hobby@action=\pgfutil@empty + \global\let\hobby@point@options=\pgfutil@empty + \tikz@scan@next@command% +} +\def\hobby@init@tikz@commands{% + \hobby@init@tikz@modcmd\tikz@movetoabs + \hobby@init@tikz@modcmd\tikz@movetorel + \hobby@init@tikz@modcmd\tikz@lineto + \hobby@init@tikz@modcmd\tikz@rect + \hobby@init@tikz@modcmd\tikz@cchar + \hobby@init@tikz@modcmd\tikz@finish + \hobby@init@tikz@modcmd\tikz@arcA + \hobby@init@tikz@modcmd\tikz@e@char + \hobby@init@tikz@modcmd\tikz@g@char + \hobby@init@tikz@modcmd\tikz@schar + \hobby@init@tikz@modcmd\tikz@vh@lineto + \hobby@init@tikz@modcmd\tikz@pchar + \hobby@init@tikz@modcmd\tikz@to + \hobby@init@tikz@modcmd\pgf@stop + \hobby@init@tikz@modcmd\tikz@decoration + \global\let\hobby@curveto@delegate=\hobby@midcurveto@auto +} +\def\hobby@restore@tikz@commands{% + \hobby@restore@tikz@modcmd\tikz@movetoabs + \hobby@restore@tikz@modcmd\tikz@movetorel + \hobby@restore@tikz@modcmd\tikz@lineto + \hobby@restore@tikz@modcmd\tikz@rect + \hobby@restore@tikz@modcmd\tikz@cchar + \hobby@restore@tikz@modcmd\tikz@finish + \hobby@restore@tikz@modcmd\tikz@arcA + \hobby@restore@tikz@modcmd\tikz@e@char + \hobby@restore@tikz@modcmd\tikz@g@char + \hobby@restore@tikz@modcmd\tikz@schar + \hobby@restore@tikz@modcmd\tikz@vh@lineto + \hobby@restore@tikz@modcmd\tikz@pchar + \hobby@restore@tikz@modcmd\tikz@to + \hobby@restore@tikz@modcmd\pgf@stop + \hobby@restore@tikz@modcmd\tikz@decoration + \global\let\hobby@curveto@delegate=\hobby@curveto@auto } -\def\hobby@curveto@continue{% +\def\hobby@init@tikz@modcmd#1{% + \expandafter\global\expandafter\let\csname hobby@orig@\string#1\endcsname=#1% + \gdef#1{\hobby@finish#1}% +} +\def\hobby@restore@tikz@modcmd#1{% + \expandafter\global\expandafter\let\expandafter#1\csname hobby@orig@\string#1\endcsname% +} +\def\hobby@midcurveto@auto{% \let\tikz@scan@point@options=\pgfutil@empty - \tikz@scan@one@point\hobby@addfromtikz} -\def\hobby@finish@auto{% - \hobbygenpath - \tikz@scan@next@command% + \global\let\hobby@action=\pgfutil@empty + \global\let\hobby@this@opts=\pgfutil@empty + \global\let\hobby@point@options=\pgfutil@empty + \tikz@scan@one@point\hobby@addfromtikz% +} +\def\hobby@finish{% + \ifhobby@externalise + \ifx\hobby@path@name\pgfutil@empty + \hobbygenusepath + \else + \hobbygenuseifnecpath{\hobby@path@name}% + \fi + \else + \hobbygenusepath + \fi + \ifx\hobby@path@name\pgfutil@empty + \else + \hobbysavepath{\hobby@path@name}% + \fi + \global\let\hobby@path@name=\pgfutil@empty + \hobby@restore@tikz@commands } \tikzset{ quick curve through/.style={% to path={% \pgfextra{% + \let\hobby@next@qbreak=\relax + \let\hobby@next@qblank=\relax \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)% + \tikz@make@last@position{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% \edef\hobby@qpoints{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% \def\hobby@qpointa{}% \def\hobby@quick@path{}% \def\hobby@angle{}% + \let\hobby@quick@curveto=\hobby@quick@makepath \tikz@scan@one@point\hobby@quickfirst #1 (\tikztotarget)\relax } \hobby@quick@path } - } + }, + quick hobby/blank curve/.is choice, + quick hobby/blank curve/true/.code={% + \gdef\hobby@next@qblank{% + \qhobby@blanktrue + \global\let\hobby@next@qblank=\relax + }% + }, + quick hobby/blank curve/false/.code={% + \gdef\hobby@next@qblank{% + \qhobby@blankfalse + \global\let\hobby@next@qblank=\relax + }% + }, + quick hobby/blank curve/once/.code={% + \gdef\hobby@next@qblank{% + \qhobby@blanktrue + \gdef\hobby@next@qblank{% + \qhobby@blankfalse + \global\let\hobby@next@qblank=\relax + }% + }% + }, + quick hobby/blank curve/.default=true, + quick hobby/break curve/.is choice, + quick hobby/break curve/true/.code={% + \gdef\hobby@next@qbreak{% + \qhobby@breaktrue + \global\let\hobby@next@qbreak=\relax + }% + }, + quick hobby/break curve/false/.code={% + \gdef\hobby@next@qbreak{% + \qhobby@breakfalse + \global\let\hobby@next@qbreak=\relax + }% + }, + quick hobby/break curve/once/.code={% + \gdef\hobby@next@qbreak{% + \qhobby@breaktrue + \gdef\hobby@next@qbreak{% + \qhobby@breakfalse + \global\let\hobby@next@qbreak=\relax + }% + }% + }, + quick hobby/break curve/.default=true, } -\pgfmathsetmacro\hobby@sf{10cm} +\newif\ifqhobby@break +\newif\ifqhobby@blank +\tikzoption{hobby}[]{\let\tikz@plot@handler=\pgfplothandlerhobby} +\tikzoption{quick hobby}[]{\let\tikz@plot@handler=\pgfplothandlerquickhobby} +\tikzoption{closed hobby}[]{\let\tikz@plot@handler=\pgfplothandlerclosedhobby} \def\hobby@quickfirst#1{% #1% - \edef\hobby@qpointa{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \xdef\hobby@qpointa{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \tikz@make@last@position{\hobby@qpointa}% \pgfutil@ifnextchar\relax{% - \edef\hobby@quick@path{ -- (\the\pgf@x,\the\pgf@y)}% + \xdef\hobby@quick@path{ -- (\the\pgf@x,\the\pgf@y)}% }{% + \pgfutil@ifnextchar.{% + \hobby@qswallowdots}{% + \tikz@scan@one@point\hobby@quick}}} +\def\hobby@qswallowdots.{% + \pgfutil@ifnextchar.{% + \hobby@qswallowdots}{% \tikz@scan@one@point\hobby@quick}} \def\hobby@quick#1{% + \hobby@quick@compute{#1}% + \tikz@make@last@position{\hobby@qpointa}% + \pgfutil@ifnextchar\relax{% + \hobby@quick@computeend% + }{% + \pgfutil@ifnextchar.{% + \hobby@qswallowdots}{% + \tikz@scan@one@point\hobby@quick}}} +\def\hobby@quick@makepath#1#2#3{% #1% - \pgf@xb=\pgf@x - \pgf@yb=\pgf@y - \hobby@qpointa - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \advance\pgf@xb by -\pgf@xa - \advance\pgf@yb by -\pgf@ya - \pgfmathsetmacro\hobby@done{sqrt((\pgf@xb/\hobby@sf)^2 + (\pgf@yb/\hobby@sf)^2)}% - \pgfmathsetmacro\hobby@omegaone{rad(atan2(\pgf@xb,\pgf@yb))}% - \hobby@qpoints - \advance\pgf@xa by -\pgf@x - \advance\pgf@ya by -\pgf@y - \pgfmathsetmacro\hobby@dzero{sqrt((\pgf@xa/\hobby@sf)^2 + (\pgf@ya/\hobby@sf)^2)}% - \pgfmathsetmacro\hobby@omegazero{rad(atan2(\pgf@xa,\pgf@ya))}% - \pgfmathsetmacro\hobby@psi{\hobby@omegaone - \hobby@omegazero}% - \pgfmathsetmacro\hobby@psi{\hobby@psi > pi ? \hobby@psi - 2*pi : \hobby@psi}% - \pgfmathsetmacro\hobby@psi{\hobby@psi < -pi ? \hobby@psi + 2*pi : \hobby@psi}% - \ifx\hobby@angle\pgfutil@empty - \pgfmathsetmacro\hobby@thetaone{-\hobby@psi * \hobby@done% -/(\hobby@done + \hobby@dzero)}% - \pgfmathsetmacro\hobby@thetazero{-\hobby@psi - \hobby@thetaone}% - \let\hobby@phione=\hobby@thetazero - \let\hobby@phitwo=\hobby@thetaone + \pgf@xa=\pgf@x\relax + \pgf@ya=\pgf@y\relax + #2% + \pgf@xb=\pgf@x\relax + \pgf@yb=\pgf@y\relax + #3% + \ifqhobby@blank + \xdef\hobby@quick@path{\hobby@quick@path (\the\pgf@x,\the\pgf@y)}% \else - \let\hobby@thetazero=\hobby@angle - \pgfmathsetmacro\hobby@thetaone{% - -(2 * \hobby@psi + \hobby@thetazero) * \hobby@done% - / (2 * \hobby@done + \hobby@dzero)}% - \pgfmathsetmacro\hobby@phione{-\hobby@psi - \hobby@thetaone}% - \let\hobby@phitwo=\hobby@thetaone - \fi - \let\hobby@angle=\hobby@thetaone - \pgfmathsetmacro\hobby@alpha{% - sqrt(2) * (sin(\hobby@thetazero r) - 1/16 * sin(\hobby@phione r))% -* (sin(\hobby@phione r) - 1/16 * sin(\hobby@thetazero r))% - * (cos(\hobby@thetazero r) - cos(\hobby@phione r))}% - \pgfmathsetmacro\hobby@rho{% - (2 + \hobby@alpha)/(1 + (1 - (3 - sqrt(5))/2)% - * cos(\hobby@thetazero r) + (3 - sqrt(5))/2 * cos(\hobby@phione r))}% - \pgfmathsetmacro\hobby@sigma{% - (2 - \hobby@alpha)/(1 + (1 - (3 - sqrt(5))/2)% - * cos(\hobby@phione r) + (3 - sqrt(5))/2 * cos(\hobby@thetazero r))}% - \hobby@qpoints - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfmathsetlength\pgf@xa{% - \pgf@xa + \hobby@dzero * \hobby@rho% - * cos((\hobby@thetazero + \hobby@omegazero) r)/3*\hobby@sf}% - \pgfmathsetlength\pgf@ya{% - \pgf@ya + \hobby@dzero * \hobby@rho% - * sin((\hobby@thetazero + \hobby@omegazero) r)/3*\hobby@sf}% - \hobby@qpointa - \pgf@xb=\pgf@x - \pgf@yb=\pgf@y - \pgfmathsetlength\pgf@xb{% - \pgf@xb - \hobby@dzero * \hobby@sigma% - * cos((-\hobby@phione + \hobby@omegazero) r)/3*\hobby@sf}% - \pgfmathsetlength\pgf@yb{% - \pgf@yb - \hobby@dzero * \hobby@sigma% - * sin((-\hobby@phione + \hobby@omegazero) r)/3*\hobby@sf}% - \hobby@qpointa - \edef\hobby@quick@path{\hobby@quick@path .. controls% + \xdef\hobby@quick@path{\hobby@quick@path .. controls% (\the\pgf@xa,\the\pgf@ya) and (\the\pgf@xb,\the\pgf@yb) .. (\the\pgf@x,\the\pgf@y) }% - \let\hobby@qpoints=\hobby@qpointa - #1 - \edef\hobby@qpointa{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfutil@ifnextchar\relax{% - \pgfmathsetmacro\hobby@alpha{% - sqrt(2) * (sin(\hobby@thetaone r) - 1/16 * sin(\hobby@phitwo r))% - * (sin(\hobby@phitwo r) - 1/16 * sin(\hobby@thetaone r))% - * (cos(\hobby@thetaone r) - cos(\hobby@phitwo r))}% - \pgfmathsetmacro\hobby@rho{% - (2 + \hobby@alpha)/(1 + (1 - (3 - sqrt(5))/2)% - * cos(\hobby@thetaone r) + (3 - sqrt(5))/2 * cos(\hobby@phitwo r))}% - \pgfmathsetmacro\hobby@sigma{% - (2 - \hobby@alpha)/(1 + (1 - (3 - sqrt(5))/2)% - * cos(\hobby@phitwo r) + (3 - sqrt(5))/2 * cos(\hobby@thetaone r))}% - \hobby@qpoints - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfmathsetlength\pgf@xa{% - \pgf@xa + \hobby@done * \hobby@rho% - * cos((\hobby@thetaone + \hobby@omegaone) r)/3*\hobby@sf}% - \pgfmathsetlength\pgf@ya{% - \pgf@ya + \hobby@done * \hobby@rho% - * sin((\hobby@thetaone + \hobby@omegaone) r)/3*\hobby@sf}% - \hobby@qpointa - \pgf@xb=\pgf@x - \pgf@yb=\pgf@y - \pgfmathsetlength\pgf@xb{% - \pgf@xb - \hobby@done * \hobby@sigma% - * cos((-\hobby@phitwo + \hobby@omegaone) r)/3*\hobby@sf}% - \pgfmathsetlength\pgf@yb{% - \pgf@yb - \hobby@done * \hobby@sigma% - * sin((-\hobby@phitwo + \hobby@omegaone) r)/3*\hobby@sf}% - \hobby@qpointa - \edef\hobby@quick@path{\hobby@quick@path .. controls% - (\the\pgf@xa,\the\pgf@ya) and (\the\pgf@xb,\the\pgf@yb) .. (\the\pgf@x,\the\pgf@y) }% -}{% -\tikz@scan@one@point\hobby@quick}} + \fi + \ifqhobby@break + \xdef\hobby@quick@path{\hobby@quick@path +(0,0)}% + \fi + \hobby@next@qbreak + \hobby@next@qblank +} +\def\hobby@qcurveto@auto{% + \global\let\hobby@next@qbreak=\relax + \global\let\hobby@next@qblank=\relax + \xdef\hobby@qpoints{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \gdef\hobby@qpointa{}% + \gdef\hobby@quick@path{}% + \gdef\hobby@angle{}% + \global\let\hobby@quick@curveto=\hobby@quick@makepathauto + \hobby@qinit@tikz@commands + \let\tikz@scan@point@options=\pgfutil@empty + \global\let\hobby@action=\pgfutil@empty + \global\let\hobby@point@options=\pgfutil@empty + \tikz@scan@one@point\hobby@qfirst@auto} +\def\hobby@qmidcurveto@auto{% + \let\tikz@scan@point@options=\pgfutil@empty + \global\let\hobby@action=\pgfutil@empty + \global\let\hobby@point@options=\pgfutil@empty + \tikz@scan@one@point\hobby@qaddfromtikz} +\def\hobby@qfirst@auto#1{% + #1% + \xdef\hobby@qpointa{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \tikz@make@last@position{\hobby@qpointa}% + \tikz@scan@next@command% +} +\def\hobby@quick@makepathauto#1#2#3{% + #1% + \pgf@xa=\pgf@x\relax + \pgf@ya=\pgf@y\relax + #2% + \pgf@xb=\pgf@x\relax + \pgf@yb=\pgf@y\relax + #3% + \ifqhobby@blank + \edef\hobby@temp{% + \noexpand\pgfpathmoveto{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + }% + \hobby@temp + \else + \edef\hobby@temp{% + \noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + }% + \hobby@temp + \fi + \ifqhobby@break + #3% + \edef\hobby@temp{% + \noexpand\pgfpathmoveto{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + }% + \hobby@temp + \fi + \hobby@next@qbreak + \hobby@next@qblank +} +\def\hobby@qaddfromtikz#1{% + \hobby@quick@compute{#1}% + \tikz@make@last@position{\hobby@qpointa}% + \tikz@scan@next@command% +} +\def\hobby@qinit@tikz@commands{% + \hobby@qinit@tikz@modcmd\tikz@movetoabs + \hobby@qinit@tikz@modcmd\tikz@movetorel + \hobby@qinit@tikz@modcmd\tikz@lineto + \hobby@qinit@tikz@modcmd\tikz@rect + \hobby@qinit@tikz@modcmd\tikz@cchar + \hobby@qinit@tikz@modcmd\tikz@finish + \hobby@qinit@tikz@modcmd\tikz@arcA + \hobby@qinit@tikz@modcmd\tikz@e@char + \hobby@qinit@tikz@modcmd\tikz@g@char + \hobby@qinit@tikz@modcmd\tikz@schar + \hobby@qinit@tikz@modcmd\tikz@vh@lineto + \hobby@qinit@tikz@modcmd\tikz@pchar + \hobby@qinit@tikz@modcmd\tikz@to + \hobby@qinit@tikz@modcmd\pgf@stop + \hobby@qinit@tikz@modcmd\tikz@decoration + \global\let\hobby@curveto@delegate=\hobby@qmidcurveto@auto +} +\def\hobby@qrestore@tikz@commands{% + \hobby@restore@tikz@modcmd\tikz@movetoabs + \hobby@restore@tikz@modcmd\tikz@movetorel + \hobby@restore@tikz@modcmd\tikz@lineto + \hobby@restore@tikz@modcmd\tikz@rect + \hobby@restore@tikz@modcmd\tikz@cchar + \hobby@restore@tikz@modcmd\tikz@finish + \hobby@restore@tikz@modcmd\tikz@arcA + \hobby@restore@tikz@modcmd\tikz@e@char + \hobby@restore@tikz@modcmd\tikz@g@char + \hobby@restore@tikz@modcmd\tikz@schar + \hobby@restore@tikz@modcmd\tikz@vh@lineto + \hobby@restore@tikz@modcmd\tikz@pchar + \hobby@restore@tikz@modcmd\tikz@to + \hobby@restore@tikz@modcmd\pgf@stop + \hobby@restore@tikz@modcmd\tikz@decoration + \hobby@restore@tikz@modcmd\tikz@@close + \global\let\hobby@curveto@delegate=\hobby@qcurveto@auto +} +\def\hobby@qinit@tikz@modcmd#1{% + \expandafter\global\expandafter\let\csname hobby@orig@\string#1\endcsname=#1% + \gdef#1{\hobby@qfinish#1}% +} +\def\hobby@qfinish{% + \hobby@quick@computeend + \hobby@qrestore@tikz@commands +} + %% %% Copyright (C) 2012 by Andrew Stacey <stacey@math.ntnu.no> %% |