Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use polyhedron as graphics primitive, placing at point and scaling

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

like image 623
cormullion Avatar asked Dec 05 '11 13:12

cormullion


1 Answers

You could do something like this:

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

icosahedra

like image 144
Heike Avatar answered Nov 05 '22 06:11

Heike