@fi4f/hg 0.0.11 → 0.0.12

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 (124) hide show
  1. package/README.md +57 -0
  2. package/dist/asset.d.ts +46 -0
  3. package/dist/asset.d.ts.map +1 -0
  4. package/dist/{core/asset.js → asset.js} +5 -30
  5. package/dist/asset.js.map +1 -0
  6. package/dist/{core/cache.d.ts → cache.d.ts} +17 -7
  7. package/dist/cache.d.ts.map +1 -0
  8. package/dist/{core/cache.js → cache.js} +5 -6
  9. package/dist/cache.js.map +1 -0
  10. package/dist/canvas.d.ts +4 -0
  11. package/dist/canvas.d.ts.map +1 -0
  12. package/dist/canvas.js +12 -0
  13. package/dist/canvas.js.map +1 -0
  14. package/dist/el.d.ts.map +1 -0
  15. package/dist/el.js.map +1 -0
  16. package/dist/event.d.ts.map +1 -0
  17. package/dist/event.js.map +1 -0
  18. package/dist/hg.d.ts +13 -13
  19. package/dist/hg.d.ts.map +1 -1
  20. package/dist/hg.js +14 -14
  21. package/dist/hg.js.map +1 -1
  22. package/dist/index.d.ts +24 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/matrix2.d.ts +152 -0
  26. package/dist/matrix2.d.ts.map +1 -0
  27. package/dist/matrix2.js +262 -0
  28. package/dist/matrix2.js.map +1 -0
  29. package/dist/matrix3.d.ts +196 -0
  30. package/dist/matrix3.d.ts.map +1 -0
  31. package/dist/matrix3.js +352 -0
  32. package/dist/matrix3.js.map +1 -0
  33. package/dist/matrix4.d.ts +253 -0
  34. package/dist/matrix4.d.ts.map +1 -0
  35. package/dist/matrix4.js +465 -0
  36. package/dist/matrix4.js.map +1 -0
  37. package/dist/{core/scene.d.ts → scene.d.ts} +2 -3
  38. package/dist/scene.d.ts.map +1 -0
  39. package/dist/scene.js.map +1 -0
  40. package/dist/sprite.d.ts.map +1 -0
  41. package/dist/sprite.js.map +1 -0
  42. package/dist/stage.d.ts +100 -0
  43. package/dist/stage.d.ts.map +1 -0
  44. package/dist/stage.js +303 -0
  45. package/dist/stage.js.map +1 -0
  46. package/dist/vector2.d.ts +114 -0
  47. package/dist/vector2.d.ts.map +1 -0
  48. package/dist/vector2.js +168 -0
  49. package/dist/vector2.js.map +1 -0
  50. package/dist/vector3.d.ts +126 -0
  51. package/dist/vector3.d.ts.map +1 -0
  52. package/dist/vector3.js +190 -0
  53. package/dist/vector3.js.map +1 -0
  54. package/dist/vector4.d.ts +135 -0
  55. package/dist/vector4.d.ts.map +1 -0
  56. package/dist/vector4.js +209 -0
  57. package/dist/vector4.js.map +1 -0
  58. package/dist/version.d.ts.map +1 -0
  59. package/dist/version.js.map +1 -0
  60. package/package.json +1 -1
  61. package/dist/core/asset.d.ts +0 -71
  62. package/dist/core/asset.d.ts.map +0 -1
  63. package/dist/core/asset.js.map +0 -1
  64. package/dist/core/atlas.d.ts +0 -2
  65. package/dist/core/atlas.d.ts.map +0 -1
  66. package/dist/core/atlas.js +0 -2
  67. package/dist/core/atlas.js.map +0 -1
  68. package/dist/core/cache.d.ts.map +0 -1
  69. package/dist/core/cache.js.map +0 -1
  70. package/dist/core/event.d.ts.map +0 -1
  71. package/dist/core/event.js.map +0 -1
  72. package/dist/core/index.d.ts +0 -14
  73. package/dist/core/index.d.ts.map +0 -1
  74. package/dist/core/index.js.map +0 -1
  75. package/dist/core/scene.d.ts.map +0 -1
  76. package/dist/core/scene.js.map +0 -1
  77. package/dist/core/sprite.d.ts.map +0 -1
  78. package/dist/core/sprite.js.map +0 -1
  79. package/dist/core/stage.d.ts +0 -130
  80. package/dist/core/stage.d.ts.map +0 -1
  81. package/dist/core/stage.js +0 -308
  82. package/dist/core/stage.js.map +0 -1
  83. package/dist/math/el.d.ts.map +0 -1
  84. package/dist/math/el.js.map +0 -1
  85. package/dist/math/matrix2.d.ts +0 -70
  86. package/dist/math/matrix2.d.ts.map +0 -1
  87. package/dist/math/matrix2.js +0 -180
  88. package/dist/math/matrix2.js.map +0 -1
  89. package/dist/math/matrix3.d.ts +0 -108
  90. package/dist/math/matrix3.d.ts.map +0 -1
  91. package/dist/math/matrix3.js +0 -257
  92. package/dist/math/matrix3.js.map +0 -1
  93. package/dist/math/matrix4.d.ts +0 -158
  94. package/dist/math/matrix4.d.ts.map +0 -1
  95. package/dist/math/matrix4.js +0 -354
  96. package/dist/math/matrix4.js.map +0 -1
  97. package/dist/math/vector2.d.ts +0 -38
  98. package/dist/math/vector2.d.ts.map +0 -1
  99. package/dist/math/vector2.js +0 -67
  100. package/dist/math/vector2.js.map +0 -1
  101. package/dist/math/vector3.d.ts +0 -34
  102. package/dist/math/vector3.d.ts.map +0 -1
  103. package/dist/math/vector3.js +0 -74
  104. package/dist/math/vector3.js.map +0 -1
  105. package/dist/math/vector4.d.ts +0 -39
  106. package/dist/math/vector4.d.ts.map +0 -1
  107. package/dist/math/vector4.js +0 -81
  108. package/dist/math/vector4.js.map +0 -1
  109. package/dist/util/types.d.ts +0 -2
  110. package/dist/util/types.d.ts.map +0 -1
  111. package/dist/util/types.js +0 -2
  112. package/dist/util/types.js.map +0 -1
  113. package/dist/util/version.d.ts.map +0 -1
  114. package/dist/util/version.js.map +0 -1
  115. /package/dist/{math/el.d.ts → el.d.ts} +0 -0
  116. /package/dist/{math/el.js → el.js} +0 -0
  117. /package/dist/{core/event.d.ts → event.d.ts} +0 -0
  118. /package/dist/{core/event.js → event.js} +0 -0
  119. /package/dist/{core/index.js → index.js} +0 -0
  120. /package/dist/{core/scene.js → scene.js} +0 -0
  121. /package/dist/{core/sprite.d.ts → sprite.d.ts} +0 -0
  122. /package/dist/{core/sprite.js → sprite.js} +0 -0
  123. /package/dist/{util/version.d.ts → version.d.ts} +0 -0
  124. /package/dist/{util/version.js → version.js} +0 -0
@@ -0,0 +1,126 @@
1
+ export type Vector3 = [number, number, number];
2
+ /**
3
+ * A collection of constants and functions for constructing and
4
+ * interacting with Vector3 objects.
5
+ */
6
+ export declare const Vector3: {
7
+ /** Constant index for the x-component of a Vector3 */
8
+ X: 0;
9
+ /** Constant index for the y-component of a Vector3 */
10
+ Y: 1;
11
+ /** Constant index for the z-component of a Vector3 */
12
+ Z: 2;
13
+ /** A collection of getters for Vector3 objects */
14
+ Get: {
15
+ /** Get the x-component of a Vector3 */
16
+ x(a: Vector3): number;
17
+ /** Get the y-component of a Vector3 */
18
+ y(a: Vector3): number;
19
+ /** Get the z-component of a Vector3 */
20
+ z(a: Vector3): number;
21
+ };
22
+ /** A collection of setters for Vector3 objects */
23
+ Set: {
24
+ /** Set the x-component of a Vector3 */
25
+ x(a: Vector3, x: number): number;
26
+ /** Set the y-component of a Vector3 */
27
+ y(a: Vector3, y: number): number;
28
+ /** Set the z-component of a Vector3 */
29
+ z(a: Vector3, z: number): number;
30
+ };
31
+ /** Get or set (when `x` is defined) the x-component of a Vector3 */
32
+ x(a: Vector3, x?: number): number;
33
+ /** Get or set (when `y` is defined) the y-component of a Vector3 */
34
+ y(a: Vector3, y?: number): number;
35
+ /** Get or set (when `z` is defined) the z-component of a Vector3 */
36
+ z(a: Vector3, z?: number): number;
37
+ /**
38
+ * Construct a Vector3 from a variadic array of numbers.
39
+ *
40
+ * Constructs a uniform Vector3 when `a.length === 1`
41
+ * ```js
42
+ * Vector3.new(1) // [1, 1, 1]
43
+ * ```
44
+ *
45
+ * Otherwise constructs a standard zero-padded Vector3
46
+ * ```js
47
+ * Vector3.new( ) // [0, 0, 0]
48
+ * Vector3.new(1, 2 ) // [1, 2, 0]
49
+ * Vector3.new(1, 2, 3) // [1, 2, 3]
50
+ * ```
51
+ */
52
+ "new"(...a: Array<number>): [number, number, number];
53
+ /**
54
+ * Constructs a Vector3 from a number or an array of numbers.
55
+ *
56
+ * Constructs a uniform Vector3 when `a` is a number
57
+ * ```js
58
+ * Vector3.from(1) // [1, 1, 1]
59
+ * ```
60
+ *
61
+ * Otherwise constructs a standard zero-padded Vector3
62
+ * ```js
63
+ * Vector3.from([ ]) // [0, 0, 0]
64
+ * Vector3.from([1 ]) // [1, 0, 0]
65
+ * Vector3.from([1, 2 ]) // [1, 2, 0]
66
+ * Vector3.from([1, 2, 3]) // [1, 2, 3]
67
+ * ```
68
+ */
69
+ from(a: number | Array<number>): [number, number, number];
70
+ /**
71
+ * Perform an element-wise operation on two Vector3 objects.
72
+ * Number-like arguments are promoted to uniform Vector3 objects
73
+ * before performing the operation. Constructs a new Vector3 when an
74
+ * output argument is not provided.
75
+ */
76
+ el(op: (a: number, b: number) => number, a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
77
+ /**
78
+ * Compute the sum of two Vector3 objects. Number-like arguments are
79
+ * promoted to uniform Vector3 objects before performing the operation.
80
+ * Constructs a new Vector3 when an output argument is not provided.
81
+ */
82
+ add(a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
83
+ /**
84
+ * Compute the difference of two Vector3 objects. Number-like arguments
85
+ * are promoted to uniform Vector3 objects before performing the
86
+ * operation. Constructs a new Vector3 when an output argument is not
87
+ * provided.
88
+ */
89
+ sub(a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
90
+ /**
91
+ * Compute the hadamard (element-wise) product of two Vector3 objects.
92
+ * Number-like arguments are promoted to uniform Vector3 objects before
93
+ * performing the operation. Constructs a new Vector3 when an output
94
+ * argument is not provided.
95
+ */
96
+ hmul(a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
97
+ /**
98
+ * Compute the hadamard (element-wise) quotient of two Vector3 objects.
99
+ * Number-like arguments are promoted to uniform Vector3 objects before
100
+ * performing the operation. Constructs a new Vector3 when an output
101
+ * argument is not provided.
102
+ */
103
+ hdiv(a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
104
+ /**
105
+ * Compute the hadamard (element-wise) remainder of two Vector3 objects.
106
+ * Number-like arguments are promoted to uniform Vector3 objects before
107
+ * performing the operation. Constructs a new Vector3 when an output
108
+ * argument is not provided.
109
+ */
110
+ hmod(a: number | Vector3, b: number | Vector3, out?: Vector3): Vector3;
111
+ /**
112
+ * Compute the dot product of two Vector3 objects, or simply the
113
+ * dot product of `a` with itself when `b` is not defined. Number-like
114
+ * arguments are promoted to uniform Vector3 objects before performing
115
+ * the operation.
116
+ */
117
+ dot(a: number | Vector3, b?: number | Vector3): number;
118
+ /**
119
+ * Convert a Vector3 into its string representation.
120
+ * ```js
121
+ * Vector3.toString([1, 2, 3]) // "vec3<1, 2, 3>"
122
+ * ```
123
+ */
124
+ toString([x, y, z]: Vector3): `vec3<${number}, ${number}, ${number}>`;
125
+ };
126
+ //# sourceMappingURL=vector3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector3.d.ts","sourceRoot":"","sources":["../src/vector3.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE9C;;;GAGG;AACH,eAAO,MAAM,OAAO;IAClB,sDAAsD;;IAEtD,sDAAsD;;IAEtD,sDAAsD;;IAGtD,kDAAkD;;QAEhD,uCAAuC;aAClC,OAAO;QACZ,uCAAuC;aAClC,OAAO;QACZ,uCAAuC;aAClC,OAAO;;IAGd,kDAAkD;;QAEhD,uCAAuC;aAClC,OAAO,KAAK,MAAM;QACvB,uCAAuC;aAClC,OAAO,KAAK,MAAM;QACvB,uCAAuC;aAClC,OAAO,KAAK,MAAM;;IAGzB,oEAAoE;SAC/D,OAAO,MAAO,MAAM;IAKzB,oEAAoE;SAC/D,OAAO,MAAO,MAAM;IAKzB,oEAAoE;SAC/D,OAAO,MAAO,MAAM;IAKzB;;;;;;;;;;;;;;OAcG;gBACO,KAAK,CAAC,MAAM,CAAC;IAavB;;;;;;;;;;;;;;;OAeG;YACK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAa9B;;;;;OAKG;WACI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,KAAK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAS/F;;;;OAIG;WACI,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI1D;;;;;OAKG;WACI,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI1D;;;;;OAKG;YACK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI3D;;;;;OAKG;YACK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI3D;;;;;OAKG;YACK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI3D;;;;;OAKG;WACI,MAAM,GAAG,OAAO,MAAK,MAAM,GAAG,OAAO;IAM5C;;;;;OAKG;wBACkB,OAAO;CAG7B,CAAA"}
@@ -0,0 +1,190 @@
1
+ import { add, sub, mul, div, mod } from "./el.js";
2
+ /**
3
+ * A collection of constants and functions for constructing and
4
+ * interacting with Vector3 objects.
5
+ */
6
+ export const Vector3 = {
7
+ /** Constant index for the x-component of a Vector3 */
8
+ X: 0,
9
+ /** Constant index for the y-component of a Vector3 */
10
+ Y: 1,
11
+ /** Constant index for the z-component of a Vector3 */
12
+ Z: 2,
13
+ /** A collection of getters for Vector3 objects */
14
+ Get: {
15
+ /** Get the x-component of a Vector3 */
16
+ x(a) { return a[Vector3.X]; },
17
+ /** Get the y-component of a Vector3 */
18
+ y(a) { return a[Vector3.Y]; },
19
+ /** Get the z-component of a Vector3 */
20
+ z(a) { return a[Vector3.Z]; },
21
+ },
22
+ /** A collection of setters for Vector3 objects */
23
+ Set: {
24
+ /** Set the x-component of a Vector3 */
25
+ x(a, x) { return a[Vector3.X] = x; },
26
+ /** Set the y-component of a Vector3 */
27
+ y(a, y) { return a[Vector3.Y] = y; },
28
+ /** Set the z-component of a Vector3 */
29
+ z(a, z) { return a[Vector3.Z] = z; },
30
+ },
31
+ /** Get or set (when `x` is defined) the x-component of a Vector3 */
32
+ x(a, x) {
33
+ if (x === undefined)
34
+ return Vector3.Get.x(a);
35
+ else
36
+ return Vector3.Set.x(a, x);
37
+ },
38
+ /** Get or set (when `y` is defined) the y-component of a Vector3 */
39
+ y(a, y) {
40
+ if (y === undefined)
41
+ return Vector3.Get.y(a);
42
+ else
43
+ return Vector3.Set.y(a, y);
44
+ },
45
+ /** Get or set (when `z` is defined) the z-component of a Vector3 */
46
+ z(a, z) {
47
+ if (z === undefined)
48
+ return Vector3.Get.z(a);
49
+ else
50
+ return Vector3.Set.z(a, z);
51
+ },
52
+ /**
53
+ * Construct a Vector3 from a variadic array of numbers.
54
+ *
55
+ * Constructs a uniform Vector3 when `a.length === 1`
56
+ * ```js
57
+ * Vector3.new(1) // [1, 1, 1]
58
+ * ```
59
+ *
60
+ * Otherwise constructs a standard zero-padded Vector3
61
+ * ```js
62
+ * Vector3.new( ) // [0, 0, 0]
63
+ * Vector3.new(1, 2 ) // [1, 2, 0]
64
+ * Vector3.new(1, 2, 3) // [1, 2, 3]
65
+ * ```
66
+ */
67
+ new(...a) {
68
+ if (a.length === 1)
69
+ return [
70
+ a[Vector3.X],
71
+ a[Vector3.X],
72
+ a[Vector3.X]
73
+ ];
74
+ else
75
+ return [
76
+ a[Vector3.X] ?? 0,
77
+ a[Vector3.Y] ?? 0,
78
+ a[Vector3.Z] ?? 0
79
+ ];
80
+ },
81
+ /**
82
+ * Constructs a Vector3 from a number or an array of numbers.
83
+ *
84
+ * Constructs a uniform Vector3 when `a` is a number
85
+ * ```js
86
+ * Vector3.from(1) // [1, 1, 1]
87
+ * ```
88
+ *
89
+ * Otherwise constructs a standard zero-padded Vector3
90
+ * ```js
91
+ * Vector3.from([ ]) // [0, 0, 0]
92
+ * Vector3.from([1 ]) // [1, 0, 0]
93
+ * Vector3.from([1, 2 ]) // [1, 2, 0]
94
+ * Vector3.from([1, 2, 3]) // [1, 2, 3]
95
+ * ```
96
+ */
97
+ from(a) {
98
+ if (typeof a === "number")
99
+ return [
100
+ a,
101
+ a,
102
+ a
103
+ ];
104
+ else
105
+ return [
106
+ a[Vector3.X] ?? 0,
107
+ a[Vector3.Y] ?? 0,
108
+ a[Vector3.Z] ?? 0
109
+ ];
110
+ },
111
+ /**
112
+ * Perform an element-wise operation on two Vector3 objects.
113
+ * Number-like arguments are promoted to uniform Vector3 objects
114
+ * before performing the operation. Constructs a new Vector3 when an
115
+ * output argument is not provided.
116
+ */
117
+ el(op, a, b, out = Vector3.new()) {
118
+ const [xa, ya, za] = Vector3.from(a);
119
+ const [xb, yb, zb] = Vector3.from(b);
120
+ Vector3.Set.x(out, op(xa, xb));
121
+ Vector3.Set.y(out, op(ya, yb));
122
+ Vector3.Set.z(out, op(za, zb));
123
+ return out;
124
+ },
125
+ /**
126
+ * Compute the sum of two Vector3 objects. Number-like arguments are
127
+ * promoted to uniform Vector3 objects before performing the operation.
128
+ * Constructs a new Vector3 when an output argument is not provided.
129
+ */
130
+ add(a, b, out = Vector3.new()) {
131
+ return Vector3.el(add, a, b, out);
132
+ },
133
+ /**
134
+ * Compute the difference of two Vector3 objects. Number-like arguments
135
+ * are promoted to uniform Vector3 objects before performing the
136
+ * operation. Constructs a new Vector3 when an output argument is not
137
+ * provided.
138
+ */
139
+ sub(a, b, out = Vector3.new()) {
140
+ return Vector3.el(sub, a, b, out);
141
+ },
142
+ /**
143
+ * Compute the hadamard (element-wise) product of two Vector3 objects.
144
+ * Number-like arguments are promoted to uniform Vector3 objects before
145
+ * performing the operation. Constructs a new Vector3 when an output
146
+ * argument is not provided.
147
+ */
148
+ hmul(a, b, out = Vector3.new()) {
149
+ return Vector3.el(mul, a, b, out);
150
+ },
151
+ /**
152
+ * Compute the hadamard (element-wise) quotient of two Vector3 objects.
153
+ * Number-like arguments are promoted to uniform Vector3 objects before
154
+ * performing the operation. Constructs a new Vector3 when an output
155
+ * argument is not provided.
156
+ */
157
+ hdiv(a, b, out = Vector3.new()) {
158
+ return Vector3.el(div, a, b, out);
159
+ },
160
+ /**
161
+ * Compute the hadamard (element-wise) remainder of two Vector3 objects.
162
+ * Number-like arguments are promoted to uniform Vector3 objects before
163
+ * performing the operation. Constructs a new Vector3 when an output
164
+ * argument is not provided.
165
+ */
166
+ hmod(a, b, out = Vector3.new()) {
167
+ return Vector3.el(mod, a, b, out);
168
+ },
169
+ /**
170
+ * Compute the dot product of two Vector3 objects, or simply the
171
+ * dot product of `a` with itself when `b` is not defined. Number-like
172
+ * arguments are promoted to uniform Vector3 objects before performing
173
+ * the operation.
174
+ */
175
+ dot(a, b = a) {
176
+ const [xa, ya, za] = Vector3.from(a);
177
+ const [xb, yb, zb] = Vector3.from(b);
178
+ return xa * xb + ya * yb + za * zb;
179
+ },
180
+ /**
181
+ * Convert a Vector3 into its string representation.
182
+ * ```js
183
+ * Vector3.toString([1, 2, 3]) // "vec3<1, 2, 3>"
184
+ * ```
185
+ */
186
+ toString([x, y, z]) {
187
+ return `vec3<${x}, ${y}, ${z}>`;
188
+ }
189
+ };
190
+ //# sourceMappingURL=vector3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector3.js","sourceRoot":"","sources":["../src/vector3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAIlD;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,sDAAsD;IACtD,CAAC,EAAE,CAAU;IACb,sDAAsD;IACtD,CAAC,EAAE,CAAU;IACb,sDAAsD;IACtD,CAAC,EAAE,CAAU;IAEb,kDAAkD;IAClD,GAAG,EAAE;QACH,uCAAuC;QACvC,CAAC,CAAC,CAAU,IAAI,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;QACrC,uCAAuC;QACvC,CAAC,CAAC,CAAU,IAAI,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;QACrC,uCAAuC;QACvC,CAAC,CAAC,CAAU,IAAI,OAAO,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AAE,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAW;QAC1B,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAY,CAAA;IAC1C,CAAC;CACF,CAAA"}
@@ -0,0 +1,135 @@
1
+ export type Vector4 = [number, number, number, number];
2
+ /**
3
+ * A collection of constants and functions for constructing and
4
+ * interacting with Vector4 objects.
5
+ */
6
+ export declare const Vector4: {
7
+ /** Constant index for the x-component of a Vector4 */
8
+ X: 0;
9
+ /** Constant index for the y-component of a Vector4 */
10
+ Y: 1;
11
+ /** Constant index for the z-component of a Vector4 */
12
+ Z: 2;
13
+ /** Constant index for the w-component of a Vector4 */
14
+ W: 3;
15
+ /** A collection of getters for Vector4 objects */
16
+ Get: {
17
+ /** Get the x-component of a Vector4 */
18
+ x(a: Vector4): number;
19
+ /** Get the y-component of a Vector4 */
20
+ y(a: Vector4): number;
21
+ /** Get the z-component of a Vector4 */
22
+ z(a: Vector4): number;
23
+ /** Get the w-component of a Vector4 */
24
+ w(a: Vector4): number;
25
+ };
26
+ Set: {
27
+ /** Set the x-component of a Vector4 */
28
+ x(a: Vector4, x: number): number;
29
+ /** Set the y-component of a Vector4 */
30
+ y(a: Vector4, y: number): number;
31
+ /** Set the z-component of a Vector4 */
32
+ z(a: Vector4, z: number): number;
33
+ /** Set the w-component of a Vector4 */
34
+ w(a: Vector4, w: number): number;
35
+ };
36
+ /** Get or set (when `x` is defined) the x-component of a Vector4 */
37
+ x(a: Vector4, x?: number): number;
38
+ /** Get or set (when `y` is defined) the y-component of a Vector4 */
39
+ y(a: Vector4, y?: number): number;
40
+ /** Get or set (when `z` is defined) the z-component of a Vector4 */
41
+ z(a: Vector4, z?: number): number;
42
+ /** Get or set (when `w` is defined) the w-component of a Vector4 */
43
+ w(a: Vector4, w?: number): number;
44
+ /**
45
+ * Construct a Vector4 from a variadic array of numbers.
46
+ *
47
+ * Constructs a uniform Vector4 when `a.length === 1`
48
+ * ```js
49
+ * Vector4.new(1) // [1, 1, 1, 1]
50
+ * ```
51
+ *
52
+ * Otherwise constructs a standard zero-padded Vector4
53
+ * ```js
54
+ * Vector4.new( ) // [0, 0, 0, 0]
55
+ * Vector4.new(1, 2 ) // [1, 2, 0, 0]
56
+ * Vector4.new(1, 2, 3 ) // [1, 2, 3, 0]
57
+ * Vector4.new(1, 2, 3, 4) // [1, 2, 3, 4]
58
+ * ```
59
+ */
60
+ "new"(...a: Array<number>): [number, number, number, number];
61
+ /**
62
+ * Constructs a Vector4 from a number or an array of numbers.
63
+ *
64
+ * Constructs a uniform Vector4 when `a` is a number
65
+ * ```js
66
+ * Vector4.from(1) // [1, 1, 1, 1]
67
+ * ```
68
+ *
69
+ * Otherwise constructs a standard zero-padded Vector4
70
+ * ```js
71
+ * Vector4.from([ ]) // [0, 0, 0, 0]
72
+ * Vector4.from([1 ]) // [1, 0, 0, 0]
73
+ * Vector4.from([1, 2 ]) // [1, 2, 0, 0]
74
+ * Vector4.from([1, 2, 3 ]) // [1, 2, 3, 0]
75
+ * Vector4.from([1, 2, 3, 4]) // [1, 2, 3, 4]
76
+ * ```
77
+ */
78
+ from(a: number | Array<number>): [number, number, number, number];
79
+ /**
80
+ * Perform an element-wise operation on two Vector4 objects.
81
+ * Number-like arguments are promoted to uniform Vector4 objects
82
+ * before performing the operation. Constructs a new Vector4 when an
83
+ * output argument is not provided.
84
+ */
85
+ el(op: (a: number, b: number) => number, a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
86
+ /**
87
+ * Compute the sum of two Vector4 objects. Number-like arguments are
88
+ * promoted to uniform Vector4 objects before performing the operation.
89
+ * Constructs a new Vector4 when an output argument is not provided.
90
+ */
91
+ add(a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
92
+ /**
93
+ * Compute the difference of two Vector4 objects. Number-like arguments
94
+ * are promoted to uniform Vector4 objects before performing the
95
+ * operation. Constructs a new Vector4 when an output argument is not
96
+ * provided.
97
+ */
98
+ sub(a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
99
+ /**
100
+ * Compute the hadamard (element-wise) product of two Vector4 objects.
101
+ * Number-like arguments are promoted to uniform Vector4 objects before
102
+ * performing the operation. Constructs a new Vector4 when an output
103
+ * argument is not provided.
104
+ */
105
+ hmul(a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
106
+ /**
107
+ * Compute the hadamard (element-wise) quotient of two Vector4 objects.
108
+ * Number-like arguments are promoted to uniform Vector4 objects before
109
+ * performing the operation. Constructs a new Vector4 when an output
110
+ * argument is not provided.
111
+ */
112
+ hdiv(a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
113
+ /**
114
+ * Compute the hadamard (element-wise) remainder of two Vector4 objects.
115
+ * Number-like arguments are promoted to uniform Vector4 objects before
116
+ * performing the operation. Constructs a new Vector4 when an output
117
+ * argument is not provided.
118
+ */
119
+ hmod(a: number | Vector4, b: number | Vector4, out?: Vector4): Vector4;
120
+ /**
121
+ * Compute the dot product of two Vector4 objects, or simply the
122
+ * dot product of `a` with itself when `b` is not defined. Number-like
123
+ * arguments are promoted to uniform Vector4 objects before performing
124
+ * the operation.
125
+ */
126
+ dot(a: number | Vector4, b?: number | Vector4): number;
127
+ /**
128
+ * Convert a Vector4 into its string representation.
129
+ * ```js
130
+ * Vector4.toString([1, 2, 3, 4]) // "vec4<1, 2, 3, 4>"
131
+ * ```
132
+ */
133
+ toString([x, y, z, w]: Vector4): `vec4<${number}, ${number}, ${number}, ${number}>`;
134
+ };
135
+ //# sourceMappingURL=vector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QAAO,OAAO;IAI3D;;;;;OAKG;YACK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI3D;;;;;OAKG;YACK,MAAM,GAAG,OAAO,KAAK,MAAM,GAAG,OAAO,QAAO,OAAO;IAI3D;;;;;OAKG;WACI,MAAM,GAAG,OAAO,MAAK,MAAM,GAAG,OAAO;IAM5C;;;;;OAKG;2BACqB,OAAO;CAGhC,CAAA"}
@@ -0,0 +1,209 @@
1
+ import { add, sub, mul, div, mod } from "./el.js";
2
+ /**
3
+ * A collection of constants and functions for constructing and
4
+ * interacting with Vector4 objects.
5
+ */
6
+ export const Vector4 = {
7
+ /** Constant index for the x-component of a Vector4 */
8
+ X: 0,
9
+ /** Constant index for the y-component of a Vector4 */
10
+ Y: 1,
11
+ /** Constant index for the z-component of a Vector4 */
12
+ Z: 2,
13
+ /** Constant index for the w-component of a Vector4 */
14
+ W: 3,
15
+ /** A collection of getters for Vector4 objects */
16
+ Get: {
17
+ /** Get the x-component of a Vector4 */
18
+ x(a) { return a[Vector4.X]; },
19
+ /** Get the y-component of a Vector4 */
20
+ y(a) { return a[Vector4.Y]; },
21
+ /** Get the z-component of a Vector4 */
22
+ z(a) { return a[Vector4.Z]; },
23
+ /** Get the w-component of a Vector4 */
24
+ w(a) { return a[Vector4.W]; },
25
+ },
26
+ Set: {
27
+ /** Set the x-component of a Vector4 */
28
+ x(a, x) { return a[Vector4.X] = x; },
29
+ /** Set the y-component of a Vector4 */
30
+ y(a, y) { return a[Vector4.Y] = y; },
31
+ /** Set the z-component of a Vector4 */
32
+ z(a, z) { return a[Vector4.Z] = z; },
33
+ /** Set the w-component of a Vector4 */
34
+ w(a, w) { return a[Vector4.W] = w; },
35
+ },
36
+ /** Get or set (when `x` is defined) the x-component of a Vector4 */
37
+ x(a, x) {
38
+ if (x === undefined)
39
+ return Vector4.Get.x(a);
40
+ else
41
+ return Vector4.Set.x(a, x);
42
+ },
43
+ /** Get or set (when `y` is defined) the y-component of a Vector4 */
44
+ y(a, y) {
45
+ if (y === undefined)
46
+ return Vector4.Get.y(a);
47
+ else
48
+ return Vector4.Set.y(a, y);
49
+ },
50
+ /** Get or set (when `z` is defined) the z-component of a Vector4 */
51
+ z(a, z) {
52
+ if (z === undefined)
53
+ return Vector4.Get.z(a);
54
+ else
55
+ return Vector4.Set.z(a, z);
56
+ },
57
+ /** Get or set (when `w` is defined) the w-component of a Vector4 */
58
+ w(a, w) {
59
+ if (w === undefined)
60
+ return Vector4.Get.w(a);
61
+ else
62
+ return Vector4.Set.w(a, w);
63
+ },
64
+ /**
65
+ * Construct a Vector4 from a variadic array of numbers.
66
+ *
67
+ * Constructs a uniform Vector4 when `a.length === 1`
68
+ * ```js
69
+ * Vector4.new(1) // [1, 1, 1, 1]
70
+ * ```
71
+ *
72
+ * Otherwise constructs a standard zero-padded Vector4
73
+ * ```js
74
+ * Vector4.new( ) // [0, 0, 0, 0]
75
+ * Vector4.new(1, 2 ) // [1, 2, 0, 0]
76
+ * Vector4.new(1, 2, 3 ) // [1, 2, 3, 0]
77
+ * Vector4.new(1, 2, 3, 4) // [1, 2, 3, 4]
78
+ * ```
79
+ */
80
+ new(...a) {
81
+ if (a.length === 1)
82
+ return [
83
+ a[Vector4.X],
84
+ a[Vector4.X],
85
+ a[Vector4.X],
86
+ a[Vector4.X]
87
+ ];
88
+ else
89
+ return [
90
+ a[Vector4.X] ?? 0,
91
+ a[Vector4.Y] ?? 0,
92
+ a[Vector4.Z] ?? 0,
93
+ a[Vector4.W] ?? 0
94
+ ];
95
+ },
96
+ /**
97
+ * Constructs a Vector4 from a number or an array of numbers.
98
+ *
99
+ * Constructs a uniform Vector4 when `a` is a number
100
+ * ```js
101
+ * Vector4.from(1) // [1, 1, 1, 1]
102
+ * ```
103
+ *
104
+ * Otherwise constructs a standard zero-padded Vector4
105
+ * ```js
106
+ * Vector4.from([ ]) // [0, 0, 0, 0]
107
+ * Vector4.from([1 ]) // [1, 0, 0, 0]
108
+ * Vector4.from([1, 2 ]) // [1, 2, 0, 0]
109
+ * Vector4.from([1, 2, 3 ]) // [1, 2, 3, 0]
110
+ * Vector4.from([1, 2, 3, 4]) // [1, 2, 3, 4]
111
+ * ```
112
+ */
113
+ from(a) {
114
+ if (typeof a === "number")
115
+ return [
116
+ a,
117
+ a,
118
+ a,
119
+ a
120
+ ];
121
+ else
122
+ return [
123
+ a[Vector4.X] ?? 0,
124
+ a[Vector4.Y] ?? 0,
125
+ a[Vector4.Z] ?? 0,
126
+ a[Vector4.W] ?? 0
127
+ ];
128
+ },
129
+ /**
130
+ * Perform an element-wise operation on two Vector4 objects.
131
+ * Number-like arguments are promoted to uniform Vector4 objects
132
+ * before performing the operation. Constructs a new Vector4 when an
133
+ * output argument is not provided.
134
+ */
135
+ el(op, a, b, out = Vector4.new()) {
136
+ const [xa, ya, za, wa] = Vector4.from(a);
137
+ const [xb, yb, zb, wb] = Vector4.from(b);
138
+ Vector4.Set.x(out, op(xa, xb));
139
+ Vector4.Set.y(out, op(ya, yb));
140
+ Vector4.Set.z(out, op(za, zb));
141
+ Vector4.Set.w(out, op(wa, wb));
142
+ return out;
143
+ },
144
+ /**
145
+ * Compute the sum of two Vector4 objects. Number-like arguments are
146
+ * promoted to uniform Vector4 objects before performing the operation.
147
+ * Constructs a new Vector4 when an output argument is not provided.
148
+ */
149
+ add(a, b, out = Vector4.new()) {
150
+ return Vector4.el(add, a, b, out);
151
+ },
152
+ /**
153
+ * Compute the difference of two Vector4 objects. Number-like arguments
154
+ * are promoted to uniform Vector4 objects before performing the
155
+ * operation. Constructs a new Vector4 when an output argument is not
156
+ * provided.
157
+ */
158
+ sub(a, b, out = Vector4.new()) {
159
+ return Vector4.el(sub, a, b, out);
160
+ },
161
+ /**
162
+ * Compute the hadamard (element-wise) product of two Vector4 objects.
163
+ * Number-like arguments are promoted to uniform Vector4 objects before
164
+ * performing the operation. Constructs a new Vector4 when an output
165
+ * argument is not provided.
166
+ */
167
+ hmul(a, b, out = Vector4.new()) {
168
+ return Vector4.el(mul, a, b, out);
169
+ },
170
+ /**
171
+ * Compute the hadamard (element-wise) quotient of two Vector4 objects.
172
+ * Number-like arguments are promoted to uniform Vector4 objects before
173
+ * performing the operation. Constructs a new Vector4 when an output
174
+ * argument is not provided.
175
+ */
176
+ hdiv(a, b, out = Vector4.new()) {
177
+ return Vector4.el(div, a, b, out);
178
+ },
179
+ /**
180
+ * Compute the hadamard (element-wise) remainder of two Vector4 objects.
181
+ * Number-like arguments are promoted to uniform Vector4 objects before
182
+ * performing the operation. Constructs a new Vector4 when an output
183
+ * argument is not provided.
184
+ */
185
+ hmod(a, b, out = Vector4.new()) {
186
+ return Vector4.el(mod, a, b, out);
187
+ },
188
+ /**
189
+ * Compute the dot product of two Vector4 objects, or simply the
190
+ * dot product of `a` with itself when `b` is not defined. Number-like
191
+ * arguments are promoted to uniform Vector4 objects before performing
192
+ * the operation.
193
+ */
194
+ dot(a, b = a) {
195
+ const [xa, ya, za, wa] = Vector4.from(a);
196
+ const [xb, yb, zb, wb] = Vector4.from(b);
197
+ return xa * xb + ya * yb + za * zb + wa * wb;
198
+ },
199
+ /**
200
+ * Convert a Vector4 into its string representation.
201
+ * ```js
202
+ * Vector4.toString([1, 2, 3, 4]) // "vec4<1, 2, 3, 4>"
203
+ * ```
204
+ */
205
+ toString([x, y, z, w]) {
206
+ return `vec4<${x}, ${y}, ${z}, ${w}>`;
207
+ }
208
+ };
209
+ //# sourceMappingURL=vector4.js.map