@jscad/web 2.5.10 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/jscad-web.min.js +959 -2030
  4. package/examples/CHANGELOG.md +30 -0
  5. package/examples/README.md +1 -5
  6. package/examples/package.json +1 -1
  7. package/examples/parameters/gear.js +1 -1
  8. package/locales/README.md +23 -0
  9. package/locales/de.json +1 -0
  10. package/locales/en.json +2 -1
  11. package/locales/fr.json +1 -0
  12. package/locales/hr.json +1 -0
  13. package/locales/ja.json +1 -0
  14. package/locales/zh.json +62 -0
  15. package/package.json +7 -7
  16. package/postInstall.js +0 -1
  17. package/src/index.js +2 -1
  18. package/src/sideEffects/i18n/index.js +2 -1
  19. package/src/sideEffects/worker/index.js +7 -8
  20. package/src/ui/flow/design.js +10 -305
  21. package/src/ui/flow/reducers.js +304 -0
  22. package/examples/old/benchmark-cag.jscad +0 -27
  23. package/examples/old/benchmark-csg.jscad +0 -29
  24. package/examples/old/benchmark.jscad +0 -25
  25. package/examples/old/bunch-cubes.jscad +0 -17
  26. package/examples/old/complex/example001.jscad +0 -31
  27. package/examples/old/complex/example002.jscad +0 -25
  28. package/examples/old/complex/example003.jscad +0 -25
  29. package/examples/old/complex/example004.jscad +0 -16
  30. package/examples/old/complex/example005.jscad +0 -27
  31. package/examples/old/complex/globe.js +0 -235
  32. package/examples/old/complex/iphone4-case.js +0 -213
  33. package/examples/old/complex/umbilical_torus.js +0 -43
  34. package/examples/old/complex/umbilical_torus.scad +0 -37
  35. package/examples/old/core/cncCutout.js +0 -16
  36. package/examples/old/core/connectors/servo.js +0 -185
  37. package/examples/old/core/extrusions/extrudeLinear.js +0 -24
  38. package/examples/old/core/extrusions/extrudeRectangular.js +0 -21
  39. package/examples/old/core/extrusions/extrudeRotate.js +0 -43
  40. package/examples/old/core/extrusions/slices/four2three-round.js +0 -62
  41. package/examples/old/core/extrusions/slices/four2three.js +0 -53
  42. package/examples/old/core/extrusions/slices/jar-barrel.js +0 -60
  43. package/examples/old/core/extrusions/slices/jar.js +0 -69
  44. package/examples/old/core/extrusions/slices/non-aff.js +0 -72
  45. package/examples/old/core/extrusions/slices/rose.js +0 -52
  46. package/examples/old/core/extrusions/slices/screw.js +0 -34
  47. package/examples/old/core/extrusions/slices/screwDouble.js +0 -34
  48. package/examples/old/core/extrusions/slices/slices.js +0 -43
  49. package/examples/old/core/extrusions/slices/spring.js +0 -41
  50. package/examples/old/core/extrusions/slices/three2four.js +0 -42
  51. package/examples/old/core/extrusions/slices/tor.js +0 -30
  52. package/examples/old/core/hulls/hullChain.js +0 -58
  53. package/examples/old/core/lookup.js +0 -19
  54. package/examples/old/core/platonics/main.jscad +0 -42
  55. package/examples/old/core/platonics/maths_geodesic.jscad +0 -192
  56. package/examples/old/core/platonics/origv07/dualdodeca_difference.stl +0 -1962
  57. package/examples/old/core/platonics/origv07/dualdodeca_intersection.stl +0 -1374
  58. package/examples/old/core/platonics/origv07/dualdodeca_union.stl +0 -1822
  59. package/examples/old/core/platonics/origv07/maths_geodesic.scad +0 -162
  60. package/examples/old/core/platonics/origv07/platonic.scad +0 -483
  61. package/examples/old/core/platonics/origv07/test_platonic.scad +0 -616
  62. package/examples/old/core/platonics/platonic.jscad +0 -528
  63. package/examples/old/core/text/textSimplex.js +0 -625
  64. package/examples/old/core/transforms/transformations.js +0 -29
  65. package/examples/old/echo.jscad +0 -7
  66. package/examples/old/formats/scad/example001.scad +0 -26
  67. package/examples/old/formats/scad/example002.scad +0 -23
  68. package/examples/old/formats/scad/example003.scad +0 -20
  69. package/examples/old/formats/scad/example004.scad +0 -11
  70. package/examples/old/formats/scad/example005.scad +0 -20
  71. package/examples/old/json_logo.json +0 -1
  72. package/examples/old/parameters/axis-coupler.js +0 -149
  73. package/examples/old/parameters/celtic-knot-ring.js +0 -300
  74. package/examples/old/parameters/grille.js +0 -257
  75. package/examples/old/parameters/lamp-shade.js +0 -369
  76. package/examples/old/parameters/name-plate.js +0 -46
  77. package/examples/old/parameters/s-hook.js +0 -131
  78. package/examples/old/parameters/stepper-motor.js +0 -127
  79. package/examples/old/various/logo.js +0 -32
  80. package/examples/old/voxel.json +0 -1
@@ -1,528 +0,0 @@
1
- /*
2
- Contributed By: Willliam A Adams
3
- September 2011
4
- Adapted for OpenJSCAD.org by Rene K. Mueller, 2013/04/01
5
- */
6
- include("maths_geodesic.jscad");
7
-
8
- //var Cpi = 3.14159;
9
- //var Cphi = 1.61803399;
10
- //var Cepsilon = 0.00000001;
11
-
12
- // Information about platonic solids
13
- // This information is useful in constructing the various solids
14
- // can be found here: http://en.wikipedia.org/wiki/Platonic_solid
15
- // V - vertices
16
- // E - edges
17
- // F - faces
18
- // number, V, E, F, schlafli symbol, dihedral angle, element, name
19
- //tetrahedron = [1, 4, 6, 4, [3,3], 70.5333, "fire", "tetrahedron"];
20
- //hexahedron = [2, 8, 12, 6, [4,3], 90, "earth", "cube"];
21
- //octahedron = [3, 6, 12, 8, [3,4], 109.467, "air", "air"];
22
- //dodecahedron = [4, 20, 30, 12, [5,3], 116.565, "ether", "universe"];
23
- //icosahedron = [5, 12, 30, 20, [3,5], 138.190, "water", "water"];
24
-
25
- // Schlafli representation for the platonic solids
26
- // Given this representation, we have enough information
27
- // to derive a number of other attributes of the solids
28
- var tetra_sch = [3,3];
29
- var hexa_sch = [4,3];
30
- var octa_sch = [3,4];
31
- var dodeca_sch = [5,3];
32
- var icosa_sch = [3,5];
33
-
34
- // Given the schlafli representation, calculate
35
- // the number of edges, vertices, and faces for the solid
36
- function plat_edges(pq) { return (2*pq[0]*pq[1])/
37
- ((2*pq[0])-(pq[0]*pq[1])+(2*pq[1])); }
38
- function plat_vertices(pq) { return (2*plat_edges(pq))/pq[1]; }
39
- function plat_faces(pq) { return (2*plat_edges(pq))/pq[0]; }
40
-
41
-
42
- // Calculate angular deficiency of each vertex in a platonic solid
43
- // p - sides
44
- // q - number of edges per vertex
45
- //function angular_defect(pq) = 360 - (poly_single_interior_angle(pq)*pq[1]);
46
- function plat_deficiency(pq) { return DEGREES(2*Cpi - pq[1]*Cpi*(1-2/pq[0])); }
47
-
48
- function plat_dihedral(pq) { return 2 * asin( cos(180/pq[1])/sin(180/pq[0])); }
49
-
50
- function plat_circumradius(pq, a) {
51
- return (a/2)*
52
- tan(Cpi/pq[1])*
53
- tan(plat_dihedral(pq)/2);
54
- }
55
-
56
- function plat_midradius(pq, a) {
57
- return (a/2)*
58
- cot(Cpi/pq[0])*
59
- tan(plat_dihedral(pq)/2);
60
- }
61
-
62
- function plat_inradius(pq,a) {
63
- return a/(2*tan(DEGREES(Cpi/pq[0])))*
64
- sqrt((1-cos(plat_dihedral(pq)))/(1+cos(plat_dihedral(pq))));
65
- }
66
-
67
- //================================================
68
- // Tetrahedron
69
- //================================================
70
- var tetra_cart = [
71
- [+1, +1, +1],
72
- [-1, -1, +1],
73
- [-1, +1, -1],
74
- [+1, -1, -1]
75
- ];
76
-
77
- function tetra_unit(rad) {
78
- rad = rad==='undefined'?1:rad;
79
- return [
80
- sph_to_cart(sphu_from_cart(tetra_cart[0], rad)),
81
- sph_to_cart(sphu_from_cart(tetra_cart[1], rad)),
82
- sph_to_cart(sphu_from_cart(tetra_cart[2], rad)),
83
- sph_to_cart(sphu_from_cart(tetra_cart[3], rad)),
84
- ];
85
- }
86
-
87
- var tetrafaces = [
88
- [0, 3, 1],
89
- [0,1,2],
90
- [2,1,3],
91
- [0,2,3]
92
- ];
93
-
94
- var tetra_edges = [
95
- [0,1],
96
- [0,2],
97
- [0,3],
98
- [1,2],
99
- [1,3],
100
- [2,3],
101
- ];
102
-
103
- tetrahedron = function tetrahedron(rad) {
104
- //tetrahedron = function(rad) {
105
- rad = rad==='undefined'?1:rad;
106
- return [tetra_unit(rad), tetrafaces, tetra_edges];
107
- }
108
-
109
-
110
-
111
- //================================================
112
- // Hexahedron - Cube
113
- //================================================
114
- // vertices for a unit cube with sides of length 1
115
- var hexa_cart = [
116
- [0.5, 0.5, 0.5],
117
- [-0.5, 0.5, 0.5],
118
- [-0.5, -0.5, 0.5],
119
- [0.5, -0.5, 0.5],
120
- [0.5, 0.5, -0.5],
121
- [-0.5, 0.5, -0.5],
122
- [-0.5, -0.5, -0.5],
123
- [0.5, -0.5, -0.5],
124
- ];
125
-
126
- function hexa_unit(rad) {
127
- rad = rad==='undefined'?1:rad;
128
- return [
129
- sph_to_cart(sphu_from_cart(hexa_cart[0], rad)),
130
- sph_to_cart(sphu_from_cart(hexa_cart[1], rad)),
131
- sph_to_cart(sphu_from_cart(hexa_cart[2], rad)),
132
- sph_to_cart(sphu_from_cart(hexa_cart[3], rad)),
133
- sph_to_cart(sphu_from_cart(hexa_cart[4], rad)),
134
- sph_to_cart(sphu_from_cart(hexa_cart[5], rad)),
135
- sph_to_cart(sphu_from_cart(hexa_cart[6], rad)),
136
- sph_to_cart(sphu_from_cart(hexa_cart[7], rad)),
137
- ];
138
- }
139
-
140
- // enumerate the faces of a cube
141
- // vertex order is clockwise winding
142
- var hexafaces = [
143
- [0,3,2,1], // top
144
- [0,1,5,4],
145
- [1,2,6,5],
146
- [2,3,7,6],
147
- [3,0,4,7],
148
- [4,5,6,7], // bottom
149
- ];
150
-
151
- var hexa_edges = [
152
- [0,1],
153
- [0,3],
154
- [0,4],
155
- [1,2],
156
- [1,5],
157
- [2,3],
158
- [2,6],
159
- [3,7],
160
- [4,5],
161
- [4,7],
162
- [5,4],
163
- [5,6],
164
- [6,7],
165
- ];
166
-
167
-
168
- hexahedron = function hexahedron(rad) {
169
- rad = rad!=='undefined'?rad:1;
170
- return [hexa_unit(rad), hexafaces, hexa_edges];
171
- }
172
-
173
-
174
- //================================================
175
- // Octahedron
176
- //================================================
177
-
178
- var octa_cart = [
179
- [+1, 0, 0], // + x axis
180
- [-1, 0, 0], // - x axis
181
- [0, +1, 0], // + y axis
182
- [0, -1, 0], // - y axis
183
- [0, 0, +1], // + z axis
184
- [0, 0, -1] // - z axis
185
- ];
186
-
187
- function octa_unit(rad) {
188
- rad = rad!=='undefined'?rad:1;
189
- return [
190
- sph_to_cart(sphu_from_cart(octa_cart[0], rad)),
191
- sph_to_cart(sphu_from_cart(octa_cart[1], rad)),
192
- sph_to_cart(sphu_from_cart(octa_cart[2], rad)),
193
- sph_to_cart(sphu_from_cart(octa_cart[3], rad)),
194
- sph_to_cart(sphu_from_cart(octa_cart[4], rad)),
195
- sph_to_cart(sphu_from_cart(octa_cart[5], rad)),
196
- ];
197
- }
198
-
199
- var octafaces = [
200
- [4,2,0],
201
- [4,0,3],
202
- [4,3,1],
203
- [4,1,2],
204
- [5,0,2],
205
- [5,3,0],
206
- [5,1,3],
207
- [5,2,1]
208
- ];
209
-
210
- var octa_edges = [
211
- [0,2],
212
- [0,3],
213
- [0,4],
214
- [0,5],
215
- [1,2],
216
- [1,3],
217
- [1,4],
218
- [1,5],
219
- [2,4],
220
- [2,5],
221
- [3,4],
222
- [3,5],
223
- ];
224
-
225
- octahedron = function octahedron(rad) {
226
- rad = rad!=='undefined'?rad:1;
227
- return [octa_unit(rad), octafaces, octa_edges];
228
- }
229
-
230
- //================================================
231
- // Dodecahedron
232
- //================================================
233
- // (+-1, +-1, +-1)
234
- // (0, +-1/Cphi, +-Cphi)
235
- // (+-1/Cphi, +-Cphi, 0)
236
- // (+-Cphi, 0, +-1/Cphi)
237
-
238
- var dodeca_cart = [
239
- [+1, +1, +1], // 0, 0
240
- [+1, -1, +1], // 0, 1
241
- [-1, -1, +1], // 0, 2
242
- [-1, +1, +1], // 0, 3
243
-
244
- [+1, +1, -1], // 1, 4
245
- [-1, +1, -1], // 1, 5
246
- [-1, -1, -1], // 1, 6
247
- [+1, -1, -1], // 1, 7
248
-
249
- [0, +1/Cphi, +Cphi], // 2, 8
250
- [0, -1/Cphi, +Cphi], // 2, 9
251
- [0, -1/Cphi, -Cphi], // 2, 10
252
- [0, +1/Cphi, -Cphi], // 2, 11
253
-
254
- [-1/Cphi, +Cphi, 0], // 3, 12
255
- [+1/Cphi, +Cphi, 0], // 3, 13
256
- [+1/Cphi, -Cphi, 0], // 3, 14
257
- [-1/Cphi, -Cphi, 0], // 3, 15
258
-
259
- [-Cphi, 0, +1/Cphi], // 4, 16
260
- [+Cphi, 0, +1/Cphi], // 4, 17
261
- [+Cphi, 0, -1/Cphi], // 4, 18
262
- [-Cphi, 0, -1/Cphi], // 4, 19
263
- ];
264
-
265
- function dodeca_unit(rad) {
266
- rad = rad!=='undefined'?rad:1;
267
- return [
268
- sph_to_cart(sphu_from_cart(dodeca_cart[0], rad)),
269
- sph_to_cart(sphu_from_cart(dodeca_cart[1], rad)),
270
- sph_to_cart(sphu_from_cart(dodeca_cart[2], rad)),
271
- sph_to_cart(sphu_from_cart(dodeca_cart[3], rad)),
272
- sph_to_cart(sphu_from_cart(dodeca_cart[4], rad)),
273
- sph_to_cart(sphu_from_cart(dodeca_cart[5], rad)),
274
- sph_to_cart(sphu_from_cart(dodeca_cart[6], rad)),
275
- sph_to_cart(sphu_from_cart(dodeca_cart[7], rad)),
276
- sph_to_cart(sphu_from_cart(dodeca_cart[8], rad)),
277
- sph_to_cart(sphu_from_cart(dodeca_cart[9], rad)),
278
- sph_to_cart(sphu_from_cart(dodeca_cart[10], rad)),
279
- sph_to_cart(sphu_from_cart(dodeca_cart[11], rad)),
280
- sph_to_cart(sphu_from_cart(dodeca_cart[12], rad)),
281
- sph_to_cart(sphu_from_cart(dodeca_cart[13], rad)),
282
- sph_to_cart(sphu_from_cart(dodeca_cart[14], rad)),
283
- sph_to_cart(sphu_from_cart(dodeca_cart[15], rad)),
284
- sph_to_cart(sphu_from_cart(dodeca_cart[16], rad)),
285
- sph_to_cart(sphu_from_cart(dodeca_cart[17], rad)),
286
- sph_to_cart(sphu_from_cart(dodeca_cart[18], rad)),
287
- sph_to_cart(sphu_from_cart(dodeca_cart[19], rad)),
288
- ];
289
- }
290
-
291
-
292
- // These are the pentagon faces
293
- // but CGAL has a problem rendering if things are
294
- // not EXACTLY coplanar
295
- // so use the triangle faces instead
296
- //dodeca_faces=[
297
- // [1,9,8,0,17],
298
- // [9,1,14,15,2],
299
- // [9,2,16,3,8],
300
- // [8,3,12,13,0],
301
- // [0,13,4,18,17],
302
- // [1,17,18,7,14],
303
- // [15,14,7,10,6],
304
- // [2,15,6,19,16],
305
- // [16,19,5,12,3],
306
- // [12,5,11,4,13],
307
- // [18,4,11,10,7],
308
- // [19,6,10,11,5]
309
- // ];
310
- var dodeca_faces = [
311
- [1,9,8],
312
- [1,8,0],
313
- [1,0,17],
314
-
315
- [9,1,14],
316
- [9,14,15],
317
- [9,15,2],
318
-
319
- [9,2,16],
320
- [9,16,3],
321
- [9,3,8],
322
-
323
- [8,3,12],
324
- [8,12,13],
325
- [8,13,0],
326
-
327
- [0,13,4],
328
- [0,4,18],
329
- [0,18,17],
330
-
331
- [1,17,18],
332
- [1,18,7],
333
- [1,7,14],
334
-
335
- [15,14,7],
336
- [15,7,10],
337
- [15,10,6],
338
-
339
- [2,15,6],
340
- [2,6,19],
341
- [2,19,16],
342
-
343
- [16,19,5],
344
- [16,5,12],
345
- [16,12,3],
346
-
347
- [12,5,11],
348
- [12,11,4],
349
- [12,4,13],
350
-
351
- [18,4,11],
352
- [18,11,10],
353
- [18,10,7],
354
-
355
- [19,6,10],
356
- [19,10,11],
357
- [19,11,5]
358
- ];
359
-
360
- var dodeca_edges=[
361
- [0,8],
362
- [0,13],
363
- [0,17],
364
-
365
- [1,9],
366
- [1,14],
367
- [1,17],
368
-
369
- [2,9],
370
- [2,15],
371
- [2,16],
372
-
373
- [3,8],
374
- [3,12],
375
- [3,16],
376
-
377
- [4,11],
378
- [4,13],
379
- [4,18],
380
-
381
- [5,11],
382
- [5,12],
383
- [5,19],
384
-
385
- [6,10],
386
- [6,15],
387
- [6,19],
388
-
389
- [7,10],
390
- [7,14],
391
- [7,18],
392
-
393
- [8,9],
394
- [10,11],
395
- [12,13],
396
- [14,15],
397
- [16,19],
398
- [17,18],
399
- ];
400
-
401
- dodecahedron = function dodecahedron(rad) {
402
- rad = rad!=='undefined'?rad:1;
403
- return [dodeca_unit(rad), dodeca_faces, dodeca_edges];
404
- }
405
-
406
- //================================================
407
- // Icosahedron
408
- //================================================
409
- //
410
- // (0, +-1, +-Cphi)
411
- // (+-Cphi, 0, +-1)
412
- // (+-1, +-Cphi, 0)
413
-
414
- var icosa_cart = [
415
- [0, +1, +Cphi], // 0
416
- [0, +1, -Cphi], // 1
417
- [0, -1, -Cphi], // 2
418
- [0, -1, +Cphi], // 3
419
-
420
- [+Cphi, 0, +1], // 4
421
- [+Cphi, 0, -1], // 5
422
- [-Cphi, 0, -1], // 6
423
- [-Cphi, 0, +1], // 7
424
-
425
- [+1, +Cphi, 0], // 8
426
- [+1, -Cphi, 0], // 9
427
- [-1, -Cphi, 0], // 10
428
- [-1, +Cphi, 0] // 11
429
- ];
430
-
431
- function icosa_sph(rad) {
432
- rad = rad!=='undefined'?rad:1;
433
- return [
434
- sphu_from_cart(icosa_cart[0], rad),
435
- sphu_from_cart(icosa_cart[1], rad),
436
- sphu_from_cart(icosa_cart[2], rad),
437
- sphu_from_cart(icosa_cart[3], rad),
438
- sphu_from_cart(icosa_cart[4], rad),
439
- sphu_from_cart(icosa_cart[5], rad),
440
- sphu_from_cart(icosa_cart[6], rad),
441
- sphu_from_cart(icosa_cart[7], rad),
442
- sphu_from_cart(icosa_cart[8], rad),
443
- sphu_from_cart(icosa_cart[9], rad),
444
- sphu_from_cart(icosa_cart[10], rad),
445
- sphu_from_cart(icosa_cart[11], rad),
446
- ];
447
- }
448
-
449
- function icosa_unit(rad) {
450
- rad = rad!=='undefined'?rad:1;
451
- return [
452
- sph_to_cart(sphu_from_cart(icosa_cart[0], rad)),
453
- sph_to_cart(sphu_from_cart(icosa_cart[1], rad)),
454
- sph_to_cart(sphu_from_cart(icosa_cart[2], rad)),
455
- sph_to_cart(sphu_from_cart(icosa_cart[3], rad)),
456
- sph_to_cart(sphu_from_cart(icosa_cart[4], rad)),
457
- sph_to_cart(sphu_from_cart(icosa_cart[5], rad)),
458
- sph_to_cart(sphu_from_cart(icosa_cart[6], rad)),
459
- sph_to_cart(sphu_from_cart(icosa_cart[7], rad)),
460
- sph_to_cart(sphu_from_cart(icosa_cart[8], rad)),
461
- sph_to_cart(sphu_from_cart(icosa_cart[9], rad)),
462
- sph_to_cart(sphu_from_cart(icosa_cart[10], rad)),
463
- sph_to_cart(sphu_from_cart(icosa_cart[11], rad)),
464
- ];
465
- }
466
-
467
- var icosa_faces = [
468
- [3,0,4],
469
- [3,4,9],
470
- [3,9,10],
471
- [3,10,7],
472
- [3,7,0],
473
- [0,8,4],
474
- [0,7,11],
475
- [0,11,8],
476
- [4,8,5],
477
- [4,5,9],
478
- [7,10,6],
479
- [7,6,11],
480
- [9,5,2],
481
- [9,2,10],
482
- [2,6,10],
483
- [1,5,8],
484
- [1,8,11],
485
- [1,11,6],
486
- [5,1,2],
487
- [2,1,6]
488
- ];
489
-
490
- var icosa_edges = [
491
- [0,3],
492
- [0,4],
493
- [0,7],
494
- [0,8],
495
- [0,11],
496
- [1,5],
497
- [1,8],
498
- [1,11],
499
- [1,6],
500
- [1,2],
501
- [2,5],
502
- [2,6],
503
- [2,9],
504
- [2,10],
505
- [3,4],
506
- [3,9],
507
- [3,10],
508
- [3,7],
509
- [4,5],
510
- [4,8],
511
- [4,9],
512
- [5,8],
513
- [5,9],
514
- [6,7],
515
- [6,10],
516
- [6,11],
517
- [7,10],
518
- [7,11],
519
- [8,11],
520
- [9,10],
521
- ];
522
-
523
- icosahedron = function icosahedron(rad) {
524
- rad = rad!=='undefined'?rad:1;
525
- return [icosa_unit(rad), icosa_faces, icosa_edges];
526
- }
527
-
528
-