An Exact Algorithm for Finding Minimum Oriented Bounding Boxes
Jukka Jyl
¨
anki
2015/06/01
Figure 1: Fast computation of the minimum volume OBB of a convex polyhedron. Left to right: Dragon: 2731149 vertices (2531 on the hull)
in 1.3 seconds; Lucy: 14026670 vertices (5262 on the hull) in 5.6 seconds; a bear: 3105537 vertices (6628 on the hull) in 7.3 seconds.
An optimized C++ implementation of the algorithm can be found here, or try it live on a web page here.
Abstract
A new method is presented for computing tight-fitting enclosing
bounding boxes for point sets in three dimensions. The algorithm
is based on enumerating all box orientations that are uniquely de-
termined by combinations of edges in the convex hull of the in-
put point set. By using a graph search technique over the vertex
graph of the hull, the iteration can be done quickly in expected
O(n
3/2
(log n)
2
) time for input point sets that have a uniform dis-
tribution of directions on their convex hull. Under very specific
conditions, the algorithm runs in worst case O(n
3
log n) complex-
ity. Surprisingly, empirical evidence shows that this process always
yields the globally minimum bounding box by volume, which leads
to a conjecture that this method is in fact optimal.
CR Categories: F.2.2 [Analysis of Algorithms and Problem Com-
plexity]: Nonnumerical Algorithms and Problems—Geometrical
Problems and Computations; I.3.5 [Computer Graphics]: Compu-
tational Geometry and Object Modeling—Geometric Algorithms;
Object representations
Keywords: computational geometry, bounding box, OBB
1 Introduction
Given a three-dimensional set of points, a fundamental problem in
computational geometry is to find the smallest possible oriented
bounding box (OBB) that contains all the points in the input data
set. This problem arises widely in applications in computer graph-
ics [Schneider and Eberly 2002], physical simulations [Ericson
2004] and spatial data structures [Gottschalk et al. 1996], as well as
other areas, such as computer-aided design [Chan 2003] and even
e-mail:jujjyl@gmail.com
in medicine [Bartz et al. 2005]. Common uses in computer graphics
include approximating a complex shape with a simpler OBB for the
purposes of faster broad phase intersection testing, or for perform-
ing culling of renderable objects that need to be sent to the GPU.
OBBs have several desirable properties that make them useful for a
variety of scenarios. They are convex and consist of three pairs
of parallel planes, called slabs. In their local coordinate frame,
they are representable as axis-aligned bounding boxes (AABB) or if
scaled, as the unit cube. As such, intersection and distance tests be-
tween OBBs and other shapes can be implemented efficiently [Kay
and Kajiya 1986] [Schneider and Eberly 2002, pp. 394, 624, 639].
OBBs also provide generally tighter fits than the simpler bound-
ing spheres or AABBs. However, unlike spheres and AABBs, for
which minimum volume enclosing shapes can be found in linear
time [Megiddo 1982] [Welzl 1991], the major shortcoming with
OBBs to date has been the difficulty of computing minimum vol-
ume OBB representations due to a lack of effective algorithms for
the task.
In this paper, new analysis and progress is presented to help solve
the minimum volume OBB problem. A new algorithm is intro-
duced, which has considerable practical merit:
1. Exact: The algorithm runs through a discrete process without
use of numerical optimization or iteration over the continuum.
As a result, the method is stable and predictable.
2. Simple: Unlike previously published results, the new method
is relatively easy to implement and it is possible to program
it in different variants to balance a tradeoff between desired
implementation complexity versus runtime complexity.
3. Fast: Both the time complexity and the constant time factors
in the algorithm are low, which make it a practically viable
solution.
4. Enumerative: The new algorithm is implementable as read-
only sequential traversal over sets of edges, so it is catego-
rizable as embarrassingly parallel and therefore suitable for
processing large data sets as well.
5. Optimal? Based on extensive numerical searches over both
synthetic and real world test cases, no example has yet sur-
faced where the new algorithm would not have found the op-
timal minimum volume box. However, at this point, no formal
proof of the optimality of this algorithm is known.
The next section of this paper will first introduce the relevant earlier
research. In sections 3 and 4, the main problem will then be grad-
ually unwound in a bottom-up manner by presenting mathematical
analysis of each of the individual subproblems one at a time. These
results will all be brought together in the main algorithm finally in
section 5. Last, sections 6 and 7 conclude with experimental results
and practical remarks.
2 Related Work
In the past, only few papers have been published with theoretical
advances on the minimum volume OBB problem. In the 2D case,
it is known that the minimum area rectangle enclosing a convex
polygon must be flush with one of the polygon edges [Freeman
and Shapira 1975]. The rotating calipers method [Toussaint
1983] is a linear time algorithm that builds on this characterization.
For the 3D case, the only currently known property is the following:
Theorem 2.1. A box of minimal volume circumscribing a convex
polyhedron must have at least two adjacent faces flush with edges
of the polyhedron. [O’Rourke 1985]
The term of being flush with an edge here means that a face of
the box contains every point of that edge. Based on this prop-
erty, O’Rourke developed a O(n
3
) time algorithm which performs
a type of rotating calipers search for each pair of edges on the hull.
However, their method involves solving roots of a sixth degree
trigonometric polynomial numerically, and in addition the com-
plexity is so high that the method is often considered impracti-
cal. Unfortunately it also looks like this work has later become
misinterpreted in literature in several published books, which in
turn has led to misinformation in online sources [GameDev.Net ],
[StackOverflow ], [Troutman ]. To illustrate and clear up the con-
fusion, consider the following quotes:
O’Rourke (1985) shows that one box face must contain a
polyhedron face and another box face must contain a polyhe-
dron edge or three box faces must each contain a polyhedron
edge.”” [Schneider and Eberly 2002, p. 806]
[...] given a polyhedron either one face and one edge or
three edges of the polyhedron will be on different faces of its
bounding box. [Ericson 2004, p.107]
The paper [O’R85] shows that the minimum-volume OBB
for a convex polyhedron must (1) have a face that is coincident
with a face of the polyhedron or (2) be supported by three mu-
tually perpendicular edges of the polyhedron. [Eberly 2006,
p. 624] (see also [Geometric Tools LLC ])
The first quote is possibly correct, however this does not follow
from theorem 2.1 or the treatise in [O’Rourke 1985]. In fact, if it
did, then it would directly prove the optimality of the new algorithm
presented in this paper. The second claim on the other hand is not
correct. Note the very subtle difference between the first two quotes
that makes them different. It is possible that two adjacent faces of
a box are flush with the same edge of a polyhedron, in the special
case that this polyhedron edge coincides with an edge of the box.
This counterexample will be called category D, and it will be pre-
sented in more detail later in section 5. See also figure 2. Finally,
the third statement is likewise a misinterpretation of O’Rourke, and
mathematically incorrect. The correct analysis will be presented in
section 3.5.
Given that the problem has resisted attempts of solving for several
decades, developers have sought to utilize a variety of numerical
and statistical optimization methods to find suboptimal but good
enough approximations for practical use. A basic method is to use
principal component analysis (PCA) to estimate the direction of
largest spread in the point set and establish that as a cardinal di-
rection for the OBB. This process must be done using a continuous
set representation on the convex hull, or otherwise the approxima-
tion can be unboundedly bad [Dimitrov et al. 2009]. For obtaining
near-optimal results, there exists a (1 + )-approximation scheme
[Barequet and Har-Peled 2001], whereas for a completely oppo-
site line of approach one can embrace a carefully defined heuristic
to trade optimality for speed [Larsson and K
¨
allberg 2011]. There
have also been attempts at providing optimal results by using so-
phisticated numerical techniques, such as particle swarm optimiza-
tion [Borckmans and Absil 2010] and genetic search [Chang et al.
2011]. These have been proven to be effective, but they have an
element of randomness in them and may not find the optimal box
in all cases.
The only brute force approach so far has been the exhaustive search
of all orientations over SO(3, R). This space is large, but there is a
commonly known trick to prune it that seems to be folklore. Given
a candidate orientation for the OBB, a better fit can be searched in-
crementally by repeatedly projecting the model onto a plane corre-
sponding to one of the main axes of the current candidate OBB and
solving the resulting 2D problem in linear time using Toussaint’s ro-
tating calipers method. This reduces the brute force challenge from
SO(3, R) to a search of a good starting direction vector in the unit
(hemi)sphere, which, when iterated in this manner, would ”lock”
into the orientation of the optimal OBB. However the fundamental
problem is still that the search is conducted over a continuous space
and therefore it is not exhaustible by sampling a discrete set of ori-
entations. Because of this, a brute force search over orientation
angles is not able to guarantee an optimal result.
In summary, all known methods so far use either approximation,
numerics or heuristics, which is unsatisfying. There is a clear need
to develop a fast and exact geometric algorithm to solve the prob-
lem, which will be the main motivation in the following sections.
3 Mathematical Aspects
In order to work through the details, some notation and concepts
need to be first introduced. Recall that the internal points of the
input set do not play a role in the problem and one can restrict to
considering only the convex hull of the point set. In fact, for the
new algorithm, computing the convex hull is the required first step,
since the algorithm is built to operate on the edges of a convex poly-
hedron. The convex hull can be computed in expected O(n log n)
time for example by using the quickhull algorithm [Barber et al.
1996].
For each direction vector n, one or more vertices of the polyhe-
dron can be identified as the most extreme points to the direction
of n. These are called supporting vertices, and will be denoted by
Supp(n). If for two vertices v
1
and v
2
there exists a direction n
such that v
1
Supp(n) and v
2
Supp(n), then v
1
and v
2
are
said to be antipodal. Geometrically described, two vertices are an-
tipodal if it is possible to find an orientation for an enclosing OBB
such that the two vertices of the hull lie on opposing faces of the
OBB.
In this paper, a new concept is introduced that is in some ways sim-
ilar to antipodality. If for two vertices v
1
and v
2
there exists two di-
rections n
1
and n
2
such that v
1
Supp(n
1
) and v
2
Supp(n
2
)
and n
1
· n
2
= 0, then v
1
and v
2
are said to be sidepodal. The geo-
metric meaning of this is that two vertices are said to be sidepodal
if it is possible to find an orientation for an enclosing OBB where
the OBB touches both vertices v
1
and v
2
on two adjacent faces of
the OBB.
The concepts of support, antipodality and sidepodality are naturally
extended to also refer to edges (and faces) of the hull. For example,
one may refer to an edge e being sidepodal to a vertex v, if it is
possible to orient an OBB to be flush with e and v on two adjacent
faces of the OBB.
If x is a vertex or an edge of the hull, then the set of all antipodal
vertices in the hull to x will be denoted by Anti
V
(x) and the set of
all antipodal edges in the hull to x will be denoted by Anti
E
(x).
Likewise, the sets Side
V
(x) and Side
E
(x) will refer to the sets of
all sidepodal vertices and respectively edges to x. Also, it will be
necessary to examine set intersections of these sidepodal sets, so as
a notational aid, Side
V
(e
1
, e
2
) will be used as a shorthand to refer
to the set intersection Side
V
(e
1
) Side
V
(e
2
). It is immediately
clear that if edge e : v
0
v
1
is an antipodal or a sidepodal edge to
a feature x, then both vertices v
0
and v
1
of e immediately have the
same property. More precisely:
If e Anti
E
(x), then {v
0
, v
1
} Anti
V
(x),
if e Side
E
(x), then {v
0
, v
1
} Side
V
(x), and
if e Side
E
(x
1
, x
2
), then {v
0
, v
1
} Side
V
(x
1
, x
2
).
This may seem trivial, but it is worth explicitly noting since this
makes traversing sidepodal and antipodal edges effectively identi-
cal to traversing the sets of vertices. Note that for the sidepodality
relation, the opposite is not true, i.e. even if two neighboring ver-
tices are sidepodal to a feature x, it does not necessarily follow that
the edge connecting them would be sidepodal to x as well.
The notation N(v) will be used to refer to the set of vertex
neighbors of vertex v. Given an edge e, the angle measured from
inside of the hull between the two adjacent faces connected to e is
commonly called the dihedral angle of edge e. Because the hull
is convex, all dihedral angles are in the range of ]0, 180[ degrees.
Finally, the face normals of the two adjacent faces to e pointing
outwards of the hull will be denoted by f
<
(e) and f
>
(e). These
normal vectors define the following simple property that will be
useful later.
Lemma 3.1. If a face of an OBB is flush with an edge e of the
convex hull, then the (unnormalized) normal vector n of that face
of the OBB is equal to n = f
<
(e) +
f
>
(e) f
<
(e)
t for some
t [0, 1].
Proof. This formula for the normal follows directly from linear in-
terpolation. The value of t = 0 corresponds to the case when the
OBB is flush with the face with normal f
<
(e), and the value of
t = 1 corresponds to the OBB being flush with the face with the
normal f
>
(e). Since the dihedral angle of the edge is never 0, the
linear interpolation will not produce a degenerate zero vector.
While it would be possible to choose a parametrization based on
angle, or another that would preserve the magnitude of the normal
vector, either would greatly complicate later analysis, which is why
this presentation is preferred instead.
There exists an interesting geometric way to relate sidepodality of
a vertex and an edge to the support function.
Lemma 3.2. Given a vertex v and an edge e on a convex polyhe-
dron, the vertex v Side
V
(e) if and only if there exists a direction
vector n for which v Supp(n) and
n ·f
<
(e)

n ·f
>
(e)
0.
Proof. By lemma 3.1, the normal vector n
2
of the face of an OBB
that is flush with an edge e has the parametrization n
2
= f
<
(e) +
f
>
(e)f
<
(e)
t. The vertex v is sidepodal to edge e if and only
if there exists a direction n such that v Supp(n) and n ·n
2
= 0.
Substituting the formula of the normal gives the equation
n ·
f
<
(e) +
f
>
(e) f
<
(e)
t
= 0, where t [0, 1] . (1)
The left-hand side is an expression linear to t, so its extremes are
at t = 0 and t = 1, and they correspond to values n · f
<
(e) and
n ·f
>
(e). Therefore according to Bolzano’s theorem, equation (1)
has a solution if and only if one of these values is nonnegative and
the other is nonpositive. In other words, either
1. n · f
<
(e) 0 and n ·f
>
(e) 0, or
2. n · f
<
(e) 0 and n ·f
>
(e) 0.
Then, in either case multiplying the two expressions together yields
the desired result.
Antipodality and sidepodality both form symmetric nontransitive
relations for vertices and edges of the hull. The new algorithm will
be based on computationally resolving these relations on the vertex
graph of the convex hull. Therefore the rest of this section will fo-
cus on the mathematical study of these properties which will enable
the development of suitable algorithms to enumerate these sets.
3.1 Antipodal Edge and Vertex
Given an edge e and a vertex v of a convex polyhedron, it is possible
to formulate a precise test whether e and v are antipodal partners to
each other. This involves finding a common normal vector n for
which e Supp(n) and v Supp(n), or concluding that such
a vector does not exist. The first condition is fulfilled if and only if
the direction n satisfies the parametrization of lemma 3.1, whereas
the second condition is met if and only if all vertex neighbors w of
vertex v are in the negative halfspace of the plane defined by v and
n. This gives the following set of conditions:
(
n = f
<
(e) +
f
>
(e) f
<
(e)
t , where t [0, 1] ,
(v w) · n 0 w N(v) .
The set of equations defined on the second line generates a set of
intervals, one for each neighbor in N (v), that the parameter t must
lie in for the solution to be valid. When codified, it turns into a test
of whether the range intervals have a non-degenerate overlap. This
procedure is shown in algorithm 1.
Algorithm 1: AreAntipodal(v,e)
let t
= 0
let t
+
= 1.0
for w N(v) do
let p = f
<
(e) · (w v)
let q =
f
<
(e) f
>
(e)
· (w v)
if q > 0 then
t
+
= Min(t
+
, p/q)
else if q < 0 then
t
= Max(t
, p/q)
else if p < 0 then
return false
return t
t
+
3.2 Antipodal Pair of Edges
Testing whether given two edges e
1
and e
2
of a convex polyhedron
are antipodal is also straightforward. Geometrically reasoning, it
is immediate that if an OBB is flush with two edges e
1
and e
2
on
opposite faces of the box, then the normal vector n
1
of one of these
faces is perpendicular to both e
1
and e
2
, and therefore the direction
of n
1
is given by the cross product of the two edge vectors. That is,
n
1
= c e
1
× e
2
for some constant c. This direction is uniquely
defined, and to see whether the configuration is physically valid,
it remains only to test whether a box laid out in this orientation
intersects the inside of the polyhedron. A special case occurs when
e
1
is parallel to e
2
, in which case the cross product is degenerate
and the box is free to ”hinge” around in contact with the two edges.
Testing whether intersection occurs can be achieved by using the
parametrization for the normal vectors of the two edges from lemma
3.1, which yields the following group of equations:
n
1
= f
<
(e
1
) +
f
>
(e
1
) f
<
(e
1
)
t , where t [0, 1] ,
n
2
= f
<
(e
2
) +
f
>
(e
2
) f
<
(e
2
)
u , where u [0, 1] ,
n
1
= cn
2
, where c < 0 .
This leads to a matrix equation of form M x = f
<
(e
1
), where
x =
t c cu
T
and M is represented as column vectors in
the form
M =
f
<
(e
1
) f
>
(e
1
) f
<
(e
2
) f
>
(e
2
) f
<
(e
2
)
(2)
From here, the valid values for t and u are solved easily by generic
3x3 matrix techniques, and they directly define one of the face nor-
mal directions for the OBB. This method is presented in algorithm
2, which tests whether two edges are antipodal, and if so, returns
the normal direction for the face of the OBB that is flush with edge
e
1
.
Algorithm 2: AntipodalDir(e
1
, e
2
)
compute M according to equation (2)
let (t, c, cu)
T
= M
1
f
<
(e
1
)
if c < 0 and t [0, 1] and u [0, 1] then
let n = f
<
(e
1
) +
f
>
(e
1
) f
<
(e
1
)
t
return n/||n||
else
return null
3.3 Sidepodal Pair of Edges
In a similar fashion, it can be analysed whether a pair of edges are
sidepodal partners to each other. If two edges e
1
and e
2
are sidepo-
dal, then the normal vectors defined on the two edges by lemma 3.1
must be perpendicular, which gives the following set of equations:
n
1
= f
<
(e
1
) +
f
>
(e
1
) f
<
(e
1
)
t , where t [0, 1] ,
n
2
= f
<
(e
2
) +
f
>
(e
2
) f
<
(e
2
)
u , where u [0, 1] ,
n
1
· n
2
= 0 .
Solving this set of equations leads to a new equation of the form
a + bt + cu + dtu = 0, where t, u [0, 1] , (3)
where a, b, c and d are all scalar constants. Since the left-hand side
is a bilinear, closed and continuous expression of the parameters t
and u, it attains its minimum and maximum values at one of the four
extreme points of its domain, i.e. one of the four corners of the unit
square. This leads to a quick test that samples all these four corner
points of potential extrema and checks the signs of the result. If the
signs are different, then again due to Bolzano’s theorem, a solution
must exist to equation 3. A programmatic way to test this is shown
in algorithm 3.
Algorithm 3: AreSidepodal(e
1
, e
2
)
let a = f
>
(e
1
) · f
>
(e
2
)
let b =
f
<
(e
1
) f
>
(e
1
)
· f
>
(e
2
)
let c =
f
<
(e
2
) f
>
(e
2
)
· f
>
(e
1
)
let d =
f
<
(e
1
) f
>
(e
1
)
·
f
<
(e
2
) f
>
(e
2
)
let v
= Min(a, a + b, a + c, a + b + c + d)
let v
+
= Max(a, a + b, a + c, a + b + c + d)
return v
0 and v
+
0
3.4 Sidepodal Edge and Vertex
If a vertex v is located sidepodal to an edge, then lemma 3.2 says
that there must exist a normal n that satisfies the following condi-
tions.
(
n · f
<
(e)

n · f
>
(e)
0 ,
v Supp(n) .
The first inequality holds if and only if one of the factors is non-
negative, and the other is nonpositive, and the second one holds if
and only if for each vertex neighbor w N(v) , n · (w v) 0.
Therefore the normal vector n satisfies either
n · f
<
(e) 0 ,
n · f
>
(e) 0 ,
n · (w v) 0 w N(v) ,
(4)
or
n · f
<
(e) 0 ,
n · f
>
(e) 0 ,
n · (w v) 0 w N(v) .
(5)
The existence of a solution can be checked by proceeding with a
Gaussian elimination type of approach, performing elementary row
operations to reduce the inequalities to a pivoted form. However
when doing this, two rows may only be added together when they
have directions for their inequalities match, so the final pivotized
form of conditions in (4) and (5) will both form a set of 3 to 6
inequalities. If neither of these sets of inequalities form a contra-
diction by forcing n to a zero vector, then the vertex v and edge e
are sidepodal.
There is also another way to determine if v Side
V
(e). This is
based on the geometric observation that if a vertex is sidepodal to
an edge, then starting from a box configuration that is flush with v
and e on adjacent faces, it is always possible to spin the box around
the normal of the box face that is flush with e until the face of the
box that is flush with v meets with a second vertex w N(v).
This property can be stated in the following form.
Proposition 3.3. Given a vertex v and an edge e of a convex poly-
hedron, v Side
V
(e) if and only if there exists a vertex w N (v)
such that (e
2
: v w) Side
E
(e).
Exploiting this property seemed to be more convenient in practice
rather than solving inequalities (4) and (5), however it is good to
know that both options exist.
3.5 Basis from Three Edges
Fixing an OBB to be flush with only two edges on adjacent faces of
the OBB does not yet uniquely define its orientation, but still leaves
one degree of freedom. This can be seen clearly for example in the
earlier analysis by [O’Rourke 1985]. The question then arises, if
one is given three edges e
1
, e
2
and e
3
of a polyhedron, is it possible
to orient an OBB to be flush with these edges, so that each of them
lies on separate, but mutually adjacent faces of the OBB, and if
so, what should the orientation (face normals n
1
, n
2
and n
3
) of the
OBB be? A hasty analysis might conclude that edges e
i
would be
in fact identical to normals n
i
, and that there would be no solution
if e
i
were not mutually perpendicular. However this
is not correct. Alternatively, one might think that the normals n
i
are computable from edges e
i
by some kind of sequence of cross
products, but this is not true either.
To provide the correct analysis, one proceeds with setting up a
group of equations like shown in previous sections. The three edges
are all mutually sidepodal, which yields the following:
n
1
= f
<
(e
1
) +
f
>
(e
1
) f
<
(e
1
)
t , t [0, 1] ,
n
2
= f
<
(e
2
) +
f
>
(e
2
) f
<
(e
2
)
u , u [0, 1] ,
n
3
= f
<
(e
3
) +
f
>
(e
3
) f
<
(e
3
)
v , v [0, 1] ,
n
1
· n
2
= 0 ,
n
2
· n
3
= 0 ,
n
1
· n
3
= 0 .
(6)
Solving this is more complicated than before, but still doable. The
first three conditions of equation set (6) may be renamed to the form
n
1
= a + bt , where t [0, 1] ,
n
2
= c + du , where u [0, 1] ,
n
3
= e + fv , where v [0, 1] ,
(7)
for obvious substitutions of vector constants a, b, c, d, e and f. Ex-
panding the three dot product conditions of equation set (6) with
variables from equations (7) then yields
a · c + b ·ct + u(a · d + b · dt) = 0 , (8)
c · e + c ·f v + u(d · e + d · fv) = 0 , (9)
a · e + a ·f v + t(b · e + b · fv) = 0 . (10)
Multiplying equation (8) by (d · e + d ·f v) and equation (9) by
(a · d + b ·dt) and adding the resulting equations together gives
g + hv + t(i + jv) = 0 , (11)
where
g := (a ·c)(d · e) (a · d)(c · e) ,
h := (a · c)(d · f) (a · d)(c · f ) ,
i := (b · c)(d · e) (b · d)(c · e) ,
j := (b · c)(d · f) (b · d)(c · f) ,
(12)
and then multiplying equation (10) by (i + jv) and equation (11)
by (b ·e + b ·fv) and adding the resulting equations together yields
kv
2
+ lv + m = 0 , (13)
where
k := h(b · f) j(a · f) ,
l := h(b · e) + g(b · f)
i(a · f) j(a · e) ,
m := g(b · e) i(a · e) .
(14)
From here on, the two possible values for the parameter v can be
readily solved by applying a standard formula for roots of a second
degree polynomial to equation (13), and the values for t and u can
then be backtracked by using equations (9) and (10). If the second
degree polynomial in equation (13) has no real roots or if the pa-
rameters t, u or v are not in [0, 1] range, then an orientation does not
exist. As a special note, it is important to test that the final solution
for t, u and v satisfies the original set of equations (6) again, since
equations (8) and (9) imply (11) only one way. That is, a solution
to equation (11) might not be a solution to equations (9) and (10).
Similarly, the equations (10) and (11) only imply (13) one way as
well.
In conclusion, this derivation provides an exact test for determin-
ing whether given three edges of the convex hull can accommodate
an OBB orientation where the three edges are all on mutually adja-
cent faces of the OBB, and if so, provides the possible coordinate
frames (n
1
, n
2
, n
3
) for the orientation. Algorithm 4 shows a pro-
grammatic example. Note that this function will return a set of zero
to two solutions. The main algorithm will then loop over each of
these solutions in turn and process each one as a separate candidate
configuration.
Algorithm 4: ComputeBasis(e
1
, e
2
, e
3
)
compute a - m from equations (7), (12) and (14).
if polynomial kv
2
+ lv + m has no roots then
return {}
let v
1
, v
2
be the roots of kv
2
+ lv + m
let O =
for v {v
1
, v
2
} do
let t = (g + hv)/(i + jv)
let u = (c · e + c · fv)/(d ·e + d · fv)
let n
1
= a + bt
let n
2
= c + du
let n
3
= e + fv
if t, u, v [0, 1] and n
1
n
2
and n
1
n
3
and n
2
n
3
then
O = O
(n
1
/||n
1
||, n
2
/||n
2
||, n
3
/||n
3
||)
return O
3.6 Basis from a Direction and an Edg e
The last subroutine that will be needed is the following. Let n
1
be a predetermined normal direction for one of the faces of the
OBB. Then, given an edge e, is it possible to complete the remain-
ing orientation of the OBB (compute n
2
and n
3
) such that edge e
is flush with a face of the resulting OBB? The task is to identify
if this is possible, and if so, complete n
1
to an orthonormal basis
(n
1
, n
2
, n
3
) where, say, n
2
is perpendicular to e. Note that like in
the case of the three edges from the previous chapter, the correct
answer is not the cross product n
2
:= n
1
× e, since if e is parallel
to n
1
, the cross product will come out zero. Instead, lemma 3.1 can
be used again, which gives the following two conditions.
(
n
2
= f
<
(e) +
f
>
(e) f
<
(e)
u , where u [0, 1] ,
n
1
· n
2
= 0 .
Combining these two gives
n
1
· f
<
(e) + n
1
·
f
>
(e) f
<
(e)
u = 0 ,
from where the solution is
u =
n
1
· f
<
(e)
/
n
1
· (f
<
(e) f
>
(e))
when the denominator is not zero, and when it is, any value of u
will satisfy the equation if and only if n
1
· f
<
(e) = 0 as well. The
Algorithm 5: CompleteBasis(n
1
, e)
let p = n
1
· f
<
(e)
let q = n
1
·
f
<
(e) f
>
(e)
if q 6= 0 then
let u = p/q
let n
2
= f
<
(e) +
f
>
(e) f
<
(e)
u
n
2
= n
2
/||n
2
||
let n
3
= n
1
× n
2
return
(n
1
, n
2
, n
3
)
else if p = 0 then
let n
2
= f
<
(e)
let n
3
= n
1
× n
2
return
(n
1
, n
2
, n
3
)
else
return
remaining face normal n
3
is then solvable via a cross product. This
process is shown in algorithm 5.
The equations and algorithms that were presented in this section
provide the tools for identifying antipodal and sidepodal compan-
ions for edges, and allows construction of candidate orientations
for an enclosing OBB once a set of candidate edges have been cho-
sen. The enumeration of these edges will follow a graph search
approach, but in order to make it feasible, these sets must first be
analyzed in some spatial detail. The next section will focus on that
task, which will then enable building a search strategy for the algo-
rithm overall.
4 Analysis of Antipodal and Sidepodal Sets
For each convex polyhedron C, one can define the Gaussian
sphere representation of C, denoted by G(C). This representation
is a type of a dual representation of C, formed by a decomposition
of the unit sphere into disjoint regions, one for each vertex of C.
A point n in the Gaussian sphere belongs to the region of vertex v
of C if v Supp(n). This has the effect that vertices of C are
mapped to faces of G(C), and faces of C are mapped to single ver-
tices on G(C). An edge e on C is mapped to an arc on a great
circle of G(C) that is perpendicular in direction to e. Each face f
on G(C) is convex, because if v Supp(n
1
) and v Supp(n
2
),
then v Supp
tn
1
+ (1 t)n
2
as well for t [0, 1].
Using the Gaussian sphere representation, the following can be
said.
Theorem 4.1. Given an edge e of C, the set Anti
V
(e) forms a
single connected component in the vertex neighbor graph of C.
Proof. The viable normal directions n for an OBB flush with an
edge e are explicitly parametrized by lemma 3.1, thus
Anti
V
(e) =
n
Supp
f
<
(e)
f
>
(e)f
<
(e)
t
: t [0, 1]
o
.
On the Gaussian sphere G(C), this corresponds to a closed and con-
tinuous arc. Since this arc forms a single connected subset of points
on the Gaussian sphere, the set of vertices on C whose convex face
regions on G(C) the arc overlaps with is also connected.
Thinking about the set Anti
V
(e) being defined by an arc on the
Gaussian sphere is also very useful for another reason. The length
of the arc is directly defined by the dihedral angle of edge e, and
the closer the angle is to 180 degrees, the smaller the arc becomes,
meaning also that the smaller the set Anti
V
(e) corresponding to
edge e will be in general.
Likewise, the sets Side
V
(e) and Side
E
(e) have the same property.
Theorem 4.2. Given an edge e of C, the sets Side
V
(e) and
Side
E
(e) both form a single connected component in the vertex
neighbor graph of C.
Proof. By lemma 3.2, the set of antipodal vertices to edge e is de-
fined in terms of the support function in the form
Side
V
(e) =
n
Supp(n) :
f
<
(e) · n

f
>
(e) · n
0
o
.
The set of normal vectors satisfying this inequality condition for n
forms a single closed and connected subset of G(C), so therefore
the set of vertices on C whose convex face regions on G(C) this
subset corresponds with is also connected. Adding the geometric
observation from proposition 3.3, it follows that the set Side
E
(e) is
also connected.
The reason that connectedness for these sets is important is that with
this property, if one first obtains any element v
0
in, say, Anti
V
(e),
then the rest of the elements in that set can be enumerated quickly
in O
|Anti
V
(e)|
time by performing a graph search starting from
the neighborhood of v
0
, which will be much faster than having to
resort to a full O
|V |
search over all vertices of the convex polyhe-
dron. However, this property is only true if the number of neighbors
for each vertex of the polyhedron is bounded by a constant. This
condition will be implicitly assumed in all the analysis that follows,
but one should keep this technicality in mind.
Finally, a similar result exists for the structure of set intersections
of pairs of sidepodal vertex sets.
Theorem 4.3. Given two edges e
1
and e
2
of C, the set
Side
V
(e
1
, e
2
) forms at most two separate connected components
in the vertex neighbor graph of C.
Proof. Expanding on the proof of lemma 3.2, the boundary of
Side
V
(e
1
) is defined by two equations f
<
(e
1
) · n = 0 and
f
>
(e
1
) · n = 0. These conditions map out two great circles on the
Gaussian sphere. Since the same holds for Side
V
(e
2
), the boundary
of Side
V
(e
1
, e
2
) is defined by an intersection of two pairs of great
circles. Given that the intersection of two circles can have two dis-
tinct solutions, the boundary of Side
V
(e
1
, e
2
) can be split into two
separate regions, both of which are themselves connected.
For the set Side
V
(e
1
, e
2
) it is therefore necessary to find, or ”boot-
strap” to two separate elements on the opposing sides of the Gaus-
sian sphere and perform a graph search from both starting points in
order to ensure that the whole set Side
V
(e
1
, e
2
) gets enumerated in
full.
This bootstrapping process is fortunately simple. Each of the sets
Anti
V
(e), Side
V
(e) and Side
V
(e
1
, e
2
) are defined by one or two
support vector directions, so the task of bootstrapping is the same
as to find an extreme vertex of the hull. That can be done in linear
time by iterating over the whole of V , but that is not very interest-
ing. A more advanced method is to utilize a Dobkin-Kirkpatrick
hierarchy to enable finding supporting vertices in O(log n) time
[Dobkin and Kirkpatrick 1990]. Therefore the total time complex-
ity to enumerate these sets is
Anti
V
(e): O
log n + |Anti
V
(e)|
.
Side
V
(e): O
log n + |Side
V
(e)|
.
Side
V
(e
1
, e
2
): O
log n + |Side
V
(e
1
, e
2
)|
.
Unfortunately it seems to be too difficult to give strict limits for
the sizes of antipodal and sidepodal sets in the general case. In
the following sections, the sizes of these sets are analyzed in two
special cases that are the most interesting.
4.1 Analysis of Sphere(n)
Consider a set of n distinct points taken uniformly random on the
surface of the unit sphere and denote by Sphere(n) the convex hull
of that set. Clearly Sphere(n) consists of the n vertices itself. As
n grows, the shape of Sphere(n) grows to resemble the unit sphere.
This set has two particularly important properties. The first is that
the dihedral angle of each edge e in Sphere(n) tends towards 180
degrees. This is another way of saying that the ”sharp” edges of
Sphere(n) all disappear. The second property is that the number of
vertices on each face of Sphere(n) is bounded by a constant. In fact,
each face is defined by exactly three vertices with probability 1.
In this scenario, the areas of the convex regions in the Gaussian
sphere corresponding to each vertex in Sphere(n) tend to zero size.
Therefore any region R of the Gaussian sphere corresponds to a
number of vertices of Sphere(n) that is linearly proportional to
the surface area of R in Sphere(n). In particular, this means the
following.
Theorem 4.4. With probability 1, on the set Sphere(n), for each
edge e, the size of antipodal vertices |Anti
V
(e)| O(1).
Proof. As n grows, the dihedral angle of e tends to 180 degrees. In
other words, f
<
(e) tends towards f
>
(e) and hence the arc traced
by n = f
<
(e)
f
>
(e) f
<
(e)
t degenerates towards a
single point, which has zero surface area.
A similar property exists for sidepodal edges.
Theorem 4.5. With probability 1, on the set Sphere(n), for each
edge e, the size of sidepodal vertices |Side
V
(e)| O(
n).
Proof. Since f
<
(e) tends towards f
>
(e), the two boundary circles
that define support directions for Side
V
(e) tend to a single overlap-
ping great circle on the Gaussian sphere. The length of circumfer-
ence of this great circle is 2πr, whereas the total surface area of the
sphere is 4πr
2
. Relating areas to vertices, n u 4πr
2
, so therefore
n u 2πr, or |Side
V
(e)| O(
n).
And finally,
Theorem 4.6. With probability 1, on the set Sphere(n), for
each pair of edges e
1
and e
2
, the size of sidepodal vertices
|Side
V
(e
1
, e
2
)| O(1).
Proof. Continuing from proof of 4.5, the support directions for
Side
V
(e
1
, e
2
) is the intersection formed by two great circles. When
e
1
6= e
2
, the great circles are distinct and the intersection has ex-
actly two solutions that are points. Like in the case of proof of
4.4, points have zero area, and hence Side
V
(e
1
, e
2
) O(1) as
well.
Putting these three results together looks like the following.
Theorem 4.7. On the set Sphere(n), given an edge e or a pair of
edges e
1
, e
2
, the total time taken to enumerate
Anti
V
(e) is O(log n) + O(1) = O(log n).
Side
V
(e) is O(log n) + O(
n) = O(
n).
Side
V
(e
1
, e
2
) is O(log n) + O(1) = O(log n).
Proof. The total time to iterate over these sets is proportional to the
time taken to bootstrap to the first vertex, plus the size of the set
itself.
This result concludes the analysis in positive light that in a suitably
uniform scenario, the sizes of antipodal and sidepodal sets are con-
siderably smaller and faster to enumerate than linear time. In the
next section, the same analysis is done without the assumption of
uniformity in place.
4.2 A Singularity in Cylinder(n)
If the requirement of uniform distribution from the case of
Sphere(n) is lifted, do the properties of theorem 4.7 still hold in
the general case? Unfortunately not always, and it is possible to
construct a scenario where the sizes of these sets are linear. Curi-
ously, the only currently found case occurs when the input data set
is a cylinder, which is defined by
Cylinder(n) :=
n
cos
2πi
n
, ±1, sin
2πi
n
: i = 1, 2, . . . , n
o
.
This set represents a cylindrical shape with n points on both end
caps. An examination of this set shows that each edge e that is part
of the cylinder end caps of the convex hull of Cylinder(n) has a
linear number of vertices on average in each of the sets Anti
V
(e),
Side
V
(e) and Side
V
(e
1
, e
2
). Therefore enumerating over these
sets is no faster than just enumerating over all vertices of the hull.
Examining the Gaussian sphere of this shape gives a clue to why
this happens. One problem stems from the fact that the end faces
of the cylinder lie on parallel planes, and have both n Ω(n)
vertices. For the Gaussian sphere, this means that there are two
vertices corresponding to those faces exactly at the opposite poles
of the Gaussian sphere, and they both have n Ω(n) incident
edges connecting them. The existence of such a ”singularity”
point that connects a linear number of vertices forces the size of
Anti
V
(e) to be linear for each edge on the cylinder end caps. If the
number of vertices on each face of the convex hull was bounded by
a constant, this would not happen. However, even if imposing such
a restriction, the sizes of the sets Side
V
(e) and Side
V
(e
1
, e
2
) will
still remain linear, so this restriction does not completely capture
the worst case behavior. Therefore, at least in for Cylinder(n), the
following appears to be the case.
Proposition 4.8. In the worst case,
|Anti
V
(e)|, |Side
V
(e)| and |Side
V
(e
1
, e
2
)| Ω(n) .
It remains an open question whether it is possible to characterize
the conditions when this occurs in a more precise manner to under-
stand this behavior better. So far this worst case behavior has only
been observed on shapes that are very cylindrical, and even a small
deviation from this generally causes the issue to vanish.
5 The New Algorithm
With the help of the mathematical analysis in sections 3 and 4, it is
now possible to present the main algorithm. The overall strategy is
straightforward: instead of performing a brute force search over all
potential orientation directions in the sphere, the plan is to enumer-
ate all OBB orientations that are uniquely fixed by combinations of