aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElena of Valhalla'' Grandi <valhalla@trueelena.org>2014-06-22 14:35:37 +0200
committerElena of Valhalla'' Grandi <valhalla@trueelena.org>2014-06-22 14:35:37 +0200
commita44fe41ef2e1230f0a593d8c842e0516866548a6 (patch)
treee96798da65b784a7bd6f08a367869082e12ec10f /lib
parentda91e60416b5efd77991480e39043128ad4e2501 (diff)
d8: new die
Diffstat (limited to 'lib')
-rw-r--r--lib/dice.scad27
-rw-r--r--lib/utils.scad2
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/dice.scad b/lib/dice.scad
index ed63d3f..76b6d63 100644
--- a/lib/dice.scad
+++ b/lib/dice.scad
@@ -42,3 +42,30 @@ module d6(size=false, side=false) {
}
}
+module d8(size=false, side=false) {
+ l = side ? side : s2s_d8(size);
+ if (l == false) {
+ echo("ERROR: d6: one of side or size should be defined");
+ }
+ r = sqrt(2)/2*l;
+ c = r*2;
+ i_r = sqrt(6)/6*l;
+ difference() {
+ intersection() {
+ #sphere(r);
+ cube([c, c, i_r*2], center=true);
+ intersection_for ( i = [0:2] ) {
+
+ rotate([0, 0, 120*i]) rotate([acos(-1/3), 0, 0]) cube([c, c, i_r*2], center=true);
+ }
+ }
+ translate([0, 0, i_r]) child(0);
+ rotate([acos(-1/3), 0, 0]) translate([0, 0, i_r]) child(1);
+ rotate([0, 0, 120]) rotate([acos(-1/3)+180, 0, 0]) translate([0, 0, i_r]) child(2);
+ rotate([0, 0, -120]) rotate([acos(-1/3)+180, 0, 0]) translate([0, 0, i_r]) child(3);
+ rotate([0, 0, -120]) rotate([acos(-1/3), 0, 0]) translate([0, 0, i_r]) child(4);
+ rotate([0, 0, 120]) rotate([acos(-1/3), 0, 0]) translate([0, 0, i_r]) child(5);
+ rotate([acos(-1/3)+180, 0, 0]) translate([0, 0, i_r]) child(6);
+ rotate([180, 0, 0]) translate([0, 0, i_r]) child(0);
+ }
+}
diff --git a/lib/utils.scad b/lib/utils.scad
index 79bccfe..c1b62dd 100644
--- a/lib/utils.scad
+++ b/lib/utils.scad
@@ -5,3 +5,5 @@ function s2s_d4(size) = circ_rad(size)*4/sqrt(6);
function s2s_d6(size) = size;
+function s2s_d8(size) = circ_rad(size)*2/sqrt(2);
+