Skip to content

Commit 570ace1

Browse files
committed
fix: make inner cage flexible
1 parent 694b1b9 commit 570ace1

File tree

1 file changed

+97
-21
lines changed

1 file changed

+97
-21
lines changed

src/models/thingyDodecahedron.ts

Lines changed: 97 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
scale,
1414
translate,
1515
translateX,
16-
translateY,
1716
translateZ,
1817
} from '@jscad/modeling/src/operations/transforms'
1918
import {
@@ -53,18 +52,21 @@ const brace = () =>
5352
[54 / 2, 54 / 2, radius],
5453
sphere({
5554
radius: 3,
55+
segments: 12,
5656
}),
5757
),
5858
translate(
5959
[radius - 6, 0, 6],
6060
sphere({
6161
radius: 3,
62+
segments: 12,
6263
}),
6364
),
6465
translate(
6566
[54 / 2, -54 / 2, radius],
6667
sphere({
6768
radius: 3,
69+
segments: 12,
6870
}),
6971
),
7072
rotateZ(
@@ -73,13 +75,15 @@ const brace = () =>
7375
[radius - 6, 0, 6],
7476
sphere({
7577
radius: 3,
78+
segments: 12,
7679
}),
7780
),
7881
),
7982
translate(
8083
[-54 / 2, -54 / 2, radius],
8184
sphere({
8285
radius: 3,
86+
segments: 12,
8387
}),
8488
),
8589
rotateZ(
@@ -88,13 +92,15 @@ const brace = () =>
8892
[radius - 6, 0, 6],
8993
sphere({
9094
radius: 3,
95+
segments: 12,
9196
}),
9297
),
9398
),
9499
translate(
95100
[-54 / 2, 0, radius],
96101
sphere({
97102
radius: 3,
103+
segments: 12,
98104
}),
99105
),
100106
rotateZ(
@@ -103,13 +109,15 @@ const brace = () =>
103109
[radius - 6, 0, 6],
104110
sphere({
105111
radius: 3,
112+
segments: 12,
106113
}),
107114
),
108115
),
109116
translate(
110117
[-54 / 2, 54 / 2, radius],
111118
sphere({
112119
radius: 3,
120+
segments: 12,
113121
}),
114122
),
115123
rotateZ(
@@ -118,42 +126,108 @@ const brace = () =>
118126
[radius - 6, 0, 6],
119127
sphere({
120128
radius: 3,
129+
segments: 12,
121130
}),
122131
),
123132
),
124133
translate(
125134
[54 / 2, 54 / 2, radius],
126135
sphere({
127136
radius: 3,
137+
segments: 12,
128138
}),
129139
),
130140
),
141+
// Corners
131142
translate(
132-
[0, 0, radius],
133-
subtract(
134-
cuboid({
135-
size: [60, 60, 6],
143+
[54 / 2, 54 / 2, radius],
144+
sphere({
145+
radius: 3 * 2,
146+
segments: 12,
147+
}),
148+
),
149+
translate(
150+
[radius - 6, 0, 6],
151+
sphere({
152+
radius: 3 * 2,
153+
segments: 12,
154+
}),
155+
),
156+
translate(
157+
[54 / 2, -54 / 2, radius],
158+
sphere({
159+
radius: 3 * 2,
160+
segments: 12,
161+
}),
162+
),
163+
rotateZ(
164+
degToRad(-segmentAngle),
165+
translate(
166+
[radius - 6, 0, 6],
167+
sphere({
168+
radius: 3 * 2,
169+
segments: 12,
136170
}),
137-
cuboid({
138-
size: [60 - 15, 60 - 15, 12],
171+
),
172+
),
173+
translate(
174+
[-54 / 2, -54 / 2, radius],
175+
sphere({
176+
radius: 3 * 2,
177+
segments: 12,
178+
}),
179+
),
180+
rotateZ(
181+
degToRad(-segmentAngle * 2),
182+
translate(
183+
[radius - 6, 0, 6],
184+
sphere({
185+
radius: 3 * 2,
186+
segments: 12,
139187
}),
140188
),
141189
),
142-
translateZ(
143-
6,
144-
subtract(
145-
cylinder({
146-
radius,
147-
segments: 5,
148-
height: 6,
190+
translate(
191+
[-54 / 2, 0, radius],
192+
sphere({
193+
radius: 3 * 2,
194+
segments: 12,
195+
}),
196+
),
197+
rotateZ(
198+
degToRad(-segmentAngle * 3),
199+
translate(
200+
[radius - 6, 0, 6],
201+
sphere({
202+
radius: 3 * 2,
203+
segments: 12,
149204
}),
150-
cylinder({
151-
radius: radius - 10,
152-
segments: 5,
153-
height: 12,
205+
),
206+
),
207+
translate(
208+
[-54 / 2, 54 / 2, radius],
209+
sphere({
210+
radius: 3 * 2,
211+
segments: 12,
212+
}),
213+
),
214+
rotateZ(
215+
degToRad(-segmentAngle * 4),
216+
translate(
217+
[radius - 6, 0, 6],
218+
sphere({
219+
radius: 3 * 2,
220+
segments: 12,
154221
}),
155222
),
156223
),
224+
translate(
225+
[54 / 2, 54 / 2, radius],
226+
sphere({
227+
radius: 3 * 2,
228+
segments: 12,
229+
}),
230+
),
157231
)
158232

159233
const hexagon = () =>
@@ -243,18 +317,20 @@ const cube = () => [
243317
]
244318

245319
export const thingyDodecahedron = () => [
246-
colorize(hexToRgb('#e76f51'), cube()),
320+
//colorize(hexToRgb('#e76f51'), cube()),
321+
/*
247322
rotateZ(
248323
degToRad(segmentAngle * 2.5),
249324
translateZ(radius, colorize(hexToRgb('#ff6600'), thingy())),
250325
),
251326
colorize(hexToRgb('#3a86ff'), translateY(radius * 2, hexagon())),
327+
*/
252328
colorize(
253329
hexToRgb('#C2F261'),
254330
subtract(
255331
brace(),
256332
scale(
257-
[1.01, 1.01, 1.01],
333+
[1.02, 1.02, 1.02],
258334
rotateZ(degToRad(segmentAngle * 2.5), translateZ(radius, thingy())),
259335
),
260336
cube(),
@@ -265,7 +341,7 @@ export const thingyDodecahedron = () => [
265341
subtract(
266342
translateZ(radius * 2.575, rotateY(degToRad(180), brace())),
267343
scale(
268-
[1.01, 1.01, 1.01],
344+
[1.02, 1.02, 1.02],
269345
rotateZ(degToRad(segmentAngle * 2.5), translateZ(radius, thingy())),
270346
),
271347
cube(),

0 commit comments

Comments
 (0)