Efficiently Determining Surface Intersections Along a Line Segment

29 Views Asked by At

Background

In general, I know how to determine the points of intersection between a surface and a line. In my case, I may have a large number of defined surfaces that may (or may not) intersect each other and may (or may not) be located in close proximity to each other. I would like to determine all the points of intersection with a line segment and any of the surfaces. Programmatically, I can loop through all surfaces to determine existing intersections with the line. However, as the number of surfaces grows this can become not only computationally expensive, but also intuitively inefficient if I know the trajectory and endpoint of the line. That is, I know that if the surface is far from the trajectory of the line or that the line segment ends well before reaching another surface along it's trajectory, there should be no need for me to even check for an intersection. For the former, determining the distance from the line trajectory and the surface to make this comparison is equally (or more) expensive than to just check for the intersection. For the latter, I'm not sure how to "terminate" evaluations for intersections.

Question

What sort of algorithm or mathematical concepts would allow me to efficiently search for surface intersections along a line segment based on the problems identified above?

1

There are 1 best solutions below

0
On

This is more a computer science question than a mathematical one in my opinion - but it does lie in the overlap of the two fields. I have done something with some similarities to this.

I was able to greatly improve speed by dividing the geometry (equivalent to your surfaces) into a heirarchy of bounding boxes of decreasing size. I would start by seeing which of the largest bounding boxes the line intersected. All surfaces in non-intersected bounding boxes could be immediately discarded. For the intersected bounding boxes, I would repeat the process with the next smaller level of bounding boxes, and so on. Only once the bounding boxes were small enough that futher division would do little to reduce the number of items that had to be checked individually did I just check the remaining items.

I do not how applicable this approach would be to your situation, though.