@woosh/meep-engine 2.49.0 → 2.49.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.
- package/package.json +1 -1
- package/src/core/bvh2/binary/IndexedBinaryBVH.spec.js +7 -0
- package/src/core/collection/CuckooFilter.js +12 -12
- package/src/core/geom/packing/miniball/Miniball.js +12 -12
- package/src/core/geom/packing/miniball/Quality.js +2 -2
- package/src/core/geom/packing/miniball/Subspan.js +13 -13
package/package.json
CHANGED
|
@@ -368,9 +368,9 @@ export class CuckooFilter {
|
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
/**
|
|
371
|
-
* Puts an element into this {@
|
|
371
|
+
* Puts an element into this {@link CuckooFilter}. Ensures that subsequent
|
|
372
372
|
* invocations of {@link #mightContain(Object)} with the same element will
|
|
373
|
-
* always return
|
|
373
|
+
* always return `true`.
|
|
374
374
|
* <p>
|
|
375
375
|
* Note that the filter should be considered full after insertion failure.
|
|
376
376
|
* Further inserts <i>may</i> fail, although deleting items can also make
|
|
@@ -380,8 +380,8 @@ export class CuckooFilter {
|
|
|
380
380
|
* insertion failure.
|
|
381
381
|
*
|
|
382
382
|
* @param {number} hash hash of item to insert
|
|
383
|
-
* @returns {boolean}
|
|
384
|
-
* Returns
|
|
383
|
+
* @returns {boolean} `true` if the cuckoo filter inserts this item successfully.
|
|
384
|
+
* Returns `false` if insertion failed.
|
|
385
385
|
*/
|
|
386
386
|
insert(hash) {
|
|
387
387
|
const current_tag = this.__compute_tag_from_hash(hash);
|
|
@@ -461,22 +461,22 @@ export class CuckooFilter {
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
|
-
* Deletes an element from this {@
|
|
464
|
+
* Deletes an element from this {@link CuckooFilter}. In most cases you
|
|
465
465
|
* should only delete items that have been previously added to the filter.
|
|
466
466
|
* Attempting to delete non-existent items may successfully delete the wrong
|
|
467
467
|
* item in the filter, causing a false negative. False negatives are defined
|
|
468
|
-
* as( {@
|
|
468
|
+
* as( {@link #mightContain(Object)} returning false for an item that
|
|
469
469
|
* <i>has</i> been added to the filter. Deleting non-existent items doesn't
|
|
470
470
|
* otherwise adversely affect the state of the filter, so attempting to
|
|
471
471
|
* delete items that <i>may not</i> have been inserted is fine if false
|
|
472
472
|
* negatives are acceptable. The false-delete rate is similar to the false
|
|
473
473
|
* positive rate. False deletes can also cause the
|
|
474
|
-
* {@
|
|
474
|
+
* {@link #approximateCount(Object)} to return both lower and higher than
|
|
475
475
|
* the real count
|
|
476
476
|
*
|
|
477
477
|
* @param {number} hash
|
|
478
|
-
* @returns {boolean}
|
|
479
|
-
* Returns
|
|
478
|
+
* @returns {boolean} `true` if the cuckoo filter deleted this item successfully.
|
|
479
|
+
* Returns `false` if the item was not found.
|
|
480
480
|
*/
|
|
481
481
|
remove(hash) {
|
|
482
482
|
const tag = this.__compute_tag_from_hash(hash);
|
|
@@ -508,8 +508,8 @@ export class CuckooFilter {
|
|
|
508
508
|
|
|
509
509
|
|
|
510
510
|
/**
|
|
511
|
-
* Returns
|
|
512
|
-
* Cuckoo filter,
|
|
511
|
+
* Returns `true` if the element <i>might</i> have been put in this
|
|
512
|
+
* Cuckoo filter, `false` if this is <i>definitely</i> not the case.
|
|
513
513
|
*
|
|
514
514
|
* @param {number} hash
|
|
515
515
|
* @returns {boolean}
|
|
@@ -523,4 +523,4 @@ export class CuckooFilter {
|
|
|
523
523
|
|| (this.__victim_exists && this.__victim_tag === tag && (this.__victim_index === i1 || this.__victim_index === i2)) //check the victim
|
|
524
524
|
;
|
|
525
525
|
}
|
|
526
|
-
}
|
|
526
|
+
}
|
|
@@ -33,7 +33,7 @@ const MAX_ITERATIONS = 10000;
|
|
|
33
33
|
/**
|
|
34
34
|
* Computes the miniball of the given point set.
|
|
35
35
|
*
|
|
36
|
-
* Notice that the point set
|
|
36
|
+
* Notice that the point set `pts` is assumed to be immutable during the computation. That
|
|
37
37
|
* is, if you add, remove, or change points in the point set, you have to create a new instance of
|
|
38
38
|
* {@link Miniball}.
|
|
39
39
|
*
|
|
@@ -102,7 +102,7 @@ class Miniball {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* Whether or not the miniball is the empty set, equivalently, whether
|
|
105
|
+
* Whether or not the miniball is the empty set, equivalently, whether `points.size() == 0`
|
|
106
106
|
* was true when this miniball instance was constructed.
|
|
107
107
|
*
|
|
108
108
|
* Notice that the miniball of a point set <i>S</i> is empty if and only if <i>S={}</i>.
|
|
@@ -116,7 +116,7 @@ class Miniball {
|
|
|
116
116
|
/**
|
|
117
117
|
* The radius of the miniball.
|
|
118
118
|
* <p>
|
|
119
|
-
* Precondition:
|
|
119
|
+
* Precondition: `!isEmpty()`
|
|
120
120
|
*
|
|
121
121
|
* @return {number} the radius of the miniball, a number ≥ 0
|
|
122
122
|
*/
|
|
@@ -127,9 +127,9 @@ class Miniball {
|
|
|
127
127
|
/**
|
|
128
128
|
* The squared radius of the miniball.
|
|
129
129
|
* <p>
|
|
130
|
-
* This is equivalent to
|
|
130
|
+
* This is equivalent to `radius() * radius()`.
|
|
131
131
|
* <p>
|
|
132
|
-
* Precondition:
|
|
132
|
+
* Precondition: `!isEmpty()`
|
|
133
133
|
*
|
|
134
134
|
* @return {number} the squared radius of the miniball
|
|
135
135
|
*/
|
|
@@ -140,7 +140,7 @@ class Miniball {
|
|
|
140
140
|
/**
|
|
141
141
|
* The Euclidean coordinates of the center of the miniball.
|
|
142
142
|
* <p>
|
|
143
|
-
* Precondition:
|
|
143
|
+
* Precondition: `!isEmpty()`
|
|
144
144
|
*
|
|
145
145
|
* @return {number[]} an array holding the coordinates of the center of the miniball
|
|
146
146
|
*/
|
|
@@ -151,8 +151,8 @@ class Miniball {
|
|
|
151
151
|
/**
|
|
152
152
|
* The number of input points.
|
|
153
153
|
*
|
|
154
|
-
* @return {number} the number of points in the original point set, i.e.,
|
|
155
|
-
*
|
|
154
|
+
* @return {number} the number of points in the original point set, i.e., `pts.size()` where
|
|
155
|
+
* `pts` was the {@link PointSet} instance passed to the constructor of this
|
|
156
156
|
* instance
|
|
157
157
|
*/
|
|
158
158
|
size() {
|
|
@@ -179,7 +179,7 @@ class Miniball {
|
|
|
179
179
|
* the points farthest from center in the support. So the current ball contains all points of
|
|
180
180
|
* <i>S</i> and has radius at most twice as large as the minball.
|
|
181
181
|
* <p>
|
|
182
|
-
* Precondition:
|
|
182
|
+
* Precondition: `size > 0`
|
|
183
183
|
* @return {Subspan}
|
|
184
184
|
* @private
|
|
185
185
|
*/
|
|
@@ -334,10 +334,10 @@ class Miniball {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
/**
|
|
337
|
-
* Given the center of the current enclosing ball and the walking direction
|
|
337
|
+
* Given the center of the current enclosing ball and the walking direction `centerToAff`,
|
|
338
338
|
* determine how much we can walk into this direction without losing a point from <i>S</i>. The
|
|
339
|
-
* (positive) factor by which we can walk along
|
|
340
|
-
*
|
|
339
|
+
* (positive) factor by which we can walk along `centerToAff` is returned. Further,
|
|
340
|
+
* `stopper` is set to the index of the most restricting point and to -1 if no such point
|
|
341
341
|
* was found.
|
|
342
342
|
* @return {number}
|
|
343
343
|
* @private
|
|
@@ -57,7 +57,7 @@ class Quality {
|
|
|
57
57
|
* the miniball ("over-length"). The returned number is the maximal such over-length, divided by
|
|
58
58
|
* the radius of the computed miniball.
|
|
59
59
|
* <p>
|
|
60
|
-
* Notice that
|
|
60
|
+
* Notice that `getMaxOverlength() == 0` if and only if all points are contained in the
|
|
61
61
|
* miniball.
|
|
62
62
|
*
|
|
63
63
|
* @return {number} the maximal over-length, a number ≥ 0
|
|
@@ -74,7 +74,7 @@ class Quality {
|
|
|
74
74
|
* this point towards the boundary of the miniball ("under-length"). The returned number is the
|
|
75
75
|
* maximal such under-length, divided by the radius of the computed miniball.
|
|
76
76
|
* <p>
|
|
77
|
-
* Notice that in theory
|
|
77
|
+
* Notice that in theory `getMaxUnderlength()` should be zero, otherwise the computed
|
|
78
78
|
* miniball is enclosing but not minimal.
|
|
79
79
|
*
|
|
80
80
|
* @return {number} the maximal under-length, a number ≥ 0
|
|
@@ -117,7 +117,7 @@ export class Subspan {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
* The size of the instance's set <i>M</i>, a number between 0 and
|
|
120
|
+
* The size of the instance's set <i>M</i>, a number between 0 and `dim+1`.
|
|
121
121
|
* <p>
|
|
122
122
|
* Complexity: O(1).
|
|
123
123
|
*
|
|
@@ -143,9 +143,9 @@ export class Subspan {
|
|
|
143
143
|
/**
|
|
144
144
|
* The global index (into <i>S</i>) of an arbitrary element of <i>M</i>.
|
|
145
145
|
* <p>
|
|
146
|
-
* Precondition:
|
|
146
|
+
* Precondition: `size()>0`
|
|
147
147
|
* <p>
|
|
148
|
-
* Postcondition:
|
|
148
|
+
* Postcondition: `isMember(anyMember())`
|
|
149
149
|
* @returns {number}
|
|
150
150
|
*/
|
|
151
151
|
anyMember() {
|
|
@@ -160,7 +160,7 @@ export class Subspan {
|
|
|
160
160
|
* Complexity: O(1)
|
|
161
161
|
*
|
|
162
162
|
* @param {number} i
|
|
163
|
-
* the "local" index, 0 ≤ i <
|
|
163
|
+
* the "local" index, 0 ≤ i < `size()`
|
|
164
164
|
* @return {number} <i>j</i> such that <i>S[j]</i> equals the <i>i</i>th point of M
|
|
165
165
|
*/
|
|
166
166
|
globalIndex(i) {
|
|
@@ -184,7 +184,7 @@ export class Subspan {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
* The point
|
|
187
|
+
* The point `members[r]` is called the <i>origin</i>.
|
|
188
188
|
*
|
|
189
189
|
* @return {number} index into <i>S</i> of the origin.
|
|
190
190
|
* @private
|
|
@@ -207,7 +207,7 @@ export class Subspan {
|
|
|
207
207
|
* <p>
|
|
208
208
|
* Note that the code of this class sometimes does not call this method but only mentions it in a
|
|
209
209
|
* comment. The reason for this is performance; Java does not allow an efficient way of returning
|
|
210
|
-
* a pair of doubles, so we sometimes manually "inline"
|
|
210
|
+
* a pair of doubles, so we sometimes manually "inline" `givens()` for the sake of
|
|
211
211
|
* performance.
|
|
212
212
|
* @param {number} a
|
|
213
213
|
* @param {number} b
|
|
@@ -234,7 +234,7 @@ export class Subspan {
|
|
|
234
234
|
* the index of the column used now for insertion; <i>r</i> is not altered by this routine and
|
|
235
235
|
* should be changed by the caller afterwards.
|
|
236
236
|
* <p>
|
|
237
|
-
* Precondition:
|
|
237
|
+
* Precondition: `r<dim`
|
|
238
238
|
* @private
|
|
239
239
|
*/
|
|
240
240
|
appendColumn() {
|
|
@@ -269,7 +269,7 @@ export class Subspan {
|
|
|
269
269
|
/**
|
|
270
270
|
* Adds the point <i>S[index]</i> to the instance's set <i>M</i>.
|
|
271
271
|
* <p>
|
|
272
|
-
* Precondition:
|
|
272
|
+
* Precondition: `!isMember(index)`
|
|
273
273
|
* <p>
|
|
274
274
|
* Complexity: O(dim^2).
|
|
275
275
|
*
|
|
@@ -302,7 +302,7 @@ export class Subspan {
|
|
|
302
302
|
* Computes the vector <i>w</i> directed from point <i>p</i> to <i>v</i>, where <i>v</i> is the
|
|
303
303
|
* point in <i>aff(M)</i> that lies nearest to <i>p</i>.
|
|
304
304
|
* <p>
|
|
305
|
-
* Precondition:
|
|
305
|
+
* Precondition: `size()>0`
|
|
306
306
|
* <p>
|
|
307
307
|
* Complexity: O(dim^2)
|
|
308
308
|
*
|
|
@@ -389,11 +389,11 @@ export class Subspan {
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
|
-
* Calculates the
|
|
392
|
+
* Calculates the `size()`-many coefficients in the representation of <i>p</i> as an affine
|
|
393
393
|
* combination of the points <i>M</i>.
|
|
394
394
|
* <p>
|
|
395
|
-
* The <i>i</i>th computed coefficient
|
|
396
|
-
* <i>M</i>, or, in other words, to the point in <i>S</i> with index
|
|
395
|
+
* The <i>i</i>th computed coefficient `lambdas[i] `corresponds to the <i>i</i>th point in
|
|
396
|
+
* <i>M</i>, or, in other words, to the point in <i>S</i> with index `globalIndex(i)`.
|
|
397
397
|
* <p>
|
|
398
398
|
* Complexity: O(dim^2)
|
|
399
399
|
* <p>
|
|
@@ -441,7 +441,7 @@ export class Subspan {
|
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
|
-
* Given <i>R</i> in lower Hessenberg form with subdiagonal entries 0 to
|
|
444
|
+
* Given <i>R</i> in lower Hessenberg form with subdiagonal entries 0 to `pos-1` already all
|
|
445
445
|
* zero, clears the remaining subdiagonal entries via Givens rotations.
|
|
446
446
|
* @param {number} pos
|
|
447
447
|
* @private
|