aboutsummaryrefslogtreecommitdiff
path: root/lib/dice.scad
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dice.scad')
-rw-r--r--lib/dice.scad33
1 files changed, 33 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);
+ }
+}