| 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
一个不可变的 Cartesian3 实例,初始化为 (1.0, 1.0, 1.0)。
用于将对象打包到数组中的元素数量。
static constant Cesium.Cartesian3.UNIT_X : Cartesian3
一个不可变的 Cartesian3 实例,初始化为 (1.0, 0.0, 0.0)。
static constant Cesium.Cartesian3.UNIT_Y : Cartesian3
一个不可变的 Cartesian3 实例,初始化为 (0.0, 1.0, 0.0)。
static constant Cesium.Cartesian3.UNIT_Z : Cartesian3
一个不可变的 Cartesian3 实例,初始化为 (0.0, 0.0, 1.0)。
static constant Cesium.Cartesian3.ZERO : Cartesian3
一个不可变的 Cartesian3 实例,初始化为 (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 容差g. |
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 <= value <= max。
static Cesium.Cartesian3.clone(cartesian, result) → Cartesian3
复制一个 Cartesian3 实例。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 要复制的 Cartesian 对象。 |
result |
Cartesian3 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,或者如果未提供则返回一个新的 Cartesian3 实例。(如果 cartesian 未定义,则返回 undefined)
static Cesium.Cartesian3.cross(left, right, result) → Cartesian3
计算两个笛卡尔坐标的叉(外)积。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
叉积的结果。
计算两点之间的距离。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 从中计算距离的第一个点。 |
right |
Cartesian3 | 要计算到的第二个点。 |
Returns:
两点之间的距离。
Example:
// 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));
计算两点之间的平方距离。使用此函数比较平方距离比使用
Cartesian3#distance 比较距离更高效。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 要计算距离的第一个点。 |
right |
Cartesian3 | 要计算距离的第二个点。 |
Returns:
两点之间的距离。
Example:
// 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
将提供的笛卡尔坐标按分量除以给定的标量。
| 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
从数组中的三个连续元素创建一个 Cartesian3。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 数组,其中三个连续元素分别对应 x、y 和 z 分量。 | |
startingIndex |
number |
0
|
optional 数组中第一个元素的偏移量,对应 x 分量。 |
result |
Cartesian3 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,或者如果未提供,则返回一个新的 Cartesian3 实例。
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
从现有的 Cartesian4 创建一个 Cartesian3 实例。这只是取 Cartesian4 的 x、y 和 z 属性,并丢弃 w。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要从中创建 Cartesian3 实例的 Cartesian4 对象。 |
result |
Cartesian3 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供则返回一个新的 Cartesian3 实例。
static Cesium.Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid, result) → Cartesian3
根据给定的经度和纬度(以度为单位)返回一个 Cartesian3 位置。
| Name | Type | Default | Description |
|---|---|---|---|
longitude |
number | 经度,单位为度 | |
latitude |
number | 纬度,单位为度 | |
height |
number |
0.0
|
optional 高度,单位为米,相对于椭球体。 |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 位置所在的椭球体。 |
result |
Cartesian3 | optional 用于存储结果的对象。 |
Returns:
位置
Example:
const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);
static Cesium.Cartesian3.fromDegreesArray(coordinates, ellipsoid, result) → Array.<Cartesian3>
根据给定的一组以度为单位的经纬度值,返回一个 Cartesian3 位置数组。
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | 一组经纬度值。值按顺序交替排列 [经度, 纬度, 经度, 纬度...]。 | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 坐标所在的椭球体。 |
result |
Array.<Cartesian3> | optional 用于存储结果的 Cartesian3 对象数组。 |
Returns:
位置数组。
Example:
const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);
static Cesium.Cartesian3.fromDegreesArrayHeights(coordinates, ellipsoid, result) → Array.<Cartesian3>
给定一个包含经度、纬度和高度值的数组(经纬度以度为单位),返回一个 Cartesian3 位置数组。
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | 一个经度、纬度和高度值的列表。值的顺序交替为 [经度, 纬度, 高度, 经度, 纬度, 高度...]。 | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 位置所在的椭球体。 |
result |
Array.<Cartesian3> | optional 用于存储结果的 Cartesian3 对象数组。 |
Returns:
位置数组。
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:
修改后的 result 参数,或者如果未提供,则返回一个新的 Cartesian3 实例。
static Cesium.Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result) → Cartesian3
根据给定的弧度单位的经度和纬度返回一个 Cartesian3 位置。
| Name | Type | Default | Description |
|---|---|---|---|
longitude |
number | 经度,单位为弧度 | |
latitude |
number | 纬度,单位为弧度 | |
height |
number |
0.0
|
optional 高度,单位为米,相对于椭球体 |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 位置所在的椭球体 |
result |
Cartesian3 | optional 用于存储结果的对象 |
Returns:
位置
Example:
const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);
static Cesium.Cartesian3.fromRadiansArray(coordinates, ellipsoid, result) → Array.<Cartesian3>
返回一个Cartesian3位置数组,给定的经纬度值以弧度表示。
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | 经纬度值列表。值按顺序交替排列 [经度, 纬度, 经度, 纬度...]。 | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 坐标所在的椭球体。 |
result |
Array.<Cartesian3> | optional 用于存储结果的Cartesian3对象数组。 |
Returns:
位置数组。
Example:
const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);
static Cesium.Cartesian3.fromRadiansArrayHeights(coordinates, ellipsoid, result) → Array.<Cartesian3>
给定一个包含经度、纬度和高度值的数组(经纬度以弧度表示),返回一个 Cartesian3 位置数组。
| Name | Type | Default | Description |
|---|---|---|---|
coordinates |
Array.<number> | 一个包含经度、纬度和高度值的列表。值的顺序为 [经度, 纬度, 高度, 经度, 纬度, 高度...]。 | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional 位置所在的椭球体。 |
result |
Array.<Cartesian3> | optional 用于存储结果的 Cartesian3 对象数组。 |
Returns:
位置数组。
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 | 要转换为笛卡尔坐标的球面坐标。 |
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:
修改后的 result 参数。
计算笛卡尔坐标的大小(长度)。
| 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
计算右侧和左侧笛卡尔坐标的中点。
| Name | Type | Description |
|---|---|---|
left |
Cartesian3 | 第一个笛卡尔坐标。 |
right |
Cartesian3 | 第二个笛卡尔坐标。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
中点。
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:
修改后的结果参数。
static Cesium.Cartesian3.pack(value, array, startingIndex) → Array.<number>|Float64Array|Float32Array
将提供的实例存储到提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
Cartesian3 | 要打包的值。 | |
array |
Array.<number> | Float64Array | Float32Array | 要打包到的数组。 | |
startingIndex |
number |
0
|
optional 开始打包元素的数组索引。 |
Returns:
被打包的数组
将一个 Cartesian3 数组展平为一个分量数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<Cartesian3> | 要打包的笛卡尔数组。 |
result |
Array.<number> | Float64Array | Float32Array |
optional
用于存储结果的数组。如果这是一个类型化数组,它必须有 array.length * 3 个分量,否则会抛出 DeveloperError。如果是普通数组,它将被调整大小以包含 (array.length * 3) 个元素。 |
Returns:
打包后的数组。
static Cesium.Cartesian3.projectVector(a, b, result) → Cartesian3
将向量 a 投影到向量 b 上
| Name | Type | Description |
|---|---|---|
a |
Cartesian3 | 需要投影的向量 |
b |
Cartesian3 | 要投影到的向量 |
result |
Cartesian3 | 结果向量 |
Returns:
修改后的结果参数
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> | Float64Array | Float32Array | 打包数组。 | |
startingIndex |
number |
0
|
optional 要解包的元素的起始索引。 |
result |
Cartesian3 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供则返回一个新的 Cartesian3 实例。
static Cesium.Cartesian3.unpackArray(array, result) → Array.<Cartesian3>
将笛卡尔分量数组解包为 Cartesian3 数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | Float64Array | Float32Array | 要解包的分量数组。 |
result |
Array.<Cartesian3> | optional 存储结果的数组。 |
Returns:
解包后的数组。
