使用多面体作为图形基元,按点放置并缩放
我可以问一个简单的初学者问题吗?我无法在我拥有的任何文本中找到易于理解的答案(不可否认,这些文本相当古老,在某些情况下早于版本 6)?如何像使用球体和长方体这样的图形基元一样使用多面体?即,以一点为中心并进行缩放。下面是一些愚蠢的例子来说明这一点:
(* spheres along a path *)
data = Table[{Cos[t], Sin[t], Sin[t] Cos[2 t]}, {t, 0, 2 Pi, Pi/24}];
Graphics3D[Sphere[#, 0.3] & /@ data]
(* cubes along a path *)
Graphics3D[Cuboid[#, # + 0.1] & /@ data]
那么如何将二十面体放置在特定的点和比例,编写类似
Graphics3D[icosahedron[#, 0.1] & /@ data]
编辑的内容:我认为我的问题是如何制作 GraphicsComplex
和Graphics3D
协同工作。例如,我目前拥有的位置:
shapes[ct_, siz_] := {Sphere[ct - .2, siz ], Sphere[ct - 0.1, siz]};
Graphics3D[{{shapes[#, size] & /@ data}}]
我想将 Sphere[]
替换为 icosahedron[]
。目前正在尝试使 Heike 的解决方案发挥作用...
编辑 2:现在工作正常,谢谢 Heike。不过,我不确定是否会 3D 打印它 - 佩戴起来看起来有点不舒服...
Can I ask an easy beginner's question, to which I'm unable to find an easy to understand answer in any of the texts I have (which are admittedly quite old, predating version 6 in some cases)? How do you use the polyhedra as if they were graphics primitives like Sphere and Cuboid? Ie, centred at a point and scaled. Here are silly examples to illustrate the point:
(* spheres along a path *)
data = Table[{Cos[t], Sin[t], Sin[t] Cos[2 t]}, {t, 0, 2 Pi, Pi/24}];
Graphics3D[Sphere[#, 0.3] & /@ data]
(* cubes along a path *)
Graphics3D[Cuboid[#, # + 0.1] & /@ data]
So how to place icosahedra at specific points and scale, writing something like
Graphics3D[icosahedron[#, 0.1] & /@ data]
Edit: I think my problem is how to make GraphicsComplex
and Graphics3D
work together. Eg, where I currently have:
shapes[ct_, siz_] := {Sphere[ct - .2, siz ], Sphere[ct - 0.1, siz]};
Graphics3D[{{shapes[#, size] & /@ data}}]
I'd like to replace that Sphere[]
with icosahedron[]
. Am currently trying to make Heike's solution work...
Edit 2: Working fine now, thanks Heike. Not sure I'll get it 3D-printed though - looks a bit uncomfortable to wear...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以这样做:
You could do something like this: