Debian Codegraph @

idp/ball-buildlayer.idp

raw
1 // example to build a mesh a cone
2 func mesh3 BuildBall(real RR,real h,int lab)
3 {
4 border Taxe(t=-RR,RR){x=t;y=0;label=0;}
5 border CC(t=0,pi){x=RR*cos(t);y=RR*sin(t);label=lab;}
6 mesh Th2=buildmesh( Taxe(2*RR/h)+ CC(pi*RR/h) ) ;
7
8 int MaxLayersT=(int(2*pi*RR/h)/4)*4;
9 func zminT = 0;
10 func zmaxT = 2*pi;
11 func fx= y*cos(z);// / max( abs(cos(z) ), abs(sin(z)));
12 func fy= y*sin(z);// / max( abs(cos(z) ), abs(sin(z)));
13 func fz= x;
14 mesh3 Th=buildlayers(Th2,coef= min(max(.01,y/RR*1.3),1.) , MaxLayersT,zbound=[zminT,zmaxT],transfo=[fx,fy,fz],facemerge=1);
15 return Th;
16 }
17 func mesh3 BuildAxiOx(mesh &Th2,real h)
18 {
19 real[int] bb(4);
20 boundingbox(Th2,bb);
21 if(verbosity>4) cout << bb << endl;
22 real RR = bb[3];
23 // cone using buildlayers with a triangle
24 int MaxLayersT=(int(2*pi*RR/h)/4)*4;
25 func zminT = 0;
26 func zmaxT = 2*pi;
27 func fx= y*cos(z);// / max( abs(cos(z) ), abs(sin(z)));
28 func fy= y*sin(z);// / max( abs(cos(z) ), abs(sin(z)));
29 func fz= x;
30 mesh3 Th=buildlayers(Th2,coef= min(max(.01,y/RR*1.3),1.) , MaxLayersT,zbound=[zminT,zmaxT],transfo=[fx,fy,fz],facemerge=1);
31 return Th;
32 }