
나는리브 잎. 지금까지 아래 코드와 이미지가 있습니다. 문제는 한 표면이 그 앞에 있는 표면을 통해(맨 앞 표면을 통해) 매우 약간 튀어나온다는 것입니다. 구부러진 화분처럼 이전 꽃 안에 완전히 중첩되어야 합니다.
settings.outformat="pdf";
settings.prc=false;
settings.render=4;
import graph;
import graph3;
import three;
size(12cm,0);
real rcutoff=.8;
real rinner=1;
real router=2;
currentprojection=orthographic(1,-2,1);
currentlight=(1,-1,0.5);
real f(pair z) {return 1/(1-abs(z)^2);}
// We change variables so that the unit cylinder x^2+y^2<1 gets mapped to the torus.
triple changevariables(triple X)
{
return (
(router+rinner*X.x)*cos(X.z),
(router+rinner*X.x)*sin(X.z),
rinner*X.y
);
}
// g returns the location of a point on a ``paraboloid'' inside the unit cylinder with given angle and radius above the unit disk in the (x,y) plane.
triple g(pair p){
real x=p.x*cos(p.y), y=p.x*sin(p.y);
return (x,y,f((x,y)));
}
triple h(pair p){
return changevariables(g(p));
}
real anglestep=10;
for (int z = 0; z <= 20; ++z) {
draw(
rotate(-anglestep*z,Z)*surface(
h,
(0,0),
(rcutoff,2*pi),Spline
),lightgray+opacity(1)
);
// real zz=f((rcutoff,0));
// triple cent=changevariables((0,0,zz));
// draw(
// rotate(-anglestep,Z)*
// circle(c=cent, r=rcutoff,normal=(-router*sin(zz),router*cos(zz),0)),
// white
// );
}
아마도 마지막 두 표면만 서로 다른 색상으로 그리면 문제가 더욱 명확해질 것입니다.
답변1
이는 베지어 패치를 사용한 표면의 수치적 근사치 때문입니다. 기본적으로 메시는 10개(또는 10x10)입니다. PC에 따라 두 변수와 관련하여 메쉬 수를 독립적으로 늘릴 수 있습니다. 여기서는 마지막 두 개의 최종 표면을 테스트했습니다.
draw(
rotate(-anglestep*z,Z)*surface(
h,
(0,0),
(rcutoff,2*pi),nu=16,nv=10,Spline
),lightgreen+opacity(1)
);
그리고 괜찮은 것 같아요.