使用多面体作为图形基元,按点放置并缩放

发布于 2024-12-19 17:08:54 字数 1107 浏览 2 评论 0原文

我可以问一个简单的初学者问题吗?我无法在我拥有的任何文本中找到易于理解的答案(不可否认,这些文本相当古老,在某些情况下早于版本 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]

loop of spheres

(* cubes along a path *)
Graphics3D[Cuboid[#, # + 0.1] & /@ data]

loop ofcubes

那么如何将二十面体放置在特定的点和比例,编写类似

Graphics3D[icosahedron[#, 0.1] & /@ data]

编辑的内容:我认为我的问题是如何制作 GraphicsComplexGraphics3D 协同工作。例如,我目前拥有的位置:

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]

loop of spheres

(* cubes along a path *)
Graphics3D[Cuboid[#, # + 0.1] & /@ data]

loop of cubes

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...

the platonic bracelet

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟柳画桥 2024-12-26 17:08:54

你可以这样做:

icosahedron = PolyhedronData["Icosahedron"][[1]];
Graphics3D[Translate[Scale[icosahedron, .1], #] & /@ data]

二十面体

You could do something like this:

icosahedron = PolyhedronData["Icosahedron"][[1]];
Graphics3D[Translate[Scale[icosahedron, .1], #] & /@ data]

icosahedra

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文