An optimal algorithm for finding segments intersections
Ivan J. Balaban
Keldysh Institute of Applied Mathematics, 125047, Miusskaya Sq. 4, Moscow, Russia.
Abstract
This paper deals with a new deterministic algorithm for
finding intersecting pairs from a given set of N segments
in the plane. The algorithm is asymptotically optimal
and has time and space complexity O(AJ log N+ K) and
0( IV ) respectively, where K is the number of intersect-
ing pairs. The algorithm may be used for finding inter-
sections not only line segments but also curve segments.
INTRODUCTION
Reporting of segments set intersections is one of the
fundamental problem of computational geometry. It
is known., that within the model of algebraic deci-
sion tree any algorithm solving this problem needs
Q(IV log N+l{) time [1, 5, 10]. The well–known Bentley
and Ottman’s algorithm based on the plane sweep has
O((IV + 1{) log IV) time and O(N) space complexity [2].
Later, Chazelle obtained an O(JV logz fV/ log log iV+K),
0( IV + A_) algorithm [4]. Time optimal algorithm
O(IV log IV + Ji) was proposed by Chazelle and Edels-
brunner with space requirement O(lV + K) [5]. Mul-
muley using randomized approach offered an algorithm
with expected running time O(N log IV + K) and space
reqllirement 0( N + K) [9]. Algorithm of Clarkson and
Shor also based on the randomized approach has ex-
pected running time O(N log IV + K) and space require-
ment O(N) [6].
In this paper we present a deterministic, asymptoti-
cally optimal for both time O(IV log N + K) and space
0( IV) algorithm for finding intersecting segments pairs.
As by product, we construct an O(lV log2 IV +K), O(N)
algorithm that could he of practical interest due to its
relative simplicity.
Permission to copy without fee all or part of this material is
granted provided that the copies are not made or distributed for
direct commercial advantage, the ACM copyright notice and the
title of the publication and its date appear, and notice is given
that copying is by permission of the Association of Computing
Machinery.To copy otherwise, or to republish, requires
a fee and/or specific permission.
1Ith Computational Geometry, Vancouver, B.C. Canada
0 1995 ACM 0-89791 -724 -3/95/0006 ...$3.50
----
/
1)
‘e
x
PRELIMINARIES
Suppose we have a set So conszstzng of N segments
in the plane. The problem M to find all mtersectmg
patrs. The set of these patrs we denote as Int(So ) and
lInt(So)l we denote as Ii.
To find Tnt ( So ) we use a collection of vertical strips
on the plane organized in a tree structure, connect each
of the strips with some subset of So and introduce pro-
cedures for finding intersections of such subsets. These
procedures require appropriate ordering of the subsets.
To obtain this ordering we use a method analogous to
plane sweep but instead of sweeping the plane by a ver-
tical line we use preorder traversal of the strips tree ( i.e
sweeping the tree by its branch).
So, the primary objects of our algorithm are seg-
ments, ordered and unordered sets of segments, pairs
of intersecting segments and vertical strips,
Let (b, e) denote the verttcal strzp b ~ x s e and let
1 and r be abscissae of endpoints of segment s (1 < r),
We call the segment s
● spannzng the strtp (b, e) if 1 ~ b < e ~ r,
● znner for the strap (b, e) if b < 1 < r < e,
● crosstng the strip (b, e) if [1, r[rl[b, e[# 0.
Two segments SI and SZ are called mtersectzng wtthtn
the strzp (b, e) if their intersection point lies within this
strip.
For two segments sets S and S’ we denote by
Int(S, S’) a set {{s, s’}[s E S, s’ G S’ and s inter-
sect s’}. Notations ~ntb,.(,$) and ~ntb,,(sj S’) will be
211