i
i
i
i
i
i
i
i
766 16. Intersection Test Methods
context of ray tracing. Also, they called the volume between two oppositely
oriented normals on parallel planes a bounding slab and used these to keep
the intersection cost down (see Section 16.7.1). This technique is used for
the k-DOPs for the same reason. As a result the intersection test consists
of only k/2 interval overlap tests. Klosowski et al. [672] have shown that,
for moderate values of k, the overlap test for two k-DOPs is an order of a
magnitude faster than the test for two OBBs. In Figure 16.4 on page 730,
a simple two-dimensional k-DOP is depicted. Note that the AABB is a
special case of a 6-DOP where the normals are the positive and negative
main axis directions. Also note that as k increases, the BV increasingly
resembles the convex hull, which is the tightest-fitting convex BV.
The intersection test that follows is simple and extremely fast, inexact
but conservative. If two k-DOPs, A and B (superscripted with indices A
and B), are to be tested for intersection, then test all pairs of slabs (S
A
i
,S
B
i
)
for overlap; s
i
= S
A
i
∩S
B
i
is a one-dimensional interval overlap test, which is
solved with ease.
14
If at any time s
i
= ∅ (i.e., the empty set), then the BVs
are disjoint and the test is terminated. Otherwise, the slab overlap tests
continues. If and only if all s
i
= ∅,1≤ i ≤ k/2, then the BVs are considered
to be overlapping. According to the separating axis test (see Section 16.2),
one also needs to test an axis parallel to the cross product of one edge from
each k-DOP. However, these tests are often omitted because they cost more
than they give back in performance. Therefore, if the test below returns
that the k-DOPs overlap, then they might actually be disjoint. Here is the
pseudocode for the k-DOP/k-DOP overlap test:
kDOP intersect(d
A,min
1
,...,d
A,min
k/2
,
d
A,max
1
,...,d
A,max
k/2
,d
B,min
1
,...,d
B,min
k/2
,
d
B,max
1
,...,d
B,max
k/2
)
returns({OVERLAP, DISJOINT});
1: for each i ∈{1,...,k/2}
2: if(d
B,min
i
>d
A,max
i
or d
A,min
i
>d
B,max
i
)
3: return (DISJOINT);
4: return (OVERLAP);
Note that only k scalar values need to be stored with each instance of
the k-DOP (the normals, n
i
, are stored once for all k-DOPs since they
are static). If the k-DOPs are translated by t
A
and t
B
, respectively, the
test gets a tiny bit more complicated. Project t
A
onto the normals, n
i
,
e.g., p
A
i
= t
A
·n
i
(note that this is independent of any k-DOP in particular
14
This is indeed an example of dimension reduction as the rules of thumb recom-
mended. Here, a three-dimensional slab test is simplified into a one-dimensional interval
overlap test.