Methods
static Cesium.IntersectionTests.grazingAltitudeLocation(ray, ellipsoid) → Cartesian3
提供沿射线最接近椭球体的点。
Name | Type | Description |
---|---|---|
ray |
Ray | 射线。 |
ellipsoid |
Ellipsoid | 椭球体。 |
Returns:
射线上最近的行星点。
static Cesium.IntersectionTests.lineSegmentPlane(endPoint0, endPoint1, plane, result) → Cartesian3
计算线段和平面的交集。
Name | Type | Description |
---|---|---|
endPoint0 |
Cartesian3 | 线段的终点。 |
endPoint1 |
Cartesian3 | 线段的另一个端点。 |
plane |
Plane | 该平面。 |
result |
Cartesian3 | optional 要在其上存储结果的对象。 |
Returns:
交点,如果没有交集,则为 undefined。
Example:
const origin = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
const normal = ellipsoid.geodeticSurfaceNormal(origin);
const plane = Cesium.Plane.fromPointNormal(origin, normal);
const p0 = new Cesium.Cartesian3(...);
const p1 = new Cesium.Cartesian3(...);
// find the intersection of the line segment from p0 to p1 and the tangent plane at origin.
const intersection = Cesium.IntersectionTests.lineSegmentPlane(p0, p1, plane);
static Cesium.IntersectionTests.lineSegmentSphere(p0, p1, sphere, result) → Interval
计算线段与球体的交点。
Name | Type | Description |
---|---|---|
p0 |
Cartesian3 | 线段的终点。 |
p1 |
Cartesian3 | 线段的另一个端点。 |
sphere |
BoundingSphere | 球体。 |
result |
Interval | optional 存储结果的结果。 |
Returns:
包含沿射线的标量点的区间,如果没有交集,则为 undefined。
static Cesium.IntersectionTests.lineSegmentTriangle(v0, v1, p0, p1, p2, cullBackFaces, result) → Cartesian3
计算线段和三角形的交集。
Name | Type | Default | Description |
---|---|---|---|
v0 |
Cartesian3 | 线段的终点。 | |
v1 |
Cartesian3 | 线段的另一个端点。 | |
p0 |
Cartesian3 | 三角形的第一个顶点。 | |
p1 |
Cartesian3 | 三角形的第二个顶点。 | |
p2 |
Cartesian3 | 三角形的第三个顶点。 | |
cullBackFaces |
boolean |
false
|
optional
如果为 true ,则仅计算与三角形正面的交点
并返回 undefined 表示与背面的交集。 |
result |
Cartesian3 |
optional
存储结果的Cartesian3 。 |
Returns:
交点,如果没有交集,则为 undefined。
static Cesium.IntersectionTests.rayEllipsoid(ray, ellipsoid) → Interval
计算射线与椭球体的交点。
Name | Type | Description |
---|---|---|
ray |
Ray | 射线。 |
ellipsoid |
Ellipsoid | 椭球体。 |
Returns:
包含沿射线的标量点的区间,如果没有交集,则为 undefined。
static Cesium.IntersectionTests.rayPlane(ray, plane, result) → Cartesian3
计算射线和平面的交集。
Name | Type | Description |
---|---|---|
ray |
Ray | 射线。 |
plane |
Plane | 该平面。 |
result |
Cartesian3 | optional 要在其上存储结果的对象。 |
Returns:
交点,如果没有交集,则为 undefined。
static Cesium.IntersectionTests.raySphere(ray, sphere, result) → Interval
计算射线与球体的交点。
Name | Type | Description |
---|---|---|
ray |
Ray | 射线。 |
sphere |
BoundingSphere | 球体。 |
result |
Interval | optional 存储结果的结果。 |
Returns:
包含沿射线的标量点的区间,如果没有交集,则为 undefined。
static Cesium.IntersectionTests.rayTriangle(ray, p0, p1, p2, cullBackFaces, result) → Cartesian3
将射线和三角形的交点计算为 Cartesian3 坐标。
实现 {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf|
Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
Name | Type | Default | Description |
---|---|---|---|
ray |
Ray | 射线。 | |
p0 |
Cartesian3 | 三角形的第一个顶点。 | |
p1 |
Cartesian3 | 三角形的第二个顶点。 | |
p2 |
Cartesian3 | 三角形的第三个顶点。 | |
cullBackFaces |
boolean |
false
|
optional
如果为 true ,则仅计算与三角形正面的交点
并返回 undefined 表示与背面的交集。 |
result |
Cartesian3 |
optional
存储结果的Cartesian3 。 |
Returns:
交点,如果没有交集,则为 undefined。
将射线和三角形的交点计算为沿输入射线的参数化距离。当三角形位于射线后面时,结果为负数。
实现 {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf|
Fast Minimum Storage Ray/Triangle Intersection} 作者:Tomas Moller 和 Ben Trumbore。
Name | Type | Default | Description |
---|---|---|---|
ray |
Ray | 射线。 | |
p0 |
Cartesian3 | 三角形的第一个顶点。 | |
p1 |
Cartesian3 | 三角形的第二个顶点。 | |
p2 |
Cartesian3 | 三角形的第三个顶点。 | |
cullBackFaces |
boolean |
false
|
optional
如果为 true ,则仅计算与三角形正面的交点
并返回 undefined 表示与背面的交集。 |
Returns:
交点作为沿射线的参数化距离,如果没有交点,则为 undefined。
计算三角形和平面的交集
Name | Type | Description |
---|---|---|
p0 |
Cartesian3 | 三角形的第一个点 |
p1 |
Cartesian3 | 三角形的第二点 |
p2 |
Cartesian3 | 三角形的第三个点 |
plane |
Plane | 相交平面 |
Returns:
具有
positions
和 indices
属性的对象,它们是表示不穿过平面的三个三角形的数组。(如果不存在交集,则为 Undefined)
Example:
const origin = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
const normal = ellipsoid.geodeticSurfaceNormal(origin);
const plane = Cesium.Plane.fromPointNormal(origin, normal);
const p0 = new Cesium.Cartesian3(...);
const p1 = new Cesium.Cartesian3(...);
const p2 = new Cesium.Cartesian3(...);
// convert the triangle composed of points (p0, p1, p2) to three triangles that don't cross the plane
const triangles = Cesium.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane);