根据下面的代码,我得到了以下图像。有没有办法移除前平面,以便 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));
}