Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualC0lumbo

Posted 08 April 2013 - 06:08 AM

Rays, being infinitely thin are pretty much never going to intersect one another (at least not reliably what with floating point inaccuracies except in the most trivial cases) unless you have some sort of epsilon/error term.

 

An epsilon is effectively going to give your two rays some thickness, I think it is equivalent if you give all the 'thickness' to just one ray rather than share it equally between them. A ray with a bit of thickness is effectively a capsule (assuming you can cope with at least one of your rays being bounded - technically a line segment), if you google "ray capsule intersection" there are plenty of useful looking results, e.g. this first one has source code: http://blog.makingartstudios.com/?p=286

 

PS. This post assumes you're working in 3D, if you're in 2D then please ignore.


#1C0lumbo

Posted 08 April 2013 - 06:05 AM

Rays, being infinitely thin are pretty much never going to intersect one another (at least not reliably what with floating point inaccuracies except in the most trivial cases) unless you have some sort of epsilon/error term.

 

An epsilon is effectively going to give your two rays some thickness, I think it is equivalent if you give all the 'thickness' to just one ray rather than share it equally between them. A ray with a bit of thickness is basically a capsule (assuming you can cope with at least one of your rays being bounded - technically a line segment), if you google "ray capsule intersection" there are plenty of useful looking results, e.g. this first one has source code: http://blog.makingartstudios.com/?p=286

 

PS. This post assumes you're working in 3D, if you're in 2D then please ignore.


PARTNERS