@adobe/data 0.5.14 → 0.5.16

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 (130) hide show
  1. package/dist/ecs/entity/entity.d.ts +8 -0
  2. package/dist/ecs/entity/entity.js +3 -0
  3. package/dist/ecs/entity/entity.js.map +1 -0
  4. package/dist/ecs/entity/u32.d.ts +8 -0
  5. package/dist/{lit/elements/service-context.js → ecs/entity/u32.js} +3 -3
  6. package/dist/ecs/entity/u32.js.map +1 -0
  7. package/dist/graphics/frame.d.ts +1 -22
  8. package/dist/graphics/frame.js +14 -11
  9. package/dist/graphics/frame.js.map +1 -1
  10. package/dist/graphics/get-web-gpu-device-and-context.d.ts +1 -2
  11. package/dist/graphics/get-web-gpu-device-and-context.js +23 -20
  12. package/dist/graphics/get-web-gpu-device-and-context.js.map +1 -1
  13. package/dist/graphics/graphics-context.d.ts +1 -5
  14. package/dist/graphics/graphics-context.js +5 -0
  15. package/dist/graphics/graphics-context.js.map +1 -1
  16. package/dist/math/aabb/aabb.d.ts +42 -42
  17. package/dist/math/aabb/aabb.js +65 -62
  18. package/dist/math/aabb/aabb.js.map +1 -1
  19. package/dist/math/aabb-face/aabb-face.d.ts +59 -0
  20. package/dist/math/aabb-face/aabb-face.js +145 -0
  21. package/dist/math/aabb-face/aabb-face.js.map +1 -0
  22. package/dist/math/aabb-face/aabb-face.test.d.ts +1 -0
  23. package/dist/math/aabb-face/aabb-face.test.js +54 -0
  24. package/dist/math/aabb-face/aabb-face.test.js.map +1 -0
  25. package/dist/math/aabb-face/face.d.ts +51 -0
  26. package/dist/math/aabb-face/face.js +110 -0
  27. package/dist/math/aabb-face/face.js.map +1 -0
  28. package/dist/math/aabb-face/face.test.d.ts +1 -0
  29. package/dist/math/aabb-face/face.test.js +94 -0
  30. package/dist/math/aabb-face/face.test.js.map +1 -0
  31. package/dist/math/box/box.d.ts +50 -0
  32. package/dist/math/box/box.js +23 -0
  33. package/dist/math/box/box.js.map +1 -0
  34. package/dist/math/f32/f32.d.ts +8 -6
  35. package/dist/math/f32/f32.js +4 -1
  36. package/dist/math/f32/f32.js.map +1 -1
  37. package/dist/math/face/face.d.ts +51 -0
  38. package/dist/math/face/face.js +110 -0
  39. package/dist/math/face/face.js.map +1 -0
  40. package/dist/math/face/face.test.d.ts +1 -0
  41. package/dist/math/face/face.test.js +94 -0
  42. package/dist/math/face/face.test.js.map +1 -0
  43. package/dist/math/i32/i32.d.ts +9 -6
  44. package/dist/math/i32/i32.js +5 -2
  45. package/dist/math/i32/i32.js.map +1 -1
  46. package/dist/math/index.d.ts +13 -22
  47. package/dist/math/index.js +13 -22
  48. package/dist/math/index.js.map +1 -1
  49. package/dist/math/line2/line2.d.ts +36 -36
  50. package/dist/math/line2/line2.js +55 -52
  51. package/dist/math/line2/line2.js.map +1 -1
  52. package/dist/math/line3/line3.d.ts +48 -43
  53. package/dist/math/line3/line3.js +64 -52
  54. package/dist/math/line3/line3.js.map +1 -1
  55. package/dist/math/mat4x4/mat4x4.d.ts +34 -34
  56. package/dist/math/mat4x4/mat4x4.js +216 -213
  57. package/dist/math/mat4x4/mat4x4.js.map +1 -1
  58. package/dist/math/picking/face.d.ts +1 -0
  59. package/dist/math/picking/face.js +2 -0
  60. package/dist/math/picking/face.js.map +1 -0
  61. package/dist/math/picking/get-closest-entity-to-line.d.ts +4 -0
  62. package/dist/math/picking/get-closest-entity-to-line.js +30 -0
  63. package/dist/math/picking/get-closest-entity-to-line.js.map +1 -0
  64. package/dist/math/picking/get-closest-entity-to-point.d.ts +4 -0
  65. package/dist/math/picking/get-closest-entity-to-point.js +27 -0
  66. package/dist/math/picking/get-closest-entity-to-point.js.map +1 -0
  67. package/dist/math/picking/get-intersecting-entities.d.ts +12 -0
  68. package/dist/math/picking/get-intersecting-entities.js +15 -0
  69. package/dist/math/picking/get-intersecting-entities.js.map +1 -0
  70. package/dist/math/picking/getClosestEntityToLine.d.ts +4 -0
  71. package/dist/math/picking/getClosestEntityToLine.js +29 -0
  72. package/dist/math/picking/getClosestEntityToLine.js.map +1 -0
  73. package/dist/math/picking/getClosestEntityToPoint.d.ts +4 -0
  74. package/dist/math/picking/getClosestEntityToPoint.js +27 -0
  75. package/dist/math/picking/getClosestEntityToPoint.js.map +1 -0
  76. package/dist/math/picking/getIntersectingEntities.d.ts +12 -0
  77. package/dist/math/picking/getIntersectingEntities.js +15 -0
  78. package/dist/math/picking/getIntersectingEntities.js.map +1 -0
  79. package/dist/math/picking/index.d.ts +4 -0
  80. package/dist/math/picking/index.js +4 -0
  81. package/dist/math/picking/index.js.map +1 -1
  82. package/dist/math/picking/pick-from-tables.d.ts +1 -0
  83. package/dist/math/picking/pick-from-tables.js +7 -98
  84. package/dist/math/picking/pick-from-tables.js.map +1 -1
  85. package/dist/math/picking/pick-result.d.ts +5 -2
  86. package/dist/math/plane/plane.d.ts +43 -0
  87. package/dist/math/plane/plane.js +70 -0
  88. package/dist/math/plane/plane.js.map +1 -0
  89. package/dist/math/plane/plane.test.d.ts +1 -0
  90. package/dist/math/plane/plane.test.js +132 -0
  91. package/dist/math/plane/plane.test.js.map +1 -0
  92. package/dist/math/quat/quat.d.ts +49 -39
  93. package/dist/math/quat/quat.js +225 -185
  94. package/dist/math/quat/quat.js.map +1 -1
  95. package/dist/math/u32/u32.d.ts +9 -7
  96. package/dist/math/u32/u32.js +4 -1
  97. package/dist/math/u32/u32.js.map +1 -1
  98. package/dist/math/vec2/vec2.d.ts +61 -61
  99. package/dist/math/vec2/vec2.js +93 -90
  100. package/dist/math/vec2/vec2.js.map +1 -1
  101. package/dist/math/vec3/vec3.d.ts +66 -63
  102. package/dist/math/vec3/vec3.js +137 -129
  103. package/dist/math/vec3/vec3.js.map +1 -1
  104. package/dist/math/vec4/vec4.d.ts +61 -61
  105. package/dist/math/vec4/vec4.js +132 -129
  106. package/dist/math/vec4/vec4.js.map +1 -1
  107. package/dist/observe/to-async-generator.js +4 -4
  108. package/dist/observe/to-async-generator.js.map +1 -1
  109. package/dist/old-ecs/action-ecs/action-ecs.test.js +1 -1
  110. package/dist/old-ecs/action-ecs/action-ecs.test.js.map +1 -1
  111. package/dist/old-ecs/action-ecs/action-types.d.ts +7 -0
  112. package/dist/old-ecs/action-ecs/action-types.js.map +1 -1
  113. package/dist/old-ecs/ecs/ecs-types.d.ts +7 -0
  114. package/dist/old-ecs/ecs/ecs.test.js +1 -1
  115. package/dist/old-ecs/ecs/ecs.test.js.map +1 -1
  116. package/dist/old-ecs/transaction-ecs/transaction-ecs.test.js +1 -1
  117. package/dist/old-ecs/transaction-ecs/transaction-ecs.test.js.map +1 -1
  118. package/dist/old-ecs/transaction-ecs/transaction-types.d.ts +7 -0
  119. package/dist/samples/todo/services/state-service/create-todo-database.d.ts +2 -2
  120. package/dist/samples/todo/services/state-service/create-todo-store.d.ts +2 -2
  121. package/dist/tsconfig.tsbuildinfo +1 -1
  122. package/package.json +6 -3
  123. package/dist/lit/elements/service-application.d.ts +0 -9
  124. package/dist/lit/elements/service-application.js +0 -55
  125. package/dist/lit/elements/service-application.js.map +0 -1
  126. package/dist/lit/elements/service-context.d.ts +0 -1
  127. package/dist/lit/elements/service-context.js.map +0 -1
  128. package/dist/lit/elements/service-element.d.ts +0 -6
  129. package/dist/lit/elements/service-element.js +0 -43
  130. package/dist/lit/elements/service-element.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ /*MIT License
2
+
3
+ © Copyright 2025 Adobe. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.*/
22
+ import { describe, it, expect } from 'vitest';
23
+ import * as Face from './face.js';
24
+ describe('Face', () => {
25
+ it('should have correct constants', () => {
26
+ expect(Face.POS_Z).toBe(0);
27
+ expect(Face.POS_X).toBe(1);
28
+ expect(Face.NEG_Z).toBe(2);
29
+ expect(Face.NEG_X).toBe(3);
30
+ expect(Face.POS_Y).toBe(4);
31
+ expect(Face.NEG_Y).toBe(5);
32
+ });
33
+ it('should get correct face names', () => {
34
+ expect(Face.getName(Face.POS_Z)).toBe('POS_Z');
35
+ expect(Face.getName(Face.POS_X)).toBe('POS_X');
36
+ expect(Face.getName(Face.NEG_Z)).toBe('NEG_Z');
37
+ expect(Face.getName(Face.NEG_X)).toBe('NEG_X');
38
+ expect(Face.getName(Face.POS_Y)).toBe('POS_Y');
39
+ expect(Face.getName(Face.NEG_Y)).toBe('NEG_Y');
40
+ });
41
+ it('should get correct normal vectors', () => {
42
+ expect(Face.getNormal(Face.POS_Z)).toEqual([0, 0, 1]);
43
+ expect(Face.getNormal(Face.NEG_Z)).toEqual([0, 0, -1]);
44
+ expect(Face.getNormal(Face.POS_X)).toEqual([1, 0, 0]);
45
+ expect(Face.getNormal(Face.NEG_X)).toEqual([-1, 0, 0]);
46
+ expect(Face.getNormal(Face.POS_Y)).toEqual([0, 1, 0]);
47
+ expect(Face.getNormal(Face.NEG_Y)).toEqual([0, -1, 0]);
48
+ });
49
+ it('should get correct opposite faces', () => {
50
+ expect(Face.getOpposite(Face.POS_Z)).toBe(Face.NEG_Z);
51
+ expect(Face.getOpposite(Face.NEG_Z)).toBe(Face.POS_Z);
52
+ expect(Face.getOpposite(Face.POS_X)).toBe(Face.NEG_X);
53
+ expect(Face.getOpposite(Face.NEG_X)).toBe(Face.POS_X);
54
+ expect(Face.getOpposite(Face.POS_Y)).toBe(Face.NEG_Y);
55
+ expect(Face.getOpposite(Face.NEG_Y)).toBe(Face.POS_Y);
56
+ });
57
+ it('should correctly identify opposite faces', () => {
58
+ expect(Face.isOpposite(Face.POS_Z, Face.NEG_Z)).toBe(true);
59
+ expect(Face.isOpposite(Face.POS_X, Face.NEG_X)).toBe(true);
60
+ expect(Face.isOpposite(Face.POS_Y, Face.NEG_Y)).toBe(true);
61
+ expect(Face.isOpposite(Face.POS_Z, Face.POS_X)).toBe(false);
62
+ expect(Face.isOpposite(Face.POS_Z, Face.POS_Z)).toBe(false);
63
+ });
64
+ it('should get correct adjacent faces', () => {
65
+ const posZAdjacent = Face.getAdjacent(Face.POS_Z);
66
+ expect(posZAdjacent).toContain(Face.POS_X);
67
+ expect(posZAdjacent).toContain(Face.NEG_X);
68
+ expect(posZAdjacent).toContain(Face.POS_Y);
69
+ expect(posZAdjacent).toContain(Face.NEG_Y);
70
+ expect(posZAdjacent).not.toContain(Face.NEG_Z);
71
+ expect(posZAdjacent).not.toContain(Face.POS_Z);
72
+ const posXAdjacent = Face.getAdjacent(Face.POS_X);
73
+ expect(posXAdjacent).toContain(Face.POS_Z);
74
+ expect(posXAdjacent).toContain(Face.NEG_Z);
75
+ expect(posXAdjacent).toContain(Face.POS_Y);
76
+ expect(posXAdjacent).toContain(Face.NEG_Y);
77
+ expect(posXAdjacent).not.toContain(Face.NEG_X);
78
+ expect(posXAdjacent).not.toContain(Face.POS_X);
79
+ });
80
+ it('should correctly identify adjacent faces', () => {
81
+ expect(Face.isAdjacent(Face.POS_Z, Face.POS_X)).toBe(true);
82
+ expect(Face.isAdjacent(Face.POS_Z, Face.NEG_X)).toBe(true);
83
+ expect(Face.isAdjacent(Face.POS_Z, Face.POS_Y)).toBe(true);
84
+ expect(Face.isAdjacent(Face.POS_Z, Face.NEG_Y)).toBe(true);
85
+ expect(Face.isAdjacent(Face.POS_Z, Face.NEG_Z)).toBe(false);
86
+ expect(Face.isAdjacent(Face.POS_Z, Face.POS_Z)).toBe(false);
87
+ });
88
+ it('should throw error for invalid face indices', () => {
89
+ expect(() => Face.getNormal(6)).toThrow('Invalid face index: 6');
90
+ expect(() => Face.getOpposite(6)).toThrow('Invalid face index: 6');
91
+ expect(() => Face.getAdjacent(6)).toThrow('Invalid face index: 6');
92
+ });
93
+ });
94
+ //# sourceMappingURL=face.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"face.test.js","sourceRoot":"","sources":["../../../src/math/face/face.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC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AAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAC1E,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { FromSchema } from "../../schema/index.js";
2
- export declare const schema: {
3
- readonly type: "number";
4
- readonly precision: 1;
5
- readonly default: number;
6
- };
7
- export type Type = FromSchema<typeof schema>;
2
+ export type I32 = FromSchema<typeof I32.schema>;
3
+ export declare namespace I32 {
4
+ const schema: {
5
+ readonly type: "integer";
6
+ readonly minimum: -2147483648;
7
+ readonly maximum: 2147483647;
8
+ readonly default: number;
9
+ };
10
+ }
@@ -19,6 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.*/
22
- import { F32Schema } from "../../schema/index.js";
23
- export const schema = F32Schema;
22
+ import { I32Schema } from "../../schema/index.js";
23
+ export var I32;
24
+ (function (I32) {
25
+ I32.schema = I32Schema;
26
+ })(I32 || (I32 = {}));
24
27
  //# sourceMappingURL=i32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i32.js","sourceRoot":"","sources":["../../../src/math/i32/i32.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,SAAS,EAAc,MAAM,uBAAuB,CAAC;AAC9D,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAA"}
1
+ {"version":3,"file":"i32.js","sourceRoot":"","sources":["../../../src/math/i32/i32.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,SAAS,EAAc,MAAM,uBAAuB,CAAC;AAI9D,MAAM,KAAW,GAAG,CAEnB;AAFD,WAAiB,GAAG;IACH,UAAM,GAAG,SAAS,CAAC;AACpC,CAAC,EAFgB,GAAG,KAAH,GAAG,QAEnB"}
@@ -1,24 +1,15 @@
1
1
  export * from "./constants.js";
2
- export type Mat4x4 = import("./mat4x4/mat4x4.js").Type;
3
- export * as Mat4x4 from "./mat4x4/mat4x4.js";
4
- export type F32 = import("./f32/f32.js").Type;
5
- export * as F32 from "./f32/f32.js";
6
- export type U32 = import("./u32/u32.js").Type;
7
- export * as U32 from "./u32/u32.js";
8
- export type I32 = import("./i32/i32.js").Type;
9
- export * as I32 from "./i32/i32.js";
10
- export type Vec2 = import("./vec2/vec2.js").Type;
11
- export * as Vec2 from "./vec2/vec2.js";
12
- export type Vec3 = import("./vec3/vec3.js").Type;
13
- export * as Vec3 from "./vec3/vec3.js";
14
- export type Vec4 = import("./vec4/vec4.js").Type;
15
- export * as Vec4 from "./vec4/vec4.js";
16
- export type Quat = import("./quat/quat.js").Type;
17
- export * as Quat from "./quat/quat.js";
18
- export type Aabb = import("./aabb/aabb.js").Type;
19
- export * as Aabb from "./aabb/aabb.js";
20
- export type Line2 = import("./line2/line2.js").Type;
21
- export * as Line2 from "./line2/line2.js";
22
- export type Line3 = import("./line3/line3.js").Type;
23
- export * as Line3 from "./line3/line3.js";
2
+ export * from "./mat4x4/mat4x4.js";
3
+ export * from "./f32/f32.js";
4
+ export * from "./u32/u32.js";
5
+ export * from "./i32/i32.js";
6
+ export * from "./vec2/vec2.js";
7
+ export * from "./vec3/vec3.js";
8
+ export * from "./vec4/vec4.js";
9
+ export * from "./quat/quat.js";
10
+ export * from "./aabb/aabb.js";
11
+ export * from "./line2/line2.js";
12
+ export * from "./line3/line3.js";
13
+ export * from "./aabb-face/aabb-face.js";
14
+ export * from "./plane/plane.js";
24
15
  export * from "./picking/index.js";
@@ -20,27 +20,18 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.*/
22
22
  export * from "./constants.js";
23
- // Export the namespace Mat4x4
24
- export * as Mat4x4 from "./mat4x4/mat4x4.js";
25
- // Export the namespace F32
26
- export * as F32 from "./f32/f32.js";
27
- // Export the namespace F32
28
- export * as U32 from "./u32/u32.js";
29
- // Export the namespace F32
30
- export * as I32 from "./i32/i32.js";
31
- // Export the namespace Vec2
32
- export * as Vec2 from "./vec2/vec2.js";
33
- // Export the namespace Vec3
34
- export * as Vec3 from "./vec3/vec3.js";
35
- // Export the namespace Vec4
36
- export * as Vec4 from "./vec4/vec4.js";
37
- // Export the namespace Quat
38
- export * as Quat from "./quat/quat.js";
39
- // Export the namespace Aabb
40
- export * as Aabb from "./aabb/aabb.js";
41
- // Export the namespace Line2
42
- export * as Line2 from "./line2/line2.js";
43
- // Export the namespace Line3
44
- export * as Line3 from "./line3/line3.js";
23
+ export * from "./mat4x4/mat4x4.js";
24
+ export * from "./f32/f32.js";
25
+ export * from "./u32/u32.js";
26
+ export * from "./i32/i32.js";
27
+ export * from "./vec2/vec2.js";
28
+ export * from "./vec3/vec3.js";
29
+ export * from "./vec4/vec4.js";
30
+ export * from "./quat/quat.js";
31
+ export * from "./aabb/aabb.js";
32
+ export * from "./line2/line2.js";
33
+ export * from "./line3/line3.js";
34
+ export * from "./aabb-face/aabb-face.js";
35
+ export * from "./plane/plane.js";
45
36
  export * from "./picking/index.js";
46
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,cAAc,gBAAgB,CAAC;AAG/B,8BAA8B;AAC9B,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAI7C,2BAA2B;AAC3B,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAIpC,2BAA2B;AAC3B,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAIpC,2BAA2B;AAC3B,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAIpC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAGvC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,6BAA6B;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAI1C,6BAA6B;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
@@ -1,42 +1,42 @@
1
1
  import { FromSchema } from "../../schema/index.js";
2
2
  import { Vec2 } from "../index.js";
3
- export declare const schema: {
4
- readonly type: "object";
5
- readonly properties: {
6
- readonly a: {
7
- readonly type: "array";
8
- readonly items: {
9
- readonly type: "number";
10
- readonly precision: 1;
11
- readonly default: number;
3
+ export type Line2 = FromSchema<typeof Line2.schema>;
4
+ export declare namespace Line2 {
5
+ const schema: {
6
+ readonly type: "object";
7
+ readonly properties: {
8
+ readonly a: {
9
+ readonly type: "array";
10
+ readonly items: {
11
+ readonly type: "number";
12
+ readonly precision: 1;
13
+ readonly default: number;
14
+ };
15
+ readonly minItems: 2;
16
+ readonly maxItems: 2;
17
+ readonly default: readonly [0, 0];
12
18
  };
13
- readonly minItems: 2;
14
- readonly maxItems: 2;
15
- readonly default: readonly [0, 0];
16
- };
17
- readonly b: {
18
- readonly type: "array";
19
- readonly items: {
20
- readonly type: "number";
21
- readonly precision: 1;
22
- readonly default: number;
19
+ readonly b: {
20
+ readonly type: "array";
21
+ readonly items: {
22
+ readonly type: "number";
23
+ readonly precision: 1;
24
+ readonly default: number;
25
+ };
26
+ readonly minItems: 2;
27
+ readonly maxItems: 2;
28
+ readonly default: readonly [0, 0];
23
29
  };
24
- readonly minItems: 2;
25
- readonly maxItems: 2;
26
- readonly default: readonly [0, 0];
30
+ };
31
+ readonly required: readonly ["a", "b"];
32
+ readonly additionalProperties: false;
33
+ readonly default: {
34
+ readonly a: readonly [0, 0];
35
+ readonly b: readonly [0, 0];
27
36
  };
28
37
  };
29
- readonly required: readonly ["a", "b"];
30
- readonly additionalProperties: false;
31
- readonly default: {
32
- readonly a: readonly [0, 0];
33
- readonly b: readonly [0, 0];
34
- };
35
- };
36
- export type Type = FromSchema<typeof schema>;
37
- type Line2 = Type;
38
- export declare const layout: import("../../typed-buffer/index.js").StructLayout;
39
- export declare const interpolate: (line: Line2, alpha: number) => Vec2;
40
- export declare const intersects: (line1: Line2, line2: Line2, includeEndpoints?: boolean) => boolean;
41
- export declare const subLine: (line: Line2, alpha: number, beta: number) => Line2;
42
- export {};
38
+ const layout: import("../../typed-buffer/index.js").StructLayout;
39
+ const interpolate: (line: Line2, alpha: number) => Vec2;
40
+ const intersects: (line1: Line2, line2: Line2, includeEndpoints?: boolean) => boolean;
41
+ const subLine: (line: Line2, alpha: number, beta: number) => Line2;
42
+ }
@@ -22,57 +22,60 @@ SOFTWARE.*/
22
22
  import { getStructLayout } from "../../typed-buffer/index.js";
23
23
  import { Vec2 } from "../index.js";
24
24
  import { epsilon } from "../constants.js";
25
- const { schema: Vec2Schema } = Vec2;
26
- export const schema = {
27
- type: 'object',
28
- properties: {
29
- a: Vec2Schema,
30
- b: Vec2Schema,
31
- },
32
- required: ['a', 'b'],
33
- additionalProperties: false,
34
- default: {
35
- a: Vec2Schema.default,
36
- b: Vec2Schema.default,
37
- }
38
- };
39
- export const layout = getStructLayout(schema);
40
- // Line2 utility functions
41
- export const interpolate = (line, alpha) => {
42
- const a = line.a;
43
- const b = line.b;
44
- return [a[0] + alpha * (b[0] - a[0]), a[1] + alpha * (b[1] - a[1])];
45
- };
46
- export const intersects = (line1, line2, includeEndpoints = false) => {
47
- const a = line1.a;
48
- const b = line1.b;
49
- const c = line2.a;
50
- const d = line2.b;
51
- // Check for endpoint intersections
52
- if (includeEndpoints && ((Math.abs(a[0] - c[0]) < epsilon && Math.abs(a[1] - c[1]) < epsilon) ||
53
- (Math.abs(a[0] - d[0]) < epsilon && Math.abs(a[1] - d[1]) < epsilon) ||
54
- (Math.abs(b[0] - c[0]) < epsilon && Math.abs(b[1] - c[1]) < epsilon) ||
55
- (Math.abs(b[0] - d[0]) < epsilon && Math.abs(b[1] - d[1]) < epsilon))) {
56
- return true;
57
- }
58
- // Calculate the denominator
59
- const denominator = (d[0] - c[0]) * (b[1] - a[1]) - (d[1] - c[1]) * (b[0] - a[0]);
60
- // Check if lines are parallel or collinear
61
- if (Math.abs(denominator) < epsilon) {
62
- return false;
63
- }
64
- // Calculate intersection parameters
65
- const numerator1 = (d[1] - c[1]) * (a[0] - c[0]) - (d[0] - c[0]) * (a[1] - c[1]);
66
- const numerator2 = (b[1] - a[1]) * (a[0] - c[0]) - (b[0] - a[0]) * (a[1] - c[1]);
67
- const ua = numerator1 / denominator;
68
- const ub = numerator2 / denominator;
69
- // Check if intersection point lies within both line segments
70
- return ua >= -epsilon && ua <= 1 + epsilon && ub >= -epsilon && ub <= 1 + epsilon;
71
- };
72
- export const subLine = (line, alpha, beta) => {
73
- return {
74
- a: interpolate(line, alpha),
75
- b: interpolate(line, beta),
25
+ export var Line2;
26
+ (function (Line2) {
27
+ const { schema: Vec2Schema } = Vec2;
28
+ Line2.schema = {
29
+ type: 'object',
30
+ properties: {
31
+ a: Vec2Schema,
32
+ b: Vec2Schema,
33
+ },
34
+ required: ['a', 'b'],
35
+ additionalProperties: false,
36
+ default: {
37
+ a: Vec2Schema.default,
38
+ b: Vec2Schema.default,
39
+ }
76
40
  };
77
- };
41
+ Line2.layout = getStructLayout(Line2.schema);
42
+ // Line2 utility functions
43
+ Line2.interpolate = (line, alpha) => {
44
+ const a = line.a;
45
+ const b = line.b;
46
+ return [a[0] + alpha * (b[0] - a[0]), a[1] + alpha * (b[1] - a[1])];
47
+ };
48
+ Line2.intersects = (line1, line2, includeEndpoints = false) => {
49
+ const a = line1.a;
50
+ const b = line1.b;
51
+ const c = line2.a;
52
+ const d = line2.b;
53
+ // Check for endpoint intersections
54
+ if (includeEndpoints && ((Math.abs(a[0] - c[0]) < epsilon && Math.abs(a[1] - c[1]) < epsilon) ||
55
+ (Math.abs(a[0] - d[0]) < epsilon && Math.abs(a[1] - d[1]) < epsilon) ||
56
+ (Math.abs(b[0] - c[0]) < epsilon && Math.abs(b[1] - c[1]) < epsilon) ||
57
+ (Math.abs(b[0] - d[0]) < epsilon && Math.abs(b[1] - d[1]) < epsilon))) {
58
+ return true;
59
+ }
60
+ // Calculate the denominator
61
+ const denominator = (d[0] - c[0]) * (b[1] - a[1]) - (d[1] - c[1]) * (b[0] - a[0]);
62
+ // Check if lines are parallel or collinear
63
+ if (Math.abs(denominator) < epsilon) {
64
+ return false;
65
+ }
66
+ // Calculate intersection parameters
67
+ const numerator1 = (d[1] - c[1]) * (a[0] - c[0]) - (d[0] - c[0]) * (a[1] - c[1]);
68
+ const numerator2 = (b[1] - a[1]) * (a[0] - c[0]) - (b[0] - a[0]) * (a[1] - c[1]);
69
+ const ua = numerator1 / denominator;
70
+ const ub = numerator2 / denominator;
71
+ // Check if intersection point lies within both line segments
72
+ return ua >= -epsilon && ua <= 1 + epsilon && ub >= -epsilon && ub <= 1 + epsilon;
73
+ };
74
+ Line2.subLine = (line, alpha, beta) => {
75
+ return {
76
+ a: Line2.interpolate(line, alpha),
77
+ b: Line2.interpolate(line, beta),
78
+ };
79
+ };
80
+ })(Line2 || (Line2 = {}));
78
81
  //# sourceMappingURL=line2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"line2.js","sourceRoot":"","sources":["../../../src/math/line2/line2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAGX,OAAO,EAAE,eAAe,E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AU,GAAG,WAAW,CAAC;QACpC,MAAM,EAAE,GAAG,UAAU,GAAG,WAAW,CAAC;QAEpC,6DAA6D;QAC7D,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,IAAI,CAAC,GAAG,OAAO,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC;IACtF,CAAC,CAAC;IAEW,aAAO,GAAG,CAAC,IAAW,EAAE,KAAa,EAAE,IAAY,EAAS,EAAE;QACvE,OAAO;YACH,CAAC,EAAE,MAAA,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;YAC3B,CAAC,EAAE,MAAA,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;SAC7B,CAAC;IACN,CAAC,CAAC;AACN,CAAC,EAlEgB,KAAK,KAAL,KAAK,QAkErB"}
@@ -1,49 +1,54 @@
1
1
  import { FromSchema } from "../../schema/index.js";
2
2
  import { Vec3 } from "../index.js";
3
- export declare const schema: {
4
- readonly type: "object";
5
- readonly properties: {
6
- readonly a: {
7
- readonly type: "array";
8
- readonly items: {
9
- readonly type: "number";
10
- readonly precision: 1;
11
- readonly default: number;
3
+ export type Line3 = FromSchema<typeof Line3.schema>;
4
+ export declare namespace Line3 {
5
+ const schema: {
6
+ readonly type: "object";
7
+ readonly properties: {
8
+ readonly a: {
9
+ readonly type: "array";
10
+ readonly items: {
11
+ readonly type: "number";
12
+ readonly precision: 1;
13
+ readonly default: number;
14
+ };
15
+ readonly minItems: 3;
16
+ readonly maxItems: 3;
17
+ readonly default: readonly [0, 0, 0];
12
18
  };
13
- readonly minItems: 3;
14
- readonly maxItems: 3;
15
- readonly default: readonly [0, 0, 0];
16
- };
17
- readonly b: {
18
- readonly type: "array";
19
- readonly items: {
20
- readonly type: "number";
21
- readonly precision: 1;
22
- readonly default: number;
19
+ readonly b: {
20
+ readonly type: "array";
21
+ readonly items: {
22
+ readonly type: "number";
23
+ readonly precision: 1;
24
+ readonly default: number;
25
+ };
26
+ readonly minItems: 3;
27
+ readonly maxItems: 3;
28
+ readonly default: readonly [0, 0, 0];
23
29
  };
24
- readonly minItems: 3;
25
- readonly maxItems: 3;
26
- readonly default: readonly [0, 0, 0];
30
+ };
31
+ readonly required: readonly ["a", "b"];
32
+ readonly additionalProperties: false;
33
+ readonly default: {
34
+ readonly a: readonly [0, 0, 0];
35
+ readonly b: readonly [0, 0, 0];
27
36
  };
28
37
  };
29
- readonly required: readonly ["a", "b"];
30
- readonly additionalProperties: false;
31
- readonly default: {
32
- readonly a: readonly [0, 0, 0];
33
- readonly b: readonly [0, 0, 0];
34
- };
35
- };
36
- export type Type = FromSchema<typeof schema>;
37
- type Line3 = Type;
38
- export declare const layout: import("../../typed-buffer/index.js").StructLayout;
39
- export declare const interpolate: (line: Line3, alpha: number) => Vec3;
40
- /**
41
- * Calculates the alpha value (0-1) representing the closest point on a line to a given point.
42
- *
43
- * @param line - The line segment
44
- * @param point - The point in 3D space
45
- * @returns Alpha value, usually between 0 and 1, where 0 is line.a and 1 is line.b
46
- */
47
- export declare const closestPointOnLine: (line: Line3, point: Vec3) => number;
48
- export declare const subLine: (line: Line3, alpha: number, beta: number) => Line3;
49
- export {};
38
+ const layout: import("../../typed-buffer/index.js").StructLayout;
39
+ const interpolate: (line: Line3, alpha: number) => Vec3;
40
+ /**
41
+ * Calculates the alpha value (0-1) representing the closest point on a line to a given point.
42
+ *
43
+ * @param line - The line segment
44
+ * @param point - The point in 3D space
45
+ * @returns Alpha value, usually between 0 and 1, where 0 is line.a and 1 is line.b
46
+ */
47
+ const closestPointOnLine: (line: Line3, point: Vec3) => number;
48
+ const subLine: (line: Line3, alpha: number, beta: number) => Line3;
49
+ /**
50
+ * Returns a unit vector pointing from line.a to line.b. If the line has zero length,
51
+ * returns the provided default direction (defaults to [0,0,1]).
52
+ */
53
+ const direction: (line: Line3) => Vec3;
54
+ }