一个二维笛卡尔坐标点。
| Name | Type | Default | Description |
|---|---|---|---|
x |
number |
0.0
|
optional X轴的坐标. |
y |
number |
0.0
|
optional Y轴的坐标. |
See:
Members
X轴的坐标.
-
Default Value:
0.0
Y轴的坐标.
-
Default Value:
0.0
static constant Cesium.Cartesian2.ONE : Cartesian2
一个不可变的 二维笛卡尔 实例初始化为 (1.0, 1.0).
用于将对象打包到数组中的元素数量.
static constant Cesium.Cartesian2.UNIT_X : Cartesian2
一个不可变的 二维笛卡尔 实例初始化为 (1.0, 0.0).
static constant Cesium.Cartesian2.UNIT_Y : Cartesian2
一个不可变的 二维笛卡尔 实例初始化为 (0.0, 1.0).
static constant Cesium.Cartesian2.ZERO : Cartesian2
一个不可变的 二维笛卡尔 实例初始化为 (0.0, 0.0).
Methods
clone(result) → Cartesian2
复制此 二维笛卡尔 实例.
| Name | Type | Description |
|---|---|---|
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 二维笛卡尔 实例(如果未提供).
将此笛卡尔坐标与提供的笛卡尔坐标逐个分量进行比较并返回
如果相等则为
true,否则为 false
| Name | Type | Description |
|---|---|---|
right |
Cartesian2 | optional 右侧笛卡尔. |
Returns:
如果相等则为
true,否则为 false
将此笛卡尔坐标与提供的笛卡尔坐标逐个分量进行比较并返回
如果通过绝对或相对公差测试,则为
true,否则为 false。
| Name | Type | Default | Description |
|---|---|---|---|
right |
Cartesian2 | optional 右侧笛卡尔. | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对 epsilon 容差. |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于平等测试的绝对 epsilon 容差. |
Returns:
如果它们在提供的 epsilon 范围内,则为
true,否则为 false
创建一个表示该笛卡尔坐标的字符串,格式为"(x, y)".
Returns:
以"(x,y)"格式表示所提供的笛卡尔坐标的字符串.
static Cesium.Cartesian2.abs(cartesian, result) → Cartesian2
计算提供的笛卡尔坐标的绝对值.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要计算绝对值的笛卡尔坐标. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.add(left, right, result) → Cartesian2
计算两个笛卡尔坐标的分量和.
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
返回提供的笛卡尔坐标之间的角度(以弧度为单位).
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
Returns:
笛卡尔坐标系之间的角度.
static Cesium.Cartesian2.clamp(value, min, max, result) → Cartesian2
将值约束为位于两个值之间.
| Name | Type | Description |
|---|---|---|
value |
Cartesian2 | 要 clamp 的值. |
min |
Cartesian2 | 最小边界. |
max |
Cartesian2 | 最大边界. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
限制值,使得最小值 <= 结果 <= 最大值.
static Cesium.Cartesian2.clone(cartesian, result) → Cartesian2
复制 二维笛卡尔 实例.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 笛卡尔重复. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 Cartesian2 实例(如果未提供)。(如果 cartesian 未定义,则返回 undefined)
计算将输入向量的 Z 坐标隐式设置为 0 所产生的叉积的幅度
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
Returns:
叉积.
计算两点之间的距离.
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 计算距离的第一个点. |
right |
Cartesian2 | 要计算距离的第二点. |
Returns:
两点之间的距离.
Example:
// Returns 1.0
const d = Cesium.Cartesian2.distance(new Cesium.Cartesian2(1.0, 0.0), new Cesium.Cartesian2(2.0, 0.0));
计算两点之间的平方距离。使用此函数比较平方距离比使用
Cartesian2#distance 比较距离更有效。
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 计算距离的第一个点. |
right |
Cartesian2 | 要计算距离的第二点. |
Returns:
两点之间的距离.
Example:
// Returns 4.0, not 2.0
const d = Cesium.Cartesian2.distance(new Cesium.Cartesian2(1.0, 0.0), new Cesium.Cartesian2(3.0, 0.0));
static Cesium.Cartesian2.divideByScalar(cartesian, scalar, result) → Cartesian2
将提供的笛卡尔分量除以提供的标量.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要划分的笛卡尔. |
scalar |
number | 要除以的标量. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.divideComponents(left, right, result) → Cartesian2
计算两个笛卡尔坐标的分量商.
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
计算两个笛卡尔坐标的点积(标量积).
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
Returns:
点积.
逐个比较提供的笛卡尔坐标并返回
如果相等则为
true,否则为 false
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | optional 第一个笛卡尔. |
right |
Cartesian2 | optional 第二个笛卡尔. |
Returns:
如果左右相等,则
true,否则 false
逐个比较提供的笛卡尔坐标并返回
如果通过绝对或相对公差测试,则为
true,否则为 false。
| Name | Type | Default | Description |
|---|---|---|---|
left |
Cartesian2 | optional 第一个笛卡尔. | |
right |
Cartesian2 | optional 第二个笛卡尔. | |
relativeEpsilon |
number |
0
|
optional 用于相等性测试的相对 epsilon 容差. |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于平等测试的绝对 epsilon 容差. |
Returns:
如果左侧和右侧在提供的 epsilon 范围内,则为
true,否则为 false。
static Cesium.Cartesian2.fromArray(array, startingIndex, result) → Cartesian2
从数组中的两个连续元素创建 二维笛卡尔 实例.
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 其两个连续元素分别对应于 x 和 y 分量的数组. | |
startingIndex |
number |
0
|
optional 第一个元素数组的偏移量,对应于 x 分量. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 二维笛卡尔 实例(如果未提供).
Example:
// Create a Cartesian2 with (1.0, 2.0)
const v = [1.0, 2.0];
const p = Cesium.Cartesian2.fromArray(v);
// Create a Cartesian2 with (1.0, 2.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0];
const p2 = Cesium.Cartesian2.fromArray(v2, 2);
static Cesium.Cartesian2.fromCartesian3(cartesian, result) → Cartesian2
从现有的 三维笛卡尔 创建 二维笛卡尔 实例。这仅获取 三维笛卡尔 的 x 和 y 属性并删除 z.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 从 三维笛卡尔 实例创建 二维笛卡尔 实例. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 二维笛卡尔 实例(如果未提供).
static Cesium.Cartesian2.fromCartesian4(cartesian, result) → Cartesian2
从现有的 四维笛卡尔 创建 二位笛卡尔 实例。这仅获取 四维笛卡尔 的 x 和 y 属性并删除 z 和 w.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 从 四维笛卡尔 实例创建 二维笛卡尔 实例. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 二维笛卡尔 实例(如果未提供).
static Cesium.Cartesian2.fromElements(x, y, result) → Cartesian2
根据 x 和 y 坐标创建一个 二维笛卡尔 实例.
| Name | Type | Description |
|---|---|---|
x |
number | X坐标. |
y |
number | Y坐标. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 Cartesian2 实例(如果未提供).
static Cesium.Cartesian2.lerp(start, end, t, result) → Cartesian2
使用提供的笛卡尔坐标计算 t 处的线性插值或外推.
| Name | Type | Description |
|---|---|---|
start |
Cartesian2 | t 在 0.0 时对应的值. |
end |
Cartesian2 | t 为 1.0 时对应的值. |
t |
number | 沿 t 进行插值的点. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
计算笛卡尔的量级(长度).
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要计算其大小的笛卡尔实例. |
Returns:
量级.
计算提供的笛卡尔量级.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要计算其平方大小的笛卡尔实例. |
Returns:
平方大小.
static Cesium.Cartesian2.maximumByComponent(first, second, result) → Cartesian2
比较两个笛卡尔坐标并计算一个包含所提供笛卡尔坐标的最大分量的笛卡尔坐标.
| Name | Type | Description |
|---|---|---|
first |
Cartesian2 | 一个笛卡尔坐标. |
second |
Cartesian2 | 一个笛卡尔坐标. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
具有最大分量的笛卡尔.
计算提供的笛卡尔矩阵的最大分量值.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要使用的笛卡尔坐标. |
Returns:
最大分量的值.
static Cesium.Cartesian2.minimumByComponent(first, second, result) → Cartesian2
比较两个笛卡尔坐标并计算一个包含所提供笛卡尔坐标的最小分量的笛卡尔坐标.
| Name | Type | Description |
|---|---|---|
first |
Cartesian2 | 一个笛卡尔坐标. |
second |
Cartesian2 | 一个笛卡尔坐标. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
具有最少组件的笛卡尔.
计算提供的笛卡尔坐标的最小分量的值.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要使用的笛卡尔. |
Returns:
最小元件值.
static Cesium.Cartesian2.mostOrthogonalAxis(cartesian, result) → Cartesian2
返回与提供的笛卡尔坐标最正交的轴.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 寻找最正交轴的笛卡尔坐标. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
最正交轴.
static Cesium.Cartesian2.multiplyByScalar(cartesian, scalar, result) → Cartesian2
将提供的笛卡尔分量与提供的标量相乘.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要缩放的笛卡尔坐标. |
scalar |
number | 要乘以的标量. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.multiplyComponents(left, right, result) → Cartesian2
计算两个笛卡尔坐标的分量积.
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.negate(cartesian, result) → Cartesian2
否定所提供的笛卡尔.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 笛卡尔被否定. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.normalize(cartesian, result) → Cartesian2
计算提供的笛卡尔坐标的规范化形式.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian2 | 要规范化的笛卡尔. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
将提供的实例存储到提供的数组中.
| Name | Type | Default | Description |
|---|---|---|---|
value |
Cartesian2 | 要打包的值. | |
array |
Array.<number> | 要打包到的数组. | |
startingIndex |
number |
0
|
optional 开始打包元素的数组索引. |
Returns:
被打包成的数组
将 二维笛卡尔 数组展平为组件数组.
| Name | Type | Description |
|---|---|---|
array |
Array.<Cartesian2> | 要打包的笛卡尔数组. |
result |
Array.<number> |
optional
用于存储结果的数组。如果这是一个类型化数组,它必须具有 array.length * 2 个组件,否则将抛出 DeveloperError。如果它是一个常规数组,它将被调整大小以包含 (array.length * 2) 个元素. |
Returns:
打包的数组.
static Cesium.Cartesian2.subtract(left, right, result) → Cartesian2
计算两个笛卡尔坐标的分量差.
| Name | Type | Description |
|---|---|---|
left |
Cartesian2 | 第一个笛卡尔. |
right |
Cartesian2 | 第二个笛卡尔. |
result |
Cartesian2 | 存储结果的对象. |
Returns:
修改的结果参数
static Cesium.Cartesian2.unpack(array, startingIndex, result) → Cartesian2
从打包数组中检索实例.
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组. | |
startingIndex |
number |
0
|
optional 要解包的数组索引. |
result |
Cartesian2 | optional 存储结果的对象. |
Returns:
修改后的结果参数或新的 二维笛卡尔 实例(如果未提供).
static Cesium.Cartesian2.unpackArray(array, result) → Array.<Cartesian2>
将笛卡尔分量数组解压缩到笛卡尔 2 数组中.
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解包的组件数组. |
result |
Array.<Cartesian2> | optional 要存储结果的数组. |
Returns:
解压缩的数组.
