@yangyongtao/gaea 1.0.3 → 1.1.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.
Files changed (137) hide show
  1. package/README.md +158 -67
  2. package/package.json +28 -7
  3. package/public/Gaea.apple-touch-icon.png +0 -0
  4. package/public/Gaea.apple-touch-icon.png.import +35 -0
  5. package/public/Gaea.audio.worklet.js +211 -0
  6. package/public/Gaea.html +245 -0
  7. package/public/Gaea.icon.png +0 -0
  8. package/public/Gaea.icon.png.import +35 -0
  9. package/public/Gaea.js +782 -0
  10. package/public/Gaea.png +0 -0
  11. package/public/Gaea.png.import +35 -0
  12. package/public/Gaea.worker.js +1 -0
  13. package/public/GaeaApp.html +275 -0
  14. package/public/GaeaMethods.js +4342 -0
  15. package/public/GaeaModule.html +276 -0
  16. package/public/config.js +76 -0
  17. package/public/constants.js +185 -0
  18. package/public/favicon.ico +0 -0
  19. package/public/image/1.png +0 -0
  20. package/public/image/12-min-min.gif +0 -0
  21. package/public/image/3.png +0 -0
  22. package/public/image/labelImg//345/217/263/350/276/271.png +0 -0
  23. package/public/image/labelImg//345/267/246/350/276/271.png +0 -0
  24. package/public/image/labelImg//346/260/264/344/275/215.png +0 -0
  25. package/public/image/screenIcon//345/205/266/344/273/226.png +0 -0
  26. package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/272/242.png +0 -0
  27. package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/273/277.png +0 -0
  28. package/public/image/screenIcon//346/212/242/351/231/251/345/215/225/344/275/215.png +0 -0
  29. package/public/image/screenIcon//346/226/255/351/235/242.png +0 -0
  30. package/public/image/screenIcon//346/227/240/344/272/272/346/234/272.png +0 -0
  31. package/public/image/screenIcon//346/227/240/344/272/272/346/234/272/345/237/272/345/234/260.png +0 -0
  32. package/public/image/screenIcon//346/260/264/345/272/223/347/253/231.png +0 -0
  33. package/public/image/screenIcon//346/260/264/346/226/207/346/265/213/347/253/231.png +0 -0
  34. package/public/image/screenIcon//346/260/264/351/227/270.png +0 -0
  35. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
  36. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/255/243/345/270/270.png +0 -0
  37. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/344/277/235.png +0 -0
  38. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/350/255/246.png +0 -0
  39. package/public/image/screenIcon//346/263/265/347/253/231-/347/201/260.png +0 -0
  40. package/public/image/screenIcon//346/263/265/347/253/231-/347/273/277.png +0 -0
  41. package/public/image/screenIcon//346/265/201/351/207/217/346/265/213/347/253/231.png +0 -0
  42. package/public/image/screenIcon//346/265/267/345/241/230-1/347/272/247.png +0 -0
  43. package/public/image/screenIcon//346/265/267/345/241/230-2/347/272/247.png +0 -0
  44. package/public/image/screenIcon//346/265/267/345/241/230-3/347/272/247.png +0 -0
  45. package/public/image/screenIcon//346/265/267/345/241/230-4/347/272/247.png +0 -0
  46. package/public/image/screenIcon//346/265/267/345/241/230-5/347/272/247.png +0 -0
  47. package/public/image/screenIcon//346/265/267/345/241/230-/346/251/231.png +0 -0
  48. package/public/image/screenIcon//346/265/267/345/241/230-/347/272/242.png +0 -0
  49. package/public/image/screenIcon//346/265/267/345/241/230-/347/273/277.png +0 -0
  50. package/public/image/screenIcon//346/265/267/345/241/230-/350/247/204/346/250/241/344/273/245/344/270/213.png +0 -0
  51. package/public/image/screenIcon//346/265/267/345/241/230-/351/273/204.png +0 -0
  52. package/public/image/screenIcon//346/265/267/345/241/230.png +0 -0
  53. package/public/image/screenIcon//346/275/256/344/275/215.png +0 -0
  54. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
  55. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/255/243/345/270/270.png +0 -0
  56. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/344/277/235.png +0 -0
  57. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/350/255/246.png +0 -0
  58. package/public/image/screenIcon//347/211/251/350/265/204/344/273/223/345/272/223.png +0 -0
  59. package/public/image/screenIcon//347/220/203/346/234/272-/345/205/263.png +0 -0
  60. package/public/image/screenIcon//347/220/203/346/234/272-/345/274/200.png +0 -0
  61. package/public/image/screenIcon//347/220/203/346/234/272-/347/272/242.png +0 -0
  62. package/public/image/screenIcon//350/247/206/351/242/221/347/233/221/346/216/247.png +0 -0
  63. package/public/image/screenIcon//351/227/270/351/227/250-/347/201/260.png +0 -0
  64. package/public/image/screenIcon//351/227/270/351/227/250-/347/273/277.png +0 -0
  65. package/public/image/screenIcon//351/230/262/346/264/252/344/273/223/345/272/223.png +0 -0
  66. package/public/image/screenIcon//351/232/220/346/202/243.png +0 -0
  67. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/346/265/205/350/223/235.png +0 -0
  68. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/201/260.png +0 -0
  69. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/262/211.png +0 -0
  70. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/272/242.png +0 -0
  71. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/273/277.png +0 -0
  72. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/350/223/235.png +0 -0
  73. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/204.png +0 -0
  74. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/221.png +0 -0
  75. package/public/image/screenIcon//351/243/216/351/200/237.png +0 -0
  76. package/public/image/screenIcon//351/243/216/351/200/237/346/265/213/347/253/231.png +0 -0
  77. package/public/image//346/260/264/346/226/207.gif +0 -0
  78. package/public/image//350/211/262/345/270/246.png +0 -0
  79. package/public/index.html +22 -0
  80. package/public/index.js +185662 -0
  81. package/public/jsWebControl-1.0.0.min.js +31 -0
  82. package/public/jsencrypt.min.js +1 -0
  83. package/public/math/Box2.js +203 -0
  84. package/public/math/Box3.js +532 -0
  85. package/public/math/Color.js +605 -0
  86. package/public/math/ColorManagement.js +74 -0
  87. package/public/math/Cylindrical.js +61 -0
  88. package/public/math/EngineUtils.js +81 -0
  89. package/public/math/Euler.js +315 -0
  90. package/public/math/Frustum.js +162 -0
  91. package/public/math/Interpolant.js +241 -0
  92. package/public/math/Line3.js +115 -0
  93. package/public/math/MathUtils.js +345 -0
  94. package/public/math/Matrix3.js +365 -0
  95. package/public/math/Matrix4.js +858 -0
  96. package/public/math/Plane.js +205 -0
  97. package/public/math/Quaternion.js +724 -0
  98. package/public/math/Ray.js +493 -0
  99. package/public/math/Sphere.js +243 -0
  100. package/public/math/Spherical.js +86 -0
  101. package/public/math/SphericalHarmonics3.js +243 -0
  102. package/public/math/Triangle.js +299 -0
  103. package/public/math/Vector2.js +464 -0
  104. package/public/math/Vector3.js +715 -0
  105. package/public/math/Vector4.js +644 -0
  106. package/public/math/interpolants/CubicInterpolant.js +151 -0
  107. package/public/math/interpolants/DiscreteInterpolant.js +26 -0
  108. package/public/math/interpolants/LinearInterpolant.js +38 -0
  109. package/public/math/interpolants/QuaternionLinearInterpolant.js +39 -0
  110. package/public/static/Cloud.png +0 -0
  111. package/public/static/Global2.jpg +0 -0
  112. package/public/static/css/main.css +170 -0
  113. package/public/static/geojson//346/265/267/345/241/230.geojson +99 -0
  114. package/public/static/img/loading.gif +0 -0
  115. package/public/static/js/app.js +359 -0
  116. package/public/static/js/appcontroller.js +207 -0
  117. package/public/static/js/dist/game.dev.js +137 -0
  118. package/public/static/js/env.js +74 -0
  119. package/public/static/js/event/event.js +107 -0
  120. package/public/static/js/init.js +8 -0
  121. package/public/static/js/initcloudmorph.js +1 -0
  122. package/public/static/js/log.js +35 -0
  123. package/public/static/js/network/ajax.js +29 -0
  124. package/public/static/js/network/rtcp.js +172 -0
  125. package/public/static/js/network/socket.js +106 -0
  126. package/public/web-control.min.js +2 -0
  127. package/scripts/postinstall.mjs +127 -0
  128. package/src/GaeaMethods.js +68 -405
  129. package/src/components/FlyAlongRoute.vue +1 -0
  130. package/src/components/WeatherControl.vue +2 -0
  131. package/src/directives/vDrag.js +70 -0
  132. package/src/index.js +1 -8
  133. package/src/plugin.js +16 -0
  134. package/src/utils.js +10 -21
  135. package/src/vite-plugin.js +117 -0
  136. package/public/static/1111.res +0 -0
  137. package/src/config.js +0 -40
@@ -0,0 +1,644 @@
1
+ class Vector4 {
2
+
3
+ constructor( x = 0, y = 0, z = 0, w = 1 ) {
4
+
5
+ Vector4.prototype.isVector4 = true;
6
+
7
+ this.x = x;
8
+ this.y = y;
9
+ this.z = z;
10
+ this.w = w;
11
+
12
+ }
13
+
14
+ get width() {
15
+
16
+ return this.z;
17
+
18
+ }
19
+
20
+ set width( value ) {
21
+
22
+ this.z = value;
23
+
24
+ }
25
+
26
+ get height() {
27
+
28
+ return this.w;
29
+
30
+ }
31
+
32
+ set height( value ) {
33
+
34
+ this.w = value;
35
+
36
+ }
37
+
38
+ set( x, y, z, w ) {
39
+
40
+ this.x = x;
41
+ this.y = y;
42
+ this.z = z;
43
+ this.w = w;
44
+
45
+ return this;
46
+
47
+ }
48
+
49
+ setScalar( scalar ) {
50
+
51
+ this.x = scalar;
52
+ this.y = scalar;
53
+ this.z = scalar;
54
+ this.w = scalar;
55
+
56
+ return this;
57
+
58
+ }
59
+
60
+ setX( x ) {
61
+
62
+ this.x = x;
63
+
64
+ return this;
65
+
66
+ }
67
+
68
+ setY( y ) {
69
+
70
+ this.y = y;
71
+
72
+ return this;
73
+
74
+ }
75
+
76
+ setZ( z ) {
77
+
78
+ this.z = z;
79
+
80
+ return this;
81
+
82
+ }
83
+
84
+ setW( w ) {
85
+
86
+ this.w = w;
87
+
88
+ return this;
89
+
90
+ }
91
+
92
+ setComponent( index, value ) {
93
+
94
+ switch ( index ) {
95
+
96
+ case 0: this.x = value; break;
97
+ case 1: this.y = value; break;
98
+ case 2: this.z = value; break;
99
+ case 3: this.w = value; break;
100
+ default: throw new Error( 'index is out of range: ' + index );
101
+
102
+ }
103
+
104
+ return this;
105
+
106
+ }
107
+
108
+ getComponent( index ) {
109
+
110
+ switch ( index ) {
111
+
112
+ case 0: return this.x;
113
+ case 1: return this.y;
114
+ case 2: return this.z;
115
+ case 3: return this.w;
116
+ default: throw new Error( 'index is out of range: ' + index );
117
+
118
+ }
119
+
120
+ }
121
+
122
+ clone() {
123
+
124
+ return new this.constructor( this.x, this.y, this.z, this.w );
125
+
126
+ }
127
+
128
+ copy( v ) {
129
+
130
+ this.x = v.x;
131
+ this.y = v.y;
132
+ this.z = v.z;
133
+ this.w = ( v.w !== undefined ) ? v.w : 1;
134
+
135
+ return this;
136
+
137
+ }
138
+
139
+ add( v ) {
140
+
141
+ this.x += v.x;
142
+ this.y += v.y;
143
+ this.z += v.z;
144
+ this.w += v.w;
145
+
146
+ return this;
147
+
148
+ }
149
+
150
+ addScalar( s ) {
151
+
152
+ this.x += s;
153
+ this.y += s;
154
+ this.z += s;
155
+ this.w += s;
156
+
157
+ return this;
158
+
159
+ }
160
+
161
+ addVectors( a, b ) {
162
+
163
+ this.x = a.x + b.x;
164
+ this.y = a.y + b.y;
165
+ this.z = a.z + b.z;
166
+ this.w = a.w + b.w;
167
+
168
+ return this;
169
+
170
+ }
171
+
172
+ addScaledVector( v, s ) {
173
+
174
+ this.x += v.x * s;
175
+ this.y += v.y * s;
176
+ this.z += v.z * s;
177
+ this.w += v.w * s;
178
+
179
+ return this;
180
+
181
+ }
182
+
183
+ sub( v ) {
184
+
185
+ this.x -= v.x;
186
+ this.y -= v.y;
187
+ this.z -= v.z;
188
+ this.w -= v.w;
189
+
190
+ return this;
191
+
192
+ }
193
+
194
+ subScalar( s ) {
195
+
196
+ this.x -= s;
197
+ this.y -= s;
198
+ this.z -= s;
199
+ this.w -= s;
200
+
201
+ return this;
202
+
203
+ }
204
+
205
+ subVectors( a, b ) {
206
+
207
+ this.x = a.x - b.x;
208
+ this.y = a.y - b.y;
209
+ this.z = a.z - b.z;
210
+ this.w = a.w - b.w;
211
+
212
+ return this;
213
+
214
+ }
215
+
216
+ multiply( v ) {
217
+
218
+ this.x *= v.x;
219
+ this.y *= v.y;
220
+ this.z *= v.z;
221
+ this.w *= v.w;
222
+
223
+ return this;
224
+
225
+ }
226
+
227
+ multiplyScalar( scalar ) {
228
+
229
+ this.x *= scalar;
230
+ this.y *= scalar;
231
+ this.z *= scalar;
232
+ this.w *= scalar;
233
+
234
+ return this;
235
+
236
+ }
237
+
238
+ applyMatrix4( m ) {
239
+
240
+ const x = this.x, y = this.y, z = this.z, w = this.w;
241
+ const e = m.elements;
242
+
243
+ this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;
244
+ this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;
245
+ this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;
246
+ this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;
247
+
248
+ return this;
249
+
250
+ }
251
+
252
+ divideScalar( scalar ) {
253
+
254
+ return this.multiplyScalar( 1 / scalar );
255
+
256
+ }
257
+
258
+ setAxisAngleFromQuaternion( q ) {
259
+
260
+ // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
261
+
262
+ // q is assumed to be normalized
263
+
264
+ this.w = 2 * Math.acos( q.w );
265
+
266
+ const s = Math.sqrt( 1 - q.w * q.w );
267
+
268
+ if ( s < 0.0001 ) {
269
+
270
+ this.x = 1;
271
+ this.y = 0;
272
+ this.z = 0;
273
+
274
+ } else {
275
+
276
+ this.x = q.x / s;
277
+ this.y = q.y / s;
278
+ this.z = q.z / s;
279
+
280
+ }
281
+
282
+ return this;
283
+
284
+ }
285
+
286
+ setAxisAngleFromRotationMatrix( m ) {
287
+
288
+ // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
289
+
290
+ // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
291
+
292
+ let angle, x, y, z; // variables for result
293
+ const epsilon = 0.01, // margin to allow for rounding errors
294
+ epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees
295
+
296
+ te = m.elements,
297
+
298
+ m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
299
+ m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
300
+ m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
301
+
302
+ if ( ( Math.abs( m12 - m21 ) < epsilon ) &&
303
+ ( Math.abs( m13 - m31 ) < epsilon ) &&
304
+ ( Math.abs( m23 - m32 ) < epsilon ) ) {
305
+
306
+ // singularity found
307
+ // first check for identity matrix which must have +1 for all terms
308
+ // in leading diagonal and zero in other terms
309
+
310
+ if ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&
311
+ ( Math.abs( m13 + m31 ) < epsilon2 ) &&
312
+ ( Math.abs( m23 + m32 ) < epsilon2 ) &&
313
+ ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {
314
+
315
+ // this singularity is identity matrix so angle = 0
316
+
317
+ this.set( 1, 0, 0, 0 );
318
+
319
+ return this; // zero angle, arbitrary axis
320
+
321
+ }
322
+
323
+ // otherwise this singularity is angle = 180
324
+
325
+ angle = Math.PI;
326
+
327
+ const xx = ( m11 + 1 ) / 2;
328
+ const yy = ( m22 + 1 ) / 2;
329
+ const zz = ( m33 + 1 ) / 2;
330
+ const xy = ( m12 + m21 ) / 4;
331
+ const xz = ( m13 + m31 ) / 4;
332
+ const yz = ( m23 + m32 ) / 4;
333
+
334
+ if ( ( xx > yy ) && ( xx > zz ) ) {
335
+
336
+ // m11 is the largest diagonal term
337
+
338
+ if ( xx < epsilon ) {
339
+
340
+ x = 0;
341
+ y = 0.707106781;
342
+ z = 0.707106781;
343
+
344
+ } else {
345
+
346
+ x = Math.sqrt( xx );
347
+ y = xy / x;
348
+ z = xz / x;
349
+
350
+ }
351
+
352
+ } else if ( yy > zz ) {
353
+
354
+ // m22 is the largest diagonal term
355
+
356
+ if ( yy < epsilon ) {
357
+
358
+ x = 0.707106781;
359
+ y = 0;
360
+ z = 0.707106781;
361
+
362
+ } else {
363
+
364
+ y = Math.sqrt( yy );
365
+ x = xy / y;
366
+ z = yz / y;
367
+
368
+ }
369
+
370
+ } else {
371
+
372
+ // m33 is the largest diagonal term so base result on this
373
+
374
+ if ( zz < epsilon ) {
375
+
376
+ x = 0.707106781;
377
+ y = 0.707106781;
378
+ z = 0;
379
+
380
+ } else {
381
+
382
+ z = Math.sqrt( zz );
383
+ x = xz / z;
384
+ y = yz / z;
385
+
386
+ }
387
+
388
+ }
389
+
390
+ this.set( x, y, z, angle );
391
+
392
+ return this; // return 180 deg rotation
393
+
394
+ }
395
+
396
+ // as we have reached here there are no singularities so we can handle normally
397
+
398
+ let s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +
399
+ ( m13 - m31 ) * ( m13 - m31 ) +
400
+ ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize
401
+
402
+ if ( Math.abs( s ) < 0.001 ) s = 1;
403
+
404
+ // prevent divide by zero, should not happen if matrix is orthogonal and should be
405
+ // caught by singularity test above, but I've left it in just in case
406
+
407
+ this.x = ( m32 - m23 ) / s;
408
+ this.y = ( m13 - m31 ) / s;
409
+ this.z = ( m21 - m12 ) / s;
410
+ this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );
411
+
412
+ return this;
413
+
414
+ }
415
+
416
+ min( v ) {
417
+
418
+ this.x = Math.min( this.x, v.x );
419
+ this.y = Math.min( this.y, v.y );
420
+ this.z = Math.min( this.z, v.z );
421
+ this.w = Math.min( this.w, v.w );
422
+
423
+ return this;
424
+
425
+ }
426
+
427
+ max( v ) {
428
+
429
+ this.x = Math.max( this.x, v.x );
430
+ this.y = Math.max( this.y, v.y );
431
+ this.z = Math.max( this.z, v.z );
432
+ this.w = Math.max( this.w, v.w );
433
+
434
+ return this;
435
+
436
+ }
437
+
438
+ clamp( min, max ) {
439
+
440
+ // assumes min < max, componentwise
441
+
442
+ this.x = Math.max( min.x, Math.min( max.x, this.x ) );
443
+ this.y = Math.max( min.y, Math.min( max.y, this.y ) );
444
+ this.z = Math.max( min.z, Math.min( max.z, this.z ) );
445
+ this.w = Math.max( min.w, Math.min( max.w, this.w ) );
446
+
447
+ return this;
448
+
449
+ }
450
+
451
+ clampScalar( minVal, maxVal ) {
452
+
453
+ this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
454
+ this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
455
+ this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
456
+ this.w = Math.max( minVal, Math.min( maxVal, this.w ) );
457
+
458
+ return this;
459
+
460
+ }
461
+
462
+ clampLength( min, max ) {
463
+
464
+ const length = this.length();
465
+
466
+ return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
467
+
468
+ }
469
+
470
+ floor() {
471
+
472
+ this.x = Math.floor( this.x );
473
+ this.y = Math.floor( this.y );
474
+ this.z = Math.floor( this.z );
475
+ this.w = Math.floor( this.w );
476
+
477
+ return this;
478
+
479
+ }
480
+
481
+ ceil() {
482
+
483
+ this.x = Math.ceil( this.x );
484
+ this.y = Math.ceil( this.y );
485
+ this.z = Math.ceil( this.z );
486
+ this.w = Math.ceil( this.w );
487
+
488
+ return this;
489
+
490
+ }
491
+
492
+ round() {
493
+
494
+ this.x = Math.round( this.x );
495
+ this.y = Math.round( this.y );
496
+ this.z = Math.round( this.z );
497
+ this.w = Math.round( this.w );
498
+
499
+ return this;
500
+
501
+ }
502
+
503
+ roundToZero() {
504
+
505
+ this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
506
+ this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
507
+ this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
508
+ this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
509
+
510
+ return this;
511
+
512
+ }
513
+
514
+ negate() {
515
+
516
+ this.x = - this.x;
517
+ this.y = - this.y;
518
+ this.z = - this.z;
519
+ this.w = - this.w;
520
+
521
+ return this;
522
+
523
+ }
524
+
525
+ dot( v ) {
526
+
527
+ return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
528
+
529
+ }
530
+
531
+ lengthSq() {
532
+
533
+ return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
534
+
535
+ }
536
+
537
+ length() {
538
+
539
+ return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
540
+
541
+ }
542
+
543
+ manhattanLength() {
544
+
545
+ return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );
546
+
547
+ }
548
+
549
+ normalize() {
550
+
551
+ return this.divideScalar( this.length() || 1 );
552
+
553
+ }
554
+
555
+ setLength( length ) {
556
+
557
+ return this.normalize().multiplyScalar( length );
558
+
559
+ }
560
+
561
+ lerp( v, alpha ) {
562
+
563
+ this.x += ( v.x - this.x ) * alpha;
564
+ this.y += ( v.y - this.y ) * alpha;
565
+ this.z += ( v.z - this.z ) * alpha;
566
+ this.w += ( v.w - this.w ) * alpha;
567
+
568
+ return this;
569
+
570
+ }
571
+
572
+ lerpVectors( v1, v2, alpha ) {
573
+
574
+ this.x = v1.x + ( v2.x - v1.x ) * alpha;
575
+ this.y = v1.y + ( v2.y - v1.y ) * alpha;
576
+ this.z = v1.z + ( v2.z - v1.z ) * alpha;
577
+ this.w = v1.w + ( v2.w - v1.w ) * alpha;
578
+
579
+ return this;
580
+
581
+ }
582
+
583
+ equals( v ) {
584
+
585
+ return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );
586
+
587
+ }
588
+
589
+ fromArray( array, offset = 0 ) {
590
+
591
+ this.x = array[ offset ];
592
+ this.y = array[ offset + 1 ];
593
+ this.z = array[ offset + 2 ];
594
+ this.w = array[ offset + 3 ];
595
+
596
+ return this;
597
+
598
+ }
599
+
600
+ toArray( array = [], offset = 0 ) {
601
+
602
+ array[ offset ] = this.x;
603
+ array[ offset + 1 ] = this.y;
604
+ array[ offset + 2 ] = this.z;
605
+ array[ offset + 3 ] = this.w;
606
+
607
+ return array;
608
+
609
+ }
610
+
611
+ fromBufferAttribute( attribute, index ) {
612
+
613
+ this.x = attribute.getX( index );
614
+ this.y = attribute.getY( index );
615
+ this.z = attribute.getZ( index );
616
+ this.w = attribute.getW( index );
617
+
618
+ return this;
619
+
620
+ }
621
+
622
+ random() {
623
+
624
+ this.x = Math.random();
625
+ this.y = Math.random();
626
+ this.z = Math.random();
627
+ this.w = Math.random();
628
+
629
+ return this;
630
+
631
+ }
632
+
633
+ *[ Symbol.iterator ]() {
634
+
635
+ yield this.x;
636
+ yield this.y;
637
+ yield this.z;
638
+ yield this.w;
639
+
640
+ }
641
+
642
+ }
643
+
644
+ export { Vector4 };