包含在2D三角形上运行的函数.
Methods
static Cesium.Intersections2D.clipTriangleAtAxisAlignedThreshold(threshold, keepAbove, u0, u1, u2, result) → Array.<number>
以给定的轴对齐阈值拆分一个 2D 三角形并返回结果
阈值的某一边的多边形。 由此产生的多边形可能有 0, 1, 2 个,
3, or 4 vertices.
| Name | Type | Description |
|---|---|---|
threshold |
number | 用于剪切三角形的阈值坐标值. |
keepAbove |
boolean | 将三角形的部分保留在阈值以上,或虚假 将这部分保留在下面. |
u0 |
number | 三角形的第一个顶点的坐标,按逆时针顺序排列. |
u1 |
number | 三角形中第二个顶点的坐标,按逆时针顺序排列. |
u2 |
number | 三角形中第三个顶点的坐标,按逆时针顺序排列. |
result |
Array.<number> | optional 复制结果的数组 。 如果不提供此参数, 新建阵列并返回. |
Returns:
剪辑后产生的多边形, 指定为列表
圆顶. 顶点按逆时针顺序指定.
每个顶点要么是现有列表中的索引(识别为:
a 0, 1, or 2) or -1 indicating a new vertex not in the original triangle.
对于新的顶点,后面是三个额外数字:
构成线段的两个原始顶点的索引
新的顶点在上 距离第一个顶点的一小部分
顶为第二.
Example:
const result = Cesium.Intersections2D.clipTriangleAtAxisAlignedThreshold(0.5, false, 0.2, 0.6, 0.4);
// result === [2, 0, -1, 1, 0, 0.25, -1, 1, 2, 0.5]
static Cesium.Intersections2D.computeBarycentricCoordinates(x, y, x1, y1, x2, y2, x3, y3, result) → Cartesian3
计算2D三角形内一个2D位置的巴向中心坐标.
| Name | Type | Description |
|---|---|---|
x |
number | 寻找巴氏坐标位置的x坐标. |
y |
number | 找到巴氏坐标位置的y坐标. |
x1 |
number | 三角形第一个顶点的x坐标. |
y1 |
number | 三角形第一个顶点的y坐标. |
x2 |
number | 三角形第二个顶点的x坐标. |
y2 |
number | 三角形第二个顶点的y坐标. |
x3 |
number | 三角形第三个顶点的x坐标. |
y3 |
number | 三角形第三个顶点的y坐标. |
result |
Cartesian3 | optional 复制结果的例子。 如果此参数 未定义,创建并返回新实例. |
Returns:
三角形内位置的巴向中心坐标.
Example:
const result = Cesium.Intersections2D.computeBarycentricCoordinates(0.0, 0.0, 0.0, 1.0, -1, -0.5, 1, -0.5);
// result === new Cesium.Cartesian3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);
static Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection(x00, y00, x01, y01, x10, y10, x11, y11, result) → Cartesian2
计算两个线段之间的交叉点
| Name | Type | Description |
|---|---|---|
x00 |
number | 第一行第一顶点的x坐标. |
y00 |
number | 第一行第一顶点的y坐标. |
x01 |
number | 第一行第二顶点的x坐标. |
y01 |
number | 第一行第二顶点的y坐标. |
x10 |
number | 第二行第一顶点的x坐标. |
y10 |
number | 第二行第一顶点的y坐标. |
x11 |
number | 二线第二顶点的x坐标. |
y11 |
number | 第二行第二顶点的y坐标. |
result |
Cartesian2 | optional 复制结果的例子。 如果此参数 未定义,创建并返回新实例. |
Returns:
交汇点,如果没有交汇点或线条,则未定义.
Example:
const result = Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1, 1, 1, 1);
// result === new Cesium.Cartesian2(0.0, 1.0);