Cartesian3

new Cesium.Cartesian3(x, y, z)

A 3D Cartesian point.
参数名称 类型 默认值 描述信息
x number 0.0 可选 The X component.
y number 0.0 可选 The Y component.
z number 0.0 可选 The Z component.
参考:

成员(属性)

The X component.
默认值: 0.0
The Y component.
默认值: 0.0
The Z component.
默认值: 0.0

static constant Cesium.Cartesian3.ONE : Cartesian3

An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).

static Cesium.Cartesian3.packedLength : number

The number of elements used to pack the object into an array.

static constant Cesium.Cartesian3.UNIT_X : Cartesian3

An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).

static constant Cesium.Cartesian3.UNIT_Y : Cartesian3

An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).

static constant Cesium.Cartesian3.UNIT_Z : Cartesian3

An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).

static constant Cesium.Cartesian3.ZERO : Cartesian3

An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).

方法

Duplicates this Cartesian3 instance.
参数名称 类型 描述信息
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.

equals(right)boolean

Compares this Cartesian against the provided Cartesian componentwise and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
right Cartesian3 可选 The right hand side Cartesian.
返回值:
true if they are equal, false otherwise.

equalsEpsilon(right, relativeEpsilon, absoluteEpsilon)boolean

Compares this Cartesian against the provided Cartesian componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.
参数名称 类型 默认值 描述信息
right Cartesian3 可选 The right hand side Cartesian.
relativeEpsilon number 0 可选 The relative epsilon tolerance to use for equality testing.
absoluteEpsilon number relativeEpsilon 可选 The absolute epsilon tolerance to use for equality testing.
返回值:
true if they are within the provided epsilon, false otherwise.
Creates a string representing this Cartesian in the format '(x, y, z)'.
返回值:
A string representing this Cartesian in the format '(x, y, z)'.

static Cesium.Cartesian3.abs(cartesian, result)Cartesian3

Computes the absolute value of the provided Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian whose absolute value is to be computed.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.add(left, right, result)Cartesian3

Computes the componentwise sum of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.angleBetween(left, right)number

Returns the angle, in radians, between the provided Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
返回值:
The angle between the Cartesians.

static Cesium.Cartesian3.clamp(cartesian, min, max, result)Cartesian3

Constrain a value to lie between two values.
参数名称 类型 描述信息
cartesian Cartesian3 The value to clamp.
min Cartesian3 The minimum bound.
max Cartesian3 The maximum bound.
result Cartesian3 The object into which to store the result.
返回值:
The clamped value such that min <= value <= max.

static Cesium.Cartesian3.clone(cartesian, result)Cartesian3

Duplicates a Cartesian3 instance.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian to duplicate.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)

static Cesium.Cartesian3.cross(left, right, result)Cartesian3

Computes the cross (outer) product of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The cross product.

static Cesium.Cartesian3.distance(left, right)number

Computes the distance between two points.
参数名称 类型 描述信息
left Cartesian3 The first point to compute the distance from.
right Cartesian3 The second point to compute the distance to.
返回值:
The distance between two points.
使用示例:
// Returns 1.0
const d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0));

static Cesium.Cartesian3.distanceSquared(left, right)number

Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using Cartesian3#distance.
参数名称 类型 描述信息
left Cartesian3 The first point to compute the distance from.
right Cartesian3 The second point to compute the distance to.
返回值:
The distance between two points.
使用示例:
// Returns 4.0, not 2.0
const d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0));

static Cesium.Cartesian3.divideByScalar(cartesian, scalar, result)Cartesian3

Divides the provided Cartesian componentwise by the provided scalar.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian to be divided.
scalar number The scalar to divide by.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.divideComponents(left, right, result)Cartesian3

Computes the componentwise quotient of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.dot(left, right)number

Computes the dot (scalar) product of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
返回值:
The dot product.

static Cesium.Cartesian3.equals(left, right)boolean

Compares the provided Cartesians componentwise and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
left Cartesian3 可选 The first Cartesian.
right Cartesian3 可选 The second Cartesian.
返回值:
true if left and right are equal, false otherwise.

static Cesium.Cartesian3.equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon)boolean

Compares the provided Cartesians componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.
参数名称 类型 默认值 描述信息
left Cartesian3 可选 The first Cartesian.
right Cartesian3 可选 The second Cartesian.
relativeEpsilon number 0 可选 The relative epsilon tolerance to use for equality testing.
absoluteEpsilon number relativeEpsilon 可选 The absolute epsilon tolerance to use for equality testing.
返回值:
true if left and right are within the provided epsilon, false otherwise.

static Cesium.Cartesian3.fromArray(array, startingIndex, result)Cartesian3

Creates a Cartesian3 from three consecutive elements in an array.
参数名称 类型 默认值 描述信息
array Array.<number> The array whose three consecutive elements correspond to the x, y, and z components, respectively.
startingIndex number 0 可选 The offset into the array of the first element, which corresponds to the x component.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.
使用示例:
// Create a Cartesian3 with (1.0, 2.0, 3.0)
const v = [1.0, 2.0, 3.0];
const p = Cesium.Cartesian3.fromArray(v);

// Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
const p2 = Cesium.Cartesian3.fromArray(v2, 2);

static Cesium.Cartesian3.fromCartesian4(cartesian, result)Cartesian3

Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the x, y, and z properties of the Cartesian4 and drops w.
参数名称 类型 描述信息
cartesian Cartesian4 The Cartesian4 instance to create a Cartesian3 instance from.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.

static Cesium.Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid, result)Cartesian3

Returns a Cartesian3 position from longitude and latitude values given in degrees.
参数名称 类型 默认值 描述信息
longitude number The longitude, in degrees
latitude number The latitude, in degrees
height number 0.0 可选 The height, in meters, above the ellipsoid.
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the position lies.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The position
使用示例:
const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);

static Cesium.Cartesian3.fromDegreesArray(coordinates, ellipsoid, result)Array.<Cartesian3>

Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees.
参数名称 类型 默认值 描述信息
coordinates Array.<number> A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the coordinates lie.
result Array.<Cartesian3> 可选 An array of Cartesian3 objects to store the result.
返回值:
The array of positions.
使用示例:
const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);

static Cesium.Cartesian3.fromDegreesArrayHeights(coordinates, ellipsoid, result)Array.<Cartesian3>

Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees.
参数名称 类型 默认值 描述信息
coordinates Array.<number> A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the position lies.
result Array.<Cartesian3> 可选 An array of Cartesian3 objects to store the result.
返回值:
The array of positions.
使用示例:
const positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]);

static Cesium.Cartesian3.fromElements(x, y, z, result)Cartesian3

Creates a Cartesian3 instance from x, y and z coordinates.
参数名称 类型 描述信息
x number The x coordinate.
y number The y coordinate.
z number The z coordinate.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.

static Cesium.Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result)Cartesian3

Returns a Cartesian3 position from longitude and latitude values given in radians.
参数名称 类型 默认值 描述信息
longitude number The longitude, in radians
latitude number The latitude, in radians
height number 0.0 可选 The height, in meters, above the ellipsoid.
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the position lies.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The position
使用示例:
const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);

static Cesium.Cartesian3.fromRadiansArray(coordinates, ellipsoid, result)Array.<Cartesian3>

Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians.
参数名称 类型 默认值 描述信息
coordinates Array.<number> A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the coordinates lie.
result Array.<Cartesian3> 可选 An array of Cartesian3 objects to store the result.
返回值:
The array of positions.
使用示例:
const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);

static Cesium.Cartesian3.fromRadiansArrayHeights(coordinates, ellipsoid, result)Array.<Cartesian3>

Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians.
参数名称 类型 默认值 描述信息
coordinates Array.<number> A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 The ellipsoid on which the position lies.
result Array.<Cartesian3> 可选 An array of Cartesian3 objects to store the result.
返回值:
The array of positions.
使用示例:
const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);

static Cesium.Cartesian3.fromSpherical(spherical, result)Cartesian3

Converts the provided Spherical into Cartesian3 coordinates.
参数名称 类型 描述信息
spherical Spherical The Spherical to be converted to Cartesian3.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.

static Cesium.Cartesian3.lerp(start, end, t, result)Cartesian3

Computes the linear interpolation or extrapolation at t using the provided cartesians.
参数名称 类型 描述信息
start Cartesian3 The value corresponding to t at 0.0.
end Cartesian3 The value corresponding to t at 1.0.
t number The point along t at which to interpolate.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.magnitude(cartesian)number

Computes the Cartesian's magnitude (length).
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian instance whose magnitude is to be computed.
返回值:
The magnitude.

static Cesium.Cartesian3.magnitudeSquared(cartesian)number

Computes the provided Cartesian's squared magnitude.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian instance whose squared magnitude is to be computed.
返回值:
The squared magnitude.

static Cesium.Cartesian3.maximumByComponent(first, second, result)Cartesian3

Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
参数名称 类型 描述信息
first Cartesian3 A cartesian to compare.
second Cartesian3 A cartesian to compare.
result Cartesian3 The object into which to store the result.
返回值:
A cartesian with the maximum components.

static Cesium.Cartesian3.maximumComponent(cartesian)number

Computes the value of the maximum component for the supplied Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The cartesian to use.
返回值:
The value of the maximum component.

static Cesium.Cartesian3.midpoint(left, right, result)Cartesian3

Computes the midpoint between the right and left Cartesian.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The midpoint.

static Cesium.Cartesian3.minimumByComponent(first, second, result)Cartesian3

Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
参数名称 类型 描述信息
first Cartesian3 A cartesian to compare.
second Cartesian3 A cartesian to compare.
result Cartesian3 The object into which to store the result.
返回值:
A cartesian with the minimum components.

static Cesium.Cartesian3.minimumComponent(cartesian)number

Computes the value of the minimum component for the supplied Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The cartesian to use.
返回值:
The value of the minimum component.

static Cesium.Cartesian3.mostOrthogonalAxis(cartesian, result)Cartesian3

Returns the axis that is most orthogonal to the provided Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian on which to find the most orthogonal axis.
result Cartesian3 The object onto which to store the result.
返回值:
The most orthogonal axis.

static Cesium.Cartesian3.multiplyByScalar(cartesian, scalar, result)Cartesian3

Multiplies the provided Cartesian componentwise by the provided scalar.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian to be scaled.
scalar number The scalar to multiply with.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.multiplyComponents(left, right, result)Cartesian3

Computes the componentwise product of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.negate(cartesian, result)Cartesian3

Negates the provided Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian to be negated.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.normalize(cartesian, result)Cartesian3

Computes the normalized form of the supplied Cartesian.
参数名称 类型 描述信息
cartesian Cartesian3 The Cartesian to be normalized.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.pack(value, array, startingIndex)Array.<number>

Stores the provided instance into the provided array.
参数名称 类型 默认值 描述信息
value Cartesian3 The value to pack.
array Array.<number> The array to pack into.
startingIndex number 0 可选 The index into the array at which to start packing the elements.
返回值:
The array that was packed into

static Cesium.Cartesian3.packArray(array, result)Array.<number>

Flattens an array of Cartesian3s into an array of components.
参数名称 类型 描述信息
array Array.<Cartesian3> The array of cartesians to pack.
result Array.<number> 可选 The array onto which to store the result. If this is a typed array, it must have array.length * 3 components, else a DeveloperError will be thrown. If it is a regular array, it will be resized to have (array.length * 3) elements.
返回值:
The packed array.

static Cesium.Cartesian3.projectVector(a, b, result)Cartesian3

Projects vector a onto vector b
参数名称 类型 描述信息
a Cartesian3 The vector that needs projecting
b Cartesian3 The vector to project onto
result Cartesian3 The result cartesian
返回值:
The modified result parameter

static Cesium.Cartesian3.subtract(left, right, result)Cartesian3

Computes the componentwise difference of two Cartesians.
参数名称 类型 描述信息
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Cartesian3.unpack(array, startingIndex, result)Cartesian3

Retrieves an instance from a packed array.
参数名称 类型 默认值 描述信息
array Array.<number> The packed array.
startingIndex number 0 可选 The starting index of the element to be unpacked.
result Cartesian3 可选 The object into which to store the result.
返回值:
The modified result parameter or a new Cartesian3 instance if one was not provided.

static Cesium.Cartesian3.unpackArray(array, result)Array.<Cartesian3>

Unpacks an array of cartesian components into an array of Cartesian3s.
参数名称 类型 描述信息
array Array.<number> The array of components to unpack.
result Array.<Cartesian3> 可选 The array onto which to store the result.
返回值:
The unpacked array.