[pstricks] hyperboloids in pst-solides3d

Zbigniew Nitecki zbigniew.nitecki at tufts.edu
Tue Jul 13 02:52:52 CEST 2010


I did copy directly from the pdf, but I take your point that it didn't copy properly.
My problem is that the hyperboloid I want has different dimensions than the 
example, so I need to understand the syntax of defining it.  While I can follow 
some postscript there are commands here which make no sense to me.
what is /z0?  what does /k exch def mean?
what does idiv mean?
and which part defines the surface, as opposed to defining how it is broken
into faces?
OK, I guess I need to get a good reference for postscript.  Any suggestions?

In trying to parse the code you gave me, I've done some indentation to
the code you gave me.  I presume doing so will not affect the compiling.

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 12, 2010, at 17:37, Michael Sharpe wrote:

> 
> On Jul 12, 2010, at 12:49 PM, Zbigniew Nitecki wrote:
> 
>> I want to draw (in one pspicture) the level surfaces of f(x,y,z)=x^2+y^2-z^2 
>> for the values -1,0, and 1.  
>> 
>> My attempt to do this with \parametricplotThreeD is not so successful:  either I have
>> a collection of lines (and difficulty hiding some) or if I use enough plotpoints, the 
>> inside stuff is totally wiped out.  So I'm trying to see if I can do it more easily in
>> pst-solides3d.
>> 
>> The cone for 0 is easy.  I tried to understand from
>> the example at the end of section 6.6.4, p. 90 in the (English) documentation for
>> pst-solides-3d how to draw a hyperboloid of one sheet in this system, but
>> I need someone to parse for me the function definitions embedded in it.
>> 
>> Here is the code in the example:
>> 
>>> \begin{pspicture*}(-5,-5)(3,5) \psSolid[object=new,fillcolor=red!50,incolor=yellow,
>>> hollow, a=10, %% nb d’etages b=20, %% diviseur de 360, nb de meridiens h=8, %% hauteur action=draw**,sommets=
>>> /z0 h neg 2 div def a-10{
>>> /k exch def 01b1 sub {
>>> /i exch def /r z0 h a div k mul add dup mul 4 div 1 add sqrt def 360 b idiv i mul cos r mul 360 b idiv i mul sin r mul z0 h a div k mul add
>>> } for } for, faces={
>>> 0 1 a 1 sub { /k exch def k b mul 1 add 1 k 1 add b mul 1 sub { /i exch def [i i 1 sub b i add 1 sub b i add]
>>> } for [k b mul k 1 add b mul 1 sub k 2 add b mul 1 sub k 1
>>> add b mul] }for
>>> }] \end{pspicture*}
>> 
>> 
>> 
>> I am having trouble understanding the structure of lines 3-8.
>> 
>> Can anyone explain it for me?  I have (limited) experience with postscript, but none with jps.
> 
> Your source code doesn't agree with the example---there may be a problem here copying from a pdf document. It should read
> 
> \begin{pspicture*}(-5,-5)(3,5) 
> \psSolid[object=new,fillcolor=red!50,incolor=yellow,
> 	hollow, a=10, %% nb d’etages 
> 	b=20, %% diviseur de 360, nb de meridiens 
> 	h=8, %% hauteur 
> action=draw**,
> 	sommets=
> 		/z0 h neg 2 div def a -1 0 {
> 			/k exch def 0 1 b 1 sub {
> 			/i exch def /r z0 h a div k mul add dup mul 4 div 1 add sqrt def 360 b idiv i mul cos r mul 360 b idiv i mul sin r mul z0 h a div k mul add
> 			} for 
> 		} for, 
> 	faces={
> 		0 1 a 1 sub { /k exch def k b mul 1 add 1 k 1 add b mul 1 sub { /i exch def [i i 1 sub b i add 1 sub b i add]
> 			} for [k b mul k 1 add b mul 1 sub k 2 add b mul 1 sub k 1 add
> 				b mul] 
> 			} for
> 		}]
> \end{pspicture*}
> 
> 
> Michael
> 
> 
> _______________________________________________
> 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/20100712/e8c39f7b/attachment.html>


More information about the PSTricks mailing list