Check if a line segment intersects a sphere

I am trying to determine if a segment (i.e. between two points) intersects a sphere. I'm not interested in the position of the intersection, is it just that the segment intersects the surface of the sphere. Does anyone have any suggestions as to what would be the most efficient algorithm for this? (I am wondering if there are any algorithms that are simpler than regular ray intersection algorithms, since I am not interested in the intersection position)

+4
source share
4 answers

I don’t know what a standard way to do this, but if you only want to know IF it intersects, that’s what I will do.

... sqrt() . , .

  • , . , , . , .

.

  1. , . , x, y- z- , , , . . , .

. . , .

, , - , .

(x0 + it, y0 + jt, z0 + kt), - (xS, yS, zS). , t , (xS - x0 - it, yS - y0 - jt, zS - z0 - kt).

x = xS - x0, y = yX - y0, z = zS - z0, D -

D = x ^ 2 -2 * xit + (i * t) ^ 2 + y ^ 2 - 2 * yjt + (j * t) ^ 2 + z ^ 2 - 2 * zkt + (k * t) ^ 2

D = (i ^ 2 + j ^ 2 + k ^ 2) t ^ 2 - (xi + yj + zk) * 2 * t + (x ^ 2 + y ^ 2 + z ^ 2)

dD/dt = 0 = 2 * t * (i ^ 2 + j ^ 2 + k ^ 2) - 2 * (xi + yj + z * k)

t = (xi + yj + z * k)/(i ^ 2 + j ^ 2 + k ^ 2)

D =.... , . , .

+6

, , , ...

, A β†’ B.

, , 90 , .

, , . , , (, , ) , ( ) .

+6

. , , . .

+4

All Articles