@flighthq/geometry 0.5.1-next.973.788d3d7 → 0.6.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 (159) hide show
  1. package/README.md +2 -2
  2. package/dist/.tsbuildinfo.contract +1 -0
  3. package/dist/.tsbuildinfo.runtime +1 -0
  4. package/dist/aabb.d.ts +2 -1
  5. package/dist/aabb.d.ts.map +1 -1
  6. package/dist/aabb.js +3 -3
  7. package/dist/aabb.js.map +1 -1
  8. package/dist/boundingSphere.d.ts +2 -1
  9. package/dist/boundingSphere.d.ts.map +1 -1
  10. package/dist/boundingSphere.js +3 -3
  11. package/dist/boundingSphere.js.map +1 -1
  12. package/dist/capsule.d.ts +2 -1
  13. package/dist/capsule.d.ts.map +1 -1
  14. package/dist/capsule.js +2 -2
  15. package/dist/capsule.js.map +1 -1
  16. package/dist/contract.d.ts +2 -44
  17. package/dist/contract.d.ts.map +1 -1
  18. package/dist/contract.geometry-types.d.ts +2 -0
  19. package/dist/contract.geometry-types.d.ts.map +1 -0
  20. package/dist/contract.geometry-types.js +4 -0
  21. package/dist/contract.geometry-types.js.map +1 -0
  22. package/dist/contract.js +2 -44
  23. package/dist/contract.js.map +1 -1
  24. package/dist/enableGeometryPoolGuards.d.ts +10 -1
  25. package/dist/enableGeometryPoolGuards.d.ts.map +1 -1
  26. package/dist/enableGeometryPoolGuards.js +56 -23
  27. package/dist/enableGeometryPoolGuards.js.map +1 -1
  28. package/dist/frustum.d.ts +2 -1
  29. package/dist/frustum.d.ts.map +1 -1
  30. package/dist/frustum.js +3 -3
  31. package/dist/frustum.js.map +1 -1
  32. package/dist/geometryPoolGuards.d.ts +3 -3
  33. package/dist/geometryPoolGuards.d.ts.map +1 -1
  34. package/dist/geometryPoolGuards.js +3 -0
  35. package/dist/geometryPoolGuards.js.map +1 -1
  36. package/dist/index.d.ts +28 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +27 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/matrix.d.ts +3 -1
  41. package/dist/matrix.d.ts.map +1 -1
  42. package/dist/matrix.js +3 -2
  43. package/dist/matrix.js.map +1 -1
  44. package/dist/matrix3.d.ts +6 -4
  45. package/dist/matrix3.d.ts.map +1 -1
  46. package/dist/matrix3.js +13 -27
  47. package/dist/matrix3.js.map +1 -1
  48. package/dist/matrix3Pool.d.ts +1 -1
  49. package/dist/matrix3Pool.d.ts.map +1 -1
  50. package/dist/matrix3Pool.js +4 -4
  51. package/dist/matrix3Pool.js.map +1 -1
  52. package/dist/matrix4.d.ts +5 -3
  53. package/dist/matrix4.d.ts.map +1 -1
  54. package/dist/matrix4.js +12 -40
  55. package/dist/matrix4.js.map +1 -1
  56. package/dist/matrix4Pool.d.ts +1 -1
  57. package/dist/matrix4Pool.d.ts.map +1 -1
  58. package/dist/matrix4Pool.js +4 -4
  59. package/dist/matrix4Pool.js.map +1 -1
  60. package/dist/matrixPool.d.ts +1 -1
  61. package/dist/matrixPool.d.ts.map +1 -1
  62. package/dist/matrixPool.js +4 -4
  63. package/dist/matrixPool.js.map +1 -1
  64. package/dist/obb.d.ts +2 -1
  65. package/dist/obb.d.ts.map +1 -1
  66. package/dist/obb.js +2 -2
  67. package/dist/obb.js.map +1 -1
  68. package/dist/plane.d.ts +2 -1
  69. package/dist/plane.d.ts.map +1 -1
  70. package/dist/plane.js +2 -2
  71. package/dist/plane.js.map +1 -1
  72. package/dist/quaternion.d.ts +2 -1
  73. package/dist/quaternion.d.ts.map +1 -1
  74. package/dist/quaternion.js +2 -2
  75. package/dist/quaternion.js.map +1 -1
  76. package/dist/quaternionPool.d.ts +1 -1
  77. package/dist/quaternionPool.d.ts.map +1 -1
  78. package/dist/quaternionPool.js +4 -4
  79. package/dist/quaternionPool.js.map +1 -1
  80. package/dist/ray3d.d.ts +2 -1
  81. package/dist/ray3d.d.ts.map +1 -1
  82. package/dist/ray3d.js +3 -3
  83. package/dist/ray3d.js.map +1 -1
  84. package/dist/rectangle.d.ts +2 -1
  85. package/dist/rectangle.d.ts.map +1 -1
  86. package/dist/rectangle.js +2 -2
  87. package/dist/rectangle.js.map +1 -1
  88. package/dist/rectanglePool.d.ts +1 -1
  89. package/dist/rectanglePool.d.ts.map +1 -1
  90. package/dist/rectanglePool.js +4 -4
  91. package/dist/rectanglePool.js.map +1 -1
  92. package/dist/runtime.d.ts +29 -0
  93. package/dist/runtime.d.ts.map +1 -0
  94. package/dist/runtime.js +29 -0
  95. package/dist/runtime.js.map +1 -0
  96. package/dist/transform2d.d.ts +2 -1
  97. package/dist/transform2d.d.ts.map +1 -1
  98. package/dist/transform2d.js +2 -2
  99. package/dist/transform2d.js.map +1 -1
  100. package/dist/transform3d.d.ts +2 -1
  101. package/dist/transform3d.d.ts.map +1 -1
  102. package/dist/transform3d.js +5 -5
  103. package/dist/transform3d.js.map +1 -1
  104. package/dist/types.d.ts +145 -0
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/types.js +2 -0
  107. package/dist/types.js.map +1 -0
  108. package/dist/vector2.d.ts +2 -1
  109. package/dist/vector2.d.ts.map +1 -1
  110. package/dist/vector2.js +2 -2
  111. package/dist/vector2.js.map +1 -1
  112. package/dist/vector2Pool.d.ts +1 -1
  113. package/dist/vector2Pool.d.ts.map +1 -1
  114. package/dist/vector2Pool.js +4 -4
  115. package/dist/vector2Pool.js.map +1 -1
  116. package/dist/vector3.d.ts +2 -1
  117. package/dist/vector3.d.ts.map +1 -1
  118. package/dist/vector3.js +2 -2
  119. package/dist/vector3.js.map +1 -1
  120. package/dist/vector3Pool.d.ts +1 -1
  121. package/dist/vector3Pool.d.ts.map +1 -1
  122. package/dist/vector3Pool.js +4 -4
  123. package/dist/vector3Pool.js.map +1 -1
  124. package/dist/vector4.d.ts +2 -1
  125. package/dist/vector4.d.ts.map +1 -1
  126. package/dist/vector4.js +2 -2
  127. package/dist/vector4.js.map +1 -1
  128. package/dist/vector4Pool.d.ts +1 -1
  129. package/dist/vector4Pool.d.ts.map +1 -1
  130. package/dist/vector4Pool.js +4 -4
  131. package/dist/vector4Pool.js.map +1 -1
  132. package/package.json +7 -6
  133. package/src/aabb.test.ts +3 -2
  134. package/src/boundingSphere.test.ts +4 -3
  135. package/src/capsule.test.ts +1 -1
  136. package/src/enableGeometryPoolGuards.test.ts +31 -24
  137. package/src/frustum.test.ts +5 -4
  138. package/src/geometryPoolGuards.test.ts +14 -1
  139. package/src/matrix.test.ts +2 -2
  140. package/src/matrix3.test.ts +59 -63
  141. package/src/matrix3Pool.test.ts +2 -2
  142. package/src/matrix4.test.ts +42 -51
  143. package/src/matrix4Pool.test.ts +2 -2
  144. package/src/matrixPool.test.ts +2 -2
  145. package/src/obb.test.ts +7 -5
  146. package/src/plane.test.ts +1 -1
  147. package/src/quaternion.test.ts +2 -2
  148. package/src/ray3d.test.ts +8 -8
  149. package/src/rectangle.test.ts +2 -2
  150. package/src/rectanglePool.test.ts +2 -2
  151. package/src/transform2d.test.ts +2 -2
  152. package/src/transform3d.test.ts +4 -4
  153. package/src/typedarray.test.ts +1 -1
  154. package/src/vector2.test.ts +2 -2
  155. package/src/vector2Pool.test.ts +2 -2
  156. package/src/vector3.test.ts +2 -2
  157. package/src/vector3Pool.test.ts +2 -2
  158. package/src/vector4.test.ts +2 -2
  159. package/src/vector4Pool.test.ts +2 -2
@@ -1,7 +1,7 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
- import type { Matrix } from '@flighthq/types/contract';
3
2
 
4
- import { acquireIdentityMatrix, acquireMatrix, clearMatrixPool, releaseMatrix } from './matrixPool';
3
+ import { acquireIdentityMatrix, acquireMatrix, clearMatrixPool, releaseMatrix } from './matrixPool.ts';
4
+ import type { Matrix } from './types.ts';
5
5
 
6
6
  beforeEach(() => {
7
7
  clearMatrixPool();
package/src/obb.test.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createAabb,
3
3
  createMatrix4,
4
+ createMatrix4FromValues,
4
5
  createObb,
5
6
  createRay3D,
6
7
  createVector3,
@@ -18,9 +19,10 @@ import {
18
19
  setObb,
19
20
  transformObbByMatrix4,
20
21
  } from '@flighthq/geometry/contract';
21
- import type { Matrix4, Obb, Vector3 } from '@flighthq/types/contract';
22
22
 
23
- import { initializeObb } from './obb';
23
+ import { initializeObb } from './obb.ts';
24
+ import type { Obb, Vector3 } from './types.ts';
25
+ import type { Matrix4 } from './types.ts';
24
26
 
25
27
  describe('createObb', () => {
26
28
  it('stores center, half-extents, and orientation', () => {
@@ -424,7 +426,7 @@ describe('transformObbByMatrix4', () => {
424
426
 
425
427
  it('scales half-extents by a uniform scale matrix', () => {
426
428
  const o = createObb(0, 0, 0, 1, 1, 1, 0, 0, 0, 1);
427
- const m = createMatrix4(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1);
429
+ const m = createMatrix4FromValues(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1);
428
430
  const out = createObb(0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
429
431
  transformObbByMatrix4(out, o, m);
430
432
  expect(out.halfExtentX).toBeCloseTo(2, 6);
@@ -464,7 +466,7 @@ describe('transformObbByMatrix4', () => {
464
466
  // A zero-length column has no direction to read, so that axis falls back to its identity
465
467
  // direction rather than dividing by zero, and the half-extent along it goes to zero.
466
468
  const o = createObb(0, 0, 0, 2, 3, 4, 0, 0, 0, 1);
467
- const m = createMatrix4(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
469
+ const m = createMatrix4FromValues(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
468
470
  const out = createObb(0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
469
471
  transformObbByMatrix4(out, o, m);
470
472
  expect(out.halfExtentX).toBe(0);
@@ -478,7 +480,7 @@ describe('transformObbByMatrix4', () => {
478
480
  // orientation it came in with — the transform contributes nothing but the translation.
479
481
  const tilt = orientationFromAxisAngle(1, 1, 1, 0.6);
480
482
  const o = createObb(1, 2, 3, 2, 3, 4, ...tilt);
481
- const m = createMatrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 1);
483
+ const m = createMatrix4FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 1);
482
484
  const out = createObb(0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
483
485
  transformObbByMatrix4(out, o, m);
484
486
  expect(out.centerX).toBeCloseTo(5, 6);
package/src/plane.test.ts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  setPlaneFromPoints,
14
14
  } from '@flighthq/geometry/contract';
15
15
 
16
- import { initializePlane } from './plane';
16
+ import { initializePlane } from './plane.ts';
17
17
 
18
18
  describe('clonePlane', () => {
19
19
  it('creates an independent copy', () => {
@@ -26,9 +26,9 @@ import {
26
26
  setQuaternionLookRotation,
27
27
  slerpQuaternion,
28
28
  } from '@flighthq/geometry/contract';
29
- import type { Quaternion } from '@flighthq/types/contract';
30
29
 
31
- import { initializeQuaternion } from './quaternion';
30
+ import { initializeQuaternion } from './quaternion.ts';
31
+ import type { Quaternion } from './types.ts';
32
32
 
33
33
  function expectQuaternionClose(q: Readonly<Quaternion>, x: number, y: number, z: number, w: number): void {
34
34
  expect(q.x).toBeCloseTo(x, 6);
package/src/ray3d.test.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { createAabb } from './aabb';
2
- import { createBoundingSphere } from './boundingSphere';
3
- import { createCapsule, intersectRay3DCapsule } from './capsule';
4
- import { createMatrix4, translateMatrix4 } from './matrix4';
5
- import { createObb, intersectRay3DObb } from './obb';
6
- import { createPlane } from './plane';
1
+ import { createAabb } from './aabb.ts';
2
+ import { createBoundingSphere } from './boundingSphere.ts';
3
+ import { createCapsule, intersectRay3DCapsule } from './capsule.ts';
4
+ import { createMatrix4, translateMatrix4 } from './matrix4.ts';
5
+ import { createObb, intersectRay3DObb } from './obb.ts';
6
+ import { createPlane } from './plane.ts';
7
7
  import {
8
8
  createRay3D,
9
9
  getClosestPointBetweenRay3Ds,
@@ -16,8 +16,8 @@ import {
16
16
  intersectRay3DTriangle,
17
17
  setRay3D,
18
18
  transformRay3DByMatrix4,
19
- } from './ray3d';
20
- import { createVector3 } from './vector3';
19
+ } from './ray3d.ts';
20
+ import { createVector3 } from './vector3.ts';
21
21
 
22
22
  describe('createRay3D', () => {
23
23
  it('creates a ray at the origin pointing in +Z by default', () => {
@@ -41,9 +41,9 @@ import {
41
41
  setRectangleTop,
42
42
  setRectangleTopLeft,
43
43
  } from '@flighthq/geometry/contract';
44
- import type { Rectangle } from '@flighthq/types/contract';
45
44
 
46
- import { initializeRectangle } from './rectangle';
45
+ import { initializeRectangle } from './rectangle.ts';
46
+ import type { Rectangle } from './types.ts';
47
47
 
48
48
  let r: Rectangle;
49
49
  let r2: Rectangle;
@@ -1,7 +1,7 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
- import type { Rectangle } from '@flighthq/types/contract';
3
2
 
4
- import { acquireEmptyRectangle, acquireRectangle, clearRectanglePool, releaseRectangle } from './rectanglePool';
3
+ import { acquireEmptyRectangle, acquireRectangle, clearRectanglePool, releaseRectangle } from './rectanglePool.ts';
4
+ import type { Rectangle } from './types.ts';
5
5
 
6
6
  beforeEach(() => {
7
7
  clearRectanglePool();
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import { createMatrix } from './matrix';
4
- import { createTransform2D, decomposeMatrixToTransform2D, initializeTransform2D } from './transform2d';
3
+ import { createMatrix } from './matrix.ts';
4
+ import { createTransform2D, decomposeMatrixToTransform2D, initializeTransform2D } from './transform2d.ts';
5
5
 
6
6
  const DEG_TO_RAD = Math.PI / 180;
7
7
 
@@ -1,14 +1,14 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import { createMatrix4 } from './matrix4';
4
- import { createQuaternion } from './quaternion';
3
+ import { createMatrix4 } from './matrix4.ts';
4
+ import { createQuaternion } from './quaternion.ts';
5
5
  import {
6
6
  composeMatrix4FromTransform3D,
7
7
  createTransform3D,
8
8
  decomposeMatrix4ToTransform3D,
9
9
  initializeTransform3D,
10
- } from './transform3d';
11
- import { createVector3 } from './vector3';
10
+ } from './transform3d.ts';
11
+ import { createVector3 } from './vector3.ts';
12
12
 
13
13
  describe('composeMatrix4FromTransform3D', () => {
14
14
  it('composes translation, rotation, and scale into a matrix', () => {
@@ -1,4 +1,4 @@
1
- import { reserveFloat32Array, reserveInt16Array, reserveUint16Array } from './typedarray';
1
+ import { reserveFloat32Array, reserveInt16Array, reserveUint16Array } from './typedarray.ts';
2
2
 
3
3
  describe('reserveFloat32Array', () => {
4
4
  it('returns the same array if the capacity is equal', () => {
@@ -34,9 +34,9 @@ import {
34
34
  subtractVector2,
35
35
  writeVector2ToFloat32Array,
36
36
  } from '@flighthq/geometry/contract';
37
- import type { Vector2 } from '@flighthq/types/contract';
38
37
 
39
- import { initializeVector2 } from './vector2';
38
+ import type { Vector2 } from './types.ts';
39
+ import { initializeVector2 } from './vector2.ts';
40
40
 
41
41
  let pt: Vector2;
42
42
  let pt2: Vector2;
@@ -1,7 +1,7 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
- import type { Vector2 } from '@flighthq/types/contract';
3
2
 
4
- import { acquireEmptyVector2, acquireVector2, clearVector2Pool, releaseVector2 } from './vector2Pool';
3
+ import type { Vector2 } from './types.ts';
4
+ import { acquireEmptyVector2, acquireVector2, clearVector2Pool, releaseVector2 } from './vector2Pool.ts';
5
5
 
6
6
  beforeEach(() => {
7
7
  clearVector2Pool();
@@ -37,9 +37,9 @@ import {
37
37
  VECTOR3_Z_AXIS,
38
38
  writeVector3ToFloat32Array,
39
39
  } from '@flighthq/geometry/contract';
40
- import type { Vector3 } from '@flighthq/types/contract';
41
40
 
42
- import { initializeVector3 } from './vector3';
41
+ import type { Vector3 } from './types.ts';
42
+ import { initializeVector3 } from './vector3.ts';
43
43
 
44
44
  describe('addVector3', () => {
45
45
  it('returns a new vector when no target is passed', () => {
@@ -1,7 +1,7 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
- import type { Vector3 } from '@flighthq/types/contract';
3
2
 
4
- import { acquireEmptyVector3, acquireVector3, clearVector3Pool, releaseVector3 } from './vector3Pool';
3
+ import type { Vector3 } from './types.ts';
4
+ import { acquireEmptyVector3, acquireVector3, clearVector3Pool, releaseVector3 } from './vector3Pool.ts';
5
5
 
6
6
  beforeEach(() => {
7
7
  clearVector3Pool();
@@ -34,9 +34,9 @@ import {
34
34
  VECTOR4_Z_AXIS,
35
35
  writeVector4ToFloat32Array,
36
36
  } from '@flighthq/geometry/contract';
37
- import type { Vector4 } from '@flighthq/types/contract';
38
37
 
39
- import { initializeVector4 } from './vector4';
38
+ import type { Vector4 } from './types.ts';
39
+ import { initializeVector4 } from './vector4.ts';
40
40
 
41
41
  describe('addVector4', () => {
42
42
  it('returns a new vector when no target is passed', () => {
@@ -1,7 +1,7 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
- import type { Vector4 } from '@flighthq/types/contract';
3
2
 
4
- import { acquireEmptyVector4, acquireVector4, clearVector4Pool, releaseVector4 } from './vector4Pool';
3
+ import type { Vector4 } from './types.ts';
4
+ import { acquireEmptyVector4, acquireVector4, clearVector4Pool, releaseVector4 } from './vector4Pool.ts';
5
5
 
6
6
  beforeEach(() => {
7
7
  clearVector4Pool();