[pstricks] Is there some explanatory text?

Zbigniew Nitecki zbigniew.nitecki at tufts.edu
Tue Nov 11 18:42:27 CET 2008


I'm trying to draw some vector field pictures like those in the  
downloadable example file vectorField.tex, but having a little trouble  
"reverse engineering" the source code.  The following is copied  
verbatim from the first part of that file:
*******************************************************************************************************
\SpecialCoor% importanmt for all examples
\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}{%
       \pstVerb{/x \ia\space def
                /y \ib\space def
                y 0 eq
                  {/ValueTempA 0 def
                   /ValueTempB 0.5 def}
                  {/ValueTempZ 2 1 x x mul y y mul div add sqrt mul def
                   /ValueTempA 1 ValueTempZ div def
                   /ValueTempB x y ValueTempZ mul div def}
                  ifelse}
       \psline(! x ValueTempA sub y ValueTempB sub)
              (! x ValueTempA add y ValueTempB add)}}
\end{pspicture}

\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}{%
       \pstVerb{/x \ia\space def
                /y \ib\space def
                y 0 eq
                  {/ValueTempA 0 def
                   /ValueTempB 0.5 def}
                  {/ValueTempZ 2 1 x x mul y y mul div add sqrt mul def
                   /ValueTempA 1 ValueTempZ div def
                   /ValueTempB x neg y ValueTempZ mul div def}
                  ifelse}
       \psline(! x ValueTempA sub y ValueTempB sub)
              (! x ValueTempA add y ValueTempB add)}}
\end{pspicture}

% From Michael Sharpe
******************************************************************************************************

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, 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  
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)?

Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20081111/5f6e7764/attachment.html 


More information about the PSTricks mailing list