@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,192 +0,0 @@
1
- /*
2
- License: This code is placed in the public Domain
3
- Contributed By: Willliam A Adams
4
- September 2011
5
- Adapted for OpenJSCAD.org by Rene K. Mueller, 2013/04/01
6
- */
7
-
8
- // A couple of useful constants
9
- Cpi = 3.14159; // global!
10
- Cphi = 1.61803399;
11
- Cepsilon = 0.00000001;
12
- //var Cpi = 3.14159; // local!
13
- //var Cphi = 1.61803399;
14
- //var Cepsilon = 0.00000001;
15
-
16
-
17
- // Function: clean
18
- //
19
- // Parameters:
20
- // n - A number that might be very close to zero
21
- // Description:
22
- // There are times when you want a very small number to
23
- // just be zero, instead of being that very small number.
24
- // This function will compare the number to an arbitrarily small
25
- // number. If it is smaller than the 'epsilon', then zero will be
26
- // returned. Otherwise, the original number will be returned.
27
- //
28
-
29
- clean = function clean(n) { return (n < 0) ? ((n < -Cepsilon) ? n : 0) :
30
- (n < Cepsilon) ? 0 : n; };
31
-
32
- // Function: safediv
33
- //
34
- // Parameters
35
- // n - The numerator
36
- // d - The denominator
37
- //
38
- // Description:
39
- // Since division by zero is generally not a desirable thing, safediv
40
- // will return '0' whenever there is a division by zero. Although this will
41
- // mask some erroneous division by zero errors, it is often the case
42
- // that you actually want this behavior. So, it makes it convenient.
43
- savediv = function safediv(n,d) { return (d==0) ? 0 : n/d; }
44
-
45
-
46
- //==================================
47
- // Degrees
48
- //==================================
49
-
50
- DEGREES = function DEGREES(radians) { return (180/Cpi) * radians; }
51
-
52
- RADIANS = function RADIANS(degrees) { return Cpi/180 * degrees; }
53
-
54
- deg = function deg(deg, min, sec) { return [deg, min===undefined?0:min, sec===undefined?0:sec]; }
55
-
56
- deg_to_dec = function deg_to_dec(d) { return d[0] + d[1]/60 + d[2]/60/60; }
57
-
58
-
59
- //==================================
60
- // Spherical coordinates
61
- //==================================
62
-
63
- // create an instance of a spherical coordinate
64
- // long - rotation around z -axis
65
- // lat - latitude, starting at 0 == 'north pole'
66
- // rad - distance from center
67
- sph = function sph(long, lat, rad) { return [long, lat, rad===undefined?1:rad] }
68
-
69
- // Convert spherical to cartesian
70
- //function sph_to_cart(s) { return [
71
- // clean(s[2]*sin(s[1])*cos(s[0])),
72
- // clean(s[2]*sin(s[1])*sin(s[0])),
73
- // clean(s[2]*cos(s[1]))
74
- // ]; }
75
-
76
- sph_to_cart = function sph_to_cart(s) {
77
- return [
78
- clean(s[2]*sin(s[1])*cos(s[0])),
79
-
80
- clean(s[2]*sin(s[1])*sin(s[0])),
81
-
82
- clean(s[2]*cos(s[1]))
83
- ]; }
84
-
85
- // Convert from cartesian to spherical
86
- sph_from_cart = function sph_from_cart(c) {
87
- return sph(
88
- atan2(c[1],c[0]),
89
- atan2(sqrt(c[0]*c[0]+c[1]*c[1]), c[2]),
90
- sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])
91
- ); }
92
-
93
- sphu_from_cart = function sphu_from_cart(c, rad) {
94
- return sph(
95
- atan2(c[1],c[0]),
96
- atan2(sqrt(c[0]*c[0]+c[1]*c[1]), c[2]),
97
- rad===undefined?1:rad
98
- ); }
99
-
100
- // compute the chord distance between two points on a sphere
101
- sph_dist = function sph_dist(c1, c2) {
102
- return sqrt(
103
- c1[2]*c1[2] + c2[2]*c2[2] -
104
- 2*c1[2]*c2[2]*
105
- ((cos(c1[1])*cos(c2[1])) + cos(c1[0]-c2[0])*sin(c1[1])*sin(c2[1]))
106
- ); }
107
-
108
-
109
- //==========================================
110
- // Geodesic calculations
111
- //
112
- // Reference: Geodesic Math and How to Use It
113
- // By: Hugh Kenner
114
- // Second Paperback Edition (2003), p.74-75
115
- // http://www.amazon.com/Geodesic-Math-How-Hugh-Kenner/dp/0520239318
116
- //
117
- // The book was used for reference, so if you want to check the math,
118
- // you can plug in various numbers to various routines and see if you get
119
- // the same numbers in the book.
120
- //
121
- // In general, there are enough routines here to implement the various
122
- // pieces necessary to make geodesic objects.
123
- //==========================================
124
-
125
- function poly_sum_interior_angles(sides) { return (sides-2)*180; }
126
- function poly_single_interior_angle(pq) { return poly_sum_interior_angles(pq[0])/pq[0]; }
127
-
128
-
129
- // Calculate angular deficiency of each vertex in a platonic solid
130
- // p - sides
131
- // q - number of edges per vertex
132
- angular_defect = function angular_defect(pq) { return 360 - (poly_single_interior_angle(pq)*pq[1]); }
133
- plat_deficiency = function plat_deficiency(pq) { return DEGREES(2*Cpi - pq[1]*Cpi*(1-2/pq[0])); }
134
-
135
- plat_dihedral = function plat_dihedral(pq) { return 2 * asin( cos(180/pq[1])/sin(180/pq[0])); }
136
-
137
- // Given a set of coordinates, return the frequency
138
- // Simply calculated by adding up the values of the coordinates
139
- geo_freq = function geo_freq(xyz) { return xyz[0]+xyz[1]+xyz[2]; }
140
-
141
- // Convert between the 2D coordinates of vertices on the face triangle
142
- // to the 3D vertices needed to calculate spherical coordinates
143
- geo_tri2_tri3 = function geo_tri2_tri3(xyf) { return [xyf[1], xyf[0]-xyf[1], xyf[2]-xyf[0]]; }
144
-
145
- // Given coordinates for a vertex on the octahedron face
146
- // return the spherical coordinates for the vertex
147
- // class 1, method 1
148
- octa_class1 = function octa_class1(c) {
149
- return sph(
150
- atan(safediv(c[0], c[1])),
151
- atan(sqrt(c[0]*c[0]+c[1]*c[1])/c[2]),
152
- 1
153
- ); }
154
-
155
- octa_class2 = function octa_class2(c) {
156
- return sph(
157
- atan(c[0]/c[1]),
158
- atan( sqrt( 2*(c[0]*c[0]+c[1]*c[1])) /c[2]),
159
- 1
160
- ); }
161
-
162
- icosa_class1 = function icosa_class1(c) {
163
- return
164
- octa_class1(
165
- [
166
- c[0]*sin(72),
167
- c[1]+c[0]*cos(72),
168
- geo_freq(c)/2+c[2]/Cphi
169
- ]); }
170
-
171
- icosa_class2 = function icosa_class2(c) {
172
- return sph(
173
- atan([c0]/c[1]),
174
- atan(sqrt(c[0]*c[0]+c[1]*c[1]))/cos(36)*c[2],
175
- 1
176
- ); }
177
-
178
- tetra_class1 = function tetra_class1(c) {
179
- return octa_class1(
180
- [
181
- sqrt(3*c[0]),
182
- 2*c[1]-c[0],
183
- (3*c[2]-c[0]-c[1])/sqrt(2)
184
- ]); }
185
-
186
- class1_icosa_chord_factor = function class1_icosa_chord_factor(v1, v2, freq) {
187
- return sph_dist(
188
- icosa_class1(geo_tri2_tri3( [v1[0], v1[1], freq])),
189
- icosa_class1(geo_tri2_tri3( [v2[0], v2[1], freq]))
190
- ); }
191
-
192
-