@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,715 @@
1
+ import * as MathUtils from './MathUtils.js';
2
+ import { Quaternion } from './Quaternion.js';
3
+
4
+ class Vector3 {
5
+
6
+ constructor(x = 0, y = 0, z = 0) {
7
+
8
+ Vector3.prototype.isVector3 = true;
9
+
10
+ this.x = x;
11
+ this.y = y;
12
+ this.z = z;
13
+
14
+ }
15
+
16
+ set(x, y, z) {
17
+
18
+ if (z === undefined) z = this.z; // sprite.scale.set(x,y)
19
+
20
+ this.x = x;
21
+ this.y = y;
22
+ this.z = z;
23
+
24
+ return this;
25
+
26
+ }
27
+
28
+ setScalar(scalar) {
29
+
30
+ this.x = scalar;
31
+ this.y = scalar;
32
+ this.z = scalar;
33
+
34
+ return this;
35
+
36
+ }
37
+
38
+ setX(x) {
39
+
40
+ this.x = x;
41
+
42
+ return this;
43
+
44
+ }
45
+
46
+ setY(y) {
47
+
48
+ this.y = y;
49
+
50
+ return this;
51
+
52
+ }
53
+
54
+ setZ(z) {
55
+
56
+ this.z = z;
57
+
58
+ return this;
59
+
60
+ }
61
+
62
+ setComponent(index, value) {
63
+
64
+ switch (index) {
65
+
66
+ case 0: this.x = value; break;
67
+ case 1: this.y = value; break;
68
+ case 2: this.z = value; break;
69
+ default: throw new Error('index is out of range: ' + index);
70
+
71
+ }
72
+
73
+ return this;
74
+
75
+ }
76
+
77
+ getComponent(index) {
78
+
79
+ switch (index) {
80
+
81
+ case 0: return this.x;
82
+ case 1: return this.y;
83
+ case 2: return this.z;
84
+ default: throw new Error('index is out of range: ' + index);
85
+
86
+ }
87
+
88
+ }
89
+
90
+ clone() {
91
+
92
+ return new this.constructor(this.x, this.y, this.z);
93
+
94
+ }
95
+
96
+ copy(v) {
97
+
98
+ this.x = v.x;
99
+ this.y = v.y;
100
+ this.z = v.z;
101
+
102
+ return this;
103
+
104
+ }
105
+
106
+ add(v) {
107
+
108
+ this.x += v.x;
109
+ this.y += v.y;
110
+ this.z += v.z;
111
+
112
+ return this;
113
+
114
+ }
115
+
116
+ addScalar(s) {
117
+
118
+ this.x += s;
119
+ this.y += s;
120
+ this.z += s;
121
+
122
+ return this;
123
+
124
+ }
125
+
126
+ addVectors(a, b) {
127
+
128
+ this.x = a.x + b.x;
129
+ this.y = a.y + b.y;
130
+ this.z = a.z + b.z;
131
+
132
+ return this;
133
+
134
+ }
135
+
136
+ addScaledVector(v, s) {
137
+
138
+ this.x += v.x * s;
139
+ this.y += v.y * s;
140
+ this.z += v.z * s;
141
+
142
+ return this;
143
+
144
+ }
145
+
146
+ sub(v) {
147
+
148
+ this.x -= v.x;
149
+ this.y -= v.y;
150
+ this.z -= v.z;
151
+
152
+ return this;
153
+
154
+ }
155
+
156
+ subScalar(s) {
157
+
158
+ this.x -= s;
159
+ this.y -= s;
160
+ this.z -= s;
161
+
162
+ return this;
163
+
164
+ }
165
+
166
+ subVectors(a, b) {
167
+
168
+ this.x = a.x - b.x;
169
+ this.y = a.y - b.y;
170
+ this.z = a.z - b.z;
171
+
172
+ return this;
173
+
174
+ }
175
+
176
+ multiply(v) {
177
+
178
+ this.x *= v.x;
179
+ this.y *= v.y;
180
+ this.z *= v.z;
181
+
182
+ return this;
183
+
184
+ }
185
+
186
+ multiplyScalar(scalar) {
187
+
188
+ this.x *= scalar;
189
+ this.y *= scalar;
190
+ this.z *= scalar;
191
+
192
+ return this;
193
+
194
+ }
195
+
196
+ multiplyVectors(a, b) {
197
+
198
+ this.x = a.x * b.x;
199
+ this.y = a.y * b.y;
200
+ this.z = a.z * b.z;
201
+
202
+ return this;
203
+
204
+ }
205
+
206
+ applyEuler(euler) {
207
+
208
+ return this.applyQuaternion(_quaternion.setFromEuler(euler));
209
+
210
+ }
211
+
212
+ applyAxisAngle(axis, angle) {
213
+
214
+ return this.applyQuaternion(_quaternion.setFromAxisAngle(axis, angle));
215
+
216
+ }
217
+
218
+ applyMatrix3(m) {
219
+
220
+ const x = this.x, y = this.y, z = this.z;
221
+ const e = m.elements;
222
+
223
+ this.x = e[0] * x + e[3] * y + e[6] * z;
224
+ this.y = e[1] * x + e[4] * y + e[7] * z;
225
+ this.z = e[2] * x + e[5] * y + e[8] * z;
226
+
227
+ return this;
228
+
229
+ }
230
+
231
+ applyNormalMatrix(m) {
232
+
233
+ return this.applyMatrix3(m).normalize();
234
+
235
+ }
236
+
237
+ applyMatrix4(m) {
238
+
239
+ const x = this.x, y = this.y, z = this.z;
240
+ const e = m.elements;
241
+
242
+ const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
243
+
244
+ this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
245
+ this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
246
+ this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
247
+
248
+ return this;
249
+
250
+ }
251
+
252
+ applyQuaternion(q) {
253
+
254
+ const x = this.x, y = this.y, z = this.z;
255
+ const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
256
+
257
+ // calculate quat * vector
258
+
259
+ const ix = qw * x + qy * z - qz * y;
260
+ const iy = qw * y + qz * x - qx * z;
261
+ const iz = qw * z + qx * y - qy * x;
262
+ const iw = - qx * x - qy * y - qz * z;
263
+
264
+ // calculate result * inverse quat
265
+
266
+ this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;
267
+ this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;
268
+ this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;
269
+
270
+ return this;
271
+
272
+ }
273
+
274
+ project(camera) {
275
+
276
+ return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);
277
+
278
+ }
279
+
280
+ unproject(camera) {
281
+
282
+ return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);
283
+
284
+ }
285
+
286
+ transformDirection(m) {
287
+
288
+ // input: THREE.Matrix4 affine matrix
289
+ // vector interpreted as a direction
290
+
291
+ const x = this.x, y = this.y, z = this.z;
292
+ const e = m.elements;
293
+
294
+ this.x = e[0] * x + e[4] * y + e[8] * z;
295
+ this.y = e[1] * x + e[5] * y + e[9] * z;
296
+ this.z = e[2] * x + e[6] * y + e[10] * z;
297
+
298
+ return this.normalize();
299
+
300
+ }
301
+
302
+ divide(v) {
303
+
304
+ this.x /= v.x;
305
+ this.y /= v.y;
306
+ this.z /= v.z;
307
+
308
+ return this;
309
+
310
+ }
311
+
312
+ divideScalar(scalar) {
313
+
314
+ return this.multiplyScalar(1 / scalar);
315
+
316
+ }
317
+
318
+ min(v) {
319
+
320
+ this.x = Math.min(this.x, v.x);
321
+ this.y = Math.min(this.y, v.y);
322
+ this.z = Math.min(this.z, v.z);
323
+
324
+ return this;
325
+
326
+ }
327
+
328
+ max(v) {
329
+
330
+ this.x = Math.max(this.x, v.x);
331
+ this.y = Math.max(this.y, v.y);
332
+ this.z = Math.max(this.z, v.z);
333
+
334
+ return this;
335
+
336
+ }
337
+
338
+ clamp(min, max) {
339
+
340
+ // assumes min < max, componentwise
341
+
342
+ this.x = Math.max(min.x, Math.min(max.x, this.x));
343
+ this.y = Math.max(min.y, Math.min(max.y, this.y));
344
+ this.z = Math.max(min.z, Math.min(max.z, this.z));
345
+
346
+ return this;
347
+
348
+ }
349
+
350
+ clampScalar(minVal, maxVal) {
351
+
352
+ this.x = Math.max(minVal, Math.min(maxVal, this.x));
353
+ this.y = Math.max(minVal, Math.min(maxVal, this.y));
354
+ this.z = Math.max(minVal, Math.min(maxVal, this.z));
355
+
356
+ return this;
357
+
358
+ }
359
+
360
+ clampLength(min, max) {
361
+
362
+ const length = this.length();
363
+
364
+ return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
365
+
366
+ }
367
+
368
+ floor() {
369
+
370
+ this.x = Math.floor(this.x);
371
+ this.y = Math.floor(this.y);
372
+ this.z = Math.floor(this.z);
373
+
374
+ return this;
375
+
376
+ }
377
+
378
+ ceil() {
379
+
380
+ this.x = Math.ceil(this.x);
381
+ this.y = Math.ceil(this.y);
382
+ this.z = Math.ceil(this.z);
383
+
384
+ return this;
385
+
386
+ }
387
+
388
+ round() {
389
+
390
+ this.x = Math.round(this.x);
391
+ this.y = Math.round(this.y);
392
+ this.z = Math.round(this.z);
393
+
394
+ return this;
395
+
396
+ }
397
+
398
+ roundToZero() {
399
+
400
+ this.x = (this.x < 0) ? Math.ceil(this.x) : Math.floor(this.x);
401
+ this.y = (this.y < 0) ? Math.ceil(this.y) : Math.floor(this.y);
402
+ this.z = (this.z < 0) ? Math.ceil(this.z) : Math.floor(this.z);
403
+
404
+ return this;
405
+
406
+ }
407
+
408
+ negate() {
409
+
410
+ this.x = - this.x;
411
+ this.y = - this.y;
412
+ this.z = - this.z;
413
+
414
+ return this;
415
+
416
+ }
417
+
418
+ dot(v) {
419
+
420
+ return this.x * v.x + this.y * v.y + this.z * v.z;
421
+
422
+ }
423
+
424
+ // TODO lengthSquared?
425
+
426
+ lengthSq() {
427
+
428
+ return this.x * this.x + this.y * this.y + this.z * this.z;
429
+
430
+ }
431
+
432
+ length() {
433
+
434
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
435
+
436
+ }
437
+
438
+ manhattanLength() {
439
+
440
+ return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
441
+
442
+ }
443
+
444
+ normalize() {
445
+
446
+ return this.divideScalar(this.length() || 1);
447
+
448
+ }
449
+
450
+ setLength(length) {
451
+
452
+ return this.normalize().multiplyScalar(length);
453
+
454
+ }
455
+
456
+ lerp(v, alpha) {
457
+
458
+ this.x += (v.x - this.x) * alpha;
459
+ this.y += (v.y - this.y) * alpha;
460
+ this.z += (v.z - this.z) * alpha;
461
+
462
+ return this;
463
+
464
+ }
465
+
466
+ lerpVectors(v1, v2, alpha) {
467
+
468
+ this.x = v1.x + (v2.x - v1.x) * alpha;
469
+ this.y = v1.y + (v2.y - v1.y) * alpha;
470
+ this.z = v1.z + (v2.z - v1.z) * alpha;
471
+
472
+ return this;
473
+
474
+ }
475
+
476
+ cross(v) {
477
+
478
+ return this.crossVectors(this, v);
479
+
480
+ }
481
+
482
+ crossVectors(a, b) {
483
+
484
+ const ax = a.x, ay = a.y, az = a.z;
485
+ const bx = b.x, by = b.y, bz = b.z;
486
+
487
+ this.x = ay * bz - az * by;
488
+ this.y = az * bx - ax * bz;
489
+ this.z = ax * by - ay * bx;
490
+
491
+ return this;
492
+
493
+ }
494
+
495
+ projectOnVector(v) {
496
+
497
+ const denominator = v.lengthSq();
498
+
499
+ if (denominator === 0) return this.set(0, 0, 0);
500
+
501
+ const scalar = v.dot(this) / denominator;
502
+
503
+ return this.copy(v).multiplyScalar(scalar);
504
+
505
+ }
506
+
507
+ projectOnPlane(planeNormal) {
508
+
509
+ _vector.copy(this).projectOnVector(planeNormal);
510
+
511
+ return this.sub(_vector);
512
+
513
+ }
514
+
515
+ reflect(normal) {
516
+
517
+ // reflect incident vector off plane orthogonal to normal
518
+ // normal is assumed to have unit length
519
+
520
+ return this.sub(_vector.copy(normal).multiplyScalar(2 * this.dot(normal)));
521
+
522
+ }
523
+
524
+ angleTo(v) {
525
+
526
+ const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
527
+
528
+ if (denominator === 0) return Math.PI / 2;
529
+
530
+ const theta = this.dot(v) / denominator;
531
+
532
+ // clamp, to handle numerical problems
533
+
534
+ return Math.acos(MathUtils.clamp(theta, - 1, 1));
535
+
536
+ }
537
+
538
+ distanceTo(v) {
539
+
540
+ return Math.sqrt(this.distanceToSquared(v));
541
+
542
+ }
543
+
544
+ distanceToSquared(v) {
545
+
546
+ const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
547
+
548
+ return dx * dx + dy * dy + dz * dz;
549
+
550
+ }
551
+
552
+ manhattanDistanceTo(v) {
553
+
554
+ return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);
555
+
556
+ }
557
+
558
+ setFromSpherical(s) {
559
+
560
+ return this.setFromSphericalCoords(s.radius, s.phi, s.theta);
561
+
562
+ }
563
+
564
+ setFromSphericalCoords(radius, phi, theta) {
565
+
566
+ const sinPhiRadius = Math.sin(phi) * radius;
567
+
568
+ this.x = sinPhiRadius * Math.sin(theta);
569
+ this.y = Math.cos(phi) * radius;
570
+ this.z = sinPhiRadius * Math.cos(theta);
571
+
572
+ return this;
573
+
574
+ }
575
+
576
+ setFromCylindrical(c) {
577
+
578
+ return this.setFromCylindricalCoords(c.radius, c.theta, c.y);
579
+
580
+ }
581
+
582
+ setFromCylindricalCoords(radius, theta, y) {
583
+
584
+ this.x = radius * Math.sin(theta);
585
+ this.y = y;
586
+ this.z = radius * Math.cos(theta);
587
+
588
+ return this;
589
+
590
+ }
591
+
592
+ setFromMatrixPosition(m) {
593
+
594
+ const e = m.elements;
595
+
596
+ this.x = e[12];
597
+ this.y = e[13];
598
+ this.z = e[14];
599
+
600
+ return this;
601
+
602
+ }
603
+
604
+ setFromMatrixScale(m) {
605
+
606
+ const sx = this.setFromMatrixColumn(m, 0).length();
607
+ const sy = this.setFromMatrixColumn(m, 1).length();
608
+ const sz = this.setFromMatrixColumn(m, 2).length();
609
+
610
+ this.x = sx;
611
+ this.y = sy;
612
+ this.z = sz;
613
+
614
+ return this;
615
+
616
+ }
617
+
618
+ setFromMatrixColumn(m, index) {
619
+
620
+ return this.fromArray(m.elements, index * 4);
621
+
622
+ }
623
+
624
+ setFromMatrix3Column(m, index) {
625
+
626
+ return this.fromArray(m.elements, index * 3);
627
+
628
+ }
629
+
630
+ setFromEuler(e) {
631
+
632
+ this.x = e._x;
633
+ this.y = e._y;
634
+ this.z = e._z;
635
+
636
+ return this;
637
+
638
+ }
639
+
640
+ equals(v) {
641
+
642
+ return ((v.x === this.x) && (v.y === this.y) && (v.z === this.z));
643
+
644
+ }
645
+
646
+ fromArray(array, offset = 0) {
647
+
648
+ this.x = array[offset];
649
+ this.y = array[offset + 1];
650
+ this.z = array[offset + 2];
651
+
652
+ return this;
653
+
654
+ }
655
+
656
+ toArray(array = [], offset = 0) {
657
+
658
+ array[offset] = this.x;
659
+ array[offset + 1] = this.y;
660
+ array[offset + 2] = this.z;
661
+
662
+ return array;
663
+
664
+ }
665
+
666
+ fromBufferAttribute(attribute, index) {
667
+
668
+ this.x = attribute.getX(index);
669
+ this.y = attribute.getY(index);
670
+ this.z = attribute.getZ(index);
671
+
672
+ return this;
673
+
674
+ }
675
+
676
+ random() {
677
+
678
+ this.x = Math.random();
679
+ this.y = Math.random();
680
+ this.z = Math.random();
681
+
682
+ return this;
683
+
684
+ }
685
+
686
+ randomDirection() {
687
+
688
+ // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
689
+
690
+ const u = (Math.random() - 0.5) * 2;
691
+ const t = Math.random() * Math.PI * 2;
692
+ const f = Math.sqrt(1 - u ** 2);
693
+
694
+ this.x = f * Math.cos(t);
695
+ this.y = f * Math.sin(t);
696
+ this.z = u;
697
+
698
+ return this;
699
+
700
+ }
701
+
702
+ *[Symbol.iterator]() {
703
+
704
+ yield this.x;
705
+ yield this.y;
706
+ yield this.z;
707
+
708
+ }
709
+
710
+ }
711
+
712
+ const _vector = /*@__PURE__*/ new Vector3();
713
+ const _quaternion = /*@__PURE__*/ new Quaternion();
714
+
715
+ export { Vector3 };