Cesium JS API
AppearanceArcGisMapServerImageryProviderArcGISTiledElevationTerrainProviderArcTypeAssociativeArrayAxisAxisAlignedBoundingBoxbarycentricCoordinatesBillboardBillboardCollectionBillboardGraphicsBillboardVisualizerbinarySearchbinarySearchComparatorBingMapsGeocoderServiceBingMapsImageryProviderBingMapsStyleBlendEquationBlendFunctionBlendingStateBlendOptionBoundingRectangleBoundingSphereBoxEmitterBoxGeometryBoxGeometryUpdaterBoxGraphicsBoxOutlineGeometrybuildModuleUrlCallbackPropertyCameraCameraEventAggregatorCameraEventTypeCartesian2Cartesian3Cartesian4CartographicCartographicGeocoderServiceCatmullRomSplineCesium3DTileCesium3DTileColorBlendModeCesium3DTileContentCesium3DTileFeatureCesium3DTilePointFeatureCesium3DTilesetCesium3DTilesetGraphicsCesium3DTilesetVisualizerCesium3DTileStyleCesium3DTilesVoxelProviderCesiumTerrainProviderCesiumWidgetCheckerboardMaterialPropertyCircleEmitterCircleGeometryCircleOutlineGeometryClassificationPrimitiveClassificationTypeClippingPlaneClippingPlaneCollectionClockClockRangeClockStepcloneCloudCollectionCloudTypeColorColorBlendModeColorGeometryInstanceAttributeColorMaterialPropertycombineComponentDatatypeCompositeEntityCollectionCompositeMaterialPropertyCompositePositionPropertyCompositePropertyCompressedTextureBufferConditionsExpressionConeEmitterConstantPositionPropertyConstantPropertyConstantSplineContextOptionsCoplanarPolygonGeometryCoplanarPolygonOutlineGeometryCornerTypeCorridorGeometryCorridorGeometryUpdaterCorridorGraphicsCorridorOutlineGeometrycreateElevationBandMaterialcreateElevationBandMaterialBandcreateElevationBandMaterialEntrycreateGuidcreateOsmBuildingscreateTangentSpaceDebugPrimitivecreateWorldImagerycreateWorldTerrainCreditCreditDisplayCubicRealPolynomialCullFaceCullingVolumeCumulusCloudCustomDataSourceCustomHeightmapTerrainProviderCustomShaderCustomShaderModeCustomShaderTranslucencyModeCylinderGeometryCylinderGeometryUpdaterCylinderGraphicsCylinderOutlineGeometryCzmlDataSourceDataSourceDataSourceClockDataSourceCollectionDataSourceDisplayDebugAppearanceDebugCameraPrimitiveDebugModelMatrixPrimitiveDefaultProxydefaultValuedefinedDepthFunctiondestroyObjectDeveloperErrorDirectionalLightDirectionUpDiscardEmptyTileImagePolicyDiscardMissingTileImagePolicyDistanceDisplayConditionDistanceDisplayConditionGeometryInstanceAttributeEasingFunctionEllipseGeometryEllipseGeometryUpdaterEllipseGraphicsEllipseOutlineGeometryEllipsoidEllipsoidGeodesicEllipsoidGeometryEllipsoidGeometryUpdaterEllipsoidGraphicsEllipsoidOutlineGeometryEllipsoidRhumbLineEllipsoidSurfaceAppearanceEllipsoidTangentPlaneEllipsoidTerrainProviderEntityEntityClusterEntityCollectionEntityViewEventEventHelperexcludesReverseAxisexportKmlexportKmlModelCallbackexportKmlResultKmlexportKmlResultKmzExpressionExtrapolationTypeFeatureDetectionFogformatErrorFrameRateMonitorFrustumGeometryFrustumOutlineGeometryFullscreenGeocoderServiceGeocodeTypeGeographicProjectionGeographicTilingSchemeGeoJsonDataSourceGeometryGeometryAttributeGeometryAttributesGeometryFactoryGeometryInstanceGeometryInstanceAttributeGeometryPipelineGeometryUpdaterGeometryVisualizergetAbsoluteUrigetBaseUrigetExtensionFromUriGetFeatureInfoFormatgetFilenameFromUrigetImagePixelsgetTimestampGlobeGlobeTranslucencyGoogleEarthEnterpriseImageryProviderGoogleEarthEnterpriseMapsProviderGoogleEarthEnterpriseMetadataGoogleEarthEnterpriseTerrainDataGoogleEarthEnterpriseTerrainProviderGpxDataSourceGregorianDateGridImageryProviderGridMaterialPropertyGroundGeometryUpdaterGroundPolylineGeometryGroundPolylinePrimitiveGroundPrimitiveHeadingPitchRangeHeadingPitchRollHeadingPitchRollValuesHeightmapEncodingHeightmapTerrainDataHeightReferenceHermitePolynomialApproximationHermiteSplineHilbertOrderHorizontalOriginI3SDataProviderI3SFeatureI3SFieldI3SGeometryI3SLayerI3SNodeImageBasedLightingImageMaterialPropertyImageryLayerImageryLayerCollectionImageryLayerFeatureInfoImageryProviderImageryTypesincludesReverseAxisIndexDatatypeIntersectIntersections2DIntersectionTestsIntervalIonIonGeocoderServiceIonImageryProviderIonResourceIonWorldImageryStyleisLeapYearIso8601JulianDateKeyboardEventModifierKmlCameraKmlDataSourceKmlFeatureDataKmlLookAtKmlTourKmlTourFlyToKmlTourWaitLabelLabelCollectionLabelGraphicsLabelStyleLabelVisualizerLagrangePolynomialApproximationLeapSecondLightLightingModelLinearApproximationLinearSplineMapboxImageryProviderMapboxStyleImageryProviderMapMode2DMapProjectionMaterialMaterialAppearanceMaterialSupportMaterialPropertyMathMatrix2Matrix3Matrix4mergeSortmergeSortComparatorMetadataClassMetadataClassPropertyMetadataComponentTypeMetadataEnumMetadataEnumValueMetadataSchemaMetadataTypeModelModelAnimationModelAnimationCollectionModelAnimationLoopModelFeatureModelGraphicsModelNodeModelVisualizerMoonMorphWeightSplineNearFarScalarNeverTileDiscardPolicyNodeTransformationPropertyobjectToQueryOccluderOpenCageGeocoderServiceOpenStreetMapImageryProviderOrientedBoundingBoxOrthographicFrustumOrthographicOffCenterFrustumPackableForInterpolationParticleParticleBurstParticleEmitterParticleSystemPathGraphicsPathVisualizerPeliasGeocoderServicePerInstanceColorAppearancePerspectiveFrustumPerspectiveOffCenterFrustumPinBuilderPixelDatatypePixelFormatPlanePlaneGeometryPlaneGeometryUpdaterPlaneGraphicsPlaneOutlineGeometryPointCloudShadingPointGraphicspointInsideTrianglePointPrimitivePointPrimitiveCollectionPointVisualizerPolygonGeometryPolygonGeometryUpdaterPolygonGraphicsPolygonHierarchyPolygonOutlineGeometryPolylinePolylineArrowMaterialPropertyPolylineCollectionPolylineColorAppearancePolylineDashMaterialPropertyPolylineGeometryPolylineGeometryUpdaterPolylineGlowMaterialPropertyPolylineGraphicsPolylineMaterialAppearancePolylineOutlineMaterialPropertyPolylineVisualizerPolylineVolumeGeometryPolylineVolumeGeometryUpdaterPolylineVolumeGraphicsPolylineVolumeOutlineGeometryPositionPropertyPositionPropertyArrayPostProcessStagePostProcessStageCollectionPostProcessStageCompositePostProcessStageLibraryPostProcessStageSampleModePrimitivePrimitiveCollectionPrimitiveTypePropertyPropertyArrayPropertyBagProxyQuadraticRealPolynomialQuantizedMeshTerrainDataQuarticRealPolynomialQuaternionQuaternionSplinequeryToObjectQueueRayreadyPromiseRectangleRectangleGeometryRectangleGeometryUpdaterRectangleGraphicsRectangleOutlineGeometryReferenceFrameReferencePropertyremoveExtensionRequestRequestErrorEventRequestSchedulerRequestStateRequestTypeResourceRuntimeErrorSampledPositionPropertySampledPropertysampleTerrainsampleTerrainMostDetailedSceneSceneModeSceneTransformsScreenSpaceCameraControllerScreenSpaceEventHandlerScreenSpaceEventTypeshaderDefinesshaderMaximumIntersectionsLengthshaderUniformsShadowMapShadowModeShowGeometryInstanceAttributeSimon1994PlanetaryPositionsSimplePolylineGeometrySingleTileImageryProviderSkyAtmosphereSkyBoxSphereEmitterSphereGeometrySphereOutlineGeometrySphericalSplineSplitDirectionStencilFunctionStencilOperationSteppedSplineStripeMaterialPropertyStripeOrientationStyleExpressionsubdivideArraySunSunLightTaskProcessorTerrainDataTerrainProviderTextureMagnificationFilterTextureMinificationFilterTextureUniformTileAvailabilityTileCoordinatesImageryProviderTileDiscardPolicyTileMapServiceImageryProviderTileProviderErrorTilingSchemeTimeDynamicImageryTimeDynamicPointCloudTimeIntervalTimeIntervalCollectionTimeIntervalCollectionPositionPropertyTimeIntervalCollectionPropertyTimeStandardTransformsTranslationRotationScaleTridiagonalSystemSolverTrustedServersUniformSpecifierUniformTypeUrlTemplateImageryProviderVaryingTypeVelocityOrientationPropertyVelocityVectorPropertyVertexFormatVerticalOriginVideoSynchronizerViewportQuadVisibilityVisualizerVoxelPrimitiveVoxelProviderVoxelShapeTypeVRTheWorldTerrainProviderWallGeometryWallGeometryUpdaterWallGraphicsWallOutlineGeometryWebGLConstantsWebGLOptionsWebMapServiceImageryProviderWebMapTileServiceImageryProviderWebMercatorProjectionWebMercatorTilingSchemeWindingOrderwriteTextToCanvasAnimationAnimationViewModelBaseLayerPickerBaseLayerPickerViewModelCesium3DTilesInspectorCesium3DTilesInspectorViewModelCesiumInspectorCesiumInspectorViewModelClockViewModelCommandcreateCommandFullscreenButtonFullscreenButtonViewModelGeocoderGeocoderViewModelHomeButtonHomeButtonViewModelInfoBoxInfoBoxViewModelNavigationHelpButtonNavigationHelpButtonViewModelPerformanceWatchdogPerformanceWatchdogViewModelProjectionPickerProjectionPickerViewModelProviderViewModelSceneModePickerSceneModePickerViewModelSelectionIndicatorSelectionIndicatorViewModelSvgPathBindingHandlerTimelineToggleButtonViewModelViewerviewerCesium3DTilesInspectorMixinviewerCesiumInspectorMixinviewerDragDropMixinviewerPerformanceWatchdogMixinviewerVoxelInspectorMixinVoxelInspectorVoxelInspectorViewModelVRButtonVRButtonViewModel

Cartesian4

Cartesian4是一个四维笛卡尔坐标系的类。四维笛卡尔坐标系表示一个点在四维空间中的位置,由四个浮点数(x, y, z, w)表示。

构造函数

  • Cartesian4(x: number, y: number, z: number, w: number): 创建一个四维笛卡尔坐标系的实例。参数包括x、y、z和w,分别表示笛卡尔坐标系中的x、y、z和w坐标。

  • Cartesian4.ZERO: 获取一个值为(0, 0, 0, 0)的Cartesian4实例。

  • Cartesian4.UNIT_X: 获取一个值为(1, 0, 0, 0)的Cartesian4实例。

  • Cartesian4.UNIT_Y: 获取一个值为(0, 1, 0, 0)的Cartesian4实例。

  • Cartesian4.UNIT_Z: 获取一个值为(0, 0, 1, 0)的Cartesian4实例。

  • Cartesian4.UNIT_W: 获取一个值为(0, 0, 0, 1)的Cartesian4实例。

属性

  • x: number: 获取或设置四维笛卡尔坐标系的x坐标。

  • y: number: 获取或设置四维笛卡尔坐标系的y坐标。

  • z: number: 获取或设置四维笛卡尔坐标系的z坐标。

  • w: number: 获取或设置四维笛卡尔坐标系的w坐标。

方法

  • clone(result?: Cartesian4): Cartesian4: 克隆当前实例,返回一个新的Cartesian4实例。如果传入参数result,则将克隆的值存储到该参数中,返回该参数。否则,返回新的实例。

  • equals(right: Cartesian4, epsilon?: number): boolean: 判断当前实例是否等于指定的另一个Cartesian4实例。如果两个实例在四个坐标都很接近,则认为它们相等。参数epsilon是一个可选参数,用于指定坐标比较的误差范围。如果不传该参数,则默认为Cesium.EPSILON12。返回布尔值。

  • toString(): string: 返回当前实例的字符串表示,格式为"(x, y, z, w)"。

静态方法

  • add(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 计算两个四维笛卡尔坐标系的和,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • subtract(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 计算两个四维笛卡尔坐标系的差,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • multiplyComponents(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 计算两个四维笛卡尔坐标系的分量乘积,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • divideComponents(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 计算两个四维笛卡尔坐标系的分量商,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • negate(cartesian: Cartesian4, result?: Cartesian4): Cartesian4: 计算指定四维笛卡尔坐标系的相反数,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • abs(cartesian: Cartesian4, result?: Cartesian4): Cartesian4: 计算指定四维笛卡尔坐标系的绝对值,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • normalize(cartesian: Cartesian4, result?: Cartesian4): Cartesian4: 将指定四维笛卡尔坐标系的坐标标准化,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • dot(left: Cartesian4, right: Cartesian4): number: 计算两个四维笛卡尔坐标系的点乘积。

  • multiplyByScalar(cartesian: Cartesian4, scalar: number, result?: Cartesian4): Cartesian4: 计算指定四维笛卡尔坐标系的标量乘积,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • divideByScalar(cartesian: Cartesian4, scalar: number, result?: Cartesian4): Cartesian4: 计算指定四维笛卡尔坐标系的标量商,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • magnitude(cartesian: Cartesian4): number: 计算指定四维笛卡尔坐标系的模长。

  • distance(left: Cartesian4, right: Cartesian4): number: 计算两个四维笛卡尔坐标系之间的距离。

  • distanceSquared(left: Cartesian4, right: Cartesian4): number: 计算两个四维笛卡尔坐标系之间距离的平方。

  • maximum(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 获取两个四维笛卡尔坐标系的每个坐标的最大值,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • minimum(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4: 获取两个四维笛卡尔坐标系的每个坐标的最小值,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • clamp(cartesian: Cartesian4, minimum: Cartesian4, maximum: Cartesian4, result?: Cartesian4): Cartesian4: 将四维笛卡尔坐标系中的每个坐标限制在指定的范围内,并返回一个新的Cartesian4实例。如果传入参数result,则将计算的值存储到该参数中,返回该参数。否则,返回新的实例。

  • pack(value: Cartesian4, array: number[], startingIndex?: number): number[]: 将四维笛卡尔坐标系压缩为一个数组。参数array指定存放压缩后的数据的数组,参数startingIndex指定从数组中的哪个索引位置开始存储数据。返回压缩后的数组。

  • unpack(array: number[], startingIndex?: number, result?: Cartesian4): Cartesian4: 将一个数组解压缩为一个四维笛卡尔坐标系。参数array是待解压缩的数组,参数startingIndex指定从数组中的哪个索引位置开始解压缩,参数result是一个可选参数,用于存储解压缩后的值。如果不传该参数,则会创建一个新的实例。返回解压缩后的Cartesian4实例。

示例

// 创建一个新的Cartesian4实例
var cartesian = new Cesium.Cartesian4(1.0, 2.0, 3.0, 4.0);

// 获取该实例的x、y、z和w坐标
var x = cartesian.x;
var y = cartesian.y;
var z = cartesian.z;
var w = cartesian.w;

// 克隆该实例
var clone = cartesian.clone();

// 判断两个实例是否相等
var equals = Cesium.Cartesian4.equals(cartesian, clone);

// 计算两个实例的和
var sum = Cesium.Cartesian4.add(cartesian, clone);

// 计算两个实例的差
var difference = Cesium.Cartesian4.subtract(cartesian, clone);

// 将该实例标准化
var normalized = Cesium.Cartesian4.normalize(cartesian);

// 计算该实例的模长
var length = Cesium.Cartesian4.magnitude(cartesian);

// 将该实例序列化为数组
var array = Cesium.Cartesian4.pack(cartesian);

// 从数组中解析出一个新的Cartesian4实例
var unpacked = Cesium.Cartesian4.unpack(array);