找回密码
 快速注册
搜索
查看: 34|回复: 1

圆环面凿孔

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2024-3-28 19:14 |阅读模式
canvas.png canvas.png

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
extrusion15.gif

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-3-28 19:35

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:20

Powered by Discuz!

× 快速回复 返回顶部 返回列表