Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm discovering the extremely cool pst-solides-3d package.

The code

\documentclass{article}

\usepackage{pstricks}
\usepackage{pst-solides3d}


\begin{document}

    \begin{pspicture}(0,0)(3,5)

    \psset{viewpoint=60 80 30 rtp2xyz,Decran=60,lightsrc=viewpoint}

    \defFunction{g}(u,v){sin(u)*sin(t)}{u}{sin(u)*cos(t)}

    \psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth, base=0 pi 0 pi,fillcolor=yellow!50,incolor=green!50, function=g, ngrid=60 0.4]%

    \end{pspicture}

\end{document}

should generate a drawing of the surface g(u,v), but instead when I compile, I get an error from ghoscript:

$latex test.tex
[...]
Output written on test.dvi (1 page, 5284 bytes).
Transcript written on test.log.
$dvips test.dvi
[...]
$ps2pdf test.ps
Error: /typecheck in --sin--
Operand stack:
   S   --nostringval--   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   1   1   60   --nostringval--   %for_pos_int_continue   1   1   7   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1158/1684(ro)(G)--   --dict:0/20(G)--   --dict:87/200(L)--   --dict:739/1012(L)--   --dict:175/300(L)--   --dict:38/200(L)--   --dict:184/200(L)--   --dict:739/1012(L)--   --dict:14/20(L)--   --dict:2/3(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 359102
GPL Ghostscript RELEASE CANDIDATE 9.00: Unrecoverable error, exit code 1

I can't open the ps file either, and the dvi file is empty.

Where does that terrible error come from ?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

There are two problems in your code:

  1. Your function can either be supplied in algebraic notation or using Reverse Polish Notation (RPN). The latter (RPN) is the default. If you want the former, you need to specify it using \defFunction[algebraic]{..}.... You have supplied it in algebraic notation without that option.

  2. Your function is using parameters u and v to determine each of the coordinates of g. Put differently, (x,y,z) of g is specified in terms of u and v. However, both x(u,v) and z(u,v) in your definition has been defined in terms of u and t instead.

Taking these two points into consideration, you need

\defFunction[algebraic]{g}(u,v){sin(u)*sin(v)}{u}{sin(u)*cos(v)}

pst-solides3d to plot a 3D surface

share|improve this answer
    
Shame on me, thank you! –  Klaus Sep 13 '11 at 9:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.