@flighthq/spatial 0.5.1-next.904.b545d9c → 0.5.1-next.905.5fbf787

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/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/spatial`. The `@flig
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/spatial@0.5.1-next.904.b545d9c](https://github.com/flighthq/flight/tree/b545d9cfe622400923a81685c78547f2be54eff5/packages/spatial)
17
- - [License](https://github.com/flighthq/flight/blob/b545d9cfe622400923a81685c78547f2be54eff5/LICENSE.md)
16
+ - [Source for @flighthq/spatial@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/spatial)
17
+ - [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/spatial",
3
- "version": "0.5.1-next.904.b545d9c",
3
+ "version": "0.5.1-next.905.5fbf787",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,9 +38,9 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/entity": "0.5.1-next.904.b545d9c",
42
- "@flighthq/geometry": "0.5.1-next.904.b545d9c",
43
- "@flighthq/types": "0.5.1-next.904.b545d9c"
41
+ "@flighthq/entity": "0.5.1-next.905.5fbf787",
42
+ "@flighthq/geometry": "0.5.1-next.905.5fbf787",
43
+ "@flighthq/types": "0.5.1-next.905.5fbf787"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "^5.3.0"
package/src/bvh3D.test.ts CHANGED
@@ -2,7 +2,7 @@ import type { SpatialAabb3D, SpatialIndexBackend3D, SpatialObjectId, SpatialPair
2
2
  import { EntityRuntimeKey } from '@flighthq/types/contract';
3
3
  import { describe, expect, it } from 'vitest';
4
4
 
5
- import { createBvhSpatialBackend3D } from './bvh3D';
5
+ import { createBvhSpatialBackend3D, initializeBvhSpatialBackend3D } from './bvh3D';
6
6
  import { setSpatialIndexingGuard } from './spatialIndexingGuard';
7
7
  import { createUniformGridSpatialBackend3D } from './uniformGrid3D';
8
8
 
@@ -297,3 +297,8 @@ describe('createBvhSpatialBackend3D', () => {
297
297
  expect(notices).toEqual([]);
298
298
  });
299
299
  });
300
+ describe('initializeBvhSpatialBackend3D', () => {
301
+ it('is the construction initializer of createBvhSpatialBackend3D', () => {
302
+ expect(typeof initializeBvhSpatialBackend3D).toBe('function');
303
+ });
304
+ });
@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest';
4
4
  import {
5
5
  clearSpatialIndex2D,
6
6
  createSpatialIndex2D,
7
+ initializeSpatialIndex2D,
7
8
  insertSpatialObject2D,
8
9
  querySpatialPairs2D,
9
10
  querySpatialPoint2D,
@@ -66,6 +67,12 @@ describe('createSpatialIndex2D', () => {
66
67
  });
67
68
  });
68
69
 
70
+ describe('initializeSpatialIndex2D', () => {
71
+ it('is the construction initializer of createSpatialIndex2D', () => {
72
+ expect(typeof initializeSpatialIndex2D).toBe('function');
73
+ });
74
+ });
75
+
69
76
  describe('insertSpatialObject2D', () => {
70
77
  it('yields exactly the one overlapping pair from two overlapping objects and one far object', () => {
71
78
  const index = makeIndex();
@@ -164,7 +171,6 @@ describe('removeSpatialObject2D', () => {
164
171
  expect(point).toHaveLength(0);
165
172
  });
166
173
  });
167
-
168
174
  describe('updateSpatialObject2D', () => {
169
175
  it('removes a pair once the moved object leaves the shared region', () => {
170
176
  const index = makeIndex();
@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest';
4
4
  import {
5
5
  clearSpatialIndex3D,
6
6
  createSpatialIndex3D,
7
+ initializeSpatialIndex3D,
7
8
  insertSpatialObject3D,
8
9
  querySpatialFrustum3D,
9
10
  querySpatialPairs3D,
@@ -64,15 +65,9 @@ describe('createSpatialIndex3D', () => {
64
65
  });
65
66
  });
66
67
 
67
- describe('insertSpatialObject3D', () => {
68
- it('returns false for bounds that cannot be indexed at all', () => {
69
- const index = createSpatialIndex3D();
70
- expect(insertSpatialObject3D(index, 1, { minX: 0, minY: 0, minZ: 0, maxX: 1, maxY: 1, maxZ: Infinity })).toBe(
71
- false,
72
- );
73
- const out: SpatialObjectId[] = [];
74
- querySpatialRegion3D(index, { minX: -1e9, minY: -1e9, minZ: -1e9, maxX: 1e9, maxY: 1e9, maxZ: 1e9 }, out);
75
- expect(out).toEqual([]);
68
+ describe('initializeSpatialIndex3D', () => {
69
+ it('is the construction initializer of createSpatialIndex3D', () => {
70
+ expect(typeof initializeSpatialIndex3D).toBe('function');
76
71
  });
77
72
  });
78
73
 
@@ -109,6 +104,18 @@ function viewFrustum(nearHalf: number, farHalf: number, farZ: number): SpatialFr
109
104
  };
110
105
  }
111
106
 
107
+ describe('insertSpatialObject3D', () => {
108
+ it('returns false for bounds that cannot be indexed at all', () => {
109
+ const index = createSpatialIndex3D();
110
+ expect(insertSpatialObject3D(index, 1, { minX: 0, minY: 0, minZ: 0, maxX: 1, maxY: 1, maxZ: Infinity })).toBe(
111
+ false,
112
+ );
113
+ const out: SpatialObjectId[] = [];
114
+ querySpatialRegion3D(index, { minX: -1e9, minY: -1e9, minZ: -1e9, maxX: 1e9, maxY: 1e9, maxZ: 1e9 }, out);
115
+ expect(out).toEqual([]);
116
+ });
117
+ });
118
+
112
119
  describe('querySpatialFrustum3D', () => {
113
120
  it('finds an object inside the volume and excludes one far outside it', () => {
114
121
  const index = createSpatialIndex3D(createUniformGridSpatialBackend3D(32));
@@ -250,7 +257,6 @@ describe('removeSpatialObject3D', () => {
250
257
  expect(out).toEqual([]);
251
258
  });
252
259
  });
253
-
254
260
  describe('updateSpatialObject3D', () => {
255
261
  it('behaves as insert for a not-yet-present id', () => {
256
262
  const index = createSpatialIndex3D();
@@ -3,7 +3,11 @@ import { EntityRuntimeKey } from '@flighthq/types/contract';
3
3
  import { afterEach, describe, expect, it } from 'vitest';
4
4
 
5
5
  import { setSpatialIndexingGuard } from './spatialIndexingGuard';
6
- import { MAX_INDEXED_CELLS_PER_OBJECT, createUniformGridSpatialBackend2D } from './uniformGrid';
6
+ import {
7
+ MAX_INDEXED_CELLS_PER_OBJECT,
8
+ createUniformGridSpatialBackend2D,
9
+ initializeUniformGridSpatialBackend2D,
10
+ } from './uniformGrid';
7
11
 
8
12
  afterEach(() => {
9
13
  setSpatialIndexingGuard(null);
@@ -433,6 +437,12 @@ describe('createUniformGridSpatialBackend2D', () => {
433
437
  });
434
438
  });
435
439
 
440
+ describe('initializeUniformGridSpatialBackend2D', () => {
441
+ it('is the construction initializer of createUniformGridSpatialBackend2D', () => {
442
+ expect(typeof initializeUniformGridSpatialBackend2D).toBe('function');
443
+ });
444
+ });
445
+
436
446
  describe('MAX_INDEXED_CELLS_PER_OBJECT', () => {
437
447
  it('is the per-object cell budget the oversized path is chosen by', () => {
438
448
  const grid = createUniformGridSpatialBackend2D(1);
@@ -688,7 +698,6 @@ describe('ray edge cases', () => {
688
698
  expect(out).toEqual([1]);
689
699
  });
690
700
  });
691
-
692
701
  describe('updateSpatialObject2D', () => {
693
702
  it('refreshes exact bounds without retaining the caller object when the covered cells stay unchanged', () => {
694
703
  const grid = createUniformGridSpatialBackend2D(10);
@@ -4,7 +4,7 @@ import { afterEach, describe, expect, it } from 'vitest';
4
4
 
5
5
  import { setSpatialIndexingGuard } from './spatialIndexingGuard';
6
6
  import { MAX_INDEXED_CELLS_PER_OBJECT } from './uniformGrid';
7
- import { createUniformGridSpatialBackend3D } from './uniformGrid3D';
7
+ import { createUniformGridSpatialBackend3D, initializeUniformGridSpatialBackend3D } from './uniformGrid3D';
8
8
 
9
9
  afterEach(() => {
10
10
  setSpatialIndexingGuard(null);
@@ -133,6 +133,12 @@ describe('createUniformGridSpatialBackend3D', () => {
133
133
  });
134
134
  });
135
135
 
136
+ describe('initializeUniformGridSpatialBackend3D', () => {
137
+ it('is the construction initializer of createUniformGridSpatialBackend3D', () => {
138
+ expect(typeof initializeUniformGridSpatialBackend3D).toBe('function');
139
+ });
140
+ });
141
+
136
142
  describe('querySpatialPairs3D', () => {
137
143
  it('emits a co-located pair exactly once even when it shares many cells', () => {
138
144
  const grid = createUniformGridSpatialBackend3D(1);
@@ -310,7 +316,6 @@ describe('querySpatialRegion3D', () => {
310
316
  expect(out).toEqual([]);
311
317
  });
312
318
  });
313
-
314
319
  describe('updateSpatialObject3D', () => {
315
320
  it('refreshes bounds without retaining the caller object when the covered cells are unchanged', () => {
316
321
  const grid = createUniformGridSpatialBackend3D(10);