# [pstricks] 3D surface on non rectangular domain

leon.free at free.fr leon.free at free.fr
Thu Mar 2 16:29:19 CET 2017

Thank you Herbert and Manuel,

I tried both of your solutions.

Manuel, it seems with your new \psSurface* macro you do not have the usual \psSurface behavior: \psSurface* and \psSurface generate the same figure, whether the r parameter is given or not. For instance, with source the code in your message

\psSurface*[
fillcolor=cyan,
%   r=1,
ngrid=.5 .5,incolor=yellow,grid](-1,-1)(1,1){%
Euler x y mul exp }

is the same as with the r=1 line uncommented. Also

\psSurface[
fillcolor=cyan,
%   r=1,
ngrid=.5 .5,incolor=yellow,grid](-1,-1)(1,1){%
Euler x y mul exp }

is the same as

\psSurface[
fillcolor=cyan,
r=1,
ngrid=.5 .5,incolor=yellow,grid](-1,-1)(1,1){%
Euler x y mul exp }

This is fine, but the problem is that the \psSurface (unstarred version without passing the r parameter) draws the surface on a circular domain (and I cannot figure out how is this domain controled)

I then tried Herbert's solution. My objective is to draw a surface of a function f as usual on a rectangular domain (xmin,xmax)X(ymin,ymax), but I also want to draw (on the same figure) the surface of f but only for (x,y) in some spherical domain B (typically a ball with a given radius) using a different color. With Herbert solution, because it translates the origin before drawing the surface for (x,y) \in B, if the surface to be drawn is to coincide exactly with that of f, the function to be plotted after the change of origin (0,0,0) to Neworigin=(ox,oy,0) must be g defined as g(x,y)= f(x+ox,y+oy). Right? If so, here is an example. It seems to me that the surfaces drawn after the change of origin (red and blue) do not exactly overlap with the whole surface of f. Is this the normal behavior? Is there something I do not understand with the change of origin?
elef

----- Mail original -----
De: "Herbert Voss" <Herbert.Voss at FU-Berlin.DE>
À: pstricks at tug.org
Envoyé: Jeudi 2 Mars 2017 09:11:55
Objet: Re: [pstricks] 3D surface on non rectangular domain

Am 01.03.2017 um 21:34 schrieb leon.free at free.fr:
> I did not know about the r parameter for \psSurface* (I could not find it in the pst-solides3d doc). It seems it controls the radius of the domain (ball) on which the surface is drawn. Are there some extra parameters that control the center of the ball? Moreover, when using r=1 how does this interact with the plotting range (xmin,ymin)(xmax,ymax)? Working with your example, the range seems to have no effect on the plot (I even used (0,0)(0,0) instead of (-1,-1)(1,1)).

for  \psSurface* (star version) only r is valid and for
\psSurface only the x-y area.
You can change the origin by using \rput:

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{pst-solides3d}
\begin{document}

\psset{viewpoint=50 30 30 rtp2xyz,Decran=100,lightsrc=viewpoint}
\begin{pspicture}(-5,-4)(6,6)
\psSolid[object=grille,base=-2 2 -2 2,action=draw]%
\axesIIID(0,0,0)(2,2,1)
\psSurface*[
fillcolor=cyan,r=1,
ngrid=.25 .25,incolor=yellow,grid,
algebraic](-1,-1)(1,1){ e^(x*y) }
\psSolid[object=cylindre,r=1,h=2,action=draw,ngrid=1 18]
\psPoint(0,0,1){O}
\psPoint(0,0,3){Z}
\psline{->}(O)(Z)
\uput[r](Z){$z$}
\psPoint(0.5,0.5,0){C}
\psdot[linecolor=red,dotstyle=x,dotscale=2](C)
\end{pspicture}
%
\begin{pspicture}(-5,-4)(6,6)
\psSolid[object=grille,base=-2 2 -2 2,action=draw]%
\axesIIID(0,0,0)(2,2,1)
\psPoint(0.5,0.5,0){Origin}
\rput(Origin){%
\psSurface*[
fillcolor=cyan,r=1,
ngrid=.25 .25,incolor=yellow,grid,
algebraic](-1,-1)(1,1){ e^(x*y) }}
\psSolid[object=cylindre,r=1,h=2,action=draw,ngrid=1 18](0.5,0.5,0)
\psPoint(0,0,1){O}
\psPoint(0,0,3){Z}
\psline{->}(O)(Z)
\uput[r](Z){$z$}
\psPoint(0.5,0.5,0){C}
\psdot[linecolor=red,dotstyle=x,dotscale=2](C)
\end{pspicture}

\end{document}

Herbert

_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.tex
Type: text/x-tex
Size: 1646 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20170302/e1381c18/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.pdf
Type: application/pdf
Size: 167109 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20170302/e1381c18/attachment-0001.pdf>