| 1 |
%% |
| 2 |
%% This is file `curve2e.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% curve2e.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2005--2024 Claudio Beccari all |
| 10 |
%% rights reserved. |
| 11 |
%% License information appended |
| 12 |
%% |
| 13 |
\NeedsTeXFormat{LaTeX2e}[2019/01/01] |
| 14 |
\ProvidesPackage{curve2e}% |
| 15 |
[2024-11-13 v.2.6.0 Extension package for pict2e] |
| 16 |
|
| 17 |
\IfFileExists{xfp.sty}{% |
| 18 |
\RequirePackage{graphicx,color} |
| 19 |
\RequirePackageWithOptions{pict2e}[2014/01/01] |
| 20 |
\@ifl@aded{sty}{xparse}{}{\RequirePackage{xparse}} |
| 21 |
\@ifl@aded{sty}{xfp}{}{\RequirePackage{xfp}}% |
| 22 |
}{% |
| 23 |
\RequirePackage{curve2e-v161}% |
| 24 |
\PackageWarningNoLine{curve2e}{% |
| 25 |
Package xfp is required, but apparently\MessageBreak% |
| 26 |
such package cannot be found in this \MessageBreak% |
| 27 |
TeX system installation\MessageBreak% |
| 28 |
Either your installation is not complete \MessageBreak% |
| 29 |
or it is older than 2018-10-17.\MessageBreak% |
| 30 |
\MessageBreak% |
| 31 |
***************************************\MessageBreak% |
| 32 |
Version 1.61 of curve2e has been loaded\MessageBreak% |
| 33 |
instead of the current version \MessageBreak% |
| 34 |
***************************************\MessageBreak}% |
| 35 |
\endinput |
| 36 |
} |
| 37 |
\ExplSyntaxOn |
| 38 |
\AtBeginDocument{% |
| 39 |
\ProvideExpandableDocumentCommand\fptest{m m m}{% |
| 40 |
\fp_compare:nTF{#1}{#2}{#3}} |
| 41 |
\ProvideExpandableDocumentCommand\fptestT{m m}{% |
| 42 |
\fp_compare:nTF{#1}{#2}{\relax}} |
| 43 |
\ProvideExpandableDocumentCommand\fptestF{m m}{% |
| 44 |
\fp_compare:nTF{#1}{\relax}{#2}} |
| 45 |
\ProvideExpandableDocumentCommand\fpdowhile{m m}{% |
| 46 |
\fp_do_while:nn{#1}{#2}} |
| 47 |
\ProvideExpandableDocumentCommand\fpwhiledo{m m}{% |
| 48 |
\fp_while_do:nn{#1}{#2}} |
| 49 |
\ProvideExpandableDocumentCommand\Modulo{m m}{% |
| 50 |
\inteval{\int_mod:nn{#1}{#2}}} |
| 51 |
\ProvideExpandableDocumentCommand\Ifodd{m m m}{% |
| 52 |
\int_if_odd:nTF{#1}{#2}{#3}} |
| 53 |
\ProvideExpandableDocumentCommand\Ifequal{m m m m}% |
| 54 |
{\str_if_eq:eeTF{#1}{#2}{#3}{#4}} |
| 55 |
} |
| 56 |
\ExplSyntaxOff |
| 57 |
|
| 58 |
\def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}% |
| 59 |
\def\TROF{\tracingcommands\z@ \tracingmacros\z@}% |
| 60 |
\newif\ifCV@polare \let\ifCV@polare\iffalse |
| 61 |
\ifx\undefined\@tdA \newdimen\@tdA \fi |
| 62 |
\ifx\undefined\@tdB \newdimen\@tdB \fi |
| 63 |
\ifx\undefined\@tdC \newdimen\@tdC \fi |
| 64 |
\ifx\undefined\@tdD \newdimen\@tdD \fi |
| 65 |
\ifx\undefined\@tdE \newdimen\@tdE \fi |
| 66 |
\ifx\undefined\@tdF \newdimen\@tdF \fi |
| 67 |
\ifx\undefined\defaultlinewidth \newdimen\defaultlinewidth \fi |
| 68 |
\gdef\linethickness#1{% |
| 69 |
\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}% |
| 70 |
\newcommand\defaultlinethickness[1]{\defaultlinewidth=#1\relax |
| 71 |
\def\thicklines{\linethickness{\defaultlinewidth}}% |
| 72 |
\def\thinlines{\linethickness{.5\defaultlinewidth}}\thinlines |
| 73 |
\ignorespaces}% |
| 74 |
\def\LIne(#1){{\GetCoord(#1)\@tX\@tY |
| 75 |
\moveto(0,0) |
| 76 |
\pIIe@lineto{\@tX\unitlength}{\@tY\unitlength}\strokepath}\ignorespaces |
| 77 |
}% |
| 78 |
\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}% |
| 79 |
\def\line(#1)#2{\begingroup |
| 80 |
\@linelen #2\unitlength |
| 81 |
\ifdim\@linelen<\z@\@badlinearg\else |
| 82 |
\expandafter\DirOfVect#1to\Dir@line |
| 83 |
\GetCoord(\Dir@line)\d@mX\d@mY |
| 84 |
\ifdim\d@mX\p@=\z@\else |
| 85 |
\edef\sc@lelen{\fpeval{1 / abs(\d@mX)}}\relax |
| 86 |
\@linelen=\sc@lelen\@linelen |
| 87 |
\fi |
| 88 |
\moveto(0,0)\pIIe@lineto{\d@mX\@linelen}{\d@mY\@linelen}% |
| 89 |
\strokepath |
| 90 |
\fi |
| 91 |
\endgroup\ignorespaces}% |
| 92 |
\let\originalmoveto\moveto |
| 93 |
\let\originallineto\lineto |
| 94 |
\let\originalcurveto\curveto |
| 95 |
|
| 96 |
\def\moveto(#1){\GetCoord(#1)\MTx\MTy |
| 97 |
\originalmoveto(\MTx,\MTy)\ignorespaces} |
| 98 |
\def\lineto(#1){\GetCoord(#1)\LTx\LTy |
| 99 |
\originallineto(\LTx,\LTy)\ignorespaces} |
| 100 |
\def\curveto(#1)(#2)(#3){\GetCoord(#1)\CTpx\CTpy |
| 101 |
\GetCoord(#2)\CTsx\CTsy\GetCoord(#3)\CTx\CTy |
| 102 |
\originalcurveto(\CTpx,\CTpy)(\CTsx,\CTsy)(\CTx,\CTy)\ignorespaces} |
| 103 |
|
| 104 |
\def\IsPolar#1:#2?{\def\@TempOne{#2}\unless\ifx\@TempOne\empty |
| 105 |
\expandafter\@firstoftwo\else |
| 106 |
\expandafter\@secondoftwo\fi} |
| 107 |
|
| 108 |
\ifx\Dashline\undefined |
| 109 |
\def\Dashline{\@ifstar{\Dashline@}{\Dashline@}}% bckwd compatibility |
| 110 |
\let\Dline\Dashline |
| 111 |
|
| 112 |
\def\Dashline@(#1)(#2)#3{\put(#1){% |
| 113 |
\GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA |
| 114 |
\GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB |
| 115 |
\IsPolar#2:?{% Polar |
| 116 |
\Dashline@@(0,0)(\V@ttB){#3}}% |
| 117 |
{% Cartesian |
| 118 |
\SubVect\V@ttA from\V@ttB to\V@ttC |
| 119 |
\Dashline@@(0,0)(\V@ttC){#3}% |
| 120 |
} |
| 121 |
}} |
| 122 |
|
| 123 |
\def\Dashline@@(#1)(#2)#3{% |
| 124 |
\countdef\NumA3254\countdef\NumB3252\relax |
| 125 |
\GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA |
| 126 |
\GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB |
| 127 |
\SubVect\V@ttA from\V@ttB to\V@ttC |
| 128 |
\ModOfVect\V@ttC to\DlineMod |
| 129 |
\DivideFN\DlineMod by#3 to\NumD |
| 130 |
\NumA=\fpeval{trunc(\NumD,0)}\relax |
| 131 |
\unless\ifodd\NumA\advance\NumA\@ne\fi |
| 132 |
\NumB=\NumA \divide\NumB\tw@ |
| 133 |
\DividE\DlineMod\p@ by\NumA\p@ to\D@shMod |
| 134 |
\DividE\p@ by\NumA\p@ to \@tempa |
| 135 |
\Multvect{\V@ttC}{\@tempa,0}\V@ttB |
| 136 |
\Multvect{\V@ttB}{2,0}\V@ttC |
| 137 |
\advance\NumB\@ne |
| 138 |
\put(\V@ttA){\multiput(0,0)(\V@ttC){\NumB}{\LIne(\V@ttB)}} |
| 139 |
\ignorespaces} |
| 140 |
\fi |
| 141 |
\ifx\Dotline\undefined |
| 142 |
\providecommand\Dotline{} |
| 143 |
\RenewDocumentCommand\Dotline{R(){0,0} R(){1,0} m O{1mm}}{% |
| 144 |
\put(#1){\edef\Diam{\fpeval{{#4}/\unitlength}}% |
| 145 |
\IsPolar#2:?{\CopyVect#2to\DirDot}% |
| 146 |
{\SubVect#1from#2to\DirDot}% |
| 147 |
\countdef\NumA=3254\relax |
| 148 |
\ModAndAngleOfVect\DirDot to\ModDirDot and\AngDirDot |
| 149 |
\edef\NumA{\fpeval{trunc(\ModDirDot/{#3},0)}}% |
| 150 |
\edef\ModDirDot{\fpeval{\ModDirDot/\NumA}}% |
| 151 |
\multiput(0,0)(\AngDirDot:\ModDirDot){\inteval{\NumA+1}}% |
| 152 |
{\makebox(0,0){\circle*{\Diam}}}}\ignorespaces} |
| 153 |
\fi |
| 154 |
\AtBeginDocument{\@ifpackageloaded{eso-pic}{% |
| 155 |
\renewcommand\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}}{}}% |
| 156 |
\def\GetCoord(#1)#2#3{\let\ifCV@polare\iffalse |
| 157 |
\bgroup\edef\x{\egroup |
| 158 |
\noexpand\IsPolar#1:?}\x |
| 159 |
{% Polar |
| 160 |
\let\ifCV@polare\iftrue |
| 161 |
\bgroup\edef\x{\egroup\noexpand\SplitPolar(#1)}\x\SCt@X\SCt@Y}% |
| 162 |
{% Cartesian |
| 163 |
\bgroup\edef\x{\egroup\noexpand\SplitCartesian(#1)}\x\SCt@X\SCt@Y}% |
| 164 |
\edef#2{\SCt@X}\edef#3{\SCt@Y}\ignorespaces} |
| 165 |
|
| 166 |
\def\SplitPolar(#1:#2)#3#4{% |
| 167 |
\edef#3{\fpeval{#2 * cosd#1}}\edef#4{\fpeval{#2 * sind#1}}} |
| 168 |
|
| 169 |
\def\SplitCartesian(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}} |
| 170 |
|
| 171 |
\let\originalput\put |
| 172 |
\def\put(#1){\bgroup\GetCoord(#1)\@tX\@tY |
| 173 |
\edef\x{\noexpand\egroup\noexpand\originalput(\@tX,\@tY)}\x} |
| 174 |
\RenewDocumentCommand{\multiput}{O{0,0} d() d() m m o }{% |
| 175 |
\IfNoValueTF{#2}{\PackageError{curve2e}% |
| 176 |
{\string\multiput\space initial point coordinates missing}% |
| 177 |
{Nothing done} |
| 178 |
}% |
| 179 |
{\IfNoValueTF{#3}{\PackageError{curve2e} |
| 180 |
{\string\multiput\space Increment components missing}% |
| 181 |
{Nothing done} |
| 182 |
}% |
| 183 |
{\put(#1){\let\c@multicnt\@multicnt |
| 184 |
\CopyVect #2 to \R |
| 185 |
\CopyVect#3 to\D |
| 186 |
\@multicnt=\inteval{#4}\relax |
| 187 |
\@whilenum \@multicnt > \z@\do{% |
| 188 |
\put(\R){#5}% |
| 189 |
\IfValueTF{#6}{#6}{\AddVect#3 and\R to \R}% |
| 190 |
\advance\@multicnt\m@ne |
| 191 |
}% |
| 192 |
}% |
| 193 |
}% |
| 194 |
}\ignorespaces |
| 195 |
} |
| 196 |
\NewDocumentCommand{\xmultiput}{O{0,0} d() d() m m o }{% |
| 197 |
\IfNoValueTF{#2}{\PackageError{curve2e}{% |
| 198 |
\string\Xmultiput\space initial point coordinates missing}% |
| 199 |
{Nothing done}}% |
| 200 |
{\IfNoValueTF{#3}{\PackageError{curve2e}{% |
| 201 |
\string\Xmultiput\space Increment components missing}% |
| 202 |
{Nothing done}}% |
| 203 |
{\put(#1)% |
| 204 |
{\let\c@multicnt\@multicnt |
| 205 |
\CopyVect #2 to \R |
| 206 |
\CopyVect #3 to \D |
| 207 |
\@multicnt=\@ne |
| 208 |
\fpdowhile{\value{multicnt} < \inteval{#4+1}}% Test |
| 209 |
{% |
| 210 |
\put(\R){#5} |
| 211 |
\IfValueTF{#6}{#6}{% |
| 212 |
\AddVect#3 and\R to \R} |
| 213 |
\advance\@multicnt\@ne |
| 214 |
} |
| 215 |
} |
| 216 |
}}\ignorespaces |
| 217 |
} |
| 218 |
\let\original@vector\vector |
| 219 |
\def\vector(#1)#2{% |
| 220 |
\begingroup |
| 221 |
\GetCoord(#1)\d@mX\d@mY |
| 222 |
\original@vector(\d@mX,\d@mY){\fpeval{round(abs(#2),6)}}% |
| 223 |
\endgroup}% |
| 224 |
\def\Vector(#1){{% |
| 225 |
\GetCoord(#1)\@tX\@tY |
| 226 |
\ifdim\@tX\p@=\z@ |
| 227 |
\vector(\@tX,\@tY){\@tY}% |
| 228 |
\else |
| 229 |
\vector(\@tX,\@tY){\@tX}% |
| 230 |
\fi}} |
| 231 |
\def\VECTOR(#1)(#2){\begingroup |
| 232 |
\SubVect#1from#2to\@tempa |
| 233 |
\expandafter\put\expandafter(#1){\expandafter\Vector\expandafter(\@tempa)}% |
| 234 |
\endgroup\ignorespaces} |
| 235 |
\def\VVECTOR(#1)(#2){{\SubVect#1from#2to\@tempb |
| 236 |
\ScaleVect\@tempb by0.5to\@tempb |
| 237 |
\AddVect\@tempb and#1to\@tempb |
| 238 |
\VECTOR(\@tempb)(#2)\VECTOR(\@tempb)(#1)}\ignorespaces} |
| 239 |
\let\lp@r( \let\rp@r) |
| 240 |
\renewcommand*\polyline[1][\beveljoin]{\p@lylin@[#1]} |
| 241 |
|
| 242 |
\def\p@lylin@[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY |
| 243 |
\pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}% |
| 244 |
\@ifnextchar\lp@r{\p@lyline}{% |
| 245 |
\PackageWarning{curve2e}% |
| 246 |
{Polylines require at least two vertices!\MessageBreak |
| 247 |
Control your polyline specification\MessageBreak}% |
| 248 |
\ignorespaces}} |
| 249 |
|
| 250 |
\def\p@lyline(#1){\GetCoord(#1)\d@mX\d@mY |
| 251 |
\pIIe@lineto{\d@mX\unitlength}{\d@mY\unitlength}% |
| 252 |
\@ifnextchar\lp@r{\p@lyline}{\strokepath\ignorespaces}} |
| 253 |
\providecommand\polygon{} |
| 254 |
\RenewDocumentCommand\polygon{s O{\beveljoin} }{\@killglue\begingroup |
| 255 |
\IfBooleanTF{#1}{\@tempswatrue}{\@tempswafalse}% |
| 256 |
\@polygon[#2]} |
| 257 |
|
| 258 |
\def\@polygon[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY |
| 259 |
\pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}% |
| 260 |
\@ifnextchar\lp@r{\@@polygon}{% |
| 261 |
\PackageWarning{curve2e}% |
| 262 |
{Polygons require at least two vertices!\MessageBreak |
| 263 |
Control your polygon specification\MessageBreak}% |
| 264 |
\ignorespaces}} |
| 265 |
|
| 266 |
\def\@@polygon(#1){\GetCoord(#1)\d@mX\d@mY |
| 267 |
\pIIe@lineto{\d@mX\unitlength}{\d@mY\unitlength}% |
| 268 |
\@ifnextchar\lp@r{\@@polygon}{\pIIe@closepath |
| 269 |
\if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi |
| 270 |
\endgroup |
| 271 |
\ignorespaces}} |
| 272 |
|
| 273 |
\def\@picture(#1,#2)(#3,#4){% |
| 274 |
\edef\pict@dimen{#1,#2} % New 2.4.0 |
| 275 |
\edef\pict@offset{#3,#4}% New 2.4.0 |
| 276 |
\@picht#2\unitlength |
| 277 |
\setbox\@picbox\hb@xt@#1\unitlength\bgroup |
| 278 |
\hskip -#3\unitlength |
| 279 |
\lower #4\unitlength\hbox\bgroup |
| 280 |
\ignorespaces} |
| 281 |
|
| 282 |
\newif\ifinnerlines \let\ifinnerlines\iftrue |
| 283 |
\def\noinnerlines{\let\ifinnerlines\iffalse} |
| 284 |
|
| 285 |
\newcommand\griglia[2]{% |
| 286 |
\linethickness{#1\p@}% |
| 287 |
\edef\ggllx{\Goffx} |
| 288 |
\fpdowhile{\ggllx!>\GridWd}{% |
| 289 |
\fptest{\ggllx=\fpeval{#2*(round(\ggllx/#2,0))}}% |
| 290 |
{\segment(\ggllx,\Goffy)(\ggllx,\GridHt)}{\relax}% |
| 291 |
\edef\ggllx{\fpeval{\ggllx+#2}}}% |
| 292 |
\edef\gglly{\Goffy} |
| 293 |
\fpdowhile{\gglly!>\GridHt}{% |
| 294 |
\fptest{\gglly=\fpeval{#2*(round(\gglly/#2,0))}}% |
| 295 |
{\segment(\Goffx,\gglly)(\GridWd,\gglly)}{\relax} |
| 296 |
\edef\gglly{\fpeval{\gglly+#2}}}} |
| 297 |
|
| 298 |
\NewDocumentCommand\Gr@phGrid{d() d()}{\bgroup |
| 299 |
\color{\GridColor} |
| 300 |
\edef\Gdim{#1}\edef\Goff{#2} |
| 301 |
\GetCoord(\Gdim)\Gllx\Glly |
| 302 |
\GetCoord(\Goff)\Goffx\Goffy |
| 303 |
\edef\GridWd{\fpeval{\Gllx+\Goffx}}% |
| 304 |
\edef\GridHt{\fpeval{\Glly+\Goffy}}% |
| 305 |
\griglia{1.0}{10} |
| 306 |
\ifinnerlines |
| 307 |
\griglia{0.70}{5}% |
| 308 |
\unless\ifdim \unitlength < 1mm |
| 309 |
\griglia{0.70}{5}% |
| 310 |
\griglia{0.35}{1}% |
| 311 |
\fi |
| 312 |
\fi |
| 313 |
\egroup |
| 314 |
\ignorespaces} |
| 315 |
|
| 316 |
\NewDocumentCommand\AutoGrid% |
| 317 |
{D(){\pict@dimen} D(){\pict@offset} O{cyan!50!white}}{\bgroup |
| 318 |
\def\GridColor{#3}% |
| 319 |
\put(0,0){\Gr@phGrid(#1)(#2)}% |
| 320 |
\egroup\ignorespaces} |
| 321 |
|
| 322 |
\NewDocumentCommand\GraphGrid% |
| 323 |
{R(){\pict@dimen} D(){\pict@offset} O{cyan!50!white}} |
| 324 |
{\bgroup |
| 325 |
\def\GridColor{#3}% |
| 326 |
\put(#2){\Gr@phGrid(#1)(#2)}% |
| 327 |
\egroup\ignorespaces} |
| 328 |
|
| 329 |
\def\RoundUp#1modulo#2to#3{\edef#3{\fpeval{(ceil(#1/#2,0))*#2}}}% |
| 330 |
\def\Integer#1.#2??{#1}% |
| 331 |
|
| 332 |
\providecommand\Pbox{} |
| 333 |
\newlength\PbDim |
| 334 |
\RenewDocumentCommand\Pbox{D(){0,0} O{cc} m O{0.5ex} s D<>{0}}{% |
| 335 |
\put(#1){\rotatebox{#6}{\makebox(0,0){% |
| 336 |
\settowidth\PbDim{#2}% |
| 337 |
\edef\Rapp{\fpeval{\PbDim/{1ex}}}% |
| 338 |
\fptest{\Rapp>1.5}{\fboxsep=0.5ex}{\fboxsep=0.75ex}% |
| 339 |
\IfBooleanTF{#5}{\fboxrule=0.4pt}{\fboxrule=0pt}% |
| 340 |
\fptest{#4=0sp}% |
| 341 |
{\makebox(0,0)[#2]{\fbox{$\relax#3\relax$}}}% |
| 342 |
{\edef\Diam{\fpeval{(#4)/\unitlength}}% |
| 343 |
\makebox(0,0){\circle*{\Diam}}% |
| 344 |
\makebox(0,0)[#2]{\fbox{$\relax\mathsf#3\relax$}}% |
| 345 |
}}}% |
| 346 |
}\ignorespaces} |
| 347 |
|
| 348 |
\providecommand\Zbox{} |
| 349 |
\RenewDocumentCommand\Zbox{R(){0,0} O{cc} m O{1}}{% |
| 350 |
\put(#1){\makebox(0,0)[#2]{\fboxrule=0pt\fboxsep=3pt\fbox{$#3$}}% |
| 351 |
\makebox(0,0)[cc]{\circle*{#4}}}\ignorespaces} |
| 352 |
|
| 353 |
\providecommand\legenda{} |
| 354 |
\newbox\legendbox |
| 355 |
\RenewDocumentCommand\legenda{D(){0,0} m}{\put(#1){% |
| 356 |
\setbox\legendbox\hbox{$\relax#2\relax$}% |
| 357 |
\edef\@tempA{\fpeval{(\wd\legendbox+3\p@)/\unitlength}}% |
| 358 |
\edef\@tempB{\fpeval{(\ht\legendbox+\dp\legendbox+3\p@)/\unitlength}}% |
| 359 |
\framebox(\@tempA,\@tempB){\box\legendbox}}\ignorespaces} |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
\def\DividE#1by#2to#3{\edef#3{\fpeval{#1 / #2}}} |
| 364 |
\let\DivideFN\DividE |
| 365 |
\def\MultiplY#1by#2to#3{\edef#3{\fpeval{#1 * #2}}}\relax |
| 366 |
\let\MultiplyFN\MultiplY |
| 367 |
\providecommand\Numero[2]{\edef#1{\fpeval{round(#2,6)}}} |
| 368 |
\def\SinOf#1to#2{\edef#2{\fpeval{round(sind#1,6)}}}\relax |
| 369 |
\def\CosOf#1to#2{\edef#2{\fpeval{round(cosd#1,6)}}}\relax |
| 370 |
\def\ArgOfVect#1to#2{\GetCoord(#1){\t@X}{\t@Y}% |
| 371 |
\fptest{\t@X=\z@&&\t@Y=\z@}{\edef#2{0}% |
| 372 |
\PackageWarning{curve2e}{Null vector}{% |
| 373 |
Check your data\MessageBreak |
| 374 |
Computations go on, but the results may be meaningless}% |
| 375 |
}{\edef#2{\fpeval{round(atand(\t@Y,\t@X),6)}}}% |
| 376 |
\ignorespaces} |
| 377 |
\def\MakeVectorFrom#1#2to#3{\edef#3{#1,#2}}% |
| 378 |
\def\CopyVect#1to#2{\edef#2{#1}\ignorespaces}% |
| 379 |
\def\ModOfVect#1to#2{\GetCoord(#1)\t@X\t@Y |
| 380 |
\edef#2{\fpeval{round(sqrt(\t@X*\t@X + \t@Y*\t@Y),6)}}\ignorespaces}% |
| 381 |
\def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y |
| 382 |
\ModOfVect#1to\@tempa |
| 383 |
\fptestF{\@tempa=\z@}{% |
| 384 |
\edef\t@X{\fpeval{round(\t@X/\@tempa,6)}}% |
| 385 |
\edef\t@Y{\fpeval{round(\t@Y/\@tempa,6)}}% |
| 386 |
}\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% |
| 387 |
\def\ModAndDirOfVect#1to#2and#3{% |
| 388 |
\ModOfVect#1to#2% |
| 389 |
\DirOfVect#1to#3\ignorespaces}% |
| 390 |
\def\DistanceAndDirOfVect#1minus#2to#3and#4{% |
| 391 |
\SubVect#2from#1to\@tempa |
| 392 |
\ModAndDirOfVect\@tempa to#3and#4\ignorespaces}% |
| 393 |
\def\XpartOfVect#1to#2{\GetCoord(#1)#2\@tempa\ignorespaces}% |
| 394 |
\def\YpartOfVect#1to#2{\GetCoord(#1)\@tempa#2\ignorespaces}% |
| 395 |
\def\DirFromAngle#1to#2{% |
| 396 |
\edef\t@X{\fpeval{round(cosd#1,6)}}% |
| 397 |
\edef\t@Y{\fpeval{round(sind#1,6)}}% |
| 398 |
\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% |
| 399 |
\def\ScaleVect#1by#2to#3{\GetCoord(#1)\t@X\t@Y |
| 400 |
\edef\t@X{\fpeval{#2 * \t@X}}% |
| 401 |
\edef\t@Y{\fpeval{#2 * \t@Y}}% |
| 402 |
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% |
| 403 |
\def\ConjVect#1to#2{\GetCoord(#1)\t@X\t@Y |
| 404 |
\edef\t@Y{-\t@Y}\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% |
| 405 |
\def\AddVect#1and#2to#3{\GetCoord(#1)\tu@X\tu@Y |
| 406 |
\GetCoord(#2)\td@X\td@Y |
| 407 |
\edef\t@X{\fpeval{\tu@X + \td@X}}% |
| 408 |
\edef\t@Y{\fpeval{\tu@Y + \td@Y}}% |
| 409 |
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% |
| 410 |
\def\SubVect#1from#2to#3{\GetCoord(#1)\tu@X\tu@Y |
| 411 |
\GetCoord(#2)\td@X\td@Y |
| 412 |
\edef\t@X{\fpeval{\td@X - \tu@X}}% |
| 413 |
\edef\t@Y{\fpeval{\td@Y - \tu@Y}}% |
| 414 |
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% |
| 415 |
\def\ModAndAngleOfVect#1to#2and#3{\ModOfVect#1to#2\relax |
| 416 |
\ArgOfVect#1to#3\ignorespaces} |
| 417 |
\newcount\MV@C |
| 418 |
\NewDocumentCommand\Multvect{m s m s m}% |
| 419 |
{\ModAndAngleOfVect#1to\MV@uM and\MV@uA |
| 420 |
\ModAndAngleOfVect#3to\MV@dM and\MV@dA |
| 421 |
\fptestT{% |
| 422 |
\IfBooleanTF{#2}{1}{0}+\IfBooleanTF{#4}{1}{0}!=0}% |
| 423 |
{\edef\MV@dA{-\MV@dA}}% |
| 424 |
\edef\MV@rM{\fpeval{round((\MV@uM*\MV@dM),6)}}% |
| 425 |
\edef\MV@rA{\fpeval{round((\MV@uA+\MV@dA),6)}}% |
| 426 |
\edef#5{\fpeval{\MV@rM*cosd\MV@rA},\fpeval{\MV@rM*sind\MV@rA}}} |
| 427 |
|
| 428 |
\def\MultVect#1by{\@ifstar{\let\MV@c1\@MultVect#1 by}{\let\MV@c0\@MultVect#1by}} |
| 429 |
|
| 430 |
\def\@MultVect#1by#2to#3{% |
| 431 |
\fptest{\MV@c!=0}{\Multvect{#1}{#2}*{#3}}% |
| 432 |
{\Multvect{#1}{#2}{#3}}% |
| 433 |
}% |
| 434 |
\def\DivVect#1by#2to#3{\Divvect{#1}{#2}{#3}} |
| 435 |
|
| 436 |
\NewDocumentCommand \Divvect{m m m}% |
| 437 |
{\ModOfVect#2to\DV@dD |
| 438 |
\fptest{\DV@dD=0}{\PackageWarning{curve2e}{^^J% |
| 439 |
******************************************^^J% |
| 440 |
Division by zero!^^J% |
| 441 |
Result set to maxdimen in scaled points^^J% |
| 442 |
******************************************^^J}% |
| 443 |
\edef#3{\fpeval{\maxdimen*2**16},0}}% |
| 444 |
{\edef\DV@sF{\fpeval{1/\DV@dD**2}}% |
| 445 |
\Multvect{#2}{\DV@sF,0}{\DV@dD}% |
| 446 |
\Multvect{#1}{\DV@dD}*{#3}}}% |
| 447 |
\def\Arc(#1)(#2)#3{\begingroup |
| 448 |
\edef\tempG{#3}% |
| 449 |
\fptestF{#3=0}{\@Arc(#1)(#2)}}% |
| 450 |
|
| 451 |
\def\@Arc(#1)(#2){% |
| 452 |
\fptest{\tempG>\z@}% |
| 453 |
{\let\Segno+}% |
| 454 |
{\let\Segno-% |
| 455 |
\edef\tempG{\fpeval{abs(\tempG)}}% |
| 456 |
}% |
| 457 |
\fptestT{\tempG>360}{% |
| 458 |
\PackageWarning{curve2e}% |
| 459 |
{The arc aperture is \tempG\space degrees |
| 460 |
and gets reduced^^J% |
| 461 |
to the interval 0--360 taking the sign into |
| 462 |
consideration}% |
| 463 |
\edef\tempG{\Modulo{\tempG}{360}}% |
| 464 |
}% |
| 465 |
\GetCoord(#2)\@pPunX\@pPunY |
| 466 |
\ifCV@polare |
| 467 |
\ModOfVect#2to\@Raggio |
| 468 |
\CopyVect#1to\@Cent |
| 469 |
\AddVect#2and#1to\@pPun% starting point |
| 470 |
\GetCoord(\@pPun)\@pPunX\@pPunY |
| 471 |
\else |
| 472 |
\SubVect#2from#1to\@V |
| 473 |
\ModOfVect\@V to\@Raggio |
| 474 |
\CopyVect#2to\@pPun |
| 475 |
\CopyVect#1to\@Cent |
| 476 |
\GetCoord(\@pPun)\@pPunX\@pPunY |
| 477 |
\fi |
| 478 |
\@@Arc\strokepath\endgroup\ignorespaces}% |
| 479 |
\def\@@Arc{% |
| 480 |
\pIIe@moveto{\@pPunX\unitlength}% |
| 481 |
{\@pPunY\unitlength}% |
| 482 |
\fptestT{\tempG>180}{% |
| 483 |
\edef\tempG{\fpeval{\tempG-180}}% |
| 484 |
\SubVect\@pPun from\@Cent to\@V |
| 485 |
\AddVect\@V and\@Cent to\@sPun |
| 486 |
\Multvect{\@V}{0,-1.3333333}{\@V}% |
| 487 |
\if\Segno-\ScaleVect\@V by-1to\@V\fi |
| 488 |
\AddVect\@pPun and\@V to\@pcPun |
| 489 |
\AddVect\@sPun and\@V to\@scPun |
| 490 |
\GetCoord(\@pcPun)\@pcPunX\@pcPunY |
| 491 |
\GetCoord(\@scPun)\@scPunX\@scPunY |
| 492 |
\GetCoord(\@sPun)\@sPunX\@sPunY |
| 493 |
\pIIe@curveto{\@pcPunX\unitlength}% |
| 494 |
{\@pcPunY\unitlength}% |
| 495 |
{\@scPunX\unitlength}% |
| 496 |
{\@scPunY\unitlength}% |
| 497 |
{\@sPunX\unitlength}% |
| 498 |
{\@sPunY\unitlength}% |
| 499 |
\CopyVect\@sPun to\@pPun}% |
| 500 |
\fptestT{\tempG>0}{% |
| 501 |
\DirFromAngle\tempG to\@Dir |
| 502 |
\if\Segno-\ConjVect\@Dir to\@Dir \fi |
| 503 |
\SubVect\@Cent from\@pPun to\@V |
| 504 |
\Multvect{\@V}{\@Dir}\@V |
| 505 |
\AddVect\@Cent and\@V to\@sPun |
| 506 |
\edef\tempG{\fpeval{\tempG/2}}% |
| 507 |
\DirFromAngle\tempG to\@Phimezzi |
| 508 |
\GetCoord(\@Phimezzi)\@cosphimezzi\@sinphimezzi |
| 509 |
\@tdB=1.3333333\p@ \@tdB=\@Raggio\@tdB |
| 510 |
\@tdC=\p@ \advance\@tdC -\@cosphimezzi\p@ |
| 511 |
\Numero\@tempa\@tdC |
| 512 |
\@tdB=\@tempa\@tdB |
| 513 |
\DividE\@tdB by\@sinphimezzi\p@ to\@cZ |
| 514 |
\ScaleVect\@Phimezzi by\@cZ to\@Phimezzi |
| 515 |
\ConjVect\@Phimezzi to\@mPhimezzi |
| 516 |
\if\Segno-% |
| 517 |
\let\@tempa\@Phimezzi |
| 518 |
\let\@Phimezzi\@mPhimezzi |
| 519 |
\let\@mPhimezzi\@tempa |
| 520 |
\fi |
| 521 |
\SubVect\@sPun from\@pPun to\@V |
| 522 |
\DirOfVect\@V to\@V |
| 523 |
\Multvect{\@Phimezzi}{\@V}\@Phimezzi |
| 524 |
\AddVect\@sPun and\@Phimezzi to\@scPun |
| 525 |
\ScaleVect\@V by-1to\@V |
| 526 |
\Multvect{\@mPhimezzi}{\@V}\@mPhimezzi |
| 527 |
\AddVect\@pPun and\@mPhimezzi to\@pcPun |
| 528 |
\GetCoord(\@pcPun)\@pcPunX\@pcPunY |
| 529 |
\GetCoord(\@scPun)\@scPunX\@scPunY |
| 530 |
\GetCoord(\@sPun)\@sPunX\@sPunY |
| 531 |
\pIIe@curveto{\@pcPunX\unitlength}% |
| 532 |
{\@pcPunY\unitlength}% |
| 533 |
{\@scPunX\unitlength}% |
| 534 |
{\@scPunY\unitlength}% |
| 535 |
{\@sPunX\unitlength}% |
| 536 |
{\@sPunY\unitlength}% |
| 537 |
}}% |
| 538 |
\def\VectorArc(#1)(#2)#3{\begingroup |
| 539 |
\def\tempG{#3}% |
| 540 |
\fptestF{#3=0}{\@VArc(#1)(#2)}}% |
| 541 |
\def\@VArc(#1)(#2){% |
| 542 |
\fptest{\tempG>\z@}% |
| 543 |
{\let\Segno+}% |
| 544 |
{\let\Segno-% |
| 545 |
\edef\tempG{\fpeval{abs(\tempG)}}}% |
| 546 |
\let\@gradi\tempG |
| 547 |
\fptestT{\tempG>360} |
| 548 |
{\PackageWarning{curve2e}% |
| 549 |
{The arc aperture is \tempG\space degrees |
| 550 |
and gets reduced^^J% |
| 551 |
to the range 0--360 taking the sign into |
| 552 |
consideration}% |
| 553 |
\edef\tempG{\Modulo{\tempG}{360}}% |
| 554 |
}% |
| 555 |
\let\@gradi\tempG |
| 556 |
\GetCoord(#2)\@pPunX\@pPunY |
| 557 |
\ifCV@polare |
| 558 |
\ModOfVect#2to\@Raggio \CopyVect#2to\@V |
| 559 |
\CopyVect#1to\@Cent |
| 560 |
\AddVect#2and#1to\@pPun% punto iniziale |
| 561 |
\GetCoord(\@pPun)\@pPunX\@pPunY |
| 562 |
\else |
| 563 |
\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio |
| 564 |
\CopyVect#2to\@pPun |
| 565 |
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY |
| 566 |
\fi |
| 567 |
\@tdE=\pIIe@FAW\@wholewidth \@tdE=\pIIe@FAL\@tdE |
| 568 |
\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi |
| 569 |
\@tdD=\DeltaGradi\p@ |
| 570 |
\@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD |
| 571 |
\@tdD=\ifx\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD |
| 572 |
\DirFromAngle\@tempa to\@Dir |
| 573 |
\Multvect{\@V}{\@Dir}\@sPun |
| 574 |
\edef\@tempA{\ifx\Segno-\m@ne\else\@ne\fi}% |
| 575 |
\Multvect{\@sPun}{0,\@tempA}\@vPun |
| 576 |
\DirOfVect\@vPun to\@Dir |
| 577 |
\AddVect\@sPun and #1 to \@sPun |
| 578 |
\GetCoord(\@sPun)\@tdX\@tdY |
| 579 |
\@tdD\ifx\Segno--\fi\DeltaGradi\p@ |
| 580 |
\@tdD=.5\@tdD \Numero\DeltaGradi\@tdD |
| 581 |
\DirFromAngle\DeltaGradi to\@Dird |
| 582 |
\Multvect{\@Dir}*{\@Dird}\@Dir% |
| 583 |
\GetCoord(\@Dir)\@xnum\@ynum |
| 584 |
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% |
| 585 |
\@tdE =\ifx\Segno--\fi\DeltaGradi\p@ |
| 586 |
\advance\@tdA -\@tdE \Numero\@gradi\@tdA |
| 587 |
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY |
| 588 |
\@@Arc |
| 589 |
\strokepath\endgroup\ignorespaces}% |
| 590 |
\def\VectorARC(#1)(#2)#3{\begingroup |
| 591 |
\def\tempG{#3}% |
| 592 |
\fptestF{#3=0}{\@VARC(#1)(#2)}}% |
| 593 |
\let\VVectorArc\VectorARC% alias |
| 594 |
|
| 595 |
\def\@VARC(#1)(#2){% |
| 596 |
\fptest{\tempG>\z@}% |
| 597 |
{\let\Segno+}% |
| 598 |
{\let\Segno-% |
| 599 |
\edef\tempG{\fpeval{abs(\tempG)}}}% |
| 600 |
\let\@gradi\tempG |
| 601 |
\fptestT{\tempG>360}{% |
| 602 |
\PackageWarning{curve2e}% |
| 603 |
{The arc aperture is \@gradi\space degrees |
| 604 |
and gets reduced\MessageBreak% |
| 605 |
to the range 0--360 taking the sign into |
| 606 |
consideration}% |
| 607 |
\edef\tempG{\Modulo{\tempG}{360}\p@}} |
| 608 |
\@tdA=\tempG\p@ \let\@gradi\tempG |
| 609 |
\GetCoord(#2)\@pPunX\@pPunY |
| 610 |
\ifCV@polare |
| 611 |
\ModOfVect#2to\@Raggio \CopyVect#2to\@V |
| 612 |
\CopyVect#1to\@Cent |
| 613 |
\AddVect#2and#1to\@pPun% punto iniziale |
| 614 |
\GetCoord(\@pPun)\@pPunX\@pPunY |
| 615 |
\else |
| 616 |
\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio |
| 617 |
\CopyVect#2to\@pPun |
| 618 |
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY |
| 619 |
\fi |
| 620 |
\@tdE=\pIIe@FAW\@wholewidth \@tdE=\pIIe@FAL\@tdE |
| 621 |
\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi |
| 622 |
\edef\DeltaGradi{\fpeval{57.29578*\DeltaGradi}} |
| 623 |
\@tdD=\if\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD |
| 624 |
\DirFromAngle\@tempa to\@Dir |
| 625 |
\Multvect{\@V}{\@Dir}\@sPun% correct the end point |
| 626 |
\edef\@tempA{\if\Segno--\fi1}% |
| 627 |
\Multvect{\@sPun}{0,\@tempA}\@vPun |
| 628 |
\DirOfVect\@vPun to\@Dir |
| 629 |
\AddVect\@sPun and #1 to \@sPun |
| 630 |
\GetCoord(\@sPun)\@tdX\@tdY |
| 631 |
\@tdD\if\Segno--\fi\DeltaGradi\p@ |
| 632 |
\@tdD=.5\@tdD \Numero\@tempB\@tdD |
| 633 |
\DirFromAngle\@tempB to\@Dird |
| 634 |
\Multvect{\@Dir}*{\@Dird}\@Dir |
| 635 |
\GetCoord(\@Dir)\@xnum\@ynum |
| 636 |
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrow tip |
| 637 |
\@tdE =\DeltaGradi\p@ |
| 638 |
\advance\@tdA -2\@tdE \Numero\@gradi\@tdA |
| 639 |
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY |
| 640 |
\SubVect\@Cent from\@pPun to \@V |
| 641 |
\edef\@tempa{\if\Segno-\else-\fi\@ne}% |
| 642 |
\Multvect{\@V}{0,\@tempa}\@vPun |
| 643 |
\@tdE\if\Segno--\fi\DeltaGradi\p@ |
| 644 |
\Numero\@tempB{0.5\@tdE}% |
| 645 |
\DirFromAngle\@tempB to\@Dird |
| 646 |
\Multvect{\@vPun}{\@Dird}\@vPun% correct the starting point |
| 647 |
\DirOfVect\@vPun to\@Dir\GetCoord(\@Dir)\@xnum\@ynum |
| 648 |
\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}% starting point arrow tip |
| 649 |
\edef\@tempa{\if\Segno--\fi\DeltaGradi}% |
| 650 |
\DirFromAngle\@tempa to \@Dir |
| 651 |
\SubVect\@Cent from\@pPun to\@V |
| 652 |
\Multvect{\@V}{\@Dir}\@V |
| 653 |
\AddVect\@Cent and\@V to\@pPun |
| 654 |
\GetCoord(\@pPun)\@pPunX\@pPunY |
| 655 |
\@@Arc |
| 656 |
\strokepath\endgroup\ignorespaces}% |
| 657 |
|
| 658 |
\def\CurveBetween#1and#2WithDirs#3and#4{% |
| 659 |
\StartCurveAt#1WithDir{#3}\relax |
| 660 |
\CurveTo#2WithDir{#4}\CurveFinish\ignorespaces |
| 661 |
}% |
| 662 |
\def\StartCurveAt#1WithDir#2{% |
| 663 |
\begingroup |
| 664 |
\GetCoord(#1)\@tempa\@tempb |
| 665 |
\CopyVect\@tempa,\@tempb to\@Pzero |
| 666 |
\pIIe@moveto{\@tempa\unitlength}{\@tempb\unitlength}% |
| 667 |
\GetCoord(#2)\@tempa\@tempb |
| 668 |
\CopyVect\@tempa,\@tempb to\@Dzero |
| 669 |
\DirOfVect\@Dzero to\@Dzero |
| 670 |
\ignorespaces} |
| 671 |
\def\ChangeDir<#1>{% |
| 672 |
\GetCoord(#1)\@tempa\@tempb |
| 673 |
\CopyVect\@tempa,\@tempb to\@Dzero |
| 674 |
\DirOfVect\@Dzero to\@Dzero |
| 675 |
\ignorespaces} |
| 676 |
\def\CurveFinish{\strokepath\endgroup\ignorespaces} |
| 677 |
\def\FillCurve{\fillpath\endgroup\ignorespaces} |
| 678 |
\def\CurveEnd{\fillstroke\endgroup\ignorespaces} |
| 679 |
\def\CbezierTo#1WithDir#2AndDists#3And#4{% |
| 680 |
\GetCoord(#1)\@tX\@tY \MakeVectorFrom\@tX\@tY to\@Puno |
| 681 |
\GetCoord(#2)\@tX\@tY \MakeVectorFrom\@tX\@tY to \@Duno |
| 682 |
\DirOfVect\@Duno to\@Duno |
| 683 |
\ScaleVect\@Dzero by#3to\@Czero \AddVect\@Pzero and\@Czero to\@Czero |
| 684 |
\ScaleVect\@Duno by-#4to \@Cuno \AddVect\@Puno and\@Cuno to \@Cuno |
| 685 |
\GetCoord(\@Czero)\@XCzero\@YCzero |
| 686 |
\GetCoord(\@Cuno)\@XCuno\@YCuno |
| 687 |
\GetCoord(\@Puno)\@XPuno\@YPuno |
| 688 |
\pIIe@curveto{\@XCzero\unitlength}{\@YCzero\unitlength}% |
| 689 |
{\@XCuno\unitlength}% |
| 690 |
{\@YCuno\unitlength}% |
| 691 |
{\@XPuno\unitlength}% |
| 692 |
{\@YPuno\unitlength}% |
| 693 |
\CopyVect\@Puno to\@Pzero |
| 694 |
\CopyVect\@Duno to\@Dzero |
| 695 |
\ignorespaces}% |
| 696 |
\def\CbezierBetween#1And#2WithDirs#3And#4UsingDists#5And#6{\StartCurveAt#1WithDir{#3}\relax |
| 697 |
\CbezierTo#2WithDir#4AndDists#5And{#6}\CurveFinish} |
| 698 |
|
| 699 |
\def\@isTension#1;#2!!{\def\@tempA{#1}% |
| 700 |
\def\@tempB{#2}\unless\ifx\@tempB\empty \strip@semicolon#2\fi} |
| 701 |
|
| 702 |
\def\strip@semicolon#1;{\def\@tempB{#1}} |
| 703 |
\def\CurveTo#1WithDir#2{% |
| 704 |
\def\@Tuno{1}\def\@Tzero{1}\relax |
| 705 |
\edef\@Puno{#1}\@isTension#2;!!% |
| 706 |
\expandafter\DirOfVect\@tempA to\@Duno |
| 707 |
\bgroup\unless\ifx\@tempB\empty\GetCoord(\@tempB)\@Tzero\@Tuno\fi |
| 708 |
\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord |
| 709 |
\Multvect{\@Dzero}*{\@DirChord}\@Dpzero |
| 710 |
\Multvect{\@Duno}*{\@DirChord}\@Dpuno |
| 711 |
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero |
| 712 |
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno |
| 713 |
\DivideFN\@Chord by2 to\@semichord |
| 714 |
\fptest{abs(\@DYpuno)<=0.01&& abs(\@DYpzero)<=0.01} |
| 715 |
{\GetCoord(\@Puno)\@tX\@tY |
| 716 |
\pIIe@lineto{\@tX\unitlength}% |
| 717 |
{\@tY\unitlength}% |
| 718 |
}{% |
| 719 |
\fptestT{abs(\@DXpzero)<=0.01}% |
| 720 |
{\@tdA=1.333333\p@ |
| 721 |
\Numero\@KCzero{\@semichord\@tdA}}% |
| 722 |
\fptestT{abs(\@DYpzero)<=0.01}% |
| 723 |
{\@tdA=1.333333\p@ |
| 724 |
\Numero\@Kpzero{\@semichord\@tdA}}% |
| 725 |
\unless\ifdim\@DXpzero\p@=\z@ |
| 726 |
\unless\ifdim\@DYpzero\p@=\z@ |
| 727 |
\edef\@CosDzero{\ifdim\@DXpzero\p@<\z@ -\fi\@DXpzero}% |
| 728 |
\edef\@SinDzero{\ifdim\@DYpzero\p@<\z@ -\fi\@DYpzero}% |
| 729 |
\@tdA=\@semichord\p@ \@tdA=1.333333\@tdA |
| 730 |
\DividE\@tdA by\@SinDzero\p@ to \@KCzero |
| 731 |
\@tdA=\dimexpr(\p@-\@CosDzero\p@)\relax |
| 732 |
\DividE\@KCzero\@tdA by\@SinDzero\p@ to \@KCzero |
| 733 |
\fi |
| 734 |
\fi |
| 735 |
\MultiplyFN\@KCzero by \@Tzero to \@KCzero |
| 736 |
\ScaleVect\@Dzero by\@KCzero to\@CPzero |
| 737 |
\AddVect\@Pzero and\@CPzero to\@CPzero |
| 738 |
\ifdim\@DXpuno\p@=\z@ |
| 739 |
\@tdA=-1.333333\p@ |
| 740 |
\Numero\@KCuno{\@semichord\@tdA}% |
| 741 |
\fi |
| 742 |
\ifdim\@DYpuno\p@=\z@ |
| 743 |
\@tdA=-1.333333\p@ |
| 744 |
\Numero\@KCuno{\@semichord\@tdA}% |
| 745 |
\fi |
| 746 |
\unless\ifdim\@DXpuno\p@=\z@ |
| 747 |
\unless\ifdim\@DYpuno\p@=\z@ |
| 748 |
\edef\@CosDuno{\ifdim\@DXpuno\p@<\z@ -\fi\@DXpuno}% |
| 749 |
\edef\@SinDuno{\ifdim\@DYpuno\p@<\z@ -\fi\@DYpuno}% |
| 750 |
\@tdA=\@semichord\p@ \@tdA=-1.333333\@tdA |
| 751 |
\DividE\@tdA by \@SinDuno\p@ to \@KCuno |
| 752 |
\@tdA=\dimexpr(\p@-\@CosDuno\p@)\relax |
| 753 |
\DividE\@KCuno\@tdA by\@SinDuno\p@ to \@KCuno |
| 754 |
\fi |
| 755 |
\fi |
| 756 |
\MultiplyFN\@KCuno by \@Tuno to \@KCuno |
| 757 |
\ScaleVect\@Duno by\@KCuno to\@CPuno |
| 758 |
\AddVect\@Puno and\@CPuno to\@CPuno |
| 759 |
\GetCoord(\@Puno)\@XPuno\@YPuno |
| 760 |
\GetCoord(\@CPzero)\@XCPzero\@YCPzero |
| 761 |
\GetCoord(\@CPuno)\@XCPuno\@YCPuno |
| 762 |
\pIIe@curveto{\@XCPzero\unitlength}% |
| 763 |
{\@YCPzero\unitlength}% |
| 764 |
{\@XCPuno\unitlength}% |
| 765 |
{\@YCPuno\unitlength}% |
| 766 |
{\@XPuno\unitlength}% |
| 767 |
{\@YPuno\unitlength}}\egroup |
| 768 |
\CopyVect\@Puno to\@Pzero |
| 769 |
\CopyVect\@Duno to\@Dzero |
| 770 |
\ignorespaces}% |
| 771 |
\def\Curve{\@killglue\@ifstar{\let\fillstroke\fillpath\Curve@}% |
| 772 |
{\let\fillstroke\strokepath\Curve@}} |
| 773 |
|
| 774 |
\def\Curve@(#1)<#2>{% |
| 775 |
\StartCurveAt#1WithDir{#2}% |
| 776 |
\@ifnextchar\lp@r\@Curve{% |
| 777 |
\PackageWarning{curve2e}{% |
| 778 |
Curve specifications must contain at least |
| 779 |
two nodes!^^J |
| 780 |
Please, control your \string\Curve\space |
| 781 |
specifications^^J}}} |
| 782 |
|
| 783 |
\def\@Curve(#1)<#2>{% |
| 784 |
\CurveTo#1WithDir{#2}% |
| 785 |
\@ifnextchar\lp@r\@Curve{% |
| 786 |
\@ifnextchar[\@ChangeDir\CurveEnd}} |
| 787 |
\def\@ChangeDir[#1]{\ChangeDir<#1>\@Curve} |
| 788 |
\def\Qurve{% |
| 789 |
\@ifstar{\let\fillstroke\fillpath\Qurve@}% |
| 790 |
{\let\fillstroke\strokepath\Qurve@}% |
| 791 |
}% |
| 792 |
|
| 793 |
\def\Qurve@(#1)<#2>{% |
| 794 |
\StartCurveAt#1WithDir{#2}% |
| 795 |
\@ifnextchar\lp@r\@Qurve{% |
| 796 |
\PackageWarning{curve2e}{% |
| 797 |
Quadratic curve specifications must contain |
| 798 |
at least two nodes!^^J |
| 799 |
Please, control your Qurve |
| 800 |
specifications^^J}}}% |
| 801 |
|
| 802 |
\def\@Qurve(#1)<#2>{\QurveTo#1WithDir{#2}% |
| 803 |
\@ifnextchar\lp@r\@Qurve{% |
| 804 |
\@ifnextchar[\@ChangeQDir\CurveEnd}}% |
| 805 |
|
| 806 |
\def\@ChangeQDir[#1]{\ChangeDir<#1>\@Qurve}% |
| 807 |
\def\QurveTo#1WithDir#2{% |
| 808 |
\edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup |
| 809 |
\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord |
| 810 |
\Multvect{\@Dzero}*{\@Duno}\@Scalar |
| 811 |
\YpartOfVect\@Scalar to \@YScalar |
| 812 |
\ifdim\@YScalar\p@=\z@ |
| 813 |
\PackageWarning{curve2e}% |
| 814 |
{Quadratic Bezier arcs cannot have their |
| 815 |
starting^^J |
| 816 |
and ending directions parallel or antiparallel |
| 817 |
with each other.^^J |
| 818 |
This arc is skipped and replaced with |
| 819 |
a dotted line.^^J}% |
| 820 |
\Dotline(\@Pzero)(\@Puno){2}\relax |
| 821 |
\else |
| 822 |
\Multvect{\@Dzero}*{\@DirChord}\@Dpzero |
| 823 |
\Multvect{\@Duno}*{\@DirChord}\@Dpuno |
| 824 |
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero |
| 825 |
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno |
| 826 |
\MultiplyFN\@DXpzero by\@DXpuno to\@XXD |
| 827 |
\MultiplyFN\@DYpzero by\@DYpuno to\@YYD |
| 828 |
\unless\ifdim\@YYD\p@<\z@\ifdim\@XXD\p@<\z@ |
| 829 |
\PackageWarning{curve2e}% |
| 830 |
{Quadratic Bezier arcs cannot have |
| 831 |
inflection points^^J |
| 832 |
Therefore the tangents to the |
| 833 |
starting and ending arc^^J |
| 834 |
points cannot be directed to the |
| 835 |
same half plane.^^J |
| 836 |
This arc is skipped and replaced by |
| 837 |
a dotted line^^J}% |
| 838 |
\Dotline(\@Pzero)(\@Puno){2}\fi |
| 839 |
\else |
| 840 |
\edef\@CDzero{\@DXpzero}\relax |
| 841 |
\edef\@SDzero{\@DYpzero}\relax |
| 842 |
\edef\@CDuno{\@DXpuno}\relax |
| 843 |
\edef\@SDuno{\@DYpuno}\relax |
| 844 |
\MultiplY\@SDzero by\@CDuno to\@tempA |
| 845 |
\MultiplY\@SDuno by\@CDzero to\@tempB |
| 846 |
\edef\@tempA{\strip@pt\dimexpr\@tempA\p@-\@tempB\p@}\relax |
| 847 |
\@tdA=\@SDuno\p@ \@tdB=\@Chord\p@ \@tdC=\@tempA\p@ |
| 848 |
\edef\@tempC{\strip@pt\dimexpr \@tdA*\@tdB/\@tdC}\relax |
| 849 |
\MultiplY\@tempC by\@CDzero to \@XC |
| 850 |
\MultiplY\@tempC by\@SDzero to \@YC |
| 851 |
\ModOfVect\@XC,\@YC to\@KC |
| 852 |
\ScaleVect\@Dzero by\@KC to\@CP |
| 853 |
\AddVect\@Pzero and\@CP to\@CP |
| 854 |
\GetCoord(\@Pzero)\@XPzero\@YPzero |
| 855 |
\GetCoord(\@Puno)\@XPuno\@YPuno |
| 856 |
\GetCoord(\@CP)\@XCP\@YCP |
| 857 |
\@ovxx=\@XPzero\unitlength \@ovyy=\@YPzero\unitlength |
| 858 |
\@ovdx=\@XCP\unitlength \@ovdy=\@YCP\unitlength |
| 859 |
\@xdim=\@XPuno\unitlength \@ydim=\@YPuno\unitlength |
| 860 |
\pIIe@bezier@QtoC\@ovxx\@ovdx\@ovro |
| 861 |
\pIIe@bezier@QtoC\@ovyy\@ovdy\@ovri |
| 862 |
\pIIe@bezier@QtoC\@xdim\@ovdx\@clnwd |
| 863 |
\pIIe@bezier@QtoC\@ydim\@ovdy\@clnht |
| 864 |
\pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim |
| 865 |
\fi\fi\egroup |
| 866 |
\CopyVect\@Puno to\@Pzero |
| 867 |
\CopyVect\@Duno to\@Dzero |
| 868 |
\ignorespaces} |
| 869 |
|
| 870 |
%% |
| 871 |
%% Distributable under the LaTeX Project Public |
| 872 |
%% License, version 1.3c or higher (your choice). |
| 873 |
%% The latest version of this license is at: |
| 874 |
%% http://www.latex-project.org/lppl.txt |
| 875 |
%% |
| 876 |
%% This work is "maintained" |
| 877 |
%% |
| 878 |
%% This work consists of file curve2e.dtx, and the |
| 879 |
%% derived files curve2e.sty and curve2e.pdf, plus |
| 880 |
%% the auxiliary derived files README.txt and |
| 881 |
%% curve2e-v161.sty. |
| 882 |
%% |
| 883 |
%% |
| 884 |
%% End of file `curve2e.sty'. |