diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-30 21:26:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-30 21:26:00 +0000 |
commit | dbca2cc7b2da8f2a0391ea92f04ee49e3f5aa7dd (patch) | |
tree | a774e64047cc130341c77bbf7885a0f9c80d51f7 /Master/texmf-dist/tex/latex/curve2e/curve2e.sty | |
parent | 287c4ade701dca1447f7de6ecf5b7ef216b7a794 (diff) |
curve2e (30mar19)
git-svn-id: svn://tug.org/texlive/trunk@50663 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/curve2e/curve2e.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/curve2e/curve2e.sty | 466 |
1 files changed, 143 insertions, 323 deletions
diff --git a/Master/texmf-dist/tex/latex/curve2e/curve2e.sty b/Master/texmf-dist/tex/latex/curve2e/curve2e.sty index 0224f13d05a..3edfbecf539 100644 --- a/Master/texmf-dist/tex/latex/curve2e/curve2e.sty +++ b/Master/texmf-dist/tex/latex/curve2e/curve2e.sty @@ -11,12 +11,30 @@ %% \NeedsTeXFormat{LaTeX2e}[2016/01/01] \ProvidesPackage{curve2e}% - [2019/02/07 v.1.61 Extension package for pict2e] + [2019-03-29 v.2.0.1 Extension package for pict2e] -\RequirePackage{color} -\RequirePackageWithOptions{pict2e}[2014/01/01] -\RequirePackage{xparse} + +\IfFileExists{xfp.sty}{% + \RequirePackage{color} + \RequirePackageWithOptions{pict2e}[2014/01/01] + \@ifl@aded{sty}{xparse}{}{\RequirePackage{xparse}} + \@ifl@aded{sty}{xfp}{}{\RequirePackage{xfp}}% +}{% + \RequirePackage{curve2e-v161}% + \PackageWarningNoLine{curve2e}{% + Package xfp is required, but apparently\MessageBreak% + such package cannot be found in this \MessageBreak% + TeX system installation\MessageBreak% + Either your installation is not complete \MessageBreak% + or it is older than 2018-10-17.\MessageBreak% + \MessageBreak% + ***************************************\MessageBreak% + Version 1.61 of curve2e has been loaded\MessageBreak% + instead of the current version\MessageBreak% + ***************************************\MessageBreak}% + \endinput +} \def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}% \def\TROF{\tracingcommands\z@ \tracingmacros\z@}% \ifx\undefined\@tdA \newdimen\@tdA \fi @@ -26,14 +44,15 @@ \ifx\undefined\@tdE \newdimen\@tdE \fi \ifx\undefined\@tdF \newdimen\@tdF \fi \ifx\undefined\defaultlinewidth \newdimen\defaultlinewidth \fi -\gdef\linethickness#1{\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}% +\gdef\linethickness#1{% +\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}% \newcommand\defaultlinethickness[1]{\defaultlinewidth=#1\relax \def\thicklines{\linethickness{\defaultlinewidth}}% -\def\thinlines{\linethickness{.5\defaultlinewidth}}% -\thinlines\ignorespaces} +\def\thinlines{\linethickness{.5\defaultlinewidth}}\thinlines \ignorespaces}% \def\LIne(#1){{\GetCoord(#1)\@tX\@tY - \moveto(0,0) - \pIIe@lineto{\@tX\unitlength}{\@tY\unitlength}\strokepath}\ignorespaces}% + \moveto(0,0) + \pIIe@lineto{\@tX\unitlength}{\@tY\unitlength}\strokepath}\ignorespaces +}% \def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}% \def\line(#1)#2{\begingroup \@linelen #2\unitlength @@ -41,7 +60,7 @@ \expandafter\DirOfVect#1to\Dir@line \GetCoord(\Dir@line)\d@mX\d@mY \ifdim\d@mX\p@=\z@\else - \DividE\ifdim\d@mX\p@<\z@-\fi\p@ by\d@mX\p@ to\sc@lelen + \edef\sc@lelen{\fpeval{1 / abs(\d@mX)}}\relax \@linelen=\sc@lelen\@linelen \fi \moveto(0,0) @@ -50,62 +69,62 @@ \fi \endgroup\ignorespaces}% \ifx\Dashline\undefined -\def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}} -\def\Dashline@(#1)(#2)#3{% -\bgroup - \countdef\NumA3254\countdef\NumB3252\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DlineMod - \DivideFN\DlineMod by#3 to\NumD - \NumA\expandafter\Integer\NumD.?? - \ifodd\NumA\else\advance\NumA\@ne\fi - \NumB=\NumA \divide\NumB\tw@ - \DividE\DlineMod\p@ by\NumA\p@ to\D@shMod - \DividE\p@ by\NumA\p@ to \@tempa - \MultVect\V@ttC by\@tempa,0 to\V@ttB - \MultVect\V@ttB by 2,0 to\V@ttC - \advance\NumB\@ne - \edef\@mpt{\noexpand\egroup - \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}% - {\noexpand\LIne(\V@ttB)}}% - \@mpt\ignorespaces}% -\let\Dline\Dashline + \def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}} + + \def\Dashline@(#1)(#2)#3{% + \bgroup + \countdef\NumA3254\countdef\NumB3252\relax + \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA + \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB + \SubVect\V@ttA from\V@ttB to\V@ttC + \ModOfVect\V@ttC to\DlineMod + \DivideFN\DlineMod by#3 to\NumD + \NumA=\fpeval{trunc(\NumD,0)}\relax + \unless\ifodd\NumA\advance\NumA\@ne\fi + \NumB=\NumA \divide\NumB\tw@ + \DividE\DlineMod\p@ by\NumA\p@ to\D@shMod + \DividE\p@ by\NumA\p@ to \@tempa + \MultVect\V@ttC by\@tempa,0 to\V@ttB + \MultVect\V@ttB by 2,0 to\V@ttC + \advance\NumB\@ne + \edef\@mpt{\noexpand\egroup + \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}% + {\noexpand\LIne(\V@ttB)}}% + \@mpt\ignorespaces}% + \let\Dline\Dashline -\def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}} + \def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}} \fi \ifx\Dotline\undefined -\def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}} -\def\Dotline@(#1)(#2)#3{% -\bgroup - \countdef\NumA 3254\relax \countdef\NumB 3255\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DotlineMod - \DivideFN\DotlineMod by#3 to\NumD - \NumA=\expandafter\Integer\NumD.?? - \DivVect\V@ttC by\NumA,0 to\V@ttB - \advance\NumA\@ne - \edef\@mpt{\noexpand\egroup - \noexpand\multiput(\V@ttA)(\V@ttB){\number\NumA}% - {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}% - \@mpt\ignorespaces}% + \def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}} + \def\Dotline@(#1)(#2)#3{% + \bgroup + \countdef\NumA 3254\relax \countdef\NumB 3255\relax + \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA + \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB + \SubVect\V@ttA from\V@ttB to\V@ttC + \ModOfVect\V@ttC to\DotlineMod + \DivideFN\DotlineMod by#3 to\NumD + \NumA=\fpeval{trunc(\NumD,0)}\relax + \DivVect\V@ttC by\NumA,0 to\V@ttB + \advance\NumA\@ne + \edef\@mpt{\noexpand\egroup + \noexpand\multiput(\V@ttA)(\V@ttB){\number\NumA}% + {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}% + \@mpt\ignorespaces}% -\def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}} + \def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}}% \fi \AtBeginDocument{\@ifpackageloaded{eso-pic}{% -\renewcommand\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}}{}} - +\renewcommand\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}}{}}% \def\GetCoord(#1)#2#3{% \expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces} +\def\SplitNod@(#1)#2#3{\isnot@polar#1:!!(#1)#2#3}% \def\isnot@polar#1:#2!!{\def\@tempOne{#2}\ifx\@tempOne\empty \expandafter\@firstoftwo\else \expandafter\@secondoftwo\fi {\SplitNod@@}{\SplitPolar@@}} -\def\SplitNod@(#1)#2#3{\isnot@polar#1:!!(#1)#2#3}% \def\SplitNod@@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}% \def\SplitPolar@@(#1:#2)#3#4{\DirFromAngle#1to\@DirA \ScaleVect\@DirA by#2to\@DirA @@ -137,7 +156,7 @@ \ifdim\d@mX\p@=\z@ \else\ifdim\d@mY\p@=\z@ \else - \DividE\ifdim\@xnum\p@<\z@-\fi\p@ by\@xnum\p@ to\sc@lelen + \edef\sc@lelen{\fpeval{1 / abs(\@xnum)}}\relax \@linelen=\sc@lelen\@linelen \fi \fi @@ -157,13 +176,19 @@ \endgroup} \def\Vector(#1){{% \GetCoord(#1)\@tX\@tY -\ifdim\@tX\p@=\z@\vector(\@tX,\@tY){\@tY} +\ifdim\@tX\p@=\z@ + \vector(\@tX,\@tY){\@tY}% \else -\vector(\@tX,\@tY){\@tX}\fi}} + \vector(\@tX,\@tY){\@tX}% +\fi}} \def\VECTOR(#1)(#2){\begingroup \SubVect#1from#2to\@tempa \expandafter\put\expandafter(#1){\expandafter\Vector\expandafter(\@tempa)}% \endgroup\ignorespaces} +\def\VVECTOR(#1)(#2){{\SubVect#1from#2to\@tempb +\ScaleVect\@tempb by0.5to\@tempb +\AddVect\@tempb and#1to\@tempb +\VECTOR(\@tempb)(#2)\VECTOR(\@tempb)(#1)\ignorespaces}} \let\lp@r( \let\rp@r) \renewcommand*\polyline[1][\beveljoin]{\p@lylin@[#1]} @@ -197,6 +222,7 @@ \if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi \endgroup \ignorespaces}} + \def\GraphGrid(#1,#2){\bgroup\textcolor{red}{\linethickness{.1\p@}% \RoundUp#1modulo10to\@GridWd \RoundUp#2modulo10to\@GridHt \@tempcnta=\@GridWd \divide\@tempcnta10\relax \advance\@tempcnta\@ne @@ -211,234 +237,65 @@ \ifnum\count252>0\advance\count252-#2\relax \advance\@tempcnta-\count252\fi\edef#3{\number\@tempcnta}\ignorespaces}% \def\Integer#1.#2??{#1}% -\ifdefined\dimexpr - \unless\ifdefined\DividE -\def\DividE#1by#2to#3{\bgroup -\dimendef\Num2254\relax \dimendef\Den2252\relax -\dimendef\@DimA 2250 -\Num=\p@ \Den=#2\relax -\ifdim\Den=\z@ - \edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\maxdimen}}% -\else - \@DimA=#1\relax - \edef\x{% - \noexpand\egroup\noexpand\def\noexpand#3{% - \strip@pt\dimexpr\@DimA*\Num/\Den\relax}}% -\fi -\x\ignorespaces}% -\fi - \unless\ifdefined\DivideFN - \def\DivideFN#1by#2to#3{\DividE#1\p@ by#2\p@ to{#3}}% - \fi - \unless\ifdefined\MultiplY - \def\MultiplY#1by#2to#3{\bgroup - \dimendef\@DimA 2254 \dimendef\@DimB2255 - \@DimA=#1\p@\relax \@DimB=#2\p@\relax - \edef\x{% - \noexpand\egroup\noexpand\def\noexpand#3{% - \strip@pt\dimexpr\@DimA*\@DimB/\p@\relax}}% - \x\ignorespaces}% - \let\MultiplyFN\MultiplY - \fi -\fi +\def\DividE#1by#2to#3{% + \edef#3{\fpeval{#1 / #2}}\relax +} +\let\DivideFN\DividE +\def\MultiplY#1by#2to#3{\edef#3{\fpeval{#1 * #2}}}\relax +\let\MultiplyFN\MultiplY \unless\ifdefined\Numero \def\Numero#1#2{\bgroup\dimen3254=#2\relax \edef\x{\noexpand\egroup\noexpand\edef\noexpand#1{% \strip@pt\dimen3254}}\x\ignorespaces}% \fi -\def\g@tTanCotanFrom#1to#2and#3{% -\DividE 114.591559\p@ by#1to\X@ \@tdB=\X@\p@ -\countdef\I=2546\def\Tan{0}\I=11\relax -\@whilenum\I>\z@\do{% - \@tdC=\Tan\p@ \@tdD=\I\@tdB - \advance\@tdD-\@tdC \DividE\p@ by\@tdD to\Tan - \advance\I-2\relax}% -\def#2{\Tan}\DividE\p@ by\Tan\p@ to\Cot \def#3{\Cot}\ignorespaces}% -\def\SinOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>\z@% - \@whiledim\@tdA>180\p@\do{\advance\@tdA -360\p@}% -\else% - \@whiledim\@tdA<-180\p@\do{\advance\@tdA 360\p@}% -\fi \ifdim\@tdA=\z@ - \def\@tempA{0}% -\else - \ifdim\@tdA>\z@ - \def\Segno{+}% - \else - \def\Segno{-}% - \@tdA=-\@tdA - \fi - \ifdim\@tdA>90\p@ - \@tdA=-\@tdA \advance\@tdA 180\p@ - \fi - \ifdim\@tdA=90\p@ - \def\@tempA{\Segno1}% +\def\SinOf#1to#2{\edef#2{\fpeval{round(sind#1,6)}}}\relax +\def\CosOf#1to#2{\edef#2{\fpeval{round(cosd#1,6)}}}\relax +\def\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t@X}{\t@Y}% +\def\s@gno{}% +\ifdim\t@X\p@=\z@ + \ifdim\t@Y\p@=\z@ + \def\ArcTan{0}% vettore nullo \else - \ifdim\@tdA=180\p@ - \def\@tempA{0}% - \else - \ifdim\@tdA<\p@ - \@tdA=\Segno0.0174533\@tdA - \DividE\@tdA by\p@ to \@tempA% - \else - \g@tTanCotanFrom\@tdA to\T and\Tp - \@tdA=\T\p@ \advance\@tdA \Tp\p@ - \DividE \Segno2\p@ by\@tdA to \@tempA% - \fi - \fi + \def\ArcTan{90}% vettore verticale + \ifdim\t@Y\p@<\z@\def\ArcTan{-90}\fi \fi -\fi -\edef\endSinOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endSinOf}% -\def\CosOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>\z@% - \@whiledim\@tdA>360\p@\do{\advance\@tdA -360\p@}% -\else% - \@whiledim\@tdA<\z@\do{\advance\@tdA 360\p@}% -\fi -\ifdim\@tdA>180\p@ - \@tdA=-\@tdA \advance\@tdA 360\p@ -\fi -\ifdim\@tdA<90\p@ - \def\Segno{+}% \else - \def\Segno{-}% - \@tdA=-\@tdA \advance\@tdA 180\p@ -\fi -\ifdim\@tdA=\z@ - \def\@tempA{\Segno1}% -\else - \ifdim\@tdA<\p@ - \@tdA=0.0174533\@tdA \Numero\@tempA\@tdA - \@tdA=\@tempA\@tdA \@tdA=-.5\@tdA - \advance\@tdA \p@ - \DividE\@tdA by\p@ to\@tempA% - \else - \ifdim\@tdA=90\p@ - \def\@tempA{0}% + \ifdim\t@Y\p@=\z@% vettore orizzontale + \ifdim\t@X\p@<\z@ + \def\ArcTan{180}% \else - \g@tTanCotanFrom\@tdA to\T and\Tp - \@tdA=\Tp\p@ \advance\@tdA-\T\p@ - \@tdB=\Tp\p@ \advance\@tdB\T\p@ - \DividE\Segno\@tdA by\@tdB to\@tempA% + \def\ArcTan{0}% \fi - \fi -\fi -\edef\endCosOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endCosOf}% -\def\TanOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>90\p@% - \@whiledim\@tdA>90\p@\do{\advance\@tdA -180\p@}% -\else% - \@whiledim\@tdA<-90\p@\do{\advance\@tdA 180\p@}% -\fi% -\ifdim\@tdA=\z@% - \def\@tempA{0}% -\else - \ifdim\@tdA>\z@ - \def\Segno{+}% - \else - \def\Segno{-}% - \@tdA=-\@tdA - \fi - \ifdim\@tdA=90\p@ - \def\@tempA{\Segno16383.99999}% - \else - \ifdim\@tdA<\p@ - \@tdA=\Segno0.0174533\@tdA - \DividE\@tdA by\p@ to\@tempA% - \else - \g@tTanCotanFrom\@tdA to\T and\Tp - \@tdA\Tp\p@ \advance\@tdA -\T\p@ - \DividE\Segno2\p@ by\@tdA to\@tempA% + \else % vettore qualsiasi + \edef\ArcTan{\fpeval{atand(\t@Y / \t@X)}}\relax + \ifdim\t@X\p@<\z@% vettore nei quadranti di sinistra + \ifdim\t@Y\p@<\z@ + \edef\ArcTan{\fpeval{\ArcTan - 180}}\relax + \else + \edef\ArcTan{\fpeval{\ArcTan + 180}}\relax + \fi \fi \fi \fi -\edef\endTanOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endTanOf}% -\def\ArcTanOf#1to#2{\bgroup -\countdef\Inverti 4444\Inverti=0 -\def\Segno{} -\edef\@tF{#1}\@tdF=\@tF\p@ \@tdE=57.295778\p@ -\@tdD=\ifdim\@tdF<\z@ -\@tdF\def\Segno{-}\else\@tdF\fi -\ifdim\@tdD>\p@ -\Inverti=\@ne -\@tdD=\dimexpr\p@*\p@/\@tdD\relax -\fi -\unless\ifdim\@tdD>0.02\p@ - \def\@tX{\strip@pt\dimexpr57.295778\@tdD\relax}% -\else - \edef\@tX{45}\relax - \countdef\I 2523 \I=9\relax - \@whilenum\I>0\do{\TanOf\@tX to\@tG - \edef\@tG{\strip@pt\dimexpr\@tG\p@-\@tdD\relax}\relax - \MultiplY\@tG by57.295778to\@tG - \CosOf\@tX to\@tH - \MultiplY\@tH by\@tH to\@tH - \MultiplY\@tH by\@tG to \@tH - \edef\@tX{\strip@pt\dimexpr\@tX\p@ - \@tH\p@\relax}\relax - \advance\I\m@ne}% -\fi -\ifnum\Inverti=\@ne -\edef\@tX{\strip@pt\dimexpr90\p@-\@tX\p@\relax} -\fi -\edef\x{\egroup\noexpand\edef\noexpand#2{\Segno\@tX}}\x\ignorespaces}% +\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}% +\x\ignorespaces} \def\MakeVectorFrom#1#2to#3{\edef#3{#1,#2}\ignorespaces}% \def\CopyVect#1to#2{\edef#2{#1}\ignorespaces}% \def\ModOfVect#1to#2{\GetCoord(#1)\t@X\t@Y -\@tempdima=\t@X\p@ \ifdim\@tempdima<\z@ \@tempdima=-\@tempdima\fi -\@tempdimb=\t@Y\p@ \ifdim\@tempdimb<\z@ \@tempdimb=-\@tempdimb\fi -\ifdim\@tempdima=\z@ - \ifdim\@tempdimb=\z@ - \def\@T{0}\@tempdimc=\z@ - \else - \def\@T{0}\@tempdimc=\@tempdimb - \fi -\else - \ifdim\@tempdima>\@tempdimb - \DividE\@tempdimb by\@tempdima to\@T - \@tempdimc=\@tempdima - \else - \DividE\@tempdima by\@tempdimb to\@T - \@tempdimc=\@tempdimb - \fi -\fi -\unless\ifdim\@tempdimc=\z@ - \unless\ifdim\@T\p@=\z@ - \@tempdima=\@T\p@ \@tempdima=\@T\@tempdima - \advance\@tempdima\p@% - \@tempdimb=\p@% - \@tempcnta=5\relax - \@whilenum\@tempcnta>\z@\do{\DividE\@tempdima by\@tempdimb to\@T - \advance\@tempdimb \@T\p@ \@tempdimb=.5\@tempdimb - \advance\@tempcnta\m@ne}% - \@tempdimc=\@T\@tempdimc - \fi -\fi -\Numero#2\@tempdimc +\edef#2{\fpeval{sqrt(\t@X*\t@X + \t@Y*\t@Y)}}\relax \ignorespaces}% \def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y \ModOfVect#1to\@tempa -\unless\ifdim\@tempdimc=\z@ - \DividE\t@X\p@ by\@tempdimc to\t@X - \DividE\t@Y\p@ by\@tempdimc to\t@Y +\unless\ifdim\@tempa\p@=\z@ + \DividE\t@X\p@ by\@tempa to\t@X + \DividE\t@Y\p@ by\@tempa to\t@Y \fi \MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% \def\ModAndDirOfVect#1to#2and#3{% \GetCoord(#1)\t@X\t@Y \ModOfVect#1to#2% -\ifdim\@tempdimc=\z@\else - \DividE\t@X\p@ by\@tempdimc to\t@X - \DividE\t@Y\p@ by\@tempdimc to\t@Y -\fi -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% +\DirOfVect#1to#3\ignorespaces}% \def\DistanceAndDirOfVect#1minus#2to#3and#4{% \SubVect#2from#1to\@tempa \ModAndDirOfVect\@tempa to#3and#4\ignorespaces}% @@ -450,79 +307,37 @@ \CosOf#1to\t@X \SinOf#1to\t@Y \MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% -\def\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t@X}{\t@Y}% -\def\s@gno{}\def\addflatt@ngle{0} -\ifdim\t@X\p@=\z@ - \ifdim\t@Y\p@=\z@ - \def\ArcTan{0}% - \else - \def\ArcTan{90}% - \ifdim\t@Y\p@<\z@\def\s@gno{-}\fi - \fi -\else - \ifdim\t@Y\p@=\z@ - \ifdim\t@X\p@<\z@ - \def\ArcTan{180}% - \else - \def\ArcTan{0}% - \fi - \else - \ifdim\t@X\p@<\z@% - \def\addflatt@ngle{180}% - \edef\t@X{\strip@pt\dimexpr-\t@X\p@}% - \edef\t@Y{\strip@pt\dimexpr-\t@Y\p@}% - \ifdim\t@Y\p@<\z@ - \def\s@gno{-}% - \edef\t@Y{-\t@Y}% - \fi - \fi - \DivideFN\t@Y by\t@X to \t@A - \ArcTanOf\t@A to\ArcTan - \fi -\fi -\edef\ArcTan{\unless\ifx\s@gno\empty\s@gno\fi\ArcTan}% -\unless\ifnum\addflatt@ngle=0\relax - \edef\ArcTan{% - \strip@pt\dimexpr\ArcTan\p@\ifx\s@gno\empty-\else+\fi - \addflatt@ngle\p@\relax}% -\fi -\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}% -\x\ignorespaces} \def\ScaleVect#1by#2to#3{\GetCoord(#1)\t@X\t@Y -\@tempdima=\t@X\p@ \@tempdima=#2\@tempdima\Numero\t@X\@tempdima -\@tempdima=\t@Y\p@ \@tempdima=#2\@tempdima\Numero\t@Y\@tempdima +\edef\t@X{\fpeval{#2 * \t@X}}\relax +\edef\t@Y{\fpeval{#2 * \t@Y}}\relax \MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% \def\ConjVect#1to#2{\GetCoord(#1)\t@X\t@Y -\@tempdima=-\t@Y\p@\Numero\t@Y\@tempdima +\edef\t@Y{-\t@Y}% \MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% \def\AddVect#1and#2to#3{\GetCoord(#1)\tu@X\tu@Y \GetCoord(#2)\td@X\td@Y -\@tempdima\tu@X\p@\advance\@tempdima\td@X\p@ \Numero\t@X\@tempdima -\@tempdima\tu@Y\p@\advance\@tempdima\td@Y\p@ \Numero\t@Y\@tempdima +\edef\t@X{\fpeval{\tu@X + \td@X}}\relax +\edef\t@Y{\fpeval{\tu@Y + \td@Y}}\relax \MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% \def\SubVect#1from#2to#3{\GetCoord(#1)\tu@X\tu@Y \GetCoord(#2)\td@X\td@Y -\@tempdima\td@X\p@\advance\@tempdima-\tu@X\p@ \Numero\t@X\@tempdima -\@tempdima\td@Y\p@\advance\@tempdima-\tu@Y\p@ \Numero\t@Y\@tempdima +\edef\t@X{\fpeval{\td@X - \tu@X}}\relax +\edef\t@Y{\fpeval{\td@Y - \tu@Y}}\relax \MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% \def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}% \def\@MultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y \GetCoord(#2)\td@X\td@Y -\@tempdima\tu@X\p@ \@tempdimb\tu@Y\p@ -\@tempdimc=\td@X\@tempdima\advance\@tempdimc-\td@Y\@tempdimb -\Numero\t@X\@tempdimc -\@tempdimc=\td@Y\@tempdima\advance\@tempdimc\td@X\@tempdimb -\Numero\t@Y\@tempdimc +\edef\t@X{\fpeval{\tu@X * \td@X - \tu@Y * \td@Y}}\relax +\edef\t@Y{\fpeval{\tu@Y * \td@X + \tu@X * \td@Y}}\relax \MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% \def\@ConjMultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y -\GetCoord(#2)\td@X\td@Y \@tempdima\tu@X\p@ \@tempdimb\tu@Y\p@ -\@tempdimc=\td@X\@tempdima\advance\@tempdimc+\td@Y\@tempdimb -\Numero\t@X\@tempdimc -\@tempdimc=\td@X\@tempdimb\advance\@tempdimc-\td@Y\@tempdima -\Numero\t@Y\@tempdimc +\GetCoord(#2)\td@X\td@Y +\edef\t@X{\fpeval{\tu@X * \td@X + \tu@Y * \td@Y}}\relax +\edef\t@Y{\fpeval{\tu@Y * \td@X - \tu@X * \td@Y}}\relax \MakeVectorFrom\t@X\t@Y to#3\ignorespaces} \def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir -\DividE\p@ by\@Mod\p@ to\@Mod \ConjVect\@Dir to\@Dir +\edef\@Mod{\fpeval{1 / \@Mod}}\relax +\ConjVect\@Dir to\@Dir \ScaleVect#1by\@Mod to\@tempa \MultVect\@tempa by\@Dir to#3\ignorespaces}% \def\Arc(#1)(#2)#3{\begingroup @@ -544,10 +359,10 @@ to the range 0--360 taking the sign into consideration}% \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% \fi -\SubVect#2from#1to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun +\SubVect#2from#1to\@V \ModOfVect\@V to\@Raggio +\CopyVect#2to\@pPun \CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% +\@@Arc\strokepath\ignorespaces}% \def\@@Arc{% \pIIe@moveto{\@pPunX\unitlength}{\@pPunY\unitlength}% \ifdim\@tdA>180\p@ @@ -555,7 +370,8 @@ \Numero\@gradi\@tdA \SubVect\@pPun from\@Cent to\@V \AddVect\@V and\@Cent to\@sPun - \MultVect\@V by0,-1.3333333to\@V \if\Segno-\ScaleVect\@V by-1to\@V\fi + \MultVect\@V by0,-1.3333333to\@V + \if\Segno-\ScaleVect\@V by-1to\@V\fi \AddVect\@pPun and\@V to\@pcPun \AddVect\@sPun and\@V to\@scPun \GetCoord(\@pcPun)\@pcPunX\@pcPunY @@ -697,8 +513,9 @@ \@@Arc \strokepath\ignorespaces}% \def\CurveBetween#1and#2WithDirs#3and#4{% -\StartCurveAt#1WithDir{#3}\relax -\CurveTo#2WithDir{#4}\CurveFinish\ignorespaces}% + \StartCurveAt#1WithDir{#3}\relax + \CurveTo#2WithDir{#4}\CurveFinish\ignorespaces +}% \def\StartCurveAt#1WithDir#2{% \begingroup \GetCoord(#1)\@tempa\@tempb @@ -737,6 +554,7 @@ \def\@isTension#1;#2!!{\def\@tempA{#1}% \def\@tempB{#2}\unless\ifx\@tempB\empty\strip@semicolon#2\fi} + \def\strip@semicolon#1;{\def\@tempB{#1}} \def\CurveTo#1WithDir#2{% \def\@Tuno{1}\def\@Tzero{1}\relax @@ -802,12 +620,13 @@ \ignorespaces}% \def\Curve{\@ifstar{\let\fillstroke\fillpath\Curve@}% {\let\fillstroke\strokepath\Curve@}} + \def\Curve@(#1)<#2>{% \StartCurveAt#1WithDir{#2}% \@ifnextchar\lp@r\@Curve{% \PackageWarning{curve2e}{% Curve specifications must contain at least two nodes!\Messagebreak - Please, control your Curve specifications\MessageBreak}}} + Please, control your \string\Curve\space specifications\MessageBreak}}} \def\@Curve(#1)<#2>{% \CurveTo#1WithDir{#2}% \@ifnextchar\lp@r\@Curve{% @@ -823,9 +642,11 @@ Quadratic curve specifications must contain at least two nodes!\Messagebreak Please, control your Qurve specifications\MessageBreak}}}% + \def\@Qurve(#1)<#2>{\QurveTo#1WithDir{#2}% \@ifnextchar\lp@r\@Qurve{% \@ifnextchar[\@ChangeQDir\CurveEnd}}% + \def\@ChangeQDir[#1]{\ChangeDir<#1>\@Qurve}% \def\QurveTo#1WithDir#2{% \edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup @@ -878,7 +699,6 @@ \pIIe@bezier@QtoC\@ovyy\@ovdy\@ovri \pIIe@bezier@QtoC\@xdim\@ovdx\@clnwd \pIIe@bezier@QtoC\@ydim\@ovdy\@clnht - \pIIe@moveto\@ovxx\@ovyy \pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim \fi\fi\egroup \CopyVect\@Puno to\@Pzero |