I am familiar with BSP, KD-tree and BVH for the general ray-primitive intersection finding problem. Are there any more efficient algorithms and data structures for finding intersections between only one sphere and many line segments? Please note that the sphere is query object.
One solution would be:
Suppose that
R
and its center is at point C
, P0
and P1
, D0
is the distance between C
and P0
, and D1
is the distance between C
and P1
. Then:
If D0 < R
and D1 < R
, the line segment is contained entirely inside the sphere and does not intersect the surface.
If D0 < R
xor D1 < R
, the line segment intersects the sphere's surface.
Otherwise, the points are outside the sphere, but the line might intersect the surface, so run a regular ray-sphere intersection test.
A further optimization would be to compare squared distances with the squared radius, to avoid taking the roots.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.