Method GetIntersections
- Namespace
- GeometryHelper.Spatial
- Assembly
- GeometryHelper.dll
GetIntersections(GeoRay3)
Finds every point where a ray crosses the mesh, using the default tolerance.
public GeoPoint3[] GetIntersections(GeoRay3 ray)
Parameters
rayGeoRay3
Returns
GetIntersections(GeoRay3, Tolerance)
Finds every point where a ray crosses the mesh, within a tolerance.
public GeoPoint3[] GetIntersections(GeoRay3 ray, Tolerance tolerance)
Parameters
Returns
Remarks
The results come back in no particular order. A ray passing exactly along an edge shared by two triangles is reported by both of them, so a caller counting crossings should aim the ray away from edges rather than trust the count. Each triangle is crossed by the ray's own crossing of its plane where the triangle holds it, not as TryIntersectWith(GeoRay3, GeoTriangle3, out GeoPoint3, Tolerance) reads the ray, as the line without ends along it: a ray starting within the planar tolerance of a triangle's plane and dipping into it, however shallowly, crosses where it reaches the plane, one rising from there touches at its origin, and one level with it to rounding names no place on it. The ray from (5, 5, 0.0004) along (1, 0, -0.01) crosses a mesh whose top lies in z = 0 at (5.04, 5, 0).
GetIntersections(GeoXLine3)
Finds every point where an infinite line crosses the mesh, using the default tolerance.
public GeoPoint3[] GetIntersections(GeoXLine3 xline)
Parameters
xlineGeoXLine3
Returns
GetIntersections(GeoXLine3, Tolerance)
Finds every point where an infinite line crosses the mesh, within a tolerance.
public GeoPoint3[] GetIntersections(GeoXLine3 xline, Tolerance tolerance)
Parameters
Returns
Remarks
The line runs both ways from its origin, so the answer is the same wherever along it the origin stands, but for a crossing within rounding of the tolerance: it is what the ray gives from before the mesh, and from behind it, together. The results come back in no particular order, and a line through an edge two triangles share is reported by both of them, as a ray's is. Each triangle is crossed as TryIntersectWith(GeoTriangle3, out GeoPoint3, Tolerance) crosses it, so the answer is the plain scan's over every triangle, without looking at the branches whose box, grown by the larger of the point and planar tolerances, the line never enters. The line through (3, 6, 4) along Z crosses a mesh of the box 10 by 10 by 10 from the origin at (3, 6, 0) and (3, 6, 10), the ray from the same point only at the second. Below the rounding of the coordinates, 1E-15 of the largest of the mesh's and of where the line is read from, and only there, a triangle holds a crossing to that rounding, as it holds a ray's (GetIntersections(GeoRay3, Tolerance)), rather than to the rounding of its own coordinates, and a line whose origin stands further off than the mesh is large is read from a diagonal short of it.