937df00a78e5b96271b8d2ea378f08348a10f328
[ozzloy@gmail.com/3d-printables] / erin / puzzle.scad
1 $fn = 100;
2
3 h = 10;
4
5 module pyramid() {
6 polyhedron(
7 points=[
8 [h,h,0], [h,-h,0], [-h,-h,0], [-h,h,0], [0,0,h]
9 ],
10 faces = [
11 [1,4,0], [2,4,1], [2,3,4], [4,3,0],
12 [0,3,2,1]
13 ]
14 );
15 }
16
17 module quarter_pyramid() {
18 difference() {
19 pyramid();
20 rotate([0,0,45]) translate([-2*h, 0, -h]) cube([h*4,h*4,h*4]);
21 rotate([0,0,-45]) translate([-2*h, -4*h, -h]) cube([h*4,h*4,h*4]);
22 rotate([0,0,-45]) translate([0, -4*h, -h]) cube([h*4,h*4,h*4]);
23 }
24 //polyhedron(
25 // points=[
26 // [0,0,0], [h,h,0], [h,-h,0], [0,0,h]
27 // ],
28 // faces = [
29 // [1,2,3], [3,1,0],
30 // ]
31 //);
32 }
33
34 //quarter_pyramid();
35
36 module bottom() {
37 children();
38 }
39
40 module top() {
41 translate([0,0,2*h]) rotate([180,0,0])
42 children();
43 }
44
45 module north() {
46 translate([0,h,h]) rotate([90,90,0])
47 children();
48 }
49
50 module south() {
51 rotate([0,0,180]) north()
52 children();
53 }
54
55 module east() {
56 translate([h,0,h]) rotate([90,0,0]) rotate([0,-90,0])
57 children();
58 }
59
60 module west() {
61 rotate([0,0,180]) east()
62 children();
63 }
64
65 module pointy() {
66 translate([0,0,-2*h]) top() pyramid();
67 }
68
69
70 module partA() {
71 translate([0,-h,-h]) rotate([180,-90,90]) quarter_pyramid();
72 }
73
74
75 module partB() {
76 translate([0,-h,-h]) rotate([180,-90,-90]) quarter_pyramid();
77 }
78
79 //top() pyramid();
80 //top() pointy();
81 //top() partA();
82 //top() partB();
83 //top() partC();
84 //top() partD();
85 //top() partE();
86
87 //south() pyramid();
88 //south() pointy();
89 //south() partA();
90 //south() partB();
91 //south() partC();
92 //south() partD();
93 //south() partE();
94
95 //north() pyramid();
96 //north() pointy();
97 //north() partA();
98 //north() partB();
99 //north() partC();
100 //north() partD();
101 //north() partE();
102
103 //west() pyramid();
104 //west() pointy();
105 //west() partA();
106 //west() partB();
107 //west() partC();
108 //west() partD();
109 //west() partE();
110
111 //east() pyramid();
112 //east() pointy();
113 //east() partA();
114 //east() partB();
115 //east() partC();
116 //east() partD();
117 //east() partE();
118
119 module partC() {
120 translate([-h,h,-h]) rotate([0,180,90]) {
121 partA(); partB();
122 }
123 }
124
125
126 //bottom() pyramid();
127 //bottom() pointy();
128 //bottom() partA();
129 //bottom() partB();
130 //bottom() partC();
131 //bottom() partD();
132 //bottom() partE();
133
134 module partD() {
135 translate([0,h,-h]) rotate([90, 0, 0]) partC();
136 }
137
138 module partE() {
139 rotate([0,0,180]) partD();
140 }
141
142 module puzzle_piece() {
143 pyramid();
144 pointy();
145 partA();
146 partB();
147 partC();
148 partD();
149 partE();
150 }
151
152 rotate([0,45,0]) puzzle_piece();
153
154 //bottom() puzzle_piece();
155 //top() puzzle_piece();
156 //north() puzzle_piece();
157 //south() puzzle_piece();
158 //east() puzzle_piece();
159 //west() puzzle_piece();