h = 10;
+module block() {
+ translate([-h, -h])
+ cube([2*h, 2*h, h]);
+};
+
+module cut() {
+ translate([0, -h/2, h/2])
+ rotate([45, 0, 0])
+ translate([-1.5*h, -1.5*h])
+ cube([3*h, 3*h, h]);
+};
+
module pyramid() {
-polyhedron(
- points=[
- [h,h,0], [h,-h,0], [-h,-h,0], [-h,h,0], [0,0,h]
- ],
- faces = [
- [1,4,0], [2,4,1], [2,3,4], [4,3,0],
- [0,3,2,1]
- ]
-);
-}
+ difference() {
+ block();
+ cut();
+ rotate(90) cut();
+ rotate(180) cut();
+ rotate(270) cut();
+ }
+};
+
+//polyhedron(
+// points=[
+// [h,h,0], [h,-h,0], [-h,-h,0], [-h,h,0], [0,0,h]
+// ],
+// faces = [
+// [1,4,0], [2,4,1], [2,3,4], [4,3,0],
+// [0,3,2,1]
+// ]
+//);
module quarter_pyramid() {
difference() {
rotate([0,0,-45]) translate([-2*h, -4*h, -h]) cube([h*4,h*4,h*4]);
rotate([0,0,-45]) translate([0, -4*h, -h]) cube([h*4,h*4,h*4]);
}
-//polyhedron(
-// points=[
-// [0,0,0], [h,h,0], [h,-h,0], [0,0,h]
-// ],
-// faces = [
-// [1,2,3], [3,1,0],
-// ]
-//);
-}
+};
//quarter_pyramid();
module bottom() {
children();
-}
+};
module top() {
translate([0,0,2*h]) rotate([180,0,0])
children();
-}
+};
module north() {
translate([0,h,h]) rotate([90,90,0])
children();
-}
+};
module south() {
rotate([0,0,180]) north()
children();
-}
+};
module east() {
translate([h,0,h]) rotate([90,0,0]) rotate([0,-90,0])
children();
-}
+};
module west() {
rotate([0,0,180]) east()
children();
-}
+};
module pointy() {
translate([0,0,-2*h]) top() pyramid();
-}
-
+};
module partA() {
translate([0,-h,-h]) rotate([180,-90,90]) quarter_pyramid();
-}
-
+};
module partB() {
translate([0,-h,-h]) rotate([180,-90,-90]) quarter_pyramid();
-}
-
-//top() pyramid();
-//top() pointy();
-//top() partA();
-//top() partB();
-//top() partC();
-//top() partD();
-//top() partE();
-
-//south() pyramid();
-//south() pointy();
-//south() partA();
-//south() partB();
-//south() partC();
-//south() partD();
-//south() partE();
-
-//north() pyramid();
-//north() pointy();
-//north() partA();
-//north() partB();
-//north() partC();
-//north() partD();
-//north() partE();
-
-//west() pyramid();
-//west() pointy();
-//west() partA();
-//west() partB();
-//west() partC();
-//west() partD();
-//west() partE();
-
-//east() pyramid();
-//east() pointy();
-//east() partA();
-//east() partB();
-//east() partC();
-//east() partD();
-//east() partE();
+};
module partC() {
translate([-h,h,-h]) rotate([0,180,90]) {
- partA(); partB();
+ union() {
+ partA();
+ partB();
+ }
}
-}
-
-
-//bottom() pyramid();
-//bottom() pointy();
-//bottom() partA();
-//bottom() partB();
-//bottom() partC();
-//bottom() partD();
-//bottom() partE();
+};
module partD() {
translate([0,h,-h]) rotate([90, 0, 0]) partC();
partE();
}
-rotate([0,45,0]) puzzle_piece();
+module cutout() {
+ translate([0, -2.8, 0])
+ rotate([45, 45, 0])
+ translate([-h, -h, 0])
+ translate([0, 4.2, 4.2])
+ cube([2*h, 2*h, 2*h]);
+}
+
+module puzzle_part(){
+difference() {
+ rotate([0,45,0]) puzzle_piece();
+ cutout();
+ translate([0, 2*h, 0])
+ cutout();
+
+ mirror([0, 180, 0])
+ translate([4, -15, h])
+ rotate([45, 0, 45])
+ block();
+
+ translate([4, -15, h])
+ rotate([45, 0, 45])
+ block();
+}}
+
+//
+module solved_puzzle(){
+bottom() puzzle_piece();
+top() puzzle_piece();
+north() puzzle_piece();
+south() puzzle_piece();
+east() puzzle_piece();
+west() puzzle_piece();
+}
+
+module step_0(){
+bottom() puzzle_piece();
+south() puzzle_piece();
+west() puzzle_piece();
+}
+
+module step_1(){
+bottom() puzzle_piece();
+south() puzzle_piece();
+east() puzzle_piece();
+west() puzzle_piece();
+}
+
+module step_2(){
+bottom() puzzle_piece();
+south() puzzle_piece();
+east() puzzle_piece();
+west() puzzle_piece();
+north() puzzle_piece();
+}
-//bottom() puzzle_piece();
-//top() puzzle_piece();
-//north() puzzle_piece();
-//south() puzzle_piece();
-//east() puzzle_piece();
-//west() puzzle_piece();
+step_2();