@minecraft/math 2.2.10 → 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
package/lib/types/math-beta.d.ts
CHANGED
|
@@ -1,466 +1,1069 @@
|
|
|
1
|
+
import type { AABB } from '@minecraft/server';
|
|
2
|
+
import { BlockVolume } from '@minecraft/server';
|
|
1
3
|
import type { Vector2 } from '@minecraft/server';
|
|
2
4
|
import type { Vector3 } from '@minecraft/server';
|
|
5
|
+
import type { VectorXZ } from '@minecraft/server';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
8
|
+
* An error that is thrown when using an invalid AABB with AABBUtils operations.
|
|
6
9
|
*
|
|
7
10
|
* @public
|
|
8
11
|
*/
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* zero
|
|
13
|
-
*
|
|
14
|
-
* A vector representing the value of 0 in all directions (0,0)
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export declare const VECTOR2_ZERO: Vector2;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Vector2 wrapper class which can be used as a Vector2 for APIs on \@minecraft/server which require a Vector2.
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare class Vector2Builder implements Vector2 {
|
|
25
|
-
x: number;
|
|
26
|
-
y: number;
|
|
27
|
-
constructor(vecStr: string, delim?: string);
|
|
28
|
-
constructor(vec: Vector2, arg?: never);
|
|
29
|
-
constructor(x: number, y: number);
|
|
30
|
-
toString(options?: {
|
|
31
|
-
decimals?: number;
|
|
32
|
-
delimiter?: string;
|
|
33
|
-
}): string;
|
|
12
|
+
export declare class AABBInvalidExtentError extends Error {
|
|
13
|
+
constructor(extent: Vector3);
|
|
34
14
|
}
|
|
35
15
|
|
|
36
16
|
/**
|
|
37
|
-
* Utilities operating on
|
|
17
|
+
* Utilities operating on AABB objects. All methods are static and do not modify the input objects.
|
|
38
18
|
*
|
|
39
19
|
* @public
|
|
40
20
|
*/
|
|
41
|
-
export declare class
|
|
21
|
+
export declare class AABBUtils {
|
|
22
|
+
private constructor();
|
|
42
23
|
/**
|
|
43
|
-
*
|
|
24
|
+
* EPSILON
|
|
44
25
|
*
|
|
45
|
-
*
|
|
26
|
+
* The internal epsilon value that determines validity and used for block volume tolerance.
|
|
46
27
|
*/
|
|
47
|
-
static
|
|
48
|
-
decimals?: number;
|
|
49
|
-
delimiter?: string;
|
|
50
|
-
}): string;
|
|
28
|
+
static EPSILON: number;
|
|
51
29
|
/**
|
|
52
|
-
*
|
|
30
|
+
* createFromCornerPoints
|
|
53
31
|
*
|
|
54
|
-
* Gets
|
|
55
|
-
*
|
|
56
|
-
* @param
|
|
57
|
-
* @
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
32
|
+
* Gets an AABB from points defining it's corners, the order doesn't matter.
|
|
33
|
+
* @param pointA - The first corner point.
|
|
34
|
+
* @param pointB - The second corner point.
|
|
35
|
+
* @throws {@link AABBInvalidExtentError}
|
|
36
|
+
* This exception is thrown if the resulting AABB is invalid.
|
|
37
|
+
*
|
|
38
|
+
* @returns - The resulting AABB.
|
|
39
|
+
*/
|
|
40
|
+
static createFromCornerPoints(pointA: Vector3, pointB: Vector3): AABB;
|
|
41
|
+
/**
|
|
42
|
+
* isValid
|
|
43
|
+
*
|
|
44
|
+
* Determines if the AABB has non-zero extent on all axes.
|
|
45
|
+
* @param aabb - The AABB to test for validity.
|
|
46
|
+
* @returns - True if all extent axes are non-zero, otherwise false.
|
|
47
|
+
*/
|
|
48
|
+
static isValid(aabb: AABB): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* throwErrorIfInvalid
|
|
51
|
+
*
|
|
52
|
+
* Throws an error if the AABB is invalid.
|
|
53
|
+
* @param aabb - The AABB to test for validity.
|
|
54
|
+
* @throws {@link AABBInvalidExtentError}
|
|
55
|
+
* This exception is thrown if the input AABB is invalid.
|
|
56
|
+
*/
|
|
57
|
+
static throwErrorIfInvalid(aabb: AABB): void;
|
|
58
|
+
/**
|
|
59
|
+
* equals
|
|
60
|
+
*
|
|
61
|
+
* Compares the equality of two AABBs.
|
|
62
|
+
* @param aabb - The first AABB in the comparison.
|
|
63
|
+
* @param other - The second AABB in the comparison.
|
|
64
|
+
* @throws {@link AABBInvalidExtentError}
|
|
65
|
+
* This exception is thrown if either of the input AABBs are invalid.
|
|
66
|
+
*
|
|
67
|
+
* @returns - True if the center and extent of both AABBs are equal.
|
|
68
|
+
*/
|
|
69
|
+
static equals(aabb: AABB, other: AABB): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* getMin
|
|
72
|
+
*
|
|
73
|
+
* Gets the minimum corner of an AABB.
|
|
74
|
+
* @param aabb - The AABB to retrieve the minimum corner of.
|
|
75
|
+
* @throws {@link AABBInvalidExtentError}
|
|
76
|
+
* This exception is thrown if the input AABB is invalid.
|
|
77
|
+
*
|
|
78
|
+
* @returns - The minimum corner of the AABB.
|
|
79
|
+
*/
|
|
80
|
+
static getMin(aabb: AABB): Vector3;
|
|
81
|
+
/**
|
|
82
|
+
* getMax
|
|
83
|
+
*
|
|
84
|
+
* Gets the maximum corner of an AABB.
|
|
85
|
+
* @param aabb - The AABB to retrieve the maximum corner of.
|
|
86
|
+
* @throws {@link AABBInvalidExtentError}
|
|
87
|
+
* This exception is thrown if the input AABB is invalid.
|
|
88
|
+
*
|
|
89
|
+
* @returns - The maximum corner of the AABB.
|
|
90
|
+
*/
|
|
91
|
+
static getMax(aabb: AABB): Vector3;
|
|
92
|
+
/**
|
|
93
|
+
* getSpan
|
|
94
|
+
*
|
|
95
|
+
* Gets the span of an AABB.
|
|
96
|
+
* @param aabb - The AABB to retrieve the span of.
|
|
97
|
+
* @throws {@link AABBInvalidExtentError}
|
|
98
|
+
* This exception is thrown if the input AABB is invalid.
|
|
99
|
+
*
|
|
100
|
+
* @returns - The span of the AABB.
|
|
101
|
+
*/
|
|
102
|
+
static getSpan(aabb: AABB): Vector3;
|
|
103
|
+
/**
|
|
104
|
+
* getBlockVolume
|
|
105
|
+
*
|
|
106
|
+
* Creates the smallest BlockVolume that includes all of a source AABB.
|
|
107
|
+
* @param aabb - The source AABB.
|
|
108
|
+
* @throws {@link AABBInvalidExtentError}
|
|
109
|
+
* This exception is thrown if the input AABB is invalid.
|
|
110
|
+
*
|
|
111
|
+
* @returns - The BlockVolume containing the source AABB.
|
|
112
|
+
*/
|
|
113
|
+
static getBlockVolume(aabb: AABB): BlockVolume;
|
|
114
|
+
/**
|
|
115
|
+
* translate
|
|
116
|
+
*
|
|
117
|
+
* Creates a translated AABB given a source AABB and translation vector.
|
|
118
|
+
* @param aabb - The source AABB.
|
|
119
|
+
* @param delta - The translation vector to add to the AABBs center.
|
|
120
|
+
* @throws {@link AABBInvalidExtentError}
|
|
121
|
+
* This exception is thrown if the input AABB is invalid.
|
|
122
|
+
*
|
|
123
|
+
* @returns - The resulting translated AABB.
|
|
124
|
+
*/
|
|
125
|
+
static translate(aabb: AABB, delta: Vector3): AABB;
|
|
126
|
+
/**
|
|
127
|
+
* dilate
|
|
128
|
+
*
|
|
129
|
+
* Creates a dilated AABB given a source AABB and dilation vector.
|
|
130
|
+
* @param aabb - The source AABB.
|
|
131
|
+
* @param size - The dilation vector to add to the AABBs extent.
|
|
132
|
+
* @throws {@link AABBInvalidExtentError}
|
|
133
|
+
* This exception is thrown if the input AABB is invalid.
|
|
134
|
+
*
|
|
135
|
+
* @returns - The resulting dilated AABB.
|
|
136
|
+
*/
|
|
137
|
+
static dilate(aabb: AABB, size: Vector3): AABB;
|
|
138
|
+
/**
|
|
139
|
+
* expand
|
|
140
|
+
*
|
|
141
|
+
* Creates an expanded AABB given two source AABBs.
|
|
142
|
+
* @param aabb - The first source AABB.
|
|
143
|
+
* @param other - The second source AABB.
|
|
144
|
+
* @throws {@link AABBInvalidExtentError}
|
|
145
|
+
* This exception is thrown if either of the input AABBs are invalid.
|
|
146
|
+
*
|
|
147
|
+
* @returns - The resulting expanded AABB.
|
|
148
|
+
*/
|
|
149
|
+
static expand(aabb: AABB, other: AABB): AABB;
|
|
150
|
+
/**
|
|
151
|
+
* getIntersection
|
|
152
|
+
*
|
|
153
|
+
* Creates an AABB of the intersecting area of two source AABBs.
|
|
154
|
+
* @param aabb - The first source AABB.
|
|
155
|
+
* @param other - The second source AABB.
|
|
156
|
+
* @throws {@link AABBInvalidExtentError}
|
|
157
|
+
* This exception is thrown if either of the input AABBs are invalid.
|
|
158
|
+
*
|
|
159
|
+
* @returns - The resulting intersecting AABB if they intersect, otherwise returns undefined.
|
|
160
|
+
*/
|
|
161
|
+
static getIntersection(aabb: AABB, other: AABB): AABB | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* intersects
|
|
164
|
+
*
|
|
165
|
+
* Calculates if two AABBs are intersecting.
|
|
166
|
+
* @param aabb - The first AABB.
|
|
167
|
+
* @param other - The second AABB.
|
|
168
|
+
* @throws {@link AABBInvalidExtentError}
|
|
169
|
+
* This exception is thrown if either of the input AABBs are invalid.
|
|
170
|
+
*
|
|
171
|
+
* @returns - True if the AABBs are intersecting, otherwise false.
|
|
172
|
+
*/
|
|
173
|
+
static intersects(aabb: AABB, other: AABB): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* isInside
|
|
176
|
+
*
|
|
177
|
+
* Calculates if a position is inside of an AABB.
|
|
178
|
+
* @param aabb - The AABB to test against.
|
|
179
|
+
* @param pos - The position to test.
|
|
180
|
+
* @throws {@link AABBInvalidExtentError}
|
|
181
|
+
* This exception is thrown if the input AABB is invalid.
|
|
182
|
+
*
|
|
183
|
+
* @returns True if the position is inside of the AABB, otherwise returns false.
|
|
184
|
+
*/
|
|
185
|
+
static isInside(aabb: AABB, pos: Vector3): boolean;
|
|
186
|
+
}
|
|
61
187
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*/
|
|
69
|
-
export declare const VECTOR3_BACK: Vector3;
|
|
188
|
+
/**
|
|
189
|
+
* Clamps the passed in number to the passed in min and max values.
|
|
190
|
+
*
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
193
|
+
export declare function clampNumber(val: number, min: number, max: number): number;
|
|
70
194
|
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export declare const
|
|
195
|
+
/**
|
|
196
|
+
* zero
|
|
197
|
+
*
|
|
198
|
+
* A vector representing the value of 0 in all directions (0,0)
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
export declare const VECTOR2_ZERO: Vector2;
|
|
79
203
|
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Vector2 wrapper class which can be used as a Vector2 for APIs on \@minecraft/server which require a Vector2.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export declare class Vector2Builder implements Vector2 {
|
|
209
|
+
x: number;
|
|
210
|
+
y: number;
|
|
211
|
+
constructor(vecStr: string, delim?: string);
|
|
212
|
+
constructor(vec: Vector2, arg?: never);
|
|
213
|
+
constructor(x: number, y: number);
|
|
214
|
+
toString(options?: {
|
|
215
|
+
decimals?: number;
|
|
216
|
+
delimiter?: string;
|
|
217
|
+
}): string;
|
|
218
|
+
/**
|
|
219
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
220
|
+
*/
|
|
221
|
+
assign(vec: Vector2): this;
|
|
222
|
+
/**
|
|
223
|
+
* equals
|
|
224
|
+
*
|
|
225
|
+
* Check the equality of two vectors
|
|
226
|
+
*/
|
|
227
|
+
equals(v: Vector2): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* add
|
|
230
|
+
*
|
|
231
|
+
* Adds the vector v to this, returning itself.
|
|
232
|
+
*/
|
|
233
|
+
add(v: Partial<Vector2>): this;
|
|
234
|
+
/**
|
|
235
|
+
* subtract
|
|
236
|
+
*
|
|
237
|
+
* Subtracts the vector v from this, returning itself.
|
|
238
|
+
*/
|
|
239
|
+
subtract(v: Partial<Vector2>): this;
|
|
240
|
+
/** scale
|
|
241
|
+
*
|
|
242
|
+
* Scales this by the passed in value, returning itself.
|
|
243
|
+
*/
|
|
244
|
+
scale(val: number): this;
|
|
245
|
+
/**
|
|
246
|
+
* dot
|
|
247
|
+
*
|
|
248
|
+
* Computes the dot product of this and the passed in vector.
|
|
249
|
+
*/
|
|
250
|
+
dot(vec: Vector2): number;
|
|
251
|
+
/**
|
|
252
|
+
* magnitude
|
|
253
|
+
*
|
|
254
|
+
* The magnitude of the vector
|
|
255
|
+
*/
|
|
256
|
+
magnitude(): number;
|
|
257
|
+
/**
|
|
258
|
+
* distance
|
|
259
|
+
*
|
|
260
|
+
* Calculate the distance between two vectors
|
|
261
|
+
*/
|
|
262
|
+
distance(vec: Vector2): number;
|
|
263
|
+
/**
|
|
264
|
+
* normalize
|
|
265
|
+
*
|
|
266
|
+
* Normalizes this vector, returning itself.
|
|
267
|
+
*/
|
|
268
|
+
normalize(): this;
|
|
269
|
+
/**
|
|
270
|
+
* floor
|
|
271
|
+
*
|
|
272
|
+
* Floor the components of a vector to produce a new vector
|
|
273
|
+
*/
|
|
274
|
+
floor(): this;
|
|
275
|
+
/**
|
|
276
|
+
* clamp
|
|
277
|
+
*
|
|
278
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
279
|
+
*/
|
|
280
|
+
clamp(limits: {
|
|
281
|
+
min?: Partial<Vector2>;
|
|
282
|
+
max?: Partial<Vector2>;
|
|
283
|
+
}): this;
|
|
284
|
+
/**
|
|
285
|
+
* lerp
|
|
286
|
+
*
|
|
287
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
288
|
+
*/
|
|
289
|
+
lerp(vec: Vector2, t: number): this;
|
|
290
|
+
/**
|
|
291
|
+
* slerp
|
|
292
|
+
*
|
|
293
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
294
|
+
*/
|
|
295
|
+
slerp(vec: Vector2, t: number): this;
|
|
296
|
+
/**
|
|
297
|
+
* multiply
|
|
298
|
+
*
|
|
299
|
+
* Element-wise multiplication of two vectors together.
|
|
300
|
+
* Not to be confused with {@link Vector2Builder.dot} product
|
|
301
|
+
*/
|
|
302
|
+
multiply(vec: Vector2): this;
|
|
303
|
+
}
|
|
89
304
|
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Utilities operating on Vector2 objects. All methods are static and do not modify the input objects.
|
|
307
|
+
*
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
310
|
+
export declare class Vector2Utils {
|
|
311
|
+
/**
|
|
312
|
+
* equals
|
|
313
|
+
*
|
|
314
|
+
* Check the equality of two vectors
|
|
315
|
+
*/
|
|
316
|
+
static equals(v1: Vector2, v2: Vector2): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* add
|
|
319
|
+
*
|
|
320
|
+
* Add two vectors to produce a new vector
|
|
321
|
+
*/
|
|
322
|
+
static add(v1: Vector2, v2: Partial<Vector2>): Vector2;
|
|
323
|
+
/**
|
|
324
|
+
* subtract
|
|
325
|
+
*
|
|
326
|
+
* Subtract two vectors to produce a new vector (v1-v2)
|
|
327
|
+
*/
|
|
328
|
+
static subtract(v1: Vector2, v2: Partial<Vector2>): Vector2;
|
|
329
|
+
/** scale
|
|
330
|
+
*
|
|
331
|
+
* Multiple all entries in a vector by a single scalar value producing a new vector
|
|
332
|
+
*/
|
|
333
|
+
static scale(v1: Vector2, scale: number): Vector2;
|
|
334
|
+
/**
|
|
335
|
+
* dot
|
|
336
|
+
*
|
|
337
|
+
* Calculate the dot product of two vectors
|
|
338
|
+
*/
|
|
339
|
+
static dot(a: Vector2, b: Vector2): number;
|
|
340
|
+
/**
|
|
341
|
+
* magnitude
|
|
342
|
+
*
|
|
343
|
+
* The magnitude of a vector
|
|
344
|
+
*/
|
|
345
|
+
static magnitude(v: Vector2): number;
|
|
346
|
+
/**
|
|
347
|
+
* distance
|
|
348
|
+
*
|
|
349
|
+
* Calculate the distance between two vectors
|
|
350
|
+
*/
|
|
351
|
+
static distance(a: Vector2, b: Vector2): number;
|
|
352
|
+
/**
|
|
353
|
+
* normalize
|
|
354
|
+
*
|
|
355
|
+
* Takes a vector 3 and normalizes it to a unit vector
|
|
356
|
+
*/
|
|
357
|
+
static normalize(v: Vector2): Vector2;
|
|
358
|
+
/**
|
|
359
|
+
* floor
|
|
360
|
+
*
|
|
361
|
+
* Floor the components of a vector to produce a new vector
|
|
362
|
+
*/
|
|
363
|
+
static floor(v: Vector2): Vector2;
|
|
364
|
+
/**
|
|
365
|
+
* toString
|
|
366
|
+
*
|
|
367
|
+
* Create a string representation of a vector2
|
|
368
|
+
*/
|
|
369
|
+
static toString(v: Vector2, options?: {
|
|
370
|
+
decimals?: number;
|
|
371
|
+
delimiter?: string;
|
|
372
|
+
}): string;
|
|
373
|
+
/**
|
|
374
|
+
* fromString
|
|
375
|
+
*
|
|
376
|
+
* Gets a Vector2 from the string representation produced by {@link Vector2Utils.toString}. If any numeric value is not a number
|
|
377
|
+
* or the format is invalid, undefined is returned.
|
|
378
|
+
* @param str - The string to parse
|
|
379
|
+
* @param delimiter - The delimiter used to separate the components. Defaults to the same as the default for {@link Vector2Utils.toString}
|
|
380
|
+
*/
|
|
381
|
+
static fromString(str: string, delimiter?: string): Vector2 | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* clamp
|
|
384
|
+
*
|
|
385
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
386
|
+
*/
|
|
387
|
+
static clamp(v: Vector2, limits?: {
|
|
388
|
+
min?: Partial<Vector2>;
|
|
389
|
+
max?: Partial<Vector2>;
|
|
390
|
+
}): Vector2;
|
|
391
|
+
/**
|
|
392
|
+
* lerp
|
|
393
|
+
*
|
|
394
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
395
|
+
*/
|
|
396
|
+
static lerp(a: Vector2, b: Vector2, t: number): Vector2;
|
|
397
|
+
/**
|
|
398
|
+
* slerp
|
|
399
|
+
*
|
|
400
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
401
|
+
*/
|
|
402
|
+
static slerp(a: Vector2, b: Vector2, t: number): Vector2;
|
|
403
|
+
/**
|
|
404
|
+
* multiply
|
|
405
|
+
*
|
|
406
|
+
* Element-wise multiplication of two vectors together.
|
|
407
|
+
* Not to be confused with {@link Vector2Utils.dot} product
|
|
408
|
+
*/
|
|
409
|
+
static multiply(a: Vector2, b: Vector2): Vector2;
|
|
410
|
+
}
|
|
98
411
|
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
export declare const
|
|
412
|
+
/**
|
|
413
|
+
* back
|
|
414
|
+
*
|
|
415
|
+
* A unit vector representing the world BACK direction (0,0,-1)
|
|
416
|
+
*
|
|
417
|
+
* @public
|
|
418
|
+
*/
|
|
419
|
+
export declare const VECTOR3_BACK: Vector3;
|
|
107
420
|
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
export declare const
|
|
421
|
+
/**
|
|
422
|
+
* down
|
|
423
|
+
*
|
|
424
|
+
* A unit vector representing the world DOWN direction (0,-1,0)
|
|
425
|
+
*
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
export declare const VECTOR3_DOWN: Vector3;
|
|
116
429
|
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
430
|
+
/**
|
|
431
|
+
* east
|
|
432
|
+
*
|
|
433
|
+
* A unit vector representing the world EAST direction (-1,0,0)
|
|
434
|
+
* (same as RIGHT)
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
438
|
+
export declare const VECTOR3_EAST: Vector3;
|
|
125
439
|
|
|
126
|
-
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
export declare const VECTOR3_NORTH: Vector3;
|
|
440
|
+
/**
|
|
441
|
+
* forward
|
|
442
|
+
*
|
|
443
|
+
* A unit vector representing the world FORWARD direction (0,0,1)
|
|
444
|
+
*
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
447
|
+
export declare const VECTOR3_FORWARD: Vector3;
|
|
135
448
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export declare const
|
|
449
|
+
/**
|
|
450
|
+
* half
|
|
451
|
+
*
|
|
452
|
+
* A unit vector representing the value of 0.5 in all directions (0.5,0.5,0.5)
|
|
453
|
+
*
|
|
454
|
+
* @public
|
|
455
|
+
*/
|
|
456
|
+
export declare const VECTOR3_HALF: Vector3;
|
|
144
457
|
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export declare const
|
|
458
|
+
/**
|
|
459
|
+
* left
|
|
460
|
+
*
|
|
461
|
+
* A unit vector representing the world LEFT direction (-1,0,0)
|
|
462
|
+
*
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
export declare const VECTOR3_LEFT: Vector3;
|
|
153
466
|
|
|
154
|
-
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
export declare const VECTOR3_SOUTH: Vector3;
|
|
467
|
+
/**
|
|
468
|
+
* negative
|
|
469
|
+
*
|
|
470
|
+
* A unit vector representing the value of -1 in all directions (-1,-1,-1)
|
|
471
|
+
*
|
|
472
|
+
* @public
|
|
473
|
+
*/
|
|
474
|
+
export declare const VECTOR3_NEGATIVE_ONE: Vector3;
|
|
163
475
|
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
476
|
+
/**
|
|
477
|
+
* north
|
|
478
|
+
*
|
|
479
|
+
* A unit vector representing the world NORTH direction (-1,0,0)
|
|
480
|
+
* (same as FORWARD)
|
|
481
|
+
*
|
|
482
|
+
* @public
|
|
483
|
+
*/
|
|
484
|
+
export declare const VECTOR3_NORTH: Vector3;
|
|
172
485
|
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
export declare const VECTOR3_WEST: Vector3;
|
|
486
|
+
/**
|
|
487
|
+
* one
|
|
488
|
+
*
|
|
489
|
+
* A unit vector representing the value of 1 in all directions (1,1,1)
|
|
490
|
+
*
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
493
|
+
export declare const VECTOR3_ONE: Vector3;
|
|
182
494
|
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
export declare const
|
|
495
|
+
/**
|
|
496
|
+
* right
|
|
497
|
+
*
|
|
498
|
+
* A unit vector representing the world RIGHT direction (1,0,0)
|
|
499
|
+
*
|
|
500
|
+
* @public
|
|
501
|
+
*/
|
|
502
|
+
export declare const VECTOR3_RIGHT: Vector3;
|
|
191
503
|
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*/
|
|
202
|
-
export declare class Vector3Builder implements Vector3 {
|
|
203
|
-
x: number;
|
|
204
|
-
y: number;
|
|
205
|
-
z: number;
|
|
206
|
-
constructor(vecStr: string, delim?: string, arg2?: never);
|
|
207
|
-
constructor(vec: Vector3, arg?: never, arg2?: never);
|
|
208
|
-
constructor(x: number, y: number, z: number);
|
|
209
|
-
/**
|
|
210
|
-
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
211
|
-
*/
|
|
212
|
-
assign(vec: Vector3): this;
|
|
213
|
-
/**
|
|
214
|
-
* equals
|
|
215
|
-
*
|
|
216
|
-
* Check the equality of two vectors
|
|
217
|
-
*/
|
|
218
|
-
equals(v: Vector3): boolean;
|
|
219
|
-
/**
|
|
220
|
-
* add
|
|
221
|
-
*
|
|
222
|
-
* Adds the vector v to this, returning itself.
|
|
223
|
-
*/
|
|
224
|
-
add(v: Partial<Vector3>): this;
|
|
225
|
-
/**
|
|
226
|
-
* subtract
|
|
227
|
-
*
|
|
228
|
-
* Subtracts the vector v from this, returning itself.
|
|
229
|
-
*/
|
|
230
|
-
subtract(v: Partial<Vector3>): this;
|
|
231
|
-
/** scale
|
|
232
|
-
*
|
|
233
|
-
* Scales this by the passed in value, returning itself.
|
|
234
|
-
*/
|
|
235
|
-
scale(val: number): this;
|
|
236
|
-
/**
|
|
237
|
-
* dot
|
|
238
|
-
*
|
|
239
|
-
* Computes the dot product of this and the passed in vector.
|
|
240
|
-
*/
|
|
241
|
-
dot(vec: Vector3): number;
|
|
242
|
-
/**
|
|
243
|
-
* cross
|
|
244
|
-
*
|
|
245
|
-
* Computes the cross product of this and the passed in vector, returning itself.
|
|
246
|
-
*/
|
|
247
|
-
cross(vec: Vector3): this;
|
|
248
|
-
/**
|
|
249
|
-
* magnitude
|
|
250
|
-
*
|
|
251
|
-
* The magnitude of the vector
|
|
252
|
-
*/
|
|
253
|
-
magnitude(): number;
|
|
254
|
-
/**
|
|
255
|
-
* distance
|
|
256
|
-
*
|
|
257
|
-
* Calculate the distance between two vectors
|
|
258
|
-
*/
|
|
259
|
-
distance(vec: Vector3): number;
|
|
260
|
-
/**
|
|
261
|
-
* normalize
|
|
262
|
-
*
|
|
263
|
-
* Normalizes this vector, returning itself.
|
|
264
|
-
*/
|
|
265
|
-
normalize(): this;
|
|
266
|
-
/**
|
|
267
|
-
* floor
|
|
268
|
-
*
|
|
269
|
-
* Floor the components of a vector to produce a new vector
|
|
270
|
-
*/
|
|
271
|
-
floor(): this;
|
|
272
|
-
/**
|
|
273
|
-
* toString
|
|
274
|
-
*
|
|
275
|
-
* Create a string representation of a vector
|
|
276
|
-
*/
|
|
277
|
-
toString(options?: {
|
|
278
|
-
decimals?: number;
|
|
279
|
-
delimiter?: string;
|
|
280
|
-
}): string;
|
|
281
|
-
/**
|
|
282
|
-
* clamp
|
|
283
|
-
*
|
|
284
|
-
* Clamps the components of a vector to limits to produce a new vector
|
|
285
|
-
*/
|
|
286
|
-
clamp(limits: {
|
|
287
|
-
min?: Partial<Vector3>;
|
|
288
|
-
max?: Partial<Vector3>;
|
|
289
|
-
}): this;
|
|
290
|
-
/**
|
|
291
|
-
* lerp
|
|
292
|
-
*
|
|
293
|
-
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
294
|
-
*/
|
|
295
|
-
lerp(vec: Vector3, t: number): this;
|
|
296
|
-
/**
|
|
297
|
-
* slerp
|
|
298
|
-
*
|
|
299
|
-
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
300
|
-
*/
|
|
301
|
-
slerp(vec: Vector3, t: number): this;
|
|
302
|
-
/**
|
|
303
|
-
* multiply
|
|
304
|
-
*
|
|
305
|
-
* Element-wise multiplication of two vectors together.
|
|
306
|
-
* Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
|
|
307
|
-
*/
|
|
308
|
-
multiply(vec: Vector3): this;
|
|
309
|
-
/**
|
|
310
|
-
* rotateX
|
|
311
|
-
*
|
|
312
|
-
* Rotates the vector around the x axis counterclockwise (left hand rule)
|
|
313
|
-
* @param a - Angle in radians
|
|
314
|
-
*/
|
|
315
|
-
rotateX(a: number): this;
|
|
316
|
-
/**
|
|
317
|
-
* rotateY
|
|
318
|
-
*
|
|
319
|
-
* Rotates the vector around the y axis counterclockwise (left hand rule)
|
|
320
|
-
* @param a - Angle in radians
|
|
321
|
-
*/
|
|
322
|
-
rotateY(a: number): this;
|
|
323
|
-
/**
|
|
324
|
-
* rotateZ
|
|
325
|
-
*
|
|
326
|
-
* Rotates the vector around the z axis counterclockwise (left hand rule)
|
|
327
|
-
* @param a - Angle in radians
|
|
328
|
-
*/
|
|
329
|
-
rotateZ(a: number): this;
|
|
330
|
-
}
|
|
504
|
+
/**
|
|
505
|
+
* south
|
|
506
|
+
*
|
|
507
|
+
* A unit vector representing the world SOUTH direction (-1,0,0)
|
|
508
|
+
* (same as BACK)
|
|
509
|
+
*
|
|
510
|
+
* @public
|
|
511
|
+
*/
|
|
512
|
+
export declare const VECTOR3_SOUTH: Vector3;
|
|
331
513
|
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
514
|
+
/**
|
|
515
|
+
* up
|
|
516
|
+
*
|
|
517
|
+
* A unit vector representing the world UP direction (0,1,0)
|
|
518
|
+
*
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
export declare const VECTOR3_UP: Vector3;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* west
|
|
525
|
+
*
|
|
526
|
+
* A unit vector representing the world WEST direction (-1,0,0)
|
|
527
|
+
* (same as LEFT)
|
|
528
|
+
*
|
|
529
|
+
* @public
|
|
530
|
+
*/
|
|
531
|
+
export declare const VECTOR3_WEST: Vector3;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* zero
|
|
535
|
+
*
|
|
536
|
+
* A unit vector representing the value of 0 in all directions (0,0,0)
|
|
537
|
+
*
|
|
538
|
+
* @public
|
|
539
|
+
*/
|
|
540
|
+
export declare const VECTOR3_ZERO: Vector3;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Vector3 wrapper class which can be used as a Vector3 for APIs on \@minecraft/server which require a Vector,
|
|
544
|
+
* but also contain additional helper methods. This is an alternative to using the core Vector 3 utility
|
|
545
|
+
* methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable
|
|
546
|
+
* and changes state inline.
|
|
547
|
+
*
|
|
548
|
+
* For an immutable version of the build, use ImmutableVector3Builder.
|
|
549
|
+
*
|
|
550
|
+
* @public
|
|
551
|
+
*/
|
|
552
|
+
export declare class Vector3Builder implements Vector3 {
|
|
553
|
+
x: number;
|
|
554
|
+
y: number;
|
|
555
|
+
z: number;
|
|
556
|
+
constructor(vecStr: string, delim?: string, arg2?: never);
|
|
557
|
+
constructor(vec: Vector3, arg?: never, arg2?: never);
|
|
558
|
+
constructor(x: number, y: number, z: number);
|
|
559
|
+
/**
|
|
560
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
561
|
+
*/
|
|
562
|
+
assign(vec: Vector3): this;
|
|
563
|
+
/**
|
|
564
|
+
* equals
|
|
565
|
+
*
|
|
566
|
+
* Check the equality of two vectors
|
|
567
|
+
*/
|
|
568
|
+
equals(v: Vector3): boolean;
|
|
569
|
+
/**
|
|
570
|
+
* add
|
|
571
|
+
*
|
|
572
|
+
* Adds the vector v to this, returning itself.
|
|
573
|
+
*/
|
|
574
|
+
add(v: Partial<Vector3>): this;
|
|
575
|
+
/**
|
|
576
|
+
* subtract
|
|
577
|
+
*
|
|
578
|
+
* Subtracts the vector v from this, returning itself.
|
|
579
|
+
*/
|
|
580
|
+
subtract(v: Partial<Vector3>): this;
|
|
581
|
+
/** scale
|
|
582
|
+
*
|
|
583
|
+
* Scales this by the passed in value, returning itself.
|
|
584
|
+
*/
|
|
585
|
+
scale(val: number): this;
|
|
586
|
+
/**
|
|
587
|
+
* dot
|
|
588
|
+
*
|
|
589
|
+
* Computes the dot product of this and the passed in vector.
|
|
590
|
+
*/
|
|
591
|
+
dot(vec: Vector3): number;
|
|
592
|
+
/**
|
|
593
|
+
* cross
|
|
594
|
+
*
|
|
595
|
+
* Computes the cross product of this and the passed in vector, returning itself.
|
|
596
|
+
*/
|
|
597
|
+
cross(vec: Vector3): this;
|
|
598
|
+
/**
|
|
599
|
+
* magnitude
|
|
600
|
+
*
|
|
601
|
+
* The magnitude of the vector
|
|
602
|
+
*/
|
|
603
|
+
magnitude(): number;
|
|
604
|
+
/**
|
|
605
|
+
* distance
|
|
606
|
+
*
|
|
607
|
+
* Calculate the distance between two vectors
|
|
608
|
+
*/
|
|
609
|
+
distance(vec: Vector3): number;
|
|
610
|
+
/**
|
|
611
|
+
* normalize
|
|
612
|
+
*
|
|
613
|
+
* Normalizes this vector, returning itself.
|
|
614
|
+
*/
|
|
615
|
+
normalize(): this;
|
|
616
|
+
/**
|
|
617
|
+
* floor
|
|
618
|
+
*
|
|
619
|
+
* Floor the components of a vector to produce a new vector
|
|
620
|
+
*/
|
|
621
|
+
floor(): this;
|
|
622
|
+
/**
|
|
623
|
+
* ceil
|
|
624
|
+
*
|
|
625
|
+
* Ceil the components of a vector to produce a new vector
|
|
626
|
+
*/
|
|
627
|
+
ceil(): this;
|
|
628
|
+
/**
|
|
629
|
+
* min
|
|
630
|
+
*
|
|
631
|
+
* Min the components of two vectors to produce a new vector
|
|
632
|
+
*/
|
|
633
|
+
min(vec: Vector3): this;
|
|
634
|
+
/**
|
|
635
|
+
* max
|
|
636
|
+
*
|
|
637
|
+
* Max the components of two vectors to produce a new vector
|
|
638
|
+
*/
|
|
639
|
+
max(vec: Vector3): this;
|
|
640
|
+
/**
|
|
641
|
+
* toString
|
|
642
|
+
*
|
|
643
|
+
* Create a string representation of a vector
|
|
644
|
+
*/
|
|
645
|
+
toString(options?: {
|
|
646
|
+
decimals?: number;
|
|
647
|
+
delimiter?: string;
|
|
648
|
+
}): string;
|
|
649
|
+
/**
|
|
650
|
+
* clamp
|
|
651
|
+
*
|
|
652
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
653
|
+
*/
|
|
654
|
+
clamp(limits: {
|
|
655
|
+
min?: Partial<Vector3>;
|
|
656
|
+
max?: Partial<Vector3>;
|
|
657
|
+
}): this;
|
|
658
|
+
/**
|
|
659
|
+
* lerp
|
|
660
|
+
*
|
|
661
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
662
|
+
*/
|
|
663
|
+
lerp(vec: Vector3, t: number): this;
|
|
664
|
+
/**
|
|
665
|
+
* slerp
|
|
666
|
+
*
|
|
667
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
668
|
+
*/
|
|
669
|
+
slerp(vec: Vector3, t: number): this;
|
|
670
|
+
/**
|
|
671
|
+
* multiply
|
|
672
|
+
*
|
|
673
|
+
* Element-wise multiplication of two vectors together.
|
|
674
|
+
* Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
|
|
675
|
+
*/
|
|
676
|
+
multiply(vec: Vector3): this;
|
|
677
|
+
/**
|
|
678
|
+
* rotateX
|
|
679
|
+
*
|
|
680
|
+
* Rotates the vector around the x axis counterclockwise (left hand rule)
|
|
681
|
+
* @param a - Angle in radians
|
|
682
|
+
*/
|
|
683
|
+
rotateX(a: number): this;
|
|
684
|
+
/**
|
|
685
|
+
* rotateY
|
|
686
|
+
*
|
|
687
|
+
* Rotates the vector around the y axis counterclockwise (left hand rule)
|
|
688
|
+
* @param a - Angle in radians
|
|
689
|
+
*/
|
|
690
|
+
rotateY(a: number): this;
|
|
691
|
+
/**
|
|
692
|
+
* rotateZ
|
|
693
|
+
*
|
|
694
|
+
* Rotates the vector around the z axis counterclockwise (left hand rule)
|
|
695
|
+
* @param a - Angle in radians
|
|
696
|
+
*/
|
|
697
|
+
rotateZ(a: number): this;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Utilities operating on Vector3 objects. All methods are static and do not modify the input objects.
|
|
702
|
+
*
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export declare class Vector3Utils {
|
|
706
|
+
/**
|
|
707
|
+
* equals
|
|
708
|
+
*
|
|
709
|
+
* Check the equality of two vectors
|
|
710
|
+
*/
|
|
711
|
+
static equals(v1: Vector3, v2: Vector3): boolean;
|
|
712
|
+
/**
|
|
713
|
+
* add
|
|
714
|
+
*
|
|
715
|
+
* Add two vectors to produce a new vector
|
|
716
|
+
*/
|
|
717
|
+
static add(v1: Vector3, v2: Partial<Vector3>): Vector3;
|
|
718
|
+
/**
|
|
719
|
+
* subtract
|
|
720
|
+
*
|
|
721
|
+
* Subtract two vectors to produce a new vector (v1-v2)
|
|
722
|
+
*/
|
|
723
|
+
static subtract(v1: Vector3, v2: Partial<Vector3>): Vector3;
|
|
724
|
+
/** scale
|
|
725
|
+
*
|
|
726
|
+
* Multiple all entries in a vector by a single scalar value producing a new vector
|
|
727
|
+
*/
|
|
728
|
+
static scale(v1: Vector3, scale: number): Vector3;
|
|
729
|
+
/**
|
|
730
|
+
* dot
|
|
731
|
+
*
|
|
732
|
+
* Calculate the dot product of two vectors
|
|
733
|
+
*/
|
|
734
|
+
static dot(a: Vector3, b: Vector3): number;
|
|
735
|
+
/**
|
|
736
|
+
* cross
|
|
737
|
+
*
|
|
738
|
+
* Calculate the cross product of two vectors. Returns a new vector.
|
|
739
|
+
*/
|
|
740
|
+
static cross(a: Vector3, b: Vector3): Vector3;
|
|
741
|
+
/**
|
|
742
|
+
* magnitude
|
|
743
|
+
*
|
|
744
|
+
* The magnitude of a vector
|
|
745
|
+
*/
|
|
746
|
+
static magnitude(v: Vector3): number;
|
|
747
|
+
/**
|
|
748
|
+
* distance
|
|
749
|
+
*
|
|
750
|
+
* Calculate the distance between two vectors
|
|
751
|
+
*/
|
|
752
|
+
static distance(a: Vector3, b: Vector3): number;
|
|
753
|
+
/**
|
|
754
|
+
* normalize
|
|
755
|
+
*
|
|
756
|
+
* Takes a vector 3 and normalizes it to a unit vector
|
|
757
|
+
*/
|
|
758
|
+
static normalize(v: Vector3): Vector3;
|
|
759
|
+
/**
|
|
760
|
+
* floor
|
|
761
|
+
*
|
|
762
|
+
* Floor the components of a vector to produce a new vector
|
|
763
|
+
*/
|
|
764
|
+
static floor(v: Vector3): Vector3;
|
|
765
|
+
/**
|
|
766
|
+
* ceil
|
|
767
|
+
*
|
|
768
|
+
* Ceil the components of a vector to produce a new vector
|
|
769
|
+
*/
|
|
770
|
+
static ceil(v: Vector3): Vector3;
|
|
771
|
+
/**
|
|
772
|
+
* min
|
|
773
|
+
*
|
|
774
|
+
* Min the components of two vectors to produce a new vector
|
|
775
|
+
*/
|
|
776
|
+
static min(a: Vector3, b: Vector3): Vector3;
|
|
777
|
+
/**
|
|
778
|
+
* max
|
|
779
|
+
*
|
|
780
|
+
* Max the components of two vectors to produce a new vector
|
|
781
|
+
*/
|
|
782
|
+
static max(a: Vector3, b: Vector3): Vector3;
|
|
783
|
+
/**
|
|
784
|
+
* toString
|
|
785
|
+
*
|
|
786
|
+
* Create a string representation of a vector3
|
|
787
|
+
*/
|
|
788
|
+
static toString(v: Vector3, options?: {
|
|
789
|
+
decimals?: number;
|
|
790
|
+
delimiter?: string;
|
|
791
|
+
}): string;
|
|
792
|
+
/**
|
|
793
|
+
* fromString
|
|
794
|
+
*
|
|
795
|
+
* Gets a Vector3 from the string representation produced by {@link Vector3Utils.toString}. If any numeric value is not a number
|
|
796
|
+
* or the format is invalid, undefined is returned.
|
|
797
|
+
* @param str - The string to parse
|
|
798
|
+
* @param delimiter - The delimiter used to separate the components. Defaults to the same as the default for {@link Vector3Utils.toString}
|
|
799
|
+
*/
|
|
800
|
+
static fromString(str: string, delimiter?: string): Vector3 | undefined;
|
|
801
|
+
/**
|
|
802
|
+
* clamp
|
|
803
|
+
*
|
|
804
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
805
|
+
*/
|
|
806
|
+
static clamp(v: Vector3, limits?: {
|
|
807
|
+
min?: Partial<Vector3>;
|
|
808
|
+
max?: Partial<Vector3>;
|
|
809
|
+
}): Vector3;
|
|
810
|
+
/**
|
|
811
|
+
* lerp
|
|
812
|
+
*
|
|
813
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
814
|
+
*/
|
|
815
|
+
static lerp(a: Vector3, b: Vector3, t: number): Vector3;
|
|
816
|
+
/**
|
|
817
|
+
* slerp
|
|
818
|
+
*
|
|
819
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
820
|
+
*/
|
|
821
|
+
static slerp(a: Vector3, b: Vector3, t: number): Vector3;
|
|
822
|
+
/**
|
|
823
|
+
* multiply
|
|
824
|
+
*
|
|
825
|
+
* Element-wise multiplication of two vectors together.
|
|
826
|
+
* Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
|
|
827
|
+
*/
|
|
828
|
+
static multiply(a: Vector3, b: Vector3): Vector3;
|
|
829
|
+
/**
|
|
830
|
+
* rotateX
|
|
831
|
+
*
|
|
832
|
+
* Rotates the vector around the x axis counterclockwise (left hand rule)
|
|
833
|
+
* @param a - Angle in radians
|
|
834
|
+
*/
|
|
835
|
+
static rotateX(v: Vector3, a: number): Vector3;
|
|
836
|
+
/**
|
|
837
|
+
* rotateY
|
|
838
|
+
*
|
|
839
|
+
* Rotates the vector around the y axis counterclockwise (left hand rule)
|
|
840
|
+
* @param a - Angle in radians
|
|
841
|
+
*/
|
|
842
|
+
static rotateY(v: Vector3, a: number): Vector3;
|
|
843
|
+
/**
|
|
844
|
+
* rotateZ
|
|
845
|
+
*
|
|
846
|
+
* Rotates the vector around the z axis counterclockwise (left hand rule)
|
|
847
|
+
* @param a - Angle in radians
|
|
848
|
+
*/
|
|
849
|
+
static rotateZ(v: Vector3, a: number): Vector3;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* zero
|
|
854
|
+
*
|
|
855
|
+
* A vector representing the value of 0 in all directions (0,0)
|
|
856
|
+
*
|
|
857
|
+
* @public
|
|
858
|
+
*/
|
|
859
|
+
export declare const VECTORXZ_ZERO: VectorXZ;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* VectorXZ wrapper class which can be used as a VectorXZ for APIs on \@minecraft/server which require a VectorXZ.
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
export declare class VectorXZBuilder implements VectorXZ {
|
|
866
|
+
x: number;
|
|
867
|
+
z: number;
|
|
868
|
+
constructor(vecStr: string, delim?: string);
|
|
869
|
+
constructor(vec: VectorXZ, arg?: never);
|
|
870
|
+
constructor(x: number, y: number);
|
|
871
|
+
toString(options?: {
|
|
872
|
+
decimals?: number;
|
|
873
|
+
delimiter?: string;
|
|
874
|
+
}): string;
|
|
875
|
+
/**
|
|
876
|
+
* Assigns the values of the passed in vector to this vector. Returns itself.
|
|
877
|
+
*/
|
|
878
|
+
assign(vec: VectorXZ): this;
|
|
879
|
+
/**
|
|
880
|
+
* equals
|
|
881
|
+
*
|
|
882
|
+
* Check the equality of two vectors
|
|
883
|
+
*/
|
|
884
|
+
equals(v: VectorXZ): boolean;
|
|
885
|
+
/**
|
|
886
|
+
* add
|
|
887
|
+
*
|
|
888
|
+
* Adds the vector v to this, returning itself.
|
|
889
|
+
*/
|
|
890
|
+
add(v: Partial<VectorXZ>): this;
|
|
891
|
+
/**
|
|
892
|
+
* subtract
|
|
893
|
+
*
|
|
894
|
+
* Subtracts the vector v from this, returning itself.
|
|
895
|
+
*/
|
|
896
|
+
subtract(v: Partial<VectorXZ>): this;
|
|
897
|
+
/** scale
|
|
898
|
+
*
|
|
899
|
+
* Scales this by the passed in value, returning itself.
|
|
900
|
+
*/
|
|
901
|
+
scale(val: number): this;
|
|
902
|
+
/**
|
|
903
|
+
* dot
|
|
904
|
+
*
|
|
905
|
+
* Computes the dot product of this and the passed in vector.
|
|
906
|
+
*/
|
|
907
|
+
dot(vec: VectorXZ): number;
|
|
908
|
+
/**
|
|
909
|
+
* magnitude
|
|
910
|
+
*
|
|
911
|
+
* The magnitude of the vector
|
|
912
|
+
*/
|
|
913
|
+
magnitude(): number;
|
|
914
|
+
/**
|
|
915
|
+
* distance
|
|
916
|
+
*
|
|
917
|
+
* Calculate the distance between two vectors
|
|
918
|
+
*/
|
|
919
|
+
distance(vec: VectorXZ): number;
|
|
920
|
+
/**
|
|
921
|
+
* normalize
|
|
922
|
+
*
|
|
923
|
+
* Normalizes this vector, returning itself.
|
|
924
|
+
*/
|
|
925
|
+
normalize(): this;
|
|
926
|
+
/**
|
|
927
|
+
* floor
|
|
928
|
+
*
|
|
929
|
+
* Floor the components of a vector to produce a new vector
|
|
930
|
+
*/
|
|
931
|
+
floor(): this;
|
|
932
|
+
/**
|
|
933
|
+
* clamp
|
|
934
|
+
*
|
|
935
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
936
|
+
*/
|
|
937
|
+
clamp(limits: {
|
|
938
|
+
min?: Partial<VectorXZ>;
|
|
939
|
+
max?: Partial<VectorXZ>;
|
|
940
|
+
}): this;
|
|
941
|
+
/**
|
|
942
|
+
* lerp
|
|
943
|
+
*
|
|
944
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
945
|
+
*/
|
|
946
|
+
lerp(vec: VectorXZ, t: number): this;
|
|
947
|
+
/**
|
|
948
|
+
* slerp
|
|
949
|
+
*
|
|
950
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
951
|
+
*/
|
|
952
|
+
slerp(vec: VectorXZ, t: number): this;
|
|
953
|
+
/**
|
|
954
|
+
* multiply
|
|
955
|
+
*
|
|
956
|
+
* Element-wise multiplication of two vectors together.
|
|
957
|
+
* Not to be confused with {@link VectorXZBuilder.dot} product
|
|
958
|
+
*/
|
|
959
|
+
multiply(vec: VectorXZ): this;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Utilities operating on VectorXZ objects. All methods are static and do not modify the input objects.
|
|
964
|
+
*
|
|
965
|
+
* @public
|
|
966
|
+
*/
|
|
967
|
+
export declare class VectorXZUtils {
|
|
968
|
+
/**
|
|
969
|
+
* equals
|
|
970
|
+
*
|
|
971
|
+
* Check the equality of two vectors
|
|
972
|
+
*/
|
|
973
|
+
static equals(v1: VectorXZ, v2: VectorXZ): boolean;
|
|
974
|
+
/**
|
|
975
|
+
* add
|
|
976
|
+
*
|
|
977
|
+
* Add two vectors to produce a new vector
|
|
978
|
+
*/
|
|
979
|
+
static add(v1: VectorXZ, v2: Partial<VectorXZ>): VectorXZ;
|
|
980
|
+
/**
|
|
981
|
+
* subtract
|
|
982
|
+
*
|
|
983
|
+
* Subtract two vectors to produce a new vector (v1-v2)
|
|
984
|
+
*/
|
|
985
|
+
static subtract(v1: VectorXZ, v2: Partial<VectorXZ>): VectorXZ;
|
|
986
|
+
/** scale
|
|
987
|
+
*
|
|
988
|
+
* Multiple all entries in a vector by a single scalar value producing a new vector
|
|
989
|
+
*/
|
|
990
|
+
static scale(v1: VectorXZ, scale: number): VectorXZ;
|
|
991
|
+
/**
|
|
992
|
+
* dot
|
|
993
|
+
*
|
|
994
|
+
* Calculate the dot product of two vectors
|
|
995
|
+
*/
|
|
996
|
+
static dot(a: VectorXZ, b: VectorXZ): number;
|
|
997
|
+
/**
|
|
998
|
+
* magnitude
|
|
999
|
+
*
|
|
1000
|
+
* The magnitude of a vector
|
|
1001
|
+
*/
|
|
1002
|
+
static magnitude(v: VectorXZ): number;
|
|
1003
|
+
/**
|
|
1004
|
+
* distance
|
|
1005
|
+
*
|
|
1006
|
+
* Calculate the distance between two vectors
|
|
1007
|
+
*/
|
|
1008
|
+
static distance(a: VectorXZ, b: VectorXZ): number;
|
|
1009
|
+
/**
|
|
1010
|
+
* normalize
|
|
1011
|
+
*
|
|
1012
|
+
* Takes a vector 3 and normalizes it to a unit vector
|
|
1013
|
+
*/
|
|
1014
|
+
static normalize(v: VectorXZ): VectorXZ;
|
|
1015
|
+
/**
|
|
1016
|
+
* floor
|
|
1017
|
+
*
|
|
1018
|
+
* Floor the components of a vector to produce a new vector
|
|
1019
|
+
*/
|
|
1020
|
+
static floor(v: VectorXZ): VectorXZ;
|
|
1021
|
+
/**
|
|
1022
|
+
* toString
|
|
1023
|
+
*
|
|
1024
|
+
* Create a string representation of a vectorxz
|
|
1025
|
+
*/
|
|
1026
|
+
static toString(v: VectorXZ, options?: {
|
|
1027
|
+
decimals?: number;
|
|
1028
|
+
delimiter?: string;
|
|
1029
|
+
}): string;
|
|
1030
|
+
/**
|
|
1031
|
+
* fromString
|
|
1032
|
+
*
|
|
1033
|
+
* Gets a VectorXZ from the string representation produced by {@link VectorXZUtils.toString}. If any numeric value is not a number
|
|
1034
|
+
* or the format is invalid, undefined is returned.
|
|
1035
|
+
* @param str - The string to parse
|
|
1036
|
+
* @param delimiter - The delimiter used to separate the components. Defaults to the same as the default for {@link VectorXZUtils.toString}
|
|
1037
|
+
*/
|
|
1038
|
+
static fromString(str: string, delimiter?: string): VectorXZ | undefined;
|
|
1039
|
+
/**
|
|
1040
|
+
* clamp
|
|
1041
|
+
*
|
|
1042
|
+
* Clamps the components of a vector to limits to produce a new vector
|
|
1043
|
+
*/
|
|
1044
|
+
static clamp(v: VectorXZ, limits?: {
|
|
1045
|
+
min?: Partial<VectorXZ>;
|
|
1046
|
+
max?: Partial<VectorXZ>;
|
|
1047
|
+
}): VectorXZ;
|
|
1048
|
+
/**
|
|
1049
|
+
* lerp
|
|
1050
|
+
*
|
|
1051
|
+
* Constructs a new vector using linear interpolation on each component from two vectors.
|
|
1052
|
+
*/
|
|
1053
|
+
static lerp(a: VectorXZ, b: VectorXZ, t: number): VectorXZ;
|
|
1054
|
+
/**
|
|
1055
|
+
* slerp
|
|
1056
|
+
*
|
|
1057
|
+
* Constructs a new vector using spherical linear interpolation on each component from two vectors.
|
|
1058
|
+
*/
|
|
1059
|
+
static slerp(a: VectorXZ, b: VectorXZ, t: number): VectorXZ;
|
|
1060
|
+
/**
|
|
1061
|
+
* multiply
|
|
1062
|
+
*
|
|
1063
|
+
* Element-wise multiplication of two vectors together.
|
|
1064
|
+
* Not to be confused with {@link VectorXZUtils.dot} product
|
|
1065
|
+
*/
|
|
1066
|
+
static multiply(a: VectorXZ, b: VectorXZ): VectorXZ;
|
|
1067
|
+
}
|
|
465
1068
|
|
|
466
|
-
export { }
|
|
1069
|
+
export { }
|