@flighthq/geometry 0.5.1-next.920.da8f530 → 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
@@ -7,7 +7,9 @@ import {
7
7
  copyMatrix3RowToVector3,
8
8
  createMatrix,
9
9
  createMatrix3,
10
+ createMatrix3FromValues,
10
11
  createMatrix4,
12
+ createMatrix4FromValues,
11
13
  createVector3,
12
14
  equalsMatrix3,
13
15
  getMatrix3Determinant,
@@ -28,9 +30,9 @@ import {
28
30
  transposeMatrix3,
29
31
  writeMatrix3ToFloat32Array,
30
32
  } from '@flighthq/geometry/contract';
31
- import type { Matrix3 } from '@flighthq/types/contract';
32
33
 
33
- import { initializeMatrix3 } from './matrix3';
34
+ import { initializeMatrix3 } from './matrix3.ts';
35
+ import type { Matrix3 } from './types.ts';
34
36
 
35
37
  // Matrix3 storage is column-major: element (row r, column c) lives at m[3 * c + r], matching
36
38
  // Matrix4 and the GL/GLSL/WGSL uniform ABI. A matrix-like {m} built from a raw Float32Array below
@@ -39,7 +41,7 @@ import { initializeMatrix3 } from './matrix3';
39
41
 
40
42
  describe('cloneMatrix3', () => {
41
43
  it('should clone the matrix correctly', () => {
42
- const m1 = createMatrix3(2, 3, 4, 5, 6, 7, 8, 9, 10);
44
+ const m1 = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 8, 9, 10);
43
45
  const m2 = cloneMatrix3(m1);
44
46
  expect(getMatrix3Element(m2, 0, 0)).toBe(2);
45
47
  expect(getMatrix3Element(m2, 0, 1)).toBe(3);
@@ -76,7 +78,7 @@ describe('cloneMatrix3', () => {
76
78
 
77
79
  describe('copyMatrix3', () => {
78
80
  it('should copy matrix values from another matrix', () => {
79
- const m1 = createMatrix3(2, 3, 4, 5, 6, 7, 8, 9, 10);
81
+ const m1 = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 8, 9, 10);
80
82
  const m2 = createMatrix3();
81
83
  copyMatrix3(m2, m1);
82
84
  expect(getMatrix3Element(m2, 0, 0)).toBe(2);
@@ -91,7 +93,7 @@ describe('copyMatrix3', () => {
91
93
  });
92
94
 
93
95
  it('supports out === source', () => {
94
- const matrix = createMatrix3(2, 3, 4, 5, 6, 7, 8, 9, 10);
96
+ const matrix = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 8, 9, 10);
95
97
  copyMatrix3(matrix, matrix);
96
98
  expect(Array.from(matrix.m)).toEqual([2, 5, 8, 3, 6, 9, 4, 7, 10]);
97
99
  });
@@ -135,7 +137,7 @@ describe('copyMatrix3ColumnFromVector3', () => {
135
137
 
136
138
  describe('copyMatrix3ColumnToVector3', () => {
137
139
  it('should copy column to a Vector3 from a Matrix3', () => {
138
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
140
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
139
141
  const v = createVector3();
140
142
  copyMatrix3ColumnToVector3(v, 0, m); // column 0
141
143
  expect(v.x).toBe(1);
@@ -144,7 +146,7 @@ describe('copyMatrix3ColumnToVector3', () => {
144
146
  });
145
147
 
146
148
  it('should copy column 1 into Vector3', () => {
147
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
149
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
148
150
  const v = createVector3();
149
151
  copyMatrix3ColumnToVector3(v, 1, m);
150
152
  expect(v.x).toBe(2);
@@ -153,7 +155,7 @@ describe('copyMatrix3ColumnToVector3', () => {
153
155
  });
154
156
 
155
157
  it('should copy column 2 into Vector3', () => {
156
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
158
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
157
159
  const v = createVector3();
158
160
  copyMatrix3ColumnToVector3(v, 2, m);
159
161
  expect(v.x).toBe(3);
@@ -217,7 +219,7 @@ describe('copyMatrix3RowFromVector3', () => {
217
219
 
218
220
  describe('copyMatrix3RowToVector3', () => {
219
221
  it('should copy row to a Vector3 from a Matrix3', () => {
220
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
222
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
221
223
  const v = createVector3();
222
224
  copyMatrix3RowToVector3(v, 0, m); // row 0
223
225
  expect(v.x).toBe(1); // m.a
@@ -226,7 +228,7 @@ describe('copyMatrix3RowToVector3', () => {
226
228
  });
227
229
 
228
230
  it('should copy row 1 (b, d, ty)', () => {
229
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
231
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
230
232
  const v = createVector3();
231
233
  copyMatrix3RowToVector3(v, 1, m);
232
234
  expect(v.x).toBe(4);
@@ -262,8 +264,15 @@ describe('copyMatrix3RowToVector3', () => {
262
264
  });
263
265
 
264
266
  describe('createMatrix3', () => {
265
- it('should initialize matrix with provided values', () => {
266
- const m = createMatrix3(2, 3, 4, 5, 6, 7, 8, 9, 10);
267
+ it('initializes to identity', () => {
268
+ const m = createMatrix3();
269
+ expect(Array.from(m.m)).toEqual([1, 0, 0, 0, 1, 0, 0, 0, 1]);
270
+ });
271
+ });
272
+
273
+ describe('createMatrix3FromValues', () => {
274
+ it('initializes matrix with provided values', () => {
275
+ const m = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 8, 9, 10);
267
276
  expect(getMatrix3Element(m, 0, 0)).toBe(2);
268
277
  expect(getMatrix3Element(m, 0, 1)).toBe(3);
269
278
  expect(getMatrix3Element(m, 0, 2)).toBe(4);
@@ -276,22 +285,9 @@ describe('createMatrix3', () => {
276
285
  });
277
286
 
278
287
  it('stores its (row, column) arguments column-major', () => {
279
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
288
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
280
289
  expect(Array.from(m.m)).toEqual([1, 4, 7, 2, 5, 8, 3, 6, 9]);
281
290
  });
282
-
283
- it('should default to identity matrix when no values are provided', () => {
284
- const m = createMatrix3();
285
- expect(getMatrix3Element(m, 0, 0)).toBe(1);
286
- expect(getMatrix3Element(m, 0, 1)).toBe(0);
287
- expect(getMatrix3Element(m, 0, 2)).toBe(0);
288
- expect(getMatrix3Element(m, 1, 0)).toBe(0);
289
- expect(getMatrix3Element(m, 1, 1)).toBe(1);
290
- expect(getMatrix3Element(m, 1, 2)).toBe(0);
291
- expect(getMatrix3Element(m, 2, 0)).toBe(0);
292
- expect(getMatrix3Element(m, 2, 1)).toBe(0);
293
- expect(getMatrix3Element(m, 2, 2)).toBe(1);
294
- });
295
291
  });
296
292
 
297
293
  describe('equalsMatrix3', () => {
@@ -325,7 +321,7 @@ describe('equalsMatrix3', () => {
325
321
  });
326
322
 
327
323
  it('should return true if one object is matrix-like and one is not', () => {
328
- const mat1 = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
324
+ const mat1 = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
329
325
  // Column-major storage of the same matrix.
330
326
  const mat2 = { m: new Float32Array([1, 4, 7, 2, 5, 8, 3, 6, 9]) };
331
327
  expect(equalsMatrix3(mat1, mat2)).toBe(true);
@@ -345,18 +341,18 @@ describe('getMatrix3Determinant', () => {
345
341
 
346
342
  it('returns 0 for a singular matrix', () => {
347
343
  // Two identical rows → determinant = 0.
348
- expect(getMatrix3Determinant(createMatrix3(1, 2, 3, 1, 2, 3, 4, 5, 6))).toBeCloseTo(0, 6);
344
+ expect(getMatrix3Determinant(createMatrix3FromValues(1, 2, 3, 1, 2, 3, 4, 5, 6))).toBeCloseTo(0, 6);
349
345
  });
350
346
 
351
347
  it('returns a negative value when a row is negated (sign flip)', () => {
352
348
  // Negate one row flips sign of det. Identity det = 1, negate row 0 → -1.
353
- expect(getMatrix3Determinant(createMatrix3(-1, 0, 0, 0, 1, 0, 0, 0, 1))).toBeCloseTo(-1, 6);
349
+ expect(getMatrix3Determinant(createMatrix3FromValues(-1, 0, 0, 0, 1, 0, 0, 0, 1))).toBeCloseTo(-1, 6);
354
350
  });
355
351
  });
356
352
 
357
353
  describe('getMatrix3Element', () => {
358
354
  it('returns the element at the given row and column', () => {
359
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
355
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
360
356
  expect(getMatrix3Element(m, 0, 0)).toBe(1);
361
357
  expect(getMatrix3Element(m, 0, 1)).toBe(2);
362
358
  expect(getMatrix3Element(m, 0, 2)).toBe(3);
@@ -374,7 +370,7 @@ describe('initializeMatrix3', () => {
374
370
  describe('inverseMatrix3', () => {
375
371
  it('should invert the matrix correctly', () => {
376
372
  // A scale of 2 with translation of (5, 3): rows [2,0,5],[0,2,3],[0,0,1].
377
- const m = createMatrix3(2, 0, 5, 0, 2, 3, 0, 0, 1);
373
+ const m = createMatrix3FromValues(2, 0, 5, 0, 2, 3, 0, 0, 1);
378
374
 
379
375
  const out = createMatrix3();
380
376
  inverseMatrix3(out, m);
@@ -389,8 +385,8 @@ describe('inverseMatrix3', () => {
389
385
  });
390
386
 
391
387
  it('should not depend on initial out matrix values', () => {
392
- const source = createMatrix3(2, 1, 5, 3, 4, 6, 0, 0, 1);
393
- const out = createMatrix3(9, 9, 9, 9, 9, 9, 0, 0, 1);
388
+ const source = createMatrix3FromValues(2, 1, 5, 3, 4, 6, 0, 0, 1);
389
+ const out = createMatrix3FromValues(9, 9, 9, 9, 9, 9, 0, 0, 1);
394
390
 
395
391
  inverseMatrix3(out, source);
396
392
 
@@ -417,7 +413,7 @@ describe('inverseMatrix3', () => {
417
413
  });
418
414
 
419
415
  it('supports out === source for affine matrices', () => {
420
- const matrix = createMatrix3(2, 1, 5, 3, 4, 6, 0, 0, 1);
416
+ const matrix = createMatrix3FromValues(2, 1, 5, 3, 4, 6, 0, 0, 1);
421
417
  const expected = createMatrix3();
422
418
  inverseMatrix3(expected, matrix);
423
419
 
@@ -427,7 +423,7 @@ describe('inverseMatrix3', () => {
427
423
  });
428
424
 
429
425
  it('supports out === source for non-affine matrices', () => {
430
- const matrix = createMatrix3(1, 2, 3, 0, 1, 4, 5, 6, 0);
426
+ const matrix = createMatrix3FromValues(1, 2, 3, 0, 1, 4, 5, 6, 0);
431
427
  const expected = createMatrix3();
432
428
  inverseMatrix3(expected, matrix);
433
429
 
@@ -437,13 +433,13 @@ describe('inverseMatrix3', () => {
437
433
  });
438
434
 
439
435
  it('returns true on success', () => {
440
- const m = createMatrix3(2, 0, 5, 0, 2, 3, 0, 0, 1);
436
+ const m = createMatrix3FromValues(2, 0, 5, 0, 2, 3, 0, 0, 1);
441
437
  const out = createMatrix3();
442
438
  expect(inverseMatrix3(out, m)).toBe(true);
443
439
  });
444
440
 
445
441
  it('returns false and fills NaN for a singular affine matrix', () => {
446
- const m = createMatrix3(0, 0, 5, 0, 0, 3, 0, 0, 1); // zero linear part -> det 0
442
+ const m = createMatrix3FromValues(0, 0, 5, 0, 0, 3, 0, 0, 1); // zero linear part -> det 0
447
443
  const out = createMatrix3();
448
444
  expect(inverseMatrix3(out, m)).toBe(false);
449
445
  expect(out.m[0]).toBeNaN();
@@ -451,14 +447,14 @@ describe('inverseMatrix3', () => {
451
447
  });
452
448
 
453
449
  it('returns false and fills NaN for a singular non-affine matrix', () => {
454
- const m = createMatrix3(1, 2, 3, 2, 4, 6, 1, 1, 1); // rows 0,1 linearly dependent -> det 0
450
+ const m = createMatrix3FromValues(1, 2, 3, 2, 4, 6, 1, 1, 1); // rows 0,1 linearly dependent -> det 0
455
451
  const out = createMatrix3();
456
452
  expect(inverseMatrix3(out, m)).toBe(false);
457
453
  expect(out.m[0]).toBeNaN();
458
454
  });
459
455
 
460
456
  it('returns false for a singular matrix with out === source', () => {
461
- const m = createMatrix3(0, 0, 5, 0, 0, 3, 0, 0, 1);
457
+ const m = createMatrix3FromValues(0, 0, 5, 0, 0, 3, 0, 0, 1);
462
458
  expect(inverseMatrix3(m, m)).toBe(false);
463
459
  expect(m.m[0]).toBeNaN();
464
460
  });
@@ -471,21 +467,21 @@ describe('isAffineMatrix3', () => {
471
467
  });
472
468
 
473
469
  it('returns false when last row is not (0, 0, 1)', () => {
474
- const m = createMatrix3(1, 0, 0, 0, 1, 0, 1, 0, 1);
470
+ const m = createMatrix3FromValues(1, 0, 0, 0, 1, 0, 1, 0, 1);
475
471
  expect(isAffineMatrix3(m)).toBe(false);
476
472
  });
477
473
 
478
474
  it('returns true for a matrix with translation', () => {
479
- const m = createMatrix3(1, 0, 5, 0, 1, 10, 0, 0, 1);
475
+ const m = createMatrix3FromValues(1, 0, 5, 0, 1, 10, 0, 0, 1);
480
476
  expect(isAffineMatrix3(m)).toBe(true);
481
477
  });
482
478
  });
483
479
 
484
480
  describe('multiplyMatrix3', () => {
485
481
  it('multiplies a non-affine matrix into distinct and aliased outputs', () => {
486
- const a = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 10);
487
- const b = createMatrix3(2, 0, 1, 1, 3, 0, 0, 2, 4);
488
- const expected = createMatrix3(4, 12, 13, 13, 27, 28, 22, 44, 47);
482
+ const a = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 10);
483
+ const b = createMatrix3FromValues(2, 0, 1, 1, 3, 0, 0, 2, 4);
484
+ const expected = createMatrix3FromValues(4, 12, 13, 13, 27, 28, 22, 44, 47);
489
485
  const out = createMatrix3();
490
486
  multiplyMatrix3(out, a, b);
491
487
  expect(equalsMatrix3(out, expected)).toBe(true);
@@ -495,8 +491,8 @@ describe('multiplyMatrix3', () => {
495
491
  });
496
492
 
497
493
  it('should support out === a', () => {
498
- const a = createMatrix3(2, 3, 4, 5, 7, 8, 0, 0, 1);
499
- const b = createMatrix3(11, 13, 17, 19, 23, 29, 0, 0, 1);
494
+ const a = createMatrix3FromValues(2, 3, 4, 5, 7, 8, 0, 0, 1);
495
+ const b = createMatrix3FromValues(11, 13, 17, 19, 23, 29, 0, 0, 1);
500
496
  const expected = createMatrix3();
501
497
  multiplyMatrix3(expected, a, b);
502
498
 
@@ -505,8 +501,8 @@ describe('multiplyMatrix3', () => {
505
501
  });
506
502
 
507
503
  it('should support out === b', () => {
508
- const a = createMatrix3(2, 3, 4, 5, 7, 8, 0, 0, 1);
509
- const b = createMatrix3(11, 13, 17, 19, 23, 29, 0, 0, 1);
504
+ const a = createMatrix3FromValues(2, 3, 4, 5, 7, 8, 0, 0, 1);
505
+ const b = createMatrix3FromValues(11, 13, 17, 19, 23, 29, 0, 0, 1);
510
506
  const expected = createMatrix3();
511
507
  multiplyMatrix3(expected, a, b);
512
508
 
@@ -516,7 +512,7 @@ describe('multiplyMatrix3', () => {
516
512
 
517
513
  it('should multiply identity correctly', () => {
518
514
  const a = createMatrix3();
519
- const b = createMatrix3(2, 3, 4, 5, 6, 7);
515
+ const b = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 0, 0, 1);
520
516
  const out = createMatrix3();
521
517
  multiplyMatrix3(out, a, b);
522
518
  expect(equalsMatrix3(out, b)).toBe(true);
@@ -524,8 +520,8 @@ describe('multiplyMatrix3', () => {
524
520
 
525
521
  it('composes an affine scale then translate (row/column semantics)', () => {
526
522
  // a = scale(2,2), b = translate(5,5). a * b applies b then a to a column vector.
527
- const a = createMatrix3(2, 0, 0, 0, 2, 0, 0, 0, 1);
528
- const b = createMatrix3(1, 0, 5, 0, 1, 5, 0, 0, 1);
523
+ const a = createMatrix3FromValues(2, 0, 0, 0, 2, 0, 0, 0, 1);
524
+ const b = createMatrix3FromValues(1, 0, 5, 0, 1, 5, 0, 0, 1);
529
525
  multiplyMatrix3(a, a, b);
530
526
  expect(getMatrix3Element(a, 0, 2)).toBe(10);
531
527
  expect(getMatrix3Element(a, 1, 2)).toBe(10);
@@ -543,7 +539,7 @@ describe('multiplyMatrix3', () => {
543
539
 
544
540
  describe('rotateMatrix3', () => {
545
541
  it('should rotate the matrix correctly', () => {
546
- const m = createMatrix3(1, 0, 0, 0, 1, 0, 0, 0, 1);
542
+ const m = createMatrix3FromValues(1, 0, 0, 0, 1, 0, 0, 0, 1);
547
543
  const out = createMatrix3();
548
544
  rotateMatrix3(out, m, Math.PI / 2); // 90 degrees
549
545
  // Rotation (0,1)-plane: (0,0)=0, (0,1)=-1, (1,0)=1, (1,1)=0.
@@ -567,7 +563,7 @@ describe('rotateMatrix3', () => {
567
563
  });
568
564
 
569
565
  it('supports out === source', () => {
570
- const matrix = createMatrix3(2, 3, 4, 5, 7, 8, 11, 13, 17);
566
+ const matrix = createMatrix3FromValues(2, 3, 4, 5, 7, 8, 11, 13, 17);
571
567
  const expected = createMatrix3();
572
568
  rotateMatrix3(expected, matrix, Math.PI / 2);
573
569
 
@@ -594,7 +590,7 @@ describe('scaleMatrix3', () => {
594
590
  });
595
591
 
596
592
  it('supports out === source', () => {
597
- const matrix = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
593
+ const matrix = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
598
594
  scaleMatrix3(matrix, matrix, 2, 3);
599
595
  expect(Array.from(matrix.m)).toEqual([2, 8, 14, 6, 15, 24, 3, 6, 9]);
600
596
  });
@@ -744,7 +740,7 @@ describe('setMatrix3FromMatrix4', () => {
744
740
 
745
741
  describe('setMatrix3Identity', () => {
746
742
  it('resets a matrix to the identity', () => {
747
- const m = createMatrix3(2, 3, 4, 5, 6, 7, 8, 9, 10);
743
+ const m = createMatrix3FromValues(2, 3, 4, 5, 6, 7, 8, 9, 10);
748
744
  setMatrix3Identity(m);
749
745
  expect(getMatrix3Element(m, 0, 0)).toBe(1);
750
746
  expect(getMatrix3Element(m, 1, 1)).toBe(1);
@@ -757,7 +753,7 @@ describe('setMatrix3Identity', () => {
757
753
  describe('setMatrix3NormalFromMatrix4', () => {
758
754
  it('equals the rotation basis for an orthonormal matrix', () => {
759
755
  // A 90-degree rotation about z (column-major Matrix4): +x -> +y.
760
- const m4 = createMatrix4(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
756
+ const m4 = createMatrix4FromValues(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
761
757
  const out = createMatrix3();
762
758
  setMatrix3NormalFromMatrix4(out, m4);
763
759
  // For a pure rotation, normal matrix == rotation R (+x -> +y): (0,0)=0,(0,1)=-1,(1,0)=1,(1,1)=0.
@@ -771,7 +767,7 @@ describe('setMatrix3NormalFromMatrix4', () => {
771
767
  it('uploads column-major so a GL upload needs no transpose', () => {
772
768
  // The whole point of the migration: the normal matrix' storage matches uniformMatrix3fv(false).
773
769
  // 90-degree rotation about z, column-major storage: R = [[0,-1,0],[1,0,0],[0,0,1]] -> [0,1,0,-1,0,0,0,0,1].
774
- const m4 = createMatrix4(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
770
+ const m4 = createMatrix4FromValues(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
775
771
  const out = createMatrix3();
776
772
  setMatrix3NormalFromMatrix4(out, m4);
777
773
  expect(out.m[0]).toBeCloseTo(0, 5);
@@ -782,7 +778,7 @@ describe('setMatrix3NormalFromMatrix4', () => {
782
778
 
783
779
  it('keeps a normal perpendicular under non-uniform scale', () => {
784
780
  // Scale x by 2, y by 1: a surface normal (1,1,0) on a plane should stay perpendicular.
785
- const m4 = createMatrix4(2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
781
+ const m4 = createMatrix4FromValues(2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
786
782
  const normalMatrix = createMatrix3();
787
783
  setMatrix3NormalFromMatrix4(normalMatrix, m4);
788
784
  // Inverse-transpose of diag(2,1,1) = diag(0.5,1,1).
@@ -810,7 +806,7 @@ describe('translateMatrix3', () => {
810
806
  });
811
807
 
812
808
  it('supports out === source', () => {
813
- const matrix = createMatrix3(1, 2, 3, 4, 5, 6, 0, 0, 1);
809
+ const matrix = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 0, 0, 1);
814
810
  translateMatrix3(matrix, matrix, 2, 3);
815
811
  expect(Array.from(matrix.m)).toEqual([1, 4, 0, 2, 5, 0, 11, 29, 1]);
816
812
  });
@@ -818,7 +814,7 @@ describe('translateMatrix3', () => {
818
814
 
819
815
  describe('transposeMatrix3', () => {
820
816
  it('swaps rows and columns', () => {
821
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
817
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
822
818
  const out = createMatrix3();
823
819
  transposeMatrix3(out, m);
824
820
  // Transpose of rows [1,2,3],[4,5,6],[7,8,9] is rows [1,4,7],[2,5,8],[3,6,9];
@@ -829,7 +825,7 @@ describe('transposeMatrix3', () => {
829
825
  });
830
826
 
831
827
  it('supports out === source', () => {
832
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
828
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
833
829
  transposeMatrix3(m, m);
834
830
  expect(Array.from(m.m)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]);
835
831
  });
@@ -843,7 +839,7 @@ describe('transposeMatrix3', () => {
843
839
  });
844
840
  describe('writeMatrix3ToFloat32Array', () => {
845
841
  it('writes 9 values starting at the given offset', () => {
846
- const m = createMatrix3(1, 2, 3, 4, 5, 6, 7, 8, 9);
842
+ const m = createMatrix3FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
847
843
  const data = new Float32Array(10);
848
844
  writeMatrix3ToFloat32Array(data, 1, m);
849
845
  // Column-major storage of the matrix, written verbatim.
@@ -851,7 +847,7 @@ describe('writeMatrix3ToFloat32Array', () => {
851
847
  });
852
848
 
853
849
  it('round-trips through setMatrix3FromFloat32Array', () => {
854
- const m = createMatrix3(9, 8, 7, 6, 5, 4, 3, 2, 1);
850
+ const m = createMatrix3FromValues(9, 8, 7, 6, 5, 4, 3, 2, 1);
855
851
  const data = new Float32Array(9);
856
852
  writeMatrix3ToFloat32Array(data, 0, m);
857
853
  const m2 = createMatrix3();
@@ -1,8 +1,8 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
2
  import { getMatrix3Element } from '@flighthq/geometry/contract';
3
- import type { Matrix3 } from '@flighthq/types/contract';
4
3
 
5
- import { acquireIdentityMatrix3, acquireMatrix3, clearMatrix3Pool, releaseMatrix3 } from './matrix3Pool';
4
+ import { acquireIdentityMatrix3, acquireMatrix3, clearMatrix3Pool, releaseMatrix3 } from './matrix3Pool.ts';
5
+ import type { Matrix3 } from './types.ts';
6
6
 
7
7
  beforeEach(() => {
8
8
  clearMatrix3Pool();
@@ -12,8 +12,10 @@ import {
12
12
  copyMatrix4RowToVector4,
13
13
  createMatrix,
14
14
  createMatrix3,
15
+ createMatrix3FromValues,
15
16
  createMatrix4,
16
17
  createMatrix4From2D,
18
+ createMatrix4FromValues,
17
19
  createOrthographicMatrix4,
18
20
  createPerspectiveMatrix4,
19
21
  createQuaternion,
@@ -56,9 +58,9 @@ import {
56
58
  transposeMatrix4,
57
59
  writeMatrix4ToFloat32Array,
58
60
  } from '@flighthq/geometry/contract';
59
- import type { Matrix, Matrix4 } from '@flighthq/types/contract';
60
61
 
61
- import { initializeMatrix4 } from './matrix4';
62
+ import { initializeMatrix4 } from './matrix4.ts';
63
+ import type { Matrix, Matrix4 } from './types.ts';
62
64
 
63
65
  const X_AXIS = { x: 1, y: 0, z: 0, w: 0 };
64
66
  const Y_AXIS = { x: 0, y: 1, z: 0, w: 0 };
@@ -287,7 +289,7 @@ describe('appendTranslationMatrix4', () => {
287
289
  it('copies the whole source matrix when out is a distinct object', () => {
288
290
  const source = discriminatingMatrix4();
289
291
  const before = Array.from(source.m);
290
- const out = createMatrix4(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
292
+ const out = createMatrix4FromValues(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
291
293
  const aliased = cloneMatrix4(source);
292
294
 
293
295
  appendTranslationMatrix4(out, source, 1, 2, 3);
@@ -308,7 +310,7 @@ describe('cloneMatrix4', () => {
308
310
  });
309
311
 
310
312
  it('copies all values from the source matrix', () => {
311
- const source = createMatrix4(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53);
313
+ const source = createMatrix4FromValues(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53);
312
314
 
313
315
  const clone = cloneMatrix4(source);
314
316
 
@@ -368,7 +370,7 @@ describe('composeMatrix4', () => {
368
370
 
369
371
  describe('copyMatrix4', () => {
370
372
  it('copies all values from source into out', () => {
371
- const source = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
373
+ const source = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
372
374
 
373
375
  const out = createMatrix4();
374
376
  copyMatrix4(out, source);
@@ -434,7 +436,7 @@ describe('copyMatrix4ColumnFromVector4', () => {
434
436
  // column catches a row/column transposition or a stray write that a single-index check misses.
435
437
  it('writes column c into elements 4c..4c+3 for every column', () => {
436
438
  for (let column = 0; column < 4; column++) {
437
- const m = createMatrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
439
+ const m = createMatrix4FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
438
440
 
439
441
  copyMatrix4ColumnFromVector4(m, column, { x: 1, y: 2, z: 3, w: 4 });
440
442
 
@@ -450,7 +452,7 @@ describe('copyMatrix4ColumnFromVector4', () => {
450
452
 
451
453
  describe('copyMatrix4ColumnToVector4', () => {
452
454
  it('copies values from column 1 into a vector', () => {
453
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
455
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
454
456
 
455
457
  const out = { x: 0, y: 0, z: 0, w: 0 };
456
458
 
@@ -473,7 +475,7 @@ describe('copyMatrix4ColumnToVector4', () => {
473
475
  });
474
476
 
475
477
  it('reads column c from elements 4c..4c+3 for every column', () => {
476
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
478
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
477
479
 
478
480
  for (let column = 0; column < 4; column++) {
479
481
  const out = { x: 0, y: 0, z: 0, w: 0 };
@@ -527,7 +529,7 @@ describe('copyMatrix4RowFromVector4', () => {
527
529
  // column write in column-major storage.
528
530
  it('writes row r with a stride of four for every row', () => {
529
531
  for (let row = 0; row < 4; row++) {
530
- const m = createMatrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
532
+ const m = createMatrix4FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
531
533
 
532
534
  copyMatrix4RowFromVector4(m, row, { x: 1, y: 2, z: 3, w: 4 });
533
535
 
@@ -543,7 +545,7 @@ describe('copyMatrix4RowFromVector4', () => {
543
545
 
544
546
  describe('copyMatrix4RowToVector4', () => {
545
547
  it('copies values from row 2 into a vector', () => {
546
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
548
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
547
549
 
548
550
  const out = { x: 0, y: 0, z: 0, w: 0 };
549
551
 
@@ -566,7 +568,7 @@ describe('copyMatrix4RowToVector4', () => {
566
568
  });
567
569
 
568
570
  it('reads row r with a stride of four for every row', () => {
569
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
571
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
570
572
 
571
573
  for (let row = 0; row < 4; row++) {
572
574
  const out = { x: 0, y: 0, z: 0, w: 0 };
@@ -591,34 +593,6 @@ describe('createMatrix4', () => {
591
593
  expect(m.m).toBeInstanceOf(Float32Array);
592
594
  expect(m.m.length).toBe(16);
593
595
  });
594
-
595
- it('overrides only the provided constructor values', () => {
596
- const m = createMatrix4(
597
- 2, // m00
598
- undefined,
599
- undefined,
600
- undefined,
601
- undefined,
602
- 3, // m11
603
- );
604
-
605
- expect(Array.from(m.m)).toEqual([2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
606
- });
607
-
608
- it('maps constructor arguments to correct column-major indices', () => {
609
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
610
-
611
- expect(Array.from(m.m)).toEqual([
612
- // column 0
613
- 1, 2, 3, 4,
614
- // column 1
615
- 5, 6, 7, 8,
616
- // column 2
617
- 9, 10, 11, 12,
618
- // column 3
619
- 13, 14, 15, 16,
620
- ]);
621
- });
622
596
  });
623
597
 
624
598
  describe('createMatrix4From2D', () => {
@@ -644,6 +618,23 @@ describe('createMatrix4From2D', () => {
644
618
  });
645
619
  });
646
620
 
621
+ describe('createMatrix4FromValues', () => {
622
+ it('maps constructor arguments to correct column-major indices', () => {
623
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
624
+
625
+ expect(Array.from(m.m)).toEqual([
626
+ // column 0
627
+ 1, 2, 3, 4,
628
+ // column 1
629
+ 5, 6, 7, 8,
630
+ // column 2
631
+ 9, 10, 11, 12,
632
+ // column 3
633
+ 13, 14, 15, 16,
634
+ ]);
635
+ });
636
+ });
637
+
647
638
  describe('createOrthographicMatrix4', () => {
648
639
  it('returns a Matrix4 equivalent to setOrtho', () => {
649
640
  const m1 = createOrthographicMatrix4(-1, 1, -1, 1, 0.1, 100);
@@ -780,9 +771,9 @@ describe('equalsMatrix4', () => {
780
771
  });
781
772
 
782
773
  it('returns true for two matrices with identical values', () => {
783
- const a = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
774
+ const a = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
784
775
 
785
- const b = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
776
+ const b = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
786
777
 
787
778
  expect(equalsMatrix4(a, b)).toBe(true);
788
779
  });
@@ -806,7 +797,7 @@ describe('getMatrix4Determinant', () => {
806
797
 
807
798
  describe('getMatrix4Element', () => {
808
799
  it('returns the element at the given row and column', () => {
809
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
800
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
810
801
  expect(getMatrix4Element(m, 0, 0)).toBe(1);
811
802
  expect(getMatrix4Element(m, 1, 0)).toBe(2);
812
803
  expect(getMatrix4Element(m, 0, 1)).toBe(5);
@@ -1154,8 +1145,8 @@ describe('multiplyMatrix4', () => {
1154
1145
  });
1155
1146
 
1156
1147
  it('supports out === a', () => {
1157
- const a = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1158
- const b = createMatrix4(17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79);
1148
+ const a = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1149
+ const b = createMatrix4FromValues(17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79);
1159
1150
  const expected = createMatrix4();
1160
1151
  multiplyMatrix4(expected, a, b);
1161
1152
 
@@ -1164,8 +1155,8 @@ describe('multiplyMatrix4', () => {
1164
1155
  });
1165
1156
 
1166
1157
  it('supports out === b', () => {
1167
- const a = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1168
- const b = createMatrix4(17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79);
1158
+ const a = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1159
+ const b = createMatrix4FromValues(17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79);
1169
1160
  const expected = createMatrix4();
1170
1161
  multiplyMatrix4(expected, a, b);
1171
1162
 
@@ -1581,7 +1572,7 @@ describe('setMatrix4', () => {
1581
1572
  });
1582
1573
 
1583
1574
  it('overwrites existing matrix values completely', () => {
1584
- const m = createMatrix4(99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99);
1575
+ const m = createMatrix4FromValues(99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99);
1585
1576
 
1586
1577
  setMatrix4(m, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
1587
1578
 
@@ -1738,7 +1729,7 @@ describe('setMatrix4FromMatrix3', () => {
1738
1729
 
1739
1730
  it('should handle scaling and translation', () => {
1740
1731
  // scale(2,3), translate(5,10)
1741
- const mat3 = createMatrix3(2, 0, 5, 0, 3, 10, 0, 0, 1);
1732
+ const mat3 = createMatrix3FromValues(2, 0, 5, 0, 3, 10, 0, 0, 1);
1742
1733
 
1743
1734
  const mat = createMatrix4();
1744
1735
  setMatrix4FromMatrix3(mat, mat3);
@@ -1767,7 +1758,7 @@ describe('setMatrix4FromMatrix3', () => {
1767
1758
 
1768
1759
  describe('setMatrix4FromQuaternion', () => {
1769
1760
  it('identity quaternion writes the identity matrix', () => {
1770
- const m = createMatrix4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
1761
+ const m = createMatrix4FromValues(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
1771
1762
  setMatrix4FromQuaternion(m, createQuaternion());
1772
1763
  expect(Array.from(m.m)).toEqual([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
1773
1764
  });
@@ -1787,7 +1778,7 @@ describe('setMatrix4FromQuaternion', () => {
1787
1778
 
1788
1779
  describe('setMatrix4Identity', () => {
1789
1780
  it('resets a matrix to identity', () => {
1790
- const m = createMatrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1781
+ const m = createMatrix4FromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1791
1782
 
1792
1783
  setMatrix4Identity(m);
1793
1784
 
@@ -1964,7 +1955,7 @@ describe('translateMatrix4', () => {
1964
1955
  it('copies the whole source matrix when out is a distinct object', () => {
1965
1956
  const source = createMatrix4();
1966
1957
  setMatrix4(source, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 7, 8, 9, 1);
1967
- const out = createMatrix4(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
1958
+ const out = createMatrix4FromValues(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
1968
1959
  const aliased = cloneMatrix4(source);
1969
1960
 
1970
1961
  translateMatrix4(out, source, 1, 2, 3);
@@ -1,8 +1,8 @@
1
1
  import { attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
2
2
  import { getMatrix4Element } from '@flighthq/geometry/contract';
3
- import type { Matrix4 } from '@flighthq/types/contract';
4
3
 
5
- import { acquireIdentityMatrix4, acquireMatrix4, clearMatrix4Pool, releaseMatrix4 } from './matrix4Pool';
4
+ import { acquireIdentityMatrix4, acquireMatrix4, clearMatrix4Pool, releaseMatrix4 } from './matrix4Pool.ts';
5
+ import type { Matrix4 } from './types.ts';
6
6
 
7
7
  beforeEach(() => {
8
8
  clearMatrix4Pool();