IntersectionTests

用于计算几何体(如射线、平面、三角形和椭球体)之间相交的函数。

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:
如果没有交点,则为未定义的交点。
Example:
var origin = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
var normal = ellipsoid.geodeticSurfaceNormal(origin);
var plane = Cesium.Plane.fromPointNormal(origin, normal);

var p0 = new Cesium.Cartesian3(...);
var p1 = new Cesium.Cartesian3(...);

// find the intersection of the line segment from p0 to p1 and the tangent plane at origin.
var 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:
包含沿光线的标量点的间隔,或者如果没有交点,则未定义。

static Cesium.IntersectionTests.lineSegmentTriangle(v0, v1, p0, p1, p2, cullBackFaces, result)Cartesian3

计算线段与三角形的交点。
Name Type Default Description
v0 Cartesian3 线段的A端点。
v1 Cartesian3 线段的另一个端点。
p0 Cartesian3 三角形的第一个顶点。
p1 Cartesian3 三角形的第二个顶点。
p2 Cartesian3 三角形的第三个顶点。
cullBackFaces Boolean false optional 如果true,则只计算一个与三角形正面的交集 并返回与背面相交的未定义。
result Cartesian3 optional 存储结果的Cartesian3
Returns:
如果没有交点,则为未定义的交点。

static Cesium.IntersectionTests.rayEllipsoid(ray, ellipsoid)Interval

计算光线与椭球体的交点。
Name Type Description
ray Ray 射线。
ellipsoid Ellipsoid 椭球体。
Returns:
包含沿光线的标量点的间隔,或者如果没有交点,则未定义。

static Cesium.IntersectionTests.rayPlane(ray, plane, result)Cartesian3

计算光线与平面的交点。
Name Type Description
ray Ray 射线。
plane Plane 飞机。
result Cartesian3 optional 要将结果存储到的对象。
Returns:
如果没有交点,则为未定义的交点。

static Cesium.IntersectionTests.raySphere(ray, sphere, result)Interval

计算光线与球体的交点。
Name Type Description
ray Ray 射线。
sphere BoundingSphere 球体。
result Interval optional 要将结果存储到其中的结果。
Returns:
包含沿光线的标量点的间隔,或者如果没有交点,则未定义。

static Cesium.IntersectionTests.rayTriangle(ray, p0, p1, p2, cullBackFaces, result)Cartesian3

将光线与三角形的交点计算为笛卡尔坐标。 由托马斯·莫勒和本·特朗博尔实施 Fast Minimum Storage Ray/Triangle Intersection
Name Type Default Description
ray Ray 射线。
p0 Cartesian3 三角形的第一个顶点。
p1 Cartesian3 三角形的第二个顶点。
p2 Cartesian3 三角形的第三个顶点。
cullBackFaces Boolean false optional 如果true,则只计算一个与三角形正面的交集 并返回与背面相交的未定义。
result Cartesian3 optional 存储结果的Cartesian3
Returns:
如果没有交点,则为未定义的交点。

static Cesium.IntersectionTests.rayTriangleParametric(ray, p0, p1, p2, cullBackFaces)Number

计算光线与三角形的交点,作为沿输入光线的参数距离。当三角形位于光线后面时,结果为负。 由托马斯·莫勒和本·特朗博尔实施 Fast Minimum Storage Ray/Triangle Intersection
Name Type Default Description
ray Ray 射线。
p0 Cartesian3 三角形的第一个顶点。
p1 Cartesian3 三角形的第二个顶点。
p2 Cartesian3 三角形的第三个顶点。
cullBackFaces Boolean false optional 如果true,则只计算一个与三角形正面的交集 并返回与背面相交的未定义。
Returns:
交点作为沿光线的参数距离,如果没有交点,则为未定义的交点。

static Cesium.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane)Object

计算三角形与平面的交点
Name Type Description
p0 Cartesian3 三角形的第一个点
p1 Cartesian3 三角形的第二点
p2 Cartesian3 三角形的第三点
plane Plane 相交平面
Returns:
一个具有positionsindices属性的对象,这些属性是表示不与平面相交的三个三角形的数组。(如果不存在交叉点,则未定义)
Example:
var origin = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
var normal = ellipsoid.geodeticSurfaceNormal(origin);
var plane = Cesium.Plane.fromPointNormal(origin, normal);

var p0 = new Cesium.Cartesian3(...);
var p1 = new Cesium.Cartesian3(...);
var p2 = new Cesium.Cartesian3(...);

// convert the triangle composed of points (p0, p1, p2) to three triangles that don't cross the plane
var triangles = Cesium.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane);