Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Last active April 18, 2022 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/3939a6fa0c2f9bee9786b121e4624467 to your computer and use it in GitHub Desktop.
Save Hermann-SW/3939a6fa0c2f9bee9786b121e4624467 to your computer and use it in GitHub Desktop.
OpenSCAD unfilled tetrahedron with cylinder edges
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);
}
@Hermann-SW
Copy link
Author

Hermann-SW commented Apr 18, 2022

@Hermann-SW
Copy link
Author

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:

@Hermann-SW
Copy link
Author

Hermann-SW commented Apr 18, 2022

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/ ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment