@woosh/meep-engine 2.110.11 → 2.110.12
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/Ray3.d.ts +1 -1
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/sphere/harmonics/README.md +1 -1
- package/src/core/math/linalg/solve_linear_system.d.ts +3 -3
- package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -1
- package/src/core/math/linalg/solve_linear_system.js +8 -3
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +5 -7
- package/src/core/math/spline/spline_hermite3.spec.d.ts +2 -0
- package/src/core/math/spline/spline_hermite3.spec.d.ts.map +1 -0
- package/src/core/math/spline/spline_hermite3.spec.js +18 -0
package/package.json
CHANGED
package/src/core/geom/3d/Ray3.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ray3_interval_array_apply_matrix4 } from "./ray/ray3_interval_array_app
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 3D ray
|
|
12
|
-
*
|
|
12
|
+
* Optimized representation for faster memory access
|
|
13
13
|
*/
|
|
14
14
|
export class Ray3 extends Float32Array {
|
|
15
15
|
constructor() {
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/Kitware/VTK/blob/af928016f4041ad8a6a193d032355b909721fc95/Common/Core/vtkMath.cxx
|
|
7
7
|
*
|
|
8
|
-
* @param {number[]|Float32Array|Float64Array} A
|
|
9
|
-
* @param {number[]|Float32Array|Float64Array} x
|
|
10
|
-
* @param {number} size
|
|
8
|
+
* @param {number[]|Float32Array|Float64Array} A Matrix of coefficients
|
|
9
|
+
* @param {number[]|Float32Array|Float64Array} x Vector of right-hand constants for each equation, resulting solution for variables will also be written here
|
|
10
|
+
* @param {number} size size of the system. Size 1 means a single variable and a single equation, 2 means a 2 variable equation system etc
|
|
11
11
|
* @returns {boolean} true if solution found, false if factorization fails
|
|
12
12
|
*/
|
|
13
13
|
export function solve_linear_system(A: number[] | Float32Array | Float64Array, x: number[] | Float32Array | Float64Array, size: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve_linear_system.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/linalg/solve_linear_system.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,uCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,GACJ,OAAO,
|
|
1
|
+
{"version":3,"file":"solve_linear_system.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/linalg/solve_linear_system.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,uCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,GACJ,OAAO,CAqCnB"}
|
|
@@ -13,9 +13,9 @@ const scratch = new Uint32Array(SCRATCH_SIZE);
|
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/Kitware/VTK/blob/af928016f4041ad8a6a193d032355b909721fc95/Common/Core/vtkMath.cxx
|
|
15
15
|
*
|
|
16
|
-
* @param {number[]|Float32Array|Float64Array} A
|
|
17
|
-
* @param {number[]|Float32Array|Float64Array} x
|
|
18
|
-
* @param {number} size
|
|
16
|
+
* @param {number[]|Float32Array|Float64Array} A Matrix of coefficients
|
|
17
|
+
* @param {number[]|Float32Array|Float64Array} x Vector of right-hand constants for each equation, resulting solution for variables will also be written here
|
|
18
|
+
* @param {number} size size of the system. Size 1 means a single variable and a single equation, 2 means a 2 variable equation system etc
|
|
19
19
|
* @returns {boolean} true if solution found, false if factorization fails
|
|
20
20
|
*/
|
|
21
21
|
export function solve_linear_system(A, x, size) {
|
|
@@ -35,6 +35,8 @@ export function solve_linear_system(A, x, size) {
|
|
|
35
35
|
|
|
36
36
|
} else if (size === 2) {
|
|
37
37
|
|
|
38
|
+
// special fast path for 2 variable systems
|
|
39
|
+
|
|
38
40
|
return solve_linear_system_GEPP_2x2(A, x, x);
|
|
39
41
|
|
|
40
42
|
}
|
|
@@ -42,6 +44,9 @@ export function solve_linear_system(A, x, size) {
|
|
|
42
44
|
const index = size <= SCRATCH_SIZE ? scratch : new Uint32Array(size);
|
|
43
45
|
|
|
44
46
|
if (lu_factor_linear_system(A, index, size) === false) {
|
|
47
|
+
|
|
48
|
+
// can not factorize system
|
|
49
|
+
|
|
45
50
|
return false;
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_simplex_noise_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/noise/create_simplex_noise_2d.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,6EAFwB,MAAM,CAwG7B
|
|
1
|
+
{"version":3,"file":"create_simplex_noise_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/noise/create_simplex_noise_2d.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,6EAFwB,MAAM,CAwG7B"}
|
|
@@ -57,7 +57,7 @@ const grad4 = /*#__PURE__*/ new Float64Array([0, 1, 1, 1, 0, 1, 1, -1, 0, 1, -1,
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Creates a 2D noise function
|
|
60
|
-
* @param random the random function that will be used to build the permutation table
|
|
60
|
+
* @param [random] the random function that will be used to build the permutation table
|
|
61
61
|
* @returns {function(x:number, y:number):number} producing values in range -1 .. 1
|
|
62
62
|
*/
|
|
63
63
|
export function create_simplex_noise_2d(random = Math.random) {
|
|
@@ -165,14 +165,11 @@ export function create_simplex_noise_2d(random = Math.random) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Builds a random permutation table
|
|
169
|
-
* This is exported only for (internal) testing purposes.
|
|
170
|
-
* Do not rely on this export.
|
|
168
|
+
* Builds a random permutation table
|
|
171
169
|
* @param {function} random
|
|
172
|
-
* @param {Uint8Array} p
|
|
173
|
-
* @private
|
|
170
|
+
* @param {Uint8Array} p result will be written here
|
|
174
171
|
*/
|
|
175
|
-
|
|
172
|
+
function buildPermutationTable(random, p) {
|
|
176
173
|
const table_size = 512;
|
|
177
174
|
|
|
178
175
|
const half_table_size = table_size >>> 1;
|
|
@@ -190,6 +187,7 @@ export function buildPermutationTable(random, p) {
|
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
for (let i = 256; i < table_size; i++) {
|
|
190
|
+
// second half of the table just repeats the first half
|
|
193
191
|
p[i] = p[i - 256];
|
|
194
192
|
}
|
|
195
193
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spline_hermite3.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline_hermite3.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { spline_hermite3 } from "./spline_hermite3.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
|
|
5
|
+
// extremes
|
|
6
|
+
expect(spline_hermite3(0, -3, 7, 0, 0)).toBe(-3);
|
|
7
|
+
|
|
8
|
+
expect(spline_hermite3(1, -3, 7, 0, 0)).toBe(7);
|
|
9
|
+
|
|
10
|
+
expect(spline_hermite3(0, -3, 7, 10, 10)).toBe(-3);
|
|
11
|
+
|
|
12
|
+
expect(spline_hermite3(1, -3, 7, 10, 10)).toBe(7);
|
|
13
|
+
|
|
14
|
+
// midpoint on linear
|
|
15
|
+
|
|
16
|
+
expect(spline_hermite3(0.5, -3, 7, 10, 10)).toBe(2);
|
|
17
|
+
|
|
18
|
+
});
|