@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,1829 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.139.1
|
|
5
|
-
*
|
|
6
|
-
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*
|
|
20
|
-
* Columbus View (Pat. Pend.)
|
|
21
|
-
*
|
|
22
|
-
* Portions licensed separately.
|
|
23
|
-
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
Math_default
|
|
28
|
-
} from "./chunk-TXYQNXNW.js";
|
|
29
|
-
import {
|
|
30
|
-
Check_default,
|
|
31
|
-
DeveloperError_default
|
|
32
|
-
} from "./chunk-N6HRZLS6.js";
|
|
33
|
-
import {
|
|
34
|
-
defined_default
|
|
35
|
-
} from "./chunk-BTP3634E.js";
|
|
36
|
-
|
|
37
|
-
// packages/engine/Source/Core/Cartesian3.js
|
|
38
|
-
var Cartesian3 = class _Cartesian3 {
|
|
39
|
-
/**
|
|
40
|
-
* @param {number} [x=0.0] The X component.
|
|
41
|
-
* @param {number} [y=0.0] The Y component.
|
|
42
|
-
* @param {number} [z=0.0] The Z component.
|
|
43
|
-
*/
|
|
44
|
-
constructor(x, y, z) {
|
|
45
|
-
this.x = x ?? 0;
|
|
46
|
-
this.y = y ?? 0;
|
|
47
|
-
this.z = z ?? 0;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Converts the provided Spherical into Cartesian3 coordinates.
|
|
51
|
-
*
|
|
52
|
-
* @param {Spherical} spherical The Spherical to be converted to Cartesian3.
|
|
53
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
54
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
|
55
|
-
*/
|
|
56
|
-
static fromSpherical(spherical, result) {
|
|
57
|
-
Check_default.typeOf.object("spherical", spherical);
|
|
58
|
-
if (!defined_default(result)) {
|
|
59
|
-
result = new _Cartesian3();
|
|
60
|
-
}
|
|
61
|
-
const clock = spherical.clock;
|
|
62
|
-
const cone = spherical.cone;
|
|
63
|
-
const magnitude = spherical.magnitude ?? 1;
|
|
64
|
-
const radial = magnitude * Math.sin(cone);
|
|
65
|
-
result.x = radial * Math.cos(clock);
|
|
66
|
-
result.y = radial * Math.sin(clock);
|
|
67
|
-
result.z = magnitude * Math.cos(cone);
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Creates a Cartesian3 instance from x, y and z coordinates.
|
|
72
|
-
*
|
|
73
|
-
* @param {number} x The x coordinate.
|
|
74
|
-
* @param {number} y The y coordinate.
|
|
75
|
-
* @param {number} z The z coordinate.
|
|
76
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
77
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
|
78
|
-
*/
|
|
79
|
-
static fromElements(x, y, z, result) {
|
|
80
|
-
if (!defined_default(result)) {
|
|
81
|
-
return new _Cartesian3(x, y, z);
|
|
82
|
-
}
|
|
83
|
-
result.x = x;
|
|
84
|
-
result.y = y;
|
|
85
|
-
result.z = z;
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Duplicates a Cartesian3 instance.
|
|
90
|
-
*
|
|
91
|
-
* @param {Cartesian3} cartesian The Cartesian to duplicate.
|
|
92
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
93
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)
|
|
94
|
-
*/
|
|
95
|
-
static clone(cartesian, result) {
|
|
96
|
-
if (!defined_default(cartesian)) {
|
|
97
|
-
return void 0;
|
|
98
|
-
}
|
|
99
|
-
if (!defined_default(result)) {
|
|
100
|
-
return new _Cartesian3(cartesian.x, cartesian.y, cartesian.z);
|
|
101
|
-
}
|
|
102
|
-
result.x = cartesian.x;
|
|
103
|
-
result.y = cartesian.y;
|
|
104
|
-
result.z = cartesian.z;
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Stores the provided instance into the provided array.
|
|
109
|
-
*
|
|
110
|
-
* @param {Cartesian3} value The value to pack.
|
|
111
|
-
* @param {number[]|TypedArray} array The array to pack into.
|
|
112
|
-
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
113
|
-
*
|
|
114
|
-
* @returns {number[]|TypedArray} The array that was packed into
|
|
115
|
-
*/
|
|
116
|
-
static pack(value, array, startingIndex) {
|
|
117
|
-
Check_default.typeOf.object("value", value);
|
|
118
|
-
Check_default.defined("array", array);
|
|
119
|
-
startingIndex = startingIndex ?? 0;
|
|
120
|
-
array[startingIndex++] = value.x;
|
|
121
|
-
array[startingIndex++] = value.y;
|
|
122
|
-
array[startingIndex] = value.z;
|
|
123
|
-
return array;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Retrieves an instance from a packed array.
|
|
127
|
-
*
|
|
128
|
-
* @param {number[]|TypedArray} array The packed array.
|
|
129
|
-
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
130
|
-
* @param {Cartesian3} [result] The object into which to store the result.
|
|
131
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
|
132
|
-
*/
|
|
133
|
-
static unpack(array, startingIndex, result) {
|
|
134
|
-
Check_default.defined("array", array);
|
|
135
|
-
startingIndex = startingIndex ?? 0;
|
|
136
|
-
if (!defined_default(result)) {
|
|
137
|
-
result = new _Cartesian3();
|
|
138
|
-
}
|
|
139
|
-
result.x = array[startingIndex++];
|
|
140
|
-
result.y = array[startingIndex++];
|
|
141
|
-
result.z = array[startingIndex];
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Flattens an array of Cartesian3s into an array of components.
|
|
146
|
-
*
|
|
147
|
-
* @param {Cartesian3[]} array The array of cartesians to pack.
|
|
148
|
-
* @param {number[]|TypedArray} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 3 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 3) elements.
|
|
149
|
-
* @returns {number[]|TypedArray} The packed array.
|
|
150
|
-
*/
|
|
151
|
-
static packArray(array, result) {
|
|
152
|
-
Check_default.defined("array", array);
|
|
153
|
-
const length = array.length;
|
|
154
|
-
const resultLength = length * 3;
|
|
155
|
-
if (!defined_default(result)) {
|
|
156
|
-
result = new Array(resultLength);
|
|
157
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
158
|
-
throw new DeveloperError_default(
|
|
159
|
-
"If result is a typed array, it must have exactly array.length * 3 elements"
|
|
160
|
-
);
|
|
161
|
-
} else if (result.length !== resultLength) {
|
|
162
|
-
result.length = resultLength;
|
|
163
|
-
}
|
|
164
|
-
for (let i = 0; i < length; ++i) {
|
|
165
|
-
_Cartesian3.pack(array[i], result, i * 3);
|
|
166
|
-
}
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Unpacks an array of cartesian components into an array of Cartesian3s.
|
|
171
|
-
*
|
|
172
|
-
* @param {number[]|TypedArray} array The array of components to unpack.
|
|
173
|
-
* @param {Cartesian3[]} [result] The array onto which to store the result.
|
|
174
|
-
* @returns {Cartesian3[]} The unpacked array.
|
|
175
|
-
*/
|
|
176
|
-
static unpackArray(array, result) {
|
|
177
|
-
Check_default.defined("array", array);
|
|
178
|
-
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 3);
|
|
179
|
-
if (array.length % 3 !== 0) {
|
|
180
|
-
throw new DeveloperError_default("array length must be a multiple of 3.");
|
|
181
|
-
}
|
|
182
|
-
const length = array.length;
|
|
183
|
-
if (!defined_default(result)) {
|
|
184
|
-
result = new Array(length / 3);
|
|
185
|
-
} else {
|
|
186
|
-
result.length = length / 3;
|
|
187
|
-
}
|
|
188
|
-
for (let i = 0; i < length; i += 3) {
|
|
189
|
-
const index = i / 3;
|
|
190
|
-
result[index] = _Cartesian3.unpack(array, i, result[index]);
|
|
191
|
-
}
|
|
192
|
-
return result;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Computes the value of the maximum component for the supplied Cartesian.
|
|
196
|
-
*
|
|
197
|
-
* @param {Cartesian3} cartesian The cartesian to use.
|
|
198
|
-
* @returns {number} The value of the maximum component.
|
|
199
|
-
*/
|
|
200
|
-
static maximumComponent(cartesian) {
|
|
201
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
202
|
-
return Math.max(cartesian.x, cartesian.y, cartesian.z);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Computes the value of the minimum component for the supplied Cartesian.
|
|
206
|
-
*
|
|
207
|
-
* @param {Cartesian3} cartesian The cartesian to use.
|
|
208
|
-
* @returns {number} The value of the minimum component.
|
|
209
|
-
*/
|
|
210
|
-
static minimumComponent(cartesian) {
|
|
211
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
212
|
-
return Math.min(cartesian.x, cartesian.y, cartesian.z);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
|
|
216
|
-
*
|
|
217
|
-
* @param {Cartesian3} first A cartesian to compare.
|
|
218
|
-
* @param {Cartesian3} second A cartesian to compare.
|
|
219
|
-
* @param {Cartesian3} result The object into which to store the result.
|
|
220
|
-
* @returns {Cartesian3} A cartesian with the minimum components.
|
|
221
|
-
*/
|
|
222
|
-
static minimumByComponent(first, second, result) {
|
|
223
|
-
Check_default.typeOf.object("first", first);
|
|
224
|
-
Check_default.typeOf.object("second", second);
|
|
225
|
-
Check_default.typeOf.object("result", result);
|
|
226
|
-
result.x = Math.min(first.x, second.x);
|
|
227
|
-
result.y = Math.min(first.y, second.y);
|
|
228
|
-
result.z = Math.min(first.z, second.z);
|
|
229
|
-
return result;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
|
|
233
|
-
*
|
|
234
|
-
* @param {Cartesian3} first A cartesian to compare.
|
|
235
|
-
* @param {Cartesian3} second A cartesian to compare.
|
|
236
|
-
* @param {Cartesian3} result The object into which to store the result.
|
|
237
|
-
* @returns {Cartesian3} A cartesian with the maximum components.
|
|
238
|
-
*/
|
|
239
|
-
static maximumByComponent(first, second, result) {
|
|
240
|
-
Check_default.typeOf.object("first", first);
|
|
241
|
-
Check_default.typeOf.object("second", second);
|
|
242
|
-
Check_default.typeOf.object("result", result);
|
|
243
|
-
result.x = Math.max(first.x, second.x);
|
|
244
|
-
result.y = Math.max(first.y, second.y);
|
|
245
|
-
result.z = Math.max(first.z, second.z);
|
|
246
|
-
return result;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Constrain a value to lie between two values.
|
|
250
|
-
*
|
|
251
|
-
* @param {Cartesian3} value The value to clamp.
|
|
252
|
-
* @param {Cartesian3} min The minimum bound.
|
|
253
|
-
* @param {Cartesian3} max The maximum bound.
|
|
254
|
-
* @param {Cartesian3} result The object into which to store the result.
|
|
255
|
-
* @returns {Cartesian3} The clamped value such that min <= value <= max.
|
|
256
|
-
*/
|
|
257
|
-
static clamp(value, min, max, result) {
|
|
258
|
-
Check_default.typeOf.object("value", value);
|
|
259
|
-
Check_default.typeOf.object("min", min);
|
|
260
|
-
Check_default.typeOf.object("max", max);
|
|
261
|
-
Check_default.typeOf.object("result", result);
|
|
262
|
-
const x = Math_default.clamp(value.x, min.x, max.x);
|
|
263
|
-
const y = Math_default.clamp(value.y, min.y, max.y);
|
|
264
|
-
const z = Math_default.clamp(value.z, min.z, max.z);
|
|
265
|
-
result.x = x;
|
|
266
|
-
result.y = y;
|
|
267
|
-
result.z = z;
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Computes the provided Cartesian's squared magnitude.
|
|
272
|
-
*
|
|
273
|
-
* @param {Cartesian3} cartesian The Cartesian instance whose squared magnitude is to be computed.
|
|
274
|
-
* @returns {number} The squared magnitude.
|
|
275
|
-
*/
|
|
276
|
-
static magnitudeSquared(cartesian) {
|
|
277
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
278
|
-
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Computes the Cartesian's magnitude (length).
|
|
282
|
-
*
|
|
283
|
-
* @param {Cartesian3} cartesian The Cartesian instance whose magnitude is to be computed.
|
|
284
|
-
* @returns {number} The magnitude.
|
|
285
|
-
*/
|
|
286
|
-
static magnitude(cartesian) {
|
|
287
|
-
return Math.sqrt(_Cartesian3.magnitudeSquared(cartesian));
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Computes the distance between two points.
|
|
291
|
-
*
|
|
292
|
-
* @param {Cartesian3} left The first point to compute the distance from.
|
|
293
|
-
* @param {Cartesian3} right The second point to compute the distance to.
|
|
294
|
-
* @returns {number} The distance between two points.
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* // Returns 1.0
|
|
298
|
-
* const d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0));
|
|
299
|
-
*/
|
|
300
|
-
static distance(left, right) {
|
|
301
|
-
Check_default.typeOf.object("left", left);
|
|
302
|
-
Check_default.typeOf.object("right", right);
|
|
303
|
-
_Cartesian3.subtract(left, right, distanceScratch);
|
|
304
|
-
return _Cartesian3.magnitude(distanceScratch);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Computes the squared distance between two points. Comparing squared distances
|
|
308
|
-
* using this function is more efficient than comparing distances using {@link Cartesian3#distance}.
|
|
309
|
-
*
|
|
310
|
-
* @param {Cartesian3} left The first point to compute the distance from.
|
|
311
|
-
* @param {Cartesian3} right The second point to compute the distance to.
|
|
312
|
-
* @returns {number} The distance between two points.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* // Returns 4.0, not 2.0
|
|
316
|
-
* const d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0));
|
|
317
|
-
*/
|
|
318
|
-
static distanceSquared(left, right) {
|
|
319
|
-
Check_default.typeOf.object("left", left);
|
|
320
|
-
Check_default.typeOf.object("right", right);
|
|
321
|
-
_Cartesian3.subtract(left, right, distanceScratch);
|
|
322
|
-
return _Cartesian3.magnitudeSquared(distanceScratch);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Computes the normalized form of the supplied Cartesian.
|
|
326
|
-
*
|
|
327
|
-
* @param {Cartesian3} cartesian The Cartesian to be normalized.
|
|
328
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
329
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
330
|
-
*/
|
|
331
|
-
static normalize(cartesian, result) {
|
|
332
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
333
|
-
Check_default.typeOf.object("result", result);
|
|
334
|
-
const magnitude = _Cartesian3.magnitude(cartesian);
|
|
335
|
-
result.x = cartesian.x / magnitude;
|
|
336
|
-
result.y = cartesian.y / magnitude;
|
|
337
|
-
result.z = cartesian.z / magnitude;
|
|
338
|
-
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z)) {
|
|
339
|
-
throw new DeveloperError_default("normalized result is not a number");
|
|
340
|
-
}
|
|
341
|
-
return result;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Computes the dot (scalar) product of two Cartesians.
|
|
345
|
-
*
|
|
346
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
347
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
348
|
-
* @returns {number} The dot product.
|
|
349
|
-
*/
|
|
350
|
-
static dot(left, right) {
|
|
351
|
-
Check_default.typeOf.object("left", left);
|
|
352
|
-
Check_default.typeOf.object("right", right);
|
|
353
|
-
return left.x * right.x + left.y * right.y + left.z * right.z;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Computes the componentwise product of two Cartesians.
|
|
357
|
-
*
|
|
358
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
359
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
360
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
361
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
362
|
-
*/
|
|
363
|
-
static multiplyComponents(left, right, result) {
|
|
364
|
-
Check_default.typeOf.object("left", left);
|
|
365
|
-
Check_default.typeOf.object("right", right);
|
|
366
|
-
Check_default.typeOf.object("result", result);
|
|
367
|
-
result.x = left.x * right.x;
|
|
368
|
-
result.y = left.y * right.y;
|
|
369
|
-
result.z = left.z * right.z;
|
|
370
|
-
return result;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Computes the componentwise quotient of two Cartesians.
|
|
374
|
-
*
|
|
375
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
376
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
377
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
378
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
379
|
-
*/
|
|
380
|
-
static divideComponents(left, right, result) {
|
|
381
|
-
Check_default.typeOf.object("left", left);
|
|
382
|
-
Check_default.typeOf.object("right", right);
|
|
383
|
-
Check_default.typeOf.object("result", result);
|
|
384
|
-
result.x = left.x / right.x;
|
|
385
|
-
result.y = left.y / right.y;
|
|
386
|
-
result.z = left.z / right.z;
|
|
387
|
-
return result;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Computes the componentwise sum of two Cartesians.
|
|
391
|
-
*
|
|
392
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
393
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
394
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
395
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
396
|
-
*/
|
|
397
|
-
static add(left, right, result) {
|
|
398
|
-
Check_default.typeOf.object("left", left);
|
|
399
|
-
Check_default.typeOf.object("right", right);
|
|
400
|
-
Check_default.typeOf.object("result", result);
|
|
401
|
-
result.x = left.x + right.x;
|
|
402
|
-
result.y = left.y + right.y;
|
|
403
|
-
result.z = left.z + right.z;
|
|
404
|
-
return result;
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Computes the componentwise difference of two Cartesians.
|
|
408
|
-
*
|
|
409
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
410
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
411
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
412
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
413
|
-
*/
|
|
414
|
-
static subtract(left, right, result) {
|
|
415
|
-
Check_default.typeOf.object("left", left);
|
|
416
|
-
Check_default.typeOf.object("right", right);
|
|
417
|
-
Check_default.typeOf.object("result", result);
|
|
418
|
-
result.x = left.x - right.x;
|
|
419
|
-
result.y = left.y - right.y;
|
|
420
|
-
result.z = left.z - right.z;
|
|
421
|
-
return result;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Multiplies the provided Cartesian componentwise by the provided scalar.
|
|
425
|
-
*
|
|
426
|
-
* @param {Cartesian3} cartesian The Cartesian to be scaled.
|
|
427
|
-
* @param {number} scalar The scalar to multiply with.
|
|
428
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
429
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
430
|
-
*/
|
|
431
|
-
static multiplyByScalar(cartesian, scalar, result) {
|
|
432
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
433
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
434
|
-
Check_default.typeOf.object("result", result);
|
|
435
|
-
result.x = cartesian.x * scalar;
|
|
436
|
-
result.y = cartesian.y * scalar;
|
|
437
|
-
result.z = cartesian.z * scalar;
|
|
438
|
-
return result;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Divides the provided Cartesian componentwise by the provided scalar.
|
|
442
|
-
*
|
|
443
|
-
* @param {Cartesian3} cartesian The Cartesian to be divided.
|
|
444
|
-
* @param {number} scalar The scalar to divide by.
|
|
445
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
446
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
447
|
-
*/
|
|
448
|
-
static divideByScalar(cartesian, scalar, result) {
|
|
449
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
450
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
451
|
-
Check_default.typeOf.object("result", result);
|
|
452
|
-
result.x = cartesian.x / scalar;
|
|
453
|
-
result.y = cartesian.y / scalar;
|
|
454
|
-
result.z = cartesian.z / scalar;
|
|
455
|
-
return result;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Negates the provided Cartesian.
|
|
459
|
-
*
|
|
460
|
-
* @param {Cartesian3} cartesian The Cartesian to be negated.
|
|
461
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
462
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
463
|
-
*/
|
|
464
|
-
static negate(cartesian, result) {
|
|
465
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
466
|
-
Check_default.typeOf.object("result", result);
|
|
467
|
-
result.x = -cartesian.x;
|
|
468
|
-
result.y = -cartesian.y;
|
|
469
|
-
result.z = -cartesian.z;
|
|
470
|
-
return result;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Computes the absolute value of the provided Cartesian.
|
|
474
|
-
*
|
|
475
|
-
* @param {Cartesian3} cartesian The Cartesian whose absolute value is to be computed.
|
|
476
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
477
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
478
|
-
*/
|
|
479
|
-
static abs(cartesian, result) {
|
|
480
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
481
|
-
Check_default.typeOf.object("result", result);
|
|
482
|
-
result.x = Math.abs(cartesian.x);
|
|
483
|
-
result.y = Math.abs(cartesian.y);
|
|
484
|
-
result.z = Math.abs(cartesian.z);
|
|
485
|
-
return result;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
|
|
489
|
-
*
|
|
490
|
-
* @param {Cartesian3} start The value corresponding to t at 0.0.
|
|
491
|
-
* @param {Cartesian3} end The value corresponding to t at 1.0.
|
|
492
|
-
* @param {number} t The point along t at which to interpolate.
|
|
493
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
494
|
-
* @returns {Cartesian3} The modified result parameter.
|
|
495
|
-
*/
|
|
496
|
-
static lerp(start, end, t, result) {
|
|
497
|
-
Check_default.typeOf.object("start", start);
|
|
498
|
-
Check_default.typeOf.object("end", end);
|
|
499
|
-
Check_default.typeOf.number("t", t);
|
|
500
|
-
Check_default.typeOf.object("result", result);
|
|
501
|
-
_Cartesian3.multiplyByScalar(end, t, lerpScratch);
|
|
502
|
-
result = _Cartesian3.multiplyByScalar(start, 1 - t, result);
|
|
503
|
-
return _Cartesian3.add(lerpScratch, result, result);
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Returns the angle, in radians, between the provided Cartesians.
|
|
507
|
-
*
|
|
508
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
509
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
510
|
-
* @returns {number} The angle between the Cartesians.
|
|
511
|
-
*/
|
|
512
|
-
static angleBetween(left, right) {
|
|
513
|
-
Check_default.typeOf.object("left", left);
|
|
514
|
-
Check_default.typeOf.object("right", right);
|
|
515
|
-
_Cartesian3.normalize(left, angleBetweenScratch);
|
|
516
|
-
_Cartesian3.normalize(right, angleBetweenScratch2);
|
|
517
|
-
const cosine = _Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2);
|
|
518
|
-
const sine = _Cartesian3.magnitude(
|
|
519
|
-
_Cartesian3.cross(
|
|
520
|
-
angleBetweenScratch,
|
|
521
|
-
angleBetweenScratch2,
|
|
522
|
-
angleBetweenScratch
|
|
523
|
-
)
|
|
524
|
-
);
|
|
525
|
-
return Math.atan2(sine, cosine);
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Returns the axis that is most orthogonal to the provided Cartesian.
|
|
529
|
-
*
|
|
530
|
-
* @param {Cartesian3} cartesian The Cartesian on which to find the most orthogonal axis.
|
|
531
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
532
|
-
* @returns {Cartesian3} The most orthogonal axis.
|
|
533
|
-
*/
|
|
534
|
-
static mostOrthogonalAxis(cartesian, result) {
|
|
535
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
536
|
-
Check_default.typeOf.object("result", result);
|
|
537
|
-
const f = _Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch);
|
|
538
|
-
_Cartesian3.abs(f, f);
|
|
539
|
-
if (f.x <= f.y) {
|
|
540
|
-
if (f.x <= f.z) {
|
|
541
|
-
result = _Cartesian3.clone(_Cartesian3.UNIT_X, result);
|
|
542
|
-
} else {
|
|
543
|
-
result = _Cartesian3.clone(_Cartesian3.UNIT_Z, result);
|
|
544
|
-
}
|
|
545
|
-
} else if (f.y <= f.z) {
|
|
546
|
-
result = _Cartesian3.clone(_Cartesian3.UNIT_Y, result);
|
|
547
|
-
} else {
|
|
548
|
-
result = _Cartesian3.clone(_Cartesian3.UNIT_Z, result);
|
|
549
|
-
}
|
|
550
|
-
return result;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Projects vector a onto vector b
|
|
554
|
-
* @param {Cartesian3} a The vector that needs projecting
|
|
555
|
-
* @param {Cartesian3} b The vector to project onto
|
|
556
|
-
* @param {Cartesian3} result The result cartesian
|
|
557
|
-
* @returns {Cartesian3} The modified result parameter
|
|
558
|
-
*/
|
|
559
|
-
static projectVector(a, b, result) {
|
|
560
|
-
Check_default.defined("a", a);
|
|
561
|
-
Check_default.defined("b", b);
|
|
562
|
-
Check_default.defined("result", result);
|
|
563
|
-
const scalar = _Cartesian3.dot(a, b) / _Cartesian3.dot(b, b);
|
|
564
|
-
return _Cartesian3.multiplyByScalar(b, scalar, result);
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Compares the provided Cartesians componentwise and returns
|
|
568
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
569
|
-
*
|
|
570
|
-
* @param {Cartesian3} [left] The first Cartesian.
|
|
571
|
-
* @param {Cartesian3} [right] The second Cartesian.
|
|
572
|
-
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
573
|
-
*/
|
|
574
|
-
static equals(left, right) {
|
|
575
|
-
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z;
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* @param {Cartesian3} cartesian
|
|
579
|
-
* @param {number[]} array
|
|
580
|
-
* @param {number} offset
|
|
581
|
-
* @private
|
|
582
|
-
*/
|
|
583
|
-
static equalsArray(cartesian, array, offset) {
|
|
584
|
-
return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2];
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Compares the provided Cartesians componentwise and returns
|
|
588
|
-
* <code>true</code> if they pass an absolute or relative tolerance test,
|
|
589
|
-
* <code>false</code> otherwise.
|
|
590
|
-
*
|
|
591
|
-
* @param {Cartesian3} [left] The first Cartesian.
|
|
592
|
-
* @param {Cartesian3} [right] The second Cartesian.
|
|
593
|
-
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
|
594
|
-
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
|
595
|
-
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
|
596
|
-
*/
|
|
597
|
-
static equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon) {
|
|
598
|
-
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
|
599
|
-
left.x,
|
|
600
|
-
right.x,
|
|
601
|
-
relativeEpsilon,
|
|
602
|
-
absoluteEpsilon
|
|
603
|
-
) && Math_default.equalsEpsilon(
|
|
604
|
-
left.y,
|
|
605
|
-
right.y,
|
|
606
|
-
relativeEpsilon,
|
|
607
|
-
absoluteEpsilon
|
|
608
|
-
) && Math_default.equalsEpsilon(
|
|
609
|
-
left.z,
|
|
610
|
-
right.z,
|
|
611
|
-
relativeEpsilon,
|
|
612
|
-
absoluteEpsilon
|
|
613
|
-
);
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Computes the cross (outer) product of two Cartesians.
|
|
617
|
-
*
|
|
618
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
619
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
620
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
621
|
-
* @returns {Cartesian3} The cross product.
|
|
622
|
-
*/
|
|
623
|
-
static cross(left, right, result) {
|
|
624
|
-
Check_default.typeOf.object("left", left);
|
|
625
|
-
Check_default.typeOf.object("right", right);
|
|
626
|
-
Check_default.typeOf.object("result", result);
|
|
627
|
-
const leftX = left.x;
|
|
628
|
-
const leftY = left.y;
|
|
629
|
-
const leftZ = left.z;
|
|
630
|
-
const rightX = right.x;
|
|
631
|
-
const rightY = right.y;
|
|
632
|
-
const rightZ = right.z;
|
|
633
|
-
const x = leftY * rightZ - leftZ * rightY;
|
|
634
|
-
const y = leftZ * rightX - leftX * rightZ;
|
|
635
|
-
const z = leftX * rightY - leftY * rightX;
|
|
636
|
-
result.x = x;
|
|
637
|
-
result.y = y;
|
|
638
|
-
result.z = z;
|
|
639
|
-
return result;
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Computes the midpoint between the right and left Cartesian.
|
|
643
|
-
* @param {Cartesian3} left The first Cartesian.
|
|
644
|
-
* @param {Cartesian3} right The second Cartesian.
|
|
645
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
|
646
|
-
* @returns {Cartesian3} The midpoint.
|
|
647
|
-
*/
|
|
648
|
-
static midpoint(left, right, result) {
|
|
649
|
-
Check_default.typeOf.object("left", left);
|
|
650
|
-
Check_default.typeOf.object("right", right);
|
|
651
|
-
Check_default.typeOf.object("result", result);
|
|
652
|
-
result.x = (left.x + right.x) * 0.5;
|
|
653
|
-
result.y = (left.y + right.y) * 0.5;
|
|
654
|
-
result.z = (left.z + right.z) * 0.5;
|
|
655
|
-
return result;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Returns a Cartesian3 position from longitude and latitude values given in degrees.
|
|
659
|
-
*
|
|
660
|
-
* @param {number} longitude The longitude, in degrees
|
|
661
|
-
* @param {number} latitude The latitude, in degrees
|
|
662
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
|
663
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the position lies.
|
|
664
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
665
|
-
* @returns {Cartesian3} The position
|
|
666
|
-
*
|
|
667
|
-
* @example
|
|
668
|
-
* const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);
|
|
669
|
-
*/
|
|
670
|
-
static fromDegrees(longitude, latitude, height, ellipsoid, result) {
|
|
671
|
-
Check_default.typeOf.number("longitude", longitude);
|
|
672
|
-
Check_default.typeOf.number("latitude", latitude);
|
|
673
|
-
longitude = Math_default.toRadians(longitude);
|
|
674
|
-
latitude = Math_default.toRadians(latitude);
|
|
675
|
-
return _Cartesian3.fromRadians(
|
|
676
|
-
longitude,
|
|
677
|
-
latitude,
|
|
678
|
-
height,
|
|
679
|
-
ellipsoid,
|
|
680
|
-
result
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Returns a Cartesian3 position from longitude and latitude values given in radians.
|
|
685
|
-
*
|
|
686
|
-
* @param {number} longitude The longitude, in radians
|
|
687
|
-
* @param {number} latitude The latitude, in radians
|
|
688
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
|
689
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the position lies.
|
|
690
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
691
|
-
* @returns {Cartesian3} The position
|
|
692
|
-
*
|
|
693
|
-
* @example
|
|
694
|
-
* const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);
|
|
695
|
-
*/
|
|
696
|
-
static fromRadians(longitude, latitude, height, ellipsoid, result) {
|
|
697
|
-
Check_default.typeOf.number("longitude", longitude);
|
|
698
|
-
Check_default.typeOf.number("latitude", latitude);
|
|
699
|
-
height = height ?? 0;
|
|
700
|
-
const radiiSquared = !defined_default(ellipsoid) ? _Cartesian3._ellipsoidRadiiSquared : (
|
|
701
|
-
// @ts-expect-error Requires type-checking on Ellipsoid.js.
|
|
702
|
-
ellipsoid.radiiSquared
|
|
703
|
-
);
|
|
704
|
-
const cosLatitude = Math.cos(latitude);
|
|
705
|
-
scratchN.x = cosLatitude * Math.cos(longitude);
|
|
706
|
-
scratchN.y = cosLatitude * Math.sin(longitude);
|
|
707
|
-
scratchN.z = Math.sin(latitude);
|
|
708
|
-
scratchN = _Cartesian3.normalize(scratchN, scratchN);
|
|
709
|
-
_Cartesian3.multiplyComponents(radiiSquared, scratchN, scratchK);
|
|
710
|
-
const gamma = Math.sqrt(_Cartesian3.dot(scratchN, scratchK));
|
|
711
|
-
scratchK = _Cartesian3.divideByScalar(scratchK, gamma, scratchK);
|
|
712
|
-
scratchN = _Cartesian3.multiplyByScalar(scratchN, height, scratchN);
|
|
713
|
-
if (!defined_default(result)) {
|
|
714
|
-
result = new _Cartesian3();
|
|
715
|
-
}
|
|
716
|
-
return _Cartesian3.add(scratchK, scratchN, result);
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees.
|
|
720
|
-
*
|
|
721
|
-
* @param {number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
|
|
722
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the coordinates lie.
|
|
723
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
|
724
|
-
* @returns {Cartesian3[]} The array of positions.
|
|
725
|
-
*
|
|
726
|
-
* @example
|
|
727
|
-
* const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);
|
|
728
|
-
*/
|
|
729
|
-
static fromDegreesArray(coordinates, ellipsoid, result) {
|
|
730
|
-
Check_default.defined("coordinates", coordinates);
|
|
731
|
-
if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
|
|
732
|
-
throw new DeveloperError_default(
|
|
733
|
-
"the number of coordinates must be a multiple of 2 and at least 2"
|
|
734
|
-
);
|
|
735
|
-
}
|
|
736
|
-
const length = coordinates.length;
|
|
737
|
-
if (!defined_default(result)) {
|
|
738
|
-
result = new Array(length / 2);
|
|
739
|
-
} else {
|
|
740
|
-
result.length = length / 2;
|
|
741
|
-
}
|
|
742
|
-
for (let i = 0; i < length; i += 2) {
|
|
743
|
-
const longitude = coordinates[i];
|
|
744
|
-
const latitude = coordinates[i + 1];
|
|
745
|
-
const index = i / 2;
|
|
746
|
-
result[index] = _Cartesian3.fromDegrees(
|
|
747
|
-
longitude,
|
|
748
|
-
latitude,
|
|
749
|
-
0,
|
|
750
|
-
ellipsoid,
|
|
751
|
-
result[index]
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
return result;
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians.
|
|
758
|
-
*
|
|
759
|
-
* @param {number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
|
|
760
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the coordinates lie.
|
|
761
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
|
762
|
-
* @returns {Cartesian3[]} The array of positions.
|
|
763
|
-
*
|
|
764
|
-
* @example
|
|
765
|
-
* const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);
|
|
766
|
-
*/
|
|
767
|
-
static fromRadiansArray(coordinates, ellipsoid, result) {
|
|
768
|
-
Check_default.defined("coordinates", coordinates);
|
|
769
|
-
if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
|
|
770
|
-
throw new DeveloperError_default(
|
|
771
|
-
"the number of coordinates must be a multiple of 2 and at least 2"
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
const length = coordinates.length;
|
|
775
|
-
if (!defined_default(result)) {
|
|
776
|
-
result = new Array(length / 2);
|
|
777
|
-
} else {
|
|
778
|
-
result.length = length / 2;
|
|
779
|
-
}
|
|
780
|
-
for (let i = 0; i < length; i += 2) {
|
|
781
|
-
const longitude = coordinates[i];
|
|
782
|
-
const latitude = coordinates[i + 1];
|
|
783
|
-
const index = i / 2;
|
|
784
|
-
result[index] = _Cartesian3.fromRadians(
|
|
785
|
-
longitude,
|
|
786
|
-
latitude,
|
|
787
|
-
0,
|
|
788
|
-
ellipsoid,
|
|
789
|
-
result[index]
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
return result;
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees.
|
|
796
|
-
*
|
|
797
|
-
* @param {number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
|
|
798
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the position lies.
|
|
799
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
|
800
|
-
* @returns {Cartesian3[]} The array of positions.
|
|
801
|
-
*
|
|
802
|
-
* @example
|
|
803
|
-
* const positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]);
|
|
804
|
-
*/
|
|
805
|
-
static fromDegreesArrayHeights(coordinates, ellipsoid, result) {
|
|
806
|
-
Check_default.defined("coordinates", coordinates);
|
|
807
|
-
if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
|
|
808
|
-
throw new DeveloperError_default(
|
|
809
|
-
"the number of coordinates must be a multiple of 3 and at least 3"
|
|
810
|
-
);
|
|
811
|
-
}
|
|
812
|
-
const length = coordinates.length;
|
|
813
|
-
if (!defined_default(result)) {
|
|
814
|
-
result = new Array(length / 3);
|
|
815
|
-
} else {
|
|
816
|
-
result.length = length / 3;
|
|
817
|
-
}
|
|
818
|
-
for (let i = 0; i < length; i += 3) {
|
|
819
|
-
const longitude = coordinates[i];
|
|
820
|
-
const latitude = coordinates[i + 1];
|
|
821
|
-
const height = coordinates[i + 2];
|
|
822
|
-
const index = i / 3;
|
|
823
|
-
result[index] = _Cartesian3.fromDegrees(
|
|
824
|
-
longitude,
|
|
825
|
-
latitude,
|
|
826
|
-
height,
|
|
827
|
-
ellipsoid,
|
|
828
|
-
result[index]
|
|
829
|
-
);
|
|
830
|
-
}
|
|
831
|
-
return result;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians.
|
|
835
|
-
*
|
|
836
|
-
* @param {number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
|
|
837
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid on which the position lies.
|
|
838
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
|
839
|
-
* @returns {Cartesian3[]} The array of positions.
|
|
840
|
-
*
|
|
841
|
-
* @example
|
|
842
|
-
* const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);
|
|
843
|
-
*/
|
|
844
|
-
static fromRadiansArrayHeights(coordinates, ellipsoid, result) {
|
|
845
|
-
Check_default.defined("coordinates", coordinates);
|
|
846
|
-
if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
|
|
847
|
-
throw new DeveloperError_default(
|
|
848
|
-
"the number of coordinates must be a multiple of 3 and at least 3"
|
|
849
|
-
);
|
|
850
|
-
}
|
|
851
|
-
const length = coordinates.length;
|
|
852
|
-
if (!defined_default(result)) {
|
|
853
|
-
result = new Array(length / 3);
|
|
854
|
-
} else {
|
|
855
|
-
result.length = length / 3;
|
|
856
|
-
}
|
|
857
|
-
for (let i = 0; i < length; i += 3) {
|
|
858
|
-
const longitude = coordinates[i];
|
|
859
|
-
const latitude = coordinates[i + 1];
|
|
860
|
-
const height = coordinates[i + 2];
|
|
861
|
-
const index = i / 3;
|
|
862
|
-
result[index] = _Cartesian3.fromRadians(
|
|
863
|
-
longitude,
|
|
864
|
-
latitude,
|
|
865
|
-
height,
|
|
866
|
-
ellipsoid,
|
|
867
|
-
result[index]
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
return result;
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Duplicates this Cartesian3 instance.
|
|
874
|
-
*
|
|
875
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
|
876
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
|
877
|
-
*/
|
|
878
|
-
clone(result) {
|
|
879
|
-
return _Cartesian3.clone(this, result);
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
|
883
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
884
|
-
*
|
|
885
|
-
* @param {Cartesian3} [right] The right hand side Cartesian.
|
|
886
|
-
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
887
|
-
*/
|
|
888
|
-
equals(right) {
|
|
889
|
-
return _Cartesian3.equals(this, right);
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
|
893
|
-
* <code>true</code> if they pass an absolute or relative tolerance test,
|
|
894
|
-
* <code>false</code> otherwise.
|
|
895
|
-
*
|
|
896
|
-
* @param {Cartesian3} [right] The right hand side Cartesian.
|
|
897
|
-
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
|
898
|
-
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
|
899
|
-
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
|
900
|
-
*/
|
|
901
|
-
equalsEpsilon(right, relativeEpsilon, absoluteEpsilon) {
|
|
902
|
-
return _Cartesian3.equalsEpsilon(
|
|
903
|
-
this,
|
|
904
|
-
right,
|
|
905
|
-
relativeEpsilon,
|
|
906
|
-
absoluteEpsilon
|
|
907
|
-
);
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Creates a string representing this Cartesian in the format '(x, y, z)'.
|
|
911
|
-
*
|
|
912
|
-
* @returns {string} A string representing this Cartesian in the format '(x, y, z)'.
|
|
913
|
-
*/
|
|
914
|
-
toString() {
|
|
915
|
-
return `(${this.x}, ${this.y}, ${this.z})`;
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
Cartesian3.fromCartesian4 = Cartesian3.clone;
|
|
919
|
-
Cartesian3.packedLength = 3;
|
|
920
|
-
Cartesian3.fromArray = Cartesian3.unpack;
|
|
921
|
-
var distanceScratch = new Cartesian3();
|
|
922
|
-
var lerpScratch = new Cartesian3();
|
|
923
|
-
var angleBetweenScratch = new Cartesian3();
|
|
924
|
-
var angleBetweenScratch2 = new Cartesian3();
|
|
925
|
-
var mostOrthogonalAxisScratch = new Cartesian3();
|
|
926
|
-
var scratchN = new Cartesian3();
|
|
927
|
-
var scratchK = new Cartesian3();
|
|
928
|
-
Cartesian3._ellipsoidRadiiSquared = new Cartesian3(
|
|
929
|
-
6378137 * 6378137,
|
|
930
|
-
6378137 * 6378137,
|
|
931
|
-
6356752314245179e-9 * 6356752314245179e-9
|
|
932
|
-
);
|
|
933
|
-
Cartesian3.ZERO = Object.freeze(new Cartesian3(0, 0, 0));
|
|
934
|
-
Cartesian3.ONE = Object.freeze(new Cartesian3(1, 1, 1));
|
|
935
|
-
Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1, 0, 0));
|
|
936
|
-
Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0, 1, 0));
|
|
937
|
-
Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0, 0, 1));
|
|
938
|
-
var Cartesian3_default = Cartesian3;
|
|
939
|
-
|
|
940
|
-
// packages/engine/Source/Core/Matrix3.js
|
|
941
|
-
function Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2) {
|
|
942
|
-
this[0] = column0Row0 ?? 0;
|
|
943
|
-
this[1] = column0Row1 ?? 0;
|
|
944
|
-
this[2] = column0Row2 ?? 0;
|
|
945
|
-
this[3] = column1Row0 ?? 0;
|
|
946
|
-
this[4] = column1Row1 ?? 0;
|
|
947
|
-
this[5] = column1Row2 ?? 0;
|
|
948
|
-
this[6] = column2Row0 ?? 0;
|
|
949
|
-
this[7] = column2Row1 ?? 0;
|
|
950
|
-
this[8] = column2Row2 ?? 0;
|
|
951
|
-
}
|
|
952
|
-
Matrix3.packedLength = 9;
|
|
953
|
-
Matrix3.pack = function(value, array, startingIndex) {
|
|
954
|
-
Check_default.typeOf.object("value", value);
|
|
955
|
-
Check_default.defined("array", array);
|
|
956
|
-
startingIndex = startingIndex ?? 0;
|
|
957
|
-
array[startingIndex++] = value[0];
|
|
958
|
-
array[startingIndex++] = value[1];
|
|
959
|
-
array[startingIndex++] = value[2];
|
|
960
|
-
array[startingIndex++] = value[3];
|
|
961
|
-
array[startingIndex++] = value[4];
|
|
962
|
-
array[startingIndex++] = value[5];
|
|
963
|
-
array[startingIndex++] = value[6];
|
|
964
|
-
array[startingIndex++] = value[7];
|
|
965
|
-
array[startingIndex++] = value[8];
|
|
966
|
-
return array;
|
|
967
|
-
};
|
|
968
|
-
Matrix3.unpack = function(array, startingIndex, result) {
|
|
969
|
-
Check_default.defined("array", array);
|
|
970
|
-
startingIndex = startingIndex ?? 0;
|
|
971
|
-
if (!defined_default(result)) {
|
|
972
|
-
result = new Matrix3();
|
|
973
|
-
}
|
|
974
|
-
result[0] = array[startingIndex++];
|
|
975
|
-
result[1] = array[startingIndex++];
|
|
976
|
-
result[2] = array[startingIndex++];
|
|
977
|
-
result[3] = array[startingIndex++];
|
|
978
|
-
result[4] = array[startingIndex++];
|
|
979
|
-
result[5] = array[startingIndex++];
|
|
980
|
-
result[6] = array[startingIndex++];
|
|
981
|
-
result[7] = array[startingIndex++];
|
|
982
|
-
result[8] = array[startingIndex++];
|
|
983
|
-
return result;
|
|
984
|
-
};
|
|
985
|
-
Matrix3.packArray = function(array, result) {
|
|
986
|
-
Check_default.defined("array", array);
|
|
987
|
-
const length = array.length;
|
|
988
|
-
const resultLength = length * 9;
|
|
989
|
-
if (!defined_default(result)) {
|
|
990
|
-
result = new Array(resultLength);
|
|
991
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
992
|
-
throw new DeveloperError_default(
|
|
993
|
-
"If result is a typed array, it must have exactly array.length * 9 elements"
|
|
994
|
-
);
|
|
995
|
-
} else if (result.length !== resultLength) {
|
|
996
|
-
result.length = resultLength;
|
|
997
|
-
}
|
|
998
|
-
for (let i = 0; i < length; ++i) {
|
|
999
|
-
Matrix3.pack(array[i], result, i * 9);
|
|
1000
|
-
}
|
|
1001
|
-
return result;
|
|
1002
|
-
};
|
|
1003
|
-
Matrix3.unpackArray = function(array, result) {
|
|
1004
|
-
Check_default.defined("array", array);
|
|
1005
|
-
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 9);
|
|
1006
|
-
if (array.length % 9 !== 0) {
|
|
1007
|
-
throw new DeveloperError_default("array length must be a multiple of 9.");
|
|
1008
|
-
}
|
|
1009
|
-
const length = array.length;
|
|
1010
|
-
if (!defined_default(result)) {
|
|
1011
|
-
result = new Array(length / 9);
|
|
1012
|
-
} else {
|
|
1013
|
-
result.length = length / 9;
|
|
1014
|
-
}
|
|
1015
|
-
for (let i = 0; i < length; i += 9) {
|
|
1016
|
-
const index = i / 9;
|
|
1017
|
-
result[index] = Matrix3.unpack(array, i, result[index]);
|
|
1018
|
-
}
|
|
1019
|
-
return result;
|
|
1020
|
-
};
|
|
1021
|
-
Matrix3.clone = function(matrix, result) {
|
|
1022
|
-
if (!defined_default(matrix)) {
|
|
1023
|
-
return void 0;
|
|
1024
|
-
}
|
|
1025
|
-
if (!defined_default(result)) {
|
|
1026
|
-
return new Matrix3(
|
|
1027
|
-
matrix[0],
|
|
1028
|
-
matrix[3],
|
|
1029
|
-
matrix[6],
|
|
1030
|
-
matrix[1],
|
|
1031
|
-
matrix[4],
|
|
1032
|
-
matrix[7],
|
|
1033
|
-
matrix[2],
|
|
1034
|
-
matrix[5],
|
|
1035
|
-
matrix[8]
|
|
1036
|
-
);
|
|
1037
|
-
}
|
|
1038
|
-
result[0] = matrix[0];
|
|
1039
|
-
result[1] = matrix[1];
|
|
1040
|
-
result[2] = matrix[2];
|
|
1041
|
-
result[3] = matrix[3];
|
|
1042
|
-
result[4] = matrix[4];
|
|
1043
|
-
result[5] = matrix[5];
|
|
1044
|
-
result[6] = matrix[6];
|
|
1045
|
-
result[7] = matrix[7];
|
|
1046
|
-
result[8] = matrix[8];
|
|
1047
|
-
return result;
|
|
1048
|
-
};
|
|
1049
|
-
Matrix3.fromArray = Matrix3.unpack;
|
|
1050
|
-
Matrix3.fromColumnMajorArray = function(values, result) {
|
|
1051
|
-
Check_default.defined("values", values);
|
|
1052
|
-
return Matrix3.clone(values, result);
|
|
1053
|
-
};
|
|
1054
|
-
Matrix3.fromRowMajorArray = function(values, result) {
|
|
1055
|
-
Check_default.defined("values", values);
|
|
1056
|
-
if (!defined_default(result)) {
|
|
1057
|
-
return new Matrix3(
|
|
1058
|
-
values[0],
|
|
1059
|
-
values[1],
|
|
1060
|
-
values[2],
|
|
1061
|
-
values[3],
|
|
1062
|
-
values[4],
|
|
1063
|
-
values[5],
|
|
1064
|
-
values[6],
|
|
1065
|
-
values[7],
|
|
1066
|
-
values[8]
|
|
1067
|
-
);
|
|
1068
|
-
}
|
|
1069
|
-
result[0] = values[0];
|
|
1070
|
-
result[1] = values[3];
|
|
1071
|
-
result[2] = values[6];
|
|
1072
|
-
result[3] = values[1];
|
|
1073
|
-
result[4] = values[4];
|
|
1074
|
-
result[5] = values[7];
|
|
1075
|
-
result[6] = values[2];
|
|
1076
|
-
result[7] = values[5];
|
|
1077
|
-
result[8] = values[8];
|
|
1078
|
-
return result;
|
|
1079
|
-
};
|
|
1080
|
-
Matrix3.fromQuaternion = function(quaternion, result) {
|
|
1081
|
-
Check_default.typeOf.object("quaternion", quaternion);
|
|
1082
|
-
const x2 = quaternion.x * quaternion.x;
|
|
1083
|
-
const xy = quaternion.x * quaternion.y;
|
|
1084
|
-
const xz = quaternion.x * quaternion.z;
|
|
1085
|
-
const xw = quaternion.x * quaternion.w;
|
|
1086
|
-
const y2 = quaternion.y * quaternion.y;
|
|
1087
|
-
const yz = quaternion.y * quaternion.z;
|
|
1088
|
-
const yw = quaternion.y * quaternion.w;
|
|
1089
|
-
const z2 = quaternion.z * quaternion.z;
|
|
1090
|
-
const zw = quaternion.z * quaternion.w;
|
|
1091
|
-
const w2 = quaternion.w * quaternion.w;
|
|
1092
|
-
const m00 = x2 - y2 - z2 + w2;
|
|
1093
|
-
const m01 = 2 * (xy - zw);
|
|
1094
|
-
const m02 = 2 * (xz + yw);
|
|
1095
|
-
const m10 = 2 * (xy + zw);
|
|
1096
|
-
const m11 = -x2 + y2 - z2 + w2;
|
|
1097
|
-
const m12 = 2 * (yz - xw);
|
|
1098
|
-
const m20 = 2 * (xz - yw);
|
|
1099
|
-
const m21 = 2 * (yz + xw);
|
|
1100
|
-
const m22 = -x2 - y2 + z2 + w2;
|
|
1101
|
-
if (!defined_default(result)) {
|
|
1102
|
-
return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
|
|
1103
|
-
}
|
|
1104
|
-
result[0] = m00;
|
|
1105
|
-
result[1] = m10;
|
|
1106
|
-
result[2] = m20;
|
|
1107
|
-
result[3] = m01;
|
|
1108
|
-
result[4] = m11;
|
|
1109
|
-
result[5] = m21;
|
|
1110
|
-
result[6] = m02;
|
|
1111
|
-
result[7] = m12;
|
|
1112
|
-
result[8] = m22;
|
|
1113
|
-
return result;
|
|
1114
|
-
};
|
|
1115
|
-
Matrix3.fromHeadingPitchRoll = function(headingPitchRoll, result) {
|
|
1116
|
-
Check_default.typeOf.object("headingPitchRoll", headingPitchRoll);
|
|
1117
|
-
const cosTheta = Math.cos(-headingPitchRoll.pitch);
|
|
1118
|
-
const cosPsi = Math.cos(-headingPitchRoll.heading);
|
|
1119
|
-
const cosPhi = Math.cos(headingPitchRoll.roll);
|
|
1120
|
-
const sinTheta = Math.sin(-headingPitchRoll.pitch);
|
|
1121
|
-
const sinPsi = Math.sin(-headingPitchRoll.heading);
|
|
1122
|
-
const sinPhi = Math.sin(headingPitchRoll.roll);
|
|
1123
|
-
const m00 = cosTheta * cosPsi;
|
|
1124
|
-
const m01 = -cosPhi * sinPsi + sinPhi * sinTheta * cosPsi;
|
|
1125
|
-
const m02 = sinPhi * sinPsi + cosPhi * sinTheta * cosPsi;
|
|
1126
|
-
const m10 = cosTheta * sinPsi;
|
|
1127
|
-
const m11 = cosPhi * cosPsi + sinPhi * sinTheta * sinPsi;
|
|
1128
|
-
const m12 = -sinPhi * cosPsi + cosPhi * sinTheta * sinPsi;
|
|
1129
|
-
const m20 = -sinTheta;
|
|
1130
|
-
const m21 = sinPhi * cosTheta;
|
|
1131
|
-
const m22 = cosPhi * cosTheta;
|
|
1132
|
-
if (!defined_default(result)) {
|
|
1133
|
-
return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
|
|
1134
|
-
}
|
|
1135
|
-
result[0] = m00;
|
|
1136
|
-
result[1] = m10;
|
|
1137
|
-
result[2] = m20;
|
|
1138
|
-
result[3] = m01;
|
|
1139
|
-
result[4] = m11;
|
|
1140
|
-
result[5] = m21;
|
|
1141
|
-
result[6] = m02;
|
|
1142
|
-
result[7] = m12;
|
|
1143
|
-
result[8] = m22;
|
|
1144
|
-
return result;
|
|
1145
|
-
};
|
|
1146
|
-
Matrix3.fromScale = function(scale, result) {
|
|
1147
|
-
Check_default.typeOf.object("scale", scale);
|
|
1148
|
-
if (!defined_default(result)) {
|
|
1149
|
-
return new Matrix3(scale.x, 0, 0, 0, scale.y, 0, 0, 0, scale.z);
|
|
1150
|
-
}
|
|
1151
|
-
result[0] = scale.x;
|
|
1152
|
-
result[1] = 0;
|
|
1153
|
-
result[2] = 0;
|
|
1154
|
-
result[3] = 0;
|
|
1155
|
-
result[4] = scale.y;
|
|
1156
|
-
result[5] = 0;
|
|
1157
|
-
result[6] = 0;
|
|
1158
|
-
result[7] = 0;
|
|
1159
|
-
result[8] = scale.z;
|
|
1160
|
-
return result;
|
|
1161
|
-
};
|
|
1162
|
-
Matrix3.fromUniformScale = function(scale, result) {
|
|
1163
|
-
Check_default.typeOf.number("scale", scale);
|
|
1164
|
-
if (!defined_default(result)) {
|
|
1165
|
-
return new Matrix3(scale, 0, 0, 0, scale, 0, 0, 0, scale);
|
|
1166
|
-
}
|
|
1167
|
-
result[0] = scale;
|
|
1168
|
-
result[1] = 0;
|
|
1169
|
-
result[2] = 0;
|
|
1170
|
-
result[3] = 0;
|
|
1171
|
-
result[4] = scale;
|
|
1172
|
-
result[5] = 0;
|
|
1173
|
-
result[6] = 0;
|
|
1174
|
-
result[7] = 0;
|
|
1175
|
-
result[8] = scale;
|
|
1176
|
-
return result;
|
|
1177
|
-
};
|
|
1178
|
-
Matrix3.fromCrossProduct = function(vector, result) {
|
|
1179
|
-
Check_default.typeOf.object("vector", vector);
|
|
1180
|
-
if (!defined_default(result)) {
|
|
1181
|
-
return new Matrix3(
|
|
1182
|
-
0,
|
|
1183
|
-
-vector.z,
|
|
1184
|
-
vector.y,
|
|
1185
|
-
vector.z,
|
|
1186
|
-
0,
|
|
1187
|
-
-vector.x,
|
|
1188
|
-
-vector.y,
|
|
1189
|
-
vector.x,
|
|
1190
|
-
0
|
|
1191
|
-
);
|
|
1192
|
-
}
|
|
1193
|
-
result[0] = 0;
|
|
1194
|
-
result[1] = vector.z;
|
|
1195
|
-
result[2] = -vector.y;
|
|
1196
|
-
result[3] = -vector.z;
|
|
1197
|
-
result[4] = 0;
|
|
1198
|
-
result[5] = vector.x;
|
|
1199
|
-
result[6] = vector.y;
|
|
1200
|
-
result[7] = -vector.x;
|
|
1201
|
-
result[8] = 0;
|
|
1202
|
-
return result;
|
|
1203
|
-
};
|
|
1204
|
-
Matrix3.fromRotationX = function(angle, result) {
|
|
1205
|
-
Check_default.typeOf.number("angle", angle);
|
|
1206
|
-
const cosAngle = Math.cos(angle);
|
|
1207
|
-
const sinAngle = Math.sin(angle);
|
|
1208
|
-
if (!defined_default(result)) {
|
|
1209
|
-
return new Matrix3(
|
|
1210
|
-
1,
|
|
1211
|
-
0,
|
|
1212
|
-
0,
|
|
1213
|
-
0,
|
|
1214
|
-
cosAngle,
|
|
1215
|
-
-sinAngle,
|
|
1216
|
-
0,
|
|
1217
|
-
sinAngle,
|
|
1218
|
-
cosAngle
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
result[0] = 1;
|
|
1222
|
-
result[1] = 0;
|
|
1223
|
-
result[2] = 0;
|
|
1224
|
-
result[3] = 0;
|
|
1225
|
-
result[4] = cosAngle;
|
|
1226
|
-
result[5] = sinAngle;
|
|
1227
|
-
result[6] = 0;
|
|
1228
|
-
result[7] = -sinAngle;
|
|
1229
|
-
result[8] = cosAngle;
|
|
1230
|
-
return result;
|
|
1231
|
-
};
|
|
1232
|
-
Matrix3.fromRotationY = function(angle, result) {
|
|
1233
|
-
Check_default.typeOf.number("angle", angle);
|
|
1234
|
-
const cosAngle = Math.cos(angle);
|
|
1235
|
-
const sinAngle = Math.sin(angle);
|
|
1236
|
-
if (!defined_default(result)) {
|
|
1237
|
-
return new Matrix3(
|
|
1238
|
-
cosAngle,
|
|
1239
|
-
0,
|
|
1240
|
-
sinAngle,
|
|
1241
|
-
0,
|
|
1242
|
-
1,
|
|
1243
|
-
0,
|
|
1244
|
-
-sinAngle,
|
|
1245
|
-
0,
|
|
1246
|
-
cosAngle
|
|
1247
|
-
);
|
|
1248
|
-
}
|
|
1249
|
-
result[0] = cosAngle;
|
|
1250
|
-
result[1] = 0;
|
|
1251
|
-
result[2] = -sinAngle;
|
|
1252
|
-
result[3] = 0;
|
|
1253
|
-
result[4] = 1;
|
|
1254
|
-
result[5] = 0;
|
|
1255
|
-
result[6] = sinAngle;
|
|
1256
|
-
result[7] = 0;
|
|
1257
|
-
result[8] = cosAngle;
|
|
1258
|
-
return result;
|
|
1259
|
-
};
|
|
1260
|
-
Matrix3.fromRotationZ = function(angle, result) {
|
|
1261
|
-
Check_default.typeOf.number("angle", angle);
|
|
1262
|
-
const cosAngle = Math.cos(angle);
|
|
1263
|
-
const sinAngle = Math.sin(angle);
|
|
1264
|
-
if (!defined_default(result)) {
|
|
1265
|
-
return new Matrix3(
|
|
1266
|
-
cosAngle,
|
|
1267
|
-
-sinAngle,
|
|
1268
|
-
0,
|
|
1269
|
-
sinAngle,
|
|
1270
|
-
cosAngle,
|
|
1271
|
-
0,
|
|
1272
|
-
0,
|
|
1273
|
-
0,
|
|
1274
|
-
1
|
|
1275
|
-
);
|
|
1276
|
-
}
|
|
1277
|
-
result[0] = cosAngle;
|
|
1278
|
-
result[1] = sinAngle;
|
|
1279
|
-
result[2] = 0;
|
|
1280
|
-
result[3] = -sinAngle;
|
|
1281
|
-
result[4] = cosAngle;
|
|
1282
|
-
result[5] = 0;
|
|
1283
|
-
result[6] = 0;
|
|
1284
|
-
result[7] = 0;
|
|
1285
|
-
result[8] = 1;
|
|
1286
|
-
return result;
|
|
1287
|
-
};
|
|
1288
|
-
Matrix3.toArray = function(matrix, result) {
|
|
1289
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1290
|
-
if (!defined_default(result)) {
|
|
1291
|
-
return [
|
|
1292
|
-
matrix[0],
|
|
1293
|
-
matrix[1],
|
|
1294
|
-
matrix[2],
|
|
1295
|
-
matrix[3],
|
|
1296
|
-
matrix[4],
|
|
1297
|
-
matrix[5],
|
|
1298
|
-
matrix[6],
|
|
1299
|
-
matrix[7],
|
|
1300
|
-
matrix[8]
|
|
1301
|
-
];
|
|
1302
|
-
}
|
|
1303
|
-
result[0] = matrix[0];
|
|
1304
|
-
result[1] = matrix[1];
|
|
1305
|
-
result[2] = matrix[2];
|
|
1306
|
-
result[3] = matrix[3];
|
|
1307
|
-
result[4] = matrix[4];
|
|
1308
|
-
result[5] = matrix[5];
|
|
1309
|
-
result[6] = matrix[6];
|
|
1310
|
-
result[7] = matrix[7];
|
|
1311
|
-
result[8] = matrix[8];
|
|
1312
|
-
return result;
|
|
1313
|
-
};
|
|
1314
|
-
Matrix3.getElementIndex = function(column, row) {
|
|
1315
|
-
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
1316
|
-
Check_default.typeOf.number.lessThanOrEquals("row", row, 2);
|
|
1317
|
-
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
|
1318
|
-
Check_default.typeOf.number.lessThanOrEquals("column", column, 2);
|
|
1319
|
-
return column * 3 + row;
|
|
1320
|
-
};
|
|
1321
|
-
Matrix3.getColumn = function(matrix, index, result) {
|
|
1322
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1323
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
1324
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
|
|
1325
|
-
Check_default.typeOf.object("result", result);
|
|
1326
|
-
const startIndex = index * 3;
|
|
1327
|
-
const x = matrix[startIndex];
|
|
1328
|
-
const y = matrix[startIndex + 1];
|
|
1329
|
-
const z = matrix[startIndex + 2];
|
|
1330
|
-
result.x = x;
|
|
1331
|
-
result.y = y;
|
|
1332
|
-
result.z = z;
|
|
1333
|
-
return result;
|
|
1334
|
-
};
|
|
1335
|
-
Matrix3.setColumn = function(matrix, index, cartesian, result) {
|
|
1336
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1337
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
1338
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
|
|
1339
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
1340
|
-
Check_default.typeOf.object("result", result);
|
|
1341
|
-
result = Matrix3.clone(matrix, result);
|
|
1342
|
-
const startIndex = index * 3;
|
|
1343
|
-
result[startIndex] = cartesian.x;
|
|
1344
|
-
result[startIndex + 1] = cartesian.y;
|
|
1345
|
-
result[startIndex + 2] = cartesian.z;
|
|
1346
|
-
return result;
|
|
1347
|
-
};
|
|
1348
|
-
Matrix3.getRow = function(matrix, index, result) {
|
|
1349
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1350
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
1351
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
|
|
1352
|
-
Check_default.typeOf.object("result", result);
|
|
1353
|
-
const x = matrix[index];
|
|
1354
|
-
const y = matrix[index + 3];
|
|
1355
|
-
const z = matrix[index + 6];
|
|
1356
|
-
result.x = x;
|
|
1357
|
-
result.y = y;
|
|
1358
|
-
result.z = z;
|
|
1359
|
-
return result;
|
|
1360
|
-
};
|
|
1361
|
-
Matrix3.setRow = function(matrix, index, cartesian, result) {
|
|
1362
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1363
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
1364
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 2);
|
|
1365
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
1366
|
-
Check_default.typeOf.object("result", result);
|
|
1367
|
-
result = Matrix3.clone(matrix, result);
|
|
1368
|
-
result[index] = cartesian.x;
|
|
1369
|
-
result[index + 3] = cartesian.y;
|
|
1370
|
-
result[index + 6] = cartesian.z;
|
|
1371
|
-
return result;
|
|
1372
|
-
};
|
|
1373
|
-
var scaleScratch1 = new Cartesian3_default();
|
|
1374
|
-
Matrix3.setScale = function(matrix, scale, result) {
|
|
1375
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1376
|
-
Check_default.typeOf.object("scale", scale);
|
|
1377
|
-
Check_default.typeOf.object("result", result);
|
|
1378
|
-
const existingScale = Matrix3.getScale(matrix, scaleScratch1);
|
|
1379
|
-
const scaleRatioX = scale.x / existingScale.x;
|
|
1380
|
-
const scaleRatioY = scale.y / existingScale.y;
|
|
1381
|
-
const scaleRatioZ = scale.z / existingScale.z;
|
|
1382
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
1383
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
1384
|
-
result[2] = matrix[2] * scaleRatioX;
|
|
1385
|
-
result[3] = matrix[3] * scaleRatioY;
|
|
1386
|
-
result[4] = matrix[4] * scaleRatioY;
|
|
1387
|
-
result[5] = matrix[5] * scaleRatioY;
|
|
1388
|
-
result[6] = matrix[6] * scaleRatioZ;
|
|
1389
|
-
result[7] = matrix[7] * scaleRatioZ;
|
|
1390
|
-
result[8] = matrix[8] * scaleRatioZ;
|
|
1391
|
-
return result;
|
|
1392
|
-
};
|
|
1393
|
-
var scaleScratch2 = new Cartesian3_default();
|
|
1394
|
-
Matrix3.setUniformScale = function(matrix, scale, result) {
|
|
1395
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1396
|
-
Check_default.typeOf.number("scale", scale);
|
|
1397
|
-
Check_default.typeOf.object("result", result);
|
|
1398
|
-
const existingScale = Matrix3.getScale(matrix, scaleScratch2);
|
|
1399
|
-
const scaleRatioX = scale / existingScale.x;
|
|
1400
|
-
const scaleRatioY = scale / existingScale.y;
|
|
1401
|
-
const scaleRatioZ = scale / existingScale.z;
|
|
1402
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
1403
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
1404
|
-
result[2] = matrix[2] * scaleRatioX;
|
|
1405
|
-
result[3] = matrix[3] * scaleRatioY;
|
|
1406
|
-
result[4] = matrix[4] * scaleRatioY;
|
|
1407
|
-
result[5] = matrix[5] * scaleRatioY;
|
|
1408
|
-
result[6] = matrix[6] * scaleRatioZ;
|
|
1409
|
-
result[7] = matrix[7] * scaleRatioZ;
|
|
1410
|
-
result[8] = matrix[8] * scaleRatioZ;
|
|
1411
|
-
return result;
|
|
1412
|
-
};
|
|
1413
|
-
var scratchColumn = new Cartesian3_default();
|
|
1414
|
-
Matrix3.getScale = function(matrix, result) {
|
|
1415
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1416
|
-
Check_default.typeOf.object("result", result);
|
|
1417
|
-
result.x = Cartesian3_default.magnitude(
|
|
1418
|
-
Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
|
|
1419
|
-
);
|
|
1420
|
-
result.y = Cartesian3_default.magnitude(
|
|
1421
|
-
Cartesian3_default.fromElements(matrix[3], matrix[4], matrix[5], scratchColumn)
|
|
1422
|
-
);
|
|
1423
|
-
result.z = Cartesian3_default.magnitude(
|
|
1424
|
-
Cartesian3_default.fromElements(matrix[6], matrix[7], matrix[8], scratchColumn)
|
|
1425
|
-
);
|
|
1426
|
-
return result;
|
|
1427
|
-
};
|
|
1428
|
-
var scaleScratch3 = new Cartesian3_default();
|
|
1429
|
-
Matrix3.getMaximumScale = function(matrix) {
|
|
1430
|
-
Matrix3.getScale(matrix, scaleScratch3);
|
|
1431
|
-
return Cartesian3_default.maximumComponent(scaleScratch3);
|
|
1432
|
-
};
|
|
1433
|
-
var scaleScratch4 = new Cartesian3_default();
|
|
1434
|
-
Matrix3.setRotation = function(matrix, rotation, result) {
|
|
1435
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1436
|
-
Check_default.typeOf.object("result", result);
|
|
1437
|
-
const scale = Matrix3.getScale(matrix, scaleScratch4);
|
|
1438
|
-
result[0] = rotation[0] * scale.x;
|
|
1439
|
-
result[1] = rotation[1] * scale.x;
|
|
1440
|
-
result[2] = rotation[2] * scale.x;
|
|
1441
|
-
result[3] = rotation[3] * scale.y;
|
|
1442
|
-
result[4] = rotation[4] * scale.y;
|
|
1443
|
-
result[5] = rotation[5] * scale.y;
|
|
1444
|
-
result[6] = rotation[6] * scale.z;
|
|
1445
|
-
result[7] = rotation[7] * scale.z;
|
|
1446
|
-
result[8] = rotation[8] * scale.z;
|
|
1447
|
-
return result;
|
|
1448
|
-
};
|
|
1449
|
-
var scaleScratch5 = new Cartesian3_default();
|
|
1450
|
-
Matrix3.getRotation = function(matrix, result) {
|
|
1451
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1452
|
-
Check_default.typeOf.object("result", result);
|
|
1453
|
-
const scale = Matrix3.getScale(matrix, scaleScratch5);
|
|
1454
|
-
result[0] = matrix[0] / scale.x;
|
|
1455
|
-
result[1] = matrix[1] / scale.x;
|
|
1456
|
-
result[2] = matrix[2] / scale.x;
|
|
1457
|
-
result[3] = matrix[3] / scale.y;
|
|
1458
|
-
result[4] = matrix[4] / scale.y;
|
|
1459
|
-
result[5] = matrix[5] / scale.y;
|
|
1460
|
-
result[6] = matrix[6] / scale.z;
|
|
1461
|
-
result[7] = matrix[7] / scale.z;
|
|
1462
|
-
result[8] = matrix[8] / scale.z;
|
|
1463
|
-
return result;
|
|
1464
|
-
};
|
|
1465
|
-
Matrix3.multiply = function(left, right, result) {
|
|
1466
|
-
Check_default.typeOf.object("left", left);
|
|
1467
|
-
Check_default.typeOf.object("right", right);
|
|
1468
|
-
Check_default.typeOf.object("result", result);
|
|
1469
|
-
const column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2];
|
|
1470
|
-
const column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2];
|
|
1471
|
-
const column0Row2 = left[2] * right[0] + left[5] * right[1] + left[8] * right[2];
|
|
1472
|
-
const column1Row0 = left[0] * right[3] + left[3] * right[4] + left[6] * right[5];
|
|
1473
|
-
const column1Row1 = left[1] * right[3] + left[4] * right[4] + left[7] * right[5];
|
|
1474
|
-
const column1Row2 = left[2] * right[3] + left[5] * right[4] + left[8] * right[5];
|
|
1475
|
-
const column2Row0 = left[0] * right[6] + left[3] * right[7] + left[6] * right[8];
|
|
1476
|
-
const column2Row1 = left[1] * right[6] + left[4] * right[7] + left[7] * right[8];
|
|
1477
|
-
const column2Row2 = left[2] * right[6] + left[5] * right[7] + left[8] * right[8];
|
|
1478
|
-
result[0] = column0Row0;
|
|
1479
|
-
result[1] = column0Row1;
|
|
1480
|
-
result[2] = column0Row2;
|
|
1481
|
-
result[3] = column1Row0;
|
|
1482
|
-
result[4] = column1Row1;
|
|
1483
|
-
result[5] = column1Row2;
|
|
1484
|
-
result[6] = column2Row0;
|
|
1485
|
-
result[7] = column2Row1;
|
|
1486
|
-
result[8] = column2Row2;
|
|
1487
|
-
return result;
|
|
1488
|
-
};
|
|
1489
|
-
Matrix3.add = function(left, right, result) {
|
|
1490
|
-
Check_default.typeOf.object("left", left);
|
|
1491
|
-
Check_default.typeOf.object("right", right);
|
|
1492
|
-
Check_default.typeOf.object("result", result);
|
|
1493
|
-
result[0] = left[0] + right[0];
|
|
1494
|
-
result[1] = left[1] + right[1];
|
|
1495
|
-
result[2] = left[2] + right[2];
|
|
1496
|
-
result[3] = left[3] + right[3];
|
|
1497
|
-
result[4] = left[4] + right[4];
|
|
1498
|
-
result[5] = left[5] + right[5];
|
|
1499
|
-
result[6] = left[6] + right[6];
|
|
1500
|
-
result[7] = left[7] + right[7];
|
|
1501
|
-
result[8] = left[8] + right[8];
|
|
1502
|
-
return result;
|
|
1503
|
-
};
|
|
1504
|
-
Matrix3.subtract = function(left, right, result) {
|
|
1505
|
-
Check_default.typeOf.object("left", left);
|
|
1506
|
-
Check_default.typeOf.object("right", right);
|
|
1507
|
-
Check_default.typeOf.object("result", result);
|
|
1508
|
-
result[0] = left[0] - right[0];
|
|
1509
|
-
result[1] = left[1] - right[1];
|
|
1510
|
-
result[2] = left[2] - right[2];
|
|
1511
|
-
result[3] = left[3] - right[3];
|
|
1512
|
-
result[4] = left[4] - right[4];
|
|
1513
|
-
result[5] = left[5] - right[5];
|
|
1514
|
-
result[6] = left[6] - right[6];
|
|
1515
|
-
result[7] = left[7] - right[7];
|
|
1516
|
-
result[8] = left[8] - right[8];
|
|
1517
|
-
return result;
|
|
1518
|
-
};
|
|
1519
|
-
Matrix3.multiplyByVector = function(matrix, cartesian, result) {
|
|
1520
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1521
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
1522
|
-
Check_default.typeOf.object("result", result);
|
|
1523
|
-
const vX = cartesian.x;
|
|
1524
|
-
const vY = cartesian.y;
|
|
1525
|
-
const vZ = cartesian.z;
|
|
1526
|
-
const x = matrix[0] * vX + matrix[3] * vY + matrix[6] * vZ;
|
|
1527
|
-
const y = matrix[1] * vX + matrix[4] * vY + matrix[7] * vZ;
|
|
1528
|
-
const z = matrix[2] * vX + matrix[5] * vY + matrix[8] * vZ;
|
|
1529
|
-
result.x = x;
|
|
1530
|
-
result.y = y;
|
|
1531
|
-
result.z = z;
|
|
1532
|
-
return result;
|
|
1533
|
-
};
|
|
1534
|
-
Matrix3.multiplyByScalar = function(matrix, scalar, result) {
|
|
1535
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1536
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
1537
|
-
Check_default.typeOf.object("result", result);
|
|
1538
|
-
result[0] = matrix[0] * scalar;
|
|
1539
|
-
result[1] = matrix[1] * scalar;
|
|
1540
|
-
result[2] = matrix[2] * scalar;
|
|
1541
|
-
result[3] = matrix[3] * scalar;
|
|
1542
|
-
result[4] = matrix[4] * scalar;
|
|
1543
|
-
result[5] = matrix[5] * scalar;
|
|
1544
|
-
result[6] = matrix[6] * scalar;
|
|
1545
|
-
result[7] = matrix[7] * scalar;
|
|
1546
|
-
result[8] = matrix[8] * scalar;
|
|
1547
|
-
return result;
|
|
1548
|
-
};
|
|
1549
|
-
Matrix3.multiplyByScale = function(matrix, scale, result) {
|
|
1550
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1551
|
-
Check_default.typeOf.object("scale", scale);
|
|
1552
|
-
Check_default.typeOf.object("result", result);
|
|
1553
|
-
result[0] = matrix[0] * scale.x;
|
|
1554
|
-
result[1] = matrix[1] * scale.x;
|
|
1555
|
-
result[2] = matrix[2] * scale.x;
|
|
1556
|
-
result[3] = matrix[3] * scale.y;
|
|
1557
|
-
result[4] = matrix[4] * scale.y;
|
|
1558
|
-
result[5] = matrix[5] * scale.y;
|
|
1559
|
-
result[6] = matrix[6] * scale.z;
|
|
1560
|
-
result[7] = matrix[7] * scale.z;
|
|
1561
|
-
result[8] = matrix[8] * scale.z;
|
|
1562
|
-
return result;
|
|
1563
|
-
};
|
|
1564
|
-
Matrix3.multiplyByUniformScale = function(matrix, scale, result) {
|
|
1565
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1566
|
-
Check_default.typeOf.number("scale", scale);
|
|
1567
|
-
Check_default.typeOf.object("result", result);
|
|
1568
|
-
result[0] = matrix[0] * scale;
|
|
1569
|
-
result[1] = matrix[1] * scale;
|
|
1570
|
-
result[2] = matrix[2] * scale;
|
|
1571
|
-
result[3] = matrix[3] * scale;
|
|
1572
|
-
result[4] = matrix[4] * scale;
|
|
1573
|
-
result[5] = matrix[5] * scale;
|
|
1574
|
-
result[6] = matrix[6] * scale;
|
|
1575
|
-
result[7] = matrix[7] * scale;
|
|
1576
|
-
result[8] = matrix[8] * scale;
|
|
1577
|
-
return result;
|
|
1578
|
-
};
|
|
1579
|
-
Matrix3.negate = function(matrix, result) {
|
|
1580
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1581
|
-
Check_default.typeOf.object("result", result);
|
|
1582
|
-
result[0] = -matrix[0];
|
|
1583
|
-
result[1] = -matrix[1];
|
|
1584
|
-
result[2] = -matrix[2];
|
|
1585
|
-
result[3] = -matrix[3];
|
|
1586
|
-
result[4] = -matrix[4];
|
|
1587
|
-
result[5] = -matrix[5];
|
|
1588
|
-
result[6] = -matrix[6];
|
|
1589
|
-
result[7] = -matrix[7];
|
|
1590
|
-
result[8] = -matrix[8];
|
|
1591
|
-
return result;
|
|
1592
|
-
};
|
|
1593
|
-
Matrix3.transpose = function(matrix, result) {
|
|
1594
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1595
|
-
Check_default.typeOf.object("result", result);
|
|
1596
|
-
const column0Row0 = matrix[0];
|
|
1597
|
-
const column0Row1 = matrix[3];
|
|
1598
|
-
const column0Row2 = matrix[6];
|
|
1599
|
-
const column1Row0 = matrix[1];
|
|
1600
|
-
const column1Row1 = matrix[4];
|
|
1601
|
-
const column1Row2 = matrix[7];
|
|
1602
|
-
const column2Row0 = matrix[2];
|
|
1603
|
-
const column2Row1 = matrix[5];
|
|
1604
|
-
const column2Row2 = matrix[8];
|
|
1605
|
-
result[0] = column0Row0;
|
|
1606
|
-
result[1] = column0Row1;
|
|
1607
|
-
result[2] = column0Row2;
|
|
1608
|
-
result[3] = column1Row0;
|
|
1609
|
-
result[4] = column1Row1;
|
|
1610
|
-
result[5] = column1Row2;
|
|
1611
|
-
result[6] = column2Row0;
|
|
1612
|
-
result[7] = column2Row1;
|
|
1613
|
-
result[8] = column2Row2;
|
|
1614
|
-
return result;
|
|
1615
|
-
};
|
|
1616
|
-
function computeFrobeniusNorm(matrix) {
|
|
1617
|
-
let norm = 0;
|
|
1618
|
-
for (let i = 0; i < 9; ++i) {
|
|
1619
|
-
const temp = matrix[i];
|
|
1620
|
-
norm += temp * temp;
|
|
1621
|
-
}
|
|
1622
|
-
return Math.sqrt(norm);
|
|
1623
|
-
}
|
|
1624
|
-
var rowVal = [1, 0, 0];
|
|
1625
|
-
var colVal = [2, 2, 1];
|
|
1626
|
-
function offDiagonalFrobeniusNorm(matrix) {
|
|
1627
|
-
let norm = 0;
|
|
1628
|
-
for (let i = 0; i < 3; ++i) {
|
|
1629
|
-
const temp = matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])];
|
|
1630
|
-
norm += 2 * temp * temp;
|
|
1631
|
-
}
|
|
1632
|
-
return Math.sqrt(norm);
|
|
1633
|
-
}
|
|
1634
|
-
function shurDecomposition(matrix, result) {
|
|
1635
|
-
const tolerance = Math_default.EPSILON15;
|
|
1636
|
-
let maxDiagonal = 0;
|
|
1637
|
-
let rotAxis = 1;
|
|
1638
|
-
for (let i = 0; i < 3; ++i) {
|
|
1639
|
-
const temp = Math.abs(
|
|
1640
|
-
matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])]
|
|
1641
|
-
);
|
|
1642
|
-
if (temp > maxDiagonal) {
|
|
1643
|
-
rotAxis = i;
|
|
1644
|
-
maxDiagonal = temp;
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
let c = 1;
|
|
1648
|
-
let s = 0;
|
|
1649
|
-
const p = rowVal[rotAxis];
|
|
1650
|
-
const q = colVal[rotAxis];
|
|
1651
|
-
if (Math.abs(matrix[Matrix3.getElementIndex(q, p)]) > tolerance) {
|
|
1652
|
-
const qq = matrix[Matrix3.getElementIndex(q, q)];
|
|
1653
|
-
const pp = matrix[Matrix3.getElementIndex(p, p)];
|
|
1654
|
-
const qp = matrix[Matrix3.getElementIndex(q, p)];
|
|
1655
|
-
const tau = (qq - pp) / 2 / qp;
|
|
1656
|
-
let t;
|
|
1657
|
-
if (tau < 0) {
|
|
1658
|
-
t = -1 / (-tau + Math.sqrt(1 + tau * tau));
|
|
1659
|
-
} else {
|
|
1660
|
-
t = 1 / (tau + Math.sqrt(1 + tau * tau));
|
|
1661
|
-
}
|
|
1662
|
-
c = 1 / Math.sqrt(1 + t * t);
|
|
1663
|
-
s = t * c;
|
|
1664
|
-
}
|
|
1665
|
-
result = Matrix3.clone(Matrix3.IDENTITY, result);
|
|
1666
|
-
result[Matrix3.getElementIndex(p, p)] = result[Matrix3.getElementIndex(q, q)] = c;
|
|
1667
|
-
result[Matrix3.getElementIndex(q, p)] = s;
|
|
1668
|
-
result[Matrix3.getElementIndex(p, q)] = -s;
|
|
1669
|
-
return result;
|
|
1670
|
-
}
|
|
1671
|
-
var jMatrix = new Matrix3();
|
|
1672
|
-
var jMatrixTranspose = new Matrix3();
|
|
1673
|
-
Matrix3.computeEigenDecomposition = function(matrix, result) {
|
|
1674
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1675
|
-
const tolerance = Math_default.EPSILON20;
|
|
1676
|
-
const maxSweeps = 10;
|
|
1677
|
-
let count = 0;
|
|
1678
|
-
let sweep = 0;
|
|
1679
|
-
if (!defined_default(result)) {
|
|
1680
|
-
result = {};
|
|
1681
|
-
}
|
|
1682
|
-
const unitaryMatrix = result.unitary = Matrix3.clone(
|
|
1683
|
-
Matrix3.IDENTITY,
|
|
1684
|
-
result.unitary
|
|
1685
|
-
);
|
|
1686
|
-
const diagMatrix = result.diagonal = Matrix3.clone(matrix, result.diagonal);
|
|
1687
|
-
const epsilon = tolerance * computeFrobeniusNorm(diagMatrix);
|
|
1688
|
-
while (sweep < maxSweeps && offDiagonalFrobeniusNorm(diagMatrix) > epsilon) {
|
|
1689
|
-
shurDecomposition(diagMatrix, jMatrix);
|
|
1690
|
-
Matrix3.transpose(jMatrix, jMatrixTranspose);
|
|
1691
|
-
Matrix3.multiply(diagMatrix, jMatrix, diagMatrix);
|
|
1692
|
-
Matrix3.multiply(jMatrixTranspose, diagMatrix, diagMatrix);
|
|
1693
|
-
Matrix3.multiply(unitaryMatrix, jMatrix, unitaryMatrix);
|
|
1694
|
-
if (++count > 2) {
|
|
1695
|
-
++sweep;
|
|
1696
|
-
count = 0;
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
return result;
|
|
1700
|
-
};
|
|
1701
|
-
Matrix3.abs = function(matrix, result) {
|
|
1702
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1703
|
-
Check_default.typeOf.object("result", result);
|
|
1704
|
-
result[0] = Math.abs(matrix[0]);
|
|
1705
|
-
result[1] = Math.abs(matrix[1]);
|
|
1706
|
-
result[2] = Math.abs(matrix[2]);
|
|
1707
|
-
result[3] = Math.abs(matrix[3]);
|
|
1708
|
-
result[4] = Math.abs(matrix[4]);
|
|
1709
|
-
result[5] = Math.abs(matrix[5]);
|
|
1710
|
-
result[6] = Math.abs(matrix[6]);
|
|
1711
|
-
result[7] = Math.abs(matrix[7]);
|
|
1712
|
-
result[8] = Math.abs(matrix[8]);
|
|
1713
|
-
return result;
|
|
1714
|
-
};
|
|
1715
|
-
Matrix3.determinant = function(matrix) {
|
|
1716
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1717
|
-
const m11 = matrix[0];
|
|
1718
|
-
const m21 = matrix[3];
|
|
1719
|
-
const m31 = matrix[6];
|
|
1720
|
-
const m12 = matrix[1];
|
|
1721
|
-
const m22 = matrix[4];
|
|
1722
|
-
const m32 = matrix[7];
|
|
1723
|
-
const m13 = matrix[2];
|
|
1724
|
-
const m23 = matrix[5];
|
|
1725
|
-
const m33 = matrix[8];
|
|
1726
|
-
return m11 * (m22 * m33 - m23 * m32) + m12 * (m23 * m31 - m21 * m33) + m13 * (m21 * m32 - m22 * m31);
|
|
1727
|
-
};
|
|
1728
|
-
Matrix3.inverse = function(matrix, result) {
|
|
1729
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1730
|
-
Check_default.typeOf.object("result", result);
|
|
1731
|
-
const m11 = matrix[0];
|
|
1732
|
-
const m21 = matrix[1];
|
|
1733
|
-
const m31 = matrix[2];
|
|
1734
|
-
const m12 = matrix[3];
|
|
1735
|
-
const m22 = matrix[4];
|
|
1736
|
-
const m32 = matrix[5];
|
|
1737
|
-
const m13 = matrix[6];
|
|
1738
|
-
const m23 = matrix[7];
|
|
1739
|
-
const m33 = matrix[8];
|
|
1740
|
-
const determinant = Matrix3.determinant(matrix);
|
|
1741
|
-
if (Math.abs(determinant) <= Math_default.EPSILON15) {
|
|
1742
|
-
throw new DeveloperError_default("matrix is not invertible");
|
|
1743
|
-
}
|
|
1744
|
-
result[0] = m22 * m33 - m23 * m32;
|
|
1745
|
-
result[1] = m23 * m31 - m21 * m33;
|
|
1746
|
-
result[2] = m21 * m32 - m22 * m31;
|
|
1747
|
-
result[3] = m13 * m32 - m12 * m33;
|
|
1748
|
-
result[4] = m11 * m33 - m13 * m31;
|
|
1749
|
-
result[5] = m12 * m31 - m11 * m32;
|
|
1750
|
-
result[6] = m12 * m23 - m13 * m22;
|
|
1751
|
-
result[7] = m13 * m21 - m11 * m23;
|
|
1752
|
-
result[8] = m11 * m22 - m12 * m21;
|
|
1753
|
-
const scale = 1 / determinant;
|
|
1754
|
-
return Matrix3.multiplyByScalar(result, scale, result);
|
|
1755
|
-
};
|
|
1756
|
-
var scratchTransposeMatrix = new Matrix3();
|
|
1757
|
-
Matrix3.inverseTranspose = function(matrix, result) {
|
|
1758
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
1759
|
-
Check_default.typeOf.object("result", result);
|
|
1760
|
-
return Matrix3.inverse(
|
|
1761
|
-
Matrix3.transpose(matrix, scratchTransposeMatrix),
|
|
1762
|
-
result
|
|
1763
|
-
);
|
|
1764
|
-
};
|
|
1765
|
-
Matrix3.equals = function(left, right) {
|
|
1766
|
-
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] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[7] === right[7] && left[8] === right[8];
|
|
1767
|
-
};
|
|
1768
|
-
Matrix3.equalsEpsilon = function(left, right, epsilon) {
|
|
1769
|
-
epsilon = epsilon ?? 0;
|
|
1770
|
-
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 && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon;
|
|
1771
|
-
};
|
|
1772
|
-
Matrix3.IDENTITY = Object.freeze(
|
|
1773
|
-
new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1)
|
|
1774
|
-
);
|
|
1775
|
-
Matrix3.ZERO = Object.freeze(
|
|
1776
|
-
new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0)
|
|
1777
|
-
);
|
|
1778
|
-
Matrix3.COLUMN0ROW0 = 0;
|
|
1779
|
-
Matrix3.COLUMN0ROW1 = 1;
|
|
1780
|
-
Matrix3.COLUMN0ROW2 = 2;
|
|
1781
|
-
Matrix3.COLUMN1ROW0 = 3;
|
|
1782
|
-
Matrix3.COLUMN1ROW1 = 4;
|
|
1783
|
-
Matrix3.COLUMN1ROW2 = 5;
|
|
1784
|
-
Matrix3.COLUMN2ROW0 = 6;
|
|
1785
|
-
Matrix3.COLUMN2ROW1 = 7;
|
|
1786
|
-
Matrix3.COLUMN2ROW2 = 8;
|
|
1787
|
-
Object.defineProperties(Matrix3.prototype, {
|
|
1788
|
-
/**
|
|
1789
|
-
* Gets the number of items in the collection.
|
|
1790
|
-
* @memberof Matrix3.prototype
|
|
1791
|
-
*
|
|
1792
|
-
* @type {number}
|
|
1793
|
-
*/
|
|
1794
|
-
length: {
|
|
1795
|
-
get: function() {
|
|
1796
|
-
return Matrix3.packedLength;
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
});
|
|
1800
|
-
Matrix3.prototype.clone = function(result) {
|
|
1801
|
-
return Matrix3.clone(this, result);
|
|
1802
|
-
};
|
|
1803
|
-
Matrix3.prototype.equals = function(right) {
|
|
1804
|
-
return Matrix3.equals(this, right);
|
|
1805
|
-
};
|
|
1806
|
-
Matrix3.equalsArray = function(matrix, array, offset) {
|
|
1807
|
-
return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3] && matrix[4] === array[offset + 4] && matrix[5] === array[offset + 5] && matrix[6] === array[offset + 6] && matrix[7] === array[offset + 7] && matrix[8] === array[offset + 8];
|
|
1808
|
-
};
|
|
1809
|
-
Matrix3.prototype.equalsEpsilon = function(right, epsilon) {
|
|
1810
|
-
return Matrix3.equalsEpsilon(this, right, epsilon);
|
|
1811
|
-
};
|
|
1812
|
-
Matrix3.prototype.toString = function() {
|
|
1813
|
-
return `(${this[0]}, ${this[3]}, ${this[6]})
|
|
1814
|
-
(${this[1]}, ${this[4]}, ${this[7]})
|
|
1815
|
-
(${this[2]}, ${this[5]}, ${this[8]})`;
|
|
1816
|
-
};
|
|
1817
|
-
var Matrix3_default = Matrix3;
|
|
1818
|
-
|
|
1819
|
-
// packages/engine/Source/Core/Frozen.js
|
|
1820
|
-
var Frozen = {};
|
|
1821
|
-
Frozen.EMPTY_OBJECT = Object.freeze({});
|
|
1822
|
-
Frozen.EMPTY_ARRAY = Object.freeze([]);
|
|
1823
|
-
var Frozen_default = Frozen;
|
|
1824
|
-
|
|
1825
|
-
export {
|
|
1826
|
-
Cartesian3_default,
|
|
1827
|
-
Matrix3_default,
|
|
1828
|
-
Frozen_default
|
|
1829
|
-
};
|