Collision Detection Using Bounding Boxes: Convexity Helps

Yunhong Zhou

Subhash Suriy

Abstract

We consider the use of bounding boxes to detect collisions among a set of convex objects in Rd . We derive tight bounds on the ratio between the number of box intersections and the number of object intersections. Con rming intuition, we show that the performance of bounding boxes improves signi cantly when the underlying objects are all convex. In particular, the ratio is 1=2 (1?1=d box ) if each object has aspect ratio at most and the set has scale factor box . More signi cantly, the bounding box performance ratio is ?

2(1 1=d) 3 1

1 3 1

? =d n (avg? =d box

? ?

1 1=d 3 1=d

)

if only the average aspect ratio avg of the n objects is known. These bounds are the best possible as we show matching lower bound constructions. The case of convex objects is interesting for several reasons: rst, in many applications, the objects are either naturally convex or are approximated by their convex hulls for convenience; second, in some applications, the penetration of convex hulls is interpreted as collision; and nally, the question is interesting from a theoretical standpoint. The proofs of our theorems are quite delicate, requiring several new ideas and nontrivial analyses.

Department of Computer Science, Washington University, St. Louis, MO 63130. Email: [email protected]. y Department of Computer Science, Washington University, St. Louis, MO 63130. Email: [email protected].

1

1 Introduction Bounding boxes are commonly used in geometric algorithms as inexpensive lters to avoid processing object pairs that are trivially non-intersecting. Due to their simpler shape, intersecting bounding boxes is almost always more ecient than intersecting complex objects. Thus, bounding boxes allow an algorithm to quickly perform a \trivial reject" test that prevents more costly processing in unnecessary cases. For instance, many rendering algorithms use bounding boxes, such as the visiblesurface determination [2], the view-frustum culling [5] and the reprojected pixel-imaging [12]. Many modeling algorithms also use bounding boxes for de ning complex shapes as boolean combinations of simpler shapes [8], or for verifying the clearance of parts in an assembly [3]. Animation algorithms use bounding boxes for collision detection in path planning [10] or simulation of physically-based motion [1, 9, 13]. The use of bounding boxes in collision detection is representative of its use in other algorithms, so we will focus on collision detection. Many collision detection algorithms break their work into two phases, which we call broad phase and narrow phase . In the broad phase, the algorithm determines all pairs whose bounding boxes intersect. The narrow phase then performs a detailed intersection test on each pair found by the broad phase. The two phases have distinct characteristics, and have often been treated as independent problems for research. In particular, suppose we have n objects, each with complexity at most m. An ecient broad phase algorithm must avoid checking all (n2) pairs, while an ecient narrow phase algorithm must avoid the (m2 ) complexity. Consider a set S of n geometric objects in d dimensions. While several dierent de nitions of a bounding box are possible, we will use the smallest enclosing L1 -norm ball, namely, the cube. (The choice of this box is purely for technical convenience, and our result hold for all the standard forms of bounding boxes, including the commonly used axis-aligned rectangular box.) Given a geometric object P , let b(P ) denote the smallest L1 ball containing P . Let Ko (S ) denote the number of intersecting object-pairs in S , and let Kb (S ) denote the number of pairs whose bounding-boxes intersect. Then, the eectiveness of bounding boxes as a broad phase heuristic can be measured by the following ratio: (S ) = n +KbK(S()S ) : o

The denominator represents the best-case work done by an ideal object intersection algorithm, so the ratio can be seen as the relative performance measure of the heuristic. Empirical evidence suggests that bounding boxes are eective in practice, meaning that ratio is quite small. On the other hand, simple examples show that (S ) can be (n) in the worst-case. (See Figure 1.) Such examples are normally written o as being \pathological" and practitioners would insist that they do not occur in practice. However, it does beg the question: what is a pathological input, and whether there is a quanti able parameter that measures the degree to which an input scene is pathological. The recent work by Suri, Hubbard and Hughes [15] and Zhou and Suri [16] investigates the phenomenon and shows that the eectiveness of bounding boxes in collision detection can be precisely calibrated by two natural shape parameters, aspect ratio and scale factor . In this paper, we extend the work of [16] in one important direction: analyze the performance of bounding boxes when all objects in the collection are convex . At rst glance, our result is perhaps not all that surprising. We show that the ratio of box-box intersections to object-object intersection shrinks, implying that convexity helps. However, the result is technically quite dicult, requiring a rather delicate analysis as well as new geometric insights. We are able to establish tight asymptotic bounds on the performance of bounding boxes, both when all objects have a bounded aspect ratio, 1

as well as when only the average aspect ratio is bounded. It is worth noting that even for convex objects in Rd , there is no good algorithm for determining all intersecting pairs in anoutput sensitive fashion. Even in two dimensions, the best algorithm for nding all intersecting pairs in a set of n convex polygons takes O(n4=3 + Ko) time [6].

n

0.5

(b)

(a)

Figure 1: (a) An example of four objects, with Kb = 2 and Ko = 1. (b) (n2) bounding-box intersections without any object intersection. The case of convex objects is interesting for several reasons. First, in many applications, the objects are either naturally convex or are approximated by their convex hulls for convenience. Second, in some applications, the penetration of convex hulls is interpreted as collision; for instance, interlocking human gures might be legitimately considered colliding. Finally, the question is interesting from a theoretical standpoint|convexity is one of the most fundamental geometric properties. While convexity does indeed improve the performance of bounding boxes, proving that fact is not at all trivial. In particular, the earlier analyses have relied on the fact that small aspect ratio implies a large core, and used that to conclude that many box-box intersections must lead to many core-core intersections. In order to show a better bound on the ratio (S ) for convex objects, we need to go beyond core-core intersections, and that requires non-trivial exploitation of convexity. Consequently, the proofs are quite delicate, requiring several new ideas and non-trivial analyses. Before stating our results precisely, let us introduce some necessary de nitions.

1.1 Aspect Ratio and Scale Factor

Given a solid object P in d-space, let b(P ) denote the smallest L1 ball containing P , and let c(P ) denote the largest L1 ball contained in P . The aspect ratio of P is de ned as vol(b(P )) ; (P ) = vol( c(P )) where vol(P ) denotes the d-dimensional volume of P . We will call b(P ) the enclosing box , and c(P ) the core of P . Thus, the aspect ratio measures the volume of the enclosing box relative to the core. For a set S = fP1 , P2 , : : :, Pn g of objects in d-space, its average aspect ratio is de ned as: n X (S ) = 1 (P ): avg

n i=1

i

We also need a bound on the scale factor , which measures the disparity between the largest and the smallest objects. We take the ratio between the largest box and the smallest box, and call it the box scale factor of S . vol(b(Pi)) : box(S ) = max i;j vol(b(P )) j

2

(One can also de ne a core scale factor as the ratio between the largest to the smallest core. We also derive our results in terms of cor , and mention them in the conclusions.) Our main result on the performance of broad phase with convex objects are summarized in the following two theorems.

Theorem 1.1 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has box scale factor , then (S ) = ( ? =d = ). Theorem 1.2 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S ? =d ? =d have average aspect ratio and box scale factor , then (S ) = ( ? =d ? =d n ? =d ). Thus, for instance, if a set of n convex objects has average aspect ratio , then (S ) is avg

=

=

2(1 1 3 1

avg

box

=

=

1 2 box

1 1

box

=

=

)

1 3 1

box

1 1 3 1

avg

(avg n ) in two dimensions, and (avg n ) in three dimension. By contrast, 1=3 1=3 n ) [16], showing that without the convexity assumption , the best bound possible is (avg 2=3 box the performance guarantee signi cantly improves if the objects are known to be convex. 2 5

2 5 box

1 5

1 2

3 8 box

1 4

1.2 Narrow Phase Computation

The narrow phase of collision detection deals with determining the detailed intersection between pairs of objects whose bounding boxes are found to intersect. Ideally, we would like the narrow phase to run in time proportional to the complexity of the intersection. Unfortunately, no such ecient algorithm is known if both objects are arbitrary non-convex polyhedra |for convex objects, an ecient algorithm follows from the Dobkin-Kirkpatrick hierarchy. In practice, many collision detection packages use the bounding boxes for the narrow phase as well. Suppose we have two (possibly non-convex) polyhedral objects P and Q in three dimensions. We put a bounding box around each face of P and Q; determine the intersecting box pairs; and then perform the detailed intersection for those face-pairs whose boxes intersect. If there are a total of m faces in P and Q, then we can nd all Kb intersecting box pairs in time O(m log2 m + Kb ). As before, we can measure the performance of this heuristic by the ratio = mK+Kb o , where Ko is the number of actual intersections among the faces of P and Q. In the worst-case, this ratio is (m) as there can be (m2) box-pair intersections even when P and Q are disjoint. Again, the constructions leading to this bound are highly pathological. We study the performance of the bounding box heuristic in terms of a natural parameter, face packing density , and show that the ratio depends on linearly. In practice, one would expect to be a small constant, partially explaining why the bounding box heuristic works well in the narrow phase.

1.3 Organization

Section 2 proves several key packing and intersection lemmas, which crucially exploit the convexity of objects. In Section 3, we analyze the performance of bounding boxes when the aspect ratio of each object is bounded. In Section 4, we extend this analysis to the case when only the average aspect ratio is bounded. In Section 6, we mention several extensions and related results.

2 Packing and Intersection Lemmas We establish several key geometric facts in this section, which rely heavily on the convexity of objects. These lemmas are crucial in our analysis of bounding boxes. Let S = fP1; P2; : : :; Pn g be a set of n 3

convex objects in Rd , where the dimension d is assumed to be a constant. Recall that b(P ) and c(P ), respectively, denote the smallest enclosing and largest enclosed L1 -boxes for P . Our rst lemma gives a lower bound on the volume of a convex object P as a function of the volumes of b(P ) and c(P ). Due to lack to space, we omit most of the proofs from the main abstract, but they are included in the appendix.

Lemma 2.1 Let P be a convex object in Rd with = vol(b(P )) and = vol(c(P )). Then, we have vol(P ) = ( )1=d .

Our next lemma formulates a type of packing result: lower bounding the number of intersections among convex objects packed in a box.

Lemma 2.2 Consider a size box B in Rd containing m objects, each with volume at least v. Then, m ? m. the number of pairwise intersections among these objects is at least =v Proof. Let S = fP ; P ; : : :; Pm g be the set of objects. Without loss of generality, assume that 1 2

1

2

2

2

all objects have the same volume, namely, vol(Pi ) = v for all i; otherwise, we can shrink each object appropriately, without increasing the number of intersections. For each point x in B , let f (x) denote the number of objects in S that contain x. The function f is nonnegative, bounded by m. Furthermor, those m objects partition B into a nite number Rof small regions where f is constant P 2 = 1im vol( among each small Rregion. Thus both f and f are integrable. Pi) = mv. B f (x) dx ?R R R 2 Also observe that B 1 dx = . Using Cauchy's Inequality, B f (x) dx ( B 1 dx) ( B f (x) dx)2, R we get B f (x)2 dx mv . Thus, 2 2

Z f (x)! 1 Z f (x) dx ? 1 Z f (x) dx m v ? mv dx = 2 B 2 B 2 2 B 2 2 2

2

(1)

The integral in Eq. (1) sums over each point of B the number of intersecting pairs. This counts a pair of intersecting objects many times, once for each point in their common intersection. Given two objects Pi and Pj , their intersection is counted for each point x 2 Pi \ Pj . Since each object has volume v , the intersection of two objects cannot have volume than v. Thus, if we let K denote R ? more the number of distinct pairs of intersecting objects, then B f (2x) dx vK . By combining this inequality with (1), we get the result: Z f (x)! 1 m2v ? m = 1 m2 ? m K v dx 2 2 2 =v 2 B 2

2

In our analysis of the bounding boxes, we will need to get an upper bound on the number of intersecting boxes, and a lower bound on the number of intersecting objects. Towards this end, we will need to group the objects depending on their positions. We will use a tiling of the plane to achieve this grouping. Pick a volume g , and consider a tiling of the space by size g boxes. We are only interested in the niteSportion of the tiling that covers the space occupied by the bounding boxes of the objects, namely, b(Pi ). Let B1 , B2 , : : :, Bp denote the boxes in this nite portion of the tiling. See Figure 2. We assume that each box is semi-open, so that the boundary shared by two boxes belongs to the one on the left, or above. Thus, each point of the plane belongs to at most one tiling box. We assign each object Pi 2 S to the unique tiling box that contains the center of its bounding box b(Pi ). 4

B1

B2

B3

B4 B6 B5

B7

B9

B8

Figure 2: A tiling. The dark square in the middle of the object in B1 depicts its core.

Lemma 2.3 Consider a tiling of the space with g = k volume boxes. Suppose a box B of this tiling is assigned m convex objects, each of which has box size and core size at least . Then, there are at least c k(= m) ? =d ? m2 pairwise intersections among the m objects assigned to B , where c is a constant dependent only on the dimension d. 2

1 1

3 Analysis for Worst-Case Aspect Ratio We now prove our rst main result: a tight bound on the ratio for a set of convex objects S = fP1; P2; : : :; Png, where each object has aspect ratio at most , and the scale factor of S is box. Our analysis has three steps: we rst deal with the case when all objects have roughly the same size enclosing box; next we deal with the case when objects belong to one of the two extreme classes, a bounding box of size either or box; nally, we handle the general case. The next two lemmas deal with the rst two cases. Recall that Kb (S ) denotes the number of intersecting bounding box pairs, and Ko(S ) denotes the number of intersecting object pairs.

Lemma 3.1 Let S be a set of n convex objects in Rd, where the bounding box of each object has size and the aspect ratio of each object is at most . Then, (S ) = O( ? =d). Lemma 3.2 Let S be a set of n convex objects in Rd where each object has aspect ratio at most , and the bounding box of each object has size either (small) or (large). Then, (S ) = 1 1

box

1=2 ). O( ? =dbox 1 1

We are now ready to prove our rst theorem.

Theorem 3.3 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has scale factor , then (S ) = ( ? =d = ). box

Proof.

1 1

1 2 box

Clearly we can rst scale all of these objects such that the largest bounding boxes have size

box and the smallest ones have size at least 1. Then we partition the set S into O(log box) classes such that P belongs to the ith class if vol(b(P )) 2 (2i?1 ; 2i]. Let Kbij , for 0 i j log box, 5

denote the number P of intersecting box-pairs where one object is in class i and the other one is in class j . Then Kb = ij Kbij . Applying Lemma 3.2 to the union of classes i and j , we get

Kbij c 1?1=d (2j?i )1=2: 1 n + Ko(S ) Thus,

P K ij (S ) = n +iKj (bS ) o

X

ij log box

0

where the last inequality uses the following fact:

X ij log box

0

2(j ?i)=2 =

1=2 ; c1 1?1=d 2(j?i)=2 = O 1?1=d box

X j log box

2j=2

X ij

2?i=2

0 = O@

0

0

X

1 2j= A = O = : 1 2 box

2

j log box

0

2

This completes the proof of the theorem.

A Matching Lower Bound

We show that the bound in Theorem 3.3 is the best possible by giving a matching lower bound. Figure 3 shows the construction. The construction is placed inside a cubic box B of volume box. We de ne a large object to be a rectangular box, whose core size is box and whose smallest enclosing cube has volume box. The long side of each rectangle is parallel to the dth dimension, and has 1=d 1=d 1=d . We partition the . Each of the remaining sides of the rectangle has length box length box 1?1=d left half of B into cells, each of which is a homothet of our large object; observe that each large rectangle has volume box1=d. We evenly distribute X = (1?1=d)=2n1=2 large rectangles among these cells. Therefore, we have Ko` = X? =d = (n): 2

1 1

Small Object Large Object

1=2 Figure 3: The lower bound construction showing (S ) = 1?1=d box .

Similarly, we de ne a small object to be a rectangular box with core size 1 and smallest enclosing cube volume . The side length of the small rectangle along dth axis is 1=d, while the other sides 1?the have length 1. We partition the right half of B into 1=d cells, each of which is a homothet 1=2 1=2 n small objects of the small object, and has volume 1=d. Weevenly distribute Y = (1?1=d)=2box Y s = (n): There are no object intersections among in these cells. We get Ko = ? =d 2

1 1

box

6

large and small objects, and thus Kos` = 0. Finally, every small-large pair of objects contributes a bounding box intersecting pair, and so

1=2 n : Kb XY = 1?1=d box

Thus,

1=2 (S ) = n +KbK(S()S ) = (1?1=dbox ): o

Remark

In the preceding construction, the smallest enclosing cube of each object is signi cantly larger than the smallest enclosing rectangular bounding box. This is purely for the convenience of presentation. We can simply rotate each object so that the main diagonal of each rectangle is oriented along the vector (11 1), which ensures that the smallest rectangular bounding box is also the smallest cubic box, implying that our construction is fully general.

4 Analysis for the Average Aspect Ratio We prove our most signi cant result in this section: a tight bound on the ratio when only the average aspect ratio is bounded. In practice, it is far more reasonable to assume that the overall aspect ratio of a scene is small than to assume that each individual object has small aspect ratio. Thus, we believe that the result of this section has much broader applicability than Theorem 3.3. Our proof for the average case follows the same general outline as the one in the previous section, but the technical details are signi cantly more complicated and the proof is far more delicate: a bound on the average aspect ratio does not constrain individual objects. In addition to the convexity-based lemmas of Section 2, we also need the following technical lemma for the average case.

Lemma 4.1 Let faki g be a nite sequence of nonnegative numbers, where 1P k p, and 1 i q , P p such that k aki n=2i , for a positive integer n and all i's. Let ak = i aki for all k's. Then the following bound holds, for any t, 1 t n: P a ? =d k k ? =d n ? =d : = O t n + P P aki =1

2

k

it

1 1 3 1

2 3 1

2

?

2i(1 1=d)

Lemma 4.2 Let S be a set of n convex obiects in Rd with average aspect ratio . Let S 0 S be avg

a subset in which each object has the same size bounding box. Then, Kb (S 0) = O( ?? =d=d n ?? =d=d ): avg n + Ko(S ) 2(1 1 3 1

)

1 1 3 1

Lemma 4.3 Let S be a set of n convex objects in Rd with average aspect ratio . Let S 0 S be

a subset where each object's bounding box has size either avg or avgbox. Then,

!

Kb(S 0 ) = O ?? =d=d ? =d n ?? =d=d : avg box n + Ko(S ) 2(1 1 3 1

7

)

1 3 1

1 1 3 1

avg

We can now prove our second theorem.

Theorem 4.4 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S have average aspect ratio avg and box scale factor box, then ? ?

2(1 1=d) 3 1=d

(S ) = (avg

1 3 1

? =d n box

? ?

1 1=d 3 1=d

):

Proof. We partition the set S into O (log box ) classes, such that P belongs to the ith class if of intersection vol(b(P )) 2 (avg2i?1 ; avg2i ]. Let Kbij , for 0 i j log box, denote the number P ij pairs where one object is in class i and the other one is in class j . Then Kb = ij Kb . If we apply Lemma 3.2 to the union of classes i and j , then

Kbij c ?? =d=d (2j?i ) ? =d n ?? =d=d 1 avg n + Ko (S ) 2(1 1 3 1

Thus,

P K ij (S ) = n +iKj (bS ) o

X

c11?1=d 2

ij log box

)

j ?i 3?1=d

ij log box

0

2

j ?i 3?1=d

X

=

n

? ?

1 1=d 3 1=d

? ?

2(1 1=d) 3 1=d

= O avg

1 3 1=d

?

box n

? ?

1 1=d 3 1=d

!

;

0

where the last inequality uses the following fact:

X

1 1 3 1

1 3 1

j log box

0

2

X

j

?

3 1=d

ij

?i 2 3?1=d

0

0 = O@

X j log box

1 ? =d A 2 =O j

3 1

1 3 1=d

?

box

:

0

2

This completes the proof.

A Matching Lower Bound

We show that the bound in Theorem 4.4 is the best possible by giving a matching lower bound. The construction follows the general outline of our earlier construction, but the details are more complicated. We omit the construction from this abstract.

5 Analysis of the Narrow Phase In this section, we brie y consider the use of bounding boxes in the narrow phase computation. Consider two (possibly non-convex) polyhedral objects P and Q in three dimensions. We put a bounding box around each face of P and Q; determine the intersecting box pairs; and then perform the detailed intersection for those face-pairs whose boxes intersect. Suppose there are a total of m faces in P and Q, the number of bounding box intersections is Kb , and the number of face-pair intersections between the faces of P and Q is Ko . Then, what is the worst-case bound on the ratio = mK+Kb o ? Clearly, without any assumptions on P and Q, the ratio can be (m). We consider below a natural shape parameter, which helps capture the pathological cases. Given a face f of a polyhedron P , let b(f ) denote the smallest cubic box containing f . Let size(f ) denote the side length of the box b(f ). Given two faces f and g , let dist(f; g ) denote the smallest distance between a point of f and a point of g . We de ne the face packing density of f , denoted (f ), as follows: 8

(f ) = jfg 2 F (P ) : size(g) size(f ) and dist(f; g) size(f )gj; where F (P ) is the set of faces of P . We say that a face packing density of P , denoted (P ), is the smallest such that (f ) , for all f 2 F (P ). A large face packing density implies that faces are

packed relatively tightly (like a closed accordion), a situation not likely to arise in practice. A key observation is that face packing density is a property of the individual polyhedron, and it does not depend on the other polyhedra with which it may intersect. Our main result is the following theorem, which we state here without proof.

Theorem 5.1 Let P and Q be two 3-dimensional polyhedra, with a total of m faces. If P and Q

both have face packing density at most , then = O(). In fact, if Kb is the total number of intersections between the bounding boxes of the faces of P and Q and Ko is the total number of face intersections between P and Q, then Ko Kb = O( m).

6 Extensions and Concluding Remarks We studied the eectiveness of bounding boxes as a ltering mechanism in collision detection. Many other applications also use bounding boxes in much the same way as collision detection, and our results should apply to them as well. The main focus of our paper was to study collision detection among convex objects. We gave tight bounds on the ratio (S ) = n+KKb(oS()S ) both when the aspect ratio of each object is bounded as well as when only the average aspect ratio of the whole set is bounded. In fact, our results precisely calibrate the worst-case eectiveness of bounding boxes in terms of the shape parameters and box. An important feature of our shape parameters is that they constrain only the individual objects and their relative sizes in the set, but put no constraints on the distribution or placement of objects. In other words, we make no assumptions about the motion, trajectories, or relative spacing among the objects. The advantage of our minimalist assumption is that our results should apply to a broad spectrum of situations. On the negative side, it is possible that in many situations, the additional constraints may lead to a better performance than our results would indicate. For instance, it may be possible that objects tend to be sparsely distributed in space, and have very few intersections. On the other hand, this can be a highly arti cial and unnatural assumption in other situations. For instance, many group dynamics exhibit a ocking tendency , such as the motion of a school of sh, a

ock of birds, visitors in a museum, or commuters in a subway station. In de ning the scale factor, we used the ratio between the largest and the smallest bounding boxes. An alternative de nition might be the ratio between the largest and the smallest cores. Somewhat surprisingly, the choice does matter, and the precise bounds on the ratio turn out to be dierent. While the proofs are similar in format, they are dierent in many details. We just state them here for the sake of completeness. De ne the core scale factor of S as vol(c(Pi)) : cor(S ) = max i;j vol(c(Pj )) Then, we prove the following tight bounds.

Theorem 6.1 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has core scale factor , then (S ) = ( ? = d = ). cor

9

1 1 2

1 2 cor

Theorem 6.2 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S ?=d ?=d have average aspect ratio and core scale factor , then (S ) = ( ? =d = n ? =d ). avg

box

2(1 1 2 ) 3 1

avg

1 2 cor

1 1 2 3 1

References [1] J. D. Cohen, M. C. Lin, D. Manocha and M. K. Ponamgi. I-COLLIDE: An interactive and exact collision detection system for large-scale environments. Proc. of ACM Interactive 3D Graphics Conference, pp. 189{196, 1995. [2] J. D. Foley, A. van Dam, S. K. Feiner, J. F. Hughes Computer Graphics: Principles and Practice (2nd Edition in C). Addison Wesley, 1996. [3] A. Garcia-Alonso, N. Serrano and J. Flaquer. Solving the Collision Detection Problem. IEEE Computer Graphics and Applications, 14, pp. 36{43, 1995. [4] S. Gottschalk, M. C. Lin and D. Manocha. OBBTree: A hierarchical structure for rapid interference detection. Proc. ACM SIGGRAPH, pp. 171{180, 1996. [5] N. Greene. Detecting Intersection of a Rectangular Solid and a Convex Polyhedron. Graphics Gems IV, pp. 83{110, 1994. [6] P. Gupta, R. Janardan and M. Smid. Ecient algorithms for counting and reporting pairwise intersection between convex polygons. Technical report, Computer Science, King's College, UK, 1996. [7] D. Halperin and M. H. Overmars. Spheres, Molecules, and Hidden Surface Removal. Proc. 10th ACM Symposium on Computational Geometry, pp. 113{122, 1994. [8] C. Homann. Geometric and Solid Modeling. Morgan Kaufmann, 1989. [9] J. T. Klosowski, M. Held, J. S. B. Mitchell, H. Sowizral, and K. Zikan. Real-time collision detection for motion simulation within complex environments. Submitted for journal publication. A preliminary version appeared in ACM SIGGRAPH'96 Visual Proceedings, pp. 151, 1996. [10] J.-C. Latombe. Robot Motion Planning. Kluwer Academic Publishers, 1991. [11] J. Matousek, J. Pach, M. Sharir, S. Sifrony and E. Welzl. Fat triangles determine linearly many holes. SIAM J. on Computing, 23, pp. 154{169, 1994. [12] L. McMillan. An Image-Based Approach to Three-Dimensional Computer Graphics. Ph.D. Thesis, University of North Carolina at Chapel Hill, 1997. [13] M. P. Moore and J. Wilhelms. Collision Detection and Response for Computer Animation. Proc. of SIGGRAPH '88, published as Computer Graphics, 22, pp. 289{298, 1988. [14] A. Smith, Y. Kitamura, H. Takemura and F. Kishino. A Simple and Ecient Method for Accurate Collision Detection among Deformable Objects in Arbitrary Motion. Proc. of the IEEE Virtual Reality Annual International Symposium, pp. 136{145, 1995. [15] S. Suri, P. M. Hubbard and J. F. Hughes. Collision Detection in Aspect and Scale Bounded Polyhedra. Proc. of 9th Annual Symposium on Discrete Algorithms, 1998. ACM Transactions on Graphics. In Press. [16] Y. Zhou and S. Suri. Analysis of a Bounding Box Heuristic for Object Intersection. Proc. of 10th Annual Symposium on Discrete Algorithms (SODA), 1999. Journal of the ACM. In Press.

10

A Appendix

Proof of Lemma 2.1: Because b(P ) and c(P ) are d-dimensional cubes, their side lengths are =d 1

=d, respectively.

and Since b(P ) is the smallest bounding cube of P , there is at least one coordinate axis along which the projection of P has length equal to the side length of b(P ). Without loss of generality, assume that axis is the dth dimension. Let l and h, respectively, denote the lowest and the highest points of P along the dth dimension. (The projection of lh on the dth coordinate axis has length 1=d .) Figure 4 illustrates this in two dimension. 1

h

b(P) c(P)

l

Figure 4: Illustration for the proof of Lemma 2.1. Now, consider a plane passing through the center of the core c(P ), with normal along the dth dimension. The plane intersects c(P ) in a (d ? 1)-dimensional cube, whose volume is 1?1=d. Since c(P ) is the core of P , it follows that the intersection \ c(P ) lies in P . Because P is convex, it contains the two cones spanned by \ c(P ) and the points l and h. Thus, the volume of P is at least 1 1?1=d 1=d = ( )1=d :

d

This completes the proof. 2

Proof of Lemma 2.3: First, consider the case k = 1, that is, vol(B) = . Then, the m objects assigned to B all have box size1=d and core size at least 0 . By Lemma 2.1, the volume of each convex object is at least (= ) . Consider the box B with same center as B and twice the side length of B ; the volume of B 0 is 2d . Recall that an object is assigned to the unique tiling box that contains the center of the object's box. Thus, each object assigned to B lies entirely inside B 0 . Therefore, by Lemam 2.2, the number of intersecting pairs is at least 2 c (= m)1?1=d ? m2 ;

which establishes the claim for k = 1. Let us now consider the general case, k > 1. As before, consider the scaled box B 0 with twice the side length of B , and tile B 0 with volume tiling boxes. Assign each of the m objects to the unique size tiling box that contains the center of object's box. Let B1 ; B2; : : :; Bp denote the boxes with a nonzero number of objects assigned to them.P It is easy to show that p = O(2dk) = O(k). If box Bi is assigned mi objects, then clearly m = 1ip mi . Let K denote the total number of intersecting pairs among the m objects, and let Ki denote the number of intersection pairs among 11

P

objects assigned to subbox Bi . Then, K i Ki. Since each subbox satis es the condition of the rst part of the proof, namely, k = 1, we get 2 Ki c (= m)1i ?1=d ? m2i ;

Therefore,

1ip

!

2 X X K Ki c (= m)1i ?1=d ? m2 i (= )c1?1=d m2i ? 12 mi i i i i P 2 2 (= )c1?1=d ( i pmi) ? m2 c0 k(= m)1?1=d ? m2 : This completes the proof. 2

X

X

Proof of Lemma 3.1: Clearly, the core size of each object must be at least 1. We consider a tiling

of the plane with size boxes, and focus on the nite portion of the tiling that covers the union of the bounding boxes of all the objects. Let B1 ; B2; : : :; Bp denote the tiling boxes, each of size . We assign each object Pi 2 S to the unique tiling box that contains the center of b(Pi). Let Xi denote the of objects assigned to box Bi . Since the boxes in the tiling are disjoint, we have P Xtotal= number n . Let Xim denote the neighbor of Bi with the maximum number of objects assigned to i i it. (A neighbor of Bi is one of the 5d tiling boxes within L1 distance 21=d of Bi .) Then,

Kb (S ) c1

X i

Xi Xim c1

X

X

i

i

(Xim )2 c2

Xi2;

where c1 ; c2 are constants dependent only on the dimension d. Let Koi denote the number of pairwise intersections among the Xi objects assigned to Bi . Then, by Lemma 2.3, there exists a constant c3 such that Koi c3 Xi2=1?1=d ? Xi =2. Therefore

n + Ko(S )

X i

(Xi + Koi )

X i

! 2 X Xi2 ! X X i i Xi + c3 1?1=d ? 2 c3 : 1?1=d i

We get our result by combining the two inequalities above: P X2 K ( S ) b (S ) = n + K (S ) c4 P i Xii = c41?1=d = O 1?1=d : o i ? =d

2

1 1

2

Proof of Lemma 3.2: Let us call an object large if its enclosing box has size , and small othbox

erwise. Clearly, there are only three kinds of intersections: large-large, small-small, and small-large, and we use Kb` ; Kbs ; Kbs` to denote the number of corresponding box pair intersections. Obviously, Kb (S ) = Kb` + Kbs + Kbs` . By Lemma 3.1, we have

Kb` Kb` = O(1?1=d) n + Ko (S ) n + Ko` Kbs = O(1?1=d): Kbs n + Ko (S ) n + Kos 12

(2) (3)

We now proceed to bound Kbs` . Consider a tiling of the plane with boxes of size box. Label these boxes B1 ; B2; :::; Bp. Let Xk denote the number of large objects assigned to Bk . Similarly de ne Yk as the total number of small objects assigned to Bk . We estimate an upper bound on Kbs` and lower bounds on n + Ko (S ) in terms of Xk and Yk . Fix a box Bk , and consider the Xk objects assigned to Bk . Let Ykm be the maximal of Yk0 for Bk0 running over the neighbors of Bk . Then we have the following estimates:

Kbs`

c

1

p X

k=1

Xk Ykm

c

1

p X

k=1

=

1 2 box

?1=2(Y m )2 Xk + box k 2

c

2

p X

1=2 ?1=2Y 2 box Xk2 + box k

k=1

Next, we bound n + Ko (S ) from below. Let Ko`i denote the number of intersecting pairs among large objects of class i. P Similarly let Kosi denote P the number of intersecting pairs among small objects of ` class i. Let n = k Xk and ns = k Yk . Then, n = n` + ns . From Lemma 2.3, we have

n + Ko (S )

X

n + Ko (S ) Thus

X

k

k

(Xk + Ko`i )

(Yk + Kosi )

!

X

2 X 2 c3 1X?k1=d + X2k c3 1X?k1=d k

k

X

2 c3 1?1Y=dk + Y2k box

k

!

c

3

X k

Yk2 1?1=d box

P (1=2X 2 + ?1=2Y 2) P X2 P Y2 Kbs` 1=2 ? 1=2 k k k k box box k c4 box n + K + box n +k Kk n + Ko (S ) c4 n + Ko o o 1=2 c4 1?1=dbox 1=2 = O 1?1=d box

!

(4)

Finally, by combining inequalities (2), (3), (4), we complete the proof of the lemma: ` s s` 1=2 (S ) = Kbn++KKb +(SK) b = O(1?1=dbox ): o

2

Proof of Lemma 4.1: Choose a constant 2i , which will be determined later, and let I = fi j i i g, I = fi j i > i g. The following bound is easily obtained: 0 1 0 1 0 1 X X @X X A X @X A X @X A ak = aki + aki 2 aki + 2 aki 0

0

2

1

0

2

2

2

2

k

k

i2I1

i2I2

i2I1

k

k

i2I2

We bound the second part of the right hand side by the following sequence of inequalities:

0 1 0 1 0 1 X @X A X X X X aki @ aki A = @ aki A i2I k k i2I k i2I 1 0 X = ni : @ 2ni A 2ni 2 i2I 2

2

2

2

2

2

2

0

2

13

2

2 0

2

To bound the rst part of the right hand side, we use Cauchy's Inequality:

10 1 0 1 0 X @X A X @ X aki A @ X i ? =d A t2 aki i ? =d i2I k i2I k i2I t 2 0 1 X @ X aki A i ? =d c t2 i ? =d 2

2

(1 1

(1 1

1

1

1

2

(1 i2I t 2

k

1

0 (1

0

)

1

)

1

c t 2i 0

)

)

?1=d) X aki ; i(1?1=d) k;i t 2 2

0 (1

where c0 = 21?1=d =(21?1=d ? 1) is a constant. By combining these two inequalities, we get

P P

Pa k k P aki n+ 2

k;i t 2i(1?1=d)

O t 2i 0

1 3 1=d

?

2

2

(1 1

k;i t

The choice of 2i = (n=t)

P P

2 2 2 k ( i2I akiP) + 2 a k ( i2I aki ) n + k;i t 2i ki? =d P P P P 2 k ( i2I aki )2 2 k ( i2I aki )2 P + a n

2

1 2

?

2i(1 1=d)

?1=d) +

0 (1

n : 22i 0

, gives

0

0

)

2

ki

n = t 2i (1?1=d) = O t 22i

1

2 3 1=d

?

?

1 1=d 3 1

n ? =d ;

which completes the proof. 2

Proof of Lemma 4.2: Without loss of generality, we can assume that all objects have xed bounding box size box. As before, we partition the plane into size box boxes. For box Bk , let Xk denote the number of objects assigned to Bk , and Xkm the maximum of Xk0 where Bk0 runs over all neighbors of Bk . Then, we have the following upper bound on Kb (S 0): Kb(S 0 ) c1

X k

Xk Xkm c1

X

X

k

k

(Xkm)2 c2

Xk2;

for some constant c1; c2 related to d. Next we partition all the objects into classes depending on their core sizes. Because P these objects have average aspect ratio avg, if we use cj to denote the core size of object Pj , then j 1=cj nbox. Now we group all objects with core size (2?i?1 ; 2?i] into class i, and denote by ni the cardinality of the ith class. Then ni n=2i , for all i. Let Koki denote the number P of object-pair intersections among the objects of the ith class assigned to box Bk . Then Ko(S ) k;i Koki . Since objects in the ith class have core size at least 1=2i, by Lemma 2.3, we have Koki c1 ( X2kii) ? =d ? X2ki , for some constant c1 . Thus, 2

avg

1 1

1 ! 0 X X X X X ki + c ki ki A @ n + Ko (S ) (Xki + Koki ) i ) ? =d c n + i ) ? =d : 2 ( 2 ( 2 k;i k;i k;i X

2

1

14

avg

2

1 1

2

avg

1 1

By putting together the bounds for Kb and Ko , we get

!

P X2 ? =d Kb (S 0) c ? =d n ?? =d i i =d = O ; avg 3 P Xki n + Ko (S ) n + k;i i ? =d 2(1 1 3 1

)

1 1 3 1

2

( avg 2 )1 1

?1=d . This where the last inequality follows from Lemma 4.1 and the parameter setting t = 1avg completes the proof of the lemma. 2

Proof of Lemma 4.3: We divide the objects of S 0 into two groups: large objects and small objects.

Each large object has bounding box size avgbox, while each small object has bounding box size avg. Let n` and ns , respectively, denote the cardinality of large and small sets. We partition the large objects into classes such that class i objects have core size ranging from box2?i?1 to box2?i . Let Xki denote the cardinality of the ith class of large objects that are assigned to box Bk . Similarly, we partition the small objects into classes such that class i objects have core size ranging from 2?i?1 to 2?i . Yki denotes the cardinality of the ith class of small objects that are assigned to box Bk . Now let Xk andPYk denote the number P of large objects and small P objects assigned to boxPBk respectively, then Xk = i Xki and Yk = i Yki . Furthermore, n`i k Xki n=2i and nsi k Yki n=2i . (This again follows from the fact that objects in class i have aspect ratio avg 2i, and so altogether there cannot be more than n=2i such objects.) Again, we use Kb` (S 0); Kbs(S 0 ) and Kbs` (S 0 ) to denote the number of bounding box intersection pairs of large-large, small-small and small-large types respectively. From Lemma 4.2, we have the following bounds:

Kb` (S 0 ) = O ?? =d=d n ?? =d=d avg n + Ko(S ) 2(1 1 3 1

)

1 1 3 1

!

!

? =d s 0 b (S ) = O avg? =d n ?? =d =d and n K : + Ko(S ) 2(1 1 3 1

)

1 1 3 1

It remains to establish a bound on Kbs` (S 0). As before, we partition the space into boxes with size avg box. Let Xkm denote the maximum of Xk0 for box Bk0 running over the neighbors of Bk . Similarly for Ykm . Then

Kbs` (S 0) c1

c c

1

2

X k

XkmYk c1

X k

X k

1 3 1=d

X k

XkmYkm ?

1 3 1

? (X m)2 + ? =d (Y m )2 box k k box 1 3 1=d

?

? ?

1 3 1=d

box Xk + box Yk : 2

2

By applying Lemma 2.3 twice, we get

1 0 1 0 X X X Y n + Ko`(S 0 ) c @n + ( 2iki) ? =d A and n + Kos(S 0) c @n + ( 2i) ki? =d A : k;i k;i 2

3

avg

2

3

1 1

Combining these inequalities with Lemma 4.1 gives us

P ? =d X + ?? =d Y k k Kbs` (S 0) c k n + Ko (S ) n + Ko (S ) 1 3 1

box

2

1 3 1

2

box

1

15

avg

1 1

box

P X P Y ! ? k k + ? =d k k ` n + Ko(S ) n + Kos (S ) P X P Y ? ? =d ? =d k k k k + P P Xki Yki n+ n+ 2

1 3 1=d

?

2

1 3 1

c 1 0 CA cB @ k;i i ? =d k;i i ? =d ? ? =d ? =d c ? =d ( ? =d) ? =d n ? =d + ? =d ( ? =d ) ? =d n ? =d ! ? =d ? =d ? =d ? =d ? =d : = O n 1

box

2

box

box

2

1 3 1

2

1 3 1

2

2

box

( avg 2 )1 1

3

1 3 1

1 1 avg

box

2(1 1 3 1

avg

)

1 3 1

box

2 3 1

1 1 3 1

1 1 3 1

This completes the proof. 2

16

( avg 2 )1 1

1 3 1

box

1 1 avg

box

2 3 1

1 1 3 1

box

Yunhong Zhou

Subhash Suriy

Abstract

We consider the use of bounding boxes to detect collisions among a set of convex objects in Rd . We derive tight bounds on the ratio between the number of box intersections and the number of object intersections. Con rming intuition, we show that the performance of bounding boxes improves signi cantly when the underlying objects are all convex. In particular, the ratio is 1=2 (1?1=d box ) if each object has aspect ratio at most and the set has scale factor box . More signi cantly, the bounding box performance ratio is ?

2(1 1=d) 3 1

1 3 1

? =d n (avg? =d box

? ?

1 1=d 3 1=d

)

if only the average aspect ratio avg of the n objects is known. These bounds are the best possible as we show matching lower bound constructions. The case of convex objects is interesting for several reasons: rst, in many applications, the objects are either naturally convex or are approximated by their convex hulls for convenience; second, in some applications, the penetration of convex hulls is interpreted as collision; and nally, the question is interesting from a theoretical standpoint. The proofs of our theorems are quite delicate, requiring several new ideas and nontrivial analyses.

Department of Computer Science, Washington University, St. Louis, MO 63130. Email: [email protected]. y Department of Computer Science, Washington University, St. Louis, MO 63130. Email: [email protected].

1

1 Introduction Bounding boxes are commonly used in geometric algorithms as inexpensive lters to avoid processing object pairs that are trivially non-intersecting. Due to their simpler shape, intersecting bounding boxes is almost always more ecient than intersecting complex objects. Thus, bounding boxes allow an algorithm to quickly perform a \trivial reject" test that prevents more costly processing in unnecessary cases. For instance, many rendering algorithms use bounding boxes, such as the visiblesurface determination [2], the view-frustum culling [5] and the reprojected pixel-imaging [12]. Many modeling algorithms also use bounding boxes for de ning complex shapes as boolean combinations of simpler shapes [8], or for verifying the clearance of parts in an assembly [3]. Animation algorithms use bounding boxes for collision detection in path planning [10] or simulation of physically-based motion [1, 9, 13]. The use of bounding boxes in collision detection is representative of its use in other algorithms, so we will focus on collision detection. Many collision detection algorithms break their work into two phases, which we call broad phase and narrow phase . In the broad phase, the algorithm determines all pairs whose bounding boxes intersect. The narrow phase then performs a detailed intersection test on each pair found by the broad phase. The two phases have distinct characteristics, and have often been treated as independent problems for research. In particular, suppose we have n objects, each with complexity at most m. An ecient broad phase algorithm must avoid checking all (n2) pairs, while an ecient narrow phase algorithm must avoid the (m2 ) complexity. Consider a set S of n geometric objects in d dimensions. While several dierent de nitions of a bounding box are possible, we will use the smallest enclosing L1 -norm ball, namely, the cube. (The choice of this box is purely for technical convenience, and our result hold for all the standard forms of bounding boxes, including the commonly used axis-aligned rectangular box.) Given a geometric object P , let b(P ) denote the smallest L1 ball containing P . Let Ko (S ) denote the number of intersecting object-pairs in S , and let Kb (S ) denote the number of pairs whose bounding-boxes intersect. Then, the eectiveness of bounding boxes as a broad phase heuristic can be measured by the following ratio: (S ) = n +KbK(S()S ) : o

The denominator represents the best-case work done by an ideal object intersection algorithm, so the ratio can be seen as the relative performance measure of the heuristic. Empirical evidence suggests that bounding boxes are eective in practice, meaning that ratio is quite small. On the other hand, simple examples show that (S ) can be (n) in the worst-case. (See Figure 1.) Such examples are normally written o as being \pathological" and practitioners would insist that they do not occur in practice. However, it does beg the question: what is a pathological input, and whether there is a quanti able parameter that measures the degree to which an input scene is pathological. The recent work by Suri, Hubbard and Hughes [15] and Zhou and Suri [16] investigates the phenomenon and shows that the eectiveness of bounding boxes in collision detection can be precisely calibrated by two natural shape parameters, aspect ratio and scale factor . In this paper, we extend the work of [16] in one important direction: analyze the performance of bounding boxes when all objects in the collection are convex . At rst glance, our result is perhaps not all that surprising. We show that the ratio of box-box intersections to object-object intersection shrinks, implying that convexity helps. However, the result is technically quite dicult, requiring a rather delicate analysis as well as new geometric insights. We are able to establish tight asymptotic bounds on the performance of bounding boxes, both when all objects have a bounded aspect ratio, 1

as well as when only the average aspect ratio is bounded. It is worth noting that even for convex objects in Rd , there is no good algorithm for determining all intersecting pairs in anoutput sensitive fashion. Even in two dimensions, the best algorithm for nding all intersecting pairs in a set of n convex polygons takes O(n4=3 + Ko) time [6].

n

0.5

(b)

(a)

Figure 1: (a) An example of four objects, with Kb = 2 and Ko = 1. (b) (n2) bounding-box intersections without any object intersection. The case of convex objects is interesting for several reasons. First, in many applications, the objects are either naturally convex or are approximated by their convex hulls for convenience. Second, in some applications, the penetration of convex hulls is interpreted as collision; for instance, interlocking human gures might be legitimately considered colliding. Finally, the question is interesting from a theoretical standpoint|convexity is one of the most fundamental geometric properties. While convexity does indeed improve the performance of bounding boxes, proving that fact is not at all trivial. In particular, the earlier analyses have relied on the fact that small aspect ratio implies a large core, and used that to conclude that many box-box intersections must lead to many core-core intersections. In order to show a better bound on the ratio (S ) for convex objects, we need to go beyond core-core intersections, and that requires non-trivial exploitation of convexity. Consequently, the proofs are quite delicate, requiring several new ideas and non-trivial analyses. Before stating our results precisely, let us introduce some necessary de nitions.

1.1 Aspect Ratio and Scale Factor

Given a solid object P in d-space, let b(P ) denote the smallest L1 ball containing P , and let c(P ) denote the largest L1 ball contained in P . The aspect ratio of P is de ned as vol(b(P )) ; (P ) = vol( c(P )) where vol(P ) denotes the d-dimensional volume of P . We will call b(P ) the enclosing box , and c(P ) the core of P . Thus, the aspect ratio measures the volume of the enclosing box relative to the core. For a set S = fP1 , P2 , : : :, Pn g of objects in d-space, its average aspect ratio is de ned as: n X (S ) = 1 (P ): avg

n i=1

i

We also need a bound on the scale factor , which measures the disparity between the largest and the smallest objects. We take the ratio between the largest box and the smallest box, and call it the box scale factor of S . vol(b(Pi)) : box(S ) = max i;j vol(b(P )) j

2

(One can also de ne a core scale factor as the ratio between the largest to the smallest core. We also derive our results in terms of cor , and mention them in the conclusions.) Our main result on the performance of broad phase with convex objects are summarized in the following two theorems.

Theorem 1.1 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has box scale factor , then (S ) = ( ? =d = ). Theorem 1.2 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S ? =d ? =d have average aspect ratio and box scale factor , then (S ) = ( ? =d ? =d n ? =d ). Thus, for instance, if a set of n convex objects has average aspect ratio , then (S ) is avg

=

=

2(1 1 3 1

avg

box

=

=

1 2 box

1 1

box

=

=

)

1 3 1

box

1 1 3 1

avg

(avg n ) in two dimensions, and (avg n ) in three dimension. By contrast, 1=3 1=3 n ) [16], showing that without the convexity assumption , the best bound possible is (avg 2=3 box the performance guarantee signi cantly improves if the objects are known to be convex. 2 5

2 5 box

1 5

1 2

3 8 box

1 4

1.2 Narrow Phase Computation

The narrow phase of collision detection deals with determining the detailed intersection between pairs of objects whose bounding boxes are found to intersect. Ideally, we would like the narrow phase to run in time proportional to the complexity of the intersection. Unfortunately, no such ecient algorithm is known if both objects are arbitrary non-convex polyhedra |for convex objects, an ecient algorithm follows from the Dobkin-Kirkpatrick hierarchy. In practice, many collision detection packages use the bounding boxes for the narrow phase as well. Suppose we have two (possibly non-convex) polyhedral objects P and Q in three dimensions. We put a bounding box around each face of P and Q; determine the intersecting box pairs; and then perform the detailed intersection for those face-pairs whose boxes intersect. If there are a total of m faces in P and Q, then we can nd all Kb intersecting box pairs in time O(m log2 m + Kb ). As before, we can measure the performance of this heuristic by the ratio = mK+Kb o , where Ko is the number of actual intersections among the faces of P and Q. In the worst-case, this ratio is (m) as there can be (m2) box-pair intersections even when P and Q are disjoint. Again, the constructions leading to this bound are highly pathological. We study the performance of the bounding box heuristic in terms of a natural parameter, face packing density , and show that the ratio depends on linearly. In practice, one would expect to be a small constant, partially explaining why the bounding box heuristic works well in the narrow phase.

1.3 Organization

Section 2 proves several key packing and intersection lemmas, which crucially exploit the convexity of objects. In Section 3, we analyze the performance of bounding boxes when the aspect ratio of each object is bounded. In Section 4, we extend this analysis to the case when only the average aspect ratio is bounded. In Section 6, we mention several extensions and related results.

2 Packing and Intersection Lemmas We establish several key geometric facts in this section, which rely heavily on the convexity of objects. These lemmas are crucial in our analysis of bounding boxes. Let S = fP1; P2; : : :; Pn g be a set of n 3

convex objects in Rd , where the dimension d is assumed to be a constant. Recall that b(P ) and c(P ), respectively, denote the smallest enclosing and largest enclosed L1 -boxes for P . Our rst lemma gives a lower bound on the volume of a convex object P as a function of the volumes of b(P ) and c(P ). Due to lack to space, we omit most of the proofs from the main abstract, but they are included in the appendix.

Lemma 2.1 Let P be a convex object in Rd with = vol(b(P )) and = vol(c(P )). Then, we have vol(P ) = ( )1=d .

Our next lemma formulates a type of packing result: lower bounding the number of intersections among convex objects packed in a box.

Lemma 2.2 Consider a size box B in Rd containing m objects, each with volume at least v. Then, m ? m. the number of pairwise intersections among these objects is at least =v Proof. Let S = fP ; P ; : : :; Pm g be the set of objects. Without loss of generality, assume that 1 2

1

2

2

2

all objects have the same volume, namely, vol(Pi ) = v for all i; otherwise, we can shrink each object appropriately, without increasing the number of intersections. For each point x in B , let f (x) denote the number of objects in S that contain x. The function f is nonnegative, bounded by m. Furthermor, those m objects partition B into a nite number Rof small regions where f is constant P 2 = 1im vol( among each small Rregion. Thus both f and f are integrable. Pi) = mv. B f (x) dx ?R R R 2 Also observe that B 1 dx = . Using Cauchy's Inequality, B f (x) dx ( B 1 dx) ( B f (x) dx)2, R we get B f (x)2 dx mv . Thus, 2 2

Z f (x)! 1 Z f (x) dx ? 1 Z f (x) dx m v ? mv dx = 2 B 2 B 2 2 B 2 2 2

2

(1)

The integral in Eq. (1) sums over each point of B the number of intersecting pairs. This counts a pair of intersecting objects many times, once for each point in their common intersection. Given two objects Pi and Pj , their intersection is counted for each point x 2 Pi \ Pj . Since each object has volume v , the intersection of two objects cannot have volume than v. Thus, if we let K denote R ? more the number of distinct pairs of intersecting objects, then B f (2x) dx vK . By combining this inequality with (1), we get the result: Z f (x)! 1 m2v ? m = 1 m2 ? m K v dx 2 2 2 =v 2 B 2

2

In our analysis of the bounding boxes, we will need to get an upper bound on the number of intersecting boxes, and a lower bound on the number of intersecting objects. Towards this end, we will need to group the objects depending on their positions. We will use a tiling of the plane to achieve this grouping. Pick a volume g , and consider a tiling of the space by size g boxes. We are only interested in the niteSportion of the tiling that covers the space occupied by the bounding boxes of the objects, namely, b(Pi ). Let B1 , B2 , : : :, Bp denote the boxes in this nite portion of the tiling. See Figure 2. We assume that each box is semi-open, so that the boundary shared by two boxes belongs to the one on the left, or above. Thus, each point of the plane belongs to at most one tiling box. We assign each object Pi 2 S to the unique tiling box that contains the center of its bounding box b(Pi ). 4

B1

B2

B3

B4 B6 B5

B7

B9

B8

Figure 2: A tiling. The dark square in the middle of the object in B1 depicts its core.

Lemma 2.3 Consider a tiling of the space with g = k volume boxes. Suppose a box B of this tiling is assigned m convex objects, each of which has box size and core size at least . Then, there are at least c k(= m) ? =d ? m2 pairwise intersections among the m objects assigned to B , where c is a constant dependent only on the dimension d. 2

1 1

3 Analysis for Worst-Case Aspect Ratio We now prove our rst main result: a tight bound on the ratio for a set of convex objects S = fP1; P2; : : :; Png, where each object has aspect ratio at most , and the scale factor of S is box. Our analysis has three steps: we rst deal with the case when all objects have roughly the same size enclosing box; next we deal with the case when objects belong to one of the two extreme classes, a bounding box of size either or box; nally, we handle the general case. The next two lemmas deal with the rst two cases. Recall that Kb (S ) denotes the number of intersecting bounding box pairs, and Ko(S ) denotes the number of intersecting object pairs.

Lemma 3.1 Let S be a set of n convex objects in Rd, where the bounding box of each object has size and the aspect ratio of each object is at most . Then, (S ) = O( ? =d). Lemma 3.2 Let S be a set of n convex objects in Rd where each object has aspect ratio at most , and the bounding box of each object has size either (small) or (large). Then, (S ) = 1 1

box

1=2 ). O( ? =dbox 1 1

We are now ready to prove our rst theorem.

Theorem 3.3 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has scale factor , then (S ) = ( ? =d = ). box

Proof.

1 1

1 2 box

Clearly we can rst scale all of these objects such that the largest bounding boxes have size

box and the smallest ones have size at least 1. Then we partition the set S into O(log box) classes such that P belongs to the ith class if vol(b(P )) 2 (2i?1 ; 2i]. Let Kbij , for 0 i j log box, 5

denote the number P of intersecting box-pairs where one object is in class i and the other one is in class j . Then Kb = ij Kbij . Applying Lemma 3.2 to the union of classes i and j , we get

Kbij c 1?1=d (2j?i )1=2: 1 n + Ko(S ) Thus,

P K ij (S ) = n +iKj (bS ) o

X

ij log box

0

where the last inequality uses the following fact:

X ij log box

0

2(j ?i)=2 =

1=2 ; c1 1?1=d 2(j?i)=2 = O 1?1=d box

X j log box

2j=2

X ij

2?i=2

0 = O@

0

0

X

1 2j= A = O = : 1 2 box

2

j log box

0

2

This completes the proof of the theorem.

A Matching Lower Bound

We show that the bound in Theorem 3.3 is the best possible by giving a matching lower bound. Figure 3 shows the construction. The construction is placed inside a cubic box B of volume box. We de ne a large object to be a rectangular box, whose core size is box and whose smallest enclosing cube has volume box. The long side of each rectangle is parallel to the dth dimension, and has 1=d 1=d 1=d . We partition the . Each of the remaining sides of the rectangle has length box length box 1?1=d left half of B into cells, each of which is a homothet of our large object; observe that each large rectangle has volume box1=d. We evenly distribute X = (1?1=d)=2n1=2 large rectangles among these cells. Therefore, we have Ko` = X? =d = (n): 2

1 1

Small Object Large Object

1=2 Figure 3: The lower bound construction showing (S ) = 1?1=d box .

Similarly, we de ne a small object to be a rectangular box with core size 1 and smallest enclosing cube volume . The side length of the small rectangle along dth axis is 1=d, while the other sides 1?the have length 1. We partition the right half of B into 1=d cells, each of which is a homothet 1=2 1=2 n small objects of the small object, and has volume 1=d. Weevenly distribute Y = (1?1=d)=2box Y s = (n): There are no object intersections among in these cells. We get Ko = ? =d 2

1 1

box

6

large and small objects, and thus Kos` = 0. Finally, every small-large pair of objects contributes a bounding box intersecting pair, and so

1=2 n : Kb XY = 1?1=d box

Thus,

1=2 (S ) = n +KbK(S()S ) = (1?1=dbox ): o

Remark

In the preceding construction, the smallest enclosing cube of each object is signi cantly larger than the smallest enclosing rectangular bounding box. This is purely for the convenience of presentation. We can simply rotate each object so that the main diagonal of each rectangle is oriented along the vector (11 1), which ensures that the smallest rectangular bounding box is also the smallest cubic box, implying that our construction is fully general.

4 Analysis for the Average Aspect Ratio We prove our most signi cant result in this section: a tight bound on the ratio when only the average aspect ratio is bounded. In practice, it is far more reasonable to assume that the overall aspect ratio of a scene is small than to assume that each individual object has small aspect ratio. Thus, we believe that the result of this section has much broader applicability than Theorem 3.3. Our proof for the average case follows the same general outline as the one in the previous section, but the technical details are signi cantly more complicated and the proof is far more delicate: a bound on the average aspect ratio does not constrain individual objects. In addition to the convexity-based lemmas of Section 2, we also need the following technical lemma for the average case.

Lemma 4.1 Let faki g be a nite sequence of nonnegative numbers, where 1P k p, and 1 i q , P p such that k aki n=2i , for a positive integer n and all i's. Let ak = i aki for all k's. Then the following bound holds, for any t, 1 t n: P a ? =d k k ? =d n ? =d : = O t n + P P aki =1

2

k

it

1 1 3 1

2 3 1

2

?

2i(1 1=d)

Lemma 4.2 Let S be a set of n convex obiects in Rd with average aspect ratio . Let S 0 S be avg

a subset in which each object has the same size bounding box. Then, Kb (S 0) = O( ?? =d=d n ?? =d=d ): avg n + Ko(S ) 2(1 1 3 1

)

1 1 3 1

Lemma 4.3 Let S be a set of n convex objects in Rd with average aspect ratio . Let S 0 S be

a subset where each object's bounding box has size either avg or avgbox. Then,

!

Kb(S 0 ) = O ?? =d=d ? =d n ?? =d=d : avg box n + Ko(S ) 2(1 1 3 1

7

)

1 3 1

1 1 3 1

avg

We can now prove our second theorem.

Theorem 4.4 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S have average aspect ratio avg and box scale factor box, then ? ?

2(1 1=d) 3 1=d

(S ) = (avg

1 3 1

? =d n box

? ?

1 1=d 3 1=d

):

Proof. We partition the set S into O (log box ) classes, such that P belongs to the ith class if of intersection vol(b(P )) 2 (avg2i?1 ; avg2i ]. Let Kbij , for 0 i j log box, denote the number P ij pairs where one object is in class i and the other one is in class j . Then Kb = ij Kb . If we apply Lemma 3.2 to the union of classes i and j , then

Kbij c ?? =d=d (2j?i ) ? =d n ?? =d=d 1 avg n + Ko (S ) 2(1 1 3 1

Thus,

P K ij (S ) = n +iKj (bS ) o

X

c11?1=d 2

ij log box

)

j ?i 3?1=d

ij log box

0

2

j ?i 3?1=d

X

=

n

? ?

1 1=d 3 1=d

? ?

2(1 1=d) 3 1=d

= O avg

1 3 1=d

?

box n

? ?

1 1=d 3 1=d

!

;

0

where the last inequality uses the following fact:

X

1 1 3 1

1 3 1

j log box

0

2

X

j

?

3 1=d

ij

?i 2 3?1=d

0

0 = O@

X j log box

1 ? =d A 2 =O j

3 1

1 3 1=d

?

box

:

0

2

This completes the proof.

A Matching Lower Bound

We show that the bound in Theorem 4.4 is the best possible by giving a matching lower bound. The construction follows the general outline of our earlier construction, but the details are more complicated. We omit the construction from this abstract.

5 Analysis of the Narrow Phase In this section, we brie y consider the use of bounding boxes in the narrow phase computation. Consider two (possibly non-convex) polyhedral objects P and Q in three dimensions. We put a bounding box around each face of P and Q; determine the intersecting box pairs; and then perform the detailed intersection for those face-pairs whose boxes intersect. Suppose there are a total of m faces in P and Q, the number of bounding box intersections is Kb , and the number of face-pair intersections between the faces of P and Q is Ko . Then, what is the worst-case bound on the ratio = mK+Kb o ? Clearly, without any assumptions on P and Q, the ratio can be (m). We consider below a natural shape parameter, which helps capture the pathological cases. Given a face f of a polyhedron P , let b(f ) denote the smallest cubic box containing f . Let size(f ) denote the side length of the box b(f ). Given two faces f and g , let dist(f; g ) denote the smallest distance between a point of f and a point of g . We de ne the face packing density of f , denoted (f ), as follows: 8

(f ) = jfg 2 F (P ) : size(g) size(f ) and dist(f; g) size(f )gj; where F (P ) is the set of faces of P . We say that a face packing density of P , denoted (P ), is the smallest such that (f ) , for all f 2 F (P ). A large face packing density implies that faces are

packed relatively tightly (like a closed accordion), a situation not likely to arise in practice. A key observation is that face packing density is a property of the individual polyhedron, and it does not depend on the other polyhedra with which it may intersect. Our main result is the following theorem, which we state here without proof.

Theorem 5.1 Let P and Q be two 3-dimensional polyhedra, with a total of m faces. If P and Q

both have face packing density at most , then = O(). In fact, if Kb is the total number of intersections between the bounding boxes of the faces of P and Q and Ko is the total number of face intersections between P and Q, then Ko Kb = O( m).

6 Extensions and Concluding Remarks We studied the eectiveness of bounding boxes as a ltering mechanism in collision detection. Many other applications also use bounding boxes in much the same way as collision detection, and our results should apply to them as well. The main focus of our paper was to study collision detection among convex objects. We gave tight bounds on the ratio (S ) = n+KKb(oS()S ) both when the aspect ratio of each object is bounded as well as when only the average aspect ratio of the whole set is bounded. In fact, our results precisely calibrate the worst-case eectiveness of bounding boxes in terms of the shape parameters and box. An important feature of our shape parameters is that they constrain only the individual objects and their relative sizes in the set, but put no constraints on the distribution or placement of objects. In other words, we make no assumptions about the motion, trajectories, or relative spacing among the objects. The advantage of our minimalist assumption is that our results should apply to a broad spectrum of situations. On the negative side, it is possible that in many situations, the additional constraints may lead to a better performance than our results would indicate. For instance, it may be possible that objects tend to be sparsely distributed in space, and have very few intersections. On the other hand, this can be a highly arti cial and unnatural assumption in other situations. For instance, many group dynamics exhibit a ocking tendency , such as the motion of a school of sh, a

ock of birds, visitors in a museum, or commuters in a subway station. In de ning the scale factor, we used the ratio between the largest and the smallest bounding boxes. An alternative de nition might be the ratio between the largest and the smallest cores. Somewhat surprisingly, the choice does matter, and the precise bounds on the ratio turn out to be dierent. While the proofs are similar in format, they are dierent in many details. We just state them here for the sake of completeness. De ne the core scale factor of S as vol(c(Pi)) : cor(S ) = max i;j vol(c(Pj )) Then, we prove the following tight bounds.

Theorem 6.1 Let S be a set of n convex objects in Rd, where d is a constant. If each object of S has aspect ratio at most and S has core scale factor , then (S ) = ( ? = d = ). cor

9

1 1 2

1 2 cor

Theorem 6.2 Let S be a set of n convex objects in Rd, where d is a constant. If the objects of S ?=d ?=d have average aspect ratio and core scale factor , then (S ) = ( ? =d = n ? =d ). avg

box

2(1 1 2 ) 3 1

avg

1 2 cor

1 1 2 3 1

References [1] J. D. Cohen, M. C. Lin, D. Manocha and M. K. Ponamgi. I-COLLIDE: An interactive and exact collision detection system for large-scale environments. Proc. of ACM Interactive 3D Graphics Conference, pp. 189{196, 1995. [2] J. D. Foley, A. van Dam, S. K. Feiner, J. F. Hughes Computer Graphics: Principles and Practice (2nd Edition in C). Addison Wesley, 1996. [3] A. Garcia-Alonso, N. Serrano and J. Flaquer. Solving the Collision Detection Problem. IEEE Computer Graphics and Applications, 14, pp. 36{43, 1995. [4] S. Gottschalk, M. C. Lin and D. Manocha. OBBTree: A hierarchical structure for rapid interference detection. Proc. ACM SIGGRAPH, pp. 171{180, 1996. [5] N. Greene. Detecting Intersection of a Rectangular Solid and a Convex Polyhedron. Graphics Gems IV, pp. 83{110, 1994. [6] P. Gupta, R. Janardan and M. Smid. Ecient algorithms for counting and reporting pairwise intersection between convex polygons. Technical report, Computer Science, King's College, UK, 1996. [7] D. Halperin and M. H. Overmars. Spheres, Molecules, and Hidden Surface Removal. Proc. 10th ACM Symposium on Computational Geometry, pp. 113{122, 1994. [8] C. Homann. Geometric and Solid Modeling. Morgan Kaufmann, 1989. [9] J. T. Klosowski, M. Held, J. S. B. Mitchell, H. Sowizral, and K. Zikan. Real-time collision detection for motion simulation within complex environments. Submitted for journal publication. A preliminary version appeared in ACM SIGGRAPH'96 Visual Proceedings, pp. 151, 1996. [10] J.-C. Latombe. Robot Motion Planning. Kluwer Academic Publishers, 1991. [11] J. Matousek, J. Pach, M. Sharir, S. Sifrony and E. Welzl. Fat triangles determine linearly many holes. SIAM J. on Computing, 23, pp. 154{169, 1994. [12] L. McMillan. An Image-Based Approach to Three-Dimensional Computer Graphics. Ph.D. Thesis, University of North Carolina at Chapel Hill, 1997. [13] M. P. Moore and J. Wilhelms. Collision Detection and Response for Computer Animation. Proc. of SIGGRAPH '88, published as Computer Graphics, 22, pp. 289{298, 1988. [14] A. Smith, Y. Kitamura, H. Takemura and F. Kishino. A Simple and Ecient Method for Accurate Collision Detection among Deformable Objects in Arbitrary Motion. Proc. of the IEEE Virtual Reality Annual International Symposium, pp. 136{145, 1995. [15] S. Suri, P. M. Hubbard and J. F. Hughes. Collision Detection in Aspect and Scale Bounded Polyhedra. Proc. of 9th Annual Symposium on Discrete Algorithms, 1998. ACM Transactions on Graphics. In Press. [16] Y. Zhou and S. Suri. Analysis of a Bounding Box Heuristic for Object Intersection. Proc. of 10th Annual Symposium on Discrete Algorithms (SODA), 1999. Journal of the ACM. In Press.

10

A Appendix

Proof of Lemma 2.1: Because b(P ) and c(P ) are d-dimensional cubes, their side lengths are =d 1

=d, respectively.

and Since b(P ) is the smallest bounding cube of P , there is at least one coordinate axis along which the projection of P has length equal to the side length of b(P ). Without loss of generality, assume that axis is the dth dimension. Let l and h, respectively, denote the lowest and the highest points of P along the dth dimension. (The projection of lh on the dth coordinate axis has length 1=d .) Figure 4 illustrates this in two dimension. 1

h

b(P) c(P)

l

Figure 4: Illustration for the proof of Lemma 2.1. Now, consider a plane passing through the center of the core c(P ), with normal along the dth dimension. The plane intersects c(P ) in a (d ? 1)-dimensional cube, whose volume is 1?1=d. Since c(P ) is the core of P , it follows that the intersection \ c(P ) lies in P . Because P is convex, it contains the two cones spanned by \ c(P ) and the points l and h. Thus, the volume of P is at least 1 1?1=d 1=d = ( )1=d :

d

This completes the proof. 2

Proof of Lemma 2.3: First, consider the case k = 1, that is, vol(B) = . Then, the m objects assigned to B all have box size1=d and core size at least 0 . By Lemma 2.1, the volume of each convex object is at least (= ) . Consider the box B with same center as B and twice the side length of B ; the volume of B 0 is 2d . Recall that an object is assigned to the unique tiling box that contains the center of the object's box. Thus, each object assigned to B lies entirely inside B 0 . Therefore, by Lemam 2.2, the number of intersecting pairs is at least 2 c (= m)1?1=d ? m2 ;

which establishes the claim for k = 1. Let us now consider the general case, k > 1. As before, consider the scaled box B 0 with twice the side length of B , and tile B 0 with volume tiling boxes. Assign each of the m objects to the unique size tiling box that contains the center of object's box. Let B1 ; B2; : : :; Bp denote the boxes with a nonzero number of objects assigned to them.P It is easy to show that p = O(2dk) = O(k). If box Bi is assigned mi objects, then clearly m = 1ip mi . Let K denote the total number of intersecting pairs among the m objects, and let Ki denote the number of intersection pairs among 11

P

objects assigned to subbox Bi . Then, K i Ki. Since each subbox satis es the condition of the rst part of the proof, namely, k = 1, we get 2 Ki c (= m)1i ?1=d ? m2i ;

Therefore,

1ip

!

2 X X K Ki c (= m)1i ?1=d ? m2 i (= )c1?1=d m2i ? 12 mi i i i i P 2 2 (= )c1?1=d ( i pmi) ? m2 c0 k(= m)1?1=d ? m2 : This completes the proof. 2

X

X

Proof of Lemma 3.1: Clearly, the core size of each object must be at least 1. We consider a tiling

of the plane with size boxes, and focus on the nite portion of the tiling that covers the union of the bounding boxes of all the objects. Let B1 ; B2; : : :; Bp denote the tiling boxes, each of size . We assign each object Pi 2 S to the unique tiling box that contains the center of b(Pi). Let Xi denote the of objects assigned to box Bi . Since the boxes in the tiling are disjoint, we have P Xtotal= number n . Let Xim denote the neighbor of Bi with the maximum number of objects assigned to i i it. (A neighbor of Bi is one of the 5d tiling boxes within L1 distance 21=d of Bi .) Then,

Kb (S ) c1

X i

Xi Xim c1

X

X

i

i

(Xim )2 c2

Xi2;

where c1 ; c2 are constants dependent only on the dimension d. Let Koi denote the number of pairwise intersections among the Xi objects assigned to Bi . Then, by Lemma 2.3, there exists a constant c3 such that Koi c3 Xi2=1?1=d ? Xi =2. Therefore

n + Ko(S )

X i

(Xi + Koi )

X i

! 2 X Xi2 ! X X i i Xi + c3 1?1=d ? 2 c3 : 1?1=d i

We get our result by combining the two inequalities above: P X2 K ( S ) b (S ) = n + K (S ) c4 P i Xii = c41?1=d = O 1?1=d : o i ? =d

2

1 1

2

Proof of Lemma 3.2: Let us call an object large if its enclosing box has size , and small othbox

erwise. Clearly, there are only three kinds of intersections: large-large, small-small, and small-large, and we use Kb` ; Kbs ; Kbs` to denote the number of corresponding box pair intersections. Obviously, Kb (S ) = Kb` + Kbs + Kbs` . By Lemma 3.1, we have

Kb` Kb` = O(1?1=d) n + Ko (S ) n + Ko` Kbs = O(1?1=d): Kbs n + Ko (S ) n + Kos 12

(2) (3)

We now proceed to bound Kbs` . Consider a tiling of the plane with boxes of size box. Label these boxes B1 ; B2; :::; Bp. Let Xk denote the number of large objects assigned to Bk . Similarly de ne Yk as the total number of small objects assigned to Bk . We estimate an upper bound on Kbs` and lower bounds on n + Ko (S ) in terms of Xk and Yk . Fix a box Bk , and consider the Xk objects assigned to Bk . Let Ykm be the maximal of Yk0 for Bk0 running over the neighbors of Bk . Then we have the following estimates:

Kbs`

c

1

p X

k=1

Xk Ykm

c

1

p X

k=1

=

1 2 box

?1=2(Y m )2 Xk + box k 2

c

2

p X

1=2 ?1=2Y 2 box Xk2 + box k

k=1

Next, we bound n + Ko (S ) from below. Let Ko`i denote the number of intersecting pairs among large objects of class i. P Similarly let Kosi denote P the number of intersecting pairs among small objects of ` class i. Let n = k Xk and ns = k Yk . Then, n = n` + ns . From Lemma 2.3, we have

n + Ko (S )

X

n + Ko (S ) Thus

X

k

k

(Xk + Ko`i )

(Yk + Kosi )

!

X

2 X 2 c3 1X?k1=d + X2k c3 1X?k1=d k

k

X

2 c3 1?1Y=dk + Y2k box

k

!

c

3

X k

Yk2 1?1=d box

P (1=2X 2 + ?1=2Y 2) P X2 P Y2 Kbs` 1=2 ? 1=2 k k k k box box k c4 box n + K + box n +k Kk n + Ko (S ) c4 n + Ko o o 1=2 c4 1?1=dbox 1=2 = O 1?1=d box

!

(4)

Finally, by combining inequalities (2), (3), (4), we complete the proof of the lemma: ` s s` 1=2 (S ) = Kbn++KKb +(SK) b = O(1?1=dbox ): o

2

Proof of Lemma 4.1: Choose a constant 2i , which will be determined later, and let I = fi j i i g, I = fi j i > i g. The following bound is easily obtained: 0 1 0 1 0 1 X X @X X A X @X A X @X A ak = aki + aki 2 aki + 2 aki 0

0

2

1

0

2

2

2

2

k

k

i2I1

i2I2

i2I1

k

k

i2I2

We bound the second part of the right hand side by the following sequence of inequalities:

0 1 0 1 0 1 X @X A X X X X aki @ aki A = @ aki A i2I k k i2I k i2I 1 0 X = ni : @ 2ni A 2ni 2 i2I 2

2

2

2

2

2

2

0

2

13

2

2 0

2

To bound the rst part of the right hand side, we use Cauchy's Inequality:

10 1 0 1 0 X @X A X @ X aki A @ X i ? =d A t2 aki i ? =d i2I k i2I k i2I t 2 0 1 X @ X aki A i ? =d c t2 i ? =d 2

2

(1 1

(1 1

1

1

1

2

(1 i2I t 2

k

1

0 (1

0

)

1

)

1

c t 2i 0

)

)

?1=d) X aki ; i(1?1=d) k;i t 2 2

0 (1

where c0 = 21?1=d =(21?1=d ? 1) is a constant. By combining these two inequalities, we get

P P

Pa k k P aki n+ 2

k;i t 2i(1?1=d)

O t 2i 0

1 3 1=d

?

2

2

(1 1

k;i t

The choice of 2i = (n=t)

P P

2 2 2 k ( i2I akiP) + 2 a k ( i2I aki ) n + k;i t 2i ki? =d P P P P 2 k ( i2I aki )2 2 k ( i2I aki )2 P + a n

2

1 2

?

2i(1 1=d)

?1=d) +

0 (1

n : 22i 0

, gives

0

0

)

2

ki

n = t 2i (1?1=d) = O t 22i

1

2 3 1=d

?

?

1 1=d 3 1

n ? =d ;

which completes the proof. 2

Proof of Lemma 4.2: Without loss of generality, we can assume that all objects have xed bounding box size box. As before, we partition the plane into size box boxes. For box Bk , let Xk denote the number of objects assigned to Bk , and Xkm the maximum of Xk0 where Bk0 runs over all neighbors of Bk . Then, we have the following upper bound on Kb (S 0): Kb(S 0 ) c1

X k

Xk Xkm c1

X

X

k

k

(Xkm)2 c2

Xk2;

for some constant c1; c2 related to d. Next we partition all the objects into classes depending on their core sizes. Because P these objects have average aspect ratio avg, if we use cj to denote the core size of object Pj , then j 1=cj nbox. Now we group all objects with core size (2?i?1 ; 2?i] into class i, and denote by ni the cardinality of the ith class. Then ni n=2i , for all i. Let Koki denote the number P of object-pair intersections among the objects of the ith class assigned to box Bk . Then Ko(S ) k;i Koki . Since objects in the ith class have core size at least 1=2i, by Lemma 2.3, we have Koki c1 ( X2kii) ? =d ? X2ki , for some constant c1 . Thus, 2

avg

1 1

1 ! 0 X X X X X ki + c ki ki A @ n + Ko (S ) (Xki + Koki ) i ) ? =d c n + i ) ? =d : 2 ( 2 ( 2 k;i k;i k;i X

2

1

14

avg

2

1 1

2

avg

1 1

By putting together the bounds for Kb and Ko , we get

!

P X2 ? =d Kb (S 0) c ? =d n ?? =d i i =d = O ; avg 3 P Xki n + Ko (S ) n + k;i i ? =d 2(1 1 3 1

)

1 1 3 1

2

( avg 2 )1 1

?1=d . This where the last inequality follows from Lemma 4.1 and the parameter setting t = 1avg completes the proof of the lemma. 2

Proof of Lemma 4.3: We divide the objects of S 0 into two groups: large objects and small objects.

Each large object has bounding box size avgbox, while each small object has bounding box size avg. Let n` and ns , respectively, denote the cardinality of large and small sets. We partition the large objects into classes such that class i objects have core size ranging from box2?i?1 to box2?i . Let Xki denote the cardinality of the ith class of large objects that are assigned to box Bk . Similarly, we partition the small objects into classes such that class i objects have core size ranging from 2?i?1 to 2?i . Yki denotes the cardinality of the ith class of small objects that are assigned to box Bk . Now let Xk andPYk denote the number P of large objects and small P objects assigned to boxPBk respectively, then Xk = i Xki and Yk = i Yki . Furthermore, n`i k Xki n=2i and nsi k Yki n=2i . (This again follows from the fact that objects in class i have aspect ratio avg 2i, and so altogether there cannot be more than n=2i such objects.) Again, we use Kb` (S 0); Kbs(S 0 ) and Kbs` (S 0 ) to denote the number of bounding box intersection pairs of large-large, small-small and small-large types respectively. From Lemma 4.2, we have the following bounds:

Kb` (S 0 ) = O ?? =d=d n ?? =d=d avg n + Ko(S ) 2(1 1 3 1

)

1 1 3 1

!

!

? =d s 0 b (S ) = O avg? =d n ?? =d =d and n K : + Ko(S ) 2(1 1 3 1

)

1 1 3 1

It remains to establish a bound on Kbs` (S 0). As before, we partition the space into boxes with size avg box. Let Xkm denote the maximum of Xk0 for box Bk0 running over the neighbors of Bk . Similarly for Ykm . Then

Kbs` (S 0) c1

c c

1

2

X k

XkmYk c1

X k

X k

1 3 1=d

X k

XkmYkm ?

1 3 1

? (X m)2 + ? =d (Y m )2 box k k box 1 3 1=d

?

? ?

1 3 1=d

box Xk + box Yk : 2

2

By applying Lemma 2.3 twice, we get

1 0 1 0 X X X Y n + Ko`(S 0 ) c @n + ( 2iki) ? =d A and n + Kos(S 0) c @n + ( 2i) ki? =d A : k;i k;i 2

3

avg

2

3

1 1

Combining these inequalities with Lemma 4.1 gives us

P ? =d X + ?? =d Y k k Kbs` (S 0) c k n + Ko (S ) n + Ko (S ) 1 3 1

box

2

1 3 1

2

box

1

15

avg

1 1

box

P X P Y ! ? k k + ? =d k k ` n + Ko(S ) n + Kos (S ) P X P Y ? ? =d ? =d k k k k + P P Xki Yki n+ n+ 2

1 3 1=d

?

2

1 3 1

c 1 0 CA cB @ k;i i ? =d k;i i ? =d ? ? =d ? =d c ? =d ( ? =d) ? =d n ? =d + ? =d ( ? =d ) ? =d n ? =d ! ? =d ? =d ? =d ? =d ? =d : = O n 1

box

2

box

box

2

1 3 1

2

1 3 1

2

2

box

( avg 2 )1 1

3

1 3 1

1 1 avg

box

2(1 1 3 1

avg

)

1 3 1

box

2 3 1

1 1 3 1

1 1 3 1

This completes the proof. 2

16

( avg 2 )1 1

1 3 1

box

1 1 avg

box

2 3 1

1 1 3 1

box