#### Finding stabbing lines in 3-space

Discrete Comput Geom
Finding Stabbing Lines in 1
-Space 1
M. Pellegrini I 1
P. W. Shor 0 1
0 AT&T Bell Laboratories , 2D-149, 600 Mountain Avenue, Murray Hill, NJ 07974 , USA
1 Courant Institute, New York University , 251 Mercer Street, New York, NY 10012 , USA
A line intersecting all polyhedra in a set ~ is called a "stabber" for the set ~. This paper addresses some combinatorial and algorithmic questions about the set 6a(~) of all lines stabbing ~. We prove that the combinatorial complexity of ~ ( ~ ) has a n 0(n32c ' f ~ ) upper bound, where n is the total number of facets in ~, and c is a suitable constant. This bound is almost tight. Within the same time bound it is possible to determine if a stabbing line exists and to find one. * The research of M. Pellegrini was partially supported by Eni and Enidata within the AXL project, and by NSF Grant CCR-8901484. A preliminary version appeared in the Proceedings of the Second ACM-SIAM Symposium on Discrete Al#orithms, pp. 24-31. Two lines are in the same isotopy class if it is possible to move one into the other without crossing edges of ,~.
1. Introduction
The first algorithm for finding line stabbers for a set ~ of polyhedra in R 3 with
total complexity n, due to Avis and Wenger [ A W l ] , [AW2], has an O(n4 log
n)time bound. M c K e n n a a n d O ' R o u r k e I-MO] improve the time complexity to
O(n*~(n)), where ct(n) is a functional inverse of the Ackerman function. The
algorithm in [ M O ] finds all the isotopy classes 1 of lines generated by the polyhedra
in ~ and it is within an 0t(n) factor from the optimal for that problem. The set
ba(~) of stabbing lines coincides with the union of some of the isotopy classes and
it was conjectured that the complexity of 6e(~) could be less than the complexity
of all the isotopy classes.
Jaromczyk and K o w a l u k [ J K ] claimed an 0(n32 ~(")) upper bound to the
complexity of the set of stabbing lines, but unfortunately there are cases in which
the analysis used in [ J K ] is incorrect (see [P2]).
A line is characterized by four parameters, therefore a natural representation
for a line in R 3 is a point m R 4. The locus of lines intersecting a given line is a
quadric (hyperbolic) surface in R4. Given a set of polyhedra ~ , consider the lines
spanning edges of the polyhedra, and for each such line the corresponding surface
in R4. We obtain an arrangement d ( ~ ) of surfaces in R 4 that divide the space
into cells (McKenna and O'Rourke [ M O ] implicitly construct this arrangement).
Each cell of d ( ~ ) contains points whose stabbed set is invariant within the cell.
The set 6e(~) of all stabbing lines is therefore the union of some cells in the
arrangement. Our aim is to find a worst-case upper bound on the combinatorial
complexity of 6P(~) which is significantly lower than the complexity of the whole
arrangement d ( ~ ) . We consider the lines spanning edges in ~ to be in general
position when no four lines are on the same ruled surface (planes, one sheet
hyperboloids, and hyperbolic paraboloids [B]). For simplicity, we deal mostly
with edges in general position and we give additional arguments to cope with
degeneracies.
The complexity of 6~(~) is bounded by the number of zero-dimensional faces
(vertices) of S~(M). Each vertex represents an extremal stabbin# line. An extremal
stabbing line l is a stabbing line for ~ which falls into one of the following three
categories:
t. I intersects four edges in four distinct polyhedra in ~¢ and is tangent to the
same four polyhedra.
2. 1 intersects one vertex and two edges in three distinct polyhedra in ~ and is
tangent to the same three polyhedra.
3. l meets two vertices in two distinct polyhedra in ~ and is tangent to those
two polyhedra.
For subclasses 2 and 3 an O(na) upper bound is trivially established. In this
paper we concentrate our attention on subclass 1 of extremal stabbing lines.
An f~(n3) lower bound for the complexity of ~ ( ~ ) is shown in [P2] and [P1]
and can also be derived by results in [CEGS]. We prove in this paper an almost
matching O(n32c ~ ) upper bound on the complexity of 6a(M) and on the time to
answer the question of whether a stabbing line exists (stabbing problem). Initially
(Section 3) we consider only triangles to show the analysis in a simplified setting.
The main tools used are the Pliicker coordinates of lines, which are introduced
in Section 2, and the random sampling technique of Clarkson [C]. All randomized
algorithms in this paper can be turned into deterministic algorithms within the
same time bounds using the methods of Matou~ek [Ma2]. The results for
triangles are extended to the general case of convex polyhedra in Section 4.
The query problem (given a line, is it a stabber?) is solved using O(n2÷~)
preprocessing and storage, and O(log n) query time (Section 5). The query
algorithm is used as a subroutine of an algorithm to find a stabbing line which
uses O(na2cl'fi~-~)time (Section 5). The techniques used in [AWl, [MO] and [JK]
are not suitable for solving stabbing queries efficiently nor for dealing with special
cases. Section 6 is an overview of results about special cases of the stabbing
problem.
~ij = xiy~ - x~yi,
/j = 01, 02, 03, 12, 23, 31,
( XO Xt
Yo
Yx
X2
Y2
Y3
.
are called Pliicker coordinates o f the line I (oriented f r o m x to y). T h e y c o r r e s p o n d
to the t w o - b y - t w o m i n o r s of the t w o - b y - f o u r m a t r i x f o r m e d b y the c o o r d i n a t e s
of the p o i n t x (on the first row) a n d y (on the second row):
The six p a r a m e t e r s are not independent; they m u s t satisfy the following
equation (whose solution constitutes the Plficker hypersurface o r Klein q u a d r i c or
G r a s s m a n manifold ~ 4z [St], [ H P ] ) :
Pliicker Coordinates of Lines
Triangles in three-dimensional space are plane figures b o u n d e d by edges. Therefore
we need to be able to represent and m a n i p u l a t e segments a n d lines in R 3 efficiently.
We use a r e p r e s e n t a t i o n for lines called Pliicker coordinates o f the line [So],
[ C E G S ] . T w o points x = (Xo, x t , x2, X3) and y = (Yo, Yl, Y2, Y3) in t h r e e - d i m e n
sional h o m o g e n e o u s c o o r d i n a t e s define a line 1 in 3-space. T h e six quantities 2
The six Pliicker c o o r d i n a t e s represent uniquely an oriented line m o d u l o
multiplication by positive scalars, therefore the six Pliicker c o o r d i n a t e s are
h o m o g e n e o u s c o o r d i n a t e s o f a projective oriented five-dimensional space ~ s .
The incidence relation between two lines l and l' can be expressed using the
Pliicker c o o r d i n a t e s of I a n d 1'. Let a l , bt (resp. a2, b2) be two points on I
(resp. l') oriented the s a m e as l (resp. l'). T h e incidence between I a n d l' is expressed
as the vanishing of the d e t e r m i n a n t o f a four-by-four m a t r i x whose rows are the
coordinates of a l , bl, a2, b2 in this o r d e r f r o m t o p to b o t t o m . 3 We use the n o t a t i o n
D(a, b, c, d) for the d e t e r m i n a n t f o r m e d by the c o o r d i n a t e s of the points a, b, c, d
placed on the rows in this o r d e r f r o m t o p to b o t t o m :
alo
a l l
O(at, bl, a2, b2) de~-~f~12~ b l l
a21
b20 b21
a12
b12
a22
b22
a13 ]
2The indices of the six quantities are chosen so as to obtain only positive signs in the following
formulas.
3The absolute value of this determinant represents the volum~ of the tetrahedron whose vertices
are al, b:, az, and b2, after normalizing the fourth homogeneous coordinate to 1. The sign of the
determinant is positive if the quadrupole of points has the same orientation as the reference frame
chosen in R3. When the volume vanishes the four points are coplanar, therefore the two lines intersect
(or are parallel).
If we e x p a n d the d e t e r m i n a n t according to the t w o - b y - t w o minors of the two
submatrices formed by the first two rows and by the last two rows we obtain the
following equation in which only Pliicker coordinates are involved:
~01~23 nt- ~02~;1 q" ~03~12 hi- ~()1~23 -~" ~)2~31 "{- ~)3~12 ---~O.
(6)
Let us introduce two mappings: n: l ~ rt~ m a p s a line in R 3 to a hyperplane
in projective oriented five-dimensional space ~5, whose plane coordinates are the
Pliicker coordinates of l a p p r o p r i a t e l y reordered, p: l ~ Pt m a p s a line in R a
to a point in ~ 5 whose coordinates are the Pliicker coordinates of the line.
The incidence relation between the two lines I and l' (expressed by equation (6))
can be reformulated as an incidence relation between points and hyperplanes in
¢~5. E q u a t i o n (6) can be rewritten in the form nz(pv) = 0, which is equivalent to
requiring point Pr to belong to hyperplane nl. S t a n d a r d geometric c o m p u t a t i o n s
can be performed in ori6nted projective spaces using techniques due to Stolfi
[St].
2.1.
Characterization of Stabbing Lines Using Pliicker Coordinates
Definition 1. Given the point a and the triangle t in 3-space the cone c¢,,t is the
set of rays from a intersecting t (see Fig. 1),
A set of triangles T and a point a define a family of cones c~..r = {c~,.~lt e T}.
W e say that the family of cones ~ , . r is based on T with apex a. In the following
we restrict o u r attention to stabbing lines intersectin9 a reference plane P and we
assume without loss of generality that the triangles in T are all above P. It is easy
to prove the following lemma:
b
C
,m,y
/ ,/
/
Fig. 1. Cone with apex a based on t.
Lemma 1. There exists a stabbiny line for T intersectino P i f and only i f there is
a point q on P such that (-] ~q, r ~ ~ .
Let cg~.t be the cone based on triangle t = (Pl, P2, P3) and with apex q e P.
Consider the three planes spanned by two vertices of t and of the apex q; the
half-space containing the third vertex of t is called positive. When q belongs to
the plane spanned by t the cone degenerates in a two-dimensional object, but for
simplicity of exposition we ignore degenerate cases. The set of points in the rays
belonging to the cone cgq,t is the intersection of the three positive half-spaces
determined by q and t (see Fig. 1).
We denote by aft(t) the plane spanning t. If aft(t) is parallel to the reference
plane P, then a variable point Q in the cone cg~,t satisfies the following system of
linear inequalities:
D(q, Pl, P2, Q) > O,
D(q, P2, P3, Q) >- O,
D(q, P3, Pl, Q) >- O.
If necessary we relabel the vertices of t to ensure the inequalities all have the
same sign.
If aft(t) is not parallel to P, we consider the position of apex q with respect to
the line It = P c~ aft(0. The cone cg~,, is defined by the two systems of linear
inequalities: system (7) and system (7) with the direction of the inequalities reversed,
depending on the position of q relative to l,.
We need two systems of inequalities because for apexes q on different sides of
It the three positive half-spaces switch with the nonpositive ones (see Fig. 2).
\ r l
f ra
',,," i ,'"
.,,'t..pLi,"
,,-'"
,"" r4
r2
1""
/ '.,! /°'"
/
z
/
.:':2...........
Using the row exchan#e rule of determinants and changing the sign of the
inequalities accordingly we can put all the determinants in system (7) in the form
D(Pl, P2, q, Q), D(p2, P3,q, Q), and D(p3, Pl, q, Q). Then we expand those
determinants according to the two-by-two minors of the submatrices formed by the first
two rows and by the last two rows. We obtain linear expressions in terms of
Pliicker coordinates (see (5) and (6)). Note that the inequalities involve the
Pliicker coordinates of lines supporting edges of triangles in T and the (variable)
line passing through q and Q (see Fig. 3).
The discussion above shows how to characterize stabbing lines intersecting a
reference plane P using Pliicker coordinates. Let us consider three mutually
orthogonal planes P I , P2, P3; every line in R 3 must intersect at least one of them.
A bound on the number of extremal stabbing lines intersecting a given plane
extends immediately to a bound on the number of extremal stabbing lines with
no restrictions.
We are now ready to state the main lemma of this section. Let ~<¢ be the set
of lines on P induced by the set aft(T) of planes spanning triangles in T, and denote
by ./¢ the arrangement generated by ~a on P. Clearly, all points of a region a of
~¢ have the same relative position with respect to the lines in ~ , therefore the
stabbing lines through a satisfy one system of linear inequalities. The solution set
to such a system is the possible empty polytope 4 K , ( T ) in ~5. The following lemma
therefore holds:
Lemma 2. Given a line l such that I c~ P ~ tr, I E 6~(T) =~Pt~ K , ( T).
4 More precisely, we have a polyhedron in 5-space. To avoid confusion between polyhedra in
q-spaceand polyhedra in 5-spacewe use the word polytope in a nonstandard way.
3. A Combinatorial Bound for Triangles
Relaxing the conditions of Lemma 2, we now consider a generic connected region
on P. Let T~ be the subset of triangles in T whose spanning planes do not
intersect a. We have the following lemma:
Lemma 3. For a connected region a on P, let T~ be the set of triangles whose
spanning planes do not intersect a,
l ~ S~(TJ)
=~ p, e K~,(T~).
Given the set of lines £P on P we use Agarwal's technique [Ag] (or
Matou~ek's technique [ M a l ] , [Ma2]) to partition the plane P into a set j[,(&o) of
O(r2) triangles so that no triangle meets more than O(n/r) lines of L~. Let o"be one
of these triangles on P. We partition T into two sets of triangles in 3-space: T~,
whose supporting planes do not cut tr, and T~, whose supporting planes cut ~r.
Furthermore, by the properties of the partition, IT~I < n and IT21 < O(n/r).
Definition 2. Given a set T, a region a, and sets T~ and T 2 as above, A~(i, j, B)
is the set of lines that touch i edges in T~, j edges in T 2, intersect every triangle
in the set B c T, and intersect P in the region ~.
Let N(n) be the maximum number of extremal stabbing lines 5 for a set of n
triangles in #eneralposition. We will show a uniform upper bound on N(n). Suppose
without loss of generality that T, of size n, attains the maximum value N(n). Let
No(n) be the number of extremal stabbing lines for T passing through the region
a. Clearly, the following holds:
(8)
(9)
and
The following lemma allows us to relax the stabbing conditions.
Lemma 4. I f C c B ~_ T, then IA,(i,j, C)I > IA~(i,j, B)I.
Proof The set A,(i, j, ~ ) of lines touching i edges in T~ and j edges in T~ is a
given finite set of lines because of the general position assumption. A line in
A~(i, j, ~ ) that stabs B stabs every subset of B. []
By consideringedgesas relativelyclosedsets,we treat uniformlystabbinglinesof type 1, 2, and 3
accordingto the classificationof Section I.
Note that Lemma 4 is true also for C G B ~ T, but in the proof of Theorem
1 we exploit the fact that B c T.t u T 2 = T, therefore we state the lemma in this
weaker form. Using Lemma 4 we can bound from above each term in (9) using a
suitable subset of T:
N,, < IA,,(4, 0, T.~)I + IA,,(3, t, T~)! + IA.(2, 2. T~)I
+ IA.(1, 3, T)I + IA.(0, 4, T.z)I.
(10)
N o w we bound separately every term in (10):
To be precise,on a two-dimensionalface.
number of extremal stabbing lines for any set of 2n/r triangles is N(2n/r),
Therefore rN(2n/r) is an upper bound for [A~(1, 3, T)[.
5. [A,(0, 4, T~)I counts the number of extremal stabbing lines for the set T~ of
size n/r. Therefore [A,(0, 4, T~)I is bounded from above by N(n/r).
From the above discussion and (8) and (10), we obtain the following recursive
inequality for N(n):
N(n) <_rZ(can2 4- c4na/r 4- csn3/r 2 + rN(cln/r ) 4- N(c2n/r)) ,
where Cl, c2, c3, c4,/25 are constants. Distributing r2:
N(n) < raN(cln/r) + rZN(czn/r) + c3r2n 2 4- c4rn 3 4- csn 3.
(
11
)
(12)
(13)
(14)
N ( k n ) < ( : ) N ( 4 n )
N(n) < cr3N(n/r) + cnZr
f(n) < cf(n/r) + cr.
for any integer k > 4. This holds because we can break the kn triangles into
subsets of size n, and then group these subsets into subsets of size 4n in every
possible way. Each extremal stabbing line of the original set of triangles will
be a stabbing line of at least one of these groups. Using r < n and the above
observation, we obtain from (12) the simpler equation
for some constant c. Now, let N(n) = n3f(n). Substituting in (13) and dividing
by n 3 gives
Lemma 5. N(n) <_clna2~21,/i~ for some constants cl and c2.
Proof. First, we observe that
Now, let r = 2 ~ . We will show that we can choose cl and c2 so that
f(n) <_c~2c~lV~g~. Assume by induction that f(n/r) satisfies this equation. Then
cf(n/r) + cr < CCl2 ~ 2 ~
+ cr
= cc12~2"fiogn-~ + c 2 ~
< cc12¢~,/i-~-c~/2 + c21,/i'~
= cc12-~/22~21,/i~ + c2C21%v~.
This last expression will be less than c12c2",t°/i~gg"if c2 > 1 and cc12 -~2/2 + c <
Cl. This can be ensured with the appropriate choice of ca and c2. Now, if we
choose c 1 and c2 so that the bounds hold for small n, then by induction they
will hold for all n. []
In the case when the set of triangles is not in general position, a standard
perturbation argument shows that the maximum of I~(T)I is attained by a set T
in general position [ C E G ÷, p. 5], I-E].
We summarize the result of this section with the following theorem:
Theorem 1. Given a set T of n triangles in R 3 the complexity of Sa(T) is bounded
by cln32c2",l°/i-~g',where cl and c2 are constants.
4. A Combinatorial Bound for Polyhedra
Section 3 gives an almost cubic upper bound to the number of extremal stabbing
lines of a set of triangles. The proof of a similar result for convex polygons in
R 3 follows by simple modifications of the argument for triangles. The upper
bound for polygons does not give immediately a similar result for polyhedra,
because polygons are just a subclass of all polyhedra. Also, it is not convenient
to reduce directly the problem of finding stabbing lines of polyhedra to the
problem of finding stabbing lines for the faces of those polyhedra. A line
intersecting a polyhedron must intersect one of its faces, therefore a stabbing
line for a set of polyhedra is a stabbing line for a subset of faces, where each
face is drawn from a distinct polyhedron. It is easy to check that there is a
superpolynomial number of sets of faces to consider in the worst case. The
approach we follow in this section is to reconsider the proof for triangles and
adapt it for polyhedra.
Definition 3. Given a convex polyhedron B and a point q disjoint from B, the
cone c~.B is the set of rays from q intersecting B.
A family ~ of polyhedra and a point q define a family of cones cgq,~ =
{~gq,n l B e ~ } . We assume that the reference plane P leaves all polyhedra in
on one side and that q ~ P. It is easy to prove the following lemma:
I.,emma 6. There exists a stabbin9 line for ~ intersectin9 P if and only if there
is a point q on P such that ('] ¢gq,~ ~ ~ .
F r o m a point q external to the polyhedron B only a connected subset of the
faces of B is visible.
Definition 4. Given a polyhedron B and a point q external to B, the silhouette
of B from q is the set of edges of B adjacent to a facet visible from q and to a
facet not visible from q. This set is denoted as sil(q, B).
The set aff(:~) of planes spanning facets of :~ induce a planar arrangement
J¢ on P. We have an equivalent of L e m m a 2 for polyhedra:
Lemma 7. Given a region a ~ Jg, a line l such that l n P e a, and a point q e ~,
the following holds: l e 6e(~) =~ Pl E K~(sil(q, 8)).
Proof For any B s ~ , and each region a E ~ / the silhouette sil(q, B) is the
same for any q e a, We can express the stabbing condition for all lines through
a as the intersection of a set of cones based on the silhouettes as seen from
a and a variable point q ' ~ a . We can express the intersection of this family
of cones by a set of linear inequalities, which define a polytope K~(sil(q, :~))
in ~ 5 D
Given any connected region ¢r on P, let E~ = U ~ ~ p ~ - sil(p, B) be the set
of edges of silhouettes that are c o m m o n for all points q e ~. The equivalent of
Lemma 3 is:
Lemma 8. For a connected region ~ on P and a line l such that I n P ~ a, the
followin9 holds: I t 5a(~) ~ pt e K,(E,).
In order to use the recursive argument in the upper bound proof we need
to be able to reconstruct a set of polyhedra from a set of edges. Given" a
polyhedron B, we consider B as the intersection of positive half-spaces based
on the planes spanning the facets and we pair the half-spaces to form wedges.
Definition 5. Given a polyhedron B and an edge e of B, the wedge w(e, B) is
the intersection of two positive half-spaces defined by planes spanning facets
adjacet to e.
Definition 6. Let B be a polyhedron, let E(B) be the set of edges of B, and let
E' be any subset of E(B). Then
W(E', B)do=f (.] w(e, B).
eEE ~
For the properties of the intersection we have the following lemma:
Lemma 9.
1. W(E(B), B) = B.
2. I f E' ~_ E" ~ E(B), then W(E", B) ~_ W(E', B).
In order to preserve separation properties the polyhedra of the form W(E', B)
are intersected with the region of R 3 above the plane P. For simplicity of
exposition we omit this detail in the rest of the discussion. F r o m L e m m a 9 the
following lemma is easily obtained.
Lemma 10. I f a line l stabs B, then, f o r every E' ~_ E(B), l stabs W(E', B).
and the set Qo of edges of silhouettes that are not common to all points in a:
E.= U n sil(p,B)
Be~ pea
Q . = U U sil(p, B ) - E~.
Begt pe~r
All definitions and lemmas of this section extend to sets of polyhedra. Given
a connected region a of P and a set of polyhedra :~ of total complexity n we
define the set E . of edges of silhouettes common to all points in a:
Now we partition P in r 2 regions such that for each one the set Q. has small
size. Consider the set La of lines induced by aff(9~) on P; we associate to every
line in Sa a weight equal to the number of edges incident to the corresponding
facet of 9~. Clearly, the sum of the weights is equal to the number of facet/edge
incidences, that is O(n),
The partitioning technique I-Ag], I-Mat], [Ma2] allows us to subdivide P into
a set J / ' ( ~ ) of r E triangular regions such that each region is cut by lines of LP
whose total weight is O(n/r).
Consider two points q' and q on P with the same relative position with respect
to all lines in L~ except for one line I e Sa. The silhouettes of a polyhedron from
q and q' differ in the worst case on the edges incident to the facet corresponding
to I. The number of these edges is the weight of l. Therefore the sum of the weights
of lines cutting a is an upper bound to the cardinality of Q.. To summarize, for
every region a of P,
lEvi < O(N),
IQ.I < O(n/r).
A stabber l through a is extremal if it touches four edges of silhouettes in four
different objects in ~ , at least two of which are distinct, and is tangent to them.
We can distribute the four contacts on the sets E a and Q. and define all extremal
stabbing lines through a.
Definition 7. Given a set 9~ of polyhedra in general position, a region a, sets E .
and Q. as above, and a subset E ~_ E(~), A.(i, j, E) is the set of lines that touch i
edges in E., j edges in Q~, intersect every polyhedron in the set W(E,M), and
intersect P in the region a.
We denote by N(n) the maximum number of extremal stabbing lines of type 1,
2, and 3 for a set of convex polybedra with n edges in generalposition. We assume
without loss of generality that our set ~ attains the maximum. By No(n) we denote
the number of extremal stabbing lines for ~ through a. Recalling that ~ =
W(E(~), ~), the following holds:
and
N,,(n) = IA~(4, 0, E(~))I + IA,,(3, 1, E(~))I + IA,,(2, 2, E(~))I
+ IA,~(1, 3, E(~))I + IA,,(0, 4, E(~))I.
(15)
The following lemma allows us to use subsets of the edges of ~ to relax the
stabbing conditions:
Lemma 11. l f E' c E" ~_ E(~), then IA.(i,j,E')[ > IAo(i,j,E")l.
Proof. From Lemma 9, W(E", B) c W(E', B) for every B ~ ~ and from Lemma
10 every line stabbing W(E", B) also stabs W(E', B). []
Using Lemma 11 we bound from above every term in (15) using suitable subsets
of E(~):
No < IA~(4, 0, Eo)I + tA~(3, 1, Eo)l + [A,,(2, 2, E,,)I
+ [A.(1, 3, E(~))I + IAo(0, 4,
Q.)t(16)
We bound separately every term in (16) using observations similar to those in
the proof of Theorem 1:
From the above discussion we obtain the following recursive equation for N(n):
N(n) < r2(n 2 + N(O(n/r)) + n3/r +na/r 2 + rN(O(n/r))),
(17)
which is the same recursion as in Lemma 5. We summarize the main result of
this section with the following theorem:
Theorem 2. Given a set ~ o f polyhedra with total complexity n, the complexity
o f 6"~(~) is bounded by cln32 "~l°/i~g~,where c I and c2 are constants.
5. Finding a Stabbing Line
Lemma 12. Given a set o f n half-spaces in R d, there exists a data structure
which uses O(nLd/2j+~')storage and can be built in O(nLd/2J+~')expected time that in
O(log n) time determines whether any point p e r d belongs to the intersection
o f the half-spaces.
Proof Given n half-spaces, draw a random sample of size r. Compute the
intersection of the sample and triangulate it. Carry on the construction recursively
in each of the simplices over the O(n/r log r) half-spaces intersecting each simplex
[C]. The time and storage needed to compute the set of simplices is proportional
to the number of vertices of the intersection of the sampled half-spaces, which is
O(rLa/2j) by the upper bound theorem. The function Y-(n) which is the maximum
storage and preprocessing time of the recursive data structure satisfies the
following inequality:
J ( n ) <_%O(rLa/ZJ)~--((nlog r)/r) + O(rLa/zj tog r).
(18)
The solution is O(nLd/2J+O. F o r r constant, the query time is O(log2 n). To
improve the query time we set r = nv, and we choose v depending on e in the range
(Ld/2J + e)/(Ld/2J(d + e)) > v > 0. We set up fast point-location data structures
for locating in O(log r) time the simplex containing the query Pliicker point. The
additional data structure is a standard point-location data structure in a set of
hyperplanes which uses O(rLd/2~d÷`))storage. The additional O(nLd/2j+`)term in (18)
does not change the asymptotic bound on ~"(n). The new search tree has constant
depth, therefore a total query time O(log n). Using the techniques in [St] this
results hold also in oriented projective d-space ~ . []
Theorem 3. There exists an algorithm f o r answering line stabbing queries on a set
o f polyhedra in three dimensions with total complexity n, that requires O(n2+~)
expected randomized preprocessing time and space, with O(log n) worst-case query
time.
Proof Consider facets of polyhedra in :~ and give to each of them a weight equal
to the number of edges incident to the facet. We draw a random sample R of the
set of weighted facets, obtaining an induced arrangement AR on the plane P. Each
simplex of the triangulated arrangement a t A(Ag) is intersected by planes
spanning facets whose total weight is O(n/r log r), by results in [C].
F o r each edge e not incident to planes cutting tr, we can decide whether e is
part of the silhouette for all points in tr, by comparing e with a point q e a. The
overhead for silhouettes computation is O(rZn). Let Eo be the set of silhouette
edges common to all points in a. If I is a stabber for ~ and l intersects a, then
Pt ~ Ko(Eo). Therefore, we set up a point-location-in-a-polytope data structure of
Lemma 12 for each region a and each set Eo. We continue recursively the
construction within each simplex in A(AR) for the lines defined by planes in aff(:~)
passing through the simplex. Denoting by ~'(n) the total storage (and
preprocessing time) for the stabbing query data structure, we obtain the following recurrence
equation:
9-(n) = r2~-((n/r) log r) + O(r2n2+~) + O(r2n),
(19)
whose solution is ~'-(n) = O(r2n2+e),for a different, slightly greater, e.
The query algorithm is the following: given the line l, consider the point
q = l r~ P and locate it in a simplex tre z~(AR); then locate the Pliicker point
Pt in the associated Pli.icker polytope K,. If the point Pt is external to K~ the
line l is not a stabber; otherwise, we recurse the query on the data structure
associated with a. The depth of the recursion is at most log, n. We set r = n", and
we choose v depending on e. We add fast planar point-location data structures to
locate the simplex a such that tr c~ l # ~ . The size of the planar point-location data
structure is O(r2). The additional term in (19) does not change the asymptotic
solution. The depth of the tree is constant and we obtain a total O(log n) query
time. We can make sure that the depth of the search tree is constant in the worst
case by requiring that, if a random sample does not have the required property
(which holds with high probability), it is discarded and a new sample is drawn.
With high probability we will not have to resampte often and the asymptotic
expected complexity is increased only by a multiplicative constant (see p. 216 of
[c]). []
Theorem 4. Given a set ~ of polyhedra in general position with total complexity
n, the set o f all extremal stabbing lines can be found in time 0(n32" l'/i~)for a
suitable constant c.
Proof Suppose the set ~ is in general position. The counting argument used in
Sections 3 and 4 to bound the number of extremal stabbing lines can be easily
modified to give an algorithm whose output is a set of lines L that is a superset
of the set of all extremal stabbing lines. All counting arguments in the proof are
based either on recursive steps or on the worst-case complexity of the intersection
of half-spaces. We find actual lines by intersecting the edges of the resulting
polytopes with the Pliicker hypersurface II.
Rewriting (12) for the time needed to compute L it is easy to see that the critical
term is c j n 3, which corresponds to solving convex-hull problems in
four-dimensional space. The optimal convex-hull algorithm of Seidel [El for even dimension
constructs the intersection without any extra factor over the worst-case
combinatorial complexity of the output. The final bound, resulting from solving a recursive
inequality similar to (12), is the same as in Lemma 5.
The superset L of lines computed in the first phase has size O(n32c2I,/i'g~) and can
be found in time 0 ( n 3 2 C 2 ~ ) . Using the stabbing query algorithm of Theorem 3
after O(n2+~) preprocessing we can determine in O(log n) time whether a line in L
is a stabber for ~. The total complexity is O(n2÷~ + cln32 "21"/i~ log n) which is
O(n32c~'/i~) for a constant c > C2. [ ]
The combinatorial bound on Iow(~)l for a set of triangles (polyhedra) in general
position is extended to a set of triangles (polyhedra) not in general position by
using a standard perturbation argument. In order to obtain an algorithm, however,
we have to deal with degeneracies explicitly. The algorithm of Theorem 4 has three
phases. In the first phase a set of Pliicker polytopes is generated. In the second
phase we intersect the Pliicker polytopes with the Pliicker surface II. In the general
case, the intersection of an edge e with II is a finite set of Pliicker points, which
are tested, in the third phase, using the procedure of Theorem 3.
1. A degenerate situation arises when the edge e is fully contained in II. The edge
e is (a portion of) a one-dimensional set F of lines in 3-space. If all the lines in
F are stabbing lines for ~ , then we just include one point of e in the test set
of lines. If not all the lines in F are stabbing lines, but there is at least one
stabber in F, then there exists an extremal stabbing line in F defined by three
of the lines whose Pliicker hyperplanes contain e and a fourth line whose
Pliicker hyperplane does not contain e. This extremal stabbing line is either
an endpoint of e or it is a test line for some of the Pliicker polytopes
produced in the first phase of the algorithm. T o account for this case, we
include the endpoints of e in the test set.
2. We have a second degenerate case when a two-dimensional face f of a
Pliicker polytope is completely contained in II. Then f is (a portion of) a
two-dimensional family of lines A. If all the lines in A are stabbing lines for ~ ,
we include one line of A in our test set. If not all the lines of A are stabbing
lines for ~ , but there is at least one stabber in A, then two of the lines whose
Pliicker hyperplanes contain f and a line whose Plficker hyperplane does
not contain f must define a one-dimensional family of lines F which contains
a stabbing line. F contains some edge e of some Pliicker polytope. This case
is covered by the analysis at 1.
3. A three-dimensional face of a Pliicker polytope cannot be completely
contained in II [So], therefore, there are no other degeneracies to consider.
The above discussion proves the following corollary:
Corollary 1. In time 0(n32c~Cig~)we can determine whether a set o f polyhedra with
n facets has a stabbing line andfind one.
6. Other Results on Line Stabbing and Open Problems
• If we have a set of parallel triangles the number of extremal stabbing lines is
®(n2) and the set of all stabbing lines ~ ( T ) is connected. A stabber can be found
in time O(n) [P2]. For a set of polyhedra of total complexity n whose facets lay
on c different plane directions there exists an algorithm to find a stabbing line in
time O(c2n 2 log n) [P2], [P1].
• Hohmeyer and Teller [ H T ] give an O(n log n) algorithm for finding a
stabbing line of a set of axis-oriented boxes. Recently, Megiddo ~ [Me] and Amenta
7Actually,Megiddo'salgorithmfindsa stabber in linear timefor axis-orientedboxesin any fixed
dimension.
[Am] have found linear-time algorithms, based on linear programming techniques,
for this problem. The problem of finding an algorithm close to linear for c-oriented
polyhedra is still open.
• T h e o r e m 2 gives the best-known upper bound on the number of
components of ,~(~). The best-known lower bound for the number of components is
D,(n2) (see [P2]). The challenge here is to narrow the gap between the two bounds.
• There is an f2(n log n) lower bound on the time needed to find a stabbing
line of a set of polyhedra in 3-space. This bound is obtained by extending a lower
bound tbr finding a stabbing line in a set of segments in R 2 [ARW]. We are still
far from a provably optimal algorithm for the general stabbing problem.
• F o r a set of disjoint polyhedra, it is easy to show an f~(n2) lower bound for
I~(~)l, by exploiting a planar construction in [ES]. It would be interesting to
narrow the gap between the upper and the lower bound for disjoint polyhedra.
Acknowledgments
We wish to thank Micha Sharir for proposing the problem and Richard Pollack,
Boris Aronov, Pankaj K. Agarwal, and Janos Pach for many useful discussions.
Comments from two anonymous referees have been of great help in improving
the style of the paper.
applications. In Proceedings of the 5th ACM Symposium on Computational Geometry,
pages 11 - 22 , 1989 .
Proceedings of the 3rd ACM Symposium on Discrete Algorithms , t991 . [ARW] D. Avis , J. M. Roberts , and R. Wenger . Lower bounds for line stabbing . Information
Processing Letters , 33 : 59 - 62 , 1989 . [AW1] D. Avis and R. Wenger . Algorithms for line transversals in space . In Proceedings of the
3rd Annual Symposium on ComputationalGeometry , pages 300 - 307 , 1987 . lAW2] D. Avis and R. Wenger . Polyhedral line transversals in space . Discrete Computational
Geometry , 3 : 257 - 265 , 1988 .
[B] K. Borsuk. MultidimensionalAnalytic Geometry. Polish Scientific , 1969 . [CEG +] B. Chazelle , H. Edelsbrunner , L. Guibas , M. Sharir , and J. Stolfi . Lines in space: Combina-
torics and applications . Technical Report UIUCDCS-R-90-1569 , Department of Compu-
ter Science , University of Illinois at Urbana-Champaign, February 1990 . [CEGS] B. Chazelle , H. Edelsbrunner , L. Guibas , and M. Sharir . Lines in space: combinatorics,
algorithms and applications . In Proceedingsof the 21st Symposium on Theory of Compu-
tin# , pages 382 - 393 , 1989 .
Computational Geometry , 2 : 195 - 222 , 1987 .
intersecting objects in the plane is 2 n - 2 . Robotics tab 101, Courant Institute , March
Press, Cambridge, 1952 , [HT] M. Hohmeyer and S. Teller . Stabbing isothetic boxes and rectangles in O(n log n) time .
Technical Report 91/634 , University of California, Berkeley, May t99t. [JK] J. W. Jaromczyk and M. Kowaluk . Skewed projections with an application to line
stabbing in R 3 . In Proceedings of the 4th Annual Symposium on Computational Geometry,
pages 362 - 370 , 1988 . [ M a l l J. Matou~ek. Construction of e-nets . In Proceedings o f the 5th A C M Symposium on
Computational Geometry , pages 1 - 10 , t989 . [Ma2] J. Matou ~ek. Cutting hyperplane arrangements . In Proceedings of the 6th A C M Symposi-
um on Computational Geometry , pages 1 - 9 , 1990 . [Me] N. Megiddo . Personal communication, 1991 . [MO] M. McKenna and J. O'Rourke . Arrangements of lines in 3-space: a data structure with
applications. In Proceedings of the 4th Annual Symposium on Computational Geometry,
pages 371 - 380 , 1988 .
[ P I ] M. Pellegrini . Stabbing and ray shooting in 3-dimensional space . In Proceedings o f the 6th
Annual Symposium on Computational Geometry , pages t77 - 187 , 1990 .
[P2] M. Pellegrini . Combinatorial and algorithmic analysis of stabbing and visibility problems
in 3-dimensional space . Ph.D. thesis, Courant Institute of Mathematical Sciences, New
York University, February 1991 .
Press, Cambridge, 1951 .
[St] J. Stolfi . Primitives for computational geometry . Technical Report 36 , Digital SRC , 1989 .