2
$\begingroup$

Hi,

I need calculate ray (line) intersection with torus for my ray-tracing program (I know, its to graphics, but i need math behind it).

I can solve equation of order x^4, but thats too way slow (Cardano's method). So is there better way, how to calculate this ?

Thanks

$\endgroup$
4
  • 2
    $\begingroup$ math.stackexchange.com is probably a better fit for your question. If you do not provide details about how you are representing the torus, it is impossible to answer your question. $\endgroup$ Oct 25, 2010 at 17:38
  • $\begingroup$ I have Center [0,0,0] and R, r diameters Line (Ray) is represented with point and its direction vector $\endgroup$
    – Johnatan
    Oct 25, 2010 at 17:45
  • $\begingroup$ Cross-posted to MSE: math.stackexchange.com/questions/7829/… $\endgroup$ Oct 25, 2010 at 20:08
  • $\begingroup$ I removed the intersection theory tag since in mathematics it has a specific meaning. I added computing as a trade off. $\endgroup$ Mar 1, 2011 at 18:18

2 Answers 2

1
$\begingroup$

If you can't avoid solving 4th degree equations, don't use complicated solutions in terms of radicals. Computing radicals is not really any more efficient than computing roots of general polynomials, so this only serves to make the problem more complicated (ignoring other problems such as casus irreducibilis). Instead, apply a suitable root-finding algorithm on the original polynomial.

$\endgroup$
0
$\begingroup$

It seems the method developed by J.J. Van Wijk, and described in his paper, "Ray tracing objects defined by sweeping a sphere" (Computers & Graphics, Volume 9, Issue 3, 1985, Pages 283-290) has become the standard approach. The main idea is to avoid the exact 4th-order computation by performing a pre-test that is only 2nd-order, essentially against the shape produced by sweeping a square rather than a circle around a circle. Then only for the rays that pierce this bounding shape do you solve the 4th-order equations.

I believe with effort you can find downloadable implementations of ray-torus intersection following this method. Code written by Han-Wen Nienhuys is available here (but I didn't check to see if he follows Van Wijk).

$\endgroup$
3
  • $\begingroup$ Joseph, it does not seem to be widely taught, a theorem of Abel I believe, that the cubic with three irrational real roots leads to solutions involving (A + B i)^(1/3) + (A - B i)^(1/3) where there is no way to "get out of it" and rewrite as roots of just real numbers. That may be relevant here, hard to say, depends on the reason for using exact symbolic solutions. $\endgroup$
    – Will Jagy
    Oct 25, 2010 at 21:54
  • $\begingroup$ @Will: Yes, difficult to say whether that is relevant to this situation. My feeling is that one cannot avoid computing the roots of a 4-th degree equation. The speedups come from only performing that computation as a last resort. $\endgroup$ Oct 26, 2010 at 11:46
  • 1
    $\begingroup$ The link to sciencedirect.com is broken, but the article can be found at doi:10.1016/0097-8493(85)90055-X. $\endgroup$ May 11, 2023 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.