如何画抛物面?

如何画抛物面?

官方图片:

在此处输入图片描述

这是一个渐近线代码:

\documentclass[border=5pt,varwidth]{standalone}
\usepackage{asymptote}

\begin{document}

\begin{asy} 
import graph3;
import palette;
currentprojection=orthographic(3,1,1.5);
currentlight=(1,0.5,1);
settings.render=4;
defaultpen(fontsize(6pt));
real r=2;
unitsize(1cm);
size(10cm,0);
draw(-1.7*r*X--1.7*r*X,red,Arrow3);
draw(-1.5*r*Y--1.5*r*Y,cyan,Arrow3);
draw(O--2.7*r*Z,blue,Arrow3);
label("$x$", 1.7*r*X, dir(-140));
label("$y$", 1.5*r*Y, dir(-20));
label("$z$", 2.7*r*Z, dir(90));
triple S=(0,0,2*r);
path3 c=circle(O,r,Z);
draw(c,heavyblue+opacity(.5));
///////
triple f(pair M) {real x = (M.x)*cos(M.y);real y = (M.x)*sin(M.y);return (x,y,x^2+y^2);}
surface s=surface(f,(0,0),(r,r*pi), Spline);
//////
pen[] pens=mean(palette(s.map(zpart), Gradient(red,yellow,brown)));
draw(s,heavygreen+opacity(0.3),meshpen=black+thin());
real x(real t) {return cos(t);}
real y(real t) {return sqrt(r)*sin(t);}
real z(real t) {return 1+sqrt(r)*sin(t)*sin(t);}
path3 g=graph(x,y,z,0,2*pi,operator ..);
draw(g,brown);
transform3 tv=shift(S);
path3 cv=tv*c;
draw(cv,heavyblue);
shipout(bbox(1mm));
\end{asy}

\end{document}

在此处输入图片描述

这是我的代码:

\documentclass[border=10pt,pstricks]{standalone}
\usepackage{pst-solides3d,pst-3dplot,}

\begin{document}
\psset{unit=.65,viewpoint=40 30 22 rtp2xyz,lightsrc=viewpoint}
\begin{pspicture}(-5,-4)(6,10)

 \axesIIID[linewidth=.5pt](0,0,0)(3,3,6.5)
\defFunction[algebraic]{funkce}(t){sin(t)}{cos(t)}{0}%
\psSolid[object=courbe,linewidth=.4pt,r=0,range=0 2 Pi mul,linecolor=blue,function=funkce]
\defFunction[algebraic]{projection}(t){cos(t)}{1.41*sin(t)}{1+sin(t)*sin(t)*1.41}
\psSolid[plotpoints=1000,object=courbe,linewidth=.3pt,r=0,range=0 2 Pi mul,linecolor=green!80!black,function=projection]
\psSurface[ngrid=.25 .25,incolor=yellow,linewidth=0.5\pslinewidth,algebraic](-2,-1)(2,1){ x^2+2*y^2 }
\end{pspicture}
\end{document}

在此处输入图片描述

我不知道如何将其转换为 PSTricks:

///////
triple f(pair M) {real x = (M.x)*cos(M.y);real y = (M.x)*sin(M.y);return (x,y,x^2+y^2);}
surface s=surface(f,(0,0),(r,r*pi), Spline);
//////

而我在第二个 \psSolid 中看不到任何意义plotstyle=curveplotpoints=...

谁能帮我?

在此处输入图片描述

答案1

\documentclass[border=10pt,pstricks]{standalone}
\usepackage{pst-solides3d}

\begin{document}
\psset{unit=.65,viewpoint=40 30 22 rtp2xyz,lightsrc=viewpoint}
\begin{pspicture}(-5,-4)(6,10)
\defFunction[algebraic]{funkce}(t){sin(t)}{cos(t)}{0}%
\psSolid[object=courbe,linewidth=1pt,r=0,range=0 2 Pi mul,linecolor=blue,function=funkce]
\psSurface*[ngrid=.5 .5,incolor=yellow,linewidth=0.5\pslinewidth](-2,-1)(2,1){
         x dup mul y dup mul add dup 4 gt { pop 4 } if}
\defFunction[algebraic]{projection}(t){cos(t)}{1.41*sin(t)}{1+sin(t)*sin(t)*1.41}
\psSolid[object=courbe,linewidth=1pt,r=0,range=0 2 Pi 
mul,linecolor=red!80!black,function=projection]
\axesIIID[linewidth=.5pt](0,0,3.5)(3,3,6.5)
\end{pspicture}
\end{document}

在此处输入图片描述

相关内容