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 坐标。
实现了 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。 |
result |
Cartesian3 |
optional
存储结果的 Cartesian3 对象。 |
Returns:
交点或如果没有交点则返回 undefined。
计算光线与三角形的交点,以输入光线上的参数化距离表示。当三角形位于光线后方时,结果为负。
实现了 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);
