41

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
Patryk Czachurski
  • 2,981
  • 5
  • 26
  • 49
  • 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

47

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

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

luke
  • 32,714
  • 7
  • 56
  • 80
  • 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
9

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

legends2k
  • 27,643
  • 22
  • 108
  • 196
James
  • 5,107
  • 1
  • 16
  • 29
  • 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
  • 8,601
  • 1
  • 25
  • 46
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
  • 23,436
  • 7
  • 60
  • 78
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,141
  • 6
  • 14
-1

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

Jay
  • 12,504
  • 3
  • 36
  • 65