summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex93
1 files changed, 88 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex b/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex
index a3fa361d216..ced64271e8b 100644
--- a/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex
+++ b/Master/texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex
@@ -116,12 +116,14 @@
},
restore Hobby path/.code={%
\pgfextra{%
- \hobbyinit\hobby@moveto\hobby@curveto\hobby@close
+ \hobbyinit\hobby@tikz@moveto\hobby@tikz@curveto\hobby@tikz@close
+ \global\let\hobby@collected@onpath\pgfutil@empty
\hobbyrestorepath{#1}}
},
restore and use Hobby path/.code 2 args={%
\pgfextra{%
- \hobbyinit\hobby@moveto\hobby@curveto\hobby@close
+ \hobbyinit\hobby@tikz@moveto\hobby@tikz@curveto\hobby@tikz@close
+ \global\let\hobby@collected@onpath\pgfutil@empty
\hobbyrestorepath{#1}%
\hobbyusepath{#2}%
}
@@ -138,8 +140,79 @@
Hobby externalise/.is if=hobby@externalise,
Hobby externalize/.is if=hobby@externalise
}
+\def\hobby@tikz@curveto#1#2#3{%
+ \pgfutil@ifundefined{tikz@timer@start}{%
+ \expandafter\hobby@topgf\expandafter{\hobby@initial@pt}%
+ \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ }{}%
+ \hobby@topgf{#1}%
+ \edef\tikz@timer@cont@one{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \hobby@topgf{#2}%
+ \edef\tikz@timer@cont@two{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \hobby@topgf{#3}%
+ \let\tikz@timer=\tikz@timer@curve
+ \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \ifx\hobby@collected@onpath\pgfutil@empty
+ \else
+ \expandafter\hobby@nodes@onpath\hobby@collected@onpath\relax\relax
+ \fi
+ \pgfpathcurveto{\hobby@topgf{#1}}{\hobby@topgf{#2}}{\hobby@topgf{#3}}%
+ \hobby@topgf{#3}%
+ \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+}
+\def\hobby@tikz@moveto#1#2#3{%
+ \pgfutil@ifundefined{tikz@timer@start}{%
+ \expandafter\hobby@topgf\expandafter{\hobby@initial@pt}%
+ \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ }{}%
+ \hobby@topgf{#3}%
+ \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfutil@empty
+ \let\tikz@timer=\tikz@timer@line
+ \else
+ \hobby@topgf{#1}%
+ \edef\tikz@timer@cont@one{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \hobby@topgf{#2}%
+ \edef\tikz@timer@cont@two{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \let\tikz@timer=\tikz@timer@curve
+ \fi
+ \ifx\hobby@collected@onpath\pgfutil@empty
+ \else
+ \expandafter\hobby@nodes@onpath\hobby@collected@onpath\relax\relax
+ \fi
+ \pgfpathmoveto{\hobby@topgf{#3}}%
+ \hobby@topgf{#3}%
+ \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+}
+\def\hobby@tikz@close#1{%
+ \hobby@topgf{#1}%
+ \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \let\tikz@timer=\tikz@timer@line
+ \ifx\hobby@collected@onpath\pgfutil@empty
+ \else
+ \expandafter\hobby@nodes@onpath\hobby@collected@onpath\relax\relax
+ \fi
+ \pgfpathclose
+}
+\def\hobby@nodes@onpath#1#2\relax{%
+ \gdef\hobby@collected@onpath{#2}%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfutil@empty
+ \else
+ \def\@gtempa{\relax}
+ \ifx\pgf@temp\@gtempa
+ \else
+ \tikz@node@is@a@labeltrue
+ \tikz@scan@next@command#1\pgf@stop
+ \tikz@node@is@a@labelfalse
+ \fi
+ \fi
+}
\newcommand\curvethrough[2][]{%
- \hobbyinit\hobby@moveto\hobby@curveto\hobby@close
+ \hobbyinit\hobby@tikz@moveto\hobby@tikz@curveto\hobby@tikz@close
+ \global\let\hobby@collected@onpath\pgfutil@empty
+ \let\hobby@initial@pt\pgfutil@empty
\hobbysetparams{#1}%
\tikzset{designated Hobby path=this}%
\global\let\hobby@this@opts=\pgfutil@empty
@@ -152,6 +225,9 @@
#1%
\pgfmathsetmacro\hobby@x{\the\pgf@x/1cm}%
\pgfmathsetmacro\hobby@y{\the\pgf@y/1cm}%
+ \ifx\hobby@initial@pt\pgfutil@empty
+ \xdef\hobby@initial@pt{x = \hobby@x, y = \hobby@y}%
+ \fi
\expandafter\hobbyaddpoint\expandafter{\hobby@point@options,%
x = \hobby@x, y = \hobby@y}%
\def\hobby@point@options{}%
@@ -183,9 +259,12 @@
\def\hobby@curveto@override{%
\hobby@curveto@delegate}
\def\hobby@curveto@auto{%
- \hobbyinit\hobby@moveto\hobby@curveto\hobby@close
+ \hobbyinit\hobby@tikz@moveto\hobby@tikz@curveto\hobby@tikz@close
+ \expandafter\gdef\expandafter\hobby@collected@onpath\expandafter{\expandafter{\tikz@collected@onpath} }%
+ \let\tikz@collected@onpath=\pgfutil@empty
\pgfmathsetmacro\hobby@x{\the\tikz@lastx/1cm}%
\pgfmathsetmacro\hobby@y{\the\tikz@lasty/1cm}%
+ \xdef\hobby@initial@pt{x = \hobby@x, y = \hobby@y}%
\expandafter\hobbysetparams\expandafter{\hobby@next@opts}%
\expandafter\hobbyaddpoint\expandafter{\hobby@point@options,%
x = \hobby@x, y = \hobby@y}%
@@ -196,7 +275,8 @@
\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}
+ \tikz@scan@one@point\hobby@addfromtikz%
+}
\def\hobby@addfromtikz#1{%
#1%
\tikz@make@last@position{#1}%
@@ -255,6 +335,8 @@
\expandafter\global\expandafter\let\expandafter#1\csname hobby@orig@\string#1\endcsname%
}
\def\hobby@midcurveto@auto{%
+ \expandafter\expandafter\expandafter\gdef\expandafter\expandafter\expandafter\hobby@collected@onpath\expandafter\expandafter\expandafter{\expandafter\hobby@collected@onpath\expandafter{\tikz@collected@onpath} }%
+ \let\tikz@collected@onpath=\pgfutil@empty
\let\tikz@scan@point@options=\pgfutil@empty
\global\let\hobby@action=\pgfutil@empty
\global\let\hobby@this@opts=\pgfutil@empty
@@ -467,6 +549,7 @@
\hobby@qinit@tikz@modcmd\tikz@to
\hobby@qinit@tikz@modcmd\pgf@stop
\hobby@qinit@tikz@modcmd\tikz@decoration
+ \hobby@qinit@tikz@modcmd\tikz@@close
\global\let\hobby@curveto@delegate=\hobby@qmidcurveto@auto
}
\def\hobby@qrestore@tikz@commands{%