| Name | Type | Default | Description |
|---|---|---|---|
x |
number |
0.0
|
optional X 分量。 |
y |
number |
0.0
|
optional Y 分量。 |
z |
number |
0.0
|
optional Z 分量。 |
See:
Members
X分量。
-
Default Value:
0.0
Y分量。
-
Default Value:
0.0
Z分量。
-
Default Value:
0.0
static constant Cesium.Cartesian3.ONE : Cartesian3
An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
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).
Methods
clone(result) → Cartesian3
复制此Cartesian3实例。
| Name | Type | Description |
|---|---|---|
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数;如果未提供则返回新的Cartesian3实例。
逐分量将此笛卡尔坐标与提供的笛卡尔坐标进行比较,如果相等则返回
true,否则返回false。
| Name | Type | Description |
|---|---|---|
right |
Cartesian3 | optional 右侧的笛卡尔坐标。 |
Returns:
如果相等则返回
true,否则返回false。
逐分量将此笛卡尔坐标与提供的笛卡尔坐标进行比较,如果通过绝对或相对容差测试则返回
true,否则返回false。
| Name | Type | Default | Description |
|---|---|---|---|
right |
Cartesian3 | optional 右侧的笛卡尔坐标。 | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对epsilon容差。 |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于相等性测试的绝对epsilon容差。 |
Returns:
如果它们在提供的epsilon范围内则返回
true,否则返回false。
创建表示此笛卡尔坐标的字符串,格式为'(x, y, z)'。
Returns:
表示此笛卡尔坐标的字符串,格式为'(x, y, z)'。
static Cesium.Cartesian3.abs(cartesian, result) → Cartesian3
计算提供的笛卡尔坐标的绝对值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要计算绝对值的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.add(left, right, result) → Cartesian3
计算两个笛卡尔坐标的分量和。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
返回提供的笛卡尔坐标之间的角度(弧度)。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
Returns:
笛卡尔坐标之间的角度。
static Cesium.Cartesian3.clamp(value, min, max, result) → Cartesian3
将值限制在两个值之间。
| Name | Type | Description |
|---|---|---|
value |
Cartesian3 | 要限制的值。 |
min |
Cartesian3 | 最小边界。 |
max |
Cartesian3 | 最大边界。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
限制后的值,满足 min <= result <= max。
static Cesium.Cartesian3.clone(cartesian, result) → Cartesian3
复制Cartesian3实例。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要复制的笛卡尔坐标。 |
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数;如果未提供则返回新的Cartesian3实例。(如果cartesian未定义则返回undefined)
static Cesium.Cartesian3.cross(left, right, result) → Cartesian3
Computes the cross (outer) product of two Cartesians.
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | The first Cartesian. |
right |
Cartesian3 | The second Cartesian. |
result |
Cartesian3 | The object onto which to store the result. |
Returns:
The cross product.
计算两点之间的距离。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 要计算距离的的第一个点。 |
right |
Cartesian3 | 要计算距离的第二个点。 |
Returns:
两点之间的距离。
Example:
// 返回 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));
计算两点之间的平方距离。使用此函数
比较平方距离比使用
Cartesian3#distance比较距离更高效。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 要计算距离的的第一个点。 |
right |
Cartesian3 | 要计算距离的第二个点。 |
Returns:
两点之间的距离平方。
Example:
// 返回 4.0,不是 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
将提供的笛卡尔坐标按分量除以提供的标量。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要除的笛卡尔坐标。 |
scalar |
number | 要除以的标量。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.divideComponents(left, right, result) → Cartesian3
计算两个笛卡尔坐标的分量商。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
计算两个笛卡尔坐标的点积(标量积)。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
Returns:
点积。
逐分量比较提供的笛卡尔坐标,如果相等则返回
true,否则返回false。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | optional 第一个笛卡尔坐标。 |
right |
Cartesian3 | optional 第二个笛卡尔坐标。 |
Returns:
如果left和right相等则返回
true,否则返回false。
逐分量比较提供的笛卡尔坐标,如果通过绝对或相对容差测试则返回
true,否则返回false。
| Name | Type | Default | Description |
|---|---|---|---|
left |
Cartesian3 | optional 第一个笛卡尔坐标。 | |
right |
Cartesian3 | optional 第二个笛卡尔坐标。 | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对epsilon容差。 |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于相等性测试的绝对epsilon容差。 |
Returns:
如果left和right在提供的epsilon范围内则返回
true,否则返回false。
static Cesium.Cartesian3.fromArray(array, startingIndex, result) → Cartesian3
Creates a Cartesian3 from three consecutive elements in an array.
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | The array whose three consecutive elements correspond to the x, y, and z components, respectively. | |
startingIndex |
number |
0
|
optional The offset into the array of the first element, which corresponds to the x component. |
result |
Cartesian3 | optional The object onto which to store the result. |
Returns:
The modified result parameter or a new Cartesian3 instance if one was not provided.
Example:
// 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.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | The Cartesian4 instance to create a Cartesian3 instance from. |
result |
Cartesian3 | optional The object onto which to store the result. |
Returns:
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.
| Name | Type | Default | Description |
|---|---|---|---|
longitude |
number | The longitude, in degrees | |
latitude |
number | The latitude, in degrees | |
height |
number |
0.0
|
optional The height, in meters, above the ellipsoid. |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the position lies. |
result |
Cartesian3 | optional The object onto which to store the result. |
Returns:
The position
Example:
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.
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...]. | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the coordinates lie. |
result |
Array.<Cartesian3> | optional An array of Cartesian3 objects to store the result. |
Returns:
The array of positions.
Example:
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.
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...]. | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the position lies. |
result |
Array.<Cartesian3> | optional An array of Cartesian3 objects to store the result. |
Returns:
The array of positions.
Example:
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
从x、y和z坐标创建Cartesian3实例。
| Name | Type | Description |
|---|---|---|
x |
number | x坐标。 |
y |
number | y坐标。 |
z |
number | z坐标。 |
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数;如果未提供则返回新的Cartesian3实例。
static Cesium.Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result) → Cartesian3
Returns a Cartesian3 position from longitude and latitude values given in radians.
| Name | Type | Default | Description |
|---|---|---|---|
longitude |
number | The longitude, in radians | |
latitude |
number | The latitude, in radians | |
height |
number |
0.0
|
optional The height, in meters, above the ellipsoid. |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the position lies. |
result |
Cartesian3 | optional The object onto which to store the result. |
Returns:
The position
Example:
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.
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...]. | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the coordinates lie. |
result |
Array.<Cartesian3> | optional An array of Cartesian3 objects to store the result. |
Returns:
The array of positions.
Example:
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.
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...]. | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid on which the position lies. |
result |
Array.<Cartesian3> | optional An array of Cartesian3 objects to store the result. |
Returns:
The array of positions.
Example:
const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);
static Cesium.Cartesian3.fromSpherical(spherical, result) → Cartesian3
将提供的球面坐标转换为Cartesian3坐标。
| Name | Type | Description |
|---|---|---|
spherical |
Spherical | 要转换为Cartesian3的球面坐标。 |
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数;如果未提供则返回新的Cartesian3实例。
static Cesium.Cartesian3.lerp(start, end, t, result) → Cartesian3
使用提供的笛卡尔坐标计算t处的线性插值或外推。
| Name | Type | Description |
|---|---|---|
start |
Cartesian3 | t为0.0时对应的值。 |
end |
Cartesian3 | t为1.0时对应的值。 |
t |
number | 要插值的t点。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
计算笛卡尔坐标的模长(长度)。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要计算模长的笛卡尔实例。 |
Returns:
模长。
计算提供的笛卡尔坐标的平方模长。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要计算平方模长的笛卡尔实例。 |
Returns:
平方模长。
static Cesium.Cartesian3.maximumByComponent(first, second, result) → Cartesian3
比较两个笛卡尔坐标并计算包含两者最大分量的笛卡尔坐标。
| Name | Type | Description |
|---|---|---|
first |
Cartesian3 | 要比较的笛卡尔坐标。 |
second |
Cartesian3 | 要比较的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
包含最大分量的笛卡尔坐标。
计算提供的笛卡尔坐标的最大分量值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要使用的笛卡尔坐标。 |
Returns:
最大分量的值。
static Cesium.Cartesian3.midpoint(left, right, result) → Cartesian3
Computes the midpoint between the right and left Cartesian.
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | The first Cartesian. |
right |
Cartesian3 | The second Cartesian. |
result |
Cartesian3 | The object onto which to store the result. |
Returns:
The midpoint.
static Cesium.Cartesian3.minimumByComponent(first, second, result) → Cartesian3
比较两个笛卡尔坐标并计算包含两者最小分量的笛卡尔坐标。
| Name | Type | Description |
|---|---|---|
first |
Cartesian3 | 要比较的笛卡尔坐标。 |
second |
Cartesian3 | 要比较的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
包含最小分量的笛卡尔坐标。
计算提供的笛卡尔坐标的最小分量值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要使用的笛卡尔坐标。 |
Returns:
最小分量的值。
static Cesium.Cartesian3.mostOrthogonalAxis(cartesian, result) → Cartesian3
返回与提供的笛卡尔坐标最正交的轴。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要在其上查找最正交轴的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
最正交的轴。
static Cesium.Cartesian3.multiplyByScalar(cartesian, scalar, result) → Cartesian3
将提供的笛卡尔坐标按分量乘以提供的标量。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要缩放的笛卡尔坐标。 |
scalar |
number | 要相乘的标量。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.multiplyComponents(left, right, result) → Cartesian3
计算两个笛卡尔坐标的分量积。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.negate(cartesian, result) → Cartesian3
对提供的笛卡尔坐标取反。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要取反的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.normalize(cartesian, result) → Cartesian3
计算提供的笛卡尔坐标的归一化形式。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要归一化的笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
将提供的实例存储到提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
Cartesian3 | 要打包的值。 | |
array |
Array.<number> | 要打包到的数组。 | |
startingIndex |
number |
0
|
optional 开始打包元素的数组索引。 |
Returns:
已打包的数组
将Cartesian3数组展平为分量数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<Cartesian3> | 要打包的笛卡尔坐标数组。 |
result |
Array.<number> |
optional
存储结果的数组。如果是类型化数组,则必须包含array.length * 3个分量,否则将抛出DeveloperError。如果是常规数组,则会调整大小以具有(array.length * 3)个元素。 |
Returns:
打包后的数组。
static Cesium.Cartesian3.projectVector(a, b, result) → Cartesian3
Projects vector a onto vector b
| Name | Type | Description |
|---|---|---|
a |
Cartesian3 | The vector that needs projecting |
b |
Cartesian3 | The vector to project onto |
result |
Cartesian3 | The result cartesian |
Returns:
The modified result parameter
static Cesium.Cartesian3.subtract(left, right, result) → Cartesian3
计算两个笛卡尔坐标的分量差。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian3.unpack(array, startingIndex, result) → Cartesian3
从打包数组中检索实例。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 打包数组。 | |
startingIndex |
number |
0
|
optional 要解包元素的起始索引。 |
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数;如果未提供则返回新的Cartesian3实例。
static Cesium.Cartesian3.unpackArray(array, result) → Array.<Cartesian3>
将笛卡尔分量数组解包为Cartesian3数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解包的分量数组。 |
result |
Array.<Cartesian3> | optional 存储结果的数组。 |
Returns:
解包后的数组。
