40

Anyone knows a source, website where I can get some good implementations of 3D intersection algorithms, like

  • intersection of sphere and sphere
  • sphere/ellipsoid
  • sphere/cuboid
  • ellipsoid/ellipsoid
  • ellipsoid/cuboid
  • cuboid/cuboid
  • sphere/ray
  • ellipsoid/ray
  • cuboid/ray
  • triangle/ray
  • quad/ray
  • triangle/triangle
  • quad/quad
Pythagoras of Samos
  • 3,051
  • 5
  • 29
  • 51
  • 3
    I bet some of the Quake source code would have something along these lines. – Rafe Kettler Jan 28 '11 at 17:33
  • Don't have a reference site, but you might want to add [GJK](http://en.wikipedia.org/wiki/Gilbert%E2%80%93Johnson%E2%80%93Keerthi_distance_algorithm) to your list. Video describing GJK can be found [here](http://mollyrocket.com/9441) – Krypes Jan 28 '11 at 17:55
  • 2
    The ONLY and BEST source for such things is the Wild Magic Library by Dave Eberly http://www.geometrictools.com –  Jan 28 '11 at 19:41

6 Answers6

48

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

It's a huge matrix of algorithms that calculate intersections between various types of objects. Excellent resource.

luke
  • 36,103
  • 8
  • 58
  • 81
  • 1
    +1, good link. But notice he also mentions `Real Time Collision Detection` as a 'definitive source' on the subject. Depends on how much detail you want/need, I guess. – James Jan 28 '11 at 18:02
  • Actually, that page links to several other things mentioned here, RTCD, Gems, etc. It's just a large maintained collection of references. – luke Jan 28 '11 at 18:03
10

Not really a website, but this book Real-Time Collision Detection is well worth it for what you are looking for.

legends2k
  • 31,634
  • 25
  • 118
  • 222
James
  • 5,355
  • 2
  • 18
  • 30
  • It's a good book. The only problem is that it has so much math in it! – James McNellis Jan 28 '11 at 17:51
  • 1
    Right. I was going for the tongue-in-cheek "there's so much math in this math book!" type comment. I should probably avoid trying to be funny until after I've had a few cups of coffee in the morning. – James McNellis Jan 28 '11 at 17:58
  • He wants to do intersections between ellipsoids. The general solution to that is a 4th order curve in R3 - it requires math :-) – phkahler Jan 28 '11 at 19:15
1

Graphics Gems is a good place to look for this type of thing.

tkerwin
  • 9,559
  • 1
  • 31
  • 47
1

You might want to put Eberly's Game Engine Design on your bookshelf. It has detailed algorithms and discussion for each of the intersections you've listed.

greyfade
  • 24,948
  • 7
  • 64
  • 80
0

If you're doing raytracing, then asking at ompf.org and looking through the RTNews archives might help. In any case, it depends on what you're going to use these for.

Artyom Shalkhakov
  • 1,101
  • 7
  • 14
-1

The source code for the POVRay ray tracer has some implementations that may be of use.

Jay
  • 13,803
  • 4
  • 42
  • 69