@woosh/meep-engine 2.121.3 → 2.121.5
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.
- package/package.json +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_size.d.ts +11 -0
- package/src/core/geom/3d/aabb/aabb3_array_size.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_array_size.js +18 -0
- package/src/core/geom/vec2/v2_angle_between.d.ts +5 -5
- package/src/core/geom/vec2/v2_angle_between.d.ts.map +1 -1
- package/src/core/geom/vec2/v2_angle_between.js +15 -6
- package/src/core/geom/vec2/v2_dot.d.ts +1 -1
- package/src/core/geom/vec2/v2_dot.js +1 -1
- package/src/core/math/frexp.d.ts +9 -0
- package/src/core/math/frexp.d.ts.map +1 -0
- package/src/core/math/frexp.js +43 -0
- package/src/core/science/units/memory/GIGABYTE.d.ts +2 -1
- package/src/core/science/units/memory/GIGABYTE.d.ts.map +1 -1
- package/src/core/science/units/memory/GIGABYTE.js +2 -1
- package/src/core/science/units/memory/KILOBYTE.d.ts +1 -1
- package/src/core/science/units/memory/KILOBYTE.js +1 -1
- package/src/core/science/units/memory/MEGABYTE.d.ts +1 -1
- package/src/core/science/units/memory/MEGABYTE.d.ts.map +1 -1
- package/src/core/science/units/memory/MEGABYTE.js +1 -2
- package/src/core/science/units/memory/TERABYTE.d.ts +2 -1
- package/src/core/science/units/memory/TERABYTE.d.ts.map +1 -1
- package/src/core/science/units/memory/TERABYTE.js +2 -1
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the size of an axis-aligned bounding box (AABB) in 3D space and stores the result in the output array.
|
|
3
|
+
*
|
|
4
|
+
* @param {Float32Array} output - The array where the computed size values will be stored.
|
|
5
|
+
* @param {number} output_offset - The starting index in the output array where the size values will be written.
|
|
6
|
+
* @param {Float32Array} data - The array containing the AABB coordinates. Must contain six consecutive values: [minX, minY, minZ, maxX, maxY, maxZ].
|
|
7
|
+
* @param {number} offset - The starting index in the data array where the AABB coordinates begin.
|
|
8
|
+
* @return {void} This function does not return a value; it writes the calculated size values directly into the output array.
|
|
9
|
+
*/
|
|
10
|
+
export function aabb3_array_size(output: Float32Array, output_offset: number, data: Float32Array, offset: number): void;
|
|
11
|
+
//# sourceMappingURL=aabb3_array_size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aabb3_array_size.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_size.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,yCANW,YAAY,iBACZ,MAAM,QACN,YAAY,UACZ,MAAM,GACL,IAAI,CAUf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the size of an axis-aligned bounding box (AABB) in 3D space and stores the result in the output array.
|
|
3
|
+
*
|
|
4
|
+
* @param {Float32Array} output - The array where the computed size values will be stored.
|
|
5
|
+
* @param {number} output_offset - The starting index in the output array where the size values will be written.
|
|
6
|
+
* @param {Float32Array} data - The array containing the AABB coordinates. Must contain six consecutive values: [minX, minY, minZ, maxX, maxY, maxZ].
|
|
7
|
+
* @param {number} offset - The starting index in the data array where the AABB coordinates begin.
|
|
8
|
+
* @return {void} This function does not return a value; it writes the calculated size values directly into the output array.
|
|
9
|
+
*/
|
|
10
|
+
export function aabb3_array_size(output, output_offset, data, offset) {
|
|
11
|
+
const x_size = data[offset + 3] - data[offset];
|
|
12
|
+
const y_size = data[offset + 4] - data[offset + 1];
|
|
13
|
+
const z_size = data[offset + 5] - data[offset + 2];
|
|
14
|
+
|
|
15
|
+
output[output_offset] = x_size;
|
|
16
|
+
output[output_offset + 1] = y_size;
|
|
17
|
+
output[output_offset + 2] = z_size;
|
|
18
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {number} x0
|
|
4
|
-
* @param {number} y0
|
|
5
|
-
* @param {number} x1
|
|
6
|
-
* @param {number} y1
|
|
7
|
-
* @returns {number}
|
|
3
|
+
* @param {number} x0 first vector X
|
|
4
|
+
* @param {number} y0 first vector Y
|
|
5
|
+
* @param {number} x1 second vector X
|
|
6
|
+
* @param {number} y1 second vector Y
|
|
7
|
+
* @returns {number} in radians
|
|
8
8
|
*/
|
|
9
9
|
export function v2_angle_between(x0: number, y0: number, x1: number, y1: number): number;
|
|
10
10
|
//# sourceMappingURL=v2_angle_between.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2_angle_between.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_angle_between.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,qCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"v2_angle_between.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_angle_between.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,qCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAkBlB"}
|
|
@@ -4,15 +4,24 @@ import { v2_length } from "./v2_length.js";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
* @param {number} x0
|
|
8
|
-
* @param {number} y0
|
|
9
|
-
* @param {number} x1
|
|
10
|
-
* @param {number} y1
|
|
11
|
-
* @returns {number}
|
|
7
|
+
* @param {number} x0 first vector X
|
|
8
|
+
* @param {number} y0 first vector Y
|
|
9
|
+
* @param {number} x1 second vector X
|
|
10
|
+
* @param {number} y1 second vector Y
|
|
11
|
+
* @returns {number} in radians
|
|
12
12
|
*/
|
|
13
13
|
export function v2_angle_between(x0, y0, x1, y1) {
|
|
14
14
|
const d = v2_dot(x0, y0, x1, y1);
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
const magnitude_0 = v2_length(x0, y0);
|
|
17
|
+
const magnitude_1 = v2_length(x1, y1);
|
|
18
|
+
|
|
19
|
+
const l = magnitude_0 * magnitude_1;
|
|
20
|
+
|
|
21
|
+
if (l === 0) {
|
|
22
|
+
// collective magnitude is 0, provide arbitrary result to avoid division by 0
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
16
25
|
|
|
17
26
|
const theta = clamp(d / l, -1, 1);
|
|
18
27
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decomposes a floating-point number into a normalized fraction and an integer power of 2.
|
|
3
|
+
* Similar to C's frexp function.
|
|
4
|
+
* @param {number} value - The floating-point number to decompose
|
|
5
|
+
* @param {number[]} exponent where to write exponent to
|
|
6
|
+
* @returns {number} mantissa
|
|
7
|
+
*/
|
|
8
|
+
export function frexp(value: number, exponent: number[]): number;
|
|
9
|
+
//# sourceMappingURL=frexp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frexp.d.ts","sourceRoot":"","sources":["../../../../src/core/math/frexp.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,6BAJW,MAAM,YACN,MAAM,EAAE,GACN,MAAM,CAqClB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decomposes a floating-point number into a normalized fraction and an integer power of 2.
|
|
3
|
+
* Similar to C's frexp function.
|
|
4
|
+
* @param {number} value - The floating-point number to decompose
|
|
5
|
+
* @param {number[]} exponent where to write exponent to
|
|
6
|
+
* @returns {number} mantissa
|
|
7
|
+
*/
|
|
8
|
+
export function frexp(value, exponent) {
|
|
9
|
+
if (value === 0 || Number.isFinite(value) === false) {
|
|
10
|
+
exponent[0] = 0;
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let abs_value = Math.abs(value);
|
|
15
|
+
|
|
16
|
+
// Get the exponent using Math.log2 and floor it
|
|
17
|
+
let exp = Math.max(
|
|
18
|
+
-1023,
|
|
19
|
+
Math.floor(Math.log2(abs_value)) + 1
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Calculate the mantissa by dividing by 2^exp
|
|
23
|
+
let mantissa = abs_value * Math.pow(2, -exp);
|
|
24
|
+
|
|
25
|
+
// These while loops compensate for rounding errors that sometimes occur because of ECMAScript's Math.log2's undefined precision
|
|
26
|
+
// and also works around the issue of Math.pow(2, -exp) === Infinity when exp <= -1024
|
|
27
|
+
while (mantissa < 0.5) {
|
|
28
|
+
mantissa *= 2;
|
|
29
|
+
exp--;
|
|
30
|
+
}
|
|
31
|
+
while (mantissa >= 1) {
|
|
32
|
+
mantissa *= 0.5;
|
|
33
|
+
exp++;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (value < 0) {
|
|
37
|
+
mantissa = -mantissa;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exponent[0] = exp;
|
|
41
|
+
|
|
42
|
+
return mantissa;
|
|
43
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GIGABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/GIGABYTE.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"GIGABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/GIGABYTE.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,uBAJU,MAAM,CAI2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MEGABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/MEGABYTE.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MEGABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/MEGABYTE.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uBAJU,MAAM,CAIoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TERABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/TERABYTE.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TERABYTE.d.ts","sourceRoot":"","sources":["../../../../../../src/core/science/units/memory/TERABYTE.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,uBAJU,MAAM,CAIkC"}
|