| Name | Type | Default | Description |
|---|---|---|---|
x |
number |
0.0
|
optional X 分量。 |
y |
number |
0.0
|
optional Y 分量。 |
z |
number |
0.0
|
optional Z 分量。 |
w |
number |
0.0
|
optional W 分量。 |
See:
Members
W 分量。
-
Default Value:
0.0
X 分量。
-
Default Value:
0.0
Y 分量。
-
Default Value:
0.0
Z 分量。
-
Default Value:
0.0
static constant Cesium.Cartesian4.ONE : Cartesian4
初始化为 (1.0, 1.0, 1.0, 1.0) 的不可变 Cartesian4 实例。
用于将对象打包到数组中的元素数。
static constant Cesium.Cartesian4.UNIT_W : Cartesian4
初始化为 (0.0, 0.0, 0.0, 1.0) 的不可变 Cartesian4 实例。
static constant Cesium.Cartesian4.UNIT_X : Cartesian4
初始化为 (1.0, 0.0, 0.0, 0.0) 的不可变 Cartesian4 实例。
static constant Cesium.Cartesian4.UNIT_Y : Cartesian4
初始化为 (0.0, 1.0, 0.0, 0.0) 的不可变 Cartesian4 实例。
static constant Cesium.Cartesian4.UNIT_Z : Cartesian4
初始化为 (0.0, 0.0, 1.0, 0.0) 的不可变 Cartesian4 实例。
static constant Cesium.Cartesian4.ZERO : Cartesian4
初始化为 (0.0, 0.0, 0.0, 0.0) 的不可变 Cartesian4 实例。
Methods
clone(result) → Cartesian4
复制此 Cartesian4 实例。
| Name | Type | Description |
|---|---|---|
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。
逐分量比较此笛卡尔坐标与提供的笛卡尔坐标,如果相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
right |
Cartesian4 | optional 右侧的笛卡尔坐标。 |
Returns:
如果相等则返回
true,否则返回 false。
逐分量比较此笛卡尔坐标与提供的笛卡尔坐标,如果通过绝对或相对容差测试则返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
right |
Cartesian4 | optional 右侧的笛卡尔坐标。 | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对 epsilon 容差。 |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于相等性测试的绝对 epsilon 容差。 |
Returns:
如果在提供的 epsilon 范围内则返回
true,否则返回 false。
创建表示此笛卡尔坐标的字符串,格式为 '(x, y, z, w)'。
Returns:
表示所提供笛卡尔坐标的字符串,格式为 '(x, y, z, w)'。
static Cesium.Cartesian4.abs(cartesian, result) → Cartesian4
计算所提供笛卡尔坐标的绝对值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要计算绝对值的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.add(left, right, result) → Cartesian4
计算两个笛卡尔坐标的逐分量和。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 第一个笛卡尔坐标。 |
right |
Cartesian4 | 第二个笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.clamp(value, min, max, result) → Cartesian4
将值约束在两个值之间。
| Name | Type | Description |
|---|---|---|
value |
Cartesian4 | 要限制的值。 |
min |
Cartesian4 | 最小边界。 |
max |
Cartesian4 | 最大边界。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
限制后的值,使得 min <= result <= max。
static Cesium.Cartesian4.clone(cartesian, result) → Cartesian4
复制 Cartesian4 实例。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要复制的笛卡尔坐标。 |
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。(如果 cartesian 为 undefined 则返回 undefined)
计算两点之间的四维空间距离。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 计算距离的第一个点。 |
right |
Cartesian4 | 计算距离的第二个点。 |
Returns:
两点之间的距离。
Example:
// Returns 1.0
const d = Cesium.Cartesian4.distance(
new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));
计算两点之间的距离平方。使用此函数比较距离平方
比使用
Cartesian4#distance 比较距离更高效。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 计算距离的第一个点。 |
right |
Cartesian4 | 计算距离的第二个点。 |
Returns:
两点之间的距离。
Example:
// Returns 4.0, not 2.0
const d = Cesium.Cartesian4.distance(
new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));
static Cesium.Cartesian4.divideByScalar(cartesian, scalar, result) → Cartesian4
将所提供的笛卡尔坐标逐分量除以所提供的标量。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要被除的笛卡尔坐标。 |
scalar |
number | 要除以的标量。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.divideComponents(left, right, result) → Cartesian4
计算两个笛卡尔坐标的逐分量商。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 第一个笛卡尔坐标。 |
right |
Cartesian4 | 第二个笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
计算两个笛卡尔坐标的点积(标量积)。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 第一个笛卡尔坐标。 |
right |
Cartesian4 | 第二个笛卡尔坐标。 |
Returns:
点积。
逐分量比较所提供的笛卡尔坐标,如果相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | optional 第一个笛卡尔坐标。 |
right |
Cartesian4 | optional 第二个笛卡尔坐标。 |
Returns:
如果 left 和 right 相等则返回
true,否则返回 false。
逐分量比较所提供的笛卡尔坐标,如果通过绝对或相对容差测试则返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
left |
Cartesian4 | optional 第一个笛卡尔坐标。 | |
right |
Cartesian4 | optional 第二个笛卡尔坐标。 | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对 epsilon 容差。 |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于相等性测试的绝对 epsilon 容差。 |
Returns:
如果 left 和 right 在提供的 epsilon 范围内则返回
true,否则返回 false。
static Cesium.Cartesian4.fromArray(array, startingIndex, result) → Cartesian4
从数组中四个连续元素创建 Cartesian4。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 其四个连续元素分别对应 x、y、z 和 w 分量的数组。 | |
startingIndex |
number |
0
|
optional 数组中第一个元素(对应 x 分量)的偏移量。 |
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。
Example:
// Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0)
const v = [1.0, 2.0, 3.0, 4.0];
const p = Cesium.Cartesian4.fromArray(v);
// Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0];
const p2 = Cesium.Cartesian4.fromArray(v2, 2);
static Cesium.Cartesian4.fromColor(color, result) → Cartesian4
| Name | Type | Description |
|---|---|---|
color |
Color | 源颜色。 |
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。
static Cesium.Cartesian4.fromElements(x, y, z, w, result) → Cartesian4
从 x、y、z 和 w 坐标创建 Cartesian4 实例。
| Name | Type | Description |
|---|---|---|
x |
number | x 坐标。 |
y |
number | y 坐标。 |
z |
number | z 坐标。 |
w |
number | w 坐标。 |
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。
static Cesium.Cartesian4.lerp(start, end, t, result) → Cartesian4
使用所提供的笛卡尔坐标计算 t 处的线性插值或外推。
| Name | Type | Description |
|---|---|---|
start |
Cartesian4 | t 为 0.0 时对应的值。 |
end |
Cartesian4 | t 为 1.0 时对应的值。 |
t |
number | 要插值的 t 方向上的点。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
计算笛卡尔坐标的模(长度)。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要计算模的笛卡尔坐标实例。 |
Returns:
模。
计算所提供笛卡尔坐标的模平方。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要计算模平方的笛卡尔坐标实例。 |
Returns:
模平方。
static Cesium.Cartesian4.maximumByComponent(first, second, result) → Cartesian4
比较两个笛卡尔坐标,并计算包含所提供笛卡尔坐标最大分量的笛卡尔坐标。
| Name | Type | Description |
|---|---|---|
first |
Cartesian4 | 要比较的笛卡尔坐标。 |
second |
Cartesian4 | 要比较的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
包含最大分量的笛卡尔坐标。
计算所提供笛卡尔坐标的最大分量值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要使用的笛卡尔坐标。 |
Returns:
最大分量的值。
static Cesium.Cartesian4.minimumByComponent(first, second, result) → Cartesian4
比较两个笛卡尔坐标,并计算包含所提供笛卡尔坐标最小分量的笛卡尔坐标。
| Name | Type | Description |
|---|---|---|
first |
Cartesian4 | 要比较的笛卡尔坐标。 |
second |
Cartesian4 | 要比较的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
包含最小分量的笛卡尔坐标。
计算所提供笛卡尔坐标的最小分量值。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要使用的笛卡尔坐标。 |
Returns:
最小分量的值。
static Cesium.Cartesian4.mostOrthogonalAxis(cartesian, result) → Cartesian4
返回与所提供笛卡尔坐标最正交的轴。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要查找最正交轴的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
最正交的轴。
static Cesium.Cartesian4.multiplyByScalar(cartesian, scalar, result) → Cartesian4
将所提供的笛卡尔坐标逐分量乘以所提供的标量。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要缩放的笛卡尔坐标。 |
scalar |
number | 要乘以的标量。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.multiplyComponents(left, right, result) → Cartesian4
计算两个笛卡尔坐标的逐分量积。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 第一个笛卡尔坐标。 |
right |
Cartesian4 | 第二个笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.negate(cartesian, result) → Cartesian4
对所提供的笛卡尔坐标取反。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要取反的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.normalize(cartesian, result) → Cartesian4
计算所提供笛卡尔坐标的归一化形式。
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 要归一化的笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
将所提供的实例存储到所提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
Cartesian4 | 要打包的值。 | |
array |
Array.<number> | 要打包到的数组。 | |
startingIndex |
number |
0
|
optional 数组中开始打包元素的索引。 |
Returns:
被打包到的数组
将 Cartesian4 数组展平为分量数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<Cartesian4> | 要打包的笛卡尔坐标数组。 |
result |
Array.<number> |
optional
用于存储结果的数组。如果是类型化数组,它必须有 array.length * 4 个分量,否则将抛出 DeveloperError。如果是常规数组,它将被调整为 (array.length * 4) 个元素。 |
Returns:
打包后的数组。
static Cesium.Cartesian4.packFloat(value, result) → Cartesian4
将任意浮点值打包为 4 个可用 uint8 表示的值。
| Name | Type | Description |
|---|---|---|
value |
number | 一个浮点数。 |
result |
Cartesian4 | optional 包含打包浮点数的 Cartesian4。 |
Returns:
表示打包到 x、y、z 和 w 中值的浮点数的 Cartesian4。
static Cesium.Cartesian4.subtract(left, right, result) → Cartesian4
计算两个笛卡尔坐标的逐分量差。
| Name | Type | Description |
|---|---|---|
left |
Cartesian4 | 第一个笛卡尔坐标。 |
right |
Cartesian4 | 第二个笛卡尔坐标。 |
result |
Cartesian4 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Cartesian4.unpack(array, startingIndex, result) → Cartesian4
从打包数组中检索实例。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 打包后的数组。 | |
startingIndex |
number |
0
|
optional 要解包的元素的起始索引。 |
result |
Cartesian4 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,或如果未提供则返回新的 Cartesian4 实例。
static Cesium.Cartesian4.unpackArray(array, result) → Array.<Cartesian4>
将笛卡尔分量数组解包为 Cartesian4 数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解包的分量数组。 |
result |
Array.<Cartesian4> | optional 用于存储结果的数组。 |
Returns:
解包后的数组。
