@cesium/engine 26.1.0 → 26.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/zip-web-worker.js +764 -520
- package/Build/Workers/{chunk-HS6AD4P2.js → chunk-2DKJSPYF.js} +14 -14
- package/Build/Workers/{chunk-QVLAFFJY.js → chunk-2PWVICP6.js} +1 -1
- package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
- package/Build/Workers/{chunk-ENNFMWDW.js → chunk-4DMAXPKB.js} +12 -12
- package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-4LRFYRBX.js} +2 -2
- package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
- package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
- package/Build/Workers/{chunk-A6X24AZI.js → chunk-6BSNYZZG.js} +5 -5
- package/Build/Workers/{chunk-IGAZBTFZ.js → chunk-6R6SGKYN.js} +6 -6
- package/Build/Workers/{chunk-SS5ABQGY.js → chunk-6V2KDEHL.js} +4 -4
- package/Build/Workers/{chunk-ZMBHFYOX.js → chunk-75BC2IHI.js} +7 -7
- package/Build/Workers/{chunk-LGNDTZVX.js → chunk-7SESBH2I.js} +4 -4
- package/Build/Workers/{chunk-CLCTQVVL.js → chunk-7WXBTNRV.js} +8 -8
- package/Build/Workers/{chunk-WBSY7HDY.js → chunk-A7SMPV6B.js} +12 -12
- package/Build/Workers/{chunk-CEEZE3YZ.js → chunk-ATSXKJ3L.js} +7 -7
- package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
- package/Build/Workers/{chunk-6HK6IXK2.js → chunk-B7Q2WF6Q.js} +4 -4
- package/Build/Workers/{chunk-YKU2Q3A2.js → chunk-BNDSDQ7D.js} +9 -12
- package/Build/Workers/{chunk-R4FPNAZ2.js → chunk-CKK6CUXK.js} +9 -9
- package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
- package/Build/Workers/{chunk-7D2HZKH7.js → chunk-CQ4TZXAT.js} +7 -7
- package/Build/Workers/{chunk-TVZD72WJ.js → chunk-DKSANM4A.js} +12 -12
- package/Build/Workers/{chunk-FDK4K5IA.js → chunk-DZK34ZVD.js} +1 -1
- package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
- package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
- package/Build/Workers/{chunk-2EFYUSUY.js → chunk-F34TJJLA.js} +16 -16
- package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
- package/Build/Workers/{chunk-T5QBPLE3.js → chunk-GS7RY2DH.js} +11 -11
- package/Build/Workers/{chunk-C7JQVRLM.js → chunk-HDD3RFLT.js} +25 -3
- package/Build/Workers/{chunk-E7NZJOK7.js → chunk-HDPNFEPP.js} +121 -93
- package/Build/Workers/{chunk-VAL7DYNR.js → chunk-JBJ6BRIM.js} +4 -4
- package/Build/Workers/{chunk-XQ3SKCMM.js → chunk-JKTWW7IO.js} +5 -5
- package/Build/Workers/{chunk-UVO6COT2.js → chunk-JL4NWWQY.js} +5 -5
- package/Build/Workers/{chunk-DBD5WWG2.js → chunk-JMUUAW4X.js} +10 -10
- package/Build/Workers/{chunk-UEY73NRN.js → chunk-KBGAHN5R.js} +1 -1
- package/Build/Workers/{chunk-LD64RPYV.js → chunk-KEWK6VZL.js} +12 -12
- package/Build/Workers/{chunk-JW6OZT4R.js → chunk-L73K5UPP.js} +10 -10
- package/Build/Workers/{chunk-DIGUUD6G.js → chunk-LL2SGJYH.js} +6 -6
- package/Build/Workers/{chunk-XLXSDIP5.js → chunk-LYJUL4XQ.js} +6 -6
- package/Build/Workers/{chunk-SM2CDCYF.js → chunk-M6W46OAP.js} +7 -7
- package/Build/Workers/{chunk-EHTS2YPT.js → chunk-MDDKCLMF.js} +17 -17
- package/Build/Workers/{chunk-FGQFQHN5.js → chunk-MUW4DJV7.js} +18 -18
- package/Build/Workers/{chunk-HHV3MCGV.js → chunk-N5YK44FS.js} +5 -5
- package/Build/Workers/{chunk-RG4F5R57.js → chunk-NZQUP52G.js} +9 -9
- package/Build/Workers/{chunk-B4CQSLZJ.js → chunk-PKZA44LH.js} +6 -6
- package/Build/Workers/{chunk-OBEU25PI.js → chunk-Q2JS5LCB.js} +17 -17
- package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
- package/Build/Workers/{chunk-NIWITKQK.js → chunk-SEJIXZZ4.js} +11 -11
- package/Build/Workers/{chunk-SGRGNDOD.js → chunk-SL2HCFYW.js} +10 -10
- package/Build/Workers/{chunk-SF6K72D7.js → chunk-SLHK3KAR.js} +5 -5
- package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
- package/Build/Workers/{chunk-LNSQVXFH.js → chunk-VRECSMG3.js} +2 -2
- package/Build/Workers/{chunk-A3O6EDBK.js → chunk-X27HKF5E.js} +2 -2
- package/Build/Workers/{chunk-7KVKHY7O.js → chunk-XBY3354M.js} +6 -6
- package/Build/Workers/{chunk-GSWMAFTE.js → chunk-XRZCS3HE.js} +23 -16
- package/Build/Workers/{chunk-6YR6JBMY.js → chunk-XSIUYAT6.js} +2 -2
- package/Build/Workers/{chunk-ZSGUV73H.js → chunk-Z2DW5NM2.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 +35 -35
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +31 -33
- package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
- 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 +24 -24
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +34 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createPolylineGeometry.js +26 -26
- 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 +21 -21
- package/Build/Workers/createSimplePolylineGeometry.js +24 -24
- 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 +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- 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 +10 -10
- 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 +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/CoplanarPolygonGeometry.js +2 -2
- package/Source/Core/CorridorGeometry.js +2 -4
- package/Source/Core/CorridorOutlineGeometry.js +1 -3
- package/Source/Core/EarthOrientationParameters.js +2 -2
- package/Source/Core/EllipseGeometryLibrary.js +2 -2
- package/Source/Core/EllipsoidGeodesic.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/GroundPolylineGeometry.js +2 -2
- package/Source/Core/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +5 -0
- package/Source/Core/IonSnapGeometryType.js +59 -0
- package/Source/Core/IonSnapHeat.js +33 -0
- package/Source/Core/IonSnapMode.js +45 -0
- package/Source/Core/IonSnapParentGeometryType.js +52 -0
- package/Source/Core/IonSnapService.js +369 -0
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +2 -2
- package/Source/Core/Matrix3.js +2 -2
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/SnapService.js +63 -0
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainPicker.js +179 -168
- package/Source/Core/TimeIntervalCollection.js +1 -3
- package/Source/Core/Tipsify.js +1 -1
- package/Source/Core/Transforms.js +5 -1
- package/Source/Core/VectorPipeline.js +1211 -0
- package/Source/Core/VectorProvider.js +669 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +2 -0
- package/Source/DataSources/DataSourceDisplay.js +1 -1
- package/Source/DataSources/GeoJsonDataSource.js +0 -1
- package/Source/DataSources/GeometryVisualizer.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -2
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +67 -2
- package/Source/Renderer/Context.js +9 -3
- package/Source/Renderer/DrawCommand.js +22 -0
- package/Source/Renderer/Framebuffer.js +4 -0
- package/Source/Renderer/Pass.js +11 -10
- package/Source/Renderer/ShaderBuilder.js +1 -1
- package/Source/Renderer/Texture.js +11 -0
- package/Source/Renderer/UniformState.js +54 -1
- package/Source/Renderer/VertexArray.js +0 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +7 -3
- package/Source/Scene/BufferPointCollection.js +4 -7
- package/Source/Scene/BufferPolygonCollection.js +56 -27
- package/Source/Scene/BufferPolylineCollection.js +61 -8
- package/Source/Scene/BufferPolylineMaterial.js +6 -5
- package/Source/Scene/BufferPrimitiveCollection.js +226 -34
- package/Source/Scene/Camera.js +71 -5
- package/Source/Scene/Cesium3DTile.js +12 -0
- package/Source/Scene/Cesium3DTileset.js +62 -9
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
- package/Source/Scene/Cesium3DTilesetCache.js +15 -0
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/ClippingPolygon.js +154 -100
- package/Source/Scene/ClippingPolygonCollection.js +352 -694
- package/Source/Scene/Controllers/Controller.js +63 -0
- package/Source/Scene/Controllers/ControllerHost.js +78 -0
- package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
- package/Source/Scene/Controllers/MouseButton.js +32 -0
- package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
- package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
- package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
- package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
- package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
- package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
- package/Source/Scene/CreditDisplay.js +62 -0
- package/Source/Scene/DerivedCommand.js +94 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GeoJsonPrimitive.js +114 -24
- package/Source/Scene/Globe.js +20 -0
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +42 -53
- package/Source/Scene/GlobeSurfaceTile.js +61 -10
- package/Source/Scene/GlobeSurfaceTileProvider.js +351 -26
- package/Source/Scene/GltfLoader.js +88 -9
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +188 -4
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +1 -1
- package/Source/Scene/MVTDataProvider.js +11 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
- package/Source/Scene/Model/I3dmLoader.js +1 -1
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
- package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
- package/Source/Scene/Model/Model.js +250 -26
- package/Source/Scene/Model/Model3DTileContent.js +5 -0
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
- package/Source/Scene/Model/ModelDrawCommand.js +160 -16
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelRenderResources.js +2 -3
- package/Source/Scene/Model/ModelSceneGraph.js +31 -1
- package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
- package/Source/Scene/Model/PickingPipelineStage.js +33 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/ModelComponents.js +71 -0
- package/Source/Scene/Picking.js +16 -5
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -1
- package/Source/Scene/PostProcessStage.js +26 -5
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +16 -13
- package/Source/Scene/Scene.js +258 -6
- package/Source/Scene/ScreenSpaceCameraController.js +1 -2
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +241 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +13 -2
- package/Source/Scene/Vector3DTileContent.js +2 -3
- package/Source/Scene/VectorGltf3DTileContent.js +31 -3
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
- package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/renderBufferPointCollection.js +1 -2
- package/Source/Scene/renderBufferPolygonCollection.js +1 -2
- package/Source/Scene/renderBufferPolylineCollection.js +6 -3
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -4
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
- package/Source/Shaders/GlobeFS.glsl +20 -14
- package/Source/Shaders/GlobeFS.js +20 -14
- package/Source/Shaders/GlobeVS.glsl +0 -32
- package/Source/Shaders/GlobeVS.js +0 -32
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
- package/Source/Shaders/Model/ModelFS.glsl +109 -0
- package/Source/Shaders/Model/ModelFS.js +109 -0
- package/Source/Shaders/Model/ModelVS.glsl +7 -2
- package/Source/Shaders/Model/ModelVS.js +7 -2
- package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
- package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
- package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
- package/Source/Shaders/VectorCommon.glsl +305 -0
- package/Source/Shaders/VectorCommon.js +307 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/index.d.ts +1326 -65
- package/index.js +179 -155
- package/package.json +6 -6
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
- package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import Cartesian3 from "./Cartesian3.js";
|
|
2
|
+
import Cartesian4 from "./Cartesian4.js";
|
|
3
|
+
import Cartographic from "./Cartographic.js";
|
|
4
|
+
import Check from "./Check.js";
|
|
5
|
+
import Frozen from "./Frozen.js";
|
|
6
|
+
import CesiumMath from "./Math.js";
|
|
7
|
+
import defined from "./defined.js";
|
|
8
|
+
import Ion from "./Ion.js";
|
|
9
|
+
import IonResource from "./IonResource.js";
|
|
10
|
+
import IonSnapMode from "./IonSnapMode.js";
|
|
11
|
+
import Matrix4 from "./Matrix4.js";
|
|
12
|
+
import Resource from "./Resource.js";
|
|
13
|
+
import RuntimeError from "./RuntimeError.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Convert a WGS84 degrees point object returned by the ion REST API to a
|
|
17
|
+
* Cartesian3, or undefined when absent.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
function cartesianFromApiPoint(point) {
|
|
21
|
+
if (
|
|
22
|
+
!defined(point) ||
|
|
23
|
+
!defined(point.longitude) ||
|
|
24
|
+
!defined(point.latitude)
|
|
25
|
+
) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return Cartesian3.fromDegrees(
|
|
29
|
+
point.longitude,
|
|
30
|
+
point.latitude,
|
|
31
|
+
point.height ?? 0.0,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Convert a Cartesian3 (ECEF) to the WGS84 degrees object shape the ion REST
|
|
37
|
+
* API expects.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
function apiPointFromCartesian(cartesian) {
|
|
41
|
+
const carto = Cartographic.fromCartesian(cartesian);
|
|
42
|
+
return {
|
|
43
|
+
longitude: CesiumMath.toDegrees(carto.longitude),
|
|
44
|
+
latitude: CesiumMath.toDegrees(carto.latitude),
|
|
45
|
+
height: carto.height,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Convert a Matrix4 to the row-major array-of-rows shape the ion REST API
|
|
51
|
+
* expects for <code>worldToView</code>.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
function rowsFromMatrix4(matrix) {
|
|
55
|
+
const rows = [];
|
|
56
|
+
const row = new Cartesian4();
|
|
57
|
+
for (let i = 0; i < 4; i++) {
|
|
58
|
+
Matrix4.getRow(matrix, i, row);
|
|
59
|
+
rows.push([row.x, row.y, row.z, row.w]);
|
|
60
|
+
}
|
|
61
|
+
return rows;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Build the clip-space -> pixel-space (projective) viewport matrix:
|
|
66
|
+
* <pre>
|
|
67
|
+
* px = (ndcX * 0.5 + 0.5) * width
|
|
68
|
+
* py = (1 - (ndcY * 0.5 + 0.5)) * height (y-down, top-left origin)
|
|
69
|
+
* pz = ndcZ * 0.5 + 0.5 ([-1,1] -> [0,1] depth)
|
|
70
|
+
* </pre>
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
function viewportMatrix(width, height, result) {
|
|
74
|
+
return Matrix4.fromRowMajorArray(
|
|
75
|
+
// prettier-ignore
|
|
76
|
+
[
|
|
77
|
+
width / 2, 0, 0, width / 2,
|
|
78
|
+
0, -height / 2, 0, height / 2,
|
|
79
|
+
0, 0, 0.5, 0.5,
|
|
80
|
+
0, 0, 0, 1,
|
|
81
|
+
],
|
|
82
|
+
result,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const scratchViewport = new Matrix4();
|
|
87
|
+
const scratchWorldToView = new Matrix4();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The result of a successful {@link IonSnapService#snap}. Extends
|
|
91
|
+
* {@link SnapService.Result} with ion-specific fields.
|
|
92
|
+
*
|
|
93
|
+
* @typedef {object} IonSnapService.Result
|
|
94
|
+
* @property {Cartesian3} [snapPoint] The snapped point. This is the point to consume.
|
|
95
|
+
* @property {Cartesian3} [hitPoint] The point where the cursor hit the geometry: the nearest edge point when within the snap aperture, otherwise the surface point under the cursor.
|
|
96
|
+
* @property {IonSnapHeat} [heat] How close the snap point is to the close point in view space.
|
|
97
|
+
* @property {IonSnapGeometryType} [geometryType] The type of geometry snapped to.
|
|
98
|
+
* @property {IonSnapParentGeometryType} [parentGeometryType] The type of the parent geometry snapped to.
|
|
99
|
+
* @property {object} [normal] The surface normal at the snap point, in the model's local cartesian frame.
|
|
100
|
+
* @property {object} [curve] The curve geometry near the snap point, with points as WGS84 degrees objects.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Provides interactive snap-to-geometry against a Cesium ion 3D Tiles asset
|
|
105
|
+
* backed by a BIM/CAD Database model, using the ion REST API's element snap
|
|
106
|
+
* endpoint.
|
|
107
|
+
*
|
|
108
|
+
* This class handles conversions between the reference frame of a
|
|
109
|
+
* source BIM/CAD Database and the view-dependent screen space pixel
|
|
110
|
+
* coordinates. Each snap, it transforms using the ion asset's source
|
|
111
|
+
* reference frame, the camera's transform, and the canvas
|
|
112
|
+
* dimensions so that view-dependent features— such as the pixel aperture,
|
|
113
|
+
* nearest position, or surface tracking— behave correctly.
|
|
114
|
+
*
|
|
115
|
+
* This object is normally not instantiated directly, use {@link IonSnapService.fromAssetId}.
|
|
116
|
+
*
|
|
117
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
118
|
+
*
|
|
119
|
+
* @see Ion
|
|
120
|
+
* @see SnapService
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const snapper = await Cesium.IonSnapService.fromAssetId(123456);
|
|
124
|
+
* const canvas = viewer.scene.canvas;
|
|
125
|
+
* const result = await snapper.snap({
|
|
126
|
+
* elementId: "0x30000000df2",
|
|
127
|
+
* testPoint: pickedPosition,
|
|
128
|
+
* camera: viewer.camera,
|
|
129
|
+
* canvasWidth: canvas.clientWidth,
|
|
130
|
+
* canvasHeight: canvas.clientHeight,
|
|
131
|
+
* });
|
|
132
|
+
* if (Cesium.defined(result)) {
|
|
133
|
+
* console.log("snapped to", result.snapPoint);
|
|
134
|
+
* }
|
|
135
|
+
*/
|
|
136
|
+
class IonSnapService {
|
|
137
|
+
/**
|
|
138
|
+
* @param {object} options Object with the following properties:
|
|
139
|
+
* @param {number} options.assetId The ion asset id.
|
|
140
|
+
* @param {Resource} options.resource The asset's ion API resource.
|
|
141
|
+
* @param {Matrix4} options.ecefTransform A 4x4 transformation matrix from the source BIM/CAD Database reference frame local to the world's fixed reference frame.
|
|
142
|
+
*/
|
|
143
|
+
constructor(options) {
|
|
144
|
+
this._assetId = options.assetId;
|
|
145
|
+
this._resource = options.resource;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A 4x4 transformation matrix from the source BIM/CAD Database reference frame local to the world's fixed reference frame.
|
|
149
|
+
* @type {Matrix4}
|
|
150
|
+
* @readonly
|
|
151
|
+
*/
|
|
152
|
+
this.ecefTransform = options.ecefTransform;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The ion asset id this snapper operates on.
|
|
157
|
+
* @type {number}
|
|
158
|
+
* @readonly
|
|
159
|
+
*/
|
|
160
|
+
get assetId() {
|
|
161
|
+
return this._assetId;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Creates an {@link IonSnapService} for the given ion asset, fetching
|
|
166
|
+
* the asset's ECEF transform from the ion REST API.
|
|
167
|
+
*
|
|
168
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
169
|
+
*
|
|
170
|
+
* @param {number} assetId The ion ID of a 3D Tiles asset backed by a BIM/CAD Database model.
|
|
171
|
+
* @param {object} [options] Object with the following properties:
|
|
172
|
+
* @param {string} [options.accessToken=Ion.defaultAccessToken] The ion access token to use.
|
|
173
|
+
* @param {string|Resource} [options.server=Ion.defaultServer] The ion API server to use.
|
|
174
|
+
* @returns {Promise<IonSnapService>} A snapper bound to the asset.
|
|
175
|
+
*
|
|
176
|
+
* @exception {RuntimeError} The asset is not geolocated, so view-correct snapping is not possible.
|
|
177
|
+
*/
|
|
178
|
+
static async fromAssetId(assetId, options) {
|
|
179
|
+
//>>includeStart('debug', pragmas.debug);
|
|
180
|
+
Check.typeOf.number("assetId", assetId);
|
|
181
|
+
//>>includeEnd('debug');
|
|
182
|
+
|
|
183
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
184
|
+
const accessToken = options.accessToken ?? Ion.defaultAccessToken;
|
|
185
|
+
const server = Resource.createIfNeeded(options.server ?? Ion.defaultServer);
|
|
186
|
+
server.appendForwardSlash();
|
|
187
|
+
|
|
188
|
+
const resourceOptions = {
|
|
189
|
+
// Trailing slash so derived resource urls resolve under the asset id.
|
|
190
|
+
url: `assets/${assetId}/`,
|
|
191
|
+
headers: IonResource._addClientHeaders(),
|
|
192
|
+
};
|
|
193
|
+
if (defined(accessToken)) {
|
|
194
|
+
resourceOptions.queryParameters = { access_token: accessToken };
|
|
195
|
+
}
|
|
196
|
+
const resource = server.getDerivedResource(resourceOptions);
|
|
197
|
+
|
|
198
|
+
const ecefResponse = await resource
|
|
199
|
+
.getDerivedResource({ url: "ecef" })
|
|
200
|
+
.fetchJson();
|
|
201
|
+
|
|
202
|
+
if (!defined(ecefResponse?.ecefTransform)) {
|
|
203
|
+
throw new RuntimeError(
|
|
204
|
+
`Cesium ion asset ${assetId} is not geolocated; snapping requires geolocation`,
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const ecefTransform = Matrix4.fromRowMajorArray(
|
|
209
|
+
ecefResponse.ecefTransform.flat(),
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
return new IonSnapService({
|
|
213
|
+
assetId: assetId,
|
|
214
|
+
resource: resource,
|
|
215
|
+
ecefTransform: ecefTransform,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Computes the world-to-view matrix the native snapper needs: a projective
|
|
221
|
+
* transform from model-world coordinates to view (CSS pixel) coordinates,
|
|
222
|
+
* composed as <code>V * P * Vm * E</code> where
|
|
223
|
+
* <ul>
|
|
224
|
+
* <li><code>E</code>: model -> ECEF (this asset's {@link IonSnapService#ecefTransform})</li>
|
|
225
|
+
* <li><code>Vm</code>: ECEF -> eye (<code>camera.viewMatrix</code>)</li>
|
|
226
|
+
* <li><code>P</code>: eye -> clip (<code>camera.frustum.projectionMatrix</code>)</li>
|
|
227
|
+
* <li><code>V</code>: clip -> pixels (y-down viewport matrix)</li>
|
|
228
|
+
* </ul>
|
|
229
|
+
* The viewport term uses CSS pixel dimensions so pixel-valued snap apertures
|
|
230
|
+
* mean CSS pixels regardless of the display's device pixel ratio.
|
|
231
|
+
*
|
|
232
|
+
* @param {Camera} camera The camera defining the view.
|
|
233
|
+
* @param {number} canvasWidth The canvas width in CSS pixels.
|
|
234
|
+
* @param {number} canvasHeight The canvas height in CSS pixels.
|
|
235
|
+
* @param {Matrix4} [result] The object onto which to store the result.
|
|
236
|
+
* @returns {Matrix4} The model-world to view (pixels) matrix.
|
|
237
|
+
*
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
_computeWorldToView(camera, canvasWidth, canvasHeight, result) {
|
|
241
|
+
//>>includeStart('debug', pragmas.debug);
|
|
242
|
+
Check.defined("camera", camera);
|
|
243
|
+
Check.typeOf.number("canvasWidth", canvasWidth);
|
|
244
|
+
Check.typeOf.number("canvasHeight", canvasHeight);
|
|
245
|
+
//>>includeEnd('debug');
|
|
246
|
+
|
|
247
|
+
result = result ?? new Matrix4();
|
|
248
|
+
|
|
249
|
+
const V = viewportMatrix(canvasWidth, canvasHeight, scratchViewport);
|
|
250
|
+
|
|
251
|
+
// result = V * P * Vm * E, built up right-to-left
|
|
252
|
+
Matrix4.multiply(camera.viewMatrix, this.ecefTransform, result);
|
|
253
|
+
Matrix4.multiply(camera.frustum.projectionMatrix, result, result);
|
|
254
|
+
return Matrix4.multiply(V, result, result);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Requests a snap against an element of this asset.
|
|
259
|
+
*
|
|
260
|
+
* A view-correct world-to-view matrix is composed from
|
|
261
|
+
* <code>options.camera</code>, <code>options.canvasWidth</code>, and
|
|
262
|
+
* <code>options.canvasHeight</code> so view-dependent snapping (nearest
|
|
263
|
+
* ordering, pixel apertures, surface tracking) matches the current view.
|
|
264
|
+
*
|
|
265
|
+
* Only 3D views are supported: the camera must be viewing in
|
|
266
|
+
* {@link SceneMode.SCENE3D}.
|
|
267
|
+
*
|
|
268
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
269
|
+
*
|
|
270
|
+
* @param {object} options Object with the following properties:
|
|
271
|
+
* @param {string} options.elementId The element id to snap to, as a hex string, e.g. <code>"0x30000000df2"</code>.
|
|
272
|
+
* @param {Cartesian3} options.testPoint The point to snap from, typically the picked cursor position.
|
|
273
|
+
* @param {Camera} options.camera The camera defining the current view. Must be viewing in {@link SceneMode.SCENE3D}.
|
|
274
|
+
* @param {number} options.canvasWidth The canvas width in CSS pixels.
|
|
275
|
+
* @param {number} options.canvasHeight The canvas height in CSS pixels.
|
|
276
|
+
* @param {Cartesian3} [options.closePoint=options.testPoint] A reference point near the target geometry that seeds the snap search.
|
|
277
|
+
* @param {number} [options.snapAperture=IonSnapService.DEFAULT_SNAP_APERTURE] The snap tolerance in CSS pixels of the world-to-view output space.
|
|
278
|
+
* @param {IonSnapMode} [options.snapMode=IonSnapMode.NEAREST] The type of snap to perform.
|
|
279
|
+
* @returns {Promise<IonSnapService.Result|undefined>} The snap result, or <code>undefined</code> if the element was not found or no snap was possible for it.
|
|
280
|
+
*/
|
|
281
|
+
async snap(options) {
|
|
282
|
+
//>>includeStart('debug', pragmas.debug);
|
|
283
|
+
Check.defined("options", options);
|
|
284
|
+
Check.typeOf.string("options.elementId", options.elementId);
|
|
285
|
+
Check.defined("options.testPoint", options.testPoint);
|
|
286
|
+
Check.defined("options.camera", options.camera);
|
|
287
|
+
Check.typeOf.number("options.canvasWidth", options.canvasWidth);
|
|
288
|
+
Check.typeOf.number("options.canvasHeight", options.canvasHeight);
|
|
289
|
+
//>>includeEnd('debug');
|
|
290
|
+
|
|
291
|
+
const worldToView = this._computeWorldToView(
|
|
292
|
+
options.camera,
|
|
293
|
+
options.canvasWidth,
|
|
294
|
+
options.canvasHeight,
|
|
295
|
+
scratchWorldToView,
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
const body = {
|
|
299
|
+
testPoint: apiPointFromCartesian(options.testPoint),
|
|
300
|
+
closePoint: apiPointFromCartesian(
|
|
301
|
+
options.closePoint ?? options.testPoint,
|
|
302
|
+
),
|
|
303
|
+
snapAperture:
|
|
304
|
+
options.snapAperture ?? IonSnapService.DEFAULT_SNAP_APERTURE,
|
|
305
|
+
snapMode: options.snapMode ?? IonSnapMode.NEAREST,
|
|
306
|
+
worldToView: rowsFromMatrix4(worldToView),
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let response;
|
|
310
|
+
try {
|
|
311
|
+
response = await this._resource
|
|
312
|
+
.getDerivedResource({
|
|
313
|
+
url: `elements/${options.elementId}/snap`,
|
|
314
|
+
})
|
|
315
|
+
.post(JSON.stringify(body), {
|
|
316
|
+
headers: {
|
|
317
|
+
"Content-Type": "application/json",
|
|
318
|
+
},
|
|
319
|
+
responseType: "json",
|
|
320
|
+
});
|
|
321
|
+
} catch (error) {
|
|
322
|
+
// The snap endpoint responds 404 when the element does not exist, and
|
|
323
|
+
// 400 with a "No snap possible" message when the element has no
|
|
324
|
+
// snappable geometry or the test point is too far from it. Treat both
|
|
325
|
+
// as "no snap".
|
|
326
|
+
if (error?.statusCode === 404) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
if (
|
|
330
|
+
error?.statusCode === 400 &&
|
|
331
|
+
typeof error.response?.message === "string" &&
|
|
332
|
+
error.response.message.includes("No snap possible")
|
|
333
|
+
) {
|
|
334
|
+
return undefined;
|
|
335
|
+
}
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (!defined(response)) {
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const result = {
|
|
344
|
+
heat: response.heat,
|
|
345
|
+
geometryType: response.geomType,
|
|
346
|
+
parentGeometryType: response.parentGeomType,
|
|
347
|
+
normal: response.normal,
|
|
348
|
+
curve: response.curve,
|
|
349
|
+
};
|
|
350
|
+
result.snapPoint = cartesianFromApiPoint(response.snapPoint);
|
|
351
|
+
result.hitPoint = cartesianFromApiPoint(response.hitPoint);
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* The default snap tolerance used by {@link IonSnapService#snap} when
|
|
358
|
+
* <code>options.snapAperture</code> is not provided, in CSS pixels of the
|
|
359
|
+
* world-to-view output space. This is {@link SnapService}'s
|
|
360
|
+
* <code>DEFAULT_SNAP_APERTURE</code> for this implementation.
|
|
361
|
+
*
|
|
362
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
363
|
+
*
|
|
364
|
+
* @type {number}
|
|
365
|
+
* @constant
|
|
366
|
+
*/
|
|
367
|
+
IonSnapService.DEFAULT_SNAP_APERTURE = 12;
|
|
368
|
+
|
|
369
|
+
export default IonSnapService;
|
|
@@ -106,7 +106,7 @@ function convertTaiToUtc(julianDate, result) {
|
|
|
106
106
|
//we're converting, so we subtract one to get the correct LeapSecond instance.
|
|
107
107
|
return JulianDate.addSeconds(
|
|
108
108
|
julianDate,
|
|
109
|
-
-leapSeconds[
|
|
109
|
+
-leapSeconds[index - 1].offset,
|
|
110
110
|
result,
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import defined from "./defined.js";
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -5,67 +7,68 @@ import defined from "./defined.js";
|
|
|
5
7
|
*
|
|
6
8
|
* @namespace LagrangePolynomialApproximation
|
|
7
9
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @returns {number} The number of required data points needed for the desired degree of interpolation.
|
|
17
|
-
*/
|
|
18
|
-
LagrangePolynomialApproximation.getRequiredDataPoints = function (degree) {
|
|
19
|
-
return Math.max(degree + 1.0, 2);
|
|
20
|
-
};
|
|
10
|
+
class LagrangePolynomialApproximation {
|
|
11
|
+
/**
|
|
12
|
+
* Gets the name of this interpolation algorithm.
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
static get type() {
|
|
16
|
+
return "Lagrange";
|
|
17
|
+
}
|
|
21
18
|
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @param {number} yStride The number of dependent variable values in yTable corresponding to
|
|
31
|
-
* each independent variable value in xTable.
|
|
32
|
-
* @param {number[]} [result] An existing array into which to store the result.
|
|
33
|
-
* @returns {number[]} The array of interpolated values, or the result parameter if one was provided.
|
|
34
|
-
*/
|
|
35
|
-
LagrangePolynomialApproximation.interpolateOrderZero = function (
|
|
36
|
-
x,
|
|
37
|
-
xTable,
|
|
38
|
-
yTable,
|
|
39
|
-
yStride,
|
|
40
|
-
result,
|
|
41
|
-
) {
|
|
42
|
-
if (!defined(result)) {
|
|
43
|
-
result = new Array(yStride);
|
|
19
|
+
/**
|
|
20
|
+
* Given the desired degree, returns the number of data points required for interpolation.
|
|
21
|
+
*
|
|
22
|
+
* @param {number} degree The desired degree of interpolation.
|
|
23
|
+
* @returns {number} The number of required data points needed for the desired degree of interpolation.
|
|
24
|
+
*/
|
|
25
|
+
static getRequiredDataPoints(degree) {
|
|
26
|
+
return Math.max(degree + 1.0, 2);
|
|
44
27
|
}
|
|
45
28
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Interpolates values using Lagrange Polynomial Approximation.
|
|
31
|
+
*
|
|
32
|
+
* @param {number} x The independent variable for which the dependent variables will be interpolated.
|
|
33
|
+
* @param {number[]} xTable The array of independent variables to use to interpolate. The values
|
|
34
|
+
* in this array must be in increasing order and the same value must not occur twice in the array.
|
|
35
|
+
* @param {number[]} yTable The array of dependent variables to use to interpolate. For a set of three
|
|
36
|
+
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
|
|
37
|
+
* @param {number} yStride The number of dependent variable values in yTable corresponding to
|
|
38
|
+
* each independent variable value in xTable.
|
|
39
|
+
* @param {number[]} [result] An existing array into which to store the result.
|
|
40
|
+
* @returns {number[]} The array of interpolated values, or the result parameter if one was provided.
|
|
41
|
+
*/
|
|
42
|
+
static interpolateOrderZero(x, xTable, yTable, yStride, result) {
|
|
43
|
+
if (!defined(result)) {
|
|
44
|
+
result = new Array(yStride);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let i;
|
|
48
|
+
let j;
|
|
49
|
+
const length = xTable.length;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
for (i = 0; i < yStride; i++) {
|
|
52
|
+
result[i] = 0;
|
|
53
|
+
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
for (i = 0; i < length; i++) {
|
|
56
|
+
let coefficient = 1;
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
for (j = 0; j < length; j++) {
|
|
59
|
+
if (j !== i) {
|
|
60
|
+
const diffX = xTable[i] - xTable[j];
|
|
61
|
+
coefficient *= (x - xTable[j]) / diffX;
|
|
62
|
+
}
|
|
61
63
|
}
|
|
62
|
-
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
for (j = 0; j < yStride; j++) {
|
|
66
|
+
result[j] += coefficient * yTable[i * yStride + j];
|
|
67
|
+
}
|
|
66
68
|
}
|
|
69
|
+
|
|
70
|
+
return result;
|
|
67
71
|
}
|
|
72
|
+
}
|
|
68
73
|
|
|
69
|
-
return result;
|
|
70
|
-
};
|
|
71
74
|
export default LagrangePolynomialApproximation;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import defined from "./defined.js";
|
|
2
4
|
import DeveloperError from "./DeveloperError.js";
|
|
3
5
|
|
|
@@ -6,78 +8,79 @@ import DeveloperError from "./DeveloperError.js";
|
|
|
6
8
|
*
|
|
7
9
|
* @namespace LinearApproximation
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* always returns 2.
|
|
17
|
-
* @param {number} degree The desired degree of interpolation.
|
|
18
|
-
* @returns {number} This function always returns 2.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
LinearApproximation.getRequiredDataPoints = function (degree) {
|
|
22
|
-
return 2;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Interpolates values using linear approximation.
|
|
27
|
-
*
|
|
28
|
-
* @param {number} x The independent variable for which the dependent variables will be interpolated.
|
|
29
|
-
* @param {number[]} xTable The array of independent variables to use to interpolate. The values
|
|
30
|
-
* in this array must be in increasing order and the same value must not occur twice in the array.
|
|
31
|
-
* @param {number[]} yTable The array of dependent variables to use to interpolate. For a set of three
|
|
32
|
-
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
|
|
33
|
-
* @param {number} yStride The number of dependent variable values in yTable corresponding to
|
|
34
|
-
* each independent variable value in xTable.
|
|
35
|
-
* @param {number[]} [result] An existing array into which to store the result.
|
|
36
|
-
* @returns {number[]} The array of interpolated values, or the result parameter if one was provided.
|
|
37
|
-
*/
|
|
38
|
-
LinearApproximation.interpolateOrderZero = function (
|
|
39
|
-
x,
|
|
40
|
-
xTable,
|
|
41
|
-
yTable,
|
|
42
|
-
yStride,
|
|
43
|
-
result,
|
|
44
|
-
) {
|
|
45
|
-
//>>includeStart('debug', pragmas.debug);
|
|
46
|
-
if (xTable.length !== 2) {
|
|
47
|
-
throw new DeveloperError(
|
|
48
|
-
"The xTable provided to the linear interpolator must have exactly two elements.",
|
|
49
|
-
);
|
|
50
|
-
} else if (yStride <= 0) {
|
|
51
|
-
throw new DeveloperError(
|
|
52
|
-
"There must be at least 1 dependent variable for each independent variable.",
|
|
53
|
-
);
|
|
11
|
+
class LinearApproximation {
|
|
12
|
+
/**
|
|
13
|
+
* Gets the name of this interpolation algorithm.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
static get type() {
|
|
17
|
+
return "Linear";
|
|
54
18
|
}
|
|
55
|
-
//>>includeEnd('debug');
|
|
56
19
|
|
|
57
|
-
|
|
58
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Given the desired degree, returns the number of data points required for interpolation.
|
|
22
|
+
* Since linear interpolation can only generate a first degree polynomial, this function
|
|
23
|
+
* always returns 2.
|
|
24
|
+
* @param {number} degree The desired degree of interpolation.
|
|
25
|
+
* @returns {number} This function always returns 2.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
static getRequiredDataPoints(degree) {
|
|
29
|
+
return 2;
|
|
59
30
|
}
|
|
60
31
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Interpolates values using linear approximation.
|
|
34
|
+
*
|
|
35
|
+
* @param {number} x The independent variable for which the dependent variables will be interpolated.
|
|
36
|
+
* @param {number[]} xTable The array of independent variables to use to interpolate. The values
|
|
37
|
+
* in this array must be in increasing order and the same value must not occur twice in the array.
|
|
38
|
+
* @param {number[]} yTable The array of dependent variables to use to interpolate. For a set of three
|
|
39
|
+
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
|
|
40
|
+
* @param {number} yStride The number of dependent variable values in yTable corresponding to
|
|
41
|
+
* each independent variable value in xTable.
|
|
42
|
+
* @param {number[]} [result] An existing array into which to store the result.
|
|
43
|
+
* @returns {number[]} The array of interpolated values, or the result parameter if one was provided.
|
|
44
|
+
*/
|
|
45
|
+
static interpolateOrderZero(x, xTable, yTable, yStride, result) {
|
|
46
|
+
//>>includeStart('debug', pragmas.debug);
|
|
47
|
+
if (xTable.length !== 2) {
|
|
48
|
+
throw new DeveloperError(
|
|
49
|
+
"The xTable provided to the linear interpolator must have exactly two elements.",
|
|
50
|
+
);
|
|
51
|
+
} else if (yStride <= 0) {
|
|
52
|
+
throw new DeveloperError(
|
|
53
|
+
"There must be at least 1 dependent variable for each independent variable.",
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
//>>includeEnd('debug');
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
if (!defined(result)) {
|
|
59
|
+
result = new Array(yStride);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let i;
|
|
63
|
+
let y0;
|
|
64
|
+
let y1;
|
|
65
|
+
const x0 = xTable[0];
|
|
66
|
+
const x1 = xTable[1];
|
|
67
|
+
|
|
68
|
+
//>>includeStart('debug', pragmas.debug);
|
|
69
|
+
if (x0 === x1) {
|
|
70
|
+
throw new DeveloperError(
|
|
71
|
+
"Divide by zero error: xTable[0] and xTable[1] are equal",
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
//>>includeEnd('debug');
|
|
75
|
+
|
|
76
|
+
for (i = 0; i < yStride; i++) {
|
|
77
|
+
y0 = yTable[i];
|
|
78
|
+
y1 = yTable[i + yStride];
|
|
79
|
+
result[i] = ((y1 - y0) * x + x1 * y0 - x0 * y1) / (x1 - x0);
|
|
80
|
+
}
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
y0 = yTable[i];
|
|
77
|
-
y1 = yTable[i + yStride];
|
|
78
|
-
result[i] = ((y1 - y0) * x + x1 * y0 - x0 * y1) / (x1 - x0);
|
|
82
|
+
return result;
|
|
79
83
|
}
|
|
84
|
+
}
|
|
80
85
|
|
|
81
|
-
return result;
|
|
82
|
-
};
|
|
83
86
|
export default LinearApproximation;
|