@cesium/engine 26.2.0 → 26.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +656 -518
  2. package/Build/Workers/{chunk-FU4BGABC.js → chunk-2DKJSPYF.js} +14 -14
  3. package/Build/Workers/{chunk-NCL22ZUX.js → chunk-2PWVICP6.js} +1 -1
  4. package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
  5. package/Build/Workers/{chunk-IJZJMIUY.js → chunk-4DMAXPKB.js} +11 -11
  6. package/Build/Workers/{chunk-IMBVP57H.js → chunk-4LRFYRBX.js} +2 -2
  7. package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
  8. package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
  9. package/Build/Workers/{chunk-UAZUP4I5.js → chunk-6BSNYZZG.js} +5 -5
  10. package/Build/Workers/{chunk-D6AY775A.js → chunk-6R6SGKYN.js} +6 -6
  11. package/Build/Workers/{chunk-3PSS3T43.js → chunk-6V2KDEHL.js} +4 -4
  12. package/Build/Workers/{chunk-GHXVQVUM.js → chunk-75BC2IHI.js} +7 -7
  13. package/Build/Workers/{chunk-SMTGMFBL.js → chunk-7SESBH2I.js} +4 -4
  14. package/Build/Workers/{chunk-NEFDMMLY.js → chunk-7WXBTNRV.js} +8 -8
  15. package/Build/Workers/{chunk-NXGQBQWE.js → chunk-A7SMPV6B.js} +12 -12
  16. package/Build/Workers/{chunk-O3XFXGPZ.js → chunk-ATSXKJ3L.js} +7 -7
  17. package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
  18. package/Build/Workers/{chunk-OZGPS7FB.js → chunk-B7Q2WF6Q.js} +4 -4
  19. package/Build/Workers/{chunk-2RGJPWQX.js → chunk-BNDSDQ7D.js} +9 -9
  20. package/Build/Workers/{chunk-2Z4ZLVOD.js → chunk-CKK6CUXK.js} +6 -6
  21. package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
  22. package/Build/Workers/{chunk-6FZDPMTO.js → chunk-CQ4TZXAT.js} +6 -6
  23. package/Build/Workers/{chunk-HDL4HOXZ.js → chunk-DKSANM4A.js} +12 -12
  24. package/Build/Workers/{chunk-XCBZVTIV.js → chunk-DZK34ZVD.js} +1 -1
  25. package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
  26. package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
  27. package/Build/Workers/{chunk-NSKZ6SBK.js → chunk-F34TJJLA.js} +14 -14
  28. package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
  29. package/Build/Workers/{chunk-SJYSIOEM.js → chunk-GS7RY2DH.js} +11 -11
  30. package/Build/Workers/{chunk-5YPQBFRD.js → chunk-HDD3RFLT.js} +3 -3
  31. package/Build/Workers/{chunk-36NI5E6W.js → chunk-HDPNFEPP.js} +18 -18
  32. package/Build/Workers/{chunk-DSGLDRTI.js → chunk-JBJ6BRIM.js} +4 -4
  33. package/Build/Workers/{chunk-DZUFEE4L.js → chunk-JKTWW7IO.js} +5 -5
  34. package/Build/Workers/{chunk-O3DKEX7Q.js → chunk-JL4NWWQY.js} +5 -5
  35. package/Build/Workers/{chunk-I74ZH5LK.js → chunk-JMUUAW4X.js} +10 -10
  36. package/Build/Workers/{chunk-SXSP3JHS.js → chunk-KBGAHN5R.js} +1 -1
  37. package/Build/Workers/{chunk-GVA7XQI2.js → chunk-KEWK6VZL.js} +12 -12
  38. package/Build/Workers/{chunk-EOWDZN5S.js → chunk-L73K5UPP.js} +10 -10
  39. package/Build/Workers/{chunk-J73T2VOY.js → chunk-LL2SGJYH.js} +6 -6
  40. package/Build/Workers/{chunk-QFSSCLLZ.js → chunk-LYJUL4XQ.js} +6 -6
  41. package/Build/Workers/{chunk-MAAHFYPC.js → chunk-M6W46OAP.js} +7 -7
  42. package/Build/Workers/{chunk-FX3VEAIU.js → chunk-MDDKCLMF.js} +16 -16
  43. package/Build/Workers/{chunk-M6QKXVAU.js → chunk-MUW4DJV7.js} +17 -17
  44. package/Build/Workers/{chunk-EZGQPOIG.js → chunk-N5YK44FS.js} +5 -5
  45. package/Build/Workers/{chunk-27FWRTJI.js → chunk-NZQUP52G.js} +9 -9
  46. package/Build/Workers/{chunk-A62YI6S6.js → chunk-PKZA44LH.js} +4 -4
  47. package/Build/Workers/{chunk-7MM3N2VE.js → chunk-Q2JS5LCB.js} +17 -17
  48. package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
  49. package/Build/Workers/{chunk-KP5QD7WU.js → chunk-SEJIXZZ4.js} +10 -10
  50. package/Build/Workers/{chunk-PRWUMCXF.js → chunk-SL2HCFYW.js} +10 -10
  51. package/Build/Workers/{chunk-NJVBJG63.js → chunk-SLHK3KAR.js} +5 -5
  52. package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
  53. package/Build/Workers/{chunk-LDRQSYBN.js → chunk-VRECSMG3.js} +2 -2
  54. package/Build/Workers/{chunk-NLLCQBX3.js → chunk-X27HKF5E.js} +2 -2
  55. package/Build/Workers/{chunk-B3QHNA4A.js → chunk-XBY3354M.js} +6 -6
  56. package/Build/Workers/{chunk-CRCGE4J4.js → chunk-XRZCS3HE.js} +8 -8
  57. package/Build/Workers/{chunk-XLQZNQ4Z.js → chunk-XSIUYAT6.js} +2 -2
  58. package/Build/Workers/{chunk-SA2A2AN5.js → chunk-Z2DW5NM2.js} +4 -4
  59. package/Build/Workers/combineGeometry.js +24 -24
  60. package/Build/Workers/createBoxGeometry.js +18 -18
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  62. package/Build/Workers/createCircleGeometry.js +26 -26
  63. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  66. package/Build/Workers/createCorridorGeometry.js +29 -29
  67. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  68. package/Build/Workers/createCylinderGeometry.js +20 -20
  69. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  70. package/Build/Workers/createEllipseGeometry.js +26 -26
  71. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  74. package/Build/Workers/createFrustumGeometry.js +18 -18
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  76. package/Build/Workers/createGeometry.js +24 -24
  77. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  78. package/Build/Workers/createPlaneGeometry.js +16 -16
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  80. package/Build/Workers/createPolygonGeometry.js +32 -32
  81. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  82. package/Build/Workers/createPolylineGeometry.js +25 -25
  83. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  85. package/Build/Workers/createRectangleGeometry.js +27 -27
  86. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  87. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  88. package/Build/Workers/createSphereGeometry.js +19 -19
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  92. package/Build/Workers/createVectorTileGeometries.js +24 -24
  93. package/Build/Workers/createVectorTilePoints.js +13 -13
  94. package/Build/Workers/createVectorTilePolygons.js +22 -22
  95. package/Build/Workers/createVectorTilePolylines.js +14 -14
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  98. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  100. package/Build/Workers/createWallGeometry.js +24 -24
  101. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +10 -10
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  112. package/Source/Core/Ion.js +1 -1
  113. package/Source/Core/IonResource.js +5 -0
  114. package/Source/Core/IonSnapGeometryType.js +59 -0
  115. package/Source/Core/IonSnapHeat.js +33 -0
  116. package/Source/Core/IonSnapMode.js +45 -0
  117. package/Source/Core/IonSnapParentGeometryType.js +52 -0
  118. package/Source/Core/IonSnapService.js +369 -0
  119. package/Source/Core/SnapService.js +63 -0
  120. package/Source/Core/VectorPipeline.js +139 -45
  121. package/Source/Core/VectorProvider.js +311 -71
  122. package/Source/Renderer/AutomaticUniforms.js +44 -2
  123. package/Source/Renderer/ShaderBuilder.js +1 -1
  124. package/Source/Renderer/UniformState.js +47 -1
  125. package/Source/Scene/ArcGisMapService.js +1 -1
  126. package/Source/Scene/BufferPointCollection.js +4 -7
  127. package/Source/Scene/BufferPolygonCollection.js +56 -27
  128. package/Source/Scene/BufferPolylineCollection.js +61 -8
  129. package/Source/Scene/BufferPolylineMaterial.js +6 -5
  130. package/Source/Scene/BufferPrimitiveCollection.js +199 -29
  131. package/Source/Scene/Cesium3DTile.js +12 -0
  132. package/Source/Scene/Cesium3DTileset.js +61 -8
  133. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
  134. package/Source/Scene/Cesium3DTilesetCache.js +15 -0
  135. package/Source/Scene/ClippingPolygon.js +154 -100
  136. package/Source/Scene/ClippingPolygonCollection.js +352 -694
  137. package/Source/Scene/CreditDisplay.js +62 -0
  138. package/Source/Scene/GeoJsonPrimitive.js +114 -24
  139. package/Source/Scene/GlobeSurfaceShaderSet.js +33 -54
  140. package/Source/Scene/GlobeSurfaceTile.js +14 -1
  141. package/Source/Scene/GlobeSurfaceTileProvider.js +232 -25
  142. package/Source/Scene/GltfLoader.js +56 -6
  143. package/Source/Scene/HeightReference.js +1 -1
  144. package/Source/Scene/MVTDataProvider.js +9 -0
  145. package/Source/Scene/Model/Model.js +242 -16
  146. package/Source/Scene/Model/Model3DTileContent.js +5 -0
  147. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
  148. package/Source/Scene/Model/ModelRenderResources.js +2 -3
  149. package/Source/Scene/Model/ModelSceneGraph.js +10 -1
  150. package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
  151. package/Source/Scene/Model/PickingPipelineStage.js +4 -0
  152. package/Source/Scene/PostProcessStage.js +22 -3
  153. package/Source/Scene/Scene.js +56 -1
  154. package/Source/Scene/Snapping.js +57 -0
  155. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +12 -1
  156. package/Source/Scene/VectorGltf3DTileContent.js +10 -2
  157. package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
  158. package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
  159. package/Source/Scene/renderBufferPolylineCollection.js +5 -1
  160. package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
  161. package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
  162. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -4
  163. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
  164. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
  165. package/Source/Shaders/GlobeFS.glsl +10 -9
  166. package/Source/Shaders/GlobeFS.js +11 -9
  167. package/Source/Shaders/GlobeVS.glsl +0 -32
  168. package/Source/Shaders/GlobeVS.js +0 -32
  169. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
  170. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
  171. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
  172. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
  173. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  174. package/Source/Shaders/Model/ModelFS.js +4 -0
  175. package/Source/Shaders/Model/ModelVS.glsl +7 -2
  176. package/Source/Shaders/Model/ModelVS.js +7 -2
  177. package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
  178. package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
  179. package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
  180. package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
  181. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
  182. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
  183. package/Source/Shaders/VectorCommon.glsl +177 -50
  184. package/Source/Shaders/VectorCommon.js +251 -19
  185. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  186. package/index.d.ts +556 -55
  187. package/index.js +20 -13
  188. package/package.json +6 -6
  189. package/Build/Workers/chunk-2EFYUSUY.js +0 -1483
  190. package/Build/Workers/chunk-2H5264K7.js +0 -1284
  191. package/Build/Workers/chunk-2H73KDBM.js +0 -511
  192. package/Build/Workers/chunk-2ZKH2QZB.js +0 -387
  193. package/Build/Workers/chunk-37SW7SYS.js +0 -778
  194. package/Build/Workers/chunk-3GHVJ3SO.js +0 -455
  195. package/Build/Workers/chunk-3LB4UVPU.js +0 -387
  196. package/Build/Workers/chunk-3PONLKEL.js +0 -778
  197. package/Build/Workers/chunk-3QR662HH.js +0 -3820
  198. package/Build/Workers/chunk-3SX2WYSO.js +0 -973
  199. package/Build/Workers/chunk-3UDN6LYX.js +0 -476
  200. package/Build/Workers/chunk-47MCBSXI.js +0 -9237
  201. package/Build/Workers/chunk-4E626OCE.js +0 -1067
  202. package/Build/Workers/chunk-4NW2MJKH.js +0 -455
  203. package/Build/Workers/chunk-52YK5BSN.js +0 -198
  204. package/Build/Workers/chunk-5RNAQZK6.js +0 -9234
  205. package/Build/Workers/chunk-6FHT43QR.js +0 -140
  206. package/Build/Workers/chunk-6HK6IXK2.js +0 -138
  207. package/Build/Workers/chunk-6R5X2GUA.js +0 -1284
  208. package/Build/Workers/chunk-6YR6JBMY.js +0 -163
  209. package/Build/Workers/chunk-7A2OGDHT.js +0 -305
  210. package/Build/Workers/chunk-7CGEQUM2.js +0 -305
  211. package/Build/Workers/chunk-7D2HZKH7.js +0 -455
  212. package/Build/Workers/chunk-7I325HV6.js +0 -1344
  213. package/Build/Workers/chunk-7KVKHY7O.js +0 -147
  214. package/Build/Workers/chunk-7TKLTCZW.js +0 -219
  215. package/Build/Workers/chunk-7UUKBDH6.js +0 -1054
  216. package/Build/Workers/chunk-7W6DUHAB.js +0 -693
  217. package/Build/Workers/chunk-7XM5JK5F.js +0 -162
  218. package/Build/Workers/chunk-7YG3ND3P.js +0 -454
  219. package/Build/Workers/chunk-A3O6EDBK.js +0 -73
  220. package/Build/Workers/chunk-A6X24AZI.js +0 -1992
  221. package/Build/Workers/chunk-A7TTWVTF.js +0 -2719
  222. package/Build/Workers/chunk-ACTVJHSP.js +0 -519
  223. package/Build/Workers/chunk-ADX3CBKD.js +0 -9234
  224. package/Build/Workers/chunk-AF7DTMJ7.js +0 -398
  225. package/Build/Workers/chunk-AJSFRY4U.js +0 -1344
  226. package/Build/Workers/chunk-ARZICEEP.js +0 -301
  227. package/Build/Workers/chunk-B4CQSLZJ.js +0 -305
  228. package/Build/Workers/chunk-BKPQFCXH.js +0 -511
  229. package/Build/Workers/chunk-BSPCI2LO.js +0 -959
  230. package/Build/Workers/chunk-BUJWSX5S.js +0 -301
  231. package/Build/Workers/chunk-C7JQVRLM.js +0 -497
  232. package/Build/Workers/chunk-C7QDUNI3.js +0 -138
  233. package/Build/Workers/chunk-CDJDJ5LK.js +0 -44
  234. package/Build/Workers/chunk-CEEZE3YZ.js +0 -476
  235. package/Build/Workers/chunk-CIV5DJOQ.js +0 -778
  236. package/Build/Workers/chunk-CLCTQVVL.js +0 -241
  237. package/Build/Workers/chunk-CQNFIAZU.js +0 -56
  238. package/Build/Workers/chunk-CUTRKXUQ.js +0 -288
  239. package/Build/Workers/chunk-DBD5WWG2.js +0 -959
  240. package/Build/Workers/chunk-DIGUUD6G.js +0 -171
  241. package/Build/Workers/chunk-DZBQUULR.js +0 -138
  242. package/Build/Workers/chunk-E2NKV5YT.js +0 -3820
  243. package/Build/Workers/chunk-E7NZJOK7.js +0 -3792
  244. package/Build/Workers/chunk-EB3Y5P3A.js +0 -368
  245. package/Build/Workers/chunk-EHTS2YPT.js +0 -2719
  246. package/Build/Workers/chunk-ELE6SC2C.js +0 -837
  247. package/Build/Workers/chunk-ENNFMWDW.js +0 -789
  248. package/Build/Workers/chunk-ERKUET22.js +0 -3201
  249. package/Build/Workers/chunk-F2IMBMZY.js +0 -241
  250. package/Build/Workers/chunk-F4CSNRZO.js +0 -219
  251. package/Build/Workers/chunk-FBP4DUQJ.js +0 -693
  252. package/Build/Workers/chunk-FDK4K5IA.js +0 -280
  253. package/Build/Workers/chunk-FGQFQHN5.js +0 -1054
  254. package/Build/Workers/chunk-FJWZMGOQ.js +0 -1992
  255. package/Build/Workers/chunk-FQ42MT7M.js +0 -58
  256. package/Build/Workers/chunk-GGNWQWSB.js +0 -301
  257. package/Build/Workers/chunk-GNKXEN4C.js +0 -682
  258. package/Build/Workers/chunk-GSWMAFTE.js +0 -9230
  259. package/Build/Workers/chunk-GXDHRC4J.js +0 -1344
  260. package/Build/Workers/chunk-GYSYP6PC.js +0 -1067
  261. package/Build/Workers/chunk-H2WCFXLP.js +0 -241
  262. package/Build/Workers/chunk-HHV3MCGV.js +0 -162
  263. package/Build/Workers/chunk-HLW2ZRVK.js +0 -368
  264. package/Build/Workers/chunk-HS6AD4P2.js +0 -398
  265. package/Build/Workers/chunk-HT6FASOT.js +0 -973
  266. package/Build/Workers/chunk-IDVHUDZT.js +0 -352
  267. package/Build/Workers/chunk-IGAZBTFZ.js +0 -3201
  268. package/Build/Workers/chunk-IOO7Z2AV.js +0 -57
  269. package/Build/Workers/chunk-IUIFLOYO.js +0 -44
  270. package/Build/Workers/chunk-JALGQYDY.js +0 -288
  271. package/Build/Workers/chunk-JW6OZT4R.js +0 -288
  272. package/Build/Workers/chunk-JXYLJCTC.js +0 -124
  273. package/Build/Workers/chunk-K27QOAW6.js +0 -97
  274. package/Build/Workers/chunk-KMV25A63.js +0 -789
  275. package/Build/Workers/chunk-KZWFWJML.js +0 -2719
  276. package/Build/Workers/chunk-LCXRRALY.js +0 -387
  277. package/Build/Workers/chunk-LD64RPYV.js +0 -368
  278. package/Build/Workers/chunk-LGNDTZVX.js +0 -97
  279. package/Build/Workers/chunk-LNSQVXFH.js +0 -1800
  280. package/Build/Workers/chunk-M4JZ6TSZ.js +0 -959
  281. package/Build/Workers/chunk-MCJDRDJQ.js +0 -102
  282. package/Build/Workers/chunk-MEENMEAH.js +0 -198
  283. package/Build/Workers/chunk-NAWU5RF4.js +0 -162
  284. package/Build/Workers/chunk-NIWITKQK.js +0 -693
  285. package/Build/Workers/chunk-OA6MYL2C.js +0 -837
  286. package/Build/Workers/chunk-OBEU25PI.js +0 -1067
  287. package/Build/Workers/chunk-OHP4ELS7.js +0 -198
  288. package/Build/Workers/chunk-PCL3Y7H5.js +0 -82
  289. package/Build/Workers/chunk-PD4GK4EM.js +0 -57
  290. package/Build/Workers/chunk-PEDU33QG.js +0 -2342
  291. package/Build/Workers/chunk-PVTSNNVI.js +0 -288
  292. package/Build/Workers/chunk-QHPZH22L.js +0 -241
  293. package/Build/Workers/chunk-QIZDWZK6.js +0 -301
  294. package/Build/Workers/chunk-QV6DG2YX.js +0 -1483
  295. package/Build/Workers/chunk-QVLAFFJY.js +0 -56
  296. package/Build/Workers/chunk-R4FPNAZ2.js +0 -352
  297. package/Build/Workers/chunk-R4K7EHOU.js +0 -171
  298. package/Build/Workers/chunk-R7JGHDD6.js +0 -789
  299. package/Build/Workers/chunk-RASQEYD4.js +0 -1483
  300. package/Build/Workers/chunk-RG4F5R57.js +0 -454
  301. package/Build/Workers/chunk-RW6ITX7Q.js +0 -3820
  302. package/Build/Workers/chunk-RYSQVJR6.js +0 -398
  303. package/Build/Workers/chunk-S6RJU5NM.js +0 -1054
  304. package/Build/Workers/chunk-SDFHDNS4.js +0 -147
  305. package/Build/Workers/chunk-SF6K72D7.js +0 -124
  306. package/Build/Workers/chunk-SGRGNDOD.js +0 -682
  307. package/Build/Workers/chunk-SM2CDCYF.js +0 -198
  308. package/Build/Workers/chunk-SS5ABQGY.js +0 -102
  309. package/Build/Workers/chunk-T5QBPLE3.js +0 -414
  310. package/Build/Workers/chunk-TN35HP5B.js +0 -1067
  311. package/Build/Workers/chunk-TNWKJNUZ.js +0 -454
  312. package/Build/Workers/chunk-TOAF47AQ.js +0 -102
  313. package/Build/Workers/chunk-TQ4QCOXT.js +0 -2719
  314. package/Build/Workers/chunk-TSDSILQB.js +0 -124
  315. package/Build/Workers/chunk-TVZD72WJ.js +0 -778
  316. package/Build/Workers/chunk-U5LV3F3Z.js +0 -1054
  317. package/Build/Workers/chunk-UEY73NRN.js +0 -38
  318. package/Build/Workers/chunk-UF46SZEZ.js +0 -789
  319. package/Build/Workers/chunk-UNRTMCET.js +0 -398
  320. package/Build/Workers/chunk-UTB7U3O6.js +0 -1992
  321. package/Build/Workers/chunk-UVO6COT2.js +0 -352
  322. package/Build/Workers/chunk-V46YGZE6.js +0 -352
  323. package/Build/Workers/chunk-VAL7DYNR.js +0 -278
  324. package/Build/Workers/chunk-VDGOCROW.js +0 -57
  325. package/Build/Workers/chunk-VFWSSBPT.js +0 -511
  326. package/Build/Workers/chunk-VVYMXI3I.js +0 -1284
  327. package/Build/Workers/chunk-VXWHPYQM.js +0 -837
  328. package/Build/Workers/chunk-VXYUBRSB.js +0 -219
  329. package/Build/Workers/chunk-VZLDLEWI.js +0 -387
  330. package/Build/Workers/chunk-W5OCKMPJ.js +0 -101
  331. package/Build/Workers/chunk-WBSY7HDY.js +0 -837
  332. package/Build/Workers/chunk-WN3F4CVG.js +0 -3201
  333. package/Build/Workers/chunk-WPRUWXGV.js +0 -693
  334. package/Build/Workers/chunk-WTO2ERBP.js +0 -414
  335. package/Build/Workers/chunk-WVHMDVG4.js +0 -959
  336. package/Build/Workers/chunk-XGA23TAX.js +0 -73
  337. package/Build/Workers/chunk-XLXSDIP5.js +0 -973
  338. package/Build/Workers/chunk-XQ3SKCMM.js +0 -140
  339. package/Build/Workers/chunk-XQH66YJC.js +0 -147
  340. package/Build/Workers/chunk-XTA7BXJG.js +0 -682
  341. package/Build/Workers/chunk-XTIDAFRS.js +0 -476
  342. package/Build/Workers/chunk-XUEDWBUD.js +0 -682
  343. package/Build/Workers/chunk-XYFLRH3H.js +0 -124
  344. package/Build/Workers/chunk-Y7JRTRTO.js +0 -305
  345. package/Build/Workers/chunk-Y7QSMDCJ.js +0 -352
  346. package/Build/Workers/chunk-YCB5TYTR.js +0 -1483
  347. package/Build/Workers/chunk-YEYOSTJX.js +0 -219
  348. package/Build/Workers/chunk-YGFVAGYF.js +0 -630
  349. package/Build/Workers/chunk-YIIACKQO.js +0 -368
  350. package/Build/Workers/chunk-YJGSP6PE.js +0 -511
  351. package/Build/Workers/chunk-YKU2Q3A2.js +0 -1287
  352. package/Build/Workers/chunk-Z4LR5EHE.js +0 -454
  353. package/Build/Workers/chunk-Z66EVE2A.js +0 -44
  354. package/Build/Workers/chunk-ZHIHHHTB.js +0 -414
  355. package/Build/Workers/chunk-ZMBHFYOX.js +0 -1344
  356. package/Build/Workers/chunk-ZNWHFSLE.js +0 -171
  357. package/Build/Workers/chunk-ZQLZG4IN.js +0 -2342
  358. package/Build/Workers/chunk-ZRTSMUZ2.js +0 -414
  359. package/Build/Workers/chunk-ZSGUV73H.js +0 -2342
  360. package/Build/Workers/chunk-ZZUVT5BM.js +0 -476
  361. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
  362. package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
  363. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
  364. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
  365. package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
  366. package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
@@ -1,1284 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.144.0
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
- Intersect_default
28
- } from "./chunk-CQNFIAZU.js";
29
- import {
30
- Rectangle_default
31
- } from "./chunk-CRCGE4J4.js";
32
- import {
33
- Matrix4_default
34
- } from "./chunk-ERKUET22.js";
35
- import {
36
- Cartographic_default,
37
- Ellipsoid_default
38
- } from "./chunk-UAZUP4I5.js";
39
- import {
40
- Cartesian3_default,
41
- Matrix3_default
42
- } from "./chunk-SA2A2AN5.js";
43
- import {
44
- Math_default
45
- } from "./chunk-ACTVJHSP.js";
46
- import {
47
- Check_default,
48
- DeveloperError_default
49
- } from "./chunk-XLQZNQ4Z.js";
50
- import {
51
- defined_default
52
- } from "./chunk-PCL3Y7H5.js";
53
-
54
- // packages/engine/Source/Core/GeographicProjection.js
55
- var GeographicProjection = class {
56
- /**
57
- * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid.
58
- */
59
- constructor(ellipsoid) {
60
- this._ellipsoid = ellipsoid ?? Ellipsoid_default.default;
61
- this._semimajorAxis = this._ellipsoid.maximumRadius;
62
- this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
63
- }
64
- /**
65
- * Gets the {@link Ellipsoid}.
66
- *
67
- * @type {Ellipsoid}
68
- * @readonly
69
- */
70
- get ellipsoid() {
71
- return this._ellipsoid;
72
- }
73
- /**
74
- * Projects a set of {@link Cartographic} coordinates, in radians, to map coordinates, in meters.
75
- * X and Y are the longitude and latitude, respectively, multiplied by the maximum radius of the
76
- * ellipsoid. Z is the unmodified height.
77
- *
78
- * @param {Cartographic} cartographic The coordinates to project.
79
- * @param {Cartesian3} [result] An instance into which to copy the result. If this parameter is
80
- * undefined, a new instance is created and returned.
81
- * @returns {Cartesian3} The projected coordinates. If the result parameter is not undefined, the
82
- * coordinates are copied there and that instance is returned. Otherwise, a new instance is
83
- * created and returned.
84
- */
85
- project(cartographic, result) {
86
- const semimajorAxis = this._semimajorAxis;
87
- const x = cartographic.longitude * semimajorAxis;
88
- const y = cartographic.latitude * semimajorAxis;
89
- const z = cartographic.height;
90
- if (!defined_default(result)) {
91
- return new Cartesian3_default(x, y, z);
92
- }
93
- result.x = x;
94
- result.y = y;
95
- result.z = z;
96
- return result;
97
- }
98
- /**
99
- * Unprojects a set of projected {@link Cartesian3} coordinates, in meters, to {@link Cartographic}
100
- * coordinates, in radians. Longitude and Latitude are the X and Y coordinates, respectively,
101
- * divided by the maximum radius of the ellipsoid. Height is the unmodified Z coordinate.
102
- *
103
- * @param {Cartesian3} cartesian The Cartesian position to unproject with height (z) in meters.
104
- * @param {Cartographic} [result] An instance into which to copy the result. If this parameter is
105
- * undefined, a new instance is created and returned.
106
- * @returns {Cartographic} The unprojected coordinates. If the result parameter is not undefined, the
107
- * coordinates are copied there and that instance is returned. Otherwise, a new instance is
108
- * created and returned.
109
- */
110
- unproject(cartesian, result) {
111
- if (!defined_default(cartesian)) {
112
- throw new DeveloperError_default("cartesian is required");
113
- }
114
- const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
115
- const longitude = cartesian.x * oneOverEarthSemimajorAxis;
116
- const latitude = cartesian.y * oneOverEarthSemimajorAxis;
117
- const height = cartesian.z;
118
- if (!defined_default(result)) {
119
- return new Cartographic_default(longitude, latitude, height);
120
- }
121
- result.longitude = longitude;
122
- result.latitude = latitude;
123
- result.height = height;
124
- return result;
125
- }
126
- };
127
- var GeographicProjection_default = GeographicProjection;
128
-
129
- // packages/engine/Source/Core/Interval.js
130
- function Interval(start, stop) {
131
- this.start = start ?? 0;
132
- this.stop = stop ?? 0;
133
- }
134
- var Interval_default = Interval;
135
-
136
- // packages/engine/Source/Core/BoundingSphere.js
137
- var BoundingSphere = class _BoundingSphere {
138
- /**
139
- * @param {Cartesian3} [center=Cartesian3.ZERO] The center of the bounding sphere.
140
- * @param {number} [radius=0.0] The radius of the bounding sphere.
141
- */
142
- constructor(center, radius) {
143
- this.center = Cartesian3_default.clone(center ?? Cartesian3_default.ZERO);
144
- this.radius = radius ?? 0;
145
- }
146
- /**
147
- * Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.
148
- * The bounding sphere is computed by running two algorithms, a naive algorithm and
149
- * Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.
150
- *
151
- * @param {Cartesian3[]} [positions] An array of points that the bounding sphere will enclose. Each point must have <code>x</code>, <code>y</code>, and <code>z</code> properties.
152
- * @param {BoundingSphere} [result] The object onto which to store the result.
153
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
154
- *
155
- * @see {@link http://help.agi.com/AGIComponents/html/BlogBoundingSphere.htm|Bounding Sphere computation article}
156
- */
157
- static fromPoints(positions, result) {
158
- if (!defined_default(result)) {
159
- result = new _BoundingSphere();
160
- }
161
- if (!defined_default(positions) || positions.length === 0) {
162
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
163
- result.radius = 0;
164
- return result;
165
- }
166
- const currentPos = Cartesian3_default.clone(positions[0], fromPointsCurrentPos);
167
- const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
168
- const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
169
- const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
170
- const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
171
- const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
172
- const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
173
- const numPositions = positions.length;
174
- let i;
175
- for (i = 1; i < numPositions; i++) {
176
- Cartesian3_default.clone(positions[i], currentPos);
177
- const x = currentPos.x;
178
- const y = currentPos.y;
179
- const z = currentPos.z;
180
- if (x < xMin.x) {
181
- Cartesian3_default.clone(currentPos, xMin);
182
- }
183
- if (x > xMax.x) {
184
- Cartesian3_default.clone(currentPos, xMax);
185
- }
186
- if (y < yMin.y) {
187
- Cartesian3_default.clone(currentPos, yMin);
188
- }
189
- if (y > yMax.y) {
190
- Cartesian3_default.clone(currentPos, yMax);
191
- }
192
- if (z < zMin.z) {
193
- Cartesian3_default.clone(currentPos, zMin);
194
- }
195
- if (z > zMax.z) {
196
- Cartesian3_default.clone(currentPos, zMax);
197
- }
198
- }
199
- const xSpan = Cartesian3_default.magnitudeSquared(
200
- Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
201
- );
202
- const ySpan = Cartesian3_default.magnitudeSquared(
203
- Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
204
- );
205
- const zSpan = Cartesian3_default.magnitudeSquared(
206
- Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
207
- );
208
- let diameter1 = xMin;
209
- let diameter2 = xMax;
210
- let maxSpan = xSpan;
211
- if (ySpan > maxSpan) {
212
- maxSpan = ySpan;
213
- diameter1 = yMin;
214
- diameter2 = yMax;
215
- }
216
- if (zSpan > maxSpan) {
217
- diameter1 = zMin;
218
- diameter2 = zMax;
219
- }
220
- const ritterCenter = fromPointsRitterCenter;
221
- ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
222
- ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
223
- ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
224
- let radiusSquared = Cartesian3_default.magnitudeSquared(
225
- Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
226
- );
227
- let ritterRadius = Math.sqrt(radiusSquared);
228
- const minBoxPt = fromPointsMinBoxPt;
229
- minBoxPt.x = xMin.x;
230
- minBoxPt.y = yMin.y;
231
- minBoxPt.z = zMin.z;
232
- const maxBoxPt = fromPointsMaxBoxPt;
233
- maxBoxPt.x = xMax.x;
234
- maxBoxPt.y = yMax.y;
235
- maxBoxPt.z = zMax.z;
236
- const naiveCenter = Cartesian3_default.midpoint(
237
- minBoxPt,
238
- maxBoxPt,
239
- fromPointsNaiveCenterScratch
240
- );
241
- let naiveRadius = 0;
242
- for (i = 0; i < numPositions; i++) {
243
- Cartesian3_default.clone(positions[i], currentPos);
244
- const r = Cartesian3_default.magnitude(
245
- Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
246
- );
247
- if (r > naiveRadius) {
248
- naiveRadius = r;
249
- }
250
- const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
251
- Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
252
- );
253
- if (oldCenterToPointSquared > radiusSquared) {
254
- const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
255
- ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
256
- radiusSquared = ritterRadius * ritterRadius;
257
- const oldToNew = oldCenterToPoint - ritterRadius;
258
- ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
259
- ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
260
- ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
261
- }
262
- }
263
- if (ritterRadius < naiveRadius) {
264
- Cartesian3_default.clone(ritterCenter, result.center);
265
- result.radius = ritterRadius;
266
- } else {
267
- Cartesian3_default.clone(naiveCenter, result.center);
268
- result.radius = naiveRadius;
269
- }
270
- return result;
271
- }
272
- /**
273
- * Computes a bounding sphere from a rectangle projected in 2D.
274
- *
275
- * @param {Rectangle} [rectangle] The rectangle around which to create a bounding sphere.
276
- * @param {MapProjection} [projection=GeographicProjection] The projection used to project the rectangle into 2D.
277
- * @param {BoundingSphere} [result] The object onto which to store the result.
278
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
279
- */
280
- static fromRectangle2D(rectangle, projection, result) {
281
- return _BoundingSphere.fromRectangleWithHeights2D(
282
- rectangle,
283
- projection,
284
- 0,
285
- 0,
286
- result
287
- );
288
- }
289
- /**
290
- * Computes a bounding sphere from a rectangle projected in 2D. The bounding sphere accounts for the
291
- * object's minimum and maximum heights over the rectangle.
292
- *
293
- * @param {Rectangle} [rectangle] The rectangle around which to create a bounding sphere.
294
- * @param {MapProjection} [projection=GeographicProjection] The projection used to project the rectangle into 2D.
295
- * @param {number} [minimumHeight=0.0] The minimum height over the rectangle.
296
- * @param {number} [maximumHeight=0.0] The maximum height over the rectangle.
297
- * @param {BoundingSphere} [result] The object onto which to store the result.
298
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
299
- */
300
- static fromRectangleWithHeights2D(rectangle, projection, minimumHeight, maximumHeight, result) {
301
- if (!defined_default(result)) {
302
- result = new _BoundingSphere();
303
- }
304
- if (!defined_default(rectangle)) {
305
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
306
- result.radius = 0;
307
- return result;
308
- }
309
- defaultProjection._ellipsoid = Ellipsoid_default.default;
310
- projection = projection ?? defaultProjection;
311
- Rectangle_default.southwest(rectangle, fromRectangle2DSouthwest);
312
- fromRectangle2DSouthwest.height = minimumHeight;
313
- Rectangle_default.northeast(rectangle, fromRectangle2DNortheast);
314
- fromRectangle2DNortheast.height = maximumHeight;
315
- const lowerLeft = projection.project(
316
- fromRectangle2DSouthwest,
317
- fromRectangle2DLowerLeft
318
- );
319
- const upperRight = projection.project(
320
- fromRectangle2DNortheast,
321
- fromRectangle2DUpperRight
322
- );
323
- const width = upperRight.x - lowerLeft.x;
324
- const height = upperRight.y - lowerLeft.y;
325
- const elevation = upperRight.z - lowerLeft.z;
326
- result.radius = Math.sqrt(width * width + height * height + elevation * elevation) * 0.5;
327
- const center = result.center;
328
- center.x = lowerLeft.x + width * 0.5;
329
- center.y = lowerLeft.y + height * 0.5;
330
- center.z = lowerLeft.z + elevation * 0.5;
331
- return result;
332
- }
333
- /**
334
- * Computes a bounding sphere from a rectangle in 3D. The bounding sphere is created using a subsample of points
335
- * on the ellipsoid and contained in the rectangle. It may not be accurate for all rectangles on all types of ellipsoids.
336
- *
337
- * @param {Rectangle} [rectangle] The valid rectangle used to create a bounding sphere.
338
- * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid used to determine positions of the rectangle.
339
- * @param {number} [surfaceHeight=0.0] The height above the surface of the ellipsoid.
340
- * @param {BoundingSphere} [result] The object onto which to store the result.
341
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
342
- */
343
- static fromRectangle3D(rectangle, ellipsoid, surfaceHeight, result) {
344
- ellipsoid = ellipsoid ?? Ellipsoid_default.default;
345
- surfaceHeight = surfaceHeight ?? 0;
346
- if (!defined_default(result)) {
347
- result = new _BoundingSphere();
348
- }
349
- if (!defined_default(rectangle)) {
350
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
351
- result.radius = 0;
352
- return result;
353
- }
354
- const positions = Rectangle_default.subsample(
355
- rectangle,
356
- ellipsoid,
357
- surfaceHeight,
358
- fromRectangle3DScratch
359
- );
360
- return _BoundingSphere.fromPoints(positions, result);
361
- }
362
- /**
363
- * Computes a tight-fitting bounding sphere enclosing a list of 3D points, where the points are
364
- * stored in a flat array in X, Y, Z, order. The bounding sphere is computed by running two
365
- * algorithms, a naive algorithm and Ritter's algorithm. The smaller of the two spheres is used to
366
- * ensure a tight fit.
367
- *
368
- * @param {number[]|TypedArray} [positions] An array of points that the bounding sphere will enclose. Each point
369
- * is formed from three elements in the array in the order X, Y, Z.
370
- * @param {Cartesian3} [center=Cartesian3.ZERO] The position to which the positions are relative, which need not be the
371
- * origin of the coordinate system. This is useful when the positions are to be used for
372
- * relative-to-center (RTC) rendering.
373
- * @param {number} [stride=3] The number of array elements per vertex. It must be at least 3, but it may
374
- * be higher. Regardless of the value of this parameter, the X coordinate of the first position
375
- * is at array index 0, the Y coordinate is at array index 1, and the Z coordinate is at array index
376
- * 2. When stride is 3, the X coordinate of the next position then begins at array index 3. If
377
- * the stride is 5, however, two array elements are skipped and the next position begins at array
378
- * index 5.
379
- * @param {BoundingSphere} [result] The object onto which to store the result.
380
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
381
- *
382
- * @example
383
- * // Compute the bounding sphere from 3 positions, each specified relative to a center.
384
- * // In addition to the X, Y, and Z coordinates, the points array contains two additional
385
- * // elements per point which are ignored for the purpose of computing the bounding sphere.
386
- * const center = new Cesium.Cartesian3(1.0, 2.0, 3.0);
387
- * const points = [1.0, 2.0, 3.0, 0.1, 0.2,
388
- * 4.0, 5.0, 6.0, 0.1, 0.2,
389
- * 7.0, 8.0, 9.0, 0.1, 0.2];
390
- * const sphere = Cesium.BoundingSphere.fromVertices(points, center, 5);
391
- *
392
- * @see {@link http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding/|Bounding Sphere computation article}
393
- */
394
- static fromVertices(positions, center, stride, result) {
395
- if (!defined_default(result)) {
396
- result = new _BoundingSphere();
397
- }
398
- if (!defined_default(positions) || positions.length === 0) {
399
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
400
- result.radius = 0;
401
- return result;
402
- }
403
- center = center ?? Cartesian3_default.ZERO;
404
- stride = stride ?? 3;
405
- Check_default.typeOf.number.greaterThanOrEquals("stride", stride, 3);
406
- const currentPos = fromPointsCurrentPos;
407
- currentPos.x = positions[0] + center.x;
408
- currentPos.y = positions[1] + center.y;
409
- currentPos.z = positions[2] + center.z;
410
- const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
411
- const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
412
- const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
413
- const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
414
- const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
415
- const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
416
- const numElements = positions.length;
417
- let i;
418
- for (i = 0; i < numElements; i += stride) {
419
- const x = positions[i] + center.x;
420
- const y = positions[i + 1] + center.y;
421
- const z = positions[i + 2] + center.z;
422
- currentPos.x = x;
423
- currentPos.y = y;
424
- currentPos.z = z;
425
- if (x < xMin.x) {
426
- Cartesian3_default.clone(currentPos, xMin);
427
- }
428
- if (x > xMax.x) {
429
- Cartesian3_default.clone(currentPos, xMax);
430
- }
431
- if (y < yMin.y) {
432
- Cartesian3_default.clone(currentPos, yMin);
433
- }
434
- if (y > yMax.y) {
435
- Cartesian3_default.clone(currentPos, yMax);
436
- }
437
- if (z < zMin.z) {
438
- Cartesian3_default.clone(currentPos, zMin);
439
- }
440
- if (z > zMax.z) {
441
- Cartesian3_default.clone(currentPos, zMax);
442
- }
443
- }
444
- const xSpan = Cartesian3_default.magnitudeSquared(
445
- Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
446
- );
447
- const ySpan = Cartesian3_default.magnitudeSquared(
448
- Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
449
- );
450
- const zSpan = Cartesian3_default.magnitudeSquared(
451
- Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
452
- );
453
- let diameter1 = xMin;
454
- let diameter2 = xMax;
455
- let maxSpan = xSpan;
456
- if (ySpan > maxSpan) {
457
- maxSpan = ySpan;
458
- diameter1 = yMin;
459
- diameter2 = yMax;
460
- }
461
- if (zSpan > maxSpan) {
462
- diameter1 = zMin;
463
- diameter2 = zMax;
464
- }
465
- const ritterCenter = fromPointsRitterCenter;
466
- ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
467
- ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
468
- ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
469
- let radiusSquared = Cartesian3_default.magnitudeSquared(
470
- Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
471
- );
472
- let ritterRadius = Math.sqrt(radiusSquared);
473
- const minBoxPt = fromPointsMinBoxPt;
474
- minBoxPt.x = xMin.x;
475
- minBoxPt.y = yMin.y;
476
- minBoxPt.z = zMin.z;
477
- const maxBoxPt = fromPointsMaxBoxPt;
478
- maxBoxPt.x = xMax.x;
479
- maxBoxPt.y = yMax.y;
480
- maxBoxPt.z = zMax.z;
481
- const naiveCenter = Cartesian3_default.midpoint(
482
- minBoxPt,
483
- maxBoxPt,
484
- fromPointsNaiveCenterScratch
485
- );
486
- let naiveRadius = 0;
487
- for (i = 0; i < numElements; i += stride) {
488
- currentPos.x = positions[i] + center.x;
489
- currentPos.y = positions[i + 1] + center.y;
490
- currentPos.z = positions[i + 2] + center.z;
491
- const r = Cartesian3_default.magnitude(
492
- Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
493
- );
494
- if (r > naiveRadius) {
495
- naiveRadius = r;
496
- }
497
- const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
498
- Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
499
- );
500
- if (oldCenterToPointSquared > radiusSquared) {
501
- const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
502
- ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
503
- radiusSquared = ritterRadius * ritterRadius;
504
- const oldToNew = oldCenterToPoint - ritterRadius;
505
- ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
506
- ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
507
- ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
508
- }
509
- }
510
- if (ritterRadius < naiveRadius) {
511
- Cartesian3_default.clone(ritterCenter, result.center);
512
- result.radius = ritterRadius;
513
- } else {
514
- Cartesian3_default.clone(naiveCenter, result.center);
515
- result.radius = naiveRadius;
516
- }
517
- return result;
518
- }
519
- /**
520
- * Computes a tight-fitting bounding sphere enclosing a list of EncodedCartesian3s, where the points are
521
- * stored in parallel flat arrays in X, Y, Z, order. The bounding sphere is computed by running two
522
- * algorithms, a naive algorithm and Ritter's algorithm. The smaller of the two spheres is used to
523
- * ensure a tight fit.
524
- *
525
- * @param {number[]} [positionsHigh] An array of high bits of the encoded cartesians that the bounding sphere will enclose. Each point
526
- * is formed from three elements in the array in the order X, Y, Z.
527
- * @param {number[]} [positionsLow] An array of low bits of the encoded cartesians that the bounding sphere will enclose. Each point
528
- * is formed from three elements in the array in the order X, Y, Z.
529
- * @param {BoundingSphere} [result] The object onto which to store the result.
530
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
531
- *
532
- * @see {@link http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding/|Bounding Sphere computation article}
533
- */
534
- static fromEncodedCartesianVertices(positionsHigh, positionsLow, result) {
535
- if (!defined_default(result)) {
536
- result = new _BoundingSphere();
537
- }
538
- if (!defined_default(positionsHigh) || !defined_default(positionsLow) || positionsHigh.length !== positionsLow.length || positionsHigh.length === 0) {
539
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
540
- result.radius = 0;
541
- return result;
542
- }
543
- const currentPos = fromPointsCurrentPos;
544
- currentPos.x = positionsHigh[0] + positionsLow[0];
545
- currentPos.y = positionsHigh[1] + positionsLow[1];
546
- currentPos.z = positionsHigh[2] + positionsLow[2];
547
- const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
548
- const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
549
- const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
550
- const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
551
- const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
552
- const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
553
- const numElements = positionsHigh.length;
554
- let i;
555
- for (i = 0; i < numElements; i += 3) {
556
- const x = positionsHigh[i] + positionsLow[i];
557
- const y = positionsHigh[i + 1] + positionsLow[i + 1];
558
- const z = positionsHigh[i + 2] + positionsLow[i + 2];
559
- currentPos.x = x;
560
- currentPos.y = y;
561
- currentPos.z = z;
562
- if (x < xMin.x) {
563
- Cartesian3_default.clone(currentPos, xMin);
564
- }
565
- if (x > xMax.x) {
566
- Cartesian3_default.clone(currentPos, xMax);
567
- }
568
- if (y < yMin.y) {
569
- Cartesian3_default.clone(currentPos, yMin);
570
- }
571
- if (y > yMax.y) {
572
- Cartesian3_default.clone(currentPos, yMax);
573
- }
574
- if (z < zMin.z) {
575
- Cartesian3_default.clone(currentPos, zMin);
576
- }
577
- if (z > zMax.z) {
578
- Cartesian3_default.clone(currentPos, zMax);
579
- }
580
- }
581
- const xSpan = Cartesian3_default.magnitudeSquared(
582
- Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
583
- );
584
- const ySpan = Cartesian3_default.magnitudeSquared(
585
- Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
586
- );
587
- const zSpan = Cartesian3_default.magnitudeSquared(
588
- Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
589
- );
590
- let diameter1 = xMin;
591
- let diameter2 = xMax;
592
- let maxSpan = xSpan;
593
- if (ySpan > maxSpan) {
594
- maxSpan = ySpan;
595
- diameter1 = yMin;
596
- diameter2 = yMax;
597
- }
598
- if (zSpan > maxSpan) {
599
- diameter1 = zMin;
600
- diameter2 = zMax;
601
- }
602
- const ritterCenter = fromPointsRitterCenter;
603
- ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
604
- ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
605
- ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
606
- let radiusSquared = Cartesian3_default.magnitudeSquared(
607
- Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
608
- );
609
- let ritterRadius = Math.sqrt(radiusSquared);
610
- const minBoxPt = fromPointsMinBoxPt;
611
- minBoxPt.x = xMin.x;
612
- minBoxPt.y = yMin.y;
613
- minBoxPt.z = zMin.z;
614
- const maxBoxPt = fromPointsMaxBoxPt;
615
- maxBoxPt.x = xMax.x;
616
- maxBoxPt.y = yMax.y;
617
- maxBoxPt.z = zMax.z;
618
- const naiveCenter = Cartesian3_default.midpoint(
619
- minBoxPt,
620
- maxBoxPt,
621
- fromPointsNaiveCenterScratch
622
- );
623
- let naiveRadius = 0;
624
- for (i = 0; i < numElements; i += 3) {
625
- currentPos.x = positionsHigh[i] + positionsLow[i];
626
- currentPos.y = positionsHigh[i + 1] + positionsLow[i + 1];
627
- currentPos.z = positionsHigh[i + 2] + positionsLow[i + 2];
628
- const r = Cartesian3_default.magnitude(
629
- Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
630
- );
631
- if (r > naiveRadius) {
632
- naiveRadius = r;
633
- }
634
- const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
635
- Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
636
- );
637
- if (oldCenterToPointSquared > radiusSquared) {
638
- const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
639
- ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
640
- radiusSquared = ritterRadius * ritterRadius;
641
- const oldToNew = oldCenterToPoint - ritterRadius;
642
- ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
643
- ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
644
- ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
645
- }
646
- }
647
- if (ritterRadius < naiveRadius) {
648
- Cartesian3_default.clone(ritterCenter, result.center);
649
- result.radius = ritterRadius;
650
- } else {
651
- Cartesian3_default.clone(naiveCenter, result.center);
652
- result.radius = naiveRadius;
653
- }
654
- return result;
655
- }
656
- /**
657
- * Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere
658
- * tightly and fully encompasses the box.
659
- *
660
- * @param {Cartesian3} [corner] The minimum height over the rectangle.
661
- * @param {Cartesian3} [oppositeCorner] The maximum height over the rectangle.
662
- * @param {BoundingSphere} [result] The object onto which to store the result.
663
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
664
- *
665
- * @example
666
- * // Create a bounding sphere around the unit cube
667
- * const sphere = Cesium.BoundingSphere.fromCornerPoints(new Cesium.Cartesian3(-0.5, -0.5, -0.5), new Cesium.Cartesian3(0.5, 0.5, 0.5));
668
- */
669
- static fromCornerPoints(corner, oppositeCorner, result) {
670
- Check_default.typeOf.object("corner", corner);
671
- Check_default.typeOf.object("oppositeCorner", oppositeCorner);
672
- if (!defined_default(result)) {
673
- result = new _BoundingSphere();
674
- }
675
- const center = Cartesian3_default.midpoint(corner, oppositeCorner, result.center);
676
- result.radius = Cartesian3_default.distance(center, oppositeCorner);
677
- return result;
678
- }
679
- /**
680
- * Creates a bounding sphere encompassing an ellipsoid.
681
- *
682
- * @param {Ellipsoid} ellipsoid The ellipsoid around which to create a bounding sphere.
683
- * @param {BoundingSphere} [result] The object onto which to store the result.
684
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
685
- *
686
- * @example
687
- * const boundingSphere = Cesium.BoundingSphere.fromEllipsoid(ellipsoid);
688
- */
689
- static fromEllipsoid(ellipsoid, result) {
690
- Check_default.typeOf.object("ellipsoid", ellipsoid);
691
- if (!defined_default(result)) {
692
- result = new _BoundingSphere();
693
- }
694
- Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
695
- result.radius = ellipsoid.maximumRadius;
696
- return result;
697
- }
698
- /**
699
- * Computes a tight-fitting bounding sphere enclosing the provided array of bounding spheres.
700
- *
701
- * @param {BoundingSphere[]} [boundingSpheres] The array of bounding spheres.
702
- * @param {BoundingSphere} [result] The object onto which to store the result.
703
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
704
- */
705
- static fromBoundingSpheres(boundingSpheres, result) {
706
- if (!defined_default(result)) {
707
- result = new _BoundingSphere();
708
- }
709
- if (!defined_default(boundingSpheres) || boundingSpheres.length === 0) {
710
- result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
711
- result.radius = 0;
712
- return result;
713
- }
714
- const length = boundingSpheres.length;
715
- if (length === 1) {
716
- return _BoundingSphere.clone(boundingSpheres[0], result);
717
- }
718
- if (length === 2) {
719
- return _BoundingSphere.union(
720
- boundingSpheres[0],
721
- boundingSpheres[1],
722
- result
723
- );
724
- }
725
- const positions = [];
726
- let i;
727
- for (i = 0; i < length; i++) {
728
- positions.push(boundingSpheres[i].center);
729
- }
730
- result = _BoundingSphere.fromPoints(positions, result);
731
- const center = result.center;
732
- let radius = result.radius;
733
- for (i = 0; i < length; i++) {
734
- const tmp = boundingSpheres[i];
735
- radius = Math.max(
736
- radius,
737
- Cartesian3_default.distance(center, tmp.center) + tmp.radius
738
- );
739
- }
740
- result.radius = radius;
741
- return result;
742
- }
743
- /**
744
- * Computes a tight-fitting bounding sphere enclosing the provided oriented bounding box.
745
- *
746
- * @param {OrientedBoundingBox} orientedBoundingBox The oriented bounding box.
747
- * @param {BoundingSphere} [result] The object onto which to store the result.
748
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
749
- */
750
- static fromOrientedBoundingBox(orientedBoundingBox, result) {
751
- Check_default.defined("orientedBoundingBox", orientedBoundingBox);
752
- if (!defined_default(result)) {
753
- result = new _BoundingSphere();
754
- }
755
- const halfAxes = orientedBoundingBox.halfAxes;
756
- const u = Matrix3_default.getColumn(halfAxes, 0, fromOrientedBoundingBoxScratchU);
757
- const v = Matrix3_default.getColumn(halfAxes, 1, fromOrientedBoundingBoxScratchV);
758
- const w = Matrix3_default.getColumn(halfAxes, 2, fromOrientedBoundingBoxScratchW);
759
- Cartesian3_default.add(u, v, u);
760
- Cartesian3_default.add(u, w, u);
761
- result.center = Cartesian3_default.clone(orientedBoundingBox.center, result.center);
762
- result.radius = Cartesian3_default.magnitude(u);
763
- return result;
764
- }
765
- /**
766
- * Computes a tight-fitting bounding sphere enclosing the provided affine transformation.
767
- *
768
- * @param {Matrix4} transformation The affine transformation.
769
- * @param {BoundingSphere} [result] The object onto which to store the result.
770
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
771
- */
772
- static fromTransformation(transformation, result) {
773
- Check_default.typeOf.object("transformation", transformation);
774
- if (!defined_default(result)) {
775
- result = new _BoundingSphere();
776
- }
777
- const center = Matrix4_default.getTranslation(
778
- transformation,
779
- scratchFromTransformationCenter
780
- );
781
- const scale = Matrix4_default.getScale(
782
- transformation,
783
- scratchFromTransformationScale
784
- );
785
- const radius = 0.5 * Cartesian3_default.magnitude(scale);
786
- result.center = Cartesian3_default.clone(center, result.center);
787
- result.radius = radius;
788
- return result;
789
- }
790
- /**
791
- * Duplicates a BoundingSphere instance.
792
- *
793
- * @param {BoundingSphere} sphere The bounding sphere to duplicate.
794
- * @param {BoundingSphere} [result] The object onto which to store the result.
795
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. (Returns undefined if sphere is undefined)
796
- */
797
- static clone(sphere, result) {
798
- if (!defined_default(sphere)) {
799
- return void 0;
800
- }
801
- if (!defined_default(result)) {
802
- return new _BoundingSphere(sphere.center, sphere.radius);
803
- }
804
- result.center = Cartesian3_default.clone(sphere.center, result.center);
805
- result.radius = sphere.radius;
806
- return result;
807
- }
808
- /**
809
- * Stores the provided instance into the provided array.
810
- *
811
- * @param {BoundingSphere} value The value to pack.
812
- * @param {number[]} array The array to pack into.
813
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
814
- *
815
- * @returns {number[]} The array that was packed into
816
- */
817
- static pack(value, array, startingIndex) {
818
- Check_default.typeOf.object("value", value);
819
- Check_default.defined("array", array);
820
- startingIndex = startingIndex ?? 0;
821
- const center = value.center;
822
- array[startingIndex++] = center.x;
823
- array[startingIndex++] = center.y;
824
- array[startingIndex++] = center.z;
825
- array[startingIndex] = value.radius;
826
- return array;
827
- }
828
- /**
829
- * Retrieves an instance from a packed array.
830
- *
831
- * @param {number[]} array The packed array.
832
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
833
- * @param {BoundingSphere} [result] The object into which to store the result.
834
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
835
- */
836
- static unpack(array, startingIndex, result) {
837
- Check_default.defined("array", array);
838
- startingIndex = startingIndex ?? 0;
839
- if (!defined_default(result)) {
840
- result = new _BoundingSphere();
841
- }
842
- const center = result.center;
843
- center.x = array[startingIndex++];
844
- center.y = array[startingIndex++];
845
- center.z = array[startingIndex++];
846
- result.radius = array[startingIndex];
847
- return result;
848
- }
849
- /**
850
- * Computes a bounding sphere that contains both the left and right bounding spheres.
851
- *
852
- * @param {BoundingSphere} left A sphere to enclose in a bounding sphere.
853
- * @param {BoundingSphere} right A sphere to enclose in a bounding sphere.
854
- * @param {BoundingSphere} [result] The object onto which to store the result.
855
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
856
- */
857
- static union(left, right, result) {
858
- Check_default.typeOf.object("left", left);
859
- Check_default.typeOf.object("right", right);
860
- if (!defined_default(result)) {
861
- result = new _BoundingSphere();
862
- }
863
- const leftCenter = left.center;
864
- const leftRadius = left.radius;
865
- const rightCenter = right.center;
866
- const rightRadius = right.radius;
867
- const toRightCenter = Cartesian3_default.subtract(
868
- rightCenter,
869
- leftCenter,
870
- unionScratch
871
- );
872
- const centerSeparation = Cartesian3_default.magnitude(toRightCenter);
873
- if (leftRadius >= centerSeparation + rightRadius) {
874
- left.clone(result);
875
- return result;
876
- }
877
- if (rightRadius >= centerSeparation + leftRadius) {
878
- right.clone(result);
879
- return result;
880
- }
881
- const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
882
- const center = Cartesian3_default.multiplyByScalar(
883
- toRightCenter,
884
- (-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation,
885
- unionScratchCenter
886
- );
887
- Cartesian3_default.add(center, leftCenter, center);
888
- Cartesian3_default.clone(center, result.center);
889
- result.radius = halfDistanceBetweenTangentPoints;
890
- return result;
891
- }
892
- /**
893
- * Computes a bounding sphere by enlarging the provided sphere to contain the provided point.
894
- *
895
- * @param {BoundingSphere} sphere A sphere to expand.
896
- * @param {Cartesian3} point A point to enclose in a bounding sphere.
897
- * @param {BoundingSphere} [result] The object onto which to store the result.
898
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
899
- */
900
- static expand(sphere, point, result) {
901
- Check_default.typeOf.object("sphere", sphere);
902
- Check_default.typeOf.object("point", point);
903
- result = _BoundingSphere.clone(sphere, result);
904
- const radius = Cartesian3_default.magnitude(
905
- Cartesian3_default.subtract(point, result.center, expandScratch)
906
- );
907
- if (radius > result.radius) {
908
- result.radius = radius;
909
- }
910
- return result;
911
- }
912
- /**
913
- * Determines which side of a plane a sphere is located.
914
- *
915
- * @param {BoundingSphere} sphere The bounding sphere to test.
916
- * @param {Plane} plane The plane to test against.
917
- * @returns {Intersect} {@link Intersect.INSIDE} if the entire sphere is on the side of the plane
918
- * the normal is pointing, {@link Intersect.OUTSIDE} if the entire sphere is
919
- * on the opposite side, and {@link Intersect.INTERSECTING} if the sphere
920
- * intersects the plane.
921
- */
922
- static intersectPlane(sphere, plane) {
923
- Check_default.typeOf.object("sphere", sphere);
924
- Check_default.typeOf.object("plane", plane);
925
- const center = sphere.center;
926
- const radius = sphere.radius;
927
- const normal = plane.normal;
928
- const distanceToPlane = Cartesian3_default.dot(normal, center) + plane.distance;
929
- if (distanceToPlane < -radius) {
930
- return Intersect_default.OUTSIDE;
931
- } else if (distanceToPlane < radius) {
932
- return Intersect_default.INTERSECTING;
933
- }
934
- return Intersect_default.INSIDE;
935
- }
936
- /**
937
- * Applies a 4x4 affine transformation matrix to a bounding sphere.
938
- *
939
- * @param {BoundingSphere} sphere The bounding sphere to apply the transformation to.
940
- * @param {Matrix4} transform The transformation matrix to apply to the bounding sphere.
941
- * @param {BoundingSphere} [result] The object onto which to store the result.
942
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
943
- */
944
- static transform(sphere, transform, result) {
945
- Check_default.typeOf.object("sphere", sphere);
946
- Check_default.typeOf.object("transform", transform);
947
- if (!defined_default(result)) {
948
- result = new _BoundingSphere();
949
- }
950
- result.center = Matrix4_default.multiplyByPoint(
951
- transform,
952
- sphere.center,
953
- result.center
954
- );
955
- result.radius = Matrix4_default.getMaximumScale(transform) * sphere.radius;
956
- return result;
957
- }
958
- /**
959
- * Computes the estimated distance squared from the closest point on a bounding sphere to a point.
960
- *
961
- * @param {BoundingSphere} sphere The sphere.
962
- * @param {Cartesian3} cartesian The point
963
- * @returns {number} The distance squared from the bounding sphere to the point. Returns 0 if the point is inside the sphere.
964
- *
965
- * @example
966
- * // Sort bounding spheres from back to front
967
- * spheres.sort(function(a, b) {
968
- * return Cesium.BoundingSphere.distanceSquaredTo(b, camera.positionWC) - Cesium.BoundingSphere.distanceSquaredTo(a, camera.positionWC);
969
- * });
970
- */
971
- static distanceSquaredTo(sphere, cartesian) {
972
- Check_default.typeOf.object("sphere", sphere);
973
- Check_default.typeOf.object("cartesian", cartesian);
974
- const diff = Cartesian3_default.subtract(
975
- sphere.center,
976
- cartesian,
977
- distanceSquaredToScratch
978
- );
979
- const distance = Cartesian3_default.magnitude(diff) - sphere.radius;
980
- if (distance <= 0) {
981
- return 0;
982
- }
983
- return distance * distance;
984
- }
985
- /**
986
- * Applies a 4x4 affine transformation matrix to a bounding sphere where there is no scale
987
- * The transformation matrix is not verified to have a uniform scale of 1.
988
- * This method is faster than computing the general bounding sphere transform using {@link BoundingSphere.transform}.
989
- *
990
- * @param {BoundingSphere} sphere The bounding sphere to apply the transformation to.
991
- * @param {Matrix4} transform The transformation matrix to apply to the bounding sphere.
992
- * @param {BoundingSphere} [result] The object onto which to store the result.
993
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
994
- *
995
- * @example
996
- * const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid);
997
- * const boundingSphere = new Cesium.BoundingSphere();
998
- * const newBoundingSphere = Cesium.BoundingSphere.transformWithoutScale(boundingSphere, modelMatrix);
999
- */
1000
- static transformWithoutScale(sphere, transform, result) {
1001
- Check_default.typeOf.object("sphere", sphere);
1002
- Check_default.typeOf.object("transform", transform);
1003
- if (!defined_default(result)) {
1004
- result = new _BoundingSphere();
1005
- }
1006
- result.center = Matrix4_default.multiplyByPoint(
1007
- transform,
1008
- sphere.center,
1009
- result.center
1010
- );
1011
- result.radius = sphere.radius;
1012
- return result;
1013
- }
1014
- /**
1015
- * The distances calculated by the vector from the center of the bounding sphere to position projected onto direction
1016
- * plus/minus the radius of the bounding sphere.
1017
- * <br>
1018
- * If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
1019
- * closest and farthest planes from position that intersect the bounding sphere.
1020
- *
1021
- * @param {BoundingSphere} sphere The bounding sphere to calculate the distance to.
1022
- * @param {Cartesian3} position The position to calculate the distance from.
1023
- * @param {Cartesian3} direction The direction from position.
1024
- * @param {Interval} [result] A Interval to store the nearest and farthest distances.
1025
- * @returns {Interval} The nearest and farthest distances on the bounding sphere from position in direction.
1026
- */
1027
- static computePlaneDistances(sphere, position, direction, result) {
1028
- Check_default.typeOf.object("sphere", sphere);
1029
- Check_default.typeOf.object("position", position);
1030
- Check_default.typeOf.object("direction", direction);
1031
- if (!defined_default(result)) {
1032
- result = new Interval_default();
1033
- }
1034
- const toCenter = Cartesian3_default.subtract(
1035
- sphere.center,
1036
- position,
1037
- scratchCartesian3
1038
- );
1039
- const mag = Cartesian3_default.dot(direction, toCenter);
1040
- result.start = mag - sphere.radius;
1041
- result.stop = mag + sphere.radius;
1042
- return result;
1043
- }
1044
- /**
1045
- * Creates a bounding sphere in 2D from a bounding sphere in 3D world coordinates.
1046
- *
1047
- * @param {BoundingSphere} sphere The bounding sphere to transform to 2D.
1048
- * @param {MapProjection} [projection=GeographicProjection] The projection to 2D.
1049
- * @param {BoundingSphere} [result] The object onto which to store the result.
1050
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
1051
- */
1052
- static projectTo2D(sphere, projection, result) {
1053
- Check_default.typeOf.object("sphere", sphere);
1054
- projectTo2DProjection._ellipsoid = Ellipsoid_default.default;
1055
- projection = projection ?? projectTo2DProjection;
1056
- const ellipsoid = projection.ellipsoid;
1057
- let center = sphere.center;
1058
- const radius = sphere.radius;
1059
- let normal;
1060
- if (Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
1061
- normal = Cartesian3_default.clone(Cartesian3_default.UNIT_X, projectTo2DNormalScratch);
1062
- } else {
1063
- normal = ellipsoid.geodeticSurfaceNormal(
1064
- center,
1065
- projectTo2DNormalScratch
1066
- );
1067
- }
1068
- const east = Cartesian3_default.cross(
1069
- Cartesian3_default.UNIT_Z,
1070
- normal,
1071
- projectTo2DEastScratch
1072
- );
1073
- Cartesian3_default.normalize(east, east);
1074
- const north = Cartesian3_default.cross(normal, east, projectTo2DNorthScratch);
1075
- Cartesian3_default.normalize(north, north);
1076
- Cartesian3_default.multiplyByScalar(normal, radius, normal);
1077
- Cartesian3_default.multiplyByScalar(north, radius, north);
1078
- Cartesian3_default.multiplyByScalar(east, radius, east);
1079
- const south = Cartesian3_default.negate(north, projectTo2DSouthScratch);
1080
- const west = Cartesian3_default.negate(east, projectTo2DWestScratch);
1081
- const positions = projectTo2DPositionsScratch;
1082
- let corner = positions[0];
1083
- Cartesian3_default.add(normal, north, corner);
1084
- Cartesian3_default.add(corner, east, corner);
1085
- corner = positions[1];
1086
- Cartesian3_default.add(normal, north, corner);
1087
- Cartesian3_default.add(corner, west, corner);
1088
- corner = positions[2];
1089
- Cartesian3_default.add(normal, south, corner);
1090
- Cartesian3_default.add(corner, west, corner);
1091
- corner = positions[3];
1092
- Cartesian3_default.add(normal, south, corner);
1093
- Cartesian3_default.add(corner, east, corner);
1094
- Cartesian3_default.negate(normal, normal);
1095
- corner = positions[4];
1096
- Cartesian3_default.add(normal, north, corner);
1097
- Cartesian3_default.add(corner, east, corner);
1098
- corner = positions[5];
1099
- Cartesian3_default.add(normal, north, corner);
1100
- Cartesian3_default.add(corner, west, corner);
1101
- corner = positions[6];
1102
- Cartesian3_default.add(normal, south, corner);
1103
- Cartesian3_default.add(corner, west, corner);
1104
- corner = positions[7];
1105
- Cartesian3_default.add(normal, south, corner);
1106
- Cartesian3_default.add(corner, east, corner);
1107
- const length = positions.length;
1108
- for (let i = 0; i < length; ++i) {
1109
- const position = positions[i];
1110
- Cartesian3_default.add(center, position, position);
1111
- const cartographic = ellipsoid.cartesianToCartographic(
1112
- position,
1113
- projectTo2DCartographicScratch
1114
- );
1115
- projection.project(cartographic, position);
1116
- }
1117
- result = _BoundingSphere.fromPoints(positions, result);
1118
- center = result.center;
1119
- const x = center.x;
1120
- const y = center.y;
1121
- const z = center.z;
1122
- center.x = z;
1123
- center.y = x;
1124
- center.z = y;
1125
- return result;
1126
- }
1127
- /**
1128
- * Determines whether or not a sphere is hidden from view by the occluder.
1129
- *
1130
- * @param {BoundingSphere} sphere The bounding sphere surrounding the occluded object.
1131
- * @param {Occluder} occluder The occluder.
1132
- * @returns {boolean} <code>true</code> if the sphere is not visible; otherwise <code>false</code>.
1133
- */
1134
- static isOccluded(sphere, occluder) {
1135
- Check_default.typeOf.object("sphere", sphere);
1136
- Check_default.typeOf.object("occluder", occluder);
1137
- return !occluder.isBoundingSphereVisible(sphere);
1138
- }
1139
- /**
1140
- * Compares the provided BoundingSphere componentwise and returns
1141
- * <code>true</code> if they are equal, <code>false</code> otherwise.
1142
- *
1143
- * @param {BoundingSphere} [left] The first BoundingSphere.
1144
- * @param {BoundingSphere} [right] The second BoundingSphere.
1145
- * @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
1146
- */
1147
- static equals(left, right) {
1148
- return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && left.radius === right.radius;
1149
- }
1150
- /**
1151
- * Determines which side of a plane the sphere is located.
1152
- *
1153
- * @param {Plane} plane The plane to test against.
1154
- * @returns {Intersect} {@link Intersect.INSIDE} if the entire sphere is on the side of the plane
1155
- * the normal is pointing, {@link Intersect.OUTSIDE} if the entire sphere is
1156
- * on the opposite side, and {@link Intersect.INTERSECTING} if the sphere
1157
- * intersects the plane.
1158
- */
1159
- intersectPlane(plane) {
1160
- return _BoundingSphere.intersectPlane(this, plane);
1161
- }
1162
- /**
1163
- * Computes the estimated distance squared from the closest point on a bounding sphere to a point.
1164
- *
1165
- * @param {Cartesian3} cartesian The point
1166
- * @returns {number} The estimated distance squared from the bounding sphere to the point.
1167
- *
1168
- * @example
1169
- * // Sort bounding spheres from back to front
1170
- * spheres.sort(function(a, b) {
1171
- * return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
1172
- * });
1173
- */
1174
- distanceSquaredTo(cartesian) {
1175
- return _BoundingSphere.distanceSquaredTo(this, cartesian);
1176
- }
1177
- /**
1178
- * The distances calculated by the vector from the center of the bounding sphere to position projected onto direction
1179
- * plus/minus the radius of the bounding sphere.
1180
- * <br>
1181
- * If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
1182
- * closest and farthest planes from position that intersect the bounding sphere.
1183
- *
1184
- * @param {Cartesian3} position The position to calculate the distance from.
1185
- * @param {Cartesian3} direction The direction from position.
1186
- * @param {Interval} [result] A Interval to store the nearest and farthest distances.
1187
- * @returns {Interval} The nearest and farthest distances on the bounding sphere from position in direction.
1188
- */
1189
- computePlaneDistances(position, direction, result) {
1190
- return _BoundingSphere.computePlaneDistances(
1191
- this,
1192
- position,
1193
- direction,
1194
- result
1195
- );
1196
- }
1197
- /**
1198
- * Determines whether or not a sphere is hidden from view by the occluder.
1199
- *
1200
- * @param {Occluder} occluder The occluder.
1201
- * @returns {boolean} <code>true</code> if the sphere is not visible; otherwise <code>false</code>.
1202
- */
1203
- isOccluded(occluder) {
1204
- return _BoundingSphere.isOccluded(this, occluder);
1205
- }
1206
- /**
1207
- * Compares this BoundingSphere against the provided BoundingSphere componentwise and returns
1208
- * <code>true</code> if they are equal, <code>false</code> otherwise.
1209
- *
1210
- * @param {BoundingSphere} [right] The right hand side BoundingSphere.
1211
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
1212
- */
1213
- equals(right) {
1214
- return _BoundingSphere.equals(this, right);
1215
- }
1216
- /**
1217
- * Duplicates this BoundingSphere instance.
1218
- *
1219
- * @param {BoundingSphere} [result] The object onto which to store the result.
1220
- * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
1221
- */
1222
- clone(result) {
1223
- return _BoundingSphere.clone(this, result);
1224
- }
1225
- /**
1226
- * Computes the radius of the BoundingSphere.
1227
- * @returns {number} The radius of the BoundingSphere.
1228
- */
1229
- volume() {
1230
- const radius = this.radius;
1231
- return volumeConstant * radius * radius * radius;
1232
- }
1233
- };
1234
- BoundingSphere.packedLength = 4;
1235
- var fromPointsXMin = new Cartesian3_default();
1236
- var fromPointsYMin = new Cartesian3_default();
1237
- var fromPointsZMin = new Cartesian3_default();
1238
- var fromPointsXMax = new Cartesian3_default();
1239
- var fromPointsYMax = new Cartesian3_default();
1240
- var fromPointsZMax = new Cartesian3_default();
1241
- var fromPointsCurrentPos = new Cartesian3_default();
1242
- var fromPointsScratch = new Cartesian3_default();
1243
- var fromPointsRitterCenter = new Cartesian3_default();
1244
- var fromPointsMinBoxPt = new Cartesian3_default();
1245
- var fromPointsMaxBoxPt = new Cartesian3_default();
1246
- var fromPointsNaiveCenterScratch = new Cartesian3_default();
1247
- var volumeConstant = 4 / 3 * Math_default.PI;
1248
- var defaultProjection = new GeographicProjection_default();
1249
- var fromRectangle2DLowerLeft = new Cartesian3_default();
1250
- var fromRectangle2DUpperRight = new Cartesian3_default();
1251
- var fromRectangle2DSouthwest = new Cartographic_default();
1252
- var fromRectangle2DNortheast = new Cartographic_default();
1253
- var fromRectangle3DScratch = (
1254
- /** @type {Cartesian3[]} */
1255
- []
1256
- );
1257
- var fromOrientedBoundingBoxScratchU = new Cartesian3_default();
1258
- var fromOrientedBoundingBoxScratchV = new Cartesian3_default();
1259
- var fromOrientedBoundingBoxScratchW = new Cartesian3_default();
1260
- var scratchFromTransformationCenter = new Cartesian3_default();
1261
- var scratchFromTransformationScale = new Cartesian3_default();
1262
- var unionScratch = new Cartesian3_default();
1263
- var unionScratchCenter = new Cartesian3_default();
1264
- var expandScratch = new Cartesian3_default();
1265
- var distanceSquaredToScratch = new Cartesian3_default();
1266
- var scratchCartesian3 = new Cartesian3_default();
1267
- var projectTo2DNormalScratch = new Cartesian3_default();
1268
- var projectTo2DEastScratch = new Cartesian3_default();
1269
- var projectTo2DNorthScratch = new Cartesian3_default();
1270
- var projectTo2DWestScratch = new Cartesian3_default();
1271
- var projectTo2DSouthScratch = new Cartesian3_default();
1272
- var projectTo2DCartographicScratch = new Cartographic_default();
1273
- var projectTo2DPositionsScratch = new Array(8);
1274
- for (let n = 0; n < 8; ++n) {
1275
- projectTo2DPositionsScratch[n] = new Cartesian3_default();
1276
- }
1277
- var projectTo2DProjection = new GeographicProjection_default();
1278
- var BoundingSphere_default = BoundingSphere;
1279
-
1280
- export {
1281
- GeographicProjection_default,
1282
- Interval_default,
1283
- BoundingSphere_default
1284
- };