Thickness or Depth of a polydata along a direction

If you use a good locator then this should be very fast, even for hundreds of thousands of points.