【问题标题】:W. Mathematica-- Graphics--Making spheresW. Mathematica--图形--制作球体
【发布时间】:2012-05-22 13:22:37
【问题描述】:

我想用 Wolfram Mathematica 写一个程序 我们有两个列表:

list1 = {Sphere[{x1}],Sphere[{x2}],Sphere[{x3}],Sphere[{x4}],Sphere[{x5}]}
list2 = {Sphere[{y1}],Sphere[{y2}],Sphere[{y3}],Sphere[{y4}],Sphere[{y5}]}

而且我需要通过圆柱体在它们之间“绘制”键,因此我们必须有

list3={Cylinder[{x1,y1}],Cylinder[{x2,y2}],Cylinder[{x3,y3}],Cylinder[{x4,y4}],Cylinder[{x5,y5}]}

如何使用任何列表自动执行此操作:list1 和 list2 这类列表?

【问题讨论】:

标签: graphics 3d wolfram-mathematica


【解决方案1】:

GraphPlot3D 的文档中有一个很好的示例,它看起来好像在做您想做的事情,但不完全是您解决问题的方式。

【讨论】:

    【解决方案2】:

    您没有指定圆柱体的半径是多少,我使用的是相对于第一个列表的那些。

    centers1 = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}};
    radii1 = {0.2, 0.3, 0.4};
    centers2 = {{1, -1, 1}, {2, -2, 2}, {3, -3, 3}};
    radii2 = {0.3, 0.3, 0.3};
    
    list1 = Sphere[Sequence @@ #] & /@ Transpose[{centers1, radii1};
    list2 = Sphere[Sequence @@ #] & /@ Transpose[{centers2, radii2}];
    
    Show[Graphics3D[{list1, list2, Cylinder[Sequence @@ #] & /@ Transpose[{Transpose[{centers1, centers2}], radii1}]}]]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-21
      • 2011-03-11
      • 2010-12-09
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      相关资源
      最近更新 更多