@cesium/engine 24.0.0 → 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 (312) hide show
  1. package/Build/Workers/{chunk-NKT5K3K3.js → chunk-35H3UBIO.js} +13 -12
  2. package/Build/Workers/{chunk-5A2SW66E.js → chunk-3LSD7OOA.js} +16 -16
  3. package/Build/Workers/{chunk-HXJMS2ZI.js → chunk-3RFFPH4M.js} +1 -1
  4. package/Build/Workers/{chunk-EDXL4W76.js → chunk-3TKLDHV3.js} +2 -2
  5. package/Build/Workers/{chunk-GQUNK2XC.js → chunk-3VDDRF2E.js} +14 -14
  6. package/Build/Workers/{chunk-Q3C6VQH6.js → chunk-3XY3MVPG.js} +4 -4
  7. package/Build/Workers/{chunk-A47HVBC5.js → chunk-4GF4MVPY.js} +7 -7
  8. package/Build/Workers/{chunk-YQFTYQMZ.js → chunk-4MTRQFJP.js} +3 -2
  9. package/Build/Workers/{chunk-N65BAKSH.js → chunk-4QQXGTCE.js} +8 -8
  10. package/Build/Workers/{chunk-EV3VGO6Y.js → chunk-4XXHJI6Y.js} +17 -17
  11. package/Build/Workers/{chunk-DHKPFLSJ.js → chunk-5T6QQAJW.js} +3 -2
  12. package/Build/Workers/{chunk-UIGVOKKI.js → chunk-6SDGQI27.js} +3 -2
  13. package/Build/Workers/{chunk-ILMFADZA.js → chunk-77RL3MBD.js} +6 -5
  14. package/Build/Workers/{chunk-2N4KDHS3.js → chunk-7LSFAEWF.js} +12 -11
  15. package/Build/Workers/{chunk-44EMEGKW.js → chunk-A7A433MD.js} +5 -5
  16. package/Build/Workers/{chunk-J6AW5YHS.js → chunk-A7ZBMVFS.js} +14 -14
  17. package/Build/Workers/{chunk-XJRBB253.js → chunk-ACFFCHHZ.js} +11 -11
  18. package/Build/Workers/{chunk-MKM27KGV.js → chunk-AEAVLYPS.js} +2 -2
  19. package/Build/Workers/{chunk-7MDYBRYJ.js → chunk-AWFZHD2B.js} +4 -4
  20. package/Build/Workers/{chunk-UQU4RXLT.js → chunk-BTX2NL3P.js} +50 -45
  21. package/Build/Workers/{chunk-4TIG36AW.js → chunk-BVAIWR7O.js} +12 -12
  22. package/Build/Workers/chunk-CKQP3DSS.js +973 -0
  23. package/Build/Workers/{chunk-VLDEUTOP.js → chunk-CZ23Y3RM.js} +2 -2
  24. package/Build/Workers/{chunk-NPF7SSHZ.js → chunk-DFEI5MAV.js} +7 -7
  25. package/Build/Workers/{chunk-AJLTU6PF.js → chunk-DH26SNAB.js} +4 -1
  26. package/Build/Workers/{chunk-5GXYJQ2K.js → chunk-DYT5NR6P.js} +3 -3
  27. package/Build/Workers/{chunk-63SIWPLS.js → chunk-EZARA5FJ.js} +13 -13
  28. package/Build/Workers/{chunk-AMIHNSST.js → chunk-FIBS5S7R.js} +2 -2
  29. package/Build/Workers/{chunk-Y7HNNPNK.js → chunk-FVLVVOBQ.js} +10 -10
  30. package/Build/Workers/{chunk-XY6HMDGI.js → chunk-GL7DNVUS.js} +5 -5
  31. package/Build/Workers/{chunk-6WLHJFD3.js → chunk-GPIGURCG.js} +59 -32
  32. package/Build/Workers/{chunk-B6SCUUFP.js → chunk-H2A4USJR.js} +10 -10
  33. package/Build/Workers/chunk-HSVQATK2.js +147 -0
  34. package/Build/Workers/{chunk-72VYSVEW.js → chunk-HVMG6AG4.js} +11 -10
  35. package/Build/Workers/{chunk-LXMCPFFS.js → chunk-I3A6DXYZ.js} +4 -4
  36. package/Build/Workers/{chunk-7QRFIKWQ.js → chunk-ITD2IN7N.js} +2 -2
  37. package/Build/Workers/{chunk-RQNJD3O4.js → chunk-J3OFS2RD.js} +12 -12
  38. package/Build/Workers/{chunk-C6P4IG5P.js → chunk-J647NNZW.js} +6 -6
  39. package/Build/Workers/{chunk-7X322WP2.js → chunk-J7KQEKPK.js} +13 -13
  40. package/Build/Workers/{chunk-7O5XJTVE.js → chunk-K6NFIRFB.js} +5 -5
  41. package/Build/Workers/{chunk-AF3MU2RL.js → chunk-LH5SF3XV.js} +7 -6
  42. package/Build/Workers/{chunk-GOQBUCXH.js → chunk-ND3NTTOF.js} +708 -430
  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-YAOZMOFL.js → chunk-ST2UWDUU.js} +5 -5
  47. package/Build/Workers/{chunk-PVV64VFW.js → chunk-TA777BGS.js} +3 -2
  48. package/Build/Workers/{chunk-ISY4EZCA.js → chunk-TAI4HLII.js} +4 -4
  49. package/Build/Workers/{chunk-JCI63T3K.js → chunk-URUCCIPS.js} +6 -6
  50. package/Build/Workers/{chunk-VMVOUQ5J.js → chunk-VQKLRBIK.js} +7 -7
  51. package/Build/Workers/{chunk-6MPGQEHA.js → chunk-WC57YYBN.js} +2 -2
  52. package/Build/Workers/{chunk-BJD6QGXZ.js → chunk-WN6P5UDH.js} +12 -12
  53. package/Build/Workers/{chunk-LIB2H534.js → chunk-WNN5D4W3.js} +12 -11
  54. package/Build/Workers/{chunk-D4EJ2NXG.js → chunk-WTQGE7Q6.js} +17 -17
  55. package/Build/Workers/{chunk-YJZGW74L.js → chunk-WUBKZFF6.js} +2213 -1349
  56. package/Build/Workers/{chunk-7TYLCBGK.js → chunk-ZAPOS52G.js} +12 -10
  57. package/Build/Workers/{chunk-6RMS4S72.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 +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  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/Cartesian3.js +1 -2
  116. package/Source/Core/Cartographic.js +257 -249
  117. package/Source/Core/ClockRange.js +6 -1
  118. package/Source/Core/ClockStep.js +6 -1
  119. package/Source/Core/Color.js +844 -835
  120. package/Source/Core/ComponentDatatype.js +4 -1
  121. package/Source/Core/CornerType.js +6 -1
  122. package/Source/Core/Credit.js +121 -124
  123. package/Source/Core/Ellipsoid.js +637 -660
  124. package/Source/Core/ExtrapolationType.js +6 -1
  125. package/Source/Core/GeocodeType.js +6 -1
  126. package/Source/Core/GeographicProjection.js +74 -74
  127. package/Source/Core/GeographicTilingScheme.js +179 -198
  128. package/Source/Core/GeometryOffsetAttribute.js +7 -1
  129. package/Source/Core/GeometryType.js +7 -1
  130. package/Source/Core/HeightmapEncoding.js +6 -1
  131. package/Source/Core/Iau2006XysData.js +24 -13
  132. package/Source/Core/IndexDatatype.js +3 -1
  133. package/Source/Core/InterpolationType.js +5 -1
  134. package/Source/Core/Intersect.js +6 -1
  135. package/Source/Core/Ion.js +1 -1
  136. package/Source/Core/IonGeocodeProviderType.js +5 -1
  137. package/Source/Core/JulianDate.js +850 -848
  138. package/Source/Core/KeyboardEventModifier.js +6 -1
  139. package/Source/Core/MapProjection.js +39 -44
  140. package/Source/Core/Matrix2.js +906 -893
  141. package/Source/Core/Matrix3.js +1643 -1575
  142. package/Source/Core/Matrix4.js +2903 -2872
  143. package/Source/Core/PixelFormat.js +3 -1
  144. package/Source/Core/PrimitiveType.js +11 -1
  145. package/Source/Core/Ray.js +62 -60
  146. package/Source/Core/Rectangle.js +913 -904
  147. package/Source/Core/ReferenceFrame.js +6 -1
  148. package/Source/Core/RequestScheduler.js +8 -3
  149. package/Source/Core/RequestState.js +6 -1
  150. package/Source/Core/RequestType.js +6 -1
  151. package/Source/Core/ScreenSpaceEventType.js +6 -1
  152. package/Source/Core/TerrainQuantization.js +6 -1
  153. package/Source/Core/TilingScheme.js +100 -98
  154. package/Source/Core/TimeConstants.js +6 -1
  155. package/Source/Core/TimeStandard.js +6 -1
  156. package/Source/Core/TrackingReferenceFrame.js +6 -1
  157. package/Source/Core/Visibility.js +6 -1
  158. package/Source/Core/VulkanConstants.js +6 -1
  159. package/Source/Core/WebGLConstants.js +6 -1
  160. package/Source/Core/WebMercatorProjection.js +108 -109
  161. package/Source/Core/WebMercatorTilingScheme.js +246 -242
  162. package/Source/Core/WindingOrder.js +3 -1
  163. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +1 -0
  164. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +1 -0
  165. package/Source/DataSources/StripeOrientation.js +6 -1
  166. package/Source/Renderer/BufferUsage.js +20 -9
  167. package/Source/Renderer/Context.js +2 -29
  168. package/Source/Renderer/DrawCommand.js +435 -403
  169. package/Source/Renderer/MipmapHint.js +5 -1
  170. package/Source/Renderer/Pass.js +7 -1
  171. package/Source/Renderer/PickId.js +44 -0
  172. package/Source/Renderer/PixelDatatype.js +3 -1
  173. package/Source/Renderer/RenderbufferFormat.js +5 -1
  174. package/Source/Renderer/ShaderDestination.js +4 -1
  175. package/Source/Renderer/TextureMagnificationFilter.js +3 -1
  176. package/Source/Renderer/TextureMinificationFilter.js +3 -1
  177. package/Source/Renderer/TextureWrap.js +5 -1
  178. package/Source/Scene/AlphaMode.js +5 -1
  179. package/Source/Scene/ArcGisBaseMapType.js +6 -1
  180. package/Source/Scene/ArcGisMapService.js +1 -1
  181. package/Source/Scene/AttributeType.js +3 -1
  182. package/Source/Scene/Axis.js +3 -1
  183. package/Source/Scene/BingMapsStyle.js +6 -1
  184. package/Source/Scene/BlendEquation.js +6 -1
  185. package/Source/Scene/BlendFunction.js +6 -1
  186. package/Source/Scene/BlendOption.js +6 -1
  187. package/Source/Scene/BlendingState.js +6 -1
  188. package/Source/Scene/BufferLoader.js +0 -2
  189. package/Source/Scene/BufferPointCollection.js +4 -1
  190. package/Source/Scene/BufferPolygonCollection.js +3 -1
  191. package/Source/Scene/BufferPolylineCollection.js +3 -1
  192. package/Source/Scene/BufferPrimitiveCollection.js +140 -24
  193. package/Source/Scene/CameraEventType.js +6 -1
  194. package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
  195. package/Source/Scene/Cesium3DTileContentState.js +6 -1
  196. package/Source/Scene/Cesium3DTileContentType.js +3 -1
  197. package/Source/Scene/Cesium3DTileFeature.js +289 -306
  198. package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
  199. package/Source/Scene/Cesium3DTilePass.js +5 -1
  200. package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
  201. package/Source/Scene/Cesium3DTileRefine.js +6 -1
  202. package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
  203. package/Source/Scene/Cesium3DTileset.js +1 -1
  204. package/Source/Scene/ClassificationType.js +3 -1
  205. package/Source/Scene/CloudType.js +3 -1
  206. package/Source/Scene/ColorBlendMode.js +4 -1
  207. package/Source/Scene/CullFace.js +6 -1
  208. package/Source/Scene/DepthFunction.js +6 -1
  209. package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
  210. package/Source/Scene/EquirectangularPanorama.js +1 -0
  211. package/Source/Scene/ExpressionNodeType.js +6 -1
  212. package/Source/Scene/GltfBufferViewLoader.js +0 -2
  213. package/Source/Scene/GltfDracoLoader.js +0 -2
  214. package/Source/Scene/GltfImageLoader.js +0 -3
  215. package/Source/Scene/GltfIndexBufferLoader.js +0 -4
  216. package/Source/Scene/GltfJsonLoader.js +0 -2
  217. package/Source/Scene/GltfLoader.js +0 -5
  218. package/Source/Scene/GltfLoaderUtil.js +14 -0
  219. package/Source/Scene/GltfSpzLoader.js +0 -2
  220. package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
  221. package/Source/Scene/GltfTextureLoader.js +0 -2
  222. package/Source/Scene/GltfVertexBufferLoader.js +0 -4
  223. package/Source/Scene/HeightReference.js +5 -1
  224. package/Source/Scene/HorizontalOrigin.js +6 -1
  225. package/Source/Scene/ImageryProvider.js +1 -1
  226. package/Source/Scene/ImageryState.js +6 -1
  227. package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
  228. package/Source/Scene/InstanceAttributeSemantic.js +3 -1
  229. package/Source/Scene/IonWorldImageryStyle.js +6 -1
  230. package/Source/Scene/JobType.js +6 -1
  231. package/Source/Scene/LabelStyle.js +6 -1
  232. package/Source/Scene/MapMode2D.js +6 -1
  233. package/Source/Scene/MetadataComponentType.js +3 -1
  234. package/Source/Scene/MetadataSchemaLoader.js +0 -2
  235. package/Source/Scene/MetadataSemantic.js +6 -2
  236. package/Source/Scene/MetadataType.js +3 -1
  237. package/Source/Scene/Model/B3dmLoader.js +0 -3
  238. package/Source/Scene/Model/CustomShaderMode.js +3 -1
  239. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
  240. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +44 -71
  241. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
  242. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
  243. package/Source/Scene/Model/GeoJsonLoader.js +0 -2
  244. package/Source/Scene/Model/I3dmLoader.js +0 -3
  245. package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
  246. package/Source/Scene/Model/LightingModel.js +5 -1
  247. package/Source/Scene/Model/MaterialPipelineStage.js +184 -3
  248. package/Source/Scene/Model/ModelReader.js +474 -3
  249. package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
  250. package/Source/Scene/Model/ModelType.js +3 -1
  251. package/Source/Scene/Model/PntsLoader.js +4 -3
  252. package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
  253. package/Source/Scene/Model/UniformType.js +5 -1
  254. package/Source/Scene/Model/VaryingType.js +5 -1
  255. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +73 -28
  256. package/Source/Scene/Model/pickModel.js +94 -299
  257. package/Source/Scene/ModelAnimationLoop.js +6 -1
  258. package/Source/Scene/ModelAnimationState.js +6 -1
  259. package/Source/Scene/ModelComponents.js +8 -1
  260. package/Source/Scene/PrimitiveState.js +7 -1
  261. package/Source/Scene/QuadtreeOccluders.js +20 -15
  262. package/Source/Scene/QuadtreeTile.js +547 -541
  263. package/Source/Scene/QuadtreeTileLoadState.js +6 -1
  264. package/Source/Scene/QuadtreeTileProvider.js +159 -175
  265. package/Source/Scene/ResourceLoader.js +0 -1
  266. package/Source/Scene/ResourceLoaderState.js +7 -1
  267. package/Source/Scene/SceneMode.js +4 -1
  268. package/Source/Scene/ShadowMode.js +3 -1
  269. package/Source/Scene/SkyBox.js +1 -1
  270. package/Source/Scene/SplitDirection.js +6 -1
  271. package/Source/Scene/StencilFunction.js +6 -1
  272. package/Source/Scene/StencilOperation.js +6 -1
  273. package/Source/Scene/TerrainState.js +7 -1
  274. package/Source/Scene/TileState.js +7 -1
  275. package/Source/Scene/Tonemapper.js +5 -1
  276. package/Source/Scene/VectorGltf3DTileContent.js +72 -51
  277. package/Source/Scene/VertexAttributeSemantic.js +3 -1
  278. package/Source/Scene/VerticalOrigin.js +6 -1
  279. package/Source/Scene/VoxelBoxShape.js +12 -6
  280. package/Source/Scene/VoxelContent.js +2 -0
  281. package/Source/Scene/VoxelCylinderShape.js +39 -38
  282. package/Source/Scene/VoxelEllipsoidShape.js +46 -96
  283. package/Source/Scene/VoxelMetadataOrder.js +6 -1
  284. package/Source/Scene/VoxelProvider.js +1 -0
  285. package/Source/Scene/VoxelShapeType.js +3 -1
  286. package/Source/Scene/renderBufferPointCollection.js +17 -66
  287. package/Source/Scene/renderBufferPolygonCollection.js +21 -68
  288. package/Source/Scene/renderBufferPolylineCollection.js +22 -73
  289. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  290. package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
  291. package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
  292. package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
  293. package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
  294. package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
  295. package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
  296. package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
  297. package/Source/Shaders/Model/MaterialStageFS.js +46 -20
  298. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
  299. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
  300. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
  301. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
  302. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
  303. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
  304. package/Source/Widget/CesiumWidget.js +11 -4
  305. package/index.d.ts +343 -309
  306. package/index.js +443 -438
  307. package/package.json +2 -2
  308. package/Build/Workers/chunk-DVB56LG7.js +0 -114
  309. package/Build/Workers/chunk-HKUES6UG.js +0 -2357
  310. package/Build/Workers/chunk-HRHRYFHS.js +0 -940
  311. package/Build/Workers/chunk-KLPGTXS3.js +0 -642
  312. package/Build/Workers/chunk-ZBZRTRJB.js +0 -1829
@@ -1,3 +1,5 @@
1
+ // @ts-check
2
+
1
3
  import Cartesian2 from "./Cartesian2.js";
2
4
  import Cartesian3 from "./Cartesian3.js";
3
5
  import Cartographic from "./Cartographic.js";
@@ -7,6 +9,26 @@ import DeveloperError from "./DeveloperError.js";
7
9
  import CesiumMath from "./Math.js";
8
10
  import scaleToGeodeticSurface from "./scaleToGeodeticSurface.js";
9
11
 
12
+ /** @import Rectangle from "./Rectangle.js"; */
13
+
14
+ /**
15
+ * A real valued scalar function.
16
+ * @callback EllipsoidRealValuedScalarFunction
17
+ *
18
+ * @param {number} x The value used to evaluate the function.
19
+ * @returns {number} The value of the function at x.
20
+ *
21
+ * @private
22
+ */
23
+
24
+ /**
25
+ * @param {Ellipsoid} ellipsoid
26
+ * @param {number} x
27
+ * @param {number} y
28
+ * @param {number} z
29
+ *
30
+ * @ignore
31
+ */
10
32
  function initialize(ellipsoid, x, y, z) {
11
33
  x = x ?? 0.0;
12
34
  y = y ?? 0.0;
@@ -59,215 +81,157 @@ function initialize(ellipsoid, x, y, z) {
59
81
  *
60
82
  * Rather than constructing this object directly, one of the provided
61
83
  * constants is normally used.
62
- * @alias Ellipsoid
63
- * @constructor
64
- *
65
- * @param {number} [x=0] The radius in the x direction.
66
- * @param {number} [y=0] The radius in the y direction.
67
- * @param {number} [z=0] The radius in the z direction.
68
- *
69
- * @exception {DeveloperError} All radii components must be greater than or equal to zero.
70
84
  *
71
85
  * @see Ellipsoid.fromCartesian3
72
86
  * @see Ellipsoid.WGS84
73
87
  * @see Ellipsoid.UNIT_SPHERE
74
88
  */
75
- function Ellipsoid(x, y, z) {
76
- this._radii = undefined;
77
- this._radiiSquared = undefined;
78
- this._radiiToTheFourth = undefined;
79
- this._oneOverRadii = undefined;
80
- this._oneOverRadiiSquared = undefined;
81
- this._minimumRadius = undefined;
82
- this._maximumRadius = undefined;
83
- this._centerToleranceSquared = undefined;
84
- this._squaredXOverSquaredZ = undefined;
85
-
86
- initialize(this, x, y, z);
87
- }
89
+ class Ellipsoid {
90
+ /**
91
+ * @param {number} [x=0] The radius in the x direction.
92
+ * @param {number} [y=0] The radius in the y direction.
93
+ * @param {number} [z=0] The radius in the z direction.
94
+ *
95
+ * @exception {DeveloperError} All radii components must be greater than or equal to zero.
96
+ */
97
+ constructor(x, y, z) {
98
+ this._radii = undefined;
99
+ this._radiiSquared = undefined;
100
+ this._radiiToTheFourth = undefined;
101
+ this._oneOverRadii = undefined;
102
+ this._oneOverRadiiSquared = undefined;
103
+ this._minimumRadius = undefined;
104
+ this._maximumRadius = undefined;
105
+ this._centerToleranceSquared = undefined;
106
+ this._squaredXOverSquaredZ = undefined;
107
+
108
+ initialize(this, x, y, z);
109
+ }
88
110
 
89
- Object.defineProperties(Ellipsoid.prototype, {
90
111
  /**
91
112
  * Gets the radii of the ellipsoid.
92
- * @memberof Ellipsoid.prototype
93
113
  * @type {Cartesian3}
94
114
  * @readonly
95
115
  */
96
- radii: {
97
- get: function () {
98
- return this._radii;
99
- },
100
- },
116
+ get radii() {
117
+ return this._radii;
118
+ }
119
+
101
120
  /**
102
121
  * Gets the squared radii of the ellipsoid.
103
- * @memberof Ellipsoid.prototype
104
122
  * @type {Cartesian3}
105
123
  * @readonly
106
124
  */
107
- radiiSquared: {
108
- get: function () {
109
- return this._radiiSquared;
110
- },
111
- },
125
+ get radiiSquared() {
126
+ return this._radiiSquared;
127
+ }
128
+
112
129
  /**
113
130
  * Gets the radii of the ellipsoid raise to the fourth power.
114
- * @memberof Ellipsoid.prototype
115
131
  * @type {Cartesian3}
116
132
  * @readonly
117
133
  */
118
- radiiToTheFourth: {
119
- get: function () {
120
- return this._radiiToTheFourth;
121
- },
122
- },
134
+ get radiiToTheFourth() {
135
+ return this._radiiToTheFourth;
136
+ }
137
+
123
138
  /**
124
139
  * Gets one over the radii of the ellipsoid.
125
- * @memberof Ellipsoid.prototype
126
140
  * @type {Cartesian3}
127
141
  * @readonly
128
142
  */
129
- oneOverRadii: {
130
- get: function () {
131
- return this._oneOverRadii;
132
- },
133
- },
143
+ get oneOverRadii() {
144
+ return this._oneOverRadii;
145
+ }
146
+
134
147
  /**
135
148
  * Gets one over the squared radii of the ellipsoid.
136
- * @memberof Ellipsoid.prototype
137
149
  * @type {Cartesian3}
138
150
  * @readonly
139
151
  */
140
- oneOverRadiiSquared: {
141
- get: function () {
142
- return this._oneOverRadiiSquared;
143
- },
144
- },
152
+ get oneOverRadiiSquared() {
153
+ return this._oneOverRadiiSquared;
154
+ }
155
+
145
156
  /**
146
157
  * Gets the minimum radius of the ellipsoid.
147
- * @memberof Ellipsoid.prototype
148
158
  * @type {number}
149
159
  * @readonly
150
160
  */
151
- minimumRadius: {
152
- get: function () {
153
- return this._minimumRadius;
154
- },
155
- },
161
+ get minimumRadius() {
162
+ return this._minimumRadius;
163
+ }
164
+
156
165
  /**
157
166
  * Gets the maximum radius of the ellipsoid.
158
- * @memberof Ellipsoid.prototype
159
167
  * @type {number}
160
168
  * @readonly
161
169
  */
162
- maximumRadius: {
163
- get: function () {
164
- return this._maximumRadius;
165
- },
166
- },
167
- });
168
-
169
- /**
170
- * Duplicates an Ellipsoid instance.
171
- *
172
- * @param {Ellipsoid} ellipsoid The ellipsoid to duplicate.
173
- * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
174
- * instance should be created.
175
- * @returns {Ellipsoid} The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
176
- */
177
- Ellipsoid.clone = function (ellipsoid, result) {
178
- if (!defined(ellipsoid)) {
179
- return undefined;
180
- }
181
- const radii = ellipsoid._radii;
182
-
183
- if (!defined(result)) {
184
- return new Ellipsoid(radii.x, radii.y, radii.z);
170
+ get maximumRadius() {
171
+ return this._maximumRadius;
185
172
  }
186
173
 
187
- Cartesian3.clone(radii, result._radii);
188
- Cartesian3.clone(ellipsoid._radiiSquared, result._radiiSquared);
189
- Cartesian3.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
190
- Cartesian3.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
191
- Cartesian3.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
192
- result._minimumRadius = ellipsoid._minimumRadius;
193
- result._maximumRadius = ellipsoid._maximumRadius;
194
- result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
195
-
196
- return result;
197
- };
198
-
199
- /**
200
- * Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
201
- *
202
- * @param {Cartesian3} [cartesian=Cartesian3.ZERO] The ellipsoid's radius in the x, y, and z directions.
203
- * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
204
- * instance should be created.
205
- * @returns {Ellipsoid} A new Ellipsoid instance.
206
- *
207
- * @exception {DeveloperError} All radii components must be greater than or equal to zero.
208
- *
209
- * @see Ellipsoid.WGS84
210
- * @see Ellipsoid.UNIT_SPHERE
211
- */
212
- Ellipsoid.fromCartesian3 = function (cartesian, result) {
213
- if (!defined(result)) {
214
- result = new Ellipsoid();
215
- }
174
+ /**
175
+ * Duplicates an Ellipsoid instance.
176
+ *
177
+ * @param {Ellipsoid} ellipsoid The ellipsoid to duplicate.
178
+ * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
179
+ * instance should be created.
180
+ * @returns {Ellipsoid} The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
181
+ */
182
+ static clone(ellipsoid, result) {
183
+ if (!defined(ellipsoid)) {
184
+ return undefined;
185
+ }
186
+ const radii = ellipsoid._radii;
187
+
188
+ if (!defined(result)) {
189
+ return new Ellipsoid(radii.x, radii.y, radii.z);
190
+ }
191
+
192
+ Cartesian3.clone(radii, result._radii);
193
+ Cartesian3.clone(ellipsoid._radiiSquared, result._radiiSquared);
194
+ Cartesian3.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
195
+ Cartesian3.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
196
+ Cartesian3.clone(
197
+ ellipsoid._oneOverRadiiSquared,
198
+ result._oneOverRadiiSquared,
199
+ );
200
+ result._minimumRadius = ellipsoid._minimumRadius;
201
+ result._maximumRadius = ellipsoid._maximumRadius;
202
+ result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
216
203
 
217
- if (!defined(cartesian)) {
218
204
  return result;
219
205
  }
220
206
 
221
- initialize(result, cartesian.x, cartesian.y, cartesian.z);
222
- return result;
223
- };
224
-
225
- /**
226
- * An Ellipsoid instance initialized to the WGS84 standard.
227
- *
228
- * @type {Ellipsoid}
229
- * @constant
230
- */
231
- Ellipsoid.WGS84 = Object.freeze(
232
- new Ellipsoid(6378137.0, 6378137.0, 6356752.3142451793),
233
- );
234
-
235
- /**
236
- * An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
237
- *
238
- * @type {Ellipsoid}
239
- * @constant
240
- */
241
- Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1.0, 1.0, 1.0));
207
+ /**
208
+ * Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
209
+ *
210
+ * @param {Cartesian3} [cartesian=Cartesian3.ZERO] The ellipsoid's radius in the x, y, and z directions.
211
+ * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
212
+ * instance should be created.
213
+ * @returns {Ellipsoid} A new Ellipsoid instance.
214
+ *
215
+ * @exception {DeveloperError} All radii components must be greater than or equal to zero.
216
+ *
217
+ * @see Ellipsoid.WGS84
218
+ * @see Ellipsoid.UNIT_SPHERE
219
+ */
220
+ static fromCartesian3(cartesian, result) {
221
+ if (!defined(result)) {
222
+ result = new Ellipsoid();
223
+ }
242
224
 
243
- /**
244
- * An Ellipsoid instance initialized to a sphere with the lunar radius.
245
- *
246
- * @type {Ellipsoid}
247
- * @constant
248
- */
249
- Ellipsoid.MOON = Object.freeze(
250
- new Ellipsoid(
251
- CesiumMath.LUNAR_RADIUS,
252
- CesiumMath.LUNAR_RADIUS,
253
- CesiumMath.LUNAR_RADIUS,
254
- ),
255
- );
225
+ if (!defined(cartesian)) {
226
+ return result;
227
+ }
256
228
 
257
- /**
258
- * An Ellipsoid instance initialized to a sphere with the mean radii of Mars.
259
- * Source: https://epsg.io/104905
260
- *
261
- * @type {Ellipsoid}
262
- * @constant
263
- */
264
- Ellipsoid.MARS = Object.freeze(new Ellipsoid(3396190.0, 3396190.0, 3376200.0));
229
+ initialize(result, cartesian.x, cartesian.y, cartesian.z);
230
+ return result;
231
+ }
265
232
 
266
- Ellipsoid._default = Ellipsoid.WGS84;
267
- Object.defineProperties(Ellipsoid, {
268
233
  /**
269
234
  * The default ellipsoid used when not otherwise specified.
270
- * @memberof Ellipsoid
271
235
  * @type {Ellipsoid}
272
236
  * @example
273
237
  * Cesium.Ellipsoid.default = Cesium.Ellipsoid.MOON;
@@ -278,514 +242,584 @@ Object.defineProperties(Ellipsoid, {
278
242
  * 23.47315,
279
243
  * );
280
244
  */
281
- default: {
282
- get: function () {
283
- return Ellipsoid._default;
284
- },
285
- set: function (value) {
286
- //>>includeStart('debug', pragmas.debug);
287
- Check.typeOf.object("value", value);
288
- //>>includeEnd('debug');
289
-
290
- Ellipsoid._default = value;
291
- Cartesian3._ellipsoidRadiiSquared = value.radiiSquared;
292
- Cartographic._ellipsoidOneOverRadii = value.oneOverRadii;
293
- Cartographic._ellipsoidOneOverRadiiSquared = value.oneOverRadiiSquared;
294
- Cartographic._ellipsoidCenterToleranceSquared =
295
- value._centerToleranceSquared;
296
- },
297
- },
298
- });
245
+ static get default() {
246
+ return Ellipsoid._default;
247
+ }
299
248
 
300
- /**
301
- * Duplicates an Ellipsoid instance.
302
- *
303
- * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
304
- * instance should be created.
305
- * @returns {Ellipsoid} The cloned Ellipsoid.
306
- */
307
- Ellipsoid.prototype.clone = function (result) {
308
- return Ellipsoid.clone(this, result);
309
- };
249
+ static set default(value) {
250
+ //>>includeStart('debug', pragmas.debug);
251
+ Check.typeOf.object("value", value);
252
+ //>>includeEnd('debug');
253
+
254
+ Ellipsoid._default = value;
255
+ Cartesian3._ellipsoidRadiiSquared = value.radiiSquared;
256
+ Cartographic._ellipsoidOneOverRadii = value.oneOverRadii;
257
+ Cartographic._ellipsoidOneOverRadiiSquared = value.oneOverRadiiSquared;
258
+ Cartographic._ellipsoidCenterToleranceSquared =
259
+ value._centerToleranceSquared;
260
+ }
310
261
 
311
- /**
312
- * The number of elements used to pack the object into an array.
313
- * @type {number}
314
- */
315
- Ellipsoid.packedLength = Cartesian3.packedLength;
262
+ /**
263
+ * Duplicates an Ellipsoid instance.
264
+ *
265
+ * @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
266
+ * instance should be created.
267
+ * @returns {Ellipsoid} The cloned Ellipsoid.
268
+ */
269
+ clone(result) {
270
+ return Ellipsoid.clone(this, result);
271
+ }
316
272
 
317
- /**
318
- * Stores the provided instance into the provided array.
319
- *
320
- * @param {Ellipsoid} value The value to pack.
321
- * @param {number[]} array The array to pack into.
322
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
323
- *
324
- * @returns {number[]} The array that was packed into
325
- */
326
- Ellipsoid.pack = function (value, array, startingIndex) {
327
- //>>includeStart('debug', pragmas.debug);
328
- Check.typeOf.object("value", value);
329
- Check.defined("array", array);
330
- //>>includeEnd('debug');
273
+ /**
274
+ * Stores the provided instance into the provided array.
275
+ *
276
+ * @param {Ellipsoid} value The value to pack.
277
+ * @param {number[]} array The array to pack into.
278
+ * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
279
+ *
280
+ * @returns {number[]} The array that was packed into
281
+ */
282
+ static pack(value, array, startingIndex) {
283
+ //>>includeStart('debug', pragmas.debug);
284
+ Check.typeOf.object("value", value);
285
+ Check.defined("array", array);
286
+ //>>includeEnd('debug');
331
287
 
332
- startingIndex = startingIndex ?? 0;
288
+ startingIndex = startingIndex ?? 0;
333
289
 
334
- Cartesian3.pack(value._radii, array, startingIndex);
290
+ Cartesian3.pack(value._radii, array, startingIndex);
335
291
 
336
- return array;
337
- };
292
+ return array;
293
+ }
338
294
 
339
- /**
340
- * Retrieves an instance from a packed array.
341
- *
342
- * @param {number[]} array The packed array.
343
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
344
- * @param {Ellipsoid} [result] The object into which to store the result.
345
- * @returns {Ellipsoid} The modified result parameter or a new Ellipsoid instance if one was not provided.
346
- */
347
- Ellipsoid.unpack = function (array, startingIndex, result) {
348
- //>>includeStart('debug', pragmas.debug);
349
- Check.defined("array", array);
350
- //>>includeEnd('debug');
295
+ /**
296
+ * Retrieves an instance from a packed array.
297
+ *
298
+ * @param {number[]} array The packed array.
299
+ * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
300
+ * @param {Ellipsoid} [result] The object into which to store the result.
301
+ * @returns {Ellipsoid} The modified result parameter or a new Ellipsoid instance if one was not provided.
302
+ */
303
+ static unpack(array, startingIndex, result) {
304
+ //>>includeStart('debug', pragmas.debug);
305
+ Check.defined("array", array);
306
+ //>>includeEnd('debug');
351
307
 
352
- startingIndex = startingIndex ?? 0;
308
+ startingIndex = startingIndex ?? 0;
353
309
 
354
- const radii = Cartesian3.unpack(array, startingIndex);
355
- return Ellipsoid.fromCartesian3(radii, result);
356
- };
310
+ const radii = Cartesian3.unpack(array, startingIndex);
311
+ return Ellipsoid.fromCartesian3(radii, result);
312
+ }
357
313
 
358
- /**
359
- * Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
360
- * @function
361
- *
362
- * @param {Cartesian3} cartesian The Cartesian for which to to determine the geocentric normal.
363
- * @param {Cartesian3} [result] The object onto which to store the result.
364
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
365
- */
366
- Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3.normalize;
314
+ /**
315
+ * Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
316
+ *
317
+ * @param {Cartographic} cartographic The cartographic position for which to to determine the geodetic normal.
318
+ * @param {Cartesian3} [result] The object onto which to store the result.
319
+ * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
320
+ */
321
+ geodeticSurfaceNormalCartographic(cartographic, result) {
322
+ //>>includeStart('debug', pragmas.debug);
323
+ Check.typeOf.object("cartographic", cartographic);
324
+ //>>includeEnd('debug');
325
+
326
+ const longitude = cartographic.longitude;
327
+ const latitude = cartographic.latitude;
328
+ const cosLatitude = Math.cos(latitude);
329
+
330
+ const x = cosLatitude * Math.cos(longitude);
331
+ const y = cosLatitude * Math.sin(longitude);
332
+ const z = Math.sin(latitude);
333
+
334
+ if (!defined(result)) {
335
+ result = new Cartesian3();
336
+ }
337
+ result.x = x;
338
+ result.y = y;
339
+ result.z = z;
340
+ return Cartesian3.normalize(result, result);
341
+ }
367
342
 
368
- /**
369
- * Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
370
- *
371
- * @param {Cartographic} cartographic The cartographic position for which to to determine the geodetic normal.
372
- * @param {Cartesian3} [result] The object onto which to store the result.
373
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
374
- */
375
- Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function (
376
- cartographic,
377
- result,
378
- ) {
379
- //>>includeStart('debug', pragmas.debug);
380
- Check.typeOf.object("cartographic", cartographic);
381
- //>>includeEnd('debug');
343
+ /**
344
+ * Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
345
+ *
346
+ * @param {Cartesian3} cartesian The Cartesian position for which to to determine the surface normal.
347
+ * @param {Cartesian3} [result] The object onto which to store the result.
348
+ * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
349
+ */
350
+ geodeticSurfaceNormal(cartesian, result) {
351
+ //>>includeStart('debug', pragmas.debug);
352
+ Check.typeOf.object("cartesian", cartesian);
353
+ if (isNaN(cartesian.x) || isNaN(cartesian.y) || isNaN(cartesian.z)) {
354
+ throw new DeveloperError("cartesian has a NaN component");
355
+ }
356
+ //>>includeEnd('debug');
357
+ if (
358
+ Cartesian3.equalsEpsilon(cartesian, Cartesian3.ZERO, CesiumMath.EPSILON14)
359
+ ) {
360
+ return undefined;
361
+ }
362
+ if (!defined(result)) {
363
+ result = new Cartesian3();
364
+ }
365
+ result = Cartesian3.multiplyComponents(
366
+ cartesian,
367
+ this._oneOverRadiiSquared,
368
+ result,
369
+ );
370
+ return Cartesian3.normalize(result, result);
371
+ }
382
372
 
383
- const longitude = cartographic.longitude;
384
- const latitude = cartographic.latitude;
385
- const cosLatitude = Math.cos(latitude);
373
+ /**
374
+ * Converts the provided cartographic to Cartesian representation.
375
+ *
376
+ * @param {Cartographic} cartographic The cartographic position.
377
+ * @param {Cartesian3} [result] The object onto which to store the result.
378
+ * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
379
+ *
380
+ * @example
381
+ * //Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
382
+ * const position = new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 5000);
383
+ * const cartesianPosition = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);
384
+ */
385
+ cartographicToCartesian(cartographic, result) {
386
+ //`cartographic is required` is thrown from geodeticSurfaceNormalCartographic.
387
+ const n = cartographicToCartesianNormal;
388
+ const k = cartographicToCartesianK;
389
+ this.geodeticSurfaceNormalCartographic(cartographic, n);
390
+ Cartesian3.multiplyComponents(this._radiiSquared, n, k);
391
+ const gamma = Math.sqrt(Cartesian3.dot(n, k));
392
+ Cartesian3.divideByScalar(k, gamma, k);
393
+ Cartesian3.multiplyByScalar(n, cartographic.height, n);
394
+
395
+ if (!defined(result)) {
396
+ result = new Cartesian3();
397
+ }
398
+ return Cartesian3.add(k, n, result);
399
+ }
386
400
 
387
- const x = cosLatitude * Math.cos(longitude);
388
- const y = cosLatitude * Math.sin(longitude);
389
- const z = Math.sin(latitude);
401
+ /**
402
+ * Converts the provided array of cartographics to an array of Cartesians.
403
+ *
404
+ * @param {Cartographic[]} cartographics An array of cartographic positions.
405
+ * @param {Cartesian3[]} [result] The object onto which to store the result.
406
+ * @returns {Cartesian3[]} The modified result parameter or a new Array instance if none was provided.
407
+ *
408
+ * @example
409
+ * //Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
410
+ * const positions = [new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 0),
411
+ * new Cesium.Cartographic(Cesium.Math.toRadians(21.321), Cesium.Math.toRadians(78.123), 100),
412
+ * new Cesium.Cartographic(Cesium.Math.toRadians(21.645), Cesium.Math.toRadians(78.456), 250)];
413
+ * const cartesianPositions = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
414
+ */
415
+ cartographicArrayToCartesianArray(cartographics, result) {
416
+ //>>includeStart('debug', pragmas.debug);
417
+ Check.defined("cartographics", cartographics);
418
+ //>>includeEnd('debug');
419
+
420
+ const length = cartographics.length;
421
+ if (!defined(result)) {
422
+ result = new Array(length);
423
+ } else {
424
+ result.length = length;
425
+ }
426
+ for (let i = 0; i < length; i++) {
427
+ result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
428
+ }
429
+ return result;
430
+ }
390
431
 
391
- if (!defined(result)) {
392
- result = new Cartesian3();
432
+ /**
433
+ * Converts the provided cartesian to cartographic representation.
434
+ * The cartesian is undefined at the center of the ellipsoid.
435
+ *
436
+ * @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation.
437
+ * @param {Cartographic} [result] The object onto which to store the result.
438
+ * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
439
+ *
440
+ * @example
441
+ * //Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
442
+ * const position = new Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
443
+ * const cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
444
+ */
445
+ cartesianToCartographic(cartesian, result) {
446
+ //`cartesian is required.` is thrown from scaleToGeodeticSurface
447
+ const p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP);
448
+
449
+ if (!defined(p)) {
450
+ return undefined;
451
+ }
452
+
453
+ const n = this.geodeticSurfaceNormal(p, cartesianToCartographicN);
454
+ const h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH);
455
+
456
+ const longitude = Math.atan2(n.y, n.x);
457
+ const latitude = Math.asin(n.z);
458
+ const height =
459
+ CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h);
460
+
461
+ if (!defined(result)) {
462
+ return new Cartographic(longitude, latitude, height);
463
+ }
464
+ result.longitude = longitude;
465
+ result.latitude = latitude;
466
+ result.height = height;
467
+ return result;
393
468
  }
394
- result.x = x;
395
- result.y = y;
396
- result.z = z;
397
- return Cartesian3.normalize(result, result);
398
- };
399
469
 
400
- /**
401
- * Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
402
- *
403
- * @param {Cartesian3} cartesian The Cartesian position for which to to determine the surface normal.
404
- * @param {Cartesian3} [result] The object onto which to store the result.
405
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
406
- */
407
- Ellipsoid.prototype.geodeticSurfaceNormal = function (cartesian, result) {
408
- //>>includeStart('debug', pragmas.debug);
409
- Check.typeOf.object("cartesian", cartesian);
410
- if (isNaN(cartesian.x) || isNaN(cartesian.y) || isNaN(cartesian.z)) {
411
- throw new DeveloperError("cartesian has a NaN component");
470
+ /**
471
+ * Converts the provided array of cartesians to an array of cartographics.
472
+ *
473
+ * @param {Cartesian3[]} cartesians An array of Cartesian positions.
474
+ * @param {Cartographic[]} [result] The object onto which to store the result.
475
+ * @returns {Cartographic[]} The modified result parameter or a new Array instance if none was provided.
476
+ *
477
+ * @example
478
+ * //Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
479
+ * const positions = [new Cesium.Cartesian3(17832.12, 83234.52, 952313.73),
480
+ * new Cesium.Cartesian3(17832.13, 83234.53, 952313.73),
481
+ * new Cesium.Cartesian3(17832.14, 83234.54, 952313.73)]
482
+ * const cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
483
+ */
484
+ cartesianArrayToCartographicArray(cartesians, result) {
485
+ //>>includeStart('debug', pragmas.debug);
486
+ Check.defined("cartesians", cartesians);
487
+ //>>includeEnd('debug');
488
+
489
+ const length = cartesians.length;
490
+ if (!defined(result)) {
491
+ result = new Array(length);
492
+ } else {
493
+ result.length = length;
494
+ }
495
+ for (let i = 0; i < length; ++i) {
496
+ result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
497
+ }
498
+ return result;
412
499
  }
413
- //>>includeEnd('debug');
414
- if (
415
- Cartesian3.equalsEpsilon(cartesian, Cartesian3.ZERO, CesiumMath.EPSILON14)
416
- ) {
417
- return undefined;
418
- }
419
- if (!defined(result)) {
420
- result = new Cartesian3();
421
- }
422
- result = Cartesian3.multiplyComponents(
423
- cartesian,
424
- this._oneOverRadiiSquared,
425
- result,
426
- );
427
- return Cartesian3.normalize(result, result);
428
- };
429
500
 
430
- const cartographicToCartesianNormal = new Cartesian3();
431
- const cartographicToCartesianK = new Cartesian3();
501
+ /**
502
+ * Scales the provided Cartesian position along the geodetic surface normal
503
+ * so that it is on the surface of this ellipsoid. If the position is
504
+ * at the center of the ellipsoid, this function returns undefined.
505
+ *
506
+ * @param {Cartesian3} cartesian The Cartesian position to scale.
507
+ * @param {Cartesian3} [result] The object onto which to store the result.
508
+ * @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
509
+ */
510
+ scaleToGeodeticSurface(cartesian, result) {
511
+ return scaleToGeodeticSurface(
512
+ cartesian,
513
+ this._oneOverRadii,
514
+ this._oneOverRadiiSquared,
515
+ this._centerToleranceSquared,
516
+ result,
517
+ );
518
+ }
432
519
 
433
- /**
434
- * Converts the provided cartographic to Cartesian representation.
435
- *
436
- * @param {Cartographic} cartographic The cartographic position.
437
- * @param {Cartesian3} [result] The object onto which to store the result.
438
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
439
- *
440
- * @example
441
- * //Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
442
- * const position = new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 5000);
443
- * const cartesianPosition = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);
444
- */
445
- Ellipsoid.prototype.cartographicToCartesian = function (cartographic, result) {
446
- //`cartographic is required` is thrown from geodeticSurfaceNormalCartographic.
447
- const n = cartographicToCartesianNormal;
448
- const k = cartographicToCartesianK;
449
- this.geodeticSurfaceNormalCartographic(cartographic, n);
450
- Cartesian3.multiplyComponents(this._radiiSquared, n, k);
451
- const gamma = Math.sqrt(Cartesian3.dot(n, k));
452
- Cartesian3.divideByScalar(k, gamma, k);
453
- Cartesian3.multiplyByScalar(n, cartographic.height, n);
454
-
455
- if (!defined(result)) {
456
- result = new Cartesian3();
457
- }
458
- return Cartesian3.add(k, n, result);
459
- };
520
+ /**
521
+ * Scales the provided Cartesian position along the geocentric surface normal
522
+ * so that it is on the surface of this ellipsoid.
523
+ *
524
+ * @param {Cartesian3} cartesian The Cartesian position to scale.
525
+ * @param {Cartesian3} [result] The object onto which to store the result.
526
+ * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
527
+ */
528
+ scaleToGeocentricSurface(cartesian, result) {
529
+ //>>includeStart('debug', pragmas.debug);
530
+ Check.typeOf.object("cartesian", cartesian);
531
+ //>>includeEnd('debug');
532
+
533
+ if (!defined(result)) {
534
+ result = new Cartesian3();
535
+ }
536
+
537
+ const positionX = cartesian.x;
538
+ const positionY = cartesian.y;
539
+ const positionZ = cartesian.z;
540
+ const oneOverRadiiSquared = this._oneOverRadiiSquared;
541
+
542
+ const beta =
543
+ 1.0 /
544
+ Math.sqrt(
545
+ positionX * positionX * oneOverRadiiSquared.x +
546
+ positionY * positionY * oneOverRadiiSquared.y +
547
+ positionZ * positionZ * oneOverRadiiSquared.z,
548
+ );
549
+
550
+ return Cartesian3.multiplyByScalar(cartesian, beta, result);
551
+ }
460
552
 
461
- /**
462
- * Converts the provided array of cartographics to an array of Cartesians.
463
- *
464
- * @param {Cartographic[]} cartographics An array of cartographic positions.
465
- * @param {Cartesian3[]} [result] The object onto which to store the result.
466
- * @returns {Cartesian3[]} The modified result parameter or a new Array instance if none was provided.
467
- *
468
- * @example
469
- * //Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
470
- * const positions = [new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 0),
471
- * new Cesium.Cartographic(Cesium.Math.toRadians(21.321), Cesium.Math.toRadians(78.123), 100),
472
- * new Cesium.Cartographic(Cesium.Math.toRadians(21.645), Cesium.Math.toRadians(78.456), 250)];
473
- * const cartesianPositions = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
474
- */
475
- Ellipsoid.prototype.cartographicArrayToCartesianArray = function (
476
- cartographics,
477
- result,
478
- ) {
479
- //>>includeStart('debug', pragmas.debug);
480
- Check.defined("cartographics", cartographics);
481
- //>>includeEnd('debug');
553
+ /**
554
+ * Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
555
+ * its components by the result of {@link Ellipsoid#oneOverRadii}.
556
+ *
557
+ * @param {Cartesian3} position The position to transform.
558
+ * @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
559
+ * return a new instance.
560
+ * @returns {Cartesian3} The position expressed in the scaled space. The returned instance is the
561
+ * one passed as the result parameter if it is not undefined, or a new instance of it is.
562
+ */
563
+ transformPositionToScaledSpace(position, result) {
564
+ if (!defined(result)) {
565
+ result = new Cartesian3();
566
+ }
482
567
 
483
- const length = cartographics.length;
484
- if (!defined(result)) {
485
- result = new Array(length);
486
- } else {
487
- result.length = length;
488
- }
489
- for (let i = 0; i < length; i++) {
490
- result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
568
+ return Cartesian3.multiplyComponents(position, this._oneOverRadii, result);
491
569
  }
492
- return result;
493
- };
494
570
 
495
- const cartesianToCartographicN = new Cartesian3();
496
- const cartesianToCartographicP = new Cartesian3();
497
- const cartesianToCartographicH = new Cartesian3();
498
-
499
- /**
500
- * Converts the provided cartesian to cartographic representation.
501
- * The cartesian is undefined at the center of the ellipsoid.
502
- *
503
- * @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation.
504
- * @param {Cartographic} [result] The object onto which to store the result.
505
- * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
506
- *
507
- * @example
508
- * //Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
509
- * const position = new Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
510
- * const cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
511
- */
512
- Ellipsoid.prototype.cartesianToCartographic = function (cartesian, result) {
513
- //`cartesian is required.` is thrown from scaleToGeodeticSurface
514
- const p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP);
571
+ /**
572
+ * Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
573
+ * its components by the result of {@link Ellipsoid#radii}.
574
+ *
575
+ * @param {Cartesian3} position The position to transform.
576
+ * @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
577
+ * return a new instance.
578
+ * @returns {Cartesian3} The position expressed in the unscaled space. The returned instance is the
579
+ * one passed as the result parameter if it is not undefined, or a new instance of it is.
580
+ */
581
+ transformPositionFromScaledSpace(position, result) {
582
+ if (!defined(result)) {
583
+ result = new Cartesian3();
584
+ }
515
585
 
516
- if (!defined(p)) {
517
- return undefined;
586
+ return Cartesian3.multiplyComponents(position, this._radii, result);
518
587
  }
519
588
 
520
- const n = this.geodeticSurfaceNormal(p, cartesianToCartographicN);
521
- const h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH);
522
-
523
- const longitude = Math.atan2(n.y, n.x);
524
- const latitude = Math.asin(n.z);
525
- const height =
526
- CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h);
589
+ /**
590
+ * Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
591
+ * <code>true</code> if they are equal, <code>false</code> otherwise.
592
+ *
593
+ * @param {Ellipsoid} [right] The other Ellipsoid.
594
+ * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
595
+ */
596
+ equals(right) {
597
+ return (
598
+ this === right ||
599
+ (defined(right) && Cartesian3.equals(this._radii, right._radii))
600
+ );
601
+ }
527
602
 
528
- if (!defined(result)) {
529
- return new Cartographic(longitude, latitude, height);
603
+ /**
604
+ * Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
605
+ *
606
+ * @returns {string} A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
607
+ */
608
+ toString() {
609
+ return this._radii.toString();
530
610
  }
531
- result.longitude = longitude;
532
- result.latitude = latitude;
533
- result.height = height;
534
- return result;
535
- };
536
611
 
537
- /**
538
- * Converts the provided array of cartesians to an array of cartographics.
539
- *
540
- * @param {Cartesian3[]} cartesians An array of Cartesian positions.
541
- * @param {Cartographic[]} [result] The object onto which to store the result.
542
- * @returns {Cartographic[]} The modified result parameter or a new Array instance if none was provided.
543
- *
544
- * @example
545
- * //Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
546
- * const positions = [new Cesium.Cartesian3(17832.12, 83234.52, 952313.73),
547
- * new Cesium.Cartesian3(17832.13, 83234.53, 952313.73),
548
- * new Cesium.Cartesian3(17832.14, 83234.54, 952313.73)]
549
- * const cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
550
- */
551
- Ellipsoid.prototype.cartesianArrayToCartographicArray = function (
552
- cartesians,
553
- result,
554
- ) {
555
- //>>includeStart('debug', pragmas.debug);
556
- Check.defined("cartesians", cartesians);
557
- //>>includeEnd('debug');
612
+ /**
613
+ * Computes a point which is the intersection of the surface normal with the z-axis.
614
+ *
615
+ * @param {Cartesian3} position the position. must be on the surface of the ellipsoid.
616
+ * @param {number} [buffer = 0.0] A buffer to subtract from the ellipsoid size when checking if the point is inside the ellipsoid.
617
+ * In earth case, with common earth datums, there is no need for this buffer since the intersection point is always (relatively) very close to the center.
618
+ * In WGS84 datum, intersection point is at max z = +-42841.31151331382 (0.673% of z-axis).
619
+ * Intersection point could be outside the ellipsoid if the ratio of MajorAxis / AxisOfRotation is bigger than the square root of 2
620
+ * @param {Cartesian3} [result] The cartesian to which to copy the result, or undefined to create and
621
+ * return a new instance.
622
+ * @returns {Cartesian3 | undefined} the intersection point if it's inside the ellipsoid, undefined otherwise
623
+ *
624
+ * @exception {DeveloperError} position is required.
625
+ * @exception {DeveloperError} Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y).
626
+ * @exception {DeveloperError} Ellipsoid.radii.z must be greater than 0.
627
+ */
628
+ getSurfaceNormalIntersectionWithZAxis(position, buffer, result) {
629
+ //>>includeStart('debug', pragmas.debug);
630
+ Check.typeOf.object("position", position);
558
631
 
559
- const length = cartesians.length;
560
- if (!defined(result)) {
561
- result = new Array(length);
562
- } else {
563
- result.length = length;
564
- }
565
- for (let i = 0; i < length; ++i) {
566
- result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
567
- }
568
- return result;
569
- };
632
+ if (
633
+ !CesiumMath.equalsEpsilon(
634
+ this._radii.x,
635
+ this._radii.y,
636
+ CesiumMath.EPSILON15,
637
+ )
638
+ ) {
639
+ throw new DeveloperError(
640
+ "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)",
641
+ );
642
+ }
570
643
 
571
- /**
572
- * Scales the provided Cartesian position along the geodetic surface normal
573
- * so that it is on the surface of this ellipsoid. If the position is
574
- * at the center of the ellipsoid, this function returns undefined.
575
- *
576
- * @param {Cartesian3} cartesian The Cartesian position to scale.
577
- * @param {Cartesian3} [result] The object onto which to store the result.
578
- * @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
579
- */
580
- Ellipsoid.prototype.scaleToGeodeticSurface = function (cartesian, result) {
581
- return scaleToGeodeticSurface(
582
- cartesian,
583
- this._oneOverRadii,
584
- this._oneOverRadiiSquared,
585
- this._centerToleranceSquared,
586
- result,
587
- );
588
- };
644
+ Check.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
645
+ //>>includeEnd('debug');
589
646
 
590
- /**
591
- * Scales the provided Cartesian position along the geocentric surface normal
592
- * so that it is on the surface of this ellipsoid.
593
- *
594
- * @param {Cartesian3} cartesian The Cartesian position to scale.
595
- * @param {Cartesian3} [result] The object onto which to store the result.
596
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
597
- */
598
- Ellipsoid.prototype.scaleToGeocentricSurface = function (cartesian, result) {
599
- //>>includeStart('debug', pragmas.debug);
600
- Check.typeOf.object("cartesian", cartesian);
601
- //>>includeEnd('debug');
647
+ buffer = buffer ?? 0.0;
602
648
 
603
- if (!defined(result)) {
604
- result = new Cartesian3();
605
- }
649
+ const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
606
650
 
607
- const positionX = cartesian.x;
608
- const positionY = cartesian.y;
609
- const positionZ = cartesian.z;
610
- const oneOverRadiiSquared = this._oneOverRadiiSquared;
651
+ if (!defined(result)) {
652
+ result = new Cartesian3();
653
+ }
611
654
 
612
- const beta =
613
- 1.0 /
614
- Math.sqrt(
615
- positionX * positionX * oneOverRadiiSquared.x +
616
- positionY * positionY * oneOverRadiiSquared.y +
617
- positionZ * positionZ * oneOverRadiiSquared.z,
618
- );
655
+ result.x = 0.0;
656
+ result.y = 0.0;
657
+ result.z = position.z * (1 - squaredXOverSquaredZ);
619
658
 
620
- return Cartesian3.multiplyByScalar(cartesian, beta, result);
621
- };
659
+ if (Math.abs(result.z) >= this._radii.z - buffer) {
660
+ return undefined;
661
+ }
622
662
 
623
- /**
624
- * Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
625
- * its components by the result of {@link Ellipsoid#oneOverRadii}.
626
- *
627
- * @param {Cartesian3} position The position to transform.
628
- * @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
629
- * return a new instance.
630
- * @returns {Cartesian3} The position expressed in the scaled space. The returned instance is the
631
- * one passed as the result parameter if it is not undefined, or a new instance of it is.
632
- */
633
- Ellipsoid.prototype.transformPositionToScaledSpace = function (
634
- position,
635
- result,
636
- ) {
637
- if (!defined(result)) {
638
- result = new Cartesian3();
663
+ return result;
664
+ }
665
+
666
+ /**
667
+ * Computes the ellipsoid curvatures at a given position on the surface.
668
+ *
669
+ * @param {Cartesian3} surfacePosition The position on the ellipsoid surface where curvatures will be calculated.
670
+ * @param {Cartesian2} [result] The cartesian to which to copy the result, or undefined to create and return a new instance.
671
+ * @returns {Cartesian2} The local curvature of the ellipsoid surface at the provided position, in east and north directions.
672
+ *
673
+ * @exception {DeveloperError} position is required.
674
+ */
675
+ getLocalCurvature(surfacePosition, result) {
676
+ //>>includeStart('debug', pragmas.debug);
677
+ Check.typeOf.object("surfacePosition", surfacePosition);
678
+ //>>includeEnd('debug');
679
+
680
+ if (!defined(result)) {
681
+ result = new Cartesian2();
682
+ }
683
+
684
+ const primeVerticalEndpoint = this.getSurfaceNormalIntersectionWithZAxis(
685
+ surfacePosition,
686
+ 0.0,
687
+ scratchEndpoint,
688
+ );
689
+ const primeVerticalRadius = Cartesian3.distance(
690
+ surfacePosition,
691
+ primeVerticalEndpoint,
692
+ );
693
+ // meridional radius = (1 - e^2) * primeVerticalRadius^3 / a^2
694
+ // where 1 - e^2 = b^2 / a^2,
695
+ // so meridional = b^2 * primeVerticalRadius^3 / a^4
696
+ // = (b * primeVerticalRadius / a^2)^2 * primeVertical
697
+ const radiusRatio =
698
+ (this.minimumRadius * primeVerticalRadius) / this.maximumRadius ** 2;
699
+ const meridionalRadius = primeVerticalRadius * radiusRatio ** 2;
700
+
701
+ return Cartesian2.fromElements(
702
+ 1.0 / primeVerticalRadius,
703
+ 1.0 / meridionalRadius,
704
+ result,
705
+ );
639
706
  }
640
707
 
641
- return Cartesian3.multiplyComponents(position, this._oneOverRadii, result);
642
- };
708
+ /**
709
+ * Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using
710
+ * Gauss-Legendre 10th order quadrature.
711
+ *
712
+ * @param {Rectangle} rectangle The rectangle used for computing the surface area.
713
+ * @returns {number} The approximate area of the rectangle on the surface of this ellipsoid.
714
+ */
715
+ surfaceArea(rectangle) {
716
+ //>>includeStart('debug', pragmas.debug);
717
+ Check.typeOf.object("rectangle", rectangle);
718
+ //>>includeEnd('debug');
719
+ const minLongitude = rectangle.west;
720
+ let maxLongitude = rectangle.east;
721
+ const minLatitude = rectangle.south;
722
+ const maxLatitude = rectangle.north;
723
+
724
+ while (maxLongitude < minLongitude) {
725
+ maxLongitude += CesiumMath.TWO_PI;
726
+ }
727
+
728
+ const radiiSquared = this._radiiSquared;
729
+ const a2 = radiiSquared.x;
730
+ const b2 = radiiSquared.y;
731
+ const c2 = radiiSquared.z;
732
+ const a2b2 = a2 * b2;
733
+ return gaussLegendreQuadrature(minLatitude, maxLatitude, function (lat) {
734
+ // phi represents the angle measured from the north pole
735
+ // sin(phi) = sin(pi / 2 - lat) = cos(lat), cos(phi) is similar
736
+ const sinPhi = Math.cos(lat);
737
+ const cosPhi = Math.sin(lat);
738
+ return (
739
+ Math.cos(lat) *
740
+ gaussLegendreQuadrature(minLongitude, maxLongitude, function (lon) {
741
+ const cosTheta = Math.cos(lon);
742
+ const sinTheta = Math.sin(lon);
743
+ return Math.sqrt(
744
+ a2b2 * cosPhi * cosPhi +
745
+ c2 *
746
+ (b2 * cosTheta * cosTheta + a2 * sinTheta * sinTheta) *
747
+ sinPhi *
748
+ sinPhi,
749
+ );
750
+ })
751
+ );
752
+ });
753
+ }
754
+ }
643
755
 
644
756
  /**
645
- * Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
646
- * its components by the result of {@link Ellipsoid#radii}.
757
+ * An Ellipsoid instance initialized to the WGS84 standard.
647
758
  *
648
- * @param {Cartesian3} position The position to transform.
649
- * @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
650
- * return a new instance.
651
- * @returns {Cartesian3} The position expressed in the unscaled space. The returned instance is the
652
- * one passed as the result parameter if it is not undefined, or a new instance of it is.
759
+ * @type {Ellipsoid}
760
+ * @constant
653
761
  */
654
- Ellipsoid.prototype.transformPositionFromScaledSpace = function (
655
- position,
656
- result,
657
- ) {
658
- if (!defined(result)) {
659
- result = new Cartesian3();
660
- }
661
-
662
- return Cartesian3.multiplyComponents(position, this._radii, result);
663
- };
762
+ Ellipsoid.WGS84 = Object.freeze(
763
+ new Ellipsoid(6378137.0, 6378137.0, 6356752.3142451793),
764
+ );
664
765
 
665
766
  /**
666
- * Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
667
- * <code>true</code> if they are equal, <code>false</code> otherwise.
767
+ * An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
668
768
  *
669
- * @param {Ellipsoid} [right] The other Ellipsoid.
670
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
769
+ * @type {Ellipsoid}
770
+ * @constant
671
771
  */
672
- Ellipsoid.prototype.equals = function (right) {
673
- return (
674
- this === right ||
675
- (defined(right) && Cartesian3.equals(this._radii, right._radii))
676
- );
677
- };
772
+ Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1.0, 1.0, 1.0));
678
773
 
679
774
  /**
680
- * Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
775
+ * An Ellipsoid instance initialized to a sphere with the lunar radius.
681
776
  *
682
- * @returns {string} A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
777
+ * @type {Ellipsoid}
778
+ * @constant
683
779
  */
684
- Ellipsoid.prototype.toString = function () {
685
- return this._radii.toString();
686
- };
780
+ Ellipsoid.MOON = Object.freeze(
781
+ new Ellipsoid(
782
+ CesiumMath.LUNAR_RADIUS,
783
+ CesiumMath.LUNAR_RADIUS,
784
+ CesiumMath.LUNAR_RADIUS,
785
+ ),
786
+ );
687
787
 
688
788
  /**
689
- * Computes a point which is the intersection of the surface normal with the z-axis.
690
- *
691
- * @param {Cartesian3} position the position. must be on the surface of the ellipsoid.
692
- * @param {number} [buffer = 0.0] A buffer to subtract from the ellipsoid size when checking if the point is inside the ellipsoid.
693
- * In earth case, with common earth datums, there is no need for this buffer since the intersection point is always (relatively) very close to the center.
694
- * In WGS84 datum, intersection point is at max z = +-42841.31151331382 (0.673% of z-axis).
695
- * Intersection point could be outside the ellipsoid if the ratio of MajorAxis / AxisOfRotation is bigger than the square root of 2
696
- * @param {Cartesian3} [result] The cartesian to which to copy the result, or undefined to create and
697
- * return a new instance.
698
- * @returns {Cartesian3 | undefined} the intersection point if it's inside the ellipsoid, undefined otherwise
789
+ * An Ellipsoid instance initialized to a sphere with the mean radii of Mars.
790
+ * Source: https://epsg.io/104905
699
791
  *
700
- * @exception {DeveloperError} position is required.
701
- * @exception {DeveloperError} Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y).
702
- * @exception {DeveloperError} Ellipsoid.radii.z must be greater than 0.
792
+ * @type {Ellipsoid}
793
+ * @constant
703
794
  */
704
- Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function (
705
- position,
706
- buffer,
707
- result,
708
- ) {
709
- //>>includeStart('debug', pragmas.debug);
710
- Check.typeOf.object("position", position);
711
-
712
- if (
713
- !CesiumMath.equalsEpsilon(
714
- this._radii.x,
715
- this._radii.y,
716
- CesiumMath.EPSILON15,
717
- )
718
- ) {
719
- throw new DeveloperError(
720
- "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)",
721
- );
722
- }
723
-
724
- Check.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
725
- //>>includeEnd('debug');
726
-
727
- buffer = buffer ?? 0.0;
728
-
729
- const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
730
-
731
- if (!defined(result)) {
732
- result = new Cartesian3();
733
- }
734
-
735
- result.x = 0.0;
736
- result.y = 0.0;
737
- result.z = position.z * (1 - squaredXOverSquaredZ);
738
-
739
- if (Math.abs(result.z) >= this._radii.z - buffer) {
740
- return undefined;
741
- }
795
+ Ellipsoid.MARS = Object.freeze(new Ellipsoid(3396190.0, 3396190.0, 3376200.0));
742
796
 
743
- return result;
744
- };
797
+ Ellipsoid._default = Ellipsoid.WGS84;
745
798
 
746
- const scratchEndpoint = new Cartesian3();
799
+ /**
800
+ * The number of elements used to pack the object into an array.
801
+ * @type {number}
802
+ */
803
+ Ellipsoid.packedLength = Cartesian3.packedLength;
747
804
 
748
805
  /**
749
- * Computes the ellipsoid curvatures at a given position on the surface.
750
- *
751
- * @param {Cartesian3} surfacePosition The position on the ellipsoid surface where curvatures will be calculated.
752
- * @param {Cartesian2} [result] The cartesian to which to copy the result, or undefined to create and return a new instance.
753
- * @returns {Cartesian2} The local curvature of the ellipsoid surface at the provided position, in east and north directions.
806
+ * Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
807
+ * @function
754
808
  *
755
- * @exception {DeveloperError} position is required.
809
+ * @param {Cartesian3} cartesian The Cartesian for which to to determine the geocentric normal.
810
+ * @param {Cartesian3} [result] The object onto which to store the result.
811
+ * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
756
812
  */
757
- Ellipsoid.prototype.getLocalCurvature = function (surfacePosition, result) {
758
- //>>includeStart('debug', pragmas.debug);
759
- Check.typeOf.object("surfacePosition", surfacePosition);
760
- //>>includeEnd('debug');
813
+ Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3.normalize;
761
814
 
762
- if (!defined(result)) {
763
- result = new Cartesian2();
764
- }
815
+ const cartographicToCartesianNormal = new Cartesian3();
816
+ const cartographicToCartesianK = new Cartesian3();
765
817
 
766
- const primeVerticalEndpoint = this.getSurfaceNormalIntersectionWithZAxis(
767
- surfacePosition,
768
- 0.0,
769
- scratchEndpoint,
770
- );
771
- const primeVerticalRadius = Cartesian3.distance(
772
- surfacePosition,
773
- primeVerticalEndpoint,
774
- );
775
- // meridional radius = (1 - e^2) * primeVerticalRadius^3 / a^2
776
- // where 1 - e^2 = b^2 / a^2,
777
- // so meridional = b^2 * primeVerticalRadius^3 / a^4
778
- // = (b * primeVerticalRadius / a^2)^2 * primeVertical
779
- const radiusRatio =
780
- (this.minimumRadius * primeVerticalRadius) / this.maximumRadius ** 2;
781
- const meridionalRadius = primeVerticalRadius * radiusRatio ** 2;
782
-
783
- return Cartesian2.fromElements(
784
- 1.0 / primeVerticalRadius,
785
- 1.0 / meridionalRadius,
786
- result,
787
- );
788
- };
818
+ const cartesianToCartographicN = new Cartesian3();
819
+ const cartesianToCartographicP = new Cartesian3();
820
+ const cartesianToCartographicH = new Cartesian3();
821
+
822
+ const scratchEndpoint = new Cartesian3();
789
823
 
790
824
  const abscissas = [
791
825
  0.14887433898163, 0.43339539412925, 0.67940956829902, 0.86506336668898,
@@ -801,7 +835,7 @@ const weights = [
801
835
  *
802
836
  * @param {number} a The lower bound for the integration.
803
837
  * @param {number} b The upper bound for the integration.
804
- * @param {Ellipsoid~RealValuedScalarFunction} func The function to integrate.
838
+ * @param {EllipsoidRealValuedScalarFunction} func The function to integrate.
805
839
  * @returns {number} The value of the integral of the given function over the given domain.
806
840
  *
807
841
  * @private
@@ -829,61 +863,4 @@ function gaussLegendreQuadrature(a, b, func) {
829
863
  return sum;
830
864
  }
831
865
 
832
- /**
833
- * A real valued scalar function.
834
- * @callback Ellipsoid~RealValuedScalarFunction
835
- *
836
- * @param {number} x The value used to evaluate the function.
837
- * @returns {number} The value of the function at x.
838
- *
839
- * @private
840
- */
841
-
842
- /**
843
- * Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using
844
- * Gauss-Legendre 10th order quadrature.
845
- *
846
- * @param {Rectangle} rectangle The rectangle used for computing the surface area.
847
- * @returns {number} The approximate area of the rectangle on the surface of this ellipsoid.
848
- */
849
- Ellipsoid.prototype.surfaceArea = function (rectangle) {
850
- //>>includeStart('debug', pragmas.debug);
851
- Check.typeOf.object("rectangle", rectangle);
852
- //>>includeEnd('debug');
853
- const minLongitude = rectangle.west;
854
- let maxLongitude = rectangle.east;
855
- const minLatitude = rectangle.south;
856
- const maxLatitude = rectangle.north;
857
-
858
- while (maxLongitude < minLongitude) {
859
- maxLongitude += CesiumMath.TWO_PI;
860
- }
861
-
862
- const radiiSquared = this._radiiSquared;
863
- const a2 = radiiSquared.x;
864
- const b2 = radiiSquared.y;
865
- const c2 = radiiSquared.z;
866
- const a2b2 = a2 * b2;
867
- return gaussLegendreQuadrature(minLatitude, maxLatitude, function (lat) {
868
- // phi represents the angle measured from the north pole
869
- // sin(phi) = sin(pi / 2 - lat) = cos(lat), cos(phi) is similar
870
- const sinPhi = Math.cos(lat);
871
- const cosPhi = Math.sin(lat);
872
- return (
873
- Math.cos(lat) *
874
- gaussLegendreQuadrature(minLongitude, maxLongitude, function (lon) {
875
- const cosTheta = Math.cos(lon);
876
- const sinTheta = Math.sin(lon);
877
- return Math.sqrt(
878
- a2b2 * cosPhi * cosPhi +
879
- c2 *
880
- (b2 * cosTheta * cosTheta + a2 * sinTheta * sinTheta) *
881
- sinPhi *
882
- sinPhi,
883
- );
884
- })
885
- );
886
- });
887
- };
888
-
889
866
  export default Ellipsoid;