discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Dodecahedron - Intersecting Tetrahedra - with Dodecahedron

U
unkerjay
Thu, Apr 13, 2017 3:38 AM

From:

https://trmm.net/Tetrahedron

I got the code for interlocking Tetrahedron (in color):

"
$fn=30;
v=[
[+1,+1,+1],
[+1,-1,-1],
[-1,+1,-1],
[-1,-1,+1],
];

colors=["red","green","blue","yellow","purple"];

module tetrahedron(len,thick)
{
for(a=[0:2])
for(b=[a+1:3])
hull() {
translate(v[a]*len) sphere(r=thick);
translate(v[b]*len) sphere(r=thick);
}
}

for(i=[0:4])
{
color(colors[i])
rotate([0,-atan(sqrt(5)/2-0.5), i*360/5])
tetrahedron(20,2);
}
"

And elsewhere, I discovered it can also be done by connecting
the vertices of a dodecahedron.

What I'd like to do is add the dodecahedron (transparent) with
the interlocking tetrahedrons to be able to show just how the
vertices connect.

I tried doing it in Blender, but, I can't color the edges.

Without being able to color the edges, it's all black and there's
no clear way to determine easily which edges identify each
tetrahedron (as is shown here).

Anyone?

He also mentions adding the code:

"rotate($t*360)"

but is unclear as to where in the initial code that would go, to work.

Last line?  Maybe.

Thanx

--
View this message in context: http://forum.openscad.org/Dodecahedron-Intersecting-Tetrahedra-with-Dodecahedron-tp21222.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

From: https://trmm.net/Tetrahedron I got the code for interlocking Tetrahedron (in color): " $fn=30; v=[ [+1,+1,+1], [+1,-1,-1], [-1,+1,-1], [-1,-1,+1], ]; colors=["red","green","blue","yellow","purple"]; module tetrahedron(len,thick) { for(a=[0:2]) for(b=[a+1:3]) hull() { translate(v[a]*len) sphere(r=thick); translate(v[b]*len) sphere(r=thick); } } for(i=[0:4]) { color(colors[i]) rotate([0,-atan(sqrt(5)/2-0.5), i*360/5]) tetrahedron(20,2); } " And elsewhere, I discovered it can also be done by connecting the vertices of a dodecahedron. What I'd like to do is add the dodecahedron (transparent) with the interlocking tetrahedrons to be able to show just how the vertices connect. I tried doing it in Blender, but, I can't color the edges. Without being able to color the edges, it's all black and there's no clear way to determine easily which edges identify each tetrahedron (as is shown here). Anyone? He also mentions adding the code: "rotate($t*360)" but is unclear as to where in the initial code that would go, to work. Last line? Maybe. Thanx -- View this message in context: http://forum.openscad.org/Dodecahedron-Intersecting-Tetrahedra-with-Dodecahedron-tp21222.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Thu, Apr 13, 2017 4:36 AM

Figured out, at least for this code, the rotation:

"
$fn=30;
v=[
[+1,+1,+1],
[+1,-1,-1],
[-1,+1,-1],
[-1,-1,+1],
];

colors=["red","green","blue","yellow","purple"];

module tetrahedron(len,thick)
{
for(a=[0:2])
for(b=[a+1:3])
hull() {
translate(v[a]*len) sphere(r=thick);
translate(v[b]*len) sphere(r=thick);
}
}

for(i=[0:4])
{
color(colors[i])
rotate([0,-atan(sqrt(5)/2-0.5), i360/5])
rotate([0,0,$t
360]) translate([0,0,0]) tetrahedron(20,.25);  //
(diameter, stick size)
}
"

--
View this message in context: http://forum.openscad.org/Dodecahedron-Intersecting-Tetrahedra-with-Dodecahedron-tp21222p21223.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Figured out, at least for this code, the rotation: " $fn=30; v=[ [+1,+1,+1], [+1,-1,-1], [-1,+1,-1], [-1,-1,+1], ]; colors=["red","green","blue","yellow","purple"]; module tetrahedron(len,thick) { for(a=[0:2]) for(b=[a+1:3]) hull() { translate(v[a]*len) sphere(r=thick); translate(v[b]*len) sphere(r=thick); } } for(i=[0:4]) { color(colors[i]) rotate([0,-atan(sqrt(5)/2-0.5), i*360/5]) rotate([0,0,$t*360]) translate([0,0,0]) tetrahedron(20,.25); // (diameter, stick size) } " -- View this message in context: http://forum.openscad.org/Dodecahedron-Intersecting-Tetrahedra-with-Dodecahedron-tp21222p21223.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Thu, Apr 13, 2017 12:49 PM

Add this to your code:

%hull()
for(i=[0:4])
{
rotate([0,-atan(sqrt(5)/2-0.5), i360/5])
rotate([0,0,$t
360]) translate([0,0,0])
for(vi=v)
translate(vi*20) sphere(.25);
}

Instead of spheres, you may use a cube for faster display.

Add this to your code: %hull() for(i=[0:4]) { rotate([0,-atan(sqrt(5)/2-0.5), i*360/5]) rotate([0,0,$t*360]) translate([0,0,0]) for(vi=v) translate(vi*20) sphere(.25); } Instead of spheres, you may use a cube for faster display.