@n3rdw1z4rd/core 0.20.0 → 0.21.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.
Files changed (44) hide show
  1. package/dist/graph/doc.d.ts +141 -0
  2. package/dist/graph/doc.js +173 -0
  3. package/dist/graph/evaluate.d.ts +114 -0
  4. package/dist/graph/evaluate.js +319 -0
  5. package/dist/graph/index.d.ts +9 -0
  6. package/dist/graph/index.js +9 -0
  7. package/dist/graph/node.d.ts +153 -0
  8. package/dist/graph/node.js +94 -0
  9. package/dist/graph/nodes.d.ts +11 -0
  10. package/dist/graph/nodes.js +399 -0
  11. package/dist/graph/script.d.ts +56 -0
  12. package/dist/graph/script.js +98 -0
  13. package/dist/graph/sources.d.ts +11 -0
  14. package/dist/graph/sources.js +263 -0
  15. package/dist/graph/subgraph.d.ts +36 -0
  16. package/dist/graph/subgraph.js +280 -0
  17. package/dist/graph/types.d.ts +56 -0
  18. package/dist/graph/types.js +67 -0
  19. package/dist/graph.cjs +1709 -0
  20. package/dist/graph.d.cts +568 -0
  21. package/dist/index.cjs +53 -52
  22. package/dist/rng-Dhqq7owV.cjs +642 -0
  23. package/dist/{spatial-partition-3d-Ba-VBveM.cjs → spatial-partition-3d-CmSCL87Z.cjs} +19 -660
  24. package/dist/three/adaptive-grid.d.ts +43 -0
  25. package/dist/three/adaptive-grid.js +127 -0
  26. package/dist/three/ecs.d.ts +5 -3
  27. package/dist/three/ecs.js +5 -3
  28. package/dist/three/editor-camera.d.ts +93 -0
  29. package/dist/three/editor-camera.js +174 -0
  30. package/dist/three/index.d.ts +6 -1
  31. package/dist/three/index.js +6 -1
  32. package/dist/three/picking.d.ts +34 -0
  33. package/dist/three/picking.js +59 -0
  34. package/dist/three/schema.d.ts +139 -0
  35. package/dist/three/schema.js +214 -0
  36. package/dist/three/world.d.ts +192 -0
  37. package/dist/three/world.js +363 -0
  38. package/dist/three.cjs +970 -23
  39. package/dist/three.d.cts +497 -5
  40. package/dist/vite.cjs +40 -0
  41. package/dist/vite.d.cts +35 -0
  42. package/dist/vite.d.ts +35 -0
  43. package/dist/vite.js +39 -0
  44. package/package.json +21 -1
@@ -1,208 +1,4 @@
1
- //#region src/math.ts
2
- /**
3
- * π, half a turn in radians.
4
- * @category Math & Random
5
- */
6
- const PI = Math.PI;
7
- /**
8
- * 2π, a full turn in radians.
9
- * @category Math & Random
10
- */
11
- const TAU = Math.PI * 2;
12
- /**
13
- * π / 2, a quarter turn in radians.
14
- * @category Math & Random
15
- */
16
- const HALF_PI = Math.PI / 2;
17
- /**
18
- * π / 4, an eighth of a turn in radians.
19
- * @category Math & Random
20
- */
21
- const QUARTER_PI = Math.PI / 4;
22
- /**
23
- * Euler's number, the base of natural logarithms.
24
- * @category Math & Random
25
- */
26
- const E = Math.E;
27
- /**
28
- * Multiply degrees by this to get radians.
29
- * @category Math & Random
30
- */
31
- const DEG2RAD = PI / 180;
32
- /**
33
- * Multiply radians by this to get degrees.
34
- * @category Math & Random
35
- */
36
- const RAD2DEG = 180 / PI;
37
- /**
38
- * Natural logarithm of 2.
39
- * @category Math & Random
40
- */
41
- const LN2 = Math.LN2;
42
- /**
43
- * Natural logarithm of 10.
44
- * @category Math & Random
45
- */
46
- const LN10 = Math.LN10;
47
- /**
48
- * Base-2 logarithm of e.
49
- * @category Math & Random
50
- */
51
- const LOG2E = Math.LOG2E;
52
- /**
53
- * Base-10 logarithm of e.
54
- * @category Math & Random
55
- */
56
- const LOG10E = Math.LOG10E;
57
- /**
58
- * Square root of 2.
59
- * @category Math & Random
60
- */
61
- const SQRT2 = Math.SQRT2;
62
- /**
63
- * Square root of 1/2.
64
- * @category Math & Random
65
- */
66
- const SQRT1_2 = Math.SQRT1_2;
67
- /**
68
- * `Number.EPSILON` (about 2.2e-16), the default tolerance of {@link nearlyEqual}.
69
- * @category Math & Random
70
- */
71
- const EPSILON = Number.EPSILON;
72
- /**
73
- * Limits `value` to the inclusive range [`minValue`, `maxValue`].
74
- * @category Math & Random
75
- */
76
- const clamp = (value, minValue, maxValue) => Math.min(Math.max(value, minValue), maxValue);
77
- /**
78
- * Clamps `value` to [0, 1].
79
- * @category Math & Random
80
- */
81
- const saturate = (value) => clamp(value, 0, 1);
82
- /**
83
- * Linearly interpolates from `start` (t = 0) to `end` (t = 1). `t` is not clamped, so values
84
- * outside [0, 1] extrapolate.
85
- * @category Math & Random
86
- */
87
- const lerp = (start, end, t) => start + (end - start) * t;
88
- /**
89
- * The inverse of {@link lerp}: returns the `t` at which `value` lies between `start` and `end`
90
- * (0 at `start`, 1 at `end`, unclamped). Returns 0 when `start === end`.
91
- * @category Math & Random
92
- */
93
- const inverseLerp = (start, end, value) => end === start ? 0 : (value - start) / (end - start);
94
- /**
95
- * Hermite smoothstep, as in GLSL: 0 at or below `edge0`, 1 at or above `edge1`, with a smooth
96
- * S-curve (3t² - 2t³) in between. With `edge0 === edge1` it is a step: 0 below the edge, 1 at or above.
97
- * @category Math & Random
98
- */
99
- const smoothstep = (edge0, edge1, value) => {
100
- if (edge1 === edge0) return value < edge0 ? 0 : 1;
101
- const t = saturate((value - edge0) / (edge1 - edge0));
102
- return t * t * (3 - 2 * t);
103
- };
104
- /**
105
- * Fractional part of `value`, always in [0, 1) (e.g. `fract(-0.25)` is 0.75).
106
- * @category Math & Random
107
- */
108
- const fract = (value) => value - Math.floor(value);
109
- /**
110
- * Modulo whose result takes the sign of `divisor` (so `mod(-1, 4)` is 3), unlike JavaScript's `%`.
111
- * @category Math & Random
112
- */
113
- const mod = (value, divisor) => (value % divisor + divisor) % divisor;
114
- /**
115
- * Wraps `value` into the half-open range [`minValue`, `maxValue`), e.g. `wrap(370, 0, 360)` is 10.
116
- * An empty range (`minValue === maxValue`) returns `minValue`.
117
- * @category Math & Random
118
- */
119
- const wrap = (value, minValue, maxValue) => {
120
- const range = maxValue - minValue;
121
- return range === 0 ? minValue : minValue + mod(value - minValue, range);
122
- };
123
- /**
124
- * Converts degrees to radians.
125
- * @category Math & Random
126
- */
127
- const radians = (degrees) => degrees * DEG2RAD;
128
- /**
129
- * Converts radians to degrees.
130
- * @category Math & Random
131
- */
132
- const degrees = (radians) => radians * RAD2DEG;
133
- /**
134
- * Wraps an angle in radians into [-π, π).
135
- * @category Math & Random
136
- */
137
- const normalizeRadians = (radians) => wrap(radians, -PI, PI);
138
- /**
139
- * Euclidean distance between (`x1`, `y1`) and (`x2`, `y2`).
140
- * @category Math & Random
141
- */
142
- const distance2d = (x1, y1, x2, y2) => Math.hypot(x2 - x1, y2 - y1);
143
- /**
144
- * Euclidean distance between (`x1`, `y1`, `z1`) and (`x2`, `y2`, `z2`).
145
- * @category Math & Random
146
- */
147
- const distance3d = (x1, y1, z1, x2, y2, z2) => Math.hypot(x2 - x1, y2 - y1, z2 - z1);
148
- /**
149
- * Squared 2D Euclidean distance; cheaper than {@link distance2d} when only comparing distances.
150
- * @category Math & Random
151
- */
152
- const squaredDistance = (x1, y1, x2, y2) => {
153
- const dx = x2 - x1;
154
- const dy = y2 - y1;
155
- return dx * dx + dy * dy;
156
- };
157
- /**
158
- * 2D Manhattan (taxicab) distance: `|dx| + |dy|`.
159
- * @category Math & Random
160
- */
161
- const manhattanDistance = (x1, y1, x2, y2) => Math.abs(x2 - x1) + Math.abs(y2 - y1);
162
- /**
163
- * True when `a` and `b` differ by at most `epsilon` (default {@link EPSILON}), scaled by the larger
164
- * magnitude once that exceeds 1: absolute near zero, relative for large values.
165
- * @category Math & Random
166
- */
167
- const nearlyEqual = (a, b, epsilon = EPSILON) => Math.abs(a - b) <= epsilon * Math.max(1, Math.abs(a), Math.abs(b));
168
- /**
169
- * Rounds `value` to `digits` decimal places (default 0); negative `digits` round to tens,
170
- * hundreds, etc.
171
- * @category Math & Random
172
- */
173
- const roundTo = (value, digits = 0) => {
174
- const factor = 10 ** digits;
175
- return Math.round(value * factor) / factor;
176
- };
177
- /**
178
- * Deterministic 32-bit integer hash (the MurmurHash3 finalizer). `n` is truncated to a 32-bit
179
- * integer first.
180
- * @returns an unsigned 32-bit integer in [0, 2³²)
181
- * @category Math & Random
182
- */
183
- const hash32 = (n) => {
184
- n |= 0;
185
- n ^= n >>> 16;
186
- n = Math.imul(n, 2246822507);
187
- n ^= n >>> 13;
188
- n = Math.imul(n, 3266489909);
189
- n ^= n >>> 16;
190
- return n >>> 0;
191
- };
192
- /**
193
- * Deterministically hashes any number of values (each truncated to a 32-bit integer) into one
194
- * unsigned 32-bit integer by folding them through {@link hash32}. Order matters; no values gives 0.
195
- * @category Math & Random
196
- */
197
- const hash32mix = (...values) => {
198
- let n = 0;
199
- for (const value of values) {
200
- n ^= value | 0;
201
- n = hash32(n);
202
- }
203
- return n;
204
- };
205
- //#endregion
1
+ const require_rng = require("./rng-Dhqq7owV.cjs");
206
2
  //#region src/log.ts
207
3
  /**
208
4
  * `console.debug` with a bold gray `[dev]` prefix; takes the same arguments. Visible only when the
@@ -309,7 +105,7 @@ var Color = class Color {
309
105
  this.a = a;
310
106
  }
311
107
  static _channel(value) {
312
- return clamp(Math.round(value), 0, 255);
108
+ return require_rng.clamp(Math.round(value), 0, 255);
313
109
  }
314
110
  _to_hex() {
315
111
  return `#${this.r.toString(16).padStart(2, "0")}${this.g.toString(16).padStart(2, "0")}${this.b.toString(16).padStart(2, "0")}${this.a.toString(16).padStart(2, "0")}`;
@@ -432,227 +228,6 @@ var Color = class Color {
432
228
  }
433
229
  };
434
230
  //#endregion
435
- //#region src/random.ts
436
- /**
437
- * Hash-based random numbers. The static methods are pure functions of their arguments (the same
438
- * inputs always give the same result), which makes them handy for coordinate-based noise; an
439
- * instance is a seeded sequence that hashes its seed and then increments it on every call.
440
- *
441
- * ```ts
442
- * Random.float(x, y); // same value for the same (x, y), in [0, 1)
443
- *
444
- * const random = new Random(42);
445
- * random.float(); // deterministic sequence for seed 42
446
- * ```
447
- *
448
- * See {@link Rng} for ranges, picking, shuffling and other helpers built on top of it.
449
- * @category Math & Random
450
- */
451
- var Random = class Random {
452
- _seed;
453
- /** @param seed truncated to a 32-bit integer, default `Date.now()` */
454
- constructor(seed = Date.now()) {
455
- this._seed = seed | 0;
456
- }
457
- /** the next value to be hashed; truncated to a 32-bit integer when set */
458
- get seed() {
459
- return this._seed;
460
- }
461
- /** truncated to a 32-bit integer */
462
- set seed(value) {
463
- this._seed = value | 0;
464
- }
465
- /** Unsigned 32-bit integer in [0, 2³²) derived from `values` (a {@link hash32mix} hash). */
466
- static uint(...values) {
467
- return hash32mix(...values);
468
- }
469
- /** Float in [0, 1) derived from `values`. */
470
- static float(...values) {
471
- return hash32mix(...values) / 4294967296;
472
- }
473
- /** Boolean derived from `values`. */
474
- static bool(...values) {
475
- return (hash32mix(...values) & 1) !== 0;
476
- }
477
- /** -1 or 1 derived from `values`. */
478
- static sign(...values) {
479
- return this.bool(...values) ? 1 : -1;
480
- }
481
- /** Angle in radians in [0, 2π) derived from `values`. */
482
- static angle(...values) {
483
- return this.float(...values) * TAU;
484
- }
485
- /** Next unsigned 32-bit integer in [0, 2³²); advances the seed. */
486
- uint() {
487
- return Random.uint(this._seed++);
488
- }
489
- /** Next float in [0, 1); advances the seed. */
490
- float() {
491
- return Random.float(this._seed++);
492
- }
493
- /** Next boolean; advances the seed. */
494
- bool() {
495
- return Random.bool(this._seed++);
496
- }
497
- /** Next -1 or 1; advances the seed. */
498
- sign() {
499
- return Random.sign(this._seed++);
500
- }
501
- /** Next angle in radians in [0, 2π); advances the seed. */
502
- angle() {
503
- return Random.angle(this._seed++);
504
- }
505
- };
506
- //#endregion
507
- //#region src/rng.ts
508
- /**
509
- * Seeded random number generator with helpers for ranges, picking, shuffling, geometric points,
510
- * Gaussian samples and matrices. Every call advances the underlying {@link Random}, so a given
511
- * seed always reproduces the same sequence of calls.
512
- *
513
- * ```ts
514
- * const r = new Rng(1234);
515
- * r.range(1, 7); // integer in [1, 7), like a die roll
516
- * r.pick(['a', 'b', 'c']);
517
- * r.shuffle([1, 2, 3, 4]); // new array, input untouched
518
- * ```
519
- *
520
- * A shared, time-seeded instance is exported as {@link rng}.
521
- * @category Math & Random
522
- */
523
- var Rng = class {
524
- /** the underlying generator; shared if one was passed to the constructor */
525
- random;
526
- /** the underlying {@link Random}'s current seed; setting it restarts the sequence */
527
- get seed() {
528
- return this.random.seed;
529
- }
530
- /** sets the underlying {@link Random}'s seed */
531
- set seed(seed) {
532
- this.random.seed = seed;
533
- }
534
- /** @param seed a seed (default `Date.now()`), or an existing {@link Random} to wrap */
535
- constructor(seed) {
536
- this.random = seed instanceof Random ? seed : new Random(seed);
537
- }
538
- /** Float in [0, 1). */
539
- nextFloat() {
540
- return this.random.float();
541
- }
542
- /** Unsigned 32-bit integer in [0, 2³²). */
543
- nextUint() {
544
- return this.random.uint();
545
- }
546
- /**
547
- * random integer in [min, max); range(max) is [0, max). Non-integer bounds are rounded up,
548
- * so the result is always an integer inside the requested range.
549
- */
550
- range(min, max) {
551
- if (typeof max !== "number") {
552
- max = min;
553
- min = 0;
554
- }
555
- min = Math.ceil(min);
556
- max = Math.ceil(max);
557
- return min + Math.floor(this.random.float() * (max - min));
558
- }
559
- pick(array) {
560
- return array[this.range(0, array.length)];
561
- }
562
- /** Up to `count` distinct elements of `array` in random order (all of them if `count` exceeds its length). */
563
- sample(array, count) {
564
- return this.shuffle(array).slice(0, count);
565
- }
566
- /** A shuffled copy of `array` (Fisher-Yates); the input is not modified. */
567
- shuffle(array) {
568
- const result = [...array];
569
- for (let i = result.length - 1; i > 0; --i) {
570
- const j = this.range(0, i + 1);
571
- [result[i], result[j]] = [result[j], result[i]];
572
- }
573
- return result;
574
- }
575
- /** True with the given probability (0 = never, 1 = always). */
576
- chance(probability) {
577
- return this.random.float() < probability;
578
- }
579
- /** Random unit-length 2D direction as `[x, y]`. */
580
- vector2() {
581
- const θ = this.random.angle();
582
- return [Math.cos(θ), Math.sin(θ)];
583
- }
584
- /** Uniform point on a circle of `radius` (default 1) centred on the origin, as `[x, y]`. */
585
- pointOnCircle(radius = 1) {
586
- const θ = this.random.angle();
587
- return [radius * Math.cos(θ), radius * Math.sin(θ)];
588
- }
589
- /** Uniform point inside a disc of `radius` (default 1) centred on the origin, as `[x, y]`. */
590
- pointInCircle(radius = 1) {
591
- const θ = this.random.angle();
592
- const r = Math.sqrt(this.random.float()) * radius;
593
- return [r * Math.cos(θ), r * Math.sin(θ)];
594
- }
595
- /** Uniform point on the surface of a sphere of `radius` (default 1) centred on the origin, as `[x, y, z]`. */
596
- pointOnSphere(radius = 1) {
597
- const u = this.random.float();
598
- const v = this.random.float();
599
- const θ = TAU * u;
600
- const φ = Math.acos(2 * v - 1);
601
- const s = Math.sin(φ);
602
- return [
603
- radius * s * Math.cos(θ),
604
- radius * s * Math.sin(θ),
605
- radius * Math.cos(φ)
606
- ];
607
- }
608
- /** Uniform point inside a ball of `radius` (default 1) centred on the origin, as `[x, y, z]`. */
609
- pointInSphere(radius = 1) {
610
- const u = this.random.float();
611
- const v = this.random.float();
612
- const θ = TAU * u;
613
- const φ = Math.acos(2 * v - 1);
614
- const r = radius * Math.cbrt(this.random.float());
615
- const s = Math.sin(φ);
616
- return [
617
- r * s * Math.cos(θ),
618
- r * s * Math.sin(θ),
619
- r * Math.cos(φ)
620
- ];
621
- }
622
- /** Normally distributed sample (Box-Muller), default mean 0 and standard deviation 1. */
623
- gaussian(mean = 0, standardDeviation = 1) {
624
- let u = 0;
625
- let v = 0;
626
- while (u === 0) u = this.random.float();
627
- while (v === 0) v = this.random.float();
628
- return mean + Math.sqrt(-2 * Math.log(u)) * Math.cos(TAU * v) * standardDeviation;
629
- }
630
- /**
631
- * `rows` x `columns` array of uniform floats in [`min`, `max`) (default [0, 1)); `columns`
632
- * defaults to `rows`.
633
- */
634
- matrix(rows, columns = rows, min = 0, max = 1) {
635
- return Array.from({ length: rows }, () => Array.from({ length: columns }, () => min + this.random.float() * (max - min)));
636
- }
637
- /** Same as {@link Rng.matrix} with values in [-1, 1). */
638
- transformMatrix(rows, columns = rows) {
639
- return this.matrix(rows, columns, -1, 1);
640
- }
641
- /** Random color as `[r, g, b]`, each an integer in [0, 255]. */
642
- rgb() {
643
- return [
644
- this.range(256),
645
- this.range(256),
646
- this.range(256)
647
- ];
648
- }
649
- };
650
- /**
651
- * Shared {@link Rng} seeded from `Date.now()` at module load; set `rng.seed` for reproducible results.
652
- * @category Math & Random
653
- */
654
- const rng = new Rng();
655
- //#endregion
656
231
  //#region src/map3d.ts
657
232
  /**
658
233
  * Default "empty" value of a {@link Map3D}: cells holding it are not stored.
@@ -830,8 +405,8 @@ var SpatialPartition2d = class {
830
405
  }
831
406
  /** positions are expected in [0, 1); anything outside wraps around, matching getCellNeighbors */
832
407
  getCell(x, y) {
833
- const cellX = mod(Math.floor(x / this.cellSize), this.cells[0].length);
834
- const cellY = mod(Math.floor(y / this.cellSize), this.cells.length);
408
+ const cellX = require_rng.mod(Math.floor(x / this.cellSize), this.cells[0].length);
409
+ const cellY = require_rng.mod(Math.floor(y / this.cellSize), this.cells.length);
835
410
  return this.cells[cellY][cellX];
836
411
  }
837
412
  /**
@@ -842,8 +417,8 @@ var SpatialPartition2d = class {
842
417
  getCellNeighbors(x, y) {
843
418
  const neighbors = /* @__PURE__ */ new Set();
844
419
  for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) {
845
- const nx = mod(x + dx, this.cells[0].length);
846
- const ny = mod(y + dy, this.cells.length);
420
+ const nx = require_rng.mod(x + dx, this.cells[0].length);
421
+ const ny = require_rng.mod(y + dy, this.cells.length);
847
422
  neighbors.add(this.cells[ny][nx]);
848
423
  }
849
424
  return [...neighbors];
@@ -861,7 +436,7 @@ function randomMatrix(size, seed = 0) {
861
436
  const rows = [];
862
437
  for (let i = 0; i < size; i++) {
863
438
  const row = [];
864
- for (let j = 0; j < size; j++) row.push(Random.float(seed, i, j) * 2 - 1);
439
+ for (let j = 0; j < size; j++) row.push(require_rng.Random.float(seed, i, j) * 2 - 1);
865
440
  rows.push(row);
866
441
  }
867
442
  return rows;
@@ -912,15 +487,15 @@ var ParticleSystem2d = class {
912
487
  *
913
488
  * @param seed defaults to a random seed from the shared `rng`, so each instance differs
914
489
  */
915
- constructor(seed = rng.nextUint()) {
490
+ constructor(seed = require_rng.rng.nextUint()) {
916
491
  this.seed = seed;
917
492
  this._attractionMatrix = randomMatrix(colors.length, seed);
918
493
  for (let i = 0; i < this.particleCount; i++) this._particles.push({
919
- x: Random.float(seed, i, 0),
920
- y: Random.float(seed, i, 1),
494
+ x: require_rng.Random.float(seed, i, 0),
495
+ y: require_rng.Random.float(seed, i, 1),
921
496
  vx: 0,
922
497
  vy: 0,
923
- color: Math.floor(Random.float(seed, i, 2) * colors.length)
498
+ color: Math.floor(require_rng.Random.float(seed, i, 2) * colors.length)
924
499
  });
925
500
  this._spatialPartition = new SpatialPartition2d(this._range, this._particles);
926
501
  }
@@ -968,8 +543,8 @@ var ParticleSystem2d = class {
968
543
  const oldCell = this._spatialPartition.getCell(particle.x, particle.y);
969
544
  particle.x += particle.vx * deltaTimeSeconds;
970
545
  particle.y += particle.vy * deltaTimeSeconds;
971
- particle.x = fract(particle.x);
972
- particle.y = fract(particle.y);
546
+ particle.x = require_rng.fract(particle.x);
547
+ particle.y = require_rng.fract(particle.y);
973
548
  renderer.setPixel(particle.x * renderer.width, particle.y * renderer.height, colors[particle.color], this._particleSize);
974
549
  const newCell = this._spatialPartition.getCell(particle.x, particle.y);
975
550
  if (newCell !== oldCell) {
@@ -1019,9 +594,9 @@ var SpatialPartition3d = class {
1019
594
  /** positions are expected in [0, 1); anything outside wraps around, matching getCellNeighbors */
1020
595
  getCell(x, y, z) {
1021
596
  const gridSize = this.cells.length;
1022
- const cx = mod(Math.floor(x / this.cellSize), gridSize);
1023
- const cy = mod(Math.floor(y / this.cellSize), gridSize);
1024
- const cz = mod(Math.floor(z / this.cellSize), gridSize);
597
+ const cx = require_rng.mod(Math.floor(x / this.cellSize), gridSize);
598
+ const cy = require_rng.mod(Math.floor(y / this.cellSize), gridSize);
599
+ const cz = require_rng.mod(Math.floor(z / this.cellSize), gridSize);
1025
600
  return this.cells[cz][cy][cx];
1026
601
  }
1027
602
  /**
@@ -1033,9 +608,9 @@ var SpatialPartition3d = class {
1033
608
  const neighbors = /* @__PURE__ */ new Set();
1034
609
  const gridSize = this.cells.length;
1035
610
  for (let dz = -1; dz <= 1; dz++) for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) {
1036
- const nx = mod(cx + dx, gridSize);
1037
- const ny = mod(cy + dy, gridSize);
1038
- const nz = mod(cz + dz, gridSize);
611
+ const nx = require_rng.mod(cx + dx, gridSize);
612
+ const ny = require_rng.mod(cy + dy, gridSize);
613
+ const nz = require_rng.mod(cz + dz, gridSize);
1039
614
  neighbors.add(this.cells[nz][ny][nx]);
1040
615
  }
1041
616
  return [...neighbors];
@@ -1058,54 +633,6 @@ Object.defineProperty(exports, "DEFAULT_MAP_3D_VALUE", {
1058
633
  return DEFAULT_MAP_3D_VALUE;
1059
634
  }
1060
635
  });
1061
- Object.defineProperty(exports, "DEG2RAD", {
1062
- enumerable: true,
1063
- get: function() {
1064
- return DEG2RAD;
1065
- }
1066
- });
1067
- Object.defineProperty(exports, "E", {
1068
- enumerable: true,
1069
- get: function() {
1070
- return E;
1071
- }
1072
- });
1073
- Object.defineProperty(exports, "EPSILON", {
1074
- enumerable: true,
1075
- get: function() {
1076
- return EPSILON;
1077
- }
1078
- });
1079
- Object.defineProperty(exports, "HALF_PI", {
1080
- enumerable: true,
1081
- get: function() {
1082
- return HALF_PI;
1083
- }
1084
- });
1085
- Object.defineProperty(exports, "LN10", {
1086
- enumerable: true,
1087
- get: function() {
1088
- return LN10;
1089
- }
1090
- });
1091
- Object.defineProperty(exports, "LN2", {
1092
- enumerable: true,
1093
- get: function() {
1094
- return LN2;
1095
- }
1096
- });
1097
- Object.defineProperty(exports, "LOG10E", {
1098
- enumerable: true,
1099
- get: function() {
1100
- return LOG10E;
1101
- }
1102
- });
1103
- Object.defineProperty(exports, "LOG2E", {
1104
- enumerable: true,
1105
- get: function() {
1106
- return LOG2E;
1107
- }
1108
- });
1109
636
  Object.defineProperty(exports, "MAP_3D_MAX_COORD", {
1110
637
  enumerable: true,
1111
638
  get: function() {
@@ -1124,54 +651,12 @@ Object.defineProperty(exports, "Map3D", {
1124
651
  return Map3D;
1125
652
  }
1126
653
  });
1127
- Object.defineProperty(exports, "PI", {
1128
- enumerable: true,
1129
- get: function() {
1130
- return PI;
1131
- }
1132
- });
1133
654
  Object.defineProperty(exports, "ParticleSystem2d", {
1134
655
  enumerable: true,
1135
656
  get: function() {
1136
657
  return ParticleSystem2d;
1137
658
  }
1138
659
  });
1139
- Object.defineProperty(exports, "QUARTER_PI", {
1140
- enumerable: true,
1141
- get: function() {
1142
- return QUARTER_PI;
1143
- }
1144
- });
1145
- Object.defineProperty(exports, "RAD2DEG", {
1146
- enumerable: true,
1147
- get: function() {
1148
- return RAD2DEG;
1149
- }
1150
- });
1151
- Object.defineProperty(exports, "Random", {
1152
- enumerable: true,
1153
- get: function() {
1154
- return Random;
1155
- }
1156
- });
1157
- Object.defineProperty(exports, "Rng", {
1158
- enumerable: true,
1159
- get: function() {
1160
- return Rng;
1161
- }
1162
- });
1163
- Object.defineProperty(exports, "SQRT1_2", {
1164
- enumerable: true,
1165
- get: function() {
1166
- return SQRT1_2;
1167
- }
1168
- });
1169
- Object.defineProperty(exports, "SQRT2", {
1170
- enumerable: true,
1171
- get: function() {
1172
- return SQRT2;
1173
- }
1174
- });
1175
660
  Object.defineProperty(exports, "SpatialPartition2d", {
1176
661
  enumerable: true,
1177
662
  get: function() {
@@ -1184,141 +669,15 @@ Object.defineProperty(exports, "SpatialPartition3d", {
1184
669
  return SpatialPartition3d;
1185
670
  }
1186
671
  });
1187
- Object.defineProperty(exports, "TAU", {
1188
- enumerable: true,
1189
- get: function() {
1190
- return TAU;
1191
- }
1192
- });
1193
- Object.defineProperty(exports, "clamp", {
1194
- enumerable: true,
1195
- get: function() {
1196
- return clamp;
1197
- }
1198
- });
1199
- Object.defineProperty(exports, "degrees", {
1200
- enumerable: true,
1201
- get: function() {
1202
- return degrees;
1203
- }
1204
- });
1205
- Object.defineProperty(exports, "distance2d", {
1206
- enumerable: true,
1207
- get: function() {
1208
- return distance2d;
1209
- }
1210
- });
1211
- Object.defineProperty(exports, "distance3d", {
1212
- enumerable: true,
1213
- get: function() {
1214
- return distance3d;
1215
- }
1216
- });
1217
- Object.defineProperty(exports, "fract", {
1218
- enumerable: true,
1219
- get: function() {
1220
- return fract;
1221
- }
1222
- });
1223
- Object.defineProperty(exports, "hash32", {
1224
- enumerable: true,
1225
- get: function() {
1226
- return hash32;
1227
- }
1228
- });
1229
- Object.defineProperty(exports, "hash32mix", {
1230
- enumerable: true,
1231
- get: function() {
1232
- return hash32mix;
1233
- }
1234
- });
1235
- Object.defineProperty(exports, "inverseLerp", {
1236
- enumerable: true,
1237
- get: function() {
1238
- return inverseLerp;
1239
- }
1240
- });
1241
- Object.defineProperty(exports, "lerp", {
1242
- enumerable: true,
1243
- get: function() {
1244
- return lerp;
1245
- }
1246
- });
1247
672
  Object.defineProperty(exports, "log", {
1248
673
  enumerable: true,
1249
674
  get: function() {
1250
675
  return log;
1251
676
  }
1252
677
  });
1253
- Object.defineProperty(exports, "manhattanDistance", {
1254
- enumerable: true,
1255
- get: function() {
1256
- return manhattanDistance;
1257
- }
1258
- });
1259
- Object.defineProperty(exports, "mod", {
1260
- enumerable: true,
1261
- get: function() {
1262
- return mod;
1263
- }
1264
- });
1265
- Object.defineProperty(exports, "nearlyEqual", {
1266
- enumerable: true,
1267
- get: function() {
1268
- return nearlyEqual;
1269
- }
1270
- });
1271
- Object.defineProperty(exports, "normalizeRadians", {
1272
- enumerable: true,
1273
- get: function() {
1274
- return normalizeRadians;
1275
- }
1276
- });
1277
- Object.defineProperty(exports, "radians", {
1278
- enumerable: true,
1279
- get: function() {
1280
- return radians;
1281
- }
1282
- });
1283
678
  Object.defineProperty(exports, "randomMatrix", {
1284
679
  enumerable: true,
1285
680
  get: function() {
1286
681
  return randomMatrix;
1287
682
  }
1288
683
  });
1289
- Object.defineProperty(exports, "rng", {
1290
- enumerable: true,
1291
- get: function() {
1292
- return rng;
1293
- }
1294
- });
1295
- Object.defineProperty(exports, "roundTo", {
1296
- enumerable: true,
1297
- get: function() {
1298
- return roundTo;
1299
- }
1300
- });
1301
- Object.defineProperty(exports, "saturate", {
1302
- enumerable: true,
1303
- get: function() {
1304
- return saturate;
1305
- }
1306
- });
1307
- Object.defineProperty(exports, "smoothstep", {
1308
- enumerable: true,
1309
- get: function() {
1310
- return smoothstep;
1311
- }
1312
- });
1313
- Object.defineProperty(exports, "squaredDistance", {
1314
- enumerable: true,
1315
- get: function() {
1316
- return squaredDistance;
1317
- }
1318
- });
1319
- Object.defineProperty(exports, "wrap", {
1320
- enumerable: true,
1321
- get: function() {
1322
- return wrap;
1323
- }
1324
- });