diff options
author | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2014-06-28 22:38:17 +0200 |
---|---|---|
committer | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2014-06-29 10:50:36 +0200 |
commit | 6e4f99f514806fccef1e7073080e4f769011d8be (patch) | |
tree | c88822c24c9a81adec91f6534fd10df67aabcc79 /lib/dice.scad | |
parent | e96a2cdf57e0d576b3ca4d7d9186ae879a677c36 (diff) |
New die: d20
Diffstat (limited to 'lib/dice.scad')
-rw-r--r-- | lib/dice.scad | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/dice.scad b/lib/dice.scad index d42d1ea..c1b2176 100644 --- a/lib/dice.scad +++ b/lib/dice.scad @@ -102,3 +102,62 @@ module d12(size=false, side=false) { rotate([180, 0, 0]) translate([0, 0, i_r]) child(11); } } + +module d20(size=false, side=false) { + l = side ? side : s2s_d20(size); + if (l == false) { + echo("ERROR: d20: one of side or size should be defined"); + } + sc_face = 0.5; + r = l*sqrt(10+2*sqrt(5))/4; + c = r*2; + i_r = (l/12)*sqrt(3)*(3+sqrt(5)); + a_b2 = atan(1/2) + acos(-sqrt(5)/3)/2; + phi = (1+sqrt(5))/2; + rotate([0, -acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) + difference() { + intersection() { + sphere(r*0.96, $fn=64); + rotate([0, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) cube([c, c, i_r*2], center=true); + mirror([1, 0, 0]) rotate([0, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) cube([c, c, i_r*2], center=true); + rotate([0, acos(1/sqrt(3)), -45]) cube([c, c, i_r*2], center=true); + mirror([1, 0, 0]) rotate([0, acos(1/sqrt(3)), -45]) cube([c, c, i_r*2], center=true); + mirror([0, 1, 0]) rotate([0, acos(1/sqrt(3)), -45]) cube([c, c, i_r*2], center=true); + mirror([0, 1, 0]) mirror([1, 0, 0]) rotate([0, acos(1/sqrt(3)), -45]) cube([c, c, i_r*2], center=true); + rotate([90, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) cube([c, c, i_r*2], center=true); + mirror([0, 0, 1]) rotate([90, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) cube([c, c, i_r*2], center=true); + rotate([0, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) cube([c, c, i_r*2], center=true); + mirror([0, 1, 0]) rotate([0, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) cube([c, c, i_r*2], center=true); + } + rotate([0, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) translate([0, 0, i_r]) rotate([0, 0, 90]) scale([sc_face, sc_face, 1]) child(0); + rotate([180, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) translate([0, 0, i_r]) rotate([0, 0, 270]) scale([sc_face, sc_face, 1]) child(19); + + mirror([1, 0, 0]) rotate([0, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) translate([0, 0, i_r]) mirror([0, 1, 0]) rotate([0, 0, 90]) scale([sc_face, sc_face, 1]) child(12); + mirror([1, 0, 0]) rotate([180, acos((-(1+sqrt(5)))/(2*sqrt(3))), 0]) translate([0, 0, i_r]) mirror([0, 1, 0]) rotate([0, 0, 90]) scale([sc_face, sc_face, 1]) child(7); + + rotate([0, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) scale([sc_face, sc_face, 1]) child(9); + rotate([180, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) scale([sc_face, sc_face, 1]) child(10); + + mirror([1, 0, 0]) rotate([0, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([1, 0, 0]) scale([sc_face, sc_face, 1]) child(1); + mirror([1, 0, 0]) rotate([180, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([1, 0, 0]) scale([sc_face, sc_face, 1]) child(18); + + mirror([0, 1, 0]) rotate([0, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([0, 1, 0]) rotate([0, 0, 180]) scale([sc_face, sc_face, 1]) child(15); + mirror([0, 1, 0]) rotate([180, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([0, 1, 0]) rotate([0, 0, 180]) scale([sc_face, sc_face, 1]) child(4); + + mirror([0, 1, 0]) mirror([1, 0, 0]) rotate([0, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([0, 1, 0]) mirror([0, 1, 0]) scale([sc_face, sc_face, 1]) child(13); + mirror([0, 1, 0]) mirror([1, 0, 0]) rotate([180, acos(1/sqrt(3)), -45]) translate([0, 0, i_r]) mirror([0, 1, 0]) mirror([0, 1, 0]) scale([sc_face, sc_face, 1]) child(6); + + rotate([90, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) translate([0, 0, i_r]) rotate([0, 0, 270]) scale([sc_face, sc_face, 1]) child(11); + rotate([270, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) translate([0, 0, i_r]) rotate([0, 0, 270]) scale([sc_face, sc_face, 1]) child(8); + + mirror([0, 0, 1]) rotate([90, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) translate([0, 0, i_r]) mirror([1, 0, 0]) rotate([0, 0, 90]) scale([sc_face, sc_face, 1]) child(14); + mirror([0, 0, 1]) rotate([270, 0, 0]) rotate([0, acos((sqrt(5)+1)/(2*sqrt(3))), 90]) translate([0, 0, i_r]) mirror([1, 0, 0]) rotate([0, 0, 90]) scale([sc_face, sc_face, 1]) child(5); + + rotate([0, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) translate([0, 0, i_r]) rotate([0, 0, 180]) scale([sc_face, sc_face, 1]) child(16); + rotate([180, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) translate([0, 0, i_r]) rotate([0, 0, 180]) scale([sc_face, sc_face, 1]) child(3); + + mirror([0, 1, 0]) rotate([0, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) translate([0, 0, i_r]) mirror([0, 1, 0]) scale([sc_face, sc_face, 1]) child(2); + mirror([0, 1, 0]) rotate([180, 90, atan((-sqrt(5)+1)/(sqrt(5)+1))]) translate([0, 0, i_r]) mirror([0, 1, 0]) scale([sc_face, sc_face, 1]) child(17); + } +} + |