@woosh/meep-engine 2.96.0 → 2.97.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.
- package/build/meep.cjs +64 -27
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +64 -27
- package/package.json +1 -1
- package/src/core/binary/BitSet.d.ts +2 -2
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +8 -5
- package/src/core/graph/v2/Graph.d.ts.map +1 -1
- package/src/core/graph/v2/Graph.js +9 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.d.ts +16 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.d.ts.map +1 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.js +90 -0
- package/src/core/primitives/strings/string_jaro_distance.d.ts +10 -0
- package/src/core/primitives/strings/string_jaro_distance.d.ts.map +1 -0
- package/src/core/primitives/strings/string_jaro_distance.js +127 -0
- package/src/core/primitives/strings/string_jaro_winkler.d.ts.map +1 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +5 -105
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +142 -10
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +9 -9
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +173 -23
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +16 -2
package/build/meep.cjs
CHANGED
|
@@ -69974,13 +69974,15 @@ BitSet.prototype.setShrinkFactor = function (x) {
|
|
|
69974
69974
|
|
|
69975
69975
|
/**
|
|
69976
69976
|
*
|
|
69977
|
-
* @param {number}
|
|
69977
|
+
* @param {number} bit_count
|
|
69978
69978
|
*/
|
|
69979
|
-
BitSet.prototype.setCapacity = function (
|
|
69980
|
-
|
|
69981
|
-
|
|
69979
|
+
BitSet.prototype.setCapacity = function (bit_count) {
|
|
69980
|
+
|
|
69981
|
+
if (this.__length > bit_count) {
|
|
69982
|
+
throw new Error(`Current length(=${this.__length}) is greater than requested size(=${bit_count})`);
|
|
69982
69983
|
}
|
|
69983
|
-
|
|
69984
|
+
|
|
69985
|
+
this.__resize(bit_count);
|
|
69984
69986
|
};
|
|
69985
69987
|
|
|
69986
69988
|
/**
|
|
@@ -71492,8 +71494,17 @@ class Graph {
|
|
|
71492
71494
|
*/
|
|
71493
71495
|
findPath(start, goal) {
|
|
71494
71496
|
const start_node_container = this.__nodes.get(start);
|
|
71497
|
+
|
|
71498
|
+
if (start_node_container === undefined) {
|
|
71499
|
+
throw new Error(`Start node not found in the graph '${start}'`);
|
|
71500
|
+
}
|
|
71501
|
+
|
|
71495
71502
|
const goal_node_container = this.__nodes.get(goal);
|
|
71496
71503
|
|
|
71504
|
+
if (goal_node_container === undefined) {
|
|
71505
|
+
throw new Error(`Goal node not found in the graph '${goal}'`);
|
|
71506
|
+
}
|
|
71507
|
+
|
|
71497
71508
|
const open = new Set();
|
|
71498
71509
|
open.add(start_node_container);
|
|
71499
71510
|
|
|
@@ -82205,22 +82216,20 @@ function seedVariablesIntoTemplateString(template, seed) {
|
|
|
82205
82216
|
}
|
|
82206
82217
|
|
|
82207
82218
|
/**
|
|
82208
|
-
* Calculate
|
|
82209
|
-
* @param {string} first
|
|
82210
|
-
* @param {string} second
|
|
82211
|
-
* @
|
|
82219
|
+
* Calculate Jaro distance between two strings, this is a measure of string similarity. Higher value means more similarity.
|
|
82220
|
+
* @param {string} first
|
|
82221
|
+
* @param {string} second
|
|
82222
|
+
* @param {number} first_length
|
|
82223
|
+
* @param {number} second_length
|
|
82224
|
+
* @return {number}
|
|
82212
82225
|
*/
|
|
82213
|
-
function
|
|
82214
|
-
|
|
82215
|
-
|
|
82216
|
-
|
|
82217
|
-
if (l1 === 0 && l2 === 0) {
|
|
82218
|
-
// special case for empty string
|
|
82219
|
-
return 1;
|
|
82220
|
-
}
|
|
82226
|
+
function string_jaro_distance(
|
|
82227
|
+
first, second,
|
|
82228
|
+
first_length, second_length
|
|
82229
|
+
) {
|
|
82221
82230
|
|
|
82222
|
-
const matches1 = BitSet.fixedSize(
|
|
82223
|
-
const matches2 = BitSet.fixedSize(
|
|
82231
|
+
const matches1 = BitSet.fixedSize(first_length);
|
|
82232
|
+
const matches2 = BitSet.fixedSize(second_length);
|
|
82224
82233
|
|
|
82225
82234
|
const matches = getMatching(first, second, matches1, matches2);
|
|
82226
82235
|
|
|
@@ -82228,15 +82237,9 @@ function string_jaro_winkler(first, second) {
|
|
|
82228
82237
|
return 0;
|
|
82229
82238
|
}
|
|
82230
82239
|
|
|
82231
|
-
// Calculate the Jaro distance:
|
|
82232
82240
|
const transpositions = getTranspositions(first, second, matches1, matches2);
|
|
82233
|
-
|
|
82241
|
+
return (matches / first_length + matches / second_length + (matches - transpositions) / matches) / 3;
|
|
82234
82242
|
|
|
82235
|
-
// Transform to Jaro-Winkler:
|
|
82236
|
-
// Prefix scale gives more favorable ratings to strings that share common prefixes:
|
|
82237
|
-
const prefix_scale = 0.1;
|
|
82238
|
-
const prefix = getPrefix(first, second, min3(l1, l2, 4));
|
|
82239
|
-
return similarity + prefix * prefix_scale * (1 - similarity);
|
|
82240
82243
|
}
|
|
82241
82244
|
|
|
82242
82245
|
/**
|
|
@@ -82298,8 +82301,12 @@ function getMatching(a1, a2, matches1, matches2) {
|
|
|
82298
82301
|
* @param {string} a2 The second string to compare
|
|
82299
82302
|
* @param {BitSet} matches1
|
|
82300
82303
|
* @param {BitSet} matches2
|
|
82304
|
+
* @returns {number}
|
|
82301
82305
|
*/
|
|
82302
|
-
function getTranspositions(
|
|
82306
|
+
function getTranspositions(
|
|
82307
|
+
a1, a2,
|
|
82308
|
+
matches1, matches2
|
|
82309
|
+
) {
|
|
82303
82310
|
let transpositions = 0;
|
|
82304
82311
|
|
|
82305
82312
|
// Loop to find transpositions:
|
|
@@ -82330,6 +82337,36 @@ function getTranspositions(a1, a2, matches1, matches2) {
|
|
|
82330
82337
|
}
|
|
82331
82338
|
|
|
82332
82339
|
return Math.floor(transpositions * 0.5);
|
|
82340
|
+
}
|
|
82341
|
+
|
|
82342
|
+
/**
|
|
82343
|
+
* Calculate the Jaro-Winkler distance between two strings
|
|
82344
|
+
* @param {string} first The string to compare
|
|
82345
|
+
* @param {string} second The string to compare with
|
|
82346
|
+
* @returns {number} similarity score, higher value means strings are more similar
|
|
82347
|
+
*/
|
|
82348
|
+
function string_jaro_winkler(first, second) {
|
|
82349
|
+
const l1 = first.length;
|
|
82350
|
+
const l2 = second.length;
|
|
82351
|
+
|
|
82352
|
+
if (l1 === 0 && l2 === 0) {
|
|
82353
|
+
// special case for empty string
|
|
82354
|
+
return 1;
|
|
82355
|
+
}
|
|
82356
|
+
|
|
82357
|
+
// Calculate the Jaro distance:
|
|
82358
|
+
const similarity = string_jaro_distance(first, second, l1, l2);
|
|
82359
|
+
|
|
82360
|
+
if (similarity === 0) {
|
|
82361
|
+
// no similarity at all
|
|
82362
|
+
return 0;
|
|
82363
|
+
}
|
|
82364
|
+
|
|
82365
|
+
// Transform to Jaro-Winkler:
|
|
82366
|
+
// Prefix scale gives more favorable ratings to strings that share common prefixes:
|
|
82367
|
+
const prefix_scale = 0.1;
|
|
82368
|
+
const prefix = getPrefix(first, second, min3(l1, l2, 4));
|
|
82369
|
+
return similarity + prefix * prefix_scale * (1 - similarity);
|
|
82333
82370
|
}
|
|
82334
82371
|
|
|
82335
82372
|
/**
|