| 1 |
% |
| 2 |
% see pstricks.tex for license and copyright |
| 3 |
% |
| 4 |
\def\pscircle{\def\pst@par{}\pst@object{pscircle}} |
| 5 |
\def\pscircle@i{\@ifnextchar({\pscircle@do}{\pscircle@do(0,0)}} |
| 6 |
\def\pscircle@do(#1)#2{% |
| 7 |
\if@star{\use@par\qdisk(#1){#2}}% qdisk does not allow |
| 8 |
\else% to use opacity option |
| 9 |
% \addbefore@par{dimen=middle}% 20220109 hv |
| 10 |
\begin@ClosedObj |
| 11 |
\pst@@getcoor{#1}% |
| 12 |
\pssetlength\pst@dimc{#2}% |
| 13 |
\def\pst@linetype{4}% |
| 14 |
\addto@pscode{ |
| 15 |
\pst@coor 2 copy moveto |
| 16 |
\ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimc \fi |
| 17 |
\psk@dimen CLW mul round % prevent rounding errors |
| 18 |
sub |
| 19 |
dup 0 rmoveto |
| 20 |
0 360 arc |
| 21 |
\ifPst@variableLW \pst@flattenpath \fi |
| 22 |
closepath |
| 23 |
}% |
| 24 |
\showpointsfalse |
| 25 |
\end@ClosedObj |
| 26 |
\fi |
| 27 |
\ignorespaces} |
| 28 |
% |
| 29 |
\def\pscircleOA{\def\pst@par{}\pst@object{pscircleOA}}% hv 2008-04-14 |
| 30 |
\def\pscircleOA@i(#1)(#2){% |
| 31 |
% \addbefore@par{dimen=middle}% 20220109 hv |
| 32 |
\begin@ClosedObj |
| 33 |
\pst@getcoor{#1}\pst@tempA |
| 34 |
\pst@@getcoor{#2}% |
| 35 |
\def\pst@linetype{4}% |
| 36 |
\addto@pscode{ |
| 37 |
\pst@tempA % x0 y0 |
| 38 |
2 copy % xO yO xO yO |
| 39 |
\pst@coor % xO yO xO yO xA yA |
| 40 |
Pyth2 % xO yO radius |
| 41 |
\psk@dimen CLW mul sub |
| 42 |
\if@star \tx@SD \else |
| 43 |
0 360 arc |
| 44 |
closepath |
| 45 |
\fi }% |
| 46 |
\showpointsfalse |
| 47 |
\end@ClosedObj |
| 48 |
\ignorespaces} |
| 49 |
% |
| 50 |
\def\qdisk(#1)#2{% |
| 51 |
\def\pst@par{}% |
| 52 |
\begin@SpecialObj |
| 53 |
\pst@@getcoor{#1}% |
| 54 |
\pssetlength\pst@dimg{#2}% |
| 55 |
\addto@pscode{ |
| 56 |
\pst@coor |
| 57 |
\ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimg \fi |
| 58 |
% \pst@number\pst@dimg |
| 59 |
\tx@SD }% |
| 60 |
\end@SpecialObj} |
| 61 |
% |
| 62 |
\define@key[psset]{pstricks}{radius}[0.25cm]{\pst@@getlength{#1}\psk@radius} |
| 63 |
\psset[pstricks]{radius=.25cm} |
| 64 |
% |
| 65 |
\def\psCircle{\pst@object{psCircle}}% same as \pscircle, but uses \psk@radius |
| 66 |
\def\psCircle@i{\@ifnextchar({\psCircle@ii}{\psCircle@ii(0,0)}} |
| 67 |
\def\psCircle@ii(#1){\pscircle@do(#1){\psk@radius}} |
| 68 |
% |
| 69 |
\def\psRing{\def\pst@par{}\pst@object{psRing}}%% hv 20130405 |
| 70 |
\def\psRing@i{\@ifnextchar({\psRing@ii}{\psRing@ii(0,0)}} |
| 71 |
\def\psRing@ii(#1){% |
| 72 |
\pst@@getcoor{#1}% |
| 73 |
\@ifnextchar[{\psRing@iii}{\psRing@iii[0,360]}} |
| 74 |
\def\psRing@iii[#1,#2]#3#4{% origin, inner radius, outer radius |
| 75 |
\begin@ClosedObj |
| 76 |
\pssetlength\pst@dimc{#3}% |
| 77 |
\edef\pst@tempA{\ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimc \fi}% |
| 78 |
\pssetlength\pst@dimd{#4}% |
| 79 |
\edef\pst@tempB{\ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimd \fi}% |
| 80 |
\pst@getangle{#1}\pst@tempa |
| 81 |
\pst@getangle{#2}\pst@tempb |
| 82 |
\def\pst@linetype{4}% |
| 83 |
\addto@pscode{ |
| 84 |
\pst@coor translate |
| 85 |
% \pst@number\pst@dimc \psk@dimen CLW mul sub /InnerRadius ED |
| 86 |
% \pst@number\pst@dimd \psk@dimen CLW mul sub /OuterRadius ED |
| 87 |
\pst@tempA\space \psk@dimen CLW mul sub /InnerRadius ED |
| 88 |
\pst@tempB\space \psk@dimen CLW mul sub /OuterRadius ED |
| 89 |
InnerRadius 0 moveto newpath |
| 90 |
0 0 InnerRadius \pst@tempa\space \pst@tempb\space arc |
| 91 |
OuterRadius \pst@tempb\space PtoC |
| 92 |
\pst@tempb\space \pst@tempa\space sub abs 360 eq { moveto }{ lineto } ifelse % whole circle or not?? |
| 93 |
0 0 OuterRadius \pst@tempb\space \pst@tempa\space arcn |
| 94 |
closepath |
| 95 |
}% |
| 96 |
\showpointsfalse |
| 97 |
\end@ClosedObj |
| 98 |
\ignorespaces} |
| 99 |
% |
| 100 |
\def\pswedge{\def\pst@par{}\pst@object{pswedge}} |
| 101 |
\def\pswedge@i{\@ifnextchar({\pswedge@ii}{\pswedge@ii(0,0)}} |
| 102 |
\def\pswedge@ii(#1)#2#3#4{% |
| 103 |
\begin@ClosedObj |
| 104 |
\pssetlength\pst@dimc{#2}% |
| 105 |
\pst@getangle{#3}\pst@tempa |
| 106 |
\pst@getangle{#4}\pst@tempb |
| 107 |
\pst@@getcoor{#1}% |
| 108 |
\def\pst@linetype{1}% |
| 109 |
\addto@pscode{ |
| 110 |
\ifx\psk@rot\@empty 0 \else \psk@rot \fi rotate |
| 111 |
\pst@coor |
| 112 |
2 copy |
| 113 |
moveto |
| 114 |
\ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimc \fi |
| 115 |
\psk@dimen CLW mul sub % Adjusted radius |
| 116 |
\pst@tempa \pst@tempb |
| 117 |
arc |
| 118 |
closepath}% |
| 119 |
\showpointsfalse |
| 120 |
\end@ClosedObj |
| 121 |
} |
| 122 |
\def\tx@ellipse#1{ \ifx\psk@rot\@empty 0 \else \psk@rot \fi #1 Ellipse } |
| 123 |
\def\tx@Ellipse{ \ifx\psk@rot\@empty 0 \else \psk@rot \fi Ellipse } |
| 124 |
% |
| 125 |
\def\psellipse{\def\pst@par{}\pst@object{psellipse}} |
| 126 |
\def\psellipse@i(#1){\@ifnextchar({\psellipse@ii(#1)}{\psellipse@ii(0,0)(#1)}} |
| 127 |
\def\psellipse@ii(#1)(#2){% |
| 128 |
\begin@ClosedObj |
| 129 |
\pst@getcoor{#1}\pst@tempa |
| 130 |
\pst@@getcoor{#2}% |
| 131 |
\addto@pscode{ |
| 132 |
0 360 |
| 133 |
\pst@coor |
| 134 |
\ifdim\psk@dimen\p@=\z@\else |
| 135 |
\psk@dimen CLW mul |
| 136 |
dup 4 -1 roll sub neg 3 1 roll sub |
| 137 |
\fi |
| 138 |
\pst@tempa |
| 139 |
\tx@ellipse{true} |
| 140 |
\ifPst@variableLW \pst@flattenpath \fi |
| 141 |
closepath |
| 142 |
}% |
| 143 |
\def\pst@linetype{2}% |
| 144 |
\end@ClosedObj% |
| 145 |
} |
| 146 |
\def\psellipseAB{\def\pst@par{}\pst@object{psellipseAB}} |
| 147 |
\def\psellipseAB@i(#1)(#2)#3{% |
| 148 |
\begin@ClosedObj |
| 149 |
\pst@getcoor{#1}\pst@tempa |
| 150 |
\pst@getcoor{#2}\pst@tempb |
| 151 |
\addto@pscode{ |
| 152 |
0 360 |
| 153 |
#3 \pst@number\psxunit mul |
| 154 |
\pst@tempa /yA ED /xA ED |
| 155 |
\pst@tempb /yB ED /xB ED |
| 156 |
xA xB sub dup mul |
| 157 |
yA yB sub dup mul add sqrt 2 div |
| 158 |
\ifdim\psk@dimen\p@=\z@\else |
| 159 |
\psk@dimen CLW mul |
| 160 |
dup 4 -1 roll sub neg 3 1 roll sub |
| 161 |
\fi |
| 162 |
xA xB add 2 div yA yB add 2 div |
| 163 |
translate 0 0 |
| 164 |
xB xA sub yA yB sub atan |
| 165 |
Ellipse % on stack is rotate coordinates |
| 166 |
\ifPst@variableLW \pst@flattenpath \fi |
| 167 |
closepath |
| 168 |
}% |
| 169 |
\def\pst@linetype{2}% |
| 170 |
\end@ClosedObj |
| 171 |
} |