@gmgis/gm-sdk 1.12.5 → 2.0.2

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 (159) hide show
  1. package/dist/dist/index.js +1848 -0
  2. package/dist/gm.min.js +16983 -16483
  3. package/dist/index.js +1436 -1434
  4. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  5. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  7. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  8. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  9. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  10. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  11. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  12. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  13. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  14. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  15. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  16. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  17. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  18. package/dist/resources/Workers/{chunk-I2ITFFPX.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-PRGYLLJT.js → chunk-ARG42DC4.js} +2 -31
  21. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  22. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  23. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  24. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  25. package/dist/resources/Workers/{chunk-DI5NGJUP.js → chunk-D6AA5QVT.js} +2 -20
  26. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  27. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  28. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  29. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  30. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  31. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  32. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  33. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  34. package/dist/resources/Workers/{chunk-7JO7GPJN.js → chunk-GBYLG25F.js} +2 -15
  35. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  36. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  37. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  38. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  39. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  40. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  41. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  42. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  43. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  44. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  45. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  46. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  47. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  48. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  49. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  50. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  51. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  52. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  53. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  54. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  55. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  56. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  57. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  58. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  59. package/dist/resources/Workers/{chunk-6CHGCNMW.js → chunk-WZDE3RYP.js} +4 -34
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -40
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -32
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -209
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -175
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -121
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -481
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -199
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1237
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -542
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -34
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -205
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -45
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -38
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -33
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -35
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -32
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -210
  78. package/dist/resources/Workers/createGeometry.js +2 -144
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1582
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -198
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -98
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1381
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -509
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -470
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -354
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -251
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1246
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -453
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -374
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -92
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -92
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -466
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -361
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -359
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -236
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -539
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2252
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -729
  101. package/dist/resources/Workers/createWallGeometry.js +2 -464
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -312
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2642
  105. package/dist/resources/Workers/decodeI3S.js +2 -1319
  106. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  107. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  108. package/dist/resources/Workers/transcodeKTX2.js +29 -3360
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -793
  111. package/package.json +74 -74
  112. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  113. package/dist/resources/Workers/chunk-26GA3JAM.js +0 -139
  114. package/dist/resources/Workers/chunk-27HUZ7SA.js +0 -305
  115. package/dist/resources/Workers/chunk-2ZGOQXYU.js +0 -171
  116. package/dist/resources/Workers/chunk-3Q2L65QU.js +0 -1258
  117. package/dist/resources/Workers/chunk-472HQ3EH.js +0 -100
  118. package/dist/resources/Workers/chunk-5ODQSF26.js +0 -101
  119. package/dist/resources/Workers/chunk-5OOFQLKF.js +0 -634
  120. package/dist/resources/Workers/chunk-5PTXS2GO.js +0 -10390
  121. package/dist/resources/Workers/chunk-76BYBWHP.js +0 -122
  122. package/dist/resources/Workers/chunk-7BMOHCPM.js +0 -390
  123. package/dist/resources/Workers/chunk-7KTQP4VB.js +0 -59
  124. package/dist/resources/Workers/chunk-7O373FFS.js +0 -665
  125. package/dist/resources/Workers/chunk-AD63PIY6.js +0 -163
  126. package/dist/resources/Workers/chunk-BHQJ2NT7.js +0 -353
  127. package/dist/resources/Workers/chunk-C6YYBQXW.js +0 -102
  128. package/dist/resources/Workers/chunk-CKY7HOHV.js +0 -287
  129. package/dist/resources/Workers/chunk-DHYHSFFJ.js +0 -73
  130. package/dist/resources/Workers/chunk-E27BLMDD.js +0 -115
  131. package/dist/resources/Workers/chunk-E63IIM5T.js +0 -75
  132. package/dist/resources/Workers/chunk-E6V6SQZW.js +0 -456
  133. package/dist/resources/Workers/chunk-EJZTDTUH.js +0 -138
  134. package/dist/resources/Workers/chunk-FDOV2LBJ.js +0 -220
  135. package/dist/resources/Workers/chunk-FIGIZHAQ.js +0 -684
  136. package/dist/resources/Workers/chunk-GESF4OXQ.js +0 -1800
  137. package/dist/resources/Workers/chunk-GGZJN2TI.js +0 -2717
  138. package/dist/resources/Workers/chunk-GNBFYG7F.js +0 -1481
  139. package/dist/resources/Workers/chunk-GWCFU2SA.js +0 -300
  140. package/dist/resources/Workers/chunk-IBLIYJZR.js +0 -196
  141. package/dist/resources/Workers/chunk-JW4FOI6M.js +0 -476
  142. package/dist/resources/Workers/chunk-K4GQUNB5.js +0 -262
  143. package/dist/resources/Workers/chunk-M3GMB5OP.js +0 -834
  144. package/dist/resources/Workers/chunk-MXIZJAPH.js +0 -629
  145. package/dist/resources/Workers/chunk-N5KJGGCM.js +0 -1073
  146. package/dist/resources/Workers/chunk-NGPPMXRM.js +0 -435
  147. package/dist/resources/Workers/chunk-O3E4OAOE.js +0 -511
  148. package/dist/resources/Workers/chunk-PGRPDNHG.js +0 -1048
  149. package/dist/resources/Workers/chunk-S6MRMMQU.js +0 -157
  150. package/dist/resources/Workers/chunk-SMDOP47J.js +0 -945
  151. package/dist/resources/Workers/chunk-TGONEMZO.js +0 -421
  152. package/dist/resources/Workers/chunk-TKVT5GQM.js +0 -781
  153. package/dist/resources/Workers/chunk-U72QNFOJ.js +0 -758
  154. package/dist/resources/Workers/chunk-VJZB3WAV.js +0 -963
  155. package/dist/resources/Workers/chunk-VU2MNO7L.js +0 -239
  156. package/dist/resources/Workers/chunk-XY4BATBS.js +0 -500
  157. package/dist/resources/Workers/chunk-YFXQECWV.js +0 -2857
  158. package/dist/resources/Workers/chunk-YSGTGQQO.js +0 -398
  159. package/dist/resources/Workers/chunk-YZ733KKS.js +0 -368
@@ -1,2857 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
5
- *
6
- * Copyright 2011-2022 Cesium Contributors
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- *
20
- * Columbus View (Pat. Pend.)
21
- *
22
- * Portions licensed separately.
23
- * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
- */
25
-
26
- import {
27
- Math_default
28
- } from "./chunk-XY4BATBS.js";
29
- import {
30
- defaultValue_default
31
- } from "./chunk-7JO7GPJN.js";
32
- import {
33
- Check_default,
34
- DeveloperError_default
35
- } from "./chunk-AD63PIY6.js";
36
- import {
37
- defined_default
38
- } from "./chunk-E63IIM5T.js";
39
-
40
- // packages/engine/Source/Core/Cartesian3.js
41
- function Cartesian3(x, y, z) {
42
- this.x = defaultValue_default(x, 0);
43
- this.y = defaultValue_default(y, 0);
44
- this.z = defaultValue_default(z, 0);
45
- }
46
- Cartesian3.fromSpherical = function(spherical, result) {
47
- Check_default.typeOf.object("spherical", spherical);
48
- if (!defined_default(result)) {
49
- result = new Cartesian3();
50
- }
51
- const clock = spherical.clock;
52
- const cone = spherical.cone;
53
- const magnitude = defaultValue_default(spherical.magnitude, 1);
54
- const radial = magnitude * Math.sin(cone);
55
- result.x = radial * Math.cos(clock);
56
- result.y = radial * Math.sin(clock);
57
- result.z = magnitude * Math.cos(cone);
58
- return result;
59
- };
60
- Cartesian3.fromElements = function(x, y, z, result) {
61
- if (!defined_default(result)) {
62
- return new Cartesian3(x, y, z);
63
- }
64
- result.x = x;
65
- result.y = y;
66
- result.z = z;
67
- return result;
68
- };
69
- Cartesian3.clone = function(cartesian, result) {
70
- if (!defined_default(cartesian)) {
71
- return void 0;
72
- }
73
- if (!defined_default(result)) {
74
- return new Cartesian3(cartesian.x, cartesian.y, cartesian.z);
75
- }
76
- result.x = cartesian.x;
77
- result.y = cartesian.y;
78
- result.z = cartesian.z;
79
- return result;
80
- };
81
- Cartesian3.fromCartesian4 = Cartesian3.clone;
82
- Cartesian3.packedLength = 3;
83
- Cartesian3.pack = function(value, array, startingIndex) {
84
- Check_default.typeOf.object("value", value);
85
- Check_default.defined("array", array);
86
- startingIndex = defaultValue_default(startingIndex, 0);
87
- array[startingIndex++] = value.x;
88
- array[startingIndex++] = value.y;
89
- array[startingIndex] = value.z;
90
- return array;
91
- };
92
- Cartesian3.unpack = function(array, startingIndex, result) {
93
- Check_default.defined("array", array);
94
- startingIndex = defaultValue_default(startingIndex, 0);
95
- if (!defined_default(result)) {
96
- result = new Cartesian3();
97
- }
98
- result.x = array[startingIndex++];
99
- result.y = array[startingIndex++];
100
- result.z = array[startingIndex];
101
- return result;
102
- };
103
- Cartesian3.packArray = function(array, result) {
104
- Check_default.defined("array", array);
105
- const length = array.length;
106
- const resultLength = length * 3;
107
- if (!defined_default(result)) {
108
- result = new Array(resultLength);
109
- } else if (!Array.isArray(result) && result.length !== resultLength) {
110
- throw new DeveloperError_default(
111
- "If result is a typed array, it must have exactly array.length * 3 elements"
112
- );
113
- } else if (result.length !== resultLength) {
114
- result.length = resultLength;
115
- }
116
- for (let i = 0; i < length; ++i) {
117
- Cartesian3.pack(array[i], result, i * 3);
118
- }
119
- return result;
120
- };
121
- Cartesian3.unpackArray = function(array, result) {
122
- Check_default.defined("array", array);
123
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 3);
124
- if (array.length % 3 !== 0) {
125
- throw new DeveloperError_default("array length must be a multiple of 3.");
126
- }
127
- const length = array.length;
128
- if (!defined_default(result)) {
129
- result = new Array(length / 3);
130
- } else {
131
- result.length = length / 3;
132
- }
133
- for (let i = 0; i < length; i += 3) {
134
- const index = i / 3;
135
- result[index] = Cartesian3.unpack(array, i, result[index]);
136
- }
137
- return result;
138
- };
139
- Cartesian3.fromArray = Cartesian3.unpack;
140
- Cartesian3.maximumComponent = function(cartesian) {
141
- Check_default.typeOf.object("cartesian", cartesian);
142
- return Math.max(cartesian.x, cartesian.y, cartesian.z);
143
- };
144
- Cartesian3.minimumComponent = function(cartesian) {
145
- Check_default.typeOf.object("cartesian", cartesian);
146
- return Math.min(cartesian.x, cartesian.y, cartesian.z);
147
- };
148
- Cartesian3.minimumByComponent = function(first, second, result) {
149
- Check_default.typeOf.object("first", first);
150
- Check_default.typeOf.object("second", second);
151
- Check_default.typeOf.object("result", result);
152
- result.x = Math.min(first.x, second.x);
153
- result.y = Math.min(first.y, second.y);
154
- result.z = Math.min(first.z, second.z);
155
- return result;
156
- };
157
- Cartesian3.maximumByComponent = function(first, second, result) {
158
- Check_default.typeOf.object("first", first);
159
- Check_default.typeOf.object("second", second);
160
- Check_default.typeOf.object("result", result);
161
- result.x = Math.max(first.x, second.x);
162
- result.y = Math.max(first.y, second.y);
163
- result.z = Math.max(first.z, second.z);
164
- return result;
165
- };
166
- Cartesian3.clamp = function(value, min, max, result) {
167
- Check_default.typeOf.object("value", value);
168
- Check_default.typeOf.object("min", min);
169
- Check_default.typeOf.object("max", max);
170
- Check_default.typeOf.object("result", result);
171
- const x = Math_default.clamp(value.x, min.x, max.x);
172
- const y = Math_default.clamp(value.y, min.y, max.y);
173
- const z = Math_default.clamp(value.z, min.z, max.z);
174
- result.x = x;
175
- result.y = y;
176
- result.z = z;
177
- return result;
178
- };
179
- Cartesian3.magnitudeSquared = function(cartesian) {
180
- Check_default.typeOf.object("cartesian", cartesian);
181
- return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z;
182
- };
183
- Cartesian3.magnitude = function(cartesian) {
184
- return Math.sqrt(Cartesian3.magnitudeSquared(cartesian));
185
- };
186
- var distanceScratch = new Cartesian3();
187
- Cartesian3.distance = function(left, right) {
188
- Check_default.typeOf.object("left", left);
189
- Check_default.typeOf.object("right", right);
190
- Cartesian3.subtract(left, right, distanceScratch);
191
- return Cartesian3.magnitude(distanceScratch);
192
- };
193
- Cartesian3.distanceSquared = function(left, right) {
194
- Check_default.typeOf.object("left", left);
195
- Check_default.typeOf.object("right", right);
196
- Cartesian3.subtract(left, right, distanceScratch);
197
- return Cartesian3.magnitudeSquared(distanceScratch);
198
- };
199
- Cartesian3.normalize = function(cartesian, result) {
200
- Check_default.typeOf.object("cartesian", cartesian);
201
- Check_default.typeOf.object("result", result);
202
- const magnitude = Cartesian3.magnitude(cartesian);
203
- result.x = cartesian.x / magnitude;
204
- result.y = cartesian.y / magnitude;
205
- result.z = cartesian.z / magnitude;
206
- if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z)) {
207
- throw new DeveloperError_default("normalized result is not a number");
208
- }
209
- return result;
210
- };
211
- Cartesian3.dot = function(left, right) {
212
- Check_default.typeOf.object("left", left);
213
- Check_default.typeOf.object("right", right);
214
- return left.x * right.x + left.y * right.y + left.z * right.z;
215
- };
216
- Cartesian3.multiplyComponents = function(left, right, result) {
217
- Check_default.typeOf.object("left", left);
218
- Check_default.typeOf.object("right", right);
219
- Check_default.typeOf.object("result", result);
220
- result.x = left.x * right.x;
221
- result.y = left.y * right.y;
222
- result.z = left.z * right.z;
223
- return result;
224
- };
225
- Cartesian3.divideComponents = function(left, right, result) {
226
- Check_default.typeOf.object("left", left);
227
- Check_default.typeOf.object("right", right);
228
- Check_default.typeOf.object("result", result);
229
- result.x = left.x / right.x;
230
- result.y = left.y / right.y;
231
- result.z = left.z / right.z;
232
- return result;
233
- };
234
- Cartesian3.add = function(left, right, result) {
235
- Check_default.typeOf.object("left", left);
236
- Check_default.typeOf.object("right", right);
237
- Check_default.typeOf.object("result", result);
238
- result.x = left.x + right.x;
239
- result.y = left.y + right.y;
240
- result.z = left.z + right.z;
241
- return result;
242
- };
243
- Cartesian3.subtract = function(left, right, result) {
244
- Check_default.typeOf.object("left", left);
245
- Check_default.typeOf.object("right", right);
246
- Check_default.typeOf.object("result", result);
247
- result.x = left.x - right.x;
248
- result.y = left.y - right.y;
249
- result.z = left.z - right.z;
250
- return result;
251
- };
252
- Cartesian3.multiplyByScalar = function(cartesian, scalar, result) {
253
- Check_default.typeOf.object("cartesian", cartesian);
254
- Check_default.typeOf.number("scalar", scalar);
255
- Check_default.typeOf.object("result", result);
256
- result.x = cartesian.x * scalar;
257
- result.y = cartesian.y * scalar;
258
- result.z = cartesian.z * scalar;
259
- return result;
260
- };
261
- Cartesian3.divideByScalar = function(cartesian, scalar, result) {
262
- Check_default.typeOf.object("cartesian", cartesian);
263
- Check_default.typeOf.number("scalar", scalar);
264
- Check_default.typeOf.object("result", result);
265
- result.x = cartesian.x / scalar;
266
- result.y = cartesian.y / scalar;
267
- result.z = cartesian.z / scalar;
268
- return result;
269
- };
270
- Cartesian3.negate = function(cartesian, result) {
271
- Check_default.typeOf.object("cartesian", cartesian);
272
- Check_default.typeOf.object("result", result);
273
- result.x = -cartesian.x;
274
- result.y = -cartesian.y;
275
- result.z = -cartesian.z;
276
- return result;
277
- };
278
- Cartesian3.abs = function(cartesian, result) {
279
- Check_default.typeOf.object("cartesian", cartesian);
280
- Check_default.typeOf.object("result", result);
281
- result.x = Math.abs(cartesian.x);
282
- result.y = Math.abs(cartesian.y);
283
- result.z = Math.abs(cartesian.z);
284
- return result;
285
- };
286
- var lerpScratch = new Cartesian3();
287
- Cartesian3.lerp = function(start, end, t, result) {
288
- Check_default.typeOf.object("start", start);
289
- Check_default.typeOf.object("end", end);
290
- Check_default.typeOf.number("t", t);
291
- Check_default.typeOf.object("result", result);
292
- Cartesian3.multiplyByScalar(end, t, lerpScratch);
293
- result = Cartesian3.multiplyByScalar(start, 1 - t, result);
294
- return Cartesian3.add(lerpScratch, result, result);
295
- };
296
- var angleBetweenScratch = new Cartesian3();
297
- var angleBetweenScratch2 = new Cartesian3();
298
- Cartesian3.angleBetween = function(left, right) {
299
- Check_default.typeOf.object("left", left);
300
- Check_default.typeOf.object("right", right);
301
- Cartesian3.normalize(left, angleBetweenScratch);
302
- Cartesian3.normalize(right, angleBetweenScratch2);
303
- const cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2);
304
- const sine = Cartesian3.magnitude(
305
- Cartesian3.cross(
306
- angleBetweenScratch,
307
- angleBetweenScratch2,
308
- angleBetweenScratch
309
- )
310
- );
311
- return Math.atan2(sine, cosine);
312
- };
313
- var mostOrthogonalAxisScratch = new Cartesian3();
314
- Cartesian3.mostOrthogonalAxis = function(cartesian, result) {
315
- Check_default.typeOf.object("cartesian", cartesian);
316
- Check_default.typeOf.object("result", result);
317
- const f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch);
318
- Cartesian3.abs(f, f);
319
- if (f.x <= f.y) {
320
- if (f.x <= f.z) {
321
- result = Cartesian3.clone(Cartesian3.UNIT_X, result);
322
- } else {
323
- result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
324
- }
325
- } else if (f.y <= f.z) {
326
- result = Cartesian3.clone(Cartesian3.UNIT_Y, result);
327
- } else {
328
- result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
329
- }
330
- return result;
331
- };
332
- Cartesian3.projectVector = function(a, b, result) {
333
- Check_default.defined("a", a);
334
- Check_default.defined("b", b);
335
- Check_default.defined("result", result);
336
- const scalar = Cartesian3.dot(a, b) / Cartesian3.dot(b, b);
337
- return Cartesian3.multiplyByScalar(b, scalar, result);
338
- };
339
- Cartesian3.equals = function(left, right) {
340
- return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z;
341
- };
342
- Cartesian3.equalsArray = function(cartesian, array, offset) {
343
- return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2];
344
- };
345
- Cartesian3.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
346
- return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
347
- left.x,
348
- right.x,
349
- relativeEpsilon,
350
- absoluteEpsilon
351
- ) && Math_default.equalsEpsilon(
352
- left.y,
353
- right.y,
354
- relativeEpsilon,
355
- absoluteEpsilon
356
- ) && Math_default.equalsEpsilon(
357
- left.z,
358
- right.z,
359
- relativeEpsilon,
360
- absoluteEpsilon
361
- );
362
- };
363
- Cartesian3.cross = function(left, right, result) {
364
- Check_default.typeOf.object("left", left);
365
- Check_default.typeOf.object("right", right);
366
- Check_default.typeOf.object("result", result);
367
- const leftX = left.x;
368
- const leftY = left.y;
369
- const leftZ = left.z;
370
- const rightX = right.x;
371
- const rightY = right.y;
372
- const rightZ = right.z;
373
- const x = leftY * rightZ - leftZ * rightY;
374
- const y = leftZ * rightX - leftX * rightZ;
375
- const z = leftX * rightY - leftY * rightX;
376
- result.x = x;
377
- result.y = y;
378
- result.z = z;
379
- return result;
380
- };
381
- Cartesian3.midpoint = function(left, right, result) {
382
- Check_default.typeOf.object("left", left);
383
- Check_default.typeOf.object("right", right);
384
- Check_default.typeOf.object("result", result);
385
- result.x = (left.x + right.x) * 0.5;
386
- result.y = (left.y + right.y) * 0.5;
387
- result.z = (left.z + right.z) * 0.5;
388
- return result;
389
- };
390
- Cartesian3.fromDegrees = function(longitude, latitude, height, ellipsoid, result) {
391
- Check_default.typeOf.number("longitude", longitude);
392
- Check_default.typeOf.number("latitude", latitude);
393
- longitude = Math_default.toRadians(longitude);
394
- latitude = Math_default.toRadians(latitude);
395
- return Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result);
396
- };
397
- var scratchN = new Cartesian3();
398
- var scratchK = new Cartesian3();
399
- Cartesian3._ellipsoidRadiiSquared = new Cartesian3(
400
- 6378137 * 6378137,
401
- 6378137 * 6378137,
402
- 6356752314245179e-9 * 6356752314245179e-9
403
- );
404
- Cartesian3.fromRadians = function(longitude, latitude, height, ellipsoid, result) {
405
- Check_default.typeOf.number("longitude", longitude);
406
- Check_default.typeOf.number("latitude", latitude);
407
- height = defaultValue_default(height, 0);
408
- const radiiSquared = !defined_default(ellipsoid) ? Cartesian3._ellipsoidRadiiSquared : ellipsoid.radiiSquared;
409
- const cosLatitude = Math.cos(latitude);
410
- scratchN.x = cosLatitude * Math.cos(longitude);
411
- scratchN.y = cosLatitude * Math.sin(longitude);
412
- scratchN.z = Math.sin(latitude);
413
- scratchN = Cartesian3.normalize(scratchN, scratchN);
414
- Cartesian3.multiplyComponents(radiiSquared, scratchN, scratchK);
415
- const gamma = Math.sqrt(Cartesian3.dot(scratchN, scratchK));
416
- scratchK = Cartesian3.divideByScalar(scratchK, gamma, scratchK);
417
- scratchN = Cartesian3.multiplyByScalar(scratchN, height, scratchN);
418
- if (!defined_default(result)) {
419
- result = new Cartesian3();
420
- }
421
- return Cartesian3.add(scratchK, scratchN, result);
422
- };
423
- Cartesian3.fromDegreesArray = function(coordinates, ellipsoid, result) {
424
- Check_default.defined("coordinates", coordinates);
425
- if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
426
- throw new DeveloperError_default(
427
- "the number of coordinates must be a multiple of 2 and at least 2"
428
- );
429
- }
430
- const length = coordinates.length;
431
- if (!defined_default(result)) {
432
- result = new Array(length / 2);
433
- } else {
434
- result.length = length / 2;
435
- }
436
- for (let i = 0; i < length; i += 2) {
437
- const longitude = coordinates[i];
438
- const latitude = coordinates[i + 1];
439
- const index = i / 2;
440
- result[index] = Cartesian3.fromDegrees(
441
- longitude,
442
- latitude,
443
- 0,
444
- ellipsoid,
445
- result[index]
446
- );
447
- }
448
- return result;
449
- };
450
- Cartesian3.fromRadiansArray = function(coordinates, ellipsoid, result) {
451
- Check_default.defined("coordinates", coordinates);
452
- if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
453
- throw new DeveloperError_default(
454
- "the number of coordinates must be a multiple of 2 and at least 2"
455
- );
456
- }
457
- const length = coordinates.length;
458
- if (!defined_default(result)) {
459
- result = new Array(length / 2);
460
- } else {
461
- result.length = length / 2;
462
- }
463
- for (let i = 0; i < length; i += 2) {
464
- const longitude = coordinates[i];
465
- const latitude = coordinates[i + 1];
466
- const index = i / 2;
467
- result[index] = Cartesian3.fromRadians(
468
- longitude,
469
- latitude,
470
- 0,
471
- ellipsoid,
472
- result[index]
473
- );
474
- }
475
- return result;
476
- };
477
- Cartesian3.fromDegreesArrayHeights = function(coordinates, ellipsoid, result) {
478
- Check_default.defined("coordinates", coordinates);
479
- if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
480
- throw new DeveloperError_default(
481
- "the number of coordinates must be a multiple of 3 and at least 3"
482
- );
483
- }
484
- const length = coordinates.length;
485
- if (!defined_default(result)) {
486
- result = new Array(length / 3);
487
- } else {
488
- result.length = length / 3;
489
- }
490
- for (let i = 0; i < length; i += 3) {
491
- const longitude = coordinates[i];
492
- const latitude = coordinates[i + 1];
493
- const height = coordinates[i + 2];
494
- const index = i / 3;
495
- result[index] = Cartesian3.fromDegrees(
496
- longitude,
497
- latitude,
498
- height,
499
- ellipsoid,
500
- result[index]
501
- );
502
- }
503
- return result;
504
- };
505
- Cartesian3.fromRadiansArrayHeights = function(coordinates, ellipsoid, result) {
506
- Check_default.defined("coordinates", coordinates);
507
- if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
508
- throw new DeveloperError_default(
509
- "the number of coordinates must be a multiple of 3 and at least 3"
510
- );
511
- }
512
- const length = coordinates.length;
513
- if (!defined_default(result)) {
514
- result = new Array(length / 3);
515
- } else {
516
- result.length = length / 3;
517
- }
518
- for (let i = 0; i < length; i += 3) {
519
- const longitude = coordinates[i];
520
- const latitude = coordinates[i + 1];
521
- const height = coordinates[i + 2];
522
- const index = i / 3;
523
- result[index] = Cartesian3.fromRadians(
524
- longitude,
525
- latitude,
526
- height,
527
- ellipsoid,
528
- result[index]
529
- );
530
- }
531
- return result;
532
- };
533
- Cartesian3.ZERO = Object.freeze(new Cartesian3(0, 0, 0));
534
- Cartesian3.ONE = Object.freeze(new Cartesian3(1, 1, 1));
535
- Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1, 0, 0));
536
- Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0, 1, 0));
537
- Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0, 0, 1));
538
- Cartesian3.prototype.clone = function(result) {
539
- return Cartesian3.clone(this, result);
540
- };
541
- Cartesian3.prototype.equals = function(right) {
542
- return Cartesian3.equals(this, right);
543
- };
544
- Cartesian3.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
545
- return Cartesian3.equalsEpsilon(
546
- this,
547
- right,
548
- relativeEpsilon,
549
- absoluteEpsilon
550
- );
551
- };
552
- Cartesian3.prototype.toString = function() {
553
- return `(${this.x}, ${this.y}, ${this.z})`;
554
- };
555
- var Cartesian3_default = Cartesian3;
556
-
557
- // packages/engine/Source/Core/scaleToGeodeticSurface.js
558
- var scaleToGeodeticSurfaceIntersection = new Cartesian3_default();
559
- var scaleToGeodeticSurfaceGradient = new Cartesian3_default();
560
- function scaleToGeodeticSurface(cartesian, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, result) {
561
- if (!defined_default(cartesian)) {
562
- throw new DeveloperError_default("cartesian is required.");
563
- }
564
- if (!defined_default(oneOverRadii)) {
565
- throw new DeveloperError_default("oneOverRadii is required.");
566
- }
567
- if (!defined_default(oneOverRadiiSquared)) {
568
- throw new DeveloperError_default("oneOverRadiiSquared is required.");
569
- }
570
- if (!defined_default(centerToleranceSquared)) {
571
- throw new DeveloperError_default("centerToleranceSquared is required.");
572
- }
573
- const positionX = cartesian.x;
574
- const positionY = cartesian.y;
575
- const positionZ = cartesian.z;
576
- const oneOverRadiiX = oneOverRadii.x;
577
- const oneOverRadiiY = oneOverRadii.y;
578
- const oneOverRadiiZ = oneOverRadii.z;
579
- const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
580
- const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
581
- const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
582
- const squaredNorm = x2 + y2 + z2;
583
- const ratio = Math.sqrt(1 / squaredNorm);
584
- const intersection = Cartesian3_default.multiplyByScalar(
585
- cartesian,
586
- ratio,
587
- scaleToGeodeticSurfaceIntersection
588
- );
589
- if (squaredNorm < centerToleranceSquared) {
590
- return !isFinite(ratio) ? void 0 : Cartesian3_default.clone(intersection, result);
591
- }
592
- const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
593
- const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
594
- const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
595
- const gradient = scaleToGeodeticSurfaceGradient;
596
- gradient.x = intersection.x * oneOverRadiiSquaredX * 2;
597
- gradient.y = intersection.y * oneOverRadiiSquaredY * 2;
598
- gradient.z = intersection.z * oneOverRadiiSquaredZ * 2;
599
- let lambda = (1 - ratio) * Cartesian3_default.magnitude(cartesian) / (0.5 * Cartesian3_default.magnitude(gradient));
600
- let correction = 0;
601
- let func;
602
- let denominator;
603
- let xMultiplier;
604
- let yMultiplier;
605
- let zMultiplier;
606
- let xMultiplier2;
607
- let yMultiplier2;
608
- let zMultiplier2;
609
- let xMultiplier3;
610
- let yMultiplier3;
611
- let zMultiplier3;
612
- do {
613
- lambda -= correction;
614
- xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
615
- yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
616
- zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
617
- xMultiplier2 = xMultiplier * xMultiplier;
618
- yMultiplier2 = yMultiplier * yMultiplier;
619
- zMultiplier2 = zMultiplier * zMultiplier;
620
- xMultiplier3 = xMultiplier2 * xMultiplier;
621
- yMultiplier3 = yMultiplier2 * yMultiplier;
622
- zMultiplier3 = zMultiplier2 * zMultiplier;
623
- func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
624
- denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
625
- const derivative = -2 * denominator;
626
- correction = func / derivative;
627
- } while (Math.abs(func) > Math_default.EPSILON12);
628
- if (!defined_default(result)) {
629
- return new Cartesian3_default(
630
- positionX * xMultiplier,
631
- positionY * yMultiplier,
632
- positionZ * zMultiplier
633
- );
634
- }
635
- result.x = positionX * xMultiplier;
636
- result.y = positionY * yMultiplier;
637
- result.z = positionZ * zMultiplier;
638
- return result;
639
- }
640
- var scaleToGeodeticSurface_default = scaleToGeodeticSurface;
641
-
642
- // packages/engine/Source/Core/Cartographic.js
643
- function Cartographic(longitude, latitude, height) {
644
- this.longitude = defaultValue_default(longitude, 0);
645
- this.latitude = defaultValue_default(latitude, 0);
646
- this.height = defaultValue_default(height, 0);
647
- }
648
- Cartographic.fromRadians = function(longitude, latitude, height, result) {
649
- Check_default.typeOf.number("longitude", longitude);
650
- Check_default.typeOf.number("latitude", latitude);
651
- height = defaultValue_default(height, 0);
652
- if (!defined_default(result)) {
653
- return new Cartographic(longitude, latitude, height);
654
- }
655
- result.longitude = longitude;
656
- result.latitude = latitude;
657
- result.height = height;
658
- return result;
659
- };
660
- Cartographic.fromDegrees = function(longitude, latitude, height, result) {
661
- Check_default.typeOf.number("longitude", longitude);
662
- Check_default.typeOf.number("latitude", latitude);
663
- longitude = Math_default.toRadians(longitude);
664
- latitude = Math_default.toRadians(latitude);
665
- return Cartographic.fromRadians(longitude, latitude, height, result);
666
- };
667
- var cartesianToCartographicN = new Cartesian3_default();
668
- var cartesianToCartographicP = new Cartesian3_default();
669
- var cartesianToCartographicH = new Cartesian3_default();
670
- Cartographic._ellipsoidOneOverRadii = new Cartesian3_default(
671
- 1 / 6378137,
672
- 1 / 6378137,
673
- 1 / 6356752314245179e-9
674
- );
675
- Cartographic._ellipsoidOneOverRadiiSquared = new Cartesian3_default(
676
- 1 / (6378137 * 6378137),
677
- 1 / (6378137 * 6378137),
678
- 1 / (6356752314245179e-9 * 6356752314245179e-9)
679
- );
680
- Cartographic._ellipsoidCenterToleranceSquared = Math_default.EPSILON1;
681
- Cartographic.fromCartesian = function(cartesian, ellipsoid, result) {
682
- const oneOverRadii = defined_default(ellipsoid) ? ellipsoid.oneOverRadii : Cartographic._ellipsoidOneOverRadii;
683
- const oneOverRadiiSquared = defined_default(ellipsoid) ? ellipsoid.oneOverRadiiSquared : Cartographic._ellipsoidOneOverRadiiSquared;
684
- const centerToleranceSquared = defined_default(ellipsoid) ? ellipsoid._centerToleranceSquared : Cartographic._ellipsoidCenterToleranceSquared;
685
- const p = scaleToGeodeticSurface_default(
686
- cartesian,
687
- oneOverRadii,
688
- oneOverRadiiSquared,
689
- centerToleranceSquared,
690
- cartesianToCartographicP
691
- );
692
- if (!defined_default(p)) {
693
- return void 0;
694
- }
695
- let n = Cartesian3_default.multiplyComponents(
696
- p,
697
- oneOverRadiiSquared,
698
- cartesianToCartographicN
699
- );
700
- n = Cartesian3_default.normalize(n, n);
701
- const h = Cartesian3_default.subtract(cartesian, p, cartesianToCartographicH);
702
- const longitude = Math.atan2(n.y, n.x);
703
- const latitude = Math.asin(n.z);
704
- const height = Math_default.sign(Cartesian3_default.dot(h, cartesian)) * Cartesian3_default.magnitude(h);
705
- if (!defined_default(result)) {
706
- return new Cartographic(longitude, latitude, height);
707
- }
708
- result.longitude = longitude;
709
- result.latitude = latitude;
710
- result.height = height;
711
- return result;
712
- };
713
- Cartographic.toCartesian = function(cartographic, ellipsoid, result) {
714
- Check_default.defined("cartographic", cartographic);
715
- return Cartesian3_default.fromRadians(
716
- cartographic.longitude,
717
- cartographic.latitude,
718
- cartographic.height,
719
- ellipsoid,
720
- result
721
- );
722
- };
723
- Cartographic.clone = function(cartographic, result) {
724
- if (!defined_default(cartographic)) {
725
- return void 0;
726
- }
727
- if (!defined_default(result)) {
728
- return new Cartographic(
729
- cartographic.longitude,
730
- cartographic.latitude,
731
- cartographic.height
732
- );
733
- }
734
- result.longitude = cartographic.longitude;
735
- result.latitude = cartographic.latitude;
736
- result.height = cartographic.height;
737
- return result;
738
- };
739
- Cartographic.equals = function(left, right) {
740
- return left === right || defined_default(left) && defined_default(right) && left.longitude === right.longitude && left.latitude === right.latitude && left.height === right.height;
741
- };
742
- Cartographic.equalsEpsilon = function(left, right, epsilon) {
743
- epsilon = defaultValue_default(epsilon, 0);
744
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left.longitude - right.longitude) <= epsilon && Math.abs(left.latitude - right.latitude) <= epsilon && Math.abs(left.height - right.height) <= epsilon;
745
- };
746
- Cartographic.ZERO = Object.freeze(new Cartographic(0, 0, 0));
747
- Cartographic.prototype.clone = function(result) {
748
- return Cartographic.clone(this, result);
749
- };
750
- Cartographic.prototype.equals = function(right) {
751
- return Cartographic.equals(this, right);
752
- };
753
- Cartographic.prototype.equalsEpsilon = function(right, epsilon) {
754
- return Cartographic.equalsEpsilon(this, right, epsilon);
755
- };
756
- Cartographic.prototype.toString = function() {
757
- return `(${this.longitude}, ${this.latitude}, ${this.height})`;
758
- };
759
- var Cartographic_default = Cartographic;
760
-
761
- // packages/engine/Source/Core/Cartesian2.js
762
- function Cartesian2(x, y) {
763
- this.x = defaultValue_default(x, 0);
764
- this.y = defaultValue_default(y, 0);
765
- }
766
- Cartesian2.fromElements = function(x, y, result) {
767
- if (!defined_default(result)) {
768
- return new Cartesian2(x, y);
769
- }
770
- result.x = x;
771
- result.y = y;
772
- return result;
773
- };
774
- Cartesian2.clone = function(cartesian, result) {
775
- if (!defined_default(cartesian)) {
776
- return void 0;
777
- }
778
- if (!defined_default(result)) {
779
- return new Cartesian2(cartesian.x, cartesian.y);
780
- }
781
- result.x = cartesian.x;
782
- result.y = cartesian.y;
783
- return result;
784
- };
785
- Cartesian2.fromCartesian3 = Cartesian2.clone;
786
- Cartesian2.fromCartesian4 = Cartesian2.clone;
787
- Cartesian2.packedLength = 2;
788
- Cartesian2.pack = function(value, array, startingIndex) {
789
- Check_default.typeOf.object("value", value);
790
- Check_default.defined("array", array);
791
- startingIndex = defaultValue_default(startingIndex, 0);
792
- array[startingIndex++] = value.x;
793
- array[startingIndex] = value.y;
794
- return array;
795
- };
796
- Cartesian2.unpack = function(array, startingIndex, result) {
797
- Check_default.defined("array", array);
798
- startingIndex = defaultValue_default(startingIndex, 0);
799
- if (!defined_default(result)) {
800
- result = new Cartesian2();
801
- }
802
- result.x = array[startingIndex++];
803
- result.y = array[startingIndex];
804
- return result;
805
- };
806
- Cartesian2.packArray = function(array, result) {
807
- Check_default.defined("array", array);
808
- const length = array.length;
809
- const resultLength = length * 2;
810
- if (!defined_default(result)) {
811
- result = new Array(resultLength);
812
- } else if (!Array.isArray(result) && result.length !== resultLength) {
813
- throw new DeveloperError_default(
814
- "If result is a typed array, it must have exactly array.length * 2 elements"
815
- );
816
- } else if (result.length !== resultLength) {
817
- result.length = resultLength;
818
- }
819
- for (let i = 0; i < length; ++i) {
820
- Cartesian2.pack(array[i], result, i * 2);
821
- }
822
- return result;
823
- };
824
- Cartesian2.unpackArray = function(array, result) {
825
- Check_default.defined("array", array);
826
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 2);
827
- if (array.length % 2 !== 0) {
828
- throw new DeveloperError_default("array length must be a multiple of 2.");
829
- }
830
- const length = array.length;
831
- if (!defined_default(result)) {
832
- result = new Array(length / 2);
833
- } else {
834
- result.length = length / 2;
835
- }
836
- for (let i = 0; i < length; i += 2) {
837
- const index = i / 2;
838
- result[index] = Cartesian2.unpack(array, i, result[index]);
839
- }
840
- return result;
841
- };
842
- Cartesian2.fromArray = Cartesian2.unpack;
843
- Cartesian2.maximumComponent = function(cartesian) {
844
- Check_default.typeOf.object("cartesian", cartesian);
845
- return Math.max(cartesian.x, cartesian.y);
846
- };
847
- Cartesian2.minimumComponent = function(cartesian) {
848
- Check_default.typeOf.object("cartesian", cartesian);
849
- return Math.min(cartesian.x, cartesian.y);
850
- };
851
- Cartesian2.minimumByComponent = function(first, second, result) {
852
- Check_default.typeOf.object("first", first);
853
- Check_default.typeOf.object("second", second);
854
- Check_default.typeOf.object("result", result);
855
- result.x = Math.min(first.x, second.x);
856
- result.y = Math.min(first.y, second.y);
857
- return result;
858
- };
859
- Cartesian2.maximumByComponent = function(first, second, result) {
860
- Check_default.typeOf.object("first", first);
861
- Check_default.typeOf.object("second", second);
862
- Check_default.typeOf.object("result", result);
863
- result.x = Math.max(first.x, second.x);
864
- result.y = Math.max(first.y, second.y);
865
- return result;
866
- };
867
- Cartesian2.clamp = function(value, min, max, result) {
868
- Check_default.typeOf.object("value", value);
869
- Check_default.typeOf.object("min", min);
870
- Check_default.typeOf.object("max", max);
871
- Check_default.typeOf.object("result", result);
872
- const x = Math_default.clamp(value.x, min.x, max.x);
873
- const y = Math_default.clamp(value.y, min.y, max.y);
874
- result.x = x;
875
- result.y = y;
876
- return result;
877
- };
878
- Cartesian2.magnitudeSquared = function(cartesian) {
879
- Check_default.typeOf.object("cartesian", cartesian);
880
- return cartesian.x * cartesian.x + cartesian.y * cartesian.y;
881
- };
882
- Cartesian2.magnitude = function(cartesian) {
883
- return Math.sqrt(Cartesian2.magnitudeSquared(cartesian));
884
- };
885
- var distanceScratch2 = new Cartesian2();
886
- Cartesian2.distance = function(left, right) {
887
- Check_default.typeOf.object("left", left);
888
- Check_default.typeOf.object("right", right);
889
- Cartesian2.subtract(left, right, distanceScratch2);
890
- return Cartesian2.magnitude(distanceScratch2);
891
- };
892
- Cartesian2.distanceSquared = function(left, right) {
893
- Check_default.typeOf.object("left", left);
894
- Check_default.typeOf.object("right", right);
895
- Cartesian2.subtract(left, right, distanceScratch2);
896
- return Cartesian2.magnitudeSquared(distanceScratch2);
897
- };
898
- Cartesian2.normalize = function(cartesian, result) {
899
- Check_default.typeOf.object("cartesian", cartesian);
900
- Check_default.typeOf.object("result", result);
901
- const magnitude = Cartesian2.magnitude(cartesian);
902
- result.x = cartesian.x / magnitude;
903
- result.y = cartesian.y / magnitude;
904
- if (isNaN(result.x) || isNaN(result.y)) {
905
- throw new DeveloperError_default("normalized result is not a number");
906
- }
907
- return result;
908
- };
909
- Cartesian2.dot = function(left, right) {
910
- Check_default.typeOf.object("left", left);
911
- Check_default.typeOf.object("right", right);
912
- return left.x * right.x + left.y * right.y;
913
- };
914
- Cartesian2.cross = function(left, right) {
915
- Check_default.typeOf.object("left", left);
916
- Check_default.typeOf.object("right", right);
917
- return left.x * right.y - left.y * right.x;
918
- };
919
- Cartesian2.multiplyComponents = function(left, right, result) {
920
- Check_default.typeOf.object("left", left);
921
- Check_default.typeOf.object("right", right);
922
- Check_default.typeOf.object("result", result);
923
- result.x = left.x * right.x;
924
- result.y = left.y * right.y;
925
- return result;
926
- };
927
- Cartesian2.divideComponents = function(left, right, result) {
928
- Check_default.typeOf.object("left", left);
929
- Check_default.typeOf.object("right", right);
930
- Check_default.typeOf.object("result", result);
931
- result.x = left.x / right.x;
932
- result.y = left.y / right.y;
933
- return result;
934
- };
935
- Cartesian2.add = function(left, right, result) {
936
- Check_default.typeOf.object("left", left);
937
- Check_default.typeOf.object("right", right);
938
- Check_default.typeOf.object("result", result);
939
- result.x = left.x + right.x;
940
- result.y = left.y + right.y;
941
- return result;
942
- };
943
- Cartesian2.subtract = function(left, right, result) {
944
- Check_default.typeOf.object("left", left);
945
- Check_default.typeOf.object("right", right);
946
- Check_default.typeOf.object("result", result);
947
- result.x = left.x - right.x;
948
- result.y = left.y - right.y;
949
- return result;
950
- };
951
- Cartesian2.multiplyByScalar = function(cartesian, scalar, result) {
952
- Check_default.typeOf.object("cartesian", cartesian);
953
- Check_default.typeOf.number("scalar", scalar);
954
- Check_default.typeOf.object("result", result);
955
- result.x = cartesian.x * scalar;
956
- result.y = cartesian.y * scalar;
957
- return result;
958
- };
959
- Cartesian2.divideByScalar = function(cartesian, scalar, result) {
960
- Check_default.typeOf.object("cartesian", cartesian);
961
- Check_default.typeOf.number("scalar", scalar);
962
- Check_default.typeOf.object("result", result);
963
- result.x = cartesian.x / scalar;
964
- result.y = cartesian.y / scalar;
965
- return result;
966
- };
967
- Cartesian2.negate = function(cartesian, result) {
968
- Check_default.typeOf.object("cartesian", cartesian);
969
- Check_default.typeOf.object("result", result);
970
- result.x = -cartesian.x;
971
- result.y = -cartesian.y;
972
- return result;
973
- };
974
- Cartesian2.abs = function(cartesian, result) {
975
- Check_default.typeOf.object("cartesian", cartesian);
976
- Check_default.typeOf.object("result", result);
977
- result.x = Math.abs(cartesian.x);
978
- result.y = Math.abs(cartesian.y);
979
- return result;
980
- };
981
- var lerpScratch2 = new Cartesian2();
982
- Cartesian2.lerp = function(start, end, t, result) {
983
- Check_default.typeOf.object("start", start);
984
- Check_default.typeOf.object("end", end);
985
- Check_default.typeOf.number("t", t);
986
- Check_default.typeOf.object("result", result);
987
- Cartesian2.multiplyByScalar(end, t, lerpScratch2);
988
- result = Cartesian2.multiplyByScalar(start, 1 - t, result);
989
- return Cartesian2.add(lerpScratch2, result, result);
990
- };
991
- var angleBetweenScratch3 = new Cartesian2();
992
- var angleBetweenScratch22 = new Cartesian2();
993
- Cartesian2.angleBetween = function(left, right) {
994
- Check_default.typeOf.object("left", left);
995
- Check_default.typeOf.object("right", right);
996
- Cartesian2.normalize(left, angleBetweenScratch3);
997
- Cartesian2.normalize(right, angleBetweenScratch22);
998
- return Math_default.acosClamped(
999
- Cartesian2.dot(angleBetweenScratch3, angleBetweenScratch22)
1000
- );
1001
- };
1002
- var mostOrthogonalAxisScratch2 = new Cartesian2();
1003
- Cartesian2.mostOrthogonalAxis = function(cartesian, result) {
1004
- Check_default.typeOf.object("cartesian", cartesian);
1005
- Check_default.typeOf.object("result", result);
1006
- const f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch2);
1007
- Cartesian2.abs(f, f);
1008
- if (f.x <= f.y) {
1009
- result = Cartesian2.clone(Cartesian2.UNIT_X, result);
1010
- } else {
1011
- result = Cartesian2.clone(Cartesian2.UNIT_Y, result);
1012
- }
1013
- return result;
1014
- };
1015
- Cartesian2.equals = function(left, right) {
1016
- return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y;
1017
- };
1018
- Cartesian2.equalsArray = function(cartesian, array, offset) {
1019
- return cartesian.x === array[offset] && cartesian.y === array[offset + 1];
1020
- };
1021
- Cartesian2.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
1022
- return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
1023
- left.x,
1024
- right.x,
1025
- relativeEpsilon,
1026
- absoluteEpsilon
1027
- ) && Math_default.equalsEpsilon(
1028
- left.y,
1029
- right.y,
1030
- relativeEpsilon,
1031
- absoluteEpsilon
1032
- );
1033
- };
1034
- Cartesian2.ZERO = Object.freeze(new Cartesian2(0, 0));
1035
- Cartesian2.ONE = Object.freeze(new Cartesian2(1, 1));
1036
- Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1, 0));
1037
- Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0, 1));
1038
- Cartesian2.prototype.clone = function(result) {
1039
- return Cartesian2.clone(this, result);
1040
- };
1041
- Cartesian2.prototype.equals = function(right) {
1042
- return Cartesian2.equals(this, right);
1043
- };
1044
- Cartesian2.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
1045
- return Cartesian2.equalsEpsilon(
1046
- this,
1047
- right,
1048
- relativeEpsilon,
1049
- absoluteEpsilon
1050
- );
1051
- };
1052
- Cartesian2.prototype.toString = function() {
1053
- return `(${this.x}, ${this.y})`;
1054
- };
1055
- var Cartesian2_default = Cartesian2;
1056
-
1057
- // packages/engine/Source/Core/Ellipsoid.js
1058
- function initialize(ellipsoid, x, y, z) {
1059
- x = defaultValue_default(x, 0);
1060
- y = defaultValue_default(y, 0);
1061
- z = defaultValue_default(z, 0);
1062
- Check_default.typeOf.number.greaterThanOrEquals("x", x, 0);
1063
- Check_default.typeOf.number.greaterThanOrEquals("y", y, 0);
1064
- Check_default.typeOf.number.greaterThanOrEquals("z", z, 0);
1065
- ellipsoid._radii = new Cartesian3_default(x, y, z);
1066
- ellipsoid._radiiSquared = new Cartesian3_default(x * x, y * y, z * z);
1067
- ellipsoid._radiiToTheFourth = new Cartesian3_default(
1068
- x * x * x * x,
1069
- y * y * y * y,
1070
- z * z * z * z
1071
- );
1072
- ellipsoid._oneOverRadii = new Cartesian3_default(
1073
- x === 0 ? 0 : 1 / x,
1074
- y === 0 ? 0 : 1 / y,
1075
- z === 0 ? 0 : 1 / z
1076
- );
1077
- ellipsoid._oneOverRadiiSquared = new Cartesian3_default(
1078
- x === 0 ? 0 : 1 / (x * x),
1079
- y === 0 ? 0 : 1 / (y * y),
1080
- z === 0 ? 0 : 1 / (z * z)
1081
- );
1082
- ellipsoid._minimumRadius = Math.min(x, y, z);
1083
- ellipsoid._maximumRadius = Math.max(x, y, z);
1084
- ellipsoid._centerToleranceSquared = Math_default.EPSILON1;
1085
- if (ellipsoid._radiiSquared.z !== 0) {
1086
- ellipsoid._squaredXOverSquaredZ = ellipsoid._radiiSquared.x / ellipsoid._radiiSquared.z;
1087
- }
1088
- }
1089
- function Ellipsoid(x, y, z) {
1090
- this._radii = void 0;
1091
- this._radiiSquared = void 0;
1092
- this._radiiToTheFourth = void 0;
1093
- this._oneOverRadii = void 0;
1094
- this._oneOverRadiiSquared = void 0;
1095
- this._minimumRadius = void 0;
1096
- this._maximumRadius = void 0;
1097
- this._centerToleranceSquared = void 0;
1098
- this._squaredXOverSquaredZ = void 0;
1099
- initialize(this, x, y, z);
1100
- }
1101
- Object.defineProperties(Ellipsoid.prototype, {
1102
- /**
1103
- * Gets the radii of the ellipsoid.
1104
- * @memberof Ellipsoid.prototype
1105
- * @type {Cartesian3}
1106
- * @readonly
1107
- */
1108
- radii: {
1109
- get: function() {
1110
- return this._radii;
1111
- }
1112
- },
1113
- /**
1114
- * Gets the squared radii of the ellipsoid.
1115
- * @memberof Ellipsoid.prototype
1116
- * @type {Cartesian3}
1117
- * @readonly
1118
- */
1119
- radiiSquared: {
1120
- get: function() {
1121
- return this._radiiSquared;
1122
- }
1123
- },
1124
- /**
1125
- * Gets the radii of the ellipsoid raise to the fourth power.
1126
- * @memberof Ellipsoid.prototype
1127
- * @type {Cartesian3}
1128
- * @readonly
1129
- */
1130
- radiiToTheFourth: {
1131
- get: function() {
1132
- return this._radiiToTheFourth;
1133
- }
1134
- },
1135
- /**
1136
- * Gets one over the radii of the ellipsoid.
1137
- * @memberof Ellipsoid.prototype
1138
- * @type {Cartesian3}
1139
- * @readonly
1140
- */
1141
- oneOverRadii: {
1142
- get: function() {
1143
- return this._oneOverRadii;
1144
- }
1145
- },
1146
- /**
1147
- * Gets one over the squared radii of the ellipsoid.
1148
- * @memberof Ellipsoid.prototype
1149
- * @type {Cartesian3}
1150
- * @readonly
1151
- */
1152
- oneOverRadiiSquared: {
1153
- get: function() {
1154
- return this._oneOverRadiiSquared;
1155
- }
1156
- },
1157
- /**
1158
- * Gets the minimum radius of the ellipsoid.
1159
- * @memberof Ellipsoid.prototype
1160
- * @type {number}
1161
- * @readonly
1162
- */
1163
- minimumRadius: {
1164
- get: function() {
1165
- return this._minimumRadius;
1166
- }
1167
- },
1168
- /**
1169
- * Gets the maximum radius of the ellipsoid.
1170
- * @memberof Ellipsoid.prototype
1171
- * @type {number}
1172
- * @readonly
1173
- */
1174
- maximumRadius: {
1175
- get: function() {
1176
- return this._maximumRadius;
1177
- }
1178
- }
1179
- });
1180
- Ellipsoid.clone = function(ellipsoid, result) {
1181
- if (!defined_default(ellipsoid)) {
1182
- return void 0;
1183
- }
1184
- const radii = ellipsoid._radii;
1185
- if (!defined_default(result)) {
1186
- return new Ellipsoid(radii.x, radii.y, radii.z);
1187
- }
1188
- Cartesian3_default.clone(radii, result._radii);
1189
- Cartesian3_default.clone(ellipsoid._radiiSquared, result._radiiSquared);
1190
- Cartesian3_default.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
1191
- Cartesian3_default.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
1192
- Cartesian3_default.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
1193
- result._minimumRadius = ellipsoid._minimumRadius;
1194
- result._maximumRadius = ellipsoid._maximumRadius;
1195
- result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
1196
- return result;
1197
- };
1198
- Ellipsoid.fromCartesian3 = function(cartesian, result) {
1199
- if (!defined_default(result)) {
1200
- result = new Ellipsoid();
1201
- }
1202
- if (!defined_default(cartesian)) {
1203
- return result;
1204
- }
1205
- initialize(result, cartesian.x, cartesian.y, cartesian.z);
1206
- return result;
1207
- };
1208
- Ellipsoid.WGS84 = Object.freeze(
1209
- new Ellipsoid(6378137, 6378137, 6356752314245179e-9)
1210
- );
1211
- Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1, 1, 1));
1212
- Ellipsoid.MOON = Object.freeze(
1213
- new Ellipsoid(
1214
- Math_default.LUNAR_RADIUS,
1215
- Math_default.LUNAR_RADIUS,
1216
- Math_default.LUNAR_RADIUS
1217
- )
1218
- );
1219
- Ellipsoid._default = Ellipsoid.WGS84;
1220
- Object.defineProperties(Ellipsoid, {
1221
- /**
1222
- * The default ellipsoid used when not otherwise specified.
1223
- * @memberof Ellipsoid
1224
- * @type {Ellipsoid}
1225
- * @example
1226
- * Cesium.Ellipsoid.default = Cesium.Ellipsoid.MOON;
1227
- *
1228
- * // Apollo 11 landing site
1229
- * const position = Cesium.Cartesian3.fromRadians(
1230
- * 0.67416,
1231
- * 23.47315,
1232
- * );
1233
- */
1234
- default: {
1235
- get: function() {
1236
- return Ellipsoid._default;
1237
- },
1238
- set: function(value) {
1239
- Check_default.typeOf.object("value", value);
1240
- Ellipsoid._default = value;
1241
- Cartesian3_default._ellipsoidRadiiSquared = value.radiiSquared;
1242
- Cartographic_default._ellipsoidOneOverRadii = value.oneOverRadii;
1243
- Cartographic_default._ellipsoidOneOverRadiiSquared = value.oneOverRadiiSquared;
1244
- Cartographic_default._ellipsoidCenterToleranceSquared = value._centerToleranceSquared;
1245
- }
1246
- }
1247
- });
1248
- Ellipsoid.prototype.clone = function(result) {
1249
- return Ellipsoid.clone(this, result);
1250
- };
1251
- Ellipsoid.packedLength = Cartesian3_default.packedLength;
1252
- Ellipsoid.pack = function(value, array, startingIndex) {
1253
- Check_default.typeOf.object("value", value);
1254
- Check_default.defined("array", array);
1255
- startingIndex = defaultValue_default(startingIndex, 0);
1256
- Cartesian3_default.pack(value._radii, array, startingIndex);
1257
- return array;
1258
- };
1259
- Ellipsoid.unpack = function(array, startingIndex, result) {
1260
- Check_default.defined("array", array);
1261
- startingIndex = defaultValue_default(startingIndex, 0);
1262
- const radii = Cartesian3_default.unpack(array, startingIndex);
1263
- return Ellipsoid.fromCartesian3(radii, result);
1264
- };
1265
- Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3_default.normalize;
1266
- Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function(cartographic, result) {
1267
- Check_default.typeOf.object("cartographic", cartographic);
1268
- const longitude = cartographic.longitude;
1269
- const latitude = cartographic.latitude;
1270
- const cosLatitude = Math.cos(latitude);
1271
- const x = cosLatitude * Math.cos(longitude);
1272
- const y = cosLatitude * Math.sin(longitude);
1273
- const z = Math.sin(latitude);
1274
- if (!defined_default(result)) {
1275
- result = new Cartesian3_default();
1276
- }
1277
- result.x = x;
1278
- result.y = y;
1279
- result.z = z;
1280
- return Cartesian3_default.normalize(result, result);
1281
- };
1282
- Ellipsoid.prototype.geodeticSurfaceNormal = function(cartesian, result) {
1283
- Check_default.typeOf.object("cartesian", cartesian);
1284
- if (isNaN(cartesian.x) || isNaN(cartesian.y) || isNaN(cartesian.z)) {
1285
- throw new DeveloperError_default("cartesian has a NaN component");
1286
- }
1287
- if (Cartesian3_default.equalsEpsilon(cartesian, Cartesian3_default.ZERO, Math_default.EPSILON14)) {
1288
- return void 0;
1289
- }
1290
- if (!defined_default(result)) {
1291
- result = new Cartesian3_default();
1292
- }
1293
- result = Cartesian3_default.multiplyComponents(
1294
- cartesian,
1295
- this._oneOverRadiiSquared,
1296
- result
1297
- );
1298
- return Cartesian3_default.normalize(result, result);
1299
- };
1300
- var cartographicToCartesianNormal = new Cartesian3_default();
1301
- var cartographicToCartesianK = new Cartesian3_default();
1302
- Ellipsoid.prototype.cartographicToCartesian = function(cartographic, result) {
1303
- const n = cartographicToCartesianNormal;
1304
- const k = cartographicToCartesianK;
1305
- this.geodeticSurfaceNormalCartographic(cartographic, n);
1306
- Cartesian3_default.multiplyComponents(this._radiiSquared, n, k);
1307
- const gamma = Math.sqrt(Cartesian3_default.dot(n, k));
1308
- Cartesian3_default.divideByScalar(k, gamma, k);
1309
- Cartesian3_default.multiplyByScalar(n, cartographic.height, n);
1310
- if (!defined_default(result)) {
1311
- result = new Cartesian3_default();
1312
- }
1313
- return Cartesian3_default.add(k, n, result);
1314
- };
1315
- Ellipsoid.prototype.cartographicArrayToCartesianArray = function(cartographics, result) {
1316
- Check_default.defined("cartographics", cartographics);
1317
- const length = cartographics.length;
1318
- if (!defined_default(result)) {
1319
- result = new Array(length);
1320
- } else {
1321
- result.length = length;
1322
- }
1323
- for (let i = 0; i < length; i++) {
1324
- result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
1325
- }
1326
- return result;
1327
- };
1328
- var cartesianToCartographicN2 = new Cartesian3_default();
1329
- var cartesianToCartographicP2 = new Cartesian3_default();
1330
- var cartesianToCartographicH2 = new Cartesian3_default();
1331
- Ellipsoid.prototype.cartesianToCartographic = function(cartesian, result) {
1332
- const p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP2);
1333
- if (!defined_default(p)) {
1334
- return void 0;
1335
- }
1336
- const n = this.geodeticSurfaceNormal(p, cartesianToCartographicN2);
1337
- const h = Cartesian3_default.subtract(cartesian, p, cartesianToCartographicH2);
1338
- const longitude = Math.atan2(n.y, n.x);
1339
- const latitude = Math.asin(n.z);
1340
- const height = Math_default.sign(Cartesian3_default.dot(h, cartesian)) * Cartesian3_default.magnitude(h);
1341
- if (!defined_default(result)) {
1342
- return new Cartographic_default(longitude, latitude, height);
1343
- }
1344
- result.longitude = longitude;
1345
- result.latitude = latitude;
1346
- result.height = height;
1347
- return result;
1348
- };
1349
- Ellipsoid.prototype.cartesianArrayToCartographicArray = function(cartesians, result) {
1350
- Check_default.defined("cartesians", cartesians);
1351
- const length = cartesians.length;
1352
- if (!defined_default(result)) {
1353
- result = new Array(length);
1354
- } else {
1355
- result.length = length;
1356
- }
1357
- for (let i = 0; i < length; ++i) {
1358
- result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
1359
- }
1360
- return result;
1361
- };
1362
- Ellipsoid.prototype.scaleToGeodeticSurface = function(cartesian, result) {
1363
- return scaleToGeodeticSurface_default(
1364
- cartesian,
1365
- this._oneOverRadii,
1366
- this._oneOverRadiiSquared,
1367
- this._centerToleranceSquared,
1368
- result
1369
- );
1370
- };
1371
- Ellipsoid.prototype.scaleToGeocentricSurface = function(cartesian, result) {
1372
- Check_default.typeOf.object("cartesian", cartesian);
1373
- if (!defined_default(result)) {
1374
- result = new Cartesian3_default();
1375
- }
1376
- const positionX = cartesian.x;
1377
- const positionY = cartesian.y;
1378
- const positionZ = cartesian.z;
1379
- const oneOverRadiiSquared = this._oneOverRadiiSquared;
1380
- const beta = 1 / Math.sqrt(
1381
- positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z
1382
- );
1383
- return Cartesian3_default.multiplyByScalar(cartesian, beta, result);
1384
- };
1385
- Ellipsoid.prototype.transformPositionToScaledSpace = function(position, result) {
1386
- if (!defined_default(result)) {
1387
- result = new Cartesian3_default();
1388
- }
1389
- return Cartesian3_default.multiplyComponents(position, this._oneOverRadii, result);
1390
- };
1391
- Ellipsoid.prototype.transformPositionFromScaledSpace = function(position, result) {
1392
- if (!defined_default(result)) {
1393
- result = new Cartesian3_default();
1394
- }
1395
- return Cartesian3_default.multiplyComponents(position, this._radii, result);
1396
- };
1397
- Ellipsoid.prototype.equals = function(right) {
1398
- return this === right || defined_default(right) && Cartesian3_default.equals(this._radii, right._radii);
1399
- };
1400
- Ellipsoid.prototype.toString = function() {
1401
- return this._radii.toString();
1402
- };
1403
- Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function(position, buffer, result) {
1404
- Check_default.typeOf.object("position", position);
1405
- if (!Math_default.equalsEpsilon(
1406
- this._radii.x,
1407
- this._radii.y,
1408
- Math_default.EPSILON15
1409
- )) {
1410
- throw new DeveloperError_default(
1411
- "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
1412
- );
1413
- }
1414
- Check_default.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
1415
- buffer = defaultValue_default(buffer, 0);
1416
- const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
1417
- if (!defined_default(result)) {
1418
- result = new Cartesian3_default();
1419
- }
1420
- result.x = 0;
1421
- result.y = 0;
1422
- result.z = position.z * (1 - squaredXOverSquaredZ);
1423
- if (Math.abs(result.z) >= this._radii.z - buffer) {
1424
- return void 0;
1425
- }
1426
- return result;
1427
- };
1428
- var scratchEndpoint = new Cartesian3_default();
1429
- Ellipsoid.prototype.getLocalCurvature = function(surfacePosition, result) {
1430
- Check_default.typeOf.object("surfacePosition", surfacePosition);
1431
- if (!defined_default(result)) {
1432
- result = new Cartesian2_default();
1433
- }
1434
- const primeVerticalEndpoint = this.getSurfaceNormalIntersectionWithZAxis(
1435
- surfacePosition,
1436
- 0,
1437
- scratchEndpoint
1438
- );
1439
- const primeVerticalRadius = Cartesian3_default.distance(
1440
- surfacePosition,
1441
- primeVerticalEndpoint
1442
- );
1443
- const radiusRatio = this.minimumRadius * primeVerticalRadius / this.maximumRadius ** 2;
1444
- const meridionalRadius = primeVerticalRadius * radiusRatio ** 2;
1445
- return Cartesian2_default.fromElements(
1446
- 1 / primeVerticalRadius,
1447
- 1 / meridionalRadius,
1448
- result
1449
- );
1450
- };
1451
- var abscissas = [
1452
- 0.14887433898163,
1453
- 0.43339539412925,
1454
- 0.67940956829902,
1455
- 0.86506336668898,
1456
- 0.97390652851717,
1457
- 0
1458
- ];
1459
- var weights = [
1460
- 0.29552422471475,
1461
- 0.26926671930999,
1462
- 0.21908636251598,
1463
- 0.14945134915058,
1464
- 0.066671344308684,
1465
- 0
1466
- ];
1467
- function gaussLegendreQuadrature(a, b, func) {
1468
- Check_default.typeOf.number("a", a);
1469
- Check_default.typeOf.number("b", b);
1470
- Check_default.typeOf.func("func", func);
1471
- const xMean = 0.5 * (b + a);
1472
- const xRange = 0.5 * (b - a);
1473
- let sum = 0;
1474
- for (let i = 0; i < 5; i++) {
1475
- const dx = xRange * abscissas[i];
1476
- sum += weights[i] * (func(xMean + dx) + func(xMean - dx));
1477
- }
1478
- sum *= xRange;
1479
- return sum;
1480
- }
1481
- Ellipsoid.prototype.surfaceArea = function(rectangle) {
1482
- Check_default.typeOf.object("rectangle", rectangle);
1483
- const minLongitude = rectangle.west;
1484
- let maxLongitude = rectangle.east;
1485
- const minLatitude = rectangle.south;
1486
- const maxLatitude = rectangle.north;
1487
- while (maxLongitude < minLongitude) {
1488
- maxLongitude += Math_default.TWO_PI;
1489
- }
1490
- const radiiSquared = this._radiiSquared;
1491
- const a2 = radiiSquared.x;
1492
- const b2 = radiiSquared.y;
1493
- const c2 = radiiSquared.z;
1494
- const a2b2 = a2 * b2;
1495
- return gaussLegendreQuadrature(minLatitude, maxLatitude, function(lat) {
1496
- const sinPhi = Math.cos(lat);
1497
- const cosPhi = Math.sin(lat);
1498
- return Math.cos(lat) * gaussLegendreQuadrature(minLongitude, maxLongitude, function(lon) {
1499
- const cosTheta = Math.cos(lon);
1500
- const sinTheta = Math.sin(lon);
1501
- return Math.sqrt(
1502
- a2b2 * cosPhi * cosPhi + c2 * (b2 * cosTheta * cosTheta + a2 * sinTheta * sinTheta) * sinPhi * sinPhi
1503
- );
1504
- });
1505
- });
1506
- };
1507
- var Ellipsoid_default = Ellipsoid;
1508
-
1509
- // packages/engine/Source/Core/Matrix3.js
1510
- function Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2) {
1511
- this[0] = defaultValue_default(column0Row0, 0);
1512
- this[1] = defaultValue_default(column0Row1, 0);
1513
- this[2] = defaultValue_default(column0Row2, 0);
1514
- this[3] = defaultValue_default(column1Row0, 0);
1515
- this[4] = defaultValue_default(column1Row1, 0);
1516
- this[5] = defaultValue_default(column1Row2, 0);
1517
- this[6] = defaultValue_default(column2Row0, 0);
1518
- this[7] = defaultValue_default(column2Row1, 0);
1519
- this[8] = defaultValue_default(column2Row2, 0);
1520
- }
1521
- Matrix3.packedLength = 9;
1522
- Matrix3.pack = function(value, array, startingIndex) {
1523
- Check_default.typeOf.object("value", value);
1524
- Check_default.defined("array", array);
1525
- startingIndex = defaultValue_default(startingIndex, 0);
1526
- array[startingIndex++] = value[0];
1527
- array[startingIndex++] = value[1];
1528
- array[startingIndex++] = value[2];
1529
- array[startingIndex++] = value[3];
1530
- array[startingIndex++] = value[4];
1531
- array[startingIndex++] = value[5];
1532
- array[startingIndex++] = value[6];
1533
- array[startingIndex++] = value[7];
1534
- array[startingIndex++] = value[8];
1535
- return array;
1536
- };
1537
- Matrix3.unpack = function(array, startingIndex, result) {
1538
- Check_default.defined("array", array);
1539
- startingIndex = defaultValue_default(startingIndex, 0);
1540
- if (!defined_default(result)) {
1541
- result = new Matrix3();
1542
- }
1543
- result[0] = array[startingIndex++];
1544
- result[1] = array[startingIndex++];
1545
- result[2] = array[startingIndex++];
1546
- result[3] = array[startingIndex++];
1547
- result[4] = array[startingIndex++];
1548
- result[5] = array[startingIndex++];
1549
- result[6] = array[startingIndex++];
1550
- result[7] = array[startingIndex++];
1551
- result[8] = array[startingIndex++];
1552
- return result;
1553
- };
1554
- Matrix3.packArray = function(array, result) {
1555
- Check_default.defined("array", array);
1556
- const length = array.length;
1557
- const resultLength = length * 9;
1558
- if (!defined_default(result)) {
1559
- result = new Array(resultLength);
1560
- } else if (!Array.isArray(result) && result.length !== resultLength) {
1561
- throw new DeveloperError_default(
1562
- "If result is a typed array, it must have exactly array.length * 9 elements"
1563
- );
1564
- } else if (result.length !== resultLength) {
1565
- result.length = resultLength;
1566
- }
1567
- for (let i = 0; i < length; ++i) {
1568
- Matrix3.pack(array[i], result, i * 9);
1569
- }
1570
- return result;
1571
- };
1572
- Matrix3.unpackArray = function(array, result) {
1573
- Check_default.defined("array", array);
1574
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 9);
1575
- if (array.length % 9 !== 0) {
1576
- throw new DeveloperError_default("array length must be a multiple of 9.");
1577
- }
1578
- const length = array.length;
1579
- if (!defined_default(result)) {
1580
- result = new Array(length / 9);
1581
- } else {
1582
- result.length = length / 9;
1583
- }
1584
- for (let i = 0; i < length; i += 9) {
1585
- const index = i / 9;
1586
- result[index] = Matrix3.unpack(array, i, result[index]);
1587
- }
1588
- return result;
1589
- };
1590
- Matrix3.clone = function(matrix, result) {
1591
- if (!defined_default(matrix)) {
1592
- return void 0;
1593
- }
1594
- if (!defined_default(result)) {
1595
- return new Matrix3(
1596
- matrix[0],
1597
- matrix[3],
1598
- matrix[6],
1599
- matrix[1],
1600
- matrix[4],
1601
- matrix[7],
1602
- matrix[2],
1603
- matrix[5],
1604
- matrix[8]
1605
- );
1606
- }
1607
- result[0] = matrix[0];
1608
- result[1] = matrix[1];
1609
- result[2] = matrix[2];
1610
- result[3] = matrix[3];
1611
- result[4] = matrix[4];
1612
- result[5] = matrix[5];
1613
- result[6] = matrix[6];
1614
- result[7] = matrix[7];
1615
- result[8] = matrix[8];
1616
- return result;
1617
- };
1618
- Matrix3.fromArray = Matrix3.unpack;
1619
- Matrix3.fromColumnMajorArray = function(values, result) {
1620
- Check_default.defined("values", values);
1621
- return Matrix3.clone(values, result);
1622
- };
1623
- Matrix3.fromRowMajorArray = function(values, result) {
1624
- Check_default.defined("values", values);
1625
- if (!defined_default(result)) {
1626
- return new Matrix3(
1627
- values[0],
1628
- values[1],
1629
- values[2],
1630
- values[3],
1631
- values[4],
1632
- values[5],
1633
- values[6],
1634
- values[7],
1635
- values[8]
1636
- );
1637
- }
1638
- result[0] = values[0];
1639
- result[1] = values[3];
1640
- result[2] = values[6];
1641
- result[3] = values[1];
1642
- result[4] = values[4];
1643
- result[5] = values[7];
1644
- result[6] = values[2];
1645
- result[7] = values[5];
1646
- result[8] = values[8];
1647
- return result;
1648
- };
1649
- Matrix3.fromQuaternion = function(quaternion, result) {
1650
- Check_default.typeOf.object("quaternion", quaternion);
1651
- const x2 = quaternion.x * quaternion.x;
1652
- const xy = quaternion.x * quaternion.y;
1653
- const xz = quaternion.x * quaternion.z;
1654
- const xw = quaternion.x * quaternion.w;
1655
- const y2 = quaternion.y * quaternion.y;
1656
- const yz = quaternion.y * quaternion.z;
1657
- const yw = quaternion.y * quaternion.w;
1658
- const z2 = quaternion.z * quaternion.z;
1659
- const zw = quaternion.z * quaternion.w;
1660
- const w2 = quaternion.w * quaternion.w;
1661
- const m00 = x2 - y2 - z2 + w2;
1662
- const m01 = 2 * (xy - zw);
1663
- const m02 = 2 * (xz + yw);
1664
- const m10 = 2 * (xy + zw);
1665
- const m11 = -x2 + y2 - z2 + w2;
1666
- const m12 = 2 * (yz - xw);
1667
- const m20 = 2 * (xz - yw);
1668
- const m21 = 2 * (yz + xw);
1669
- const m22 = -x2 - y2 + z2 + w2;
1670
- if (!defined_default(result)) {
1671
- return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
1672
- }
1673
- result[0] = m00;
1674
- result[1] = m10;
1675
- result[2] = m20;
1676
- result[3] = m01;
1677
- result[4] = m11;
1678
- result[5] = m21;
1679
- result[6] = m02;
1680
- result[7] = m12;
1681
- result[8] = m22;
1682
- return result;
1683
- };
1684
- Matrix3.fromHeadingPitchRoll = function(headingPitchRoll, result) {
1685
- Check_default.typeOf.object("headingPitchRoll", headingPitchRoll);
1686
- const cosTheta = Math.cos(-headingPitchRoll.pitch);
1687
- const cosPsi = Math.cos(-headingPitchRoll.heading);
1688
- const cosPhi = Math.cos(headingPitchRoll.roll);
1689
- const sinTheta = Math.sin(-headingPitchRoll.pitch);
1690
- const sinPsi = Math.sin(-headingPitchRoll.heading);
1691
- const sinPhi = Math.sin(headingPitchRoll.roll);
1692
- const m00 = cosTheta * cosPsi;
1693
- const m01 = -cosPhi * sinPsi + sinPhi * sinTheta * cosPsi;
1694
- const m02 = sinPhi * sinPsi + cosPhi * sinTheta * cosPsi;
1695
- const m10 = cosTheta * sinPsi;
1696
- const m11 = cosPhi * cosPsi + sinPhi * sinTheta * sinPsi;
1697
- const m12 = -sinPhi * cosPsi + cosPhi * sinTheta * sinPsi;
1698
- const m20 = -sinTheta;
1699
- const m21 = sinPhi * cosTheta;
1700
- const m22 = cosPhi * cosTheta;
1701
- if (!defined_default(result)) {
1702
- return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
1703
- }
1704
- result[0] = m00;
1705
- result[1] = m10;
1706
- result[2] = m20;
1707
- result[3] = m01;
1708
- result[4] = m11;
1709
- result[5] = m21;
1710
- result[6] = m02;
1711
- result[7] = m12;
1712
- result[8] = m22;
1713
- return result;
1714
- };
1715
- Matrix3.fromScale = function(scale, result) {
1716
- Check_default.typeOf.object("scale", scale);
1717
- if (!defined_default(result)) {
1718
- return new Matrix3(scale.x, 0, 0, 0, scale.y, 0, 0, 0, scale.z);
1719
- }
1720
- result[0] = scale.x;
1721
- result[1] = 0;
1722
- result[2] = 0;
1723
- result[3] = 0;
1724
- result[4] = scale.y;
1725
- result[5] = 0;
1726
- result[6] = 0;
1727
- result[7] = 0;
1728
- result[8] = scale.z;
1729
- return result;
1730
- };
1731
- Matrix3.fromUniformScale = function(scale, result) {
1732
- Check_default.typeOf.number("scale", scale);
1733
- if (!defined_default(result)) {
1734
- return new Matrix3(scale, 0, 0, 0, scale, 0, 0, 0, scale);
1735
- }
1736
- result[0] = scale;
1737
- result[1] = 0;
1738
- result[2] = 0;
1739
- result[3] = 0;
1740
- result[4] = scale;
1741
- result[5] = 0;
1742
- result[6] = 0;
1743
- result[7] = 0;
1744
- result[8] = scale;
1745
- return result;
1746
- };
1747
- Matrix3.fromCrossProduct = function(vector, result) {
1748
- Check_default.typeOf.object("vector", vector);
1749
- if (!defined_default(result)) {
1750
- return new Matrix3(
1751
- 0,
1752
- -vector.z,
1753
- vector.y,
1754
- vector.z,
1755
- 0,
1756
- -vector.x,
1757
- -vector.y,
1758
- vector.x,
1759
- 0
1760
- );
1761
- }
1762
- result[0] = 0;
1763
- result[1] = vector.z;
1764
- result[2] = -vector.y;
1765
- result[3] = -vector.z;
1766
- result[4] = 0;
1767
- result[5] = vector.x;
1768
- result[6] = vector.y;
1769
- result[7] = -vector.x;
1770
- result[8] = 0;
1771
- return result;
1772
- };
1773
- Matrix3.fromRotationX = function(angle, result) {
1774
- Check_default.typeOf.number("angle", angle);
1775
- const cosAngle = Math.cos(angle);
1776
- const sinAngle = Math.sin(angle);
1777
- if (!defined_default(result)) {
1778
- return new Matrix3(
1779
- 1,
1780
- 0,
1781
- 0,
1782
- 0,
1783
- cosAngle,
1784
- -sinAngle,
1785
- 0,
1786
- sinAngle,
1787
- cosAngle
1788
- );
1789
- }
1790
- result[0] = 1;
1791
- result[1] = 0;
1792
- result[2] = 0;
1793
- result[3] = 0;
1794
- result[4] = cosAngle;
1795
- result[5] = sinAngle;
1796
- result[6] = 0;
1797
- result[7] = -sinAngle;
1798
- result[8] = cosAngle;
1799
- return result;
1800
- };
1801
- Matrix3.fromRotationY = function(angle, result) {
1802
- Check_default.typeOf.number("angle", angle);
1803
- const cosAngle = Math.cos(angle);
1804
- const sinAngle = Math.sin(angle);
1805
- if (!defined_default(result)) {
1806
- return new Matrix3(
1807
- cosAngle,
1808
- 0,
1809
- sinAngle,
1810
- 0,
1811
- 1,
1812
- 0,
1813
- -sinAngle,
1814
- 0,
1815
- cosAngle
1816
- );
1817
- }
1818
- result[0] = cosAngle;
1819
- result[1] = 0;
1820
- result[2] = -sinAngle;
1821
- result[3] = 0;
1822
- result[4] = 1;
1823
- result[5] = 0;
1824
- result[6] = sinAngle;
1825
- result[7] = 0;
1826
- result[8] = cosAngle;
1827
- return result;
1828
- };
1829
- Matrix3.fromRotationZ = function(angle, result) {
1830
- Check_default.typeOf.number("angle", angle);
1831
- const cosAngle = Math.cos(angle);
1832
- const sinAngle = Math.sin(angle);
1833
- if (!defined_default(result)) {
1834
- return new Matrix3(
1835
- cosAngle,
1836
- -sinAngle,
1837
- 0,
1838
- sinAngle,
1839
- cosAngle,
1840
- 0,
1841
- 0,
1842
- 0,
1843
- 1
1844
- );
1845
- }
1846
- result[0] = cosAngle;
1847
- result[1] = sinAngle;
1848
- result[2] = 0;
1849
- result[3] = -sinAngle;
1850
- result[4] = cosAngle;
1851
- result[5] = 0;
1852
- result[6] = 0;
1853
- result[7] = 0;
1854
- result[8] = 1;
1855
- return result;
1856
- };
1857
- Matrix3.toArray = function(matrix, result) {
1858
- Check_default.typeOf.object("matrix", matrix);
1859
- if (!defined_default(result)) {
1860
- return [
1861
- matrix[0],
1862
- matrix[1],
1863
- matrix[2],
1864
- matrix[3],
1865
- matrix[4],
1866
- matrix[5],
1867
- matrix[6],
1868
- matrix[7],
1869
- matrix[8]
1870
- ];
1871
- }
1872
- result[0] = matrix[0];
1873
- result[1] = matrix[1];
1874
- result[2] = matrix[2];
1875
- result[3] = matrix[3];
1876
- result[4] = matrix[4];
1877
- result[5] = matrix[5];
1878
- result[6] = matrix[6];
1879
- result[7] = matrix[7];
1880
- result[8] = matrix[8];
1881
- return result;
1882
- };
1883
- Matrix3.getElementIndex = function(column, row) {
1884
- Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
1885
- Check_default.typeOf.number.lessThanOrEquals("row", row, 2);
1886
- Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
1887
- Check_default.typeOf.number.lessThanOrEquals("column", column, 2);
1888
- return column * 3 + row;
1889
- };
1890
- Matrix3.getColumn = function(matrix, index, result) {
1891
- Check_default.typeOf.object("matrix", matrix);
1892
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1893
- Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
1894
- Check_default.typeOf.object("result", result);
1895
- const startIndex = index * 3;
1896
- const x = matrix[startIndex];
1897
- const y = matrix[startIndex + 1];
1898
- const z = matrix[startIndex + 2];
1899
- result.x = x;
1900
- result.y = y;
1901
- result.z = z;
1902
- return result;
1903
- };
1904
- Matrix3.setColumn = function(matrix, index, cartesian, result) {
1905
- Check_default.typeOf.object("matrix", matrix);
1906
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1907
- Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
1908
- Check_default.typeOf.object("cartesian", cartesian);
1909
- Check_default.typeOf.object("result", result);
1910
- result = Matrix3.clone(matrix, result);
1911
- const startIndex = index * 3;
1912
- result[startIndex] = cartesian.x;
1913
- result[startIndex + 1] = cartesian.y;
1914
- result[startIndex + 2] = cartesian.z;
1915
- return result;
1916
- };
1917
- Matrix3.getRow = function(matrix, index, result) {
1918
- Check_default.typeOf.object("matrix", matrix);
1919
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1920
- Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
1921
- Check_default.typeOf.object("result", result);
1922
- const x = matrix[index];
1923
- const y = matrix[index + 3];
1924
- const z = matrix[index + 6];
1925
- result.x = x;
1926
- result.y = y;
1927
- result.z = z;
1928
- return result;
1929
- };
1930
- Matrix3.setRow = function(matrix, index, cartesian, result) {
1931
- Check_default.typeOf.object("matrix", matrix);
1932
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1933
- Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
1934
- Check_default.typeOf.object("cartesian", cartesian);
1935
- Check_default.typeOf.object("result", result);
1936
- result = Matrix3.clone(matrix, result);
1937
- result[index] = cartesian.x;
1938
- result[index + 3] = cartesian.y;
1939
- result[index + 6] = cartesian.z;
1940
- return result;
1941
- };
1942
- var scaleScratch1 = new Cartesian3_default();
1943
- Matrix3.setScale = function(matrix, scale, result) {
1944
- Check_default.typeOf.object("matrix", matrix);
1945
- Check_default.typeOf.object("scale", scale);
1946
- Check_default.typeOf.object("result", result);
1947
- const existingScale = Matrix3.getScale(matrix, scaleScratch1);
1948
- const scaleRatioX = scale.x / existingScale.x;
1949
- const scaleRatioY = scale.y / existingScale.y;
1950
- const scaleRatioZ = scale.z / existingScale.z;
1951
- result[0] = matrix[0] * scaleRatioX;
1952
- result[1] = matrix[1] * scaleRatioX;
1953
- result[2] = matrix[2] * scaleRatioX;
1954
- result[3] = matrix[3] * scaleRatioY;
1955
- result[4] = matrix[4] * scaleRatioY;
1956
- result[5] = matrix[5] * scaleRatioY;
1957
- result[6] = matrix[6] * scaleRatioZ;
1958
- result[7] = matrix[7] * scaleRatioZ;
1959
- result[8] = matrix[8] * scaleRatioZ;
1960
- return result;
1961
- };
1962
- var scaleScratch2 = new Cartesian3_default();
1963
- Matrix3.setUniformScale = function(matrix, scale, result) {
1964
- Check_default.typeOf.object("matrix", matrix);
1965
- Check_default.typeOf.number("scale", scale);
1966
- Check_default.typeOf.object("result", result);
1967
- const existingScale = Matrix3.getScale(matrix, scaleScratch2);
1968
- const scaleRatioX = scale / existingScale.x;
1969
- const scaleRatioY = scale / existingScale.y;
1970
- const scaleRatioZ = scale / existingScale.z;
1971
- result[0] = matrix[0] * scaleRatioX;
1972
- result[1] = matrix[1] * scaleRatioX;
1973
- result[2] = matrix[2] * scaleRatioX;
1974
- result[3] = matrix[3] * scaleRatioY;
1975
- result[4] = matrix[4] * scaleRatioY;
1976
- result[5] = matrix[5] * scaleRatioY;
1977
- result[6] = matrix[6] * scaleRatioZ;
1978
- result[7] = matrix[7] * scaleRatioZ;
1979
- result[8] = matrix[8] * scaleRatioZ;
1980
- return result;
1981
- };
1982
- var scratchColumn = new Cartesian3_default();
1983
- Matrix3.getScale = function(matrix, result) {
1984
- Check_default.typeOf.object("matrix", matrix);
1985
- Check_default.typeOf.object("result", result);
1986
- result.x = Cartesian3_default.magnitude(
1987
- Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
1988
- );
1989
- result.y = Cartesian3_default.magnitude(
1990
- Cartesian3_default.fromElements(matrix[3], matrix[4], matrix[5], scratchColumn)
1991
- );
1992
- result.z = Cartesian3_default.magnitude(
1993
- Cartesian3_default.fromElements(matrix[6], matrix[7], matrix[8], scratchColumn)
1994
- );
1995
- return result;
1996
- };
1997
- var scaleScratch3 = new Cartesian3_default();
1998
- Matrix3.getMaximumScale = function(matrix) {
1999
- Matrix3.getScale(matrix, scaleScratch3);
2000
- return Cartesian3_default.maximumComponent(scaleScratch3);
2001
- };
2002
- var scaleScratch4 = new Cartesian3_default();
2003
- Matrix3.setRotation = function(matrix, rotation, result) {
2004
- Check_default.typeOf.object("matrix", matrix);
2005
- Check_default.typeOf.object("result", result);
2006
- const scale = Matrix3.getScale(matrix, scaleScratch4);
2007
- result[0] = rotation[0] * scale.x;
2008
- result[1] = rotation[1] * scale.x;
2009
- result[2] = rotation[2] * scale.x;
2010
- result[3] = rotation[3] * scale.y;
2011
- result[4] = rotation[4] * scale.y;
2012
- result[5] = rotation[5] * scale.y;
2013
- result[6] = rotation[6] * scale.z;
2014
- result[7] = rotation[7] * scale.z;
2015
- result[8] = rotation[8] * scale.z;
2016
- return result;
2017
- };
2018
- var scaleScratch5 = new Cartesian3_default();
2019
- Matrix3.getRotation = function(matrix, result) {
2020
- Check_default.typeOf.object("matrix", matrix);
2021
- Check_default.typeOf.object("result", result);
2022
- const scale = Matrix3.getScale(matrix, scaleScratch5);
2023
- result[0] = matrix[0] / scale.x;
2024
- result[1] = matrix[1] / scale.x;
2025
- result[2] = matrix[2] / scale.x;
2026
- result[3] = matrix[3] / scale.y;
2027
- result[4] = matrix[4] / scale.y;
2028
- result[5] = matrix[5] / scale.y;
2029
- result[6] = matrix[6] / scale.z;
2030
- result[7] = matrix[7] / scale.z;
2031
- result[8] = matrix[8] / scale.z;
2032
- return result;
2033
- };
2034
- Matrix3.multiply = function(left, right, result) {
2035
- Check_default.typeOf.object("left", left);
2036
- Check_default.typeOf.object("right", right);
2037
- Check_default.typeOf.object("result", result);
2038
- const column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2];
2039
- const column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2];
2040
- const column0Row2 = left[2] * right[0] + left[5] * right[1] + left[8] * right[2];
2041
- const column1Row0 = left[0] * right[3] + left[3] * right[4] + left[6] * right[5];
2042
- const column1Row1 = left[1] * right[3] + left[4] * right[4] + left[7] * right[5];
2043
- const column1Row2 = left[2] * right[3] + left[5] * right[4] + left[8] * right[5];
2044
- const column2Row0 = left[0] * right[6] + left[3] * right[7] + left[6] * right[8];
2045
- const column2Row1 = left[1] * right[6] + left[4] * right[7] + left[7] * right[8];
2046
- const column2Row2 = left[2] * right[6] + left[5] * right[7] + left[8] * right[8];
2047
- result[0] = column0Row0;
2048
- result[1] = column0Row1;
2049
- result[2] = column0Row2;
2050
- result[3] = column1Row0;
2051
- result[4] = column1Row1;
2052
- result[5] = column1Row2;
2053
- result[6] = column2Row0;
2054
- result[7] = column2Row1;
2055
- result[8] = column2Row2;
2056
- return result;
2057
- };
2058
- Matrix3.add = function(left, right, result) {
2059
- Check_default.typeOf.object("left", left);
2060
- Check_default.typeOf.object("right", right);
2061
- Check_default.typeOf.object("result", result);
2062
- result[0] = left[0] + right[0];
2063
- result[1] = left[1] + right[1];
2064
- result[2] = left[2] + right[2];
2065
- result[3] = left[3] + right[3];
2066
- result[4] = left[4] + right[4];
2067
- result[5] = left[5] + right[5];
2068
- result[6] = left[6] + right[6];
2069
- result[7] = left[7] + right[7];
2070
- result[8] = left[8] + right[8];
2071
- return result;
2072
- };
2073
- Matrix3.subtract = function(left, right, result) {
2074
- Check_default.typeOf.object("left", left);
2075
- Check_default.typeOf.object("right", right);
2076
- Check_default.typeOf.object("result", result);
2077
- result[0] = left[0] - right[0];
2078
- result[1] = left[1] - right[1];
2079
- result[2] = left[2] - right[2];
2080
- result[3] = left[3] - right[3];
2081
- result[4] = left[4] - right[4];
2082
- result[5] = left[5] - right[5];
2083
- result[6] = left[6] - right[6];
2084
- result[7] = left[7] - right[7];
2085
- result[8] = left[8] - right[8];
2086
- return result;
2087
- };
2088
- Matrix3.multiplyByVector = function(matrix, cartesian, result) {
2089
- Check_default.typeOf.object("matrix", matrix);
2090
- Check_default.typeOf.object("cartesian", cartesian);
2091
- Check_default.typeOf.object("result", result);
2092
- const vX = cartesian.x;
2093
- const vY = cartesian.y;
2094
- const vZ = cartesian.z;
2095
- const x = matrix[0] * vX + matrix[3] * vY + matrix[6] * vZ;
2096
- const y = matrix[1] * vX + matrix[4] * vY + matrix[7] * vZ;
2097
- const z = matrix[2] * vX + matrix[5] * vY + matrix[8] * vZ;
2098
- result.x = x;
2099
- result.y = y;
2100
- result.z = z;
2101
- return result;
2102
- };
2103
- Matrix3.multiplyByScalar = function(matrix, scalar, result) {
2104
- Check_default.typeOf.object("matrix", matrix);
2105
- Check_default.typeOf.number("scalar", scalar);
2106
- Check_default.typeOf.object("result", result);
2107
- result[0] = matrix[0] * scalar;
2108
- result[1] = matrix[1] * scalar;
2109
- result[2] = matrix[2] * scalar;
2110
- result[3] = matrix[3] * scalar;
2111
- result[4] = matrix[4] * scalar;
2112
- result[5] = matrix[5] * scalar;
2113
- result[6] = matrix[6] * scalar;
2114
- result[7] = matrix[7] * scalar;
2115
- result[8] = matrix[8] * scalar;
2116
- return result;
2117
- };
2118
- Matrix3.multiplyByScale = function(matrix, scale, result) {
2119
- Check_default.typeOf.object("matrix", matrix);
2120
- Check_default.typeOf.object("scale", scale);
2121
- Check_default.typeOf.object("result", result);
2122
- result[0] = matrix[0] * scale.x;
2123
- result[1] = matrix[1] * scale.x;
2124
- result[2] = matrix[2] * scale.x;
2125
- result[3] = matrix[3] * scale.y;
2126
- result[4] = matrix[4] * scale.y;
2127
- result[5] = matrix[5] * scale.y;
2128
- result[6] = matrix[6] * scale.z;
2129
- result[7] = matrix[7] * scale.z;
2130
- result[8] = matrix[8] * scale.z;
2131
- return result;
2132
- };
2133
- Matrix3.multiplyByUniformScale = function(matrix, scale, result) {
2134
- Check_default.typeOf.object("matrix", matrix);
2135
- Check_default.typeOf.number("scale", scale);
2136
- Check_default.typeOf.object("result", result);
2137
- result[0] = matrix[0] * scale;
2138
- result[1] = matrix[1] * scale;
2139
- result[2] = matrix[2] * scale;
2140
- result[3] = matrix[3] * scale;
2141
- result[4] = matrix[4] * scale;
2142
- result[5] = matrix[5] * scale;
2143
- result[6] = matrix[6] * scale;
2144
- result[7] = matrix[7] * scale;
2145
- result[8] = matrix[8] * scale;
2146
- return result;
2147
- };
2148
- Matrix3.negate = function(matrix, result) {
2149
- Check_default.typeOf.object("matrix", matrix);
2150
- Check_default.typeOf.object("result", result);
2151
- result[0] = -matrix[0];
2152
- result[1] = -matrix[1];
2153
- result[2] = -matrix[2];
2154
- result[3] = -matrix[3];
2155
- result[4] = -matrix[4];
2156
- result[5] = -matrix[5];
2157
- result[6] = -matrix[6];
2158
- result[7] = -matrix[7];
2159
- result[8] = -matrix[8];
2160
- return result;
2161
- };
2162
- Matrix3.transpose = function(matrix, result) {
2163
- Check_default.typeOf.object("matrix", matrix);
2164
- Check_default.typeOf.object("result", result);
2165
- const column0Row0 = matrix[0];
2166
- const column0Row1 = matrix[3];
2167
- const column0Row2 = matrix[6];
2168
- const column1Row0 = matrix[1];
2169
- const column1Row1 = matrix[4];
2170
- const column1Row2 = matrix[7];
2171
- const column2Row0 = matrix[2];
2172
- const column2Row1 = matrix[5];
2173
- const column2Row2 = matrix[8];
2174
- result[0] = column0Row0;
2175
- result[1] = column0Row1;
2176
- result[2] = column0Row2;
2177
- result[3] = column1Row0;
2178
- result[4] = column1Row1;
2179
- result[5] = column1Row2;
2180
- result[6] = column2Row0;
2181
- result[7] = column2Row1;
2182
- result[8] = column2Row2;
2183
- return result;
2184
- };
2185
- function computeFrobeniusNorm(matrix) {
2186
- let norm = 0;
2187
- for (let i = 0; i < 9; ++i) {
2188
- const temp = matrix[i];
2189
- norm += temp * temp;
2190
- }
2191
- return Math.sqrt(norm);
2192
- }
2193
- var rowVal = [1, 0, 0];
2194
- var colVal = [2, 2, 1];
2195
- function offDiagonalFrobeniusNorm(matrix) {
2196
- let norm = 0;
2197
- for (let i = 0; i < 3; ++i) {
2198
- const temp = matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])];
2199
- norm += 2 * temp * temp;
2200
- }
2201
- return Math.sqrt(norm);
2202
- }
2203
- function shurDecomposition(matrix, result) {
2204
- const tolerance = Math_default.EPSILON15;
2205
- let maxDiagonal = 0;
2206
- let rotAxis = 1;
2207
- for (let i = 0; i < 3; ++i) {
2208
- const temp = Math.abs(
2209
- matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])]
2210
- );
2211
- if (temp > maxDiagonal) {
2212
- rotAxis = i;
2213
- maxDiagonal = temp;
2214
- }
2215
- }
2216
- let c = 1;
2217
- let s = 0;
2218
- const p = rowVal[rotAxis];
2219
- const q = colVal[rotAxis];
2220
- if (Math.abs(matrix[Matrix3.getElementIndex(q, p)]) > tolerance) {
2221
- const qq = matrix[Matrix3.getElementIndex(q, q)];
2222
- const pp = matrix[Matrix3.getElementIndex(p, p)];
2223
- const qp = matrix[Matrix3.getElementIndex(q, p)];
2224
- const tau = (qq - pp) / 2 / qp;
2225
- let t;
2226
- if (tau < 0) {
2227
- t = -1 / (-tau + Math.sqrt(1 + tau * tau));
2228
- } else {
2229
- t = 1 / (tau + Math.sqrt(1 + tau * tau));
2230
- }
2231
- c = 1 / Math.sqrt(1 + t * t);
2232
- s = t * c;
2233
- }
2234
- result = Matrix3.clone(Matrix3.IDENTITY, result);
2235
- result[Matrix3.getElementIndex(p, p)] = result[Matrix3.getElementIndex(q, q)] = c;
2236
- result[Matrix3.getElementIndex(q, p)] = s;
2237
- result[Matrix3.getElementIndex(p, q)] = -s;
2238
- return result;
2239
- }
2240
- var jMatrix = new Matrix3();
2241
- var jMatrixTranspose = new Matrix3();
2242
- Matrix3.computeEigenDecomposition = function(matrix, result) {
2243
- Check_default.typeOf.object("matrix", matrix);
2244
- const tolerance = Math_default.EPSILON20;
2245
- const maxSweeps = 10;
2246
- let count = 0;
2247
- let sweep = 0;
2248
- if (!defined_default(result)) {
2249
- result = {};
2250
- }
2251
- const unitaryMatrix = result.unitary = Matrix3.clone(
2252
- Matrix3.IDENTITY,
2253
- result.unitary
2254
- );
2255
- const diagMatrix = result.diagonal = Matrix3.clone(matrix, result.diagonal);
2256
- const epsilon = tolerance * computeFrobeniusNorm(diagMatrix);
2257
- while (sweep < maxSweeps && offDiagonalFrobeniusNorm(diagMatrix) > epsilon) {
2258
- shurDecomposition(diagMatrix, jMatrix);
2259
- Matrix3.transpose(jMatrix, jMatrixTranspose);
2260
- Matrix3.multiply(diagMatrix, jMatrix, diagMatrix);
2261
- Matrix3.multiply(jMatrixTranspose, diagMatrix, diagMatrix);
2262
- Matrix3.multiply(unitaryMatrix, jMatrix, unitaryMatrix);
2263
- if (++count > 2) {
2264
- ++sweep;
2265
- count = 0;
2266
- }
2267
- }
2268
- return result;
2269
- };
2270
- Matrix3.abs = function(matrix, result) {
2271
- Check_default.typeOf.object("matrix", matrix);
2272
- Check_default.typeOf.object("result", result);
2273
- result[0] = Math.abs(matrix[0]);
2274
- result[1] = Math.abs(matrix[1]);
2275
- result[2] = Math.abs(matrix[2]);
2276
- result[3] = Math.abs(matrix[3]);
2277
- result[4] = Math.abs(matrix[4]);
2278
- result[5] = Math.abs(matrix[5]);
2279
- result[6] = Math.abs(matrix[6]);
2280
- result[7] = Math.abs(matrix[7]);
2281
- result[8] = Math.abs(matrix[8]);
2282
- return result;
2283
- };
2284
- Matrix3.determinant = function(matrix) {
2285
- Check_default.typeOf.object("matrix", matrix);
2286
- const m11 = matrix[0];
2287
- const m21 = matrix[3];
2288
- const m31 = matrix[6];
2289
- const m12 = matrix[1];
2290
- const m22 = matrix[4];
2291
- const m32 = matrix[7];
2292
- const m13 = matrix[2];
2293
- const m23 = matrix[5];
2294
- const m33 = matrix[8];
2295
- return m11 * (m22 * m33 - m23 * m32) + m12 * (m23 * m31 - m21 * m33) + m13 * (m21 * m32 - m22 * m31);
2296
- };
2297
- Matrix3.inverse = function(matrix, result) {
2298
- Check_default.typeOf.object("matrix", matrix);
2299
- Check_default.typeOf.object("result", result);
2300
- const m11 = matrix[0];
2301
- const m21 = matrix[1];
2302
- const m31 = matrix[2];
2303
- const m12 = matrix[3];
2304
- const m22 = matrix[4];
2305
- const m32 = matrix[5];
2306
- const m13 = matrix[6];
2307
- const m23 = matrix[7];
2308
- const m33 = matrix[8];
2309
- const determinant = Matrix3.determinant(matrix);
2310
- if (Math.abs(determinant) <= Math_default.EPSILON15) {
2311
- throw new DeveloperError_default("matrix is not invertible");
2312
- }
2313
- result[0] = m22 * m33 - m23 * m32;
2314
- result[1] = m23 * m31 - m21 * m33;
2315
- result[2] = m21 * m32 - m22 * m31;
2316
- result[3] = m13 * m32 - m12 * m33;
2317
- result[4] = m11 * m33 - m13 * m31;
2318
- result[5] = m12 * m31 - m11 * m32;
2319
- result[6] = m12 * m23 - m13 * m22;
2320
- result[7] = m13 * m21 - m11 * m23;
2321
- result[8] = m11 * m22 - m12 * m21;
2322
- const scale = 1 / determinant;
2323
- return Matrix3.multiplyByScalar(result, scale, result);
2324
- };
2325
- var scratchTransposeMatrix = new Matrix3();
2326
- Matrix3.inverseTranspose = function(matrix, result) {
2327
- Check_default.typeOf.object("matrix", matrix);
2328
- Check_default.typeOf.object("result", result);
2329
- return Matrix3.inverse(
2330
- Matrix3.transpose(matrix, scratchTransposeMatrix),
2331
- result
2332
- );
2333
- };
2334
- Matrix3.equals = function(left, right) {
2335
- return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[7] === right[7] && left[8] === right[8];
2336
- };
2337
- Matrix3.equalsEpsilon = function(left, right, epsilon) {
2338
- epsilon = defaultValue_default(epsilon, 0);
2339
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon;
2340
- };
2341
- Matrix3.IDENTITY = Object.freeze(
2342
- new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1)
2343
- );
2344
- Matrix3.ZERO = Object.freeze(
2345
- new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0)
2346
- );
2347
- Matrix3.COLUMN0ROW0 = 0;
2348
- Matrix3.COLUMN0ROW1 = 1;
2349
- Matrix3.COLUMN0ROW2 = 2;
2350
- Matrix3.COLUMN1ROW0 = 3;
2351
- Matrix3.COLUMN1ROW1 = 4;
2352
- Matrix3.COLUMN1ROW2 = 5;
2353
- Matrix3.COLUMN2ROW0 = 6;
2354
- Matrix3.COLUMN2ROW1 = 7;
2355
- Matrix3.COLUMN2ROW2 = 8;
2356
- Object.defineProperties(Matrix3.prototype, {
2357
- /**
2358
- * Gets the number of items in the collection.
2359
- * @memberof Matrix3.prototype
2360
- *
2361
- * @type {number}
2362
- */
2363
- length: {
2364
- get: function() {
2365
- return Matrix3.packedLength;
2366
- }
2367
- }
2368
- });
2369
- Matrix3.prototype.clone = function(result) {
2370
- return Matrix3.clone(this, result);
2371
- };
2372
- Matrix3.prototype.equals = function(right) {
2373
- return Matrix3.equals(this, right);
2374
- };
2375
- Matrix3.equalsArray = function(matrix, array, offset) {
2376
- return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3] && matrix[4] === array[offset + 4] && matrix[5] === array[offset + 5] && matrix[6] === array[offset + 6] && matrix[7] === array[offset + 7] && matrix[8] === array[offset + 8];
2377
- };
2378
- Matrix3.prototype.equalsEpsilon = function(right, epsilon) {
2379
- return Matrix3.equalsEpsilon(this, right, epsilon);
2380
- };
2381
- Matrix3.prototype.toString = function() {
2382
- return `(${this[0]}, ${this[3]}, ${this[6]})
2383
- (${this[1]}, ${this[4]}, ${this[7]})
2384
- (${this[2]}, ${this[5]}, ${this[8]})`;
2385
- };
2386
- var Matrix3_default = Matrix3;
2387
-
2388
- // packages/engine/Source/Core/Fullscreen.js
2389
- var _supportsFullscreen;
2390
- var _names = {
2391
- requestFullscreen: void 0,
2392
- exitFullscreen: void 0,
2393
- fullscreenEnabled: void 0,
2394
- fullscreenElement: void 0,
2395
- fullscreenchange: void 0,
2396
- fullscreenerror: void 0
2397
- };
2398
- var Fullscreen = {};
2399
- Object.defineProperties(Fullscreen, {
2400
- /**
2401
- * The element that is currently fullscreen, if any. To simply check if the
2402
- * browser is in fullscreen mode or not, use {@link Fullscreen#fullscreen}.
2403
- * @memberof Fullscreen
2404
- * @type {object}
2405
- * @readonly
2406
- */
2407
- element: {
2408
- get: function() {
2409
- if (!Fullscreen.supportsFullscreen()) {
2410
- return void 0;
2411
- }
2412
- return document[_names.fullscreenElement];
2413
- }
2414
- },
2415
- /**
2416
- * The name of the event on the document that is fired when fullscreen is
2417
- * entered or exited. This event name is intended for use with addEventListener.
2418
- * In your event handler, to determine if the browser is in fullscreen mode or not,
2419
- * use {@link Fullscreen#fullscreen}.
2420
- * @memberof Fullscreen
2421
- * @type {string}
2422
- * @readonly
2423
- */
2424
- changeEventName: {
2425
- get: function() {
2426
- if (!Fullscreen.supportsFullscreen()) {
2427
- return void 0;
2428
- }
2429
- return _names.fullscreenchange;
2430
- }
2431
- },
2432
- /**
2433
- * The name of the event that is fired when a fullscreen error
2434
- * occurs. This event name is intended for use with addEventListener.
2435
- * @memberof Fullscreen
2436
- * @type {string}
2437
- * @readonly
2438
- */
2439
- errorEventName: {
2440
- get: function() {
2441
- if (!Fullscreen.supportsFullscreen()) {
2442
- return void 0;
2443
- }
2444
- return _names.fullscreenerror;
2445
- }
2446
- },
2447
- /**
2448
- * Determine whether the browser will allow an element to be made fullscreen, or not.
2449
- * For example, by default, iframes cannot go fullscreen unless the containing page
2450
- * adds an "allowfullscreen" attribute (or prefixed equivalent).
2451
- * @memberof Fullscreen
2452
- * @type {boolean}
2453
- * @readonly
2454
- */
2455
- enabled: {
2456
- get: function() {
2457
- if (!Fullscreen.supportsFullscreen()) {
2458
- return void 0;
2459
- }
2460
- return document[_names.fullscreenEnabled];
2461
- }
2462
- },
2463
- /**
2464
- * Determines if the browser is currently in fullscreen mode.
2465
- * @memberof Fullscreen
2466
- * @type {boolean}
2467
- * @readonly
2468
- */
2469
- fullscreen: {
2470
- get: function() {
2471
- if (!Fullscreen.supportsFullscreen()) {
2472
- return void 0;
2473
- }
2474
- return Fullscreen.element !== null;
2475
- }
2476
- }
2477
- });
2478
- Fullscreen.supportsFullscreen = function() {
2479
- if (defined_default(_supportsFullscreen)) {
2480
- return _supportsFullscreen;
2481
- }
2482
- _supportsFullscreen = false;
2483
- const body = document.body;
2484
- if (typeof body.requestFullscreen === "function") {
2485
- _names.requestFullscreen = "requestFullscreen";
2486
- _names.exitFullscreen = "exitFullscreen";
2487
- _names.fullscreenEnabled = "fullscreenEnabled";
2488
- _names.fullscreenElement = "fullscreenElement";
2489
- _names.fullscreenchange = "fullscreenchange";
2490
- _names.fullscreenerror = "fullscreenerror";
2491
- _supportsFullscreen = true;
2492
- return _supportsFullscreen;
2493
- }
2494
- const prefixes = ["webkit", "moz", "o", "ms", "khtml"];
2495
- let name;
2496
- for (let i = 0, len = prefixes.length; i < len; ++i) {
2497
- const prefix = prefixes[i];
2498
- name = `${prefix}RequestFullscreen`;
2499
- if (typeof body[name] === "function") {
2500
- _names.requestFullscreen = name;
2501
- _supportsFullscreen = true;
2502
- } else {
2503
- name = `${prefix}RequestFullScreen`;
2504
- if (typeof body[name] === "function") {
2505
- _names.requestFullscreen = name;
2506
- _supportsFullscreen = true;
2507
- }
2508
- }
2509
- name = `${prefix}ExitFullscreen`;
2510
- if (typeof document[name] === "function") {
2511
- _names.exitFullscreen = name;
2512
- } else {
2513
- name = `${prefix}CancelFullScreen`;
2514
- if (typeof document[name] === "function") {
2515
- _names.exitFullscreen = name;
2516
- }
2517
- }
2518
- name = `${prefix}FullscreenEnabled`;
2519
- if (document[name] !== void 0) {
2520
- _names.fullscreenEnabled = name;
2521
- } else {
2522
- name = `${prefix}FullScreenEnabled`;
2523
- if (document[name] !== void 0) {
2524
- _names.fullscreenEnabled = name;
2525
- }
2526
- }
2527
- name = `${prefix}FullscreenElement`;
2528
- if (document[name] !== void 0) {
2529
- _names.fullscreenElement = name;
2530
- } else {
2531
- name = `${prefix}FullScreenElement`;
2532
- if (document[name] !== void 0) {
2533
- _names.fullscreenElement = name;
2534
- }
2535
- }
2536
- name = `${prefix}fullscreenchange`;
2537
- if (document[`on${name}`] !== void 0) {
2538
- if (prefix === "ms") {
2539
- name = "MSFullscreenChange";
2540
- }
2541
- _names.fullscreenchange = name;
2542
- }
2543
- name = `${prefix}fullscreenerror`;
2544
- if (document[`on${name}`] !== void 0) {
2545
- if (prefix === "ms") {
2546
- name = "MSFullscreenError";
2547
- }
2548
- _names.fullscreenerror = name;
2549
- }
2550
- }
2551
- return _supportsFullscreen;
2552
- };
2553
- Fullscreen.requestFullscreen = function(element, vrDevice) {
2554
- if (!Fullscreen.supportsFullscreen()) {
2555
- return;
2556
- }
2557
- element[_names.requestFullscreen]({ vrDisplay: vrDevice });
2558
- };
2559
- Fullscreen.exitFullscreen = function() {
2560
- if (!Fullscreen.supportsFullscreen()) {
2561
- return;
2562
- }
2563
- document[_names.exitFullscreen]();
2564
- };
2565
- Fullscreen._names = _names;
2566
- var Fullscreen_default = Fullscreen;
2567
-
2568
- // packages/engine/Source/Core/FeatureDetection.js
2569
- var theNavigator;
2570
- if (typeof navigator !== "undefined") {
2571
- theNavigator = navigator;
2572
- } else {
2573
- theNavigator = {};
2574
- }
2575
- function extractVersion(versionString) {
2576
- const parts = versionString.split(".");
2577
- for (let i = 0, len = parts.length; i < len; ++i) {
2578
- parts[i] = parseInt(parts[i], 10);
2579
- }
2580
- return parts;
2581
- }
2582
- var isChromeResult;
2583
- var chromeVersionResult;
2584
- function isChrome() {
2585
- if (!defined_default(isChromeResult)) {
2586
- isChromeResult = false;
2587
- if (!isEdge()) {
2588
- const fields = / Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);
2589
- if (fields !== null) {
2590
- isChromeResult = true;
2591
- chromeVersionResult = extractVersion(fields[1]);
2592
- }
2593
- }
2594
- }
2595
- return isChromeResult;
2596
- }
2597
- function chromeVersion() {
2598
- return isChrome() && chromeVersionResult;
2599
- }
2600
- var isSafariResult;
2601
- var safariVersionResult;
2602
- function isSafari() {
2603
- if (!defined_default(isSafariResult)) {
2604
- isSafariResult = false;
2605
- if (!isChrome() && !isEdge() && / Safari\/[\.0-9]+/.test(theNavigator.userAgent)) {
2606
- const fields = / Version\/([\.0-9]+)/.exec(theNavigator.userAgent);
2607
- if (fields !== null) {
2608
- isSafariResult = true;
2609
- safariVersionResult = extractVersion(fields[1]);
2610
- }
2611
- }
2612
- }
2613
- return isSafariResult;
2614
- }
2615
- function safariVersion() {
2616
- return isSafari() && safariVersionResult;
2617
- }
2618
- var isWebkitResult;
2619
- var webkitVersionResult;
2620
- function isWebkit() {
2621
- if (!defined_default(isWebkitResult)) {
2622
- isWebkitResult = false;
2623
- const fields = / AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);
2624
- if (fields !== null) {
2625
- isWebkitResult = true;
2626
- webkitVersionResult = extractVersion(fields[1]);
2627
- webkitVersionResult.isNightly = !!fields[2];
2628
- }
2629
- }
2630
- return isWebkitResult;
2631
- }
2632
- function webkitVersion() {
2633
- return isWebkit() && webkitVersionResult;
2634
- }
2635
- var isInternetExplorerResult;
2636
- var internetExplorerVersionResult;
2637
- function isInternetExplorer() {
2638
- if (!defined_default(isInternetExplorerResult)) {
2639
- isInternetExplorerResult = false;
2640
- let fields;
2641
- if (theNavigator.appName === "Microsoft Internet Explorer") {
2642
- fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent);
2643
- if (fields !== null) {
2644
- isInternetExplorerResult = true;
2645
- internetExplorerVersionResult = extractVersion(fields[1]);
2646
- }
2647
- } else if (theNavigator.appName === "Netscape") {
2648
- fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(
2649
- theNavigator.userAgent
2650
- );
2651
- if (fields !== null) {
2652
- isInternetExplorerResult = true;
2653
- internetExplorerVersionResult = extractVersion(fields[1]);
2654
- }
2655
- }
2656
- }
2657
- return isInternetExplorerResult;
2658
- }
2659
- function internetExplorerVersion() {
2660
- return isInternetExplorer() && internetExplorerVersionResult;
2661
- }
2662
- var isEdgeResult;
2663
- var edgeVersionResult;
2664
- function isEdge() {
2665
- if (!defined_default(isEdgeResult)) {
2666
- isEdgeResult = false;
2667
- const fields = / Edg\/([\.0-9]+)/.exec(theNavigator.userAgent);
2668
- if (fields !== null) {
2669
- isEdgeResult = true;
2670
- edgeVersionResult = extractVersion(fields[1]);
2671
- }
2672
- }
2673
- return isEdgeResult;
2674
- }
2675
- function edgeVersion() {
2676
- return isEdge() && edgeVersionResult;
2677
- }
2678
- var isFirefoxResult;
2679
- var firefoxVersionResult;
2680
- function isFirefox() {
2681
- if (!defined_default(isFirefoxResult)) {
2682
- isFirefoxResult = false;
2683
- const fields = /Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);
2684
- if (fields !== null) {
2685
- isFirefoxResult = true;
2686
- firefoxVersionResult = extractVersion(fields[1]);
2687
- }
2688
- }
2689
- return isFirefoxResult;
2690
- }
2691
- var isWindowsResult;
2692
- function isWindows() {
2693
- if (!defined_default(isWindowsResult)) {
2694
- isWindowsResult = /Windows/i.test(theNavigator.appVersion);
2695
- }
2696
- return isWindowsResult;
2697
- }
2698
- var isIPadOrIOSResult;
2699
- function isIPadOrIOS() {
2700
- if (!defined_default(isIPadOrIOSResult)) {
2701
- isIPadOrIOSResult = navigator.platform === "iPhone" || navigator.platform === "iPod" || navigator.platform === "iPad";
2702
- }
2703
- return isIPadOrIOSResult;
2704
- }
2705
- function firefoxVersion() {
2706
- return isFirefox() && firefoxVersionResult;
2707
- }
2708
- var hasPointerEvents;
2709
- function supportsPointerEvents() {
2710
- if (!defined_default(hasPointerEvents)) {
2711
- hasPointerEvents = !isFirefox() && typeof PointerEvent !== "undefined" && (!defined_default(theNavigator.pointerEnabled) || theNavigator.pointerEnabled);
2712
- }
2713
- return hasPointerEvents;
2714
- }
2715
- var imageRenderingValueResult;
2716
- var supportsImageRenderingPixelatedResult;
2717
- function supportsImageRenderingPixelated() {
2718
- if (!defined_default(supportsImageRenderingPixelatedResult)) {
2719
- const canvas = document.createElement("canvas");
2720
- canvas.setAttribute(
2721
- "style",
2722
- "image-rendering: -moz-crisp-edges;image-rendering: pixelated;"
2723
- );
2724
- const tmp = canvas.style.imageRendering;
2725
- supportsImageRenderingPixelatedResult = defined_default(tmp) && tmp !== "";
2726
- if (supportsImageRenderingPixelatedResult) {
2727
- imageRenderingValueResult = tmp;
2728
- }
2729
- }
2730
- return supportsImageRenderingPixelatedResult;
2731
- }
2732
- function imageRenderingValue() {
2733
- return supportsImageRenderingPixelated() ? imageRenderingValueResult : void 0;
2734
- }
2735
- function supportsWebP() {
2736
- if (!supportsWebP.initialized) {
2737
- throw new DeveloperError_default(
2738
- "You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP"
2739
- );
2740
- }
2741
- return supportsWebP._result;
2742
- }
2743
- supportsWebP._promise = void 0;
2744
- supportsWebP._result = void 0;
2745
- supportsWebP.initialize = function() {
2746
- if (defined_default(supportsWebP._promise)) {
2747
- return supportsWebP._promise;
2748
- }
2749
- supportsWebP._promise = new Promise((resolve) => {
2750
- const image = new Image();
2751
- image.onload = function() {
2752
- supportsWebP._result = image.width > 0 && image.height > 0;
2753
- resolve(supportsWebP._result);
2754
- };
2755
- image.onerror = function() {
2756
- supportsWebP._result = false;
2757
- resolve(supportsWebP._result);
2758
- };
2759
- image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
2760
- });
2761
- return supportsWebP._promise;
2762
- };
2763
- Object.defineProperties(supportsWebP, {
2764
- initialized: {
2765
- get: function() {
2766
- return defined_default(supportsWebP._result);
2767
- }
2768
- }
2769
- });
2770
- var typedArrayTypes = [];
2771
- if (typeof ArrayBuffer !== "undefined") {
2772
- typedArrayTypes.push(
2773
- Int8Array,
2774
- Uint8Array,
2775
- Int16Array,
2776
- Uint16Array,
2777
- Int32Array,
2778
- Uint32Array,
2779
- Float32Array,
2780
- Float64Array
2781
- );
2782
- if (typeof Uint8ClampedArray !== "undefined") {
2783
- typedArrayTypes.push(Uint8ClampedArray);
2784
- }
2785
- if (typeof Uint8ClampedArray !== "undefined") {
2786
- typedArrayTypes.push(Uint8ClampedArray);
2787
- }
2788
- if (typeof BigInt64Array !== "undefined") {
2789
- typedArrayTypes.push(BigInt64Array);
2790
- }
2791
- if (typeof BigUint64Array !== "undefined") {
2792
- typedArrayTypes.push(BigUint64Array);
2793
- }
2794
- }
2795
- var FeatureDetection = {
2796
- isChrome,
2797
- chromeVersion,
2798
- isSafari,
2799
- safariVersion,
2800
- isWebkit,
2801
- webkitVersion,
2802
- isInternetExplorer,
2803
- internetExplorerVersion,
2804
- isEdge,
2805
- edgeVersion,
2806
- isFirefox,
2807
- firefoxVersion,
2808
- isWindows,
2809
- isIPadOrIOS,
2810
- hardwareConcurrency: defaultValue_default(theNavigator.hardwareConcurrency, 3),
2811
- supportsPointerEvents,
2812
- supportsImageRenderingPixelated,
2813
- supportsWebP,
2814
- imageRenderingValue,
2815
- typedArrayTypes
2816
- };
2817
- FeatureDetection.supportsBasis = function(scene) {
2818
- return FeatureDetection.supportsWebAssembly() && scene.context.supportsBasis;
2819
- };
2820
- FeatureDetection.supportsFullscreen = function() {
2821
- return Fullscreen_default.supportsFullscreen();
2822
- };
2823
- FeatureDetection.supportsTypedArrays = function() {
2824
- return typeof ArrayBuffer !== "undefined";
2825
- };
2826
- FeatureDetection.supportsBigInt64Array = function() {
2827
- return typeof BigInt64Array !== "undefined";
2828
- };
2829
- FeatureDetection.supportsBigUint64Array = function() {
2830
- return typeof BigUint64Array !== "undefined";
2831
- };
2832
- FeatureDetection.supportsBigInt = function() {
2833
- return typeof BigInt !== "undefined";
2834
- };
2835
- FeatureDetection.supportsWebWorkers = function() {
2836
- return typeof Worker !== "undefined";
2837
- };
2838
- FeatureDetection.supportsWebAssembly = function() {
2839
- return typeof WebAssembly !== "undefined";
2840
- };
2841
- FeatureDetection.supportsWebgl2 = function(scene) {
2842
- Check_default.defined("scene", scene);
2843
- return scene.context.webgl2;
2844
- };
2845
- FeatureDetection.supportsEsmWebWorkers = function() {
2846
- return !isFirefox() || parseInt(firefoxVersionResult) >= 114;
2847
- };
2848
- var FeatureDetection_default = FeatureDetection;
2849
-
2850
- export {
2851
- Cartesian3_default,
2852
- Cartographic_default,
2853
- Cartesian2_default,
2854
- Ellipsoid_default,
2855
- Matrix3_default,
2856
- FeatureDetection_default
2857
- };