-
-
Save Hermann-SW/3939a6fa0c2f9bee9786b121e4624467 to your computer and use it in GitHub Desktop.
v=[[sqrt(8/9),0,-1/3],[-sqrt(2/9),sqrt(2/3),-1/3],[-sqrt(2/9),-sqrt(2/3),-1/3],[0,0,1]]; | |
R=40; | |
r=1; | |
$fn=25; | |
for (a = [0:2], b = [a + 1:3]) hull() { | |
translate(R*v[a]) sphere(r); | |
translate(R*v[b]) sphere(r); | |
} |
Wow, just learned from @Torsten_Paul on twitter …
https://twitter.com/Torsten_Paul/status/1516096609595109382
… on hull() function (on two spheres) to achieve cylinder edges:
https://www.openscad.info/index.php/2020/10/18/hull/
Now script is only 8 lines long(!), and the result of reduced script is identical to first longer script:
Nice, I will use OpenSCAD output file with "hull()" for edges for planar graphs that I will have embedded onto sphere surface:
https://forums.raspberrypi.com/viewtopic.php?p=1994828#p1994828
Overlaying a bigger radius sphere over the vertex sphere used in "hull()" allows to even make vertices move visible.
Writing OpenSCAD file and opening written file in OpenSCAD gives rotating, moving and scaling for free without writing any new code.
[ For 2D planar graph convex face straight line drawing I wrote my own JavaScript browser viewer: https://hermann-sw.github.io/planar_graph_playground/ ]
Coordinates taken from Wikipedia:
https://en.wikipedia.org/wiki/Tetrahedron#Coordinates_for_a_regular_tetrahedron
Angles a and b as well:
https://en.wikipedia.org/wiki/Tetrahedron#Angles_and_distances