使用 Asymptote 包时,我可以移除 3D 网格的前平面吗?

使用 Asymptote 包时,我可以移除 3D 网格的前平面吗?

根据下面的代码,我得到了以下图像。有没有办法移除前平面,以便 3D 表面真正出现在盒子内部?谢谢。

盒子里的 3d 表面

    settings.render=0;
    import graph3;
    import smoothcontour3;
    import palette;
    import grid3;
    
    size3(10cm, IgnoreAspect);
    
    limits((-3,-3,-3),(3,3,3));
    xaxis3(Label("$x$",0.5),Bounds,InTicks);
    yaxis3(Label("$y$",0.5),Bounds,InTicks);
    zaxis3(Label("$z$",0.5),Bounds,InTicks);
    grid3(XYZgrid, above=true);
    currentprojection=orthographic(0.75,3,1);
    
    real f(real x, real y, real z) {return ((x^2 -x -2)*(y^2 + 2*y)) -z;}
    
    surface s=implicitsurface(f,(-3,-3,-3),(3,-1,3),overlapedges=true);
    s.colors(palette(s.map(zpart),Gradient(rgb(0.24,0.67,0.79)+opacity(0.83), rgb(0.86,0.94,0.96)+opacity(0.83))));
    draw(s,render(merge=true),light=nolight);
    draw((0.5,-1,-3)--(0.5,-1,2.25),red+dashed+linewidth(2));
    surface s=implicitsurface(f,(-3,-1,-3),(3,3,3),overlapedges=true);
    s.colors(palette(s.map(zpart),Gradient(rgb(0.24,0.67,0.79)+opacity(0.83), rgb(0.86,0.94,0.96)+opacity(0.83))));
    draw(s,render(merge=true),light=nolight);

答案1

这是我的解决方法,但我仍然想知道是否有更有效的方法来做到这一点。

settings.render=0;
import graph3;
import smoothcontour3;
import palette;
import grid3;

size3(10cm, IgnoreAspect);

limits((-3,-3,-3),(3,3,3));
xaxis3(Label("$x$",0.5),Bounds,InTicks);
yaxis3(Label("$y$",0.5,align=(10,0,0)),Bounds,NoTicks3);
zaxis3(Label("$z$",0.5),Bounds,InTicks(Label(align=(0.71,-0.71,0))));
grid3(XYZgrid, above=true);
currentprojection=orthographic(0.75,3,1);

real f(real x, real y, real z) {return ((x^2 -x -2)*(y^2 + 2*y)) -z;}

surface s=implicitsurface(f,(-3,-3,-3),(3,-1,3),overlapedges=true);
s.colors(palette(s.map(zpart),Gradient(rgb(0.24,0.67,0.79)+opacity(0.83), rgb(0.86,0.94,0.96)+opacity(0.83))));
draw(s,render(merge=true),light=nolight);
draw((0.5,-1,-3)--(0.5,-1,2.2),rgb(0.87,0.44,0.14)+dashed+linewidth(2));

surface s=implicitsurface(f,(-3,-1,-3),(3,3,3),overlapedges=true);
s.colors(palette(s.map(zpart),Gradient(rgb(0.24,0.67,0.79)+opacity(0.83), rgb(0.86,0.94,0.96)+opacity(0.83))));
draw(s,render(merge=true),light=nolight);

draw((3,-3,3)--(3,3,3));
draw((-3,3,3)--(3,3,3));
draw((3,3,-3)--(3,3,3));
for(int i=-2; i<=2; ++i) {
label("$"+string(i)+"$", (3,i,-3), align=(2,0,0));
}

在此处输入图片描述

相关内容