http://www.gamasutra.com/features/19991018/Gomez_5.htm
A drawback of using an axis-aligned bounding box is that it can’t fit rotating geometry very tightly.
On the other hand, an oriented bounding box can be rotated with the objects, fitting the geometry with less volume than an AABB. This requires that the orientation of the box must also be specified. Figure 8 shows a 2D example, where A1, A2, B1 and B2 are the local axes of boxes A and B.

For OBBs, the separating axis test must be generalized to three dimensions. A box's scalar projection onto a unit vector L creates an interval along the axis defined by L.
The radius of the projection of box A onto L is
![]()
The same is true for B, and L forms a separating axis if
![]()
Note that L does not have to be a unit vector for this test to work. The boxes A and B are disjoint if none of the 6 principal axes and their 9 cross products form a separating axis. These tests are greatly simplified if T and B’s basis vectors (B1, B2, B3) are transformed into A’s coordinate frame.
An OBB class and an implementation of the OBB overlap test is given in Listing 6 below.
| Listing 6. An OBB class. #include "coordinate_frame.h"
class OBB : public COORD_FRAME public:
VeCTOR E; //extents
};
//check if two oriented bounding boxes overlap
//A
) {
//translation, in parent frame
|
For a more complete discussion of OBBs and the separating axis test, please see [3]. Some other applications of the separating axis test are given next.

本文详细介绍了使用定向包围盒(OBB)进行三维碰撞检测的方法。包括如何通过分离轴定理来判断两个OBB是否相交,并提供了一个实现OBB重叠测试的示例代码。

418

被折叠的 条评论
为什么被折叠?



