# Mma粉丝分享：全国建模大赛B题椭圆形活动桌面设计

by：银色子弹

Tuoyuan[a_,b_,h_,n_,name_]:= Print[Clear["Global`*"]; l=Table[Null,{i,n}]; L=Table[Null,{i,n}]; For[i=1,i<n+1,i++,l[[i]]=Sqrt[(1-((25-b/n-(2b)/n (i-1))/b)^2)a^2]]; For[i=1,i<n+1,i++,L[[i]]=60-Sqrt[(1-((25-b/n-(2b)/n (i-1))/b)^2)a^2]]; \[Sigma]=ArcSin[h/L[[1]]]; Export[name, Table[ X=Table[Null,{i,n}]; Y=Table[Null,{i,n}]; Z=Table[Null,{i,n}]; DA=Table[Null,{i,n}]; For[i=1,i<n+1,i++,X[[i]]=l[[i]]+(L[[i]]Cos[\[Theta]])/2; Y[[i]]=25-(2b)/n (i-1); Z[[i]]=(-L[[i]]*Sin[\[Theta]])/2]; For[i=1,i<n+1,i++, DA[[i]]=Solve[{z==Z[[1]]/(X[[l]]-l[[i]]) x-(Z[[1]]l[[i]])/(X[[l]]-l[[i]]), (x-l[[i]])^2==(L[[i]])^2,x>=0,z<=0 },{x,z}] ]; Graphics3D[ {capForm[cap],Thickness[.005], Table[Line[{{l[[i]],Y[[i]],0},{x/.DA[[i,1]],Y[[i]],z/.DA[[i,1]]}}, VertexColors->{Red,Yellow} ],{i,1,n} ], Line[{{-x[[1]],-30,Z[[1]]},{-X[[1]],30,Z[[1]]}}],Scale[Cylinder[{{0,0,0},{0,0,3}},b],{a/b,1,1},{0,0,0}] },PlotRange->{{-90,90},{-50,50},{-50,3}},Axes->False,Boxed->False ],{\[Theta],0,\[Sigma],0.05}]]]

Tuoyuan[15, 25, 50, 10, "tuoyuan001.gif"]

284 篇文章53 人订阅

0 条评论

## 相关文章

### Leetcode 65 Valid Number DFA有限状态机

Validate if a given string is numeric. Some examples: "0" => true " 0.1 " =>...

2286

2986

4863

3067

### BZOJ 1293: [SCOI2009]生日礼物【单调队列】

1293: [SCOI2009]生日礼物 Time Limit: 10 Sec  Memory Limit: 162 MB Submit: 2534  Solv...

2625

3497

891

3755

2156

38512