@cesium/engine 22.2.0 → 23.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-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
- package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
- 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 +22 -22
- 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 +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/BoxGeometry.js +1 -1
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/CornerType.js +1 -1
- package/Source/Core/CorridorGeometry.js +1 -1
- package/Source/Core/FeatureDetection.js +1 -32
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/IntersectionTests.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometry.js +1 -1
- package/Source/Core/RectangleGeometry.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +4 -8
- package/Source/Core/TerrainMesh.js +11 -8
- package/Source/Core/TerrainPicker.js +24 -7
- package/Source/Core/VideoSynchronizer.js +1 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Core/writeTextToCanvas.js +40 -86
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BoxGraphics.js +1 -1
- package/Source/DataSources/CallbackPositionProperty.js +1 -1
- package/Source/DataSources/CorridorGraphics.js +1 -1
- package/Source/DataSources/CzmlDataSource.js +1 -1
- package/Source/DataSources/EllipseGraphics.js +1 -1
- package/Source/DataSources/EllipsoidGraphics.js +1 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/EntityCluster.js +2 -2
- package/Source/DataSources/GeoJsonDataSource.js +2 -2
- package/Source/DataSources/GpxDataSource.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -1
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +1 -1
- package/Source/DataSources/ModelGraphics.js +1 -1
- package/Source/DataSources/PlaneGraphics.js +1 -1
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/DataSources/PolylineGraphics.js +1 -1
- package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
- package/Source/DataSources/RectangleGraphics.js +1 -1
- package/Source/DataSources/WallGraphics.js +1 -1
- package/Source/DataSources/exportKml.js +1 -1
- package/Source/Renderer/Context.js +11 -10
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Renderer/ShaderSource.js +19 -18
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +2 -2
- package/Source/Scene/Appearance.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +8 -5
- package/Source/Scene/BillboardCollection.js +65 -26
- package/Source/Scene/BillboardTexture.js +4 -1
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/Camera.js +13 -2
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/CloudCollection.js +2 -2
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/CumulusCloud.js +1 -1
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +907 -168
- package/Source/Scene/Globe.js +3 -10
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +323 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/ImageBasedLighting.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/ImageryProvider.js +2 -2
- package/Source/Scene/Label.js +7 -5
- package/Source/Scene/LabelCollection.js +60 -2
- package/Source/Scene/Material.js +1 -1
- package/Source/Scene/MaterialAppearance.js +1 -1
- package/Source/Scene/Megatexture.js +174 -242
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/ParticleSystem.js +2 -2
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/Polyline.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -4
- package/Source/Scene/PolylineColorAppearance.js +1 -6
- package/Source/Scene/PolylineMaterialAppearance.js +1 -6
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/QuadtreePrimitive.js +6 -3
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/ShadowMap.js +1 -2
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
- package/Source/Scene/Vector3DTilePolylines.js +1 -5
- package/Source/Scene/VoxelPrimitive.js +16 -33
- package/Source/Scene/VoxelRenderResources.js +1 -8
- package/Source/Scene/VoxelTraversal.js +16 -61
- package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +9 -1
- package/Source/Shaders/Model/ModelFS.js +9 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -2
- package/Source/Shaders/Model/ModelVS.js +4 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +6 -9
- package/Source/Shaders/Voxels/Octree.js +6 -9
- package/Source/Widget/CesiumWidget.js +1 -1
- package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
- package/index.d.ts +582 -193
- package/index.js +91 -83
- package/package.json +2 -1
- package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.139.0
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -25,415 +25,714 @@
|
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
RuntimeError_default
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-Y5AJSEEN.js";
|
|
29
29
|
import {
|
|
30
30
|
Cartesian3_default,
|
|
31
31
|
Frozen_default,
|
|
32
32
|
Matrix3_default
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-5VKZVPO5.js";
|
|
34
34
|
import {
|
|
35
35
|
Math_default
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-52K3GJKG.js";
|
|
37
37
|
import {
|
|
38
38
|
Check_default,
|
|
39
39
|
DeveloperError_default
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-MT5M7RLZ.js";
|
|
41
41
|
import {
|
|
42
42
|
defined_default
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-3B65YFXC.js";
|
|
44
44
|
|
|
45
45
|
// packages/engine/Source/Core/Cartesian4.js
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
var Cartesian4 = class _Cartesian4 {
|
|
47
|
+
/**
|
|
48
|
+
* @param {number} [x=0.0] The X component.
|
|
49
|
+
* @param {number} [y=0.0] The Y component.
|
|
50
|
+
* @param {number} [z=0.0] The Z component.
|
|
51
|
+
* @param {number} [w=0.0] The W component.
|
|
52
|
+
*/
|
|
53
|
+
constructor(x, y, z, w) {
|
|
54
|
+
this.x = x ?? 0;
|
|
55
|
+
this.y = y ?? 0;
|
|
56
|
+
this.z = z ?? 0;
|
|
57
|
+
this.w = w ?? 0;
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Creates a Cartesian4 instance from x, y, z and w coordinates.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} x The x coordinate.
|
|
63
|
+
* @param {number} y The y coordinate.
|
|
64
|
+
* @param {number} z The z coordinate.
|
|
65
|
+
* @param {number} w The w coordinate.
|
|
66
|
+
* @param {Cartesian4} [result] The object onto which to store the result.
|
|
67
|
+
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
|
|
68
|
+
*/
|
|
69
|
+
static fromElements(x, y, z, w, result) {
|
|
70
|
+
if (!defined_default(result)) {
|
|
71
|
+
return new _Cartesian4(x, y, z, w);
|
|
72
|
+
}
|
|
73
|
+
result.x = x;
|
|
74
|
+
result.y = y;
|
|
75
|
+
result.z = z;
|
|
76
|
+
result.w = w;
|
|
77
|
+
return result;
|
|
66
78
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
Cartesian4
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Creates a Cartesian4 instance from a {@link Color}. <code>red</code>, <code>green</code>, <code>blue</code>,
|
|
81
|
+
* and <code>alpha</code> map to <code>x</code>, <code>y</code>, <code>z</code>, and <code>w</code>, respectively.
|
|
82
|
+
*
|
|
83
|
+
* @param {Color} color The source color.
|
|
84
|
+
* @param {Cartesian4} [result] The object onto which to store the result.
|
|
85
|
+
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
|
|
86
|
+
*/
|
|
87
|
+
static fromColor(color, result) {
|
|
88
|
+
Check_default.typeOf.object("color", color);
|
|
89
|
+
if (!defined_default(result)) {
|
|
90
|
+
return new _Cartesian4(color.red, color.green, color.blue, color.alpha);
|
|
91
|
+
}
|
|
92
|
+
result.x = color.red;
|
|
93
|
+
result.y = color.green;
|
|
94
|
+
result.z = color.blue;
|
|
95
|
+
result.w = color.alpha;
|
|
96
|
+
return result;
|
|
76
97
|
}
|
|
77
|
-
|
|
78
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Duplicates a Cartesian4 instance.
|
|
100
|
+
*
|
|
101
|
+
* @param {Cartesian4} cartesian The Cartesian to duplicate.
|
|
102
|
+
* @param {Cartesian4} [result] The object onto which to store the result.
|
|
103
|
+
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
|
|
104
|
+
*/
|
|
105
|
+
static clone(cartesian, result) {
|
|
106
|
+
if (!defined_default(cartesian)) {
|
|
107
|
+
return void 0;
|
|
108
|
+
}
|
|
109
|
+
if (!defined_default(result)) {
|
|
110
|
+
return new _Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
111
|
+
}
|
|
112
|
+
result.x = cartesian.x;
|
|
113
|
+
result.y = cartesian.y;
|
|
114
|
+
result.z = cartesian.z;
|
|
115
|
+
result.w = cartesian.w;
|
|
116
|
+
return result;
|
|
79
117
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Check_default.defined("array", array);
|
|
99
|
-
startingIndex = startingIndex ?? 0;
|
|
100
|
-
if (!defined_default(result)) {
|
|
101
|
-
result = new Cartesian4();
|
|
118
|
+
/**
|
|
119
|
+
* Stores the provided instance into the provided array.
|
|
120
|
+
*
|
|
121
|
+
* @param {Cartesian4} value The value to pack.
|
|
122
|
+
* @param {number[]|TypedArray} array The array to pack into.
|
|
123
|
+
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
|
124
|
+
*
|
|
125
|
+
* @returns {number[]|TypedArray} The array that was packed into
|
|
126
|
+
*/
|
|
127
|
+
static pack(value, array, startingIndex) {
|
|
128
|
+
Check_default.typeOf.object("value", value);
|
|
129
|
+
Check_default.defined("array", array);
|
|
130
|
+
startingIndex = startingIndex ?? 0;
|
|
131
|
+
array[startingIndex++] = value.x;
|
|
132
|
+
array[startingIndex++] = value.y;
|
|
133
|
+
array[startingIndex++] = value.z;
|
|
134
|
+
array[startingIndex] = value.w;
|
|
135
|
+
return array;
|
|
102
136
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
Cartesian4
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
result.
|
|
137
|
+
/**
|
|
138
|
+
* Retrieves an instance from a packed array.
|
|
139
|
+
*
|
|
140
|
+
* @param {number[]|TypedArray} array The packed array.
|
|
141
|
+
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
|
142
|
+
* @param {Cartesian4} [result] The object into which to store the result.
|
|
143
|
+
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
|
|
144
|
+
*/
|
|
145
|
+
static unpack(array, startingIndex, result) {
|
|
146
|
+
Check_default.defined("array", array);
|
|
147
|
+
startingIndex = startingIndex ?? 0;
|
|
148
|
+
if (!defined_default(result)) {
|
|
149
|
+
result = new _Cartesian4();
|
|
150
|
+
}
|
|
151
|
+
result.x = array[startingIndex++];
|
|
152
|
+
result.y = array[startingIndex++];
|
|
153
|
+
result.z = array[startingIndex++];
|
|
154
|
+
result.w = array[startingIndex];
|
|
155
|
+
return result;
|
|
121
156
|
}
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Flattens an array of Cartesian4s into an array of components.
|
|
159
|
+
*
|
|
160
|
+
* @param {Cartesian4[]} array The array of cartesians to pack.
|
|
161
|
+
* @param {number[]|TypedArray} [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.
|
|
162
|
+
* @returns {number[]|TypedArray} The packed array.
|
|
163
|
+
*/
|
|
164
|
+
static packArray(array, result) {
|
|
165
|
+
Check_default.defined("array", array);
|
|
166
|
+
const length = array.length;
|
|
167
|
+
const resultLength = length * 4;
|
|
168
|
+
if (!defined_default(result)) {
|
|
169
|
+
result = new Array(resultLength);
|
|
170
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
171
|
+
throw new DeveloperError_default(
|
|
172
|
+
"If result is a typed array, it must have exactly array.length * 4 elements"
|
|
173
|
+
);
|
|
174
|
+
} else if (result.length !== resultLength) {
|
|
175
|
+
result.length = resultLength;
|
|
176
|
+
}
|
|
177
|
+
for (let i = 0; i < length; ++i) {
|
|
178
|
+
_Cartesian4.pack(array[i], result, i * 4);
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
124
181
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Unpacks an array of cartesian components into an array of Cartesian4s.
|
|
184
|
+
*
|
|
185
|
+
* @param {number[]|TypedArray} array The array of components to unpack.
|
|
186
|
+
* @param {Cartesian4[]} [result] The array onto which to store the result.
|
|
187
|
+
* @returns {Cartesian4[]} The unpacked array.
|
|
188
|
+
*/
|
|
189
|
+
static unpackArray(array, result) {
|
|
190
|
+
Check_default.defined("array", array);
|
|
191
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
|
192
|
+
if (array.length % 4 !== 0) {
|
|
193
|
+
throw new DeveloperError_default("array length must be a multiple of 4.");
|
|
194
|
+
}
|
|
195
|
+
const length = array.length;
|
|
196
|
+
if (!defined_default(result)) {
|
|
197
|
+
result = new Array(length / 4);
|
|
198
|
+
} else {
|
|
199
|
+
result.length = length / 4;
|
|
200
|
+
}
|
|
201
|
+
for (let i = 0; i < length; i += 4) {
|
|
202
|
+
const index = i / 4;
|
|
203
|
+
result[index] = _Cartesian4.unpack(array, i, result[index]);
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
132
206
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Computes the value of the maximum component for the supplied Cartesian.
|
|
209
|
+
*
|
|
210
|
+
* @param {Cartesian4} cartesian The cartesian to use.
|
|
211
|
+
* @returns {number} The value of the maximum component.
|
|
212
|
+
*/
|
|
213
|
+
static maximumComponent(cartesian) {
|
|
214
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
215
|
+
return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
138
216
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Computes the value of the minimum component for the supplied Cartesian.
|
|
219
|
+
*
|
|
220
|
+
* @param {Cartesian4} cartesian The cartesian to use.
|
|
221
|
+
* @returns {number} The value of the minimum component.
|
|
222
|
+
*/
|
|
223
|
+
static minimumComponent(cartesian) {
|
|
224
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
225
|
+
return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
142
226
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
Cartesian4
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
result.z = Math.min(first.z, second.z);
|
|
161
|
-
result.w = Math.min(first.w, second.w);
|
|
162
|
-
return result;
|
|
163
|
-
};
|
|
164
|
-
Cartesian4.maximumByComponent = function(first, second, result) {
|
|
165
|
-
Check_default.typeOf.object("first", first);
|
|
166
|
-
Check_default.typeOf.object("second", second);
|
|
167
|
-
Check_default.typeOf.object("result", result);
|
|
168
|
-
result.x = Math.max(first.x, second.x);
|
|
169
|
-
result.y = Math.max(first.y, second.y);
|
|
170
|
-
result.z = Math.max(first.z, second.z);
|
|
171
|
-
result.w = Math.max(first.w, second.w);
|
|
172
|
-
return result;
|
|
173
|
-
};
|
|
174
|
-
Cartesian4.clamp = function(value, min, max, result) {
|
|
175
|
-
Check_default.typeOf.object("value", value);
|
|
176
|
-
Check_default.typeOf.object("min", min);
|
|
177
|
-
Check_default.typeOf.object("max", max);
|
|
178
|
-
Check_default.typeOf.object("result", result);
|
|
179
|
-
const x = Math_default.clamp(value.x, min.x, max.x);
|
|
180
|
-
const y = Math_default.clamp(value.y, min.y, max.y);
|
|
181
|
-
const z = Math_default.clamp(value.z, min.z, max.z);
|
|
182
|
-
const w = Math_default.clamp(value.w, min.w, max.w);
|
|
183
|
-
result.x = x;
|
|
184
|
-
result.y = y;
|
|
185
|
-
result.z = z;
|
|
186
|
-
result.w = w;
|
|
187
|
-
return result;
|
|
188
|
-
};
|
|
189
|
-
Cartesian4.magnitudeSquared = function(cartesian) {
|
|
190
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
191
|
-
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
|
|
192
|
-
};
|
|
193
|
-
Cartesian4.magnitude = function(cartesian) {
|
|
194
|
-
return Math.sqrt(Cartesian4.magnitudeSquared(cartesian));
|
|
195
|
-
};
|
|
196
|
-
var distanceScratch = new Cartesian4();
|
|
197
|
-
Cartesian4.distance = function(left, right) {
|
|
198
|
-
Check_default.typeOf.object("left", left);
|
|
199
|
-
Check_default.typeOf.object("right", right);
|
|
200
|
-
Cartesian4.subtract(left, right, distanceScratch);
|
|
201
|
-
return Cartesian4.magnitude(distanceScratch);
|
|
202
|
-
};
|
|
203
|
-
Cartesian4.distanceSquared = function(left, right) {
|
|
204
|
-
Check_default.typeOf.object("left", left);
|
|
205
|
-
Check_default.typeOf.object("right", right);
|
|
206
|
-
Cartesian4.subtract(left, right, distanceScratch);
|
|
207
|
-
return Cartesian4.magnitudeSquared(distanceScratch);
|
|
208
|
-
};
|
|
209
|
-
Cartesian4.normalize = function(cartesian, result) {
|
|
210
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
211
|
-
Check_default.typeOf.object("result", result);
|
|
212
|
-
const magnitude = Cartesian4.magnitude(cartesian);
|
|
213
|
-
result.x = cartesian.x / magnitude;
|
|
214
|
-
result.y = cartesian.y / magnitude;
|
|
215
|
-
result.z = cartesian.z / magnitude;
|
|
216
|
-
result.w = cartesian.w / magnitude;
|
|
217
|
-
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
|
|
218
|
-
throw new DeveloperError_default("normalized result is not a number");
|
|
227
|
+
/**
|
|
228
|
+
* Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
|
|
229
|
+
*
|
|
230
|
+
* @param {Cartesian4} first A cartesian to compare.
|
|
231
|
+
* @param {Cartesian4} second A cartesian to compare.
|
|
232
|
+
* @param {Cartesian4} result The object into which to store the result.
|
|
233
|
+
* @returns {Cartesian4} A cartesian with the minimum components.
|
|
234
|
+
*/
|
|
235
|
+
static minimumByComponent(first, second, result) {
|
|
236
|
+
Check_default.typeOf.object("first", first);
|
|
237
|
+
Check_default.typeOf.object("second", second);
|
|
238
|
+
Check_default.typeOf.object("result", result);
|
|
239
|
+
result.x = Math.min(first.x, second.x);
|
|
240
|
+
result.y = Math.min(first.y, second.y);
|
|
241
|
+
result.z = Math.min(first.z, second.z);
|
|
242
|
+
result.w = Math.min(first.w, second.w);
|
|
243
|
+
return result;
|
|
219
244
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
|
|
247
|
+
*
|
|
248
|
+
* @param {Cartesian4} first A cartesian to compare.
|
|
249
|
+
* @param {Cartesian4} second A cartesian to compare.
|
|
250
|
+
* @param {Cartesian4} result The object into which to store the result.
|
|
251
|
+
* @returns {Cartesian4} A cartesian with the maximum components.
|
|
252
|
+
*/
|
|
253
|
+
static maximumByComponent(first, second, result) {
|
|
254
|
+
Check_default.typeOf.object("first", first);
|
|
255
|
+
Check_default.typeOf.object("second", second);
|
|
256
|
+
Check_default.typeOf.object("result", result);
|
|
257
|
+
result.x = Math.max(first.x, second.x);
|
|
258
|
+
result.y = Math.max(first.y, second.y);
|
|
259
|
+
result.z = Math.max(first.z, second.z);
|
|
260
|
+
result.w = Math.max(first.w, second.w);
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Constrain a value to lie between two values.
|
|
265
|
+
*
|
|
266
|
+
* @param {Cartesian4} value The value to clamp.
|
|
267
|
+
* @param {Cartesian4} min The minimum bound.
|
|
268
|
+
* @param {Cartesian4} max The maximum bound.
|
|
269
|
+
* @param {Cartesian4} result The object into which to store the result.
|
|
270
|
+
* @returns {Cartesian4} The clamped value such that min <= result <= max.
|
|
271
|
+
*/
|
|
272
|
+
static clamp(value, min, max, result) {
|
|
273
|
+
Check_default.typeOf.object("value", value);
|
|
274
|
+
Check_default.typeOf.object("min", min);
|
|
275
|
+
Check_default.typeOf.object("max", max);
|
|
276
|
+
Check_default.typeOf.object("result", result);
|
|
277
|
+
const x = Math_default.clamp(value.x, min.x, max.x);
|
|
278
|
+
const y = Math_default.clamp(value.y, min.y, max.y);
|
|
279
|
+
const z = Math_default.clamp(value.z, min.z, max.z);
|
|
280
|
+
const w = Math_default.clamp(value.w, min.w, max.w);
|
|
281
|
+
result.x = x;
|
|
282
|
+
result.y = y;
|
|
283
|
+
result.z = z;
|
|
284
|
+
result.w = w;
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Computes the provided Cartesian's squared magnitude.
|
|
289
|
+
*
|
|
290
|
+
* @param {Cartesian4} cartesian The Cartesian instance whose squared magnitude is to be computed.
|
|
291
|
+
* @returns {number} The squared magnitude.
|
|
292
|
+
*/
|
|
293
|
+
static magnitudeSquared(cartesian) {
|
|
294
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
295
|
+
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Computes the Cartesian's magnitude (length).
|
|
299
|
+
*
|
|
300
|
+
* @param {Cartesian4} cartesian The Cartesian instance whose magnitude is to be computed.
|
|
301
|
+
* @returns {number} The magnitude.
|
|
302
|
+
*/
|
|
303
|
+
static magnitude(cartesian) {
|
|
304
|
+
return Math.sqrt(_Cartesian4.magnitudeSquared(cartesian));
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Computes the 4-space distance between two points.
|
|
308
|
+
*
|
|
309
|
+
* @param {Cartesian4} left The first point to compute the distance from.
|
|
310
|
+
* @param {Cartesian4} right The second point to compute the distance to.
|
|
311
|
+
* @returns {number} The distance between two points.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* // Returns 1.0
|
|
315
|
+
* const d = Cesium.Cartesian4.distance(
|
|
316
|
+
* new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
|
|
317
|
+
* new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));
|
|
318
|
+
*/
|
|
319
|
+
static distance(left, right) {
|
|
320
|
+
Check_default.typeOf.object("left", left);
|
|
321
|
+
Check_default.typeOf.object("right", right);
|
|
322
|
+
_Cartesian4.subtract(left, right, distanceScratch);
|
|
323
|
+
return _Cartesian4.magnitude(distanceScratch);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Computes the squared distance between two points. Comparing squared distances
|
|
327
|
+
* using this function is more efficient than comparing distances using {@link Cartesian4#distance}.
|
|
328
|
+
*
|
|
329
|
+
* @param {Cartesian4} left The first point to compute the distance from.
|
|
330
|
+
* @param {Cartesian4} right The second point to compute the distance to.
|
|
331
|
+
* @returns {number} The distance between two points.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* // Returns 4.0, not 2.0
|
|
335
|
+
* const d = Cesium.Cartesian4.distance(
|
|
336
|
+
* new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
|
|
337
|
+
* new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));
|
|
338
|
+
*/
|
|
339
|
+
static distanceSquared(left, right) {
|
|
340
|
+
Check_default.typeOf.object("left", left);
|
|
341
|
+
Check_default.typeOf.object("right", right);
|
|
342
|
+
_Cartesian4.subtract(left, right, distanceScratch);
|
|
343
|
+
return _Cartesian4.magnitudeSquared(distanceScratch);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Computes the normalized form of the supplied Cartesian.
|
|
347
|
+
*
|
|
348
|
+
* @param {Cartesian4} cartesian The Cartesian to be normalized.
|
|
349
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
350
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
351
|
+
*/
|
|
352
|
+
static normalize(cartesian, result) {
|
|
353
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
354
|
+
Check_default.typeOf.object("result", result);
|
|
355
|
+
const magnitude = _Cartesian4.magnitude(cartesian);
|
|
356
|
+
result.x = cartesian.x / magnitude;
|
|
357
|
+
result.y = cartesian.y / magnitude;
|
|
358
|
+
result.z = cartesian.z / magnitude;
|
|
359
|
+
result.w = cartesian.w / magnitude;
|
|
360
|
+
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
|
|
361
|
+
throw new DeveloperError_default("normalized result is not a number");
|
|
362
|
+
}
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Computes the dot (scalar) product of two Cartesians.
|
|
367
|
+
*
|
|
368
|
+
* @param {Cartesian4} left The first Cartesian.
|
|
369
|
+
* @param {Cartesian4} right The second Cartesian.
|
|
370
|
+
* @returns {number} The dot product.
|
|
371
|
+
*/
|
|
372
|
+
static dot(left, right) {
|
|
373
|
+
Check_default.typeOf.object("left", left);
|
|
374
|
+
Check_default.typeOf.object("right", right);
|
|
375
|
+
return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Computes the componentwise product of two Cartesians.
|
|
379
|
+
*
|
|
380
|
+
* @param {Cartesian4} left The first Cartesian.
|
|
381
|
+
* @param {Cartesian4} right The second Cartesian.
|
|
382
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
383
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
384
|
+
*/
|
|
385
|
+
static multiplyComponents(left, right, result) {
|
|
386
|
+
Check_default.typeOf.object("left", left);
|
|
387
|
+
Check_default.typeOf.object("right", right);
|
|
388
|
+
Check_default.typeOf.object("result", result);
|
|
389
|
+
result.x = left.x * right.x;
|
|
390
|
+
result.y = left.y * right.y;
|
|
391
|
+
result.z = left.z * right.z;
|
|
392
|
+
result.w = left.w * right.w;
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Computes the componentwise quotient of two Cartesians.
|
|
397
|
+
*
|
|
398
|
+
* @param {Cartesian4} left The first Cartesian.
|
|
399
|
+
* @param {Cartesian4} right The second Cartesian.
|
|
400
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
401
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
402
|
+
*/
|
|
403
|
+
static divideComponents(left, right, result) {
|
|
404
|
+
Check_default.typeOf.object("left", left);
|
|
405
|
+
Check_default.typeOf.object("right", right);
|
|
406
|
+
Check_default.typeOf.object("result", result);
|
|
407
|
+
result.x = left.x / right.x;
|
|
408
|
+
result.y = left.y / right.y;
|
|
409
|
+
result.z = left.z / right.z;
|
|
410
|
+
result.w = left.w / right.w;
|
|
411
|
+
return result;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Computes the componentwise sum of two Cartesians.
|
|
415
|
+
*
|
|
416
|
+
* @param {Cartesian4} left The first Cartesian.
|
|
417
|
+
* @param {Cartesian4} right The second Cartesian.
|
|
418
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
419
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
420
|
+
*/
|
|
421
|
+
static add(left, right, result) {
|
|
422
|
+
Check_default.typeOf.object("left", left);
|
|
423
|
+
Check_default.typeOf.object("right", right);
|
|
424
|
+
Check_default.typeOf.object("result", result);
|
|
425
|
+
result.x = left.x + right.x;
|
|
426
|
+
result.y = left.y + right.y;
|
|
427
|
+
result.z = left.z + right.z;
|
|
428
|
+
result.w = left.w + right.w;
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Computes the componentwise difference of two Cartesians.
|
|
433
|
+
*
|
|
434
|
+
* @param {Cartesian4} left The first Cartesian.
|
|
435
|
+
* @param {Cartesian4} right The second Cartesian.
|
|
436
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
437
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
438
|
+
*/
|
|
439
|
+
static subtract(left, right, result) {
|
|
440
|
+
Check_default.typeOf.object("left", left);
|
|
441
|
+
Check_default.typeOf.object("right", right);
|
|
442
|
+
Check_default.typeOf.object("result", result);
|
|
443
|
+
result.x = left.x - right.x;
|
|
444
|
+
result.y = left.y - right.y;
|
|
445
|
+
result.z = left.z - right.z;
|
|
446
|
+
result.w = left.w - right.w;
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Multiplies the provided Cartesian componentwise by the provided scalar.
|
|
451
|
+
*
|
|
452
|
+
* @param {Cartesian4} cartesian The Cartesian to be scaled.
|
|
453
|
+
* @param {number} scalar The scalar to multiply with.
|
|
454
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
455
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
456
|
+
*/
|
|
457
|
+
static multiplyByScalar(cartesian, scalar, result) {
|
|
458
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
459
|
+
Check_default.typeOf.number("scalar", scalar);
|
|
460
|
+
Check_default.typeOf.object("result", result);
|
|
461
|
+
result.x = cartesian.x * scalar;
|
|
462
|
+
result.y = cartesian.y * scalar;
|
|
463
|
+
result.z = cartesian.z * scalar;
|
|
464
|
+
result.w = cartesian.w * scalar;
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Divides the provided Cartesian componentwise by the provided scalar.
|
|
469
|
+
*
|
|
470
|
+
* @param {Cartesian4} cartesian The Cartesian to be divided.
|
|
471
|
+
* @param {number} scalar The scalar to divide by.
|
|
472
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
473
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
474
|
+
*/
|
|
475
|
+
static divideByScalar(cartesian, scalar, result) {
|
|
476
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
477
|
+
Check_default.typeOf.number("scalar", scalar);
|
|
478
|
+
Check_default.typeOf.object("result", result);
|
|
479
|
+
result.x = cartesian.x / scalar;
|
|
480
|
+
result.y = cartesian.y / scalar;
|
|
481
|
+
result.z = cartesian.z / scalar;
|
|
482
|
+
result.w = cartesian.w / scalar;
|
|
483
|
+
return result;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Negates the provided Cartesian.
|
|
487
|
+
*
|
|
488
|
+
* @param {Cartesian4} cartesian The Cartesian to be negated.
|
|
489
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
490
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
491
|
+
*/
|
|
492
|
+
static negate(cartesian, result) {
|
|
493
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
494
|
+
Check_default.typeOf.object("result", result);
|
|
495
|
+
result.x = -cartesian.x;
|
|
496
|
+
result.y = -cartesian.y;
|
|
497
|
+
result.z = -cartesian.z;
|
|
498
|
+
result.w = -cartesian.w;
|
|
499
|
+
return result;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Computes the absolute value of the provided Cartesian.
|
|
503
|
+
*
|
|
504
|
+
* @param {Cartesian4} cartesian The Cartesian whose absolute value is to be computed.
|
|
505
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
506
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
507
|
+
*/
|
|
508
|
+
static abs(cartesian, result) {
|
|
509
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
510
|
+
Check_default.typeOf.object("result", result);
|
|
511
|
+
result.x = Math.abs(cartesian.x);
|
|
512
|
+
result.y = Math.abs(cartesian.y);
|
|
513
|
+
result.z = Math.abs(cartesian.z);
|
|
514
|
+
result.w = Math.abs(cartesian.w);
|
|
515
|
+
return result;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
|
|
519
|
+
*
|
|
520
|
+
* @param {Cartesian4} start The value corresponding to t at 0.0.
|
|
521
|
+
* @param {Cartesian4}end The value corresponding to t at 1.0.
|
|
522
|
+
* @param {number} t The point along t at which to interpolate.
|
|
523
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
524
|
+
* @returns {Cartesian4} The modified result parameter.
|
|
525
|
+
*/
|
|
526
|
+
static lerp(start, end, t, result) {
|
|
527
|
+
Check_default.typeOf.object("start", start);
|
|
528
|
+
Check_default.typeOf.object("end", end);
|
|
529
|
+
Check_default.typeOf.number("t", t);
|
|
530
|
+
Check_default.typeOf.object("result", result);
|
|
531
|
+
_Cartesian4.multiplyByScalar(end, t, lerpScratch);
|
|
532
|
+
result = _Cartesian4.multiplyByScalar(start, 1 - t, result);
|
|
533
|
+
return _Cartesian4.add(lerpScratch, result, result);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Returns the axis that is most orthogonal to the provided Cartesian.
|
|
537
|
+
*
|
|
538
|
+
* @param {Cartesian4} cartesian The Cartesian on which to find the most orthogonal axis.
|
|
539
|
+
* @param {Cartesian4} result The object onto which to store the result.
|
|
540
|
+
* @returns {Cartesian4} The most orthogonal axis.
|
|
541
|
+
*/
|
|
542
|
+
static mostOrthogonalAxis(cartesian, result) {
|
|
543
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
544
|
+
Check_default.typeOf.object("result", result);
|
|
545
|
+
const f = _Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
|
|
546
|
+
_Cartesian4.abs(f, f);
|
|
547
|
+
if (f.x <= f.y) {
|
|
548
|
+
if (f.x <= f.z) {
|
|
549
|
+
if (f.x <= f.w) {
|
|
550
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_X, result);
|
|
551
|
+
} else {
|
|
552
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
|
|
553
|
+
}
|
|
554
|
+
} else if (f.z <= f.w) {
|
|
555
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_Z, result);
|
|
325
556
|
} else {
|
|
326
|
-
result =
|
|
557
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
|
|
558
|
+
}
|
|
559
|
+
} else if (f.y <= f.z) {
|
|
560
|
+
if (f.y <= f.w) {
|
|
561
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_Y, result);
|
|
562
|
+
} else {
|
|
563
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
|
|
327
564
|
}
|
|
328
565
|
} else if (f.z <= f.w) {
|
|
329
|
-
result =
|
|
566
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_Z, result);
|
|
330
567
|
} else {
|
|
331
|
-
result =
|
|
568
|
+
result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
|
|
332
569
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
570
|
+
return result;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Compares the provided Cartesians componentwise and returns
|
|
574
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
575
|
+
*
|
|
576
|
+
* @param {Cartesian4} [left] The first Cartesian.
|
|
577
|
+
* @param {Cartesian4} [right] The second Cartesian.
|
|
578
|
+
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
579
|
+
*/
|
|
580
|
+
static equals(left, right) {
|
|
581
|
+
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* @param {Cartesian4} cartesian
|
|
585
|
+
* @param {number[]} array
|
|
586
|
+
* @param {number} offset
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
589
|
+
static equalsArray(cartesian, array, offset) {
|
|
590
|
+
return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Compares the provided Cartesians componentwise and returns
|
|
594
|
+
* <code>true</code> if they pass an absolute or relative tolerance test,
|
|
595
|
+
* <code>false</code> otherwise.
|
|
596
|
+
*
|
|
597
|
+
* @param {Cartesian4} [left] The first Cartesian.
|
|
598
|
+
* @param {Cartesian4} [right] The second Cartesian.
|
|
599
|
+
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
|
600
|
+
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
|
601
|
+
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
|
602
|
+
*/
|
|
603
|
+
static equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon) {
|
|
604
|
+
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
|
605
|
+
left.x,
|
|
606
|
+
right.x,
|
|
607
|
+
relativeEpsilon,
|
|
608
|
+
absoluteEpsilon
|
|
609
|
+
) && Math_default.equalsEpsilon(
|
|
610
|
+
left.y,
|
|
611
|
+
right.y,
|
|
612
|
+
relativeEpsilon,
|
|
613
|
+
absoluteEpsilon
|
|
614
|
+
) && Math_default.equalsEpsilon(
|
|
615
|
+
left.z,
|
|
616
|
+
right.z,
|
|
617
|
+
relativeEpsilon,
|
|
618
|
+
absoluteEpsilon
|
|
619
|
+
) && Math_default.equalsEpsilon(
|
|
620
|
+
left.w,
|
|
621
|
+
right.w,
|
|
622
|
+
relativeEpsilon,
|
|
623
|
+
absoluteEpsilon
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Duplicates this Cartesian4 instance.
|
|
628
|
+
*
|
|
629
|
+
* @param {Cartesian4} [result] The object onto which to store the result.
|
|
630
|
+
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
|
|
631
|
+
*/
|
|
632
|
+
clone(result) {
|
|
633
|
+
return _Cartesian4.clone(this, result);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
|
637
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
638
|
+
*
|
|
639
|
+
* @param {Cartesian4} [right] The right hand side Cartesian.
|
|
640
|
+
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
641
|
+
*/
|
|
642
|
+
equals(right) {
|
|
643
|
+
return _Cartesian4.equals(this, right);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
|
647
|
+
* <code>true</code> if they pass an absolute or relative tolerance test,
|
|
648
|
+
* <code>false</code> otherwise.
|
|
649
|
+
*
|
|
650
|
+
* @param {Cartesian4} [right] The right hand side Cartesian.
|
|
651
|
+
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
|
652
|
+
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
|
653
|
+
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
|
654
|
+
*/
|
|
655
|
+
equalsEpsilon(right, relativeEpsilon, absoluteEpsilon) {
|
|
656
|
+
return _Cartesian4.equalsEpsilon(
|
|
657
|
+
this,
|
|
658
|
+
right,
|
|
659
|
+
relativeEpsilon,
|
|
660
|
+
absoluteEpsilon
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Creates a string representing this Cartesian in the format '(x, y, z, w)'.
|
|
665
|
+
*
|
|
666
|
+
* @returns {string} A string representing the provided Cartesian in the format '(x, y, z, w)'.
|
|
667
|
+
*/
|
|
668
|
+
toString() {
|
|
669
|
+
return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Packs an arbitrary floating point value to 4 values representable using uint8.
|
|
673
|
+
*
|
|
674
|
+
* @param {number} value A floating point number.
|
|
675
|
+
* @param {Cartesian4} [result] The Cartesian4 that will contain the packed float.
|
|
676
|
+
* @returns {Cartesian4} A Cartesian4 representing the float packed to values in x, y, z, and w.
|
|
677
|
+
*/
|
|
678
|
+
static packFloat(value, result) {
|
|
679
|
+
Check_default.typeOf.number("value", value);
|
|
680
|
+
if (!defined_default(result)) {
|
|
681
|
+
result = new _Cartesian4();
|
|
682
|
+
}
|
|
683
|
+
scratchF32Array[0] = value;
|
|
684
|
+
if (littleEndian) {
|
|
685
|
+
result.x = scratchU8Array[0];
|
|
686
|
+
result.y = scratchU8Array[1];
|
|
687
|
+
result.z = scratchU8Array[2];
|
|
688
|
+
result.w = scratchU8Array[3];
|
|
336
689
|
} else {
|
|
337
|
-
result =
|
|
690
|
+
result.x = scratchU8Array[3];
|
|
691
|
+
result.y = scratchU8Array[2];
|
|
692
|
+
result.z = scratchU8Array[1];
|
|
693
|
+
result.w = scratchU8Array[0];
|
|
338
694
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
695
|
+
return result;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Unpacks a float packed using Cartesian4.packFloat.
|
|
699
|
+
*
|
|
700
|
+
* @param {Cartesian4} packedFloat A Cartesian4 containing a float packed to 4 values representable using uint8.
|
|
701
|
+
* @returns {number} The unpacked float.
|
|
702
|
+
* @private
|
|
703
|
+
*/
|
|
704
|
+
static unpackFloat(packedFloat) {
|
|
705
|
+
Check_default.typeOf.object("packedFloat", packedFloat);
|
|
706
|
+
if (littleEndian) {
|
|
707
|
+
scratchU8Array[0] = packedFloat.x;
|
|
708
|
+
scratchU8Array[1] = packedFloat.y;
|
|
709
|
+
scratchU8Array[2] = packedFloat.z;
|
|
710
|
+
scratchU8Array[3] = packedFloat.w;
|
|
711
|
+
} else {
|
|
712
|
+
scratchU8Array[0] = packedFloat.w;
|
|
713
|
+
scratchU8Array[1] = packedFloat.z;
|
|
714
|
+
scratchU8Array[2] = packedFloat.y;
|
|
715
|
+
scratchU8Array[3] = packedFloat.x;
|
|
716
|
+
}
|
|
717
|
+
return scratchF32Array[0];
|
|
343
718
|
}
|
|
344
|
-
return result;
|
|
345
|
-
};
|
|
346
|
-
Cartesian4.equals = function(left, right) {
|
|
347
|
-
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
|
|
348
|
-
};
|
|
349
|
-
Cartesian4.equalsArray = function(cartesian, array, offset) {
|
|
350
|
-
return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
|
|
351
|
-
};
|
|
352
|
-
Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
|
|
353
|
-
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
|
354
|
-
left.x,
|
|
355
|
-
right.x,
|
|
356
|
-
relativeEpsilon,
|
|
357
|
-
absoluteEpsilon
|
|
358
|
-
) && Math_default.equalsEpsilon(
|
|
359
|
-
left.y,
|
|
360
|
-
right.y,
|
|
361
|
-
relativeEpsilon,
|
|
362
|
-
absoluteEpsilon
|
|
363
|
-
) && Math_default.equalsEpsilon(
|
|
364
|
-
left.z,
|
|
365
|
-
right.z,
|
|
366
|
-
relativeEpsilon,
|
|
367
|
-
absoluteEpsilon
|
|
368
|
-
) && Math_default.equalsEpsilon(
|
|
369
|
-
left.w,
|
|
370
|
-
right.w,
|
|
371
|
-
relativeEpsilon,
|
|
372
|
-
absoluteEpsilon
|
|
373
|
-
);
|
|
374
719
|
};
|
|
720
|
+
Cartesian4.packedLength = 4;
|
|
721
|
+
Cartesian4.fromArray = Cartesian4.unpack;
|
|
722
|
+
var distanceScratch = new Cartesian4();
|
|
723
|
+
var lerpScratch = new Cartesian4();
|
|
724
|
+
var mostOrthogonalAxisScratch = new Cartesian4();
|
|
375
725
|
Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
|
|
376
726
|
Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
|
|
377
727
|
Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
|
|
378
728
|
Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
|
|
379
729
|
Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
|
|
380
730
|
Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
|
|
381
|
-
Cartesian4.prototype.clone = function(result) {
|
|
382
|
-
return Cartesian4.clone(this, result);
|
|
383
|
-
};
|
|
384
|
-
Cartesian4.prototype.equals = function(right) {
|
|
385
|
-
return Cartesian4.equals(this, right);
|
|
386
|
-
};
|
|
387
|
-
Cartesian4.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
|
|
388
|
-
return Cartesian4.equalsEpsilon(
|
|
389
|
-
this,
|
|
390
|
-
right,
|
|
391
|
-
relativeEpsilon,
|
|
392
|
-
absoluteEpsilon
|
|
393
|
-
);
|
|
394
|
-
};
|
|
395
|
-
Cartesian4.prototype.toString = function() {
|
|
396
|
-
return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
|
|
397
|
-
};
|
|
398
731
|
var scratchF32Array = new Float32Array(1);
|
|
399
732
|
var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
|
|
400
733
|
var testU32 = new Uint32Array([287454020]);
|
|
401
734
|
var testU8 = new Uint8Array(testU32.buffer);
|
|
402
735
|
var littleEndian = testU8[0] === 68;
|
|
403
|
-
Cartesian4.packFloat = function(value, result) {
|
|
404
|
-
Check_default.typeOf.number("value", value);
|
|
405
|
-
if (!defined_default(result)) {
|
|
406
|
-
result = new Cartesian4();
|
|
407
|
-
}
|
|
408
|
-
scratchF32Array[0] = value;
|
|
409
|
-
if (littleEndian) {
|
|
410
|
-
result.x = scratchU8Array[0];
|
|
411
|
-
result.y = scratchU8Array[1];
|
|
412
|
-
result.z = scratchU8Array[2];
|
|
413
|
-
result.w = scratchU8Array[3];
|
|
414
|
-
} else {
|
|
415
|
-
result.x = scratchU8Array[3];
|
|
416
|
-
result.y = scratchU8Array[2];
|
|
417
|
-
result.z = scratchU8Array[1];
|
|
418
|
-
result.w = scratchU8Array[0];
|
|
419
|
-
}
|
|
420
|
-
return result;
|
|
421
|
-
};
|
|
422
|
-
Cartesian4.unpackFloat = function(packedFloat) {
|
|
423
|
-
Check_default.typeOf.object("packedFloat", packedFloat);
|
|
424
|
-
if (littleEndian) {
|
|
425
|
-
scratchU8Array[0] = packedFloat.x;
|
|
426
|
-
scratchU8Array[1] = packedFloat.y;
|
|
427
|
-
scratchU8Array[2] = packedFloat.z;
|
|
428
|
-
scratchU8Array[3] = packedFloat.w;
|
|
429
|
-
} else {
|
|
430
|
-
scratchU8Array[0] = packedFloat.w;
|
|
431
|
-
scratchU8Array[1] = packedFloat.z;
|
|
432
|
-
scratchU8Array[2] = packedFloat.y;
|
|
433
|
-
scratchU8Array[3] = packedFloat.x;
|
|
434
|
-
}
|
|
435
|
-
return scratchF32Array[0];
|
|
436
|
-
};
|
|
437
736
|
var Cartesian4_default = Cartesian4;
|
|
438
737
|
|
|
439
738
|
// packages/engine/Source/Core/Matrix4.js
|