如何在 Asymptote 中裁剪或确定 3d 中 z 的范围

如何在 Asymptote 中裁剪或确定 3d 中 z 的范围

使用 Asymptote 从下面编写代码并使用 Overleaf 运行代码。

\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage[inline]{asymptote}
\begin{document}
\begin{asy}
    import graph3;
    import three;
    settings.outformat="pdf";
    settings.render=8;
    settings.prc=false;
    size(10cm,0);
    //currentprojection = obliqueX;
    currentprojection =orthographic(4,1,1);

    draw(O -- 5X, L=Label("$x$",position=EndPoint),
    Arrow3(HookHead2, emissive(black)));
    draw(-5X -- O,dashed);
    draw(O -- 5Y, L=Label("$y$",position=EndPoint),
    Arrow3(HookHead2, emissive(black)));
    draw(-5Y -- O,dashed);
    draw(O -- 5Z, L=Label("$z$",position=EndPoint),
    Arrow3(HookHead2, emissive(black)));
    draw(-5Z -- O,dashed);

    draw(circle(c=Z, r=1,normal=Z), blue);
    draw(circle(c=2Z, r=sqrt(2),normal=2Z), blue);
    draw(circle(c=3Z, r=sqrt(3),normal=3Z), blue);
    draw(circle(c=4Z, r=2,normal=4Z), blue);
    
    real f(pair xy) {
    real x = xy.x; real y = xy.y;
    return (x^2+y^2);
    }
    real xmax = 2; real xmin = -xmax;
    real ymax = 2; real ymin = -ymax;
    surface s = surface(f, (xmin,ymin), (xmax,ymax), Spline);
    draw(s, surfacepen=white);
\end{asy}

\end{document}

我得到了下面的图表。

在此处输入图片描述

但我想将最近的图表裁剪成我突出显示的红色图表。

在此处输入图片描述

如何将第一张图片裁剪成第二张图片渐近线

答案1

在不使用裁剪的情况下,我为表面选择了相关的重新参数化;这几乎是这个答案

希望这可以帮助!

在此处输入图片描述

// http://asymptote.ualberta.ca/
import graph3;
//currentprojection=orthographic(3,5,5);
currentprojection=obliqueX(30);
unitsize(1cm);
size(8cm,0);
real a=2.5; // below z=a
triple f(pair M) {
real x = sqrt(a)*(M.x)*cos(M.y);
real y =sqrt(a/2)* (M.x)*sin(M.y);
return (x,y,x^2+2*y^2);
}
real rmax = 1, rmin =0;
real phimax =2*pi, phimin =0;
surface s=surface(f, (rmin,phimin), (rmax,phimax), Spline);
//draw(s, surfacepen=pink,meshpen=brown);
draw(s, surfacepen=yellow+opacity(.8));
real x(real t) {return cos(t);}
real y(real t) {return sin(t);}
real z(real t) {return 1+sin(t)*sin(t);}
path3 g=graph(x,y,z,phimin,phimax,operator ..);
draw(g,red+1.5bp);
path3 hc=circle(O,1,normal=Z);
draw(hc,red+linewidth(1pt));
draw(-1.5*X--2*X,Arrow3());
draw(-1.5*Y--2*Y,Arrow3());
draw(O--4*Z,Arrow3());
label("$x$",2*X,plain.SW);
label("$y$",2*Y,plain.NE);
label("$z$",4*Z,plain.SE);
label(rotate(10)*"$x^2+y^2=1$",1.3X+1.3Y,red);
label("$z=x^2+2y^2$",(-1,0,3),E,red);
dot(3X,white);

相关内容