|
size(200);
import graph3;
real r1 = 1;
real r2 = 0.25;
real ri = 0.1;
bool allow(pair t) {
return hypot(sin(t.x)*(r1+r2*cos(t.y)),r2*sin(t.y))>ri*0.9;
}
bool nearboundary(pair t) {
return hypot(sin(t.x)*(r1+r2*cos(t.y)),r2*sin(t.y))<ri*1.05;
}
triple f(pair t) {
real tx=t.x;
if(t.x<0&&nearboundary(t+(pi/3/100,0))||t.x>0&&nearboundary(t-(pi/3/100,0))){
real x0 = asin(sqrt(ri^2-(r2*sin(t.y))^2)/(r1+r2*cos(t.y)));
if(t.x>=0){
tx=x0;
}else{
tx=-x0;
}
}
return (cos(tx),sin(tx),0)*(r1 + r2*cos(t.y))+ r2*(0,0,sin(t.y));
}
surface s1=surface(f,(-pi/6,0),(pi/6,2pi),100,100,Spline,allow);
material whitem = material(diffusepen=white);
surface s2=surface(s1,shift((r1-r2,0,0))*scale(2r2,ri,ri)*align(X)*unitcylinder);
draw(s2,whitem,opacity(.5),render(merge=true));
需要把一个圆环面和一个圆柱面在交线接合?(上图是不精确的)
类似于 Merging Subdivision Surfaces
|
|