@cesium/engine 23.0.1 → 25.0.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 (398) hide show
  1. package/Build/Workers/{chunk-ZEMJQKHD.js → chunk-35H3UBIO.js} +13 -12
  2. package/Build/Workers/{chunk-PQTSXJBJ.js → chunk-3LSD7OOA.js} +16 -16
  3. package/Build/Workers/{chunk-PUO7BYDY.js → chunk-3RFFPH4M.js} +1 -1
  4. package/Build/Workers/{chunk-PBECJOWF.js → chunk-3TKLDHV3.js} +2 -2
  5. package/Build/Workers/{chunk-TMCTZ5E3.js → chunk-3VDDRF2E.js} +14 -14
  6. package/Build/Workers/{chunk-FKU77FNM.js → chunk-3XY3MVPG.js} +4 -4
  7. package/Build/Workers/{chunk-2OBWHTIC.js → chunk-4GF4MVPY.js} +7 -7
  8. package/Build/Workers/{chunk-JUKGMJX7.js → chunk-4MTRQFJP.js} +3 -2
  9. package/Build/Workers/{chunk-66OWUDO7.js → chunk-4QQXGTCE.js} +8 -8
  10. package/Build/Workers/{chunk-ALTCIHRH.js → chunk-4XXHJI6Y.js} +17 -17
  11. package/Build/Workers/{chunk-K7UTK4OM.js → chunk-5T6QQAJW.js} +3 -2
  12. package/Build/Workers/{chunk-IJ3SUMK3.js → chunk-6SDGQI27.js} +3 -2
  13. package/Build/Workers/{chunk-FXSRA5UG.js → chunk-77RL3MBD.js} +6 -5
  14. package/Build/Workers/{chunk-G6MJ3ZW3.js → chunk-7LSFAEWF.js} +12 -11
  15. package/Build/Workers/{chunk-C6HHBKT5.js → chunk-A7A433MD.js} +5 -5
  16. package/Build/Workers/{chunk-PGZ3B6CB.js → chunk-A7ZBMVFS.js} +14 -14
  17. package/Build/Workers/{chunk-OZYB3AOR.js → chunk-ACFFCHHZ.js} +11 -11
  18. package/Build/Workers/{chunk-DNMASBMH.js → chunk-AEAVLYPS.js} +2 -2
  19. package/Build/Workers/{chunk-VPWYHFQA.js → chunk-AWFZHD2B.js} +4 -4
  20. package/Build/Workers/{chunk-TFPG3ZKW.js → chunk-BTX2NL3P.js} +59 -46
  21. package/Build/Workers/{chunk-TNXOPEIG.js → chunk-BVAIWR7O.js} +12 -12
  22. package/Build/Workers/chunk-CKQP3DSS.js +973 -0
  23. package/Build/Workers/{chunk-N6HRZLS6.js → chunk-CZ23Y3RM.js} +2 -2
  24. package/Build/Workers/{chunk-EIC3VAOZ.js → chunk-DFEI5MAV.js} +7 -7
  25. package/Build/Workers/{chunk-BTP3634E.js → chunk-DH26SNAB.js} +4 -1
  26. package/Build/Workers/{chunk-TXYQNXNW.js → chunk-DYT5NR6P.js} +3 -3
  27. package/Build/Workers/{chunk-O67UP5YO.js → chunk-EZARA5FJ.js} +13 -13
  28. package/Build/Workers/{chunk-YSJRB2UZ.js → chunk-FIBS5S7R.js} +2 -2
  29. package/Build/Workers/{chunk-2M7DKGLW.js → chunk-FVLVVOBQ.js} +10 -10
  30. package/Build/Workers/{chunk-B2VA6IEL.js → chunk-GL7DNVUS.js} +5 -5
  31. package/Build/Workers/{chunk-77DJBHMI.js → chunk-GPIGURCG.js} +59 -32
  32. package/Build/Workers/{chunk-QPXGGVHC.js → chunk-H2A4USJR.js} +10 -10
  33. package/Build/Workers/chunk-HSVQATK2.js +147 -0
  34. package/Build/Workers/{chunk-HXEPZWJN.js → chunk-HVMG6AG4.js} +11 -10
  35. package/Build/Workers/{chunk-H3TVRJLY.js → chunk-I3A6DXYZ.js} +4 -4
  36. package/Build/Workers/{chunk-UEWYSOFD.js → chunk-ITD2IN7N.js} +2 -2
  37. package/Build/Workers/{chunk-CYOPNGPX.js → chunk-J3OFS2RD.js} +12 -12
  38. package/Build/Workers/{chunk-RZX6LOG6.js → chunk-J647NNZW.js} +6 -6
  39. package/Build/Workers/{chunk-GLCPE2BJ.js → chunk-J7KQEKPK.js} +13 -13
  40. package/Build/Workers/{chunk-XPMXRJDD.js → chunk-K6NFIRFB.js} +5 -5
  41. package/Build/Workers/{chunk-CID5SY7L.js → chunk-LH5SF3XV.js} +7 -6
  42. package/Build/Workers/{chunk-UOQB7XQI.js → chunk-ND3NTTOF.js} +713 -435
  43. package/Build/Workers/chunk-QO2CGXMP.js +2342 -0
  44. package/Build/Workers/chunk-QSDY4NS7.js +1287 -0
  45. package/Build/Workers/chunk-QXNQQYPV.js +3201 -0
  46. package/Build/Workers/{chunk-CJ7ZDY77.js → chunk-ST2UWDUU.js} +5 -5
  47. package/Build/Workers/{chunk-YDR5LX5Z.js → chunk-TA777BGS.js} +3 -2
  48. package/Build/Workers/{chunk-U4SWB6TI.js → chunk-TAI4HLII.js} +4 -4
  49. package/Build/Workers/{chunk-VX774SWE.js → chunk-URUCCIPS.js} +6 -6
  50. package/Build/Workers/{chunk-MNSNOONX.js → chunk-VQKLRBIK.js} +7 -7
  51. package/Build/Workers/{chunk-CVAAIRNP.js → chunk-WC57YYBN.js} +2 -2
  52. package/Build/Workers/{chunk-QNABVTTP.js → chunk-WN6P5UDH.js} +12 -12
  53. package/Build/Workers/{chunk-CNLXMOPM.js → chunk-WNN5D4W3.js} +12 -11
  54. package/Build/Workers/{chunk-4JJQRZYL.js → chunk-WTQGE7Q6.js} +17 -17
  55. package/Build/Workers/{chunk-FCJQO4NC.js → chunk-WUBKZFF6.js} +2213 -1349
  56. package/Build/Workers/{chunk-3UQ2YMPP.js → chunk-ZAPOS52G.js} +12 -10
  57. package/Build/Workers/{chunk-LHFC4R7Z.js → chunk-ZCCIIBZT.js} +6 -6
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +175 -118
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +24 -23
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +25 -25
  100. package/Build/Workers/createWallOutlineGeometry.js +24 -24
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +12 -12
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +12 -9
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/ArcType.js +6 -1
  112. package/Source/Core/ArticulationStageType.js +5 -1
  113. package/Source/Core/AssociativeArray.js +100 -94
  114. package/Source/Core/BoundingSphere.js +1296 -1300
  115. package/Source/Core/Cartesian2.js +7 -5
  116. package/Source/Core/Cartesian3.js +9 -8
  117. package/Source/Core/Cartesian4.js +8 -6
  118. package/Source/Core/Cartographic.js +257 -249
  119. package/Source/Core/ClockRange.js +6 -1
  120. package/Source/Core/ClockStep.js +6 -1
  121. package/Source/Core/Color.js +846 -835
  122. package/Source/Core/ComponentDatatype.js +4 -1
  123. package/Source/Core/CornerType.js +6 -1
  124. package/Source/Core/Credit.js +121 -124
  125. package/Source/Core/DeveloperError.js +2 -1
  126. package/Source/Core/Ellipsoid.js +637 -660
  127. package/Source/Core/ExtrapolationType.js +6 -1
  128. package/Source/Core/GeocodeType.js +6 -1
  129. package/Source/Core/GeographicProjection.js +74 -74
  130. package/Source/Core/GeographicTilingScheme.js +179 -198
  131. package/Source/Core/GeometryOffsetAttribute.js +7 -1
  132. package/Source/Core/GeometryType.js +7 -1
  133. package/Source/Core/HeightmapEncoding.js +6 -1
  134. package/Source/Core/ITwinPlatform.js +1 -0
  135. package/Source/Core/Iau2006XysData.js +24 -13
  136. package/Source/Core/IndexDatatype.js +3 -1
  137. package/Source/Core/InterpolationType.js +5 -1
  138. package/Source/Core/Intersect.js +6 -1
  139. package/Source/Core/Ion.js +1 -1
  140. package/Source/Core/IonGeocodeProviderType.js +5 -1
  141. package/Source/Core/JulianDate.js +850 -848
  142. package/Source/Core/KeyboardEventModifier.js +6 -1
  143. package/Source/Core/MapProjection.js +39 -44
  144. package/Source/Core/Matrix2.js +906 -893
  145. package/Source/Core/Matrix3.js +1643 -1575
  146. package/Source/Core/Matrix4.js +2903 -2872
  147. package/Source/Core/PixelFormat.js +3 -1
  148. package/Source/Core/PrimitiveType.js +11 -1
  149. package/Source/Core/Ray.js +62 -60
  150. package/Source/Core/Rectangle.js +913 -904
  151. package/Source/Core/ReferenceFrame.js +6 -1
  152. package/Source/Core/RequestScheduler.js +8 -3
  153. package/Source/Core/RequestState.js +6 -1
  154. package/Source/Core/RequestType.js +6 -1
  155. package/Source/Core/S2Cell.js +2 -2
  156. package/Source/Core/ScreenSpaceEventType.js +6 -1
  157. package/Source/Core/TerrainMesh.js +10 -1
  158. package/Source/Core/TerrainPicker.js +1 -0
  159. package/Source/Core/TerrainQuantization.js +6 -1
  160. package/Source/Core/TilingScheme.js +100 -98
  161. package/Source/Core/TimeConstants.js +6 -1
  162. package/Source/Core/TimeStandard.js +6 -1
  163. package/Source/Core/TrackingReferenceFrame.js +6 -1
  164. package/Source/Core/Visibility.js +6 -1
  165. package/Source/Core/VulkanConstants.js +6 -1
  166. package/Source/Core/WallGeometry.js +1 -1
  167. package/Source/Core/WallOutlineGeometry.js +1 -1
  168. package/Source/Core/WebGLConstants.js +6 -1
  169. package/Source/Core/WebMercatorProjection.js +108 -109
  170. package/Source/Core/WebMercatorTilingScheme.js +246 -242
  171. package/Source/Core/WindingOrder.js +3 -1
  172. package/Source/Core/assert.js +27 -0
  173. package/Source/Core/globalTypes.js +4 -0
  174. package/Source/DataSources/CzmlDataSource.js +9 -0
  175. package/Source/DataSources/PathGraphics.js +13 -0
  176. package/Source/DataSources/PathVisualizer.js +330 -18
  177. package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
  178. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
  179. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +4 -1
  180. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +4 -1
  181. package/Source/DataSources/StripeOrientation.js +6 -1
  182. package/Source/Renderer/BufferUsage.js +20 -9
  183. package/Source/Renderer/Context.js +2 -29
  184. package/Source/Renderer/DrawCommand.js +435 -403
  185. package/Source/Renderer/MipmapHint.js +5 -1
  186. package/Source/Renderer/Pass.js +7 -1
  187. package/Source/Renderer/PickId.js +44 -0
  188. package/Source/Renderer/PixelDatatype.js +3 -1
  189. package/Source/Renderer/RenderState.js +2 -2
  190. package/Source/Renderer/RenderbufferFormat.js +5 -1
  191. package/Source/Renderer/ShaderDestination.js +4 -1
  192. package/Source/Renderer/TextureMagnificationFilter.js +3 -1
  193. package/Source/Renderer/TextureMinificationFilter.js +3 -1
  194. package/Source/Renderer/TextureWrap.js +5 -1
  195. package/Source/Renderer/VertexArray.js +80 -0
  196. package/Source/Scene/AlphaMode.js +5 -1
  197. package/Source/Scene/ArcGisBaseMapType.js +6 -1
  198. package/Source/Scene/ArcGisMapService.js +1 -1
  199. package/Source/Scene/AttributeType.js +3 -1
  200. package/Source/Scene/Axis.js +3 -1
  201. package/Source/Scene/BillboardCollection.js +65 -364
  202. package/Source/Scene/BingMapsStyle.js +6 -1
  203. package/Source/Scene/BlendEquation.js +6 -1
  204. package/Source/Scene/BlendFunction.js +6 -1
  205. package/Source/Scene/BlendOption.js +6 -1
  206. package/Source/Scene/BlendingState.js +6 -1
  207. package/Source/Scene/BufferLoader.js +0 -2
  208. package/Source/Scene/BufferPoint.js +148 -0
  209. package/Source/Scene/BufferPointCollection.js +138 -0
  210. package/Source/Scene/BufferPointMaterial.js +95 -0
  211. package/Source/Scene/BufferPolygon.js +516 -0
  212. package/Source/Scene/BufferPolygonCollection.js +370 -0
  213. package/Source/Scene/BufferPolygonMaterial.js +41 -0
  214. package/Source/Scene/BufferPolyline.js +185 -0
  215. package/Source/Scene/BufferPolylineCollection.js +138 -0
  216. package/Source/Scene/BufferPolylineMaterial.js +93 -0
  217. package/Source/Scene/BufferPrimitive.js +347 -0
  218. package/Source/Scene/BufferPrimitiveCollection.js +818 -0
  219. package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
  220. package/Source/Scene/CameraEventType.js +6 -1
  221. package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
  222. package/Source/Scene/Cesium3DTileContent.js +5 -1
  223. package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
  224. package/Source/Scene/Cesium3DTileContentState.js +6 -1
  225. package/Source/Scene/Cesium3DTileContentType.js +3 -1
  226. package/Source/Scene/Cesium3DTileFeature.js +289 -306
  227. package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
  228. package/Source/Scene/Cesium3DTilePass.js +5 -1
  229. package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
  230. package/Source/Scene/Cesium3DTileRefine.js +6 -1
  231. package/Source/Scene/Cesium3DTileStyle.js +22 -0
  232. package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
  233. package/Source/Scene/Cesium3DTileset.js +2 -1
  234. package/Source/Scene/ClassificationType.js +3 -1
  235. package/Source/Scene/ClippingPolygonCollection.js +270 -101
  236. package/Source/Scene/CloudType.js +3 -1
  237. package/Source/Scene/ColorBlendMode.js +4 -1
  238. package/Source/Scene/CubeMapPanorama.js +4 -4
  239. package/Source/Scene/CullFace.js +6 -1
  240. package/Source/Scene/DepthFunction.js +6 -1
  241. package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
  242. package/Source/Scene/EquirectangularPanorama.js +1 -0
  243. package/Source/Scene/ExpressionNodeType.js +6 -1
  244. package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
  245. package/Source/Scene/GaussianSplatPrimitive.js +413 -70
  246. package/Source/Scene/GetFeatureInfoFormat.js +3 -3
  247. package/Source/Scene/GltfBufferViewLoader.js +0 -2
  248. package/Source/Scene/GltfDracoLoader.js +0 -2
  249. package/Source/Scene/GltfImageLoader.js +0 -3
  250. package/Source/Scene/GltfIndexBufferLoader.js +0 -4
  251. package/Source/Scene/GltfJsonLoader.js +0 -2
  252. package/Source/Scene/GltfLoader.js +215 -39
  253. package/Source/Scene/GltfLoaderUtil.js +14 -0
  254. package/Source/Scene/GltfSpzLoader.js +109 -2
  255. package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
  256. package/Source/Scene/GltfTextureLoader.js +0 -2
  257. package/Source/Scene/GltfVertexBufferLoader.js +0 -4
  258. package/Source/Scene/HeightReference.js +5 -1
  259. package/Source/Scene/HorizontalOrigin.js +6 -1
  260. package/Source/Scene/ITwinData.js +1 -0
  261. package/Source/Scene/ImageryProvider.js +1 -1
  262. package/Source/Scene/ImageryState.js +6 -1
  263. package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
  264. package/Source/Scene/InstanceAttributeSemantic.js +3 -1
  265. package/Source/Scene/IonWorldImageryStyle.js +6 -1
  266. package/Source/Scene/JobType.js +6 -1
  267. package/Source/Scene/Label.js +32 -0
  268. package/Source/Scene/LabelCollection.js +14 -13
  269. package/Source/Scene/LabelStyle.js +6 -1
  270. package/Source/Scene/MapMode2D.js +6 -1
  271. package/Source/Scene/Material.js +2 -0
  272. package/Source/Scene/Megatexture.js +1 -0
  273. package/Source/Scene/MetadataClassProperty.js +24 -10
  274. package/Source/Scene/MetadataComponentType.js +118 -24
  275. package/Source/Scene/MetadataSchemaLoader.js +0 -2
  276. package/Source/Scene/MetadataSemantic.js +6 -2
  277. package/Source/Scene/MetadataType.js +3 -1
  278. package/Source/Scene/Model/B3dmLoader.js +0 -3
  279. package/Source/Scene/Model/CustomShaderMode.js +3 -1
  280. package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
  281. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
  282. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +735 -264
  283. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
  284. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
  285. package/Source/Scene/Model/GeoJsonLoader.js +0 -2
  286. package/Source/Scene/Model/I3dmLoader.js +0 -3
  287. package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
  288. package/Source/Scene/Model/LightingModel.js +5 -1
  289. package/Source/Scene/Model/MaterialPipelineStage.js +331 -3
  290. package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
  291. package/Source/Scene/Model/ModelDrawCommand.js +6 -0
  292. package/Source/Scene/Model/ModelReader.js +475 -4
  293. package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
  294. package/Source/Scene/Model/ModelType.js +3 -1
  295. package/Source/Scene/Model/ModelUtility.js +3 -1
  296. package/Source/Scene/Model/PntsLoader.js +4 -3
  297. package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
  298. package/Source/Scene/Model/UniformType.js +5 -1
  299. package/Source/Scene/Model/VaryingType.js +5 -1
  300. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +375 -0
  301. package/Source/Scene/Model/pickModel.js +94 -299
  302. package/Source/Scene/ModelAnimationLoop.js +6 -1
  303. package/Source/Scene/ModelAnimationState.js +6 -1
  304. package/Source/Scene/ModelComponents.js +1639 -1542
  305. package/Source/Scene/PickedMetadataInfo.js +1 -0
  306. package/Source/Scene/PrimitiveState.js +7 -1
  307. package/Source/Scene/QuadtreeOccluders.js +20 -15
  308. package/Source/Scene/QuadtreeTile.js +547 -541
  309. package/Source/Scene/QuadtreeTileLoadState.js +6 -1
  310. package/Source/Scene/QuadtreeTileProvider.js +159 -175
  311. package/Source/Scene/ResourceLoader.js +0 -1
  312. package/Source/Scene/ResourceLoaderState.js +7 -1
  313. package/Source/Scene/SceneMode.js +4 -1
  314. package/Source/Scene/ScreenSpaceCameraController.js +13 -0
  315. package/Source/Scene/ShadowMode.js +3 -1
  316. package/Source/Scene/SkyBox.js +17 -8
  317. package/Source/Scene/SplitDirection.js +6 -1
  318. package/Source/Scene/StencilFunction.js +6 -1
  319. package/Source/Scene/StencilOperation.js +6 -1
  320. package/Source/Scene/TerrainState.js +7 -1
  321. package/Source/Scene/TileBoundingRegion.js +1 -1
  322. package/Source/Scene/TileBoundingS2Cell.js +1 -1
  323. package/Source/Scene/TileBoundingSphere.js +1 -1
  324. package/Source/Scene/TileState.js +7 -1
  325. package/Source/Scene/Tonemapper.js +5 -1
  326. package/Source/Scene/TweenCollection.js +7 -0
  327. package/Source/Scene/VectorGltf3DTileContent.js +403 -0
  328. package/Source/Scene/VertexAttributeSemantic.js +17 -1
  329. package/Source/Scene/VerticalOrigin.js +6 -1
  330. package/Source/Scene/VoxelBoxShape.js +12 -6
  331. package/Source/Scene/VoxelContent.js +2 -0
  332. package/Source/Scene/VoxelCylinderShape.js +39 -38
  333. package/Source/Scene/VoxelEllipsoidShape.js +46 -96
  334. package/Source/Scene/VoxelMetadataOrder.js +6 -1
  335. package/Source/Scene/VoxelProvider.js +1 -0
  336. package/Source/Scene/VoxelShapeType.js +3 -1
  337. package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
  338. package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
  339. package/Source/Scene/parseStructuralMetadata.js +97 -37
  340. package/Source/Scene/renderBufferPointCollection.js +285 -0
  341. package/Source/Scene/renderBufferPolygonCollection.js +339 -0
  342. package/Source/Scene/renderBufferPolylineCollection.js +478 -0
  343. package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
  344. package/Source/Shaders/BillboardCollectionFS.js +2 -77
  345. package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
  346. package/Source/Shaders/BillboardCollectionVS.js +2 -60
  347. package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
  348. package/Source/Shaders/BufferPointMaterialFS.js +29 -0
  349. package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
  350. package/Source/Shaders/BufferPointMaterialVS.js +50 -0
  351. package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
  352. package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
  353. package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
  354. package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
  355. package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
  356. package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
  357. package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
  358. package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
  359. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  360. package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
  361. package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
  362. package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
  363. package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
  364. package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
  365. package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
  366. package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
  367. package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
  368. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
  369. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
  370. package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
  371. package/Source/Shaders/Model/MaterialStageFS.js +46 -20
  372. package/Source/Shaders/Model/ModelFS.glsl +15 -0
  373. package/Source/Shaders/Model/ModelFS.js +15 -0
  374. package/Source/Shaders/Model/ModelVS.glsl +8 -0
  375. package/Source/Shaders/Model/ModelVS.js +8 -0
  376. package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
  377. package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
  378. package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
  379. package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
  380. package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
  381. package/Source/Shaders/Voxels/VoxelFS.js +1 -1
  382. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
  383. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
  384. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
  385. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
  386. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
  387. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
  388. package/Source/Widget/CesiumWidget.js +11 -4
  389. package/Source/Workers/decodeDraco.js +3 -0
  390. package/Source/Workers/decodeI3S.js +5 -2
  391. package/index.d.ts +1332 -402
  392. package/index.js +111 -81
  393. package/package.json +3 -3
  394. package/Build/Workers/chunk-54O3AGOA.js +0 -642
  395. package/Build/Workers/chunk-6U5QMZU3.js +0 -940
  396. package/Build/Workers/chunk-HNDE73JK.js +0 -1829
  397. package/Build/Workers/chunk-PAFMAR7A.js +0 -2357
  398. package/Build/Workers/chunk-S53HSRT6.js +0 -114
@@ -1,3 +1,5 @@
1
+ // @ts-check
2
+
1
3
  import Cartesian3 from "./Cartesian3.js";
2
4
  import Cartographic from "./Cartographic.js";
3
5
  import Check from "./Check.js";
@@ -7,1052 +9,1059 @@ import CesiumMath from "./Math.js";
7
9
  import Transforms from "./Transforms.js";
8
10
  import Matrix4 from "./Matrix4.js";
9
11
 
12
+ /** @import BoundingSphere from "./BoundingSphere.js"; */
13
+
10
14
  /**
11
15
  * A two dimensional region specified as longitude and latitude coordinates.
12
- *
13
- * @alias Rectangle
14
- * @constructor
15
- *
16
- * @param {number} [west=0.0] The westernmost longitude, in radians, in the range [-Pi, Pi].
17
- * @param {number} [south=0.0] The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
18
- * @param {number} [east=0.0] The easternmost longitude, in radians, in the range [-Pi, Pi].
19
- * @param {number} [north=0.0] The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
20
- *
21
16
  * @see Packable
22
17
  */
23
- function Rectangle(west, south, east, north) {
24
- /**
25
- * The westernmost longitude in radians in the range [-Pi, Pi].
26
- *
27
- * @type {number}
28
- * @default 0.0
29
- */
30
- this.west = west ?? 0.0;
31
-
32
- /**
33
- * The southernmost latitude in radians in the range [-Pi/2, Pi/2].
34
- *
35
- * @type {number}
36
- * @default 0.0
37
- */
38
- this.south = south ?? 0.0;
39
-
40
- /**
41
- * The easternmost longitude in radians in the range [-Pi, Pi].
42
- *
43
- * @type {number}
44
- * @default 0.0
45
- */
46
- this.east = east ?? 0.0;
47
-
18
+ class Rectangle {
48
19
  /**
49
- * The northernmost latitude in radians in the range [-Pi/2, Pi/2].
50
- *
51
- * @type {number}
52
- * @default 0.0
20
+ * @param {number} [west=0.0] The westernmost longitude, in radians, in the range [-Pi, Pi].
21
+ * @param {number} [south=0.0] The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
22
+ * @param {number} [east=0.0] The easternmost longitude, in radians, in the range [-Pi, Pi].
23
+ * @param {number} [north=0.0] The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
53
24
  */
54
- this.north = north ?? 0.0;
55
- }
25
+ constructor(west, south, east, north) {
26
+ /**
27
+ * The westernmost longitude in radians in the range [-Pi, Pi].
28
+ *
29
+ * @type {number}
30
+ * @default 0.0
31
+ */
32
+ this.west = west ?? 0.0;
33
+
34
+ /**
35
+ * The southernmost latitude in radians in the range [-Pi/2, Pi/2].
36
+ *
37
+ * @type {number}
38
+ * @default 0.0
39
+ */
40
+ this.south = south ?? 0.0;
41
+
42
+ /**
43
+ * The easternmost longitude in radians in the range [-Pi, Pi].
44
+ *
45
+ * @type {number}
46
+ * @default 0.0
47
+ */
48
+ this.east = east ?? 0.0;
49
+
50
+ /**
51
+ * The northernmost latitude in radians in the range [-Pi/2, Pi/2].
52
+ *
53
+ * @type {number}
54
+ * @default 0.0
55
+ */
56
+ this.north = north ?? 0.0;
57
+ }
56
58
 
57
- Object.defineProperties(Rectangle.prototype, {
58
59
  /**
59
60
  * Gets the width of the rectangle in radians.
60
- * @memberof Rectangle.prototype
61
61
  * @type {number}
62
62
  * @readonly
63
63
  */
64
- width: {
65
- get: function () {
66
- return Rectangle.computeWidth(this);
67
- },
68
- },
64
+ get width() {
65
+ return Rectangle.computeWidth(this);
66
+ }
69
67
 
70
68
  /**
71
69
  * Gets the height of the rectangle in radians.
72
- * @memberof Rectangle.prototype
73
70
  * @type {number}
74
71
  * @readonly
75
72
  */
76
- height: {
77
- get: function () {
78
- return Rectangle.computeHeight(this);
79
- },
80
- },
81
- });
73
+ get height() {
74
+ return Rectangle.computeHeight(this);
75
+ }
82
76
 
83
- /**
84
- * The number of elements used to pack the object into an array.
85
- * @type {number}
86
- */
87
- Rectangle.packedLength = 4;
77
+ /**
78
+ * Stores the provided instance into the provided array.
79
+ *
80
+ * @param {Rectangle} value The value to pack.
81
+ * @param {number[]} array The array to pack into.
82
+ * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
83
+ *
84
+ * @returns {number[]} The array that was packed into
85
+ */
86
+ static pack(value, array, startingIndex) {
87
+ //>>includeStart('debug', pragmas.debug);
88
+ Check.typeOf.object("value", value);
89
+ Check.defined("array", array);
90
+ //>>includeEnd('debug');
88
91
 
89
- /**
90
- * Stores the provided instance into the provided array.
91
- *
92
- * @param {Rectangle} value The value to pack.
93
- * @param {number[]} array The array to pack into.
94
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
95
- *
96
- * @returns {number[]} The array that was packed into
97
- */
98
- Rectangle.pack = function (value, array, startingIndex) {
99
- //>>includeStart('debug', pragmas.debug);
100
- Check.typeOf.object("value", value);
101
- Check.defined("array", array);
102
- //>>includeEnd('debug');
92
+ startingIndex = startingIndex ?? 0;
103
93
 
104
- startingIndex = startingIndex ?? 0;
94
+ array[startingIndex++] = value.west;
95
+ array[startingIndex++] = value.south;
96
+ array[startingIndex++] = value.east;
97
+ array[startingIndex] = value.north;
105
98
 
106
- array[startingIndex++] = value.west;
107
- array[startingIndex++] = value.south;
108
- array[startingIndex++] = value.east;
109
- array[startingIndex] = value.north;
99
+ return array;
100
+ }
110
101
 
111
- return array;
112
- };
102
+ /**
103
+ * Retrieves an instance from a packed array.
104
+ *
105
+ * @param {number[]} array The packed array.
106
+ * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
107
+ * @param {Rectangle} [result] The object into which to store the result.
108
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
109
+ */
110
+ static unpack(array, startingIndex, result) {
111
+ //>>includeStart('debug', pragmas.debug);
112
+ Check.defined("array", array);
113
+ //>>includeEnd('debug');
113
114
 
114
- /**
115
- * Retrieves an instance from a packed array.
116
- *
117
- * @param {number[]} array The packed array.
118
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
119
- * @param {Rectangle} [result] The object into which to store the result.
120
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
121
- */
122
- Rectangle.unpack = function (array, startingIndex, result) {
123
- //>>includeStart('debug', pragmas.debug);
124
- Check.defined("array", array);
125
- //>>includeEnd('debug');
115
+ startingIndex = startingIndex ?? 0;
126
116
 
127
- startingIndex = startingIndex ?? 0;
117
+ if (!defined(result)) {
118
+ result = new Rectangle();
119
+ }
128
120
 
129
- if (!defined(result)) {
130
- result = new Rectangle();
121
+ result.west = array[startingIndex++];
122
+ result.south = array[startingIndex++];
123
+ result.east = array[startingIndex++];
124
+ result.north = array[startingIndex];
125
+ return result;
131
126
  }
132
127
 
133
- result.west = array[startingIndex++];
134
- result.south = array[startingIndex++];
135
- result.east = array[startingIndex++];
136
- result.north = array[startingIndex];
137
- return result;
138
- };
128
+ /**
129
+ * Computes the width of a rectangle in radians.
130
+ * @param {Rectangle} rectangle The rectangle to compute the width of.
131
+ * @returns {number} The width.
132
+ */
133
+ static computeWidth(rectangle) {
134
+ //>>includeStart('debug', pragmas.debug);
135
+ Check.typeOf.object("rectangle", rectangle);
136
+ //>>includeEnd('debug');
137
+ let east = rectangle.east;
138
+ const west = rectangle.west;
139
+ if (east < west) {
140
+ east += CesiumMath.TWO_PI;
141
+ }
142
+ return east - west;
143
+ }
139
144
 
140
- /**
141
- * Computes the width of a rectangle in radians.
142
- * @param {Rectangle} rectangle The rectangle to compute the width of.
143
- * @returns {number} The width.
144
- */
145
- Rectangle.computeWidth = function (rectangle) {
146
- //>>includeStart('debug', pragmas.debug);
147
- Check.typeOf.object("rectangle", rectangle);
148
- //>>includeEnd('debug');
149
- let east = rectangle.east;
150
- const west = rectangle.west;
151
- if (east < west) {
152
- east += CesiumMath.TWO_PI;
145
+ /**
146
+ * Computes the height of a rectangle in radians.
147
+ * @param {Rectangle} rectangle The rectangle to compute the height of.
148
+ * @returns {number} The height.
149
+ */
150
+ static computeHeight(rectangle) {
151
+ //>>includeStart('debug', pragmas.debug);
152
+ Check.typeOf.object("rectangle", rectangle);
153
+ //>>includeEnd('debug');
154
+ return rectangle.north - rectangle.south;
153
155
  }
154
- return east - west;
155
- };
156
156
 
157
- /**
158
- * Computes the height of a rectangle in radians.
159
- * @param {Rectangle} rectangle The rectangle to compute the height of.
160
- * @returns {number} The height.
161
- */
162
- Rectangle.computeHeight = function (rectangle) {
163
- //>>includeStart('debug', pragmas.debug);
164
- Check.typeOf.object("rectangle", rectangle);
165
- //>>includeEnd('debug');
166
- return rectangle.north - rectangle.south;
167
- };
157
+ /**
158
+ * Creates a rectangle given the boundary longitude and latitude in degrees.
159
+ *
160
+ * @param {number} [west=0.0] The westernmost longitude in degrees in the range [-180.0, 180.0].
161
+ * @param {number} [south=0.0] The southernmost latitude in degrees in the range [-90.0, 90.0].
162
+ * @param {number} [east=0.0] The easternmost longitude in degrees in the range [-180.0, 180.0].
163
+ * @param {number} [north=0.0] The northernmost latitude in degrees in the range [-90.0, 90.0].
164
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
165
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
166
+ *
167
+ * @example
168
+ * const rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);
169
+ */
170
+ static fromDegrees(west, south, east, north, result) {
171
+ west = CesiumMath.toRadians(west ?? 0.0);
172
+ south = CesiumMath.toRadians(south ?? 0.0);
173
+ east = CesiumMath.toRadians(east ?? 0.0);
174
+ north = CesiumMath.toRadians(north ?? 0.0);
175
+
176
+ if (!defined(result)) {
177
+ return new Rectangle(west, south, east, north);
178
+ }
168
179
 
169
- /**
170
- * Creates a rectangle given the boundary longitude and latitude in degrees.
171
- *
172
- * @param {number} [west=0.0] The westernmost longitude in degrees in the range [-180.0, 180.0].
173
- * @param {number} [south=0.0] The southernmost latitude in degrees in the range [-90.0, 90.0].
174
- * @param {number} [east=0.0] The easternmost longitude in degrees in the range [-180.0, 180.0].
175
- * @param {number} [north=0.0] The northernmost latitude in degrees in the range [-90.0, 90.0].
176
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
177
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
178
- *
179
- * @example
180
- * const rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);
181
- */
182
- Rectangle.fromDegrees = function (west, south, east, north, result) {
183
- west = CesiumMath.toRadians(west ?? 0.0);
184
- south = CesiumMath.toRadians(south ?? 0.0);
185
- east = CesiumMath.toRadians(east ?? 0.0);
186
- north = CesiumMath.toRadians(north ?? 0.0);
187
-
188
- if (!defined(result)) {
189
- return new Rectangle(west, south, east, north);
180
+ result.west = west;
181
+ result.south = south;
182
+ result.east = east;
183
+ result.north = north;
184
+
185
+ return result;
190
186
  }
191
187
 
192
- result.west = west;
193
- result.south = south;
194
- result.east = east;
195
- result.north = north;
188
+ /**
189
+ * Creates a rectangle given the boundary longitude and latitude in radians.
190
+ *
191
+ * @param {number} [west=0.0] The westernmost longitude in radians in the range [-Math.PI, Math.PI].
192
+ * @param {number} [south=0.0] The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
193
+ * @param {number} [east=0.0] The easternmost longitude in radians in the range [-Math.PI, Math.PI].
194
+ * @param {number} [north=0.0] The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
195
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
196
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
197
+ *
198
+ * @example
199
+ * const rectangle = Cesium.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);
200
+ */
201
+ static fromRadians(west, south, east, north, result) {
202
+ if (!defined(result)) {
203
+ return new Rectangle(west, south, east, north);
204
+ }
196
205
 
197
- return result;
198
- };
206
+ result.west = west ?? 0.0;
207
+ result.south = south ?? 0.0;
208
+ result.east = east ?? 0.0;
209
+ result.north = north ?? 0.0;
199
210
 
200
- /**
201
- * Creates a rectangle given the boundary longitude and latitude in radians.
202
- *
203
- * @param {number} [west=0.0] The westernmost longitude in radians in the range [-Math.PI, Math.PI].
204
- * @param {number} [south=0.0] The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
205
- * @param {number} [east=0.0] The easternmost longitude in radians in the range [-Math.PI, Math.PI].
206
- * @param {number} [north=0.0] The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
207
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
208
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
209
- *
210
- * @example
211
- * const rectangle = Cesium.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);
212
- */
213
- Rectangle.fromRadians = function (west, south, east, north, result) {
214
- if (!defined(result)) {
215
- return new Rectangle(west, south, east, north);
211
+ return result;
216
212
  }
217
213
 
218
- result.west = west ?? 0.0;
219
- result.south = south ?? 0.0;
220
- result.east = east ?? 0.0;
221
- result.north = north ?? 0.0;
214
+ /**
215
+ * Creates the smallest possible Rectangle that encloses all positions in the provided array.
216
+ *
217
+ * @param {Cartographic[]} cartographics The list of Cartographic instances.
218
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
219
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
220
+ */
221
+ static fromCartographicArray(cartographics, result) {
222
+ //>>includeStart('debug', pragmas.debug);
223
+ Check.defined("cartographics", cartographics);
224
+ //>>includeEnd('debug');
225
+
226
+ let west = Number.MAX_VALUE;
227
+ let east = -Number.MAX_VALUE;
228
+ let westOverIDL = Number.MAX_VALUE;
229
+ let eastOverIDL = -Number.MAX_VALUE;
230
+ let south = Number.MAX_VALUE;
231
+ let north = -Number.MAX_VALUE;
232
+
233
+ for (let i = 0, len = cartographics.length; i < len; i++) {
234
+ const position = cartographics[i];
235
+ west = Math.min(west, position.longitude);
236
+ east = Math.max(east, position.longitude);
237
+ south = Math.min(south, position.latitude);
238
+ north = Math.max(north, position.latitude);
239
+
240
+ const lonAdjusted =
241
+ position.longitude >= 0
242
+ ? position.longitude
243
+ : position.longitude + CesiumMath.TWO_PI;
244
+ westOverIDL = Math.min(westOverIDL, lonAdjusted);
245
+ eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
246
+ }
222
247
 
223
- return result;
224
- };
248
+ if (east - west > eastOverIDL - westOverIDL) {
249
+ west = westOverIDL;
250
+ east = eastOverIDL;
225
251
 
226
- /**
227
- * Creates the smallest possible Rectangle that encloses all positions in the provided array.
228
- *
229
- * @param {Cartographic[]} cartographics The list of Cartographic instances.
230
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
231
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
232
- */
233
- Rectangle.fromCartographicArray = function (cartographics, result) {
234
- //>>includeStart('debug', pragmas.debug);
235
- Check.defined("cartographics", cartographics);
236
- //>>includeEnd('debug');
237
-
238
- let west = Number.MAX_VALUE;
239
- let east = -Number.MAX_VALUE;
240
- let westOverIDL = Number.MAX_VALUE;
241
- let eastOverIDL = -Number.MAX_VALUE;
242
- let south = Number.MAX_VALUE;
243
- let north = -Number.MAX_VALUE;
244
-
245
- for (let i = 0, len = cartographics.length; i < len; i++) {
246
- const position = cartographics[i];
247
- west = Math.min(west, position.longitude);
248
- east = Math.max(east, position.longitude);
249
- south = Math.min(south, position.latitude);
250
- north = Math.max(north, position.latitude);
251
-
252
- const lonAdjusted =
253
- position.longitude >= 0
254
- ? position.longitude
255
- : position.longitude + CesiumMath.TWO_PI;
256
- westOverIDL = Math.min(westOverIDL, lonAdjusted);
257
- eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
252
+ if (east > CesiumMath.PI) {
253
+ east = east - CesiumMath.TWO_PI;
254
+ }
255
+ if (west > CesiumMath.PI) {
256
+ west = west - CesiumMath.TWO_PI;
257
+ }
258
+ }
259
+
260
+ if (!defined(result)) {
261
+ return new Rectangle(west, south, east, north);
262
+ }
263
+
264
+ result.west = west;
265
+ result.south = south;
266
+ result.east = east;
267
+ result.north = north;
268
+ return result;
258
269
  }
259
270
 
260
- if (east - west > eastOverIDL - westOverIDL) {
261
- west = westOverIDL;
262
- east = eastOverIDL;
271
+ /**
272
+ * Creates the smallest possible Rectangle that encloses all positions in the provided array.
273
+ *
274
+ * @param {Cartesian3[]} cartesians The list of Cartesian instances.
275
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid the cartesians are on.
276
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
277
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
278
+ */
279
+ static fromCartesianArray(cartesians, ellipsoid, result) {
280
+ //>>includeStart('debug', pragmas.debug);
281
+ Check.defined("cartesians", cartesians);
282
+ //>>includeEnd('debug');
283
+ ellipsoid = ellipsoid ?? Ellipsoid.default;
284
+
285
+ let west = Number.MAX_VALUE;
286
+ let east = -Number.MAX_VALUE;
287
+ let westOverIDL = Number.MAX_VALUE;
288
+ let eastOverIDL = -Number.MAX_VALUE;
289
+ let south = Number.MAX_VALUE;
290
+ let north = -Number.MAX_VALUE;
291
+
292
+ for (let i = 0, len = cartesians.length; i < len; i++) {
293
+ const position = ellipsoid.cartesianToCartographic(cartesians[i]);
294
+ west = Math.min(west, position.longitude);
295
+ east = Math.max(east, position.longitude);
296
+ south = Math.min(south, position.latitude);
297
+ north = Math.max(north, position.latitude);
298
+
299
+ const lonAdjusted =
300
+ position.longitude >= 0
301
+ ? position.longitude
302
+ : position.longitude + CesiumMath.TWO_PI;
303
+ westOverIDL = Math.min(westOverIDL, lonAdjusted);
304
+ eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
305
+ }
306
+
307
+ if (east - west > eastOverIDL - westOverIDL) {
308
+ west = westOverIDL;
309
+ east = eastOverIDL;
263
310
 
264
- if (east > CesiumMath.PI) {
265
- east = east - CesiumMath.TWO_PI;
311
+ if (east > CesiumMath.PI) {
312
+ east = east - CesiumMath.TWO_PI;
313
+ }
314
+ if (west > CesiumMath.PI) {
315
+ west = west - CesiumMath.TWO_PI;
316
+ }
266
317
  }
267
- if (west > CesiumMath.PI) {
268
- west = west - CesiumMath.TWO_PI;
318
+
319
+ if (!defined(result)) {
320
+ return new Rectangle(west, south, east, north);
269
321
  }
270
- }
271
322
 
272
- if (!defined(result)) {
273
- return new Rectangle(west, south, east, north);
323
+ result.west = west;
324
+ result.south = south;
325
+ result.east = east;
326
+ result.north = north;
327
+ return result;
274
328
  }
275
329
 
276
- result.west = west;
277
- result.south = south;
278
- result.east = east;
279
- result.north = north;
280
- return result;
281
- };
330
+ /**
331
+ * Create a rectangle from a bounding sphere, ignoring height.
332
+ *
333
+ *
334
+ * @param {BoundingSphere} boundingSphere The bounding sphere.
335
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid.
336
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
337
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
338
+ */
339
+ static fromBoundingSphere(boundingSphere, ellipsoid, result) {
340
+ //>>includeStart('debug', pragmas.debug);
341
+ Check.typeOf.object("boundingSphere", boundingSphere);
342
+ //>>includeEnd('debug');
282
343
 
283
- /**
284
- * Creates the smallest possible Rectangle that encloses all positions in the provided array.
285
- *
286
- * @param {Cartesian3[]} cartesians The list of Cartesian instances.
287
- * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid the cartesians are on.
288
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
289
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
290
- */
291
- Rectangle.fromCartesianArray = function (cartesians, ellipsoid, result) {
292
- //>>includeStart('debug', pragmas.debug);
293
- Check.defined("cartesians", cartesians);
294
- //>>includeEnd('debug');
295
- ellipsoid = ellipsoid ?? Ellipsoid.default;
296
-
297
- let west = Number.MAX_VALUE;
298
- let east = -Number.MAX_VALUE;
299
- let westOverIDL = Number.MAX_VALUE;
300
- let eastOverIDL = -Number.MAX_VALUE;
301
- let south = Number.MAX_VALUE;
302
- let north = -Number.MAX_VALUE;
303
-
304
- for (let i = 0, len = cartesians.length; i < len; i++) {
305
- const position = ellipsoid.cartesianToCartographic(cartesians[i]);
306
- west = Math.min(west, position.longitude);
307
- east = Math.max(east, position.longitude);
308
- south = Math.min(south, position.latitude);
309
- north = Math.max(north, position.latitude);
310
-
311
- const lonAdjusted =
312
- position.longitude >= 0
313
- ? position.longitude
314
- : position.longitude + CesiumMath.TWO_PI;
315
- westOverIDL = Math.min(westOverIDL, lonAdjusted);
316
- eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
317
- }
344
+ const center = boundingSphere.center;
345
+ const radius = boundingSphere.radius;
318
346
 
319
- if (east - west > eastOverIDL - westOverIDL) {
320
- west = westOverIDL;
321
- east = eastOverIDL;
347
+ if (!defined(ellipsoid)) {
348
+ ellipsoid = Ellipsoid.default;
349
+ }
322
350
 
323
- if (east > CesiumMath.PI) {
324
- east = east - CesiumMath.TWO_PI;
351
+ if (!defined(result)) {
352
+ result = new Rectangle();
325
353
  }
326
- if (west > CesiumMath.PI) {
327
- west = west - CesiumMath.TWO_PI;
354
+
355
+ if (Cartesian3.equals(center, Cartesian3.ZERO)) {
356
+ Rectangle.clone(Rectangle.MAX_VALUE, result);
357
+ return result;
328
358
  }
329
- }
330
359
 
331
- if (!defined(result)) {
332
- return new Rectangle(west, south, east, north);
333
- }
360
+ const fromENU = Transforms.eastNorthUpToFixedFrame(
361
+ center,
362
+ ellipsoid,
363
+ fromBoundingSphereMatrixScratch,
364
+ );
365
+ const east = Matrix4.multiplyByPointAsVector(
366
+ fromENU,
367
+ Cartesian3.UNIT_X,
368
+ fromBoundingSphereEastScratch,
369
+ );
370
+ Cartesian3.normalize(east, east);
371
+ const north = Matrix4.multiplyByPointAsVector(
372
+ fromENU,
373
+ Cartesian3.UNIT_Y,
374
+ fromBoundingSphereNorthScratch,
375
+ );
376
+ Cartesian3.normalize(north, north);
334
377
 
335
- result.west = west;
336
- result.south = south;
337
- result.east = east;
338
- result.north = north;
339
- return result;
340
- };
378
+ Cartesian3.multiplyByScalar(north, radius, north);
379
+ Cartesian3.multiplyByScalar(east, radius, east);
341
380
 
342
- const fromBoundingSphereMatrixScratch = new Cartesian3();
343
- const fromBoundingSphereEastScratch = new Cartesian3();
344
- const fromBoundingSphereNorthScratch = new Cartesian3();
345
- const fromBoundingSphereWestScratch = new Cartesian3();
346
- const fromBoundingSphereSouthScratch = new Cartesian3();
347
- const fromBoundingSpherePositionsScratch = new Array(5);
348
- for (let n = 0; n < fromBoundingSpherePositionsScratch.length; ++n) {
349
- fromBoundingSpherePositionsScratch[n] = new Cartesian3();
350
- }
351
- /**
352
- * Create a rectangle from a bounding sphere, ignoring height.
353
- *
354
- *
355
- * @param {BoundingSphere} boundingSphere The bounding sphere.
356
- * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid.
357
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
358
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
359
- */
360
- Rectangle.fromBoundingSphere = function (boundingSphere, ellipsoid, result) {
361
- //>>includeStart('debug', pragmas.debug);
362
- Check.typeOf.object("boundingSphere", boundingSphere);
363
- //>>includeEnd('debug');
381
+ const south = Cartesian3.negate(north, fromBoundingSphereSouthScratch);
382
+ const west = Cartesian3.negate(east, fromBoundingSphereWestScratch);
364
383
 
365
- const center = boundingSphere.center;
366
- const radius = boundingSphere.radius;
384
+ const positions = fromBoundingSpherePositionsScratch;
367
385
 
368
- if (!defined(ellipsoid)) {
369
- ellipsoid = Ellipsoid.default;
370
- }
386
+ // North
387
+ let corner = positions[0];
388
+ Cartesian3.add(center, north, corner);
371
389
 
372
- if (!defined(result)) {
373
- result = new Rectangle();
374
- }
390
+ // West
391
+ corner = positions[1];
392
+ Cartesian3.add(center, west, corner);
375
393
 
376
- if (Cartesian3.equals(center, Cartesian3.ZERO)) {
377
- Rectangle.clone(Rectangle.MAX_VALUE, result);
378
- return result;
379
- }
394
+ // South
395
+ corner = positions[2];
396
+ Cartesian3.add(center, south, corner);
380
397
 
381
- const fromENU = Transforms.eastNorthUpToFixedFrame(
382
- center,
383
- ellipsoid,
384
- fromBoundingSphereMatrixScratch,
385
- );
386
- const east = Matrix4.multiplyByPointAsVector(
387
- fromENU,
388
- Cartesian3.UNIT_X,
389
- fromBoundingSphereEastScratch,
390
- );
391
- Cartesian3.normalize(east, east);
392
- const north = Matrix4.multiplyByPointAsVector(
393
- fromENU,
394
- Cartesian3.UNIT_Y,
395
- fromBoundingSphereNorthScratch,
396
- );
397
- Cartesian3.normalize(north, north);
398
-
399
- Cartesian3.multiplyByScalar(north, radius, north);
400
- Cartesian3.multiplyByScalar(east, radius, east);
401
-
402
- const south = Cartesian3.negate(north, fromBoundingSphereSouthScratch);
403
- const west = Cartesian3.negate(east, fromBoundingSphereWestScratch);
404
-
405
- const positions = fromBoundingSpherePositionsScratch;
406
-
407
- // North
408
- let corner = positions[0];
409
- Cartesian3.add(center, north, corner);
410
-
411
- // West
412
- corner = positions[1];
413
- Cartesian3.add(center, west, corner);
414
-
415
- // South
416
- corner = positions[2];
417
- Cartesian3.add(center, south, corner);
418
-
419
- // East
420
- corner = positions[3];
421
- Cartesian3.add(center, east, corner);
422
-
423
- positions[4] = center;
424
-
425
- return Rectangle.fromCartesianArray(positions, ellipsoid, result);
426
- };
398
+ // East
399
+ corner = positions[3];
400
+ Cartesian3.add(center, east, corner);
427
401
 
428
- /**
429
- * Duplicates a Rectangle.
430
- *
431
- * @param {Rectangle} rectangle The rectangle to clone.
432
- * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
433
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)
434
- */
435
- Rectangle.clone = function (rectangle, result) {
436
- if (!defined(rectangle)) {
437
- return undefined;
438
- }
402
+ positions[4] = center;
439
403
 
440
- if (!defined(result)) {
441
- return new Rectangle(
442
- rectangle.west,
443
- rectangle.south,
444
- rectangle.east,
445
- rectangle.north,
446
- );
404
+ return Rectangle.fromCartesianArray(positions, ellipsoid, result);
447
405
  }
448
406
 
449
- result.west = rectangle.west;
450
- result.south = rectangle.south;
451
- result.east = rectangle.east;
452
- result.north = rectangle.north;
453
- return result;
454
- };
407
+ /**
408
+ * Duplicates a Rectangle.
409
+ *
410
+ * @param {Rectangle} rectangle The rectangle to clone.
411
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
412
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)
413
+ */
414
+ static clone(rectangle, result) {
415
+ if (!defined(rectangle)) {
416
+ return undefined;
417
+ }
455
418
 
456
- /**
457
- * Compares the provided Rectangles componentwise and returns
458
- * <code>true</code> if they pass an absolute or relative tolerance test,
459
- * <code>false</code> otherwise.
460
- *
461
- * @param {Rectangle} [left] The first Rectangle.
462
- * @param {Rectangle} [right] The second Rectangle.
463
- * @param {number} [absoluteEpsilon=0] The absolute epsilon tolerance to use for equality testing.
464
- * @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
465
- */
466
- Rectangle.equalsEpsilon = function (left, right, absoluteEpsilon) {
467
- absoluteEpsilon = absoluteEpsilon ?? 0;
468
-
469
- return (
470
- left === right ||
471
- (defined(left) &&
472
- defined(right) &&
473
- Math.abs(left.west - right.west) <= absoluteEpsilon &&
474
- Math.abs(left.south - right.south) <= absoluteEpsilon &&
475
- Math.abs(left.east - right.east) <= absoluteEpsilon &&
476
- Math.abs(left.north - right.north) <= absoluteEpsilon)
477
- );
478
- };
419
+ if (!defined(result)) {
420
+ return new Rectangle(
421
+ rectangle.west,
422
+ rectangle.south,
423
+ rectangle.east,
424
+ rectangle.north,
425
+ );
426
+ }
479
427
 
480
- /**
481
- * Duplicates this Rectangle.
482
- *
483
- * @param {Rectangle} [result] The object onto which to store the result.
484
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
485
- */
486
- Rectangle.prototype.clone = function (result) {
487
- return Rectangle.clone(this, result);
488
- };
428
+ result.west = rectangle.west;
429
+ result.south = rectangle.south;
430
+ result.east = rectangle.east;
431
+ result.north = rectangle.north;
432
+ return result;
433
+ }
489
434
 
490
- /**
491
- * Compares the provided Rectangle with this Rectangle componentwise and returns
492
- * <code>true</code> if they are equal, <code>false</code> otherwise.
493
- *
494
- * @param {Rectangle} [other] The Rectangle to compare.
495
- * @returns {boolean} <code>true</code> if the Rectangles are equal, <code>false</code> otherwise.
496
- */
497
- Rectangle.prototype.equals = function (other) {
498
- return Rectangle.equals(this, other);
499
- };
435
+ /**
436
+ * Compares the provided Rectangles componentwise and returns
437
+ * <code>true</code> if they pass an absolute or relative tolerance test,
438
+ * <code>false</code> otherwise.
439
+ *
440
+ * @param {Rectangle} [left] The first Rectangle.
441
+ * @param {Rectangle} [right] The second Rectangle.
442
+ * @param {number} [absoluteEpsilon=0] The absolute epsilon tolerance to use for equality testing.
443
+ * @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
444
+ */
445
+ static equalsEpsilon(left, right, absoluteEpsilon) {
446
+ absoluteEpsilon = absoluteEpsilon ?? 0;
447
+
448
+ return (
449
+ left === right ||
450
+ (defined(left) &&
451
+ defined(right) &&
452
+ Math.abs(left.west - right.west) <= absoluteEpsilon &&
453
+ Math.abs(left.south - right.south) <= absoluteEpsilon &&
454
+ Math.abs(left.east - right.east) <= absoluteEpsilon &&
455
+ Math.abs(left.north - right.north) <= absoluteEpsilon)
456
+ );
457
+ }
500
458
 
501
- /**
502
- * Compares the provided rectangles and returns <code>true</code> if they are equal,
503
- * <code>false</code> otherwise.
504
- *
505
- * @param {Rectangle} [left] The first Rectangle.
506
- * @param {Rectangle} [right] The second Rectangle.
507
- * @returns {boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>.
508
- */
509
- Rectangle.equals = function (left, right) {
510
- return (
511
- left === right ||
512
- (defined(left) &&
513
- defined(right) &&
514
- left.west === right.west &&
515
- left.south === right.south &&
516
- left.east === right.east &&
517
- left.north === right.north)
518
- );
519
- };
459
+ /**
460
+ * Duplicates this Rectangle.
461
+ *
462
+ * @param {Rectangle} [result] The object onto which to store the result.
463
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
464
+ */
465
+ clone(result) {
466
+ return Rectangle.clone(this, result);
467
+ }
520
468
 
521
- /**
522
- * Compares the provided Rectangle with this Rectangle componentwise and returns
523
- * <code>true</code> if they are within the provided epsilon,
524
- * <code>false</code> otherwise.
525
- *
526
- * @param {Rectangle} [other] The Rectangle to compare.
527
- * @param {number} [epsilon=0] The epsilon to use for equality testing.
528
- * @returns {boolean} <code>true</code> if the Rectangles are within the provided epsilon, <code>false</code> otherwise.
529
- */
530
- Rectangle.prototype.equalsEpsilon = function (other, epsilon) {
531
- return Rectangle.equalsEpsilon(this, other, epsilon);
532
- };
469
+ /**
470
+ * Compares the provided Rectangle with this Rectangle componentwise and returns
471
+ * <code>true</code> if they are equal, <code>false</code> otherwise.
472
+ *
473
+ * @param {Rectangle} [other] The Rectangle to compare.
474
+ * @returns {boolean} <code>true</code> if the Rectangles are equal, <code>false</code> otherwise.
475
+ */
476
+ equals(other) {
477
+ return Rectangle.equals(this, other);
478
+ }
533
479
 
534
- /**
535
- * Checks a Rectangle's properties and throws if they are not in valid ranges.
536
- *
537
- * @param {Rectangle} rectangle The rectangle to validate
538
- *
539
- * @exception {DeveloperError} <code>north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
540
- * @exception {DeveloperError} <code>south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
541
- * @exception {DeveloperError} <code>east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
542
- * @exception {DeveloperError} <code>west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
543
- * @private
544
- */
545
- Rectangle._validate = function (rectangle) {
546
- //>>includeStart('debug', pragmas.debug);
547
- Check.typeOf.object("rectangle", rectangle);
548
-
549
- const north = rectangle.north;
550
- Check.typeOf.number.greaterThanOrEquals(
551
- "north",
552
- north,
553
- -CesiumMath.PI_OVER_TWO,
554
- );
555
- Check.typeOf.number.lessThanOrEquals("north", north, CesiumMath.PI_OVER_TWO);
480
+ /**
481
+ * Compares the provided rectangles and returns <code>true</code> if they are equal,
482
+ * <code>false</code> otherwise.
483
+ *
484
+ * @param {Rectangle} [left] The first Rectangle.
485
+ * @param {Rectangle} [right] The second Rectangle.
486
+ * @returns {boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>.
487
+ */
488
+ static equals(left, right) {
489
+ return (
490
+ left === right ||
491
+ (defined(left) &&
492
+ defined(right) &&
493
+ left.west === right.west &&
494
+ left.south === right.south &&
495
+ left.east === right.east &&
496
+ left.north === right.north)
497
+ );
498
+ }
556
499
 
557
- const south = rectangle.south;
558
- Check.typeOf.number.greaterThanOrEquals(
559
- "south",
560
- south,
561
- -CesiumMath.PI_OVER_TWO,
562
- );
563
- Check.typeOf.number.lessThanOrEquals("south", south, CesiumMath.PI_OVER_TWO);
500
+ /**
501
+ * Compares the provided Rectangle with this Rectangle componentwise and returns
502
+ * <code>true</code> if they are within the provided epsilon,
503
+ * <code>false</code> otherwise.
504
+ *
505
+ * @param {Rectangle} [other] The Rectangle to compare.
506
+ * @param {number} [epsilon=0] The epsilon to use for equality testing.
507
+ * @returns {boolean} <code>true</code> if the Rectangles are within the provided epsilon, <code>false</code> otherwise.
508
+ */
509
+ equalsEpsilon(other, epsilon) {
510
+ return Rectangle.equalsEpsilon(this, other, epsilon);
511
+ }
564
512
 
565
- const west = rectangle.west;
566
- Check.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
567
- Check.typeOf.number.lessThanOrEquals("west", west, Math.PI);
513
+ /**
514
+ * Checks a Rectangle's properties and throws if they are not in valid ranges.
515
+ *
516
+ * @param {Rectangle} rectangle The rectangle to validate
517
+ *
518
+ * @exception {DeveloperError} <code>north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
519
+ * @exception {DeveloperError} <code>south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
520
+ * @exception {DeveloperError} <code>east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
521
+ * @exception {DeveloperError} <code>west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
522
+ * @private
523
+ */
524
+ static _validate(rectangle) {
525
+ //>>includeStart('debug', pragmas.debug);
526
+ Check.typeOf.object("rectangle", rectangle);
527
+
528
+ const north = rectangle.north;
529
+ Check.typeOf.number.greaterThanOrEquals(
530
+ "north",
531
+ north,
532
+ -CesiumMath.PI_OVER_TWO,
533
+ );
534
+ Check.typeOf.number.lessThanOrEquals(
535
+ "north",
536
+ north,
537
+ CesiumMath.PI_OVER_TWO,
538
+ );
568
539
 
569
- const east = rectangle.east;
570
- Check.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
571
- Check.typeOf.number.lessThanOrEquals("east", east, Math.PI);
572
- //>>includeEnd('debug');
573
- };
540
+ const south = rectangle.south;
541
+ Check.typeOf.number.greaterThanOrEquals(
542
+ "south",
543
+ south,
544
+ -CesiumMath.PI_OVER_TWO,
545
+ );
546
+ Check.typeOf.number.lessThanOrEquals(
547
+ "south",
548
+ south,
549
+ CesiumMath.PI_OVER_TWO,
550
+ );
574
551
 
575
- /**
576
- * Computes the southwest corner of a rectangle.
577
- *
578
- * @param {Rectangle} rectangle The rectangle for which to find the corner
579
- * @param {Cartographic} [result] The object onto which to store the result.
580
- * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
581
- */
582
- Rectangle.southwest = function (rectangle, result) {
583
- //>>includeStart('debug', pragmas.debug);
584
- Check.typeOf.object("rectangle", rectangle);
585
- //>>includeEnd('debug');
552
+ const west = rectangle.west;
553
+ Check.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
554
+ Check.typeOf.number.lessThanOrEquals("west", west, Math.PI);
586
555
 
587
- if (!defined(result)) {
588
- return new Cartographic(rectangle.west, rectangle.south);
556
+ const east = rectangle.east;
557
+ Check.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
558
+ Check.typeOf.number.lessThanOrEquals("east", east, Math.PI);
559
+ //>>includeEnd('debug');
589
560
  }
590
- result.longitude = rectangle.west;
591
- result.latitude = rectangle.south;
592
- result.height = 0.0;
593
- return result;
594
- };
595
561
 
596
- /**
597
- * Computes the northwest corner of a rectangle.
598
- *
599
- * @param {Rectangle} rectangle The rectangle for which to find the corner
600
- * @param {Cartographic} [result] The object onto which to store the result.
601
- * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
602
- */
603
- Rectangle.northwest = function (rectangle, result) {
604
- //>>includeStart('debug', pragmas.debug);
605
- Check.typeOf.object("rectangle", rectangle);
606
- //>>includeEnd('debug');
562
+ /**
563
+ * Computes the southwest corner of a rectangle.
564
+ *
565
+ * @param {Rectangle} rectangle The rectangle for which to find the corner
566
+ * @param {Cartographic} [result] The object onto which to store the result.
567
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
568
+ */
569
+ static southwest(rectangle, result) {
570
+ //>>includeStart('debug', pragmas.debug);
571
+ Check.typeOf.object("rectangle", rectangle);
572
+ //>>includeEnd('debug');
607
573
 
608
- if (!defined(result)) {
609
- return new Cartographic(rectangle.west, rectangle.north);
574
+ if (!defined(result)) {
575
+ return new Cartographic(rectangle.west, rectangle.south);
576
+ }
577
+ result.longitude = rectangle.west;
578
+ result.latitude = rectangle.south;
579
+ result.height = 0.0;
580
+ return result;
610
581
  }
611
- result.longitude = rectangle.west;
612
- result.latitude = rectangle.north;
613
- result.height = 0.0;
614
- return result;
615
- };
616
582
 
617
- /**
618
- * Computes the northeast corner of a rectangle.
619
- *
620
- * @param {Rectangle} rectangle The rectangle for which to find the corner
621
- * @param {Cartographic} [result] The object onto which to store the result.
622
- * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
623
- */
624
- Rectangle.northeast = function (rectangle, result) {
625
- //>>includeStart('debug', pragmas.debug);
626
- Check.typeOf.object("rectangle", rectangle);
627
- //>>includeEnd('debug');
583
+ /**
584
+ * Computes the northwest corner of a rectangle.
585
+ *
586
+ * @param {Rectangle} rectangle The rectangle for which to find the corner
587
+ * @param {Cartographic} [result] The object onto which to store the result.
588
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
589
+ */
590
+ static northwest(rectangle, result) {
591
+ //>>includeStart('debug', pragmas.debug);
592
+ Check.typeOf.object("rectangle", rectangle);
593
+ //>>includeEnd('debug');
628
594
 
629
- if (!defined(result)) {
630
- return new Cartographic(rectangle.east, rectangle.north);
595
+ if (!defined(result)) {
596
+ return new Cartographic(rectangle.west, rectangle.north);
597
+ }
598
+ result.longitude = rectangle.west;
599
+ result.latitude = rectangle.north;
600
+ result.height = 0.0;
601
+ return result;
631
602
  }
632
- result.longitude = rectangle.east;
633
- result.latitude = rectangle.north;
634
- result.height = 0.0;
635
- return result;
636
- };
637
603
 
638
- /**
639
- * Computes the southeast corner of a rectangle.
640
- *
641
- * @param {Rectangle} rectangle The rectangle for which to find the corner
642
- * @param {Cartographic} [result] The object onto which to store the result.
643
- * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
644
- */
645
- Rectangle.southeast = function (rectangle, result) {
646
- //>>includeStart('debug', pragmas.debug);
647
- Check.typeOf.object("rectangle", rectangle);
648
- //>>includeEnd('debug');
604
+ /**
605
+ * Computes the northeast corner of a rectangle.
606
+ *
607
+ * @param {Rectangle} rectangle The rectangle for which to find the corner
608
+ * @param {Cartographic} [result] The object onto which to store the result.
609
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
610
+ */
611
+ static northeast(rectangle, result) {
612
+ //>>includeStart('debug', pragmas.debug);
613
+ Check.typeOf.object("rectangle", rectangle);
614
+ //>>includeEnd('debug');
649
615
 
650
- if (!defined(result)) {
651
- return new Cartographic(rectangle.east, rectangle.south);
616
+ if (!defined(result)) {
617
+ return new Cartographic(rectangle.east, rectangle.north);
618
+ }
619
+ result.longitude = rectangle.east;
620
+ result.latitude = rectangle.north;
621
+ result.height = 0.0;
622
+ return result;
652
623
  }
653
- result.longitude = rectangle.east;
654
- result.latitude = rectangle.south;
655
- result.height = 0.0;
656
- return result;
657
- };
658
624
 
659
- /**
660
- * Computes the center of a rectangle.
661
- *
662
- * @param {Rectangle} rectangle The rectangle for which to find the center
663
- * @param {Cartographic} [result] The object onto which to store the result.
664
- * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
665
- */
666
- Rectangle.center = function (rectangle, result) {
667
- //>>includeStart('debug', pragmas.debug);
668
- Check.typeOf.object("rectangle", rectangle);
669
- //>>includeEnd('debug');
670
-
671
- let east = rectangle.east;
672
- const west = rectangle.west;
625
+ /**
626
+ * Computes the southeast corner of a rectangle.
627
+ *
628
+ * @param {Rectangle} rectangle The rectangle for which to find the corner
629
+ * @param {Cartographic} [result] The object onto which to store the result.
630
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
631
+ */
632
+ static southeast(rectangle, result) {
633
+ //>>includeStart('debug', pragmas.debug);
634
+ Check.typeOf.object("rectangle", rectangle);
635
+ //>>includeEnd('debug');
673
636
 
674
- if (east < west) {
675
- east += CesiumMath.TWO_PI;
637
+ if (!defined(result)) {
638
+ return new Cartographic(rectangle.east, rectangle.south);
639
+ }
640
+ result.longitude = rectangle.east;
641
+ result.latitude = rectangle.south;
642
+ result.height = 0.0;
643
+ return result;
676
644
  }
677
645
 
678
- const longitude = CesiumMath.negativePiToPi((west + east) * 0.5);
679
- const latitude = (rectangle.south + rectangle.north) * 0.5;
646
+ /**
647
+ * Computes the center of a rectangle.
648
+ *
649
+ * @param {Rectangle} rectangle The rectangle for which to find the center
650
+ * @param {Cartographic} [result] The object onto which to store the result.
651
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
652
+ */
653
+ static center(rectangle, result) {
654
+ //>>includeStart('debug', pragmas.debug);
655
+ Check.typeOf.object("rectangle", rectangle);
656
+ //>>includeEnd('debug');
680
657
 
681
- if (!defined(result)) {
682
- return new Cartographic(longitude, latitude);
683
- }
658
+ let east = rectangle.east;
659
+ const west = rectangle.west;
684
660
 
685
- result.longitude = longitude;
686
- result.latitude = latitude;
687
- result.height = 0.0;
688
- return result;
689
- };
661
+ if (east < west) {
662
+ east += CesiumMath.TWO_PI;
663
+ }
690
664
 
691
- /**
692
- * Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are
693
- * latitude and longitude in radians and produces a correct intersection, taking into account the fact that
694
- * the same angle can be represented with multiple values as well as the wrapping of longitude at the
695
- * anti-meridian. For a simple intersection that ignores these factors and can be used with projected
696
- * coordinates, see {@link Rectangle.simpleIntersection}.
697
- *
698
- * @param {Rectangle} rectangle On rectangle to find an intersection
699
- * @param {Rectangle} otherRectangle Another rectangle to find an intersection
700
- * @param {Rectangle} [result] The object onto which to store the result.
701
- * @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
702
- */
703
- Rectangle.intersection = function (rectangle, otherRectangle, result) {
704
- //>>includeStart('debug', pragmas.debug);
705
- Check.typeOf.object("rectangle", rectangle);
706
- Check.typeOf.object("otherRectangle", otherRectangle);
707
- //>>includeEnd('debug');
708
-
709
- let rectangleEast = rectangle.east;
710
- let rectangleWest = rectangle.west;
711
-
712
- let otherRectangleEast = otherRectangle.east;
713
- let otherRectangleWest = otherRectangle.west;
714
-
715
- if (rectangleEast < rectangleWest && otherRectangleEast > 0.0) {
716
- rectangleEast += CesiumMath.TWO_PI;
717
- } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0.0) {
718
- otherRectangleEast += CesiumMath.TWO_PI;
719
- }
665
+ const longitude = CesiumMath.negativePiToPi((west + east) * 0.5);
666
+ const latitude = (rectangle.south + rectangle.north) * 0.5;
720
667
 
721
- if (rectangleEast < rectangleWest && otherRectangleWest < 0.0) {
722
- otherRectangleWest += CesiumMath.TWO_PI;
723
- } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0.0) {
724
- rectangleWest += CesiumMath.TWO_PI;
725
- }
668
+ if (!defined(result)) {
669
+ return new Cartographic(longitude, latitude);
670
+ }
726
671
 
727
- const west = CesiumMath.negativePiToPi(
728
- Math.max(rectangleWest, otherRectangleWest),
729
- );
730
- const east = CesiumMath.negativePiToPi(
731
- Math.min(rectangleEast, otherRectangleEast),
732
- );
733
-
734
- if (
735
- (rectangle.west < rectangle.east ||
736
- otherRectangle.west < otherRectangle.east) &&
737
- east <= west
738
- ) {
739
- return undefined;
672
+ result.longitude = longitude;
673
+ result.latitude = latitude;
674
+ result.height = 0.0;
675
+ return result;
740
676
  }
741
677
 
742
- const south = Math.max(rectangle.south, otherRectangle.south);
743
- const north = Math.min(rectangle.north, otherRectangle.north);
678
+ /**
679
+ * Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are
680
+ * latitude and longitude in radians and produces a correct intersection, taking into account the fact that
681
+ * the same angle can be represented with multiple values as well as the wrapping of longitude at the
682
+ * anti-meridian. For a simple intersection that ignores these factors and can be used with projected
683
+ * coordinates, see {@link Rectangle.simpleIntersection}.
684
+ *
685
+ * @param {Rectangle} rectangle On rectangle to find an intersection
686
+ * @param {Rectangle} otherRectangle Another rectangle to find an intersection
687
+ * @param {Rectangle} [result] The object onto which to store the result.
688
+ * @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
689
+ */
690
+ static intersection(rectangle, otherRectangle, result) {
691
+ //>>includeStart('debug', pragmas.debug);
692
+ Check.typeOf.object("rectangle", rectangle);
693
+ Check.typeOf.object("otherRectangle", otherRectangle);
694
+ //>>includeEnd('debug');
695
+
696
+ let rectangleEast = rectangle.east;
697
+ let rectangleWest = rectangle.west;
698
+
699
+ let otherRectangleEast = otherRectangle.east;
700
+ let otherRectangleWest = otherRectangle.west;
701
+
702
+ if (rectangleEast < rectangleWest && otherRectangleEast > 0.0) {
703
+ rectangleEast += CesiumMath.TWO_PI;
704
+ } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0.0) {
705
+ otherRectangleEast += CesiumMath.TWO_PI;
706
+ }
744
707
 
745
- if (south >= north) {
746
- return undefined;
747
- }
708
+ if (rectangleEast < rectangleWest && otherRectangleWest < 0.0) {
709
+ otherRectangleWest += CesiumMath.TWO_PI;
710
+ } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0.0) {
711
+ rectangleWest += CesiumMath.TWO_PI;
712
+ }
748
713
 
749
- if (!defined(result)) {
750
- return new Rectangle(west, south, east, north);
751
- }
752
- result.west = west;
753
- result.south = south;
754
- result.east = east;
755
- result.north = north;
756
- return result;
757
- };
714
+ const west = CesiumMath.negativePiToPi(
715
+ Math.max(rectangleWest, otherRectangleWest),
716
+ );
717
+ const east = CesiumMath.negativePiToPi(
718
+ Math.min(rectangleEast, otherRectangleEast),
719
+ );
758
720
 
759
- /**
760
- * Computes a simple intersection of two rectangles. Unlike {@link Rectangle.intersection}, this function
761
- * does not attempt to put the angular coordinates into a consistent range or to account for crossing the
762
- * anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude
763
- * and longitude (i.e. projected coordinates).
764
- *
765
- * @param {Rectangle} rectangle On rectangle to find an intersection
766
- * @param {Rectangle} otherRectangle Another rectangle to find an intersection
767
- * @param {Rectangle} [result] The object onto which to store the result.
768
- * @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
769
- */
770
- Rectangle.simpleIntersection = function (rectangle, otherRectangle, result) {
771
- //>>includeStart('debug', pragmas.debug);
772
- Check.typeOf.object("rectangle", rectangle);
773
- Check.typeOf.object("otherRectangle", otherRectangle);
774
- //>>includeEnd('debug');
775
-
776
- const west = Math.max(rectangle.west, otherRectangle.west);
777
- const south = Math.max(rectangle.south, otherRectangle.south);
778
- const east = Math.min(rectangle.east, otherRectangle.east);
779
- const north = Math.min(rectangle.north, otherRectangle.north);
780
-
781
- if (south >= north || west >= east) {
782
- return undefined;
783
- }
721
+ if (
722
+ (rectangle.west < rectangle.east ||
723
+ otherRectangle.west < otherRectangle.east) &&
724
+ east <= west
725
+ ) {
726
+ return undefined;
727
+ }
784
728
 
785
- if (!defined(result)) {
786
- return new Rectangle(west, south, east, north);
787
- }
729
+ const south = Math.max(rectangle.south, otherRectangle.south);
730
+ const north = Math.min(rectangle.north, otherRectangle.north);
788
731
 
789
- result.west = west;
790
- result.south = south;
791
- result.east = east;
792
- result.north = north;
793
- return result;
794
- };
732
+ if (south >= north) {
733
+ return undefined;
734
+ }
795
735
 
796
- /**
797
- * Computes a rectangle that is the union of two rectangles.
798
- *
799
- * @param {Rectangle} rectangle A rectangle to enclose in rectangle.
800
- * @param {Rectangle} otherRectangle A rectangle to enclose in a rectangle.
801
- * @param {Rectangle} [result] The object onto which to store the result.
802
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
803
- */
804
- Rectangle.union = function (rectangle, otherRectangle, result) {
805
- //>>includeStart('debug', pragmas.debug);
806
- Check.typeOf.object("rectangle", rectangle);
807
- Check.typeOf.object("otherRectangle", otherRectangle);
808
- //>>includeEnd('debug');
809
-
810
- if (!defined(result)) {
811
- result = new Rectangle();
736
+ if (!defined(result)) {
737
+ return new Rectangle(west, south, east, north);
738
+ }
739
+ result.west = west;
740
+ result.south = south;
741
+ result.east = east;
742
+ result.north = north;
743
+ return result;
812
744
  }
813
745
 
814
- let rectangleEast = rectangle.east;
815
- let rectangleWest = rectangle.west;
746
+ /**
747
+ * Computes a simple intersection of two rectangles. Unlike {@link Rectangle.intersection}, this function
748
+ * does not attempt to put the angular coordinates into a consistent range or to account for crossing the
749
+ * anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude
750
+ * and longitude (i.e. projected coordinates).
751
+ *
752
+ * @param {Rectangle} rectangle On rectangle to find an intersection
753
+ * @param {Rectangle} otherRectangle Another rectangle to find an intersection
754
+ * @param {Rectangle} [result] The object onto which to store the result.
755
+ * @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
756
+ */
757
+ static simpleIntersection(rectangle, otherRectangle, result) {
758
+ //>>includeStart('debug', pragmas.debug);
759
+ Check.typeOf.object("rectangle", rectangle);
760
+ Check.typeOf.object("otherRectangle", otherRectangle);
761
+ //>>includeEnd('debug');
762
+
763
+ const west = Math.max(rectangle.west, otherRectangle.west);
764
+ const south = Math.max(rectangle.south, otherRectangle.south);
765
+ const east = Math.min(rectangle.east, otherRectangle.east);
766
+ const north = Math.min(rectangle.north, otherRectangle.north);
767
+
768
+ if (south >= north || west >= east) {
769
+ return undefined;
770
+ }
816
771
 
817
- let otherRectangleEast = otherRectangle.east;
818
- let otherRectangleWest = otherRectangle.west;
772
+ if (!defined(result)) {
773
+ return new Rectangle(west, south, east, north);
774
+ }
819
775
 
820
- if (rectangleEast < rectangleWest && otherRectangleEast > 0.0) {
821
- rectangleEast += CesiumMath.TWO_PI;
822
- } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0.0) {
823
- otherRectangleEast += CesiumMath.TWO_PI;
776
+ result.west = west;
777
+ result.south = south;
778
+ result.east = east;
779
+ result.north = north;
780
+ return result;
824
781
  }
825
782
 
826
- if (rectangleEast < rectangleWest && otherRectangleWest < 0.0) {
827
- otherRectangleWest += CesiumMath.TWO_PI;
828
- } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0.0) {
829
- rectangleWest += CesiumMath.TWO_PI;
830
- }
783
+ /**
784
+ * Computes a rectangle that is the union of two rectangles.
785
+ *
786
+ * @param {Rectangle} rectangle A rectangle to enclose in rectangle.
787
+ * @param {Rectangle} otherRectangle A rectangle to enclose in a rectangle.
788
+ * @param {Rectangle} [result] The object onto which to store the result.
789
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
790
+ */
791
+ static union(rectangle, otherRectangle, result) {
792
+ //>>includeStart('debug', pragmas.debug);
793
+ Check.typeOf.object("rectangle", rectangle);
794
+ Check.typeOf.object("otherRectangle", otherRectangle);
795
+ //>>includeEnd('debug');
796
+
797
+ if (!defined(result)) {
798
+ result = new Rectangle();
799
+ }
831
800
 
832
- const west = CesiumMath.negativePiToPi(
833
- Math.min(rectangleWest, otherRectangleWest),
834
- );
835
- const east = CesiumMath.negativePiToPi(
836
- Math.max(rectangleEast, otherRectangleEast),
837
- );
801
+ let rectangleEast = rectangle.east;
802
+ let rectangleWest = rectangle.west;
838
803
 
839
- result.west = west;
840
- result.south = Math.min(rectangle.south, otherRectangle.south);
841
- result.east = east;
842
- result.north = Math.max(rectangle.north, otherRectangle.north);
804
+ let otherRectangleEast = otherRectangle.east;
805
+ let otherRectangleWest = otherRectangle.west;
843
806
 
844
- return result;
845
- };
807
+ if (rectangleEast < rectangleWest && otherRectangleEast > 0.0) {
808
+ rectangleEast += CesiumMath.TWO_PI;
809
+ } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0.0) {
810
+ otherRectangleEast += CesiumMath.TWO_PI;
811
+ }
846
812
 
847
- /**
848
- * Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
849
- *
850
- * @param {Rectangle} rectangle A rectangle to expand.
851
- * @param {Cartographic} cartographic A cartographic to enclose in a rectangle.
852
- * @param {Rectangle} [result] The object onto which to store the result.
853
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
854
- */
855
- Rectangle.expand = function (rectangle, cartographic, result) {
856
- //>>includeStart('debug', pragmas.debug);
857
- Check.typeOf.object("rectangle", rectangle);
858
- Check.typeOf.object("cartographic", cartographic);
859
- //>>includeEnd('debug');
860
-
861
- if (!defined(result)) {
862
- result = new Rectangle();
863
- }
813
+ if (rectangleEast < rectangleWest && otherRectangleWest < 0.0) {
814
+ otherRectangleWest += CesiumMath.TWO_PI;
815
+ } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0.0) {
816
+ rectangleWest += CesiumMath.TWO_PI;
817
+ }
864
818
 
865
- result.west = Math.min(rectangle.west, cartographic.longitude);
866
- result.south = Math.min(rectangle.south, cartographic.latitude);
867
- result.east = Math.max(rectangle.east, cartographic.longitude);
868
- result.north = Math.max(rectangle.north, cartographic.latitude);
819
+ const west = CesiumMath.negativePiToPi(
820
+ Math.min(rectangleWest, otherRectangleWest),
821
+ );
822
+ const east = CesiumMath.negativePiToPi(
823
+ Math.max(rectangleEast, otherRectangleEast),
824
+ );
869
825
 
870
- return result;
871
- };
826
+ result.west = west;
827
+ result.south = Math.min(rectangle.south, otherRectangle.south);
828
+ result.east = east;
829
+ result.north = Math.max(rectangle.north, otherRectangle.north);
872
830
 
873
- /**
874
- * Returns true if the cartographic is on or inside the rectangle, false otherwise.
875
- *
876
- * @param {Rectangle} rectangle The rectangle
877
- * @param {Cartographic} cartographic The cartographic to test.
878
- * @returns {boolean} true if the provided cartographic is inside the rectangle, false otherwise.
879
- */
880
- Rectangle.contains = function (rectangle, cartographic) {
881
- //>>includeStart('debug', pragmas.debug);
882
- Check.typeOf.object("rectangle", rectangle);
883
- Check.typeOf.object("cartographic", cartographic);
884
- //>>includeEnd('debug');
885
-
886
- let longitude = cartographic.longitude;
887
- const latitude = cartographic.latitude;
888
-
889
- const west = rectangle.west;
890
- let east = rectangle.east;
891
-
892
- if (east < west) {
893
- east += CesiumMath.TWO_PI;
894
- if (longitude < 0.0) {
895
- longitude += CesiumMath.TWO_PI;
896
- }
831
+ return result;
897
832
  }
898
- return (
899
- (longitude > west ||
900
- CesiumMath.equalsEpsilon(longitude, west, CesiumMath.EPSILON14)) &&
901
- (longitude < east ||
902
- CesiumMath.equalsEpsilon(longitude, east, CesiumMath.EPSILON14)) &&
903
- latitude >= rectangle.south &&
904
- latitude <= rectangle.north
905
- );
906
- };
907
833
 
908
- const subsampleLlaScratch = new Cartographic();
909
- /**
910
- * Samples a rectangle so that it includes a list of Cartesian points suitable for passing to
911
- * {@link BoundingSphere#fromPoints}. Sampling is necessary to account
912
- * for rectangles that cover the poles or cross the equator.
913
- *
914
- * @param {Rectangle} rectangle The rectangle to subsample.
915
- * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid to use.
916
- * @param {number} [surfaceHeight=0.0] The height of the rectangle above the ellipsoid.
917
- * @param {Cartesian3[]} [result] The array of Cartesians onto which to store the result.
918
- * @returns {Cartesian3[]} The modified result parameter or a new Array of Cartesians instances if none was provided.
919
- */
920
- Rectangle.subsample = function (rectangle, ellipsoid, surfaceHeight, result) {
921
- //>>includeStart('debug', pragmas.debug);
922
- Check.typeOf.object("rectangle", rectangle);
923
- //>>includeEnd('debug');
834
+ /**
835
+ * Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
836
+ *
837
+ * @param {Rectangle} rectangle A rectangle to expand.
838
+ * @param {Cartographic} cartographic A cartographic to enclose in a rectangle.
839
+ * @param {Rectangle} [result] The object onto which to store the result.
840
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
841
+ */
842
+ static expand(rectangle, cartographic, result) {
843
+ //>>includeStart('debug', pragmas.debug);
844
+ Check.typeOf.object("rectangle", rectangle);
845
+ Check.typeOf.object("cartographic", cartographic);
846
+ //>>includeEnd('debug');
847
+
848
+ if (!defined(result)) {
849
+ result = new Rectangle();
850
+ }
924
851
 
925
- ellipsoid = ellipsoid ?? Ellipsoid.default;
926
- surfaceHeight = surfaceHeight ?? 0.0;
852
+ result.west = Math.min(rectangle.west, cartographic.longitude);
853
+ result.south = Math.min(rectangle.south, cartographic.latitude);
854
+ result.east = Math.max(rectangle.east, cartographic.longitude);
855
+ result.north = Math.max(rectangle.north, cartographic.latitude);
927
856
 
928
- if (!defined(result)) {
929
- result = [];
857
+ return result;
930
858
  }
931
- let length = 0;
932
859
 
933
- const north = rectangle.north;
934
- const south = rectangle.south;
935
- const east = rectangle.east;
936
- const west = rectangle.west;
860
+ /**
861
+ * Returns true if the cartographic is on or inside the rectangle, false otherwise.
862
+ *
863
+ * @param {Rectangle} rectangle The rectangle
864
+ * @param {Cartographic} cartographic The cartographic to test.
865
+ * @returns {boolean} true if the provided cartographic is inside the rectangle, false otherwise.
866
+ */
867
+ static contains(rectangle, cartographic) {
868
+ //>>includeStart('debug', pragmas.debug);
869
+ Check.typeOf.object("rectangle", rectangle);
870
+ Check.typeOf.object("cartographic", cartographic);
871
+ //>>includeEnd('debug');
872
+
873
+ let longitude = cartographic.longitude;
874
+ const latitude = cartographic.latitude;
875
+
876
+ const west = rectangle.west;
877
+ let east = rectangle.east;
878
+
879
+ if (east < west) {
880
+ east += CesiumMath.TWO_PI;
881
+ if (longitude < 0.0) {
882
+ longitude += CesiumMath.TWO_PI;
883
+ }
884
+ }
885
+ return (
886
+ (longitude > west ||
887
+ CesiumMath.equalsEpsilon(longitude, west, CesiumMath.EPSILON14)) &&
888
+ (longitude < east ||
889
+ CesiumMath.equalsEpsilon(longitude, east, CesiumMath.EPSILON14)) &&
890
+ latitude >= rectangle.south &&
891
+ latitude <= rectangle.north
892
+ );
893
+ }
937
894
 
938
- const lla = subsampleLlaScratch;
939
- lla.height = surfaceHeight;
895
+ /**
896
+ * Samples a rectangle so that it includes a list of Cartesian points suitable for passing to
897
+ * {@link BoundingSphere#fromPoints}. Sampling is necessary to account
898
+ * for rectangles that cover the poles or cross the equator.
899
+ *
900
+ * @param {Rectangle} rectangle The rectangle to subsample.
901
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid to use.
902
+ * @param {number} [surfaceHeight=0.0] The height of the rectangle above the ellipsoid.
903
+ * @param {Cartesian3[]} [result] The array of Cartesians onto which to store the result.
904
+ * @returns {Cartesian3[]} The modified result parameter or a new Array of Cartesians instances if none was provided.
905
+ */
906
+ static subsample(rectangle, ellipsoid, surfaceHeight, result) {
907
+ //>>includeStart('debug', pragmas.debug);
908
+ Check.typeOf.object("rectangle", rectangle);
909
+ //>>includeEnd('debug');
940
910
 
941
- lla.longitude = west;
942
- lla.latitude = north;
943
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
944
- length++;
911
+ ellipsoid = ellipsoid ?? Ellipsoid.default;
912
+ surfaceHeight = surfaceHeight ?? 0.0;
945
913
 
946
- lla.longitude = east;
947
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
948
- length++;
914
+ if (!defined(result)) {
915
+ result = [];
916
+ }
917
+ let length = 0;
949
918
 
950
- lla.latitude = south;
951
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
952
- length++;
919
+ const north = rectangle.north;
920
+ const south = rectangle.south;
921
+ const east = rectangle.east;
922
+ const west = rectangle.west;
953
923
 
954
- lla.longitude = west;
955
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
956
- length++;
924
+ const lla = subsampleLlaScratch;
925
+ lla.height = surfaceHeight;
957
926
 
958
- if (north < 0.0) {
927
+ lla.longitude = west;
959
928
  lla.latitude = north;
960
- } else if (south > 0.0) {
929
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
930
+ length++;
931
+
932
+ lla.longitude = east;
933
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
934
+ length++;
935
+
961
936
  lla.latitude = south;
962
- } else {
963
- lla.latitude = 0.0;
964
- }
937
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
938
+ length++;
939
+
940
+ lla.longitude = west;
941
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
942
+ length++;
943
+
944
+ if (north < 0.0) {
945
+ lla.latitude = north;
946
+ } else if (south > 0.0) {
947
+ lla.latitude = south;
948
+ } else {
949
+ lla.latitude = 0.0;
950
+ }
951
+
952
+ for (let i = 1; i < 8; ++i) {
953
+ lla.longitude = -Math.PI + i * CesiumMath.PI_OVER_TWO;
954
+ if (Rectangle.contains(rectangle, lla)) {
955
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
956
+ length++;
957
+ }
958
+ }
965
959
 
966
- for (let i = 1; i < 8; ++i) {
967
- lla.longitude = -Math.PI + i * CesiumMath.PI_OVER_TWO;
968
- if (Rectangle.contains(rectangle, lla)) {
960
+ if (lla.latitude === 0.0) {
961
+ lla.longitude = west;
962
+ result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
963
+ length++;
964
+ lla.longitude = east;
969
965
  result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
970
966
  length++;
971
967
  }
968
+ result.length = length;
969
+ return result;
972
970
  }
973
971
 
974
- if (lla.latitude === 0.0) {
975
- lla.longitude = west;
976
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
977
- length++;
978
- lla.longitude = east;
979
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
980
- length++;
972
+ /**
973
+ * Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].
974
+ *
975
+ * @param {Rectangle} rectangle The rectangle to subsection.
976
+ * @param {number} westLerp The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.
977
+ * @param {number} southLerp The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.
978
+ * @param {number} eastLerp The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.
979
+ * @param {number} northLerp The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.
980
+ * @param {Rectangle} [result] The object onto which to store the result.
981
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
982
+ */
983
+ static subsection(
984
+ rectangle,
985
+ westLerp,
986
+ southLerp,
987
+ eastLerp,
988
+ northLerp,
989
+ result,
990
+ ) {
991
+ //>>includeStart('debug', pragmas.debug);
992
+ Check.typeOf.object("rectangle", rectangle);
993
+ Check.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0.0);
994
+ Check.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1.0);
995
+ Check.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0.0);
996
+ Check.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1.0);
997
+ Check.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0.0);
998
+ Check.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1.0);
999
+ Check.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0.0);
1000
+ Check.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1.0);
1001
+
1002
+ Check.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
1003
+ Check.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
1004
+ //>>includeEnd('debug');
1005
+
1006
+ if (!defined(result)) {
1007
+ result = new Rectangle();
1008
+ }
1009
+
1010
+ // This function doesn't use CesiumMath.lerp because it has floating point precision problems
1011
+ // when the start and end values are the same but the t changes.
1012
+
1013
+ if (rectangle.west <= rectangle.east) {
1014
+ const width = rectangle.east - rectangle.west;
1015
+ result.west = rectangle.west + westLerp * width;
1016
+ result.east = rectangle.west + eastLerp * width;
1017
+ } else {
1018
+ const width = CesiumMath.TWO_PI + rectangle.east - rectangle.west;
1019
+ result.west = CesiumMath.negativePiToPi(
1020
+ rectangle.west + westLerp * width,
1021
+ );
1022
+ result.east = CesiumMath.negativePiToPi(
1023
+ rectangle.west + eastLerp * width,
1024
+ );
1025
+ }
1026
+ const height = rectangle.north - rectangle.south;
1027
+ result.south = rectangle.south + southLerp * height;
1028
+ result.north = rectangle.south + northLerp * height;
1029
+
1030
+ // Fix floating point precision problems when t = 1
1031
+ if (westLerp === 1.0) {
1032
+ result.west = rectangle.east;
1033
+ }
1034
+ if (eastLerp === 1.0) {
1035
+ result.east = rectangle.east;
1036
+ }
1037
+ if (southLerp === 1.0) {
1038
+ result.south = rectangle.north;
1039
+ }
1040
+ if (northLerp === 1.0) {
1041
+ result.north = rectangle.north;
1042
+ }
1043
+
1044
+ return result;
981
1045
  }
982
- result.length = length;
983
- return result;
984
- };
1046
+ }
985
1047
 
986
1048
  /**
987
- * Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].
988
- *
989
- * @param {Rectangle} rectangle The rectangle to subsection.
990
- * @param {number} westLerp The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.
991
- * @param {number} southLerp The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.
992
- * @param {number} eastLerp The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.
993
- * @param {number} northLerp The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.
994
- * @param {Rectangle} [result] The object onto which to store the result.
995
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
1049
+ * The number of elements used to pack the object into an array.
1050
+ * @type {number}
996
1051
  */
997
- Rectangle.subsection = function (
998
- rectangle,
999
- westLerp,
1000
- southLerp,
1001
- eastLerp,
1002
- northLerp,
1003
- result,
1004
- ) {
1005
- //>>includeStart('debug', pragmas.debug);
1006
- Check.typeOf.object("rectangle", rectangle);
1007
- Check.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0.0);
1008
- Check.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1.0);
1009
- Check.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0.0);
1010
- Check.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1.0);
1011
- Check.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0.0);
1012
- Check.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1.0);
1013
- Check.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0.0);
1014
- Check.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1.0);
1015
-
1016
- Check.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
1017
- Check.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
1018
- //>>includeEnd('debug');
1019
-
1020
- if (!defined(result)) {
1021
- result = new Rectangle();
1022
- }
1023
-
1024
- // This function doesn't use CesiumMath.lerp because it has floating point precision problems
1025
- // when the start and end values are the same but the t changes.
1026
-
1027
- if (rectangle.west <= rectangle.east) {
1028
- const width = rectangle.east - rectangle.west;
1029
- result.west = rectangle.west + westLerp * width;
1030
- result.east = rectangle.west + eastLerp * width;
1031
- } else {
1032
- const width = CesiumMath.TWO_PI + rectangle.east - rectangle.west;
1033
- result.west = CesiumMath.negativePiToPi(rectangle.west + westLerp * width);
1034
- result.east = CesiumMath.negativePiToPi(rectangle.west + eastLerp * width);
1035
- }
1036
- const height = rectangle.north - rectangle.south;
1037
- result.south = rectangle.south + southLerp * height;
1038
- result.north = rectangle.south + northLerp * height;
1052
+ Rectangle.packedLength = 4;
1039
1053
 
1040
- // Fix floating point precision problems when t = 1
1041
- if (westLerp === 1.0) {
1042
- result.west = rectangle.east;
1043
- }
1044
- if (eastLerp === 1.0) {
1045
- result.east = rectangle.east;
1046
- }
1047
- if (southLerp === 1.0) {
1048
- result.south = rectangle.north;
1049
- }
1050
- if (northLerp === 1.0) {
1051
- result.north = rectangle.north;
1052
- }
1054
+ const fromBoundingSphereMatrixScratch = new Matrix4();
1055
+ const fromBoundingSphereEastScratch = new Cartesian3();
1056
+ const fromBoundingSphereNorthScratch = new Cartesian3();
1057
+ const fromBoundingSphereWestScratch = new Cartesian3();
1058
+ const fromBoundingSphereSouthScratch = new Cartesian3();
1059
+ const fromBoundingSpherePositionsScratch = new Array(5);
1060
+ for (let n = 0; n < fromBoundingSpherePositionsScratch.length; ++n) {
1061
+ fromBoundingSpherePositionsScratch[n] = new Cartesian3();
1062
+ }
1053
1063
 
1054
- return result;
1055
- };
1064
+ const subsampleLlaScratch = new Cartographic();
1056
1065
 
1057
1066
  /**
1058
1067
  * The largest possible rectangle.