[pstricks] multido

Michael Sharpe msharpe at ucsd.edu
Tue Feb 17 23:58:11 CET 2009


It's worthwhile to study the final example posted by Herbert. Clipping  
is a planar construct. It is carried out in each two dimensional  
section. The point of \begin{psclip}<graphics>...\end{psclip} is to  
clip the ... to the border specified by <graphics>. In the first case  
below, the clipping path is a rectangle in the section x=\nA. (More  
correctly, it's a parallelogram in its projection on the viewing  
plane.) Each corner of the rectangle is given in the form of  
coordinates (x,y,z), where each of x, y z is specified in PostScript  
code. This is permissible without using an initial !, unlike 2d  
coordinates. The object (the ...) being clipped to that rectangle is  
the \parametricplotThreeD.

Michael

%Herbert's example from 11/24/2008.
\begin{pspicture}(-1.5,-1.5)(1.5,1.5)
\pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2]
\multido{\nA=-1+.1}{21}{%
\begin{psclip}{%
  \pstThreeDLine[linestyle=none]%
    (\nA, 1 \nA\space dup mul sub sqrt neg,-1)%
    (\nA, 1 \nA\space dup mul sub sqrt neg,-1)%
    (\nA, 1 \nA\space dup mul sub sqrt,1)%
    (\nA, 1 \nA\space dup mul sub sqrt neg,1)%
    (\nA, 1 \nA\space dup mul sub sqrt neg,-1)}%
  \parametricplotThreeD[linecolor=red](-1,1)%
    {\nA\space t \nA\space dup mul t t  mul sub}%
\end{psclip}%
%slices with y fixed---interchange x, y
\begin{psclip}{%
  \pstThreeDLine[linestyle=none]%
    (1 \nA\space dup mul sub sqrt neg,\nA,1)%
    (1 \nA\space dup mul sub sqrt,\nA,-1)%
    (1 \nA\space dup mul sub sqrt,\nA,1)%
    (1 \nA\space dup mul sub sqrt neg,\nA,1)%
    (1 \nA\space dup mul sub sqrt neg,\nA,-1)}
\parametricplotThreeD[linecolor=blue](-1,1)%
  {t \nA\space t t mul  \nA\space dup mul sub}%
\end{psclip}%
}
\end{pspicture}




More information about the PSTricks mailing list