| 1 |
% |
| 2 |
% see pstricks.tex for license and copyright |
| 3 |
% |
| 4 |
\define@key[psset]{pstricks}{arcsepA}[0]{\pst@getlength{#1}\psk@arcsepA} |
| 5 |
\define@key[psset]{pstricks}{arcsepB}[0]{\pst@getlength{#1}\psk@arcsepB} |
| 6 |
\define@key[psset]{pstricks}{arcsep}[0]{% |
| 7 |
\pst@getlength{#1}\psk@arcsepA\let\psk@arcsepB\psk@arcsepA} |
| 8 |
\psset[pstricks]{arcsep=0} |
| 9 |
\def\tx@ArcArrow{ArcArrow } |
| 10 |
% |
| 11 |
\def\psarc{\pst@object{psarc}} |
| 12 |
\def\psarc@i{\@ifnextchar({\psarc@iii}{\psarc@ii}} |
| 13 |
\def\psarc@ii#1{\addto@par{arrows=#1}\@ifnextchar(\psarc@iii{\psarc@iii(0,0)}} |
| 14 |
\def\psarc@iii(#1)#2#3#4{% |
| 15 |
\pst@getangle{#3}\pst@tempa |
| 16 |
\pst@getangle{#4}\pst@tempb |
| 17 |
\ifx\pst@tempa\pst@tempb |
| 18 |
\else |
| 19 |
\begin@OpenObj |
| 20 |
\pst@@getcoor{#1}% |
| 21 |
\pssetlength\pst@dima{#2}% |
| 22 |
\addto@pscode{\psarc@iv \psarc@v |
| 23 |
\ifPst@variableLW \pst@flattenpath \fi |
| 24 |
}% |
| 25 |
\gdef\psarc@type{0}% |
| 26 |
\showpointsfalse |
| 27 |
\end@OpenObj |
| 28 |
\fi |
| 29 |
} |
| 30 |
% |
| 31 |
\def\psarcOA{\pst@object{psarcOA}}% \psarcOA[..](O)(A){angle1}{angle2} |
| 32 |
\def\psarcOA@i{\@ifnextchar({\psarcOA@iii}{\psarcOA@ii}} |
| 33 |
\def\psarcOA@ii#1{\addto@par{arrows=#1}\@ifnextchar(\psarcOA@iii{\psarcOA@iii(0,0)}} |
| 34 |
\def\psarcOA@iii(#1)(#2)#3#4{% |
| 35 |
\pst@getangle{#3}\pst@tempa |
| 36 |
\pst@getangle{#4}\pst@tempb |
| 37 |
\ifx\pst@tempa\pst@tempb |
| 38 |
\else |
| 39 |
\begin@OpenObj |
| 40 |
\pst@getcoor{#1}\pst@tempA |
| 41 |
\pst@getcoor{#2}\pst@tempB |
| 42 |
\addto@pscode{ |
| 43 |
\pst@tempA 2 copy /y ED /x ED \pst@tempB Pyth2 /r ED |
| 44 |
x y translate |
| 45 |
/c 57.2957 r \tx@Div def |
| 46 |
/angleA |
| 47 |
\pst@tempa |
| 48 |
\psk@arcsepA c mul 2 div |
| 49 |
\ifcase\psarc@type add \or sub \fi def |
| 50 |
/angleB |
| 51 |
\pst@tempb |
| 52 |
\psk@arcsepB c mul 2 div |
| 53 |
\ifcase\psarc@type sub \or add \fi def |
| 54 |
\ifshowpoints\psarc@showpoints\fi |
| 55 |
\ifx\psk@arrowA\@empty |
| 56 |
\ifnum\psk@liftpen=2 |
| 57 |
r angleA \tx@PtoC moveto |
| 58 |
\fi |
| 59 |
\fi |
| 60 |
/angleAtoB angleB angleA gt { true }{ false } ifelse def |
| 61 |
0 0 r |
| 62 |
angleA |
| 63 |
\ifx\psk@arrowA\@empty\else |
| 64 |
{ ArrowA CP } |
| 65 |
r 0 gt \pslbrace |
| 66 |
{ \ifcase\psarc@type add \or sub \fi } \psrbrace\pslbrace |
| 67 |
{ \ifcase\psarc@type sub \or add \fi } \psrbrace ifelse |
| 68 |
% { \ifcase\psarc@type add \or sub \fi } |
| 69 |
\tx@ArcArrow |
| 70 |
% dup AngleA gt AngleAtoB exor { neg } fi |
| 71 |
\fi |
| 72 |
angleB |
| 73 |
\ifx\psk@arrowB\@empty\else |
| 74 |
{ ArrowB } |
| 75 |
r 0 gt \pslbrace |
| 76 |
{ \ifcase\psarc@type sub \or add \fi } \psrbrace\pslbrace |
| 77 |
{ \ifcase\psarc@type add \or sub \fi } \psrbrace ifelse |
| 78 |
% { \ifcase\psarc@type sub \or add \fi } |
| 79 |
\tx@ArcArrow |
| 80 |
dup angleA gt angleAtoB xor { pop angleA } if |
| 81 |
\fi |
| 82 |
\ifcase\psarc@type arc \or arcn \fi |
| 83 |
\ifPst@variableLW \pst@flattenpath \fi |
| 84 |
x neg y neg translate |
| 85 |
}% |
| 86 |
\gdef\psarc@type{0}% |
| 87 |
\showpointsfalse |
| 88 |
\end@OpenObj |
| 89 |
\fi |
| 90 |
} |
| 91 |
\def\psarc@iv{% |
| 92 |
\pst@coor /y ED /x ED |
| 93 |
/r \ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dima \fi def |
| 94 |
/c 57.2957 r \tx@Div def |
| 95 |
/angleA |
| 96 |
\pst@tempa |
| 97 |
\psk@arcsepA c mul 2 div |
| 98 |
\ifcase\psarc@type add \or sub \fi |
| 99 |
def |
| 100 |
/angleB |
| 101 |
\pst@tempb |
| 102 |
\psk@arcsepB c mul 2 div |
| 103 |
\ifcase\psarc@type sub \or add \fi |
| 104 |
def |
| 105 |
\ifshowpoints\psarc@showpoints\fi |
| 106 |
\ifx\psk@arrowA\@empty |
| 107 |
\ifnum\psk@liftpen=2 |
| 108 |
r angleA \tx@PtoC |
| 109 |
y add exch x add exch moveto |
| 110 |
\fi |
| 111 |
\fi} |
| 112 |
% hv ---- 1.10 2005-05-05 ----------------------> hv begin |
| 113 |
\def\psarc@v{% |
| 114 |
/angleAtoB angleB angleA gt { true }{ false } ifelse def |
| 115 |
x y r |
| 116 |
angleA |
| 117 |
\ifx\psk@arrowA\@empty\else |
| 118 |
{ ArrowA CP } |
| 119 |
r 0 gt \pslbrace |
| 120 |
{ \ifcase\psarc@type add \or sub \fi } \psrbrace\pslbrace |
| 121 |
{ \ifcase\psarc@type sub \or add \fi } \psrbrace ifelse |
| 122 |
% { \ifcase\psarc@type add \or sub \fi } |
| 123 |
\tx@ArcArrow |
| 124 |
% dup AngleA gt AngleAtoB exor { neg } fi |
| 125 |
\fi |
| 126 |
angleB |
| 127 |
\ifx\psk@arrowB\@empty\else |
| 128 |
{ ArrowB } |
| 129 |
r 0 gt \pslbrace |
| 130 |
{ \ifcase\psarc@type sub \or add \fi } \psrbrace\pslbrace |
| 131 |
{ \ifcase\psarc@type add \or sub \fi } \psrbrace ifelse |
| 132 |
% { \ifcase\psarc@type sub \or add \fi } |
| 133 |
\tx@ArcArrow |
| 134 |
dup angleA gt angleAtoB xor { pop angleA } if |
| 135 |
\fi |
| 136 |
\ifcase\psarc@type arc \or arcn \fi |
| 137 |
} |
| 138 |
% hv ----- 1.10 2005-05-05 ------------------------> end |
| 139 |
% |
| 140 |
\def\psarc@type{0} |
| 141 |
\def\psarc@showpoints{% |
| 142 |
gsave |
| 143 |
newpath |
| 144 |
x y moveto |
| 145 |
x y r \pst@tempa \pst@tempb |
| 146 |
\ifcase\psarc@type arc \or arcn \fi |
| 147 |
closepath |
| 148 |
CLW 2 div SLW |
| 149 |
[ \psk@dash\space ] 0 setdash stroke |
| 150 |
grestore } |
| 151 |
\def\psarcn{\def\pst@par{}\pst@object{psarcn}} |
| 152 |
\def\psarcn@i{\def\psarc@type{1}\psarc@i} |
| 153 |
% |
| 154 |
\def\psarcAB{\pst@object{psarcAB}}% hv 2008-11-26 |
| 155 |
\def\psarcAB@i{% |
| 156 |
\addbefore@par{psscale=1}% be sure, that it is defined |
| 157 |
\pst@getarrows{% |
| 158 |
\begin@OpenObj% |
| 159 |
\pst@getcoors{}% |
| 160 |
\psarcAB@ii |
| 161 |
}% |
| 162 |
} |
| 163 |
\def\psarcAB@ii{% |
| 164 |
\addto@pscode{ |
| 165 |
/y ED /x ED /yA ED /xA ED /yB ED /xB ED |
| 166 |
/r xB yB x y Pyth2 \psk@psscale\space mul def |
| 167 |
/c 57.2957 r \tx@Div def |
| 168 |
/angleA |
| 169 |
yA y sub xA x sub atan |
| 170 |
\psk@arcsepA c mul 2 div |
| 171 |
\ifcase\psarc@type add \else sub \fi |
| 172 |
def |
| 173 |
/angleB |
| 174 |
yB y sub xB x sub atan |
| 175 |
\psk@arcsepB c mul 2 div |
| 176 |
\ifcase\psarc@type sub \else add \fi |
| 177 |
def |
| 178 |
\ifx\psk@arrowA\@empty |
| 179 |
\ifnum\psk@liftpen=2 |
| 180 |
r angleA \tx@PtoC |
| 181 |
y add exch x add exch moveto |
| 182 |
\fi |
| 183 |
\fi |
| 184 |
\psarc@v}% |
| 185 |
\gdef\psarc@type{0}% |
| 186 |
\showpointsfalse% |
| 187 |
\end@OpenObj% |
| 188 |
} |
| 189 |
\def\psarcnAB{\def\pst@par{}\pst@object{psarcnAB}} |
| 190 |
\def\psarcnAB@i{\def\psarc@type{1}\psarcAB@i} |
| 191 |
% |
| 192 |
%------------------ tvz/DG/hv (2004-05-10) begin -------------------%% |
| 193 |
% from Denis Giroux: http://www.tug.org/pipermail/pstricks/2001/000507.html |
| 194 |
% |
| 195 |
% I - Definition of \psellipticwedge, a generalization of \pswedge for wedges |
| 196 |
% of ellipses (from the code of \pswedge and \psellipse) |
| 197 |
% |
| 198 |
\def\psellipticwedge{\pst@object{psellipticwedge}} |
| 199 |
\def\psellipticwedge@i(#1){% |
| 200 |
\@ifnextchar({\psellipticwedge@ii(#1)}{\psellipticwedge@ii(0,0)(#1)}} |
| 201 |
\def\psellipticwedge@ii(#1)(#2)#3#4{% |
| 202 |
\begin@ClosedObj |
| 203 |
\pst@getangle{#3}\pst@tempa |
| 204 |
\pst@getangle{#4}\pst@tempb |
| 205 |
\pst@getcoor{#1}\pst@tempc |
| 206 |
\pst@@getcoor{#2}% |
| 207 |
\def\pst@linetype{1}% |
| 208 |
\addto@pscode{% |
| 209 |
\pst@coor /ry ED /rx ED |
| 210 |
\ifx\psk@rot\@empty \else \psk@rot\space rotate \fi |
| 211 |
\pst@tempa |
| 212 |
\ifPst@correctAngle |
| 213 |
cvi 90 mod 0 eq { \pst@tempa } |
| 214 |
{ rx abs ry abs sub cvi 0 eq { \pst@tempa }{ rx ry |
| 215 |
\tx@UserCoor exch \pst@tempa tan mul exch atan |
| 216 |
\pst@tempa 180 div 0.5 add floor |
| 217 |
180 mul sub } ifelse } ifelse |
| 218 |
\fi |
| 219 |
\pst@tempb |
| 220 |
\ifPst@correctAngle |
| 221 |
cvi 90 mod 0 eq { \pst@tempb } |
| 222 |
{ rx abs ry abs sub cvi 0 eq { \pst@tempb }{ rx ry |
| 223 |
\tx@UserCoor exch \pst@tempb tan mul exch atan |
| 224 |
\pst@tempb 180 div 0.5 add floor |
| 225 |
180 mul sub } ifelse } ifelse |
| 226 |
\fi |
| 227 |
rx ry |
| 228 |
\pst@tempc moveto |
| 229 |
\ifdim\psk@dimen\p@=\z@\else |
| 230 |
\psk@dimen CLW mul dup 3 1 roll |
| 231 |
sub 3 1 roll sub exch |
| 232 |
\fi |
| 233 |
\pst@tempc |
| 234 |
\tx@Ellipse |
| 235 |
closepath |
| 236 |
}% |
| 237 |
\showpointsfalse |
| 238 |
\end@ClosedObj% |
| 239 |
} |
| 240 |
% |
| 241 |
% Code mainly from "pstricks.tex'' 0.94 beta (TvZ) |
| 242 |
% |
| 243 |
\def\psellipticarcn{\pst@object{psellipticarcn}} |
| 244 |
\def\psellipticarcn@i{\let\if@psarcn\iftrue\psellipticarc@ii} |
| 245 |
% |
| 246 |
\def\psellipticarc{\pst@object{psellipticarc}} |
| 247 |
\def\psellipticarc@i{\let\if@psarcn\iffalse\psellipticarc@ii} |
| 248 |
|
| 249 |
\define@boolkey[psset]{pstricks}[Pst@]{correctAngle}[true]{} |
| 250 |
\psset{correctAngle} |
| 251 |
|
| 252 |
\let\if@psarcn\iffalse |
| 253 |
|
| 254 |
\def\psellipticarc@ii{\pst@getarrows\psellipticarc@iii} |
| 255 |
\def\psellipticarc@iii(#1){% |
| 256 |
\@ifnextchar({\psellipticarc@iv(#1)}{\psellipticarc@iv(0,0)(#1)}} |
| 257 |
\def\psellipticarc@iv(#1)(#2)#3#4{% |
| 258 |
% \addbefore@par{correctAngle=false} |
| 259 |
\pst@getangle{#3}\pst@tempc % start angle |
| 260 |
\pst@getangle{#4}\pst@tempd % end angle |
| 261 |
\ifx\pst@tempc\pst@tempd |
| 262 |
\else % same angles? then do nothing |
| 263 |
\begin@OpenObj |
| 264 |
\pst@getcoor{#1}\pst@tempa % origin |
| 265 |
\pst@getcoor{#2}\pst@tempb % a b |
| 266 |
\addto@pscode{ |
| 267 |
\psellipticarc@definearg \psellipticarc@draw |
| 268 |
\ifPst@variableLW \pst@flattenpath \fi |
| 269 |
\ifshowpoints{} |
| 270 |
gsave |
| 271 |
xOrig yOrig T % set origin to ellipse origin |
| 272 |
\ifx\psk@rot\@empty \else \psk@rot\space rotate \fi |
| 273 |
rx ry scale % now we draw a circle :-) |
| 274 |
1 \pst@tempc % start angle |
| 275 |
\ifPst@correctAngle |
| 276 |
cvi 90 mod 0 eq { \pst@tempc } |
| 277 |
{ rx abs ry abs sub cvi 0 eq { \pst@tempc }{ rx ry |
| 278 |
\tx@UserCoor exch \pst@tempc tan mul exch atan |
| 279 |
\pst@tempc 180 div 0.5 add floor |
| 280 |
180 mul sub } ifelse } ifelse |
| 281 |
\fi |
| 282 |
PtoC moveto |
| 283 |
0 0 lineto |
| 284 |
1 \pst@tempd % end angle |
| 285 |
\ifPst@correctAngle |
| 286 |
cvi 90 mod 0 eq { \pst@tempd } |
| 287 |
{ rx ry \tx@UserCoor exch \pst@tempd tan mul exch atan |
| 288 |
\pst@tempd 180 div .5 add floor 180 mul sub } ifelse |
| 289 |
\fi |
| 290 |
PtoC lineto 0 0 lineto |
| 291 |
closepath |
| 292 |
% \ifcase\psarc@type arc \or arcn \fi |
| 293 |
CLW 3 div \pst@number\psunit div SLW |
| 294 |
[ 1 1 \tx@UserCoor 2 mul ] 0 setdash |
| 295 |
stroke |
| 296 |
grestore |
| 297 |
\fi |
| 298 |
}% |
| 299 |
\showpointsfalse |
| 300 |
\end@OpenObj |
| 301 |
\fi |
| 302 |
} |
| 303 |
\def\psellipticarc@definearg{% |
| 304 |
% \ifx\psk@rot\@empty \else \psk@rot\space rotate \fi |
| 305 |
\pst@tempa /yOrig ED /xOrig ED % Origin |
| 306 |
\pst@tempb % radii. Now adjust: |
| 307 |
\ifdim\psk@dimen\p@=\z@\else |
| 308 |
\psk@dimen CLW mul dup 3 1 roll |
| 309 |
sub 3 1 roll sub exch |
| 310 |
\fi |
| 311 |
/ry ED /rx ED % a b |
| 312 |
/angleA |
| 313 |
/d { \if@psarcn sub \else add \fi } def |
| 314 |
% \pst@tempc |
| 315 |
% the angle in the parameter equation is not proportional to the real angle! |
| 316 |
% phi=atan(b*tan(angle)/a)+floor(angle/180+0.5)*180 |
| 317 |
\pst@tempc |
| 318 |
\ifPst@correctAngle |
| 319 |
cvi 90 mod 0 eq { \pst@tempc } |
| 320 |
{ rx ry \tx@UserCoor exch \pst@tempc tan mul exch atan |
| 321 |
\pst@tempc 180 div .5 add floor 180 mul sub } ifelse |
| 322 |
\fi |
| 323 |
\psk@arcsepA 2 div |
| 324 |
ArcAdjust |
| 325 |
def |
| 326 |
/angleB |
| 327 |
/d { \if@psarcn add \else sub \fi } def |
| 328 |
% \pst@tempd |
| 329 |
\pst@tempd |
| 330 |
\ifPst@correctAngle |
| 331 |
cvi 90 mod 0 eq { \pst@tempd } |
| 332 |
{ rx ry \tx@UserCoor exch \pst@tempd tan mul exch atan |
| 333 |
\pst@tempd 180 div .5 add floor 180 mul sub } ifelse |
| 334 |
\fi |
| 335 |
\psk@arcsepB 2 div ArcAdjust def |
| 336 |
% \ifshowpoints\psellipticarc@showpoints\fi |
| 337 |
\ifx\psk@arrowA\@empty |
| 338 |
\ifnum\psk@liftpen=2 |
| 339 |
angleA cos rx mul xOrig add |
| 340 |
angleA sin ry mul yOrig add |
| 341 |
moveto |
| 342 |
\fi% |
| 343 |
\fi% |
| 344 |
} |
| 345 |
\def\psellipticarc@draw{% |
| 346 |
0 0 1 |
| 347 |
angleA |
| 348 |
\ifx\psk@arrowA\@empty\else |
| 349 |
{ ArrowA CP } |
| 350 |
{ \if@psarcn sub \else add \fi } |
| 351 |
EllipticArcArrow |
| 352 |
\fi |
| 353 |
angleB |
| 354 |
\ifx\psk@arrowB\@empty\else |
| 355 |
{ ArrowB } |
| 356 |
{ \if@psarcn add \else sub \fi } |
| 357 |
EllipticArcArrow |
| 358 |
\fi |
| 359 |
/mtrx CM def |
| 360 |
xOrig yOrig T |
| 361 |
\ifx\psk@rot\@empty \else \psk@rot\space rotate \fi |
| 362 |
rx ry scale |
| 363 |
\pst@ifcustom\else |
| 364 |
0 0 moveto |
| 365 |
exch dup dup % end start start start |
| 366 |
cos exch sin moveto % end start |
| 367 |
exch % start end |
| 368 |
\fi |
| 369 |
%% \if@star 0 0 moveto \fi % for filling |
| 370 |
\if@psarcn arcn \else arc \fi |
| 371 |
%% \if@star 0 0 moveto \fi |
| 372 |
mtrx setmatrix% |
| 373 |
} |
| 374 |
\def\psellipticarc@showpoints{% |
| 375 |
gsave |
| 376 |
/mtrx CM def |
| 377 |
xOrig yOrig T |
| 378 |
rx ry scale |
| 379 |
0 0 moveto |
| 380 |
0 0 1 |
| 381 |
\pst@tempc % start angle |
| 382 |
\ifPst@correctAngle |
| 383 |
cvi 90 mod 0 eq { \pst@tempc } |
| 384 |
{ rx abs ry abs sub cvi 0 eq { \pst@tempc }{ rx ry |
| 385 |
\tx@UserCoor exch \pst@tempc tan mul exch atan |
| 386 |
\pst@tempc 180 div 0.5 add floor |
| 387 |
180 mul sub } ifelse } ifelse |
| 388 |
\fi |
| 389 |
\pst@tempd % end angle |
| 390 |
\ifPst@correctAngle |
| 391 |
cvi 90 mod 0 eq { \pst@tempd } |
| 392 |
{ rx abs ry abs sub cvi 0 eq { \pst@tempd } { rx ry |
| 393 |
\tx@UserCoor exch \pst@tempd tan mul exch atan |
| 394 |
\pst@tempd 180 div 0.5 add floor |
| 395 |
180 mul sub } ifelse } ifelse |
| 396 |
\fi |
| 397 |
\ifcase\psarc@type arc \or arcn \fi |
| 398 |
closepath |
| 399 |
mtrx setmatrix |
| 400 |
CLW 2 div SLW |
| 401 |
[ \psk@dash\space ] 0 setdash |
| 402 |
stroke |
| 403 |
grestore % |
| 404 |
} |