[pstricks] \psSurface in \pst3d-solides

Zbigniew Nitecki zbigniew.nitecki at tufts.edu
Fri Jul 23 15:33:19 CEST 2010


Thanks for the suggestion;  I'll try it later.
But in trying my own workaround I simply got rid of the axesbox,
since I don't rally care about it for this particular picture.  

What I want is to draw the surface z=(x^2-3*y^2)/2
together with two curves, obtained by intersecting the surface with
planes parallel to the coordinate planes xz and yz through the point
(1, 1/2, 1/8);  these have equations

z=(x^2-3/4)/2=0.5*x^2-0.375,
y=0.5

and

z=(1-3*y^2)/2=0.5-1.5*y^2
x=1.

I liked your version of the surface, so I used it.
Initially, since I am more familiar with it, I tried to then draw the curves using \parametricplotThreeD,
but there seems to be some slight difference between the coordinate systems for pst-3dplot and
pst3d-solides, so when I discovered Section 10.11 of the pst3d-solides guide (English), I decided to
try to use the pst3d-solides routines for everything, in particular to fuse objects and take advantage
of the hidden line feature of pst3d-solides.  

I am not entirely clear on the structure of \defFunction, in particular the trailing empty parentheses
when using it for courbe (or parenthesis for courbeR2), nor of the way to put the curve in a plane
not through the origin.  In any case, after fixing what I could, here is my code, patterned as much as
possible on the examples on pp. 165 & 166 of the pst3d-solides guide:
***************************************************************************************************
> % !TEX TS-program = latex
> \listfiles
> \documentclass[11pt]{article}
> \usepackage{pst-solides3d, pst-3dplot, pst-math,pstricks-add}
> \usepackage{pst-3d}
> \begin{document}
> 		\begin{pspicture}(-0.5,-2)(3,3)
> 				\psset{solidmemory}
> 				\psset{lightsrc=50 20 50, viewpoint=15 60 70 rtp2xyz,
> 					Decran=50}
> 
> 				\psSurface[
> 				 fillcolor=gray,
> 				 incolor=green,
> 				 ngrid=0.1 0.1,
> 				 algebraic,
> 				 grid,% comment it out to see meaning of ngrid
> 				action=none,
> 				name=surface,
> 				](-1,-1)(1,1){ (x^2-3*y^2)/2 }
> 
> 			\defFunction[algebraic]{ycurve}(t){0.5-1.5*t^2}{}{}
> 			\psSolid[%
> 				object=courbe,
> 				range=-1.0 1.0,
> 				linecolor=blue, 
> 				linewidth=1.5pt,
> 				function=ycurve,
> 				action=none,
> 				name=ycurve,
> 				]%
> 			\defFunction[algebraic]{xcurve}(t){0.5}{0.5*t^2-0.375} {}
> 			\psSolid[%
> 				object=courbeR2,
> 				range=-1.0 1.0,
> 				linecolor=lightgray, 
> 				linewidth=1.5pt,
> 				function=xcurve,
> 				action=none,
> 				name=xcurve
> 				]%
> 			\psSolid[
> 				object=fusion,
> 				action=draw**,
> 				base=surface ycurve xcurve,
> 				]
> 			\composeSolid
> 				
> 		\end{pspicture}
> \end{document}
*********************************************************************************************************
The resulting error message is
> Error: /stackunderflow in --exch--
> Operand stack:
>    yA
> Execution stack:
>    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3   %oparray_pop   1739   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   299   --nostringval--   %repeat_continue   --nostringval--   --nostringval--   --nostringval--
> Dictionary stack:
>    --dict:1150/1684(ro)(G)--   --dict:0/20(G)--   --dict:80/200(L)--   --dict:778/1012(L)--   --dict:175/300(L)--   --dict:38/200(L)--   --dict:185/200(L)--   --dict:778/1012(L)--   --dict:13/20(L)--   --dict:4/6(L)--
> Current allocation mode is local
> Last OS error: 2
> Current file position is 402256
> GPL Ghostscript 8.70: Unrecoverable error, exit code 1


I cannot figure out where my error is, and if I fix it, I don't know how to move these curves so that they go through the point (1, 1/2, z) instead of the origin.


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/

On Jul 23, 2010, at 9:05, Herbert Voss wrote:

> Am 22.07.2010 19:40, schrieb Zbigniew Nitecki:
>> Thanks for pointing out the need to define ngrid. I used grid to avoid seeing 
>> the gridlines on the surface.
>> Here is a complete code, which draws my version (that evaluates the function for 
>> (0,2)\times(0,1))
>> and then yours (evaluating the function over (-1,1)\times(-1,1). Why do I get 
>> the weird ticks (can I avoid them altogether?)
>> and why does my surface extend out of the box?
> 
> that is a bug. Try this workaround:
> 
> \listfiles
> \documentclass[11pt]{article}
> \usepackage{pst-solides3d,pst-3dplot}
> \makeatletter
> \def\gridIIID at ii(#1,#2)(#3,#4)[#5,#6,#7]{%
>  \pst at killglue%
>  \begingroup%
>  \use at par%
>  \psSolid[object=parallelepiped,
>    intersectiontype=-1,
>    a={#2 #1 sub},b={#4 #3 sub},
>    c={\pst at solides@@Zmax\space \pst at solides@@Zmin\space sub},
>    action=draw](#1 #2 add 2 div,#3 #4 add 2 div,\pst at solides@@Zmax
> \pst at solides@@Zmin add 2 div )%
>  \endgroup
> }
> \makeatother
> 
> \begin{document}
> ....
> \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 --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100723/9d6eded8/attachment-0001.html>


More information about the PSTricks mailing list