IntersectionTests

IntersectionTests()

用于计算射线、平面、三角形和椭圆形等几何图形之间交点的函数。

Methods

staticSuperMap3D.IntersectionTests.lineSegmentSphere(p0, p1, sphere, result)Interval

计算线段与球体的交点。
Name Type Description
p0 Cartesian3 线段的终点。
p1 Cartesian3 线段的另一个端点。
sphere BoundingSphere 球体。
result Interval optional 存储结果的结果。
Returns:
包含沿射线的标量点的区间,如果没有交点,则为未定义的区间。

staticSuperMap3D.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:
如果没有交点,则交点或未定义。

staticSuperMap3D.IntersectionTests.raySphere(ray, sphere, result)Interval

计算射线与球体的交点。
Name Type Description
ray Ray 射线。
sphere BoundingSphere 球体。
result Interval optional 存储结果的结果。
Returns:
包含沿射线的标量点的区间,如果没有交点,则为未定义的区间。

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

以直角坐标系的形式计算射线和三角形的交点。 计算射线和三角形的交点作为Cartesian。由 Tomas Moller 和 Ben Trumbore 实现{@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf| Fast Minimum Storage Ray/Triangle Intersection}。
Name Type Default Description
ray Ray 射线。
p0 Cartesian3 三角形的第一个顶点。
p1 Cartesian3 三角形的第二个顶点。
p2 Cartesian3 三角形的第三个顶点。
cullBackFaces Boolean false optional 如果为 true ,将只计算与三角形正面的交点,并为与背面的交点返回 undefined。
result Cartesian3 optional 存储结果的 Cartesian3 。
Returns:
如果没有交点,则交点或未定义。

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

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

staticSuperMap3D.IntersectionTests.grazingAltitudeLocation(ray, ellipsoid)Cartesian3

沿射线提供离椭球最近的点。
Name Type Description
ray Ray 射线。
ellipsoid Ellipsoid 椭球体。
Returns:
射线上最近的定行星点。

staticSuperMap3D.IntersectionTests.lineSegmentPlane(endPoint0, endPoint1, plane, result)Cartesian3

计算线段和平面的交点。
Name Type Description
endPoint0 Cartesian3 线段的终点。
endPoint1 Cartesian3 线段的另一个端点。
plane Plane 平面。
result Cartesian3 optional 存储结果的对象。
Returns:
如果没有交点,则交点或未定义。
Example:
var origin = SuperMap3D.Cartesian3.fromDegrees(-75.59777, 40.03883);
var normal = ellipsoid.geodeticSurfaceNormal(origin);
var plane = SuperMap3D.Plane.fromPointNormal(origin, normal);

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

// find the intersection of the line segment from p0 to p1 and the tangent plane at origin.
var intersection = SuperMap3D.IntersectionTests.lineSegmentPlane(p0, p1, plane);

staticSuperMap3D.IntersectionTests.rayEllipsoid(ray, ellipsoid)Interval

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

staticSuperMap3D.IntersectionTests.rayPlane(ray, plane, result)Cartesian3

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

staticSuperMap3D.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane)Object

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

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

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