@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
package/Source/Core/Matrix2.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import Cartesian2 from "./Cartesian2.js";
|
|
2
4
|
import Check from "./Check.js";
|
|
3
5
|
import defined from "./defined.js";
|
|
@@ -6,14 +8,8 @@ import DeveloperError from "./DeveloperError.js";
|
|
|
6
8
|
/**
|
|
7
9
|
* A 2x2 matrix, indexable as a column-major order array.
|
|
8
10
|
* Constructor parameters are in row-major order for code readability.
|
|
9
|
-
* @alias Matrix2
|
|
10
|
-
* @constructor
|
|
11
|
-
* @implements {ArrayLike<number>}
|
|
12
11
|
*
|
|
13
|
-
* @
|
|
14
|
-
* @param {number} [column1Row0=0.0] The value for column 1, row 0.
|
|
15
|
-
* @param {number} [column0Row1=0.0] The value for column 0, row 1.
|
|
16
|
-
* @param {number} [column1Row1=0.0] The value for column 1, row 1.
|
|
12
|
+
* @implements {ArrayLike<number>}
|
|
17
13
|
*
|
|
18
14
|
* @see Matrix2.fromArray
|
|
19
15
|
* @see Matrix2.fromColumnMajorArray
|
|
@@ -24,949 +20,1016 @@ import DeveloperError from "./DeveloperError.js";
|
|
|
24
20
|
* @see Matrix3
|
|
25
21
|
* @see Matrix4
|
|
26
22
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
23
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
24
|
+
class Matrix2 {
|
|
25
|
+
/**
|
|
26
|
+
* @param {number} [column0Row0=0.0] The value for column 0, row 0.
|
|
27
|
+
* @param {number} [column1Row0=0.0] The value for column 1, row 0.
|
|
28
|
+
* @param {number} [column0Row1=0.0] The value for column 0, row 1.
|
|
29
|
+
* @param {number} [column1Row1=0.0] The value for column 1, row 1.
|
|
30
|
+
*/
|
|
31
|
+
constructor(column0Row0, column1Row0, column0Row1, column1Row1) {
|
|
32
|
+
this[0] = column0Row0 ?? 0.0;
|
|
33
|
+
this[1] = column0Row1 ?? 0.0;
|
|
34
|
+
this[2] = column1Row0 ?? 0.0;
|
|
35
|
+
this[3] = column1Row1 ?? 0.0;
|
|
36
|
+
}
|
|
33
37
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Stores the provided instance into the provided array.
|
|
40
|
+
*
|
|
41
|
+
* @param {Matrix2} value The value to pack.
|
|
42
|
+
* @param {number[]} array The array to pack into.
|
|
43
|
+
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
44
|
+
*
|
|
45
|
+
* @returns {number[]} The array that was packed into
|
|
46
|
+
*/
|
|
47
|
+
static pack(value, array, startingIndex) {
|
|
48
|
+
//>>includeStart('debug', pragmas.debug);
|
|
49
|
+
Check.typeOf.object("value", value);
|
|
50
|
+
Check.defined("array", array);
|
|
51
|
+
//>>includeEnd('debug');
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
* Stores the provided instance into the provided array.
|
|
42
|
-
*
|
|
43
|
-
* @param {Matrix2} value The value to pack.
|
|
44
|
-
* @param {number[]} array The array to pack into.
|
|
45
|
-
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
46
|
-
*
|
|
47
|
-
* @returns {number[]} The array that was packed into
|
|
48
|
-
*/
|
|
49
|
-
Matrix2.pack = function (value, array, startingIndex) {
|
|
50
|
-
//>>includeStart('debug', pragmas.debug);
|
|
51
|
-
Check.typeOf.object("value", value);
|
|
52
|
-
Check.defined("array", array);
|
|
53
|
-
//>>includeEnd('debug');
|
|
53
|
+
startingIndex = startingIndex ?? 0;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
array[startingIndex++] = value[0];
|
|
56
|
+
array[startingIndex++] = value[1];
|
|
57
|
+
array[startingIndex++] = value[2];
|
|
58
|
+
array[startingIndex++] = value[3];
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
array[startingIndex++] = value[2];
|
|
60
|
-
array[startingIndex++] = value[3];
|
|
60
|
+
return array;
|
|
61
|
+
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves an instance from a packed array.
|
|
65
|
+
*
|
|
66
|
+
* @param {number[]} array The packed array.
|
|
67
|
+
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
68
|
+
* @param {Matrix2} [result] The object into which to store the result.
|
|
69
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
70
|
+
*/
|
|
71
|
+
static unpack(array, startingIndex, result) {
|
|
72
|
+
//>>includeStart('debug', pragmas.debug);
|
|
73
|
+
Check.defined("array", array);
|
|
74
|
+
//>>includeEnd('debug');
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
* Retrieves an instance from a packed array.
|
|
67
|
-
*
|
|
68
|
-
* @param {number[]} array The packed array.
|
|
69
|
-
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
70
|
-
* @param {Matrix2} [result] The object into which to store the result.
|
|
71
|
-
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
72
|
-
*/
|
|
73
|
-
Matrix2.unpack = function (array, startingIndex, result) {
|
|
74
|
-
//>>includeStart('debug', pragmas.debug);
|
|
75
|
-
Check.defined("array", array);
|
|
76
|
-
//>>includeEnd('debug');
|
|
76
|
+
startingIndex = startingIndex ?? 0;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
if (!defined(result)) {
|
|
79
|
+
result = new Matrix2();
|
|
80
|
+
}
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
result =
|
|
82
|
+
result[0] = array[startingIndex++];
|
|
83
|
+
result[1] = array[startingIndex++];
|
|
84
|
+
result[2] = array[startingIndex++];
|
|
85
|
+
result[3] = array[startingIndex++];
|
|
86
|
+
return result;
|
|
82
87
|
}
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* are stored in column-major order.
|
|
94
|
-
*
|
|
95
|
-
* @param {Matrix2[]} array The array of matrices to pack.
|
|
96
|
-
* @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
|
|
97
|
-
* @returns {number[]} The packed array.
|
|
98
|
-
*/
|
|
99
|
-
Matrix2.packArray = function (array, result) {
|
|
100
|
-
//>>includeStart('debug', pragmas.debug);
|
|
101
|
-
Check.defined("array", array);
|
|
102
|
-
//>>includeEnd('debug');
|
|
103
|
-
|
|
104
|
-
const length = array.length;
|
|
105
|
-
const resultLength = length * 4;
|
|
106
|
-
if (!defined(result)) {
|
|
107
|
-
result = new Array(resultLength);
|
|
108
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
89
|
+
/**
|
|
90
|
+
* Flattens an array of Matrix2s into an array of components. The components
|
|
91
|
+
* are stored in column-major order.
|
|
92
|
+
*
|
|
93
|
+
* @param {Matrix2[]} array The array of matrices to pack.
|
|
94
|
+
* @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
|
|
95
|
+
* @returns {number[]} The packed array.
|
|
96
|
+
*/
|
|
97
|
+
static packArray(array, result) {
|
|
109
98
|
//>>includeStart('debug', pragmas.debug);
|
|
110
|
-
|
|
111
|
-
"If result is a typed array, it must have exactly array.length * 4 elements",
|
|
112
|
-
);
|
|
99
|
+
Check.defined("array", array);
|
|
113
100
|
//>>includeEnd('debug');
|
|
114
|
-
} else if (result.length !== resultLength) {
|
|
115
|
-
result.length = resultLength;
|
|
116
|
-
}
|
|
117
101
|
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
const length = array.length;
|
|
103
|
+
const resultLength = length * 4;
|
|
104
|
+
if (!defined(result)) {
|
|
105
|
+
result = new Array(resultLength);
|
|
106
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires conditional TypedArray types.
|
|
107
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
108
|
+
//>>includeStart('debug', pragmas.debug);
|
|
109
|
+
throw new DeveloperError(
|
|
110
|
+
"If result is a typed array, it must have exactly array.length * 4 elements",
|
|
111
|
+
);
|
|
112
|
+
//>>includeEnd('debug');
|
|
113
|
+
} else if (result.length !== resultLength) {
|
|
114
|
+
/** @type {number[]} */ (result).length = resultLength;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (let i = 0; i < length; ++i) {
|
|
118
|
+
Matrix2.pack(array[i], result, i * 4);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result;
|
|
120
122
|
}
|
|
121
|
-
return result;
|
|
122
|
-
};
|
|
123
123
|
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Unpacks an array of column-major matrix components into an array of Matrix2s.
|
|
126
|
+
*
|
|
127
|
+
* @param {number[]} array The array of components to unpack.
|
|
128
|
+
* @param {Matrix2[]} [result] The array onto which to store the result.
|
|
129
|
+
* @returns {Matrix2[]} The unpacked array.
|
|
130
|
+
*/
|
|
131
|
+
static unpackArray(array, result) {
|
|
132
|
+
//>>includeStart('debug', pragmas.debug);
|
|
133
|
+
Check.defined("array", array);
|
|
134
|
+
Check.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
|
135
|
+
if (array.length % 4 !== 0) {
|
|
136
|
+
throw new DeveloperError("array length must be a multiple of 4.");
|
|
137
|
+
}
|
|
138
|
+
//>>includeEnd('debug');
|
|
139
|
+
|
|
140
|
+
const length = array.length;
|
|
141
|
+
if (!defined(result)) {
|
|
142
|
+
result = new Array(length / 4);
|
|
143
|
+
} else {
|
|
144
|
+
result.length = length / 4;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
for (let i = 0; i < length; i += 4) {
|
|
148
|
+
const index = i / 4;
|
|
149
|
+
result[index] = Matrix2.unpack(array, i, result[index]);
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
137
152
|
}
|
|
138
|
-
//>>includeEnd('debug');
|
|
139
153
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Duplicates a Matrix2 instance.
|
|
156
|
+
*
|
|
157
|
+
* @param {Matrix2} matrix The matrix to duplicate.
|
|
158
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
|
159
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided. (Returns undefined if matrix is undefined)
|
|
160
|
+
*/
|
|
161
|
+
static clone(matrix, result) {
|
|
162
|
+
if (!defined(matrix)) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
if (!defined(result)) {
|
|
166
|
+
return new Matrix2(matrix[0], matrix[2], matrix[1], matrix[3]);
|
|
167
|
+
}
|
|
168
|
+
result[0] = matrix[0];
|
|
169
|
+
result[1] = matrix[1];
|
|
170
|
+
result[2] = matrix[2];
|
|
171
|
+
result[3] = matrix[3];
|
|
172
|
+
return result;
|
|
145
173
|
}
|
|
146
174
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Creates a Matrix2 instance from a column-major order array.
|
|
177
|
+
*
|
|
178
|
+
* @param {number[]} values The column-major order array.
|
|
179
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
180
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
181
|
+
*/
|
|
182
|
+
static fromColumnMajorArray(values, result) {
|
|
183
|
+
//>>includeStart('debug', pragmas.debug);
|
|
184
|
+
Check.defined("values", values);
|
|
185
|
+
//>>includeEnd('debug');
|
|
186
|
+
|
|
187
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
188
|
+
return Matrix2.clone(values, result);
|
|
150
189
|
}
|
|
151
|
-
return result;
|
|
152
|
-
};
|
|
153
190
|
|
|
154
|
-
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Creates a Matrix2 instance from a row-major order array.
|
|
193
|
+
* The resulting matrix will be in column-major order.
|
|
194
|
+
*
|
|
195
|
+
* @param {number[]} values The row-major order array.
|
|
196
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
197
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
198
|
+
*/
|
|
199
|
+
static fromRowMajorArray(values, result) {
|
|
200
|
+
//>>includeStart('debug', pragmas.debug);
|
|
201
|
+
Check.defined("values", values);
|
|
202
|
+
//>>includeEnd('debug');
|
|
203
|
+
|
|
204
|
+
if (!defined(result)) {
|
|
205
|
+
return new Matrix2(values[0], values[1], values[2], values[3]);
|
|
206
|
+
}
|
|
207
|
+
result[0] = values[0];
|
|
208
|
+
result[1] = values[2];
|
|
209
|
+
result[2] = values[1];
|
|
210
|
+
result[3] = values[3];
|
|
211
|
+
return result;
|
|
164
212
|
}
|
|
165
|
-
|
|
166
|
-
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Computes a Matrix2 instance representing a non-uniform scale.
|
|
216
|
+
*
|
|
217
|
+
* @param {Cartesian2} scale The x and y scale factors.
|
|
218
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
219
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* // Creates
|
|
223
|
+
* // [7.0, 0.0]
|
|
224
|
+
* // [0.0, 8.0]
|
|
225
|
+
* const m = Cesium.Matrix2.fromScale(new Cesium.Cartesian2(7.0, 8.0));
|
|
226
|
+
*/
|
|
227
|
+
static fromScale(scale, result) {
|
|
228
|
+
//>>includeStart('debug', pragmas.debug);
|
|
229
|
+
Check.typeOf.object("scale", scale);
|
|
230
|
+
//>>includeEnd('debug');
|
|
231
|
+
|
|
232
|
+
if (!defined(result)) {
|
|
233
|
+
return new Matrix2(scale.x, 0.0, 0.0, scale.y);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
result[0] = scale.x;
|
|
237
|
+
result[1] = 0.0;
|
|
238
|
+
result[2] = 0.0;
|
|
239
|
+
result[3] = scale.y;
|
|
240
|
+
return result;
|
|
167
241
|
}
|
|
168
|
-
result[0] = matrix[0];
|
|
169
|
-
result[1] = matrix[1];
|
|
170
|
-
result[2] = matrix[2];
|
|
171
|
-
result[3] = matrix[3];
|
|
172
|
-
return result;
|
|
173
|
-
};
|
|
174
242
|
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* // Create same Matrix2 with using an offset into an array
|
|
193
|
-
* const v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
|
|
194
|
-
* const m2 = Cesium.Matrix2.fromArray(v2, 2);
|
|
195
|
-
*/
|
|
196
|
-
Matrix2.fromArray = Matrix2.unpack;
|
|
197
|
-
/**
|
|
198
|
-
* Creates a Matrix2 instance from a column-major order array.
|
|
199
|
-
*
|
|
200
|
-
* @param {number[]} values The column-major order array.
|
|
201
|
-
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
202
|
-
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
203
|
-
*/
|
|
204
|
-
Matrix2.fromColumnMajorArray = function (values, result) {
|
|
205
|
-
//>>includeStart('debug', pragmas.debug);
|
|
206
|
-
Check.defined("values", values);
|
|
207
|
-
//>>includeEnd('debug');
|
|
243
|
+
/**
|
|
244
|
+
* Computes a Matrix2 instance representing a uniform scale.
|
|
245
|
+
*
|
|
246
|
+
* @param {number} scale The uniform scale factor.
|
|
247
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
248
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* // Creates
|
|
252
|
+
* // [2.0, 0.0]
|
|
253
|
+
* // [0.0, 2.0]
|
|
254
|
+
* const m = Cesium.Matrix2.fromUniformScale(2.0);
|
|
255
|
+
*/
|
|
256
|
+
static fromUniformScale(scale, result) {
|
|
257
|
+
//>>includeStart('debug', pragmas.debug);
|
|
258
|
+
Check.typeOf.number("scale", scale);
|
|
259
|
+
//>>includeEnd('debug');
|
|
208
260
|
|
|
209
|
-
|
|
210
|
-
|
|
261
|
+
if (!defined(result)) {
|
|
262
|
+
return new Matrix2(scale, 0.0, 0.0, scale);
|
|
263
|
+
}
|
|
211
264
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
265
|
+
result[0] = scale;
|
|
266
|
+
result[1] = 0.0;
|
|
267
|
+
result[2] = 0.0;
|
|
268
|
+
result[3] = scale;
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Creates a rotation matrix.
|
|
274
|
+
*
|
|
275
|
+
* @param {number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
|
|
276
|
+
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
277
|
+
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* // Rotate a point 45 degrees counterclockwise.
|
|
281
|
+
* const p = new Cesium.Cartesian2(5, 6);
|
|
282
|
+
* const m = Cesium.Matrix2.fromRotation(Cesium.Math.toRadians(45.0));
|
|
283
|
+
* const rotated = Cesium.Matrix2.multiplyByVector(m, p, new Cesium.Cartesian2());
|
|
284
|
+
*/
|
|
285
|
+
static fromRotation(angle, result) {
|
|
286
|
+
//>>includeStart('debug', pragmas.debug);
|
|
287
|
+
Check.typeOf.number("angle", angle);
|
|
288
|
+
//>>includeEnd('debug');
|
|
224
289
|
|
|
225
|
-
|
|
226
|
-
|
|
290
|
+
const cosAngle = Math.cos(angle);
|
|
291
|
+
const sinAngle = Math.sin(angle);
|
|
292
|
+
|
|
293
|
+
if (!defined(result)) {
|
|
294
|
+
return new Matrix2(cosAngle, -sinAngle, sinAngle, cosAngle);
|
|
295
|
+
}
|
|
296
|
+
result[0] = cosAngle;
|
|
297
|
+
result[1] = sinAngle;
|
|
298
|
+
result[2] = -sinAngle;
|
|
299
|
+
result[3] = cosAngle;
|
|
300
|
+
return result;
|
|
227
301
|
}
|
|
228
|
-
result[0] = values[0];
|
|
229
|
-
result[1] = values[2];
|
|
230
|
-
result[2] = values[1];
|
|
231
|
-
result[3] = values[3];
|
|
232
|
-
return result;
|
|
233
|
-
};
|
|
234
302
|
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*/
|
|
248
|
-
Matrix2.fromScale = function (scale, result) {
|
|
249
|
-
//>>includeStart('debug', pragmas.debug);
|
|
250
|
-
Check.typeOf.object("scale", scale);
|
|
251
|
-
//>>includeEnd('debug');
|
|
303
|
+
/**
|
|
304
|
+
* Creates an Array from the provided Matrix2 instance.
|
|
305
|
+
* The array will be in column-major order.
|
|
306
|
+
*
|
|
307
|
+
* @param {Matrix2} matrix The matrix to use..
|
|
308
|
+
* @param {number[]} [result] The Array onto which to store the result.
|
|
309
|
+
* @returns {number[]} The modified Array parameter or a new Array instance if one was not provided.
|
|
310
|
+
*/
|
|
311
|
+
static toArray(matrix, result) {
|
|
312
|
+
//>>includeStart('debug', pragmas.debug);
|
|
313
|
+
Check.typeOf.object("matrix", matrix);
|
|
314
|
+
//>>includeEnd('debug');
|
|
252
315
|
|
|
253
|
-
|
|
254
|
-
|
|
316
|
+
if (!defined(result)) {
|
|
317
|
+
return [matrix[0], matrix[1], matrix[2], matrix[3]];
|
|
318
|
+
}
|
|
319
|
+
result[0] = matrix[0];
|
|
320
|
+
result[1] = matrix[1];
|
|
321
|
+
result[2] = matrix[2];
|
|
322
|
+
result[3] = matrix[3];
|
|
323
|
+
return result;
|
|
255
324
|
}
|
|
256
325
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
326
|
+
/**
|
|
327
|
+
* Computes the array index of the element at the provided row and column.
|
|
328
|
+
*
|
|
329
|
+
* @param {number} row The zero-based index of the row.
|
|
330
|
+
* @param {number} column The zero-based index of the column.
|
|
331
|
+
* @returns {number} The index of the element at the provided row and column.
|
|
332
|
+
*
|
|
333
|
+
* @exception {DeveloperError} row must be 0 or 1.
|
|
334
|
+
* @exception {DeveloperError} column must be 0 or 1.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* const myMatrix = new Cesium.Matrix2();
|
|
338
|
+
* const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
|
|
339
|
+
* const column1Row0 = myMatrix[column1Row0Index]
|
|
340
|
+
* myMatrix[column1Row0Index] = 10.0;
|
|
341
|
+
*/
|
|
342
|
+
static getElementIndex(column, row) {
|
|
343
|
+
//>>includeStart('debug', pragmas.debug);
|
|
344
|
+
Check.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
345
|
+
Check.typeOf.number.lessThanOrEquals("row", row, 1);
|
|
263
346
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
* @param {number} scale The uniform scale factor.
|
|
268
|
-
* @param {Matrix2} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
|
269
|
-
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* // Creates
|
|
273
|
-
* // [2.0, 0.0]
|
|
274
|
-
* // [0.0, 2.0]
|
|
275
|
-
* const m = Cesium.Matrix2.fromUniformScale(2.0);
|
|
276
|
-
*/
|
|
277
|
-
Matrix2.fromUniformScale = function (scale, result) {
|
|
278
|
-
//>>includeStart('debug', pragmas.debug);
|
|
279
|
-
Check.typeOf.number("scale", scale);
|
|
280
|
-
//>>includeEnd('debug');
|
|
347
|
+
Check.typeOf.number.greaterThanOrEquals("column", column, 0);
|
|
348
|
+
Check.typeOf.number.lessThanOrEquals("column", column, 1);
|
|
349
|
+
//>>includeEnd('debug');
|
|
281
350
|
|
|
282
|
-
|
|
283
|
-
return new Matrix2(scale, 0.0, 0.0, scale);
|
|
351
|
+
return column * 2 + row;
|
|
284
352
|
}
|
|
285
353
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
354
|
+
/**
|
|
355
|
+
* Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.
|
|
356
|
+
*
|
|
357
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
358
|
+
* @param {number} index The zero-based index of the column to retrieve.
|
|
359
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
360
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
361
|
+
*
|
|
362
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
363
|
+
*/
|
|
364
|
+
static getColumn(matrix, index, result) {
|
|
365
|
+
//>>includeStart('debug', pragmas.debug);
|
|
366
|
+
Check.typeOf.object("matrix", matrix);
|
|
292
367
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* @returns {Matrix2} The modified result parameter, or a new Matrix2 instance if one was not provided.
|
|
299
|
-
*
|
|
300
|
-
* @example
|
|
301
|
-
* // Rotate a point 45 degrees counterclockwise.
|
|
302
|
-
* const p = new Cesium.Cartesian2(5, 6);
|
|
303
|
-
* const m = Cesium.Matrix2.fromRotation(Cesium.Math.toRadians(45.0));
|
|
304
|
-
* const rotated = Cesium.Matrix2.multiplyByVector(m, p, new Cesium.Cartesian2());
|
|
305
|
-
*/
|
|
306
|
-
Matrix2.fromRotation = function (angle, result) {
|
|
307
|
-
//>>includeStart('debug', pragmas.debug);
|
|
308
|
-
Check.typeOf.number("angle", angle);
|
|
309
|
-
//>>includeEnd('debug');
|
|
368
|
+
Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
369
|
+
Check.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
370
|
+
|
|
371
|
+
Check.typeOf.object("result", result);
|
|
372
|
+
//>>includeEnd('debug');
|
|
310
373
|
|
|
311
|
-
|
|
312
|
-
|
|
374
|
+
const startIndex = index * 2;
|
|
375
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
376
|
+
const x = matrix[startIndex];
|
|
377
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
378
|
+
const y = matrix[startIndex + 1];
|
|
313
379
|
|
|
314
|
-
|
|
315
|
-
|
|
380
|
+
result.x = x;
|
|
381
|
+
result.y = y;
|
|
382
|
+
return result;
|
|
316
383
|
}
|
|
317
|
-
result[0] = cosAngle;
|
|
318
|
-
result[1] = sinAngle;
|
|
319
|
-
result[2] = -sinAngle;
|
|
320
|
-
result[3] = cosAngle;
|
|
321
|
-
return result;
|
|
322
|
-
};
|
|
323
384
|
|
|
324
|
-
/**
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.
|
|
387
|
+
*
|
|
388
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
389
|
+
* @param {number} index The zero-based index of the column to set.
|
|
390
|
+
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified column.
|
|
391
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
392
|
+
* @returns {Matrix2} The modified result parameter.
|
|
393
|
+
*
|
|
394
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
395
|
+
*/
|
|
396
|
+
static setColumn(matrix, index, cartesian, result) {
|
|
397
|
+
//>>includeStart('debug', pragmas.debug);
|
|
398
|
+
Check.typeOf.object("matrix", matrix);
|
|
336
399
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
result[0] = matrix[0];
|
|
341
|
-
result[1] = matrix[1];
|
|
342
|
-
result[2] = matrix[2];
|
|
343
|
-
result[3] = matrix[3];
|
|
344
|
-
return result;
|
|
345
|
-
};
|
|
400
|
+
Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
401
|
+
Check.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
346
402
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
* @param {number} row The zero-based index of the row.
|
|
351
|
-
* @param {number} column The zero-based index of the column.
|
|
352
|
-
* @returns {number} The index of the element at the provided row and column.
|
|
353
|
-
*
|
|
354
|
-
* @exception {DeveloperError} row must be 0 or 1.
|
|
355
|
-
* @exception {DeveloperError} column must be 0 or 1.
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* const myMatrix = new Cesium.Matrix2();
|
|
359
|
-
* const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
|
|
360
|
-
* const column1Row0 = myMatrix[column1Row0Index]
|
|
361
|
-
* myMatrix[column1Row0Index] = 10.0;
|
|
362
|
-
*/
|
|
363
|
-
Matrix2.getElementIndex = function (column, row) {
|
|
364
|
-
//>>includeStart('debug', pragmas.debug);
|
|
365
|
-
Check.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
366
|
-
Check.typeOf.number.lessThanOrEquals("row", row, 1);
|
|
403
|
+
Check.typeOf.object("cartesian", cartesian);
|
|
404
|
+
Check.typeOf.object("result", result);
|
|
405
|
+
//>>includeEnd('debug');
|
|
367
406
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
407
|
+
result = Matrix2.clone(matrix, result);
|
|
408
|
+
const startIndex = index * 2;
|
|
409
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
410
|
+
result[startIndex] = cartesian.x;
|
|
411
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
412
|
+
result[startIndex + 1] = cartesian.y;
|
|
413
|
+
return result;
|
|
414
|
+
}
|
|
371
415
|
|
|
372
|
-
|
|
373
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.
|
|
418
|
+
*
|
|
419
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
420
|
+
* @param {number} index The zero-based index of the row to retrieve.
|
|
421
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
422
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
423
|
+
*
|
|
424
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
425
|
+
*/
|
|
426
|
+
static getRow(matrix, index, result) {
|
|
427
|
+
//>>includeStart('debug', pragmas.debug);
|
|
428
|
+
Check.typeOf.object("matrix", matrix);
|
|
374
429
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*
|
|
378
|
-
* @param {Matrix2} matrix The matrix to use.
|
|
379
|
-
* @param {number} index The zero-based index of the column to retrieve.
|
|
380
|
-
* @param {Cartesian2} result The object onto which to store the result.
|
|
381
|
-
* @returns {Cartesian2} The modified result parameter.
|
|
382
|
-
*
|
|
383
|
-
* @exception {DeveloperError} index must be 0 or 1.
|
|
384
|
-
*/
|
|
385
|
-
Matrix2.getColumn = function (matrix, index, result) {
|
|
386
|
-
//>>includeStart('debug', pragmas.debug);
|
|
387
|
-
Check.typeOf.object("matrix", matrix);
|
|
430
|
+
Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
431
|
+
Check.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
388
432
|
|
|
389
|
-
|
|
390
|
-
|
|
433
|
+
Check.typeOf.object("result", result);
|
|
434
|
+
//>>includeEnd('debug');
|
|
391
435
|
|
|
392
|
-
|
|
393
|
-
|
|
436
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
437
|
+
const x = matrix[index];
|
|
438
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
439
|
+
const y = matrix[index + 2];
|
|
394
440
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
441
|
+
result.x = x;
|
|
442
|
+
result.y = y;
|
|
443
|
+
return result;
|
|
444
|
+
}
|
|
398
445
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
446
|
+
/**
|
|
447
|
+
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.
|
|
448
|
+
*
|
|
449
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
450
|
+
* @param {number} index The zero-based index of the row to set.
|
|
451
|
+
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified row.
|
|
452
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
453
|
+
* @returns {Matrix2} The modified result parameter.
|
|
454
|
+
*
|
|
455
|
+
* @exception {DeveloperError} index must be 0 or 1.
|
|
456
|
+
*/
|
|
457
|
+
static setRow(matrix, index, cartesian, result) {
|
|
458
|
+
//>>includeStart('debug', pragmas.debug);
|
|
459
|
+
Check.typeOf.object("matrix", matrix);
|
|
403
460
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
*
|
|
407
|
-
* @param {Matrix2} matrix The matrix to use.
|
|
408
|
-
* @param {number} index The zero-based index of the column to set.
|
|
409
|
-
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified column.
|
|
410
|
-
* @param {Cartesian2} result The object onto which to store the result.
|
|
411
|
-
* @returns {Matrix2} The modified result parameter.
|
|
412
|
-
*
|
|
413
|
-
* @exception {DeveloperError} index must be 0 or 1.
|
|
414
|
-
*/
|
|
415
|
-
Matrix2.setColumn = function (matrix, index, cartesian, result) {
|
|
416
|
-
//>>includeStart('debug', pragmas.debug);
|
|
417
|
-
Check.typeOf.object("matrix", matrix);
|
|
461
|
+
Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
462
|
+
Check.typeOf.number.lessThanOrEquals("index", index, 1);
|
|
418
463
|
|
|
419
|
-
|
|
420
|
-
|
|
464
|
+
Check.typeOf.object("cartesian", cartesian);
|
|
465
|
+
Check.typeOf.object("result", result);
|
|
466
|
+
//>>includeEnd('debug');
|
|
421
467
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
468
|
+
result = Matrix2.clone(matrix, result);
|
|
469
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
470
|
+
result[index] = cartesian.x;
|
|
471
|
+
// @ts-expect-error TODO(tsd-jsdoc): Requires index signature support.
|
|
472
|
+
result[index + 2] = cartesian.y;
|
|
473
|
+
return result;
|
|
474
|
+
}
|
|
425
475
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
476
|
+
/**
|
|
477
|
+
* Computes a new matrix that replaces the scale with the provided scale.
|
|
478
|
+
* This assumes the matrix is an affine transformation.
|
|
479
|
+
*
|
|
480
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
481
|
+
* @param {Cartesian2} scale The scale that replaces the scale of the provided matrix.
|
|
482
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
483
|
+
* @returns {Matrix2} The modified result parameter.
|
|
484
|
+
*
|
|
485
|
+
* @see Matrix2.setUniformScale
|
|
486
|
+
* @see Matrix2.fromScale
|
|
487
|
+
* @see Matrix2.fromUniformScale
|
|
488
|
+
* @see Matrix2.multiplyByScale
|
|
489
|
+
* @see Matrix2.multiplyByUniformScale
|
|
490
|
+
* @see Matrix2.getScale
|
|
491
|
+
*/
|
|
492
|
+
static setScale(matrix, scale, result) {
|
|
493
|
+
//>>includeStart('debug', pragmas.debug);
|
|
494
|
+
Check.typeOf.object("matrix", matrix);
|
|
495
|
+
Check.typeOf.object("scale", scale);
|
|
496
|
+
Check.typeOf.object("result", result);
|
|
497
|
+
//>>includeEnd('debug');
|
|
432
498
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
* @param {Matrix2} matrix The matrix to use.
|
|
437
|
-
* @param {number} index The zero-based index of the row to retrieve.
|
|
438
|
-
* @param {Cartesian2} result The object onto which to store the result.
|
|
439
|
-
* @returns {Cartesian2} The modified result parameter.
|
|
440
|
-
*
|
|
441
|
-
* @exception {DeveloperError} index must be 0 or 1.
|
|
442
|
-
*/
|
|
443
|
-
Matrix2.getRow = function (matrix, index, result) {
|
|
444
|
-
//>>includeStart('debug', pragmas.debug);
|
|
445
|
-
Check.typeOf.object("matrix", matrix);
|
|
499
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch1);
|
|
500
|
+
const scaleRatioX = scale.x / existingScale.x;
|
|
501
|
+
const scaleRatioY = scale.y / existingScale.y;
|
|
446
502
|
|
|
447
|
-
|
|
448
|
-
|
|
503
|
+
result[0] = matrix[0] * scaleRatioX;
|
|
504
|
+
result[1] = matrix[1] * scaleRatioX;
|
|
505
|
+
result[2] = matrix[2] * scaleRatioY;
|
|
506
|
+
result[3] = matrix[3] * scaleRatioY;
|
|
449
507
|
|
|
450
|
-
|
|
451
|
-
|
|
508
|
+
return result;
|
|
509
|
+
}
|
|
452
510
|
|
|
453
|
-
|
|
454
|
-
|
|
511
|
+
/**
|
|
512
|
+
* Computes a new matrix that replaces the scale with the provided uniform scale.
|
|
513
|
+
* This assumes the matrix is an affine transformation.
|
|
514
|
+
*
|
|
515
|
+
* @param {Matrix2} matrix The matrix to use.
|
|
516
|
+
* @param {number} scale The uniform scale that replaces the scale of the provided matrix.
|
|
517
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
518
|
+
* @returns {Matrix2} The modified result parameter.
|
|
519
|
+
*
|
|
520
|
+
* @see Matrix2.setScale
|
|
521
|
+
* @see Matrix2.fromScale
|
|
522
|
+
* @see Matrix2.fromUniformScale
|
|
523
|
+
* @see Matrix2.multiplyByScale
|
|
524
|
+
* @see Matrix2.multiplyByUniformScale
|
|
525
|
+
* @see Matrix2.getScale
|
|
526
|
+
*/
|
|
527
|
+
static setUniformScale(matrix, scale, result) {
|
|
528
|
+
//>>includeStart('debug', pragmas.debug);
|
|
529
|
+
Check.typeOf.object("matrix", matrix);
|
|
530
|
+
Check.typeOf.number("scale", scale);
|
|
531
|
+
Check.typeOf.object("result", result);
|
|
532
|
+
//>>includeEnd('debug');
|
|
455
533
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
};
|
|
534
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch2);
|
|
535
|
+
const scaleRatioX = scale / existingScale.x;
|
|
536
|
+
const scaleRatioY = scale / existingScale.y;
|
|
460
537
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
*
|
|
464
|
-
|
|
465
|
-
* @param {number} index The zero-based index of the row to set.
|
|
466
|
-
* @param {Cartesian2} cartesian The Cartesian whose values will be assigned to the specified row.
|
|
467
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
468
|
-
* @returns {Matrix2} The modified result parameter.
|
|
469
|
-
*
|
|
470
|
-
* @exception {DeveloperError} index must be 0 or 1.
|
|
471
|
-
*/
|
|
472
|
-
Matrix2.setRow = function (matrix, index, cartesian, result) {
|
|
473
|
-
//>>includeStart('debug', pragmas.debug);
|
|
474
|
-
Check.typeOf.object("matrix", matrix);
|
|
538
|
+
result[0] = matrix[0] * scaleRatioX;
|
|
539
|
+
result[1] = matrix[1] * scaleRatioX;
|
|
540
|
+
result[2] = matrix[2] * scaleRatioY;
|
|
541
|
+
result[3] = matrix[3] * scaleRatioY;
|
|
475
542
|
|
|
476
|
-
|
|
477
|
-
|
|
543
|
+
return result;
|
|
544
|
+
}
|
|
478
545
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
546
|
+
/**
|
|
547
|
+
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
548
|
+
*
|
|
549
|
+
* @param {Matrix2} matrix The matrix.
|
|
550
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
551
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
552
|
+
*
|
|
553
|
+
* @see Matrix2.multiplyByScale
|
|
554
|
+
* @see Matrix2.multiplyByUniformScale
|
|
555
|
+
* @see Matrix2.fromScale
|
|
556
|
+
* @see Matrix2.fromUniformScale
|
|
557
|
+
* @see Matrix2.setScale
|
|
558
|
+
* @see Matrix2.setUniformScale
|
|
559
|
+
*/
|
|
560
|
+
static getScale(matrix, result) {
|
|
561
|
+
//>>includeStart('debug', pragmas.debug);
|
|
562
|
+
Check.typeOf.object("matrix", matrix);
|
|
563
|
+
Check.typeOf.object("result", result);
|
|
564
|
+
//>>includeEnd('debug');
|
|
482
565
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
566
|
+
result.x = Cartesian2.magnitude(
|
|
567
|
+
Cartesian2.fromElements(matrix[0], matrix[1], scratchColumn),
|
|
568
|
+
);
|
|
569
|
+
result.y = Cartesian2.magnitude(
|
|
570
|
+
Cartesian2.fromElements(matrix[2], matrix[3], scratchColumn),
|
|
571
|
+
);
|
|
572
|
+
return result;
|
|
573
|
+
}
|
|
488
574
|
|
|
489
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Computes the maximum scale assuming the matrix is an affine transformation.
|
|
577
|
+
* The maximum scale is the maximum length of the column vectors.
|
|
578
|
+
*
|
|
579
|
+
* @param {Matrix2} matrix The matrix.
|
|
580
|
+
* @returns {number} The maximum scale.
|
|
581
|
+
*/
|
|
582
|
+
static getMaximumScale(matrix) {
|
|
583
|
+
Matrix2.getScale(matrix, scaleScratch3);
|
|
584
|
+
return Cartesian2.maximumComponent(scaleScratch3);
|
|
585
|
+
}
|
|
490
586
|
|
|
491
|
-
/**
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
Matrix2.setScale = function (matrix, scale, result) {
|
|
508
|
-
//>>includeStart('debug', pragmas.debug);
|
|
509
|
-
Check.typeOf.object("matrix", matrix);
|
|
510
|
-
Check.typeOf.object("scale", scale);
|
|
511
|
-
Check.typeOf.object("result", result);
|
|
512
|
-
//>>includeEnd('debug');
|
|
587
|
+
/**
|
|
588
|
+
* Sets the rotation assuming the matrix is an affine transformation.
|
|
589
|
+
*
|
|
590
|
+
* @param {Matrix2} matrix The matrix.
|
|
591
|
+
* @param {Matrix2} rotation The rotation matrix.
|
|
592
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
593
|
+
* @returns {Matrix2} The modified result parameter.
|
|
594
|
+
*
|
|
595
|
+
* @see Matrix2.fromRotation
|
|
596
|
+
* @see Matrix2.getRotation
|
|
597
|
+
*/
|
|
598
|
+
static setRotation(matrix, rotation, result) {
|
|
599
|
+
//>>includeStart('debug', pragmas.debug);
|
|
600
|
+
Check.typeOf.object("matrix", matrix);
|
|
601
|
+
Check.typeOf.object("result", result);
|
|
602
|
+
//>>includeEnd('debug');
|
|
513
603
|
|
|
514
|
-
|
|
515
|
-
const scaleRatioX = scale.x / existingScale.x;
|
|
516
|
-
const scaleRatioY = scale.y / existingScale.y;
|
|
604
|
+
const scale = Matrix2.getScale(matrix, scaleScratch4);
|
|
517
605
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
606
|
+
result[0] = rotation[0] * scale.x;
|
|
607
|
+
result[1] = rotation[1] * scale.x;
|
|
608
|
+
result[2] = rotation[2] * scale.y;
|
|
609
|
+
result[3] = rotation[3] * scale.y;
|
|
522
610
|
|
|
523
|
-
|
|
524
|
-
}
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
525
613
|
|
|
526
|
-
|
|
614
|
+
/**
|
|
615
|
+
* Extracts the rotation matrix assuming the matrix is an affine transformation.
|
|
616
|
+
*
|
|
617
|
+
* @param {Matrix2} matrix The matrix.
|
|
618
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
619
|
+
* @returns {Matrix2} The modified result parameter.
|
|
620
|
+
*
|
|
621
|
+
* @see Matrix2.setRotation
|
|
622
|
+
* @see Matrix2.fromRotation
|
|
623
|
+
*/
|
|
624
|
+
static getRotation(matrix, result) {
|
|
625
|
+
//>>includeStart('debug', pragmas.debug);
|
|
626
|
+
Check.typeOf.object("matrix", matrix);
|
|
627
|
+
Check.typeOf.object("result", result);
|
|
628
|
+
//>>includeEnd('debug');
|
|
527
629
|
|
|
528
|
-
|
|
529
|
-
* Computes a new matrix that replaces the scale with the provided uniform scale.
|
|
530
|
-
* This assumes the matrix is an affine transformation.
|
|
531
|
-
*
|
|
532
|
-
* @param {Matrix2} matrix The matrix to use.
|
|
533
|
-
* @param {number} scale The uniform scale that replaces the scale of the provided matrix.
|
|
534
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
535
|
-
* @returns {Matrix2} The modified result parameter.
|
|
536
|
-
*
|
|
537
|
-
* @see Matrix2.setScale
|
|
538
|
-
* @see Matrix2.fromScale
|
|
539
|
-
* @see Matrix2.fromUniformScale
|
|
540
|
-
* @see Matrix2.multiplyByScale
|
|
541
|
-
* @see Matrix2.multiplyByUniformScale
|
|
542
|
-
* @see Matrix2.getScale
|
|
543
|
-
*/
|
|
544
|
-
Matrix2.setUniformScale = function (matrix, scale, result) {
|
|
545
|
-
//>>includeStart('debug', pragmas.debug);
|
|
546
|
-
Check.typeOf.object("matrix", matrix);
|
|
547
|
-
Check.typeOf.number("scale", scale);
|
|
548
|
-
Check.typeOf.object("result", result);
|
|
549
|
-
//>>includeEnd('debug');
|
|
630
|
+
const scale = Matrix2.getScale(matrix, scaleScratch5);
|
|
550
631
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
632
|
+
result[0] = matrix[0] / scale.x;
|
|
633
|
+
result[1] = matrix[1] / scale.x;
|
|
634
|
+
result[2] = matrix[2] / scale.y;
|
|
635
|
+
result[3] = matrix[3] / scale.y;
|
|
554
636
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
result[2] = matrix[2] * scaleRatioY;
|
|
558
|
-
result[3] = matrix[3] * scaleRatioY;
|
|
637
|
+
return result;
|
|
638
|
+
}
|
|
559
639
|
|
|
560
|
-
|
|
561
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Computes the product of two matrices.
|
|
642
|
+
*
|
|
643
|
+
* @param {Matrix2} left The first matrix.
|
|
644
|
+
* @param {Matrix2} right The second matrix.
|
|
645
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
646
|
+
* @returns {Matrix2} The modified result parameter.
|
|
647
|
+
*/
|
|
648
|
+
static multiply(left, right, result) {
|
|
649
|
+
//>>includeStart('debug', pragmas.debug);
|
|
650
|
+
Check.typeOf.object("left", left);
|
|
651
|
+
Check.typeOf.object("right", right);
|
|
652
|
+
Check.typeOf.object("result", result);
|
|
653
|
+
//>>includeEnd('debug');
|
|
562
654
|
|
|
563
|
-
const
|
|
655
|
+
const column0Row0 = left[0] * right[0] + left[2] * right[1];
|
|
656
|
+
const column1Row0 = left[0] * right[2] + left[2] * right[3];
|
|
657
|
+
const column0Row1 = left[1] * right[0] + left[3] * right[1];
|
|
658
|
+
const column1Row1 = left[1] * right[2] + left[3] * right[3];
|
|
564
659
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
*
|
|
572
|
-
* @see Matrix2.multiplyByScale
|
|
573
|
-
* @see Matrix2.multiplyByUniformScale
|
|
574
|
-
* @see Matrix2.fromScale
|
|
575
|
-
* @see Matrix2.fromUniformScale
|
|
576
|
-
* @see Matrix2.setScale
|
|
577
|
-
* @see Matrix2.setUniformScale
|
|
578
|
-
*/
|
|
579
|
-
Matrix2.getScale = function (matrix, result) {
|
|
580
|
-
//>>includeStart('debug', pragmas.debug);
|
|
581
|
-
Check.typeOf.object("matrix", matrix);
|
|
582
|
-
Check.typeOf.object("result", result);
|
|
583
|
-
//>>includeEnd('debug');
|
|
584
|
-
|
|
585
|
-
result.x = Cartesian2.magnitude(
|
|
586
|
-
Cartesian2.fromElements(matrix[0], matrix[1], scratchColumn),
|
|
587
|
-
);
|
|
588
|
-
result.y = Cartesian2.magnitude(
|
|
589
|
-
Cartesian2.fromElements(matrix[2], matrix[3], scratchColumn),
|
|
590
|
-
);
|
|
591
|
-
return result;
|
|
592
|
-
};
|
|
660
|
+
result[0] = column0Row0;
|
|
661
|
+
result[1] = column0Row1;
|
|
662
|
+
result[2] = column1Row0;
|
|
663
|
+
result[3] = column1Row1;
|
|
664
|
+
return result;
|
|
665
|
+
}
|
|
593
666
|
|
|
594
|
-
|
|
667
|
+
/**
|
|
668
|
+
* Computes the sum of two matrices.
|
|
669
|
+
*
|
|
670
|
+
* @param {Matrix2} left The first matrix.
|
|
671
|
+
* @param {Matrix2} right The second matrix.
|
|
672
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
673
|
+
* @returns {Matrix2} The modified result parameter.
|
|
674
|
+
*/
|
|
675
|
+
static add(left, right, result) {
|
|
676
|
+
//>>includeStart('debug', pragmas.debug);
|
|
677
|
+
Check.typeOf.object("left", left);
|
|
678
|
+
Check.typeOf.object("right", right);
|
|
679
|
+
Check.typeOf.object("result", result);
|
|
680
|
+
//>>includeEnd('debug');
|
|
595
681
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
*/
|
|
603
|
-
Matrix2.getMaximumScale = function (matrix) {
|
|
604
|
-
Matrix2.getScale(matrix, scaleScratch3);
|
|
605
|
-
return Cartesian2.maximumComponent(scaleScratch3);
|
|
606
|
-
};
|
|
682
|
+
result[0] = left[0] + right[0];
|
|
683
|
+
result[1] = left[1] + right[1];
|
|
684
|
+
result[2] = left[2] + right[2];
|
|
685
|
+
result[3] = left[3] + right[3];
|
|
686
|
+
return result;
|
|
687
|
+
}
|
|
607
688
|
|
|
608
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Computes the difference of two matrices.
|
|
691
|
+
*
|
|
692
|
+
* @param {Matrix2} left The first matrix.
|
|
693
|
+
* @param {Matrix2} right The second matrix.
|
|
694
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
695
|
+
* @returns {Matrix2} The modified result parameter.
|
|
696
|
+
*/
|
|
697
|
+
static subtract(left, right, result) {
|
|
698
|
+
//>>includeStart('debug', pragmas.debug);
|
|
699
|
+
Check.typeOf.object("left", left);
|
|
700
|
+
Check.typeOf.object("right", right);
|
|
701
|
+
Check.typeOf.object("result", result);
|
|
702
|
+
//>>includeEnd('debug');
|
|
609
703
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
* @returns {Matrix2} The modified result parameter.
|
|
617
|
-
*
|
|
618
|
-
* @see Matrix2.fromRotation
|
|
619
|
-
* @see Matrix2.getRotation
|
|
620
|
-
*/
|
|
621
|
-
Matrix2.setRotation = function (matrix, rotation, result) {
|
|
622
|
-
//>>includeStart('debug', pragmas.debug);
|
|
623
|
-
Check.typeOf.object("matrix", matrix);
|
|
624
|
-
Check.typeOf.object("result", result);
|
|
625
|
-
//>>includeEnd('debug');
|
|
704
|
+
result[0] = left[0] - right[0];
|
|
705
|
+
result[1] = left[1] - right[1];
|
|
706
|
+
result[2] = left[2] - right[2];
|
|
707
|
+
result[3] = left[3] - right[3];
|
|
708
|
+
return result;
|
|
709
|
+
}
|
|
626
710
|
|
|
627
|
-
|
|
711
|
+
/**
|
|
712
|
+
* Computes the product of a matrix and a column vector.
|
|
713
|
+
*
|
|
714
|
+
* @param {Matrix2} matrix The matrix.
|
|
715
|
+
* @param {Cartesian2} cartesian The column.
|
|
716
|
+
* @param {Cartesian2} result The object onto which to store the result.
|
|
717
|
+
* @returns {Cartesian2} The modified result parameter.
|
|
718
|
+
*/
|
|
719
|
+
static multiplyByVector(matrix, cartesian, result) {
|
|
720
|
+
//>>includeStart('debug', pragmas.debug);
|
|
721
|
+
Check.typeOf.object("matrix", matrix);
|
|
722
|
+
Check.typeOf.object("cartesian", cartesian);
|
|
723
|
+
Check.typeOf.object("result", result);
|
|
724
|
+
//>>includeEnd('debug');
|
|
628
725
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
result[2] = rotation[2] * scale.y;
|
|
632
|
-
result[3] = rotation[3] * scale.y;
|
|
726
|
+
const x = matrix[0] * cartesian.x + matrix[2] * cartesian.y;
|
|
727
|
+
const y = matrix[1] * cartesian.x + matrix[3] * cartesian.y;
|
|
633
728
|
|
|
634
|
-
|
|
635
|
-
|
|
729
|
+
result.x = x;
|
|
730
|
+
result.y = y;
|
|
731
|
+
return result;
|
|
732
|
+
}
|
|
636
733
|
|
|
637
|
-
|
|
734
|
+
/**
|
|
735
|
+
* Computes the product of a matrix and a scalar.
|
|
736
|
+
*
|
|
737
|
+
* @param {Matrix2} matrix The matrix.
|
|
738
|
+
* @param {number} scalar The number to multiply by.
|
|
739
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
740
|
+
* @returns {Matrix2} The modified result parameter.
|
|
741
|
+
*/
|
|
742
|
+
static multiplyByScalar(matrix, scalar, result) {
|
|
743
|
+
//>>includeStart('debug', pragmas.debug);
|
|
744
|
+
Check.typeOf.object("matrix", matrix);
|
|
745
|
+
Check.typeOf.number("scalar", scalar);
|
|
746
|
+
Check.typeOf.object("result", result);
|
|
747
|
+
//>>includeEnd('debug');
|
|
638
748
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
*
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
*
|
|
646
|
-
* @see Matrix2.setRotation
|
|
647
|
-
* @see Matrix2.fromRotation
|
|
648
|
-
*/
|
|
649
|
-
Matrix2.getRotation = function (matrix, result) {
|
|
650
|
-
//>>includeStart('debug', pragmas.debug);
|
|
651
|
-
Check.typeOf.object("matrix", matrix);
|
|
652
|
-
Check.typeOf.object("result", result);
|
|
653
|
-
//>>includeEnd('debug');
|
|
749
|
+
result[0] = matrix[0] * scalar;
|
|
750
|
+
result[1] = matrix[1] * scalar;
|
|
751
|
+
result[2] = matrix[2] * scalar;
|
|
752
|
+
result[3] = matrix[3] * scalar;
|
|
753
|
+
return result;
|
|
754
|
+
}
|
|
654
755
|
|
|
655
|
-
|
|
756
|
+
/**
|
|
757
|
+
* Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
|
758
|
+
*
|
|
759
|
+
* @param {Matrix2} matrix The matrix on the left-hand side.
|
|
760
|
+
* @param {Cartesian2} scale The non-uniform scale on the right-hand side.
|
|
761
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
762
|
+
* @returns {Matrix2} The modified result parameter.
|
|
763
|
+
*
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
|
|
767
|
+
* Cesium.Matrix2.multiplyByScale(m, scale, m);
|
|
768
|
+
*
|
|
769
|
+
* @see Matrix2.multiplyByUniformScale
|
|
770
|
+
* @see Matrix2.fromScale
|
|
771
|
+
* @see Matrix2.fromUniformScale
|
|
772
|
+
* @see Matrix2.setScale
|
|
773
|
+
* @see Matrix2.setUniformScale
|
|
774
|
+
* @see Matrix2.getScale
|
|
775
|
+
*/
|
|
776
|
+
static multiplyByScale(matrix, scale, result) {
|
|
777
|
+
//>>includeStart('debug', pragmas.debug);
|
|
778
|
+
Check.typeOf.object("matrix", matrix);
|
|
779
|
+
Check.typeOf.object("scale", scale);
|
|
780
|
+
Check.typeOf.object("result", result);
|
|
781
|
+
//>>includeEnd('debug');
|
|
656
782
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
783
|
+
result[0] = matrix[0] * scale.x;
|
|
784
|
+
result[1] = matrix[1] * scale.x;
|
|
785
|
+
result[2] = matrix[2] * scale.y;
|
|
786
|
+
result[3] = matrix[3] * scale.y;
|
|
661
787
|
|
|
662
|
-
|
|
663
|
-
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
664
790
|
|
|
665
|
-
/**
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
};
|
|
791
|
+
/**
|
|
792
|
+
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
|
|
793
|
+
*
|
|
794
|
+
* @param {Matrix2} matrix The matrix on the left-hand side.
|
|
795
|
+
* @param {number} scale The uniform scale on the right-hand side.
|
|
796
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
797
|
+
* @returns {Matrix2} The modified result parameter.
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromUniformScale(scale), m);
|
|
801
|
+
* Cesium.Matrix2.multiplyByUniformScale(m, scale, m);
|
|
802
|
+
*
|
|
803
|
+
* @see Matrix2.multiplyByScale
|
|
804
|
+
* @see Matrix2.fromScale
|
|
805
|
+
* @see Matrix2.fromUniformScale
|
|
806
|
+
* @see Matrix2.setScale
|
|
807
|
+
* @see Matrix2.setUniformScale
|
|
808
|
+
* @see Matrix2.getScale
|
|
809
|
+
*/
|
|
810
|
+
static multiplyByUniformScale(matrix, scale, result) {
|
|
811
|
+
//>>includeStart('debug', pragmas.debug);
|
|
812
|
+
Check.typeOf.object("matrix", matrix);
|
|
813
|
+
Check.typeOf.number("scale", scale);
|
|
814
|
+
Check.typeOf.object("result", result);
|
|
815
|
+
//>>includeEnd('debug');
|
|
691
816
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
|
|
696
|
-
* @param {Matrix2} right The second matrix.
|
|
697
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
698
|
-
* @returns {Matrix2} The modified result parameter.
|
|
699
|
-
*/
|
|
700
|
-
Matrix2.add = function (left, right, result) {
|
|
701
|
-
//>>includeStart('debug', pragmas.debug);
|
|
702
|
-
Check.typeOf.object("left", left);
|
|
703
|
-
Check.typeOf.object("right", right);
|
|
704
|
-
Check.typeOf.object("result", result);
|
|
705
|
-
//>>includeEnd('debug');
|
|
706
|
-
|
|
707
|
-
result[0] = left[0] + right[0];
|
|
708
|
-
result[1] = left[1] + right[1];
|
|
709
|
-
result[2] = left[2] + right[2];
|
|
710
|
-
result[3] = left[3] + right[3];
|
|
711
|
-
return result;
|
|
712
|
-
};
|
|
817
|
+
result[0] = matrix[0] * scale;
|
|
818
|
+
result[1] = matrix[1] * scale;
|
|
819
|
+
result[2] = matrix[2] * scale;
|
|
820
|
+
result[3] = matrix[3] * scale;
|
|
713
821
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
*
|
|
717
|
-
* @param {Matrix2} left The first matrix.
|
|
718
|
-
* @param {Matrix2} right The second matrix.
|
|
719
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
720
|
-
* @returns {Matrix2} The modified result parameter.
|
|
721
|
-
*/
|
|
722
|
-
Matrix2.subtract = function (left, right, result) {
|
|
723
|
-
//>>includeStart('debug', pragmas.debug);
|
|
724
|
-
Check.typeOf.object("left", left);
|
|
725
|
-
Check.typeOf.object("right", right);
|
|
726
|
-
Check.typeOf.object("result", result);
|
|
727
|
-
//>>includeEnd('debug');
|
|
728
|
-
|
|
729
|
-
result[0] = left[0] - right[0];
|
|
730
|
-
result[1] = left[1] - right[1];
|
|
731
|
-
result[2] = left[2] - right[2];
|
|
732
|
-
result[3] = left[3] - right[3];
|
|
733
|
-
return result;
|
|
734
|
-
};
|
|
822
|
+
return result;
|
|
823
|
+
}
|
|
735
824
|
|
|
736
|
-
/**
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
Check.typeOf.object("result", result);
|
|
749
|
-
//>>includeEnd('debug');
|
|
825
|
+
/**
|
|
826
|
+
* Creates a negated copy of the provided matrix.
|
|
827
|
+
*
|
|
828
|
+
* @param {Matrix2} matrix The matrix to negate.
|
|
829
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
830
|
+
* @returns {Matrix2} The modified result parameter.
|
|
831
|
+
*/
|
|
832
|
+
static negate(matrix, result) {
|
|
833
|
+
//>>includeStart('debug', pragmas.debug);
|
|
834
|
+
Check.typeOf.object("matrix", matrix);
|
|
835
|
+
Check.typeOf.object("result", result);
|
|
836
|
+
//>>includeEnd('debug');
|
|
750
837
|
|
|
751
|
-
|
|
752
|
-
|
|
838
|
+
result[0] = -matrix[0];
|
|
839
|
+
result[1] = -matrix[1];
|
|
840
|
+
result[2] = -matrix[2];
|
|
841
|
+
result[3] = -matrix[3];
|
|
842
|
+
return result;
|
|
843
|
+
}
|
|
753
844
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
845
|
+
/**
|
|
846
|
+
* Computes the transpose of the provided matrix.
|
|
847
|
+
*
|
|
848
|
+
* @param {Matrix2} matrix The matrix to transpose.
|
|
849
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
850
|
+
* @returns {Matrix2} The modified result parameter.
|
|
851
|
+
*/
|
|
852
|
+
static transpose(matrix, result) {
|
|
853
|
+
//>>includeStart('debug', pragmas.debug);
|
|
854
|
+
Check.typeOf.object("matrix", matrix);
|
|
855
|
+
Check.typeOf.object("result", result);
|
|
856
|
+
//>>includeEnd('debug');
|
|
758
857
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
* @param {number} scalar The number to multiply by.
|
|
764
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
765
|
-
* @returns {Matrix2} The modified result parameter.
|
|
766
|
-
*/
|
|
767
|
-
Matrix2.multiplyByScalar = function (matrix, scalar, result) {
|
|
768
|
-
//>>includeStart('debug', pragmas.debug);
|
|
769
|
-
Check.typeOf.object("matrix", matrix);
|
|
770
|
-
Check.typeOf.number("scalar", scalar);
|
|
771
|
-
Check.typeOf.object("result", result);
|
|
772
|
-
//>>includeEnd('debug');
|
|
773
|
-
|
|
774
|
-
result[0] = matrix[0] * scalar;
|
|
775
|
-
result[1] = matrix[1] * scalar;
|
|
776
|
-
result[2] = matrix[2] * scalar;
|
|
777
|
-
result[3] = matrix[3] * scalar;
|
|
778
|
-
return result;
|
|
779
|
-
};
|
|
858
|
+
const column0Row0 = matrix[0];
|
|
859
|
+
const column0Row1 = matrix[2];
|
|
860
|
+
const column1Row0 = matrix[1];
|
|
861
|
+
const column1Row1 = matrix[3];
|
|
780
862
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
* @returns {Matrix2} The modified result parameter.
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
* @example
|
|
791
|
-
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
|
|
792
|
-
* Cesium.Matrix2.multiplyByScale(m, scale, m);
|
|
793
|
-
*
|
|
794
|
-
* @see Matrix2.multiplyByUniformScale
|
|
795
|
-
* @see Matrix2.fromScale
|
|
796
|
-
* @see Matrix2.fromUniformScale
|
|
797
|
-
* @see Matrix2.setScale
|
|
798
|
-
* @see Matrix2.setUniformScale
|
|
799
|
-
* @see Matrix2.getScale
|
|
800
|
-
*/
|
|
801
|
-
Matrix2.multiplyByScale = function (matrix, scale, result) {
|
|
802
|
-
//>>includeStart('debug', pragmas.debug);
|
|
803
|
-
Check.typeOf.object("matrix", matrix);
|
|
804
|
-
Check.typeOf.object("scale", scale);
|
|
805
|
-
Check.typeOf.object("result", result);
|
|
806
|
-
//>>includeEnd('debug');
|
|
863
|
+
result[0] = column0Row0;
|
|
864
|
+
result[1] = column0Row1;
|
|
865
|
+
result[2] = column1Row0;
|
|
866
|
+
result[3] = column1Row1;
|
|
867
|
+
return result;
|
|
868
|
+
}
|
|
807
869
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
870
|
+
/**
|
|
871
|
+
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
|
872
|
+
*
|
|
873
|
+
* @param {Matrix2} matrix The matrix with signed elements.
|
|
874
|
+
* @param {Matrix2} result The object onto which to store the result.
|
|
875
|
+
* @returns {Matrix2} The modified result parameter.
|
|
876
|
+
*/
|
|
877
|
+
static abs(matrix, result) {
|
|
878
|
+
//>>includeStart('debug', pragmas.debug);
|
|
879
|
+
Check.typeOf.object("matrix", matrix);
|
|
880
|
+
Check.typeOf.object("result", result);
|
|
881
|
+
//>>includeEnd('debug');
|
|
812
882
|
|
|
813
|
-
|
|
814
|
-
|
|
883
|
+
result[0] = Math.abs(matrix[0]);
|
|
884
|
+
result[1] = Math.abs(matrix[1]);
|
|
885
|
+
result[2] = Math.abs(matrix[2]);
|
|
886
|
+
result[3] = Math.abs(matrix[3]);
|
|
815
887
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
*
|
|
819
|
-
* @param {Matrix2} matrix The matrix on the left-hand side.
|
|
820
|
-
* @param {number} scale The uniform scale on the right-hand side.
|
|
821
|
-
* @param {Matrix2} result The object onto which to store the result.
|
|
822
|
-
* @returns {Matrix2} The modified result parameter.
|
|
823
|
-
*
|
|
824
|
-
* @example
|
|
825
|
-
* // Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromUniformScale(scale), m);
|
|
826
|
-
* Cesium.Matrix2.multiplyByUniformScale(m, scale, m);
|
|
827
|
-
*
|
|
828
|
-
* @see Matrix2.multiplyByScale
|
|
829
|
-
* @see Matrix2.fromScale
|
|
830
|
-
* @see Matrix2.fromUniformScale
|
|
831
|
-
* @see Matrix2.setScale
|
|
832
|
-
* @see Matrix2.setUniformScale
|
|
833
|
-
* @see Matrix2.getScale
|
|
834
|
-
*/
|
|
835
|
-
Matrix2.multiplyByUniformScale = function (matrix, scale, result) {
|
|
836
|
-
//>>includeStart('debug', pragmas.debug);
|
|
837
|
-
Check.typeOf.object("matrix", matrix);
|
|
838
|
-
Check.typeOf.number("scale", scale);
|
|
839
|
-
Check.typeOf.object("result", result);
|
|
840
|
-
//>>includeEnd('debug');
|
|
888
|
+
return result;
|
|
889
|
+
}
|
|
841
890
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
891
|
+
/**
|
|
892
|
+
* Compares the provided matrices componentwise and returns
|
|
893
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
894
|
+
*
|
|
895
|
+
* @param {Matrix2} [left] The first matrix.
|
|
896
|
+
* @param {Matrix2} [right] The second matrix.
|
|
897
|
+
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
898
|
+
*/
|
|
899
|
+
static equals(left, right) {
|
|
900
|
+
return (
|
|
901
|
+
left === right ||
|
|
902
|
+
(defined(left) &&
|
|
903
|
+
defined(right) &&
|
|
904
|
+
left[0] === right[0] &&
|
|
905
|
+
left[1] === right[1] &&
|
|
906
|
+
left[2] === right[2] &&
|
|
907
|
+
left[3] === right[3])
|
|
908
|
+
);
|
|
909
|
+
}
|
|
846
910
|
|
|
847
|
-
|
|
848
|
-
|
|
911
|
+
/**
|
|
912
|
+
* Compares provided matrix and array, starting from a given array offset.
|
|
913
|
+
*
|
|
914
|
+
* @param {Matrix2} matrix
|
|
915
|
+
* @param {number[]} array
|
|
916
|
+
* @param {number} offset
|
|
917
|
+
* @private
|
|
918
|
+
*/
|
|
919
|
+
static equalsArray(matrix, array, offset) {
|
|
920
|
+
return (
|
|
921
|
+
matrix[0] === array[offset] &&
|
|
922
|
+
matrix[1] === array[offset + 1] &&
|
|
923
|
+
matrix[2] === array[offset + 2] &&
|
|
924
|
+
matrix[3] === array[offset + 3]
|
|
925
|
+
);
|
|
926
|
+
}
|
|
849
927
|
|
|
850
|
-
/**
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
928
|
+
/**
|
|
929
|
+
* Compares the provided matrices componentwise and returns
|
|
930
|
+
* <code>true</code> if they are within the provided epsilon,
|
|
931
|
+
* <code>false</code> otherwise.
|
|
932
|
+
*
|
|
933
|
+
* @param {Matrix2} [left] The first matrix.
|
|
934
|
+
* @param {Matrix2} [right] The second matrix.
|
|
935
|
+
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
936
|
+
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
|
937
|
+
*/
|
|
938
|
+
static equalsEpsilon(left, right, epsilon) {
|
|
939
|
+
epsilon = epsilon ?? 0;
|
|
940
|
+
return (
|
|
941
|
+
left === right ||
|
|
942
|
+
(defined(left) &&
|
|
943
|
+
defined(right) &&
|
|
944
|
+
Math.abs(left[0] - right[0]) <= epsilon &&
|
|
945
|
+
Math.abs(left[1] - right[1]) <= epsilon &&
|
|
946
|
+
Math.abs(left[2] - right[2]) <= epsilon &&
|
|
947
|
+
Math.abs(left[3] - right[3]) <= epsilon)
|
|
948
|
+
);
|
|
949
|
+
}
|
|
869
950
|
|
|
870
|
-
/**
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
//>>includeStart('debug', pragmas.debug);
|
|
879
|
-
Check.typeOf.object("matrix", matrix);
|
|
880
|
-
Check.typeOf.object("result", result);
|
|
881
|
-
//>>includeEnd('debug');
|
|
882
|
-
|
|
883
|
-
const column0Row0 = matrix[0];
|
|
884
|
-
const column0Row1 = matrix[2];
|
|
885
|
-
const column1Row0 = matrix[1];
|
|
886
|
-
const column1Row1 = matrix[3];
|
|
887
|
-
|
|
888
|
-
result[0] = column0Row0;
|
|
889
|
-
result[1] = column0Row1;
|
|
890
|
-
result[2] = column1Row0;
|
|
891
|
-
result[3] = column1Row1;
|
|
892
|
-
return result;
|
|
893
|
-
};
|
|
951
|
+
/**
|
|
952
|
+
* Gets the number of items in the collection.
|
|
953
|
+
*
|
|
954
|
+
* @type {number}
|
|
955
|
+
*/
|
|
956
|
+
get length() {
|
|
957
|
+
return Matrix2.packedLength;
|
|
958
|
+
}
|
|
894
959
|
|
|
895
|
-
/**
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
Matrix2.
|
|
903
|
-
|
|
904
|
-
Check.typeOf.object("matrix", matrix);
|
|
905
|
-
Check.typeOf.object("result", result);
|
|
906
|
-
//>>includeEnd('debug');
|
|
960
|
+
/**
|
|
961
|
+
* Duplicates the provided Matrix2 instance.
|
|
962
|
+
*
|
|
963
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
|
964
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
965
|
+
*/
|
|
966
|
+
clone(result) {
|
|
967
|
+
return Matrix2.clone(this, result);
|
|
968
|
+
}
|
|
907
969
|
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
970
|
+
/**
|
|
971
|
+
* Compares this matrix to the provided matrix componentwise and returns
|
|
972
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
973
|
+
*
|
|
974
|
+
* @param {Matrix2} [right] The right hand side matrix.
|
|
975
|
+
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
976
|
+
*/
|
|
977
|
+
equals(right) {
|
|
978
|
+
return Matrix2.equals(this, right);
|
|
979
|
+
}
|
|
912
980
|
|
|
913
|
-
|
|
914
|
-
|
|
981
|
+
/**
|
|
982
|
+
* Compares this matrix to the provided matrix componentwise and returns
|
|
983
|
+
* <code>true</code> if they are within the provided epsilon,
|
|
984
|
+
* <code>false</code> otherwise.
|
|
985
|
+
*
|
|
986
|
+
* @param {Matrix2} [right] The right hand side matrix.
|
|
987
|
+
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
988
|
+
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
|
989
|
+
*/
|
|
990
|
+
equalsEpsilon(right, epsilon) {
|
|
991
|
+
return Matrix2.equalsEpsilon(this, right, epsilon);
|
|
992
|
+
}
|
|
915
993
|
|
|
916
|
-
/**
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
left === right ||
|
|
927
|
-
(defined(left) &&
|
|
928
|
-
defined(right) &&
|
|
929
|
-
left[0] === right[0] &&
|
|
930
|
-
left[1] === right[1] &&
|
|
931
|
-
left[2] === right[2] &&
|
|
932
|
-
left[3] === right[3])
|
|
933
|
-
);
|
|
934
|
-
};
|
|
994
|
+
/**
|
|
995
|
+
* Creates a string representing this Matrix with each row being
|
|
996
|
+
* on a separate line and in the format '(column0, column1)'.
|
|
997
|
+
*
|
|
998
|
+
* @returns {string} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1)'.
|
|
999
|
+
*/
|
|
1000
|
+
toString() {
|
|
1001
|
+
return `(${this[0]}, ${this[2]})\n` + `(${this[1]}, ${this[3]})`;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
935
1004
|
|
|
936
1005
|
/**
|
|
937
|
-
*
|
|
1006
|
+
* The number of elements used to pack the object into an array.
|
|
1007
|
+
* @type {number}
|
|
938
1008
|
*/
|
|
939
|
-
Matrix2.
|
|
940
|
-
return (
|
|
941
|
-
matrix[0] === array[offset] &&
|
|
942
|
-
matrix[1] === array[offset + 1] &&
|
|
943
|
-
matrix[2] === array[offset + 2] &&
|
|
944
|
-
matrix[3] === array[offset + 3]
|
|
945
|
-
);
|
|
946
|
-
};
|
|
1009
|
+
Matrix2.packedLength = 4;
|
|
947
1010
|
|
|
948
1011
|
/**
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
1012
|
+
* Creates a Matrix2 from 4 consecutive elements in an array.
|
|
1013
|
+
*
|
|
1014
|
+
* @function
|
|
1015
|
+
* @param {number[]} array The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
|
|
1016
|
+
* @param {number} [startingIndex=0] The offset into the array of the first element, which corresponds to first column first row position in the matrix.
|
|
1017
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
|
1018
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
952
1019
|
*
|
|
953
|
-
* @
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
*
|
|
1020
|
+
* @example
|
|
1021
|
+
* // Create the Matrix2:
|
|
1022
|
+
* // [1.0, 2.0]
|
|
1023
|
+
* // [1.0, 2.0]
|
|
1024
|
+
*
|
|
1025
|
+
* const v = [1.0, 1.0, 2.0, 2.0];
|
|
1026
|
+
* const m = Cesium.Matrix2.fromArray(v);
|
|
1027
|
+
*
|
|
1028
|
+
* // Create same Matrix2 with using an offset into an array
|
|
1029
|
+
* const v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
|
|
1030
|
+
* const m2 = Cesium.Matrix2.fromArray(v2, 2);
|
|
957
1031
|
*/
|
|
958
|
-
Matrix2.
|
|
959
|
-
epsilon = epsilon ?? 0;
|
|
960
|
-
return (
|
|
961
|
-
left === right ||
|
|
962
|
-
(defined(left) &&
|
|
963
|
-
defined(right) &&
|
|
964
|
-
Math.abs(left[0] - right[0]) <= epsilon &&
|
|
965
|
-
Math.abs(left[1] - right[1]) <= epsilon &&
|
|
966
|
-
Math.abs(left[2] - right[2]) <= epsilon &&
|
|
967
|
-
Math.abs(left[3] - right[3]) <= epsilon)
|
|
968
|
-
);
|
|
969
|
-
};
|
|
1032
|
+
Matrix2.fromArray = Matrix2.unpack;
|
|
970
1033
|
|
|
971
1034
|
/**
|
|
972
1035
|
* An immutable Matrix2 instance initialized to the identity matrix.
|
|
@@ -1032,61 +1095,11 @@ Matrix2.COLUMN1ROW0 = 2;
|
|
|
1032
1095
|
*/
|
|
1033
1096
|
Matrix2.COLUMN1ROW1 = 3;
|
|
1034
1097
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
*/
|
|
1042
|
-
length: {
|
|
1043
|
-
get: function () {
|
|
1044
|
-
return Matrix2.packedLength;
|
|
1045
|
-
},
|
|
1046
|
-
},
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* Duplicates the provided Matrix2 instance.
|
|
1051
|
-
*
|
|
1052
|
-
* @param {Matrix2} [result] The object onto which to store the result.
|
|
1053
|
-
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
|
1054
|
-
*/
|
|
1055
|
-
Matrix2.prototype.clone = function (result) {
|
|
1056
|
-
return Matrix2.clone(this, result);
|
|
1057
|
-
};
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Compares this matrix to the provided matrix componentwise and returns
|
|
1061
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
1062
|
-
*
|
|
1063
|
-
* @param {Matrix2} [right] The right hand side matrix.
|
|
1064
|
-
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
1065
|
-
*/
|
|
1066
|
-
Matrix2.prototype.equals = function (right) {
|
|
1067
|
-
return Matrix2.equals(this, right);
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Compares this matrix to the provided matrix componentwise and returns
|
|
1072
|
-
* <code>true</code> if they are within the provided epsilon,
|
|
1073
|
-
* <code>false</code> otherwise.
|
|
1074
|
-
*
|
|
1075
|
-
* @param {Matrix2} [right] The right hand side matrix.
|
|
1076
|
-
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
|
1077
|
-
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
|
1078
|
-
*/
|
|
1079
|
-
Matrix2.prototype.equalsEpsilon = function (right, epsilon) {
|
|
1080
|
-
return Matrix2.equalsEpsilon(this, right, epsilon);
|
|
1081
|
-
};
|
|
1098
|
+
const scaleScratch1 = new Cartesian2();
|
|
1099
|
+
const scaleScratch2 = new Cartesian2();
|
|
1100
|
+
const scratchColumn = new Cartesian2();
|
|
1101
|
+
const scaleScratch3 = new Cartesian2();
|
|
1102
|
+
const scaleScratch4 = new Cartesian2();
|
|
1103
|
+
const scaleScratch5 = new Cartesian2();
|
|
1082
1104
|
|
|
1083
|
-
/**
|
|
1084
|
-
* Creates a string representing this Matrix with each row being
|
|
1085
|
-
* on a separate line and in the format '(column0, column1)'.
|
|
1086
|
-
*
|
|
1087
|
-
* @returns {string} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1)'.
|
|
1088
|
-
*/
|
|
1089
|
-
Matrix2.prototype.toString = function () {
|
|
1090
|
-
return `(${this[0]}, ${this[2]})\n` + `(${this[1]}, ${this[3]})`;
|
|
1091
|
-
};
|
|
1092
1105
|
export default Matrix2;
|