@minecraft/math 2.2.11 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-report/math.api.md +127 -0
- package/dist/minecraft-math.d.ts +1034 -431
- package/dist/minecraft-math.js +833 -6
- package/dist/minecraft-math.js.map +3 -3
- package/lib/__mocks__/minecraft-server.js +17 -0
- package/lib/__mocks__/minecraft-server.js.map +1 -0
- package/lib/src/aabb/coreHelpers.js +282 -0
- package/lib/src/aabb/coreHelpers.js.map +1 -0
- package/lib/src/aabb/coreHelpers.test.js +227 -0
- package/lib/src/aabb/coreHelpers.test.js.map +1 -0
- package/lib/src/aabb/index.js +4 -0
- package/lib/src/aabb/index.js.map +1 -0
- package/lib/src/general/clamp.js.map +1 -0
- package/lib/src/general/index.js.map +1 -0
- package/lib/{index.js → src/index.js} +1 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/index.test.js.map +1 -0
- package/lib/{vector3 → src/vector3}/coreHelpers.js +294 -2
- package/lib/src/vector3/coreHelpers.js.map +1 -0
- package/lib/src/vector3/coreHelpers.test.js +578 -0
- package/lib/src/vector3/coreHelpers.test.js.map +1 -0
- package/lib/src/vector3/index.js.map +1 -0
- package/lib/src/vector3/vectorWrapper.js +509 -0
- package/lib/src/vector3/vectorWrapper.js.map +1 -0
- package/lib/src/vector3/vectorWrapper.test.js +575 -0
- package/lib/src/vector3/vectorWrapper.test.js.map +1 -0
- package/lib/types/math-beta.d.ts +1034 -431
- package/lib/types/math-public.d.ts +1034 -431
- package/lib/types/math.d.ts +1034 -431
- package/package.json +1 -1
- package/lib/general/clamp.js.map +0 -1
- package/lib/general/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/index.test.js.map +0 -1
- package/lib/vector3/coreHelpers.js.map +0 -1
- package/lib/vector3/coreHelpers.test.js +0 -264
- package/lib/vector3/coreHelpers.test.js.map +0 -1
- package/lib/vector3/index.js.map +0 -1
- package/lib/vector3/vectorWrapper.js +0 -230
- package/lib/vector3/vectorWrapper.js.map +0 -1
- package/lib/vector3/vectorWrapper.test.js +0 -228
- package/lib/vector3/vectorWrapper.test.js.map +0 -1
- /package/lib/{general → src/general}/clamp.js +0 -0
- /package/lib/{general → src/general}/index.js +0 -0
- /package/lib/{index.test.js → src/index.test.js} +0 -0
- /package/lib/{vector3 → src/vector3}/index.js +0 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { Vector2Utils, Vector3Utils, VectorXZUtils } from './coreHelpers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Vector3 wrapper class which can be used as a Vector3 for APIs on \@minecraft/server which require a Vector,
|
|
6
|
+
* but also contain additional helper methods. This is an alternative to using the core Vector 3 utility
|
|
7
|
+
* methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable
|
|
8
|
+
* and changes state inline.
|
|
9
|
+
*
|
|
10
|
+
* For an immutable version of the build, use ImmutableVector3Builder.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export class Vector3Builder {
|
|
15
|
+
x;
|
|
16
|
+
y;
|
|
17
|
+
z;
|
|
18
|
+
constructor(first, second, z) {
|
|
19
|
+
if (typeof first === 'object') {
|
|
20
|
+
this.x = first.x;
|
|
21
|
+
this.y = first.y;
|
|
22
|
+
this.z = first.z;
|
|
23
|
+
}
|
|
24
|
+
else if (typeof first === 'string') {
|
|
25
|
+
const parsed = Vector3Utils.fromString(first, second ?? ',');
|
|
26
|
+
if (!parsed) {
|
|
27
|
+
this.x = 0;
|
|
28
|
+
this.y = 0;
|
|
29
|
+
this.z = 0;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.x = parsed.x;
|
|
33
|
+
this.y = parsed.y;
|
|
34
|
+
this.z = parsed.z;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.x = first;
|
|
38
|
+
this.y = second ?? 0;
|
|
39
|
+
this.z = z ?? 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
44
|
+
*/
|
|
45
|
+
assign(vec) {
|
|
46
|
+
this.x = vec.x;
|
|
47
|
+
this.y = vec.y;
|
|
48
|
+
this.z = vec.z;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* equals
|
|
53
|
+
*
|
|
54
|
+
* Check the equality of two vectors
|
|
55
|
+
*/
|
|
56
|
+
equals(v) {
|
|
57
|
+
return Vector3Utils.equals(this, v);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* add
|
|
61
|
+
*
|
|
62
|
+
* Adds the vector v to this, returning itself.
|
|
63
|
+
*/
|
|
64
|
+
add(v) {
|
|
65
|
+
return this.assign(Vector3Utils.add(this, v));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* subtract
|
|
69
|
+
*
|
|
70
|
+
* Subtracts the vector v from this, returning itself.
|
|
71
|
+
*/
|
|
72
|
+
subtract(v) {
|
|
73
|
+
return this.assign(Vector3Utils.subtract(this, v));
|
|
74
|
+
}
|
|
75
|
+
/** scale
|
|
76
|
+
*
|
|
77
|
+
* Scales this by the passed in value, returning itself.
|
|
78
|
+
*/
|
|
79
|
+
scale(val) {
|
|
80
|
+
return this.assign(Vector3Utils.scale(this, val));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* dot
|
|
84
|
+
*
|
|
85
|
+
* Computes the dot product of this and the passed in vector.
|
|
86
|
+
*/
|
|
87
|
+
dot(vec) {
|
|
88
|
+
return Vector3Utils.dot(this, vec);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* cross
|
|
92
|
+
*
|
|
93
|
+
* Computes the cross product of this and the passed in vector, returning itself.
|
|
94
|
+
*/
|
|
95
|
+
cross(vec) {
|
|
96
|
+
return this.assign(Vector3Utils.cross(this, vec));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* magnitude
|
|
100
|
+
*
|
|
101
|
+
* The magnitude of the vector
|
|
102
|
+
*/
|
|
103
|
+
magnitude() {
|
|
104
|
+
return Vector3Utils.magnitude(this);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* distance
|
|
108
|
+
*
|
|
109
|
+
* Calculate the distance between two vectors
|
|
110
|
+
*/
|
|
111
|
+
distance(vec) {
|
|
112
|
+
return Vector3Utils.distance(this, vec);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* normalize
|
|
116
|
+
*
|
|
117
|
+
* Normalizes this vector, returning itself.
|
|
118
|
+
*/
|
|
119
|
+
normalize() {
|
|
120
|
+
return this.assign(Vector3Utils.normalize(this));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* floor
|
|
124
|
+
*
|
|
125
|
+
* Floor the components of a vector to produce a new vector
|
|
126
|
+
*/
|
|
127
|
+
floor() {
|
|
128
|
+
return this.assign(Vector3Utils.floor(this));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* ceil
|
|
132
|
+
*
|
|
133
|
+
* Ceil the components of a vector to produce a new vector
|
|
134
|
+
*/
|
|
135
|
+
ceil() {
|
|
136
|
+
return this.assign(Vector3Utils.ceil(this));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* min
|
|
140
|
+
*
|
|
141
|
+
* Min the components of two vectors to produce a new vector
|
|
142
|
+
*/
|
|
143
|
+
min(vec) {
|
|
144
|
+
return this.assign(Vector3Utils.min(this, vec));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* max
|
|
148
|
+
*
|
|
149
|
+
* Max the components of two vectors to produce a new vector
|
|
150
|
+
*/
|
|
151
|
+
max(vec) {
|
|
152
|
+
return this.assign(Vector3Utils.max(this, vec));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* toString
|
|
156
|
+
*
|
|
157
|
+
* Create a string representation of a vector
|
|
158
|
+
*/
|
|
159
|
+
toString(options) {
|
|
160
|
+
return Vector3Utils.toString(this, options);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* clamp
|
|
164
|
+
*
|
|
165
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
166
|
+
*/
|
|
167
|
+
clamp(limits) {
|
|
168
|
+
return this.assign(Vector3Utils.clamp(this, limits));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* lerp
|
|
172
|
+
*
|
|
173
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
174
|
+
*/
|
|
175
|
+
lerp(vec, t) {
|
|
176
|
+
return this.assign(Vector3Utils.lerp(this, vec, t));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* slerp
|
|
180
|
+
*
|
|
181
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
182
|
+
*/
|
|
183
|
+
slerp(vec, t) {
|
|
184
|
+
return this.assign(Vector3Utils.slerp(this, vec, t));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* multiply
|
|
188
|
+
*
|
|
189
|
+
* Element-wise multiplication of two vectors together.
|
|
190
|
+
* Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
|
|
191
|
+
*/
|
|
192
|
+
multiply(vec) {
|
|
193
|
+
return this.assign(Vector3Utils.multiply(this, vec));
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* rotateX
|
|
197
|
+
*
|
|
198
|
+
* Rotates the vector around the x axis counterclockwise (left hand rule)
|
|
199
|
+
* @param a - Angle in radians
|
|
200
|
+
*/
|
|
201
|
+
rotateX(a) {
|
|
202
|
+
return this.assign(Vector3Utils.rotateX(this, a));
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* rotateY
|
|
206
|
+
*
|
|
207
|
+
* Rotates the vector around the y axis counterclockwise (left hand rule)
|
|
208
|
+
* @param a - Angle in radians
|
|
209
|
+
*/
|
|
210
|
+
rotateY(a) {
|
|
211
|
+
return this.assign(Vector3Utils.rotateY(this, a));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* rotateZ
|
|
215
|
+
*
|
|
216
|
+
* Rotates the vector around the z axis counterclockwise (left hand rule)
|
|
217
|
+
* @param a - Angle in radians
|
|
218
|
+
*/
|
|
219
|
+
rotateZ(a) {
|
|
220
|
+
return this.assign(Vector3Utils.rotateZ(this, a));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Vector2 wrapper class which can be used as a Vector2 for APIs on \@minecraft/server which require a Vector2.
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
export class Vector2Builder {
|
|
228
|
+
x;
|
|
229
|
+
y;
|
|
230
|
+
constructor(first, second) {
|
|
231
|
+
if (typeof first === 'object') {
|
|
232
|
+
this.x = first.x;
|
|
233
|
+
this.y = first.y;
|
|
234
|
+
}
|
|
235
|
+
else if (typeof first === 'string') {
|
|
236
|
+
const parsed = Vector2Utils.fromString(first, second ?? ',');
|
|
237
|
+
if (!parsed) {
|
|
238
|
+
this.x = 0;
|
|
239
|
+
this.y = 0;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.x = parsed.x;
|
|
243
|
+
this.y = parsed.y;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this.x = first;
|
|
247
|
+
this.y = second ?? 0;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
toString(options) {
|
|
251
|
+
return Vector2Utils.toString(this, options);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
255
|
+
*/
|
|
256
|
+
assign(vec) {
|
|
257
|
+
this.x = vec.x;
|
|
258
|
+
this.y = vec.y;
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* equals
|
|
263
|
+
*
|
|
264
|
+
* Check the equality of two vectors
|
|
265
|
+
*/
|
|
266
|
+
equals(v) {
|
|
267
|
+
return Vector2Utils.equals(this, v);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* add
|
|
271
|
+
*
|
|
272
|
+
* Adds the vector v to this, returning itself.
|
|
273
|
+
*/
|
|
274
|
+
add(v) {
|
|
275
|
+
return this.assign(Vector2Utils.add(this, v));
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* subtract
|
|
279
|
+
*
|
|
280
|
+
* Subtracts the vector v from this, returning itself.
|
|
281
|
+
*/
|
|
282
|
+
subtract(v) {
|
|
283
|
+
return this.assign(Vector2Utils.subtract(this, v));
|
|
284
|
+
}
|
|
285
|
+
/** scale
|
|
286
|
+
*
|
|
287
|
+
* Scales this by the passed in value, returning itself.
|
|
288
|
+
*/
|
|
289
|
+
scale(val) {
|
|
290
|
+
return this.assign(Vector2Utils.scale(this, val));
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* dot
|
|
294
|
+
*
|
|
295
|
+
* Computes the dot product of this and the passed in vector.
|
|
296
|
+
*/
|
|
297
|
+
dot(vec) {
|
|
298
|
+
return Vector2Utils.dot(this, vec);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* magnitude
|
|
302
|
+
*
|
|
303
|
+
* The magnitude of the vector
|
|
304
|
+
*/
|
|
305
|
+
magnitude() {
|
|
306
|
+
return Vector2Utils.magnitude(this);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* distance
|
|
310
|
+
*
|
|
311
|
+
* Calculate the distance between two vectors
|
|
312
|
+
*/
|
|
313
|
+
distance(vec) {
|
|
314
|
+
return Vector2Utils.distance(this, vec);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* normalize
|
|
318
|
+
*
|
|
319
|
+
* Normalizes this vector, returning itself.
|
|
320
|
+
*/
|
|
321
|
+
normalize() {
|
|
322
|
+
return this.assign(Vector2Utils.normalize(this));
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* floor
|
|
326
|
+
*
|
|
327
|
+
* Floor the components of a vector to produce a new vector
|
|
328
|
+
*/
|
|
329
|
+
floor() {
|
|
330
|
+
return this.assign(Vector2Utils.floor(this));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* clamp
|
|
334
|
+
*
|
|
335
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
336
|
+
*/
|
|
337
|
+
clamp(limits) {
|
|
338
|
+
return this.assign(Vector2Utils.clamp(this, limits));
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* lerp
|
|
342
|
+
*
|
|
343
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
344
|
+
*/
|
|
345
|
+
lerp(vec, t) {
|
|
346
|
+
return this.assign(Vector2Utils.lerp(this, vec, t));
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* slerp
|
|
350
|
+
*
|
|
351
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
352
|
+
*/
|
|
353
|
+
slerp(vec, t) {
|
|
354
|
+
return this.assign(Vector2Utils.slerp(this, vec, t));
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* multiply
|
|
358
|
+
*
|
|
359
|
+
* Element-wise multiplication of two vectors together.
|
|
360
|
+
* Not to be confused with {@link Vector2Builder.dot} product
|
|
361
|
+
*/
|
|
362
|
+
multiply(vec) {
|
|
363
|
+
return this.assign(Vector2Utils.multiply(this, vec));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* VectorXZ wrapper class which can be used as a VectorXZ for APIs on \@minecraft/server which require a VectorXZ.
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
export class VectorXZBuilder {
|
|
371
|
+
x;
|
|
372
|
+
z;
|
|
373
|
+
constructor(first, second) {
|
|
374
|
+
if (typeof first === 'object') {
|
|
375
|
+
this.x = first.x;
|
|
376
|
+
this.z = first.z;
|
|
377
|
+
}
|
|
378
|
+
else if (typeof first === 'string') {
|
|
379
|
+
const parsed = VectorXZUtils.fromString(first, second ?? ',');
|
|
380
|
+
if (!parsed) {
|
|
381
|
+
this.x = 0;
|
|
382
|
+
this.z = 0;
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this.x = parsed.x;
|
|
386
|
+
this.z = parsed.z;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.x = first;
|
|
390
|
+
this.z = second ?? 0;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
toString(options) {
|
|
394
|
+
return VectorXZUtils.toString(this, options);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
398
|
+
*/
|
|
399
|
+
assign(vec) {
|
|
400
|
+
this.x = vec.x;
|
|
401
|
+
this.z = vec.z;
|
|
402
|
+
return this;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* equals
|
|
406
|
+
*
|
|
407
|
+
* Check the equality of two vectors
|
|
408
|
+
*/
|
|
409
|
+
equals(v) {
|
|
410
|
+
return VectorXZUtils.equals(this, v);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* add
|
|
414
|
+
*
|
|
415
|
+
* Adds the vector v to this, returning itself.
|
|
416
|
+
*/
|
|
417
|
+
add(v) {
|
|
418
|
+
return this.assign(VectorXZUtils.add(this, v));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* subtract
|
|
422
|
+
*
|
|
423
|
+
* Subtracts the vector v from this, returning itself.
|
|
424
|
+
*/
|
|
425
|
+
subtract(v) {
|
|
426
|
+
return this.assign(VectorXZUtils.subtract(this, v));
|
|
427
|
+
}
|
|
428
|
+
/** scale
|
|
429
|
+
*
|
|
430
|
+
* Scales this by the passed in value, returning itself.
|
|
431
|
+
*/
|
|
432
|
+
scale(val) {
|
|
433
|
+
return this.assign(VectorXZUtils.scale(this, val));
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* dot
|
|
437
|
+
*
|
|
438
|
+
* Computes the dot product of this and the passed in vector.
|
|
439
|
+
*/
|
|
440
|
+
dot(vec) {
|
|
441
|
+
return VectorXZUtils.dot(this, vec);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* magnitude
|
|
445
|
+
*
|
|
446
|
+
* The magnitude of the vector
|
|
447
|
+
*/
|
|
448
|
+
magnitude() {
|
|
449
|
+
return VectorXZUtils.magnitude(this);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* distance
|
|
453
|
+
*
|
|
454
|
+
* Calculate the distance between two vectors
|
|
455
|
+
*/
|
|
456
|
+
distance(vec) {
|
|
457
|
+
return VectorXZUtils.distance(this, vec);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* normalize
|
|
461
|
+
*
|
|
462
|
+
* Normalizes this vector, returning itself.
|
|
463
|
+
*/
|
|
464
|
+
normalize() {
|
|
465
|
+
return this.assign(VectorXZUtils.normalize(this));
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* floor
|
|
469
|
+
*
|
|
470
|
+
* Floor the components of a vector to produce a new vector
|
|
471
|
+
*/
|
|
472
|
+
floor() {
|
|
473
|
+
return this.assign(VectorXZUtils.floor(this));
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* clamp
|
|
477
|
+
*
|
|
478
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
479
|
+
*/
|
|
480
|
+
clamp(limits) {
|
|
481
|
+
return this.assign(VectorXZUtils.clamp(this, limits));
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* lerp
|
|
485
|
+
*
|
|
486
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
487
|
+
*/
|
|
488
|
+
lerp(vec, t) {
|
|
489
|
+
return this.assign(VectorXZUtils.lerp(this, vec, t));
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* slerp
|
|
493
|
+
*
|
|
494
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
495
|
+
*/
|
|
496
|
+
slerp(vec, t) {
|
|
497
|
+
return this.assign(VectorXZUtils.slerp(this, vec, t));
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* multiply
|
|
501
|
+
*
|
|
502
|
+
* Element-wise multiplication of two vectors together.
|
|
503
|
+
* Not to be confused with {@link VectorXZBuilder.dot} product
|
|
504
|
+
*/
|
|
505
|
+
multiply(vec) {
|
|
506
|
+
return this.assign(VectorXZUtils.multiply(this, vec));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
//# sourceMappingURL=vectorWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorWrapper.js","sourceRoot":"","sources":["../../../src/vector3/vectorWrapper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAc;IACvB,CAAC,CAAS;IACV,CAAC,CAAS;IACV,CAAC,CAAS;IAKV,YAAY,KAAgC,EAAE,MAAwB,EAAE,CAAU;QAC9E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QACrB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,EAAG,MAA6B,IAAI,GAAG,CAAC,CAAC;YACrF,IAAI,CAAC,MAAM,EAAE,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