@woosh/meep-engine 2.98.0 → 2.98.1

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 (45) hide show
  1. package/build/meep.cjs +33 -10
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +33 -10
  4. package/package.json +1 -1
  5. package/src/core/collection/set/compute_set_difference.d.ts.map +1 -1
  6. package/src/core/collection/set/compute_set_difference.js +8 -0
  7. package/src/core/collection/set/compute_set_difference.spec.d.ts +2 -0
  8. package/src/core/collection/set/compute_set_difference.spec.d.ts.map +1 -0
  9. package/src/core/collection/set/compute_set_difference.spec.js +45 -0
  10. package/src/core/collection/set/compute_set_intersection.d.ts +1 -0
  11. package/src/core/collection/set/compute_set_intersection.d.ts.map +1 -1
  12. package/src/core/collection/set/compute_set_intersection.js +9 -0
  13. package/src/core/collection/set/compute_set_intersection.spec.d.ts +2 -0
  14. package/src/core/collection/set/compute_set_intersection.spec.d.ts.map +1 -0
  15. package/src/core/collection/set/compute_set_intersection.spec.js +45 -0
  16. package/src/core/collection/set/set_remove.d.ts +2 -0
  17. package/src/core/collection/set/set_remove.d.ts.map +1 -1
  18. package/src/core/collection/set/set_remove.js +2 -0
  19. package/src/core/color/oklab/XYZ.spec.d.ts +2 -0
  20. package/src/core/color/oklab/XYZ.spec.d.ts.map +1 -0
  21. package/src/core/color/oklab/XYZ.spec.js +17 -0
  22. package/src/core/color/oklab/oklab_to_xyz.d.ts +9 -0
  23. package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -0
  24. package/src/core/color/oklab/oklab_to_xyz.js +32 -0
  25. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts +2 -0
  26. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts.map +1 -0
  27. package/src/core/color/oklab/oklab_to_xyz.spec.js +31 -0
  28. package/src/core/color/oklab/xyz_to_oklab.d.ts +8 -0
  29. package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -0
  30. package/src/core/color/oklab/xyz_to_oklab.js +29 -0
  31. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts +2 -0
  32. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts.map +1 -0
  33. package/src/core/color/oklab/xyz_to_oklab.spec.js +31 -0
  34. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  35. package/src/core/color/sRGB/linear_to_sRGB.js +16 -5
  36. package/src/core/color/sRGB/sRGB_to_linear.d.ts.map +1 -1
  37. package/src/core/color/sRGB/sRGB_to_linear.js +17 -5
  38. package/src/core/color/xyz/rgb_to_xyz.d.ts +1 -0
  39. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  40. package/src/core/color/xyz/rgb_to_xyz.js +4 -3
  41. package/src/core/color/xyz/xyz_to_rgb.d.ts +1 -1
  42. package/src/core/color/xyz/xyz_to_rgb.js +4 -4
  43. package/src/core/color/hsluv/HSLuv.d.ts +0 -13
  44. package/src/core/color/hsluv/HSLuv.d.ts.map +0 -1
  45. package/src/core/color/hsluv/HSLuv.js +0 -187
@@ -1,187 +0,0 @@
1
- /**
2
- * @see https://github.com/hsluv/hsluv-c/blob/master/src/hsluv.c
3
- */
4
-
5
- const temp_0 = new Float32Array(3);
6
- const temp_1 = new Float32Array(3);
7
- /* for RGB */
8
- const m = new Float32Array([
9
- 3.24096994190452134377, -1.53738317757009345794, -0.49861076029300328366,
10
- -0.96924363628087982613, 1.87596750150772066772, 0.04155505740717561247,
11
- 0.05563007969699360846, -0.20397695888897656435, 1.05697151424287856072
12
- ]);
13
-
14
- /* for XYZ */
15
- const m_inv = new Float32Array([
16
- 0.41239079926595948129, 0.35758433938387796373, 0.18048078840183428751,
17
- 0.21263900587151035754, 0.71516867876775592746, 0.07219231536073371500,
18
- 0.01933081871559185069, 0.11919477979462598791, 0.95053215224966058086
19
- ]);
20
-
21
- function dot_product(t1, offset_1, t2, offset_2) {
22
- return t1[offset_1] * t2[offset_2] + t1[offset_1 + 1] * t2[offset_2 + 1] + t1[offset_1 + 2] * t2[offset_2 + 2];
23
- }
24
-
25
- /* Used for rgb conversions */
26
-
27
- function from_linear(c) {
28
- if (c <= 0.0031308)
29
- return 12.92 * c;
30
- else
31
- return 1.055 * Math.pow(c, 1.0 / 2.4) - 0.055;
32
- }
33
-
34
- function to_linear(c) {
35
- if (c > 0.04045)
36
- return Math.pow((c + 0.055) / 1.055, 2.4);
37
- else
38
- return c / 12.92;
39
- }
40
-
41
- const ref_u = 0.19783000664283680764;
42
- const ref_v = 0.46831999493879100370;
43
-
44
- const kappa = 903.29629629629629629630;
45
- const epsilon = 0.00885645167903563082;
46
-
47
-
48
- /**
49
- *
50
- * @param {number} theta
51
- * @param {number[]|Float32Array} line
52
- * @param {number} line_address
53
- * @return {number}
54
- */
55
- function ray_length_until_intersect(theta, line, line_address) {
56
- return line[line_address + 1] / (Math.sin(theta) - line[line_address] * Math.cos(theta));
57
- }
58
-
59
- function get_bounds( l, bounds)
60
- {
61
- const tl = l + 16.0;
62
- const sub1 = (tl * tl * tl) / 1560896.0;
63
- const sub2 = (sub1 > epsilon ? sub1 : (l / kappa));
64
- let channel;
65
- let t;
66
-
67
- for(channel = 0; channel < 3; channel++) {
68
- const ch3 = channel*3;
69
- let m1 = m[ch3];
70
- let m2 = m[ch3+1];
71
- let m3 = m[ch3+2];
72
-
73
- for (t = 0; t < 2; t++) {
74
- const top1 = (284517.0 * m1 - 94839.0 * m3) * sub2;
75
- const top2 = (838422.0 * m3 + 769860.0 * m2 + 731718.0 * m1) * l * sub2 - 769860.0 * t * l;
76
- const bottom = (632260.0 * m3 - 126452.0 * m2) * sub2 + 126452.0 * t;
77
-
78
- const bounds_index = channel * 2 + t;
79
- const bounds_address = bounds_index*2;
80
-
81
- bounds[bounds_address] = top1 / bottom;
82
- bounds[bounds_address] = top2 / bottom;
83
- }
84
- }
85
- }
86
-
87
- function max_chroma_for_lh(l, h) {
88
- let min_len = Infinity;
89
- const hrad = h * 0.01745329251994329577; /* (2 * pi / 360) */
90
- const bounds = new Float32Array(12);
91
- let i;
92
-
93
- get_bounds(l, bounds);
94
-
95
- for (i = 0; i < 6; i++) {
96
- const len = ray_length_until_intersect(hrad, bounds, i * 2);
97
-
98
- if (len >= 0 && len < min_len)
99
- min_len = len;
100
- }
101
-
102
- return min_len;
103
- }
104
-
105
- function hsluv2lch(input, output) {
106
- let h = input[0];
107
- const s = input[1];
108
- const l = input[2];
109
- let c;
110
-
111
- /* White and black: disambiguate chroma */
112
- if (l > 99.9999999 || l < 0.00000001)
113
- c = 0.0;
114
- else
115
- c = max_chroma_for_lh(l, h) / 100.0 * s;
116
-
117
- /* Grays: disambiguate hue */
118
- if (s < 0.00000001)
119
- h = 0.0;
120
-
121
- output[0] = l;
122
- output[1] = c;
123
- output[2] = h;
124
- }
125
-
126
- function lch2luv(input, output) {
127
-
128
- }
129
-
130
- function luv2xyz(input, output) {
131
-
132
- }
133
-
134
- function xyz2rgb(input, output) {
135
- const r = from_linear(dot_product(m, 0, input, 0));
136
-
137
- const g = from_linear(dot_product(m, 3, input, 0));
138
-
139
- const b = from_linear(dot_product(m, 6, input, 0));
140
-
141
- output[0] = r;
142
- output[1] = g;
143
- output[2] = b;
144
- }
145
-
146
- function rgb2xyz(input, output) {
147
-
148
- }
149
-
150
- function xyz2luv(input, output) {
151
-
152
- }
153
-
154
- function luv2lch(input, output) {
155
-
156
- }
157
-
158
- function lch2hsluv(input, output) {
159
-
160
- }
161
-
162
-
163
- /**
164
- *
165
- * @param {number[]} input
166
- * @param {number[]} output
167
- */
168
- export function rgb2hsluv(input, output) {
169
- rgb2xyz(input, temp_0);
170
- xyz2luv(temp_0, temp_1);
171
- luv2lch(temp_1, temp_0);
172
- lch2hsluv(temp_0, output);
173
- }
174
-
175
- /**
176
- *
177
- * @param {number[]} input
178
- * @param {number[]} output
179
- */
180
- export function hsluv2rgb(input, output) {
181
- hsluv2lch(input, temp_0);
182
- lch2luv(temp_0, temp_1);
183
- luv2xyz(temp_1, temp_0);
184
- xyz2rgb(temp_0, output);
185
- }
186
-
187
-