aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dice.scad37
-rw-r--r--lib/utils.scad2
2 files changed, 38 insertions, 1 deletions
diff --git a/lib/dice.scad b/lib/dice.scad
index fedc2ed..7ce7c7f 100644
--- a/lib/dice.scad
+++ b/lib/dice.scad
@@ -98,6 +98,43 @@ module d8(size=false, side=false) {
}
}
+// inscribed in a sphere of radius r
+module pentagonal_trapezohedron(r) {
+ c = r*2;
+ i_r = r * 0.70;
+ intersection() {
+ //cube([c, c, i_r*2], center=true);
+ sphere(r=r);
+ intersection_for ( i = [0:5] ) {
+ rotate([0, 0, 72*i]) rotate([0, 48, 0]) cube([c, c, i_r*2], center=true);
+ }
+ }
+}
+
+module pentagonal_trapezohedron_faces(r, sc_face=0.6) {
+ i_r = r * 0.85;
+ union() {
+ for ( i = [0:4] ) {
+ rotate([0, 0, 72*i]) translate([i_r * 0.6, 0, i_r * 0.3]) rotate([48, 0, 90]) scale([sc_face, sc_face, 1]) children(i * 2);
+ rotate([180, 0, 72*i + 180]) translate([i_r * 0.6, 0, i_r * 0.3]) rotate([48, 0, 90]) scale([sc_face, sc_face, 1]) children(10 - i * 2 - 1);
+ }
+ }
+}
+
+module d10(size=false, side=false) {
+ l = side ? side : s2s_d10(size);
+ if (l == false) {
+ echo("ERROR: d10: one of side or size should be defined");
+ }
+ r = sqrt(6)/4*l;
+ difference() {
+ intersection() {
+ sphere(r=r*0.98, $fn=64);
+ pentagonal_trapezohedron(r);
+ }
+ }
+}
+
// Dodecahedron inscribed in a sphere of radius r
module dodecahedron(r) {
c = r*2;
diff --git a/lib/utils.scad b/lib/utils.scad
index 5bc2a15..46d602e 100644
--- a/lib/utils.scad
+++ b/lib/utils.scad
@@ -14,6 +14,7 @@ function circ_rad(size) = size * sqrt(3) / 2;
function s2s_d4(size) = size * 1.57;
function s2s_d6(size) = size;
function s2s_d8(size) = size * 1.21;
+function s2s_d10(size) = size * 1.27;
function s2s_d12(size) = size * 0.50;
function s2s_d20(size) = size * 0.86;
@@ -24,4 +25,3 @@ function s2s_d20(size) = size * 0.86;
//function s2s_d8(size) = size * 1.16;
//function s2s_d12(size) = size * 0.69;
//function s2s_d20(size) = size * 0.78;
-