[pstricks] Is there some explanatory text?

Herbert Voss Herbert.Voss at FU-Berlin.DE
Tue Nov 11 22:11:55 CET 2008


Zbigniew Nitecki schrieb:

see comments:

> \SpecialCoor				% enable \psline(!...) for PostScript coors
> \begin{pspicture}(-6,-6)(6,6)
>   \psaxes{<->}(0,0)(-6,-6)(6,6)
>   \psset{arrows=->}
>   \multido{\ia=-5+1}{11}{%
>     \multido{\ib=-5+1}{11}{% 	        save all globally for further PS operation
>       \pstVerb{/x \ia\space def       % save TeX variable \ia as x for PS
>                /y \ib\space def       % same for y
>                y 0 eq                 % comp { if true }{ if false } ifelse
>                  {/ValueTempA 0 def   % the true part for y=0
>                   /ValueTempB 0.5 def}
>                  {/ValueTempZ 2 1 x x mul y y mul div add sqrt mul def
>                   /ValueTempA 1 ValueTempZ div def  % the false part for y ne 0
>                   /ValueTempB x y ValueTempZ mul div def}
>                  ifelse}              % end of if ..then.. else..
>       \psline(! x ValueTempA sub y ValueTempB sub)% use the PS coordinates
>              (! x ValueTempA add y ValueTempB add)}}
> \end{pspicture}

> I've tried reading about \pstVerb in TLGC2 (p. 305), and sort of
> understand it, but other bits of calligraphy (or syntax) are a mystery
> to me, like the forward slashes, or even more so the \ifelse at the end,

ifelse (without backslash) defines the end of

comparison { true part} { false part} ifelse

the simple one is

comparison { true part} if

> and I am not quite sure of the logic of the construction.  Am I correct
> that the lines enclosed in braces after \pstVerb define certain
> temporary values in terms of "x" and "y", which themselves are

yes

> identified in the first two lines of the \pstVerb with ia and ib (from
> the multido) respectively?  What is the syntax of the ensuing definition
> of the psline: am I correct that we are putting an arrow centered at
> (x,y) which corresponds to the vector (2 ValueTempA, 2ValueTempB)?

yes


Herbert




More information about the PSTricks mailing list