Pete
2014-03-08
Hi!
Does anybody remember if there is a simple, foolproof mathematical trick to check if two box-shaped volumes are intersecting, when they are in arbitrary positions AND orientations in space?
The method I have come up with in my mind is, that it should be checked if all the corner points on Box2 are on the positive side of any of the 6 surface planes (surface normals) of Box1 and vice versa. So if one of all the 12 cases is true, then the volumes are not intersecting. Otherwise they are.
The good thing is, that numbers and vectors are pretty fast to compute, but anything with less work would naturally help. :)
Peter Eastman
2014-03-08
If you do a web search for "oriented bounding box intersection test", you'll find tons of information on this. Here's a paper describing one algorithm:
http://www.cs.unc.edu/~walk/papers/gottscha/sig96.pdf
And here's an implementation I wrote for a different project (the "intersectsBox" method):
https://github.com/simbody/simbody/blob/master/SimTKmath/Geometry/src/OrientedBoundingBox.cpp
Peter
Pete
2014-03-09
A good set of search keywords helps as well... :)
At a quick browse it looks that the articles are pretty much describing all the options I had in mind. So no real shortcuts here, but there is a way that looks like a bit more simple version of, what I had come up with.
Actually I was also wondering how to generate simplified geometries for collision detection and ideas to that are presented there as well.
It may take a while, before I properly understand your code, but at least there seems to be the amount of it, that I was expecting :)
Thanks!