@woosh/meep-engine 2.36.11 → 2.36.14

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.
@@ -510,6 +510,36 @@ BitSet.prototype.getAndClear = function (index) {
510
510
  return v;
511
511
  };
512
512
 
513
+ /**
514
+ *
515
+ * @param {number} distance
516
+ * @param {number} start_index
517
+ * @param {number} end_index
518
+ */
519
+ BitSet.prototype.shift_right = function (distance, start_index, end_index) {
520
+ assert.isNonNegativeInteger(distance, 'distance');
521
+
522
+ for (let i = end_index; i >= start_index; i--) {
523
+ const v = this.get(i);
524
+ this.set(i + distance, v);
525
+ }
526
+ }
527
+
528
+ /**
529
+ *
530
+ * @param {number} distance
531
+ * @param {number} start_index
532
+ * @param {number} end_index
533
+ */
534
+ BitSet.prototype.shift_left = function (distance, start_index, end_index) {
535
+ assert.isNonNegativeInteger(distance, 'distance');
536
+
537
+ for (let i = start_index; i <= end_index; i++) {
538
+ const v = this.get(i);
539
+ this.set(i - distance, v);
540
+ }
541
+ }
542
+
513
543
  /**
514
544
  *
515
545
  * @param {number} distance
@@ -518,15 +548,9 @@ BitSet.prototype.getAndClear = function (index) {
518
548
  */
519
549
  BitSet.prototype.shift = function (distance, start_index, end_index) {
520
550
  if (distance > 0) {
521
- for (let i = end_index; i >= start_index; i--) {
522
- const v = this.get(i);
523
- this.set(i + distance, v);
524
- }
551
+ this.shift_right(distance, start_index, end_index);
525
552
  } else {
526
- for (let i = start_index; i <= end_index; i++) {
527
- const v = this.get(i);
528
- this.set(i + distance, v);
529
- }
553
+ this.shift_right(-distance, start_index, end_index);
530
554
  }
531
555
  };
532
556
 
@@ -452,3 +452,15 @@ test('performance, next clear from 0', () => {
452
452
  const v = s.nextClearBit(0);
453
453
  }
454
454
  });
455
+
456
+
457
+ test('shift right by 1', () => {
458
+ const s = new BitSet();
459
+
460
+ s.set(0, true);
461
+
462
+ s.shift_right(1, 0, 1);
463
+
464
+ expect(s.get(0)).toBe(true);
465
+ expect(s.get(1)).toBe(true);
466
+ });
@@ -0,0 +1,20 @@
1
+ import { aabb3_intersects_frustum_degree } from "./aabb3_intersects_frustum_degree.js";
2
+
3
+
4
+ /**
5
+ *
6
+ * @param {number[]} aabb
7
+ * @param {number[]} frustum
8
+ * @returns {number}
9
+ */
10
+ export function aabb3_array_intersects_frustum_degree(aabb, frustum) {
11
+
12
+ const x0 = aabb[0];
13
+ const y0 = aabb[1];
14
+ const z0 = aabb[2];
15
+ const x1 = aabb[3];
16
+ const y1 = aabb[4];
17
+ const z1 = aabb[5];
18
+
19
+ return aabb3_intersects_frustum_degree(x0, y0, z0, x1, y1, z1, frustum);
20
+ }