IntersectionTests

Functions for computing the intersection between geometries such as rays, planes, triangles, and ellipsoids.

方法

static Cesium.IntersectionTests.grazingAltitudeLocation(ray, ellipsoid)Cartesian3

Provides the point along the ray which is nearest to the ellipsoid.
参数名称 类型 描述信息
ray Ray The ray.
ellipsoid Ellipsoid The ellipsoid.
返回值:
The nearest planetodetic point on the ray.

static Cesium.IntersectionTests.lineSegmentPlane(endPoint0, endPoint1, plane, result)Cartesian3

Computes the intersection of a line segment and a plane.
参数名称 类型 描述信息
endPoint0 Cartesian3 An end point of the line segment.
endPoint1 Cartesian3 The other end point of the line segment.
plane Plane The plane.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The intersection point or undefined if there is no intersection.
使用示例:
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

Computes the intersection points of a line segment with a sphere.
参数名称 类型 描述信息
p0 Cartesian3 An end point of the line segment.
p1 Cartesian3 The other end point of the line segment.
sphere BoundingSphere The sphere.
result Interval 可选 The result onto which to store the result.
返回值:
The interval containing scalar points along the ray or undefined if there are no intersections.

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

Computes the intersection of a line segment and a triangle.
参数名称 类型 默认值 描述信息
v0 Cartesian3 The an end point of the line segment.
v1 Cartesian3 The other end point of the line segment.
p0 Cartesian3 The first vertex of the triangle.
p1 Cartesian3 The second vertex of the triangle.
p2 Cartesian3 The third vertex of the triangle.
cullBackFaces boolean false 可选 If true, will only compute an intersection with the front face of the triangle and return undefined for intersections with the back face.
result Cartesian3 可选 The Cartesian3 onto which to store the result.
返回值:
The intersection point or undefined if there is no intersections.

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

Computes the intersection points of a ray with an ellipsoid.
参数名称 类型 描述信息
ray Ray The ray.
ellipsoid Ellipsoid The ellipsoid.
返回值:
The interval containing scalar points along the ray or undefined if there are no intersections.

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

Computes the intersection of a ray and a plane.
参数名称 类型 描述信息
ray Ray The ray.
plane Plane The plane.
result Cartesian3 可选 The object onto which to store the result.
返回值:
The intersection point or undefined if there is no intersections.

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

Computes the intersection points of a ray with a sphere.
参数名称 类型 描述信息
ray Ray The ray.
sphere BoundingSphere The sphere.
result Interval 可选 The result onto which to store the result.
返回值:
The interval containing scalar points along the ray or undefined if there are no intersections.

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

Computes the intersection of a ray and a triangle as a Cartesian3 coordinate. Implements {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf| Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
参数名称 类型 默认值 描述信息
ray Ray The ray.
p0 Cartesian3 The first vertex of the triangle.
p1 Cartesian3 The second vertex of the triangle.
p2 Cartesian3 The third vertex of the triangle.
cullBackFaces boolean false 可选 If true, will only compute an intersection with the front face of the triangle and return undefined for intersections with the back face.
result Cartesian3 可选 The Cartesian3 onto which to store the result.
返回值:
The intersection point or undefined if there is no intersections.

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

Computes the intersection of a ray and a triangle as a parametric distance along the input ray. The result is negative when the triangle is behind the ray. Implements {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf| Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
参数名称 类型 默认值 描述信息
ray Ray The ray.
p0 Cartesian3 The first vertex of the triangle.
p1 Cartesian3 The second vertex of the triangle.
p2 Cartesian3 The third vertex of the triangle.
cullBackFaces boolean false 可选 If true, will only compute an intersection with the front face of the triangle and return undefined for intersections with the back face.
返回值:
The intersection as a parametric distance along the ray, or undefined if there is no intersection.

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

Computes the intersection of a triangle and a plane
参数名称 类型 描述信息
p0 Cartesian3 First point of the triangle
p1 Cartesian3 Second point of the triangle
p2 Cartesian3 Third point of the triangle
plane Plane Intersection plane
返回值:
An object with properties positions and indices, which are arrays that represent three triangles that do not cross the plane. (Undefined if no intersection exists)
使用示例:
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);