@oliversalzburg/js-utils 0.0.7 → 0.0.8

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 (56) hide show
  1. package/LICENSES.md +17 -0
  2. package/lib/dom/core.d.ts +12 -0
  3. package/lib/dom/core.js +23 -0
  4. package/lib/dom/core.js.map +1 -0
  5. package/lib/dom/index.d.ts +1 -0
  6. package/lib/dom/index.js +2 -0
  7. package/lib/dom/index.js.map +1 -0
  8. package/lib/error-serializer.js +1 -2
  9. package/lib/error-serializer.js.map +1 -1
  10. package/lib/error-serializer.test.d.ts +1 -0
  11. package/lib/error-serializer.test.js +117 -0
  12. package/lib/error-serializer.test.js.map +1 -0
  13. package/lib/graphics/canvas.d.ts +21 -0
  14. package/lib/graphics/canvas.js +21 -0
  15. package/lib/graphics/canvas.js.map +1 -1
  16. package/lib/graphics/render-loop.d.ts +12 -3
  17. package/lib/graphics/render-loop.js +7 -1
  18. package/lib/graphics/render-loop.js.map +1 -1
  19. package/lib/index.d.ts +1 -0
  20. package/lib/index.js +1 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/math/core.js +1 -1
  23. package/lib/math/core.js.map +1 -1
  24. package/lib/math/index.d.ts +2 -0
  25. package/lib/math/index.js +2 -0
  26. package/lib/math/index.js.map +1 -1
  27. package/lib/math/vector.d.ts +2 -33
  28. package/lib/math/vector.js +2 -41
  29. package/lib/math/vector.js.map +1 -1
  30. package/lib/math/vector2.d.ts +164 -0
  31. package/lib/math/vector2.js +255 -0
  32. package/lib/math/vector2.js.map +1 -0
  33. package/lib/math/vector3.d.ts +45 -0
  34. package/lib/math/vector3.js +58 -0
  35. package/lib/math/vector3.js.map +1 -0
  36. package/lib/random.d.ts +6 -3
  37. package/lib/random.js +15 -12
  38. package/lib/random.js.map +1 -1
  39. package/package.json +9 -10
  40. package/docs/README.md +0 -3
  41. package/docs/classes/AbstractError.md +0 -271
  42. package/docs/classes/Canvas.md +0 -177
  43. package/docs/classes/InternalError.md +0 -301
  44. package/docs/classes/InvalidArgumentError.md +0 -277
  45. package/docs/classes/InvalidOperationError.md +0 -277
  46. package/docs/classes/NotImplementedError.md +0 -276
  47. package/docs/classes/PermissionViolationError.md +0 -277
  48. package/docs/classes/Random.md +0 -109
  49. package/docs/classes/RenderLoop.md +0 -49
  50. package/docs/classes/ResourceConflictError.md +0 -276
  51. package/docs/classes/UnexpectedNilError.md +0 -169
  52. package/docs/classes/UnknownError.md +0 -280
  53. package/docs/classes/Vector2.md +0 -79
  54. package/docs/classes/Vector3.md +0 -106
  55. package/docs/modules.md +0 -1313
  56. package/typedoc.json +0 -8
@@ -0,0 +1,164 @@
1
+ /**
2
+ * A vector with 2 components, labeled: `X`, `Y`.
3
+ */
4
+ export declare class Vector2 {
5
+ /**
6
+ * The X component of the vector.
7
+ */
8
+ x: number;
9
+ /**
10
+ * The Y component of the vector.
11
+ */
12
+ y: number;
13
+ /**
14
+ * Constructs a new {@link Vector2}.
15
+ * @param x The X component.
16
+ * @param y The Y component.
17
+ */
18
+ constructor(x: number, y: number);
19
+ /**
20
+ * Sets the vector to new coordinates.
21
+ * @param vector The coordinates to set the vector to.
22
+ * @returns This instance.
23
+ */
24
+ set(vector: Vector2): this;
25
+ /**
26
+ * Sets the vector to new coordinates.
27
+ * @param x The new X component for the vector.
28
+ * @param y The new Y component for the vector.
29
+ * @returns This instance.
30
+ */
31
+ setXY(x: number, y: number): this;
32
+ /**
33
+ * Adds another vector to this vector.
34
+ * @param vector The vector to add to this vector.
35
+ * @returns This instance.
36
+ */
37
+ add(vector: Vector2): this;
38
+ /**
39
+ * Adds another vector to this vector.
40
+ * @param x The value to add to the X component.
41
+ * @param y The value to add to the Y component.
42
+ * @returns This instance.
43
+ */
44
+ addXY(x: number, y: number): this;
45
+ /**
46
+ * Scales another vector and adds it to this vector.
47
+ * @param vector The vector to add to this vector.
48
+ * @param scale The scaling to apply to the input vector.
49
+ * @returns This instance.
50
+ */
51
+ addMultiply(vector: Vector2, scale: number): this;
52
+ /**
53
+ * Scales another vector and adds it to this vector.
54
+ * @param x The value to add to the X component.
55
+ * @param y The value to add to the Y component.
56
+ * @param scale The scaling to apply to the input vector.
57
+ * @returns This instance.
58
+ */
59
+ addMultiplyXY(x: number, y: number, scale: number): this;
60
+ /**
61
+ * Subtracts another vector to this vector.
62
+ * @param vector The vector to subtract from this vector.
63
+ * @returns This instance.
64
+ */
65
+ subtract(vector: Vector2): this;
66
+ /**
67
+ * Subtracts another vector to this vector.
68
+ * @param x The value to subtract from the X component.
69
+ * @param y The value to subtract from the Y component.
70
+ * @returns This instance.
71
+ */
72
+ subtractXY(x: number, y: number): this;
73
+ /**
74
+ * Multiplies this vector by another vector.
75
+ * @param vector The vector to multiply with this vector.
76
+ * @returns This instance.
77
+ */
78
+ multiply(vector: Vector2): this;
79
+ /**
80
+ * Multiplies this vector by another vector.
81
+ * @param x The value to multiply with the X component.
82
+ * @param y The value to multiply with the Y component.
83
+ * @returns This instance.
84
+ */
85
+ multiplyXY(x: number, y: number): this;
86
+ /**
87
+ * Multiplies the vector by the given scale.
88
+ * @param scale The scaling to apply to the vector.
89
+ * @returns This instance.
90
+ */
91
+ multiplyScale(scale: number): this;
92
+ /**
93
+ * Divides this vector by another vector.
94
+ * @param vector The vector to divide this vector with.
95
+ * @returns This instance.
96
+ */
97
+ divide(vector: Vector2): this;
98
+ /**
99
+ * Divides this vector by another vector.
100
+ * @param x The value to divide the X component with.
101
+ * @param y The value to divide the Y component with.
102
+ * @returns This instance.
103
+ */
104
+ divideXY(x: number, y: number): this;
105
+ /**
106
+ * Divides the vector by the given scale.
107
+ * @param scale The scaling to apply to the vector.
108
+ * @returns This instance.
109
+ */
110
+ divideScale(scale: number): this;
111
+ /**
112
+ * Inverts the vector.
113
+ * @returns This instance.
114
+ */
115
+ invertAdd(): this;
116
+ /**
117
+ * Inverts the vectors scale.
118
+ * @returns This instance.
119
+ */
120
+ invertMultiply(): this;
121
+ /**
122
+ * Clamps the components of the vector at the given boundary.
123
+ * @param floor The lowest value to allow.
124
+ * @param ceil The largest value to allow.
125
+ * @returns This instance.
126
+ */
127
+ clamp(floor: number, ceil: number): this;
128
+ /**
129
+ * Calculates the length of the vector.
130
+ * @returns The length of the vector.
131
+ */
132
+ length(): number;
133
+ /**
134
+ * Normalizes the vector.
135
+ * @returns This instance.
136
+ */
137
+ normalize(): this;
138
+ /**
139
+ * Compares two vectors.
140
+ * @param vector The vector to compare this vector to.
141
+ * @returns `true` if the vectors are idently, `false` otherwise.
142
+ */
143
+ compare(vector: Readonly<Vector2>): boolean;
144
+ /**
145
+ * Linearly moves this vector towards a target vector.
146
+ * @param vector The target vector.
147
+ * @param t The location on the scale, from `0` to `1`.
148
+ * @returns This instance.
149
+ */
150
+ lerp(vector: Readonly<Vector2>, t: number): this;
151
+ /**
152
+ * Returns the dot product between two vectors.
153
+ * @param vector The other vector.
154
+ * @returns The dot product between the two vectors.
155
+ */
156
+ dot(vector: Vector2): number;
157
+ /**
158
+ * Returns the dot product between two vectors.
159
+ * @param x The X component of the other vector.
160
+ * @param y The Y component of the other vector.
161
+ * @returns The dot product between the two vectors.
162
+ */
163
+ dotXY(x: number, y: number): number;
164
+ }
@@ -0,0 +1,255 @@
1
+ /**
2
+ * A vector with 2 components, labeled: `X`, `Y`.
3
+ */
4
+ export class Vector2 {
5
+ /**
6
+ * The X component of the vector.
7
+ */
8
+ x;
9
+ /**
10
+ * The Y component of the vector.
11
+ */
12
+ y;
13
+ /**
14
+ * Constructs a new {@link Vector2}.
15
+ * @param x The X component.
16
+ * @param y The Y component.
17
+ */
18
+ constructor(x, y) {
19
+ this.x = x;
20
+ this.y = y;
21
+ }
22
+ /**
23
+ * Sets the vector to new coordinates.
24
+ * @param vector The coordinates to set the vector to.
25
+ * @returns This instance.
26
+ */
27
+ set(vector) {
28
+ return this.setXY(vector.x, vector.y);
29
+ }
30
+ /**
31
+ * Sets the vector to new coordinates.
32
+ * @param x The new X component for the vector.
33
+ * @param y The new Y component for the vector.
34
+ * @returns This instance.
35
+ */
36
+ setXY(x, y) {
37
+ this.x = x;
38
+ this.y = y;
39
+ return this;
40
+ }
41
+ /**
42
+ * Adds another vector to this vector.
43
+ * @param vector The vector to add to this vector.
44
+ * @returns This instance.
45
+ */
46
+ add(vector) {
47
+ return this.addXY(vector.x, vector.y);
48
+ }
49
+ /**
50
+ * Adds another vector to this vector.
51
+ * @param x The value to add to the X component.
52
+ * @param y The value to add to the Y component.
53
+ * @returns This instance.
54
+ */
55
+ addXY(x, y) {
56
+ this.x += x;
57
+ this.y += y;
58
+ return this;
59
+ }
60
+ /**
61
+ * Scales another vector and adds it to this vector.
62
+ * @param vector The vector to add to this vector.
63
+ * @param scale The scaling to apply to the input vector.
64
+ * @returns This instance.
65
+ */
66
+ addMultiply(vector, scale) {
67
+ return this.addMultiplyXY(vector.x, vector.y, scale);
68
+ }
69
+ /**
70
+ * Scales another vector and adds it to this vector.
71
+ * @param x The value to add to the X component.
72
+ * @param y The value to add to the Y component.
73
+ * @param scale The scaling to apply to the input vector.
74
+ * @returns This instance.
75
+ */
76
+ addMultiplyXY(x, y, scale) {
77
+ this.x += x * scale;
78
+ this.y += y * scale;
79
+ return this;
80
+ }
81
+ /**
82
+ * Subtracts another vector to this vector.
83
+ * @param vector The vector to subtract from this vector.
84
+ * @returns This instance.
85
+ */
86
+ subtract(vector) {
87
+ return this.subtractXY(vector.x, vector.y);
88
+ }
89
+ /**
90
+ * Subtracts another vector to this vector.
91
+ * @param x The value to subtract from the X component.
92
+ * @param y The value to subtract from the Y component.
93
+ * @returns This instance.
94
+ */
95
+ subtractXY(x, y) {
96
+ this.x -= x;
97
+ this.y -= y;
98
+ return this;
99
+ }
100
+ /**
101
+ * Multiplies this vector by another vector.
102
+ * @param vector The vector to multiply with this vector.
103
+ * @returns This instance.
104
+ */
105
+ multiply(vector) {
106
+ return this.multiplyXY(vector.x, vector.y);
107
+ }
108
+ /**
109
+ * Multiplies this vector by another vector.
110
+ * @param x The value to multiply with the X component.
111
+ * @param y The value to multiply with the Y component.
112
+ * @returns This instance.
113
+ */
114
+ multiplyXY(x, y) {
115
+ this.x *= x;
116
+ this.y *= y;
117
+ return this;
118
+ }
119
+ /**
120
+ * Multiplies the vector by the given scale.
121
+ * @param scale The scaling to apply to the vector.
122
+ * @returns This instance.
123
+ */
124
+ multiplyScale(scale) {
125
+ this.x *= scale;
126
+ this.y *= scale;
127
+ return this;
128
+ }
129
+ /**
130
+ * Divides this vector by another vector.
131
+ * @param vector The vector to divide this vector with.
132
+ * @returns This instance.
133
+ */
134
+ divide(vector) {
135
+ return this.divideXY(vector.x, vector.y);
136
+ }
137
+ /**
138
+ * Divides this vector by another vector.
139
+ * @param x The value to divide the X component with.
140
+ * @param y The value to divide the Y component with.
141
+ * @returns This instance.
142
+ */
143
+ divideXY(x, y) {
144
+ this.x /= x;
145
+ this.y /= y;
146
+ return this;
147
+ }
148
+ /**
149
+ * Divides the vector by the given scale.
150
+ * @param scale The scaling to apply to the vector.
151
+ * @returns This instance.
152
+ */
153
+ divideScale(scale) {
154
+ this.x /= scale;
155
+ this.y /= scale;
156
+ return this;
157
+ }
158
+ /**
159
+ * Inverts the vector.
160
+ * @returns This instance.
161
+ */
162
+ invertAdd() {
163
+ this.x = -this.x;
164
+ this.y = -this.y;
165
+ return this;
166
+ }
167
+ /**
168
+ * Inverts the vectors scale.
169
+ * @returns This instance.
170
+ */
171
+ invertMultiply() {
172
+ this.x = 1 / this.x;
173
+ this.y = 1 / this.y;
174
+ return this;
175
+ }
176
+ /**
177
+ * Clamps the components of the vector at the given boundary.
178
+ * @param floor The lowest value to allow.
179
+ * @param ceil The largest value to allow.
180
+ * @returns This instance.
181
+ */
182
+ clamp(floor, ceil) {
183
+ if (this.x < floor) {
184
+ this.x = floor;
185
+ }
186
+ if (this.x > ceil) {
187
+ this.x = ceil;
188
+ }
189
+ if (this.y < floor) {
190
+ this.y = floor;
191
+ }
192
+ if (this.y > ceil) {
193
+ this.y = ceil;
194
+ }
195
+ return this;
196
+ }
197
+ /**
198
+ * Calculates the length of the vector.
199
+ * @returns The length of the vector.
200
+ */
201
+ length() {
202
+ return Math.sqrt(this.x * this.x + this.y * this.y);
203
+ }
204
+ /**
205
+ * Normalizes the vector.
206
+ * @returns This instance.
207
+ */
208
+ normalize() {
209
+ const length = this.length();
210
+ if (length === 0) {
211
+ return this;
212
+ }
213
+ this.x /= length;
214
+ this.y /= length;
215
+ return this;
216
+ }
217
+ /**
218
+ * Compares two vectors.
219
+ * @param vector The vector to compare this vector to.
220
+ * @returns `true` if the vectors are idently, `false` otherwise.
221
+ */
222
+ compare(vector) {
223
+ return vector.x === this.x && vector.y === this.y;
224
+ }
225
+ /**
226
+ * Linearly moves this vector towards a target vector.
227
+ * @param vector The target vector.
228
+ * @param t The location on the scale, from `0` to `1`.
229
+ * @returns This instance.
230
+ */
231
+ lerp(vector, t) {
232
+ const tn = 1.0 - t;
233
+ this.x = this.x * tn + vector.x * t;
234
+ this.y = this.y * tn + vector.y * t;
235
+ return this;
236
+ }
237
+ /**
238
+ * Returns the dot product between two vectors.
239
+ * @param vector The other vector.
240
+ * @returns The dot product between the two vectors.
241
+ */
242
+ dot(vector) {
243
+ return this.dotXY(vector.x, vector.y);
244
+ }
245
+ /**
246
+ * Returns the dot product between two vectors.
247
+ * @param x The X component of the other vector.
248
+ * @param y The Y component of the other vector.
249
+ * @returns The dot product between the two vectors.
250
+ */
251
+ dotXY(x, y) {
252
+ return this.x * x + this.y * y;
253
+ }
254
+ }
255
+ //# sourceMappingURL=vector2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector2.js","sourceRoot":"","sources":["../../source/math/vector2.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,OAAO;IAClB;;OAEG;IACH,CAAC,CAAS;IAEV;;OAEG;IACH,CAAC,CAAS;IAEV;;;;OAIG;IACH,YAAY,CAAS,EAAE,CAAS;QAC9B,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,C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AC;IACpD,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAAyB,EAAE,CAAS;QACvC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAe;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,CAAS,EAAE,CAAS;QACxB,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * A vector with 3 components, labeled: `X`, `Y`, `Z`.
3
+ */
4
+ export declare class Vector3 {
5
+ /**
6
+ * The X component of the vector.
7
+ */
8
+ x: number;
9
+ /**
10
+ * The Y component of the vector.
11
+ */
12
+ y: number;
13
+ /**
14
+ * The Z component of the vector.
15
+ */
16
+ z: number;
17
+ /**
18
+ * Constructs a new {@link Vector3}.
19
+ * @param x The X component.
20
+ * @param y The Y component.
21
+ * @param z The Z component.
22
+ */
23
+ constructor(x: number, y: number, z: number);
24
+ /**
25
+ * Sets the vector to new coordinates.
26
+ * @param x The new X component for the vector.
27
+ * @param y The new Y component for the vector.
28
+ * @param z The new Z component for the vector.
29
+ */
30
+ setXYZ(x: number, y: number, z: number): void;
31
+ /**
32
+ * Returns the dot product between two vectors.
33
+ * @param vector The other vector.
34
+ * @returns The dot product between the two vectors.
35
+ */
36
+ dot(vector: Vector3): number;
37
+ /**
38
+ * Returns the dot product between two vectors.
39
+ * @param x The X component of the other vector.
40
+ * @param y The Y component of the other vector.
41
+ * @param z The Z component of the other vector.
42
+ * @returns The dot product between the two vectors.
43
+ */
44
+ dotXYZ(x: number, y: number, z: number): number;
45
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * A vector with 3 components, labeled: `X`, `Y`, `Z`.
3
+ */
4
+ export class Vector3 {
5
+ /**
6
+ * The X component of the vector.
7
+ */
8
+ x;
9
+ /**
10
+ * The Y component of the vector.
11
+ */
12
+ y;
13
+ /**
14
+ * The Z component of the vector.
15
+ */
16
+ z;
17
+ /**
18
+ * Constructs a new {@link Vector3}.
19
+ * @param x The X component.
20
+ * @param y The Y component.
21
+ * @param z The Z component.
22
+ */
23
+ constructor(x, y, z) {
24
+ this.x = x;
25
+ this.y = y;
26
+ this.z = z;
27
+ }
28
+ /**
29
+ * Sets the vector to new coordinates.
30
+ * @param x The new X component for the vector.
31
+ * @param y The new Y component for the vector.
32
+ * @param z The new Z component for the vector.
33
+ */
34
+ setXYZ(x, y, z) {
35
+ this.x = x;
36
+ this.y = y;
37
+ this.z = z;
38
+ }
39
+ /**
40
+ * Returns the dot product between two vectors.
41
+ * @param vector The other vector.
42
+ * @returns The dot product between the two vectors.
43
+ */
44
+ dot(vector) {
45
+ return this.dotXYZ(vector.x, vector.y, vector.z);
46
+ }
47
+ /**
48
+ * Returns the dot product between two vectors.
49
+ * @param x The X component of the other vector.
50
+ * @param y The Y component of the other vector.
51
+ * @param z The Z component of the other vector.
52
+ * @returns The dot product between the two vectors.
53
+ */
54
+ dotXYZ(x, y, z) {
55
+ return this.x * x + this.y * y + this.z * z;
56
+ }
57
+ }
58
+ //# sourceMappingURL=vector3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector3.js","sourceRoot":"","sources":["../../source/math/vector3.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,OAAO;IAClB;;OAEG;IACH,CAAC,CAAS;IAEV;;OAEG;IACH,CAAC,CAAS;IAEV;;OAEG;IACH,CAAC,CAAS;IAEV;;;;;OAKG;IACH,YAAY,CAAS,EAAE,CAAS,EAAE,CAAS;QACzC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;QACpC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;QACpC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;CACF"}
package/lib/random.d.ts CHANGED
@@ -32,11 +32,14 @@ export declare class Random {
32
32
  nextFloat(): number;
33
33
  /**
34
34
  * Returns a 2D simplex noise value for a given input coordinate.
35
- * @param xin The X input coordinate.
36
- * @param yin The Y input coordinate.
35
+ * @license ISC
36
+ * @author Joseph Gentle
37
+ * @see https://github.com/josephg/noisejs
38
+ * @param x The X input coordinate.
39
+ * @param y The Y input coordinate.
37
40
  * @returns The noise value for the input coordinates.
38
41
  */
39
- simplex2(xin: number, yin: number): number;
42
+ simplex2(x: number, y: number): number;
40
43
  }
41
44
  /**
42
45
  * Returns a random value in a given range.
package/lib/random.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "./math/vector";
1
+ import { Vector3 } from "./math/vector3.js";
2
2
  /**
3
3
  * Helps with generating random numbers.
4
4
  */
@@ -90,19 +90,22 @@ export class Random {
90
90
  }
91
91
  /**
92
92
  * Returns a 2D simplex noise value for a given input coordinate.
93
- * @param xin The X input coordinate.
94
- * @param yin The Y input coordinate.
93
+ * @license ISC
94
+ * @author Joseph Gentle
95
+ * @see https://github.com/josephg/noisejs
96
+ * @param x The X input coordinate.
97
+ * @param y The Y input coordinate.
95
98
  * @returns The noise value for the input coordinates.
96
99
  */
97
- simplex2(xin, yin) {
100
+ simplex2(x, y) {
98
101
  let n0, n1, n2; // Noise contributions from the three corners
99
102
  // Skew the input space to determine which simplex cell we're in
100
- const s = (xin + yin) * this._F2; // Hairy factor for 2D
101
- let i = Math.floor(xin + s);
102
- let j = Math.floor(yin + s);
103
+ const s = (x + y) * this._F2; // Hairy factor for 2D
104
+ let i = Math.floor(x + s);
105
+ let j = Math.floor(y + s);
103
106
  const t = (i + j) * this._G2;
104
- const x0 = xin - i + t; // The x,y distances from the cell origin, unskewed.
105
- const y0 = yin - j + t;
107
+ const x0 = x - i + t; // The x,y distances from the cell origin, unskewed.
108
+ const y0 = y - j + t;
106
109
  // For the 2D case, the simplex shape is an equilateral triangle.
107
110
  // Determine which simplex we are in.
108
111
  let i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords
@@ -136,7 +139,7 @@ export class Random {
136
139
  }
137
140
  else {
138
141
  t0 *= t0;
139
- n0 = t0 * t0 * gi0.dot2(x0, y0); // (x,y) of grad3 used for 2D gradient
142
+ n0 = t0 * t0 * gi0.dotXYZ(x0, y0, 0); // (x,y) of grad3 used for 2D gradient
140
143
  }
141
144
  let t1 = 0.5 - x1 * x1 - y1 * y1;
142
145
  if (t1 < 0) {
@@ -144,7 +147,7 @@ export class Random {
144
147
  }
145
148
  else {
146
149
  t1 *= t1;
147
- n1 = t1 * t1 * gi1.dot2(x1, y1);
150
+ n1 = t1 * t1 * gi1.dotXYZ(x1, y1, 0);
148
151
  }
149
152
  let t2 = 0.5 - x2 * x2 - y2 * y2;
150
153
  if (t2 < 0) {
@@ -152,7 +155,7 @@ export class Random {
152
155
  }
153
156
  else {
154
157
  t2 *= t2;
155
- n2 = t2 * t2 * gi2.dot2(x2, y2);
158
+ n2 = t2 * t2 * gi2.dotXYZ(x2, y2, 0);
156
159
  }
157
160
  // Add contributions from each corner to get the final noise value.
158
161
  // The result is scaled to return values in the interval [-1,1].
package/lib/random.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../source/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,MAAM;IACT,KAAK,CAAS;IACd,KAAK,CAAgB;IACrB,MAAM,CAAiB;IACvB,GAAG,CAAS;IACZ,GAAG,CAAS;IAEpB;;;;;;OAMG;IACH,YAAY,IAAI,GAAG,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;QAC3C,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE;YACnB,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC;SAC1B;QAED,MAAM,KAAK,GAAG;YACZ,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACpB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACrB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACtB,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACpB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,IAAI,OAAO,CAAC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