Two solutions because the ray tracer intersects with the surface both front and back
keenan
@Arthas007 Right. What happens in the equation when the ray misses, or just grazes the surface tangentially?
jifengy
If there is only one solution (grazing surface tangentially), then the sqrt(b^2 - 4ac) term in the equivalent quadratic equation would be 0, and if there are no solutions (ray misses), then the (b^2 - 4ac) term would be negative
0x484884
If the ray misses or touches just tangentially then you would get complex solutions to the equation. The real solutions to the equation have an intuitive meaning but is there any use or interesting interpretation or the complex solutions in graphics?
keenan
@jifengy and @0x484884 have the right idea. If the ray grazes tangentially, then the argument to the square root function is zero and you have a unique solution to the quadratic equation: just the single point of tangency. If this argument is negative, then there are no real solutions and the ray misses the sphere.
Here's a further interesting question (I've never thought about the answer): the square root of a negative number is complex. In this situation, does this complex number tell you something geometrically about the relationship between the sphere and the ray?
Two solutions because the ray tracer intersects with the surface both front and back
@Arthas007 Right. What happens in the equation when the ray misses, or just grazes the surface tangentially?
If there is only one solution (grazing surface tangentially), then the sqrt(b^2 - 4ac) term in the equivalent quadratic equation would be 0, and if there are no solutions (ray misses), then the (b^2 - 4ac) term would be negative
If the ray misses or touches just tangentially then you would get complex solutions to the equation. The real solutions to the equation have an intuitive meaning but is there any use or interesting interpretation or the complex solutions in graphics?
@jifengy and @0x484884 have the right idea. If the ray grazes tangentially, then the argument to the square root function is zero and you have a unique solution to the quadratic equation: just the single point of tangency. If this argument is negative, then there are no real solutions and the ray misses the sphere.
Here's a further interesting question (I've never thought about the answer): the square root of a negative number is complex. In this situation, does this complex number tell you something geometrically about the relationship between the sphere and the ray?