Generation of a cone
![]() | ![]() |
Cone mesh | Cross section |
download example: cone.edp or return to 3D examples
// example to build a mesh a cone load "msh3" load "medit" // cone using buildlayers with a triangle real RR=1,HH=1; border Taxe(t=0,HH){x=t;y=0;label=0;}; border Hypo(t=1,0){x=HH*t;y=RR*t;label=1;}; border Vert(t=0,RR){x=HH;y=t;label=2;}; int nn=10; real h= 1./nn; mesh Th2=buildmesh( Taxe(HH*nn)+ Hypo(sqrt(HH*HH+RR*RR)*nn) + Vert(RR*nn) ) ; plot(Th2,wait=1); //medit("circle",ThT); int MaxLayersT=(int(2*pi*RR/h)/4)*4; func zminT = 0; func zmaxT = 2*pi; func fx= y*cos(z);// / max( abs(cos(z) ), abs(sin(z))); func fy= y*sin(z);// / max( abs(cos(z) ), abs(sin(z))); func fz= x; int[int] r1T=[0,0], r2T=[0,0,2,2]; int[int] r4T=[0,2]; mesh3 Th3T=buildlayers(Th2,coef= max(.01,y/max(x/HH,0.4) /RR), MaxLayersT,zbound=[zminT,zmaxT],transfo=[fx,fy,fz],facemerge=1, region=r1T, labelmid=r2T); medit("cone",Th3T,wait=1);