You are on page 1of 3

2009 First International Workshop on Education Technology and Computer Science

Research on collision detection algorithm Based on AABB-OBB Bounding Volume

Chaoqiang Tu Lizhen Yu
Dept. of electronic information engineering Dept. of electronic information engineering
Nanchang University Nanchang University
Nanchang, China Nanchang, China
ndrabbit@163.com yu1li1zhen1@yahoo.com.cn

Abstract—Collision detection is pretty important in Virtual R = {c + ar1v1 + br 2 v 2 + cr 3v 3 | a, b, c ∈ (−1,1)} , as


Reality, and its speed greatly influences the reality and illusion
of immersion in virtual environment. We propose a collision shown in figure(b).
detection algorithm of hybrid bounding box based on the The most prominent feature of the OBB is the
merits of AABB and OBB: AABB-OBB. It is applicable to solid arbitrariness in its direction, which makes it surround the
objects. We construct simpler bounding volume tree and apply prescribed object as closely as possible according to the
improved data structure to decrease storage space. During the object’s shape. As shown in figure 1(b). The calculation of
period of traverse AABB-OBBTree, we have applied single the OBB is more complicated relatively. The key is to find
traverse method to improve the efficiency of collision detection, the best direction and determine the smallest size of
and its effect is more obvious especially when the depth of trees bounding box which surrounds the object in this direction. It
is different greatly. is assumed that the basic geometric element is the triangle
Keywords-collision detection; AABB; OBB; hybrid bounding i th triangle are p i , q i , r i . The
and the vertices of the
box AABB-OBB average u and covariance matrix C of the model is
calculated as follows:
I. INTRODUCTION
1
Collision detection has been the hot issue in the
computer graphics recently and is very important in many
u=
3n
∑ ( pi + qi + r i ) (1)

areas of the virtual environment. 1 n


Hierarchical Bounding Box which has been recognized C jk = ∑
3n i =1
( p ij pki + q ij qki + rji rki ),1 ≤ j , k ≤ 3 (2)
as a good means of collision detection is widely used. The
basic idea of bounding box is to use simple geometric body n is the number of triangles, p i = pi − u ,
to replace the complex geometric body. First, detecting the
bounding box of the object roughly, only when two qi = qi − u , r i = r i − u , and each of them is a vector
bounding boxes intersect, the geometry bodies they
surround have possibility to intersect. This method can rule R 3 . For example pi = ( p1i , p2i , p3i )T , C is a 3×3
out a large number geometry bodies which can’t intersect. symmetric matrix.
There are several types of bounding box: Axis-Aligned Three characteristic vectors of covariance matrix C are
Bounding Box[1](AABB),Sphere Box[2],Orientation orthogonal. After the standardization they can be used as
Bounding Box[3](OBB), K-Discrete Orientation basements that determine the direction of OBB. We calculate
Polytopes[4](K-DOPs). the maximum and minimum of all elements’ vertices in the
In this paper, we propose a collision detection algorithm three axes of the substrates. Storing an OBB needs 15
of hybrid bounding box: AABB-OBB which takes the float-point numbers (9 float-point numbers to express three
merits of AABB and OBB. AABB is used in the top level of basis vectors of the direction and 6 float-point numbers to
the tree. The method improves the efficiency and reduces express the scope).
the storage space.
B. Intersection tests between OBBs
II. THE METHOD OF OBB BOUNDING BOX
Intersection tests between OBBs based on the separation
A. Introduction of OBB axis theory. If the projection does not overlap in one axis
The OBB is a smallest rectangular parallelepiped whose between a couple of OBBs, we defined the axis as separation
axis is arbitrary and it contains a given object. It’s a good axis. We can judge the two OBBs are disjoint if two OBBs
application in the bounding box. It is assumed that one exist a separation axis. Therefore, a pair of OBBs only need
OBB’s center is c. The three orthogonal directions are test 15 axes which might be separation axis (the pairs of
combinations of each OBB’s three plane directions and three
v1 , v 2 , v3 and the “radius” in three directions are sides directions). As long as we find a separation axis, the
r 1 , r 2 , r 3 . Thus the definitive region of OBB is two OBBs are recognized as disjoint. If these 15 axes can’t
divide the pairs of OBBs, they are intersectant.Though the

978-0-7695-3557-9/09 $25.00 © 2009 IEEE 331


DOI 10.1109/ETCS.2009.82
Authorized licensed use limited to: Universitaetsbibliothek der RWTH Aachen. Downloaded on October 09,2023 at 20:59:47 UTC from IEEE Xplore. Restrictions apply.
cost of the intersection test between OBBs is high, its The top-down method is used widely and maturely in
tightness is very well. It can reduce the numbers of the technology. We adopt binary tree and use basic elements as
bounding boxes that participate in intersection test and the leaf node replace of using bounding box in the basic
basic geometric elements. In addition, if geometric object geometric elements. The basic element use triangle or
rotates, the basement of OBB need rotate too. tetrahedron which decided by the usage of surface model or
volume model for modeling method.
III. THE METHOD OF AABB BOUNDING BOX The process of a building hybrid bounding box is
The AABB is a smallest hexahedron that contains a described as follows:
given object and each edge of the hexahedron parallels to • Obtain the required points of each element from the
coordinate axis. Figure 1(a) is a simplified example of basic geometric elements' coordinates value
two-dimensional plane. By traversing all vertex of the object contained in the root node.
to find the maximum and minimum of the vertex’s X, Y, Z • Obtain the bounding box of the node
coordinates we can construct the AABB. AABB bounding • Determine the division axis. First, if the element
boxes intersect only when their projective interval in three contained in the bounding box is the basic geometric
axis are all overlapped. The maximum and minimum in the element, it can be used as leaf node directly, else,
X, Y, Z directions determine its projective interval in the use the method of dividing the longest axis, that is,
3-axis coordinates. Thus intersection tests between AABBs choose the longest axis of the bounding box as the
need comparison operation at most of 6 times. The AABB division axis
two-dimensional plane’s intersection test was shown in • Use median method to determine splitting point and
figure 2. to locate splitting plane
• Use the method based on splitting plane to divide the
AABB-OBB's element into two subsets
• Use the subsets of AABB-OBB as the root nodes
respectively, return to the step (2), until the basic
geometric element has been divided into leaf node to
form a balance tree
The example of the bounding box tree shows in figure 3.
Figure 3(a) is OBB tree and figure 3(b) is the hybrid
(a) AABB (b) OBB bounding box tree. The diamond in the following graph
Figure 1. AABB and OBB bounding box represents AABB bounding box, rectangular represents
OBB and triangle represents the basic geometric element.

B
A B
B A
B
B Br
1

B Br
B Br B Br
1 1

(a)A and B are disjoint


(b)Aand B are intersectant
Figure
Figure 2. 2. Determine
Determine the
the intersection (a) OBB (b)AABB-OBB
i i
Figure 3. The comparision of structure between new and old bounding
IV. HYBRID BOUNDING BOX AABB-OBB box trees
A. The method of the hybrid bounding box
The AABB bounding box has simple structure, but has C. The intersection test between bounding boxes and the
shortcoming in tightness. So we need to test more couples of intersection tesst between basic elements.
bounding boxes. OBB bounding box has good tightness but The intersection test between AABB-OBBs, include two
complex structure. So we propose a hybrid bounding box: stages. The first stage is to use a simple AABB bounding
AABB-OBB combined the good tightness of OBB and box's method to rule out pairs of models that can't intersect.
simple structure of AABB. We adopt AABB bounding box And the second stage is to judge the OBB's intersection
in the top level of AABB-OBB tree and adopt OBB in the precisely for pairs of models that are not ruled out.
other levels. The intersection test between OBBs is based on the
separation axis theory[7]. We observe whether the bounding
B. The construction of hybrid bounding box box can intersects when we do the tests. If AABB bounding
The construction of bounding box tree usually uses two boxes do not intersect, then pairs of models won't collide,
methods: Top-down[5] and bottom-up[6]. The core of despite there would be a possible collision between OBBs.
top-down is how to merge a number of sets into superset.

332

Authorized licensed use limited to: Universitaetsbibliothek der RWTH Aachen. Downloaded on October 09,2023 at 20:59:47 UTC from IEEE Xplore. Restrictions apply.
This is because the OBB may exceed the scope of the AABB very smaller than human organ and our algorithm requires
bounding box. less storage space.
We used triangle as the basic geometric element. It was
verified that intersection test time between OBB and OBB is VI. CONCLUSION
quite equal to that between OBB and basic element or At present, the bounding box used to carry out bounding
between the basic elements. That's why we don't use the box collision detection algorithm at home and abroad is all
bounding box in the elements of the lowest layer. If the next single bounding box. After comparision of AABB and OBB,
layer was just the basic elements in the test process, the the AABB-OBB provides a new way of thinking for the
intersection test would be run directly. This method not only development of real time interactivity in virtual reality. The
improved the speed of testing but also reduced the storage performance of the proposed algorithm is better than that of
space. the original algorithm and the data structure takes up less
storage space. Our future work is to broaden the range of the
V. EXPERIMENTAL RESULT
algorithm and use it in the software model. This is also a
The test was done on a personal computer with 3.00GHz field which needs to be solved in the virtual reality
pentium processor and a 512M memory. We use the technology.
proposed algorithm to test collision detection time of seven
scences. Figure 4 shows the results. REFERENCES

[1] G van den Bergen, “Efficient Collision Detection of Complex


Deformable Models using AABB Trees,” Journal of Graphics Tools,
vol. 2, 1997, pp. 1-13.
[2] P M Hubbard, “Collision Detection for Interactive Graphics
Applications,” IEEE Transaction on Visualization and Computer
Graphics, vol. 1, 1995, pp. 218-230.
[3] S Gottschalk, M C Lin, D. Manocha, “OBB-Tree: A Hierarchical
Structure for Rapid Interference Detection,” Proceedings of
SIGGRAPH, vol. 96, 1996, pp. 171-180.
[4] He Yu, Chen Li hui, “A novel nonparametric clustering algorithm for
discovering arbitrary sharped clusters,” Proceedings of the 2003 Joint
Conference of the Fourth International Conference, vol. 32, Dec.
2003, pp. 1826-1830.
[5] N. Greene, “Detecting Intersection of a Rectangular Solid and a
CoNbex Polyhedron. P.S. Heckbert,” editor, Graphics Gems IV,
1994, pp. 74-82.
Figure 4. Test for collision detection time
[6] G. Zachmann, “Exact and Fast Collision Detection. Diploma thesis,
Fraunhofer Institute for Computer Graphics,” Technische Hochschule
From the result we can see that the performance of the Darmstadt, Fachbereich Informatik, 1994.
AABB-OBB algorithm improved by 40--50% compared to [7] S. Gottschalk, M. Lin, D. Manocha, “OBBTree: A Hierarchical
OBB. Especially when one object is far larger than another, Structure for Rapid Interference Detection,” In Proceedings of ACM
our algorithm has greater advantages. The thinking can be Siggraph,”1996, pp. 171-180.
applied to the virtual surgery project because the scalpel is

333

Authorized licensed use limited to: Universitaetsbibliothek der RWTH Aachen. Downloaded on October 09,2023 at 20:59:47 UTC from IEEE Xplore. Restrictions apply.

You might also like