@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.
- package/README.md +2 -2
- package/dist/.tsbuildinfo.contract +1 -0
- package/dist/.tsbuildinfo.runtime +1 -0
- package/dist/aabb.d.ts +2 -1
- package/dist/aabb.d.ts.map +1 -1
- package/dist/aabb.js +3 -3
- package/dist/aabb.js.map +1 -1
- package/dist/boundingSphere.d.ts +2 -1
- package/dist/boundingSphere.d.ts.map +1 -1
- package/dist/boundingSphere.js +3 -3
- package/dist/boundingSphere.js.map +1 -1
- package/dist/capsule.d.ts +2 -1
- package/dist/capsule.d.ts.map +1 -1
- package/dist/capsule.js +2 -2
- package/dist/capsule.js.map +1 -1
- package/dist/contract.d.ts +2 -44
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.geometry-types.d.ts +2 -0
- package/dist/contract.geometry-types.d.ts.map +1 -0
- package/dist/contract.geometry-types.js +4 -0
- package/dist/contract.geometry-types.js.map +1 -0
- package/dist/contract.js +2 -44
- package/dist/contract.js.map +1 -1
- package/dist/enableGeometryPoolGuards.d.ts +10 -1
- package/dist/enableGeometryPoolGuards.d.ts.map +1 -1
- package/dist/enableGeometryPoolGuards.js +56 -23
- package/dist/enableGeometryPoolGuards.js.map +1 -1
- package/dist/frustum.d.ts +2 -1
- package/dist/frustum.d.ts.map +1 -1
- package/dist/frustum.js +3 -3
- package/dist/frustum.js.map +1 -1
- package/dist/geometryPoolGuards.d.ts +3 -3
- package/dist/geometryPoolGuards.d.ts.map +1 -1
- package/dist/geometryPoolGuards.js +3 -0
- package/dist/geometryPoolGuards.js.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/matrix.d.ts +3 -1
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +3 -2
- package/dist/matrix.js.map +1 -1
- package/dist/matrix3.d.ts +6 -4
- package/dist/matrix3.d.ts.map +1 -1
- package/dist/matrix3.js +13 -27
- package/dist/matrix3.js.map +1 -1
- package/dist/matrix3Pool.d.ts +1 -1
- package/dist/matrix3Pool.d.ts.map +1 -1
- package/dist/matrix3Pool.js +4 -4
- package/dist/matrix3Pool.js.map +1 -1
- package/dist/matrix4.d.ts +5 -3
- package/dist/matrix4.d.ts.map +1 -1
- package/dist/matrix4.js +12 -40
- package/dist/matrix4.js.map +1 -1
- package/dist/matrix4Pool.d.ts +1 -1
- package/dist/matrix4Pool.d.ts.map +1 -1
- package/dist/matrix4Pool.js +4 -4
- package/dist/matrix4Pool.js.map +1 -1
- package/dist/matrixPool.d.ts +1 -1
- package/dist/matrixPool.d.ts.map +1 -1
- package/dist/matrixPool.js +4 -4
- package/dist/matrixPool.js.map +1 -1
- package/dist/obb.d.ts +2 -1
- package/dist/obb.d.ts.map +1 -1
- package/dist/obb.js +2 -2
- package/dist/obb.js.map +1 -1
- package/dist/plane.d.ts +2 -1
- package/dist/plane.d.ts.map +1 -1
- package/dist/plane.js +2 -2
- package/dist/plane.js.map +1 -1
- package/dist/quaternion.d.ts +2 -1
- package/dist/quaternion.d.ts.map +1 -1
- package/dist/quaternion.js +2 -2
- package/dist/quaternion.js.map +1 -1
- package/dist/quaternionPool.d.ts +1 -1
- package/dist/quaternionPool.d.ts.map +1 -1
- package/dist/quaternionPool.js +4 -4
- package/dist/quaternionPool.js.map +1 -1
- package/dist/ray3d.d.ts +2 -1
- package/dist/ray3d.d.ts.map +1 -1
- package/dist/ray3d.js +3 -3
- package/dist/ray3d.js.map +1 -1
- package/dist/rectangle.d.ts +2 -1
- package/dist/rectangle.d.ts.map +1 -1
- package/dist/rectangle.js +2 -2
- package/dist/rectangle.js.map +1 -1
- package/dist/rectanglePool.d.ts +1 -1
- package/dist/rectanglePool.d.ts.map +1 -1
- package/dist/rectanglePool.js +4 -4
- package/dist/rectanglePool.js.map +1 -1
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +29 -0
- package/dist/runtime.js.map +1 -0
- package/dist/transform2d.d.ts +2 -1
- package/dist/transform2d.d.ts.map +1 -1
- package/dist/transform2d.js +2 -2
- package/dist/transform2d.js.map +1 -1
- package/dist/transform3d.d.ts +2 -1
- package/dist/transform3d.d.ts.map +1 -1
- package/dist/transform3d.js +5 -5
- package/dist/transform3d.js.map +1 -1
- package/dist/types.d.ts +145 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vector2.d.ts +2 -1
- package/dist/vector2.d.ts.map +1 -1
- package/dist/vector2.js +2 -2
- package/dist/vector2.js.map +1 -1
- package/dist/vector2Pool.d.ts +1 -1
- package/dist/vector2Pool.d.ts.map +1 -1
- package/dist/vector2Pool.js +4 -4
- package/dist/vector2Pool.js.map +1 -1
- package/dist/vector3.d.ts +2 -1
- package/dist/vector3.d.ts.map +1 -1
- package/dist/vector3.js +2 -2
- package/dist/vector3.js.map +1 -1
- package/dist/vector3Pool.d.ts +1 -1
- package/dist/vector3Pool.d.ts.map +1 -1
- package/dist/vector3Pool.js +4 -4
- package/dist/vector3Pool.js.map +1 -1
- package/dist/vector4.d.ts +2 -1
- package/dist/vector4.d.ts.map +1 -1
- package/dist/vector4.js +2 -2
- package/dist/vector4.js.map +1 -1
- package/dist/vector4Pool.d.ts +1 -1
- package/dist/vector4Pool.d.ts.map +1 -1
- package/dist/vector4Pool.js +4 -4
- package/dist/vector4Pool.js.map +1 -1
- package/package.json +7 -6
- package/src/aabb.test.ts +3 -2
- package/src/boundingSphere.test.ts +4 -3
- package/src/capsule.test.ts +1 -1
- package/src/enableGeometryPoolGuards.test.ts +31 -24
- package/src/frustum.test.ts +5 -4
- package/src/geometryPoolGuards.test.ts +14 -1
- package/src/matrix.test.ts +2 -2
- package/src/matrix3.test.ts +59 -63
- package/src/matrix3Pool.test.ts +2 -2
- package/src/matrix4.test.ts +42 -51
- package/src/matrix4Pool.test.ts +2 -2
- package/src/matrixPool.test.ts +2 -2
- package/src/obb.test.ts +7 -5
- package/src/plane.test.ts +1 -1
- package/src/quaternion.test.ts +2 -2
- package/src/ray3d.test.ts +8 -8
- package/src/rectangle.test.ts +2 -2
- package/src/rectanglePool.test.ts +2 -2
- package/src/transform2d.test.ts +2 -2
- package/src/transform3d.test.ts +4 -4
- package/src/typedarray.test.ts +1 -1
- package/src/vector2.test.ts +2 -2
- package/src/vector2Pool.test.ts +2 -2
- package/src/vector3.test.ts +2 -2
- package/src/vector3Pool.test.ts +2 -2
- package/src/vector4.test.ts +2 -2
- package/src/vector4Pool.test.ts +2 -2
package/src/matrixPool.test.ts
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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
package/src/quaternion.test.ts
CHANGED
|
@@ -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', () => {
|
package/src/rectangle.test.ts
CHANGED
|
@@ -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();
|
package/src/transform2d.test.ts
CHANGED
|
@@ -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
|
|
package/src/transform3d.test.ts
CHANGED
|
@@ -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', () => {
|
package/src/typedarray.test.ts
CHANGED
|
@@ -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', () => {
|
package/src/vector2.test.ts
CHANGED
|
@@ -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 {
|
|
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;
|
package/src/vector2Pool.test.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import type { Vector2 } from './types.ts';
|
|
4
|
+
import { acquireEmptyVector2, acquireVector2, clearVector2Pool, releaseVector2 } from './vector2Pool.ts';
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
clearVector2Pool();
|
package/src/vector3.test.ts
CHANGED
|
@@ -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 {
|
|
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', () => {
|
package/src/vector3Pool.test.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import type { Vector3 } from './types.ts';
|
|
4
|
+
import { acquireEmptyVector3, acquireVector3, clearVector3Pool, releaseVector3 } from './vector3Pool.ts';
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
clearVector3Pool();
|
package/src/vector4.test.ts
CHANGED
|
@@ -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 {
|
|
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', () => {
|
package/src/vector4Pool.test.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import type { Vector4 } from './types.ts';
|
|
4
|
+
import { acquireEmptyVector4, acquireVector4, clearVector4Pool, releaseVector4 } from './vector4Pool.ts';
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
clearVector4Pool();
|