@galacean/engine-math 0.0.0-experimental-animator-additive.1

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.
@@ -0,0 +1,327 @@
1
+ import { IClone } from "./IClone";
2
+ import { ICopy } from "./ICopy";
3
+ import { Matrix3x3 } from "./Matrix3x3";
4
+ import { Vector3 } from "./Vector3";
5
+ /**
6
+ * Represents a four dimensional mathematical quaternion.
7
+ */
8
+ export declare class Quaternion implements IClone<Quaternion>, ICopy<QuaternionLike, Quaternion> {
9
+ /**
10
+ * Determines the sum of two quaternions.
11
+ * @param left - The first quaternion to add
12
+ * @param right - The second quaternion to add
13
+ * @param out - The sum of two quaternions
14
+ */
15
+ static add(left: Quaternion, right: Quaternion, out: Quaternion): void;
16
+ /**
17
+ * Determines the product of two quaternions.
18
+ * @param left - The first quaternion to multiply
19
+ * @param right - The second quaternion to multiply
20
+ * @param out - The product of two quaternions
21
+ */
22
+ static multiply(left: Quaternion, right: Quaternion, out: Quaternion): void;
23
+ /**
24
+ * Calculate quaternion that contains conjugated version of the specified quaternion.
25
+ * @param a - The specified quaternion
26
+ * @param out - The conjugate version of the specified quaternion
27
+ */
28
+ static conjugate(a: Quaternion, out: Quaternion): void;
29
+ /**
30
+ * Determines the dot product of two quaternions.
31
+ * @param left - The first quaternion to dot
32
+ * @param right - The second quaternion to dot
33
+ * @returns The dot product of two quaternions
34
+ */
35
+ static dot(left: Quaternion, right: Quaternion): number;
36
+ /**
37
+ * Determines whether the specified quaternions are equals.
38
+ * @param left - The first quaternion to compare
39
+ * @param right - The second quaternion to compare
40
+ * @returns True if the specified quaternions are equals, false otherwise
41
+ */
42
+ static equals(left: Quaternion, right: Quaternion): boolean;
43
+ /**
44
+ * Calculate a quaternion rotates around an arbitrary axis.
45
+ * @param axis - The axis
46
+ * @param rad - The rotation angle in radians
47
+ * @param out - The quaternion after rotate
48
+ */
49
+ static rotationAxisAngle(axis: Vector3, rad: number, out: Quaternion): void;
50
+ /**
51
+ * Calculate a quaternion rotates around x, y, z axis (pitch/yaw/roll).
52
+ * @param x - The radian of rotation around X (pitch)
53
+ * @param y - The radian of rotation around Y (yaw)
54
+ * @param z - The radian of rotation around Z (roll)
55
+ * @param out - The calculated quaternion
56
+ */
57
+ static rotationEuler(x: number, y: number, z: number, out: Quaternion): void;
58
+ /**
59
+ * Calculate a quaternion from the specified yaw, pitch and roll angles.
60
+ * @param yaw - Yaw around the y axis in radians
61
+ * @param pitch - Pitch around the x axis in radians
62
+ * @param roll - Roll around the z axis in radians
63
+ * @param out - The calculated quaternion
64
+ */
65
+ static rotationYawPitchRoll(yaw: number, pitch: number, roll: number, out: Quaternion): void;
66
+ /**
67
+ * Calculate a quaternion from the specified 3x3 matrix.
68
+ * @param m - The specified 3x3 matrix
69
+ * @param out - The calculated quaternion
70
+ */
71
+ static rotationMatrix3x3(m: Matrix3x3, out: Quaternion): void;
72
+ /**
73
+ * Calculate the inverse of the specified quaternion.
74
+ * @param a - The quaternion whose inverse is to be calculated
75
+ * @param out - The inverse of the specified quaternion
76
+ */
77
+ static invert(a: Quaternion, out: Quaternion): void;
78
+ /**
79
+ * Performs a linear blend between two quaternions.
80
+ * @param start - The first quaternion
81
+ * @param end - The second quaternion
82
+ * @param t - The blend amount where 0 returns start and 1 end
83
+ * @param out - The result of linear blending between two quaternions
84
+ */
85
+ static lerp(start: Quaternion, end: Quaternion, t: number, out: Quaternion): void;
86
+ /**
87
+ * Performs a spherical linear blend between two quaternions.
88
+ * @param start - The first quaternion
89
+ * @param end - The second quaternion
90
+ * @param amount - The blend amount where 0 returns start and 1 end
91
+ * @param out - The result of spherical linear blending between two quaternions
92
+ */
93
+ static slerp(start: Quaternion, end: Quaternion, amount: number, out: Quaternion): void;
94
+ /**
95
+ * Scales the specified quaternion magnitude to unit length.
96
+ * @param a - The specified quaternion
97
+ * @param out - The normalized quaternion
98
+ */
99
+ static normalize(a: Quaternion, out: Quaternion): void;
100
+ /**
101
+ * Calculate a quaternion rotate around X axis.
102
+ * @param rad - The rotation angle in radians
103
+ * @param out - The calculated quaternion
104
+ */
105
+ static rotationX(rad: number, out: Quaternion): void;
106
+ /**
107
+ * Calculate a quaternion rotate around Y axis.
108
+ * @param rad - The rotation angle in radians
109
+ * @param out - The calculated quaternion
110
+ */
111
+ static rotationY(rad: number, out: Quaternion): void;
112
+ /**
113
+ * Calculate a quaternion rotate around Z axis.
114
+ * @param rad - The rotation angle in radians
115
+ * @param out - The calculated quaternion
116
+ */
117
+ static rotationZ(rad: number, out: Quaternion): void;
118
+ /**
119
+ * Calculate a quaternion that the specified quaternion rotate around X axis.
120
+ * @param quaternion - The specified quaternion
121
+ * @param rad - The rotation angle in radians
122
+ * @param out - The calculated quaternion
123
+ */
124
+ static rotateX(quaternion: Quaternion, rad: number, out: Quaternion): void;
125
+ /**
126
+ * Calculate a quaternion that the specified quaternion rotate around Y axis.
127
+ * @param quaternion - The specified quaternion
128
+ * @param rad - The rotation angle in radians
129
+ * @param out - The calculated quaternion
130
+ */
131
+ static rotateY(quaternion: Quaternion, rad: number, out: Quaternion): void;
132
+ /**
133
+ * Calculate a quaternion that the specified quaternion rotate around Z axis.
134
+ * @param quaternion - The specified quaternion
135
+ * @param rad - The rotation angle in radians
136
+ * @param out - The calculated quaternion
137
+ */
138
+ static rotateZ(quaternion: Quaternion, rad: number, out: Quaternion): void;
139
+ /**
140
+ * Scale a quaternion by a given number.
141
+ * @param a - The quaternion
142
+ * @param s - The given number
143
+ * @param out - The scaled quaternion
144
+ */
145
+ static scale(a: Quaternion, s: number, out: Quaternion): void;
146
+ /**
147
+ * The x component of the quaternion.
148
+ */
149
+ get x(): number;
150
+ set x(value: number);
151
+ /**
152
+ * The y component of the quaternion.
153
+ */
154
+ get y(): number;
155
+ set y(value: number);
156
+ /**
157
+ * The z component of the quaternion.
158
+ */
159
+ get z(): number;
160
+ set z(value: number);
161
+ /**
162
+ * Indicting whether this instance is normalized.
163
+ */
164
+ get normalized(): boolean;
165
+ /**
166
+ * The w component of the quaternion.
167
+ */
168
+ get w(): number;
169
+ set w(value: number);
170
+ /**
171
+ * Constructor of Quaternion.
172
+ * @param x - The x component of the quaternion, default 0
173
+ * @param y - The y component of the quaternion, default 0
174
+ * @param z - The z component of the quaternion, default 0
175
+ * @param w - The w component of the quaternion, default 1
176
+ */
177
+ constructor(x?: number, y?: number, z?: number, w?: number);
178
+ /**
179
+ * Set the value of this quaternion, and return this quaternion.
180
+ * @param x - The x component of the quaternion
181
+ * @param y - The y component of the quaternion
182
+ * @param z - The z component of the quaternion
183
+ * @param w - The w component of the quaternion
184
+ * @returns This quaternion
185
+ */
186
+ set(x: number, y: number, z: number, w: number): Quaternion;
187
+ /**
188
+ * Transforms this quaternion into its conjugated version.
189
+ * @returns This quaternion
190
+ */
191
+ conjugate(): Quaternion;
192
+ /**
193
+ * Get the rotation axis and rotation angle of the quaternion (unit: radians).
194
+ * @param out - The axis as an output parameter
195
+ * @returns The rotation angle (unit: radians)
196
+ */
197
+ getAxisAngle(out: Vector3): number;
198
+ /**
199
+ * Identity this quaternion.
200
+ * @returns This quaternion after identity
201
+ */
202
+ identity(): Quaternion;
203
+ /**
204
+ * Calculate the length of this quaternion.
205
+ * @returns The length of this quaternion
206
+ */
207
+ length(): number;
208
+ /**
209
+ * Calculates the squared length of this quaternion.
210
+ * @returns The squared length of this quaternion
211
+ */
212
+ lengthSquared(): number;
213
+ /**
214
+ * Converts this quaternion into a unit quaternion.
215
+ * @returns This quaternion
216
+ */
217
+ normalize(): Quaternion;
218
+ /**
219
+ * Get the euler of this quaternion.
220
+ * @param out - The euler (in radians) as an output parameter
221
+ * @returns Euler x->pitch y->yaw z->roll
222
+ */
223
+ toEuler(out: Vector3): Vector3;
224
+ /**
225
+ * Get the euler of this quaternion.
226
+ * @param out - The euler (in radians) as an output parameter
227
+ * @returns Euler x->yaw y->pitch z->roll
228
+ */
229
+ toYawPitchRoll(out: Vector3): Vector3;
230
+ /**
231
+ * Calculate this quaternion rotate around X axis.
232
+ * @param rad - The rotation angle in radians
233
+ * @returns This quaternion
234
+ */
235
+ rotateX(rad: number): Quaternion;
236
+ /**
237
+ * Calculate this quaternion rotate around Y axis.
238
+ * @param rad - The rotation angle in radians
239
+ * @returns This quaternion
240
+ */
241
+ rotateY(rad: number): Quaternion;
242
+ /**
243
+ * Calculate this quaternion rotate around Z axis.
244
+ * @param rad - The rotation angle in radians
245
+ * @returns This quaternion
246
+ */
247
+ rotateZ(rad: number): Quaternion;
248
+ /**
249
+ * Calculate this quaternion rotates around an arbitrary axis.
250
+ * @param axis - The axis
251
+ * @param rad - The rotation angle in radians
252
+ * @returns This quaternion
253
+ */
254
+ rotationAxisAngle(axis: Vector3, rad: number): Quaternion;
255
+ /**
256
+ * Determines the product of this quaternion and the specified quaternion.
257
+ * @param quat - The specified quaternion
258
+ * @returns The product of the two quaternions
259
+ */
260
+ multiply(quat: Quaternion): Quaternion;
261
+ /**
262
+ * Invert this quaternion.
263
+ * @returns This quaternion after invert
264
+ */
265
+ invert(): Quaternion;
266
+ /**
267
+ * Determines the dot product of this quaternion and the specified quaternion.
268
+ * @param quat - The specified quaternion
269
+ * @returns The dot product of two quaternions
270
+ */
271
+ dot(quat: Quaternion): number;
272
+ /**
273
+ * Performs a linear blend between this quaternion and the specified quaternion.
274
+ * @param quat - The specified quaternion
275
+ * @param t - The blend amount where 0 returns this and 1 quat
276
+ * @returns - The result of linear blending between two quaternions
277
+ */
278
+ lerp(quat: Quaternion, t: number): Quaternion;
279
+ /**
280
+ * Calculate this quaternion rotation around an arbitrary axis.
281
+ * @param axis - The axis
282
+ * @param rad - The rotation angle in radians
283
+ * @returns This quaternion
284
+ */
285
+ rotateAxisAngle(axis: Vector3, rad: number): Quaternion;
286
+ /**
287
+ * Creates a clone of this quaternion.
288
+ * @returns A clone of this quaternion
289
+ */
290
+ clone(): Quaternion;
291
+ /**
292
+ * Copy this quaternion from the specified quaternion.
293
+ * @param source - The specified quaternion
294
+ * @returns This quaternion
295
+ */
296
+ copyFrom(source: QuaternionLike): Quaternion;
297
+ /**
298
+ * Copy the value of this quaternion from an array.
299
+ * @param array - The array
300
+ * @param offset - The start offset of the array
301
+ * @returns This quaternion
302
+ */
303
+ copyFromArray(array: ArrayLike<number>, offset?: number): Quaternion;
304
+ /**
305
+ * Copy the value of this quaternion to an array.
306
+ * @param out - The array
307
+ * @param outOffset - The start offset of the array
308
+ */
309
+ copyToArray(out: number[] | Float32Array | Float64Array, outOffset?: number): void;
310
+ /**
311
+ * Serialize this quaternion to a JSON representation.
312
+ * @returns A JSON Object representation of this quaternion
313
+ */
314
+ toJSON(): QuaternionLike;
315
+ private _toYawPitchRoll;
316
+ }
317
+ interface QuaternionLike {
318
+ /** {@inheritDoc Quaternion.x} */
319
+ x: number;
320
+ /** {@inheritDoc Quaternion.y} */
321
+ y: number;
322
+ /** {@inheritDoc Quaternion.z} */
323
+ z: number;
324
+ /** {@inheritDoc Quaternion.w} */
325
+ w: number;
326
+ }
327
+ export {};
package/types/Ray.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { BoundingBox } from "./BoundingBox";
2
+ import { BoundingSphere } from "./BoundingSphere";
3
+ import { Plane } from "./Plane";
4
+ import { Vector3 } from "./Vector3";
5
+ /**
6
+ * Represents a ray with an origin and a direction in 3D space.
7
+ */
8
+ export declare class Ray {
9
+ /** The origin of the ray. */
10
+ readonly origin: Vector3;
11
+ /** The normalized direction of the ray. */
12
+ readonly direction: Vector3;
13
+ /**
14
+ * Constructor of Ray.
15
+ * @param origin - The origin vector
16
+ * @param direction - The direction vector
17
+ */
18
+ constructor(origin?: Vector3, direction?: Vector3);
19
+ /**
20
+ * Check if this ray intersects the specified plane.
21
+ * @param plane - The specified plane
22
+ * @returns The distance from this ray to the specified plane if intersecting, -1 otherwise
23
+ */
24
+ intersectPlane(plane: Plane): number;
25
+ /**
26
+ * Check if this ray intersects the specified sphere.
27
+ * @param sphere - The specified sphere
28
+ * @returns The distance from this ray to the specified sphere if intersecting, -1 otherwise
29
+ */
30
+ intersectSphere(sphere: BoundingSphere): number;
31
+ /**
32
+ * Check if this ray intersects the specified box (AABB).
33
+ * @param box - The specified box
34
+ * @returns The distance from this ray to the specified box if intersecting, -1 otherwise
35
+ */
36
+ intersectBox(box: BoundingBox): number;
37
+ /**
38
+ * The coordinates of the specified distance from the origin in the ray direction.
39
+ * @param distance - The specified distance
40
+ * @param out - The coordinates as an output parameter
41
+ * @returns The out
42
+ */
43
+ getPoint(distance: number, out: Vector3): Vector3;
44
+ }
@@ -0,0 +1,40 @@
1
+ import { IClone } from "./IClone";
2
+ import { ICopy } from "./ICopy";
3
+ export declare class Rect implements IClone<Rect>, ICopy<Rect, Rect> {
4
+ /** The x coordinate of the rectangle. */
5
+ x: number;
6
+ /** The y coordinate of the rectangle. */
7
+ y: number;
8
+ /** The width of the rectangle, measured from the x position. */
9
+ width: number;
10
+ /** The height of the rectangle, measured from the y position. */
11
+ height: number;
12
+ /**
13
+ * Constructor of Rect.
14
+ * @param x - The x coordinate of the rectangle, default 0
15
+ * @param y - The y coordinate of the rectangle, default 0
16
+ * @param width - The width of the rectangle, measured from the x position, default 0
17
+ * @param height - The height of the rectangle, measured from the y position, default 0
18
+ */
19
+ constructor(x?: number, y?: number, width?: number, height?: number);
20
+ /**
21
+ * Set the value of this rectangle.
22
+ * @param x - The x coordinate of the rectangle
23
+ * @param y - The y coordinate of the rectangle
24
+ * @param width - The width of the rectangle, measured from the x position
25
+ * @param height - The height of the rectangle, measured from the y position
26
+ * @returns This rectangle
27
+ */
28
+ set(x: number, y: number, width: number, height: number): Rect;
29
+ /**
30
+ * Creates a clone of this rect.
31
+ * @returns A clone of this rect
32
+ */
33
+ clone(): Rect;
34
+ /**
35
+ * Copy this rect from the specified rect.
36
+ * @param source - The specified rect
37
+ * @returns This rect
38
+ */
39
+ copyFrom(source: Rect): Rect;
40
+ }
@@ -0,0 +1,56 @@
1
+ import { Color } from "./Color";
2
+ import { IClone } from "./IClone";
3
+ import { ICopy } from "./ICopy";
4
+ import { Vector3 } from "./Vector3";
5
+ /**
6
+ * Use SH3 to represent irradiance environment maps efficiently, allowing for interactive rendering of diffuse objects under distant illumination.
7
+ * @remarks
8
+ * https://graphics.stanford.edu/papers/envmap/envmap.pdf
9
+ * http://www.ppsloan.org/publications/StupidSH36.pdf
10
+ * https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics
11
+ */
12
+ export declare class SphericalHarmonics3 implements IClone<SphericalHarmonics3>, ICopy<SphericalHarmonics3, SphericalHarmonics3> {
13
+ /** The coefficients of SphericalHarmonics3. */
14
+ coefficients: Float32Array;
15
+ /**
16
+ * Add light to SphericalHarmonics3.
17
+ * @param direction - Light direction
18
+ * @param color - Light color
19
+ * @param deltaSolidAngle - The delta solid angle of the light
20
+ */
21
+ addLight(direction: Vector3, color: Color, deltaSolidAngle: number): void;
22
+ /**
23
+ * Evaluates the color for the specified direction.
24
+ * @param direction - Specified direction
25
+ * @param out - Out color
26
+ */
27
+ evaluate(direction: Vector3, out: Color): Color;
28
+ /**
29
+ * Scale the coefficients.
30
+ * @param s - The amount by which to scale the SphericalHarmonics3
31
+ */
32
+ scale(s: number): void;
33
+ /**
34
+ * Creates a clone of this SphericalHarmonics3.
35
+ * @returns A clone of this SphericalHarmonics3
36
+ */
37
+ clone(): SphericalHarmonics3;
38
+ /**
39
+ * Copy this SphericalHarmonics3 from the specified SphericalHarmonics3.
40
+ * @param source - The specified SphericalHarmonics3
41
+ * @returns This SphericalHarmonics3
42
+ */
43
+ copyFrom(source: SphericalHarmonics3): SphericalHarmonics3;
44
+ /**
45
+ * Copy the value of this spherical harmonics from an array.
46
+ * @param array - The array
47
+ * @param offset - The start offset of the array
48
+ */
49
+ copyFromArray(array: ArrayLike<number>, offset?: number): void;
50
+ /**
51
+ * Copy the value of this spherical harmonics to an array.
52
+ * @param out - The array
53
+ * @param outOffset - The start offset of the array
54
+ */
55
+ copyToArray(out: number[] | Float32Array | Float64Array, outOffset?: number): void;
56
+ }
@@ -0,0 +1,213 @@
1
+ import { IClone } from "./IClone";
2
+ import { ICopy } from "./ICopy";
3
+ /**
4
+ * Describes a 2D-vector.
5
+ */
6
+ export declare class Vector2 implements IClone<Vector2>, ICopy<Vector2Like, Vector2> {
7
+ /**
8
+ * Determines the sum of two vectors.
9
+ * @param left - The first vector to add
10
+ * @param right - The second vector to add
11
+ * @param out - The sum of two vectors
12
+ */
13
+ static add(left: Vector2, right: Vector2, out: Vector2): void;
14
+ /**
15
+ * Determines the difference between two vectors.
16
+ * @param left - The first vector to subtract
17
+ * @param right - The second vector to subtract
18
+ * @param out - The difference between two vectors
19
+ */
20
+ static subtract(left: Vector2, right: Vector2, out: Vector2): void;
21
+ /**
22
+ * Determines the product of two vectors.
23
+ * @param left - The first vector to multiply
24
+ * @param right - The second vector to multiply
25
+ * @param out - The product of two vectors
26
+ */
27
+ static multiply(left: Vector2, right: Vector2, out: Vector2): void;
28
+ /**
29
+ * Determines the divisor of two vectors.
30
+ * @param left - The first vector to divide
31
+ * @param right - The second vector to divide
32
+ * @param out - The divisor of two vectors
33
+ */
34
+ static divide(left: Vector2, right: Vector2, out: Vector2): void;
35
+ /**
36
+ * Determines the dot product of two vectors.
37
+ * @param left - The first vector to dot
38
+ * @param right - The second vector to dot
39
+ * @returns The dot product of two vectors
40
+ */
41
+ static dot(left: Vector2, right: Vector2): number;
42
+ /**
43
+ * Determines the distance of two vectors.
44
+ * @param left - The first vector
45
+ * @param right - The second vector
46
+ * @returns The distance of two vectors
47
+ */
48
+ static distance(left: Vector2, right: Vector2): number;
49
+ /**
50
+ * Determines the squared distance of two vectors.
51
+ * @param left - The first vector
52
+ * @param right - The second vector
53
+ * @returns The squared distance of two vectors
54
+ */
55
+ static distanceSquared(left: Vector2, right: Vector2): number;
56
+ /**
57
+ * Determines whether the specified vectors are equals.
58
+ * @param left - The first vector to compare
59
+ * @param right - The second vector to compare
60
+ * @returns True if the specified vectors are equals, false otherwise
61
+ */
62
+ static equals(left: Vector2, right: Vector2): boolean;
63
+ /**
64
+ * Performs a linear interpolation between two vectors.
65
+ * @param left - The first vector
66
+ * @param right - The second vector
67
+ * @param t - The blend amount where 0 returns left and 1 right
68
+ * @param out - The result of linear blending between two vectors
69
+ */
70
+ static lerp(left: Vector2, right: Vector2, t: number, out: Vector2): void;
71
+ /**
72
+ * Calculate a vector containing the largest components of the specified vectors.
73
+ * @param left - The first vector
74
+ * @param right - The second vector
75
+ * @param out - The vector containing the largest components of the specified vectors
76
+ */
77
+ static max(left: Vector2, right: Vector2, out: Vector2): void;
78
+ /**
79
+ * Calculate a vector containing the smallest components of the specified vectors.
80
+ * @param left - The first vector
81
+ * @param right - The second vector
82
+ * @param out - The vector containing the smallest components of the specified vectors
83
+ */
84
+ static min(left: Vector2, right: Vector2, out: Vector2): void;
85
+ /**
86
+ * Reverses the direction of a given vector.
87
+ * @param left - The vector to negate
88
+ * @param out - The vector facing in the opposite direction
89
+ */
90
+ static negate(left: Vector2, out: Vector2): void;
91
+ /**
92
+ * Converts the vector into a unit vector.
93
+ * @param left - The vector to normalize
94
+ * @param out - The normalized vector
95
+ */
96
+ static normalize(left: Vector2, out: Vector2): void;
97
+ /**
98
+ * Scale a vector by the given value.
99
+ * @param left - The vector to scale
100
+ * @param s - The amount by which to scale the vector
101
+ * @param out - The scaled vector
102
+ */
103
+ static scale(left: Vector2, s: number, out: Vector2): void;
104
+ /**
105
+ * The x component of the vector.
106
+ */
107
+ get x(): number;
108
+ set x(value: number);
109
+ /**
110
+ * The y component of the vector.
111
+ */
112
+ get y(): number;
113
+ set y(value: number);
114
+ /**
115
+ * Constructor of Vector2.
116
+ * @param x - The x component of the vector, default 0
117
+ * @param y - The y component of the vector, default 0
118
+ */
119
+ constructor(x?: number, y?: number);
120
+ /**
121
+ * Set the value of this vector.
122
+ * @param x - The x component of the vector
123
+ * @param y - The y component of the vector
124
+ * @returns This vector
125
+ */
126
+ set(x: number, y: number): Vector2;
127
+ /**
128
+ * Determines the sum of this vector and the specified vector.
129
+ * @param right - The specified vector
130
+ * @returns This vector
131
+ */
132
+ add(right: Vector2): Vector2;
133
+ /**
134
+ * Determines the difference of this vector and the specified vector.
135
+ * @param right - The specified vector
136
+ * @returns This vector
137
+ */
138
+ subtract(right: Vector2): Vector2;
139
+ /**
140
+ * Determines the product of this vector and the specified vector.
141
+ * @param right - The specified vector
142
+ * @returns This vector
143
+ */
144
+ multiply(right: Vector2): Vector2;
145
+ /**
146
+ * Determines the divisor of this vector and the specified vector.
147
+ * @param right - The specified vector
148
+ * @returns This vector
149
+ */
150
+ divide(right: Vector2): Vector2;
151
+ /**
152
+ * Calculate the length of this vector.
153
+ * @returns The length of this vector
154
+ */
155
+ length(): number;
156
+ /**
157
+ * Calculate the squared length of this vector.
158
+ * @returns The squared length of this vector
159
+ */
160
+ lengthSquared(): number;
161
+ /**
162
+ * Reverses the direction of this vector.
163
+ * @returns This vector
164
+ */
165
+ negate(): Vector2;
166
+ /**
167
+ * Converts this vector into a unit vector.
168
+ * @returns This vector
169
+ */
170
+ normalize(): Vector2;
171
+ /**
172
+ * Scale this vector by the given value.
173
+ * @param s - The amount by which to scale the vector
174
+ * @returns This vector
175
+ */
176
+ scale(s: number): Vector2;
177
+ /**
178
+ * Creates a clone of this vector.
179
+ * @returns A clone of this vector
180
+ */
181
+ clone(): Vector2;
182
+ /**
183
+ * Copy from vector2 like object.
184
+ * @param source - Vector2 like object
185
+ * @returns This vector
186
+ */
187
+ copyFrom(source: Vector2Like): Vector2;
188
+ /**
189
+ * Copy the value of this vector from an array.
190
+ * @param array - The array
191
+ * @param offset - The start offset of the array
192
+ * @returns This vector
193
+ */
194
+ copyFromArray(array: ArrayLike<number>, offset?: number): Vector2;
195
+ /**
196
+ * Copy the value of this vector to an array.
197
+ * @param out - The array
198
+ * @param outOffset - The start offset of the array
199
+ */
200
+ copyToArray(out: number[] | Float32Array | Float64Array, outOffset?: number): void;
201
+ /**
202
+ * Serialize this vector to a JSON representation.
203
+ * @returns A JSON representation of this vector
204
+ */
205
+ toJSON(): Vector2Like;
206
+ }
207
+ interface Vector2Like {
208
+ /** {@inheritDoc Vector2.x} */
209
+ x: number;
210
+ /** {@inheritDoc Vector2.y} */
211
+ y: number;
212
+ }
213
+ export {};