@minecraft/math 1.5.0 → 1.5.2

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.
@@ -1,425 +1,516 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
5
+
1
6
  // lib/general/clamp.js
2
- function clampNumber(val, min, max) {
3
- return Math.min(Math.max(val, min), max);
4
- }
7
+ var require_clamp = __commonJS({
8
+ "lib/general/clamp.js"(exports) {
9
+ "use strict";
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.clampNumber = void 0;
12
+ function clampNumber(val, min, max) {
13
+ return Math.min(Math.max(val, min), max);
14
+ }
15
+ exports.clampNumber = clampNumber;
16
+ }
17
+ });
5
18
 
6
19
  // lib/vector3/coreHelpers.js
7
- var Vector3Utils = class _Vector3Utils {
8
- /**
9
- * equals
10
- *
11
- * Check the equality of two vectors
12
- */
13
- static equals(v1, v2) {
14
- return v1.x === v2.x && v1.y === v2.y && v1.z === v2.z;
15
- }
16
- /**
17
- * add
18
- *
19
- * Add two vectors to produce a new vector
20
- */
21
- static add(v1, v2) {
22
- return { x: v1.x + v2.x, y: v1.y + v2.y, z: v1.z + v2.z };
23
- }
24
- /**
25
- * subtract
26
- *
27
- * Subtract two vectors to produce a new vector (v1-v2)
28
- */
29
- static subtract(v1, v2) {
30
- return { x: v1.x - v2.x, y: v1.y - v2.y, z: v1.z - v2.z };
31
- }
32
- /** scale
33
- *
34
- * Multiple all entries in a vector by a single scalar value producing a new vector
35
- */
36
- static scale(v1, scale) {
37
- return { x: v1.x * scale, y: v1.y * scale, z: v1.z * scale };
38
- }
39
- /**
40
- * dot
41
- *
42
- * Calculate the dot product of two vectors
43
- */
44
- static dot(a, b) {
45
- return a.x * b.x + a.y * b.y + a.z * b.z;
46
- }
47
- /**
48
- * cross
49
- *
50
- * Calculate the cross product of two vectors. Returns a new vector.
51
- */
52
- static cross(a, b) {
53
- return {
54
- x: a.y * b.z - a.z * b.y,
55
- y: a.z * b.x - a.x * b.z,
56
- z: a.x * b.y - a.y * b.x
57
- };
58
- }
59
- /**
60
- * magnitude
61
- *
62
- * The magnitude of a vector
63
- */
64
- static magnitude(v) {
65
- return Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);
66
- }
67
- /**
68
- * distance
69
- *
70
- * Calculate the distance between two vectors
71
- */
72
- static distance(a, b) {
73
- return _Vector3Utils.magnitude(_Vector3Utils.subtract(a, b));
74
- }
75
- /**
76
- * normalize
77
- *
78
- * Takes a vector 3 and normalizes it to a unit vector
79
- */
80
- static normalize(v) {
81
- const mag = _Vector3Utils.magnitude(v);
82
- return { x: v.x / mag, y: v.y / mag, z: v.z / mag };
83
- }
84
- /**
85
- * floor
86
- *
87
- * Floor the components of a vector to produce a new vector
88
- */
89
- static floor(v) {
90
- return { x: Math.floor(v.x), y: Math.floor(v.y), z: Math.floor(v.z) };
91
- }
92
- /**
93
- * toString
94
- *
95
- * Create a string representation of a vector3
96
- */
97
- static toString(v, options) {
98
- const decimals = options?.decimals ?? 2;
99
- const str = [v.x.toFixed(decimals), v.y.toFixed(decimals), v.z.toFixed(decimals)];
100
- return str.join(options?.delimiter ?? ", ");
101
- }
102
- /**
103
- * clamp
104
- *
105
- * Clamps the components of a vector to limits to produce a new vector
106
- */
107
- static clamp(v, limits) {
108
- return {
109
- x: clampNumber(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),
110
- y: clampNumber(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),
111
- z: clampNumber(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER)
20
+ var require_coreHelpers = __commonJS({
21
+ "lib/vector3/coreHelpers.js"(exports) {
22
+ "use strict";
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.VECTOR3_SOUTH = exports.VECTOR3_NORTH = exports.VECTOR3_EAST = exports.VECTOR3_WEST = exports.VECTOR3_ZERO = exports.VECTOR3_ONE = exports.VECTOR3_BACK = exports.VECTOR3_FORWARD = exports.VECTOR3_RIGHT = exports.VECTOR3_LEFT = exports.VECTOR3_DOWN = exports.VECTOR3_UP = exports.Vector2Utils = exports.Vector3Utils = void 0;
25
+ var clamp_1 = require_clamp();
26
+ var Vector3Utils = class _Vector3Utils {
27
+ /**
28
+ * equals
29
+ *
30
+ * Check the equality of two vectors
31
+ */
32
+ static equals(v1, v2) {
33
+ return v1.x === v2.x && v1.y === v2.y && v1.z === v2.z;
34
+ }
35
+ /**
36
+ * add
37
+ *
38
+ * Add two vectors to produce a new vector
39
+ */
40
+ static add(v1, v2) {
41
+ return { x: v1.x + v2.x, y: v1.y + v2.y, z: v1.z + v2.z };
42
+ }
43
+ /**
44
+ * subtract
45
+ *
46
+ * Subtract two vectors to produce a new vector (v1-v2)
47
+ */
48
+ static subtract(v1, v2) {
49
+ return { x: v1.x - v2.x, y: v1.y - v2.y, z: v1.z - v2.z };
50
+ }
51
+ /** scale
52
+ *
53
+ * Multiple all entries in a vector by a single scalar value producing a new vector
54
+ */
55
+ static scale(v1, scale) {
56
+ return { x: v1.x * scale, y: v1.y * scale, z: v1.z * scale };
57
+ }
58
+ /**
59
+ * dot
60
+ *
61
+ * Calculate the dot product of two vectors
62
+ */
63
+ static dot(a, b) {
64
+ return a.x * b.x + a.y * b.y + a.z * b.z;
65
+ }
66
+ /**
67
+ * cross
68
+ *
69
+ * Calculate the cross product of two vectors. Returns a new vector.
70
+ */
71
+ static cross(a, b) {
72
+ return {
73
+ x: a.y * b.z - a.z * b.y,
74
+ y: a.z * b.x - a.x * b.z,
75
+ z: a.x * b.y - a.y * b.x
76
+ };
77
+ }
78
+ /**
79
+ * magnitude
80
+ *
81
+ * The magnitude of a vector
82
+ */
83
+ static magnitude(v) {
84
+ return Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);
85
+ }
86
+ /**
87
+ * distance
88
+ *
89
+ * Calculate the distance between two vectors
90
+ */
91
+ static distance(a, b) {
92
+ return _Vector3Utils.magnitude(_Vector3Utils.subtract(a, b));
93
+ }
94
+ /**
95
+ * normalize
96
+ *
97
+ * Takes a vector 3 and normalizes it to a unit vector
98
+ */
99
+ static normalize(v) {
100
+ const mag = _Vector3Utils.magnitude(v);
101
+ return { x: v.x / mag, y: v.y / mag, z: v.z / mag };
102
+ }
103
+ /**
104
+ * floor
105
+ *
106
+ * Floor the components of a vector to produce a new vector
107
+ */
108
+ static floor(v) {
109
+ return { x: Math.floor(v.x), y: Math.floor(v.y), z: Math.floor(v.z) };
110
+ }
111
+ /**
112
+ * toString
113
+ *
114
+ * Create a string representation of a vector3
115
+ */
116
+ static toString(v, options) {
117
+ const decimals = options?.decimals ?? 2;
118
+ const str = [v.x.toFixed(decimals), v.y.toFixed(decimals), v.z.toFixed(decimals)];
119
+ return str.join(options?.delimiter ?? ", ");
120
+ }
121
+ /**
122
+ * clamp
123
+ *
124
+ * Clamps the components of a vector to limits to produce a new vector
125
+ */
126
+ static clamp(v, limits) {
127
+ return {
128
+ x: (0, clamp_1.clampNumber)(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),
129
+ y: (0, clamp_1.clampNumber)(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),
130
+ z: (0, clamp_1.clampNumber)(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER)
131
+ };
132
+ }
133
+ /**
134
+ * lerp
135
+ *
136
+ * Constructs a new vector using linear interpolation on each component from two vectors.
137
+ */
138
+ static lerp(a, b, t) {
139
+ return {
140
+ x: a.x + (b.x - a.x) * t,
141
+ y: a.y + (b.y - a.y) * t,
142
+ z: a.z + (b.z - a.z) * t
143
+ };
144
+ }
145
+ /**
146
+ * slerp
147
+ *
148
+ * Constructs a new vector using spherical linear interpolation on each component from two vectors.
149
+ */
150
+ static slerp(a, b, t) {
151
+ const theta = Math.acos(_Vector3Utils.dot(a, b));
152
+ const sinTheta = Math.sin(theta);
153
+ const ta = Math.sin((1 - t) * theta) / sinTheta;
154
+ const tb = Math.sin(t * theta) / sinTheta;
155
+ return _Vector3Utils.add(_Vector3Utils.scale(a, ta), _Vector3Utils.scale(b, tb));
156
+ }
157
+ /**
158
+ * multiply
159
+ *
160
+ * Element-wise multiplication of two vectors together.
161
+ * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
162
+ */
163
+ static multiply(a, b) {
164
+ return {
165
+ x: a.x * b.x,
166
+ y: a.y * b.y,
167
+ z: a.z * b.z
168
+ };
169
+ }
170
+ /**
171
+ * rotateX
172
+ *
173
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
174
+ * @param a - Angle in radians
175
+ */
176
+ static rotateX(v, a) {
177
+ let cos = Math.cos(a);
178
+ let sin = Math.sin(a);
179
+ return {
180
+ x: v.x,
181
+ y: v.y * cos - v.z * sin,
182
+ z: v.z * cos + v.y * sin
183
+ };
184
+ }
185
+ /**
186
+ * rotateY
187
+ *
188
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
189
+ * @param a - Angle in radians
190
+ */
191
+ static rotateY(v, a) {
192
+ let cos = Math.cos(a);
193
+ let sin = Math.sin(a);
194
+ return {
195
+ x: v.x * cos + v.z * sin,
196
+ y: v.y,
197
+ z: v.z * cos - v.x * sin
198
+ };
199
+ }
200
+ /**
201
+ * rotateZ
202
+ *
203
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
204
+ * @param a - Angle in radians
205
+ */
206
+ static rotateZ(v, a) {
207
+ let cos = Math.cos(a);
208
+ let sin = Math.sin(a);
209
+ return {
210
+ x: v.x * cos - v.y * sin,
211
+ y: v.y * cos + v.x * sin,
212
+ z: v.z
213
+ };
214
+ }
112
215
  };
113
- }
114
- /**
115
- * lerp
116
- *
117
- * Constructs a new vector using linear interpolation on each component from two vectors.
118
- */
119
- static lerp(a, b, t) {
120
- return {
121
- x: a.x + (b.x - a.x) * t,
122
- y: a.y + (b.y - a.y) * t,
123
- z: a.z + (b.z - a.z) * t
216
+ exports.Vector3Utils = Vector3Utils;
217
+ var Vector2Utils = class {
218
+ /**
219
+ * toString
220
+ *
221
+ * Create a string representation of a vector2
222
+ */
223
+ static toString(v, options) {
224
+ const decimals = options?.decimals ?? 2;
225
+ const str = [v.x.toFixed(decimals), v.y.toFixed(decimals)];
226
+ return str.join(options?.delimiter ?? ", ");
227
+ }
124
228
  };
125
- }
126
- /**
127
- * slerp
128
- *
129
- * Constructs a new vector using spherical linear interpolation on each component from two vectors.
130
- */
131
- static slerp(a, b, t) {
132
- const theta = Math.acos(_Vector3Utils.dot(a, b));
133
- const sinTheta = Math.sin(theta);
134
- const ta = Math.sin((1 - t) * theta) / sinTheta;
135
- const tb = Math.sin(t * theta) / sinTheta;
136
- return _Vector3Utils.add(_Vector3Utils.scale(a, ta), _Vector3Utils.scale(b, tb));
137
- }
138
- /**
139
- * multiply
140
- *
141
- * Element-wise multiplication of two vectors together.
142
- * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
143
- */
144
- static multiply(a, b) {
145
- return {
146
- x: a.x * b.x,
147
- y: a.y * b.y,
148
- z: a.z * b.z
229
+ exports.Vector2Utils = Vector2Utils;
230
+ exports.VECTOR3_UP = { x: 0, y: 1, z: 0 };
231
+ exports.VECTOR3_DOWN = { x: 0, y: -1, z: 0 };
232
+ exports.VECTOR3_LEFT = { x: -1, y: 0, z: 0 };
233
+ exports.VECTOR3_RIGHT = { x: 1, y: 0, z: 0 };
234
+ exports.VECTOR3_FORWARD = { x: 0, y: 0, z: 1 };
235
+ exports.VECTOR3_BACK = { x: 0, y: 0, z: -1 };
236
+ exports.VECTOR3_ONE = { x: 1, y: 1, z: 1 };
237
+ exports.VECTOR3_ZERO = { x: 0, y: 0, z: 0 };
238
+ exports.VECTOR3_WEST = { x: -1, y: 0, z: 0 };
239
+ exports.VECTOR3_EAST = { x: 1, y: 0, z: 0 };
240
+ exports.VECTOR3_NORTH = { x: 0, y: 0, z: 1 };
241
+ exports.VECTOR3_SOUTH = { x: 0, y: 0, z: -1 };
242
+ }
243
+ });
244
+
245
+ // lib/vector3/vectorWrapper.js
246
+ var require_vectorWrapper = __commonJS({
247
+ "lib/vector3/vectorWrapper.js"(exports) {
248
+ "use strict";
249
+ Object.defineProperty(exports, "__esModule", { value: true });
250
+ exports.Vector2Builder = exports.Vector3Builder = void 0;
251
+ var coreHelpers_1 = require_coreHelpers();
252
+ var Vector3Builder = class {
253
+ constructor(first, y, z) {
254
+ if (typeof first === "object") {
255
+ this.x = first.x;
256
+ this.y = first.y;
257
+ this.z = first.z;
258
+ } else {
259
+ this.x = first;
260
+ this.y = y ?? 0;
261
+ this.z = z ?? 0;
262
+ }
263
+ }
264
+ /**
265
+ * Assigns the values of the passed in vector to this vector. Returns itself.
266
+ */
267
+ assign(vec) {
268
+ this.x = vec.x;
269
+ this.y = vec.y;
270
+ this.z = vec.z;
271
+ return this;
272
+ }
273
+ /**
274
+ * equals
275
+ *
276
+ * Check the equality of two vectors
277
+ */
278
+ equals(v) {
279
+ return coreHelpers_1.Vector3Utils.equals(this, v);
280
+ }
281
+ /**
282
+ * add
283
+ *
284
+ * Adds the vector v to this, returning itself.
285
+ */
286
+ add(v) {
287
+ return this.assign(coreHelpers_1.Vector3Utils.add(this, v));
288
+ }
289
+ /**
290
+ * subtract
291
+ *
292
+ * Subtracts the vector v from this, returning itself.
293
+ */
294
+ subtract(v) {
295
+ return this.assign(coreHelpers_1.Vector3Utils.subtract(this, v));
296
+ }
297
+ /** scale
298
+ *
299
+ * Scales this by the passed in value, returning itself.
300
+ */
301
+ scale(val) {
302
+ return this.assign(coreHelpers_1.Vector3Utils.scale(this, val));
303
+ }
304
+ /**
305
+ * dot
306
+ *
307
+ * Computes the dot product of this and the passed in vector.
308
+ */
309
+ dot(vec) {
310
+ return coreHelpers_1.Vector3Utils.dot(this, vec);
311
+ }
312
+ /**
313
+ * cross
314
+ *
315
+ * Computes the cross product of this and the passed in vector, returning itself.
316
+ */
317
+ cross(vec) {
318
+ return this.assign(coreHelpers_1.Vector3Utils.cross(this, vec));
319
+ }
320
+ /**
321
+ * magnitude
322
+ *
323
+ * The magnitude of the vector
324
+ */
325
+ magnitude() {
326
+ return coreHelpers_1.Vector3Utils.magnitude(this);
327
+ }
328
+ /**
329
+ * distance
330
+ *
331
+ * Calculate the distance between two vectors
332
+ */
333
+ distance(vec) {
334
+ return coreHelpers_1.Vector3Utils.distance(this, vec);
335
+ }
336
+ /**
337
+ * normalize
338
+ *
339
+ * Normalizes this vector, returning itself.
340
+ */
341
+ normalize() {
342
+ return this.assign(coreHelpers_1.Vector3Utils.normalize(this));
343
+ }
344
+ /**
345
+ * floor
346
+ *
347
+ * Floor the components of a vector to produce a new vector
348
+ */
349
+ floor() {
350
+ return this.assign(coreHelpers_1.Vector3Utils.floor(this));
351
+ }
352
+ /**
353
+ * toString
354
+ *
355
+ * Create a string representation of a vector
356
+ */
357
+ toString(options) {
358
+ return coreHelpers_1.Vector3Utils.toString(this, options);
359
+ }
360
+ /**
361
+ * clamp
362
+ *
363
+ * Clamps the components of a vector to limits to produce a new vector
364
+ */
365
+ clamp(limits) {
366
+ return this.assign(coreHelpers_1.Vector3Utils.clamp(this, limits));
367
+ }
368
+ /**
369
+ * lerp
370
+ *
371
+ * Constructs a new vector using linear interpolation on each component from two vectors.
372
+ */
373
+ lerp(vec, t) {
374
+ return this.assign(coreHelpers_1.Vector3Utils.lerp(this, vec, t));
375
+ }
376
+ /**
377
+ * slerp
378
+ *
379
+ * Constructs a new vector using spherical linear interpolation on each component from two vectors.
380
+ */
381
+ slerp(vec, t) {
382
+ return this.assign(coreHelpers_1.Vector3Utils.slerp(this, vec, t));
383
+ }
384
+ /**
385
+ * multiply
386
+ *
387
+ * Element-wise multiplication of two vectors together.
388
+ * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
389
+ */
390
+ multiply(vec) {
391
+ return this.assign(coreHelpers_1.Vector3Utils.multiply(this, vec));
392
+ }
393
+ /**
394
+ * rotateX
395
+ *
396
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
397
+ * @param a - Angle in radians
398
+ */
399
+ rotateX(a) {
400
+ return this.assign(coreHelpers_1.Vector3Utils.rotateX(this, a));
401
+ }
402
+ /**
403
+ * rotateY
404
+ *
405
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
406
+ * @param a - Angle in radians
407
+ */
408
+ rotateY(a) {
409
+ return this.assign(coreHelpers_1.Vector3Utils.rotateY(this, a));
410
+ }
411
+ /**
412
+ * rotateZ
413
+ *
414
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
415
+ * @param a - Angle in radians
416
+ */
417
+ rotateZ(a) {
418
+ return this.assign(coreHelpers_1.Vector3Utils.rotateZ(this, a));
419
+ }
149
420
  };
150
- }
151
- /**
152
- * rotateX
153
- *
154
- * Rotates the vector around the x axis counterclockwise (left hand rule)
155
- * @param a - Angle in radians
156
- */
157
- static rotateX(v, a) {
158
- let cos = Math.cos(a);
159
- let sin = Math.sin(a);
160
- return {
161
- x: v.x,
162
- y: v.y * cos - v.z * sin,
163
- z: v.z * cos + v.y * sin
421
+ exports.Vector3Builder = Vector3Builder;
422
+ var Vector2Builder = class {
423
+ constructor(first, y) {
424
+ if (typeof first === "object") {
425
+ this.x = first.x;
426
+ this.y = first.y;
427
+ } else {
428
+ this.x = first;
429
+ this.y = y ?? 0;
430
+ }
431
+ }
432
+ toString(options) {
433
+ return coreHelpers_1.Vector2Utils.toString(this, options);
434
+ }
164
435
  };
436
+ exports.Vector2Builder = Vector2Builder;
165
437
  }
166
- /**
167
- * rotateY
168
- *
169
- * Rotates the vector around the y axis counterclockwise (left hand rule)
170
- * @param a - Angle in radians
171
- */
172
- static rotateY(v, a) {
173
- let cos = Math.cos(a);
174
- let sin = Math.sin(a);
175
- return {
176
- x: v.x * cos + v.z * sin,
177
- y: v.y,
178
- z: v.z * cos - v.x * sin
438
+ });
439
+
440
+ // lib/vector3/index.js
441
+ var require_vector3 = __commonJS({
442
+ "lib/vector3/index.js"(exports) {
443
+ "use strict";
444
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
445
+ if (k2 === void 0) k2 = k;
446
+ var desc = Object.getOwnPropertyDescriptor(m, k);
447
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
448
+ desc = { enumerable: true, get: function() {
449
+ return m[k];
450
+ } };
451
+ }
452
+ Object.defineProperty(o, k2, desc);
453
+ } : function(o, m, k, k2) {
454
+ if (k2 === void 0) k2 = k;
455
+ o[k2] = m[k];
456
+ });
457
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
458
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
179
459
  };
460
+ Object.defineProperty(exports, "__esModule", { value: true });
461
+ __exportStar(require_coreHelpers(), exports);
462
+ __exportStar(require_vectorWrapper(), exports);
180
463
  }
181
- /**
182
- * rotateZ
183
- *
184
- * Rotates the vector around the z axis counterclockwise (left hand rule)
185
- * @param a - Angle in radians
186
- */
187
- static rotateZ(v, a) {
188
- let cos = Math.cos(a);
189
- let sin = Math.sin(a);
190
- return {
191
- x: v.x * cos - v.y * sin,
192
- y: v.y * cos + v.x * sin,
193
- z: v.z
464
+ });
465
+
466
+ // lib/general/index.js
467
+ var require_general = __commonJS({
468
+ "lib/general/index.js"(exports) {
469
+ "use strict";
470
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
471
+ if (k2 === void 0) k2 = k;
472
+ var desc = Object.getOwnPropertyDescriptor(m, k);
473
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
474
+ desc = { enumerable: true, get: function() {
475
+ return m[k];
476
+ } };
477
+ }
478
+ Object.defineProperty(o, k2, desc);
479
+ } : function(o, m, k, k2) {
480
+ if (k2 === void 0) k2 = k;
481
+ o[k2] = m[k];
482
+ });
483
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
484
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
194
485
  };
486
+ Object.defineProperty(exports, "__esModule", { value: true });
487
+ __exportStar(require_clamp(), exports);
195
488
  }
196
- };
197
- var Vector2Utils = class {
198
- /**
199
- * toString
200
- *
201
- * Create a string representation of a vector2
202
- */
203
- static toString(v, options) {
204
- const decimals = options?.decimals ?? 2;
205
- const str = [v.x.toFixed(decimals), v.y.toFixed(decimals)];
206
- return str.join(options?.delimiter ?? ", ");
207
- }
208
- };
209
- var VECTOR3_UP = { x: 0, y: 1, z: 0 };
210
- var VECTOR3_DOWN = { x: 0, y: -1, z: 0 };
211
- var VECTOR3_LEFT = { x: -1, y: 0, z: 0 };
212
- var VECTOR3_RIGHT = { x: 1, y: 0, z: 0 };
213
- var VECTOR3_FORWARD = { x: 0, y: 0, z: 1 };
214
- var VECTOR3_BACK = { x: 0, y: 0, z: -1 };
215
- var VECTOR3_ONE = { x: 1, y: 1, z: 1 };
216
- var VECTOR3_ZERO = { x: 0, y: 0, z: 0 };
217
- var VECTOR3_WEST = { x: -1, y: 0, z: 0 };
218
- var VECTOR3_EAST = { x: 1, y: 0, z: 0 };
219
- var VECTOR3_NORTH = { x: 0, y: 0, z: 1 };
220
- var VECTOR3_SOUTH = { x: 0, y: 0, z: -1 };
489
+ });
221
490
 
222
- // lib/vector3/vectorWrapper.js
223
- var Vector3Builder = class {
224
- constructor(first, y, z) {
225
- if (typeof first === "object") {
226
- this.x = first.x;
227
- this.y = first.y;
228
- this.z = first.z;
229
- } else {
230
- this.x = first;
231
- this.y = y ?? 0;
232
- this.z = z ?? 0;
233
- }
234
- }
235
- /**
236
- * Assigns the values of the passed in vector to this vector. Returns itself.
237
- */
238
- assign(vec) {
239
- this.x = vec.x;
240
- this.y = vec.y;
241
- this.z = vec.z;
242
- return this;
243
- }
244
- /**
245
- * equals
246
- *
247
- * Check the equality of two vectors
248
- */
249
- equals(v) {
250
- return Vector3Utils.equals(this, v);
251
- }
252
- /**
253
- * add
254
- *
255
- * Adds the vector v to this, returning itself.
256
- */
257
- add(v) {
258
- return this.assign(Vector3Utils.add(this, v));
259
- }
260
- /**
261
- * subtract
262
- *
263
- * Subtracts the vector v from this, returning itself.
264
- */
265
- subtract(v) {
266
- return this.assign(Vector3Utils.subtract(this, v));
267
- }
268
- /** scale
269
- *
270
- * Scales this by the passed in value, returning itself.
271
- */
272
- scale(val) {
273
- return this.assign(Vector3Utils.scale(this, val));
274
- }
275
- /**
276
- * dot
277
- *
278
- * Computes the dot product of this and the passed in vector.
279
- */
280
- dot(vec) {
281
- return Vector3Utils.dot(this, vec);
282
- }
283
- /**
284
- * cross
285
- *
286
- * Computes the cross product of this and the passed in vector, returning itself.
287
- */
288
- cross(vec) {
289
- return this.assign(Vector3Utils.cross(this, vec));
290
- }
291
- /**
292
- * magnitude
293
- *
294
- * The magnitude of the vector
295
- */
296
- magnitude() {
297
- return Vector3Utils.magnitude(this);
298
- }
299
- /**
300
- * distance
301
- *
302
- * Calculate the distance between two vectors
303
- */
304
- distance(vec) {
305
- return Vector3Utils.distance(this, vec);
306
- }
307
- /**
308
- * normalize
309
- *
310
- * Normalizes this vector, returning itself.
311
- */
312
- normalize() {
313
- return this.assign(Vector3Utils.normalize(this));
314
- }
315
- /**
316
- * floor
317
- *
318
- * Floor the components of a vector to produce a new vector
319
- */
320
- floor() {
321
- return this.assign(Vector3Utils.floor(this));
322
- }
323
- /**
324
- * toString
325
- *
326
- * Create a string representation of a vector
327
- */
328
- toString(options) {
329
- return Vector3Utils.toString(this, options);
330
- }
331
- /**
332
- * clamp
333
- *
334
- * Clamps the components of a vector to limits to produce a new vector
335
- */
336
- clamp(limits) {
337
- return this.assign(Vector3Utils.clamp(this, limits));
338
- }
339
- /**
340
- * lerp
341
- *
342
- * Constructs a new vector using linear interpolation on each component from two vectors.
343
- */
344
- lerp(vec, t) {
345
- return this.assign(Vector3Utils.lerp(this, vec, t));
346
- }
347
- /**
348
- * slerp
349
- *
350
- * Constructs a new vector using spherical linear interpolation on each component from two vectors.
351
- */
352
- slerp(vec, t) {
353
- return this.assign(Vector3Utils.slerp(this, vec, t));
354
- }
355
- /**
356
- * multiply
357
- *
358
- * Element-wise multiplication of two vectors together.
359
- * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
360
- */
361
- multiply(vec) {
362
- return this.assign(Vector3Utils.multiply(this, vec));
363
- }
364
- /**
365
- * rotateX
366
- *
367
- * Rotates the vector around the x axis counterclockwise (left hand rule)
368
- * @param a - Angle in radians
369
- */
370
- rotateX(a) {
371
- return this.assign(Vector3Utils.rotateX(this, a));
372
- }
373
- /**
374
- * rotateY
375
- *
376
- * Rotates the vector around the y axis counterclockwise (left hand rule)
377
- * @param a - Angle in radians
378
- */
379
- rotateY(a) {
380
- return this.assign(Vector3Utils.rotateY(this, a));
381
- }
382
- /**
383
- * rotateZ
384
- *
385
- * Rotates the vector around the z axis counterclockwise (left hand rule)
386
- * @param a - Angle in radians
387
- */
388
- rotateZ(a) {
389
- return this.assign(Vector3Utils.rotateZ(this, a));
390
- }
391
- };
392
- var Vector2Builder = class {
393
- constructor(first, y) {
394
- if (typeof first === "object") {
395
- this.x = first.x;
396
- this.y = first.y;
397
- } else {
398
- this.x = first;
399
- this.y = y ?? 0;
400
- }
401
- }
402
- toString(options) {
403
- return Vector2Utils.toString(this, options);
491
+ // lib/index.js
492
+ var require_lib = __commonJS({
493
+ "lib/index.js"(exports) {
494
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
495
+ if (k2 === void 0) k2 = k;
496
+ var desc = Object.getOwnPropertyDescriptor(m, k);
497
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
498
+ desc = { enumerable: true, get: function() {
499
+ return m[k];
500
+ } };
501
+ }
502
+ Object.defineProperty(o, k2, desc);
503
+ } : function(o, m, k, k2) {
504
+ if (k2 === void 0) k2 = k;
505
+ o[k2] = m[k];
506
+ });
507
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
508
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
509
+ };
510
+ Object.defineProperty(exports, "__esModule", { value: true });
511
+ __exportStar(require_vector3(), exports);
512
+ __exportStar(require_general(), exports);
404
513
  }
405
- };
406
- export {
407
- VECTOR3_BACK,
408
- VECTOR3_DOWN,
409
- VECTOR3_EAST,
410
- VECTOR3_FORWARD,
411
- VECTOR3_LEFT,
412
- VECTOR3_NORTH,
413
- VECTOR3_ONE,
414
- VECTOR3_RIGHT,
415
- VECTOR3_SOUTH,
416
- VECTOR3_UP,
417
- VECTOR3_WEST,
418
- VECTOR3_ZERO,
419
- Vector2Builder,
420
- Vector2Utils,
421
- Vector3Builder,
422
- Vector3Utils,
423
- clampNumber
424
- };
514
+ });
515
+ export default require_lib();
425
516
  //# sourceMappingURL=minecraft-math.js.map