new IntersectionTests()
用于计算射线、平面、三角形和椭圆形等几何图形之间交点的函数。
Methods
-
static grazingAltitudeLocation(ray, ellipsoid){Cartesian3}
-
沿射线提供离椭球最近的点。
Name Type Description rayRay 射线。
ellipsoidEllipsoid 椭球体。
Returns:
Type Description Cartesian3 射线上最近的定行星点。 -
static lineSegmentPlane(endPoint0, endPoint1, plane, result){Cartesian3}
-
计算线段和平面的交点。
Name Type Description endPoint0Cartesian3 线段的终点。
endPoint1Cartesian3 线段的另一个端点。
planePlane 平面。
resultCartesian3 可选 存储结果的对象。
Returns:
Type Description Cartesian3 如果没有交点,则交点或未定义。 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); -
static lineSegmentSphere(p0, p1, sphere, result){Interval}
-
计算线段与球体的交点。
Name Type Description p0Cartesian3 线段的终点。
p1Cartesian3 线段的另一个端点。
sphereBoundingSphere 球体。
resultInterval 可选 存储结果的结果。
Returns:
Type Description Interval 包含沿射线的标量点的区间,如果没有交点,则为未定义的区间。 -
static lineSegmentTriangle(v0, v1, p0, p1, p2, cullBackFaces, result){Cartesian3}
-
计算线段和三角形的交点。
Name Type Default Description v0Cartesian3 线段的端点。
v1Cartesian3 线段的另一个端点。
p0Cartesian3 三角形的第一个顶点。
p1Cartesian3 三角形的第二个顶点。
p2Cartesian3 三角形的第三个顶点。
cullBackFacesBoolean false 可选 如果为 true ,将只计算与三角形正面的交点,并为与背面的交点返回 undefined。
resultCartesian3 可选 存储结果的 Cartesian3 。
Returns:
Type Description Cartesian3 如果没有交点,则交点或未定义。 -
static polygonIntersectsRectangle(polygon, rectangle){Boolean}
-
多边形与矩形相交检测
Name Type Description polygonArray.<Cartographic> 进行相交检测的多边形顶点元素的数组集合
rectangleRectangle 进行相交检测的矩形对象
Returns:
Type Description Boolean bool 相交返回true,不相交返回false -
static polygonIntersectsRectangleInCartesian(polygon, rectangle){Boolean}
-
平面坐标系多边形与矩形相交检测
Name Type Description polygonArray.<Cartographic> 进行相交检测的多边形顶点元素的数组集合
rectangleRectangle 进行相交检测的矩形对象
Returns:
Type Description Boolean bool 相交返回true,不相交返回false -
static rayEllipsoid(ray, ellipsoid){Interval}
-
计算射线与椭球的交点。
Name Type Description rayRay 射线。
ellipsoidEllipsoid 椭球体。
Returns:
Type Description Interval 包含沿射线的标量点的区间,如果没有交点,则为未定义的区间。 -
static rayPlane(ray, plane, result){Cartesian3}
-
计算射线与平面的交点。
Name Type Description rayRay 射线。
planePlane 平面。
resultCartesian3 可选 存储结果的对象。
Returns:
Type Description Cartesian3 如果没有交点,则交点或未定义。 -
static raySphere(ray, sphere, result){Interval}
-
计算射线与球体的交点。
Name Type Description rayRay 射线。
sphereBoundingSphere 球体。
resultInterval 可选 存储结果的结果。
Returns:
Type Description Interval 包含沿射线的标量点的区间,如果没有交点,则为未定义的区间。 -
static rayTriangle(ray, p0, p1, p2, cullBackFaces, result){Cartesian3}
-
以直角坐标系的形式计算射线和三角形的交点。
计算射线和三角形的交点作为Cartesian。由 Tomas Moller 和 Ben Trumbore 实现 Fast Minimum Storage Ray/Triangle Intersection。
Name Type Default Description rayRay 射线。
p0Cartesian3 三角形的第一个顶点。
p1Cartesian3 三角形的第二个顶点。
p2Cartesian3 三角形的第三个顶点。
cullBackFacesBoolean false 可选 如果为 true ,将只计算与三角形正面的交点,并为与背面的交点返回 undefined。
resultCartesian3 可选 存储结果的 Cartesian3 。
Returns:
Type Description Cartesian3 如果没有交点,则交点或未定义。 -
static rayTriangleParametric(ray, p0, p1, p2, cullBackFaces){Number}
-
计算射线与三角形的交点,作为沿输入射线的参数距离。
将光线和三角形的交点计算为沿输入光线的参数距离。 当三角形位于射线后面时,结果为负。由 Tomas Moller 和 Ben Trumbore 实现Fast Minimum Storage Ray/Triangle Intersection
Name Type Default Description rayRay 射线。
p0Cartesian3 三角形的第一个顶点。
p1Cartesian3 三角形的第二个顶点。
p2Cartesian3 三角形的第三个顶点。
cullBackFacesBoolean false 可选 如果
true,将只计算与三角形正面的交集,并返回与背面交集的未定义。Returns:
Type Description Number 交点作为沿射线的参数距离,如果没有交点则未定义。 -
static trianglePlaneIntersection(p0, p1, p2, plane){Object}
-
计算三角形和平面的交点。
Name Type Description p0Cartesian3 三角形的第一个点。
p1Cartesian3 三角形的第二个点。
p2Cartesian3 三角形的第三点。
planePlane 相交平面。
Returns:
Type Description Object 具有属性 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);