summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex19
1 files changed, 15 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex b/Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex
index 5d0f4a91996..37d6a70a6ed 100644
--- a/Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex
+++ b/Master/texmf-dist/tex/latex/hobby/pgflibraryhobby.code.tex
@@ -20,11 +20,22 @@
x/.code={\pgf@x=#1cm},
y/.code={\pgf@y=#1cm}
}
+\pgfmathparse{atan2(0,1)}
+\def\hobby@temp{0.0}
+\ifx\pgfmathresult\hobby@temp
+ \pgfmathdeclarefunction{hobbyatan2}{2}{%
+ \pgfmathatantwo@{#1}{#2}%
+ }
+\else
+ \pgfmathdeclarefunction{hobbyatan2}{2}{%
+ \pgfmathatantwo@{#2}{#1}%
+ }
+\fi
\def\hobby@curveto#1#2#3{%
\pgfpathcurveto{\hobby@topgf{#1}}{\hobby@topgf{#2}}{\hobby@topgf{#3}}%
}
-\def\hobby@moveto#1{%
- \pgfpathmoveto{\hobby@topgf{#1}}%
+\def\hobby@moveto#1#2#3{%
+ \pgfpathmoveto{\hobby@topgf{#3}}%
}
\def\hobby@topgf#1{%
\pgfqkeys{/pgf/hobby}{#1}%
@@ -137,12 +148,12 @@
\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))}%
+ \pgfmathsetmacro\hobby@omegaone{rad(hobbyatan2(\pgf@yb,\pgf@xb))}%
\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@omegazero{rad(hobbyatan2(\pgf@ya,\pgf@xa))}%
\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}%