[pstricks] clipping in 3d

Michael Sharpe msharpe at ucsd.edu
Tue Mar 17 18:36:41 CET 2009


On Mar 17, 2009, at 7:50 AM, Zbigniew Nitecki wrote:

> I tried clipping, but there's something I don't understand.  In the  
> example below, I first want to plot the surface
> z=-xy, but only inside the cylinder x^2 +y^2 \leq 2.25.  I used the  
> circle centered at the origin with radius 1.5 as the clipping  
> curve.  Then I plotted what should be the boundary curve for this  
> surface, using \parametricplot3D.
> The output is attached.  Why the discrepancy?
>
> Example based on Herbert's example from 11/24/2008:
>
> 			\begin{pspicture}(-5,-9.5)(5,3)
> 			\psset{unit=2}
> 			\pstThreeDCoor[xMin=-2, xMax=2, yMin=-2,yMax=2, zMin=0, zMax=2]
> 			\begin{psclip}{%
> 				\pstThreeDCircle[linestyle=none](0,0,0)(1.5,0,0)(0,1.5,0)
> 			}
> 				\psplotThreeD[drawStyle=xyLines](-2,2)(-2,2){%
> 					x y mul neg%
> 				}
> 			\end{psclip}
> 			
> 			\parametricplotThreeD[linewidth=1.2pt, xPlotpoints=200](0,360){%
> 				1.5 t cos mul %
> 				1.5 t sin mul %
> 				t cos t sin mul 1.5 mul neg%
> 			}
> 				
> 			\end{pspicture}
Your picture is showing the surface clipped to the projection of the  
circle of radius r=1.5, center (0,0,0) in the x y plane, which is not  
what you really want. The example from last November clips in vertical  
slices perpendicular to the x and y axes. In this particular case, it  
would be easier to avoid clipping, and simply draw the line segment  
from (x,-\sqrt{r^2-x^2},x\sqrt{r^2-x^x}) to (x,\sqrt{r^2-x^2},-x 
\sqrt{r^2-x^x}) for a selection of x values (using multido), then do a  
similar thing for a selection of y.

Michael



More information about the PSTricks mailing list