Skip to content

Instantly share code, notes, and snippets.

Avatar

Hermann Stamm-Wilbrandt Hermann-SW

View GitHub Profile
@Hermann-SW
Hermann-SW / octahedron.separating_circle.scad
Created Aug 6, 2022
Separating circle created from Octahedron by removing 6 of its 12 edges
View octahedron.separating_circle.scad
look_inside=false;
diff_last=false;
$vpr = [355, 55, 40];
$fn = 25;
$vpt = [0,0,0];
function map_3D(c) = [cos(c[0])*sin(c[1]), sin(c[0])*sin(c[1]), cos(c[1])];
sc = 7.745966692414834 ;
coords =[
[0,90]
, [90,90]
@Hermann-SW
Hermann-SW / difflast_question.scad
Created Aug 3, 2022
test OpenSCAD file for reddit/r/openscad question
View difflast_question.scad
difflast=false;
$vpr = [355, 45, 0];
$fn = 25;
$vpt = [0,0,0];
function map_3D(c) = [cos(c[0])*sin(c[1]), sin(c[0])*sin(c[1]), cos(c[1])];
sc = 7.745966692414834 ;
coords =[
[270,54.735610317245346]
, [270,32.84136619034721]
, [450,-10.947122063449068]
@Hermann-SW
Hermann-SW / ico.2.scad
Created Aug 2, 2022
dotCSAD icosaeder, prepared for OpenSCAD "animate"
View ico.2.scad
// require https://github.com/JustinSDK/dotSCAD
use <triangle/tri_subdivide.scad>
use <polyhedra/geom_icosahedron.scad>
use <surface/sf_solidifyT.scad>
icosahedron_detail = 0;
subdivided_n = 0;
radius = 10;
thickness = 1;
@Hermann-SW
Hermann-SW / C60.half.mirrors.animate.3.scad
Last active Aug 1, 2022
More than half of C60 fullerene vertices rotating, OpenSCAD with three mirrors
View C60.half.mirrors.animate.3.scad
$vpr = [ 340 , 45, 0 ];
$fn = 25;
$vpt = [0,-6.5,0];
function map_3D(c) = [cos(c[0])*sin(c[1]), sin(c[0])*sin(c[1]), cos(c[1])];
sc = 7.745966692414834 ;
coords =[
[270,54.735610317245346]
, [270,32.84136619034721]
, [90,-10.947122063449068]
, [90,10.947122063449068]
@Hermann-SW
Hermann-SW / C60.half.mirrors.animate.scad
Last active Aug 1, 2022
More than half of C60 fullerene vertices rotating, OpenSCAD with two mirrors
View C60.half.mirrors.animate.scad
$vpr = [ 340 , 45, 0 ];
$fn = 25;
$vpt = [0,3,0];
function map_3D(c) = [cos(c[0])*sin(c[1]), sin(c[0])*sin(c[1]), cos(c[1])];
sc = 7.745966692414834 ;
coords =[
[270,54.735610317245346]
, [270,32.84136619034721]
, [90,-10.947122063449068]
, [90,10.947122063449068]
@Hermann-SW
Hermann-SW / scad_calltree
Created Jul 30, 2022
Generate Graphviz dotfile from OpenSCAD "use" calltree
View scad_calltree
#/bin/bash
if [ "$2" = "" ]; then
echo "digraph G {"
echo "rankdir=LR"
echo "node [shape=none]"
fi
echo \"$2\" "->" \"$1\" "[label=\"`wc --lines $1 | cut -f1 -d\ `\"]"
for f in `grep "^use" $1 | cut -f2 -d\< | cut -f1 -d\>`
do
./scad_calltree `dirname $1`/$f $1
@Hermann-SW
Hermann-SW / wlog.js
Created Jun 25, 2022
OpenSCAD external NodeJS animation demo
View wlog.js
var fs = require("fs");
var writer;
function wait(ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms);
});
}
function rad2deg(r) {
return r / Math.PI * 180;
@Hermann-SW
Hermann-SW / calc60.ps
Created May 15, 2022
Determination of pentagon fold angle for C60 fullerene (truncated icosahedron)
View calc60.ps
%!
0 setlinewidth
/vertex { 2 copy 5 4 roll dup 4 1 roll
newpath 0 360 arc closepath
gsave 1.0 setgray fill grestore
stroke
12 ge {
@Hermann-SW
Hermann-SW / lmbda.cpp
Last active May 3, 2022
Self contained test code for partial initializing struct function pointers with lambdas (c++14)
View lmbda.cpp
// Copyright: https://mit-license.org/
//
// cpplint lmbda.cpp 2>&1 | grep -v "Is this a non-const reference?"
// g++ -Wall -Wextra -pedantic -std=c++14 -g lmbda.cpp -o lmbda
//
#include <assert.h>
#include <iostream>
#include <vector>
@Hermann-SW
Hermann-SW / C30.py
Created Apr 22, 2022
Planar drawing of C30 fullerene
View C30.py
#!/usr/bin/env python
import matplotlib.pyplot as plt
import networkx as nx
C30=[[9,10,1],[0,2,25],[1,18,3],[2,4,26],[3,16,5],[4,6,27],[5,14,7],[6,8,28],[7,12,9],[8,0,29],[0,11,19],[10,12,21],[11,8,13],[12,14,22],[13,6,15],[14,16,23],[15,4,17],[16,18,24],[17,2,19],[18,10,20],[19,21,24],[20,11,22],[21,13,23],[22,15,24],[23,17,20],[1,26,29],[25,3,27],[26,5,28],[27,7,29],[28,9,25]]
G = nx.Graph()
for i in range(len(C30)):
for j in C30[i]:
G.add_edge(i, j)