| 1 |
%% |
| 2 |
%% This is file `ellipse.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ellipse.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2015 |
| 10 |
%% Daan Leijen |
| 11 |
%% |
| 12 |
%% This work may be distributed and/or modified under the |
| 13 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 14 |
%% of this license or (at your option) any later version. |
| 15 |
%% The latest version of this license is in |
| 16 |
%% http://www.latex-project.org/lppl.txt |
| 17 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 18 |
%% version 2003/12/01 or later. |
| 19 |
%% |
| 20 |
%% This work has the LPPL maintenance status "author-maintained". |
| 21 |
%% |
| 22 |
\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 23 |
\ProvidesPackage{ellipse} |
| 24 |
[2004/11/05 v1.0 .dtx ellipse file] |
| 25 |
\RequirePackage{pict2e} |
| 26 |
|
| 27 |
\providecommand*\pIIe@csedef[1]{\expandafter\edef\csname #1\endcsname} |
| 28 |
\newcommand*\pIIe@ellip@csqrt[3]{% |
| 29 |
\@ovxx=#1\relax |
| 30 |
\ifdim\@ovxx<\z@\@ovxx-\@ovxx\fi |
| 31 |
\@ovyy=#2\relax |
| 32 |
\ifdim\@ovyy<\z@\@ovyy-\@ovyy\fi |
| 33 |
\edef\pIIe@csname{@csqrt(\number\@ovxx,\number\@ovyy)}% |
| 34 |
\expandafter\ifx\csname\pIIe@csname\endcsname\relax |
| 35 |
\pIIe@ellip@csqrt@% |
| 36 |
\pIIe@csedef{\pIIe@csname}{\the\dimen@}% |
| 37 |
#3\dimen@ |
| 38 |
\else |
| 39 |
#3\dimexpr\csname\pIIe@csname\endcsname\relax |
| 40 |
\fi |
| 41 |
} |
| 42 |
\newcommand*\pIIe@ellip@csqrt@{% |
| 43 |
\@ovdx\@ovxx |
| 44 |
\advance\@ovdx by \@ovyy |
| 45 |
\[email protected]\@ovdx |
| 46 |
\ifdim\dimen@<\@ovyy\dimen@\@ovyy\fi |
| 47 |
\ifdim\dimen@<\@ovxx\dimen@\@ovxx\fi |
| 48 |
\ifdim\@ovdx<128\p@ |
| 49 |
\edef\@tempa{\strip@pt\@ovxx}% |
| 50 |
\@ovxx\@tempa\@ovxx |
| 51 |
\edef\@tempa{\strip@pt\@ovyy}% |
| 52 |
\@ovyy\@tempa\@ovyy |
| 53 |
\advance\@ovxx by \@ovyy |
| 54 |
\advance\dimen@ by \dimexpr1pt * \@ovxx/\dimen@\relax |
| 55 |
\divide\dimen@ by 2% |
| 56 |
\advance\dimen@ by \dimexpr1pt * \@ovxx/\dimen@\relax |
| 57 |
\divide\dimen@ by 2% |
| 58 |
\fi |
| 59 |
} |
| 60 |
|
| 61 |
\newcommand*\pIIe@atan@{% |
| 62 |
\@tempdima\dimen@ |
| 63 |
\@tempdimb\@tempdima |
| 64 |
\ifdim\@tempdimb<\z@\@tempdimb-\@tempdimb\fi |
| 65 |
\[email protected]\@tempdimb |
| 66 |
\advance\dimen@ 0.2447pt\relax |
| 67 |
\advance\@tempdimb -1pt\relax |
| 68 |
\edef\@tempa{\strip@pt\@tempdimb}% |
| 69 |
\dimen@\@tempa\dimen@ |
| 70 |
\edef\@tempa{\strip@pt\@tempdima}% |
| 71 |
\dimen@\@tempa\dimen@ |
| 72 |
\dimen@-\dimen@ |
| 73 |
\advance\dimen@ 0.7853\@tempdima |
| 74 |
} |
| 75 |
|
| 76 |
\newcommand*\pIIe@atantwo[3]{% |
| 77 |
\edef\pIIe@csname{@atan2(\number\dimexpr#1\relax,\number\dimexpr#2\relax)}% |
| 78 |
\expandafter\ifx\csname\pIIe@csname\endcsname\relax |
| 79 |
\pIIe@atantwo@{#1}{#2}{#3}% |
| 80 |
\pIIe@csedef{\pIIe@csname}{\the\dimexpr#3\relax}% |
| 81 |
\else |
| 82 |
#3\dimexpr\csname\pIIe@csname\endcsname\relax |
| 83 |
\fi |
| 84 |
} |
| 85 |
|
| 86 |
\newcommand*\pIIe@atantwo@[3]{% |
| 87 |
\@tempdima\dimexpr#2\relax |
| 88 |
\@tempdimb\dimexpr#1\relax |
| 89 |
\ifdim\@tempdima=\z@\relax |
| 90 |
\ifdim\@tempdimb>\z@\relax\dimen@90\p@ |
| 91 |
\else\ifdim\@tempdimb<\z@\relax\dimen@-90\p@ |
| 92 |
\else\dimen@0\p@ |
| 93 |
\fi\fi |
| 94 |
\else |
| 95 |
\@tempdimd\z@ |
| 96 |
\ifdim\@tempdima<\z@\relax |
| 97 |
\ifdim\@tempdimb<\z@\relax\@tempdimd-180\p@ |
| 98 |
\else\@tempdimd180\p@ |
| 99 |
\fi |
| 100 |
\fi |
| 101 |
\dimen@\dimexpr1pt * \@tempdimb/\@tempdima\relax |
| 102 |
\@tempdimc\dimen@ |
| 103 |
\ifdim\@tempdimc<\z@\relax\@tempdimc-\@tempdimc\fi |
| 104 |
\ifdim\@tempdimc>\p@\relax |
| 105 |
\dimen@\dimexpr1pt * \@tempdima/\@tempdimb\relax |
| 106 |
\ifdim\dimen@<\z@\relax\def\@tempsign{-}\else\def\@tempsign{}\fi |
| 107 |
\pIIe@atan@ |
| 108 |
\dimen@-\dimen@ |
| 109 |
\advance\dimen@ by \@tempsign1.5707pt\relax |
| 110 |
\else |
| 111 |
\pIIe@atan@ |
| 112 |
\fi |
| 113 |
\[email protected]\dimen@ |
| 114 |
\advance\dimen@ by \@tempdimd |
| 115 |
\fi |
| 116 |
#3\dimen@% |
| 117 |
} |
| 118 |
|
| 119 |
\newcommand*\pIIe@noneto[2]{} |
| 120 |
\newcommand*\pIIe@ellip@sincost@[2]{% |
| 121 |
\CalculateSin{#1}% |
| 122 |
\CalculateCos{#1}% |
| 123 |
\@tempdima\UseSin{#1}\p@ |
| 124 |
\@tempdimb\UseCos{#1}\p@ |
| 125 |
\ifdim\@tempdima=\p@\relax |
| 126 |
\pIIe@csedef{@ellipsin#2}{1}% |
| 127 |
\pIIe@csedef{@ellipcos#2}{0}% |
| 128 |
\else\ifdim\@tempdima=-\p@\relax |
| 129 |
\pIIe@csedef{@ellipsin#2}{-1}% |
| 130 |
\pIIe@csedef{@ellipcos#2}{0}% |
| 131 |
\else |
| 132 |
\@tempdimc\@ellipratio\dimexpr1pt * \@tempdima/\@tempdimb\relax |
| 133 |
%\typeout{ i#2=\the\@tempdimc, sin(#1)=\the\@tempdima}% |
| 134 |
\pIIe@ellip@csqrt{\p@}{\@tempdimc}\@tempdimd |
| 135 |
\ifdim\@tempdimb<\z@\relax\@tempdimd-\@tempdimd\fi |
| 136 |
\pIIe@csedef{@ellipsin#2}{\strip@pt\dimexpr1pt * \@tempdimc/\@tempdimd\relax}% |
| 137 |
\pIIe@csedef{@ellipcos#2}{\strip@pt\dimexpr1pt * \p@/\@tempdimd\relax}% |
| 138 |
\fi\fi |
| 139 |
} |
| 140 |
|
| 141 |
\newcommand*\pIIe@ellip@sincost[2]{% |
| 142 |
%\typeout{ calc sin cos: angles (#1,#2), radii: (\the\@ovro,\the\@ovri)}% |
| 143 |
\edef\@ellipratio{\strip@pt\dimexpr1pt * \@ovro/\@ovri\relax}% |
| 144 |
\pIIe@ellip@sincost@{#1}{one}% |
| 145 |
\pIIe@ellip@sincost@{#2}{two}% |
| 146 |
%\typeout{ sincos(a=#1)=(\@ellipsinone,\@ellipcosone), sincos(a=#2)=(\@ellipsintwo,\@ellipcostwo), }% |
| 147 |
} |
| 148 |
\newcommand*\pIIe@omega[3]{% |
| 149 |
\@tempdima\csname @ellipcos#3\endcsname\@ovro |
| 150 |
\advance\@tempdima by #1\relax |
| 151 |
\@tempdimb\csname @ellipsin#3\endcsname\@ovri |
| 152 |
\advance\@tempdimb by #2\relax |
| 153 |
} |
| 154 |
|
| 155 |
\newcommand*\pIIe@omegai[1]{% |
| 156 |
\@tempdimc\csname @ellipsin#1\endcsname\@ovro |
| 157 |
\@tempdimc-\@tempdimc |
| 158 |
\@tempdimd\csname @ellipcos#1\endcsname\@ovri |
| 159 |
} |
| 160 |
|
| 161 |
\newcommand*\pIIe@ellip@kappa{% |
| 162 |
\@ovyy\@ellipsinone\p@ |
| 163 |
\@ovxx\@ellipcosone\p@ |
| 164 |
\@tempdima\@ellipcostwo\@ovyy |
| 165 |
\@tempdima-\@tempdima |
| 166 |
\advance\@tempdima by \@ellipsintwo\@ovxx |
| 167 |
\@tempdimb\@ellipcostwo\@ovxx |
| 168 |
\advance\@tempdimb by \@ellipsintwo\@ovyy |
| 169 |
\ifdim\@tempdima=\z@\relax |
| 170 |
\edef\@ellipkappa{0}% |
| 171 |
\else |
| 172 |
\dimen@\dimexpr1pt - \@tempdimb\relax |
| 173 |
\dimen@\dimexpr1pt * \dimen@/\@tempdima\relax |
| 174 |
\pIIe@ellip@csqrt{2\p@}{1.73205\dimen@}{\dimen@}% |
| 175 |
\advance\dimen@ by -\p@ |
| 176 |
\divide\dimen@ by 3% |
| 177 |
\edef\@tempa{\strip@pt\@tempdima}% |
| 178 |
\dimen@\@tempa\dimen@ |
| 179 |
\edef\@ellipkappa{\strip@pt\dimen@}% |
| 180 |
\fi |
| 181 |
%\typeout{ calculated kappa: \@ellipkappa}% |
| 182 |
} |
| 183 |
|
| 184 |
\newcommand*\pIIe@elliparc@[5]{% |
| 185 |
%\typeout{elliparc: #1, center: (#2, #3), radius (\the\@ovro, \the\@ovri),angle (#4, #5)}% |
| 186 |
\ifcase #1\relax |
| 187 |
\let\@ellip@startto\pIIe@lineto |
| 188 |
\or \let\@ellip@startto\pIIe@moveto |
| 189 |
\or \let\@ellip@startto\pIIe@noneto% |
| 190 |
\else\PackageWarning{ellipse}{Illegal initial action in \protect\elliparc: % |
| 191 |
must be one of 0 (lineto), 1 (moveto) or 2 (do nothing) but I got: #1}% |
| 192 |
\fi |
| 193 |
\ifdim\@ovro=\z@\relax\@ovri\z@\fi |
| 194 |
\ifdim\@ovri=\z@\relax |
| 195 |
\@ellip@startto{#2}{#3}% |
| 196 |
\else |
| 197 |
\pIIe@ellip@sincost{#4}{#5}% |
| 198 |
\pIIe@elliparc@draw{#2}{#3}% |
| 199 |
\fi |
| 200 |
} |
| 201 |
\newcommand*\pIIe@elliparc@t[5]{% |
| 202 |
\ifcase #1\relax |
| 203 |
\let\@ellip@startto\pIIe@lineto |
| 204 |
\or \let\@ellip@startto\pIIe@moveto |
| 205 |
\or \let\@ellip@startto\pIIe@noneto% |
| 206 |
\else\PackageWarning{ellipse}{Illegal initial action in \protect\elliparc: % |
| 207 |
must be one of 0 (lineto), 1 (moveto) or 2 (do nothing) but I got: #1}% |
| 208 |
\fi |
| 209 |
\ifdim\@ovro=\z@\relax\@ovri\z@\fi |
| 210 |
\ifdim\@ovri=\z@\relax |
| 211 |
\@ellip@startto{#2}{#3}% |
| 212 |
\else |
| 213 |
\CalculateSin{#4}\CalculateCos{#4}% |
| 214 |
\edef\@ellipsinone{\UseSin{#4}}% |
| 215 |
\edef\@ellipcosone{\UseCos{#4}}% |
| 216 |
\CalculateSin{#5}\CalculateCos{#5}% |
| 217 |
\edef\@ellipsintwo{\UseSin{#5}}% |
| 218 |
\edef\@ellipcostwo{\UseCos{#5}}% |
| 219 |
\pIIe@elliparc@draw{#2}{#3}% |
| 220 |
\fi |
| 221 |
} |
| 222 |
\newcommand*\pIIe@elliparc@draw[2]{% |
| 223 |
\pIIe@ellip@kappa% |
| 224 |
\pIIe@omega{#1}{#2}{one}% |
| 225 |
%\typeout{ point one: (\the\@tempdima,\the\@tempdimb)}% |
| 226 |
\@ellip@startto\@tempdima\@tempdimb |
| 227 |
\pIIe@omegai{one}% |
| 228 |
\advance\@tempdima by \@ellipkappa\@tempdimc |
| 229 |
\advance\@tempdimb by \@ellipkappa\@tempdimd |
| 230 |
\pIIe@add@nums\@tempdima\@tempdimb |
| 231 |
%\typeout{ control one: (\the\@tempdima,\the\@tempdimb)}% |
| 232 |
\pIIe@omega{#1}{#2}{two}% |
| 233 |
\pIIe@omegai{two}% |
| 234 |
\@tempdimc\@ellipkappa\@tempdimc |
| 235 |
\@tempdimd\@ellipkappa\@tempdimd |
| 236 |
\@tempdimc-\@tempdimc |
| 237 |
\@tempdimd-\@tempdimd |
| 238 |
\advance\@tempdimc by \@tempdima |
| 239 |
\advance\@tempdimd by \@tempdimb |
| 240 |
\pIIe@add@nums\@tempdimc\@tempdimd |
| 241 |
%\typeout{ control two: (\the\@tempdimc,\the\@tempdimd)}% |
| 242 |
\pIIe@add@CP\@tempdima\@tempdimb |
| 243 |
%\typeout{ point two: (\the\@tempdima,\the\@tempdimb)}% |
| 244 |
\pIIe@addtoGraph\pIIe@curveto@op |
| 245 |
} |
| 246 |
\newcommand*\pIIe@elliparc[7][0]{% |
| 247 |
\@ovro #4\relax |
| 248 |
\@ovri #5\relax |
| 249 |
\iffalse%dim\@ovro=\@ovri |
| 250 |
\pIIe@arc[#1]{#2}{#3}{#4}{#6}{#7} |
| 251 |
\else |
| 252 |
\ifdim \@ovro<\z@ \pIIe@badcircarg\else |
| 253 |
\ifdim \@ovri<\z@ \pIIe@badcircarg\else |
| 254 |
\@arclen #7\p@ \advance\@arclen -#6\p@ |
| 255 |
\ifdim \@arclen<\z@ \def\@tempsign{-}\else\def\@tempsign{}\fi |
| 256 |
\ifdim \@tempsign\@arclen>720\p@ |
| 257 |
\PackageWarning {ellipse}{The arc angle is reduced to -720..720}% |
| 258 |
\@whiledim \@tempsign\@arclen>720\p@ \do {\advance\@arclen-\@tempsign360\p@}% |
| 259 |
\@tempdima #6\p@ \advance\@tempdima \@arclen |
| 260 |
\edef\@angleend{\strip@pt\@tempdima}% |
| 261 |
\pIIe@@elliparc{#1}{#2}{#3}{#6}{\@angleend}% |
| 262 |
\else |
| 263 |
\pIIe@@elliparc{#1}{#2}{#3}{#6}{#7}% |
| 264 |
\fi |
| 265 |
\fi |
| 266 |
\fi |
| 267 |
\fi |
| 268 |
} |
| 269 |
\newcommand*\pIIe@@elliparc[5]{% |
| 270 |
\begingroup |
| 271 |
\ifdim \@tempsign\@arclen>90\p@ |
| 272 |
\divide\@arclen 2% |
| 273 |
\@tempdima #4\p@\advance\@tempdima by \@arclen |
| 274 |
\edef\@anglemid{\strip@pt\@tempdima}% |
| 275 |
\def\@tempa{\pIIe@@elliparc{#1}{#2}{#3}{#4}}% |
| 276 |
\expandafter\@tempa\expandafter{\@anglemid}% |
| 277 |
\def\@tempa{\pIIe@@elliparc{2}{#2}{#3}}% |
| 278 |
\expandafter\@tempa\expandafter{\@anglemid}{#5}% |
| 279 |
\else |
| 280 |
\pIIe@elliparc@{#1}{#2}{#3}{#4}{#5}% |
| 281 |
\fi |
| 282 |
\endgroup |
| 283 |
}% |
| 284 |
|
| 285 |
\newcommand*\pIIeelliparc[7][0]{% |
| 286 |
\@killglue |
| 287 |
\pIIe@elliparc[#1]{#2\unitlength}{#3\unitlength}{#4\unitlength}{#5\unitlength}{#6}{#7}% |
| 288 |
\ignorespaces% |
| 289 |
} |
| 290 |
\ifx\undefined\elliparc\else |
| 291 |
\PackageWarning{ellipse}{\protect\elliparc\space is redefined}% |
| 292 |
\fi |
| 293 |
\let\elliparc\pIIeelliparc |
| 294 |
|
| 295 |
\newcommand*\pIIeearc |
| 296 |
{\@ifstar{\@tempswatrue\pIIe@earc@}{\@tempswafalse\pIIe@earc@}} |
| 297 |
\newcommand*\pIIe@earc@[3][0,360]{\pIIe@earc@@(#1){#2}{#3}} |
| 298 |
\def\pIIe@earc@@(#1,#2)#3#4{% |
| 299 |
\if@tempswa |
| 300 |
\pIIe@moveto\z@\z@ |
| 301 |
\pIIe@elliparc{\z@}{\z@}{#3\unitlength}{#4\unitlength}{#1}{#2}% |
| 302 |
\pIIe@closepath\pIIe@fillGraph |
| 303 |
\else |
| 304 |
\pIIe@elliparc[1]{\z@}{\z@}{#3\unitlength}{#4\unitlength}{#1}{#2}% |
| 305 |
\pIIe@strokeGraph |
| 306 |
\fi} |
| 307 |
\ifx\undefined\earc\else |
| 308 |
\PackageWarning{ellipse}{\protect\earc\space is redefined}% |
| 309 |
\fi |
| 310 |
\let\earc\pIIeearc |
| 311 |
|
| 312 |
\newcommand*\pIIeellipse |
| 313 |
{\@ifstar{\@tempswatrue\pIIe@earc@}{\@tempswafalse\pIIe@earc@}} |
| 314 |
\let\ellipse\pIIeellipse |
| 315 |
|
| 316 |
\endinput |
| 317 |
%% |
| 318 |
%% End of file `ellipse.sty'. |