3
\$\begingroup\$

How can I check it if a line3D/ or ray is intersecting a sphere?

\$\endgroup\$

3 Answers 3

4
\$\begingroup\$

The real time rendering web-site is good source for different intersection algorithms (including ray/sphere intersection):

http://www.realtimerendering.com/intersections.html

\$\endgroup\$
1
  • \$\begingroup\$ Except that a ton of the links are down these days. \$\endgroup\$
    – Tara
    May 8, 2015 at 0:56
4
\$\begingroup\$

The problem logically reduces to finding the shortest distance between the ray (line) and the sphere centre. If that distance is shorter than the sphere radius, there is an intersection.

Of course, there's a formula for line-point distance.

\$\endgroup\$
0
\$\begingroup\$

It is a part of ray tracer design. Look at the ray and sphere intersection. It is very simple and commonly used in every ray tracer.

\$\endgroup\$
1
  • \$\begingroup\$ You could have added a link or something at least. \$\endgroup\$
    – Tara
    May 8, 2015 at 0:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .