如何在 Asymptote 中用圆弧从 3D 路径绘制曲面?

如何在 Asymptote 中用圆弧从 3D 路径绘制曲面?

我正在尝试用

path3 arcT=Arc(O, Tl, Tr);
path3 surfT = (O--arcT--cycle);
draw(surfT);
draw(surface(surfT),red);

但该区域仍然空无一人 曲面工作如图所示,圆弧与原点之间的区域为空 曲面通常如图所示工作,这是怎么回事?如何为圆弧和原点之间的区域着色?

可编译示例

settings.outformat = "pdf";
settings.prc = false;
//settings.render = 0;
defaultpen(fontsize(10pt));
//label("Hello world!");
settings.inlinetex=true;
deletepreamble();
defaultfilename="Kugelintegral";
if(settings.render < 0) settings.render=4;
settings.outformat="";
settings.inlineimage=true;
settings.embed=true;
settings.toolbar=false;
viewportmargin=(2,2);
import three;
usepackage("bm");
size(8cm,0);
unitsize(1cm);
import solids;
import graph3;
import grid3;

currentprojection=perspective(camera=(-5,0,2),up=Y); // perspective(5,2,3);   //orthographic(10,15,3);

pen thickblack = black+0.75;
pen thickgreen = green+0.75;

//Arrow3(TeXHead2, emissive(thickblack)
real axislength = 1;
draw(L=Label("$x$", position=Relative(1.1), align=SW),
O--axislength*X, thickblack, arrow=Arrow3(TeXHead2)); //thickred
draw(L=Label("$y$", position=Relative(1.1), align=E),
O--axislength*Y,thickblack, arrow=Arrow3(TeXHead2)); //thickgreen
draw(L=Label("$z$", position=Relative(1.1), align=N),
O--axislength*Z,thickblack, arrow=Arrow3(TeXHead2)); //thickblue


real r=10;     // r=radius;
real q=0.125pi; //theta
real q_H = q/2;
real f=0.125pi; //phi
real f_H = f/2;
real h = cos(q/2)*r;
//real h=9.8481; // h=altitude section
triple rM=(0,0,h);

real q_ASY = sqrt(q_H^2+f_H^2);

triple M =  r*expi(0,0);
triple T =  r*expi(q_H,pi/2);
triple Tl = r*expi(q_ASY,pi/4);
triple Tr = r*expi(q_ASY,3pi/4);

//limits((0,0,0),1.2*(r,r,r));
dot("$\mathbf{p}_r$",O); 
dot("$M$",M);
dot("$T$",T);

dot("$Tl$",Tl);
dot("$Tr$",Tr);

//path3 arcT=Arc(O,r,180,0,ch,0,Y,50);
path3 arcT=Arc(O, Tl, Tr);
path3 surfT = (O--arcT--cycle);
draw(surfT);
draw(surface(surfT),red);
path3 g=(0,0,0)--(1,0,0)--(1,1,0)--(0,1,0)--cycle; 
draw(surface(g),green); 

答案1

Arc和之间是有区别的arcArc给出了更好的近似值,但会产生大量的贝塞尔曲线,默认值约为 400。 对于常规来说,它似乎太大了surface(path3[]),对于计算表面的法线向量来说,它的值可能太小了。 因此,您有两个解决方案:减少数量或使用arc。 您可以尝试

path3 arcT=Arc(O, Tl, Tr,50);

或者

path3 arcT=arc(O,T1,Tr);

并且你会得到

在此处输入图片描述

相关内容