diff options
author | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2014-06-22 17:24:50 +0200 |
---|---|---|
committer | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2014-06-22 17:24:50 +0200 |
commit | e96a2cdf57e0d576b3ca4d7d9186ae879a677c36 (patch) | |
tree | f5e2f70a31dbfe6f89b372834c5aa099bcf378d5 /lib | |
parent | f6877939ff386a340acea456b6e731bfe63abc68 (diff) |
d12: new die
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dice.scad | 33 | ||||
-rw-r--r-- | lib/utils.scad | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/dice.scad b/lib/dice.scad index e87bbb6..d42d1ea 100644 --- a/lib/dice.scad +++ b/lib/dice.scad @@ -69,3 +69,36 @@ module d8(size=false, side=false) { rotate([180, 0, 0]) translate([0, 0, i_r]) child(0); } } + +module d12(size=false, side=false) { + l = side ? side : s2s_d12(size); + if (l == false) { + echo("ERROR: d12: one of side or size should be defined"); + } + r = l*sqrt(3)*(1+sqrt(5))/4; + c = r*2; + i_r = (l/2)*sqrt(5/2 + 11*sqrt(5)/10); + difference() { + intersection() { + sphere(r*0.96, $fn=64); + cube([c, c, i_r*2], center=true); + intersection_for ( i = [0:4] ) { + + rotate([0, 0, 72*i]) rotate([acos(-1/sqrt(5)), 0, 0]) cube([c, c, i_r*2], center=true); + } + } + translate([0, 0, i_r]) child(0); + rotate([acos(-1/sqrt(5))+180, 0, 0]) translate([0, 0, i_r]) child(1); + rotate([0, 0, 72]) rotate([acos(-1/sqrt(5))+180, 0, 0]) translate([0, 0, i_r]) child(3); + rotate([0, 0, 144]) rotate([acos(-1/sqrt(5))+180, 0, 0]) translate([0, 0, i_r]) child(5); + rotate([0, 0, 216]) rotate([acos(-1/sqrt(5))+180, 0, 0]) translate([0, 0, i_r]) child(4); + rotate([0, 0, 288]) rotate([acos(-1/sqrt(5))+180, 0, 0]) translate([0, 0, i_r]) child(2); + + rotate([acos(-1/sqrt(5)), 0, 0]) translate([0, 0, i_r]) child(10); + rotate([0, 0, 72]) rotate([acos(-1/sqrt(5)), 0, 0]) translate([0, 0, i_r]) child(8); + rotate([0, 0, 144]) rotate([acos(-1/sqrt(5)), 0, 0]) translate([0, 0, i_r]) child(6); + rotate([0, 0, 216]) rotate([acos(-1/sqrt(5)), 0, 0]) translate([0, 0, i_r]) child(7); + rotate([0, 0, 288]) rotate([acos(-1/sqrt(5)), 0, 0]) translate([0, 0, i_r]) child(9); + rotate([180, 0, 0]) translate([0, 0, i_r]) child(11); + } +} diff --git a/lib/utils.scad b/lib/utils.scad index c1b62dd..7661b2f 100644 --- a/lib/utils.scad +++ b/lib/utils.scad @@ -7,3 +7,5 @@ function s2s_d6(size) = size; function s2s_d8(size) = circ_rad(size)*2/sqrt(2); +function s2s_d12(size) = circ_rad(size)*4/(sqrt(3)*(1+sqrt(5))); + |