[pstricks] \psellipse

Denis Girou Denis.Girou at idris.fr
Fri Jan 19 22:09:07 CET 2001


>>>>> "Chris.Sangwin" == Chris Sangwin <sangwinc at for.mat.bham.ac.uk> writes:

    Chris.Sangwin> Can one draw part of an ellipse easily, something of a cross between
    Chris.Sangwin> \psellipse and \psarc?

  Outside Michael answer, I need such functions myself long time ago
(beginning of 1996...) and wrote some versions of them (take care that they
are more restricted than the primitive versions: no arrows, etc.). I remember
that I sent them personally to some people later, but probably not here.


% I - Definition of \PstWedgeEllipse, a generalization of \pswedge for wedges
%     of ellipses (from the code of \pswedge and \psellipse)

\def\PstWedgeEllipse{\def\pst at par{}\pst at object{PstWedgeEllipse}}
\def\PstWedgeEllipse at i(#1){%
\@ifnextchar({\PstWedgeEllipse at ii(#1)}{\PstWedgeEllipse at ii(0,0)(#1)}}
\def\PstWedgeEllipse at ii(#1)(#2)#3#4{%
\begin at ClosedObj
\pst at getangle{#3}\pst at tempa
\pst at getangle{#4}\pst at tempb
\pst at getcoor{#1}\pst at tempc
\pst@@getcoor{#2}%
\def\pst at linetype{1}%
\addto at pscode{%
\pst at tempa \pst at tempb
\pst at coor
\pst at tempc moveto
\ifdim\psk at dimen\p@=\z@\else
\psk at dimen CLW mul dup 3 1 roll
sub 3 1 roll sub exch
\fi
\pst at tempc
\tx at Ellipse
closepath}%
\showpointsfalse
\end at ClosedObj}

% II - Definition of \PstArcEllipse, a generalization of \psarc for arcs
%      of ellipses (from the code of \psarc and \psellipse)
%      But it's simplified, and doesn't support arrows and arcangle
%      by instance...

\def\PstArcEllipse{\def\pst at par{}\pst at object{PstArcEllipse}}
\def\PstArcEllipse at i(#1){%
\@ifnextchar({\PstArcEllipse at ii(#1)}{\PstArcEllipse at ii(0,0)(#1)}}
\def\PstArcEllipse at ii(#1)(#2)#3#4{%
\begin at OpenObj
\pst at getangle{#3}\pst at tempa
\pst at getangle{#4}\pst at tempb
\pst at getcoor{#1}\pst at tempc
\pst@@getcoor{#2}%
\def\pst at linetype{1}%
\addto at pscode{%
\pst at tempa \pst at tempb
\pst at coor
\ifdim\psk at dimen\p@=\z@\else
\psk at dimen CLW mul dup 3 1 roll
sub 3 1 roll sub exch
\fi
\pst at tempc
\tx at Ellipse}%
\showpointsfalse
\end at ClosedObj}

% III - Definition of \PstArcEllipseN, a generalization of \psarcn for arcs
%       of ellipses (from the code of \psarcn and \psellipse)
%       But it's simplified, and doesn't support arrows and arcangle
%       by instance...
%       For that, we must define an ellipse in counter clockwise

\def\PstArcEllipseN{\def\pst at par{}\pst at object{PstArcEllipseN}}
\def\PstArcEllipseN at i(#1){%
\@ifnextchar({\PstArcEllipseN at ii(#1)}{\PstArcEllipseN at ii(0,0)(#1)}}
\def\PstArcEllipseN at ii(#1)(#2)#3#4{%
\begin at OpenObj
\pst at getangle{#3}\pst at tempa
\pst at getangle{#4}\pst at tempb
\pst at getcoor{#1}\pst at tempc
\pst@@getcoor{#2}%
\def\pst at linetype{1}%
\addto at pscode{%
\pst at tempa \pst at tempb
\pst at coor
\ifdim\psk at dimen\p@=\z@\else
\psk at dimen CLW mul dup 3 1 roll
sub 3 1 roll sub exch
\fi
\pst at tempc
%\tx at Ellipse}%
% Just like \tx at Ellipse with arc replace by arcn
\tx at EllipseN}%
\showpointsfalse
\end at ClosedObj}

% Just like \tx at Ellipse with arc replace by arcn
\def\tx at EllipseN{/mtrx CM def T scale 0 0 1 5 3 roll arcn mtrx setmatrix}


    Chris.Sangwin> I'm doing awful things with white \psframes at the moment.  There must be
    Chris.Sangwin> something better?

  You must say more on your needs...


  P.S. As usual (I do not hope that my recurrent remarks will ever change
something!), take care to don't use a "reply" function to an existing message
to send one on a new subject. You break the thread mechanism in the archives:

  3.[pstricks] [Programming] Lens
     Denis Girou (Tue Jan 09 20:57:01 2001)
         Maurice DIAMANTINI (Wed Jan 10 10:29:14 2001)
              Denis Girou (Thu Jan 11 18:44:02 2001)
                  Chris Sangwin (Tue Jan 16 22:13:16 2001)
                  etc.

D.G.



More information about the PSTricks mailing list