Methods
static Cesium.Intersections2D.clipTriangleAtAxisAlignedThreshold(threshold, keepAbove, u0, u1, u2, result) → Array.<number>
在给定的轴对齐阈值处分割 2D 三角形,并返回结果
阈值给定一侧的多边形。 生成的多边形可能具有 0、1、2、
3 或 4 个顶点。
Name | Type | Description |
---|---|---|
threshold |
number | 剪切三角形的阈值坐标值。 |
keepAbove |
boolean | true 保持三角形的部分高于阈值,或 false 保留以下部分。 |
u0 |
number | 三角形中第一个顶点的坐标,按逆时针顺序排列。 |
u1 |
number | 三角形中第二个顶点的坐标,按逆时针顺序排列。 |
u2 |
number | 三角形中第三个顶点的坐标,按逆时针顺序排列。 |
result |
Array.<number> | optional 要将结果复制到其中的数组。 如果未提供此参数,则 构造并返回一个新数组。 |
Returns:
剪辑后生成的多边形,指定为
顶点。 顶点按逆时针顺序指定。
每个顶点都是现有列表中的索引(标识为
0、1 或 2)或 -1 表示不在原始三角形中的新顶点。
对于新顶点,-1 后跟三个附加数字:
两个原始顶点中每个顶点的索引,该索引构成线段
新顶点位于 上,与第一个顶点的距离分数
顶点分配给第二个。
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
计算 2 条线段之间的交点
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);