@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.
- package/Build/Workers/{chunk-ZEMJQKHD.js → chunk-35H3UBIO.js} +13 -12
- package/Build/Workers/{chunk-PQTSXJBJ.js → chunk-3LSD7OOA.js} +16 -16
- package/Build/Workers/{chunk-PUO7BYDY.js → chunk-3RFFPH4M.js} +1 -1
- package/Build/Workers/{chunk-PBECJOWF.js → chunk-3TKLDHV3.js} +2 -2
- package/Build/Workers/{chunk-TMCTZ5E3.js → chunk-3VDDRF2E.js} +14 -14
- package/Build/Workers/{chunk-FKU77FNM.js → chunk-3XY3MVPG.js} +4 -4
- package/Build/Workers/{chunk-2OBWHTIC.js → chunk-4GF4MVPY.js} +7 -7
- package/Build/Workers/{chunk-JUKGMJX7.js → chunk-4MTRQFJP.js} +3 -2
- package/Build/Workers/{chunk-66OWUDO7.js → chunk-4QQXGTCE.js} +8 -8
- package/Build/Workers/{chunk-ALTCIHRH.js → chunk-4XXHJI6Y.js} +17 -17
- package/Build/Workers/{chunk-K7UTK4OM.js → chunk-5T6QQAJW.js} +3 -2
- package/Build/Workers/{chunk-IJ3SUMK3.js → chunk-6SDGQI27.js} +3 -2
- package/Build/Workers/{chunk-FXSRA5UG.js → chunk-77RL3MBD.js} +6 -5
- package/Build/Workers/{chunk-G6MJ3ZW3.js → chunk-7LSFAEWF.js} +12 -11
- package/Build/Workers/{chunk-C6HHBKT5.js → chunk-A7A433MD.js} +5 -5
- package/Build/Workers/{chunk-PGZ3B6CB.js → chunk-A7ZBMVFS.js} +14 -14
- package/Build/Workers/{chunk-OZYB3AOR.js → chunk-ACFFCHHZ.js} +11 -11
- package/Build/Workers/{chunk-DNMASBMH.js → chunk-AEAVLYPS.js} +2 -2
- package/Build/Workers/{chunk-VPWYHFQA.js → chunk-AWFZHD2B.js} +4 -4
- package/Build/Workers/{chunk-TFPG3ZKW.js → chunk-BTX2NL3P.js} +59 -46
- package/Build/Workers/{chunk-TNXOPEIG.js → chunk-BVAIWR7O.js} +12 -12
- package/Build/Workers/chunk-CKQP3DSS.js +973 -0
- package/Build/Workers/{chunk-N6HRZLS6.js → chunk-CZ23Y3RM.js} +2 -2
- package/Build/Workers/{chunk-EIC3VAOZ.js → chunk-DFEI5MAV.js} +7 -7
- package/Build/Workers/{chunk-BTP3634E.js → chunk-DH26SNAB.js} +4 -1
- package/Build/Workers/{chunk-TXYQNXNW.js → chunk-DYT5NR6P.js} +3 -3
- package/Build/Workers/{chunk-O67UP5YO.js → chunk-EZARA5FJ.js} +13 -13
- package/Build/Workers/{chunk-YSJRB2UZ.js → chunk-FIBS5S7R.js} +2 -2
- package/Build/Workers/{chunk-2M7DKGLW.js → chunk-FVLVVOBQ.js} +10 -10
- package/Build/Workers/{chunk-B2VA6IEL.js → chunk-GL7DNVUS.js} +5 -5
- package/Build/Workers/{chunk-77DJBHMI.js → chunk-GPIGURCG.js} +59 -32
- package/Build/Workers/{chunk-QPXGGVHC.js → chunk-H2A4USJR.js} +10 -10
- package/Build/Workers/chunk-HSVQATK2.js +147 -0
- package/Build/Workers/{chunk-HXEPZWJN.js → chunk-HVMG6AG4.js} +11 -10
- package/Build/Workers/{chunk-H3TVRJLY.js → chunk-I3A6DXYZ.js} +4 -4
- package/Build/Workers/{chunk-UEWYSOFD.js → chunk-ITD2IN7N.js} +2 -2
- package/Build/Workers/{chunk-CYOPNGPX.js → chunk-J3OFS2RD.js} +12 -12
- package/Build/Workers/{chunk-RZX6LOG6.js → chunk-J647NNZW.js} +6 -6
- package/Build/Workers/{chunk-GLCPE2BJ.js → chunk-J7KQEKPK.js} +13 -13
- package/Build/Workers/{chunk-XPMXRJDD.js → chunk-K6NFIRFB.js} +5 -5
- package/Build/Workers/{chunk-CID5SY7L.js → chunk-LH5SF3XV.js} +7 -6
- package/Build/Workers/{chunk-UOQB7XQI.js → chunk-ND3NTTOF.js} +713 -435
- package/Build/Workers/chunk-QO2CGXMP.js +2342 -0
- package/Build/Workers/chunk-QSDY4NS7.js +1287 -0
- package/Build/Workers/chunk-QXNQQYPV.js +3201 -0
- package/Build/Workers/{chunk-CJ7ZDY77.js → chunk-ST2UWDUU.js} +5 -5
- package/Build/Workers/{chunk-YDR5LX5Z.js → chunk-TA777BGS.js} +3 -2
- package/Build/Workers/{chunk-U4SWB6TI.js → chunk-TAI4HLII.js} +4 -4
- package/Build/Workers/{chunk-VX774SWE.js → chunk-URUCCIPS.js} +6 -6
- package/Build/Workers/{chunk-MNSNOONX.js → chunk-VQKLRBIK.js} +7 -7
- package/Build/Workers/{chunk-CVAAIRNP.js → chunk-WC57YYBN.js} +2 -2
- package/Build/Workers/{chunk-QNABVTTP.js → chunk-WN6P5UDH.js} +12 -12
- package/Build/Workers/{chunk-CNLXMOPM.js → chunk-WNN5D4W3.js} +12 -11
- package/Build/Workers/{chunk-4JJQRZYL.js → chunk-WTQGE7Q6.js} +17 -17
- package/Build/Workers/{chunk-FCJQO4NC.js → chunk-WUBKZFF6.js} +2213 -1349
- package/Build/Workers/{chunk-3UQ2YMPP.js → chunk-ZAPOS52G.js} +12 -10
- package/Build/Workers/{chunk-LHFC4R7Z.js → chunk-ZCCIIBZT.js} +6 -6
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +175 -118
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +24 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +25 -25
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +12 -12
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +12 -9
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcType.js +6 -1
- package/Source/Core/ArticulationStageType.js +5 -1
- package/Source/Core/AssociativeArray.js +100 -94
- package/Source/Core/BoundingSphere.js +1296 -1300
- package/Source/Core/Cartesian2.js +7 -5
- package/Source/Core/Cartesian3.js +9 -8
- package/Source/Core/Cartesian4.js +8 -6
- package/Source/Core/Cartographic.js +257 -249
- package/Source/Core/ClockRange.js +6 -1
- package/Source/Core/ClockStep.js +6 -1
- package/Source/Core/Color.js +846 -835
- package/Source/Core/ComponentDatatype.js +4 -1
- package/Source/Core/CornerType.js +6 -1
- package/Source/Core/Credit.js +121 -124
- package/Source/Core/DeveloperError.js +2 -1
- package/Source/Core/Ellipsoid.js +637 -660
- package/Source/Core/ExtrapolationType.js +6 -1
- package/Source/Core/GeocodeType.js +6 -1
- package/Source/Core/GeographicProjection.js +74 -74
- package/Source/Core/GeographicTilingScheme.js +179 -198
- package/Source/Core/GeometryOffsetAttribute.js +7 -1
- package/Source/Core/GeometryType.js +7 -1
- package/Source/Core/HeightmapEncoding.js +6 -1
- package/Source/Core/ITwinPlatform.js +1 -0
- package/Source/Core/Iau2006XysData.js +24 -13
- package/Source/Core/IndexDatatype.js +3 -1
- package/Source/Core/InterpolationType.js +5 -1
- package/Source/Core/Intersect.js +6 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocodeProviderType.js +5 -1
- package/Source/Core/JulianDate.js +850 -848
- package/Source/Core/KeyboardEventModifier.js +6 -1
- package/Source/Core/MapProjection.js +39 -44
- package/Source/Core/Matrix2.js +906 -893
- package/Source/Core/Matrix3.js +1643 -1575
- package/Source/Core/Matrix4.js +2903 -2872
- package/Source/Core/PixelFormat.js +3 -1
- package/Source/Core/PrimitiveType.js +11 -1
- package/Source/Core/Ray.js +62 -60
- package/Source/Core/Rectangle.js +913 -904
- package/Source/Core/ReferenceFrame.js +6 -1
- package/Source/Core/RequestScheduler.js +8 -3
- package/Source/Core/RequestState.js +6 -1
- package/Source/Core/RequestType.js +6 -1
- package/Source/Core/S2Cell.js +2 -2
- package/Source/Core/ScreenSpaceEventType.js +6 -1
- package/Source/Core/TerrainMesh.js +10 -1
- package/Source/Core/TerrainPicker.js +1 -0
- package/Source/Core/TerrainQuantization.js +6 -1
- package/Source/Core/TilingScheme.js +100 -98
- package/Source/Core/TimeConstants.js +6 -1
- package/Source/Core/TimeStandard.js +6 -1
- package/Source/Core/TrackingReferenceFrame.js +6 -1
- package/Source/Core/Visibility.js +6 -1
- package/Source/Core/VulkanConstants.js +6 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/WebGLConstants.js +6 -1
- package/Source/Core/WebMercatorProjection.js +108 -109
- package/Source/Core/WebMercatorTilingScheme.js +246 -242
- package/Source/Core/WindingOrder.js +3 -1
- package/Source/Core/assert.js +27 -0
- package/Source/Core/globalTypes.js +4 -0
- package/Source/DataSources/CzmlDataSource.js +9 -0
- package/Source/DataSources/PathGraphics.js +13 -0
- package/Source/DataSources/PathVisualizer.js +330 -18
- package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +4 -1
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +4 -1
- package/Source/DataSources/StripeOrientation.js +6 -1
- package/Source/Renderer/BufferUsage.js +20 -9
- package/Source/Renderer/Context.js +2 -29
- package/Source/Renderer/DrawCommand.js +435 -403
- package/Source/Renderer/MipmapHint.js +5 -1
- package/Source/Renderer/Pass.js +7 -1
- package/Source/Renderer/PickId.js +44 -0
- package/Source/Renderer/PixelDatatype.js +3 -1
- package/Source/Renderer/RenderState.js +2 -2
- package/Source/Renderer/RenderbufferFormat.js +5 -1
- package/Source/Renderer/ShaderDestination.js +4 -1
- package/Source/Renderer/TextureMagnificationFilter.js +3 -1
- package/Source/Renderer/TextureMinificationFilter.js +3 -1
- package/Source/Renderer/TextureWrap.js +5 -1
- package/Source/Renderer/VertexArray.js +80 -0
- package/Source/Scene/AlphaMode.js +5 -1
- package/Source/Scene/ArcGisBaseMapType.js +6 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/AttributeType.js +3 -1
- package/Source/Scene/Axis.js +3 -1
- package/Source/Scene/BillboardCollection.js +65 -364
- package/Source/Scene/BingMapsStyle.js +6 -1
- package/Source/Scene/BlendEquation.js +6 -1
- package/Source/Scene/BlendFunction.js +6 -1
- package/Source/Scene/BlendOption.js +6 -1
- package/Source/Scene/BlendingState.js +6 -1
- package/Source/Scene/BufferLoader.js +0 -2
- package/Source/Scene/BufferPoint.js +148 -0
- package/Source/Scene/BufferPointCollection.js +138 -0
- package/Source/Scene/BufferPointMaterial.js +95 -0
- package/Source/Scene/BufferPolygon.js +516 -0
- package/Source/Scene/BufferPolygonCollection.js +370 -0
- package/Source/Scene/BufferPolygonMaterial.js +41 -0
- package/Source/Scene/BufferPolyline.js +185 -0
- package/Source/Scene/BufferPolylineCollection.js +138 -0
- package/Source/Scene/BufferPolylineMaterial.js +93 -0
- package/Source/Scene/BufferPrimitive.js +347 -0
- package/Source/Scene/BufferPrimitiveCollection.js +818 -0
- package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
- package/Source/Scene/CameraEventType.js +6 -1
- package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
- package/Source/Scene/Cesium3DTileContent.js +5 -1
- package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
- package/Source/Scene/Cesium3DTileContentState.js +6 -1
- package/Source/Scene/Cesium3DTileContentType.js +3 -1
- package/Source/Scene/Cesium3DTileFeature.js +289 -306
- package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
- package/Source/Scene/Cesium3DTilePass.js +5 -1
- package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
- package/Source/Scene/Cesium3DTileRefine.js +6 -1
- package/Source/Scene/Cesium3DTileStyle.js +22 -0
- package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
- package/Source/Scene/Cesium3DTileset.js +2 -1
- package/Source/Scene/ClassificationType.js +3 -1
- package/Source/Scene/ClippingPolygonCollection.js +270 -101
- package/Source/Scene/CloudType.js +3 -1
- package/Source/Scene/ColorBlendMode.js +4 -1
- package/Source/Scene/CubeMapPanorama.js +4 -4
- package/Source/Scene/CullFace.js +6 -1
- package/Source/Scene/DepthFunction.js +6 -1
- package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
- package/Source/Scene/EquirectangularPanorama.js +1 -0
- package/Source/Scene/ExpressionNodeType.js +6 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
- package/Source/Scene/GaussianSplatPrimitive.js +413 -70
- package/Source/Scene/GetFeatureInfoFormat.js +3 -3
- package/Source/Scene/GltfBufferViewLoader.js +0 -2
- package/Source/Scene/GltfDracoLoader.js +0 -2
- package/Source/Scene/GltfImageLoader.js +0 -3
- package/Source/Scene/GltfIndexBufferLoader.js +0 -4
- package/Source/Scene/GltfJsonLoader.js +0 -2
- package/Source/Scene/GltfLoader.js +215 -39
- package/Source/Scene/GltfLoaderUtil.js +14 -0
- package/Source/Scene/GltfSpzLoader.js +109 -2
- package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
- package/Source/Scene/GltfTextureLoader.js +0 -2
- package/Source/Scene/GltfVertexBufferLoader.js +0 -4
- package/Source/Scene/HeightReference.js +5 -1
- package/Source/Scene/HorizontalOrigin.js +6 -1
- package/Source/Scene/ITwinData.js +1 -0
- package/Source/Scene/ImageryProvider.js +1 -1
- package/Source/Scene/ImageryState.js +6 -1
- package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
- package/Source/Scene/InstanceAttributeSemantic.js +3 -1
- package/Source/Scene/IonWorldImageryStyle.js +6 -1
- package/Source/Scene/JobType.js +6 -1
- package/Source/Scene/Label.js +32 -0
- package/Source/Scene/LabelCollection.js +14 -13
- package/Source/Scene/LabelStyle.js +6 -1
- package/Source/Scene/MapMode2D.js +6 -1
- package/Source/Scene/Material.js +2 -0
- package/Source/Scene/Megatexture.js +1 -0
- package/Source/Scene/MetadataClassProperty.js +24 -10
- package/Source/Scene/MetadataComponentType.js +118 -24
- package/Source/Scene/MetadataSchemaLoader.js +0 -2
- package/Source/Scene/MetadataSemantic.js +6 -2
- package/Source/Scene/MetadataType.js +3 -1
- package/Source/Scene/Model/B3dmLoader.js +0 -3
- package/Source/Scene/Model/CustomShaderMode.js +3 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
- package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +735 -264
- package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
- package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
- package/Source/Scene/Model/GeoJsonLoader.js +0 -2
- package/Source/Scene/Model/I3dmLoader.js +0 -3
- package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
- package/Source/Scene/Model/LightingModel.js +5 -1
- package/Source/Scene/Model/MaterialPipelineStage.js +331 -3
- package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +6 -0
- package/Source/Scene/Model/ModelReader.js +475 -4
- package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
- package/Source/Scene/Model/ModelType.js +3 -1
- package/Source/Scene/Model/ModelUtility.js +3 -1
- package/Source/Scene/Model/PntsLoader.js +4 -3
- package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
- package/Source/Scene/Model/UniformType.js +5 -1
- package/Source/Scene/Model/VaryingType.js +5 -1
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +375 -0
- package/Source/Scene/Model/pickModel.js +94 -299
- package/Source/Scene/ModelAnimationLoop.js +6 -1
- package/Source/Scene/ModelAnimationState.js +6 -1
- package/Source/Scene/ModelComponents.js +1639 -1542
- package/Source/Scene/PickedMetadataInfo.js +1 -0
- package/Source/Scene/PrimitiveState.js +7 -1
- package/Source/Scene/QuadtreeOccluders.js +20 -15
- package/Source/Scene/QuadtreeTile.js +547 -541
- package/Source/Scene/QuadtreeTileLoadState.js +6 -1
- package/Source/Scene/QuadtreeTileProvider.js +159 -175
- package/Source/Scene/ResourceLoader.js +0 -1
- package/Source/Scene/ResourceLoaderState.js +7 -1
- package/Source/Scene/SceneMode.js +4 -1
- package/Source/Scene/ScreenSpaceCameraController.js +13 -0
- package/Source/Scene/ShadowMode.js +3 -1
- package/Source/Scene/SkyBox.js +17 -8
- package/Source/Scene/SplitDirection.js +6 -1
- package/Source/Scene/StencilFunction.js +6 -1
- package/Source/Scene/StencilOperation.js +6 -1
- package/Source/Scene/TerrainState.js +7 -1
- package/Source/Scene/TileBoundingRegion.js +1 -1
- package/Source/Scene/TileBoundingS2Cell.js +1 -1
- package/Source/Scene/TileBoundingSphere.js +1 -1
- package/Source/Scene/TileState.js +7 -1
- package/Source/Scene/Tonemapper.js +5 -1
- package/Source/Scene/TweenCollection.js +7 -0
- package/Source/Scene/VectorGltf3DTileContent.js +403 -0
- package/Source/Scene/VertexAttributeSemantic.js +17 -1
- package/Source/Scene/VerticalOrigin.js +6 -1
- package/Source/Scene/VoxelBoxShape.js +12 -6
- package/Source/Scene/VoxelContent.js +2 -0
- package/Source/Scene/VoxelCylinderShape.js +39 -38
- package/Source/Scene/VoxelEllipsoidShape.js +46 -96
- package/Source/Scene/VoxelMetadataOrder.js +6 -1
- package/Source/Scene/VoxelProvider.js +1 -0
- package/Source/Scene/VoxelShapeType.js +3 -1
- package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
- package/Source/Scene/parseStructuralMetadata.js +97 -37
- package/Source/Scene/renderBufferPointCollection.js +285 -0
- package/Source/Scene/renderBufferPolygonCollection.js +339 -0
- package/Source/Scene/renderBufferPolylineCollection.js +478 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
- package/Source/Shaders/BillboardCollectionFS.js +2 -77
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
- package/Source/Shaders/BillboardCollectionVS.js +2 -60
- package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
- package/Source/Shaders/BufferPointMaterialFS.js +29 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
- package/Source/Shaders/BufferPointMaterialVS.js +50 -0
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
- package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
- package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
- package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
- package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
- package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
- package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
- package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
- package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
- package/Source/Shaders/Model/MaterialStageFS.js +46 -20
- package/Source/Shaders/Model/ModelFS.glsl +15 -0
- package/Source/Shaders/Model/ModelFS.js +15 -0
- package/Source/Shaders/Model/ModelVS.glsl +8 -0
- package/Source/Shaders/Model/ModelVS.js +8 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
- package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
- package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
- package/Source/Shaders/Voxels/VoxelFS.js +1 -1
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
- package/Source/Widget/CesiumWidget.js +11 -4
- package/Source/Workers/decodeDraco.js +3 -0
- package/Source/Workers/decodeI3S.js +5 -2
- package/index.d.ts +1332 -402
- package/index.js +111 -81
- package/package.json +3 -3
- package/Build/Workers/chunk-54O3AGOA.js +0 -642
- package/Build/Workers/chunk-6U5QMZU3.js +0 -940
- package/Build/Workers/chunk-HNDE73JK.js +0 -1829
- package/Build/Workers/chunk-PAFMAR7A.js +0 -2357
- package/Build/Workers/chunk-S53HSRT6.js +0 -114
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.141.0
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -26,34 +26,34 @@
|
|
|
26
26
|
import {
|
|
27
27
|
Cartesian4_default,
|
|
28
28
|
Matrix4_default
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-QXNQQYPV.js";
|
|
30
30
|
import {
|
|
31
31
|
RuntimeError_default
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-3TKLDHV3.js";
|
|
33
33
|
import {
|
|
34
34
|
Cartesian2_default,
|
|
35
35
|
Cartographic_default,
|
|
36
36
|
Ellipsoid_default,
|
|
37
37
|
FeatureDetection_default
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ND3NTTOF.js";
|
|
39
39
|
import {
|
|
40
40
|
Cartesian3_default,
|
|
41
41
|
Frozen_default,
|
|
42
42
|
Matrix3_default
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-QO2CGXMP.js";
|
|
44
44
|
import {
|
|
45
45
|
Math_default
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-DYT5NR6P.js";
|
|
47
47
|
import {
|
|
48
48
|
Check_default,
|
|
49
49
|
DeveloperError_default
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-CZ23Y3RM.js";
|
|
51
51
|
import {
|
|
52
52
|
__commonJS,
|
|
53
53
|
__require,
|
|
54
54
|
__toESM,
|
|
55
55
|
defined_default
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-DH26SNAB.js";
|
|
57
57
|
|
|
58
58
|
// node_modules/urijs/src/punycode.js
|
|
59
59
|
var require_punycode = __commonJS({
|
|
@@ -2747,7 +2747,8 @@ var TimeConstants = {
|
|
|
2747
2747
|
*/
|
|
2748
2748
|
MODIFIED_JULIAN_DATE_DIFFERENCE: 24000005e-1
|
|
2749
2749
|
};
|
|
2750
|
-
|
|
2750
|
+
Object.freeze(TimeConstants);
|
|
2751
|
+
var TimeConstants_default = TimeConstants;
|
|
2751
2752
|
|
|
2752
2753
|
// packages/engine/Source/Core/TimeStandard.js
|
|
2753
2754
|
var TimeStandard = {
|
|
@@ -2771,7 +2772,8 @@ var TimeStandard = {
|
|
|
2771
2772
|
*/
|
|
2772
2773
|
TAI: 1
|
|
2773
2774
|
};
|
|
2774
|
-
|
|
2775
|
+
Object.freeze(TimeStandard);
|
|
2776
|
+
var TimeStandard_default = TimeStandard;
|
|
2775
2777
|
|
|
2776
2778
|
// packages/engine/Source/Core/JulianDate.js
|
|
2777
2779
|
var gregorianDateScratch = new GregorianDate_default();
|
|
@@ -2885,527 +2887,738 @@ var matchHours = /^(\d{2})(\.\d+)?/.source + utcOffset.source;
|
|
|
2885
2887
|
var matchHoursMinutes = /^(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
|
|
2886
2888
|
var matchHoursMinutesSeconds = /^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
|
|
2887
2889
|
var iso8601ErrorMessage = "Invalid ISO 8601 date.";
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
date.year,
|
|
2907
|
-
date.month,
|
|
2908
|
-
date.day,
|
|
2909
|
-
date.hour,
|
|
2910
|
-
date.minute,
|
|
2911
|
-
date.second,
|
|
2912
|
-
date.millisecond
|
|
2913
|
-
);
|
|
2914
|
-
if (!defined_default(result)) {
|
|
2915
|
-
return new JulianDate(components[0], components[1], TimeStandard_default.UTC);
|
|
2890
|
+
var JulianDate = class _JulianDate {
|
|
2891
|
+
/**
|
|
2892
|
+
* @param {number} [julianDayNumber=0.0] The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
|
|
2893
|
+
* @param {number} [secondsOfDay=0.0] The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.
|
|
2894
|
+
* @param {TimeStandard} [timeStandard=TimeStandard.UTC] The time standard in which the first two parameters are defined.
|
|
2895
|
+
*/
|
|
2896
|
+
constructor(julianDayNumber, secondsOfDay, timeStandard) {
|
|
2897
|
+
this.dayNumber = void 0;
|
|
2898
|
+
this.secondsOfDay = void 0;
|
|
2899
|
+
julianDayNumber = julianDayNumber ?? 0;
|
|
2900
|
+
secondsOfDay = secondsOfDay ?? 0;
|
|
2901
|
+
timeStandard = timeStandard ?? TimeStandard_default.UTC;
|
|
2902
|
+
const wholeDays = julianDayNumber | 0;
|
|
2903
|
+
secondsOfDay = secondsOfDay + (julianDayNumber - wholeDays) * TimeConstants_default.SECONDS_PER_DAY;
|
|
2904
|
+
setComponents(wholeDays, secondsOfDay, this);
|
|
2905
|
+
if (timeStandard === TimeStandard_default.UTC) {
|
|
2906
|
+
convertUtcToTai(this);
|
|
2907
|
+
}
|
|
2916
2908
|
}
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
}
|
|
2921
|
-
JulianDate
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
date
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2909
|
+
/**
|
|
2910
|
+
* Creates a new instance from a GregorianDate.
|
|
2911
|
+
*
|
|
2912
|
+
* @param {GregorianDate} date A GregorianDate.
|
|
2913
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
2914
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
|
|
2915
|
+
*
|
|
2916
|
+
* @exception {DeveloperError} date must be a valid GregorianDate.
|
|
2917
|
+
*/
|
|
2918
|
+
static fromGregorianDate(date, result) {
|
|
2919
|
+
if (!(date instanceof GregorianDate_default)) {
|
|
2920
|
+
throw new DeveloperError_default("date must be a valid GregorianDate.");
|
|
2921
|
+
}
|
|
2922
|
+
const components = computeJulianDateComponents(
|
|
2923
|
+
date.year,
|
|
2924
|
+
date.month,
|
|
2925
|
+
date.day,
|
|
2926
|
+
date.hour,
|
|
2927
|
+
date.minute,
|
|
2928
|
+
date.second,
|
|
2929
|
+
date.millisecond
|
|
2930
|
+
);
|
|
2931
|
+
if (!defined_default(result)) {
|
|
2932
|
+
return new _JulianDate(components[0], components[1], TimeStandard_default.UTC);
|
|
2933
|
+
}
|
|
2934
|
+
setComponents(components[0], components[1], result);
|
|
2935
|
+
convertUtcToTai(result);
|
|
2936
|
+
return result;
|
|
2936
2937
|
}
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
}
|
|
2941
|
-
JulianDate
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2938
|
+
/**
|
|
2939
|
+
* Creates a new instance from a JavaScript Date.
|
|
2940
|
+
*
|
|
2941
|
+
* @param {Date} date A JavaScript Date.
|
|
2942
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
2943
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
|
|
2944
|
+
*
|
|
2945
|
+
* @exception {DeveloperError} date must be a valid JavaScript Date.
|
|
2946
|
+
*/
|
|
2947
|
+
static fromDate(date, result) {
|
|
2948
|
+
if (!(date instanceof Date) || isNaN(date.getTime())) {
|
|
2949
|
+
throw new DeveloperError_default("date must be a valid JavaScript Date.");
|
|
2950
|
+
}
|
|
2951
|
+
const components = computeJulianDateComponents(
|
|
2952
|
+
date.getUTCFullYear(),
|
|
2953
|
+
date.getUTCMonth() + 1,
|
|
2954
|
+
date.getUTCDate(),
|
|
2955
|
+
date.getUTCHours(),
|
|
2956
|
+
date.getUTCMinutes(),
|
|
2957
|
+
date.getUTCSeconds(),
|
|
2958
|
+
date.getUTCMilliseconds()
|
|
2959
|
+
);
|
|
2960
|
+
if (!defined_default(result)) {
|
|
2961
|
+
return new _JulianDate(components[0], components[1], TimeStandard_default.UTC);
|
|
2962
|
+
}
|
|
2963
|
+
setComponents(components[0], components[1], result);
|
|
2964
|
+
convertUtcToTai(result);
|
|
2965
|
+
return result;
|
|
2960
2966
|
}
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2967
|
+
/**
|
|
2968
|
+
* Creates a new instance from a from an {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601} date.
|
|
2969
|
+
* This method is superior to <code>Date.parse</code> because it will handle all valid formats defined by the ISO 8601
|
|
2970
|
+
* specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.
|
|
2971
|
+
*
|
|
2972
|
+
* @param {string} iso8601String An ISO 8601 date.
|
|
2973
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
2974
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
|
|
2975
|
+
*
|
|
2976
|
+
* @exception {DeveloperError} Invalid ISO 8601 date.
|
|
2977
|
+
*/
|
|
2978
|
+
static fromIso8601(iso8601String, result) {
|
|
2979
|
+
if (typeof iso8601String !== "string") {
|
|
2966
2980
|
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
2967
2981
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2982
|
+
iso8601String = iso8601String.replace(",", ".");
|
|
2983
|
+
let tokens = iso8601String.split("T");
|
|
2984
|
+
let year;
|
|
2985
|
+
let month = 1;
|
|
2986
|
+
let day = 1;
|
|
2987
|
+
let hour = 0;
|
|
2988
|
+
let minute = 0;
|
|
2989
|
+
let second = 0;
|
|
2990
|
+
let millisecond = 0;
|
|
2991
|
+
const date = tokens[0];
|
|
2992
|
+
const time = tokens[1];
|
|
2993
|
+
let tmp;
|
|
2994
|
+
let inLeapYear;
|
|
2995
|
+
if (!defined_default(date)) {
|
|
2996
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
2997
|
+
}
|
|
2998
|
+
let dashCount;
|
|
2999
|
+
tokens = date.match(matchCalendarDate);
|
|
2973
3000
|
if (tokens !== null) {
|
|
3001
|
+
dashCount = date.split("-").length - 1;
|
|
3002
|
+
if (dashCount > 0 && dashCount !== 2) {
|
|
3003
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3004
|
+
}
|
|
2974
3005
|
year = +tokens[1];
|
|
2975
3006
|
month = +tokens[2];
|
|
3007
|
+
day = +tokens[3];
|
|
2976
3008
|
} else {
|
|
2977
|
-
tokens = date.match(
|
|
3009
|
+
tokens = date.match(matchCalendarMonth);
|
|
2978
3010
|
if (tokens !== null) {
|
|
2979
3011
|
year = +tokens[1];
|
|
3012
|
+
month = +tokens[2];
|
|
2980
3013
|
} else {
|
|
2981
|
-
|
|
2982
|
-
tokens = date.match(matchOrdinalDate);
|
|
3014
|
+
tokens = date.match(matchCalendarYear);
|
|
2983
3015
|
if (tokens !== null) {
|
|
2984
3016
|
year = +tokens[1];
|
|
2985
|
-
dayOfYear = +tokens[2];
|
|
2986
|
-
inLeapYear = isLeapYear_default(year);
|
|
2987
|
-
if (dayOfYear < 1 || inLeapYear && dayOfYear > 366 || !inLeapYear && dayOfYear > 365) {
|
|
2988
|
-
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
2989
|
-
}
|
|
2990
3017
|
} else {
|
|
2991
|
-
|
|
3018
|
+
let dayOfYear;
|
|
3019
|
+
tokens = date.match(matchOrdinalDate);
|
|
2992
3020
|
if (tokens !== null) {
|
|
2993
3021
|
year = +tokens[1];
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
if (dashCount > 0 && (!defined_default(tokens[3]) && dashCount !== 1 || defined_default(tokens[3]) && dashCount !== 2)) {
|
|
3022
|
+
dayOfYear = +tokens[2];
|
|
3023
|
+
inLeapYear = isLeapYear_default(year);
|
|
3024
|
+
if (dayOfYear < 1 || inLeapYear && dayOfYear > 366 || !inLeapYear && dayOfYear > 365) {
|
|
2998
3025
|
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
2999
3026
|
}
|
|
3000
|
-
const january4 = new Date(Date.UTC(year, 0, 4));
|
|
3001
|
-
dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
|
|
3002
3027
|
} else {
|
|
3003
|
-
|
|
3028
|
+
tokens = date.match(matchWeekDate);
|
|
3029
|
+
if (tokens !== null) {
|
|
3030
|
+
year = +tokens[1];
|
|
3031
|
+
const weekNumber = +tokens[2];
|
|
3032
|
+
const dayOfWeek = +tokens[3] || 0;
|
|
3033
|
+
dashCount = date.split("-").length - 1;
|
|
3034
|
+
if (dashCount > 0 && (!defined_default(tokens[3]) && dashCount !== 1 || defined_default(tokens[3]) && dashCount !== 2)) {
|
|
3035
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3036
|
+
}
|
|
3037
|
+
const january4 = new Date(Date.UTC(year, 0, 4));
|
|
3038
|
+
dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
|
|
3039
|
+
} else {
|
|
3040
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3041
|
+
}
|
|
3004
3042
|
}
|
|
3043
|
+
tmp = new Date(Date.UTC(year, 0, 1));
|
|
3044
|
+
tmp.setUTCDate(dayOfYear);
|
|
3045
|
+
month = tmp.getUTCMonth() + 1;
|
|
3046
|
+
day = tmp.getUTCDate();
|
|
3005
3047
|
}
|
|
3006
|
-
tmp = new Date(Date.UTC(year, 0, 1));
|
|
3007
|
-
tmp.setUTCDate(dayOfYear);
|
|
3008
|
-
month = tmp.getUTCMonth() + 1;
|
|
3009
|
-
day = tmp.getUTCDate();
|
|
3010
3048
|
}
|
|
3011
3049
|
}
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
tokens = time.match(matchHoursMinutesSeconds);
|
|
3020
|
-
if (tokens !== null) {
|
|
3021
|
-
dashCount = time.split(":").length - 1;
|
|
3022
|
-
if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
|
|
3023
|
-
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3024
|
-
}
|
|
3025
|
-
hour = +tokens[1];
|
|
3026
|
-
minute = +tokens[2];
|
|
3027
|
-
second = +tokens[3];
|
|
3028
|
-
millisecond = +(tokens[4] || 0) * 1e3;
|
|
3029
|
-
offsetIndex = 5;
|
|
3030
|
-
} else {
|
|
3031
|
-
tokens = time.match(matchHoursMinutes);
|
|
3050
|
+
inLeapYear = isLeapYear_default(year);
|
|
3051
|
+
if (month < 1 || month > 12 || day < 1 || (month !== 2 || !inLeapYear) && day > daysInMonth[month - 1] || inLeapYear && month === 2 && day > daysInLeapFebruary) {
|
|
3052
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3053
|
+
}
|
|
3054
|
+
let offsetIndex;
|
|
3055
|
+
if (defined_default(time)) {
|
|
3056
|
+
tokens = time.match(matchHoursMinutesSeconds);
|
|
3032
3057
|
if (tokens !== null) {
|
|
3033
3058
|
dashCount = time.split(":").length - 1;
|
|
3034
|
-
if (dashCount > 2) {
|
|
3059
|
+
if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
|
|
3035
3060
|
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3036
3061
|
}
|
|
3037
3062
|
hour = +tokens[1];
|
|
3038
3063
|
minute = +tokens[2];
|
|
3039
|
-
second = +
|
|
3040
|
-
|
|
3064
|
+
second = +tokens[3];
|
|
3065
|
+
millisecond = +(tokens[4] || 0) * 1e3;
|
|
3066
|
+
offsetIndex = 5;
|
|
3041
3067
|
} else {
|
|
3042
|
-
tokens = time.match(
|
|
3068
|
+
tokens = time.match(matchHoursMinutes);
|
|
3043
3069
|
if (tokens !== null) {
|
|
3070
|
+
dashCount = time.split(":").length - 1;
|
|
3071
|
+
if (dashCount > 2) {
|
|
3072
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3073
|
+
}
|
|
3044
3074
|
hour = +tokens[1];
|
|
3045
|
-
minute = +
|
|
3046
|
-
|
|
3075
|
+
minute = +tokens[2];
|
|
3076
|
+
second = +(tokens[3] || 0) * 60;
|
|
3077
|
+
offsetIndex = 4;
|
|
3047
3078
|
} else {
|
|
3048
|
-
|
|
3079
|
+
tokens = time.match(matchHours);
|
|
3080
|
+
if (tokens !== null) {
|
|
3081
|
+
hour = +tokens[1];
|
|
3082
|
+
minute = +(tokens[2] || 0) * 60;
|
|
3083
|
+
offsetIndex = 3;
|
|
3084
|
+
} else {
|
|
3085
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3086
|
+
}
|
|
3049
3087
|
}
|
|
3050
3088
|
}
|
|
3089
|
+
if (minute >= 60 || second >= 61 || hour > 24 || hour === 24 && (minute > 0 || second > 0 || millisecond > 0)) {
|
|
3090
|
+
throw new DeveloperError_default(iso8601ErrorMessage);
|
|
3091
|
+
}
|
|
3092
|
+
const offset = tokens[offsetIndex];
|
|
3093
|
+
const offsetHours = +tokens[offsetIndex + 1];
|
|
3094
|
+
const offsetMinutes = +(tokens[offsetIndex + 2] || 0);
|
|
3095
|
+
switch (offset) {
|
|
3096
|
+
case "+":
|
|
3097
|
+
hour = hour - offsetHours;
|
|
3098
|
+
minute = minute - offsetMinutes;
|
|
3099
|
+
break;
|
|
3100
|
+
case "-":
|
|
3101
|
+
hour = hour + offsetHours;
|
|
3102
|
+
minute = minute + offsetMinutes;
|
|
3103
|
+
break;
|
|
3104
|
+
case "Z":
|
|
3105
|
+
break;
|
|
3106
|
+
default:
|
|
3107
|
+
minute = minute + new Date(
|
|
3108
|
+
Date.UTC(year, month - 1, day, hour, minute)
|
|
3109
|
+
).getTimezoneOffset();
|
|
3110
|
+
break;
|
|
3111
|
+
}
|
|
3051
3112
|
}
|
|
3052
|
-
|
|
3053
|
-
|
|
3113
|
+
const isLeapSecond = second === 60;
|
|
3114
|
+
if (isLeapSecond) {
|
|
3115
|
+
second--;
|
|
3054
3116
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
switch (offset) {
|
|
3059
|
-
case "+":
|
|
3060
|
-
hour = hour - offsetHours;
|
|
3061
|
-
minute = minute - offsetMinutes;
|
|
3062
|
-
break;
|
|
3063
|
-
case "-":
|
|
3064
|
-
hour = hour + offsetHours;
|
|
3065
|
-
minute = minute + offsetMinutes;
|
|
3066
|
-
break;
|
|
3067
|
-
case "Z":
|
|
3068
|
-
break;
|
|
3069
|
-
default:
|
|
3070
|
-
minute = minute + new Date(
|
|
3071
|
-
Date.UTC(year, month - 1, day, hour, minute)
|
|
3072
|
-
).getTimezoneOffset();
|
|
3073
|
-
break;
|
|
3117
|
+
while (minute >= 60) {
|
|
3118
|
+
minute -= 60;
|
|
3119
|
+
hour++;
|
|
3074
3120
|
}
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
second--;
|
|
3079
|
-
}
|
|
3080
|
-
while (minute >= 60) {
|
|
3081
|
-
minute -= 60;
|
|
3082
|
-
hour++;
|
|
3083
|
-
}
|
|
3084
|
-
while (hour >= 24) {
|
|
3085
|
-
hour -= 24;
|
|
3086
|
-
day++;
|
|
3087
|
-
}
|
|
3088
|
-
tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
|
|
3089
|
-
while (day > tmp) {
|
|
3090
|
-
day -= tmp;
|
|
3091
|
-
month++;
|
|
3092
|
-
if (month > 12) {
|
|
3093
|
-
month -= 12;
|
|
3094
|
-
year++;
|
|
3121
|
+
while (hour >= 24) {
|
|
3122
|
+
hour -= 24;
|
|
3123
|
+
day++;
|
|
3095
3124
|
}
|
|
3096
3125
|
tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}
|
|
3106
|
-
while (day < 1) {
|
|
3107
|
-
month--;
|
|
3108
|
-
if (month < 1) {
|
|
3109
|
-
month += 12;
|
|
3110
|
-
year--;
|
|
3126
|
+
while (day > tmp) {
|
|
3127
|
+
day -= tmp;
|
|
3128
|
+
month++;
|
|
3129
|
+
if (month > 12) {
|
|
3130
|
+
month -= 12;
|
|
3131
|
+
year++;
|
|
3132
|
+
}
|
|
3133
|
+
tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
|
|
3111
3134
|
}
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
if (isLeapSecond) {
|
|
3131
|
-
JulianDate.addSeconds(result, 1, result);
|
|
3132
|
-
}
|
|
3133
|
-
return result;
|
|
3134
|
-
};
|
|
3135
|
-
JulianDate.now = function(result) {
|
|
3136
|
-
return JulianDate.fromDate(/* @__PURE__ */ new Date(), result);
|
|
3137
|
-
};
|
|
3138
|
-
var toGregorianDateScratch = new JulianDate(0, 0, TimeStandard_default.TAI);
|
|
3139
|
-
JulianDate.toGregorianDate = function(julianDate, result) {
|
|
3140
|
-
if (!defined_default(julianDate)) {
|
|
3141
|
-
throw new DeveloperError_default("julianDate is required.");
|
|
3142
|
-
}
|
|
3143
|
-
let isLeapSecond = false;
|
|
3144
|
-
let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
|
|
3145
|
-
if (!defined_default(thisUtc)) {
|
|
3146
|
-
JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
|
|
3147
|
-
thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
|
|
3148
|
-
isLeapSecond = true;
|
|
3149
|
-
}
|
|
3150
|
-
let julianDayNumber = thisUtc.dayNumber;
|
|
3151
|
-
const secondsOfDay = thisUtc.secondsOfDay;
|
|
3152
|
-
if (secondsOfDay >= 43200) {
|
|
3153
|
-
julianDayNumber += 1;
|
|
3154
|
-
}
|
|
3155
|
-
let L = julianDayNumber + 68569 | 0;
|
|
3156
|
-
const N = 4 * L / 146097 | 0;
|
|
3157
|
-
L = L - ((146097 * N + 3) / 4 | 0) | 0;
|
|
3158
|
-
const I = 4e3 * (L + 1) / 1461001 | 0;
|
|
3159
|
-
L = L - (1461 * I / 4 | 0) + 31 | 0;
|
|
3160
|
-
const J = 80 * L / 2447 | 0;
|
|
3161
|
-
const day = L - (2447 * J / 80 | 0) | 0;
|
|
3162
|
-
L = J / 11 | 0;
|
|
3163
|
-
const month = J + 2 - 12 * L | 0;
|
|
3164
|
-
const year = 100 * (N - 49) + I + L | 0;
|
|
3165
|
-
let hour = secondsOfDay / TimeConstants_default.SECONDS_PER_HOUR | 0;
|
|
3166
|
-
let remainingSeconds = secondsOfDay - hour * TimeConstants_default.SECONDS_PER_HOUR;
|
|
3167
|
-
const minute = remainingSeconds / TimeConstants_default.SECONDS_PER_MINUTE | 0;
|
|
3168
|
-
remainingSeconds = remainingSeconds - minute * TimeConstants_default.SECONDS_PER_MINUTE;
|
|
3169
|
-
let second = remainingSeconds | 0;
|
|
3170
|
-
const millisecond = (remainingSeconds - second) / TimeConstants_default.SECONDS_PER_MILLISECOND;
|
|
3171
|
-
hour += 12;
|
|
3172
|
-
if (hour > 23) {
|
|
3173
|
-
hour -= 24;
|
|
3174
|
-
}
|
|
3175
|
-
if (isLeapSecond) {
|
|
3176
|
-
second += 1;
|
|
3177
|
-
}
|
|
3178
|
-
if (!defined_default(result)) {
|
|
3179
|
-
return new GregorianDate_default(
|
|
3135
|
+
while (minute < 0) {
|
|
3136
|
+
minute += 60;
|
|
3137
|
+
hour--;
|
|
3138
|
+
}
|
|
3139
|
+
while (hour < 0) {
|
|
3140
|
+
hour += 24;
|
|
3141
|
+
day--;
|
|
3142
|
+
}
|
|
3143
|
+
while (day < 1) {
|
|
3144
|
+
month--;
|
|
3145
|
+
if (month < 1) {
|
|
3146
|
+
month += 12;
|
|
3147
|
+
year--;
|
|
3148
|
+
}
|
|
3149
|
+
tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
|
|
3150
|
+
day += tmp;
|
|
3151
|
+
}
|
|
3152
|
+
const components = computeJulianDateComponents(
|
|
3180
3153
|
year,
|
|
3181
3154
|
month,
|
|
3182
3155
|
day,
|
|
3183
3156
|
hour,
|
|
3184
3157
|
minute,
|
|
3185
3158
|
second,
|
|
3186
|
-
millisecond
|
|
3187
|
-
isLeapSecond
|
|
3159
|
+
millisecond
|
|
3188
3160
|
);
|
|
3161
|
+
if (!defined_default(result)) {
|
|
3162
|
+
result = new _JulianDate(components[0], components[1], TimeStandard_default.UTC);
|
|
3163
|
+
} else {
|
|
3164
|
+
setComponents(components[0], components[1], result);
|
|
3165
|
+
convertUtcToTai(result);
|
|
3166
|
+
}
|
|
3167
|
+
if (isLeapSecond) {
|
|
3168
|
+
_JulianDate.addSeconds(result, 1, result);
|
|
3169
|
+
}
|
|
3170
|
+
return result;
|
|
3189
3171
|
}
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
result
|
|
3198
|
-
|
|
3199
|
-
};
|
|
3200
|
-
JulianDate.toDate = function(julianDate) {
|
|
3201
|
-
if (!defined_default(julianDate)) {
|
|
3202
|
-
throw new DeveloperError_default("julianDate is required.");
|
|
3203
|
-
}
|
|
3204
|
-
const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
|
|
3205
|
-
let second = gDate.second;
|
|
3206
|
-
if (gDate.isLeapSecond) {
|
|
3207
|
-
second -= 1;
|
|
3208
|
-
}
|
|
3209
|
-
return new Date(
|
|
3210
|
-
Date.UTC(
|
|
3211
|
-
gDate.year,
|
|
3212
|
-
gDate.month - 1,
|
|
3213
|
-
gDate.day,
|
|
3214
|
-
gDate.hour,
|
|
3215
|
-
gDate.minute,
|
|
3216
|
-
second,
|
|
3217
|
-
gDate.millisecond
|
|
3218
|
-
)
|
|
3219
|
-
);
|
|
3220
|
-
};
|
|
3221
|
-
JulianDate.toIso8601 = function(julianDate, precision) {
|
|
3222
|
-
if (!defined_default(julianDate)) {
|
|
3223
|
-
throw new DeveloperError_default("julianDate is required.");
|
|
3224
|
-
}
|
|
3225
|
-
const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
|
|
3226
|
-
let year = gDate.year;
|
|
3227
|
-
let month = gDate.month;
|
|
3228
|
-
let day = gDate.day;
|
|
3229
|
-
let hour = gDate.hour;
|
|
3230
|
-
const minute = gDate.minute;
|
|
3231
|
-
const second = gDate.second;
|
|
3232
|
-
const millisecond = gDate.millisecond;
|
|
3233
|
-
if (year === 1e4 && month === 1 && day === 1 && hour === 0 && minute === 0 && second === 0 && millisecond === 0) {
|
|
3234
|
-
year = 9999;
|
|
3235
|
-
month = 12;
|
|
3236
|
-
day = 31;
|
|
3237
|
-
hour = 24;
|
|
3238
|
-
}
|
|
3239
|
-
let millisecondStr;
|
|
3240
|
-
if (!defined_default(precision) && millisecond !== 0) {
|
|
3241
|
-
const millisecondHundreds = millisecond * 0.01;
|
|
3242
|
-
millisecondStr = millisecondHundreds < 1e-6 ? millisecondHundreds.toFixed(20).replace(".", "").replace(/0+$/, "") : millisecondHundreds.toString().replace(".", "");
|
|
3243
|
-
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}.${millisecondStr}Z`;
|
|
3244
|
-
}
|
|
3245
|
-
if (!defined_default(precision) || precision === 0) {
|
|
3246
|
-
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
|
|
3172
|
+
/**
|
|
3173
|
+
* Creates a new instance that represents the current system time.
|
|
3174
|
+
* This is equivalent to calling <code>JulianDate.fromDate(new Date());</code>.
|
|
3175
|
+
*
|
|
3176
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
3177
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
|
|
3178
|
+
*/
|
|
3179
|
+
static now(result) {
|
|
3180
|
+
return _JulianDate.fromDate(/* @__PURE__ */ new Date(), result);
|
|
3247
3181
|
}
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
JulianDate
|
|
3252
|
-
|
|
3253
|
-
|
|
3182
|
+
/**
|
|
3183
|
+
* Creates a {@link GregorianDate} from the provided instance.
|
|
3184
|
+
*
|
|
3185
|
+
* @param {JulianDate} julianDate The date to be converted.
|
|
3186
|
+
* @param {GregorianDate} [result] An existing instance to use for the result.
|
|
3187
|
+
* @returns {GregorianDate} The modified result parameter or a new instance if none was provided.
|
|
3188
|
+
*/
|
|
3189
|
+
static toGregorianDate(julianDate, result) {
|
|
3190
|
+
if (!defined_default(julianDate)) {
|
|
3191
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3192
|
+
}
|
|
3193
|
+
let isLeapSecond = false;
|
|
3194
|
+
let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
|
|
3195
|
+
if (!defined_default(thisUtc)) {
|
|
3196
|
+
_JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
|
|
3197
|
+
thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
|
|
3198
|
+
isLeapSecond = true;
|
|
3199
|
+
}
|
|
3200
|
+
let julianDayNumber = thisUtc.dayNumber;
|
|
3201
|
+
const secondsOfDay = thisUtc.secondsOfDay;
|
|
3202
|
+
if (secondsOfDay >= 43200) {
|
|
3203
|
+
julianDayNumber += 1;
|
|
3204
|
+
}
|
|
3205
|
+
let L = julianDayNumber + 68569 | 0;
|
|
3206
|
+
const N = 4 * L / 146097 | 0;
|
|
3207
|
+
L = L - ((146097 * N + 3) / 4 | 0) | 0;
|
|
3208
|
+
const I = 4e3 * (L + 1) / 1461001 | 0;
|
|
3209
|
+
L = L - (1461 * I / 4 | 0) + 31 | 0;
|
|
3210
|
+
const J = 80 * L / 2447 | 0;
|
|
3211
|
+
const day = L - (2447 * J / 80 | 0) | 0;
|
|
3212
|
+
L = J / 11 | 0;
|
|
3213
|
+
const month = J + 2 - 12 * L | 0;
|
|
3214
|
+
const year = 100 * (N - 49) + I + L | 0;
|
|
3215
|
+
let hour = secondsOfDay / TimeConstants_default.SECONDS_PER_HOUR | 0;
|
|
3216
|
+
let remainingSeconds = secondsOfDay - hour * TimeConstants_default.SECONDS_PER_HOUR;
|
|
3217
|
+
const minute = remainingSeconds / TimeConstants_default.SECONDS_PER_MINUTE | 0;
|
|
3218
|
+
remainingSeconds = remainingSeconds - minute * TimeConstants_default.SECONDS_PER_MINUTE;
|
|
3219
|
+
let second = remainingSeconds | 0;
|
|
3220
|
+
const millisecond = (remainingSeconds - second) / TimeConstants_default.SECONDS_PER_MILLISECOND;
|
|
3221
|
+
hour += 12;
|
|
3222
|
+
if (hour > 23) {
|
|
3223
|
+
hour -= 24;
|
|
3224
|
+
}
|
|
3225
|
+
if (isLeapSecond) {
|
|
3226
|
+
second += 1;
|
|
3227
|
+
}
|
|
3228
|
+
if (!defined_default(result)) {
|
|
3229
|
+
return new GregorianDate_default(
|
|
3230
|
+
year,
|
|
3231
|
+
month,
|
|
3232
|
+
day,
|
|
3233
|
+
hour,
|
|
3234
|
+
minute,
|
|
3235
|
+
second,
|
|
3236
|
+
millisecond,
|
|
3237
|
+
isLeapSecond
|
|
3238
|
+
);
|
|
3239
|
+
}
|
|
3240
|
+
result.year = year;
|
|
3241
|
+
result.month = month;
|
|
3242
|
+
result.day = day;
|
|
3243
|
+
result.hour = hour;
|
|
3244
|
+
result.minute = minute;
|
|
3245
|
+
result.second = second;
|
|
3246
|
+
result.millisecond = millisecond;
|
|
3247
|
+
result.isLeapSecond = isLeapSecond;
|
|
3248
|
+
return result;
|
|
3254
3249
|
}
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3250
|
+
/**
|
|
3251
|
+
* Creates a JavaScript Date from the provided instance.
|
|
3252
|
+
* Since JavaScript dates are only accurate to the nearest millisecond and
|
|
3253
|
+
* cannot represent a leap second, consider using {@link JulianDate.toGregorianDate} instead.
|
|
3254
|
+
* If the provided JulianDate is during a leap second, the previous second is used.
|
|
3255
|
+
*
|
|
3256
|
+
* @param {JulianDate} julianDate The date to be converted.
|
|
3257
|
+
* @returns {Date} A new instance representing the provided date.
|
|
3258
|
+
*/
|
|
3259
|
+
static toDate(julianDate) {
|
|
3260
|
+
if (!defined_default(julianDate)) {
|
|
3261
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3262
|
+
}
|
|
3263
|
+
const gDate = _JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
|
|
3264
|
+
let second = gDate.second;
|
|
3265
|
+
if (gDate.isLeapSecond) {
|
|
3266
|
+
second -= 1;
|
|
3267
|
+
}
|
|
3268
|
+
return new Date(
|
|
3269
|
+
Date.UTC(
|
|
3270
|
+
gDate.year,
|
|
3271
|
+
gDate.month - 1,
|
|
3272
|
+
gDate.day,
|
|
3273
|
+
gDate.hour,
|
|
3274
|
+
gDate.minute,
|
|
3275
|
+
second,
|
|
3276
|
+
gDate.millisecond
|
|
3277
|
+
)
|
|
3260
3278
|
);
|
|
3261
3279
|
}
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3280
|
+
/**
|
|
3281
|
+
* Creates an ISO8601 representation of the provided date.
|
|
3282
|
+
*
|
|
3283
|
+
* @param {JulianDate} julianDate The date to be converted.
|
|
3284
|
+
* @param {number} [precision] The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
|
|
3285
|
+
* @returns {string} The ISO8601 representation of the provided date.
|
|
3286
|
+
*/
|
|
3287
|
+
static toIso8601(julianDate, precision) {
|
|
3288
|
+
if (!defined_default(julianDate)) {
|
|
3289
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3290
|
+
}
|
|
3291
|
+
const gDate = _JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
|
|
3292
|
+
let year = gDate.year;
|
|
3293
|
+
let month = gDate.month;
|
|
3294
|
+
let day = gDate.day;
|
|
3295
|
+
let hour = gDate.hour;
|
|
3296
|
+
const minute = gDate.minute;
|
|
3297
|
+
const second = gDate.second;
|
|
3298
|
+
const millisecond = gDate.millisecond;
|
|
3299
|
+
if (year === 1e4 && month === 1 && day === 1 && hour === 0 && minute === 0 && second === 0 && millisecond === 0) {
|
|
3300
|
+
year = 9999;
|
|
3301
|
+
month = 12;
|
|
3302
|
+
day = 31;
|
|
3303
|
+
hour = 24;
|
|
3304
|
+
}
|
|
3305
|
+
let millisecondStr;
|
|
3306
|
+
if (!defined_default(precision) && millisecond !== 0) {
|
|
3307
|
+
const millisecondHundreds = millisecond * 0.01;
|
|
3308
|
+
millisecondStr = millisecondHundreds < 1e-6 ? millisecondHundreds.toFixed(20).replace(".", "").replace(/0+$/, "") : millisecondHundreds.toString().replace(".", "");
|
|
3309
|
+
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}.${millisecondStr}Z`;
|
|
3310
|
+
}
|
|
3311
|
+
if (!defined_default(precision) || precision === 0) {
|
|
3312
|
+
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
|
|
3313
|
+
}
|
|
3314
|
+
millisecondStr = (millisecond * 0.01).toFixed(precision).replace(".", "").slice(0, precision);
|
|
3315
|
+
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}.${millisecondStr}Z`;
|
|
3269
3316
|
}
|
|
3270
|
-
|
|
3271
|
-
|
|
3317
|
+
/**
|
|
3318
|
+
* Duplicates a JulianDate instance.
|
|
3319
|
+
*
|
|
3320
|
+
* @param {JulianDate} julianDate The date to duplicate.
|
|
3321
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
3322
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
|
|
3323
|
+
*/
|
|
3324
|
+
static clone(julianDate, result) {
|
|
3325
|
+
if (!defined_default(julianDate)) {
|
|
3326
|
+
return void 0;
|
|
3327
|
+
}
|
|
3328
|
+
if (!defined_default(result)) {
|
|
3329
|
+
return new _JulianDate(
|
|
3330
|
+
julianDate.dayNumber,
|
|
3331
|
+
julianDate.secondsOfDay,
|
|
3332
|
+
TimeStandard_default.TAI
|
|
3333
|
+
);
|
|
3334
|
+
}
|
|
3335
|
+
result.dayNumber = julianDate.dayNumber;
|
|
3336
|
+
result.secondsOfDay = julianDate.secondsOfDay;
|
|
3337
|
+
return result;
|
|
3272
3338
|
}
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3339
|
+
/**
|
|
3340
|
+
* Compares two instances.
|
|
3341
|
+
*
|
|
3342
|
+
* @param {JulianDate} left The first instance.
|
|
3343
|
+
* @param {JulianDate} right The second instance.
|
|
3344
|
+
* @returns {number} A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.
|
|
3345
|
+
*/
|
|
3346
|
+
static compare(left, right) {
|
|
3347
|
+
if (!defined_default(left)) {
|
|
3348
|
+
throw new DeveloperError_default("left is required.");
|
|
3349
|
+
}
|
|
3350
|
+
if (!defined_default(right)) {
|
|
3351
|
+
throw new DeveloperError_default("right is required.");
|
|
3352
|
+
}
|
|
3353
|
+
const julianDayNumberDifference = left.dayNumber - right.dayNumber;
|
|
3354
|
+
if (julianDayNumberDifference !== 0) {
|
|
3355
|
+
return julianDayNumberDifference;
|
|
3356
|
+
}
|
|
3357
|
+
return left.secondsOfDay - right.secondsOfDay;
|
|
3276
3358
|
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
JulianDate.totalDays = function(julianDate) {
|
|
3287
|
-
if (!defined_default(julianDate)) {
|
|
3288
|
-
throw new DeveloperError_default("julianDate is required.");
|
|
3359
|
+
/**
|
|
3360
|
+
* Compares two instances and returns <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
3361
|
+
*
|
|
3362
|
+
* @param {JulianDate} [left] The first instance.
|
|
3363
|
+
* @param {JulianDate} [right] The second instance.
|
|
3364
|
+
* @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
|
|
3365
|
+
*/
|
|
3366
|
+
static equals(left, right) {
|
|
3367
|
+
return left === right || defined_default(left) && defined_default(right) && left.dayNumber === right.dayNumber && left.secondsOfDay === right.secondsOfDay;
|
|
3289
3368
|
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3369
|
+
/**
|
|
3370
|
+
* Compares two instances and returns <code>true</code> if they are within <code>epsilon</code> seconds of
|
|
3371
|
+
* each other. That is, in order for the dates to be considered equal (and for
|
|
3372
|
+
* this function to return <code>true</code>), the absolute value of the difference between them, in
|
|
3373
|
+
* seconds, must be less than <code>epsilon</code>.
|
|
3374
|
+
*
|
|
3375
|
+
* @param {JulianDate} [left] The first instance.
|
|
3376
|
+
* @param {JulianDate} [right] The second instance.
|
|
3377
|
+
* @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
|
|
3378
|
+
* @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
|
|
3379
|
+
*/
|
|
3380
|
+
static equalsEpsilon(left, right, epsilon) {
|
|
3381
|
+
epsilon = epsilon ?? 0;
|
|
3382
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(_JulianDate.secondsDifference(left, right)) <= epsilon;
|
|
3295
3383
|
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3384
|
+
/**
|
|
3385
|
+
* Computes the total number of whole and fractional days represented by the provided instance.
|
|
3386
|
+
*
|
|
3387
|
+
* @param {JulianDate} julianDate The date.
|
|
3388
|
+
* @returns {number} The Julian date as single floating point number.
|
|
3389
|
+
*/
|
|
3390
|
+
static totalDays(julianDate) {
|
|
3391
|
+
if (!defined_default(julianDate)) {
|
|
3392
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3393
|
+
}
|
|
3394
|
+
return julianDate.dayNumber + julianDate.secondsOfDay / TimeConstants_default.SECONDS_PER_DAY;
|
|
3298
3395
|
}
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
JulianDate
|
|
3303
|
-
|
|
3304
|
-
|
|
3396
|
+
/**
|
|
3397
|
+
* Computes the difference in seconds between the provided instance.
|
|
3398
|
+
*
|
|
3399
|
+
* @param {JulianDate} left The first instance.
|
|
3400
|
+
* @param {JulianDate} right The second instance.
|
|
3401
|
+
* @returns {number} The difference, in seconds, when subtracting <code>right</code> from <code>left</code>.
|
|
3402
|
+
*/
|
|
3403
|
+
static secondsDifference(left, right) {
|
|
3404
|
+
if (!defined_default(left)) {
|
|
3405
|
+
throw new DeveloperError_default("left is required.");
|
|
3406
|
+
}
|
|
3407
|
+
if (!defined_default(right)) {
|
|
3408
|
+
throw new DeveloperError_default("right is required.");
|
|
3409
|
+
}
|
|
3410
|
+
const dayDifference = (left.dayNumber - right.dayNumber) * TimeConstants_default.SECONDS_PER_DAY;
|
|
3411
|
+
return dayDifference + (left.secondsOfDay - right.secondsOfDay);
|
|
3305
3412
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3413
|
+
/**
|
|
3414
|
+
* Computes the difference in days between the provided instance.
|
|
3415
|
+
*
|
|
3416
|
+
* @param {JulianDate} left The first instance.
|
|
3417
|
+
* @param {JulianDate} right The second instance.
|
|
3418
|
+
* @returns {number} The difference, in days, when subtracting <code>right</code> from <code>left</code>.
|
|
3419
|
+
*/
|
|
3420
|
+
static daysDifference(left, right) {
|
|
3421
|
+
if (!defined_default(left)) {
|
|
3422
|
+
throw new DeveloperError_default("left is required.");
|
|
3423
|
+
}
|
|
3424
|
+
if (!defined_default(right)) {
|
|
3425
|
+
throw new DeveloperError_default("right is required.");
|
|
3426
|
+
}
|
|
3427
|
+
const dayDifference = left.dayNumber - right.dayNumber;
|
|
3428
|
+
const secondDifference = (left.secondsOfDay - right.secondsOfDay) / TimeConstants_default.SECONDS_PER_DAY;
|
|
3429
|
+
return dayDifference + secondDifference;
|
|
3308
3430
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
leapSeconds
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
--index;
|
|
3431
|
+
/**
|
|
3432
|
+
* Computes the number of seconds the provided instance is ahead of UTC.
|
|
3433
|
+
*
|
|
3434
|
+
* @param {JulianDate} julianDate The date.
|
|
3435
|
+
* @returns {number} The number of seconds the provided instance is ahead of UTC
|
|
3436
|
+
*/
|
|
3437
|
+
static computeTaiMinusUtc(julianDate) {
|
|
3438
|
+
binarySearchScratchLeapSecond.julianDate = julianDate;
|
|
3439
|
+
const leapSeconds = _JulianDate.leapSeconds;
|
|
3440
|
+
let index = binarySearch_default(
|
|
3441
|
+
leapSeconds,
|
|
3442
|
+
binarySearchScratchLeapSecond,
|
|
3443
|
+
compareLeapSecondDates
|
|
3444
|
+
);
|
|
3324
3445
|
if (index < 0) {
|
|
3325
|
-
index =
|
|
3446
|
+
index = ~index;
|
|
3447
|
+
--index;
|
|
3448
|
+
if (index < 0) {
|
|
3449
|
+
index = 0;
|
|
3450
|
+
}
|
|
3326
3451
|
}
|
|
3452
|
+
return leapSeconds[index].offset;
|
|
3327
3453
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3454
|
+
/**
|
|
3455
|
+
* Adds the provided number of seconds to the provided date instance.
|
|
3456
|
+
*
|
|
3457
|
+
* @param {JulianDate} julianDate The date.
|
|
3458
|
+
* @param {number} seconds The number of seconds to add or subtract.
|
|
3459
|
+
* @param {JulianDate} result An existing instance to use for the result.
|
|
3460
|
+
* @returns {JulianDate} The modified result parameter.
|
|
3461
|
+
*/
|
|
3462
|
+
static addSeconds(julianDate, seconds, result) {
|
|
3463
|
+
if (!defined_default(julianDate)) {
|
|
3464
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3465
|
+
}
|
|
3466
|
+
if (!defined_default(seconds)) {
|
|
3467
|
+
throw new DeveloperError_default("seconds is required.");
|
|
3468
|
+
}
|
|
3469
|
+
if (!defined_default(result)) {
|
|
3470
|
+
throw new DeveloperError_default("result is required.");
|
|
3471
|
+
}
|
|
3472
|
+
return setComponents(
|
|
3473
|
+
julianDate.dayNumber,
|
|
3474
|
+
julianDate.secondsOfDay + seconds,
|
|
3475
|
+
result
|
|
3476
|
+
);
|
|
3333
3477
|
}
|
|
3334
|
-
|
|
3335
|
-
|
|
3478
|
+
/**
|
|
3479
|
+
* Adds the provided number of minutes to the provided date instance.
|
|
3480
|
+
*
|
|
3481
|
+
* @param {JulianDate} julianDate The date.
|
|
3482
|
+
* @param {number} minutes The number of minutes to add or subtract.
|
|
3483
|
+
* @param {JulianDate} result An existing instance to use for the result.
|
|
3484
|
+
* @returns {JulianDate} The modified result parameter.
|
|
3485
|
+
*/
|
|
3486
|
+
static addMinutes(julianDate, minutes, result) {
|
|
3487
|
+
if (!defined_default(julianDate)) {
|
|
3488
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3489
|
+
}
|
|
3490
|
+
if (!defined_default(minutes)) {
|
|
3491
|
+
throw new DeveloperError_default("minutes is required.");
|
|
3492
|
+
}
|
|
3493
|
+
if (!defined_default(result)) {
|
|
3494
|
+
throw new DeveloperError_default("result is required.");
|
|
3495
|
+
}
|
|
3496
|
+
const newSecondsOfDay = julianDate.secondsOfDay + minutes * TimeConstants_default.SECONDS_PER_MINUTE;
|
|
3497
|
+
return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
|
|
3336
3498
|
}
|
|
3337
|
-
|
|
3338
|
-
|
|
3499
|
+
/**
|
|
3500
|
+
* Adds the provided number of hours to the provided date instance.
|
|
3501
|
+
*
|
|
3502
|
+
* @param {JulianDate} julianDate The date.
|
|
3503
|
+
* @param {number} hours The number of hours to add or subtract.
|
|
3504
|
+
* @param {JulianDate} result An existing instance to use for the result.
|
|
3505
|
+
* @returns {JulianDate} The modified result parameter.
|
|
3506
|
+
*/
|
|
3507
|
+
static addHours(julianDate, hours, result) {
|
|
3508
|
+
if (!defined_default(julianDate)) {
|
|
3509
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3510
|
+
}
|
|
3511
|
+
if (!defined_default(hours)) {
|
|
3512
|
+
throw new DeveloperError_default("hours is required.");
|
|
3513
|
+
}
|
|
3514
|
+
if (!defined_default(result)) {
|
|
3515
|
+
throw new DeveloperError_default("result is required.");
|
|
3516
|
+
}
|
|
3517
|
+
const newSecondsOfDay = julianDate.secondsOfDay + hours * TimeConstants_default.SECONDS_PER_HOUR;
|
|
3518
|
+
return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
|
|
3339
3519
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
}
|
|
3346
|
-
JulianDate
|
|
3347
|
-
|
|
3348
|
-
|
|
3520
|
+
/**
|
|
3521
|
+
* Adds the provided number of days to the provided date instance.
|
|
3522
|
+
*
|
|
3523
|
+
* @param {JulianDate} julianDate The date.
|
|
3524
|
+
* @param {number} days The number of days to add or subtract.
|
|
3525
|
+
* @param {JulianDate} result An existing instance to use for the result.
|
|
3526
|
+
* @returns {JulianDate} The modified result parameter.
|
|
3527
|
+
*/
|
|
3528
|
+
static addDays(julianDate, days, result) {
|
|
3529
|
+
if (!defined_default(julianDate)) {
|
|
3530
|
+
throw new DeveloperError_default("julianDate is required.");
|
|
3531
|
+
}
|
|
3532
|
+
if (!defined_default(days)) {
|
|
3533
|
+
throw new DeveloperError_default("days is required.");
|
|
3534
|
+
}
|
|
3535
|
+
if (!defined_default(result)) {
|
|
3536
|
+
throw new DeveloperError_default("result is required.");
|
|
3537
|
+
}
|
|
3538
|
+
const newJulianDayNumber = julianDate.dayNumber + days;
|
|
3539
|
+
return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
|
|
3349
3540
|
}
|
|
3350
|
-
|
|
3351
|
-
|
|
3541
|
+
/**
|
|
3542
|
+
* Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
|
|
3543
|
+
*
|
|
3544
|
+
* @param {JulianDate} left The first instance.
|
|
3545
|
+
* @param {JulianDate} right The second instance.
|
|
3546
|
+
* @returns {boolean} <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
|
|
3547
|
+
*/
|
|
3548
|
+
static lessThan(left, right) {
|
|
3549
|
+
return _JulianDate.compare(left, right) < 0;
|
|
3352
3550
|
}
|
|
3353
|
-
|
|
3354
|
-
|
|
3551
|
+
/**
|
|
3552
|
+
* Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
|
|
3553
|
+
*
|
|
3554
|
+
* @param {JulianDate} left The first instance.
|
|
3555
|
+
* @param {JulianDate} right The second instance.
|
|
3556
|
+
* @returns {boolean} <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
|
|
3557
|
+
*/
|
|
3558
|
+
static lessThanOrEquals(left, right) {
|
|
3559
|
+
return _JulianDate.compare(left, right) <= 0;
|
|
3355
3560
|
}
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
JulianDate
|
|
3360
|
-
|
|
3361
|
-
|
|
3561
|
+
/**
|
|
3562
|
+
* Compares the provided instances and returns <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
|
|
3563
|
+
*
|
|
3564
|
+
* @param {JulianDate} left The first instance.
|
|
3565
|
+
* @param {JulianDate} right The second instance.
|
|
3566
|
+
* @returns {boolean} <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
|
|
3567
|
+
*/
|
|
3568
|
+
static greaterThan(left, right) {
|
|
3569
|
+
return _JulianDate.compare(left, right) > 0;
|
|
3362
3570
|
}
|
|
3363
|
-
|
|
3364
|
-
|
|
3571
|
+
/**
|
|
3572
|
+
* Compares the provided instances and returns <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
|
|
3573
|
+
*
|
|
3574
|
+
* @param {JulianDate} left The first instance.
|
|
3575
|
+
* @param {JulianDate} right The second instance.
|
|
3576
|
+
* @returns {boolean} <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
|
|
3577
|
+
*/
|
|
3578
|
+
static greaterThanOrEquals(left, right) {
|
|
3579
|
+
return _JulianDate.compare(left, right) >= 0;
|
|
3365
3580
|
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3581
|
+
/**
|
|
3582
|
+
* Duplicates this instance.
|
|
3583
|
+
*
|
|
3584
|
+
* @param {JulianDate} [result] An existing instance to use for the result.
|
|
3585
|
+
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
|
|
3586
|
+
*/
|
|
3587
|
+
clone(result) {
|
|
3588
|
+
return _JulianDate.clone(this, result);
|
|
3368
3589
|
}
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
JulianDate
|
|
3373
|
-
|
|
3374
|
-
|
|
3590
|
+
/**
|
|
3591
|
+
* Compares this and the provided instance and returns <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
3592
|
+
*
|
|
3593
|
+
* @param {JulianDate} [right] The second instance.
|
|
3594
|
+
* @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
|
|
3595
|
+
*/
|
|
3596
|
+
equals(right) {
|
|
3597
|
+
return _JulianDate.equals(this, right);
|
|
3375
3598
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3599
|
+
/**
|
|
3600
|
+
* Compares this and the provided instance and returns <code>true</code> if they are within <code>epsilon</code> seconds of
|
|
3601
|
+
* each other. That is, in order for the dates to be considered equal (and for
|
|
3602
|
+
* this function to return <code>true</code>), the absolute value of the difference between them, in
|
|
3603
|
+
* seconds, must be less than <code>epsilon</code>.
|
|
3604
|
+
*
|
|
3605
|
+
* @param {JulianDate} [right] The second instance.
|
|
3606
|
+
* @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
|
|
3607
|
+
* @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
|
|
3608
|
+
*/
|
|
3609
|
+
equalsEpsilon(right, epsilon) {
|
|
3610
|
+
return _JulianDate.equalsEpsilon(this, right, epsilon);
|
|
3378
3611
|
}
|
|
3379
|
-
|
|
3380
|
-
|
|
3612
|
+
/**
|
|
3613
|
+
* Creates a string representing this date in ISO8601 format.
|
|
3614
|
+
*
|
|
3615
|
+
* @returns {string} A string representing this date in ISO8601 format.
|
|
3616
|
+
*/
|
|
3617
|
+
toString() {
|
|
3618
|
+
return _JulianDate.toIso8601(this);
|
|
3381
3619
|
}
|
|
3382
|
-
const newJulianDayNumber = julianDate.dayNumber + days;
|
|
3383
|
-
return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
|
|
3384
|
-
};
|
|
3385
|
-
JulianDate.lessThan = function(left, right) {
|
|
3386
|
-
return JulianDate.compare(left, right) < 0;
|
|
3387
|
-
};
|
|
3388
|
-
JulianDate.lessThanOrEquals = function(left, right) {
|
|
3389
|
-
return JulianDate.compare(left, right) <= 0;
|
|
3390
|
-
};
|
|
3391
|
-
JulianDate.greaterThan = function(left, right) {
|
|
3392
|
-
return JulianDate.compare(left, right) > 0;
|
|
3393
|
-
};
|
|
3394
|
-
JulianDate.greaterThanOrEquals = function(left, right) {
|
|
3395
|
-
return JulianDate.compare(left, right) >= 0;
|
|
3396
|
-
};
|
|
3397
|
-
JulianDate.prototype.clone = function(result) {
|
|
3398
|
-
return JulianDate.clone(this, result);
|
|
3399
|
-
};
|
|
3400
|
-
JulianDate.prototype.equals = function(right) {
|
|
3401
|
-
return JulianDate.equals(this, right);
|
|
3402
|
-
};
|
|
3403
|
-
JulianDate.prototype.equalsEpsilon = function(right, epsilon) {
|
|
3404
|
-
return JulianDate.equalsEpsilon(this, right, epsilon);
|
|
3405
|
-
};
|
|
3406
|
-
JulianDate.prototype.toString = function() {
|
|
3407
|
-
return JulianDate.toIso8601(this);
|
|
3408
3620
|
};
|
|
3621
|
+
var toGregorianDateScratch = new JulianDate(0, 0, TimeStandard_default.TAI);
|
|
3409
3622
|
JulianDate.leapSeconds = [
|
|
3410
3623
|
new LeapSecond_default(new JulianDate(2441317, 43210, TimeStandard_default.TAI), 10),
|
|
3411
3624
|
// January 1, 1972 00:00:00 UTC
|
|
@@ -3772,7 +3985,8 @@ var RequestState = {
|
|
|
3772
3985
|
*/
|
|
3773
3986
|
FAILED: 5
|
|
3774
3987
|
};
|
|
3775
|
-
|
|
3988
|
+
Object.freeze(RequestState);
|
|
3989
|
+
var RequestState_default = RequestState;
|
|
3776
3990
|
|
|
3777
3991
|
// packages/engine/Source/Core/RequestType.js
|
|
3778
3992
|
var RequestType = {
|
|
@@ -3805,7 +4019,8 @@ var RequestType = {
|
|
|
3805
4019
|
*/
|
|
3806
4020
|
OTHER: 3
|
|
3807
4021
|
};
|
|
3808
|
-
|
|
4022
|
+
Object.freeze(RequestType);
|
|
4023
|
+
var RequestType_default = RequestType;
|
|
3809
4024
|
|
|
3810
4025
|
// packages/engine/Source/Core/Request.js
|
|
3811
4026
|
function Request(options) {
|
|
@@ -4290,8 +4505,10 @@ function cancelRequest(request) {
|
|
|
4290
4505
|
++statistics.numberOfCancelledRequests;
|
|
4291
4506
|
if (defined_default(request.deferred)) {
|
|
4292
4507
|
const deferred = request.deferred;
|
|
4508
|
+
deferred.promise.catch(() => {
|
|
4509
|
+
});
|
|
4293
4510
|
request.deferred = void 0;
|
|
4294
|
-
deferred.reject();
|
|
4511
|
+
deferred.reject(new RuntimeError_default(`Request cancelled: "${request.url}"`));
|
|
4295
4512
|
}
|
|
4296
4513
|
if (active) {
|
|
4297
4514
|
--statistics.numberOfActiveRequests;
|
|
@@ -6162,8 +6379,23 @@ Iau2006XysData.prototype.computeXysRadians = function(dayTT, secondTT, result) {
|
|
|
6162
6379
|
}
|
|
6163
6380
|
return result;
|
|
6164
6381
|
};
|
|
6382
|
+
Iau2006XysData.prototype._updateChunkData = function(index, { samples }) {
|
|
6383
|
+
this._chunkDownloadsInProgress[index] = void 0;
|
|
6384
|
+
const samplesPerFile = this._samplesPerXysFile;
|
|
6385
|
+
const startIndex = index * samplesPerFile * 3;
|
|
6386
|
+
for (let i = 0; i < samples.length; ++i) {
|
|
6387
|
+
this._samples[startIndex + i] = samples[i];
|
|
6388
|
+
}
|
|
6389
|
+
};
|
|
6390
|
+
async function requestXysChunkJson(resource, index, xysData) {
|
|
6391
|
+
try {
|
|
6392
|
+
const chunk = await resource.fetchJson();
|
|
6393
|
+
xysData._updateChunkData(index, chunk);
|
|
6394
|
+
} catch (e) {
|
|
6395
|
+
}
|
|
6396
|
+
}
|
|
6165
6397
|
function requestXysChunk(xysData, chunkIndex) {
|
|
6166
|
-
if (xysData._chunkDownloadsInProgress[chunkIndex]) {
|
|
6398
|
+
if (defined_default(xysData._chunkDownloadsInProgress[chunkIndex])) {
|
|
6167
6399
|
return xysData._chunkDownloadsInProgress[chunkIndex];
|
|
6168
6400
|
}
|
|
6169
6401
|
let chunkUrl;
|
|
@@ -6179,15 +6411,7 @@ function requestXysChunk(xysData, chunkIndex) {
|
|
|
6179
6411
|
url: buildModuleUrl_default(`Assets/IAU2006_XYS/IAU2006_XYS_${chunkIndex}.json`)
|
|
6180
6412
|
});
|
|
6181
6413
|
}
|
|
6182
|
-
const promise = chunkUrl
|
|
6183
|
-
xysData._chunkDownloadsInProgress[chunkIndex] = false;
|
|
6184
|
-
const samples = xysData._samples;
|
|
6185
|
-
const newSamples = chunk.samples;
|
|
6186
|
-
const startIndex = chunkIndex * xysData._samplesPerXysFile * 3;
|
|
6187
|
-
for (let i = 0, len = newSamples.length; i < len; ++i) {
|
|
6188
|
-
samples[startIndex + i] = newSamples[i];
|
|
6189
|
-
}
|
|
6190
|
-
});
|
|
6414
|
+
const promise = requestXysChunkJson(chunkUrl, chunkIndex, xysData);
|
|
6191
6415
|
xysData._chunkDownloadsInProgress[chunkIndex] = promise;
|
|
6192
6416
|
return promise;
|
|
6193
6417
|
}
|
|
@@ -7384,553 +7608,803 @@ Transforms.ellipsoidTo2DModelMatrix = function(projection, center, result) {
|
|
|
7384
7608
|
var Transforms_default = Transforms;
|
|
7385
7609
|
|
|
7386
7610
|
// packages/engine/Source/Core/Rectangle.js
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
}
|
|
7393
|
-
|
|
7611
|
+
var Rectangle = class _Rectangle {
|
|
7612
|
+
/**
|
|
7613
|
+
* @param {number} [west=0.0] The westernmost longitude, in radians, in the range [-Pi, Pi].
|
|
7614
|
+
* @param {number} [south=0.0] The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
7615
|
+
* @param {number} [east=0.0] The easternmost longitude, in radians, in the range [-Pi, Pi].
|
|
7616
|
+
* @param {number} [north=0.0] The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
7617
|
+
*/
|
|
7618
|
+
constructor(west, south, east, north) {
|
|
7619
|
+
this.west = west ?? 0;
|
|
7620
|
+
this.south = south ?? 0;
|
|
7621
|
+
this.east = east ?? 0;
|
|
7622
|
+
this.north = north ?? 0;
|
|
7623
|
+
}
|
|
7394
7624
|
/**
|
|
7395
7625
|
* Gets the width of the rectangle in radians.
|
|
7396
|
-
* @memberof Rectangle.prototype
|
|
7397
7626
|
* @type {number}
|
|
7398
7627
|
* @readonly
|
|
7399
7628
|
*/
|
|
7400
|
-
width
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
}
|
|
7404
|
-
},
|
|
7629
|
+
get width() {
|
|
7630
|
+
return _Rectangle.computeWidth(this);
|
|
7631
|
+
}
|
|
7405
7632
|
/**
|
|
7406
7633
|
* Gets the height of the rectangle in radians.
|
|
7407
|
-
* @memberof Rectangle.prototype
|
|
7408
7634
|
* @type {number}
|
|
7409
7635
|
* @readonly
|
|
7410
7636
|
*/
|
|
7411
|
-
height
|
|
7412
|
-
|
|
7413
|
-
return Rectangle.computeHeight(this);
|
|
7414
|
-
}
|
|
7415
|
-
}
|
|
7416
|
-
});
|
|
7417
|
-
Rectangle.packedLength = 4;
|
|
7418
|
-
Rectangle.pack = function(value, array, startingIndex) {
|
|
7419
|
-
Check_default.typeOf.object("value", value);
|
|
7420
|
-
Check_default.defined("array", array);
|
|
7421
|
-
startingIndex = startingIndex ?? 0;
|
|
7422
|
-
array[startingIndex++] = value.west;
|
|
7423
|
-
array[startingIndex++] = value.south;
|
|
7424
|
-
array[startingIndex++] = value.east;
|
|
7425
|
-
array[startingIndex] = value.north;
|
|
7426
|
-
return array;
|
|
7427
|
-
};
|
|
7428
|
-
Rectangle.unpack = function(array, startingIndex, result) {
|
|
7429
|
-
Check_default.defined("array", array);
|
|
7430
|
-
startingIndex = startingIndex ?? 0;
|
|
7431
|
-
if (!defined_default(result)) {
|
|
7432
|
-
result = new Rectangle();
|
|
7433
|
-
}
|
|
7434
|
-
result.west = array[startingIndex++];
|
|
7435
|
-
result.south = array[startingIndex++];
|
|
7436
|
-
result.east = array[startingIndex++];
|
|
7437
|
-
result.north = array[startingIndex];
|
|
7438
|
-
return result;
|
|
7439
|
-
};
|
|
7440
|
-
Rectangle.computeWidth = function(rectangle) {
|
|
7441
|
-
Check_default.typeOf.object("rectangle", rectangle);
|
|
7442
|
-
let east = rectangle.east;
|
|
7443
|
-
const west = rectangle.west;
|
|
7444
|
-
if (east < west) {
|
|
7445
|
-
east += Math_default.TWO_PI;
|
|
7446
|
-
}
|
|
7447
|
-
return east - west;
|
|
7448
|
-
};
|
|
7449
|
-
Rectangle.computeHeight = function(rectangle) {
|
|
7450
|
-
Check_default.typeOf.object("rectangle", rectangle);
|
|
7451
|
-
return rectangle.north - rectangle.south;
|
|
7452
|
-
};
|
|
7453
|
-
Rectangle.fromDegrees = function(west, south, east, north, result) {
|
|
7454
|
-
west = Math_default.toRadians(west ?? 0);
|
|
7455
|
-
south = Math_default.toRadians(south ?? 0);
|
|
7456
|
-
east = Math_default.toRadians(east ?? 0);
|
|
7457
|
-
north = Math_default.toRadians(north ?? 0);
|
|
7458
|
-
if (!defined_default(result)) {
|
|
7459
|
-
return new Rectangle(west, south, east, north);
|
|
7637
|
+
get height() {
|
|
7638
|
+
return _Rectangle.computeHeight(this);
|
|
7460
7639
|
}
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
}
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7640
|
+
/**
|
|
7641
|
+
* Stores the provided instance into the provided array.
|
|
7642
|
+
*
|
|
7643
|
+
* @param {Rectangle} value The value to pack.
|
|
7644
|
+
* @param {number[]} array The array to pack into.
|
|
7645
|
+
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
7646
|
+
*
|
|
7647
|
+
* @returns {number[]} The array that was packed into
|
|
7648
|
+
*/
|
|
7649
|
+
static pack(value, array, startingIndex) {
|
|
7650
|
+
Check_default.typeOf.object("value", value);
|
|
7651
|
+
Check_default.defined("array", array);
|
|
7652
|
+
startingIndex = startingIndex ?? 0;
|
|
7653
|
+
array[startingIndex++] = value.west;
|
|
7654
|
+
array[startingIndex++] = value.south;
|
|
7655
|
+
array[startingIndex++] = value.east;
|
|
7656
|
+
array[startingIndex] = value.north;
|
|
7657
|
+
return array;
|
|
7470
7658
|
}
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
}
|
|
7477
|
-
Rectangle
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
let north = -Number.MAX_VALUE;
|
|
7485
|
-
for (let i = 0, len = cartographics.length; i < len; i++) {
|
|
7486
|
-
const position = cartographics[i];
|
|
7487
|
-
west = Math.min(west, position.longitude);
|
|
7488
|
-
east = Math.max(east, position.longitude);
|
|
7489
|
-
south = Math.min(south, position.latitude);
|
|
7490
|
-
north = Math.max(north, position.latitude);
|
|
7491
|
-
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
|
7492
|
-
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
|
7493
|
-
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
|
7494
|
-
}
|
|
7495
|
-
if (east - west > eastOverIDL - westOverIDL) {
|
|
7496
|
-
west = westOverIDL;
|
|
7497
|
-
east = eastOverIDL;
|
|
7498
|
-
if (east > Math_default.PI) {
|
|
7499
|
-
east = east - Math_default.TWO_PI;
|
|
7500
|
-
}
|
|
7501
|
-
if (west > Math_default.PI) {
|
|
7502
|
-
west = west - Math_default.TWO_PI;
|
|
7659
|
+
/**
|
|
7660
|
+
* Retrieves an instance from a packed array.
|
|
7661
|
+
*
|
|
7662
|
+
* @param {number[]} array The packed array.
|
|
7663
|
+
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
7664
|
+
* @param {Rectangle} [result] The object into which to store the result.
|
|
7665
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
|
|
7666
|
+
*/
|
|
7667
|
+
static unpack(array, startingIndex, result) {
|
|
7668
|
+
Check_default.defined("array", array);
|
|
7669
|
+
startingIndex = startingIndex ?? 0;
|
|
7670
|
+
if (!defined_default(result)) {
|
|
7671
|
+
result = new _Rectangle();
|
|
7503
7672
|
}
|
|
7673
|
+
result.west = array[startingIndex++];
|
|
7674
|
+
result.south = array[startingIndex++];
|
|
7675
|
+
result.east = array[startingIndex++];
|
|
7676
|
+
result.north = array[startingIndex];
|
|
7677
|
+
return result;
|
|
7504
7678
|
}
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
|
|
7517
|
-
let west = Number.MAX_VALUE;
|
|
7518
|
-
let east = -Number.MAX_VALUE;
|
|
7519
|
-
let westOverIDL = Number.MAX_VALUE;
|
|
7520
|
-
let eastOverIDL = -Number.MAX_VALUE;
|
|
7521
|
-
let south = Number.MAX_VALUE;
|
|
7522
|
-
let north = -Number.MAX_VALUE;
|
|
7523
|
-
for (let i = 0, len = cartesians.length; i < len; i++) {
|
|
7524
|
-
const position = ellipsoid.cartesianToCartographic(cartesians[i]);
|
|
7525
|
-
west = Math.min(west, position.longitude);
|
|
7526
|
-
east = Math.max(east, position.longitude);
|
|
7527
|
-
south = Math.min(south, position.latitude);
|
|
7528
|
-
north = Math.max(north, position.latitude);
|
|
7529
|
-
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
|
7530
|
-
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
|
7531
|
-
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
|
7532
|
-
}
|
|
7533
|
-
if (east - west > eastOverIDL - westOverIDL) {
|
|
7534
|
-
west = westOverIDL;
|
|
7535
|
-
east = eastOverIDL;
|
|
7536
|
-
if (east > Math_default.PI) {
|
|
7537
|
-
east = east - Math_default.TWO_PI;
|
|
7538
|
-
}
|
|
7539
|
-
if (west > Math_default.PI) {
|
|
7540
|
-
west = west - Math_default.TWO_PI;
|
|
7679
|
+
/**
|
|
7680
|
+
* Computes the width of a rectangle in radians.
|
|
7681
|
+
* @param {Rectangle} rectangle The rectangle to compute the width of.
|
|
7682
|
+
* @returns {number} The width.
|
|
7683
|
+
*/
|
|
7684
|
+
static computeWidth(rectangle) {
|
|
7685
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
7686
|
+
let east = rectangle.east;
|
|
7687
|
+
const west = rectangle.west;
|
|
7688
|
+
if (east < west) {
|
|
7689
|
+
east += Math_default.TWO_PI;
|
|
7541
7690
|
}
|
|
7691
|
+
return east - west;
|
|
7542
7692
|
}
|
|
7543
|
-
|
|
7544
|
-
|
|
7693
|
+
/**
|
|
7694
|
+
* Computes the height of a rectangle in radians.
|
|
7695
|
+
* @param {Rectangle} rectangle The rectangle to compute the height of.
|
|
7696
|
+
* @returns {number} The height.
|
|
7697
|
+
*/
|
|
7698
|
+
static computeHeight(rectangle) {
|
|
7699
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
7700
|
+
return rectangle.north - rectangle.south;
|
|
7545
7701
|
}
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
}
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7702
|
+
/**
|
|
7703
|
+
* Creates a rectangle given the boundary longitude and latitude in degrees.
|
|
7704
|
+
*
|
|
7705
|
+
* @param {number} [west=0.0] The westernmost longitude in degrees in the range [-180.0, 180.0].
|
|
7706
|
+
* @param {number} [south=0.0] The southernmost latitude in degrees in the range [-90.0, 90.0].
|
|
7707
|
+
* @param {number} [east=0.0] The easternmost longitude in degrees in the range [-180.0, 180.0].
|
|
7708
|
+
* @param {number} [north=0.0] The northernmost latitude in degrees in the range [-90.0, 90.0].
|
|
7709
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7710
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7711
|
+
*
|
|
7712
|
+
* @example
|
|
7713
|
+
* const rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);
|
|
7714
|
+
*/
|
|
7715
|
+
static fromDegrees(west, south, east, north, result) {
|
|
7716
|
+
west = Math_default.toRadians(west ?? 0);
|
|
7717
|
+
south = Math_default.toRadians(south ?? 0);
|
|
7718
|
+
east = Math_default.toRadians(east ?? 0);
|
|
7719
|
+
north = Math_default.toRadians(north ?? 0);
|
|
7720
|
+
if (!defined_default(result)) {
|
|
7721
|
+
return new _Rectangle(west, south, east, north);
|
|
7722
|
+
}
|
|
7723
|
+
result.west = west;
|
|
7724
|
+
result.south = south;
|
|
7725
|
+
result.east = east;
|
|
7726
|
+
result.north = north;
|
|
7727
|
+
return result;
|
|
7567
7728
|
}
|
|
7568
|
-
|
|
7569
|
-
|
|
7729
|
+
/**
|
|
7730
|
+
* Creates a rectangle given the boundary longitude and latitude in radians.
|
|
7731
|
+
*
|
|
7732
|
+
* @param {number} [west=0.0] The westernmost longitude in radians in the range [-Math.PI, Math.PI].
|
|
7733
|
+
* @param {number} [south=0.0] The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
|
|
7734
|
+
* @param {number} [east=0.0] The easternmost longitude in radians in the range [-Math.PI, Math.PI].
|
|
7735
|
+
* @param {number} [north=0.0] The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
|
|
7736
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7737
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7738
|
+
*
|
|
7739
|
+
* @example
|
|
7740
|
+
* const rectangle = Cesium.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);
|
|
7741
|
+
*/
|
|
7742
|
+
static fromRadians(west, south, east, north, result) {
|
|
7743
|
+
if (!defined_default(result)) {
|
|
7744
|
+
return new _Rectangle(west, south, east, north);
|
|
7745
|
+
}
|
|
7746
|
+
result.west = west ?? 0;
|
|
7747
|
+
result.south = south ?? 0;
|
|
7748
|
+
result.east = east ?? 0;
|
|
7749
|
+
result.north = north ?? 0;
|
|
7750
|
+
return result;
|
|
7570
7751
|
}
|
|
7571
|
-
|
|
7572
|
-
|
|
7752
|
+
/**
|
|
7753
|
+
* Creates the smallest possible Rectangle that encloses all positions in the provided array.
|
|
7754
|
+
*
|
|
7755
|
+
* @param {Cartographic[]} cartographics The list of Cartographic instances.
|
|
7756
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7757
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7758
|
+
*/
|
|
7759
|
+
static fromCartographicArray(cartographics, result) {
|
|
7760
|
+
Check_default.defined("cartographics", cartographics);
|
|
7761
|
+
let west = Number.MAX_VALUE;
|
|
7762
|
+
let east = -Number.MAX_VALUE;
|
|
7763
|
+
let westOverIDL = Number.MAX_VALUE;
|
|
7764
|
+
let eastOverIDL = -Number.MAX_VALUE;
|
|
7765
|
+
let south = Number.MAX_VALUE;
|
|
7766
|
+
let north = -Number.MAX_VALUE;
|
|
7767
|
+
for (let i = 0, len = cartographics.length; i < len; i++) {
|
|
7768
|
+
const position = cartographics[i];
|
|
7769
|
+
west = Math.min(west, position.longitude);
|
|
7770
|
+
east = Math.max(east, position.longitude);
|
|
7771
|
+
south = Math.min(south, position.latitude);
|
|
7772
|
+
north = Math.max(north, position.latitude);
|
|
7773
|
+
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
|
7774
|
+
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
|
7775
|
+
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
|
7776
|
+
}
|
|
7777
|
+
if (east - west > eastOverIDL - westOverIDL) {
|
|
7778
|
+
west = westOverIDL;
|
|
7779
|
+
east = eastOverIDL;
|
|
7780
|
+
if (east > Math_default.PI) {
|
|
7781
|
+
east = east - Math_default.TWO_PI;
|
|
7782
|
+
}
|
|
7783
|
+
if (west > Math_default.PI) {
|
|
7784
|
+
west = west - Math_default.TWO_PI;
|
|
7785
|
+
}
|
|
7786
|
+
}
|
|
7787
|
+
if (!defined_default(result)) {
|
|
7788
|
+
return new _Rectangle(west, south, east, north);
|
|
7789
|
+
}
|
|
7790
|
+
result.west = west;
|
|
7791
|
+
result.south = south;
|
|
7792
|
+
result.east = east;
|
|
7793
|
+
result.north = north;
|
|
7573
7794
|
return result;
|
|
7574
7795
|
}
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
}
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7796
|
+
/**
|
|
7797
|
+
* Creates the smallest possible Rectangle that encloses all positions in the provided array.
|
|
7798
|
+
*
|
|
7799
|
+
* @param {Cartesian3[]} cartesians The list of Cartesian instances.
|
|
7800
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid the cartesians are on.
|
|
7801
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7802
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7803
|
+
*/
|
|
7804
|
+
static fromCartesianArray(cartesians, ellipsoid, result) {
|
|
7805
|
+
Check_default.defined("cartesians", cartesians);
|
|
7806
|
+
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
|
|
7807
|
+
let west = Number.MAX_VALUE;
|
|
7808
|
+
let east = -Number.MAX_VALUE;
|
|
7809
|
+
let westOverIDL = Number.MAX_VALUE;
|
|
7810
|
+
let eastOverIDL = -Number.MAX_VALUE;
|
|
7811
|
+
let south = Number.MAX_VALUE;
|
|
7812
|
+
let north = -Number.MAX_VALUE;
|
|
7813
|
+
for (let i = 0, len = cartesians.length; i < len; i++) {
|
|
7814
|
+
const position = ellipsoid.cartesianToCartographic(cartesians[i]);
|
|
7815
|
+
west = Math.min(west, position.longitude);
|
|
7816
|
+
east = Math.max(east, position.longitude);
|
|
7817
|
+
south = Math.min(south, position.latitude);
|
|
7818
|
+
north = Math.max(north, position.latitude);
|
|
7819
|
+
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
|
7820
|
+
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
|
7821
|
+
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
|
7822
|
+
}
|
|
7823
|
+
if (east - west > eastOverIDL - westOverIDL) {
|
|
7824
|
+
west = westOverIDL;
|
|
7825
|
+
east = eastOverIDL;
|
|
7826
|
+
if (east > Math_default.PI) {
|
|
7827
|
+
east = east - Math_default.TWO_PI;
|
|
7828
|
+
}
|
|
7829
|
+
if (west > Math_default.PI) {
|
|
7830
|
+
west = west - Math_default.TWO_PI;
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
if (!defined_default(result)) {
|
|
7834
|
+
return new _Rectangle(west, south, east, north);
|
|
7835
|
+
}
|
|
7836
|
+
result.west = west;
|
|
7837
|
+
result.south = south;
|
|
7838
|
+
result.east = east;
|
|
7839
|
+
result.north = north;
|
|
7840
|
+
return result;
|
|
7611
7841
|
}
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7842
|
+
/**
|
|
7843
|
+
* Create a rectangle from a bounding sphere, ignoring height.
|
|
7844
|
+
*
|
|
7845
|
+
*
|
|
7846
|
+
* @param {BoundingSphere} boundingSphere The bounding sphere.
|
|
7847
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid.
|
|
7848
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7849
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7850
|
+
*/
|
|
7851
|
+
static fromBoundingSphere(boundingSphere, ellipsoid, result) {
|
|
7852
|
+
Check_default.typeOf.object("boundingSphere", boundingSphere);
|
|
7853
|
+
const center = boundingSphere.center;
|
|
7854
|
+
const radius = boundingSphere.radius;
|
|
7855
|
+
if (!defined_default(ellipsoid)) {
|
|
7856
|
+
ellipsoid = Ellipsoid_default.default;
|
|
7857
|
+
}
|
|
7858
|
+
if (!defined_default(result)) {
|
|
7859
|
+
result = new _Rectangle();
|
|
7860
|
+
}
|
|
7861
|
+
if (Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
|
|
7862
|
+
_Rectangle.clone(_Rectangle.MAX_VALUE, result);
|
|
7863
|
+
return result;
|
|
7864
|
+
}
|
|
7865
|
+
const fromENU = Transforms_default.eastNorthUpToFixedFrame(
|
|
7866
|
+
center,
|
|
7867
|
+
ellipsoid,
|
|
7868
|
+
fromBoundingSphereMatrixScratch
|
|
7869
|
+
);
|
|
7870
|
+
const east = Matrix4_default.multiplyByPointAsVector(
|
|
7871
|
+
fromENU,
|
|
7872
|
+
Cartesian3_default.UNIT_X,
|
|
7873
|
+
fromBoundingSphereEastScratch
|
|
7618
7874
|
);
|
|
7875
|
+
Cartesian3_default.normalize(east, east);
|
|
7876
|
+
const north = Matrix4_default.multiplyByPointAsVector(
|
|
7877
|
+
fromENU,
|
|
7878
|
+
Cartesian3_default.UNIT_Y,
|
|
7879
|
+
fromBoundingSphereNorthScratch
|
|
7880
|
+
);
|
|
7881
|
+
Cartesian3_default.normalize(north, north);
|
|
7882
|
+
Cartesian3_default.multiplyByScalar(north, radius, north);
|
|
7883
|
+
Cartesian3_default.multiplyByScalar(east, radius, east);
|
|
7884
|
+
const south = Cartesian3_default.negate(north, fromBoundingSphereSouthScratch);
|
|
7885
|
+
const west = Cartesian3_default.negate(east, fromBoundingSphereWestScratch);
|
|
7886
|
+
const positions = fromBoundingSpherePositionsScratch;
|
|
7887
|
+
let corner = positions[0];
|
|
7888
|
+
Cartesian3_default.add(center, north, corner);
|
|
7889
|
+
corner = positions[1];
|
|
7890
|
+
Cartesian3_default.add(center, west, corner);
|
|
7891
|
+
corner = positions[2];
|
|
7892
|
+
Cartesian3_default.add(center, south, corner);
|
|
7893
|
+
corner = positions[3];
|
|
7894
|
+
Cartesian3_default.add(center, east, corner);
|
|
7895
|
+
positions[4] = center;
|
|
7896
|
+
return _Rectangle.fromCartesianArray(positions, ellipsoid, result);
|
|
7619
7897
|
}
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
}
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
}
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
const north = rectangle.north;
|
|
7645
|
-
Check_default.typeOf.number.greaterThanOrEquals(
|
|
7646
|
-
"north",
|
|
7647
|
-
north,
|
|
7648
|
-
-Math_default.PI_OVER_TWO
|
|
7649
|
-
);
|
|
7650
|
-
Check_default.typeOf.number.lessThanOrEquals("north", north, Math_default.PI_OVER_TWO);
|
|
7651
|
-
const south = rectangle.south;
|
|
7652
|
-
Check_default.typeOf.number.greaterThanOrEquals(
|
|
7653
|
-
"south",
|
|
7654
|
-
south,
|
|
7655
|
-
-Math_default.PI_OVER_TWO
|
|
7656
|
-
);
|
|
7657
|
-
Check_default.typeOf.number.lessThanOrEquals("south", south, Math_default.PI_OVER_TWO);
|
|
7658
|
-
const west = rectangle.west;
|
|
7659
|
-
Check_default.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
|
|
7660
|
-
Check_default.typeOf.number.lessThanOrEquals("west", west, Math.PI);
|
|
7661
|
-
const east = rectangle.east;
|
|
7662
|
-
Check_default.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
|
|
7663
|
-
Check_default.typeOf.number.lessThanOrEquals("east", east, Math.PI);
|
|
7664
|
-
};
|
|
7665
|
-
Rectangle.southwest = function(rectangle, result) {
|
|
7666
|
-
Check_default.typeOf.object("rectangle", rectangle);
|
|
7667
|
-
if (!defined_default(result)) {
|
|
7668
|
-
return new Cartographic_default(rectangle.west, rectangle.south);
|
|
7898
|
+
/**
|
|
7899
|
+
* Duplicates a Rectangle.
|
|
7900
|
+
*
|
|
7901
|
+
* @param {Rectangle} rectangle The rectangle to clone.
|
|
7902
|
+
* @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
|
|
7903
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)
|
|
7904
|
+
*/
|
|
7905
|
+
static clone(rectangle, result) {
|
|
7906
|
+
if (!defined_default(rectangle)) {
|
|
7907
|
+
return void 0;
|
|
7908
|
+
}
|
|
7909
|
+
if (!defined_default(result)) {
|
|
7910
|
+
return new _Rectangle(
|
|
7911
|
+
rectangle.west,
|
|
7912
|
+
rectangle.south,
|
|
7913
|
+
rectangle.east,
|
|
7914
|
+
rectangle.north
|
|
7915
|
+
);
|
|
7916
|
+
}
|
|
7917
|
+
result.west = rectangle.west;
|
|
7918
|
+
result.south = rectangle.south;
|
|
7919
|
+
result.east = rectangle.east;
|
|
7920
|
+
result.north = rectangle.north;
|
|
7921
|
+
return result;
|
|
7669
7922
|
}
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
Rectangle
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7923
|
+
/**
|
|
7924
|
+
* Compares the provided Rectangles componentwise and returns
|
|
7925
|
+
* <code>true</code> if they pass an absolute or relative tolerance test,
|
|
7926
|
+
* <code>false</code> otherwise.
|
|
7927
|
+
*
|
|
7928
|
+
* @param {Rectangle} [left] The first Rectangle.
|
|
7929
|
+
* @param {Rectangle} [right] The second Rectangle.
|
|
7930
|
+
* @param {number} [absoluteEpsilon=0] The absolute epsilon tolerance to use for equality testing.
|
|
7931
|
+
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
|
7932
|
+
*/
|
|
7933
|
+
static equalsEpsilon(left, right, absoluteEpsilon) {
|
|
7934
|
+
absoluteEpsilon = absoluteEpsilon ?? 0;
|
|
7935
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left.west - right.west) <= absoluteEpsilon && Math.abs(left.south - right.south) <= absoluteEpsilon && Math.abs(left.east - right.east) <= absoluteEpsilon && Math.abs(left.north - right.north) <= absoluteEpsilon;
|
|
7679
7936
|
}
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
}
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
return new Cartographic_default(rectangle.east, rectangle.north);
|
|
7937
|
+
/**
|
|
7938
|
+
* Duplicates this Rectangle.
|
|
7939
|
+
*
|
|
7940
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
7941
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
7942
|
+
*/
|
|
7943
|
+
clone(result) {
|
|
7944
|
+
return _Rectangle.clone(this, result);
|
|
7689
7945
|
}
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
}
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
return
|
|
7946
|
+
/**
|
|
7947
|
+
* Compares the provided Rectangle with this Rectangle componentwise and returns
|
|
7948
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
7949
|
+
*
|
|
7950
|
+
* @param {Rectangle} [other] The Rectangle to compare.
|
|
7951
|
+
* @returns {boolean} <code>true</code> if the Rectangles are equal, <code>false</code> otherwise.
|
|
7952
|
+
*/
|
|
7953
|
+
equals(other) {
|
|
7954
|
+
return _Rectangle.equals(this, other);
|
|
7699
7955
|
}
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
}
|
|
7705
|
-
Rectangle
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
east += Math_default.TWO_PI;
|
|
7956
|
+
/**
|
|
7957
|
+
* Compares the provided rectangles and returns <code>true</code> if they are equal,
|
|
7958
|
+
* <code>false</code> otherwise.
|
|
7959
|
+
*
|
|
7960
|
+
* @param {Rectangle} [left] The first Rectangle.
|
|
7961
|
+
* @param {Rectangle} [right] The second Rectangle.
|
|
7962
|
+
* @returns {boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>.
|
|
7963
|
+
*/
|
|
7964
|
+
static equals(left, right) {
|
|
7965
|
+
return left === right || defined_default(left) && defined_default(right) && left.west === right.west && left.south === right.south && left.east === right.east && left.north === right.north;
|
|
7711
7966
|
}
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7967
|
+
/**
|
|
7968
|
+
* Compares the provided Rectangle with this Rectangle componentwise and returns
|
|
7969
|
+
* <code>true</code> if they are within the provided epsilon,
|
|
7970
|
+
* <code>false</code> otherwise.
|
|
7971
|
+
*
|
|
7972
|
+
* @param {Rectangle} [other] The Rectangle to compare.
|
|
7973
|
+
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
7974
|
+
* @returns {boolean} <code>true</code> if the Rectangles are within the provided epsilon, <code>false</code> otherwise.
|
|
7975
|
+
*/
|
|
7976
|
+
equalsEpsilon(other, epsilon) {
|
|
7977
|
+
return _Rectangle.equalsEpsilon(this, other, epsilon);
|
|
7716
7978
|
}
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7979
|
+
/**
|
|
7980
|
+
* Checks a Rectangle's properties and throws if they are not in valid ranges.
|
|
7981
|
+
*
|
|
7982
|
+
* @param {Rectangle} rectangle The rectangle to validate
|
|
7983
|
+
*
|
|
7984
|
+
* @exception {DeveloperError} <code>north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
|
|
7985
|
+
* @exception {DeveloperError} <code>south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
|
|
7986
|
+
* @exception {DeveloperError} <code>east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
|
|
7987
|
+
* @exception {DeveloperError} <code>west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
|
|
7988
|
+
* @private
|
|
7989
|
+
*/
|
|
7990
|
+
static _validate(rectangle) {
|
|
7991
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
7992
|
+
const north = rectangle.north;
|
|
7993
|
+
Check_default.typeOf.number.greaterThanOrEquals(
|
|
7994
|
+
"north",
|
|
7995
|
+
north,
|
|
7996
|
+
-Math_default.PI_OVER_TWO
|
|
7997
|
+
);
|
|
7998
|
+
Check_default.typeOf.number.lessThanOrEquals(
|
|
7999
|
+
"north",
|
|
8000
|
+
north,
|
|
8001
|
+
Math_default.PI_OVER_TWO
|
|
8002
|
+
);
|
|
8003
|
+
const south = rectangle.south;
|
|
8004
|
+
Check_default.typeOf.number.greaterThanOrEquals(
|
|
8005
|
+
"south",
|
|
8006
|
+
south,
|
|
8007
|
+
-Math_default.PI_OVER_TWO
|
|
8008
|
+
);
|
|
8009
|
+
Check_default.typeOf.number.lessThanOrEquals(
|
|
8010
|
+
"south",
|
|
8011
|
+
south,
|
|
8012
|
+
Math_default.PI_OVER_TWO
|
|
8013
|
+
);
|
|
8014
|
+
const west = rectangle.west;
|
|
8015
|
+
Check_default.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
|
|
8016
|
+
Check_default.typeOf.number.lessThanOrEquals("west", west, Math.PI);
|
|
8017
|
+
const east = rectangle.east;
|
|
8018
|
+
Check_default.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
|
|
8019
|
+
Check_default.typeOf.number.lessThanOrEquals("east", east, Math.PI);
|
|
7747
8020
|
}
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
8021
|
+
/**
|
|
8022
|
+
* Computes the southwest corner of a rectangle.
|
|
8023
|
+
*
|
|
8024
|
+
* @param {Rectangle} rectangle The rectangle for which to find the corner
|
|
8025
|
+
* @param {Cartographic} [result] The object onto which to store the result.
|
|
8026
|
+
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
|
|
8027
|
+
*/
|
|
8028
|
+
static southwest(rectangle, result) {
|
|
8029
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8030
|
+
if (!defined_default(result)) {
|
|
8031
|
+
return new Cartographic_default(rectangle.west, rectangle.south);
|
|
8032
|
+
}
|
|
8033
|
+
result.longitude = rectangle.west;
|
|
8034
|
+
result.latitude = rectangle.south;
|
|
8035
|
+
result.height = 0;
|
|
8036
|
+
return result;
|
|
7752
8037
|
}
|
|
7753
|
-
|
|
7754
|
-
|
|
8038
|
+
/**
|
|
8039
|
+
* Computes the northwest corner of a rectangle.
|
|
8040
|
+
*
|
|
8041
|
+
* @param {Rectangle} rectangle The rectangle for which to find the corner
|
|
8042
|
+
* @param {Cartographic} [result] The object onto which to store the result.
|
|
8043
|
+
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
|
|
8044
|
+
*/
|
|
8045
|
+
static northwest(rectangle, result) {
|
|
8046
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8047
|
+
if (!defined_default(result)) {
|
|
8048
|
+
return new Cartographic_default(rectangle.west, rectangle.north);
|
|
8049
|
+
}
|
|
8050
|
+
result.longitude = rectangle.west;
|
|
8051
|
+
result.latitude = rectangle.north;
|
|
8052
|
+
result.height = 0;
|
|
8053
|
+
return result;
|
|
7755
8054
|
}
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
}
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
8055
|
+
/**
|
|
8056
|
+
* Computes the northeast corner of a rectangle.
|
|
8057
|
+
*
|
|
8058
|
+
* @param {Rectangle} rectangle The rectangle for which to find the corner
|
|
8059
|
+
* @param {Cartographic} [result] The object onto which to store the result.
|
|
8060
|
+
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
|
|
8061
|
+
*/
|
|
8062
|
+
static northeast(rectangle, result) {
|
|
8063
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8064
|
+
if (!defined_default(result)) {
|
|
8065
|
+
return new Cartographic_default(rectangle.east, rectangle.north);
|
|
8066
|
+
}
|
|
8067
|
+
result.longitude = rectangle.east;
|
|
8068
|
+
result.latitude = rectangle.north;
|
|
8069
|
+
result.height = 0;
|
|
8070
|
+
return result;
|
|
7771
8071
|
}
|
|
7772
|
-
|
|
7773
|
-
|
|
8072
|
+
/**
|
|
8073
|
+
* Computes the southeast corner of a rectangle.
|
|
8074
|
+
*
|
|
8075
|
+
* @param {Rectangle} rectangle The rectangle for which to find the corner
|
|
8076
|
+
* @param {Cartographic} [result] The object onto which to store the result.
|
|
8077
|
+
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
|
|
8078
|
+
*/
|
|
8079
|
+
static southeast(rectangle, result) {
|
|
8080
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8081
|
+
if (!defined_default(result)) {
|
|
8082
|
+
return new Cartographic_default(rectangle.east, rectangle.south);
|
|
8083
|
+
}
|
|
8084
|
+
result.longitude = rectangle.east;
|
|
8085
|
+
result.latitude = rectangle.south;
|
|
8086
|
+
result.height = 0;
|
|
8087
|
+
return result;
|
|
7774
8088
|
}
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
}
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
} else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
|
|
7799
|
-
rectangleWest += Math_default.TWO_PI;
|
|
7800
|
-
}
|
|
7801
|
-
const west = Math_default.negativePiToPi(
|
|
7802
|
-
Math.min(rectangleWest, otherRectangleWest)
|
|
7803
|
-
);
|
|
7804
|
-
const east = Math_default.negativePiToPi(
|
|
7805
|
-
Math.max(rectangleEast, otherRectangleEast)
|
|
7806
|
-
);
|
|
7807
|
-
result.west = west;
|
|
7808
|
-
result.south = Math.min(rectangle.south, otherRectangle.south);
|
|
7809
|
-
result.east = east;
|
|
7810
|
-
result.north = Math.max(rectangle.north, otherRectangle.north);
|
|
7811
|
-
return result;
|
|
7812
|
-
};
|
|
7813
|
-
Rectangle.expand = function(rectangle, cartographic, result) {
|
|
7814
|
-
Check_default.typeOf.object("rectangle", rectangle);
|
|
7815
|
-
Check_default.typeOf.object("cartographic", cartographic);
|
|
7816
|
-
if (!defined_default(result)) {
|
|
7817
|
-
result = new Rectangle();
|
|
8089
|
+
/**
|
|
8090
|
+
* Computes the center of a rectangle.
|
|
8091
|
+
*
|
|
8092
|
+
* @param {Rectangle} rectangle The rectangle for which to find the center
|
|
8093
|
+
* @param {Cartographic} [result] The object onto which to store the result.
|
|
8094
|
+
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
|
|
8095
|
+
*/
|
|
8096
|
+
static center(rectangle, result) {
|
|
8097
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8098
|
+
let east = rectangle.east;
|
|
8099
|
+
const west = rectangle.west;
|
|
8100
|
+
if (east < west) {
|
|
8101
|
+
east += Math_default.TWO_PI;
|
|
8102
|
+
}
|
|
8103
|
+
const longitude = Math_default.negativePiToPi((west + east) * 0.5);
|
|
8104
|
+
const latitude = (rectangle.south + rectangle.north) * 0.5;
|
|
8105
|
+
if (!defined_default(result)) {
|
|
8106
|
+
return new Cartographic_default(longitude, latitude);
|
|
8107
|
+
}
|
|
8108
|
+
result.longitude = longitude;
|
|
8109
|
+
result.latitude = latitude;
|
|
8110
|
+
result.height = 0;
|
|
8111
|
+
return result;
|
|
7818
8112
|
}
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
}
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
8113
|
+
/**
|
|
8114
|
+
* Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are
|
|
8115
|
+
* latitude and longitude in radians and produces a correct intersection, taking into account the fact that
|
|
8116
|
+
* the same angle can be represented with multiple values as well as the wrapping of longitude at the
|
|
8117
|
+
* anti-meridian. For a simple intersection that ignores these factors and can be used with projected
|
|
8118
|
+
* coordinates, see {@link Rectangle.simpleIntersection}.
|
|
8119
|
+
*
|
|
8120
|
+
* @param {Rectangle} rectangle On rectangle to find an intersection
|
|
8121
|
+
* @param {Rectangle} otherRectangle Another rectangle to find an intersection
|
|
8122
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
8123
|
+
* @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
|
|
8124
|
+
*/
|
|
8125
|
+
static intersection(rectangle, otherRectangle, result) {
|
|
8126
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8127
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
|
8128
|
+
let rectangleEast = rectangle.east;
|
|
8129
|
+
let rectangleWest = rectangle.west;
|
|
8130
|
+
let otherRectangleEast = otherRectangle.east;
|
|
8131
|
+
let otherRectangleWest = otherRectangle.west;
|
|
8132
|
+
if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
|
|
8133
|
+
rectangleEast += Math_default.TWO_PI;
|
|
8134
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
|
|
8135
|
+
otherRectangleEast += Math_default.TWO_PI;
|
|
8136
|
+
}
|
|
8137
|
+
if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
|
|
8138
|
+
otherRectangleWest += Math_default.TWO_PI;
|
|
8139
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
|
|
8140
|
+
rectangleWest += Math_default.TWO_PI;
|
|
7836
8141
|
}
|
|
8142
|
+
const west = Math_default.negativePiToPi(
|
|
8143
|
+
Math.max(rectangleWest, otherRectangleWest)
|
|
8144
|
+
);
|
|
8145
|
+
const east = Math_default.negativePiToPi(
|
|
8146
|
+
Math.min(rectangleEast, otherRectangleEast)
|
|
8147
|
+
);
|
|
8148
|
+
if ((rectangle.west < rectangle.east || otherRectangle.west < otherRectangle.east) && east <= west) {
|
|
8149
|
+
return void 0;
|
|
8150
|
+
}
|
|
8151
|
+
const south = Math.max(rectangle.south, otherRectangle.south);
|
|
8152
|
+
const north = Math.min(rectangle.north, otherRectangle.north);
|
|
8153
|
+
if (south >= north) {
|
|
8154
|
+
return void 0;
|
|
8155
|
+
}
|
|
8156
|
+
if (!defined_default(result)) {
|
|
8157
|
+
return new _Rectangle(west, south, east, north);
|
|
8158
|
+
}
|
|
8159
|
+
result.west = west;
|
|
8160
|
+
result.south = south;
|
|
8161
|
+
result.east = east;
|
|
8162
|
+
result.north = north;
|
|
8163
|
+
return result;
|
|
7837
8164
|
}
|
|
7838
|
-
|
|
7839
|
-
}
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
length++;
|
|
7868
|
-
if (north < 0) {
|
|
7869
|
-
lla.latitude = north;
|
|
7870
|
-
} else if (south > 0) {
|
|
7871
|
-
lla.latitude = south;
|
|
7872
|
-
} else {
|
|
7873
|
-
lla.latitude = 0;
|
|
8165
|
+
/**
|
|
8166
|
+
* Computes a simple intersection of two rectangles. Unlike {@link Rectangle.intersection}, this function
|
|
8167
|
+
* does not attempt to put the angular coordinates into a consistent range or to account for crossing the
|
|
8168
|
+
* anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude
|
|
8169
|
+
* and longitude (i.e. projected coordinates).
|
|
8170
|
+
*
|
|
8171
|
+
* @param {Rectangle} rectangle On rectangle to find an intersection
|
|
8172
|
+
* @param {Rectangle} otherRectangle Another rectangle to find an intersection
|
|
8173
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
8174
|
+
* @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
|
|
8175
|
+
*/
|
|
8176
|
+
static simpleIntersection(rectangle, otherRectangle, result) {
|
|
8177
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8178
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
|
8179
|
+
const west = Math.max(rectangle.west, otherRectangle.west);
|
|
8180
|
+
const south = Math.max(rectangle.south, otherRectangle.south);
|
|
8181
|
+
const east = Math.min(rectangle.east, otherRectangle.east);
|
|
8182
|
+
const north = Math.min(rectangle.north, otherRectangle.north);
|
|
8183
|
+
if (south >= north || west >= east) {
|
|
8184
|
+
return void 0;
|
|
8185
|
+
}
|
|
8186
|
+
if (!defined_default(result)) {
|
|
8187
|
+
return new _Rectangle(west, south, east, north);
|
|
8188
|
+
}
|
|
8189
|
+
result.west = west;
|
|
8190
|
+
result.south = south;
|
|
8191
|
+
result.east = east;
|
|
8192
|
+
result.north = north;
|
|
8193
|
+
return result;
|
|
7874
8194
|
}
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
8195
|
+
/**
|
|
8196
|
+
* Computes a rectangle that is the union of two rectangles.
|
|
8197
|
+
*
|
|
8198
|
+
* @param {Rectangle} rectangle A rectangle to enclose in rectangle.
|
|
8199
|
+
* @param {Rectangle} otherRectangle A rectangle to enclose in a rectangle.
|
|
8200
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
8201
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
8202
|
+
*/
|
|
8203
|
+
static union(rectangle, otherRectangle, result) {
|
|
8204
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8205
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
|
8206
|
+
if (!defined_default(result)) {
|
|
8207
|
+
result = new _Rectangle();
|
|
8208
|
+
}
|
|
8209
|
+
let rectangleEast = rectangle.east;
|
|
8210
|
+
let rectangleWest = rectangle.west;
|
|
8211
|
+
let otherRectangleEast = otherRectangle.east;
|
|
8212
|
+
let otherRectangleWest = otherRectangle.west;
|
|
8213
|
+
if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
|
|
8214
|
+
rectangleEast += Math_default.TWO_PI;
|
|
8215
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
|
|
8216
|
+
otherRectangleEast += Math_default.TWO_PI;
|
|
8217
|
+
}
|
|
8218
|
+
if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
|
|
8219
|
+
otherRectangleWest += Math_default.TWO_PI;
|
|
8220
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
|
|
8221
|
+
rectangleWest += Math_default.TWO_PI;
|
|
8222
|
+
}
|
|
8223
|
+
const west = Math_default.negativePiToPi(
|
|
8224
|
+
Math.min(rectangleWest, otherRectangleWest)
|
|
8225
|
+
);
|
|
8226
|
+
const east = Math_default.negativePiToPi(
|
|
8227
|
+
Math.max(rectangleEast, otherRectangleEast)
|
|
8228
|
+
);
|
|
8229
|
+
result.west = west;
|
|
8230
|
+
result.south = Math.min(rectangle.south, otherRectangle.south);
|
|
8231
|
+
result.east = east;
|
|
8232
|
+
result.north = Math.max(rectangle.north, otherRectangle.north);
|
|
8233
|
+
return result;
|
|
8234
|
+
}
|
|
8235
|
+
/**
|
|
8236
|
+
* Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
|
|
8237
|
+
*
|
|
8238
|
+
* @param {Rectangle} rectangle A rectangle to expand.
|
|
8239
|
+
* @param {Cartographic} cartographic A cartographic to enclose in a rectangle.
|
|
8240
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
8241
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if one was not provided.
|
|
8242
|
+
*/
|
|
8243
|
+
static expand(rectangle, cartographic, result) {
|
|
8244
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8245
|
+
Check_default.typeOf.object("cartographic", cartographic);
|
|
8246
|
+
if (!defined_default(result)) {
|
|
8247
|
+
result = new _Rectangle();
|
|
8248
|
+
}
|
|
8249
|
+
result.west = Math.min(rectangle.west, cartographic.longitude);
|
|
8250
|
+
result.south = Math.min(rectangle.south, cartographic.latitude);
|
|
8251
|
+
result.east = Math.max(rectangle.east, cartographic.longitude);
|
|
8252
|
+
result.north = Math.max(rectangle.north, cartographic.latitude);
|
|
8253
|
+
return result;
|
|
8254
|
+
}
|
|
8255
|
+
/**
|
|
8256
|
+
* Returns true if the cartographic is on or inside the rectangle, false otherwise.
|
|
8257
|
+
*
|
|
8258
|
+
* @param {Rectangle} rectangle The rectangle
|
|
8259
|
+
* @param {Cartographic} cartographic The cartographic to test.
|
|
8260
|
+
* @returns {boolean} true if the provided cartographic is inside the rectangle, false otherwise.
|
|
8261
|
+
*/
|
|
8262
|
+
static contains(rectangle, cartographic) {
|
|
8263
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8264
|
+
Check_default.typeOf.object("cartographic", cartographic);
|
|
8265
|
+
let longitude = cartographic.longitude;
|
|
8266
|
+
const latitude = cartographic.latitude;
|
|
8267
|
+
const west = rectangle.west;
|
|
8268
|
+
let east = rectangle.east;
|
|
8269
|
+
if (east < west) {
|
|
8270
|
+
east += Math_default.TWO_PI;
|
|
8271
|
+
if (longitude < 0) {
|
|
8272
|
+
longitude += Math_default.TWO_PI;
|
|
8273
|
+
}
|
|
7880
8274
|
}
|
|
8275
|
+
return (longitude > west || Math_default.equalsEpsilon(longitude, west, Math_default.EPSILON14)) && (longitude < east || Math_default.equalsEpsilon(longitude, east, Math_default.EPSILON14)) && latitude >= rectangle.south && latitude <= rectangle.north;
|
|
7881
8276
|
}
|
|
7882
|
-
|
|
8277
|
+
/**
|
|
8278
|
+
* Samples a rectangle so that it includes a list of Cartesian points suitable for passing to
|
|
8279
|
+
* {@link BoundingSphere#fromPoints}. Sampling is necessary to account
|
|
8280
|
+
* for rectangles that cover the poles or cross the equator.
|
|
8281
|
+
*
|
|
8282
|
+
* @param {Rectangle} rectangle The rectangle to subsample.
|
|
8283
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid to use.
|
|
8284
|
+
* @param {number} [surfaceHeight=0.0] The height of the rectangle above the ellipsoid.
|
|
8285
|
+
* @param {Cartesian3[]} [result] The array of Cartesians onto which to store the result.
|
|
8286
|
+
* @returns {Cartesian3[]} The modified result parameter or a new Array of Cartesians instances if none was provided.
|
|
8287
|
+
*/
|
|
8288
|
+
static subsample(rectangle, ellipsoid, surfaceHeight, result) {
|
|
8289
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8290
|
+
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
|
|
8291
|
+
surfaceHeight = surfaceHeight ?? 0;
|
|
8292
|
+
if (!defined_default(result)) {
|
|
8293
|
+
result = [];
|
|
8294
|
+
}
|
|
8295
|
+
let length = 0;
|
|
8296
|
+
const north = rectangle.north;
|
|
8297
|
+
const south = rectangle.south;
|
|
8298
|
+
const east = rectangle.east;
|
|
8299
|
+
const west = rectangle.west;
|
|
8300
|
+
const lla = subsampleLlaScratch;
|
|
8301
|
+
lla.height = surfaceHeight;
|
|
7883
8302
|
lla.longitude = west;
|
|
8303
|
+
lla.latitude = north;
|
|
7884
8304
|
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
7885
8305
|
length++;
|
|
7886
8306
|
lla.longitude = east;
|
|
7887
8307
|
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
7888
8308
|
length++;
|
|
8309
|
+
lla.latitude = south;
|
|
8310
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
8311
|
+
length++;
|
|
8312
|
+
lla.longitude = west;
|
|
8313
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
8314
|
+
length++;
|
|
8315
|
+
if (north < 0) {
|
|
8316
|
+
lla.latitude = north;
|
|
8317
|
+
} else if (south > 0) {
|
|
8318
|
+
lla.latitude = south;
|
|
8319
|
+
} else {
|
|
8320
|
+
lla.latitude = 0;
|
|
8321
|
+
}
|
|
8322
|
+
for (let i = 1; i < 8; ++i) {
|
|
8323
|
+
lla.longitude = -Math.PI + i * Math_default.PI_OVER_TWO;
|
|
8324
|
+
if (_Rectangle.contains(rectangle, lla)) {
|
|
8325
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
8326
|
+
length++;
|
|
8327
|
+
}
|
|
8328
|
+
}
|
|
8329
|
+
if (lla.latitude === 0) {
|
|
8330
|
+
lla.longitude = west;
|
|
8331
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
8332
|
+
length++;
|
|
8333
|
+
lla.longitude = east;
|
|
8334
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
|
8335
|
+
length++;
|
|
8336
|
+
}
|
|
8337
|
+
result.length = length;
|
|
8338
|
+
return result;
|
|
7889
8339
|
}
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
Rectangle
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
result.
|
|
8340
|
+
/**
|
|
8341
|
+
* Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].
|
|
8342
|
+
*
|
|
8343
|
+
* @param {Rectangle} rectangle The rectangle to subsection.
|
|
8344
|
+
* @param {number} westLerp The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.
|
|
8345
|
+
* @param {number} southLerp The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.
|
|
8346
|
+
* @param {number} eastLerp The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.
|
|
8347
|
+
* @param {number} northLerp The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.
|
|
8348
|
+
* @param {Rectangle} [result] The object onto which to store the result.
|
|
8349
|
+
* @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
|
|
8350
|
+
*/
|
|
8351
|
+
static subsection(rectangle, westLerp, southLerp, eastLerp, northLerp, result) {
|
|
8352
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
8353
|
+
Check_default.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0);
|
|
8354
|
+
Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1);
|
|
8355
|
+
Check_default.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0);
|
|
8356
|
+
Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1);
|
|
8357
|
+
Check_default.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0);
|
|
8358
|
+
Check_default.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1);
|
|
8359
|
+
Check_default.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0);
|
|
8360
|
+
Check_default.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1);
|
|
8361
|
+
Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
|
|
8362
|
+
Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
|
|
8363
|
+
if (!defined_default(result)) {
|
|
8364
|
+
result = new _Rectangle();
|
|
8365
|
+
}
|
|
8366
|
+
if (rectangle.west <= rectangle.east) {
|
|
8367
|
+
const width = rectangle.east - rectangle.west;
|
|
8368
|
+
result.west = rectangle.west + westLerp * width;
|
|
8369
|
+
result.east = rectangle.west + eastLerp * width;
|
|
8370
|
+
} else {
|
|
8371
|
+
const width = Math_default.TWO_PI + rectangle.east - rectangle.west;
|
|
8372
|
+
result.west = Math_default.negativePiToPi(
|
|
8373
|
+
rectangle.west + westLerp * width
|
|
8374
|
+
);
|
|
8375
|
+
result.east = Math_default.negativePiToPi(
|
|
8376
|
+
rectangle.west + eastLerp * width
|
|
8377
|
+
);
|
|
8378
|
+
}
|
|
8379
|
+
const height = rectangle.north - rectangle.south;
|
|
8380
|
+
result.south = rectangle.south + southLerp * height;
|
|
8381
|
+
result.north = rectangle.south + northLerp * height;
|
|
8382
|
+
if (westLerp === 1) {
|
|
8383
|
+
result.west = rectangle.east;
|
|
8384
|
+
}
|
|
8385
|
+
if (eastLerp === 1) {
|
|
8386
|
+
result.east = rectangle.east;
|
|
8387
|
+
}
|
|
8388
|
+
if (southLerp === 1) {
|
|
8389
|
+
result.south = rectangle.north;
|
|
8390
|
+
}
|
|
8391
|
+
if (northLerp === 1) {
|
|
8392
|
+
result.north = rectangle.north;
|
|
8393
|
+
}
|
|
8394
|
+
return result;
|
|
7931
8395
|
}
|
|
7932
|
-
return result;
|
|
7933
8396
|
};
|
|
8397
|
+
Rectangle.packedLength = 4;
|
|
8398
|
+
var fromBoundingSphereMatrixScratch = new Matrix4_default();
|
|
8399
|
+
var fromBoundingSphereEastScratch = new Cartesian3_default();
|
|
8400
|
+
var fromBoundingSphereNorthScratch = new Cartesian3_default();
|
|
8401
|
+
var fromBoundingSphereWestScratch = new Cartesian3_default();
|
|
8402
|
+
var fromBoundingSphereSouthScratch = new Cartesian3_default();
|
|
8403
|
+
var fromBoundingSpherePositionsScratch = new Array(5);
|
|
8404
|
+
for (let n = 0; n < fromBoundingSpherePositionsScratch.length; ++n) {
|
|
8405
|
+
fromBoundingSpherePositionsScratch[n] = new Cartesian3_default();
|
|
8406
|
+
}
|
|
8407
|
+
var subsampleLlaScratch = new Cartographic_default();
|
|
7934
8408
|
Rectangle.MAX_VALUE = Object.freeze(
|
|
7935
8409
|
new Rectangle(
|
|
7936
8410
|
-Math.PI,
|
|
@@ -7942,413 +8416,803 @@ Rectangle.MAX_VALUE = Object.freeze(
|
|
|
7942
8416
|
var Rectangle_default = Rectangle;
|
|
7943
8417
|
|
|
7944
8418
|
// packages/engine/Source/Core/Matrix2.js
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
array[startingIndex++] = value[1];
|
|
7958
|
-
array[startingIndex++] = value[2];
|
|
7959
|
-
array[startingIndex++] = value[3];
|
|
7960
|
-
return array;
|
|
7961
|
-
};
|
|
7962
|
-
Matrix2.unpack = function(array, startingIndex, result) {
|
|
7963
|
-
Check_default.defined("array", array);
|
|
7964
|
-
startingIndex = startingIndex ?? 0;
|
|
7965
|
-
if (!defined_default(result)) {
|
|
7966
|
-
result = new Matrix2();
|
|
8419
|
+
var Matrix2 = class _Matrix2 {
|
|
8420
|
+
/**
|
|
8421
|
+
* @param {number} [column0Row0=0.0] The value for column 0, row 0.
|
|
8422
|
+
* @param {number} [column1Row0=0.0] The value for column 1, row 0.
|
|
8423
|
+
* @param {number} [column0Row1=0.0] The value for column 0, row 1.
|
|
8424
|
+
* @param {number} [column1Row1=0.0] The value for column 1, row 1.
|
|
8425
|
+
*/
|
|
8426
|
+
constructor(column0Row0, column1Row0, column0Row1, column1Row1) {
|
|
8427
|
+
this[0] = column0Row0 ?? 0;
|
|
8428
|
+
this[1] = column0Row1 ?? 0;
|
|
8429
|
+
this[2] = column1Row0 ?? 0;
|
|
8430
|
+
this[3] = column1Row1 ?? 0;
|
|
7967
8431
|
}
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
}
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
8432
|
+
/**
|
|
8433
|
+
* Stores the provided instance into the provided array.
|
|
8434
|
+
*
|
|
8435
|
+
* @param {Matrix2} value The value to pack.
|
|
8436
|
+
* @param {number[]} array The array to pack into.
|
|
8437
|
+
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
8438
|
+
*
|
|
8439
|
+
* @returns {number[]} The array that was packed into
|
|
8440
|
+
*/
|
|
8441
|
+
static pack(value, array, startingIndex) {
|
|
8442
|
+
Check_default.typeOf.object("value", value);
|
|
8443
|
+
Check_default.defined("array", array);
|
|
8444
|
+
startingIndex = startingIndex ?? 0;
|
|
8445
|
+
array[startingIndex++] = value[0];
|
|
8446
|
+
array[startingIndex++] = value[1];
|
|
8447
|
+
array[startingIndex++] = value[2];
|
|
8448
|
+
array[startingIndex++] = value[3];
|
|
8449
|
+
return array;
|
|
7986
8450
|
}
|
|
7987
|
-
|
|
7988
|
-
|
|
8451
|
+
/**
|
|
8452
|
+
* Retrieves an instance from a packed array.
|
|
8453
|
+
*
|
|
8454
|
+
* @param {number[]} array The packed array.
|
|
8455
|
+
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
8456
|
+
* @param {Matrix2} [result] The object into which to store the result.
|
|
8457
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
8458
|
+
*/
|
|
8459
|
+
static unpack(array, startingIndex, result) {
|
|
8460
|
+
Check_default.defined("array", array);
|
|
8461
|
+
startingIndex = startingIndex ?? 0;
|
|
8462
|
+
if (!defined_default(result)) {
|
|
8463
|
+
result = new _Matrix2();
|
|
8464
|
+
}
|
|
8465
|
+
result[0] = array[startingIndex++];
|
|
8466
|
+
result[1] = array[startingIndex++];
|
|
8467
|
+
result[2] = array[startingIndex++];
|
|
8468
|
+
result[3] = array[startingIndex++];
|
|
8469
|
+
return result;
|
|
7989
8470
|
}
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
8471
|
+
/**
|
|
8472
|
+
* Flattens an array of Matrix2s into an array of components. The components
|
|
8473
|
+
* are stored in column-major order.
|
|
8474
|
+
*
|
|
8475
|
+
* @param {Matrix2[]} array The array of matrices to pack.
|
|
8476
|
+
* @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
|
|
8477
|
+
* @returns {number[]} The packed array.
|
|
8478
|
+
*/
|
|
8479
|
+
static packArray(array, result) {
|
|
8480
|
+
Check_default.defined("array", array);
|
|
8481
|
+
const length = array.length;
|
|
8482
|
+
const resultLength = length * 4;
|
|
8483
|
+
if (!defined_default(result)) {
|
|
8484
|
+
result = new Array(resultLength);
|
|
8485
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
8486
|
+
throw new DeveloperError_default(
|
|
8487
|
+
"If result is a typed array, it must have exactly array.length * 4 elements"
|
|
8488
|
+
);
|
|
8489
|
+
} else if (result.length !== resultLength) {
|
|
8490
|
+
result.length = resultLength;
|
|
8491
|
+
}
|
|
8492
|
+
for (let i = 0; i < length; ++i) {
|
|
8493
|
+
_Matrix2.pack(array[i], result, i * 4);
|
|
8494
|
+
}
|
|
8495
|
+
return result;
|
|
7997
8496
|
}
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8497
|
+
/**
|
|
8498
|
+
* Unpacks an array of column-major matrix components into an array of Matrix2s.
|
|
8499
|
+
*
|
|
8500
|
+
* @param {number[]} array The array of components to unpack.
|
|
8501
|
+
* @param {Matrix2[]} [result] The array onto which to store the result.
|
|
8502
|
+
* @returns {Matrix2[]} The unpacked array.
|
|
8503
|
+
*/
|
|
8504
|
+
static unpackArray(array, result) {
|
|
8505
|
+
Check_default.defined("array", array);
|
|
8506
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
|
8507
|
+
if (array.length % 4 !== 0) {
|
|
8508
|
+
throw new DeveloperError_default("array length must be a multiple of 4.");
|
|
8509
|
+
}
|
|
8510
|
+
const length = array.length;
|
|
8511
|
+
if (!defined_default(result)) {
|
|
8512
|
+
result = new Array(length / 4);
|
|
8513
|
+
} else {
|
|
8514
|
+
result.length = length / 4;
|
|
8515
|
+
}
|
|
8516
|
+
for (let i = 0; i < length; i += 4) {
|
|
8517
|
+
const index = i / 4;
|
|
8518
|
+
result[index] = _Matrix2.unpack(array, i, result[index]);
|
|
8519
|
+
}
|
|
8520
|
+
return result;
|
|
8003
8521
|
}
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8522
|
+
/**
|
|
8523
|
+
* Duplicates a Matrix2 instance.
|
|
8524
|
+
*
|
|
8525
|
+
* @param {Matrix2} matrix The matrix to duplicate.
|
|
8526
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
|
8527
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided. (Returns undefined if matrix is undefined)
|
|
8528
|
+
*/
|
|
8529
|
+
static clone(matrix, result) {
|
|
8530
|
+
if (!defined_default(matrix)) {
|
|
8531
|
+
return void 0;
|
|
8532
|
+
}
|
|
8533
|
+
if (!defined_default(result)) {
|
|
8534
|
+
return new _Matrix2(matrix[0], matrix[2], matrix[1], matrix[3]);
|
|
8535
|
+
}
|
|
8536
|
+
result[0] = matrix[0];
|
|
8537
|
+
result[1] = matrix[1];
|
|
8538
|
+
result[2] = matrix[2];
|
|
8539
|
+
result[3] = matrix[3];
|
|
8540
|
+
return result;
|
|
8007
8541
|
}
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8542
|
+
/**
|
|
8543
|
+
* Creates a Matrix2 instance from a column-major order array.
|
|
8544
|
+
*
|
|
8545
|
+
* @param {number[]} values The column-major order array.
|
|
8546
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
8547
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
8548
|
+
*/
|
|
8549
|
+
static fromColumnMajorArray(values, result) {
|
|
8550
|
+
Check_default.defined("values", values);
|
|
8551
|
+
return _Matrix2.clone(values, result);
|
|
8013
8552
|
}
|
|
8014
|
-
|
|
8015
|
-
|
|
8553
|
+
/**
|
|
8554
|
+
* Creates a Matrix2 instance from a row-major order array.
|
|
8555
|
+
* The resulting matrix will be in column-major order.
|
|
8556
|
+
*
|
|
8557
|
+
* @param {number[]} values The row-major order array.
|
|
8558
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
8559
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
8560
|
+
*/
|
|
8561
|
+
static fromRowMajorArray(values, result) {
|
|
8562
|
+
Check_default.defined("values", values);
|
|
8563
|
+
if (!defined_default(result)) {
|
|
8564
|
+
return new _Matrix2(values[0], values[1], values[2], values[3]);
|
|
8565
|
+
}
|
|
8566
|
+
result[0] = values[0];
|
|
8567
|
+
result[1] = values[2];
|
|
8568
|
+
result[2] = values[1];
|
|
8569
|
+
result[3] = values[3];
|
|
8570
|
+
return result;
|
|
8016
8571
|
}
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
}
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8572
|
+
/**
|
|
8573
|
+
* Computes a Matrix2 instance representing a non-uniform scale.
|
|
8574
|
+
*
|
|
8575
|
+
* @param {Cartesian2} scale The x and y scale factors.
|
|
8576
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
8577
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
8578
|
+
*
|
|
8579
|
+
* @example
|
|
8580
|
+
* // Creates
|
|
8581
|
+
* // [7.0, 0.0]
|
|
8582
|
+
* // [0.0, 8.0]
|
|
8583
|
+
* const m = Cesium.Matrix2.fromScale(new Cesium.Cartesian2(7.0, 8.0));
|
|
8584
|
+
*/
|
|
8585
|
+
static fromScale(scale, result) {
|
|
8586
|
+
Check_default.typeOf.object("scale", scale);
|
|
8587
|
+
if (!defined_default(result)) {
|
|
8588
|
+
return new _Matrix2(scale.x, 0, 0, scale.y);
|
|
8589
|
+
}
|
|
8590
|
+
result[0] = scale.x;
|
|
8591
|
+
result[1] = 0;
|
|
8592
|
+
result[2] = 0;
|
|
8593
|
+
result[3] = scale.y;
|
|
8594
|
+
return result;
|
|
8032
8595
|
}
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
}
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8596
|
+
/**
|
|
8597
|
+
* Computes a Matrix2 instance representing a uniform scale.
|
|
8598
|
+
*
|
|
8599
|
+
* @param {number} scale The uniform scale factor.
|
|
8600
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
8601
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
8602
|
+
*
|
|
8603
|
+
* @example
|
|
8604
|
+
* // Creates
|
|
8605
|
+
* // [2.0, 0.0]
|
|
8606
|
+
* // [0.0, 2.0]
|
|
8607
|
+
* const m = Cesium.Matrix2.fromUniformScale(2.0);
|
|
8608
|
+
*/
|
|
8609
|
+
static fromUniformScale(scale, result) {
|
|
8610
|
+
Check_default.typeOf.number("scale", scale);
|
|
8611
|
+
if (!defined_default(result)) {
|
|
8612
|
+
return new _Matrix2(scale, 0, 0, scale);
|
|
8613
|
+
}
|
|
8614
|
+
result[0] = scale;
|
|
8615
|
+
result[1] = 0;
|
|
8616
|
+
result[2] = 0;
|
|
8617
|
+
result[3] = scale;
|
|
8618
|
+
return result;
|
|
8043
8619
|
}
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
}
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8620
|
+
/**
|
|
8621
|
+
* Creates a rotation matrix.
|
|
8622
|
+
*
|
|
8623
|
+
* @param {number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
|
|
8624
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
8625
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
8626
|
+
*
|
|
8627
|
+
* @example
|
|
8628
|
+
* // Rotate a point 45 degrees counterclockwise.
|
|
8629
|
+
* const p = new Cesium.Cartesian2(5, 6);
|
|
8630
|
+
* const m = Cesium.Matrix2.fromRotation(Cesium.Math.toRadians(45.0));
|
|
8631
|
+
* const rotated = Cesium.Matrix2.multiplyByVector(m, p, new Cesium.Cartesian2());
|
|
8632
|
+
*/
|
|
8633
|
+
static fromRotation(angle, result) {
|
|
8634
|
+
Check_default.typeOf.number("angle", angle);
|
|
8635
|
+
const cosAngle = Math.cos(angle);
|
|
8636
|
+
const sinAngle = Math.sin(angle);
|
|
8637
|
+
if (!defined_default(result)) {
|
|
8638
|
+
return new _Matrix2(cosAngle, -sinAngle, sinAngle, cosAngle);
|
|
8639
|
+
}
|
|
8640
|
+
result[0] = cosAngle;
|
|
8641
|
+
result[1] = sinAngle;
|
|
8642
|
+
result[2] = -sinAngle;
|
|
8643
|
+
result[3] = cosAngle;
|
|
8644
|
+
return result;
|
|
8054
8645
|
}
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
}
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8646
|
+
/**
|
|
8647
|
+
* Creates an Array from the provided Matrix2 instance.
|
|
8648
|
+
* The array will be in column-major order.
|
|
8649
|
+
*
|
|
8650
|
+
* @param {Matrix2} matrix The matrix to use..
|
|
8651
|
+
* @param {number[]} [result] The Array onto which to store the result.
|
|
8652
|
+
* @returns {number[]} The modified Array parameter or a new Array instance if one was not provided.
|
|
8653
|
+
*/
|
|
8654
|
+
static toArray(matrix, result) {
|
|
8655
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8656
|
+
if (!defined_default(result)) {
|
|
8657
|
+
return [matrix[0], matrix[1], matrix[2], matrix[3]];
|
|
8658
|
+
}
|
|
8659
|
+
result[0] = matrix[0];
|
|
8660
|
+
result[1] = matrix[1];
|
|
8661
|
+
result[2] = matrix[2];
|
|
8662
|
+
result[3] = matrix[3];
|
|
8663
|
+
return result;
|
|
8067
8664
|
}
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
}
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8665
|
+
/**
|
|
8666
|
+
* Computes the array index of the element at the provided row and column.
|
|
8667
|
+
*
|
|
8668
|
+
* @param {number} row The zero-based index of the row.
|
|
8669
|
+
* @param {number} column The zero-based index of the column.
|
|
8670
|
+
* @returns {number} The index of the element at the provided row and column.
|
|
8671
|
+
*
|
|
8672
|
+
* @exception {DeveloperError} row must be 0 or 1.
|
|
8673
|
+
* @exception {DeveloperError} column must be 0 or 1.
|
|
8674
|
+
*
|
|
8675
|
+
* @example
|
|
8676
|
+
* const myMatrix = new Cesium.Matrix2();
|
|
8677
|
+
* const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
|
|
8678
|
+
* const column1Row0 = myMatrix[column1Row0Index]
|
|
8679
|
+
* myMatrix[column1Row0Index] = 10.0;
|
|
8680
|
+
*/
|
|
8681
|
+
static getElementIndex(column, row) {
|
|
8682
|
+
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
8683
|
+
Check_default.typeOf.number.lessThanOrEquals("row", row, 1);
|
|
8684
|
+
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
|
8685
|
+
Check_default.typeOf.number.lessThanOrEquals("column", column, 1);
|
|
8686
|
+
return column * 2 + row;
|
|
8687
|
+
}
|
|
8688
|
+
/**
|
|
8689
|
+
* Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.
|
|
8690
|
+
*
|
|
8691
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8692
|
+
* @param {number} index The zero-based index of the column to retrieve.
|
|
8693
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
8694
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
8695
|
+
*
|
|
8696
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
8697
|
+
*/
|
|
8698
|
+
static getColumn(matrix, index, result) {
|
|
8699
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8700
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8701
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8702
|
+
Check_default.typeOf.object("result", result);
|
|
8703
|
+
const startIndex = index * 2;
|
|
8704
|
+
const x = matrix[startIndex];
|
|
8705
|
+
const y = matrix[startIndex + 1];
|
|
8706
|
+
result.x = x;
|
|
8707
|
+
result.y = y;
|
|
8708
|
+
return result;
|
|
8709
|
+
}
|
|
8710
|
+
/**
|
|
8711
|
+
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.
|
|
8712
|
+
*
|
|
8713
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8714
|
+
* @param {number} index The zero-based index of the column to set.
|
|
8715
|
+
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified column.
|
|
8716
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8717
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8718
|
+
*
|
|
8719
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
8720
|
+
*/
|
|
8721
|
+
static setColumn(matrix, index, cartesian, result) {
|
|
8722
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8723
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8724
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8725
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
8726
|
+
Check_default.typeOf.object("result", result);
|
|
8727
|
+
result = _Matrix2.clone(matrix, result);
|
|
8728
|
+
const startIndex = index * 2;
|
|
8729
|
+
result[startIndex] = cartesian.x;
|
|
8730
|
+
result[startIndex + 1] = cartesian.y;
|
|
8731
|
+
return result;
|
|
8732
|
+
}
|
|
8733
|
+
/**
|
|
8734
|
+
* Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.
|
|
8735
|
+
*
|
|
8736
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8737
|
+
* @param {number} index The zero-based index of the row to retrieve.
|
|
8738
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
8739
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
8740
|
+
*
|
|
8741
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
8742
|
+
*/
|
|
8743
|
+
static getRow(matrix, index, result) {
|
|
8744
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8745
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8746
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8747
|
+
Check_default.typeOf.object("result", result);
|
|
8748
|
+
const x = matrix[index];
|
|
8749
|
+
const y = matrix[index + 2];
|
|
8750
|
+
result.x = x;
|
|
8751
|
+
result.y = y;
|
|
8752
|
+
return result;
|
|
8753
|
+
}
|
|
8754
|
+
/**
|
|
8755
|
+
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.
|
|
8756
|
+
*
|
|
8757
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8758
|
+
* @param {number} index The zero-based index of the row to set.
|
|
8759
|
+
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified row.
|
|
8760
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8761
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8762
|
+
*
|
|
8763
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
8764
|
+
*/
|
|
8765
|
+
static setRow(matrix, index, cartesian, result) {
|
|
8766
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8767
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8768
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8769
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
8770
|
+
Check_default.typeOf.object("result", result);
|
|
8771
|
+
result = _Matrix2.clone(matrix, result);
|
|
8772
|
+
result[index] = cartesian.x;
|
|
8773
|
+
result[index + 2] = cartesian.y;
|
|
8774
|
+
return result;
|
|
8775
|
+
}
|
|
8776
|
+
/**
|
|
8777
|
+
* Computes a new matrix that replaces the scale with the provided scale.
|
|
8778
|
+
* This assumes the matrix is an affine transformation.
|
|
8779
|
+
*
|
|
8780
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8781
|
+
* @param {Cartesian2} scale The scale that replaces the scale of the provided matrix.
|
|
8782
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8783
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8784
|
+
*
|
|
8785
|
+
* @see Matrix2.setUniformScale
|
|
8786
|
+
* @see Matrix2.fromScale
|
|
8787
|
+
* @see Matrix2.fromUniformScale
|
|
8788
|
+
* @see Matrix2.multiplyByScale
|
|
8789
|
+
* @see Matrix2.multiplyByUniformScale
|
|
8790
|
+
* @see Matrix2.getScale
|
|
8791
|
+
*/
|
|
8792
|
+
static setScale(matrix, scale, result) {
|
|
8793
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8794
|
+
Check_default.typeOf.object("scale", scale);
|
|
8795
|
+
Check_default.typeOf.object("result", result);
|
|
8796
|
+
const existingScale = _Matrix2.getScale(matrix, scaleScratch1);
|
|
8797
|
+
const scaleRatioX = scale.x / existingScale.x;
|
|
8798
|
+
const scaleRatioY = scale.y / existingScale.y;
|
|
8799
|
+
result[0] = matrix[0] * scaleRatioX;
|
|
8800
|
+
result[1] = matrix[1] * scaleRatioX;
|
|
8801
|
+
result[2] = matrix[2] * scaleRatioY;
|
|
8802
|
+
result[3] = matrix[3] * scaleRatioY;
|
|
8803
|
+
return result;
|
|
8804
|
+
}
|
|
8805
|
+
/**
|
|
8806
|
+
* Computes a new matrix that replaces the scale with the provided uniform scale.
|
|
8807
|
+
* This assumes the matrix is an affine transformation.
|
|
8808
|
+
*
|
|
8809
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
8810
|
+
* @param {number} scale The uniform scale that replaces the scale of the provided matrix.
|
|
8811
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8812
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8813
|
+
*
|
|
8814
|
+
* @see Matrix2.setScale
|
|
8815
|
+
* @see Matrix2.fromScale
|
|
8816
|
+
* @see Matrix2.fromUniformScale
|
|
8817
|
+
* @see Matrix2.multiplyByScale
|
|
8818
|
+
* @see Matrix2.multiplyByUniformScale
|
|
8819
|
+
* @see Matrix2.getScale
|
|
8820
|
+
*/
|
|
8821
|
+
static setUniformScale(matrix, scale, result) {
|
|
8822
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8823
|
+
Check_default.typeOf.number("scale", scale);
|
|
8824
|
+
Check_default.typeOf.object("result", result);
|
|
8825
|
+
const existingScale = _Matrix2.getScale(matrix, scaleScratch2);
|
|
8826
|
+
const scaleRatioX = scale / existingScale.x;
|
|
8827
|
+
const scaleRatioY = scale / existingScale.y;
|
|
8828
|
+
result[0] = matrix[0] * scaleRatioX;
|
|
8829
|
+
result[1] = matrix[1] * scaleRatioX;
|
|
8830
|
+
result[2] = matrix[2] * scaleRatioY;
|
|
8831
|
+
result[3] = matrix[3] * scaleRatioY;
|
|
8832
|
+
return result;
|
|
8833
|
+
}
|
|
8834
|
+
/**
|
|
8835
|
+
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
8836
|
+
*
|
|
8837
|
+
* @param {Matrix2} matrix The matrix.
|
|
8838
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
8839
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
8840
|
+
*
|
|
8841
|
+
* @see Matrix2.multiplyByScale
|
|
8842
|
+
* @see Matrix2.multiplyByUniformScale
|
|
8843
|
+
* @see Matrix2.fromScale
|
|
8844
|
+
* @see Matrix2.fromUniformScale
|
|
8845
|
+
* @see Matrix2.setScale
|
|
8846
|
+
* @see Matrix2.setUniformScale
|
|
8847
|
+
*/
|
|
8848
|
+
static getScale(matrix, result) {
|
|
8849
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8850
|
+
Check_default.typeOf.object("result", result);
|
|
8851
|
+
result.x = Cartesian2_default.magnitude(
|
|
8852
|
+
Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn)
|
|
8853
|
+
);
|
|
8854
|
+
result.y = Cartesian2_default.magnitude(
|
|
8855
|
+
Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn)
|
|
8856
|
+
);
|
|
8857
|
+
return result;
|
|
8858
|
+
}
|
|
8859
|
+
/**
|
|
8860
|
+
* Computes the maximum scale assuming the matrix is an affine transformation.
|
|
8861
|
+
* The maximum scale is the maximum length of the column vectors.
|
|
8862
|
+
*
|
|
8863
|
+
* @param {Matrix2} matrix The matrix.
|
|
8864
|
+
* @returns {number} The maximum scale.
|
|
8865
|
+
*/
|
|
8866
|
+
static getMaximumScale(matrix) {
|
|
8867
|
+
_Matrix2.getScale(matrix, scaleScratch3);
|
|
8868
|
+
return Cartesian2_default.maximumComponent(scaleScratch3);
|
|
8869
|
+
}
|
|
8870
|
+
/**
|
|
8871
|
+
* Sets the rotation assuming the matrix is an affine transformation.
|
|
8872
|
+
*
|
|
8873
|
+
* @param {Matrix2} matrix The matrix.
|
|
8874
|
+
* @param {Matrix2} rotation The rotation matrix.
|
|
8875
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8876
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8877
|
+
*
|
|
8878
|
+
* @see Matrix2.fromRotation
|
|
8879
|
+
* @see Matrix2.getRotation
|
|
8880
|
+
*/
|
|
8881
|
+
static setRotation(matrix, rotation, result) {
|
|
8882
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8883
|
+
Check_default.typeOf.object("result", result);
|
|
8884
|
+
const scale = _Matrix2.getScale(matrix, scaleScratch4);
|
|
8885
|
+
result[0] = rotation[0] * scale.x;
|
|
8886
|
+
result[1] = rotation[1] * scale.x;
|
|
8887
|
+
result[2] = rotation[2] * scale.y;
|
|
8888
|
+
result[3] = rotation[3] * scale.y;
|
|
8889
|
+
return result;
|
|
8890
|
+
}
|
|
8891
|
+
/**
|
|
8892
|
+
* Extracts the rotation matrix assuming the matrix is an affine transformation.
|
|
8893
|
+
*
|
|
8894
|
+
* @param {Matrix2} matrix The matrix.
|
|
8895
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8896
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8897
|
+
*
|
|
8898
|
+
* @see Matrix2.setRotation
|
|
8899
|
+
* @see Matrix2.fromRotation
|
|
8900
|
+
*/
|
|
8901
|
+
static getRotation(matrix, result) {
|
|
8902
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8903
|
+
Check_default.typeOf.object("result", result);
|
|
8904
|
+
const scale = _Matrix2.getScale(matrix, scaleScratch5);
|
|
8905
|
+
result[0] = matrix[0] / scale.x;
|
|
8906
|
+
result[1] = matrix[1] / scale.x;
|
|
8907
|
+
result[2] = matrix[2] / scale.y;
|
|
8908
|
+
result[3] = matrix[3] / scale.y;
|
|
8909
|
+
return result;
|
|
8910
|
+
}
|
|
8911
|
+
/**
|
|
8912
|
+
* Computes the product of two matrices.
|
|
8913
|
+
*
|
|
8914
|
+
* @param {Matrix2} left The first matrix.
|
|
8915
|
+
* @param {Matrix2} right The second matrix.
|
|
8916
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8917
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8918
|
+
*/
|
|
8919
|
+
static multiply(left, right, result) {
|
|
8920
|
+
Check_default.typeOf.object("left", left);
|
|
8921
|
+
Check_default.typeOf.object("right", right);
|
|
8922
|
+
Check_default.typeOf.object("result", result);
|
|
8923
|
+
const column0Row0 = left[0] * right[0] + left[2] * right[1];
|
|
8924
|
+
const column1Row0 = left[0] * right[2] + left[2] * right[3];
|
|
8925
|
+
const column0Row1 = left[1] * right[0] + left[3] * right[1];
|
|
8926
|
+
const column1Row1 = left[1] * right[2] + left[3] * right[3];
|
|
8927
|
+
result[0] = column0Row0;
|
|
8928
|
+
result[1] = column0Row1;
|
|
8929
|
+
result[2] = column1Row0;
|
|
8930
|
+
result[3] = column1Row1;
|
|
8931
|
+
return result;
|
|
8932
|
+
}
|
|
8933
|
+
/**
|
|
8934
|
+
* Computes the sum of two matrices.
|
|
8935
|
+
*
|
|
8936
|
+
* @param {Matrix2} left The first matrix.
|
|
8937
|
+
* @param {Matrix2} right The second matrix.
|
|
8938
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8939
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8940
|
+
*/
|
|
8941
|
+
static add(left, right, result) {
|
|
8942
|
+
Check_default.typeOf.object("left", left);
|
|
8943
|
+
Check_default.typeOf.object("right", right);
|
|
8944
|
+
Check_default.typeOf.object("result", result);
|
|
8945
|
+
result[0] = left[0] + right[0];
|
|
8946
|
+
result[1] = left[1] + right[1];
|
|
8947
|
+
result[2] = left[2] + right[2];
|
|
8948
|
+
result[3] = left[3] + right[3];
|
|
8949
|
+
return result;
|
|
8950
|
+
}
|
|
8951
|
+
/**
|
|
8952
|
+
* Computes the difference of two matrices.
|
|
8953
|
+
*
|
|
8954
|
+
* @param {Matrix2} left The first matrix.
|
|
8955
|
+
* @param {Matrix2} right The second matrix.
|
|
8956
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8957
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8958
|
+
*/
|
|
8959
|
+
static subtract(left, right, result) {
|
|
8960
|
+
Check_default.typeOf.object("left", left);
|
|
8961
|
+
Check_default.typeOf.object("right", right);
|
|
8962
|
+
Check_default.typeOf.object("result", result);
|
|
8963
|
+
result[0] = left[0] - right[0];
|
|
8964
|
+
result[1] = left[1] - right[1];
|
|
8965
|
+
result[2] = left[2] - right[2];
|
|
8966
|
+
result[3] = left[3] - right[3];
|
|
8967
|
+
return result;
|
|
8968
|
+
}
|
|
8969
|
+
/**
|
|
8970
|
+
* Computes the product of a matrix and a column vector.
|
|
8971
|
+
*
|
|
8972
|
+
* @param {Matrix2} matrix The matrix.
|
|
8973
|
+
* @param {Cartesian2} cartesian The column.
|
|
8974
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
8975
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
8976
|
+
*/
|
|
8977
|
+
static multiplyByVector(matrix, cartesian, result) {
|
|
8978
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8979
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
8980
|
+
Check_default.typeOf.object("result", result);
|
|
8981
|
+
const x = matrix[0] * cartesian.x + matrix[2] * cartesian.y;
|
|
8982
|
+
const y = matrix[1] * cartesian.x + matrix[3] * cartesian.y;
|
|
8983
|
+
result.x = x;
|
|
8984
|
+
result.y = y;
|
|
8985
|
+
return result;
|
|
8986
|
+
}
|
|
8987
|
+
/**
|
|
8988
|
+
* Computes the product of a matrix and a scalar.
|
|
8989
|
+
*
|
|
8990
|
+
* @param {Matrix2} matrix The matrix.
|
|
8991
|
+
* @param {number} scalar The number to multiply by.
|
|
8992
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
8993
|
+
* @returns {Matrix2} The modified result parameter.
|
|
8994
|
+
*/
|
|
8995
|
+
static multiplyByScalar(matrix, scalar, result) {
|
|
8996
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
8997
|
+
Check_default.typeOf.number("scalar", scalar);
|
|
8998
|
+
Check_default.typeOf.object("result", result);
|
|
8999
|
+
result[0] = matrix[0] * scalar;
|
|
9000
|
+
result[1] = matrix[1] * scalar;
|
|
9001
|
+
result[2] = matrix[2] * scalar;
|
|
9002
|
+
result[3] = matrix[3] * scalar;
|
|
9003
|
+
return result;
|
|
9004
|
+
}
|
|
9005
|
+
/**
|
|
9006
|
+
* Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
|
9007
|
+
*
|
|
9008
|
+
* @param {Matrix2} matrix The matrix on the left-hand side.
|
|
9009
|
+
* @param {Cartesian2} scale The non-uniform scale on the right-hand side.
|
|
9010
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
9011
|
+
* @returns {Matrix2} The modified result parameter.
|
|
9012
|
+
*
|
|
9013
|
+
*
|
|
9014
|
+
* @example
|
|
9015
|
+
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
|
|
9016
|
+
* Cesium.Matrix2.multiplyByScale(m, scale, m);
|
|
9017
|
+
*
|
|
9018
|
+
* @see Matrix2.multiplyByUniformScale
|
|
9019
|
+
* @see Matrix2.fromScale
|
|
9020
|
+
* @see Matrix2.fromUniformScale
|
|
9021
|
+
* @see Matrix2.setScale
|
|
9022
|
+
* @see Matrix2.setUniformScale
|
|
9023
|
+
* @see Matrix2.getScale
|
|
9024
|
+
*/
|
|
9025
|
+
static multiplyByScale(matrix, scale, result) {
|
|
9026
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
9027
|
+
Check_default.typeOf.object("scale", scale);
|
|
9028
|
+
Check_default.typeOf.object("result", result);
|
|
9029
|
+
result[0] = matrix[0] * scale.x;
|
|
9030
|
+
result[1] = matrix[1] * scale.x;
|
|
9031
|
+
result[2] = matrix[2] * scale.y;
|
|
9032
|
+
result[3] = matrix[3] * scale.y;
|
|
9033
|
+
return result;
|
|
9034
|
+
}
|
|
9035
|
+
/**
|
|
9036
|
+
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
|
|
9037
|
+
*
|
|
9038
|
+
* @param {Matrix2} matrix The matrix on the left-hand side.
|
|
9039
|
+
* @param {number} scale The uniform scale on the right-hand side.
|
|
9040
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
9041
|
+
* @returns {Matrix2} The modified result parameter.
|
|
9042
|
+
*
|
|
9043
|
+
* @example
|
|
9044
|
+
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromUniformScale(scale), m);
|
|
9045
|
+
* Cesium.Matrix2.multiplyByUniformScale(m, scale, m);
|
|
9046
|
+
*
|
|
9047
|
+
* @see Matrix2.multiplyByScale
|
|
9048
|
+
* @see Matrix2.fromScale
|
|
9049
|
+
* @see Matrix2.fromUniformScale
|
|
9050
|
+
* @see Matrix2.setScale
|
|
9051
|
+
* @see Matrix2.setUniformScale
|
|
9052
|
+
* @see Matrix2.getScale
|
|
9053
|
+
*/
|
|
9054
|
+
static multiplyByUniformScale(matrix, scale, result) {
|
|
9055
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
9056
|
+
Check_default.typeOf.number("scale", scale);
|
|
9057
|
+
Check_default.typeOf.object("result", result);
|
|
9058
|
+
result[0] = matrix[0] * scale;
|
|
9059
|
+
result[1] = matrix[1] * scale;
|
|
9060
|
+
result[2] = matrix[2] * scale;
|
|
9061
|
+
result[3] = matrix[3] * scale;
|
|
9062
|
+
return result;
|
|
9063
|
+
}
|
|
9064
|
+
/**
|
|
9065
|
+
* Creates a negated copy of the provided matrix.
|
|
9066
|
+
*
|
|
9067
|
+
* @param {Matrix2} matrix The matrix to negate.
|
|
9068
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
9069
|
+
* @returns {Matrix2} The modified result parameter.
|
|
9070
|
+
*/
|
|
9071
|
+
static negate(matrix, result) {
|
|
9072
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
9073
|
+
Check_default.typeOf.object("result", result);
|
|
9074
|
+
result[0] = -matrix[0];
|
|
9075
|
+
result[1] = -matrix[1];
|
|
9076
|
+
result[2] = -matrix[2];
|
|
9077
|
+
result[3] = -matrix[3];
|
|
9078
|
+
return result;
|
|
9079
|
+
}
|
|
9080
|
+
/**
|
|
9081
|
+
* Computes the transpose of the provided matrix.
|
|
9082
|
+
*
|
|
9083
|
+
* @param {Matrix2} matrix The matrix to transpose.
|
|
9084
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
9085
|
+
* @returns {Matrix2} The modified result parameter.
|
|
9086
|
+
*/
|
|
9087
|
+
static transpose(matrix, result) {
|
|
9088
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
9089
|
+
Check_default.typeOf.object("result", result);
|
|
9090
|
+
const column0Row0 = matrix[0];
|
|
9091
|
+
const column0Row1 = matrix[2];
|
|
9092
|
+
const column1Row0 = matrix[1];
|
|
9093
|
+
const column1Row1 = matrix[3];
|
|
9094
|
+
result[0] = column0Row0;
|
|
9095
|
+
result[1] = column0Row1;
|
|
9096
|
+
result[2] = column1Row0;
|
|
9097
|
+
result[3] = column1Row1;
|
|
9098
|
+
return result;
|
|
9099
|
+
}
|
|
9100
|
+
/**
|
|
9101
|
+
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
|
9102
|
+
*
|
|
9103
|
+
* @param {Matrix2} matrix The matrix with signed elements.
|
|
9104
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
9105
|
+
* @returns {Matrix2} The modified result parameter.
|
|
9106
|
+
*/
|
|
9107
|
+
static abs(matrix, result) {
|
|
9108
|
+
Check_default.typeOf.object("matrix", matrix);
|
|
9109
|
+
Check_default.typeOf.object("result", result);
|
|
9110
|
+
result[0] = Math.abs(matrix[0]);
|
|
9111
|
+
result[1] = Math.abs(matrix[1]);
|
|
9112
|
+
result[2] = Math.abs(matrix[2]);
|
|
9113
|
+
result[3] = Math.abs(matrix[3]);
|
|
9114
|
+
return result;
|
|
9115
|
+
}
|
|
9116
|
+
/**
|
|
9117
|
+
* Compares the provided matrices componentwise and returns
|
|
9118
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
9119
|
+
*
|
|
9120
|
+
* @param {Matrix2} [left] The first matrix.
|
|
9121
|
+
* @param {Matrix2} [right] The second matrix.
|
|
9122
|
+
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
9123
|
+
*/
|
|
9124
|
+
static equals(left, right) {
|
|
9125
|
+
return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3];
|
|
9126
|
+
}
|
|
9127
|
+
/**
|
|
9128
|
+
* Compares provided matrix and array, starting from a given array offset.
|
|
9129
|
+
*
|
|
9130
|
+
* @param {Matrix2} matrix
|
|
9131
|
+
* @param {number[]} array
|
|
9132
|
+
* @param {number} offset
|
|
9133
|
+
* @private
|
|
9134
|
+
*/
|
|
9135
|
+
static equalsArray(matrix, array, offset) {
|
|
9136
|
+
return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3];
|
|
9137
|
+
}
|
|
9138
|
+
/**
|
|
9139
|
+
* Compares the provided matrices componentwise and returns
|
|
9140
|
+
* <code>true</code> if they are within the provided epsilon,
|
|
9141
|
+
* <code>false</code> otherwise.
|
|
9142
|
+
*
|
|
9143
|
+
* @param {Matrix2} [left] The first matrix.
|
|
9144
|
+
* @param {Matrix2} [right] The second matrix.
|
|
9145
|
+
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
9146
|
+
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
|
9147
|
+
*/
|
|
9148
|
+
static equalsEpsilon(left, right, epsilon) {
|
|
9149
|
+
epsilon = epsilon ?? 0;
|
|
9150
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon;
|
|
8078
9151
|
}
|
|
8079
|
-
result[0] = matrix[0];
|
|
8080
|
-
result[1] = matrix[1];
|
|
8081
|
-
result[2] = matrix[2];
|
|
8082
|
-
result[3] = matrix[3];
|
|
8083
|
-
return result;
|
|
8084
|
-
};
|
|
8085
|
-
Matrix2.getElementIndex = function(column, row) {
|
|
8086
|
-
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
8087
|
-
Check_default.typeOf.number.lessThanOrEquals("row", row, 1);
|
|
8088
|
-
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
|
8089
|
-
Check_default.typeOf.number.lessThanOrEquals("column", column, 1);
|
|
8090
|
-
return column * 2 + row;
|
|
8091
|
-
};
|
|
8092
|
-
Matrix2.getColumn = function(matrix, index, result) {
|
|
8093
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8094
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8095
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8096
|
-
Check_default.typeOf.object("result", result);
|
|
8097
|
-
const startIndex = index * 2;
|
|
8098
|
-
const x = matrix[startIndex];
|
|
8099
|
-
const y = matrix[startIndex + 1];
|
|
8100
|
-
result.x = x;
|
|
8101
|
-
result.y = y;
|
|
8102
|
-
return result;
|
|
8103
|
-
};
|
|
8104
|
-
Matrix2.setColumn = function(matrix, index, cartesian, result) {
|
|
8105
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8106
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8107
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8108
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
8109
|
-
Check_default.typeOf.object("result", result);
|
|
8110
|
-
result = Matrix2.clone(matrix, result);
|
|
8111
|
-
const startIndex = index * 2;
|
|
8112
|
-
result[startIndex] = cartesian.x;
|
|
8113
|
-
result[startIndex + 1] = cartesian.y;
|
|
8114
|
-
return result;
|
|
8115
|
-
};
|
|
8116
|
-
Matrix2.getRow = function(matrix, index, result) {
|
|
8117
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8118
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8119
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8120
|
-
Check_default.typeOf.object("result", result);
|
|
8121
|
-
const x = matrix[index];
|
|
8122
|
-
const y = matrix[index + 2];
|
|
8123
|
-
result.x = x;
|
|
8124
|
-
result.y = y;
|
|
8125
|
-
return result;
|
|
8126
|
-
};
|
|
8127
|
-
Matrix2.setRow = function(matrix, index, cartesian, result) {
|
|
8128
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8129
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
8130
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
8131
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
8132
|
-
Check_default.typeOf.object("result", result);
|
|
8133
|
-
result = Matrix2.clone(matrix, result);
|
|
8134
|
-
result[index] = cartesian.x;
|
|
8135
|
-
result[index + 2] = cartesian.y;
|
|
8136
|
-
return result;
|
|
8137
|
-
};
|
|
8138
|
-
var scaleScratch1 = new Cartesian2_default();
|
|
8139
|
-
Matrix2.setScale = function(matrix, scale, result) {
|
|
8140
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8141
|
-
Check_default.typeOf.object("scale", scale);
|
|
8142
|
-
Check_default.typeOf.object("result", result);
|
|
8143
|
-
const existingScale = Matrix2.getScale(matrix, scaleScratch1);
|
|
8144
|
-
const scaleRatioX = scale.x / existingScale.x;
|
|
8145
|
-
const scaleRatioY = scale.y / existingScale.y;
|
|
8146
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
8147
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
8148
|
-
result[2] = matrix[2] * scaleRatioY;
|
|
8149
|
-
result[3] = matrix[3] * scaleRatioY;
|
|
8150
|
-
return result;
|
|
8151
|
-
};
|
|
8152
|
-
var scaleScratch2 = new Cartesian2_default();
|
|
8153
|
-
Matrix2.setUniformScale = function(matrix, scale, result) {
|
|
8154
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8155
|
-
Check_default.typeOf.number("scale", scale);
|
|
8156
|
-
Check_default.typeOf.object("result", result);
|
|
8157
|
-
const existingScale = Matrix2.getScale(matrix, scaleScratch2);
|
|
8158
|
-
const scaleRatioX = scale / existingScale.x;
|
|
8159
|
-
const scaleRatioY = scale / existingScale.y;
|
|
8160
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
8161
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
8162
|
-
result[2] = matrix[2] * scaleRatioY;
|
|
8163
|
-
result[3] = matrix[3] * scaleRatioY;
|
|
8164
|
-
return result;
|
|
8165
|
-
};
|
|
8166
|
-
var scratchColumn = new Cartesian2_default();
|
|
8167
|
-
Matrix2.getScale = function(matrix, result) {
|
|
8168
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8169
|
-
Check_default.typeOf.object("result", result);
|
|
8170
|
-
result.x = Cartesian2_default.magnitude(
|
|
8171
|
-
Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn)
|
|
8172
|
-
);
|
|
8173
|
-
result.y = Cartesian2_default.magnitude(
|
|
8174
|
-
Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn)
|
|
8175
|
-
);
|
|
8176
|
-
return result;
|
|
8177
|
-
};
|
|
8178
|
-
var scaleScratch3 = new Cartesian2_default();
|
|
8179
|
-
Matrix2.getMaximumScale = function(matrix) {
|
|
8180
|
-
Matrix2.getScale(matrix, scaleScratch3);
|
|
8181
|
-
return Cartesian2_default.maximumComponent(scaleScratch3);
|
|
8182
|
-
};
|
|
8183
|
-
var scaleScratch4 = new Cartesian2_default();
|
|
8184
|
-
Matrix2.setRotation = function(matrix, rotation, result) {
|
|
8185
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8186
|
-
Check_default.typeOf.object("result", result);
|
|
8187
|
-
const scale = Matrix2.getScale(matrix, scaleScratch4);
|
|
8188
|
-
result[0] = rotation[0] * scale.x;
|
|
8189
|
-
result[1] = rotation[1] * scale.x;
|
|
8190
|
-
result[2] = rotation[2] * scale.y;
|
|
8191
|
-
result[3] = rotation[3] * scale.y;
|
|
8192
|
-
return result;
|
|
8193
|
-
};
|
|
8194
|
-
var scaleScratch5 = new Cartesian2_default();
|
|
8195
|
-
Matrix2.getRotation = function(matrix, result) {
|
|
8196
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8197
|
-
Check_default.typeOf.object("result", result);
|
|
8198
|
-
const scale = Matrix2.getScale(matrix, scaleScratch5);
|
|
8199
|
-
result[0] = matrix[0] / scale.x;
|
|
8200
|
-
result[1] = matrix[1] / scale.x;
|
|
8201
|
-
result[2] = matrix[2] / scale.y;
|
|
8202
|
-
result[3] = matrix[3] / scale.y;
|
|
8203
|
-
return result;
|
|
8204
|
-
};
|
|
8205
|
-
Matrix2.multiply = function(left, right, result) {
|
|
8206
|
-
Check_default.typeOf.object("left", left);
|
|
8207
|
-
Check_default.typeOf.object("right", right);
|
|
8208
|
-
Check_default.typeOf.object("result", result);
|
|
8209
|
-
const column0Row0 = left[0] * right[0] + left[2] * right[1];
|
|
8210
|
-
const column1Row0 = left[0] * right[2] + left[2] * right[3];
|
|
8211
|
-
const column0Row1 = left[1] * right[0] + left[3] * right[1];
|
|
8212
|
-
const column1Row1 = left[1] * right[2] + left[3] * right[3];
|
|
8213
|
-
result[0] = column0Row0;
|
|
8214
|
-
result[1] = column0Row1;
|
|
8215
|
-
result[2] = column1Row0;
|
|
8216
|
-
result[3] = column1Row1;
|
|
8217
|
-
return result;
|
|
8218
|
-
};
|
|
8219
|
-
Matrix2.add = function(left, right, result) {
|
|
8220
|
-
Check_default.typeOf.object("left", left);
|
|
8221
|
-
Check_default.typeOf.object("right", right);
|
|
8222
|
-
Check_default.typeOf.object("result", result);
|
|
8223
|
-
result[0] = left[0] + right[0];
|
|
8224
|
-
result[1] = left[1] + right[1];
|
|
8225
|
-
result[2] = left[2] + right[2];
|
|
8226
|
-
result[3] = left[3] + right[3];
|
|
8227
|
-
return result;
|
|
8228
|
-
};
|
|
8229
|
-
Matrix2.subtract = function(left, right, result) {
|
|
8230
|
-
Check_default.typeOf.object("left", left);
|
|
8231
|
-
Check_default.typeOf.object("right", right);
|
|
8232
|
-
Check_default.typeOf.object("result", result);
|
|
8233
|
-
result[0] = left[0] - right[0];
|
|
8234
|
-
result[1] = left[1] - right[1];
|
|
8235
|
-
result[2] = left[2] - right[2];
|
|
8236
|
-
result[3] = left[3] - right[3];
|
|
8237
|
-
return result;
|
|
8238
|
-
};
|
|
8239
|
-
Matrix2.multiplyByVector = function(matrix, cartesian, result) {
|
|
8240
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8241
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
8242
|
-
Check_default.typeOf.object("result", result);
|
|
8243
|
-
const x = matrix[0] * cartesian.x + matrix[2] * cartesian.y;
|
|
8244
|
-
const y = matrix[1] * cartesian.x + matrix[3] * cartesian.y;
|
|
8245
|
-
result.x = x;
|
|
8246
|
-
result.y = y;
|
|
8247
|
-
return result;
|
|
8248
|
-
};
|
|
8249
|
-
Matrix2.multiplyByScalar = function(matrix, scalar, result) {
|
|
8250
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8251
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
8252
|
-
Check_default.typeOf.object("result", result);
|
|
8253
|
-
result[0] = matrix[0] * scalar;
|
|
8254
|
-
result[1] = matrix[1] * scalar;
|
|
8255
|
-
result[2] = matrix[2] * scalar;
|
|
8256
|
-
result[3] = matrix[3] * scalar;
|
|
8257
|
-
return result;
|
|
8258
|
-
};
|
|
8259
|
-
Matrix2.multiplyByScale = function(matrix, scale, result) {
|
|
8260
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8261
|
-
Check_default.typeOf.object("scale", scale);
|
|
8262
|
-
Check_default.typeOf.object("result", result);
|
|
8263
|
-
result[0] = matrix[0] * scale.x;
|
|
8264
|
-
result[1] = matrix[1] * scale.x;
|
|
8265
|
-
result[2] = matrix[2] * scale.y;
|
|
8266
|
-
result[3] = matrix[3] * scale.y;
|
|
8267
|
-
return result;
|
|
8268
|
-
};
|
|
8269
|
-
Matrix2.multiplyByUniformScale = function(matrix, scale, result) {
|
|
8270
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8271
|
-
Check_default.typeOf.number("scale", scale);
|
|
8272
|
-
Check_default.typeOf.object("result", result);
|
|
8273
|
-
result[0] = matrix[0] * scale;
|
|
8274
|
-
result[1] = matrix[1] * scale;
|
|
8275
|
-
result[2] = matrix[2] * scale;
|
|
8276
|
-
result[3] = matrix[3] * scale;
|
|
8277
|
-
return result;
|
|
8278
|
-
};
|
|
8279
|
-
Matrix2.negate = function(matrix, result) {
|
|
8280
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8281
|
-
Check_default.typeOf.object("result", result);
|
|
8282
|
-
result[0] = -matrix[0];
|
|
8283
|
-
result[1] = -matrix[1];
|
|
8284
|
-
result[2] = -matrix[2];
|
|
8285
|
-
result[3] = -matrix[3];
|
|
8286
|
-
return result;
|
|
8287
|
-
};
|
|
8288
|
-
Matrix2.transpose = function(matrix, result) {
|
|
8289
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8290
|
-
Check_default.typeOf.object("result", result);
|
|
8291
|
-
const column0Row0 = matrix[0];
|
|
8292
|
-
const column0Row1 = matrix[2];
|
|
8293
|
-
const column1Row0 = matrix[1];
|
|
8294
|
-
const column1Row1 = matrix[3];
|
|
8295
|
-
result[0] = column0Row0;
|
|
8296
|
-
result[1] = column0Row1;
|
|
8297
|
-
result[2] = column1Row0;
|
|
8298
|
-
result[3] = column1Row1;
|
|
8299
|
-
return result;
|
|
8300
|
-
};
|
|
8301
|
-
Matrix2.abs = function(matrix, result) {
|
|
8302
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
8303
|
-
Check_default.typeOf.object("result", result);
|
|
8304
|
-
result[0] = Math.abs(matrix[0]);
|
|
8305
|
-
result[1] = Math.abs(matrix[1]);
|
|
8306
|
-
result[2] = Math.abs(matrix[2]);
|
|
8307
|
-
result[3] = Math.abs(matrix[3]);
|
|
8308
|
-
return result;
|
|
8309
|
-
};
|
|
8310
|
-
Matrix2.equals = function(left, right) {
|
|
8311
|
-
return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3];
|
|
8312
|
-
};
|
|
8313
|
-
Matrix2.equalsArray = function(matrix, array, offset) {
|
|
8314
|
-
return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3];
|
|
8315
|
-
};
|
|
8316
|
-
Matrix2.equalsEpsilon = function(left, right, epsilon) {
|
|
8317
|
-
epsilon = epsilon ?? 0;
|
|
8318
|
-
return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon;
|
|
8319
|
-
};
|
|
8320
|
-
Matrix2.IDENTITY = Object.freeze(new Matrix2(1, 0, 0, 1));
|
|
8321
|
-
Matrix2.ZERO = Object.freeze(new Matrix2(0, 0, 0, 0));
|
|
8322
|
-
Matrix2.COLUMN0ROW0 = 0;
|
|
8323
|
-
Matrix2.COLUMN0ROW1 = 1;
|
|
8324
|
-
Matrix2.COLUMN1ROW0 = 2;
|
|
8325
|
-
Matrix2.COLUMN1ROW1 = 3;
|
|
8326
|
-
Object.defineProperties(Matrix2.prototype, {
|
|
8327
9152
|
/**
|
|
8328
9153
|
* Gets the number of items in the collection.
|
|
8329
|
-
* @memberof Matrix2.prototype
|
|
8330
9154
|
*
|
|
8331
9155
|
* @type {number}
|
|
8332
9156
|
*/
|
|
8333
|
-
length
|
|
8334
|
-
|
|
8335
|
-
return Matrix2.packedLength;
|
|
8336
|
-
}
|
|
9157
|
+
get length() {
|
|
9158
|
+
return _Matrix2.packedLength;
|
|
8337
9159
|
}
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
}
|
|
8342
|
-
Matrix2
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
9160
|
+
/**
|
|
9161
|
+
* Duplicates the provided Matrix2 instance.
|
|
9162
|
+
*
|
|
9163
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
|
9164
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
9165
|
+
*/
|
|
9166
|
+
clone(result) {
|
|
9167
|
+
return _Matrix2.clone(this, result);
|
|
9168
|
+
}
|
|
9169
|
+
/**
|
|
9170
|
+
* Compares this matrix to the provided matrix componentwise and returns
|
|
9171
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
9172
|
+
*
|
|
9173
|
+
* @param {Matrix2} [right] The right hand side matrix.
|
|
9174
|
+
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
9175
|
+
*/
|
|
9176
|
+
equals(right) {
|
|
9177
|
+
return _Matrix2.equals(this, right);
|
|
9178
|
+
}
|
|
9179
|
+
/**
|
|
9180
|
+
* Compares this matrix to the provided matrix componentwise and returns
|
|
9181
|
+
* <code>true</code> if they are within the provided epsilon,
|
|
9182
|
+
* <code>false</code> otherwise.
|
|
9183
|
+
*
|
|
9184
|
+
* @param {Matrix2} [right] The right hand side matrix.
|
|
9185
|
+
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
9186
|
+
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
|
9187
|
+
*/
|
|
9188
|
+
equalsEpsilon(right, epsilon) {
|
|
9189
|
+
return _Matrix2.equalsEpsilon(this, right, epsilon);
|
|
9190
|
+
}
|
|
9191
|
+
/**
|
|
9192
|
+
* Creates a string representing this Matrix with each row being
|
|
9193
|
+
* on a separate line and in the format '(column0, column1)'.
|
|
9194
|
+
*
|
|
9195
|
+
* @returns {string} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1)'.
|
|
9196
|
+
*/
|
|
9197
|
+
toString() {
|
|
9198
|
+
return `(${this[0]}, ${this[2]})
|
|
8350
9199
|
(${this[1]}, ${this[3]})`;
|
|
9200
|
+
}
|
|
8351
9201
|
};
|
|
9202
|
+
Matrix2.packedLength = 4;
|
|
9203
|
+
Matrix2.fromArray = Matrix2.unpack;
|
|
9204
|
+
Matrix2.IDENTITY = Object.freeze(new Matrix2(1, 0, 0, 1));
|
|
9205
|
+
Matrix2.ZERO = Object.freeze(new Matrix2(0, 0, 0, 0));
|
|
9206
|
+
Matrix2.COLUMN0ROW0 = 0;
|
|
9207
|
+
Matrix2.COLUMN0ROW1 = 1;
|
|
9208
|
+
Matrix2.COLUMN1ROW0 = 2;
|
|
9209
|
+
Matrix2.COLUMN1ROW1 = 3;
|
|
9210
|
+
var scaleScratch1 = new Cartesian2_default();
|
|
9211
|
+
var scaleScratch2 = new Cartesian2_default();
|
|
9212
|
+
var scratchColumn = new Cartesian2_default();
|
|
9213
|
+
var scaleScratch3 = new Cartesian2_default();
|
|
9214
|
+
var scaleScratch4 = new Cartesian2_default();
|
|
9215
|
+
var scaleScratch5 = new Cartesian2_default();
|
|
8352
9216
|
var Matrix2_default = Matrix2;
|
|
8353
9217
|
|
|
8354
9218
|
export {
|