Canadian Conference on Computational Geometry 9780773591134

The 8th Canadian conference on computational geometry had an international flavour. Sixty-one papers were submitted by a

156 89 27MB

English Pages [355] Year 1996

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Canadian Conference on Computational Geometry
 9780773591134

Table of contents :
Cover
Title
Copyright
Table of Contents
Preface
Robust proximity queries in implicit Voronoi diagrams
O-Convexity: Computing hulls, approximations, and orientation sets
Efficient algorithms for counting and reporting pairwise intersections between convex polygons
Convex hulls of bounded curvature
Enclosing k points in the smallest axis parallel rectangle
Finding the set of all minimal nested convex polygons
Optimizing a corridor between two polygons with an application to polyhedral interpolation
Heuristics for the generation of random polygons
Orthogonal polygon reconstruction
Correcting topological defects of tessellations
Generating rooted triangulations with minimum degree four
On stable line segments in triangulations
Diamonds are not a minimum weight triangulation's best friend
Stabbing information of a simple polygon
K-transversals of parallel convex sets
Fast stabbing of boxes in high dimensions
Shooter location problem
Computational geometry for interrogative visualization
An optimal algorithm for dynamic post-office problem in R² and related problems
A topology-oriented algorithm for the Voronoi diagram of polygons
On non-smooth convex distance functions
Time-optimal proximity graph computations on enhanced meshes
Deforming curves in the plane for tethered-robot motion planning
Heuristic motion planning with movable obstacles
Viewing a set of spheres while moving on a linear flightpath
Approximating shortest paths in arrangments of lines
Velocity planning for a robot moving along the shortest straight line path among moving obstacles
Lower bounds for computing geometric spanners and approximate shortest paths
On the reachable regions of chains
Heuristic motion planning with many degrees of freedom
C omputing largest circles separating two sets of segments
On the permutations generated by rotational sweeps of planar point sets
Maximal length common non-intersecting paths
Maintaining multiple levels of detail in the overlay of hierarchical subdivisions
Distance-based subdivision for translational LP containment
Variable resolution terrain surfaces
Generalizing halfspaces
Efficient algorithms for guarding or illuminating the surface of a polyhedral terrain
The surveillance of the walls of an art gallery
On rectangle visibility graphs. III. External visibility and complexity
Maintaining visibility of a polygon with a moving point of view
Visibility graph of a set of line sements: A dynamic sequential algorithm and its parallel version
Dynamic algorithms for approximate neighbor searching
Three-dimensional restricted-orientation convexity
Efficient algorithms for the smallest enclosing cylinder problem
On the O(n4/3) weak lower bounds for some 3D geometric problems
Computational geometry impact potential: A business and industrial perspective
Probalistic algorithms for efficient grasping and fixturing
On a problem of immobilizing polygons
Finding an o(n²log n) algorithm is sometimes hard
Improved orthogonal drawings of 3-graphs
Algorithms on polygonal embeddings of graphs
Optimal orthogonal drawings of connected plane graphs
Straight line embeddings of planar graphs on point sets
Extending rectangular range reporting with query sensitive analysis
The complexity of rivers in triangulated terrains
Computing the angularity tolerance
The complexity of illuminating polygons by a-flood-lights
Author Index

Citation preview

INTERNATIONAL INFORMATICS SERIES 5 EDITORS- IN-CHIEF Evangelos Kranakis School of Computing Science Carleton University Ottawa, ON KIS 586

Nicola Santoro School of Computing Science Carleton University Ottawa, ON KIS 586

CONSULTING EDITORS Frank Dehne School of Computing Science Carleton University Ottawa, ON KIS 586

Danny Krizanc School of Computing Science Carleton University Ottawa, ON KIS 586

Jorg-RUdiger Sack School of Computing Science Carleton University Ottawa, ON KIS 586

Jorge Urrutia Department of Computing Science University of Ottawa Ottawa, ON KIN 984

SERIES EDITOR John Flood Carleton University Press Carleton University Ottawa, ON KIS 5B6

i'-: - •.

','. ',,'

,

.....

.

.

'. ; \ :

:.',

.

.

. ; ~

Frank Fiala, Evangelos Kranakis, and Jorg-Riidiger Sack (Eds.)

CANADIAN CONFERENCE ON COMPUTATIONAL GEOMETRY CCCG '96

Proceedings of the 8th Canadian Conference on Computational Geometry, Carleton University, Ottawa, Canada, August 12-15, 1996

CARLETON UNIVERSITY PRESS

+

Copyright © Carleton University Press, 1996

Canadian Cataloguing in Publication Data Canadian Conference on Computational Geometry (8th: 1996: Carleton University) Proceedings of the Eighth Canadian Conference on Computational Geometry (International Informatics Series; 5) Conference held August 12-15,1996, at Carleton University. ISBN 0-88629-307-3 1. Geometry-Data processing-Congresses. I. Fiala, Frank, 1935 - II. Kranakis, Evangelos III. Sack, Jorg-RUdiger, 1954- IV. Title. V. Series. QA 440.C351996 516'.00285 C96-900596-2

Published by Carleton University Press. The publisher would like to thank the Vice-President (Academic), the Associate VicePresident (Research), the Dean of Science and the School of Computer Sciences at Carleton University for their contributions to the development of the Carleton Informatics Series. Carleton University Press would also like to thank the Canada Council, the Ontario Arts Council, the Government of Canada through the Department of Canadian Heritage and the Government of Ontario through the Ministry of Culture, Tourism and Recreation, for their assistance. Printed and bound in Canada

Table of Contents Preface

xi

Monday, August 12 Session M1 Invited Lecture by Roberto Tamassia Robust proximity queries in implicit Voronoi diagrams R. Tamassia, G. Liotta, and F. P. Preparata Session M2 O-Convexity: Computing hulls, approximations, and orientation sets V. Martynchik, N. Metelski, and D. Wood Efficient algorithms for counting and reporting pairwise intersections between convex polygons P. Gupta, R. Janardan, and M.l Smid

1

2

8

Convex hulls of bounded curvature J.-D. Boissonnat and S. Lazard

14

Enclosing k points in the smallest axis parallel rectangle M. Segal and K. Kedem

20

Session M3 Finding the set of all minimal nested convex polygons J. Bhadury and R. Chandrasekaran

26

Optimizing a corridor between two polygons with an application to polyhedral interpolation G. Barequet and B. Wolfers

32

Heuristics for the generation of random polygons T. Auer and M. Held

38

Orthogonal polygon reconstruction L. Jackson and S.K. Wismath

44

Session M4 Correcting topological defects of tessellations D. Wang and J. A. Goldak Generating rooted triangulations with minimum degree four D. Avis and C. M. Kong

50

56

On stable line segments in triangulations A. Mirzaian, C. A. Wang, and Y.-F. Xu

62

Diamonds are not a minimum weight triangulation's best friend P. Bose, L. Devroye, and W. Evans

68

Session M5 Stabbing information of a simple polygon H. Everett, F. Hurtado, and M. Noy

74

K-transversals of parallel convex sets N. Amenta

80

Fast stabbing of boxes in high dimensions F. Nielsen

87

Shooter location problem S. C. Nandy, K. Mukhopadhyaya, and Bhargab B. Bhattacharya

93

Tuesday, August 13 Session Tul Invited Lecture by C. Bajaj Computational geometry for interrogative visualization C. Bajaj Session Tu2 An optimal algorithm for dynamic post-office problem in R~ and related problems S. N. Bespamyatnikh A topology oriented algorithm for the Voronoi diagram of polygons T. Imai On non-smooth convex distance functions N.-M. Le

99

101

107 113

Time-optimal proximity graph computations on enhanced meshes 119 S. Olariu, I. Stojmenovic, and A. Y. Zomaya Session Tu3 Deforming curves in the plane for tethered-robot motion planning 125 S. Hert and V. Lumelsky

Heuristic motion planning with movable obstacles T. Chadzelek, J. Eckstein, and E. Schomer

131

Viewing a set of spheres while moving on a linear flight path

137

F. Follert Approximating shortest paths in arrangments of lines P. Bose, W. Evans, D. Kirkpatrick, M. McAllister, and J. Snoeyink Session Tu4 Velocity planning for a robot moving along the shortest straight line path among moving obstacles

143

149

K. Krithivasan, A. Rema, S. Schirra, and P.I. Vijaykumar Lower bounds for computing geometric spanners and approximate shortest paths

155

D. Z. Chen, G. Das, and M. Smid On the reachable regions of chains N. Pei and S. Whitesides

161

Heuristic motion planning with many degrees of freedom T. Chadzelek, J. Eckstein, and E. Schomer

167

Session Tu5 Computing largest circles separating two sets of segments J.-D. Boissonnat, J. Czyzowicz, O. Devillers, J. Urrutia, and M. Yvinec On the permutations generated by rotational sweeps of planar point sets

173

179

H. Bieri and P.-M. Schmidt Maximal length common non-intersecting paths J. Czyzowicz, E. Kranakis, D. Krizanc, and J. Urrutia

185

Wednesday, August 14 Session Wl Maintaining multiple levels of detail in the overlay of hierarchical subdivisions

190

P. Magillo and L. Floriani Distance-based subdivision for translational LP containment

K. Daniels and V. J. Milenkovic

196

Variable resolution terrain surfaces E. Puppo

202

Session W2 Generalizing halfspaces E. Fink and D. Wood

211

Efficient algorithms for guarding or illuminating the surface of a polyhedral terrain P. Bose, D.Kirkpatrick, and Z. Li

217

The surveillance of the walls of an art gallery A. Laurentini Session W3 On rectangle visibility graphs. III. External visibility and complexity T. C. Shermer Maintaining visibility of a polygon with a moving point of view D. Z. Chen and O. Daescu Visibility graph of a set of line sements: A dynamic sequential algorithm and its parallel version Y. Atassi Dynamic algorithms for approximate neighbor searching S. N. Bespamyatnikh Session W4 Three-dimensional restricted-orientation convexity E. Fink and D. Wood Efficient algorithms for the smallest enclosing cylinder problem E. Schomer, J. Sellen, M. Teichmann, and C. Yap On the O(n4/3) weak lower bounds for some 3D geometric problems B. Zhu Thursday, August 15 Session Thl Invited Lecture by P. Raghavan

223

234

240

246

252

258

264

270

Computational geometry impact potential: A business and industrial perspective P. Raghavan

276

Session Th2 Probalistic algorithms for efficient grasping and fixturing M. Teichmann

277

On a problem of immobilizing polygons J. Czyzowicz, I. Stojmenovic, and T. Szymacha

283

Finding an oC n2 log n) algorithm is sometimes hard A. Hernandez Barrera

289

Improved orthogonal drawings of 3-graphs T. Biedl

295

Session Th3 Algorithms on polygonal embeddings of graphs L. Cai

300

Optimal orthogonal drawings of connected plane graphs T. Biedl

306

Straight line embeddings of planar graphs on point sets N. Castaneda and J. Urrutia

312

Extending rectangular range reporting with query sensitive analysis R. Y. Flatland and C. V. Stewart Session Th4 The complexity of rivers in triangulated terrains M. de Berg, P. Bose, K. Dobrint, M. van Kreveld, M. Overmars, M. de Groot, T. Roos, J. Snoeyink, and S. Yu

319

325

Computing the angularity tolerance M. de Berg, H. Meijer, M. Overmars, and G. Wilfong

331

The complexity of illuminating polygons by a-flood-lights J. Bagga, L. Gewali, and D. Glasser

337

Author Index

343

Preface The Eighth Canadian Conference on Computational Geometry, CCCG'96, took place at Carleton University, Ottawa, Canada on August 12-15, 1996. The goal of the conference is to bring together researchers in computational geometry from around the world, to present a forum for the presentation of new ideas, and to promote collaboration. The conference had a real international flavor. There were 61 papers submitted by authors from over 20 countries, representing 4 continents. The program committee selected 55 papers for presentation; over 100 authors or co-authors are represented. In addition, 3 invited lectures were presented by Roberto Tamassia, Chandrajit L. Bajaj, and Prabhakar Raghavan and a problem session was organized. The proceedings contain extended abstracts of all contributed papers and abstracts of the invited lectures. The conference was organized by the School of Computer Science at Carleton University. The organizers thank all who submitted papers to the conference, the invited speakers, the members of the program committee and those who attended. Frank Fiala, Evangelos Kranakis, and Jorg-Riidiger Sack

Ottawa, August 1996

Program Committee Jurek Czyzowicz Frank Fiala Evangelos Kranakis Ani! Maheshwari David Rappaport Jorg-Riidiger Sack Jorge Urrutia Organizing Committee Frank Fiala (Carleton) Barbara Coleman (Carleton) Rosemary Carter (Carleton)

Universite du Quebec a Hull Carleton University (Conference Chair) Carleton University (Program Co-chair) TIFR & Carleton University Queen's University Carleton University (Program Co-chair) University of Ottawa Sponsored by Carleton University

Robust Proximity Queries in Implicit Voronoi Diagrams Roberto Tamassia Center for Geometric Computing Department of Computer Science, Brown University 115 Waterman Street, Providence, RI 02912-1910, USA [email protected]

Abstract In the context of methodologies intended to confer robustness to geometric algorithms, we elaborate on the exact computation paradigm and formalize the notion of degree of a geometric algorithm, as a worstcase quantification of the precision (number of bits) to which arithmetic calculation have to be executed in order to guarantee topological correctness. We also propose a formalism for the expeditious evaluation of algorithmic degree. As an application of this paradigm and an illustration of our general approach, we consider .the important classical problem of proximity queries in 2 and 3 dimensions, and develop a new technique for the efficient and robust execution of such queries based on an implicit representation of Voronoi diagrams. Our new technique gives both low degree and fast query time, and for 2D queries is optimal with respect to both cost measures of the paradigm, asymptotic number of operations and arithmetic degree. This lecture presents joint work with Giuseppe Liotta and Franco P. Preparata. This research was supported in part by the U.S. Army Research Office under grant DAAH04-96-1-0013. References http://wwv.cs.brown.edu/people/rt/papers/robust-proximity.html

V-Convexity: Computing Hulls, Approximations, and Orientation Sets1

v. Martynchik

2

N. Metelski 2

D. Wood3

April 8, 1996

Abstract We continue the investigation of computational aspects of restricted-orientation convexity (O-convexity) in two dimensions. We introduce one notion of an O-halfplane, for a set 0 of orientations, and we investigate O-connected convexity. The O-connected convex hull of a finite set X can be computed in time O( I X I log I X I + I D. The V-connected hull is a basis for determining the V-convex hull of a finite set X and a finite set of orientations in time O(IXliOllog IXI). We also consider two new problems. First, we give an algorithm to determine a. minimum-area O-connected convex outer approximation of an O-polygon with n vertices when the number r of O-halfplanes forming the approximation is given. The approximation can be determined in time O(n 2 r+ 101). Second, we give an algorithm to find the largest orientation set for a simple polygon. This problem can be solved in time O(nlogn), where n is the number of vertices of the polygon. For each of these complexity bounds we assume that 0 is sorted.

°

1

°

Introduction

Let 0 be a set of unit vectors (orientations) in'R,2. A line (segment, ray) in the plane is called an O-line (O-segment, O-ray) if its orientation vector is collinear to a vector of O. Giiting [3] introduced, essentially, the notion of an O-oriented polygon; tha.t is, a polygon whose edges are O-segments. A planar point set X is O-convex if the intersection of X with any O-line is empty or connected. The O-convex hull of a planar set is defined to be the smallest O-convex set that contains the set. Rawlins [6] initiated the study of O-convexity, Schuierer [11] examined the relationship of O-convexity and O-visibility. Investigation of these notions in higher dimensions has recently been initiated by Fink and Wood [1, 2] and Metelski [4]. Following Rawlins and Wood [6,8, 10], we also refer to O-convexity as restricted-orientation convexity. This natural generalization (or relaxation) of standard convexity arose in computational geometry in the eighties, initially for two axial orientations in the plane (isothetic convexity or ortho-convexity). It has applications to problems of VLSI layout synthesis, database design, computational morphology, image processing, and stock cutting. The problem of determining the ortho-convex hull of ortho-polygons was the first computational problem in O-convexity. Consult Wood's review [12] for more details and references. Rawlins and Wood [6, 7] showed that the four kinds of O-convex hull of an O-oriented polygon can be determined in optimal (linear) time. It should be noted that there are substantial difficulties in developing algorithms for computing the O-convex hulls of disconnected sets. For example, Rawlin's decomposition theorem [6, 9] that 1 This work was supported under grants from the Natural Sciences and Engineering Research Council of Canada, the Information Technology Research Centre of Ontario, and the Research Grant Committee of Hong Kong. 2Institute of Ma.thema.tics, Belarussian Academy of Sciences, Surganova. str. 11, Minsk, 220072, Belarus. E-mail: imanb%imanb.belpak.minsk.byGdemos.su. 3Department of Computer Science, Hong Kong University of Science & Technology, Clear Water Bay, Kowloon, Hong Kong. E-mail: dvoodOcs.ust.hk: •

2

leads to a natural approach to compute the V-convex hull of a connected planar set, for finite V, is not valid for disconnected sets. The O-convex hull of a disconnected planar ortho-region and a finite point set have been determined for only two orientations [5, 12]. In these cases, halfplaneconvexity, a re~triction of ortho-convexity, plays a key role in the construction of the boundaries of the connected components of the O-convex hull. To compute the V-convex hull of a finite planar point set X, for any finite V, we introduce, in Section 2, an analog of haJfplane-convexity (we call it O-connected convexity) and we give an algorithm to construct the O-connected convex hull of X in O(IXllog IXI + 101) time and in O(IXI + 1(1) spa.ce. An algorithm to compute the O-convex hull of a set is given in Section 3. It runs in O(IXIiOllog IXI) time and uses O(IXIIOI) space. In Section 4, we consider the construction of an outer approximation of a finite planar set X with an O-connected convex polygon 0 A(X) that is further restricted. It turns out that the approximation problem can be effectively reduced to a polynomial-time solvable network optimization problem. In all previous work, it is assumed that an orientation set is given and that computational properties of O-convex sets are studied. In Section 5, we consider an "inverse" problem; namely, determine the set Ore X) of all vectors v such that each v-line has a connected intersection with X. The notion of Or(X) leads to measures of the convexity of point sets which may find applications in shape analysis and image processing. An O(nlogn)-time algorithm to compute Or(P) of a polygon P with n vertices is also sketched.

2

O-Connected convexity

We begin with the following important notion [7]. Definition 1 For a planar set X, the convex O-hull of X is the smallest convex O-oriented polygon that contains X. H X is an O-oriented polygon with n vertices, then the convex O-hull of (X) can be found in 9(n+ 101) optimal time [1]. Starting from the convex hull of X and exploiting notions of 0oriented supporting lines, antipodal points, and Coxeter's star structure, we obtain the following result; see Fig. 1. Theorem 1 Let X be a finite planar point set and 0 be a sorted finite-orientation set. Then, the convex O-hull of X can be determined in O(IXllog IXI + 1(1) time and in O(lXI + 1(1) space, Convex cones pla.y an important role in the definition of an analog of haJfplane-convexity. Recall that a set C is a. convex cone if, for all vectors x, y E C and for all nonnegative real numbers .x and J-L, we have .xx + p,y E C. A convex cone C is pointed if whenever we have x E C and -x E C, then x = o. The conic hull of a planar set is the smallest convex cone that contains the set. Since every 0' such that 0 S; 0' ~ 0 U -0 defines the same class of restricted-orientation convex sets, we can assume that 0 is a symmetric vector set; that is, we have V = 0 U -0. Let cl(X) denote the topological closure of a set X. Definition 2 A cone is an O-cone if it is the conic hull of some subset of O. Let a be a point in the plane and C be a maximal pointed O-cone; then, the set cl('R,2 \ (a +C» is an O-halfplane at the point a; seeFig. 2. Definition 3 The intersection of all O-halfplanes that contain a planar set is called the O-connected hull of the set. A set is O-connected convex if it equals its O-connected hull. Theorem 2 Let 0 be a finite orientation set. Then, all O-connected convex sets are O-convex. Conversely, all closed connected O-convex sets are O-connected convex. Theorem 3 For a sorted finite orientation set 0 and a finite set X, the O-connected hull of X can be computed in O( IXIIog IXI + 1(1) time and in O( IXI + 1(1) space.

3

3

The O-convex hull of a finite point set

From Theorem 2 it follows that, for closed connected sets, the O-convex hull of X coincides with the O-connected hull of X. As we have remarked, the disconnected case is more complex. Having O-connected convexity as the appropriate generalization of ortho-orientation halfplane-convexity at our disposal, we are able to extend the approach of Ottmann et ale [5] to arbitrary finite 0 and X. Our algorithm also has the following two steps:

Step 1: Determine maximum subsets of the given set X (clusters) that generate connected components of the O-convex hull of X; see Fig. 3. Step 2: Construct the boundaries of the components by computing the O-connected hulls of the clusters. Theorem 4 For sorted finite () and X, the O-convex hull of X can be computed in O(IXIiOllog I XI) time and in O(IXIIOI) space.

4

O-connected convex approximations

A number of algorithms in the fields of VLSI synthesis and cutting-stock problems are based on outer approximations that simplify the geometric shapes of objects. In the case of finite 0, the class of all O-convex sets is too vast and contains rather unusual sets. In this context, O-connected convex sets, which are formed by intersections of O-halfplanes, appear to be more regular and more suitable for approximation. When the intersection of a finite planar set of 0- halfplanes is a polygon, the polygon is clearly an O-connected convex O-oriented polygon. We caJl it an ibp-polygon. The following proposition, which results from Definitions 2 and 3, makes clear the structure of fhp-polygons.

Theorem 5 Let P be a Jhp-polygon that is not classically convu; then, there are maximal pointed O-cones C1 , ••• , Cr such that P is the set-theoretic difference of the convex O-hull of P and the interior of the cones; see Fig. .4. The minimal number of the cones C1 , ••• , Cr , for the fb.p-polygon P, is called its rank. The rank of a classically convex polygon is defined to be zero. We consider the rank of an fhp-polygon to be a measure of its shape convexity. Approximation problem: Given an O-oriented polygon P and a positive integer r, determine a minimum-area fhp-polygon OC A(P, r) that contains P and has rank at most r.

Theorem 6 The approximation problem can be reduced to the problem of searching for a path of maximal total weight, with at most r arcs, in a weighted acyclic digraph. For an O-oriented polygon P with n vertices, OCA(P,r) can be computed in O(n2 r+ 101) time and in O(nr+ 101) space.

5

Computing the cone of convex orientations of a polygon

Definition 4 Let X be a planar set and Or(X) be the set of all unit planar vectors v that have a connected intersection with X. The set K(X) = {AV I v E Or(X) and A 2: O} is the cone of convex orientations of X. Let P be a simple polygon. A chain (Vt,V2),(V2,V3), ••• ,(Vk,Vk+l), k 2: 2 of edges of P is concave if the inner angles of the vertices V2, V3, •• " Vk are of more than 1r radians.

Theorem 7 Suppose that C hl' C h2' ... , C h" is the set of all maximal concave chains of P; then, K(P) ni=lK(Chi), where the chains are considered to be planar point sets; see Fig. 5.

=

This theorem is the basis for our algorithm, which leads to the following result. Theorem 8 The cone of convex orientations of a simple polygon with n vertices can be computed in O(nlogn) time and O(n) space.

4

References [1] Eugene Fink and Derick Wood. Fundamentals of restricted-orientation convexity. Information Sciences, 1996, to appear. [2] Eugene Fink and Derick Wood. Generalized halfspaces in restricted-orientation convexity. Unpublished manuscript, 1995. [3] RaJ{ Hartmut Giiting. Stabbing C-oriented polygons. Information Processing Letters, 16:3540, 1983. [4] Nikolai N. Metelski. On semispaces of partial convexity. Doklady of Belarussian Academy of Sciences, 3:12-16, 1995, (in Russian). [5] Thomas Ottmann, Eljas Soisalon-Soininen, and Derick Wood. On the definition and computation of rectilinear convex hulls. Information Sciences, 33:157-171, 1984. [6] Gregory J. E. Ra.wlins. Explorations in Restricted-Orientation Geometry. PhD thesis, University of Wa.terloo, 1987. Technical Report CS-89-48. [7] Gregory J. E. Rawlins and Derick Wood. Optimal computation of finitely oriented convex hulls. Information and Computation, 72:150-166, 1987. [8] Gregory J. E. Rawlins and Derick Wood. Ortho-convexity and its generalizations. In Godfried T. Toussaint, editor, Computational Morphology, pages 137-152. Elsevier Science Publishers B. V., North-Holla.nd, 1988. [9] Gregory J. E. Rawlins and Derick Wood. A decomposition theorem for convexity spaces. Journal of Geometry, 36:143-157,1989. [10] Gregory J. E. Rawlins and Derick Wood. Restricted-orientation convex sets. Information Sciences, 54:263-281, 1991. [11] Sven Schmerer. On Generalized Visibility. PhD thesis, Universitit Freiburg, Germany, 1991. [12] Derick Wood. An isothetic view of computational geometry. In Godfried T. Toussaint, editor, Computational Geometry, pages 429-459. Elsevier Science Publishers B. V., North-Holland, 1985.

5

• • •

·X

• (a)

(b)

Figure 1: a. The standard convex hull (outlined with heavy lines) and the convex: O-hull (vertices: b1 , b2 , ba, b4 , bs, be) of a finite point set X. b. Superposition of Coxeter's star (the arrows) and the given O-lines. The pairs (al,a4), (a2,as), and (aa,ae) are antipodal.

Figure 2: An O-cone C and the O-halfpla.ne cl(1l2 \ (a + C» .

b

l

····

........-............, ..•..•.•...,.,...., ......, ......., ....',

............ ......................

Figure 3: The O-connected hull (outlined with heavy lines) and components of the O-convex hull of a :finite set X (the inner polygon, the segment [a, b), a.nd all the other points of X).

6

CO~------------------~·C4

Figure 4: An O-oriented polygon P, its maximal pointed O-cones digraph.

Ct, ... , C4, and its corresponding

Figure 5: A polygon P with its unique, maximal concave chain Chi such that K(P) = K(Ch l ).

7

Efficient Algorithms for Counting and Reporting Pairwise Intersections between Convex Polygons Prosenjit Gupta*t

Ravi Janardan+*

Abstract

1

Michiel Smid§

Introduction

Let S be a set of r bounded, convex polygons in the plane with a total of n vertices. By a polygon, we mean the region consisting of the boundary as well as the interior. Polygons P and Q are said to intersect if they share a point; in particular, they intersect if one is completely contained inside the other or if their boundaries intersect. We consider efficient algorithms for reporting output-sensitively (resp. counting) all intersecting pairs of polygo~ in S. By output size we mean the number of intersecting pairs of polygons in S; we denote this by I. Let K denote the total number of intersections between the polygons in S. That is, if P is completely contained in Q, or vice versa, we count this in K as one intersection; otherwise, if the boundaries of P and Q intersect, then we count all the boundary intersections in K. Note that I is no larger than K and, in general, it can be much smaller: The boundaries of P and Q can intersect O(lPI+IQD times; however, this is counted in I as just a single intersection between P and Q. Output-sensitivity is only one of the reasons why the problem we consider is interesting and non-trivial. A second reason has to do with the number of polygons and their sizes. We note at the outset that the problem is straightforward if either (a) r is a constant, or (b) all the polygons are of constant size. Consider case (a): Assuming that the polygons P and Q are represented appropriately, we can use the algorithm of Chazelle and Dobkin [2] to decide if they inO(logn). tersect in time O(Iog(IPI + IQI») Considering all pairs of polygons in this way, we can solve the problem in time O(r2 logn + I) O(logn). (Here I 0(1), since r 0(1).) Next, consider case (b): Note that I 9(K) since all the polygons are of constant size. We can compute the at most K boundary intersec-

Let S be a set of convex polygons in the plane with a total of n vertices, where a polygon consists of the boundary as well as the interior. Efficient algorithms are presented for the problem of reporting output-sensitively (resp. counting) the I pairs of polygons that intersect. The algorithm for the reporting (resp. counting) problem runs in time O(n4 / 3+t + I) (resp. 0(n4 / 3+t where € > 0 is an arbitrarily small constant. This result is based on an interesting characterization of the intersection of two convex polygons in terms of the intersection of certain trapezoids from their trapezoidal decomposition. Also given is an alternative solution to the reporting problem, which runs in O(n4 / 3 10gO(1) n + I) time, and is based on characterizing the intersection of two convex polygons via the intersection of their upper and lower chains and their leftmost vertices. The problems are interesting and challenging because the output size, I, can be much smaller than the total number of intersections between the boundaries of the polygons and because the number of polygons and their sizes can depend onn.

»,

'The research of these authors was supported in part by NSF grant CCR-92-00270. t Max-Planck-Institut fUr Informatik, 1m Stadtwald, D-66123 Saarbriicken, Germany. E-mail: pguptaCmpi-sb.mpg.de.

*

Department of Computer Science, University of Minnesota, Minneapolis, MN 55455, U.S.A. E-mail: j anardanOcs . umn. edu. Also supported in part by a Grant-in-Aid of Research from the Graduate School of the University of Minnesota. §Department of Computer Science, King's College London, Strand, London WC2R 2LS, United Kingdom. E-mail: michielOdcs.kcl.ac.uk. Part of this work was done while the author was at the Max-Planck-Institut fUr Informatik, Saarbriicken.

=

=

8

=

=

=

tions among the polygons in S by using the algorithm of Chazelle and Edelsbrunner [3] in time O(n log n+ K). Moreover, we can determine the at most K complete containments among the polygons by triangulating them and then stabbing the triangles with a vertex of each polygon. This takes time O(n4/ s logO(l) n + K) using the algorithm given in [1, Corollary 5.14]. It follows that the total time is O(n4/ s logO(l) n + I). The interesting case is when both r and the polygon sizes depend on n, for then the two approaches outlined above are not efficient. For example, assume that each polygon has size na, for some 0, 0 < 0 < 2/3; thus r n l-a. Assume further that the polygons intersect pairwise in the maximum number of edges. Thus there are 9(na ) intersections in each of the 9(n 2 - 2a ) pairs, so that K 9(n 2 - a ). 2 2a Moreover, I = 9(n - ) = o(K). The first approach above takes time O(r2 10gn + I) = O(n2 - 2a logn). The second approach takes time O(n4/ s logO(l) n+K), which is 9(K) since K 9(n2 - a ) and 0 < 2/3. The first solution can be made nearly quadratic by a suitable choice of 0, while the second solution is not sensitive to I. The challenge then is to devise an algorithm for reporting the intersecting pairs of polygons in output-sensitive fashion, in time O(f(n) +1), where fen) is subquaclratic and small. For the more difficult counting problem, we seek an algorithm with running time 0 (f (n)). (Note that the counting problem can be solved using a reporting algorithm, but this is not efficient.) We remark that we are not aware of any previous work on this problem.

zoidal decomposition. We also give an alternative algorithm for the reporting problem, which runs in time O(n4/ s logO(l) n + I). This algorithm is based on a different characterization of the intersection of a pair of convex polygons in terms of their upper and lower chains and their leftmost vertices.

3 3.1

=

The counting problem Characterizing the intersection of two polygons

We need the notion of a trapezoidal decomposition. Let P be a convex polygon. Draw a vertical line through each vertex of P. This partitions Pinto O(IPI) trapezoids and triangles P l , P2 , ••• , sorted from left to right. We consider a triangle as a degenerate trapezoid. We define an artificial trapezoid Po, which is immediately to the left of P l , and which "behaves" like an empty trapezoid. By definition, Po does not intersect anything. (Po can be represented by four halfplanes whose intersection is empty.) Note that a trapezoid also consists of a boundary together with its interior. For each polygon P of S, we define a new set P consisting of all pairs (Pi,1'i+l), i ~ O. We call each pair (l'i, Pi+1 ) a trapezoidal pair of P.

=

=

Definition 1 Let P and Q be two convex polygons. Consider the sets P and Q. We say that the elements (~, Pi+d E P and (Qj, Qj+l) E Q have a conflict if

1. l'i+l

n Qi+l :f; 0, and

2. Pi n Qi+l

2

Summary of results

3. PHl

Our first result is a data structure of size O(ml+E) (for any m satisfying n ~ m ~ n 2 ), which stores a set S of convex polygons with a total of n vertices, such that given a query convex polygon, Q, the 1Q polygons in S intersecting Q can be counted (resp. reported) in time O(IQI . n l + E/m l / 2 ) (resp. O(IQI' nl + E/m l / 2 + 1Q». Using the counting (resp. reporting) version of this data structure, we can count the pairs (resp. report the I pairs) of intersecting polygons in time O(n4/S+E) (resp. O(n4/S+E + I», for any constant € > o. This algorithm is based on an interesting characterization of the intersection of two convex polygons in terms of intersecting pairs of trapezoids from their trape-

= 0, and

n Qi = 0.

Theorem 1 Let P and Q be two convex polygons. Then P and Q intersect if and only if there are indices i and j such that (Pi, Pi+1l and (Qj,Qj+l) have a conflict. Moreover, if such indices i and j exist, then they are unique. Proof: Suppose there are indices i and j such that (Pi, Pi+l) and (Qi, Qi+l) have a conflict. Then l'i+l and Qj+l have a point in common. Hence, P and Q also have a point in common, i.e., P and Q intersect. To prove the converse, assume that P and Q intersect. Let x be the leftmost point in the intersection of P and Q. (If there is no unique leftmost point of intersection, then we take for x

9

the leftmost point with minimum y-coordinate.) We distinguish .three cases. Case 1: x is in the interior of Q.

In this case, ·x must be the leftmost point of P. In particular, x is a point of the trapezoid Pl' Let j 2= 0 be the index such that x E Qj+l. (ll x is on the boundaries of two trapezoids of Q, then we choose j such that x is on the right boundary-which is vertical-of Qj+l') Note that x does not belong to Qj. We claim that the elements (Po, PI) and (Q i , Q i+l) have a conflict. Indeed, since x E PlnQj+l, wehavePlnQj+l # 0. Also, by definition of the artificial trapezoid Po, we have Po n Qj+l = 0. Finally, we have PI nQj 0: This follows from the facts that (i) x is the leftmost common point of P and Q, (ii) x does not belong to Qj and (iii) Qj is to the left of Qi+l. Case 2: x is in the interior of P. This case is symmetric to Case 1. Case 3: x is on the boundaries of both P and

=

Q. Let i (resp. j) be the index such that x E Pi +l (resp. x E Qi+d. (ll x is on the boundaries of two trapezoids of P (resp. Q), then we choose i (resp. j) such that x is on the right boundary of Pi+l (resp. Qj+l).) We claim that the pairs (Pi'~+I) and (Qj,Qj+l) have a conflict. The case PHI n Qj+l # 0 is obvious. II we had ~ n Qj+l :j:. 0, then x could not be the leftmost intersection since Pi is to the left of Pi+l • The case involving Pi+l and Q j is similar. This proves the first part of the theorem. Now assume there are indices i and j such that (Pi, Pi+t) and (Qj, Qi+l) have a conflict. We will prove that i and j are unique. Among all indices i 2= 0 and j 2= 0 such that (~,Pi+l) and (Qj, Qj+l) have a conflict, choose those for which the pair (i, j) is lexicographically maximal. We consider four cases.

Case A: i

= j = O.

The way we chose the pair (i, j) immediately implies that i and j are unique.

Case B: i

= 0 and j

:j:. O.

We claim that there is no k such that k < j and (Po, PI) and (QIc,QIc+l) have a conflict. Clearly, this claim will prove that i and j are unique. To prove the claim, assume there is a k < j such that (Po, PI) and (Qk, Qk+l) have a conflict. We know that PI n QIc+l :j:. 0 and P 1 nQj+1 # 0. Let a and b be points of PlnQIc+1 and P 1 nQj+l, respectively. Then, by convexity,

the segment ab is completely contained inside

Moreover, this segment passes through the trapezoid Qj. Hence, PI n Qj # 0 which contradicts the fact that (Po,PI ) and (Qj,Qj+l) have a conflict. Case C: i :j:. 0 and j = O. We claim that there are no k and I, such that k < i, I, 2= 0, and (Pic, Pk+d and (Qt, Qt+l) have a conflict. Clearly, this claim will prove that i and j are unique. To prove the claim, assume there are k < i and I, 2= 0 such that (Pic, Pk+l) and (Qt, Qt+l) have a conflict. We know that Pk+l n Qt+l # 0 and Pi + l n Ql # 0. Since k < i, the trapezoid P k+l is to the left of Pi+l. But then I, must be equal to zero. As in Case B, let a and b be points of Pk+l n QI and P i +1 n QI, respectively. Then the segment ab is completely contained inside

Since this segment passes through the trapezoid Pi, it follows that ~ n QI :I 0, which is a contradiction. Case D: i :I 0 and j # O. Let L and L' denote the left vertical sides of Pi +l and Qj+l, respectively. Note that L and L' exist and that they are also the right vertical sides of Pi and Qj, respectively. Since Pi n Qi+l 0, L lies completely outside Qj+l. Similarly, since Pi+1nQj 0, Lilies completely outside Pi+l. These two facts, together with the fact that PH1nQj+1 # 0, imply that the boundaries of PHI and Qj+l intersect. In particular, the top side, t, of Qi+l intersects the bottom side, b, of Pi+l or, symmetrically, the bottom side of Qj+l intersects the top side of ~+l' Assume without loss of generality that t intersects b. Then the slope of t is larger than that of b. (Otherwise, L would intersect Qj+l or L' would intersect Pi+l.) By convexity, the polygon Q lies below the supporting line of t, and the polygon P lies above the supporting line of b. Hence, the polygon P n Q does not contain any point to the left of the intersection of t and b. In particular, there are no indices k and I, such that (k,l,) is lexicographically smaller than (i, j), and (Pk , Pk+l) and (Qt, Qt+l) have a conflict. This proves that i and j are unique. This completes the proof of the theorem.•

=

10

=

3.2

Review of a query composition technique

such that given a query trapezoid Q, the trapezoids in 8 that intersect Q can be counted efficiently. We can define a boolean formula B(P, Q) in disjunctive normal form (DNF) such that B(P, Q) is true iff P intersects Q. Each minterm in B(P, Q) is the conjunction of literals of the form P e H, where p is a point and H is a halfplane (either open or closed). The point P is either a vertex of P or the dual of a line supporting an edge of P, while H is a halfplane whose bounding line is either a supporting line of an edge of Q or is the dual of a vertex of Q. For example, the condition that a vertex peP is in Q in Lemma 1 can be written as the conjunction of four closed halfplane membership conditions, where each halfplane is bounded by a supporting line of an edge of Q and contains Q. The condition that a vertex of Q is in P can be expressed similarly using duality. The intersection of an edge of P and an edge of Q can also be written similarly. (Note that the condition p rt H-which arises when we want to express the non-intersection of two trapezoids, as in Definition I-can also be expressed in a similar form as P e HC, where HC is the open halfplane that is complementary to H.) Let Mi, i = 1,2, ... , k, be the minterms of B(P, Q). We may assume that B(P, Q) is written in a form such that it is true iff exactly one of the Mi'S is true. We can ensure this easily: we create the truth table for B(P, Q) and, for each instance of a 1 as the truth value, we write out the corresponding minterm. Since P and Q are of constant size, B (P, Q) has a constant number of minterms, each of constant size. A trapezoid is composed of (at most) four vertices Pi, i = 1, ... ,4 and at most four edges ei, i = 1, ... ,4. Let pi denote the point that is dual to the line supporting ei. Any of the minterms M can be written as

In Section 3~3 below, we will express intersection conditions as the conjunction of h > 1 halfplane range queries, where h = 0(1). Towards this end, we review a useful query composition result due to van Kreveld [9], which we will use. (This result is based on multi-level range searching structures [5, 6, 4].) Let 8 be a set of n geometric objects. Let D be a data structure for some query problem on 8, with building time, space and query time bounds of pen), fen) and g(n), respectively. Suppose that we now wish to answer queries not on the entire set 8 but on a subset 8' of 8, where 8' is specified by putting 8 in 1-1 correspondence with a set P of points in 1Rd and letting 8' correspond to the subset P' of P lying in a query simplex. (In [9], this technique is called simplex composition on P to D.) The follOwing theorem, adapted from [9], states how fast the query problem on 8' can be solved.

Theorem 2 [9] Let 8, D, P and n be as above. For an arbitrarily small constant € > 0, simplex composition on P to D yields a data structure with building time O(mE(m + pen»~), size O(mE(m + f(n»), and query time O(nE(g(n) + n/ml/d», for any n ::; m ::; n d , assuming f(n)/n is nondecreasing and g(n)/n is nonincreasing. For the reporting problem, the output size, denoted by k, ffl'lLSt be included in the query time as an additive term.•

In our application, the simplex will always be a halfplane. Given the h = 0(1) halfplanes, we proceed as follows: We design an initial data structure D. Then we apply Theorem 2, with one of the h halfplanes. This gives a new structure D' to which we apply Theorem 2 using a second halfplane and so on. Since h = 0(1), the space and query time bounds of the resulting structure are asymptotically the same as the ones given in Theorem 2.

M=~A~A~A~A~A~A~A~

where Gi (resp. Gt) is the AND of literals of the form Pi E H (resp. pi e H). We build a data structure corresponding to each minterm. Each such data structure is built on all the trapezoids P that we have. Each data structure is built on eight levels, corresponding to the Pi'S and pi's. Given a query trapezoid Q, we query each data structure. H level j is built on Pi, then we look at the literals in Gi = (Pi e Hl APi e H2A ... Api E Hs). Each Hie, k = 1, ... , s (where s ::; 16) is a halfplane bounded by one of the edges of Q or is dual to one of the vertices of Q. We query the data structure at level j by

3.3

The algorithm for the counting problem Lemma 1 Two trapezoids P and Q intersect iff (i) P has a vertex inside Q, or . (ii) Q has a vertex inside P, or (iii) an edge of P intersects an edge of Q.• First let us consider the following problem: Preprocess a set 8 of trapezoids in the plane,

11

first searching using HI, then searching with H2 below nodes selected by HI and so on. Once we are done at level j, we explore the level j + 1 structures at nodes selected at level j. For a given Q, a particular trapezoid P intersecting Q will be included in the count for the query on the data structure corresponding to only one of the minterms (because B(P, Q) is written such that it is true iff exactly one of its minterms is true). Hence the counts from the queries of the different data structures can be simply added up. We apply Theorem 2 with d 2 to get:

=

Lemma 2 For any m satisfying n :5 m :5 n 2 , and any constant € > 0, a set S of n trapezoids in the plane can be preprocessed in time O(m 1+E ) into a data structure of size O( m 1+E) such that the trapezoids that intersect a query trapezoid Q can be counted in time o (nl +E /m1/ 2 ) • • Now we turn to another problem. Let PS denote the union of the sets P of trapezoidal pairs corresponding to all polygons PES. We wish to preprocess PS into a data structure such that given a query trapezoidal pair TQ, the trapezoidal pairs in PSthat have a conflict with TO can be counted efficiently. We consider two trapezoidal pairs Tp = (PI, P II ) and TQ (Q', QII) and the three conditions enumerated in Definition 1. From the previous discussions, we know how to construct the boolean formula for the first condition of Definition 1. For the second and the third conditions of Definition 1, we construct the boolean formula for the corresponding intersection condition, negate it and again write it in DNF. From the AND of the three formulas thus constructed, we can construct a boolean formula BT(Tp,TQ) which is true iff Tp and TO have a conflict. Moreover, we can write BT(Tp, TQ) in DNF such that it is true iff exactly one of its minterms is true.

=

Lemma 3 Let PS be a set of O(n) trapezoidal pairs in the plane. For any m satisfying n :5 m :5 n 2 , and any constant € > 0, we can preprocess PS in time O(m 1+E ) into a data structure of size O(m1+E ), such that the trapezoidal pairs in P S that conflict with a query trapezoidal pair TQ can be counted in time O(n1+E /ml / 2 ) • • Finally we would like to preprocess a set S of r convex polygons with a total of n vertices (where r and the polygon sizes can depend on n), into a data structure such that given a query convex polygon Q, the polygons in S intersected by Q can be reported efficiently.

Theorem 3 Let S be a set of convex polygons in the plane with a total of n vertices. For any m such that n :5 m :5 n 2 , and any constant € > 0, S can be preprocessed in time O(ml+E) into a data structure of size O(ml+E) such that the polygons in S that intersect a query polygon Q can be counted in time O(lQI' n 1+E /m 1/ 2 ) • • To count pairwise intersections of the polygons, we simply build an instance of the data structure of Theorem 3 and query with each polygon in turn.

Theorem 4 Given a set S of convex polygons in the plane with a total of n vertices, the number of intersecting pairs of polygons in S can be counted in time O(n4 / 3+E ), for any constant e> 0 .•

4

The reporting problem: an alternative algorithm

The technique presented in the previous section can also be used to report the I intersecting pairs of polygons in time O{n4 / 3+E + I). In this section, we use a different approach to obtain a slightly faster algorithm. We preprocess each polygon to remove any vertex between two adjacent edges supported by the same line. This can be achieved in O( n) time. We also assume that no polygon has a vertical side, which can be achieved by appropriate rotation. Now each polygon P has a leftmost vertex £(P), a rightmost vertex reP) and can be uniquely decomposed into an upper chain U(P) and a lower chain L(P) at these vertices. We give a different characterization for the intersection of two convex polygons P and Q, which forms the basis of the reporting algorithm.

Observation 1 For convex polygons P and Q, if L(P) intersects U(Q), then at most a total of eight edges of L(P) and U(Q) are involved in the intersection.• Theorem 5 Two convex polygons P and Q intersect iff (i) £(P) E Q or £(Q) E P, or (ii) L(P) intersects U{Q) or U(P) intersects L(Q) .• Given r convex polygons with a total of n vertices, we break them up into upper and lower chains. We color the segments from the upper chains red and those from the lower chains

12

References

blue. Then we run the red-blue segment intersection algorithm given in [1, Theorem 5.10] to compute all intersections involving a red segment and a blue segment. This takes time O(n4/ 3 10gO(1) n + k), where k is the number of red-blue intersections. This time bound is also O(n4 / 3 IogO(1) n + I), since k = 0(1) by Observation 1. (Note that there can be intersections between red segments and, similarly, between blue segments; therefore we cannot use the algorithms given in [7, 8].) Next we take the r leftmost points of the polygons, triangulate the polygons into O(n) triangles and solve the following problem: Given r points and O(n) triangles, report all k' pairs (p, t) such that point p lies in triangle t. Using an algorithm given in [1, Corollary 5.14], this problem can be solved in time O(n 4/ 3 IogO(1) n+ k/), which is O(n4 / 3 Iog°(l) n + I), since k' 0(1). We conclude:

[1] P.K. Agarwal. Intersection and decomposition algorithms for planar arrangements.

Cambridge University Press, New York, 1991.

[2] B. Chazelle and D.P. Dobkin. Intersection of convex objects in two and three dimensions. Journal of the ACM, 34(1):1-:-27, 1987.

[3] B. Chazelle and H. Edelsbrunner. An optimal algorithm for intersecting line segments in the plane. Journal of the ACM, 39(1):154, 1992.

[4] B. Chazelle, M. Sharir, and E. Welzl. Quasioptimal upper bounds for simplex range searching and new zone theorems. Algorith-

=

mica, 8:407-429, 1992.

[5] D.P. Dobkin and H. Edelsbrunner. Space searching for intersecting objects. Journal

Theorem 6 Given a set S of convex polygons in the plane, with a total of n vertices, the I pairs of polygons that intersect can be reported in time O(n4/ 3 1ogO(1) n + I) .•

of Algorithms, 8:348-361, 1987.

[6] J. Matousek. Efficient partition trees. Discrete & Computational Geometry, 8:315334,1992.

Remark 1 Let A and B be sets of convex polygons, with a total of n vertices, where no two polygons in the same set intersect. Using the above approach, we can report in time O(n log n + I) the I pairwise intersections between polygons in A and B. Note that Observation 1 and Theorem 5 still hold for PEA and Q E B. We color red (resp. blue) the segments belonging to the upper (resp. lower) chains of polygons in A (resp. B). Then we compute all k red-blue intersections using the algorithm of [7] or [8]. These algorithms are applicable since no two red segments and no two blue segments intersect. This takes time O(n log n + k) = O(n log n + I), since k = 0(1) by Observation 1. We then repeat the above step with the lower chains in A and the upper chains in B. Next, we take the leftmost vertex of each polygon in B and determine which polygon (if any) in A contains it. Since the polygons in A are non-intersecting, this step can be done by building, in O(nlogn) time, a point-location structure for the subdivision induced by the polygons in A and querying with the leftmost vertex of each polygon in B. The total time for the queries is O(lBllogn) O(nlogn) time. It follows that the overall time for the algorithm is O(nlogn + I).

[7] H.G. Mairson and J. Stolfi. Reporting and counting intersections between two sets of line segments. Theoretical Foundations of Computer Graphics and CAD, NATO-AS! Series (R.A. Earnshaw, ed.) 307-325, 1988.

[8] L. Palazzi and J. Snoeyink. Counting and reporting red/blue segment intersections. Proceedings of the Third Workshop on Algorithms and Data Structures, Lecture Notes in Computer Science, Vol. 709, SpringerVerlag, Berlin, 530-540, 1993.

[9] M. van Kreveld. New results on data structures in computational geometry. PhD thesis, Department of Computer Science, University of Utrecht, Utrecht, the Netherlands,

1992.

=

13

Convex hulls of bounded curvature Jean-Daniel Boissonnat*

Sylvain Lazard*

Abstract

If the radius r of the smallest disk that contains S is smaller or equal to 1, any disk of unit radius containing In this paper, we consider the problem of computing a S is plainly a convex hull of bounded curvature of S. convex hull of bounded curvature of a set S of points in Notice that if r < 1 there exists an infinite number of the plane, i. e. a set containing S and whose boundary such disks, and, if r 1 such a disk is unique. We is a curve of bounded curvature of minimal length. We assume in the sequel that r > 1. prove that, if the radius of the smallest disk that contains S is greater than 1, such a hull is unique. We show that 2 Properties of the computation of a convex hull of bounded curvature reduces to convex programming or to solving a set of Lemma 1 T is convex and contains P.

=

r

algebraic systems.

Proof: T is convex because otherwise its convex hull has shorter perimeter and its boundary is a curve of bounded 1 Introduction curvature. Thus, T contains P because P is the smallest convex that contains S. 0 The convex hull of a set of points in the plane is defined We easily deduce from this lemma that the convex hull as the smallest set, or equivalently, the set of smallest perimeter that contains all the points. We consider in of bounded curvature of S is equal to the convex hull of this paper convex hulls of bounded curvature. A curve is bounded curvature of the vertices of the convex hull of said of bounded curvature if it is 1 and if its curvature is S. upper bounded by 1 everywhere it is defined. We define Lemma 2 aT consists of line segments and arcs of 'Unit a convex hull of bounded curvature of a set S of points circles passing through the vertices of P. in the plane as a set containing S and whose boundary is a curve of bounded curvature of minimal length. Proof: Since the radius of the smallest disk that conConvex sets of bounded curvature have been con- tains S is strictly greater than 1, aT is not reduced sidered in the context of non-holonomic motion plan- to a unit circle and passes through some points of S, ning [ART95, BL96J but we are not aware of any previous which, by the remark above, are vertices of P. Let S' be work devoted to the construction of such hulls. the set of vertices of P. Clearly, any arc of aT joining In the sequel, the boundary of a region 'R will be de- two oriented points (A, Q) and (E, {3) in JR2 \ S' is a loA polygon whose vertices are M 1 , ••• , Mn cally shortest path of bounded curvaturel joining these noted by such that MI, ... ,Mn appear in this order on the two oriented points. Then, according to [BCL94] and boundary of the polygon will simply be called polygon [PBGM62, Theorem.25J, any arc of aT in JR2 \ S' is a Ml ... Mn. When necessary, the suffix i of a vertex Mi of curve e1 of one of the two types ese or eee where a polygon Ml ... Mn will be considered modulo n. Two denotes a unit circular arc and S a line segment. The polygons are said to be geometrically equal if they define paths of type eee cannot appear in aT because aT the same region; notice that two polygons that are geo- is convex. Thus, any circular arc that appears in aT is metrically equal have the same non-flat vertices but may followed and preceded by a line segment and must pass have different flat vertices. through a vertex of P. o In the sequel, S denotes a set of points in the plane, T a convex hull of bounded curvature of S. P is the usual Notice that not all the vertices of P necessarily belong convex hull of S and PI, ... , Pn denote the vertices of to aT : Figure 1 shows aT when P is a square; when we P. Di denotes the closed disk of unit radius centered add to P a fifth vertex A that belongs to T, T is still the at Pi, for any i E {I, ... , n}. Q is a polygonal region convex hull of bounded curvature of these five vertices whose perimeter is minimal and that intersects all the yet not all five vertices belong to aT. disks D 1 , ••• ,Dn (observe that it is not required that the Now, we transform the problem of computing T into a boundary of Q intersects all the disks D l , • .. ,Dn). As more standard problem in Euclidean geometry (see Figwe will see, Q plays a central role in the characterization ure 1) : and in the computation of T.

e

an.

e

1 A curve C is a locally shortest path of bounded curvature joining (A, Q) and (B, (3) if and only if any curve of bounded curvature jOining CA, Q) and (B, (3) and contained in a sufficiently small neighborhood of C is longer than C.

* INRIA, BP 93

06902 Sophia-Antipolis Cedex, France E-mail: boissonn.lazard(Qsophia.inria.fr

14

onto P. Notice that we cannot simply replace the part of Q that is outside P by an arc of ap because the resulting polygon may possibly not intersect all the disks Db"" Dn (see Figure 2a). Precisely, each point of Q outside P is projected onto the closest point of 8P (see Figure 2b). That transformation shortens 8Q. Moreover, each point of Q that belongs to a disk Di is projected onto a point that belongs to the same disk because P is convex. Thus, the transformed polygon still intersects all the disks D 1 , ••• , Dn. As the perimeter of Q is minimal, we have a contradic&a 0 Figure 1: Example where not all the vertices ofP belong to8T

Proposition 3 T is the Minkowski sum of the disk of unit radius centered at the origin and of a polygonal region Q* which is, among the regions that intersect all the disks Db"" Dn , one whose perimeter is minimal. Proof: First, notice that, since T is convex, the sum of the lengths of the circular arcs of aT is equal to 211". Hence, the perimeter of T is equal to 27r plus the sum of the lengths of the line segments of 8T. We recall that the eroded region of T by the unit disk D centered at the origin is (TC e D)C where fI .CfI denotes the complementation and e the Minkowski sum. In other words, the eroded region of T by D is T\ Upe8TD(P) where D(P) is the translated of D centered at P. Let Q* denote the eroded region of T by D. As aT is convex and of bounded curvature, Q* is convex, non empty and the Minkowski sum of Q* and D is equal to T. Moreover, as T contains P, Q* intersects all the disks D 1 , ••• ,Dn. The perimeter of T is equal to 27r plus the perimeter of Q*. Thus, Q* is, among th~ regions that intersect all the disks D 1 , ••• ,Dn , one whose perimeter is minimal. 0 Let Q denote a polygonal region of minimal perimeter that intersects all the disks Db' .. ,Dn. We will prove some properties of Q in Section 3 and show in Section 4 that Q is unique and therefore equal to Q*.

3

Properties of Q

Lemma 4 Q is convex. Proof: Q is convex because, otherwise, its convex hull has a perimeter strictly smaller than the one of Q and its convex hull still intersects all the disks D1 , • •• , Dn and still has a bounded curvature; that contradicts the definition of Q. 0 LemmaS

Q~P.

Proof: Assume for a contradiction that Q ~ P. The idea of the proof is to project the part of Q outside P 15

Figure 2: For the proof of Lemma 5

Lemma 6 8Q intersects all the disks D 1 , ••• , Dn. Proof: Assume for a contradiction that 8Q does not intersect a disk Dio' As, by hypothesis, Q n Dio is not empty, Pio belongs to the interior of Q. Thus, by Lemma 5, Pia belongs to the interior of P which contra0 dicts the hypothesis that Pia is a vertex of P. Proposition 7 There exists Mi e D 1 , ••• , M~ e Dn such that the polygon Mi ... M~ is geometrically equal to the polygon Q. Proof: By Lemma 6, there exists Mi E Di

n 8Q, Vi

E

{I, ... ,n}. If the points M 1 , ••• ,Mn appear in this order on 8Q, we take Mt = Mi (Vi E {I, ... ,n}). The polygon Mi ... M~ is geometrically equal to Q. Indeed, as Q is convex and Mt E 8Q, the polygon Mi ... M~ is convex and included in Q. Thus, the perimeter of the polygon Mi ... M~ is not greater than the perimeter of Q, and it intersects all the disks D 1 , ••• , Dn (because Mt E Di). As, by definition, Q is a polygon intersecting all the disks D 1 , ••• ,Dn whose perimeter is minimal, Q is geometrically equal to the polygon Mi ... M~. If the points M 1 , ••• ,Mn. do not appear in this order on 8Q, let Mi be the intersection point between 8Q and the line segment PiMi which is the closest from Pi (see Figure 3). By construction, Mi E Di and the line segment PiMi does not intersect the interior of Q.

Di Pi

Mj Q

-- --

M; = Mj'

Dj

Pj

Pj

Dj

(a)

Pi

(b)

Figure 3: For the proof of Lemma 7 If the points M{ , . .. ,M~ appear in this order on aQ, by the same argument as above, the polygon M{ ... M~ is geometrically equal to Q. Otherwise, there exist two consecutive points Mi and Mj on aQ such that the line segments p,Mi and P;Mj intersect 2 , because the segments P, M{, . .. , PnM~ belong to P (P is convex and contains Q) and do not intersect the interior of Q. The two segments P,M; and P; M j can intersect only if M; or Mj belongs to the intersection between the two disks D , and D; (see Figure 4a). We assume, without loss of generality, that Mi E D , n D;. We t hen define Mj' = Mi . The number of intersection points between the segments PIM{, .. ' ,Pnj\1~ decreases by 1 when we replace M j by Mj' = Mi (see Figure 4b) : actually, on one hand , the segments Pi1\1l: and PjMj' do not intersect contrary to the segments P,M; and P;Mj; on the other hand, the II new " segment PjM'/ can only be intersected by a segment intersecting the "old" segment P;Mj (because M; and Mj are consecutive on aQ ). Furthermore, we claim that the line segment P; Mj' does not intersect the interior of Q. Indeed (see Figure 4c) , let 11., be the union of the two half-planes limited by the edges of Q incident to M; that do not contain Q. Let 11.; be the complementary of 11.,. By construction, p,Mi does not intersect the interior of Q, thus p,Mi c 11.,. If P; Mj' intersects the interior of Q , P; E 11.; and so P;Mj C 11.; . Then P,M; n P;Mj = 0, which contradicts our assumption and proves the claim. Repeating this procedure for all t he pairs of consecutive points on aQ such that the corresponding line segments intersect, we define a list of points Mj, . . . , M~ that belong to aQ such that t he segments PI MI" PnM~ do not pairwise intersect and do not intersect the interior of Q. The fact that the segments P,Mi , . . . , PnM~ do not pairwise intersect, are included in P and do not intersect the interior of Q, implies that the points Mi M~ appear in this order on aQ. By the same argument as above, t he polygon Mj ... M~ is geometrically equal to

(c)

Figure 4: For the proof of Proposition 7 For example in Figure 1, the number of non-flat vertices of Q is smaller t han the number of vertices of P. In that case, one of the Mt is a fiat vertex of Q and moving Mt inside D , along 8Q does not modify aQ. Proposition 9 If Mj E D .. . ,M~ E Dn are the ver" equal to Q, then, for any tices of a polygon geometrically non-fiat' vertex M;, • M ; belongs to the boundary of D" • the segments Mt_ lMt and AI; j"ft+ l do not intersect the interior of D"

• the line P,M; is the bisector of the two lines Mt_l Mt and Mt Mt-H that separates Mt_l and

Mt+l "

Remark 8 The points Mj, ... ,M~ may not be unique.

Proof: The first claim of the proposition is a direct consequence of the second one. Let M; be a non-flat vertex of Q. As M; is not flat, t he line segment Mi_1 M'+ l does not intersect D,. As the perimeter of Q is minimal , the polygonal line Nlt_l1\1[i A1t+l is, among the polygonal lines Mi_1MM:+1 such that M ED" one of smallest length. The set of points M such that the length of the polygonalline Mt_l 1\11 Mt+l is equal to a given I is an ellipse whose focuses are M ;_ l and M'+ l. It follows that M; is t he common point of D , and the ellipse whose focuses are M ;_l and M'+l that is tangent to D , and does not enclose D , (see Figure 5). This proves the second claim of the proposition.

2We say that two line segments intersect if their relative interior intersect.

3If Q is reduced to a point, Mt ; M; for all (i , j) and we consider t he vertices Mt as fiat, by convention.

1"

• 1

I ' . • 1

Q.

0

16

A well known property of the ellipses is that the normal line to an ellipse at a point M is the bisector of the two lines Mt-l M and M Mt'H that separates the focuses. In our case, the normal to the ellipse at the point M; is also normal to the boundary of Di and so passes through Pi. Therefore, ~Mt is the bisector of the two lines Mi_lMi and Mt Mt'H that separates Mi-l and Mt+l' 0

among the regions that intersect all the disks D 1 , .•. , Dn.

o Lemma 12 Let Oi be the angle L(PiPi-~PiU) where Mi is a point of the boundary of Di and let Ui C [O,27r] be the set of the Oi such that Mi E'P (1 :s; i ~ n). Let g be g:

U1 x ... X Un ~ 1R O}, ... ,On .-. IIMIM211

+ IIM2M311 + ... +IIMn-lMnll + IIMnMlll

and let V C [O,27r]n be the open set of the e = (O}, ... , On) E U1 X ... X Un such that the polygon MI'" Mn does not intersect the interior of the disks D}, ... ,Dn • Then, g is locally strictly convex on V, i. e. for any e E V, there exists an open neighborhood of e such that the restriction of 9 on this neighborhood is a strictly convex function.

........

Figure 5: ~Mt is the bisector of the two lines Mt-l Mt and M; Mt'H that separates Mt-l and Mt'H

Uniqueness of Q and of

4

We define the following function f:

r

Remark 13 9 is not convex on V because it can be shown that V is not a convex set. Notice that e E V if and only if the polygon Ml ... Mn does not intersect the interior of the disks Dl, ... ,Dn and if the edge MiMi+l is neither tangent to Di nor to Di+l' 'Vi E {I, ... , n}. Proof: We consider the function

9i : Ui x Ui +1

f :

Oi,Oi+l

~

.-.

1R II MiMi+l II·

Dl X ••• x Dn ~ 1R M}, ... ,Mn .-. II Ml M2 II + IIM2 M 311 + ... +IIMn-lMnli + IIMnMl/l

We show by computing the Hessian matrix of 9i that 9i is locally strictly convex at any point (8 i , 8i+ 1) such that the relative interior of the line segment MiMi+l does not where II MiMi+tll denotes the Euclidean distance be- intersect (and is not tangent to) Di and Di+l. It follows that 9i is locally strictly convex on the projection Vi of tween the points Mi and Mi+l. V onto Ui x Ui+l. We omit here these computations. Proposition 10 I is a convex function. Let gi be the function Proof: A simple computation, omitted here, yields the 0 proposition.

gi:

U1 x ... x Un

~

(h, .. ·, On

.-.

1R II MiMi+l II·

Proposition 11 I(Mi, ... , M:) is the minimum of f if Since 9 = El II Mi:_ l M~ II + lIM Mi:+ l ll. and, as the polygon Mi~ ... M1i: does qnot have any Hat Therefore, any perturbation of a vertex Mi; that keeps vertex, (8il , ••• , 8:q ) E V by Proposition 9. Thus, by Mt inside Di; strictly increases the perimeter of the Lemma 12, 9 is locally strictly convex at (8;1"'" 8iq )· , M*il . . . M*i ' polygon It follows that (Mi~ , ... , M i:) realizes a local minimum As I(Mi*I'" . ,Mi: ) is the minimum of j, it is the minimum of the restriction of I to Gil X ••• X Giq and thereof the function fore g(8i1 , . . . , 8; ) is the minimum of g. Thus for any j: Dil x ... X Diq ~ JR (8il" .. , 8i ) =F (Oil' ... ,8: ) in a sufficiently small neigh...... IIMilMi211 + ... Mil'" .,Miq borhood of (8il , . . . ,8; ), ;(8i1 ' . . . , 8iq ) > g(8;1'"'' 8iq). +II Miq _l M iqll + II Mi qMil II· Hence, for any (Milq, ... , Mi ) • =1= (Mi~"'" ~i~) in q Gil X ••• X Giq and in a suffiCIently small neIgnborIndeed, let il E JR2n be a sufficiently small vector of (Mi~'"'' M~), the perimeter of the polygon such that (M;, + il E Dil X •••_ X Di_ q. The hood 1 ... ,M;) q Mil ... Mi q is strictly greater than the perimeter of t?e vector il is the sum of q vectors (... ,0, ili; , 0, ... ) E Polygon M~'1 ... M~'9 . This shows that •the polygon of rom• JR2 X ••• X JR2 such that M i: + ili; E Dij' Let D j(M*) imal perimeter that intersects the q diSks D i1 , ... , Diq IS be the differential at M* (Mi~"'" M~). As shown unique.

4

=

18

3)Let Q' be a ·polygon intersecting all the disks D I , ... , Dn and whose perimeter is minimal. We show that Q' Q. Plainly, Q' intersects the q disks D il , ..• , Di q • As shown above, the polygon of minimal perimeter that intersects the q disks Dil"'" Diq is unique and equal to Q. Thus, either Q' = Q or the perimeter of Q' is strictly greater than the one of Q. As the perimeters of Q' and of Q are equal, Q' = Q. 0 Propositions 3 and 14 yield the following proposition:

the polygon Mi~ ... M i: is minimal. That system can be solved in time O(2 0 (n» (see [LL91]). By considering all the possible sets of suffix {i}, ... ,iq } ~ {l, .. o,n} (q E {l, ... ,n}) we can comM;) such that the polygon pute the solution (MZ, Mi~ M i: intersects all the disks D 1 ,. Dn and for which the perimeter is minimal. Hence, we can compute the convex hull of bounded curvature of n points in exponential time in n.

Proposition 15 T is unique.

6

5

The work reported here raises many questions. We mention a few of them we plan to consider in near future : Does there exists a polynomial time algorithm for this problem? Can these results be generalized to higher dimensions? Can similar results be obtained for convex hulls of bounded curvature and of minimal area? Can similar results be obtained for convex hulls whose boundaries are curves 0 2 for which the derivative of the curvature is bounded?

=

Results and algorithms

We sum up the results of Propositions 3, 10, 11, 14 and 15 in the following theorem :

0.0,

0

••

0



,

Open questions

Theorem 16 Let S be a finite set of points such that the radius of the smallest disk that contains S is strictly greater than 1. Let 'P = PI,"" Pn be its convex hull and D I , .. . ,Dn the closed disks of unit radius centered at PI, ... , Pn . S has a unique convex hull of bounded curvature of which is equal to the Minkowski sum of the disk References of unit radius centered at the origin and of any polygon Mi ... M~ such that f(Mi, ... , M~) is the minimum of [ART95] Agarwal (P. K.), Raghavan (P.) et Tamaki (H.). Motion planning for a steerthe convex function ing-constrained robot through moderate obstacles. In: Proc. 27th Annu. A CM Symf : DI X •.• x Dn ~ JR pos. Theory Comput., pp. 343-352. M MI, ... ,Mn ~ IIMIM211+IIM2 311+··· M M +II n-I nll + II MnMI II· [BCL94] Boissonnat (J.-D.), cerezo CA.) et Leblond (J.). - Shortest paths of bounded curvature According to Theorem 16, the main problem in comin the plane. Journal of Intelligent Systems, puting T is the computation of a point for which the vol. 10, 1994, pp. 1-16. function f is minimum. The minimization of f can be viewed as the minimization of the function : [BL96] Boissonnat (J-D.) et Lazard (S.). - A polynoF:

JR2 x ... X JR2 Ml, ... ,Mn

~

JR

~

II Ml M2 II + IIM2 M 311 + ... +II M n-I M nll + II MnMl II

under the n constraints Mi E Di, 1 ~ i ~ n. Interior point algorithms can be used to compute, in polynomial time, a point that approximate the minimum of F under [LL91] these constraints (see [NN94]). We can also compute Q exactly : if Mi~"'" M i: are the non-flat vertices of Q , then, by Proposition 9, (Mi~ , ... , M i:) is a solution of the system [NN94]

mial-time algorithm for computing a shortest path of bounded curvature amidst moderate obstacles. In: Proc. 12th Annu. ACM Sympos. Comput. Geom. - Philadelphia, PA, USA, 1996. Lakshman (Y.N.) et Lazard (D.). - On the complexity of zero-dimensional algebraic systems. In: Effective Methods in Algebraic Geometry (MEGA), ed. par Mora (T.) et Traverso (C.). pp. 217-225. - Birkhiuser. Nesterov (Yo) et Nemirovskii (A.). - Interior-point polynomial algorithms in convex programming. - SIAM Studies in Applied Mathematics, 1994.

[PBGM62] Pontryagin (L. S.), Boltyanskii (V. G.), Gamkrelidze (R. V.) et Mishchenko (E. F.). That system can be transformed into an algebraic sys- The mathematical theory of optimal protem of q equations (of degree 6) in q indeterminates cesses. - Interscience Publishers, 1962. tan(8ij/2) (j E {i1, ... ,iq }) where (hj is the polar angle of PiU. Then, (Mi~"'" M;q) is, among all the solutions of the system, the one for which the perimeter of 19

Enclosing k points in the smallest axis parallel rectangle Michael Segal and Klara Kedem* Department of Mathematics and Computer Science Ben-Gurion University of the Negev, Beer-Sheva 84105, Israel

April 22, 1996

1

Introduction

Given a set S of n points in the plane, and given an integer k, ! ~ k ~ n, we want to find the smallest axis parallel rectangle (smallest perimeter or smallest area) that encloses e..xactiy k points of S. Aggarwal et al. [2} present an algorithm for this problem for any k ~ n, which runs in time O( k 2n log n) and uses O( kn) space. Eppstein et aI. [4J and Datta et al. [3} show that this problem can be solved in O(k 2 n) time; the algorithm in [4} uses O(kn) space, while the algorithm in [3} uses linear space. These algorithms are quite efficient for small k values, but become inefficient for large k's. The naive algorithm, for k = n, will find the (only) rectangle in O(n) time. "vVe present an algorithm which is more efficient than the algorithms cited above for large k values. It runs in time O(n+k(n-k)2) and uses linear space. Moreover, when k = n our algorithm runs in 0 ( n) time. We extend our planar algorithm to find a minimum volume axis parallel box in 3-space that contains k of n points from a point set S in the space. The 3d algorithm runs in time O( n + k( n k)2 + (n - k)5), and occupies O(n) space.

2

The Algorithms

In this section we present our algorithms for the planar and 3d problems. In Subsection 2.1 we present an algorithm that finds the smallest enclosing rectangle that contains k x-consecutive points of S. This algorithm is used as a subroutine in our following algorithms. In Subsection 2.2 we present our algorithm to the planar problem stated in the Introduction, and in Subsection 2.3 the 3d algorithm. We assume that the rectangle (box) is closed, i.e., some of the k points can be on its boundary. vVe assume that all the points of S are in general position, meaning that no two points have the same x (or 11, or z) coordinate.

2.1

Enclosing k x-consecutive points

"vVe do not want to sort S according to x, since this will immediately spend O(nlogn) time. Therefore we use a partial order selection method, described in Aigner [1], which creates posets for selecting the n - k largest elements (x coordinate order) in S. A poset is a partially ordered set of ·Work by

Klara Kedem has been supported by a grant from the U.S.-Israeli Binational Science Foundation.

20

elements. Figure 2 below illustrates a poset S, where the largest n - k + 1 points are sorted and the bottom k - 1 points are known to be smaller but are not sorted. Let v denote the smallest point in the subset of the larger x coordinates. Denote by x( v) the x coordinate of v. We are interested in the set of points ReS whose x coordinates are larger than xCv). .

largest n-k

points

k-l points

Figure 1: A poset We describe how to find the poset R. vVe set a knock-out tournament as described in [lJ. Assuming n is a power of 2 we put all the points of S in the leaves of a tree and compare them by pairs. As in a knock-out tennis tournament we determine the winner of each pair, put it in the parent node of the pair and repeat the process for this level: pair winners again and copy the winner of this stage to the parent level, and so on. The best player in the tournament, w, is determined by n - 1 games and is at the root - zero level of the tree. We report w as the largest found and take it out of the tournament (put it in R). Take w's opponent from the first level in the tree and compare it to each of w's opponents along the path that w climbed up to the top (going from the root down to the leaf). After at most rlog n1- 1 games the second best player s is determined and reported (in R). Note that the third best player must have lost to the second best by this set-up. Hence the highest opponent of s now plays against all of .s's opponents on the path that moved s to the top. It is immediately seen that in the worst case we need no more than rlog( n - 1)1 - 1 games to move the 3rd best player up to the top. Continuing in this way, we have collected the n - k largest elements in S into an oredered set R, in time O(k + ~r=k+2I1og-il) ~ O(k + (n - k)logn). We have R, the x-ordered subset of n - k points of S with the largest x coordinates. Let L = S - R. vVe know v - the point with the largest x coordinate in L. We perform three similar tournaments on L, but to a smaller extent. We find the point with the smallest y coordinate among the points in L. using the knockout strategy and resulting with a full binary tree /(1 (with k leaves) which stores the y coordinates of the points of L in the leaves, and the results of the intermediate tournaments in the inner nodes. Denote by min~ the winner in 1(1' Similarly, we constrlict a tournament tree [(2 for finding the largest y coordinate, max~. vVe repeat this for finding the smallest x coordinate, min~, building a tournament tree D. 1(2 and D are also trees of k leaves each. Notice that max~ = xCv). We create an array U with n entries, an entry for each point Pi E S. Each entry contains two pointers, one to the location of Pi in ](1 (assigned to be nil if Pi is not in 1(1), and the other pointer for the location of Pi in /(2 (or nil). Finding a rectangle We slide a sweepline from left to right, starting at the leftmost point r of S. At this point we compute the perimeter (area) of the rectangle defined by min~, max~, min~ and max~. The next

21

event is to slide the sweepline to the next leftmost point of S (r is deleted from L, and VI, the smallest point of R, is inserted into L) so that L always contains k points. The new max~ equals x( VI) and is found in time 0 (1). The next leftmost point in S is found using the tournament step of finding the second winner in D. This is the new min~. Finding the next leftmost point in D takes log k - 1 comparisons. We update the tournament trees 1(1 and [(2 according to the deletion of the first point and the insertion of VI. There are few possibilities: 1. The y coordinate of the deleted point r is not equal to min~ or max~.

• If y( vd < min~, where min~ = Y(Pi), for some point Pi E L, then we replace in [(I the value Y(Pi) by y( VI). • If Y(VI) > max~ attained at some point Pi E L, then we replace in [(2 the value Y(pj) by Y(Vl). • If min~ = Y(Pi) < y( VI) < y(p;) = max~ then find the location of the deleted point r in 1(1 and 1(2 and replace it in both trees by y( vt)). We update the tree 1(1 and the array U as follows: Using U we find the leaf containing y(r) in 1(1, replace it by y(vr), and moving from this leaf to the root of I(r, we compare y(Vl) with the values in the adjacent nodes along the path and update 1(1 accordingly. This step takes O(logk) time. We update U in time 0(1). We put the pointer to 1(1 that was in entry r of U as the pointer to 1(1 for entry VI in U. We put nil in the entry of r in U. Symmetrically we update [(2 and the pointers to 1(2 in U. 2. The y coordinate of the deleted point r is equal to min~ or max~. Say, wlog, to min~. We find the second smallest y value in 1(1 as we did in the previous step; we put y( vr) into the leaf of 1(1 just vacated by min~; and update the tree and U accordingly (as in step 1). Notice that we do not need to update D at all. This procedure is repeated n - k times. Hence the total time involved in updates in O( (n - k) log k). The construction of U takes O(n) time. The initial construction of I(t, K2 and D, is performed in total time of O«k - 1) + (logk - 1) + (log(k - 1) - 1) + ... (log(k - n + k - 2) - 1», which (substituting the first k in each log term by n) is ::; 0(~i::k+2nogil) ~ O(k + (n - k)logn). Summing up the runtimes of the updates and constructing the trees. we get

Theorem 2.1 The smallest perimeter (area) rectangle that contains a given number k of x -consecutive points in a set of n points in the plane, can be found in time O( n + (n - k) log (kn».

2.2

The smallest rectangle containing k arbitrary points

To avoid tedious notations we assume that the names of the points correspond to their x-ordering~ though this does not mean that the points are sorted. In general the outline of our algorithm is as follows: initially we fix the leftmost point of the rectangle to be the leftmost point of S. At the next stage the leftmost point of the rectangle is fixed to be the second left point of S, etc. Within one stage, of a fixed leftmost rectangle point, r, we pick the rightmost point of the rectangle to be the q'th x consecutive point of S, for q = k + r -1, ... , n. For fixed r and q the x boundaries of the rectangle are fixed, and we go over a small number of possibilities to choose the upper and lower boundaries of the rectangle so that it encloses k points.

22

In more detail, we initially produce the posets R, D, Kl and ](2 and the array U, as in the former algorithm. We use them as before but with a slight modification to the maintenance of ](1 and K2 as we describe below. We will also use two auxiliary sorted lists Al and A2 that are initially set to be empty. They will collect the information found throughout the algorithm, of the lowest points (min~) and highest points (max~), respectively, plus pointers to the leaves in ](1 and K2 containing these points (nil as a pointer if the point is not the corresponding tree). The maximum size of Al and A2 is 2( n - k) as will be seen below. Since the lists are short we can afford O(n - k) time update operation on them (search, insert, delete). As before, D and Rare not updated throughout the algorithm, and U's updates are done in 0(1) time. For the initial rectangle (say T = 1 and q = k) we compute the perimeter (area) of the rectangle by the initial min~, max~, min~ and max;. The point that attains mini' (maxi') is stored as the first element in Al (A2)' For the next step, q = k + 1, the vertical slab between T and q contains the first k + 1 xconsecutive points. Trivially there are two rectangles containing k of these points within this slab: (1) The second smallest (y) in ](1 (store it in AI) and the first largest in K 2 , and (2) The first smallest (y) in 1(1 and the second largest in [(2 (store it in A2)' For each stage (r) we use the tree D to find the next smallest point r in S. We go over all the steps within this stage, varying q (found in R) as above and finding the smallest rectangle that contains k points in the vertical slab determined by T and q. As we go over the rectangles containing k points in the fixed vertical slab we add the newly found points with smallest (largest) y coordinates to A.l (A 2 ) sorted by their y-value. Not all these possibilities yield feasible rectangles. See, e.g., in Figure 2, where the rectangle determined by T and q contains k points that do not include q. But the infeasible rectangles are dealt with either in a previous step or in a subsequent step.

--

kpoints

.-.

o q

Figure 2: A rectangle with k points was dealt with in step q' The main differences between the maintenance of [(I and ](2 in this algorithm and the former are as follows. At the beginning of each stage T, the vertical slab determined by T and by q = r+k-1 contains k points in 1(1 and [(2. As we take the next right point q, we add points to 1(1' vVe will show below though, that the trees [(I and ](2 remain of size k, but they undergo changes as q changes. However, at the beginning of the next stage r' = r + 1, q' = q + 1, the new trees [(land [(2 will differ from the ones at the beginning of the former stage only by the deletion of r and insertion of q'. So we keep copies of these initial trees at stage r and update them by these two points to obtain the initial trees for stage r + 1. Similarly, we have to keep a copy of the initial array U, and update it as we did above, for the deleted T and added q'. We initialize Al and A2 to be empty at the beginning of the whole process. We add points to Al and A2 throughout all the (n - k) steps of stage r = 1. At the beginning of each stage T' = r + 1 we delete from Al and A2 the point T.

23

Assuming we have the initial trees, array and lists at the beginning of stage rand q = r + k - 1. For the next x-consecutive point q we do the following Updating Kl and A2 • IT y(q) > max(y) in A2 for the entries in A2 for which the pointer to 1(1 is not nil, then we skip to the next q. This is because y(q) will never be reached to act as min~ in the slab defined by r and q. We find the point with max(y) in A2 by going over all its « n - k) entries. • IT y(q) < max(y) in A2 for the entries in A2 for which the pointer to Kl is not nil, then we can delete the point Pi whlch attains ma..x(v) from 1(1 and put the point q instead of it, updating the path to the root (in O(log(k) time). (as in the former case Pi will not participate as a lower y boundary of a rectangle in this slab.) We put nil in the pointer assigned to 1(1 in A2, for the entry Pi (O(n - k) time). Symmetrically we deal with 1(2 and AI' Summarizing the runtime of our algorithm we get: • Computing R: O(k + Ei::k+2I1ogil)

= O(k + (n -

k) logn)

• Initially producing U: O(n). • Copying trees 1(1 and 1(2 and U and initially updating them per each stage is dominated by the latter: O(n). For all stages O(n(n - k)). • Total time for updating 1(1, [(2, Al and A 2 , for all the steps in one stage: O«n - k)«nk) + log k). O«n - k)2log k + (n - k)3) for all stages. • The number of possible rectangles at each stage: Ej;tU + 1) = O«n - k)2). Knowing Al and A2 we invest 0(1) time in computing the area (perimeter) of each rectangle. The number of possible rectangles at all stages: O((n - k)3). Since k > n/2 some of the above summands can be neglected we yield

Theorem 2.2 The smallest perimeter (area) rectangle that contains a given number k of points from a set of n points in the plane, can be found in time O(n + ken - k)2) and O(n) space. 2.3

The smallest box containing k arbitrary points in 3d-space

We extend the planar algorithm to the smallest box containing k points in the space. We project S on the x, y plane, call this planar set S1. 1. We use the planar algorithm to find all the rectangles on the x, y plane that contain k, k

+

1, ... , n points of 51' In essence we do the following:

2. For each rectangle found in the former step use the z axis to bound exactly k points of S in a 3d box defined by the x, y rectangle and a segment on the z axis.

24

(The whole process will be later repeated similarly for the x, z plane and a segment in the y axis and for the y, z pla.ne and x axis.) During the planar algorithm we encounter rectangles with k, k + 1, ... , n points of S1 in them. We construct additional tournament trees C1 and C2 for the z axis (similar to 1(1 and K 2 ). Initially, for each vertical'slab in the planar algorithm, the trees store the k minimal (maximal) values of the z-coorclinates of the points projected in the rectangle. Similary to the arrays A1 and A2 in the planar algorithm, we construct and maintain two arrays Tl and T2 that save the points in increasing (decreasing) z order, that have been found during the algorithm. The vector U will now contain four fields per entry (for 1(bK2,CbC2). The new data structures are updated when the planar data structures are updated, and their update time is as for the corresponding planar data structures. For each rectangle generated in step 1 above, we go over the (length n - k) arrays, Tl and T2 , and compute all the boxes determined by the z delimiter in 0(1) time per box. Assume that we are at step m of stage r of the planar algorithm. There are k' k + m - r ~ k points of S1 in the slab defined by r and m. We go over all the rectangles with k, ... ,k' points in this slab. In the z dimension we perform an identical updating scheme as for the y direction in the planar algorithm, updating C}, c2, T 1 , T2 and U accordingly. The number of planar rectangles in one step is bounded by (n - k)2, and in axis z by (n - k), totalling in (n - k? boxes per step. As in the planar algorithm we check for consistency of the boundaries of the boxes This is done in constant time per box. We have n - k stages with at most n - k steps, so the running time of this algorithm is O(k + k(n - k)2 + (n - k)5).

=

Remark The same technique works when we have to deal with Loo metrics. For example, an algorithm for finding the minimum Loo diameter for a k-point subset of a set of n points in the plane is described in [4] and runs in time 0(nlog2 n). Using the assumption that k > ~ this algorithm can be improved to run O(nlognlog(n - k)) time. They [4] used an O(nlogn) time algorithm for placing a fixed-size axis-aligned hypercube and then applied the technique of sorted matrices described in [5]. Actually, we need not keep all the 0(n2) distances along each coordinate axis in the matrix, but only O( (n - k )2) (points that will be used as boundaries). Searching over this matrix adds a factor of 0 (log ( n - k)) and not 0 (log n) as in [4].

References [1] Martin Aigner, Combinatorical search, \iViley-Teubner Series in CS, John Wiley and 1988.

Sons~

[2] A. Aggarwal, H. Imai, N. Katoh, S. Suri, Finding k points with minimum diameter and related problems~ Journal of algorithms, 12. 38-56, (1991). [3] A. Datta~ H.-P. Lenhof, C. Schwarz, M. Smid, Static and dynamic algorithms for k-point clustering problems, In Proc. 3rd Workshop Algorithms Data Struct., pp. 265-276. Lecture Notes in Computer Science, vo1.709. Springer-Verlag, New York, 1993. [4] D. Eppstein, J. Erickson, Iterated nearest neighbors and finding minimal polytopes, Discrete Comput. Geom., 11, 321-350, (1994). [5] G. Frederickson, D. Johnson, Generalized selection and ranking: sorted matrices, SIAM J. Comput. 13, 14-30, (1984).

25

FINDING THE SET OF ALL MINIMAL NESTED CONVEX POLYGONS (EXTENDED ABSTRACT)

J. Bhadury, University of New Brunswick, Fredericton, N.B., Canada R. Chandrasekaran, The University of Texas at Dallas, Richardson, TX, U.S.A. Abstract. Given two simple polygons Pm and Pout, with Pill completely contained in Pout) the Minimal Nested Polygon problem is to find a polygon p* that is completely contained in the annulus between Poat and Pm, contains Pm and has the minimum number of edges. Given Pm and Poat, there may be an infinite number of Minimal Nested Polygons. In this paper, we consider the case where Pm and PcnI1 are convex and have attempted to characterize the set of all Minimal Nested Polygons by giving two different algorithms. The first partitions the annulus into disjoint regions to identify all points in the annulus that can be assumed to be the vertex of some Minimal Nested Polygon. The second algorithm identifies those points that can be assumed to lie on some Minimal Nested Polygon. The time taken by the algorithms is O(nt), where n is the total number of edges in Pout and Pill and ~ is the number of edges in P*.

1

Introduction The Minimal Nested Polygon problem is defined as the following: given two simple polygons Pin and Pout, with Pin completely contained in Pout (Le. Pin C PouJ, find a nested polygon (Le. one that is contained in the annulus between Pin and Pout and contains the inner polygon PJ P*, that has the fewest number of edges. This problem has applications in robotics, collision avoidance, stock cutting etc. and is hence extensively studied - see [1],[2],[3],[5]. When p* is known to be non-convex, an D(n) time algorithm is given in [3] to find it, where n is me total number of edges of Pin and Pout. However if P* is known to be convex, the best algorithm is in [1], which takes O(nlog~) time, where.p is the number of edges in p* (for a characterization of when p* is convex see [4]). Given a pair of nested polygons Pout and Pin, p* is not unique (for example when Pout (respectively, Pm> is a large (respectively, small) triangle) - hence the question 'for a given pair of nested polygons Pin and Pout can the set of all Minimal Nested Polygons be characterized 1'. This is important in applications where alternate Minimal Nested Polygons are needed because of one being preferable to another. In this paper we have attempted to address this question in the case where Pin and POUt7 (and hence P*, by [4]) are convex. Two indices are first defined for every point in the annulus - the Polygon Index and the Turn Index respectively. Two algorithms are then given that identify all points in the annulus that can either be assumed to be the vertex of some P* or lying on some P*. The algorithms are shown to take O(n~) time. Preliminaries As mentioned before, Pout and Pin are assumed to be convex polygons, with Pin C Pout and the Minimal Nested Polygon for Pout and Pin is assumed to be P*. n is assumed to represent the total number of edges of Pin and Pout and ~, the total number of edges in P*. The entire annular region between Pout and Pin is referred to as the annulus and designated by [Pout-PuJ. The boundary of Pout (respectively, Pm> is referred to as bd(PouJ (respectively, bd(PJ) and (Pout-PJ refers to all the points that are in the interior of the annulus - Le. all points in [Pout-PJ except those on bd(PouJ and bd(Pm>. For two points x,y E [PoucPJ, [x -+ y] is assumed to represent a ray from x in the direction of y. Let x and y be two points on bd(PoJ, with the property that Pin is completely on one side of the line segment [x,y] and let z be any point on bd(PouJ that is on the same side of [x,y] as Pin. Then, in a clockwise traversal of bd(PouJ that begins at Z, if x is encountered after y, then x is said to be clockwise of y. Further, x is said to be atleast 2

26

clockwise of y if either x and y are coincident or if x is clockwise of y.

For any point v E [Pout-PJ, pry) is defined as a nested polygon that passes through v and has the minimum number of edges and T(v) as a nested polygon that has vasa vertex and has the minimum number of edges. (Ip(v) I (called the Polygon Index) and ~ T(v) [I (the Turn Index) denote the number of edges in pry) and T(v) respectively (obviously,l) T(v) ) > I pry) [I). For any point v E [POllCPml a clockwise greedy structure G(v) is defined, that is obtained as follows: (figure 1 shows G(a) for point a E bd(PoeJ): from v the clockwise tangent to Pin is drawn - this tangent is assumed to intersect bd(Pm> (or, in other words, is tangential to Pm> at a vertex denoted by Tgt(v) (in case it intersects two vertices, Tgt(v) is defined as the more clockwise of these ~o vertices). The point of intersection of the ray [v -oJ> Tgt(v)] with bd(PcuJ is defined as VI. From VI this process is Continued and successive points V2 ,V3 etc. (called the vertices of G(v) are defined on bd(pouJ similarly until that vertex of G(v) is reached where v becomes visible for the first time - it will be assumed throughout the paper that for any point V, this occurs on the JCh- vertex of G(v). Then another clockwise tangent is drawn from vk to Pin to obtain the next vertex of G(v) (i.e the point VA:+l) in a manner similar to the other vertices. The line segments [V,VI],[VhV2], .. [V,hVk+l] constitute G(v) - and these line segments are referred to as the edges of G(v). I G(v) I is used to denote the number of edges in G(v). If the sequence of anticlockwise tangents is taken from v, the resulting greedy structure is denoted by Giv). The point of intersection of the line segments [v,vt ] and [Vk,Vk+ l ] is denoted by Int(v). A point v E bd(PouJ is defined as a tight point if v = v4t • For such a tight point, G(v) is a closed polygon and is referred to as a tight greedy polygon for the tight point v. For any point v E [Pout-Pml, consider the anticlockwise tangent from v to Pin - the vertex of Pin that this anticlockwise tangent from V intersects is denoted by Atgt(v) - if it intersects two vertices, the more clockwise of these two is chosen as Atgt(v). Then the point of intersection of the ray [v -+ Atgt(v)] with bd(PauJ is denoted as Anti(v) - and since Pin C Pauh if v E bd(PouJ, v and Anti (v) will occur on different edges of bd(Pau;). For any point v E bd(PauJ with 11 G(v) [I = CP, the slack cone of v is defined as the entire region of the annulus bounded by the line segments [v,v4t-t1, [v,Anti(v)] and the section of bd(PauJ between Antl(v) and V4t-I (including these boundaries themselves). For example in figure 1, if II G(a) I = cp (and hence aJ; = a 4t-t ), then the slack cone of a is the triangle [a, Anti(a), aJ. Note that slack cone for a point v is only defined if v E bd(PoeJ and ~ G(v) I = CP. For a point v E [PoucPJ, the projector of v, denoted by Proj(v) is defined as the point of intersection of the ray [VI -+ v] with bd(PouJ - in figure 1, a is the projector of Int(a). For all v E bd(PauJ, Proj(v) = v. The following results are either known or easy to verify: (i) It is shown in [1] that for any v E bd(PouJ, c) s I G(v) II s ~+ 1. (ii) If v is a tight point then II G(v) ~ = CP. Further, since Pin C Pout, for a tight point v, VA: = v4t-1 = Anti(v) and v = VJ;+1 = v.o (iii) For any point v E bd(PouJ, [I G(v) II = cP+ 1 iff Anti (v) (respectively, v) is clockwise of V4t-1 (respectively, v.). (iv) For any point v E [Pout-PmJ, the edges [v,vl],[V.,v:z), .. ,[vb v] represents T(v). Hence II T(v) ~ = II G(v) II. Based on these, we now state the following results. Lemma 1: For any point v E [Pout-Pial, cP < [I G(v) II < C)+2 (hence, cP < II T(v) I < .+2). Lemma 2: For any point v E [Pout-PmJ, ~ < ~ pry) II s ~+ 1. Lemma 3: For any v E [Pout-Pial, IIp(v) I iff vis in the slack cone of a point x E bd(PouJ·

=. 27

2

Partitioning bd(pouJ Into Critical Intervals

Consider a point von bd(PoJ such that ~ G(v) I = 4)+ 1 (and hence v is clockwise of v~). As v is moved clockwise on bd(PouJ, along the edge of Pout that it lies on, all vertices and edges of G(v) move clockwise too - a direct consequence of the fact that bd(PouJ and bd(PuJ are continuous, and Pine Pout. During this movement of v, the following four events (heretofore referred to as events I through IV) that can occur will be of interest to us: (I) An edge of G(v) can encounter a new vertex of Pin. (II) A vertex of G(v) can encounter a new vertex of Pout· (llI) V can encounter the next vertex of Pout. (IV) V can encounter a tight point on bd(PauJ. We now give an algorithm to partition bd(Pom> into intervals that are "small" enough such that if the point v is restricted to move inside an interval, none of eve!1ts I through IV will occur. Algorithm Partition - bdfPwJ. 1. Every edge of Pin is extended to intersect with bd(Pout) and the two points of intersection are considered critical points. Every vertex of Pout is also considered a critical point. 2. For every critical point v found in Step 1 , find the greedy structures G(v} and Giv} and the vertices of these two structures for this critical point are also included as critical points - for each critical point v store the following: the value of k; the points Anti(v), Tgt(v} and Atgt(v); all the vertices of G(v) (including vk +,); the points Tgt(v), Atgt(v} and functions 6vld}, for 1 s j s k + 1. 3. The critical points obtained above in Steps 1 and 2 partition bd(Pout ) into disjoint intervals - for each interval do the following: check if there exists any tight point within this interval by checking if there is a solution to the quadratic vfd) = vofd) in this interval (there can be atmost 2 tight points per interval). If a tight point exists, then for this tight point v, draw the tight greedy polygon and this tight point and the vertices of its associated tight greedy polygon are also included as critical points. For each such tight point v, store all parameters in Step 2. 0

It can be shown that Partition-bd(PouJ, takes O(n4) time and produces a total of O(nt) critical points bd(PouJ that partition it into as many intervals (heretofore referred to as critical intervals) such that any two points within an interval have the same Turn Index. Further, note that a tight point v E bd(PouJ represents a 'crossing over' of the two points v and v~. Hence, if there exist two points x, y E bd(PouJ such that ~ G(x) II and ~ G(y) ~ are not equal, then there must exist atleast one tight point on the section of bd(PouJ between x and y. This leads to:

Corollary 4: After Algorithm Partition-bd(PouJ is over, for every critical interval [E,.F]. (i) If E is not a tight point then Tum Index in (E,F) = ~ G(E) ~. (ii) If Turn Index in the interval (E,F) is q; then it is guaranteed that ~ G(E) = ~ G(F) = 4).

I

I

3 PARTITIONING OF THE ANNuLus BASED ON II T(v) II Now we give a polynomial time algorithm based on lemma 1, to partition the annulus according to I T(v) II. The algorithm is based on the idea of moving a point v clockwise on bd(PouJ and tracing the locus of the point Int(v). 1. 2. 3.

Algorithm Partition - ~ T(v) ~ Find a p. and



Figure 2: A Reconstructed Orthogonal Polygon with Horizontal Stabs types of rectangles, as enumerated in figure 3, are possible, ignoring horizontal and vertically symmetric situations. It is assumed that those rectangles with stabs to infinity are completed by a pseudo side at infinity. This stage of the algorithm organizes the (horizontal) stabs into rectangles, and based on the type, identifies the convexity of the vertices.

Type 2

Type 1

Type 3

Type 4

Type 5

b- t=J ~-T1-~ ~:T-T--~ FT-T:~ Type 7

Type 8

Type 9

Type 10

Type 11

Type 6

k- - - - ...l..-L ->I !'ETT----~

Type 12

Figure 3: The Twelve Possible Horizontal Rectangles Notice that every stab is part of exactly two rectangles, one above and one below it. For the previously stated assumption of no collinear sides, there exists a unique top most side and a unique bottom most side, each of which partially bound degenerate rectangles. These will be called type o rectangles and are easily identifiable. Lemma 1 Aside from the two type 0 rectangles, rectangles of types 1 through 12 are the only possible rectangles created from the sides of an orthogonal polygon and its horizontal stabs.

Proof: The proof to this lemma is a combinatorial proof that considers the number of corners of the rectangles that correspond to the vertices of the polygon. See [Jac96] for details. 0 Identification of each of the types 0 through 11 rectangles requires checking constant time conditions. The list of conditions is lengthy, but straightforward and is omitted; two examples of the conditions are given below: 45

• A type 1 rectangle is identified when the horizontal stab of one vertex i and its neighbour on the Han:.iltonian cycle i + 1 are both to the same side. Thus i and i + 1 must have the same convexity. • A type 3 rectangle is identified when the stab of one vertex i and the stab of vertex i + 3 are to the same side, and vertices i + 1 and i + 2 form a vertical side. Thus, vertex i + 3 must have the same convexity as i, but i + 1 and i + 2 must have the opposite convexity of i. A type 12 rectangle is detectable when two pairs of vertices have common stabs. (That is, = stab[j + 1] and stab[i + 1] = stab[j] , assuming vertices (i and i + 1) and (j and j + 1) form horizontal sides). Detecting this type of rectangle will require examining all horizontal stabs to each vertical side. Since it is possible that O(n) stabs could hit one side, for example, it might appear that this operation could take O(n2 ) time. However, in section 2.2, a data structure is presented that reduces the overall time needed to identify all type 12 rectangles to O(nlogn) time in total.

stab[i]

2.1

Classify and Identify Rectangles: Types 0 to 11

This part of the algorithm walks along the Hamiltonian cycle of the polygon, checking each horizontal stab for inclusion as part of any type 0 through 11 rectangles. For each vertex, v, append the other vertices on the same rectangle to either its same[v] or opposite[v] set, and count the number of rectangles to which it has been assigned. • Initialize: For each vertex v, in Hamiltonian cycle order do:

number...bf -rectangles [v] := O. 2. initialize same[v] to the empty set. 3. initialize opposite[v] to the empty set. 1.

• Classify/Identify: For each vertex, v, in Hamiltonian cycle order do:

- if conditions 0 to 11 of section 2 are satisfied with vertex v:

* For every pair of vertices, j

and k, on the rectangle

1. increment number_0f -rectangles [j] 2. either INSERT(j, same[k]) or INSERT(j, opposite[k]) appropriatelyl Analysis: O(n) time and space is used. Note that every vertex is part of exactly three horizontal rectangles, each of which contains from two to four vertices of the polygon, the same and opposite sets for each vertex will together contain no more than twelve vertices. Now, label any vertex that has been assigned to three rectangles as classified and the rest as unclassified. The next section will use this classified/unclassified labelling to identify the type 12 rectangles.

2.2

Identify Rectangles: Type 12

A type 12 rectangle could be on either the inside or the outside of the polygon; there could be O(n) type 12 rectangles. Any vertex that is now unclassified must be part of some type 12 rectangle. The difficulty is identifying which other stabs are also part of this same rectangle; refer to figure 4. The stab S2 that is on the other end of the horizontal side from S1 can be identified in constant 1 This

is easily determined from figure 3

46

Figure 4: A Type 12 Rectangle

time, simply by looking at the stab of the next vertex on the Hamiltonian cycle. However, the two stabs S3 and S4 of the same rectangle are more difficult to find. For every adjacent pair of type 12 vertices (e.g., S1 S2 in figure 4) one vertex of the pair is included in a binary search tree of the vertical side stabbed by the other. When inserting into these binary trees, a vertex to be inserted that already exists in the tree was placed there by the other pair of type 12 vertices that stabbed the same vertical sides. This condition indicates that all four vertices of a type 12 rectangle have been identified.

• Initialize: For each vertical side, s, in Hamiltonian cycle order do: - unclassified_count[s] := O. - initialize binaryJree[s] to empty. • Count stabs: For each vertex, v, in Hamiltonian cycle order do: - If (number -of_rectangles [v]

= 2 ) increment unclassified_count[stab[v]].

• Create Trees: For each vertex, v, in Hamiltonian cycle order do:

*

= 2) AND

(number _of _rectangles [v + 1] if (unclassified-eount[stab[v]] < unclassified_count[stab[v + 1]]) . least-stabbed:= stab[v] ; most-stabbed := stab[v + 1]

- if (number...of _rectangles [v]

= 2)

* else . least-stabbed:= stab[v + 1] ; most-stabbed := stab[v] - if (MEMBER(most-stabbed, binary_tree[least-stabbedJ))

* /* a type 12 rectangle has been found. */ * For every pair of vertices, j and k, on the rectangle: IN SERT(j, same[k]) * D ELET E(most-stabbed, binary_tree[v]) - else INSERT(most-stabbed, binary_tree[least-stabbed]). Analysis: The initialize and count stabs loops are each O(n) loops. The create trees loop is an So, the overall time needed by this part of the algorithm is 0 (n log n). However the space required here is only Oen), since the number of entries in all the binary trees never exceeds n.

o (n log n) loop.

2.3

Determine Convexity of Vertices

This stage of the algorithm starts with any vertex, v, that has a stab to infinity, marks it as CONVEX, and initializes a queue (called to_be_done) with this vertex. Then a loop is created that dequeues a vertex, v, from the front of the queue, marks the vertices in same[v] as the same convexity as v, and those in opposite[v] as opposite to v. For each of these vertices, if they were not previously marked, enqueue them to the back of the queue. The loop continues until the to_be_done queue is empty. The algorithm is straightforward and the pseudo-code is omitted. 47

Analysis: Each vertex is put onto the queue once, and pulled off once and a constant amount of work is done for each vertex. Therefore, this stage of the algorithm uses O(n) time. Thus, the time used to determine whether each vertex of an orthogonal polygon of n vertices is CONVEX or REFLEX is dominated by the O(n logn) needed to identify the type 12 rectangles. The space requirement is only 0 (n).

3

Layout Algorithm

In this section, an efficient algorithm is presented to reconstruct an orthogonal polygon from its stabs and Hamiltonian cycle, after the convexity of the vertices is established. This algorithm creates two lists, representing the relationships between the x and Y coordinates of all vertices. One list {Xmin, ... x max } represents the x coordinates of each of the vertical sides, the other list {Ymin, ·.·Ymaz} represents the Y coordinates of the horizontal sides. The lists are not unique since it is not possible to determine the relationships between the stabs on opposite sides of any boundary segment. 1. Find the four segments with both horizontal and vertical stabs to infinity. The two vertical ones must be located at Xmin = 1 and x max n/2, while the two horizontal ones must be at Ymin 1 and Ymax n/2. Completion of this step requires O(n) time.

=

=

2. The segment that runs horizontally along Ymin is laid out from right to left. Call this a left segment. The next segment on the Hamiltonian cycle, a vertical segment, must be an up segment, and the corner between the two must be a convex corner. Name the sides of the polygon hI, VI, h2, V2, ... h n j2, Vnj2 along the Hamiltonian cycle. For a horizontal (respectively vertical) segment, define its predecessor segment to be the horizontal (respectively vertical) segment immediately before it on the Hamiltonian cycle. (hi'S predecessor is hi-I, and vj's predecessor is Vj-I.) On any segment, vertical or horizontal, define its two preceding vertices to be the two vertices between hi and hi-lor between Vi and Vi-I' Figure 5 shows a horizontal segment and a vertical segment and their respective

~

vi's

predecessor

U y

predecessor

Vi X

Figure 5: Predecessor Segments and Preceding Vertices predecessor segments. In each case, vertices x and yare the preceding vertices to the segment. For each of the remaining segments, in the cycle, if the preceding vertices have the same convexity, the segment must be opposite its predecessor segment, in the same dimension. If the preceding vertices have opposite convexity, the segment is the same as its predecessor segment, in the same dimension. In this way, assign up/down, left/right to each segment of the polygon. Again, this step uses a total of O(n) time and space. 3. Create two digraphs, X and Y (representing the two partial orders of the sides of P), with a node in the X graph for each vertical side, and a node in the Y graph for each horizontal side. Add arcs as follows: • On the X graph, direct arcs from the node corresponding to the Xmin side to every other node, and from all nodes to the node corresponding the Xmax side. 48

• For. every right (respectively left) segment in the polygon, put an arc in the X digraph from the node corresponding to the side containing the first (respectively second) endpoint to the node corresponding to the side containing the second (respectively first) endpoint . • For every stab to a right (respectively left) segment put an arc from the node corresponding to the side containing the first (respectively second) endpoint of the stabbed segment, to the node corresponding to the side containing the endpoints of the stabbing segment, and another from the node corresponding to the side containing the endpoints of the stabbing segment to the node corresponding to the side containing the second (respectively first) endpoint of the stabbed segment. The X digraph contains less than 5n/2 - 2 = O(n) arcs. The arcs for the Y digraph are created in a similar fashion, substituting up for right and down for left. Creating the two digraphs uses a total of 0 (n) time and space. 4. Topologically sort each digraph to order the nodes from minimum to maximum in O(n) time. 5. Assign x and y integer track numbers (unique integers chosen from the range [1..n/2]) to the nodes indexed according to the previous topological sorts. Follow through the Hamiltonian cycle laying each vertex on its respective tracks, putting a segment between each pair of consecutive vertices. The resulting orthogonal polygon respects the given Hamiltonian cycle and stabs and has no collinear sides. This step, also uses O(n) time. Thus the layout algorithm uses O(n) time and space.

4

Conclusion

Overall, the algorithm reconstructs an orthogonal polygon in O(n logn) time and O(n) space. An interesting open problem is to reduce the time to classify type 12 rectangles (and hence the overall algorithm) to O(n), or alternately to show a lower bound of Q(n logn).

References [CL91]

C. Coullard and A. Lubiw. Distance visibility graphs. In Proceedings of the seventh Annual A CM Symposium on Computational Geometry, pages 289-296, 1991.

[Eve90] H. Everett. Visibility Graph Recognition. PhD thesis, University of Toronto, Department of Computer Science, January 1990. [Jac96] L. Jackson. Polygon reconstruction from visibility information. Master's thesis, University Lethbridge, April 1996. [O'R87] J. O'Rourke. Art Gallery Theorems and Algorithms. Oxford University Press, New York, NY, 1987. [Wis85] S. K. Wismath. Characterizing bar line-of-sight graphs. In Proceedings of the first Annual ACM Symposium on Computational Geometry, pages 147-152, 1985. [Wis94] S. K. Wismath. Reconstruction of parallel line segments from endpoint visibility information. In Proceedings sixth Canadian Conference on Computational Geometry, pages 369-373, 1994.

49

CORRECTING TOPOLOGICAL DEFECTS OF TESSELLATIONS Dong Wang, John A. Goldak Department of Mechanical and Aerospace Engineering Carleton University, Ottawa, Canada KlS 5B6 April 26, 1996

Abstract In automation of geometric modelling in industry, models of solids are often converted to collections of oriented triangles. Each triangle is described by the coordinates of three vertices and an outward normal vector. The topology is discarded. For many applications it is useful to reconstruct the topology of the boundary of a real solid as an oriented two-manifold. This poses three types of difficulties. First because of the finite precision, the coordinates of matching vertices in two triangles may not be equal. If a tolerance is assumed that is small compared to the shortest triangle edge, coordinates can be matched. A more serious problem is that many CAD systems produce collections of triangles that do not match. They often contain topological defects such as non-manifold edges. An algorithm is presented that has successfully transformed non-manifold edges into oriented two manifolds for most cases encountered to date.

1. Introduction Geometric modeling technology, which has developed rapidly since 1970, plays a central role in industrial CAD [5] . Solid modelers have complex data structures that are usually proprietary to the computer code used to generate them and therefore are secret. There complexity and secrecy makes it difficult to exchange data between different solid modelers. One of the easiest ways to overcome the difficulties of data exchange between solid modelers is to create a simple boundary representation (BRep) of a tessellation that covers the surface of the solid with planar triangles. In this paper, an STL tessellation of a BRep approximates a partition of a 2-manifold into triangles. It has a simple data structure. Each triangle is described by an outward normal and the coordinates of three ordered points. Some industrial and research applications begin their solid modeling with

50

such files that contain the information describing the boundary of the solid model. Typical industrial tessellations can have several hundreds of thousands of triangles. One difficulty that arises with this representation is that most current solid models do not create topologically correct tessellations. In order to use these tessellations as the definition of the geometry of a real solid part for other processes, such as Finite Element Method (FEM) mesh generation, it may be necessary to have a mathematically correct oriented 2-manifold. In such cases it is necessary to correct the topological defects in the tessellation of solid models in these files. The automation of solid modeling from initial BRep to the final meshing of the solid model continues to be an important research goal. Many research papers discuss how to build correct, complete and efficient BRep models [5][6] . However, because the solid modeling itself is complicated or because the defects of tessellation can vary in many ways, few papers study the issue of detecting and correcting topological defects. One of our aims is to help to fill this gap. The major areas of research covered in this paper include identifying topological defects, classifying topological defects and correcting topological defects automatically if feasible and with the help of a graphical user interface (GUI) when necessary. However, due to the length of the paper, only one of the most difficult aspects: resolving high degree non-manifold edges is discussed in detail.

2. Two-Manifold BRep There are two mathematical theories that define the modeling space for solid modeling: point-set topology and algebraic topology [3][4] . Point-set topology stresses the three-dimensional solidity of a mathematical object while the algebraic topology stresses the bounding surface of a mathematical object.

In point-set topology, a solid is defined as a bounded, closed subset of E3. The solid should remain invariant under a rigid transformation such as translation or rotation. All shapes that can be formed from stretching an infinitely elastic sphere without tearing or ripping form a topologically equivalent class. The topological transformation gives a hint that a solid model with some topological defects can be corrected mainly by topological information. A bounded regular set is termed an r-set. This definition of regularization describes the interior of a point set, i.e., forms an open set, then covers it completely with a tight skin. This means that it will not contain isolated points, isolated lines, isolated faces or missing points, lines or faces. The boundary should also be sufficiently smooth, e.g., Lipschitz, in order to be modeled. Real solids do have quite smooth boundaries. Manifold (2-manifold) BRep based solid modeling topology representations are the basis of some of the most popular forms of solid modeling representations used today. A 2-manifold M is a topological space where every point has a neighborhood topologically equivalent to an open disk of E2, which is the same as saying that every point has a neighborhood which is homeomorphic to R2. The BRep model in this paper is defined to be a 2-manifold with triangular tessellation. There is an inherent theoretical mismatch between r-set models and 2-manifold models: not all r-sets are realizations of some 2-manifolds. The problem with such objects is that a surface can "touch" itself at a point or on a curve segment. The neighborhoods of such points are not homeomorphic to an open disk in E2. These problems can be resolved by separating the touching surfaces. This is accomplished by duplicating the nodes with the same coordinates but a different node identity. Hence, the object would be represented as the rigid combination of two or more components that are separated topologically but still touch each other at a geometrical point. There are 2-manifolds that do not have physical counterparts in E 3 , i.e., that cannot be constructed in three-dimensional space at all, and are hence not the boundaries of any r-set. The I(lein bottle is an example. Also a correct 2-manifold should obey Mobius' Rule that requires the faces of the BRep to be consistently oriented in E3. Another characteristic of a BRep of a solid is the Euler characteristic. It states that: for a surface S of an r-set, the sum v - e + I, where v, e, f stand for the numbers of vertices, edges and faces respectively, is a constant independent of the manner in which the surface S is partitioned and independent of any oper-

51

ation on the surface, provided that the surfaces before and after the operation are topologically equivalent. Usually this does not help in correcting topological defects. Based on the discussion above, we can defined atopalogically correct 2-manifold BRep model using planar triangles to be one that satisfies: 1. Each edge's degree is two, which means that

each edge is only adjacent to two polygon faces. 2. Each vertex has only one open disk. 3. The face normal of each polygon is directed outward from the r-set. 4. A solid could be a union of one or more 2-

manifolds. 5. Faces of the model do not intersect each other except at common vertices or edges.

3. Identification and Classification of

Topological Defects

It is assumed that topological defects in tessellations can be arbitrarily complex. Therefore our objective is to correct automatically those defects that occur most frequently in a set of real STL files that have been provided by industry[2]. As an r-set can be a union of several sub-r-sets, the checking can be carried out on each separate set of connected face elements, each of which is adjacent to other face elements in the same set at least at one edge. The sets of connected triangles can be easily found by face flood filling[l]. Geometric information can also be calculated for each separate r-set, such as the bounding-box, the volume of the set, the average area of the face, the average edge length for certain sets of edges. All the information including that pertaining to the topological defects will be used to correct the topological defects in the BRep. The GUI should be used to check for connections between separate sets since global information about the BRep is needed. If the BRep is reasonably behaved, a single r-set will be one set of connected face elements. Our attention will focus on checking each set of connected face elements. It is possible to identify most topological defects by checking if every edge in the model is degree two (the degree of an edge in this paper represents the number of faces that are adjacent to this edge). This test will detect objects with missing surfaces or that are joined together. Missing surfaces will introduce open loops edges which are odd degree edges caused by missing faces adjacent to these edges. The open loop edges

form loops and the loops can further form loops. In most cases, open loop edges are degree one edges. The open loop edges can be fixed by separating open loops into single open loops and adding the missing faces or by merging the nodes on each of the single open loops. High degree edges are introduced by touching of the surfaces at the edges or by dangling undesired faces or bodies at these edges. They can be further classified into two categories: odd high degree edges and even high degree edges. High degree edges cannot be simply resolved by duplicating edges since it is also necessary to check which faces should be adjacent to which edges. Otherwise the correct adjacency of the faces may not be guaranteed which could exacerbate face intersection or even result in a Klein Bottle, which has no physical counterpart in 3D. The criteria that each edge should be adjacent to two faces will miss at least three kinds of topological defects: wrong orientation edges exist when there are some patches - sets of faces - that are oriented differently, such that for each pair of faces along the boundaries of these sets, one is facing outward while the other is facing inward from the solid body. This problem can be identified by checking the paired faces adjacent to each edge in a tessellation to see if they have opposite orientation along the edge. For a correct edge, the edge adjacent faces should have the opposite orientation relative to the edge; while for an incorrect edge, the edge adjacent faces have the same orientation with respect to the edge. Wrong orientation edges will form loops, so that the incorrectly oriented faces can be collected by face flood filling bounded by the loops. The second case of topologically defects that cannot be detected using the criteria above is the one where the surfaces touch at points. Often, the points that are touching can be separated without effort: reproduce the joining nodes two or more times and separate them along with their open disks such that after separation, each node will only have one open disk. For some cases, this kind of topological defect will not have any negative impact on other processes such as mesh generation which is based on the assumption that the surface of the part is topologically correct. The third and perhaps the worst type of topological defect that cannot be detected by the above criteria above is exemplified by the Klein Bottle. This kind of topological defect cannot be corrected unless the associated geometric information is also corrected. This involves the very costly check of face intersection which is usually several orders of magnitude more expensive than pure topological checking[l]. It may be

52

necessary for the user to rebuild the local geometry and topology in the G UI. The detection of the intersecting triangles is necessary before the user can correct the defects. From the above analysis, we can see that the topological defects can be identified mainly by identifying the non-manifold edges in the part. If the part passes this test, further tests will include checking the number of open disks for each vertex on the part and face intersections in the tessellation. There are maybe other defects, such as duplicate faces and ill-shaped faces, such as two nodes in a triangle element have the same coordinates.

4. Resolving High Degree Non-Manifold Edges Fixing open loops involves more geometric information and can include high degree edges[l]. Therefore, a quite logical and practical strategy is to resolve the high degree edges first which will leave only non-manifold edges of degree one to be fixed later. Resolving the high degree edges will be carried out sequentially in each set of connected non-manifold edges. From a topological point of view, there is sufficient information in each set of non-manifold edges and their connected face elements to resolve the high degree edges for a real solid. The main steps to resolve the high degree edges include: 1.

Finding all of the non-manifold edges in the part;

2. Do edge flood filling by the adjacency of con-

necting nodes to find connected sets of nonmanifold edges; 3. Checking each set of connected non-manifold

edges to see if there are high degree nonmanifold edges in the set; 4. If there are, resolve the high degree edges in the set. This divides the tasks into manageable portions and also makes recursive operations more efficient. As in some cases, some of the geometric information or topological information is missing or incorrect, resolving the high degree edges in a set of connected nonmanifold edges is one of the most difficult challenges in this research. Solving this creates non-manifold degree one edges which can be much easier to fix. All the available topological and geometric information may have to be used to perform this task correctly. Often, cases of high degree edges are very complex. The degrees of high degree edges can he odd or even.

In the odd high degree cases, there must exist miss- branches of a tree (graph) of high degree edges, but it ing or additional face elements adjacent to the edge. is also possible to begin with any node on high degree In the even degree cases, there might also exist miss- edges. ing or additional faces, but the number of missing or additional faces should be an even number, which makes these cases rare. The high degree edges may not all be separate edges. They can form links, loops, trees and more general graphs.

Figure 3: Separating open disks of the high degree edges.

Figure 1: High degree edges can form links, loops, trees and more general graphs. The thickness represents the edge degrees. To resolve a high degree edge will depend strongly upon the local topological and geometric information. In a valid tessellation, both kinds of information are consistent. In a invalid tessellation, one or both kinds of information might be incorrect or incomplete. In the following steps, a complex problem is broken down into sub-problems and each subproblem is dealt with separately. For a connected set of connected non-manifold edges that include high degree edges, all the high degree edges can be collected. As the degree of a nonmanifold edge is directly associated with the number of open disks that its end nodes have, it can be seen that for a high degree edge, each of its end nodes will have at least two open disks. To resolve a high degree edge, either or both of the end nodes should be separated from the original nodes. In order to separate a node from the original node, the new node must find all the face elements in its open disk. Separating the face elements without regard for this requirement can result in an incorrect topology (see Figure 2).

Figure 2: An incorrectly separated open disk. As it has been discussed earlier, the high degree edges

will form links, loops, trees or more general graphs and they cut the open disks into several pieces. It is easier to solve if the separation begins at the ends of

53

For a set of non-manifold edges with high degree edges, the high degree edges in the set can be resolved recursively. This can begin by separating the open disks from the easiest node - the node that has the fewest high degree edges in the set such that the open disks of this node are being cut the least by the high degree edges. Often the node will be connected to only one high degree edge. As the separation proceeds, the number of high degree edges in the set and also the degrees of the high degree edges will decline. At the same time, the data structure of the set of non-manifold edges and the data structure of the part should be updated. When all the high degree edges in the set have been resolved the processing of this set will terminate. Now the key problem is to resolve a node with several open disks. How to find the complete open disks for the node is the main problem, since as soon as a complete open disk is extracted from the face elements of the node, a new node can be generated with the same coordinates (but with a different topological neighborhood) and then the open disk with the new node can be separated from the original node. By doing so, the related high degree edges will reduce their degrees by one ( see Figure 3). Since the high degree edges will cut the open disks into several pieces, a face element flood filling by edge adjacency but not adjacency of the non-manifold edge, in the connected set of non-degree two non-manifold edges to form connected sets of elements called necklaces of the node. These necklaces are parts of open disks or complete open disks bounded by the high degree edges (see Figure 4). In Figure 4, let's assume that open disk abed belongs to a part of a surface, open disk efgh belongs to another part of a surface, face aoe and face goi are topological defects. Because of face aoe and face goi, edge 30, eo and ggo are degree three edges, edge gi and edge io are degree one edges. The high degrees

Figure 4: Combining necklaces to form open disks. eo and go cut open disk efgh into necklace efg and ghe while on the other hand, the even high degree

node orientations. If the ordering result is a circular list (+,-,+,-,+,-, ... , +, -) then the order is defined to be valid (see Figure 5). If the order is valid, then each triangle can find its paired triangle by searching in the opposite direction of its face normal and the necklaces can be combined in pairs. If the two face elements in pair are in one necklace already, they are already combined. Otherwise the necklaces in which the paired face elements are separated will be combined into one necklace. The same process can continue until one complete open disk has been formed. In cases where some face elements are missing, (which means in Figure 5 some faces would be missing,) the ordering results will not be complete, but valid pairs might still be found provided there are no face elements inside the solid body of other paired face elements. The ordering results will be combined with the local topological information to judge if the pairing is valid. If the pairing is valid, the paired face elements can be combined to further form complete open disks. In our research, no cases have not been resolved by this procedure. Often, success at one node can lead to resolving the whole set of connected high degree edges adjacent to this node. If high degree edges remains that cannot be resolved by the above procedure, the set of non-manifold edges that contains these high degree edges will be sent to the G Ul for correction by the user_After the high degree non-manifold edges have been resolved, the remaining non-manifold edges are much easier to be fixed[l].

edge ao cuts the open disk abed. Open disk abed is still complete. It can be separated without effort. Separating open disk abed can simplify the situation: after open disk abed has been separated, face aoe and goi can be considered as dangling faces, they can be removed easily. In some complicated cases, no open disks can be extracted easily. For example, if there is a topological defect face goe, then open disk abed is separated into two necklaces. The following steps can combine the paired faces to form complete open disks. So far, no geometric information has been used to resolve the high degree edges. From the definition of a necklace we can know that its boundaries are high degree non-manifold edges. If the two boundaries of a necklace are actually one high degree edge, the necklace is a complete open disk and can be separated. In most cases, the necklaces are not complete open disks at all. In such cases, two or more necklaces should be connected to form a complete open disk. Then one must find the correct pair of face elements on the boundaries of the necklaces. 5. Conclusions The problem of pairing can be solved by searching for the face element that will form a valid solid with an- Based on the results of the study of identifying and other face element, both of which are adjacent to the correcting topological defects described in this paper, boundary high degree edge. Geometric information the following conclusions can be drawn: plays a very important role in this case. • The topological defects can be identified and classified by examination of non-manifold edges and vertices in the solid models and the intersections of face elements in the tessellation.

-~. •

+

Figure 5: Radially ordering the faces around a hight degree edge and then separate the pairs. Figure 5 shows the pairing process. To combine the necklaces of a node, first the high degree edges adjacent to the node are found, and then the triangles around each of these high degree edges will be radially ordered according to their face normals and their

54

• The topological defects can be classified into non-manifold vertices, open loops, high degree edges, wrong orientation edges and intersecting face elements. • Most of the topological defects can be corrected by a systematic approach which can include several clearly isolated components. • A GUI can be very useful to enable the user to check and correct topological defects that cannot be corrected automatically_

The method described in this paper mainly depends on topological and geometric information on the boundary of solid models. During the course of study it has been found that certain aspects of topological defects which maybe difficult to correct by the algorithms given in this paper may be easier to correct by meshing the solid model first which may supply information not only about the topology of the boundary but also the topology of the volume of the solid model. Further research should be carried out on this aspect. As the scope of this paper dealt mainly with topological defects, geometric defects such as removing zero area faces and improving the tessellation are not discussed in depth in this paper.

6. References 1. Dong Wang, Oorrecting Topological Defects in Tessellations, M.Eng Thesis, Carleton University, 1995 2. M. N. Dai, Automating the Analysis of Oomplex Physical Systems - The Virtual Foundry, Ph.D Thesis, Carleton University, August, 1994 3. Martti Mintyli, An Introduction to Solid Modeling, Computer Science Press, 1988, T385.M363, ISBN 088175-108-1 4. J. Mayer, Algebraic Topology. Prentice-Hall, Englewood Cliffs, New Jersey, 1972, QA612.M39, ISBN :0130220531 5. A. A. G. Requicha, Representations of solid objects - theory, methods, and systems. AOM Oomputing Surveys, 12(4):437-464, Dec. 1980 6. Kevin J. Weiler, Topological Structures for Geometric Modelling, Ph.D. thesis, Resselaer Polytechnic Institute, Tory, New York, 12180-3590, August, 1988.

55

Generating Rooted Triangulations with Minimum Degree Four (An extended abstract.) David Avis and Chiu Ming Kong School of Computer Science McGill University, Montreal {avis,min}~cs.mcgill.ca

1

Introduction

A graph is a triangulation if it is planar and every face is a triangle. A triangulation is rooted if the external triangular face is labelled. Two rooted triangulations with the same external face labels are isomorphic if their internal vertices can be labelled so that both triangulations have identical edge lists. In this article, we show that in the set of rooted triangulations on n points with minimum degree four, there exists a target triangulation E~ such that any other triangulation En :I E~ in the set can be transformed to E~ via a finite sequence of single and double diagonal transformations. Using this result with the reverse search technique, we present an algorithm for generating all non-isomorphic rooted triangulations on n points with minimum degree four. The triangulations are produced without repetitions in O(n2 ) time per triangulation. The algorithm uses O(n) space.

2 2.1

Background Maximal Planar Graphs and Diagonal Transformation

A simple planar graph is maximal planar if and only if it is triangulated. Hence a triangulation of a set of points in the plane is a maximal planar graph. In a maximal planar graph(MPG) G = (V, E), lEI = 31VI - 6. An edge in a triangulation is external if it is contained in exactly one triangle (not the external face) of the triangulation. The vertices of the external edges are external vertices. Vertices that are not external are internal vertices. An edge in a triangulation is internal if it is contained in exactly two triangles (neither is the external face) of the triangulation. Such an edge bounds the two triangles. The objects we want to generate are rooted triangulations with minimum degree four on n points (given n), which, hereafter, will be referred to as rooted maximal planar graphs with mjnimum degree four (rooted MPG4). In a maximal planar graph G, let Aabc and Aabd be two adjoining triangular faces. The edges of these faces form a quadrangle acbd with the diagonal (a, b). When this diagonal is replaced by (c, d), one obtains a new maximal planar graph G' with the same vertices and the same number of edges and faces. We say that G' has been obtained from G by a diagonal transformation or a diagonal flip. This is possible only if (c, d) is not an edge in G already. Additional details may be found in [4, 6].

2.2

Reverse Search Essentials

The reverse search method is developed by Avis and Fukuda [2]. It was used to generate all rooted triangulations (without degree constraint) by Avis [1] and dually to generate all 3-polytopes by Deza et al [3]. It is a technique for generating all vertices of a graph whose edges are given implicitly by an oracle. Let H = (T, U) be such a graph. In our application, each vertex in T corresponds to a rooted MPG4 with given n. U is the edge set of adjacent vertices in T. Two rooted MPG4 are adjacent if they differ by one edge or two edges. The method works by finding a spanning tree in the graph H. To do this we first fix some given rooted MPG4 with the required parameter n. Call the vertex in H corresponding to this triangulation the target E~. We then define a local search function L, that given any vertex En of H defines a unique adjacent vertex in H, with the property that repeated application of L defines a path in H to the target. In

56

Figure 1: Reverse search tree of rooted MPG4 for n = 8 other words, (En, L(En)) is an edge in U and Lk(En } = E; for some finite integer k. The path generated consists of a sequence of rooted MPG4 (for given n) that differ in one edge or two edges and ends with the target MPG4. The set of all such paths form a spanning tree called the reverse search tree in H. Figure 1 shows the reverse search tree of rooted MPG4 for n = 8. The local search function is described in section 4. The arrows show the traces of applications of the local search function. The bold-faced edges are those on which diagonal flips are performed. The reverse search procedure is essentially a depth first search. It is initiated at the target E; and traverses the reverse search tree of H by reversing the local search function. To do this we generate all neighbours in H of any given vertex En in T, in some given order. This is done by an adjacency oracle. Using the adjacency oracle at E~ we consider neighbours of E; until we find a neighbour En such that L(En) = E~. We then replace E; by En and use the adjacency oracle to find (if possible) a neighbour E~ of En such that L(E~} = En. H such a vertex exists we move to E~ and continue. H we reach a node En for which no such neighbour exists, we backtrack by computing the parent E~ = L(En) of En. We then continue from E~ using the adjacency oracle to give the next neighbour of E~ in the order after En. Hence it is necessary to specify: • the target MPG4, • the local search function, and • the adjacency oracle.

57

3

Target Triangulation

Let En be a rooted MPG4 with vertex set {Vb V2, ... , vn }. All rooted MPG4 mentioned hereafter are assumed to be rooted at {VI, V2, vg}. To avoid the trivial case we assume n > 6. Let d( v) denote the degree of vertex v. The target triangulation for n > 6 is a stand holding a gem as shown in figure 2. It is the unique rooted triangulation with degree VI sequence:

E:

4

Local Search

In general, given a rooted MPG4 En :f:. E:, we first build the stand by reducing d( V2) and d(Vg) to 4, and then reduce the degrees of the v3 vertices in the horizontal "chain" in the gem to 4, working from right v2 to left along the " chain" . Figure 2: Target Triangulation We say that a vertex v has consecutive neighbours UI, U2, ... , Urn if these neighbours occur in consecutive counterclockwise order in the unique planar embedding of the triangulation. An edge is said to be 1-flippable if and only if it is internal and a diagonal transformation can be performed on it without destroying the minimum-degree-4 property of the triangulation. Two edges are said to be 2-flippable if and only if they are internal and a diagonal transformation can be performed on each of them simultaneously without destroying the minimum-degree-4 property of the triangulation. The following lemmas describe some properties of MPG4, which motivate our Local Search function. Lemma 4.1 Let s be a vertex in a MPG4 such that d(s) ~ 5. Suppose s has five consecutive neighbours Ub U2, Us, U4, Us such that UI is external, and U2, Us, U4 are internal. Then either d( { U2, U3, U4}) ~ 5, or there exists a vertex t E N2(S) N(uj).

n;=l

= m ~ 5. Suppose s has consecutive neighbours such that Ul is external, and U2, U3, .. ·, Urn-l are internal. If d(U2) = d(us) = ... = d(U rn -2) = 4 and d(Um-l) ~ 5, then either there exists a vertex t E N2(s) n~~l N(uj) such that d(t) ~ 5, or (u}, um-d is l-ftippable. Further, (s, Urn-I) is l-fiippable.

Lemma 4.2 Let s be a vertex in a MPG4 such that d(s) UI, U2, Ug, ..• , Urn-I, urn

Lemma 4.3 Let s be a vertex in a MPG4 such that d(s) ~ 5. Suppose s has four consecutive neighbours u}, U2, Us, U4 such that U2, Us are internal, and d(U2) ~ 5. Then either (8, U2) is l-fiippable, or (8, Us) is l-ftippable. Further, if (s, U2) is not l-ftippable, then d(ud ~ 5. Lemma 4.4 Let 8 be a vertex in a MPG4 such that d(s) ~ 5. Suppose s has four consecutive neighbours Ul,U2,US,U4 such that Ul is external, U2,U3,U4 are internal, and d(U2) = d(u3) = 4. Let t ::f: s be the common neighbour oful,u2,us,u4,and d(t) ~ 5. Then (S,U2) and (t,us) are 2-ftippable.

Figure 3: illustrating the local search function

58

Before presenting the Local Search function, let us illustrate it with an example. The idea is to compare first, the degrees of vertices V2 and V3 to their corresponding degrees in the target, and then the degrees of vertices along the horizontal "chain" in the gem to their corresponding degrees in the target, starting with the vertex adjacent to VI and V3, and examine the neighbours of VI in clockwise order. Figure 3 shows an example with n = 11. EI has d(vs) = 5. Since d(t) < 5, we apply Lemma 4.2 and flip (VI,U4) to get E2. In E2, d(vs) is still> 4. We can apply Lemmas 4.2 and 4.4, flip (V3,U2) and (t,U3) to get ES. We see that des) = 5 in ES. Again we can apply Lemmas 4.2 and 4.4, flip (S,U2) and (t,us) and then reach our target EiI ' Figure 4 shows the pseudo code for the Local Search function LocalSearch. In our notation, deg(v) denotes d( v), and v [i] , u [j] denote vertices Vi and Uj respectively. Hereafter, "application" of the function implies the diagonal transformation follows on the returned edge(s). The next theorem shows that repeated application of the function leads any rooted MPG4 to the target. Theorem 4.1

i. Edges returned by LocalSearch are either l-ft,ippable or 2-ft,ippable. ii. Successive application of LocalSearch transforms any rooted MPG4 En(n 2:: 6 and En target MPG4 E~.

i=

E~)

to the

Sketch of proof: For part i, we use the lemmas. Whenever two edges are returned, we apply Lemmas 4.2 and 4.4. Whenever (Vi,Uj), (Vi,Uj+I), (s,Uj) or (S,Uj+I) is returned, we apply Lemma 4.3. Whenever (Vi, urn-d or (UI' Urn-I) is returned, we apply Lemma 4.2. In all cases, s in the lemmas will be the vertex Vi or s in LocalSearch. By the lemmas, the returned edges are either I-flippable or 2-flippable. Hence, we have shown that application of LocalSearch on any rooted MPG4 always results in another rooted MPG4 (for given n). For part ii: for 2 :5 i :5 3, the algorithm reduces d(Vi) by one, by returning a I-flippable edge incident to Vi; or it returns some edge, flipping which leads to another MPG4, on which subsequent application of LocalSearch returns a I-flippable edge incident to Vi, hence reducing d(Vi) by one. We need to show that the process of reducing d( V3) does not increase d( V2). This can be verified by going through all the cases. When d(v2) and d(vs) reach 4, the algorithm works on the vertices that are internal neighbours of VI in clockwise order. We have to show that, when s= the vertex adjacent to Vl and V3, and lasts =Vs, the process of reducing d(s) does not increase d(lasts) or d(V2)' Again this can be verified by going through all the cases. By the structure of the target triangulation we defined, the above argument applies to subsequent s's for lasts i= Va as well, since we can assume that previous lasts's are erased from the graph and this part will not be affected by the algorithm anymore. The process stops once the degrees of the vertices match their counterparts in the target, and so the algorithm is finite. 0

5

Adjacency Oracle

Suppose En has its edges indexed from 1 to 3n - 6, and let el, e2, es be the 3 external edges. The edges are stored in some ordered edge list En {el' e2, ... , e3n-6}. Suppose a single diagonal flip is performed on some internal edge e. The new edge e' is well defined and need not be specified explicitly. The operation is: fliPI (En, e) = En - e + e' . We know that not only a single diagonal flip, but two simultaneous diagonal flips can also define adjacency. Suppose a double diagonal flip is performed. The two edges flipped must be the two pairs of opposite sides of some quadrangle in the triangulation. Each quadrangle is defined by one internal edge in the triangulation. Hence for each internal edge in the triangulation, we also consider two pairs of edges. We can define the adjacency oracle which gives all adjacent rooted MPG4 to a given rooted MPG4 En as follows:

=

59

LocalSearch(E,n)

II

returns one(or two) flippable edge(s) or (-1) if E==target

II reduce deg(v[2]) and deg(v[3]) to 4 i=2; while (deg(v[i])==4 && i p we can derive a O(nlogp)-time algorithm by choosing c* = p and stopping the iterative process as soon as we have computed i = min{c*,p} stabbing points. Note that our algorithm works in time O( n log c·) if c· :5 c* < c· 2 • Since we do not know c· beforehand we iteratively estimate it by squaring our current estimate. We start with any arbisay c* = 2, and s_luar~ it until c* ~ c*. trary value for Thus, we obtain an O(EI:glogc n2\) = O(nlogc*) time algorithm. More details can be found in [Nie96]. Since verifying, if among n numbers, k are distinct requires O( n log k) time on the real RAM [KS86), it follows that this lower bound also holds for the stabbing problem by reduction in linear time. Therefore, we obtain the following theorem:

c·,

Principle

Theorem 1 Given a set S of n intervals, there exists Finding the minimum value c* so that S can be stabbed an optimal output-sensitive algorithm that reports an opwith c* points is easy and already known [HM84]. Con- timal stabbing set of c· points in optimal e(n log c*) time sider the interval I that has the rightmost left endpoint and linear space. q. I must be stabbed by a point and clearly, the best place to stab it is on its left endpoint q. We then remove all the intervals stabbed by q and loop until all the in- 3 The algorithm in higher dimentervals are stabbed. We thus obtain an optimal set of c* sions points that stab S. A straightforward algorithm based on this fact has running time O(nc*) with linear space. We show below how an adequate preprocessing can yield 3.1 Principle an optimal output-sensitive algorithm in 0(n(logc*+l» We describe below a "divide-and-conquer" strategy and time and linear space. show how we can get results on the approximation factor when dealing with axis-parallel boxes. Let 8 be a set of 2.2 Getting an output-sensitive algo- n d-dimensional boxes. Let (0, {Xb ... ,Xd}) denote the rithm orthogonal frame of the d-dimensional Euclidean space. Each box can be viewed as the intersection of 2d halfThe methodology consists in grouping the intervals into spaces. A facet f of a box B is a (d - 1)-dimensional groups and to preprocess each group in order to anbox of the boundary BB supported by a hyperplane HI. swer queries efficiently [Cha95, NY95]. Typically, our If HI is defined by an equation of type Xi = 1 for some queries are of two kinds: "what are the intervals stabbed real 1 then we say that f is a facet of type i. In other by a point q?" and ''which interval has the rightmost words, a facet of type i is perpendicular to the i-th axis. left endpoint?". Moreover, ",re must be able to remove A box B can be viewed as the ordered cartesian product some of these intervals at some steps i, 1 =:; i ~ c*. We use the interval tree of McCreight [McC80, PS85] IIt=l [ri(B), rtCB)] where [riCB), ri(B)] is the range of B along the i-th dimension. We say that box B is to the as the data-structure for answering these queries. Asleft (right) of Xi = 1 if rt(B) < I (resp. ri(B) > I}. Let sume we know an estimate c* of c*. Then, we group XCi) be the set of values defining the facets of type i, i.e. the n intervals into 41 groups of size c* and preproc XCi) = {x13 B E 8 such that ri(B) = X or riCB) = x} cess each group into a static interval tree4 for a total (XCi) = 2181). ~ 1c*log c*) = OC n log c*}. At some step i, cost of We describe below the algorithm (see also Figure 1):

r

Ocr

3Computing the arrangement of a set of n isothetic boxes costs O(nd } time and space [PS85]. 4 In

this context, static means that we know beforehand the 2;· endpoints of each group. We only remove intervals and do not add new ones to that data-structure.

Intervals (Basic case). If 8 is one-dimensional then apply the optimal algorithm of Section 2.2 for piercing this set of intervals. 88

Partition. Let X~d) and X~'ZI be respectively the n-th and (n + 1)-th greatest elements of Xed). Com- Monotonicity. For any object 0, c*({O}uS) ~ c*(S). • :(d)+:I:(cl) pute the 'median' m = n 2 n t l of X(d) in linear Additive rule. Let II and Z2 be two subsets of objects time [BFP+72]. Partition S according to the hyperso that VII E II, "112 E I2, 11 n 12 = 0 then c*(Zi u plane Hm : (Xd = m) as follows: Z2) = C*CZ1) + c*(I2)' • Let S1 be the set of boxes that do not cross Cutting rule. Let S be a set of boxes and H a hyHm and are to the left of Hm. perplane of type i, with 1 :s; i :s; d. Then, • Let S2 be the set of boxes that do not cross C*(SH) = c*(SH) where SH = {B n HIB E S} and Hm and are to the right of Hm. SH = {BIB n H =P 0}. • Let Sm be the set of boxes intersecting H m' Recursion. Stab the boxes of Sm by piercing the set of We study below the number Cd(S) of points returned (d-l}-dimensional boxes: S:n = {BnHmIB E Sm}. by our algorithm: Conquest. Stab recursively SI and S2.

Let us prove by induction on the lexicographically orc-(S)d c-(S)2=1 dered vector Cd, n} that Cd(S}:S; d! + (d-1)! - 1, where xm = (:+:-1). Proof. For d = 1, Section 2.2 describes an optimal algorithm so that Cl (S) = c*(S) :s; c"'(S) + 1-1 since xO = 1 by convention (finite calculus rules may be found in (GKP94]).

I

I

-------;---

,I

1 1 I _ 1_ - - - - - - ' I

I

,'- - I I, _ _ _ _ _ _ -L____ ~

,

--

~

- 1_-_-_

,

I

'"

_-_-_-_-_-_-_-_-_-_1 - -

~

I

I___ + '

_______

~

___ .

------..1

- - -~

-

,-----

since (c-CS)+d-l)(c-(S)+d-2) > 1 (recall that c*(S) > 1). d(d-l) If SI, S2 :f: 0 then we have:

Figure 1: Partition of S into three subsets depending on their location with respect to the hyperplane Hm : (Xd = m). We denote by S:n the set of (d-l}-dimensional boxes SmnHm.

Our algorithm relies on the follOwing simple facts:

12=1

c*CS)d-l c"'(S)7i=2 < C*(S)d c*(S)-:r=r c(S):5 (d _ I)! + (d _ 2)! 1 - ----;t!+ (d -I)! 1,

--~---

Let tCS). and cCS) be respectively the running time of the algorithm and the number of stabbing points delivered by this algorithm. Sometimes, when we want to specify the dimension d of S, we put in subscript of these notations a d. Thus, tk(S) and Ck(S) denote respectively the running time and the output-size of our algorithm for a set of k-dimensional isothetic boxes S. Denote by c*CS} the minimum number of stabbing points of set S of d-dimensional boxes. In the sequel, d is not assumed to be a constant.

Id

If lSI = n = 1 then Cd(S) = C (S) = 1 :s; d! + (d-l)! - 1. Otherwise (d > 1 and n > 1), there are two cases depending on whether St,S2 = 0 or not (observe that lSI I = IS21)· If SI = S2 = 0 then we have:

I

Cd(S)

(S) Cd:5

= cd(Sd + Cd(S2) + Cd-l (S!n),

c*(St}d + C*CS2)d d!

+(

+

C*CSl)d=I + C*(S2)-:r=r Cd - I)!

c*CS)d-l (d - I)!

c*(S)d-2

+ (d _ 2)! ) - 3,

with 1 :s; C*(Sl),C*(S2) and c*(Sd + C*(S2) :5 c*(S), since c*CS:n) = C*(Sm) :5 c*(S). Since the rising factorial power is a convex function, the right hand side of the last inequality is ma..'(imized5 for c*(Sd = 1 and sLet 1(') be a convex function defined on range ~.b] then maxc P2 then d(q,D(u)) = Ymin(U)-Q2'

=

vVe take into account the nearest neighbor of q in D(u). Add the node w to the queue Q.

Now consider the general case. Let

db = mine le!LYmin( u) - q'2, down-xmin (u) - ql ). If db :5 d(p, q) then remove wand add the node u to the queue Q. Otherwise take into account a point pi E D( u) such that d(p, p') = db, and add the node w to the queue Q. We omit the proof of the following Theorem. Theorem 3.1 The above search algorithm. finds a nearest neighbor of a query point in 0. (log n) time.

subtree. For v, we store (k -1 )-dimensional data structure for the set S~. vVe apply dynamic fractional cascading [13, 19] as in [17]. This proves the following result. Theorem 4.1 For the dynamic post-office problem in k-dimensional space, k 2:: 3, un-

der Loo-metric, there is a data structure of size O(nlogk-2 n) having O(logk-2 n log log n) query time and O(logk-2 n log log 11,) amortized update

time.

5 3.2

The maintenance of n10dified tree

Note that an insertion (deletion) of point in (from) S causes o (log n) creations and updates of nodes. vVe can modify the insertion land deletion) algorithm to mark these nodes. The number of marked nodes is O(log n). The parent of any marked node is marked. vVe have to compute the auxiliary pointers (four or eight) for marked nodes. We apply the breadth-first search on the search tree. It is easy to show that, for a node 'v, the auxiliary pointers of v can be computed in 0(1) time if these pointers are known for the sons of v.

Theorem 3.2 The auxiliary pointers can be maintained in O(log n) time per update of the point set.

4

The dynamic post-office algorithm in higher dimensions

In this Section~ we apply the range tree technique to generalize the dynamic post-office algorithm of previous Section to higher dimensions. For a. point p in Rk, we denote by pi the point (P2, .•. ,Pk) in R k-1). For a set A of points in R k, we define 5' = {pi I pES}). For the dimension k 2, we use the data structure of previous Section. For the dimension k > 2~ the data structure is constructed as follows. The balanced binary tree stores the point of S in its leaves. sorted bv their first coordinates. For each inten~al node I.:, let St.. be the set of points that are stored in its

=

105

The dynamic all-nearestneighbors problem

In this Section we show that our dynamic postoffice algorithm can be used for solving the dynamic all-nearest-neighbors problem with the same complexity bounds.

Theorem 5.1 Let DS be any data structure for the dynamic post-office problem. Let S(n)~ Q(n) and U(n) denote the size and query and update time of DS, respectively. For the dynamic all-nearest-neighbors problem there is a data structure of size S(n) having Q(n) + U(n) update time. Corollary 5.2 Using our dynamic postoffice algorithm we obtain the data structure for the dynamic all-nearest-neighbors problem with the following complexity bounds.

• For planar case, the data structure has size O(n) and an update time of o(log n). • For the dimension k 2:: 3, the data structure has si=e O( n 10gk-2 n) and an amortized. update time of O(logk-2 nloglogn). We omit the proof of Theorem 5.1.

References [1] S. Arya and D. 1'1. !vlount. Approximate Nearest-Neighbor Queries in Fixed Dimensions. Proceedings 4th Annual Symposium on Discrete Algorithms, 1993, pp. 271-280.

[2] S. Arya, D. tv!. Nlount, N. S. Netanyahu, R. Silverman, and A. vVu. An Optimal .4lgorithm for Approximate Nearest-Neighbor

Searching. Proceedings 5th Annual Symposium on Discrete Algorithms, 1994, pp. 573582.

[13] B. ChazelIe and L.J. Guibas. Fractional cascading I: A data structuring technique. -AIgorithmica 1 (1986), pp. 133-162.

[3] S. Arya, D. :WI. Mount, N. S. Netanyahu, R. Silverman, and A. Wu. An Optimal Algorithm for Approximate iVearest-iVeighbor Searching. (revised version), 1994.

[14] T.NI. Chan and J. Snoeyink. Algorithms for approximate nearest-neighbor queries. Manuscript, 1995.

[4] S. Arya and D.

~!.

Mount. Approximate Range Searching. Proc. 11th Annual ACM Symp. Comput. Geom., 1995, pp. 172-181.

[5] S. W. Bent, D. D. Sleator and R.E. Tarjan Biased Search Trees. SIAN! Journal of Computing, 1985, 14, pp. 545-568

[l.5J K. L. Clarkson. A Randomized Algorithm for Closest-Point Queries. SIAM Journal on Computing, 17(4), 1993, pp. 830-847. [16] K. L. Clarkson. An Algorithm for Approximate Closest-Point Queries. Proc. 10th Annual AClvl Symp. Comput. Geom., 1994, pp. 160-164.

[6] ~L Bern. Approximate closest-point queries in high dimensions. Inform. Proc. Lett., 45, 1993, pp. 9.5-99.

[17] S. Kapoor and M. Smid. New Techniquesfor Exact and Approximate Dynamic ClosestPoint Problems. Proc. 10th Annual ACM Symp. Comput. Geom., 1994, pp. 165-174.

[7] S. N. Bespamyatnikh. The Region Approach for Some Dynamic Closest-Point Problems. Proc. 6th Canadian Conf. Comput. Geom., 1994.

[18] D.E. Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching. Addison-Wesley, Reading, MA, 1973.

[8] S. N. Bespamyatnikh. An optimal algorithm for closest pair maintenance. Proc. 11th Annual ACM Symp. Comput. Geom., 1995, pp. 152-161. [9] S. N. Bespamyatnikh. An optimal algorithm for closest pair maintenance. manuscript (final version). [10] S. N. Bespamyatnikh. Dynamic algorithms for approximate neighbor searching. manuscript. [11] P. B. Callahan and S. R. Kosaraju. A Decomposition of J.;/ulti-Dimensional Point-Sets with A.pplications to k-NearestNeighbors and n-Body Potential Fields. Proc. 24th Annual ANIC Symposium on the Theory of Computing, 1992, pp. 546-556. [12] P. B. Callahan and S. R. K6saraju. Algorithms for Dynamic Closest Pair and nBody Potential Fields. Proc. 6th Annual ACNI-SIA!vI Symp. on Discrete Algorithms, 1995.

106

[19] K. Mehlhorn and S. Naher. Dynamic fractional cascading. Algorithmica 5 (1990), pp. 215-241. [20] D. D. Sleator and R. E. Tarjan. A Data Structure for Dynamic Trees. Journal of Computer and System Sciences, 26, 1983. [21] M. Smid. Closest Point Problems in Computational Geometry. to appear in the Handbook on Computational Geometry, edited by J.-R. Sack and J. Urrutia. [22] P. M. Vaidya. An Optimal Algorithm for All-Nearest-Neighbors Problem. Proceedings 27th Annual Symposium Found. Compo Sc., 1986, pp. 117-122. [23] P. M. Vaidya. An O(nlogn) Algorithm for All-1Vearest-Neighbors Problem. Discrete Comput. GeoID., 1989, pp. 101-115 [24] A. C. Yao and F. F. Yao. A General Approach to D-Dimensional Geometric Queries. Proc. 17th Annu. ACM Sympos. Theory Comput., 1985, pp. 163-168.

A Topology- Oriented Algorithm for the Voronoi Diagram of Polygons Toshiyuki Imai Department of Mathematical Engineering and Information Physics University of Tokyo

1

Abstract

An algorithm for constructing Voronoi diagrams whose generators are points, line segments, segment chains and polygons is shown. In this algorithm, topological structure of the diagrams is treated as prior information to numerical values of reals. If the computation is precise enough for conventional algorithms to construct the correct Voronoi diagrams, this algorithm also works well. Moreover, even when the precision is not enough, this algorithm never fails and ends up with a diagram as an output with several topological properties which Voronoi diagrams must have. In this sense, this algorithm is robust against numerical error. This algorithm is designed in the practical assumption that numerical error exists; hence it has not any exceptional rules for degeneracy but still works for degenerate inputs.

2

Voronoi Diagrams

The algorithm in this paper belongs to an incremental type. At first, we introduce some definitions and notations. In this paper, polygon is considered as a simple closed chain of line segments. Let gi be a point, a line segment, a segment chain or a polygon for each i (1 :$ i:$ N). Let us assume that each gi is simple and any gi, gj (i :/; j) do not intersect. We also assume that the set {gl,· .. ,gn} is a plane graph in which the degree of any vertex is at most 2. We call the set G {gl, ... , gN} a generator set. We define the distance d between a point v and a generator gi as d(v, 9i) inf{lIu - vIII u E gil, where II-II is the Euclidean norm. For gi, gj (i:/; j), we define region R(gi, gj) R(9i,9j) {v E R21 d(V,gi) < d(v,gj)}. (1) as follows:

=

=

=

=

Let R(gi) nj¢iR(9i,9j). Those regions R(gd,···,R(gN) define a partition V(G) of the plane R2 and we call the partition the (generalized) Voronoi diagram for the set G. We call the region R(gi) Voronoi region of the generator gi. The Voronoi edge is defined as a curve segment which is the common boundary of 2 Voronoi regions and the Voronoi vertex is defined as an endpoint of a Voronoi edge. Voronoi vertices and Voronoi edges have a structure like a plane graph. In this paper, we use the terms region, edge and vertex instead of the Voronoi region, the Voronoi edge and the Voronoi vertex respectively. We also use the term the Voronoi diagram of polygons for simplicity even if its generators are points, line segments, segment chains and polygons We consider the next problem. - For a set of generators in the unit square [0,1]2, construct the Voronoi diagram of the generators in the same square. This setting of the problem does not lose generality, because the generators can be transformed in this square by scale transformation and parallel displacement. In order to describe the algorithm, we introduce another partition of the plane called the separated Voronoi diagram of polygons. For each generator gi E G, we make a set Go of points by gathering 1. if gi is a point, gi itself, 2. if gi is a line segment, 2 endpoints, 3. if gi is a segment chain, all endpoints of all segments, 4. if gi is a polygon, all corner points of gi. \Ve denote Go = {Pb··· ,Pm}. By removing the points in Go from each generator gi, nothing is left if gi is a point, and some segments without their endpoints are left otherwise. We call the segment without its endpoints the open segment. Suppose {ell···, en} is a set of all open segments. For each k (0 < k :$ n), we denote Gk

= Go u {ell··· ,ek}.

Like the Voronoi diagram of polygons, we define a region R(p, q) for p, q E Gn , as follows: If p, q are an open segment and its endpoint, (assume {p,q} = {Pi:ek} and Pi,Pj are endpoints of ek),

107

Otherwise, we use the definition by the formula 1. Let R(q) = np¢q R(q,p). We call the partition of the plane defined by R(q) (q E Gk) the separated Voronoi diagram for the generator set Gk. We use the notation V(Gk) for the separated Voronoi diagram. The separated Voronoi diagram and the Voronoi diagram of polygons use the same notation Vee) but both can be distinguished by the generator sets G and G". We also use terms region, edge, vertex and so on in common. We can get easily the Voronoi diagram V(G) from the separated Voronoi diagram V(G n ) by removing edges whose both sides are regions of the same generator in G (Figure 1). That's why the algorithm constructs the separated Voronoi diagram V ( Gn ) instead of the Voronoi diagram V (G) of polygons. Especially, in the separated Voronoi diagram V(Gk)' we call edges between regions of an open segment and its endpoints a separator.

Figure 1: The Voronoi diagram of polygons and the associated separated Voronoi diagram. The Voronoi diagram has some unbounded edges. This is the difference between the Voronoi diagrams and plane graphs. The algorithm adds 3 extra points to the generators. We use 3 points of a triangle which includes the square [-1,2]2 to make the number of the unbounded edges just 3 without any influence on the Voronoi diagram in the unit square [0,1]2.

3

Topology-Oriented Algorithm

The algorithm takes the topology-oriented method. Geometric algorithms are considered as a series of processing data of figures by arithmetic of reals (floating point numbers). In general, arithmetics of reals have numerical errors. The topology-oriented method is an approach such that the topological properties which the figures must have are considered prior to the results of arithmetic. Conventional approaches to geometric algorithms assume the complete accuracy of the computation. Just this assumption assures the data free from topologically inconsistent structures automatically, but this assumption fails when the algorithm is implemented. As a result of the assumption, there occurs a problem that the program by the algorithm leads to inconsistent judgements, endless loops, failures, or data destructions. The topology-oriented method avoids the problem by keeping the topological properties of the data. We first treat the algorithm for the Voronoi diagram of line segments and then we extend it to the algorithm for the Voronoi diagram of polygons. In this paper, we take numerical errors for granted. We also take the following assumptions: e Any combinatorial computation (computation of integers) is correct, e the same computation of reals always has the same numerical errors. In general, those assumptions hold on conventional computer systems. \Ve also take assumptions on the input segments and the computer as follows: e The result of computation of the length of a line segment is always positive. e The intersection test reports no intersecting pair of the line segments is found. The algorithm we present in this paper is in the incremental type. It is as follows: Algorithm 1 (Construction of a separated Voronoi diagram)

108

1.1 Construct the Voronoi diagram V(Go) of points. 1.2 For each k = 1"", n, do 1.2.1. 1.2.1 Add the open line segment ele to the generator set, to make V(G"-l) into V(Gk)' After the execution of the algorithm 1, we obtain the separated Voronoi diagram V(Gn ). As we mentioned in the previous section, we can easily get the Voronoi diagram of line segments from this V(G n ) by removing the edges of separators. vVe use Sugihara-Iri's algorithm [6] to construct the Voronoi diagram V(Go) of points at 1.1 in the algorithm 1, Sugihara-Iri's algorithm also takes a topology-oriented method. Therefore, we just show the detail of 1.2.1 in the algorithm 1. This part of the algorithm adds an open segment to the generator set and modifies the Voronoi diagram. Let the open segment be added to the generator set Gk-l. We take the data structure in which all of open segments have arbitrary orientation. The endpoints of an open segment consist of the initial point and the terminal point. Let Pi and Pi be the initial and terminal points of the open segment ele respectively. The difference between V(Gk-d and V(G,,) has the following properties (Figure 2): • Newly born vertices and edges make a closed path which surrounds the vertices and edges to be removed. • The vertices and edges to be removed constitute a tree structure. • The tree structure has the unique path between the regions of the endpoints Pi and Pi' • The path goes between the two groups of regions; one is right to the open segment ek ant the other is left. • Any separator is not completely removed.

e"

The algorithm we present takes such properties. The following algorithm 2 adds the open segment

e"

and

\

Figure 2: Adding an open segment. modifies the Voronoi diagram from V(GIe-d to V(GIe):

Algorithm 2 (Addition of an open segment e".) 2.1 Find the start vertex on the boundary of R(Pi). 2.2 Set the search point to the start vertex. 2.3 Until the search point get to the region R(p;), do 2.3.1 and find the path. 2.3.1 Find the unsearched edge which lies between the right and left regions to ele and which has the search point as an end vertex, and then set the other end vertex to the new search point. 2.4 Search the edges to be removed from the vertices on the path, and determine the tree structure to be removed. 2.5 add new vertices and edges which surround the tree and remove the tree to make the new region, i.e., the region of elc. At 2.3 in the algorithm 2, if the path gets the wrong edge such as an unbounded edge, a separator, a edge which makes a closed path or which returns to the start region R(Pi), we backtrack the path to the vertex where the

109

judgement is the most unsure. At 2.4 in the algorithm 2, if the tree gets the wrong edge above, we make a vertex on the edge to keep the tree structure to be removed. For the generator set of points and line segments as an input, the algorithm 2 guarantees the output with the following properties under any numerical error: • Any endpoint or open segment has a simply connected region . • Regions of any open segment and its endpoints are adjacent on the separator. We adapt the algorithm 2 (which is for the set of points and line segments) to the one for polygons. Suppose the open segment ek is to be added and ek is adjacent to already added open segment e, at the initial point Pi of el;. Then, at 2.1 in the algorithm 2, such property holds that one of vertices on the separator between el; and Pi never becomes the start point of the path (Figure 3). The corresponding property holds at the terminal point Pi of the open segment ek if the open segment has an adjacent open segment already added at the endpoint Pi' The algorithm for the set of polygons keep those properties. In the case of the Voronoi diagram of polygons,

Figure 3: Vertex (empty circle) which never becomes the start point of the path. such problem may occurs at 2.3 in the algorithm 2 that the path cannot reach the destination without taking a separator (Figure 4). This is because numerical errors make some wrong judgements which separate the endpoints of an unadded open segment inside and outside a polygon whose boundary has already been added. We can avoid this problem by changing the order of addition of the open segments in such way that the open segments which close polygons are added last. By reordering the open segments to be added, the algorithm 2 guarantees the output of the (separated) Voronoi diagram of polygons under any numerical errors .

••

•••••

.......

not added

Figure 4: Endpoints separated by a polygon with numerical errors. In general, the topology-oriented method divides the algorithm into 2 parts. One is the combinatorical part and the other is numerical part. This means we can first make a combinatorical part of the algorithm, which is robust against numerical errors and which ends with an output which keeps some topological properties and then, we can improve the way of numerical computations in the algorithm. In the algorithm for the Voronoi diagram of polygons, it is also important to improve the way of numerical computations; however we skip the details because of space limitation. At 2.3 in the algorithm 2, to find the next edge on the path to be removed, we compute for each neighbor generator, a value of how left the generator is to the open segment ek at the search point v of the path. We call this value left-value. The sign of the left-value shows whether the generator is left to el; or not. If the generator is an open segment e" we use the orthogonal projection P of v to e, for the computation of the left-value, and if the generator is a point, we use this point as p. We can compute the left-value of the generator at v as the signed distance from the point P to the segment ek (Figure 5). Especially, in the case of computing the left-value of the open segment at v, it takes a lot of computations with errors to compute the coordinates of v and p. For the Voronoi diagram of polygons, if the open segments ek and e, are adjacent, the sign of the left-value of e, is independent from the search point v of the path. In

e,

110

such case, to diminish the influence of errors, we first test whether e, is left to ek or not, without computing and then, we set a constant as the the left-value, directly from the coordinates of the endpoints of ek and left-value of e,.

e,

~ /~

... ...•

Figure 5: Computing the left-value of a generator. As the format of the input for the set of points and line segments, just an integer and a series of reals are enough in which the integer is the number of segments and the series is the coordinates of the endpoints of segments and the isolated points. This format is not enough for the input of the Voronoi diagram of polygons. As the input, information about incidence of open segments and endpoints is required. The same kind of thing happens on the output of the algorithm. These mean that the input and output for the set of polygons become larger in their size than those for the set of points and line segments. We do not mention the details of the input or the output anymore for such difference make little influence on the algorithm. Allowing the numerical error means that we cannot find any degeneracy in the input. Hence, the algorithm we present does not have any exceptional rules for the degenerate input. The algorithm treats a degenerate input in the same way as it treats a non-degenerate input.

4

Complexities

"\IVe discuss the complexity of the algorithm. Let n be the number of isolated points and open segments in the input. The Voronoi diagram and the separated Voronoi diagram of polygons have O(n) vertices and O(n) edges. We discuss the time complexity of the algorithm first. The optimal one is O(n log n)[l]. To construct the Voronoi diagram of all endpoints of open segments and isolated points, it takes O( n 2 ) time by Sugihara and Iri's algorithm. When an open segment is added to the generators, it takes O( n) time to find the initial point of the path, takes O(n 2 ) (O(n) if no backtrack happens) time to find the path and takes O(n) time for determining the tree structure. It takes O(n) to add and remove edges to create a region. Hence, the total time complexity is O(n3 ) in the worst case. It is reduced to O(n 2 ) if the numerical errors are so small that no backtrack happens at the path search. If there is no numerical error, our algorithm has the O(n 2 ) time complexity, which is not optimal but the same as the conventional incremental algorithm for the Voronoi diagram. Next: let us discuss the space complexity of the algorithm. It is easy to see the space complexity is O(n) and optimal because the number of edges and vertices is O(n). We show the practical time complexity of the algorithm. We first implemented the algorithm for the Voronoi diagram of line segments as a program SEGVOR and then we adapted SEGVOR to a program for the Voronoi diagram of polygons named PLVOR. We show the performance of PLVOR. Inputs consist of just polygons obtained by the following algorithm.

Algorithm 3 (Construction of an input set of polygons.) 3.1 Genearate the coordinates of endpoints Pi, ... , Pn by random reals uniformly distributed in an interval [0,1]. 3.2 Set the open segments el,' ··,en in the following way: ei (Pi,Pi+t) (i 1" ··,n -l);en (Pn,pt). 3.3 While an intersecting pair (ei, ej) of segments exists, do 3.3.!. 3.3.1 If the exchange of the terminal points of ei and ej makes no pair of edges with the same endpoints, exchange the terminal points of ei, ej, otherwise, exchange the initial point of ei and the terminal point of ej.

=

=

=

At 3.3 in the algorithm 3, we take 2 ways to search an intersecting pair (ei, ej) of open segments. The first

111

way is the search in the ascending lexicographical order of the indices (i, j) of open segments. We call the way A. The second way is based on the sweep line method by [2]. We call the way B. We show examples of 1024 segments in fig. 6. We can easily see that they are not alike. For each way and each number of segments, we

Figure 6: The way A (left) and the way B (right) (1024 segments). generated 10 inputs and made the Voronoi diagrams. Because the execution times on SPARCstation ELC are almost the same for each way and each number of segments, we show the average in the table 1. The execution times are a little different between the way A and the way B, but the complexities are almost the same and 2 nearer to O(n) than to O(n ). Table 1: The average of the execution time [8].

I num. of segments I the way A the way B

5

256 2.94

I 512 I 1024 I 2048 I 4096 I 5.90 6.31

11.87

24.50

51.78 57.19

Concluding Remarks

We present an algorithm for constructing the Voronoi diagram of points, line segments, segment chains and polygons and implement it as a program named PLVOR. With any numerical errors, the the algorithm ends with an output which holds some properties which the Voronoi diagram must have. If the numerical error is so small that the conventional algorithms works, the time complexity is O(n 2 ) for the set of n open segments and isolated points, which is the same as that of the conventional incremental algorithm (not optimal). Under any (bad) accuracy, the execution is terminated in O(n3 ) time. For the experimental input constructed in 2 ways, the practical time complexity is nearer to the linear order than to the square order. As a subject for the future, we can point the extension of the algorithm for inputs in which three or more segments are adjacent at an endpoint. In such input, the combinatorical data itself can be inconsistent even if they are locally consistent. This means that the extended algorithm must prove that the input is combinatorically consistent or will require a consistent input. Moreover, by the format of the current input, the algorithm cannot determine in which polygon or chain each open segment is. This means that the input and the output will be more complicated for the extended algorithm.

References [1] Aurenhammer, F.: Voronoi Diagrams - A Survey of a Fundamental Geometric Data Structure, ACM Comput. Suev., vol. 23, pp. 345-405(1991). [2] Bentley, J. L. and Ottmann, T., Algorithms for Reporting and Counting Geometric Intersections, IEEE Trans. Comput., C-28, pp. 643-647.(1979} [3] Imai, T. and Sugihara, K.: A Failure Free Algorithm for Constructing Voronoi Diagrams of Line Segments, IPS} Trans., vol. 35, No. 10, pp. 1966-1977(1989}: (in Japanese). [4] Imai, T.: A Combinatorial-Structure Oriente and whose edg('s ar(\ precisely t.he edges of P. It should be clear that the gra.ph G( /1) can b(' {"(>IIst.ruded from P in O( 1) time. Since a number of different gra.phs will b(3 cOJlsid('rNI in t.his paper. it. is appropriate to clarify how these graphs are specified. As customary~ a. graph (; will 1)(' specified by a linked list. of edges i.e. unordered pa.irs of vertices st.ored in some 01' 1, constructs a Steiner tspanner for S with o( n log n) edges. Hence, the output of A is a graph having as its vertices the elements of S and (possibly) some addit.ional St.einer points. Note that, although the elements of S are pairwise distinct, this graph may have multiple vertices that. represent the same numbers: There may be an element. u of S and a Steiner point v that represent the same real number. Similarly, there may be Steiner points u and v that are different as vertices of the graph, but that. represent the same real number. Hence, the graph may have edges of length zero.

We will show that the worst-case running time of A is O(n.log n}. In order to apply Theorem 2, we have to define an appropriate algorithm C such that (i) C solves a decision problem, i.e., it outputs YES or NO, (ii) C has a running time that is within a constant factor of A's running time, and (iii) the set of YES-inputs of C, considered as a subset of IRn , consists of many (at least n! in our case) connected components. There is one problem here. We consider decision algorithms whose inputs consist of n real numbers that are pairwise distinct. The subset of IRn on which such an algorithm X is defined trivially has at least n! connected components. We cannot apply Theorem 2 to algorithm X. For example, X could be the algorithm that takes as input a sequence of n pairwise distinct real numbers, and simply outputs YES. The subset of IRn accepted by this algorithm has at least n! connected components, although it has a running time of 0(1). Therefore, to apply Theorem 2, we must carefully define algorithm C. After we define algorithm C as specified above, we will further define a related algorit.hm V that takes any point of IRn as input, and whose set of YES-inputs still has at least n! connected components. As the reader might expect, we start with defining an algorithm 8, before introducing algorithm C. Algorithm B does the following on an input consisting of n pairwise distinct real numbers Zt, X2, ••• , Xn and a real number t > 1. It first runs algorithm A on the input Xl, X2, ••• , X n, t. Let G be the Steiner t-spanner that is computed by A. Considering all edges of G, algorithm B then select,s a shortest edge of non-zero length, and outputs the length Is of this edge. We introduce the following notation. For real numbers Xl! X2, ... , X n , we denote

Lemma 1 0 < is:::; t . mg(xt, X2,"" xn). We now fix an integer n and a real number t > 1. For any permutation 1f' of the integers 1,2, ... , n, let IS1r be the output of algorithm B when given as input 1f'(1), 1f'(2) , ... , 1I'(n) , t. Among all these n! outputs, let Is· be one that has the minimal value. Now we can define algorithm C. It only accepts inputs of our fixed length n., consisting of n pairwise distinct real numbers. On input XI, X2, ••• , X n , algorithm C does the following. It first runs algorithm B on the input Xl, X2, ••• , X n • t. Let Is be the output of 8. Algorithm C then outputs YES if Is 2:: Is·, and NO otherwise. Since algorithm C only accepts inputs of our fixed length n, and since we also fixed t, we may assume that it "knows" the value ls·. Algorithm C exists, although we have not explicit.ly computed Is·.

156

Algorithm C is defined only for inputs consisting of n pairwise distinct real numbers. As a result, C can safely perform operations of the form z := x I (Xi - Xj ), for any real number x, without having to worry whether the denominator is zero or not. Our final algorithm V will take any point (Xl, X2, • •• , xn) of rn.n as input. On input Xl, X2, ••• , X n , V performs t.he same computation as C does on the same input., except that each operation of the form =:= xly is performed by V as

if y # 0 then z terminate fl.

:=

xly else out.put YES and

Since C is a well-defined algorithm, it will always be the case that y # 0 if the input consists of n pairwise dist.inct. real numbers. When two input elements are equal, it. may still be t.rue that y # 0, although this is not necessarily t.he case. It is clear that C and V give the same output when given as input the same sequence of n pairwise dist.inct real numbers. If t.hese numbers are not pairwise distinct, then C is not defined, whereas '[) is, although it.s output may not have a meaning at all. We will prove that the running t.ime of algorithm V is !l(nlogn). This will imply the same lower bound on the running time of our target algorithm A. Let. W be the set of all points (XI, X2, ••• , xn) E IR" that are accepted by algorithm V. Lemma 2 and Theorem 2 imply the lower bound on the running time of algorithm V.

Lemma 2

Spanners and approximate shortest paths among obstacles in the plane

3

Let S be the set of obstacle vertices (isolated points are considered as point-obstacles), and let n lSI. Let G (V, E) be a graph such that (i) S is a subset of V, and (ii) the edges of G are straight-line segments in the plane that do not intersect the interior of any obstacle. Then the not.ion of spanners in the previous sections can be generalized such that G is a t-spanner for S if for any two obstacle vertices u, v E S, there is a u-to-v path in G whose length is no more than t times the length of a shortest u-to-v obstacle-avoiding path in the plane. If V S, then we call Gat-spanner for S. Otherwise, if G contains additional vertices (Steiner points), then we call G a Steiner t-spanner for S. If a spanner G is planar, then there is an embedding of the graph G in the plane, such that no two of its embedded edges properly cross each other. An obstacle-avoiding path connecting two points u and v in the plane is called at-short u-to-v path if the length of that. pat.h is no more than t times the length of a shortest u-to-v obstacle-avoiding path in the plane. We need to distinguish two kinds of spanners in this section: Explicitly represented spanners and implicitly represented spanners. The spanners considered in Section 2 are explicitly represented spanners, since there we assumed that each edge of such a spanner is specified or represented in some explicit manner. Thus, constructing an explicitly represented spanner with n vertices and m edges requires !l(n + m) time. Specifically, our lower bound results in Section 2 hold for explicitly represented spanners with o(n logn) edges. Spanners in this section, however, are allowed to contain O(n logn) edges, and if this is the case, the spanners, called implicitly represented spanners, are assumed to be representable in some implicit fashion. For example, one could, in O(n) space, somehow represent a coloring of the points in S with several different colors, such that a spanner G of

=

=

#W ~ n!.

Proof: Let 1r and p be two different permutations of 1,2, ... , n. We will show that the points P := (1r(1),1r(2), ... ,1r(n)) and R := (p(1),p(2), ... ,p(n)) belong to different connected component.s of W. Let i and j, 1 :$ i, j :$ 71, be two indices such that 1I"(i) < 1I"(j) and p(i) > p(j). Consider any continuous curve C in IRn that connects P and R. Since this curve passes through the hyperplane Xi Xj, it contains points for which the absolute difference between the it.h and j-th coordinates is positive but. arbitrarily small. However, for such poi 11 t.s Q (q I , q2, ... , qn), there may be two dist.indo indices k and such that qk qt. We do not have any cont.rol over algorithm V when given such a point Q as input. Therefore, we proceed as follows. Paramct.rize the curve C as C(T), 0 :5 r :5 I, where C(O) P and G( 1) R. For 1 :5 k :5 n., we write the k-th coordinate of the point. G(r) as C(r}k. Define TO as the Ininimum value of r, 0 :$ T :5 I, such that

=

= e

=

Is· > Is· f(2t). The value of TO is the first "time" at which the mg-function is at most equal to Is· f(2t). Since this function is continuous along C, we have mg(q}, q2, ... , qn) > O. Hence, (ql, q2, ... , qn) is a sequence of n pairwise distinct real numbers. Consider algorithm V when given this sequence as input. It runs algorithm B on the input qt, Q2, ... , qn, t. Let Is be the output of B. By Lemma 1, we have Is :5 t· mg(ql, q2, ... , qn). Hence, Is < Is· and, therefore, algorithm V outputs NO. This implies that point Q does • not belong to the set W.

=

=

m.g( C (Th , G (Th, ... , C (T)n)

:5

Is· I (2t) .

=

Let Q := C( TO), and write this poiut as Q (qt,q2, ... ,qn). Then we have mg(Ql,Q2, ... ,qn) :5 Is· 1(2t) < Is· It. Also, m.g(C(Oh, C(Oh, ... , C(O)n) ~

157

=

A

I. ••••

.......

............... / c .•...•.

...

-+

~: ~

:::0-:-:-:::.::;

I!IIIII!I

I

Figure 1: The rectangle Ri and rectilinear notch N; associated with the point Pi.

ilil1!iili S would contain only the edges whose endpoints are of different. colors. Our proof of t.he U(Tdog n) lower bound for computing t-short obst.acle-avoiding paths is inspired by the reduction t.hat de R.ezende, Lee, and Wu used to prove the Q (n. log n) lower bound for com pu ti ng rectilinear shortest obstacle-avoiding paths [10]. We reduce the problem of sorting a set. R of n distinct positive integers h, 12, ... , In to the i-short path and spanner problems we consider. This sorting problem has an Q(n log n) lower bound. The reduction is done mainly by constructing a geometric sort.ing device based 011 an (arbitrary) algorithm for the t-short path or spanner problem. Our lower bound proofs are based on the following framework of reduction (but the actual values of several parameters can vary frOIn one proof to another). Consider a set J( of n. positive pairwise distinct integers h, 12, ... , In. Let Iu (resp., Iv) be the smallest (resp., largest) integer in the set Ii. For every integer 1; E K, first map 1; to the point Pi = (Ij, 0) in the plane, and then construct a rectangle Ri and a rectilinear notch Ni associated with Pi, as follows (see Figure 1). The edges of Ri and Ni are parallel to an axis of the coordinate system. The cutoff of the rectilinear not.ch Ni forms a d x d square Sj whose vert.ices are b, c, d, and e (the value of d is carefully chosen to be sufficiently small and this will be done later). The point Pi is at the center of t.he square Si and also at. t.he center of t.he edge gh of R;. The length of t.he edge gh. is d /2, and the length of both the edges ab and cf of Ni is d/4. Let C be a large circle whose center is at t.he origin of the coordinate syst.em and whose radius is dependent on the input value of l and on the specific problem. We only consider t.he half of C t.o t.he right. of the y-axis. Let the upperright (resp., lower-right) corner of each Ri (resp., Ni)

..'

..... .....

illlll!lll ........ ..... Figure 2: Reducing integers h, 12, ... , In to a geometric setting. touch the circle C (see Figure 2). Let the obstacle set consist of the Ri's and Ni'S. It is not hard to observe that, because each Ri (resp., N;) is contained in the circle C and its upper-right (resp., lower-right) corner touches C, the visibility graph of the obstacle vertices in this geometric setting has only O(n) edges (Figure 2). Moreover, observe that the length of the shortest Pu-toPv obstacle-avoiding path among this set of obstacles is < 2(Iv - Iu). Also, note that once the circle C is given, this reduction can be easily performed in 0(71.) time. Theorem 3 In the algebraic computation tree model, any algorithm that, given a set of disjoint polygonal obstacles in the plane with a total of n vertices, two obstacle vertices Pu and Pv, and a real number t > 1, computes at-short Pu -to-pv obstacle-avoiding path in the plane requires Q(nlogn) time in the worst case. Proof: We reduce the problem of sorting a set Ii of n positive pairwise distinct. integers II, 12 , ... , In to the problem of computing at-short Pu-to-pv obstacleavoiding path in the plane, where Iu (resp., Iv) is the smallest (resp., largest) integer in J{. The key is to make the height.s of the R; 's and Ni'S very large, thus forcing the (unique) t-short Pu-to-pv path to go through the points Pi, in sorted order. Specifically, we let d be any real number with 0 < d < 1/8, and let the height of N v be ~ 6 + 2t(Jv - Iu). Next, we let C be t.he circle whose center is at the origin and that passes through the

158

lower-right corner of N v', and let other obstacles R; and Ni touch C as discussed above (Figure 2). Now, observe that. the height of any ~ (resp., Nd, for each i = I, 2, ... , n, is no smaller than the height of N v (which is ~ 0- + 2t (Iv - Iu)). Also, observe that there can be only one t-short. Pu-to-pv pat.h in t.he plane. Furthermore, t.his tshort Pu-to-pv path goes through the edge of each R; that contains Pi, and the length of t.his t-short path is < 2t(/v - Iu). In fact, for every value t' with 1 ~ t' ~ t, the t'-short Pu-t.o-p" path in this geomet.ric set.ting is identical to the t-short Pu-to-pv path. After the O(n) time reduction, we simply use an (arbitrary) algorithm to compute at-short Pu-to-pv path in this geometric set.ting. Then tracing this path from Pu t.o Pv will give • us a sorted sequence of the integers II, 12 , .•• , In.

Theorem 4 In the algebraic computation tree model, any algorithm that, given a set of disjoint polygonal obstacles in the plane with a total of n vertices, and a real number t > 1, constructs a t-spanner (explicitly or implicitly represented) 7'equi7'es O(n log n) time. Proof: We first perform t.he same rcduction as in the proof of Theorem 3 (wit.h t.he same values for the parameters). Wc t.hen usc an (arbitrary) algorithm t.o const.ruct at-spanner G whosc vertices are precisely the obst.acle vert. ices. Now observe that, because of the chosen heights of thc obstacles R.j and N i , G must contain a t-short. Pu-t.o-Pt, path P t.hat does not pass through any upper (rcsp., lower) vertices of the ~'s (resp., N/s). Furthermore, observe that G contains only O(n) edges. From t.he spanner G, wc remove all its edges whose lengt.hs are ~ t(Iv - Iu), and let the graph so resulted be G'. Notc that no edge on the t-short Pu-to-p" path P is removed from G. More iluportantly, there is no path in G' from Pu to any upper (resp., lower) vertex of the Ri'S (resp., Ni's). If this were not. the case, then t.here would be a path P' in G' from Pu to (sa.y) an upper vertex of an R.i. W.l.o.g., let Rj be t.he rectangle such that its upper vertex z first appears in P'. But then the edge on P' connecting with z cannot be adjacent to an upper vertex of another Rk, and, consequently, this edge is of a length ~ t(/v - Iu), a contradiction. It is now an easy matter to find in G' a Pu-to-pv path P* in O(n) time. Note that p. need not pass through a particular point Pi. But, for each point Pi, P* must pass through some of the vertices in {a, b, c, d, e, I, g, h} that are associat.ed with Pi (see Figure 1). We "color" all the vertices in {a, b, c, d, e, I, g, h} associated wit.h a point Pi by a "color" i. Not.e that, if we t.ravel along the 1)u-toPv path P*, the vert.ices of the same "color" need not appear consecutively along p.. Nevertheless, we can obtain a. sorted sequence of the input. int.egers from p., as follows: We travel along P* from Pu to Pv two times.

In the first traveling along P*, we keep track of, for each "color", the last vertex with that "color" that we encounter. This traveling process can be easily done in O(n) time. After the first traveling along P*, we travel along p. again, and this time, we output along the order of P* the "color" vertices that we have kept track of as the result of our first. traveling on P*. That the "colors" we output in this manner are in the sorted order of the input integers follows from the fact that P* is a path of the visibility graph that does not pass through the upper (resp., lower) vertices of the R;'s (resp., Ni's) . •

Theorem 5 In the algebraic computation tree model, any algorithm that, given a set of disjoint polygonal obstacles in the plane with a total of n vertices, and a real number t > 1, constructs an explicitly represented Steiner t-spanner that contains o( nlog n) Steiner points and o( n log n) edges requi7Y.:s O( n log n) time. Proof: We use basically the same reduction framework as in the proof of Theorem 4. However, we need to choose carefully the values for a few parameters of the geometric setting and t.o usc several additional observations and ideas in this proof. In particular, we let 0be a posit.ive number ~ min{1/(2tn,2),l/8}, and let the height of N v be a value ~ d + 2tn 2 (/v - Iu). Once the value of the height of Ntl is decided, the value of the radius of the circle C and the values of the heights of all the other ~'s and Ni'S can be decided accordingly. Suppose that we have used an (arbitrary) algorithm to construct an explicitly represented Steiner t-spanner G (V, E) with o(nlogn) Steiner points and o(n log n) edges. Then IVI o(n log n). The key idea is to obtain from the spanner G an obstacle-avoiding path p. from Pu to p", such that (1) p. does not pass through any upper (resp., lower) vertices of the Ri'S (resp., Ni's), and (2) with an appropriate "coloring" of a subset of the vertices in V, the "colors" of the vertices along p. can lead to finding the sorted sequence of the input integers. However, with the presence of Steiner points, preventing such a PU-to-Pll pat.h p. in G from going through the upper (resp., lower) vertices of the R; 's (resp., Ni'S) and coloring a subset of the vertices in V must be done in a different way from that of the proof of Theorem 4. We first discuss how to prevent a certain Pu-to-pv obstacle-avoiding path from going through the upper (resp., lower) vertices of the R;'s (resp., Ni's). Observe that (1) there is at-short. Pu-to-pv path Pin G, and (2) the length of every edge on P is < 2t (Iv - Iu). We obtain another graph G' from G by removing from G all the edges whose lengths are ~ 2t(It,-Iu ). Note that no edge on the path P is removed from G. More importantly, we claim that. in G', there is no path from Pu to any upper (resp., lower) vert.ex of the R;'s (resp., Ni's). If

=

159

=

,, p','

Figure 3: Every Pu-t.o-P1J path pI in (J' contains a vertex q of G in rio this were not the case, then there would be a path p' in G' from Pu to (say) an upper vertex of an ~. W.l.o.g, let Rj be the rectangle such that its upper vertex z first appears in P'. It means that when we travel along pI from Pu t.o z, we encounter no other upper (resp., lower) vertex of the R; 's (resp., Nj's) than Z. There can be only o( n.log n) vertices of G on the path along pI from Pu to z, and the length of this Pu-to-z path is 2: 2tn2(I1J - Ju ). It then follows that at least one edge on this Pu-t.o-z path is of a length> 2t(Jt, - Tu) (otherwise, the length of this Pu-to-z path in G' would be :5 2t(11J Ju ) x o(nlogn) < 2tn 2 (J1J -Ju ), a. contradiction). But this is a cont.radict.ion t.o t.hc definit.ion of G'. We now discuss how to "color" a subset of the vertices in G'. Note t.hat. because of the presence of Steiner point.s, a l>u-t.o-p1J pat.h 1" in G' (which cannot go t.hrough any upper (resp., lower) vertices of the Ri's (rcsp., Ni's)) need not pass t.hrough any vertex in the set {a, fl, r, d, c, I, g, h} associated with a point Pi (Figure 3), even t.hough P' does have to pass through the "alley" between R; and Nj. Our "coloring" method is based on t.he following observation:

( *) For a point. Pi, let r j be the portion of the square Si (recall t.hat Si is defined by the obst.acle vertices b, c, d, and c associated with Pi) that is on or below the horizont.al line passing through Pi (see Figure 3). Then every Pu-to-pv path P' in G' goes t.hrough at least one point. q in 7', such that. q is either an obstacle vertex or a Steiner point of G. Furt.hermore, the distance between Pi and q is :5 0, and there is at-short. p;-to-q path in G' whose length is :5 to. We do the "coloring" as follows. We first obtain from

G' anot.her graph Gil, by removing from G' all the edges whose lengths are 2: 1/n2. We then have the following claims on G". (i) There is no path in Gil connecting two distinct points Pi and Pi; (ii) For every point Pi and

every vertex w of G such that the length of the shortest Pi-to-w obstacle-avoiding path ill the plane is :5 ~, there is a path in Gil connecting Pi and W. Note that the second claim implies that there is a path in Gil connecting Pi and the point q, where q is defined as in the observation (*) given above. Also, note that it is trivial to obtain G" from G' in o(nlogn) time. Based on the above two claims, the rest of the "coloring" process is done as follows: For every point Pi, compute the connected cOlnponent in Gil that contains Pi (by performing a depth-first search in G"), and "color" this connected component with a "color" i. This computation certainly takes o( n log n) time. The rest of the proof proceeds as in the proof of Theorem 4. • Corollary 1 In the algebraic com.putation tree model, any algorithm. that, given a set of disjoint polygonal obstacles in the plane with a total of n vertices, and a real number t > 1, constructs an explicitly represented planar Steiner t-spanner with o( n log n) Steiner points requires O( n log n) time in the worst case. Corollary 1 implies that the O( n log n )-time algorithms in [1] for constructing planar Steiner t-spanners with 0 (n.) Steiner points are optimal.

References [1] S. Arikati, D.Z. Chen, L.P. Chew, G. Das, M. Smid, and C.D. Zaroliagis. Planar spanners and approximate shortest path queries among obstacles in the plane.

Manuscript, 1996. [2] M. Ben-Or. Lower bounds for algebraic computation trees. 15th STOC, 1983, pp. 80-86. [3] P.B. Callahan and S.R. Kosaraju. Faster algorithms for some geometric graph problems in higher dimensions.

[4] [5] [6]

[7] [8] [9] [10]

4th SODA, 1993, pp. 291-300. L.P. Chew. Constrained Delaunay triangulations. Algorithmica 4 (1989), pp. 97-108. L.P. Chew. There are planar graphs almost as good as the complete graph. JCSS 39 (1989), pp. 205-219. L.P. Chew. Planar graphs and sparse graphs for efficient motion planning in the plane. PCS-TR90-146, Dartmouth College. K.L. Clarkson. Approximation algorithms for shortest path motion planning. 19th STOC, 1987, pp. 56-65. J. Mitchell. Ll shortest paths among polygonal obstacle in the plane. Algorithmica 8 (1992), pp. 55-88. F.P. Preparata and M.1. Shamos. Computational Geometry, an Introduction. Springer-Verlag! 1985. P.J. de Rezende, D.T. Lee, and Y.F. Wu. Rectilinear shortest paths in the presence of rectangular barriers.

DCG 4 (1989), pp. 41-53. [11] J.S. Salowe. Constructing multidimensional spanner graphs. IJCGA 1 (1991), pp. 99-107. [12] P.M. Vaidya. A sparse graph almost as good as the complete graph on points in K dimensions. DCG 6 (1991), pp.369-381.

160

On the Reachable Regions of Chains (extended abstract) Naixun Pei* and Sue Whitesides t McGill Universityt

Abstract A chain is a sequence of rigid rods or links consecutively connected at their endjoints, about which they may rotate freely. A planar chain is a chain whose rods lie in the plane, with rods allowed to pass over one another as they move. This paper studies properties of the reachable regions of the endjoints of an n-link chain r lying inside a convex polygon P. We show that if the length of the longest link in r is sufficiently small, then the reachability of a point pEP by the endpoint of r is independent of the initial configuration of r. Then we ask how large the bound on the longest link may be made so that reachability does not depend on initial placement of r. Here the bound is a function of

P.

1

Introduction

An n-link chain is a sequence of n rigid rods consecutively connected together at their endjoints, about which the rods may rotate freely. This paper considers the reach ability properties of the endjoints of chains confined inside convex polygons. Figure 1 illustrates an n-link chain r with joints Ao, . .. , An. Here li denotes the length of link Li = [Ai-I, Ai]. Joints Ao and An are called endjoints and the others are called intermediate joints. We denote maxl:$i:$n {ld by lmax and say that • [email protected] t [email protected] Supported by FeAR and NSERC. : School of Computer Science, 3480 University St. #318, Montreal, Quebec H3A 2A 7 CAN ADA

161

Figure 1: Notation for chains.

r

is bounded by b, denoted by r -< b, if lmax < b. We propose a strong notion of reach ability, namely, we say that a point pEP is reachable by chain r provided that r can be moved from any arbitrary initial configuration to one in which An touches p. The set of reachable points of P for a given chain r is called the reachability region of r, denoted Pr(An). This paper studies such reach ability regions. We give conditions under which the reachability region of a chain r in a convex polygon P is exactly that of an equivalent, one-link chain r e in P, and we use this equivalence to compute the reach ability region in linear time. We show that the reachability regions of the chains inside a convex polygon P are linearly ordered by set inclusion, provided their links are not too long. This motivates us to propose an even stronger notion of reachability; namely, we say that a point pEP is I-reachable provided that it is a reachable point for all chains r whose longest link has length at most I. We also develop the notion of a hardest reachable point. A point pEP is a hardest reachable point if being reachable by r implies that every other point is reachable by r. We show such a point exists and

A i. 1

- - - Ii -

n

L

Ij > 0 - - -

An

jai+1

is unique; in fact, it is the center of the minimal spanning circle of P. Our study of reachability is novel in two ways. First, it asks when reach ability by a given chain is independent of its initial configuration. Second, it asks for environment dependent conditions that, when satisfied, guarantee reachability by an otherwise arbitrary chain.

1.1

Motivation

A problem closely related to reachability is reconfiguration. Reconfiguration problems ask whether an object or ensemble of objects can be' moved from one given configuration to another, often in the presence of obstacles. Reachability and reconfiguration problems in which the number n of degrees of freedom is allowed to vary from instance to instance are often at least NP-hard. Hence it is interesting to find big subfamilies of problems that can be solved quickly. In this paper, we ask whether there are simple properties one could require of a confining region and an enclosed chain that, if satisfied, would ensure that point reachability is easy to determine. To this end, denote by dma~(P) the distance between pEP and a point q E P that is farthest from p; then note that a necessary condition that a point p be reachable by the endpoint An of a chain r is the following (see Figure 2).

Condition (*): For all i E {I, ... , n} h - 2:j=i+l lj :5 dma~(P)·

(*)

This condition is obviously necessary because, if not satisfied, there is no way to place An at p while also keeping in P the joint Ai-l of the link Li associated with the maximum in Condition (*). However, this condition is so mild that it does not guarantee the existence of a configuration of r lying in P and placing An at p. 162

Intuitively, it seems reasonable that if all the links of r are very tiny compared to some measure of P, then the initial configuration of r will not matter, Condition (*) will be satisfied by every point pEP, and it will be possible to reconfigure r so that An is brought to p. Thus Condition (*) will trivially determines reachability. Kantabutra [4] has shown that Condition (*) is not only necessary but also sufficient for determining whether a point in a square can be reached by the endpoint of a chain whose link lengths are bounded by the length of the side of the square. In this case, not every point is reachable, but Condition (*) determines exactly which points can be reached; furthermore, reach ability turns out to be independent of initial configuration and can be tested in linear time. Inspired by Kantabutra's example, we define for a given confining convex polygon P, a bound bS on maximum -link length Ima:c that guarantees that Condition (*) is sufficient (hence the superscript S on b) as well as necessary for deterimining reach ability independent of initial configuration. In terms of this notation, Kantabutra's result can be restated as saying that for a square of side length s, we have s :5 bS : as long as a chain r confined inside S has no link that is longer than s, then Condition (*) tests reachabili ty.

1.2

Results

One of our results is that for a convex polygon P, bS :5 w, where w is the width of P. The width of P is the minimum possible distance between two parallel lines of support of P. Concerning I-reachability, we show that the largest value I for which a polygon Pis l-reachable is I = min{r,bS }, where r is the radius of the minimal spanning circle. The (unique) minimal spanning circle of a convex polygon P is the circle of smallest radius that contains P. We show that the point of P that is "hardest reachable" is the center, 0, of the minimal spanning circle.

1.3

Previous Work

Reconfiguration problems for linkages have been investigated by several researchers. Paper [1] shows that a kind of reach ability problem for a planar linkage with certain joints possibly fixed to the plane is PSPACE-hard. Here the problem is to determine, given an initial configuration of the linkage, some joint j of the linkage, and some point p in the plane, whether the linkage can be moved to place j at p. The desired configuration of the linkage is not further specified. Paper [2] studies reach ability problems for nlink chains with one endpoint fixed to the plane and with an initial configuration specified in the input to the problem. It shows that this kind of reachability problem is NP-hard when the environment is polygonal. However, for environments that consist of an enclosing circle, it gives an order O(n 2 ) algorithm to solve the reachability problem in decision form. When a point is reachable, [2] gives an O( n 3 ) algorithm to move the chain to some configuration in which the endpoint touches the given point. Kantabutra and Kosaraju [5] improved this running time from O(n 3 ) to O(n). Algorithms for fast reconfiguration of n-link chains have been given for very simple confining regions: circles, squares, equilateral triangles, or no confining region at all. Lenhart and Whitesides [6] gave a linear time algorithm for reconfiguring closed link chains in d-dimensional space, with no confining region. Kantabutra (see [5] and [4]) gave fast algorithms for reconfiguring chains inside squares, where the lengths of the links are bounded by the length of the side of the square. The problem of folding an n-link chain of equal-length links onto one link inside an equilateral triangle of unit side was considered by van Kreveld, Snoeyink and Whitesides [3]. Pei and Whitesides [7] solved the reachability problem for n-link planar chains confined within convex obtuse polygons. A convex obtuse polygon is a convex polygon whose internal angles each measure 1i /2 or more. In particular, [7] gives a polynomial time algorithm that decides 163

whether a given endjoint of a chain confined within a convex obtuse polygon P can reach a given point pEP and that produces a sequence of moves that bring the endjoint to p when p is reachable.

1.4

Additional Preliminaries

The angle at intermediate joint Ai, denoted by Qi, is that determined by rotating Li about Ai counterclockwise to bring Li to Li+l. We use [A, B] to denote a single link chain having joints A and B. We denote the distance between two points x, y by d(x, y). We use V to denote the set of vertices of a polygon P. We regard polygons as 2dimensional closed sets and denote the boundary of P by 8P. We denote the length of the shortest side of P by Smin. We denote the circle centered at 0 with radius r by C( 0, r), or simply by C if 0, r are clear from the context. For a closed polygonal region P, vma~(P) denotes a point of P farthest from p, and dma~(P) denotes d(p, vma~(P)). Obviously, vma~(P) is a vertex of P. For an n-link chain r confined by a region P, the set of points of P that are reachable by An, independent of the initial configuration of r, is denoted by Pr(An) and called the reachable region of An. The complement with respect to P of Pr(An ), denoted by Pr(An), is called the unreachable region of An. In terms of this notation, a point pEP is called an I-reachable point if p E Fr(An) for every r ~ I no matter where r initially lies. The set of I-reachable points in P, denoted by PI, is called the I-reachable region of P, and if PI = P, P is said to be I-reachable. Clearly these concepts remain valid for nonpolygonal confining regions as well.

To show bS ::; w, the width of the confining convex polygon P, we first establish the following.

Lemma 2.1 If p E 8P, then dma~(P) ~ w. Furthermore, if v E V, then dma~( v) > w.

Theorem 2.1 bS

::; w.

proof sketch: Figure 3 illustrates the general idea of the proof, which goes by contradiction. If for some convex polygon P, the bound bS were greater than the width w, then the situation illustrated in the figure could arise. Here the chain consists of a single link [A, B], initially placed so that A lies at vertex V2 and [A, B] points, as a first case, upward and leftward toward a vertex v~ farthest from V2. By the previous lemma, w < dmax (V2). Suppose further that the line 12 through edge (Vb V2) is a support line of P that, together with a parallel support line 11, achieves the width w of P. Suppose the length of [A, B] is greater than w but less than dmax (V2), dmax(v) and bS • Such a length is always possible under the assumption that bS > w. Then in order to bring B to the rightmost vertex v of P, where possibly v is V2 or lies on I, it is necessary to turn the link around, making it parallel to 1 at some moment. But this is impossible since the link is longer than the distance between it and 12 • Nevertheless, vertex v satisfies Condition (*) and so should be reachable, since Ima.x < bS , a contradiction. o.

To see this, consider a 3-link chain r having joints A, B, C, D whose initial configuration is as follows: B, C are at the midpoints of two sides of 1::::., respectively; A, D are at two right corners of 1::::., respectively. Then r ~ 1/2. If bS = w, then the top vertex of I::::. is reachable by D. But this is impossible as r is completely stuck.

?

:'B

... ····.·····r······.····--····!··· ....... ···········.... VZ•

~ ""B

••••••• -......

VI

I

B at v

~ ••••••••••••••..••.• ~ v A 2:

Figure 4: bS < w.

3

Rea~hable

Regions

Definition 3.1 Let r be confined inside convex polygon P, where Imax < bS , and let it, ... , In be the lengths of the links of r . We call the chain r e consisting of a single link of length Ie = maxo' := x+ Ar, where A E IR. The Predicate We assume that the edge lp,q is moving while the face remains stationary. For fixed r we now have to determine all relevant times of collision, i.e. all A E 1R ([0, AM 4~} for "intersectSegment") with SeT; (I), f) true. With the above notation, T;(/p,q) = lp>.,q>.. The terms nTq ~ no and det[q - p, Vi+l - Vi, P - Vi} ~ 0 lead to simple linear inequalities in A, whose solutions can be described by at most one interval, including 1R or

=

0. The main idea now is to evaluate S using lists of intervals as intermediate results. The boolean operations 1\ and V are substituted by intersection and union on interval lists which can be easily implemented to run in linear time. A tree for S(P, Q) has Sen) leafs because of the predicate'S size, n := IPIIQI; its depth can be restricted to O(log n). That tree is pruned during evaluation if intermediate results are IR and 0 for union and intersection resp. The atomic inequalities can be evaluated in constant time, there are at most n intervals to handle at each level of the tree--note that neither intersection nor union can increase the number of intervals. All in all time O( n log n) suffices to determine all sections of the motion that correspond to collisions.

Enveloping Techniques A hierarchic approach is used which features ever more detailed bounding bodies around the actual polyhedra and their faces. At the highest level, approximations of smallest enclosing spheres are computed once for every object, e.g. at startup time, and associated with it; these can easily be handled even during rotations. A simple quadratic inequality can tell whether the moving sphere intersects the other at some time during the motion, in which case we proceed to the next level. Bounding boxes are then computed in a special orthogonal coordinate system with r as z-axis, thus x- and y-coordinates now remain fixed under translation. We use axially parallel rectangloids; these can be computed easily and may be looked upon as the Cartesian product of x-, y-, and z-intervals; they are stored with the polyhedron for possible re-use. Collision-freeness is ascertained if the x-y-rectangles do not overlap or if the z-intervals remain disjunct even if the translation is considered. If these boxes interfere with each other, we eventually have to look at all edge-face-pairs but use bounding rectangloids for individual faces first. The test for containment can also be improved in such a way; because of the rectangloids' alignment one object may only lie totally within another if the same holds for their bounding boxes.

3.3

Rotational Case

The moving object now rotates about a fixed axis, either through a given angle or through one complete turn. It is well known that a rotation R: can be described by an axis through the origin with direction r E IRa, Irl = 1 and an angle tp E IR. It is applied to a vector x E IRa by the function x'P := (1- costp)rTxr + cos~ x

+ sin~ r

Another way to deal with rotations is to use quaternions, and as this is quite elegant we give a short introduction here and show the applications to our problem. 3.3.1

Motion Planning for Rotations

=

Containment We assume P is moving and Q remains fixed and take r as direction of the ray. We choose V within a triangle on the surface of P whose projection onto a plane orthogonal to r does not degenerate to a line; not every point of such a triangle can collide with an edge or vertex of Q. This part is irrelevant for the total running time of the collision detection scheme.

x x (1)

Quaternions Quaternions Q (qO, q) E JR4 will now be written with a scalar part qo E IR and a vector part q E IRa I naturally including IR and IR3 into the set of quaternions. is given by the quaternion Q~ .(cos l' sin 1 r) via (0, x'P) Q~' (0, x)· (Q~) •. All Q~ are unit quaternions and form a group under quaternion product which corresponds to composition of rotations.

e::

171

=

Spherical Geometry The set of unit quaternions can be looked upon as the unit sphere 84 in four-dimensional. Euclidean space, where 8 n := {x E IRn Ilxl = 1}. We again read 1 = (1,0) E 84 and r = (0, r) E 8 4 for convenience and identify points with their position vectors. We describe the orientation of a polyhedron by a rotation with reference to some fixed initial position which corresponds to the unity 1 of the quatemion algebra. The orientation of a rotating object varies continuously and the corresponding quaternion traces an arc of a great circle on the unit sphere. Such a great circle of 8 n , i.e. a circle around the origin with radius 1, is uniquely determined by the plane in which it is contained; the latter can be given by two linearly independent vectors or two distinct points on the sphere. In the special case of two orthogonal axes P, Q E 8 n (P J.. Q with respect to the standard scalar product of IRn) we have CP.Q := {cos

of a family of circles tangent from the right-hand side to a given oriented line it, and passing through a given point SI lying on the right-hand side of II is the parabola being the intersection of the cone LC(sd with the halfplane LH+ (it) Lemma 6 The image with respect to the transformation q> of a family of circles tangent from the right-hand side to two given oriented lines hand 12 is the line of intersection of two halfplanes LH+(lI) and LH+(l2)

The idea of the algorithm is to search for all the circles which may possibly verify one of the conditions of Lemma 1 or 1(bis). Consider first conditions 1, l' or 1". Any circle C tangent to Q in three points and not containing any point of Q inside C is centered at a vertex of CSVor(Q), the closest site Voronoi diagram of the set of line segments Q. Each such center of a candidate circle is point-located in some face of F SV or(P), the furthest site Voronoi diagram of the vertices of the convex hull CH(P) of the set of line segments P. This way we can compute the distance from the center of C to the furthest point of P. If this distance appears to be smaller that the radius of C, C separates P and Q. In such a case, if C verifies conditions 1, l' or 1", it is reported as a largest separating circle.

When the separating circle C verifies the conditions 2 of Lemma 1 or one of the degenerated condition 2' and 2", it must be internally tangent to some vertex PI of CH(P) and externally tangent to some two points ql and q2 of Q. The first condition means that ~(C) lies on U E(P), the upper envelope of the lifting cones of the vertices of CH(P), within the face corresponding to vertex Pl. At the same time, the center of C lies then on a Voronoi edge of C SV ore Q) equidistant from ql and q2. Suppose that ql and q2 are internal points of two edges of Q, then in the space of circle ~(C) lies then on a segment belonging to a line determined according to Lemma 6. Similarly, if ql or q2 are endpoints of segments of Q, the corresponding edge of C SV ore Q) is mapped in the space of circles to a segment of parabola or to a segment of hyperbola as stated in Lemmas 4 and 5. Thus, to find the largest separating circles which fulfill conditions 2, 2' or 2", it is sufficient to scan, one by one, all the O(n) edges of CSVor(Q). For each edge of CSVor(Q), the segment of line, parabola or hyperbola which is the transformed of the largest circles centered on this edge is intersected with the enveloppe U E(P). The hierarchical representation of U E(P) is used for this purpose. Each point of intersection corresponding to a circle which verify one of the conditions 2, 2' or 2" is reported as a largest separating circles.

176

,

Algorithm All Largest Separating Circles

/

,, Q

'"

/

\

I

\

I

Input: Two sets of line segments P and Q with a total of n segments meeting only at their endpoints.

\

.p

I

I I

\

Output: All largest separating circles C, with P inside, Q outside and at least three contact points. 1. Compute FBVor(P) the furthest site Voronoi diagram of the vertices of the convex hull CH(P) of set P; compute UE(P) the representation of FSVor(P) in the space of circles. 2. Compute the hierarchical representation of U E(P). 3. Compute C BV ore Q) I the closest site Voronoi diagram of the set Q. 4. for each vertex v of CSVor(Q) 4.1. Compute the distance d(v, Q) from v to Q. 4.2. Locate v in a face of FSVor(P) and compute d( v, F SV ore P)), the distance from v to the furthest vertex of P. 4.3. if d(v, Q) >= d(v, FSVor(P» and one of the conditions 1, l' or 1" holds for circle C centered in v with radius d(v, Q) then Output(C). 5. for each edge e of CSVor(Q) 5.1. Compute a curve segment z in the space of circles corresponding to largest circles centered on e and externally tangent to Q and the curve ( (line, parabola or hyperbola) supporting z. 5.2. Compute Xl and X2, the two intersections of (with UE(CH(P)) if they exist. 5.3. for i = 1,2 if Xi E z and Xi is the image of a circle Ci such that conditions 2, 2' or 2" hold then Output(Ci). End of the Algorithm

I "

II

rr --r1111 ".I'

Q

I

Figure 3: The lower bound example The for loop from step 4 is run O(n) times. Step 4.1 takes a constant time. The point location in the planar map FSVor(CH(P» from step 4.2 takes O(logn) time, for example using Kirkpatrick technique.[14] Observe that a hierarchical representation of F SV or(P), needed for this approach is implied by the structure computed in step 2. In step 4.3, in time proportional to the degree of vertex v we check whether one of the conditions 1, l' or 1" is met. Over all iterations of the foor loop the complexity of step 4.3 is O(n). Thus the total complexity of the for loop from step 4 is O(n logn). Similarly, the for loop from step 5 is executed O(n) times. Depending on the case, the curve segment z needed in step 5.1 is computed using one of the lemmas 4, 5 or 6. By Theorem 3, there are at most two intersections of z with UE(CH(P» and they may be computed in 0 (log n) time. In constant time we then check in step 5.3 if the candidate circle meets one of the conditions 2, 2' or 2" in order to report it as a largest separating circle. We conclude that the loop 5 takes O(n log n) time. We have thus proved Theorem 7 For two sets of line segments P and Q with a total of n segments meeting only at their endpoints, it is possible to compute in O( n log n) time and O( n) space all largest circles separating P and Q.

Once all largest separating circles have been reported, Correctness of the algorithm is obvious considering the largest one can be easily found comparing their radii. Lemmas 1, l(bis) and the previous discussion. In order to show the optimality of our result we sketch the proof of a !l(n log n) lower bound of our problem.[20] It is obtained by reduction of the maximum gap problem 6 Complexity of the Algorithmfor which the fl(n log n) lower bound was established The computation of the furthest site Voronoi diagram in the linear decision-tree model of computation. [16] in step 1 takes O(nlogn) time and O(n) space by well Let X = Xl, X2, ••• , Xn be a set of points on the real known algorithms.[13] To obtain in linear time the upper line between Xmin and Xma:z: for which the maximum envelope UE(P), each of O(n) faces of FSVor(P) is gap must be computed, i.e. the pair of consecutive transformed into a portion of a cone, and each of the points of X maximizing the distance between them. Let O(n) edges of FSVor(S(P» is transformed into a segment set Q contain n line segments, each one extending beof hyperbola. tween the points (Xi, -1) and (Xi,O), i = 1,2, ... , n and The hierarchical representation of UE(P) from step the (n + 1)-th segment s extending between the points 2 is computed in O(n log n) time and O(n) space by (Xmin,Xma:z: - Xmin) and (xma:z:,Xma:z: - Xmin)' Let P be a single point of coordinates (:Z:min ;:z: ....... , Z."n;z;;:Z:wir! ). Theorem 3. The Voronoi diagram of the set of line segments from Clearly, the largest circle separating P and Q is tangent step 3 is computed within O(nlog n) time and O(n) to s and passes through segments at Xi and Xj defining the maximum gap in X (see Figure 3). space using one of the well known algorithms.[15] 177

It follows from the algorithm that there is at most O( n) largest separating circles with at least three contact points. Indeed, for 'each of O(n) vertices of C SV Q) there is at most one such candidate separating circle, and for each of O(n) edges of CSVor(Q) there are at most two candidate circles. The above example where values of X are equally spaced shows that there are sets P and Q actually admitting O( n) largest separating circles.

ore

presented here applied this idea to the upper envelopes of some families of cones. Moreover, not only lines are used as the intersection queries, but also some other curves as parabola and hyperbola. It is of independent interest to extend this idea to some other families of surfaces.

References

[1] A. Aggarwal, H. Booth, J. O'Rourke, S. Suri, and C. K. Yap. Finding minimal convex nested polygons. Inform. Comput., 83(1):98-110, October 1989. [2] B. K. Bhattacharya. Circular separability of planar point sets. In G. T. Toussaint, editor, Computational Morphology, pages The paper gives an efficient algorithm for the problem of 25-39. North-Holland, Amsterdam, Netherlands, 1988. finding all largest circles separating two given sets of line [3] J.-D. Boissonnat, J. Czyzowicz, O. Devillers, and M. Yvinec. segments. The solution is proven optimal in the linear Circular separability of polygon. In Proc. 6th ACM·SIAM Sympos. Discrete Algorithms (SODA). 1995. decision-tree model of computation. However, for the general algebraic tree model, the lower bound for the [4] H. Bronnimann and M. T. Goodrich. Almost optimal set covers in finite vc-dimension. In Proc. 10th Annu. ACM Sympos. maximum gap problem is not known so far. Thus in Comput. Geom., pages 293-302, 1994. this model of computation the optimality of our solution [5] B. Chazelle, H. Edelsbrunner, L. Guibas, M. Sharir, and remains open. J. Snoeyink. Computing a face in an arrangement of Note that the previous discussion does not imply an line segments and related problems. SIAM J. Comput., 22:1286-1302, 1993. n( n log n) lower bound for the problem of the largest [6] G. Das and D. Joseph. The complexity of minimum concircle separating two given polygons. Indeed, it is not vex nested polyhedra. In Proc. 2nd Canad. Coni. Comput. possible to build in linear time a polygon using the set Geom., pages 296-301, 1990. of line segments from Figure 3. [7] M. de Berg, K. Dobrindt, and O. Schwarzkopf. On lazy ranIt was supposed in this paper that the line segments domized incremental construction. In Proc. 26th Annu. ACM Sympos. Theory Comput., pages 105-114, 1994. meet only at their endpoints. For two arbitrary sets of segments we can obtain n(n2 ) points of intersec- [81 D. P. Dobkin and D. G. Kirkpatrick. A linear algorithm for determining the separation of convex polyhedra. J. Algorithms, tion. However, the following corollary states that we can 6:381-392, 1985. tackle the problem of largest circles separating two arbi[9] H. Edelsbrunner, L. Guibas, and M. Sharir. The complexity trary sets of line segments in less than quadratic time. of many cells in arrangements of planes and related problems. Discrete Comput. Geom., 5:197-216, 1990. Corollary 8 For two sets of line segments P and Q con- [10] H. Edelsbrunner and F. P. Preparata. Minimum polygonal taining a total of n segments, it is possible to compu.te in separation. Inform. Comput., 77:218-232, 1988. O(na(n) log2 n) deterministic time or in O(na(n) logn) [11] S. Fisk. Separating points by circles and the recognition of digital discs. IEEE TI-ans. Pattern Anal. Mach. Intell., randomized time and O( na( n » space all locally largest 8(4):554-556, 1986. circles separating P and Q. [12] C. E. Kim and T. Anderson. Digital disks and a digital compactness measure. In Proc. 16th A nnu. A CM Sympos. Theory To prove this, observe that if there exists a circle C sepComput., pages 117-124, 1984. arating two sets of line segments P and Q, P lying inside [13] D. G. Kirkpatrick. Efficient computation of continuous skeleand Q lying outside C, it is sufficient to take into considtons. In Proc. 20th Annu. IEEE Sympos. Found. Comput. Sci., pages 18-27, 1979. eration separation of the external cell of the arrangement of line segments of set P, and, containing it, a single cell [14] D. G. Kirkpatrick. Optimal search in planar subdivisions. SIAM J. Comput., 12:28-35, 1983. of the arrangement of line segments of Q. The complexity of such cell[9] is at most O(na( n» and it may be [15] D. T. Lee and R. L. Drysdale, III. Generalization of Voronoi diagrams in the plane. SIAM J. Comput., 10:73-87, 1981. computed in O(na(n) log2 n) deterministic time[5] or in [16] U. Manber and M. Tompa. The complexity of problems D(na(n)1ogn) randomized time.[7] Once both cells are on probabilistic, nondeterministic, and alternating decision computed, we can apply our algorithm to D(na(n» portrees. J. ACM, 32(3):720-732, 1985. tions of line segments which do not meet outside their [17] N. Megiddo. Linear programming in linear time when the dimension is fixed. J. ACM, 31:114-127, 1984. endpoints. An interesting open problem is to extend the algo- [18] J. S. B. Mitchell and S. Suri. Separation and approximation of polyhedral surfaces. In Proc. 3rd ACM-SIAM Sympos. rithm onto some other classes of objects like, for examDiscrete Algorithms, pages 296-306, 1992. ple, circles or figures bounded by line segments and cir[19] D. M. Mount. Intersection detection and separators for simple cular arcs. polygons. In Proc. 8th Annu. ACM Sympos. Comput. Geom., The original approach of the hierarchical pages 303-311, 1992. representation [14] was applied to the problem of [20] J. O'Rourke, S. R. Kosaraju, and N. Megiddo. Computing circular separability. Discrete Comput. Geom., 1:105-113, intersection of convex polyhedra (envelopes of planes 1986. in three dimensions) by query lines. The approach

7

Conclusions.

178

On the Permutations Generated by Rotational Sweeps of Planar Point Sets Hanspeter Bieri and Peter-1.fichael Schmidt Extended Abstract

1

Introduction

The sweep technique has proved to be one of the most powerful paradigms in Computational and Combinatorial Geometry, especially when dealing with problems in the 2-dimensional Euclidean plane. In most cases the plane is swept by a straight line whose normal vector never changes its direction. Such a plane sweep is called translational. In some other cases it is more appropriate to perform a rotational plane sweep, i.e. the plane is swept by rotating a straight line or halfline (ray) around a point. Starting from previous works by J.E. Goodman and R. Pollack ([GoP080], [GoP093]) one of the authors studied the following problem ([Schm92]): Let P = {PI,··· ,Pn} a set of points in the plane JR2 and G( T) c IR? a straight line to be used as a sweep line. We perform a translational sweep through lR,2 by varying the parameter T from-oo to +00 and assume general position, Le. at no moment (Le. for no value of T) G{T) contains more than one point of P. By doing this we impose order on P and thus generate a permutation of the corresponding index set {I,···, n} which we denote by if': Let Ti be the value of T uniquely determined by Pi E G( T) (i = 1,···, n). We define 7r by 7r{i) < 7r(j) iff Ti < Tj. [GoP080] and [Schm92] examine which of the n! orders of P or permutations of {I,···, n}, respectively, can be generated in this way by translational sweeps. It is shown that their number is in 9(n 2 ), and in [Schm92] an algorithm to find all these orders is given. In the present paper we study an analogous but more general problem by considering rotational instead of translational sweeps. One common kind of rotational sweeps sweeps the plane by rotating a straight line around a fixed point by an angle of 1800 , a second kind rotates a straight halfline (ray) around its endpoint by an angle of 360 0 • We will call these two kinds of rotational sweeps RL -sweep and RH -sweep, respectively. They impose different orders on a given set P, in general. First we give precise definitions of RL-sweeps and RH-sweeps and of the quantities we want to determine. We compare the two kinds of sweeps with regard to the

an

179

permutations they generate for the same set P. Lower and upper bounds on the number of. permutations are determined and it is shown that for RL-sweeps as well as for RH-sweeps the maximal number of permutations that can be generated in case of n points is in 9(n 4 ). Finally we present for both kinds of rotational sweeps an optimal algorithm which finds for a given set of points all permutations that can be generated.

2

Fundamentals

In order to define more precisely the two kinds of rotational plane sweeps introduced above, we assume JR2 to be equipped with its natural basis and choose any point q = (x, y) E IR? as a center of rotation. A RL-sweep around q is defined by an angle T} E [0,27i') and a sweep line L(q,T) = {(x+rcosT, y+rsinT) : r E lR} depending on a parameter T which is assumed to run through the interval [T1' T1 + 7i'). This means that a straight line whose initial position is defined by the angle T1 turns around the point q by an angle of 180 0 • Every point p E IR?, P i: q, is swept exactly once. In an analogous way, a RH-sweep around q is defined by an angle T1 E [0, 27i') and a sweep halfline H( q, T) = {(x + r cos T, y + r sin T): r E JRt} depending on T. Here the parameter T is assumed to run through the interval [T1, T1 + 27i'). This means that a straight halfiine whose initial position is defined by 71 turns around its endpoint q by an angle of 360 0 • Again every point P E lR,2, P i: q, is swept exactly once. Now we consider a nonempty finite set P C JR2 being in general position in the following sense: Let H( P) be the set of all straight lines joining two points of P. We assume that no two lines of H( P) are parallel and no three lines of H{ P) meet in one point. (Every point set P we will consider in this paper is assumed to be in JR2, finite and in general position.) H( P) partitions the plane JR2 into finitely many relatively open convex cells of dimensions 0,1 or 2 which represent an arrangement A(P). Let D denote the union of all 2-dimensional cells of A(P). By choosing qED and performing a RL-sweep around q we obviously define a linear order 1 and given P = {PI,'" ,Pn} C JR2 in general position. H(P) consists of (~) E 9{n 2 ) lines. Every 2-dimensional cell C E A{P} is the inter~ection of open halfplanes belonging to lines of H{P). C can be specified, therefore, e.g. by providing for each such halfplane a number identifying the corresponding line of H( P) and a sign which indicates if the halfplane is positive or negative. We conceive all these 2-dimensional cells of A(P) as nodes of a graph G(P). Two nodes of G{P)

182

are joined by an edge iff there exists a I-dimensional cell in A(P) which is adherent to both 2-dimensional cells represented by them. Figure 3 shows A( P) and G( P) for a set P of only three points. The graph G( P) contains 9(n4 ) nodes and is closely related to the well-known incidence graph G*(P) introduced by [EdOS86] to represent A(P). As G*(P) can be constructed in optimal time 9(n 4 ) (cf. [EdOS86]) the same is true for G(P). The graph G(P) can be constructed incrementally, using the same ideas as the construction of G*(P). Next we perform a depth-first traversal of G(P) which costs 9(n 4 ) time. That is, we traverse all 2-dimensional cells C E A(P), hence find all equivalence classes of ,-vs. The permutation belonging to the first cell we traverse can be found in e (n . log n) time by determining a point q E C and executing the corresponding S-sweep. The permutations of any two incident cells differ only by a transposition. Hence, by reporting just these transpositions we can find the permutation of any cell (except the first one) from the permutation of the previous one in constant time. In this way, we can find all permutations - in general more than once - in 8(n 4 ) time. Considering that card(IIs(P)) E 8(n 4 ) (Theorem 2) we conclude: Theorem 3 For a n-point set P, IIs(P) can be found in time 8(n4), which is

optimal.

Figure 3: The arrangement A(P) and the graph G(P) for P

= {PbP2,P3}.

Vve summarize our approach in form of an algorithm FINDPERM: input: P = {PI, ... , Pn} C JR2 in general position. S E {RL, RH}. output: All permutations generated by S-sweeps. procedure FINDPERM 1. Construct the graph G(P).

2. For any 2-dimensional cell C E A(P) choose q E C and find

183

'ifS,q.

3. Depth-first traversal of G(P), starting at C. For each traversed edge, find the corresponding transposition. 4. Optionally: Report complete permutations. 5. Optionally: Eliminate duplicates.

6. Optionally: Report for each 7C'j E IIs(P) the list C(7rj) of all 2-dimensional cells C E A(P) belonging to 7rj. end FINDPERM

5

Outlook

From several points of view it seems to be a challenging problem to characterize geometrically the equivalence classes of Land H, respectively, probably in the context of projective geometry. It also would certainly be interesting to characterize (for n ~ 6) those permutations 7T" which are in IIL(P) n II B (P), and those P for which IlL( P) ::) IIH( P) holds. It might be worthwhile to examine also I'J

I'J

Ms(n) := min{card(IIs (P)) : card(P) = n}. Our conjecture is, that ./W's(n) E 9(n4), which would mean that the order of magnitude of card(IIs(P)) does not depend on the position of PI,··· ,Pn. But such a result, although interesting, should not affect our algorithm FINDPERM for determining TIs( Pl. Finally, the generalization to higher dimensions represents an obvious subject for further research.

References [EdOS86]

Edelsbrunner, H., O'Rourke, J., Seidel, R.: Constructing arrangements of lines and hyperplanes with applications. SIAl"l Journal on Computing, Vol. 15, 341-363 (1986).

[GoPo80]

Goodman, J.E., Pollack, R.: On the combinatorial classification of nondegenerate configurations in the plane. Journal of Combinatorial Theory, Series A, Vql. 29, 220-235 (1980).

[GoPo93]

Goodman, J .E., Pollack, R.: Allowable sequences and order types in discrete and computational geometry. In Pach, J. (Ed.): New Trends in Discrete and Computational Geometry. Springer 1993.

[Schm92]

Schmidt, P.-M:.: Counting and generating circular sequences of finite planar point sets. Algorithms Review 2, 139-151 (1992).

184

MAXIMAL LENGTH COMMON NON-INTERSECTING PATHS Jurek Czyzowicz§t

Evangelos Kranakis*t

Danny Krizanc*t

([email protected])

([email protected])

([email protected])

Jorge Urrutia+t ([email protected])

Abstract

supported by both of them has received attention recently. For example, Aronov, Seidel and Souvaine [1] and Kranakis and Urrutia [5] studied the problem of finding common triangulations of point sets of polygons; see also Shapira and Rappaport [7]. The problem of finding embeddings of trees on point sets has also been studied recently by Bose, McAllister and Snoeyink [2], Ibeke, Pedes, Tamura and Tokunaga [4]. . Let Pn and Q be labeled point sets, both labeled with the integers 1, ... , n. A nonintersecting path 1r (henceforth called path) of Pn is a non-repeating sequence of points iI, ... ,ik such that the polygonal path obtained by connecting ij to ij+l ,j = 1, ... , k1 is non-self intersecting. In addition, we say that 1r is an increasing path of Pn if i 1 < ...
d+(A2ilower -1) and d-(A2iupper) < d+(A2iupper) and that the "ordering"8 of d+(u) and d-(u) changes exactly once for il ower :5 i :5 iupper' The first part of the invariant is true at the start of the search because d-(A2a-l) > d+(A2a-l) 0 and o d-(A 2,,) < d+(A 2,,). The updates of ilower and iupper for each i maintain this part of the invariant. The second part of the invariant relies on the following monotonicity result by Daniels [1]. Parameterize the line segment A 1A 2n by the linear function 1(r), for r E [0,1], such that "Y(O) A2n and "Y(I) AI. Daniels shows that the distance function d-(LINE(j(r)t» is non-increasing for rover [0,1]' For r, r' E [0,1] and r' > r, LINE(j(r')t) is rotated clockwise from LINE(j(r)t). Her proof shows that, as a consequence, "more" of Ulies to the left of LINE(j(r')t) than LINE("Y(r)t), and thus CH(U-(LINE(j(r)t») ~ CH(U-(LINE(j(r')t»), which implies that d-(LINE(1( r)t» ~ d-(LINE(j(r')t» and therefore establishes that d-(LINE(j(r)t» is nonincreasing. A similar argument shows that d+(LINE("Y(r)t» is non-decreasing for rover [0,1]. The full paper shows that d-(u) (d+(u» has the same monotonicity property as d-(LINE(tu» (d+(LINE(tu»). Monotonicity guarantees that the minimum of d-(u) and d+(u) is maximized where the ordering changes. The full paper shows that the minimum of d-(L) and d+(L) is maximized where the minimum of d-(u) and d+(u) is maximized . •

=

=

=

4

=

Preprocessing.

Lemma 3.1 allows us to find the vertex or edge in G associated with Lmax using binary search on the value of the index of G. The running time of the binary search is dominated by O(log(IGI)X) O(log(JU!)X), where X is the time required to calculate d+(Aj) and d-(Aj) for a given vertex Aj of G. This allows Lmax to be found in time O(lUI + 10g(IU!)X + Y), where Y is the time to find u E INTERIOR(A2i-IA2i) such that d(u) maximizes del) for L E £, (if the binary search returns an edge instead of a vertex). This section shows how to preprocess G in O(IU!) time so that X = 0(1) and so that Y = 0(1) in a real arithmetic model and Y O(log(loge- l » in a rational arithmetic model with accuracy e. (Finding u E INTERIOR(A2i-1A2i) such that d(u) maximizes del) for L E £, is addressed in Section 5.) This allows us to find Lmax in O(lUI) time in a real arithmetic model and in O( IU I+log(log e- 1» time in a rational arithmetic model. Some of the preprocessing involves partitioning G in O(IU!) time into G' which has O(IU!) edges. Clearly, any partition G' of G also has the binary search property and, since G' has O(IUJ) edges and is constructed in O(IU!) time, the asymptotic running time of the overall algorithm is unaffected by the partitioning. Before describing the preprocessing, we introduce more notation. If u is in edge A2i-lA2i of G, (Q ::5 i :5 P), then denote by C-(u) the portion of CH(At, A 2, ... , A2i-l, u) which is visible from t. Le~ c-(u) be the closest point of C-(u) to t. Similarly, define C+(u) to be the portion of CH(A2n, A2n-l, ... , A2i, u) which is visible from t and define c+( u) be the closest point of C-(u) to t. Lemma 4.1 below allows us to use C-(u) and C+(u) instead of CH(U-(LINE(tu») and CH(U+(LINE(tu») in the remainder of the paper.

=

=

Lemma 4.1 d-(u)

=~(t,C-(u», andd+(u) =.!l(t,C+(u».

Consider u E A2i-1A2i,Q :5 i ~ p. The vertices of C-(u) are a subsequence of AI, A 2 , ••• ,A2i-1 plus the last (clockwise most)9 vertex is u. Similarly, the vertices of C+ (u) are a subsequence of A2n, A2n-l, ... ,A2i plus the first (counter-clockwise most) vertex is u. Define the fixed part R- (u) of C- (u) to be the chain which is a cannot guarantee intersection of d- (u) and d+ (u) because d- (u) and d+ (u) are discontinuous. 9This is clockwise most from the point of view of t.

8 We

199

subset of C-(u) and whose vertices form the set VERTICES(C-(u» \ {u}. Let r-(u) be the closest point of R-(u) to t. Let s-(u) be the last vertex of R-(u). Define the fixed part R+(u) of C+(u), r+(u), and s+(u) analogously. We say that C-(p) and C-(q) are combinatorially equivalent if R-(p) R-(q). The analogous definition holds for C+(p) and C+(q). We say that two points p and q are hull equivalent if C-(p) and C-(q) are combinatorially equivalent and C+(p) and C+(q) are combinatoriallyequivalent.

=

Here we describe a clockwise scan of E = AIA2' ... , A2n-1A2n which is a modification of Graham's scan [6J. Graham's scan constructs the convex hull of a set of points in linear time once they are in sorted order about an internal point O. As observed in [13], in Graham's scan, "if a point is not a vertex of the convex hull, it is internal to some triangle Opq where p and q are consecutive hull vertices." If points are ordered clockwise about 0, then this implies that the point is in the wedge which is on the right of Op and on the left of Oq and the point is on the right of pq. When the scan encounters a triple of consecutive points prq in the ordering about 0 such that prq is a left turn, it pops vertices off the current hull until convexity is restored. We modify Graham's scan so that it correctly constructs the visible part of a convex chain when 0 (t in our case) is external to the chain. We need only change the left turn test for a triple prq to a right turn test in order to perform a clockwise scan about t. A counter-clockwise scan about t from A2n to Al requires only minor modifications to the scan. In both cases, the modified scan has the same asymptotic running time of O(IUI) as Graham's scan. To simplify the remainder of our discussion, we insist that the chain which is built during the modified scan is convex at all times. Hence, we do not add a new point to the chain until all vertices which must be removed have been removed. This does not affect the running time or correctness of the algorithm. During a given step of one direction of the modified Graham scan, denote by C the current state of the convex chain which is maintained by the scan. We describe a partitioning process which produces a partition G' of G, where the new index of A2,8 is 2f3'. The partition can be generated during the modified scan of E by marking edges of A2a-1A2a, ... , A2P-IA2P as vertices are removed from C. In the clockwise scan, suppose we are processing A2i, Q =:; i =:; (3, and that AgAhA2i is a right turn, where AgAh is the last edge of C. Before deleting Ah, extend ray AgAh. If it intersects A2i-1A2i, then "mark" A2i-1A2i at the intersection point". Note that no marking need be done when processing A 2i+l because there is no edge between A2i and A2i+l. Use the same marking process during the counterclockwise scan of A2nA2n-l, ... , A2Al. When the second scan is complete, split the edges of G at the marks to produce the partition G' A~or-lA~or'.'.' A~,8'-IA~,8'. The full paper shows that G' has O(IUI) edges and can be constructed in O(IUI) time.

=

Lemma 4.2 Immediately after the clockwise (counterclockwise) partitioning/modified Graham scan processes vertex Ai of edge AiAi+l of G', we can obtain, in 0(1) time: 1) C-(Aj) (C+(Aj») from C and 2) R-(u) (R+(u») and s-(u) (s (u») from C, for u E INTERIOR(AjAj+l) if j is odd. Furthermore, given p,q E INTERIOR(A~i_1A~i) for Q =:; i =:; P', p and q are hull equivalent. In the full paper, we show that, because the modified Graham scan repeatedly either adds or deletes a single edge from C, Lemma 4.3 below implies that we can update the nearest point in 0(1) time, which yields the result below in Lemma 4.4.

Lemma 4.3 Let Q be a convex polygon and t be a point outside Q. Parameterize the portion of the boundary of Q which is visible to t by the piecewise linear function "Y(T), T E [0,1], where T increases clockwise about t. The distance functi~n dQ(T) ~(t, Q("Y(T») is unimodal.

=

Lemma 4.4 In O(IUI) time it is possible to precompute r-(u) and r+(u) for u E INTERIOR(A~i_1A~i) ofG',

Ct:5 i:5 (3', as well as c-(u) and c+(u) for each vertex u ofG'.

5

Locating the Intersection Point along an Edge.

Lemma 5.1 If Lmax intersects INTERIOR(A~i_1A~i)' then we can find the intersection point in 0(1) time in a real arithmetic model, or in o(log(1og £-1» time in a rational arithmetic model with accuracy £.

Proof: Consider u E INTERIOR(A~i_1A~i)' The point c-(u) is either: 1) on R-(u) (and therefore equal to r-(u», 2) in the interior of s-(u)u, or 3) equal to u. A similar statement holds for c+(u). We show that

200

INTERIOR(A~i_1A~i) contains four subsegments, each having constant c-(u) and c+(u) type. Consider c-(u), w.l.o.g. In the full paper, we show that if type (1) applies to any point in INTERIOR(A~i_1A~i)' then either c-(u) is the same for all points u in INTERIOR(A~i_1A~i) or else there is one point w along it where c-(u) changes from s-(u) to a point on (s-(u)u). The point w, ifit exists, is the intersection ofINTERIOR(A~i_1A~i) with the line through s-(u) perpendicular to s-(u)t. The nearest point of (s-(u)u) to t becomes u when tu is perpendicular to ts-(u). The locus of points for which tu is perpendicular to ts-(u) is the circle with diameter ts-(u). This circle has up to two intersections with INTERIOR(A~i_1A~i)' and c-(u) is at u in between the two points of intersection. Lemma 4.2 and Lemma 4.4 allow us to retrieve s-(u), s+(u), r- (u) and r+(u) for a given i in 0(1) time. From these, the endpoints of the subsegments can be located in 0(1) time for a given i, because they require only a constant number of algebraic operations, such as intersecting a line and/or circle with a line.

To find the intersection point on a constant-type subsegment, parameterize the subsegment by the linear function 'Y(r), for r E [0,1]. Consider c-('Y(r». By Lemma 4.1, d-('Y(r» is the distance from c-('Y(r» to t. In case (2),

d-('Y(r» = (t - q) x ('Y(r) - q), h(r) - ql

=

a continuous algebraic function. In case (3), d-('Y(r» h(r) - tl; this is also continuous. Analogous formulas hold for d+('Y(r». We can intersect two pieces using algebraic operations. The case which dominates the running time occurs when both c-('Y(r» and c+('Y(r» are of type (2). In this case, one can find the intersection d-('Y(r», squaring, and point by proceeding algebraically at first and then numerically. Setting d+('Y(r» clearing fractions produces a fourth-degree polynomial equation in r. The intersection point for r E [0,1] is the root (in this interval) of the fourth-degree polynomial. Under a real arithmetic model, we can represent the root exactly as an algebraic number. This requires manipulating algebraic numbers. To avoid this, one can operate on a nearby rational approximation to the root. This can be obtained using, for example, Newton's method. The quadratic convergence of Newton's method adds only log(loge- 1) to the running time of the algorithm, • where e is the accuracy.

=

Theorem 5.2 The line Lmax can be computed in O(IUI) time in a real arithmetic model and in O(IUI log(loge- 1» time in a rational arithmetic model, where e is the accuracy.

+

References [1] K. Daniels. Containment Algorithms /or Nonconvu Polygons with Applications to Layout. PhD thesis. Harvard University. 1995.

[2] K. Daniels and V. J. Milenkovic. Multiple Translational Containment: Approximate and Exact Algorithms. In Proceedings 0/ the 6th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 205-214. 1995. [3] D.T.Lee. On finding the convex hull of a simple polygon. Int'l J. Comput. and In/or. Sci .• 12(2):87-98.1983.

[4] H. EI Gindy and D. Avis. A Linear Algorithm for Computing the Visibility Polygon from a Point. Journal 0/ Algorithms, 1981. [5] R. Graham and F. Yao. Finding the convex hull of a simple polygon. Journal

2:186-197.

0/ Algorithms. 4(4):324-331.1983.

[6] R. L. Graham. An efficient algorithm for determining the convex hull of a finite planar set. In/o. Proc. Lett., 1:132-133, 1972.

[7] B. Joe and R. B. Simpson. Corrections to Lee's Visibility Polygon Algorithm. BIT. 27:458-473.1987. [8] D. T. Lee. Visibility of a Simple Polygon. Computer Vision, Graphics, and Image Processing, 22:207-221,1983. [9] D. McCallum and D. Avis. A linear algorithm for finding the convex hull of a simple polygon. In/o. Proc. Lett., 9:201-206. 1979. [10] V. J. Milenkovic. Multiple Translational Containment. Part II: Exact Algorithms. Algorithmica, special issue on Computational Geometry in Manufacturing, accepted, subject to revisions.

[11] V. J. Milenkovic and K. Daniels. Translational Polygon Containment and Minimal Enclosure using Geometric Algorithms and Mathematical Programming. Technical Report 25-95, Center for Research in Computing Technology. Division of Applied Sciences. Harvard University, 1995. [12] V.J. Milenkovic and K. Daniels. Translational Polygon Containment and Minimal Enclosure using Mathematical Programming. International Transactions in Operational Research (submitted). [13] F. Preparata and M. Shamos. Computational Geometry: .Iln Introduction. Springer-Verlag, New York. 1985.

201

Variable Resolution Terrain Surfaces E. Puppo Istituto per la Matematica Applicata - Consiglio Nazionale delle Ricerche Via de Marini, 6 (Torre di Francia) - 16149 Genova, ITALY Email: [email protected]

Abstract A model for the multiresolution decomposition of planar domains into triangles is introduced, which is more general than other multiresolution models proposed in the literature, and can be efficiently applied to the representation of a polyhedral terrain at variable resolution. The model is based on a collection of fragments of plane triangulations arranged into a partially ordered set. Different decompositions of a domain can be obtained by combining different fragments from the model. A data structure to encode the model is presented, and an efficient algorithm is proposed that can extract in linear time a polyhedral terrain representation, whose accuracy over the domain is variable according to a given threshold function. Furthermore, the size of the extracted representation is minimum among all possible polyhedral representations that can be built from the model, and that satisfy the threshold function. A major application of these results is in real time rendering of terrains in flight simulation.

1

elevation of terrain over the area of the triangle. In this context, a key concept is that the resolution of a model is somehow proportional to the refinement of the domain decomposition, hence to the number of its vertices. The power of a multiresolution model derives from its ability to adapt a representation to a required resolution, while minimizing its size. Although many different multiresolution models have been proposed in the literature, the extraction of a representation at variable resolution has been investigated only recently. For this problem, a threshold function is defined over the terrain's domain, which specifies for each point a threshold for the error of the model in approximating elevation at that point. A terrain representation satisfying such a threshold must be extracted from the multiresolution model. It is also important to obtain a representation that is as small as possible.

Introduction

The model presented here is based on a multiresolution decomposition of a planar domain, called a multi-triangulation, and it is thought as a generalization over a broad class of multiresolution models. The basic idea underlying the model is that a large number of different subdivisions of a planar domain can be obtained on the basis of a relatively small set of atomic components, called fragments, which can be combined in different ways to cover the domain. Fragments can be partially overlapping, and they are arranged into a partially ordered set, where the order relation is dependent on interferences of fragments on the plane, and on the possibility to combine them to obtain triangulations.

Multiresolution geometric models can be used in several application fields to support the representation and processing of geometric entities at different levels of resolution. The case of topographic surfaces is especially attractive for its impact on applications like geographic information systems, and virtual reality contexts. For instance, visualization in flight simuThe model gives support to variable resolution, lation can be made faster by rendering portions of allowing an application to extract a representation of terrain close to the observer at high resolution, while minimum size for an arbitrary threshold function in far portions are rendered at lower resolution. linear time. This is the first proposal addressing the In this paper we consider polyhedral terrains de- minimality of the representation extracted in a strong fined by a triangulation of a plane domain, where sense: indeed, the algorithm proposed warrants that each vertex has an elevation value, and each triangle the representation extracted is the smallest possible corresponds to a triangular patch approximating the that can be built from the triangles of the model.

202

The rest of the paper is organized as follows. In Section 2 related work is brieBy reviewed. In Section 3 some terminology and notations are introduced, while the definition of multi-triangulations is given in Section 4. In Section 5, a data structure to encode multi-triangulations is described. In Section 6, an algorithm for extracting a triangulation at variable resolution from a multi-triangulation is described and analyzed. In Section 7, some examples and applications are discussed. Finally, in Section 8 some concluding remarks are given.

2

Related work

Several multiresolution terrain models have been proposed in the literature: see [6] for a recent survey. Here, we focus only on most recent models, and on issues relevant to the support of variable resolution.

The hypertriangulation model proposed in [3] is built from fragments by recording the history of the construction of a triangulation, e.g., through an online Delaunay triangulation algorithm [8, 12]. Fragments are arranged into a two-dimensional simplicial complex embedded in three-dimensional space, which is obtained by assigning a third coordinate to each vertex, whose value correspond to an iteration counter. Each time a vertex is inserted into a triangulation, the set of triangles updating the triangulation is stored as a new fragment that form a "dome" over the portion of the current triangulation that is updated. It is straightforward to obtain an analogous structure through a dynamic procedure that iteratively eliminates vertices from a given triangulation. An algorithm for extracting variable resolution representations from hypertriangulations is proposed, which is valid only for a special elass of threshold functions, namely those monotonically increasing with distance from a given viewpoint, which are suitable to Bight simulation. The algorithm is based on a breadth-first traversal of the domain starting at the viewpoint, and an incremental construction of the representation. The traversal technique ensures that the extracted model will satisfy the threshold function everywhere, but the computational complexity is suboptimal.

For all models considered here, we assume the following: each triangle of a triangulation defining a polyhedral terrain is tagged with an accuracy, corresponding to the maximum error made in approximating the terrain over its area with its corresponding linear patch; given a threshold function defined over the terrain's domain, a representation is said to satIn [5] hierarchical triangulated models are disisfy such a threshold if the accuracy of each triangle cussed, whose general structure is a tree: each node is is smaller than the minimum of the function on the a triangulation with a triangular domain, refining the triangle itself. domain covered by a triangle in its parent node. Two Most multiresolution models support only con- algorithms for variable resolution surface extraction stant thresholds. A few models supporting more are proposed. The first algorithm is a simple topgeneral functions, called variable resolution models, down visit of the tree which accepts triangle as soon were proposed recently by de Berg and Dobrindt [4], as its accuracy lies below the threshold. The resulting Cignoni et al. [3], and De Floriani and Puppo [5]. structure is a subivision called a generalized triangulation, in which some triangles are added new vertices The hierarchical representation proposed in [4] is along their edges. A triangulation of such generalized defined as a pyramid of triangulations, whose struc- triangles is performed next to obtain a triangulated ture is essentially based on an earlier hierarchical tri- surface, and the whole algorithm is completed in time angulation scheme proposed by Kirkpatrick [9]. The linear in its output size. However, the approximating pyramid is built bottom-up: each layer is obtained function is changed by the triangulation of generalby removing a constant fraction of the vertices from ized triangles, hence the accuracy of the final structhe previous layer. A traversal algorithm extracts a ture might be worse than desired. The second algorepresentation at variable resolution based on an ar- rithm is essentially an adaptation of that of Cignoni bitrary threshold function, in time linear in its output et aI. to hierarchical triangulated models. The acsize. The algorithm is based on a top-down traversal curacy of the result is warranted, but the algorithm of the pyramid, and on a greedy construction of the works only for the special class of threshold functions result. Unfortunately, the greedy approach does not described above, and its computational complexity is warrant that the desired accuracy is satisfied every- suboptimal. where: indeed, because of the current configuration at an intermediate step, the algorithm can be obliged to accept into the solution triangles whose accuracy is worse than required.

203

3

Ti e Tj Ti eTj

Preliminaries

= =

(2) (3)

Ti \ (Ti ® Tj) (Ti eTj) U Tj.

e

Posets: Let be a finite set. A partial order on C is a reflexive, antisymmetric and transitive relation ~ on its elements. A pair (e,~) is called a poset. For every c, dEC, the following notations are used: c < d means c ~ d and c :F c'; c ~ d means c < d and 7J d' such that c < d' < c' .

If Ti ® Tj ¥: 0 then we say Ti and Tj are interfering, otherwise we say they are independent. If To e Tl is also a triangulation, and ~(ToeTl) ~(To)U~(Td, then Tl is said compatible over To, and To e Tl is said a modification of To. If Tl is compatible over To, and no subset T{ C Tl is compatible over To, then Tl is c E C is a minimal element of C if .tI c' E C such said minimally compatible over To. that d < Cj if there exists a unique minimal element Given a sequence of triangulations To, ... ,Tk we in C, it is called the least of C. A subset C' ~ C is define its upward pasting as the successive pasting of called a lower set if Vc' E Vc ~ c' then c E To e Tl e ... e Tk. We say For any c E C, the set Cc {d E C I c' ~ c} is the its elements EBf=o1i that To, ... I Tk is an upward compatible sequence if smallest lower set containing c, and it is called the down-closure of c. We also define the sub-closure of c Vj 1, ... ,k, Tj is compatible over ES{~Ti' as C; = {d E C I c' < c} = Cc \ {c}. Definition 4.1 Let 0 be a polygonal domain in 1R2. Given a lower set C' ~ C, a compatible ordering A multi-triangulation (MT) on n is a poset (7,~) on C' is any total order ~c' on its elements such that where 7 = {To, ... ,Th} is a set of triangulations, Vc,d E C', c ~ c' ::} c ~c' c'. and ~ is a partial order on 7 satisfying the following conditions:

e', =

=

ct.

=

=

Triangulations: Given a generic set of triangles T {tl,"" tN} in m.2, called a t-set, we use the follOwing notation: ITI = N is the size of T; ~(T) = Uf:l ti is the domain of Tj V(T) is the set of vertices of the triangles of T; E(T) is the set of edges of the triangles of Tj Vt E T, i(t) is the interior of t.

=

A plane triangulation is a regular simplicial complex of order two embedded in 1R?: a triangulation is characterized by at-set T such that for each pair of triangles ti, tj E T, with ti :F tj, then ti n tj is either empty, or an edge or a vertex of both ti and tj. In the following we will use a triangulation and its t-set interchangeably.

1. Vi

= 0, .. . ,h, ~(Ti) ~ n;

B. Vi, j

= 0, ... ,h, i ¥: j,

(a) Ti ~ Tj => Ti ® Tj

¥: 0;

(b) Ti®Tj =F 0 ::} 11 is in relation with Tj (i.e., either Ti < Tj or T j < Ti).

7' ~ 7, if [To _-_---J_ _

_

_

~

71 ...1- --' (a)

(b)

Figure 5: The boundary of this O-halfplane (a) and O-halfspace (b) is not O-convex.

Lemma 4 An interior-closed set is a halfspace if and only if its boundary is a nonempty convex set. We first generalize the "if' part of this characterization.

Lemma 5 An interior-closed set with O-convex boundary is an O-halfspace. The converse of Lemma 5 does· not hold: the boundary of an O-halfplane (in two dimensions) or an O-halfspace (in three dimensions) may not be O-convex. In Figure 5(a), we show an O-halfplane whose boundary is not O-convex: the intersection of its boundary with the dotted O-line is disconnected. Similarly, the boundary of the O-halfspace in Figure 5(b) is not O-convex. We now present a necessary and sufficient characterization of O-halfspaces in terms of their boundary.

Theorem 6 (Boundary characterization) An interior-closed set P is an O-halfspace if and only if, for every O-line 1, one of the following two conditions holds: 1. The intersection of 1 with the boundary of P is empty or connected. 2. The intersection of 1with the boundary of P consists of two disconnected rays and the segment of 1between these rays is in P. Sketch of a proof. Suppose that, for every O-line, one of the two conditions holds. Then, the intersection of P's boundary with every O-line is empty, a segment (or point), a ray, a line, or two disconnected rays. An analysis of these five possible cases shows that, if P is interio~-closed, then, in all cases, the intersection . of the O-line with P is empty, a ray, or a line. The proof of the converse is trickier. We have to show that, if P is an O-halfspace and the intersection of P's boundary with some O-line I is not connected, then this intersection satisfies Condition 2. Since the boundary is closed, we can select two points in the intersection of 1 with the boundary such that all points of 1 between them is not in the boundary. Since the intersection of 1 with P is connected, the segment of I between these two points is in P. We then show that all points of I outside this segment are in P's boundary. 0 Observe that, if the intersection of P's boundary with a line 1consists of two rays and the segment of I between these rays is in P, then I is in P. We use this observation to simplify Condition 2 in Theorem 6.

Corollary 7 An interior-closed set P is an O-halfspace ifand only if, for every O-line 1, oneofthefollowing two conditions holds: 1. The intersection of 1 with the boundary of P is empty or connected. 2. The O-line I is contained in P. We next characterize the closure of the complement of an O-halfspace. We call the closure of the complement of a set the closed complement. We observed in Section 1 that the closed complement of a standard halfspace is a halfspace. We lose this property in the generalization to O-convexity: the closed complement of an O-halfplane may not be an O-halfplane and the closed complement of an O-halfspace may not be an O-halfspace. For example, the closed complement of the O-halfplane in Figure 5(a) is not an O-halfplane, because its intersection with the dotted line in not empty, a ray, or a line. Similarly, the closed complement of the O-halfspace in Figure 5(b) is not an O-halfspace. We state a necessary and sufficient condition under which the closed complement of an O-halfspace is an O-halfspace. 215

Theorem 8 (Complementation) The closed complement of an O-halfspace P is an O-halfspace if and only if the boundary of P is O-convex. We denote the closed complement of P by Q. Note that Q is interior-closed and the boundary of Q is the same as the boundary of P. If the boundary of P is O-convex, then Q is an interior-closed set with an O-convex boundary, which implies that Q is an O-halfspace (Theorem 6). Suppose, conversely, that Q is an O-halfspace. If the boundary of P is not O-convex, then there are points x, y, and z on some O-line 1 such that x and z are in the boundary, whereas y, located between them, is not in the boundary. Then, y is either in the interior of P or in the interior of Q, which implies that either P n 1 or Q n 1 is disconnected, contradicting the fact that P and Q are O-halfspaces. 0

Sketch of a proof.

6 Conclusions We have described a generalization of halfspaces in the theory of restricted-orientation convexity and demonstrated that the properties of these generalized halfspaces are similar to the properties of standard halfspaces. The work we have presented here extends our previous study of O-convex sets [3]. In the full paper [2], we demonstrate that the results hold not only in three dimensions but also in higher dimensions. The work leaves some open research problems, which we are currently trying to address. For example, we have not established the contractability of O-halfspaces. We conjecture that every connected O-halfspace is contractable. We also plan to study computational properties of O-convex sets and O-halfspaces.

References [1] C. K. Bruckner and J. B. Bruckner. On Ln-sets, the Hausdorff metric, and connectedness. Proceedings of the American Mathematical Society, 13:765-767, 1962. [2] Eugene Fink and Derick Wood. manuscript, 1995.

Generalized halfspaces in restricted-orientation convexity.

Unpublished

[3] Eugene Fink and Derick Wood. Fundamentals of restricted-orientation convexity. Information Sciences, 1996. To appear. [4] RalfHartmut Giiting. Stabbing C-oriented polygons. Information Processing Letters, 16:35-40,1983. [5] Witold Lipski and Christos H. Papadimitriou. A fast algorithm for testing for safety and detecting deadlock in locked transaction systems. Journal of Algorithms, 2:211-226, 1981. [6] TIna M. Nicholl, D. T. Lee, Y. Z. Liao, and C. K. Wong. Constructing the X-Y convex hull of a set of X-Y polygons. BIT, 23:456-471, 1983. [7] Thomas Ottmann, Eljas Soisalon-Soininen. and Derick Wood. On the definition and computation of rectilinear convex hulls. Information Sciences, 33:157-171, 1984. [8] Franco P. Preparata and Michael 1. Shamos. Computational Geometry. Springer-Verlag, New York, NY, 1985. [9] Gregory J. E. Rawlins. Explorations in Restricted-Orientation Geometry. PhD thesis, University of Waterloo, 1987. Technical Report CS-89-48. [10] Gregory J. E. Rawlins and Derick Wood. Optimal computation of finitely oriented convex hulls. Information and Computation, 72:150-166, 1987. . [11] Gregory J. E. Rawlins and Derick Wood. Restricted-orientation convex sets. Information Sciences, 54:263-281, 1991. [12] Sven Schuierer. On Generalized Visibility. PhD thesis, Universitat Freiburg, Gennany, 1991. [13] Eljas Soisalon-Soininen and Derick Wood. Optimal algorithms to compute the closure of a set of iso-rectangles. Journal ofAlgorithms, 5:199-214, 1984.

216

Efficient Algorithms for Guarding or Illuminating the Surface of a Polyhedral Terrain Prosenjit Bose*

David Kirkpatrick t

Zaiqing Li~

Abstract We present efficient polynomial time algorithms that place at most ln/2J vertex guards which cover the surface of an n-vertex polyhedral terrain, and similarly, at most ln/3 J edge guards which cover the surface of an n-vertex polyhedral terrain. The time complexity of both algorithms, dominated by the cost of finding a maximum matching in a graph, is O(n 3 / 2 ).

1

Introduction

Victor Klee originally posed the problem of determining the minimum number of guards sufficient to cover the interior of an n-sided art gallery (polygon) in 1973. Chvatal showed that In/3J guards are sufficient and sometimes necessary to cover the interior of an n-sided art gallery using a lengthy combinatorial argument [4]. Subsequently, Fisk [8] gave a concise and elegant proof using the fact that the vertices of a triangulated polygon may be three-colored. Since then, this problem has evolved into what is virtually a new field of study with numerous variations of the original question. The reader is referred to the book by O'Rourke [12] and the recent survey by Shermer [15] for an overview of the area. Most of the research has concerned problems set in two dimensions. Very little is known about guarding or illuminating objects in three dimensions. A step in this direction is the study of polyhedral terrains. The problem of guarding a polyhedral terrain was first investigated by deFloriani, et al. [6]. They showed that the minimum number of guards could be found using a set covering algorithm. Cole and Sharir [5] showed that the problem was NP-complete. Goodchild and Lee [9] and Lee [10] presented some heuristics for placing vertex guards on a terrain. Bose et al. [3] showed that Ln/2J vertex guards are always sufficient and sometimes necessary to guard an n-vertex terrain. With respect to edge guards, they establish that l(4n - 4)/13J edge guards are sometimes necessary to guard the surface of an n-vertex terrain. The sufficiency result of Ln/3J edge guards was proved by Everett and Rivera-Campo [7]. Both upper bounds are based on the Four color theorem, leaving open the question of their efficient realization. In [3], linear time algorithms (based on the five color theorem) are presented for placing l3n/5J vertex guards which cover the surface of a polyhedral terrain, and L2n/5J edge guards which cover the surface of a polyhedral terrain. In this paper, we close this gap by finding efficient polynomial time algorithms (O(n3/2) time) that place at most l n/2J vertex guards which cover the surface of a polyhedral terrain, and similarly, at most ·Research supported by NSERC and FIR. Departement de mathematiques et d'informatique, Universite du Quebec a Trois-Rivieres, C.P. 500, Trois-Rivieres, Quebec G9A 5H7, Canada. This work was carried out while the author was at the Department of Computer Science, University of British Columbia. E-mail: [email protected]. t Research supported by NSERC. Department of Computer Science, University of British Columbia, 201-2366 Main Mall, Vancouver, B.C., V6T 1Z4, Canada. E-mail: [email protected] !Oepartment of Computer Science, University of British Columbia, 201-2366 Main Mall, Vancouver, B.C., V6T 1Z4, Canada.

217

ln/3J edge guards

which cover the surface of a polyhedral terrain. The key behind these algorithms is an alternate proof to both upper bounds that avoids the use of the Four color theorem by relying on matchings. The time complexity of both algorithms is dominated by the time needed to find a maximum matching in a graph. To date, the most efficient algorithm to find a matching in a general graph takes O( JiVjIEI) time (Micali and Vazirani [11]). This turns out to be O(n3/ 2 ) in our case since the graphs we deal with have 0 (n) vertices and edges.

2

Preliminaries

We begin by reviewing some of the terminology used throughout this paper. Most of the geometric and graph theoretic terminology used is standard, and for additional details, we refer the reader to [13] and

[2].

We define a terrain T as a triangulated polyhedral surface with n vertices V = {Vb V2,' •. , vn }. Each vertex Vi is specified by three real numbers (Xi, Yi, Zi) which are its cartesian coordinates and Zi is referred to as the height of vertex Vi. Let P = {PI, P2, ... ,Pn} denote the orthogonal projections of the points 1/ = {VI, V2,"" Vn} on the X-Y plane, i.e., each point Pi is specified by the two real numbers (Xi, Yi). It is assumed that the set P = {PI,P2,'" ,Pn} is in general position, i.e., no three points are collinear 50 that the projections of the edges of the polyhedral surface onto the X -Y plane determine a triangulation of P (hence the term triangulated polyhedral surface). We refer to the triangulation as the underlying triangulated planar graph associated with the terrain. Therefore we can view a terrain T as the graph of a polyhedral function z F(x, Y), defined over CH(P). A point a on or above T is said to be visible from point P on or above T if the line segment ap does not intersect any point strictly below T. More generally, point a is said to be visible from line segment s on or above T if there exists a point p on s from which a is visible. Given a point P (respectively, segment oS), the subset of points of T that are visible from p (respectively oS) is called the visible region of T from p (respectively, s) and is denoted by VR(Tlp) (respectively, VR(Tls)). Throughout this paper, we distinguish certain points and line segments as guards. A vertex guard is a vertex of T and an edge guard is an edge of T. A set of guards covers or illuminates the surface of a terrain if every point on the terrain is visible from at least one guard in the set. A set of guards with this property will be called a guard set. A vertex guard set is a set of vertex guards that covers a polyhedral terrain. Similarly, an edge guard set is a set of edge guards that covers a polyhedral terrain. The combinatorial counterparts of these terrain guarding problems can be expressed as guarding problems on the planar triangulated graph underlying the terrain. A vertex guard on the graph can only guard the faces adjacent to that vertex, and an edge guard on the graph can only guard the faces adjacent to the endpoints of the edge. It seems difficult to show that the problem of guarding a polyhedral terrain is equivalent to the combinatorial problem of guarding the underlying planar triangulated graph. The difficulty stems from the fact that not all plane triangulations can be realized as convex terrains. However, a valid placement of vertex (respectively, edge) guards on the underlying triangulated graph is also a valid placement of vertex (respectively, edge) guards on the polyhedral terrain since a guard on the terrain can always see the faces adjacent to it. Therefore, an upper bound on the number of guards used to guard a triangulated planar graph is also an upper bound for polyhedral terrains. Traditionally in graph theory, a k-vertex coloring of a graph G is defined to be an assignment of one of k colors to each vertex of G such that no two distinct adjacent vertices have the same color. We break from tradition and call such a coloring a ](2-free k-coloring since no edge (clique of size 2) is monochromatic. A ](d-free k-coloring of a graph G is an assignment of one of k colors to each vertex of G such that no clique of size din G is monochromatic. In this paper, we will concentrate on ](3-free 2-colorings of planar triangulated graphs.

=

218

Given a plane graph G, the dual of G, denoted G*, is defined as follows: corresponding to each face f of G there is a vertex f* of G*, and corresponding to each edge e of G is an edge e* of G*; two vertices f* and g* of G* are joined by an edge e* if and only if the faces f and 9 of G are separated by (i.e. share) the edge e in G.

3

I{3-free 2-coloring

]{3-free 2-colorings form the basis of the placement algorithms to follow. We first investigate these colorings on planar graphs and then address the issue of guard placement. Definition 1 A maximal planar graph is a connected planar graph in which every face is a triangle.

Notice that if every maximal planar graph is ]{3-free 2-colorable, then so is every planar graph. Therefore, in the remainder of this section we assume that our graphs are maximal planar graphs. The Four color theorem [1] states that every planar graph is 4-vertex colorable. The Four color theorem implies (by arbitrarily pairing colors) that every planar graph admits a ](3-free 2-coloring. Unfortunately, this implication is not computationally satisfying since no simple algorithm to 4-vertex color a planar graph exists. We provide below an alternate proof (that does not depend on the Four color theorem) that every planar graph admits a ](3-free 2-coloring. We begin by investigating some properties of K3-free 2-colorings of planar graphs. Theorem 3.1 A ](3-free 2-coloring of a maximal planar graph G determines a perfect matching on its dual graph G*. Proof: Given a ](3-free 2-coloring of G, let R (red) and B (blue) represent the two color classes. Define a set of edges M* in G* as follows: if the end vertices of an edge e of G are assigned the same color, then the corresponding dual edge e* of G* is placed in set 111 .... We now show that the set 1'1.[* represents a perfect matching in G*. First, we show that no vertex in G* is adjacent to two edges in M*. Suppose such a vertex f* existed, this would imply that the corresponding face f in G would be monochromatic which is a contradiction. Second, we show that every vertex in G* is adjacent to at least one edge in 1\([*. Suppose vertex f* in C* is not adjacent to any edge in M*. Let f be the corresponding face in G. Let a, b, c be the three vertices of face f in G. Face f is not monochromatic by assumption, however, two of the three vertices must be assigned the same color. Without loss of generality, assume a and b are assigned color red. By construction of 1\1*, the dual of the edge ab must be in M"", contradicting the fact that f* is not adjacent to any edge in }II * . • Lemma 3.1 The dual C* of a maximal planar graph C is 3-regular and bridge less (i.e. contains no cut edge). Proof: Since every face in G is a triangle, every vertex in G* has degree three. Suppose that C* had a cut edge e*. Note that the faces adjacent to a vertex v in G form a cycle in G*. Let edge e with end points a and b in G be the dual of edge e*. The faces adjacent to a form a cycle • C in G*. However, e* is in cycle C contradicting the fact it is a cut edge. Theorem 3.2 ([14], a proof also appears in [2]) Every bridgeless 3-regular graph has a perfect matching.

219

Theorem 3.3 Every planar graph admits a ](3-free 2-coloring. Proof: Let P be a planar graph. If P is not maximal, insert edges until it is maximal. Let G be this maximal planar graph and G* its dual. By Lemma 3.1, G* has a perfect matching. Let M* represent a set of edges forming this perfect matching in G*. Let M be the edges in G that are dual to the edges in 1\([*. Let G' be the graph G with the edges M removed. Since G is a maximal planar graph, G' is a planar graph where every face is a quadrilateral. It follows that every cycle in G' is even, and hence G' is bipartite. Let Rand B represent the two sets of vertices which form the bipartition of G'. Since the vertex set of G and G' is the same, this forms a partition of the vertices of G. Assign the color red to the vertices in R and blue to the vertices in B. We have defined a coloring of the vertices of G, such that any two vertices adjacent via an edge not in M must have distinct colors. Since every face of G has two such edges, we conclude that no face of G is monochromatic. Therefore, the sets Rand B form a ](3-free 2-coloring of G and P. •

Algorithms for Guard Placement

4

As noted in the preliminaries section, a valid placement of vertex (respectively, edge) guards on the underlying triangulated graph is also a valid placement of vertex (respectively, edge) guards on a polyhedral terrain since a guard on the terrain can always see the faces adjacent to it. Therefore, we will concentrate on the combinatorial problem. Note that the underlying graph G of a polyhedral terrain need not be a maximal planar graph, since the outer face is not necessarily a triangle. However, we simply add the missing edges in order to transform the underlying graph into a maximal planar graph G' since the guard placement on this augmented graph G' is also a valid placement on the original graph G. Thus in the remainder of this section we assume that the underlying graph is a maximal planar graph.

4.1

Vertex Guard Placement

Observation 4.1 Let Rand B be the two color classes of a ](3-jree 2-coloring oj the underlying triangulated graph of a polyhedral terrain. Both Rand B form a valid vertex guard set. Based on this observation, we see that there always exists a guard set of size at most Ln/2J and to compute such a valid vertex guard set, one simply needs to compute a ](3-free 2-coloring of the underlying graph. The proof of Theorem 3.3 implies the following algorithm. Note that we assume that G is maximal planar. Algorithm: Vertex Guard Placement Input: Underlying n vertex graph G. Output: Vertex guard set of size at most Ln/2J. 1. Compute the dual G* of G. 2. Compute a perfect matching M* in G*. 3. Form graph G' by removing from G edges dual to those in M*. 4. Compute the two sets Rand B forming the bipartition of graph G'.

220

.5. Output the smaller of Rand B. All of the steps, except step 2, can be computed in O(n) time. Step 2 can be performed in O(n3 / 2 ) time [11], since the number of vertices and edges in G* is O(n). Therefore, the complexity of the algorithm is O( n 3 / 2 ), dominated by the time taken to find the perfect matching.

Theorem 4.1 In O( n 3 / 2 ) time, one can find a vertex set of size at most ln/2J that covers or illuminates the surface of an n vertex polyhedral terrain.

Edge Guard Placement

4.2

We present an algorithm for placing In/3J edge guards to cover the surface of an n vertex polyhedral terrain. Let G represent the underlying graph. Our edge guard algorithm proceeds as follows. The first step in the algorithm is to compute a ](3-free 2-coloring of the vertices of G. Let the two color classes be: Rand B. Let Matching(x) denote a maximal matching (which is not necessarily a maximum matching) on the graph induced by the vertices in the color class x. Although Matching( x) does not provide a set of edges that guards the whole terrain, if we take all the edges in Matching(x) as well as one edge from each of the remaining unmatched vertices of color x then we guard the whole terrain by Observation 4.1. Let Guard(x) represent a set of edge guards obtained in this way. Also, let lSI represent the number of elements in a set S. We have the following relation: IGuard(x)1 = Ixl- IMatching(x)l. This relation holds because for each edge of the matching, we reduce the number of unmatched vertices by 2 which results in a reduction of the size of Guard by 1. We have two color classes Rand B. Note that IRI + IBI = n. Let GS = Matching(R) U Matching(B).

Lemma 4.2 The set of edges in G S covers G. Proof: Let f be a face of G which is not covered by an edge in GS. This implies that none of the three vertices of f are adjacent to any edge in Matching(R) or Matching(B). Without loss of generality, let f have two vertices colored red. This contradicts the fact that Nlatching( R) is maximal. • Notice that the above lemma implies that we have three valid edge guard sets for graph G: Guard(R), Guard(B), and GS. In the next theorem we show that one of these three sets has size at most Ln/3J.

Theorem 4.2 Given a polyhedral terrain on n vertices, there exists a set of size at most l n/3J edges that guards the terrain. Proof: If the size of GS is at most Ln/3J. Then we have the following. IGuard(R)1

Ln/3J, then we're done.

+ IGuard(B)\ =

IRI

+ IBI -

Suppose that the size of GS is greater than

(IMatching(R)1

+ IMatching(B)1)

< n -IGSI ~

~

Since the size of Guard(R)

+

In/3J r2n/31

n-

Guard(B) is at most

~/~.

221

by assumption

r2n/31,

.

one of the two must have size at most

Once again, the time complexity is dominated by the time taken to find a maximum matching. Therefore, we conclude with the following theorem. Theorem 4.3 Given a polyhedral terrain on n vertices, O( n 3 / 2 ) time is sufficient to find a set 8 of edges to guard the terrain, where lSI::; Ln/3J.

References [1] K. Appel and W. Haken. Every planar map is 4-colorable. III Journal of lVIathematics, 21:429 - 567, 1977. [2] J. Bondy and U. Murty. Graph Theory with Applications. North Holland, 1976. [3] P. Bose, T. Shermer, G. Toussaint, and B. Zhu. Guarding Polyhedral Terrains. Computational Geometry: Theory and Applications (to appear). Also available as Technical Report 92.20, McGill University, 1992. [4] V. Chvatal. A combinatorial theorem in plane geometry. J. Comb. Theory Sere B, 18:39-41, 1975. [5] R. Cole and M. Sharir. Visibility problems for polyhedral terrains. Journal of Symbolic Computation, 7:11-30, 1989. [6] L. deFloriani, B. Falcidieno, C. Pienovi, D. Allen, and G. Nagy. A visibility-based model for terrain features. In Proc. 2nd International Symposium on Spatial Data Handling, pages 235-250,1986. [7] H. Everett and E. Rivera-Campo. Edge guarding a triangulated polyhedral terrain. In Proc. 6th Canad. Con! Comput. Geom., pages 293-295, 1994. [8] S. Fisk. A short proof of Chvatal's watchman theorem. J. Combin. Theory 8er. B, 24:374, 1978. [9] M.F. Goodchild and J. Lee. Coverage problems an visibility regions on topographic surfaces. Annals of Operations Research, 18:175-186, 1989. [10] J. Lee. Analyses of visibility sites on topographic surfaces. Int. J. Geographic Information Systems, 5:4:413-429, 1991. [11] S. Micali and V. Vazirani. An O(vlIE) algorithm for finding maximum matching in general graphs. Proc. 21st Annual IEEE Symposium on Foundations of Computer Science, pp. 17-27,1980. [12] J. O'Rourke. Art Gallery Theorems and Algorithms. Oxford University Press, 1987. [13] J. O'Rourke. Computational Geometry in C. Cambridge University Press, 1994. [141 J. Petersen. Die theorie der Regularen Graphs. Acta Mathematica, 15: 193-220, 1891. [15] T. Shermer. Recent results in art galleries. Proc. IEEE, Special Issue on Compo Geom., 1992.

222

The Surveillance of the Walls of an Art Gallery Aldo Laurentini Dipartimento di Automatica ed Informatica, Politecnico di Torino [email protected]

Abstract The "Art Gallery" problem consists in stationing in a polygon P a minimum set of guards such that each point ofP is seen by at least one guard. In this paper we explore the related edge covering problem. where the guards are required to observe the edges of p. metaphorically the paintings on the walls ofthe art gallery. and not necessarily every interior point. Minimum edge and interior covers for a given polygon are compared. and bounds and complexityfor the edge covering problem analyzed. Then we introduce a restricted problem where full visibility of each edge from at least one guard is required. compare this problem with unrestricted edge covering and analyze its bounds and complexity. For this problem we present an algorithm that computes a set ofregions where a minimum set of guards must be located. The algorithm can also deal with the external visibility of a set of polygons (the" Fortress" Problem).

I. INTRODUCTION Withthewordpolygon werefertoaclosed set which includes interior and boundary points. If the line segment connecting two points of a polygonP lies entirely in P, we say that they are visible from each other. A polygon P is covered by a set of viewpoints. or guards, lying in p. if each point in P is visible from at least one guard The research in this area was triggered in 1975 by Chvatal's "Art Gallery" Theorem[3]. He proved that at most g(n)=ln!3 J guards are required for covering a simple polygon P with n edges. The upper tight bound g(n.h)= L(n+h)13Jror polygons with h polygonal holes and n edges has been proven about fifteen years later[S][6]. The reader is referred to the monograph of o 'Rourke[ 1] and the more recent paper of Shenner[2] for comprehensive surveys of the results obtained in this area. In spite of these results, the minimum cover problem, that is the practical problem of stationing a minimum set of G(P) guards in a given polygon P, is still open. It can be refonnulated as the problem of finding the minimum number of star-polygons whose union is P. A star-polygon is a polygon such that there exists a set of internal points. the kernel, whose members can observe the entire

223

polygon. We will use the tenns ICH and IC referring to the minimum cover problems for the interior of polygons with and without holes. O'Rourke and Supowit have shown that the decision problem corresponding to ICH is NP-hard [9]. The same result for problem IC has been obtained by Lee and Lin[10]. Many important application problems are not polynomial, and many algorithms have been constructed which work sufficiently well with the usual inputs, even though some unlikely worst case might occur. Rather swprisingly, this is not the case for IC and CH: up to now no exact algorithm for finding and locating in a given polygon a minimum set of guards has been found. Another approach to non-polynomial problems is to construct approximate algorithms with guaranteed performances. Also this approach seems unable to cope with the elusive nature of IC and ICH. We will show that the worst-case perfonnance of the approximate guard placing algorithms is as bad as possible, and the simplification introduced have no practical rationale. The problem addressed in this paper is the related Edge Covering Problem. where the minimum set of GE(P) guards must cover the edges of the polygon P. If we consider the original meaning of the Art Gallery Problem, the surveillance of paintings on the walls is in effect the main task of the guards, even if some internal region could be left uncovered. First we discuss the relations between minimum interior and edge covers for a given polygon, and analyze worst cases and complexity for the edge covering problem. Then we introduce the restriction that each edge be entirely visible from at least one guard, analyze this subproblem and compare it with unrestricted edge covering. As a result of this restriction, we discretize the problem and construct an algorithm which provides, for general polygons with or without holes, a set of regions where a minimum set of guards can be located. The algorithm is exponential in the worst case, but its behavior appears sufficiently good for many practical cases. In addition, sub-optimal solution can be obtained in polynomial time. With small changes. the algorithm also applies to the "Fortress" Problem, where the external polygon is missing.

The content of this paper is as follows. Section II deals with the worst case behavior of approximate guard placing algorithms for interior cover. Complexity, worst cases and relation with interior cover of edge cover are analyzed in Section III. Entire visibility edge covering is analyzed in Section IV. In Section V we present the algorithm for entire visibility edge covering and the complexity analysis. In this conference paper we present some results without detailed proofs. The interested reader can fmd proofs and full details on the algorithm in [29].

for covering a modified family of polygons where h tiny triangular holes are conveniently located in the regions highlighted .

G Fig.2-Worst cases for vertex guards.

n. APPROXIMATE GUARD PLACING In this section we survey the approximate guard placing algorithms known for the IC and ICH. Letting GA(P) be the number of guards located by an approximate algorithm A, we will show that the ratio GA(P)IG(P) is unbounded both for polygons without holes and with an arbitrary number of holes. For each algorithm we will produce families of polygons where G(P) is a constant (1 or 2) and GA(P) can be made arbitrarily large. In addition, we will verify that the geometrical simplification proposed hardly have a practical rationale. Stationing g(n) and g(n,h) guards. Avis and Tuissaint [8] and Bjorling-Sachs and Suvaine[5] gave polynomial algorithms for placing L(n)13J and L(n+h)13J guards in polygons without and with holes. Since for any value of

,

",

I

AAAA."'.

Partitions. A partition is a cover with non-overlapping pieces. An algorithm for finding in polynomial time a convex partition with the minimum number GCP(P) of pieces has been found by Chazelle and Dobkin[12]. The problem is NP-hard for polygons with holes[13]. In any way, it is easy to guess that the ratio GCP(P)IG(P) is not bounded. This is shown for instance by the examples in Fig.2. A partition into the minimum number GSP(P)of star polygons seems more promising. A polynomial algorithm for this pmpose, restricted to star polygons with vertices coincident with the vertices of P, was given by Keil[14]. However, also the worst-case behavior of any star partition is as bad as possible, as shown by the family of polygons found by Ntafos[15], (Fig.3(a», where G(P)=2 and GSP(P) is O(n). Also in this case we can modify these polygons by inserting any number of tiny triangular holes in the area highlighted without affecting the optimal cover (Fig.3(b».

h holes

Fig. 1-Worst case for stationing g(n,h) guards. n or of the pair (n, h) we can construct polygons which can

be covered by one guard in the former case(a convex polygon), by two guards in the latter(Fig.l), the algorithms could place O(n) and O(n+h) more guards than necessary. Vertex guards. IC with guards restricted to vertices is NP-complete[10]. A vertex cover which has at most O(lgn) time the minimum number GV(P) of vertex guards can be found in polynomial time[ll]. Anyway, for polygons without holes GV(P)IG(P) can assume any value, as shown by the family of polygons in Fig.2 (a), where G(P)=l and GV(P) is O(n). The ratio is unbounded also for polygons with any number of holes, as shown by the example in Fig. 2(b). Two guards 01 and G2 are sufficient

224

Fig.3- Worst cases for partition into star polygons.

Cover by restricted star polygons. Restricted star polygons have edges lying on the lines supporting the edges of P. Aggarwal et al.[16] gave a polynomial algorithm to find a cover by restricted star polygons that has at most O(lgn) times the GRSP(P) pieces of the minimal cover of this sort. A minimal cover could be found in finite exponential time. Restricted star polygons have

been acknowledged to be unable in some cases to provide the minimal cover (see [I], Fig.9.3). Here we show that also this approximate cover can be as bad as possible.

El E2 •....En

Gl

Fig.5-Three guards cover the edges of PI, but four are needed for the interior. For P2, the guards are 7 and 10 .

G2

(b) Fig.4-Worst cases for cover with restricted star polygons. (a)

The minimum set of guards for the polygon without holes shown in Fig.4(a) consists of Gl and G2 at the bottom vertices. Covering each top edge requires both Gl and G2. Let us consider the top edges El, E2, .... En. The kernel of any reduced star polygon covering Ei has an empty intersection with the kernel of any reduced star polygons covering Ej for i ¢ j. Thus, a cover with reduced star polygon requires a different polygon for each edge. Reducing the height h, the example can be extended to any number of concavities, and GRSP(P )IG(P) can assume any value. The modified polygon in Fig.4(b), with tiny triangular holes in the shaded area, shows that GRSP(P)IG(P) is O(n) also for polygons with holes. Concluding, no approximate algorithm known to the author is guaranteed to provide in polynomial (or even exponential) time a cover close to the optimal solution. Moreover, the various simplifications introduced can hardly be justified on the ground of practical reasons.

polygon Pl( Fig.5), three guards Gl, G2 and G3 , located anywhere in the areas highlighted, are the minimum solution for edge covering, but another guard is necessary for covering the central area Z. The difference G(P)-GE(P) can assume any value (see polygonP2 in Fig. 5, where the difference is three). For the ratio G(P)IGE(P) we have found the following results. - For polygons with holes, G(P)IGE(P) can assume any value; - For polygons without holes, (G(P)I GE(P)) < 1.5. The difference G(P) -1.5 GE(P) can be arbitrarily small. Proof. The first statement is proved by the example in

Fig. 6. The polygon in the figure belongs to a family where GE(P) is two and G(P) is O(n). The relatively complex proof of the second statement can be found in [29].

m.

COMPARING EDGE AND INTERIOR COVER

Even though covering the edges appears an interesting alternative to covering the interior, till now it received very little attention. Let EC and ECH indicate the edge covering problem for polygons without and with holes and the tean edge guards indicate the guards required for this purpose.

Minimum edge and interior coverfor the same polygon. Let GE(P) be the the minimum number of edge guards necessary for covering (the edges of) a polygon P. Obviously GE(P) S G(P). since observing the interior implies observing the edges. It is not difficult to find examples where the minimum covers are different For

225

Fig.~ Gl and G2 cover all edges, but cove~ng ~e interior requires one more guard for each area highlighted.

An example where (G(P)I GE(P)) can be made arbitrarily near to 1.5 is shown in Fig.7

JO{)[~~--

Fig.7- G(P) - 1.5 GE(P) can be arbitrarily small.

In some cases, a minimum set of edge guards also covers the interior of P, and obviously it is a minimum set also for interior covering. For the case where the edge guards do not cover the interior, the examples of Figures (5),(6), (7) may suggest that, when a solution for EC is known, a solution for IC could be obtained by adding some guards, or, vice-versa, an EC solution could be obtained by deleting some guards of an IC solution. However, in general it is not possible to establish such simple relations between minimum edge and interior covers. In fact, let us consider the polygon in Fig 8(a). In this case 01, G2 and OJ are a solution for EC but not for IC since region Z is not covered. However, a minimum set of guard for IC is not obtained by adding a fourth guard for covering Z: only three guards as 01' ,02' and 03' are sufficient The polygon in Fig.8(b) requires four guards for IC and three for EC. The four guards of Fig. 8(b) are a solution for IC, but no subset of three guards covers the edges.

polygons with n edges without holes and with h holes respectively. We have: - ge(n) = g(n) = Lnl3J - ge(n.h) = g(n.h) = L(n+h)13J Proof geln) S; g(n), otherwise there would exist polygons(the worst case polygons for EC) which require more guards for edge covering than for interior covering. The Chvatal[3] comb polygon, a worst case for IC, is a worst case also for EC, and thus the equal sign holds. It must also be ge(n.h)Sg(n.h),otherwiseacontradiction follows. It is easy to see that the polygons used as worst cases for ICH([l], pp.l28-129) requires L(n+h)13J guards also for ECH , and thus the bound is tight

Computational complexity of edge covering Many covering and decomposition problems have been shown to be NP-hard(see O'Rourke[l], Shermer[2] and Culberson and Reckow[17]). We have found that: - EC and ECH are both NP-hard This can be shown by verifying that the constructions given by Lee and Linn[lO] and by O'Rourke and Supowit [9] for reducing 3-SAT to IC and ICH also apply to EC and ECH. More details can be found in [29]

IV. THE ENTIRE VISIBILITY EDGE COVER· INGPROBLEM

Gl' e

GI Fig.S--The examples show that, in general, a solution for IC cannot be obtained from a solution for EC(a) or vice-versa(b) by deleting or adding some guards. Concluding, even though interior and edge cover are close relatives, general simple ways for transforming a solution of one problem into a solution of the other do not seem to exist. The situation is different if we are content with approximate solution with guaranteed performance. Let us consider polygons without holes. If a minimum set of guards for IC is available, this is also a solution for EC which contains at most 1.5 times more guards than strictly necessary. Vice-versa, starting from a minimum set of EC guards, we can add in polynomial time at most L(GE(P)-l).I2J guards for covering the interior uncovered areas(see[29]). Also in this case we have obtained an approximate IC solution with guaranteed performance.

"Art Gallery" theorems for edge cover. Let ge(n) and ge(n,h) be the worst case minimum numbers of point guards necessary to cover the edges of

226

Now we introduce a restriction for the edge covering problem: we require that each edge must be seen in its entirety by at least one guard. Unlike the restrictions seen for interior cover, entire visibility of the edges could make practical sense. Let EEC and EECH be the problems of fmding a minimum cover of this kind for polygons without and with holes. In this section we compare these problems with unrestricted edge cover, and discuss their WOISt cases and computational complexity.

Entire edge cover versus edge cover for the same polygon. Let GEE(P) be the minimum number of guards required for the entire edge cover of a polygon P. Obviously GEE(P) ~ GE(P). In Fig. 9 we show a polygon with holes and another without holes where these minimum numbers are different Connecting together polygons as those shown in the figure we can easily obtain cases where GEE(P)- GE(P) is O(n).

What about the ratio GEE(P)IGE(P)? Were it bounded, a solution of the restricted problem could be an approximate solution with guaranteed performance for edge cover. Unfortunately this is not the case, and the ratio is unbounded both for polygons with and without

(a)

[Qj

~

GE(P) =2

GEE(P)=3

guard can entirely observe four edges or more; from the regions highlighted in Fig.l0(a) it is possible to entirely observe three edges. Thus 4 guards at least are required for observing the ten edges, for instance those in Fig.lO(b). The polygon belongs to a family composed by a regular polygonal hole inside a larger regular polygon with the same number of edges. If the polygons are sufficiently close and n=2m=3p+l, with m and p integers, L(n+2)f3J guards are required. For two or more holes, we conjecture:

~~ GE(P)=2

(b)

- gee(n,h)

GEE(P)=3

Fig.9-Two examples where entire edge cover requires one additional guard.

Computational complexity of EEC and EECH The reduction of 3-SAT to EC and ECH also hold for

holes as shown by the examples already presented in FigA. Two unrestricted edge guards are sufficient in both cases. but each upper edge requires a different guard to be entirely observed. Observe that GEE(P) could be equal (for instance for the Chvatal comb polygon). greater(Fig.9) or smaller (Fig.5) than G(P). Finally. in general, a solution for EEC cannot be obtained from a solution for EC. or vice-versa, by deleting or adding some guards, as Fig.9(b) may suggest. This is shown by the example in Fig.9(a). No minimum set of GEE(P)=3 guards can be obtained adding one guard to the GE(P )=2 edge guards shown, and no two guards subset of the GEE(P)=3 guards shown covers the edges.

"Art Gallery"" theorems for entire edge cover. Let gee(n) and gee(n,h) be the worst-case minimum numbers of guards required by problems EEC and EECH. For polygons without holes we have: -gee(n) =ge(n)= g(n) = Lnf3J For the case of one hole. we have found: - gee(n,]) = L(n+2)f3J The proofs can be found in [29]. An example where this bound is thight is shown in Fig. 10. In this polygon no

Zt

E3 ZlO.

(a)

~!"

Ez ": ...

= L(n+h)13J

Zz

EEC and EECH, since both proofs construct polygons where each edge is entirely observed by at least one guard.

V. AN ALGORITHM FOR ENTIRE EDGE COVER The entire visibility restriction allows to discretize the edge guarding problem. In this section we describe an algorithm for both problems EEC and EECH. Given a polygon P, the algorithm computes a set of polygonal regions. A minimum set of GEE(P) guards can be obtained locating independently one guard anywhere in each region. A minor addition makes the algorithm also suitable for the "Fortress" or "external guarding" problem, where the edges of the holes are observed from an unbounded region. The algorithm consists of the following steps:

n

Step l-Compute a partition of P into regions Zi such that: - the same set Ei=(Ep, Eq, ......El) of edges is completely visible from all points of Zi V'i, - Zi are maximum regions, i.e. Ei;tEj for contiguous regions. Step 2-Select the dominant regions (d.r.). A region Zi is defined to be dominant if there is no other region Zj of the partition such that Ei c Ej . Step 3-Select an optimal (or minimum) solution. A minimum solution consists of a set of dominant regions Sj= (Zjl, Zj2••.•Zjk....) which covers E=uEi with the minimum number of members.

Observe that there could be minimal solution also containing non--dominant regions. For instance, in Fig. 10(a) the dominant regions are those highlighted. The upper guard in Fig. lO(b)does not lie in a dominant region.

(b)

Fig.lO. An example where L(n+2)I3J = 4 guards are required.

227

We choose to consider only sets of dominant regions for the following reasons. First, a non-dominant region can be substituted by a dominant region covering the same edges plus some more. Multiple coverage of edges appears preferable, for instance in the case of sensor failure. Second, we are looking for one optimal solution, not for all optimal solution: to consider only the dominant regions reduces the computations in Step.3, exponential in the worst case. In the following of this section we present some details of the algorithm and the complexity analysis.

in Fig.12 is: A(G) =«Ei, O),(Ej, 3),(Ek, O),(Eh, 0) .......)

Step 1: Computing partition II We will divide P into maximal regions Zi from which the same set of edges Ei is entirely visible, and label each region Zi with the set Ei , using a visiting algorithm. Let us discuss which lines are relevant to n. Obviously., the lines supporting the edges are necessary. When a guard crosses line La as shown in Fig.ll(a), the supported edge Ei turns entirely visible. Taking into account

ll' is defmed as the partition which divides P into regions Zi' such that: - all points of Zi' have the same aspect Ai - Zi' are maximum regions, i.e. Ai;tAj for contiguous regions. Clearly, to belong to the same region of

n ' is a neces-

sary, but not sufficient condition for two points to belong

to the same region of

n'

n.

Computing is related to the computation of the aspect graph of a set of polygons. For further details on this matter, the reader is referred to [19], [20], [21] and [22]

Let us present now the catalogue of lines which fonn

Fig. 1I-Examples of lines which change the visibility condition of an edge

n'

occlusions requires other categories of lines. For instance, if a guard crosses line Lb in Fig. 11 (b», vertex Vk turns visible. If there are no other occlusions, as in Fig.lI(b), the entire edge Ei to which the vertex Vk belongs turns visible. Otherwise, as in the case of Fig. 10(c), the edge turns visible only partially. Thus line Lb is p0tentially relevant to ll. For dealing with such cases, we will compute

n as a

refinement of a more detailed partition II', which also contains potentially relevant lines, as Lb, and auxiliary

n,

lines. Auxiliary lines are not relevant to but change the state of occlusion of an edge, as for instance Lc in Fig.I3(d). Before defining partition n', let us flfSt defme the aspect A(G) of a point G belonging to P be: A(G) =«Eh, nh), (Ek, nk),..............{Eq, nq» where Eh, Ek, .....Eq are the edges fully or partially visible from G, and nh, nk ••....nq are the numbers of occlusions of these edges. For instance, the aspect relative to point G

228

partition ,and the associated visual events, or changes in the aspects. A line is dermed to be active if it contains one or more active segments. An active segment is the boundary between points whose aspects are different All possible active lines are those which join two vertices in the cases of Table 1. The active segments are highlighted with a thicker line. The arrows mark the positive crossing directions. The positive visual event is the change of aspect of a point which crosses the active segment along the positive direction; a similar definition holds for the negative visual event For simplicity, in cases (d) and (e), each with two active segments, we only indicate the visual event of the left segment, since the other is obtained by changing the subscripts. Observe that:

- the positive visual events of cases (a) and (b) always produce full visibility of a new edge; - positive visual events of cases (c) and (d) produce full visibility of a new edge only if the previous number of occlusions of this edge is one; - visual events of case e) only affect the occlusion numbers.

TABLEt Active lines

(a)

(b)

(c)

Positive visual event

Negative visual event

Add (Ei, 0)

Delete (Bi, 0)

njE-nj-l Add (Ei,O)

njE-nj+l Delete (Bi, 0)

DiE-Di-l

DiE-Di+l ifnj =1: delete (Ej, 1); othelWise, njE-nj-l

if Ej is already in the aspect: njE-nj+l; otherwise. add (Ei. 1) niE-Di-l

DiE-Di+l

if Ej is already in the aspect

ifnj =2:

njE-nj+2; otherwise, add (Ej, 2)

delete (Ej, 2); othelWise, njE-nj-2

if Ej is already in the aspect

if nj =1: delete (Ej, 1); othelWise, njE-nj-l

njE-nj+l; otherwise, add (Ej, 1) niE-ni-l

DiE-Di+l

Note. AE-B means that B replaces A in the aspect

- case d') refers to the "Fortress" problem, i.e.,the case where there are only the polygonal holes and the region where the guards can be located is unbounded[1, pag.146]. In this case, an active segments could be unbounded. However, inspecting the previous cases in the Table we can verify that this only affects case (d). If the right active segment is unbounded, the positive and negative visual events reduce to the parts affecting Ei. This produces the new entry (d'). Computing II requires to perfonn the following substeps: 1(a)-Computing the active segments of II'

Welzl's algorithm ([1] page 211). -The partitionII' can be constructed using a plane sweep algorithm in O(plogp) time, where p is the number of vertices of the partition (regions and edges also are O(p))(see[19]). For each edge of II' lying on an active segment we store in the data structure the positive direction and the visual event. -For computing II' from II some construction lines must be removed and the regions which these lines separate merged together. The time for computing the aspect of the starting region, visiting II', computing II and storing all aspects is O(n2+pn). Adding up, the overall time bound of Step 1 is

l(b)-Constructing II' l(c)-Rejining

-O(n2) active segments are obtained in O(n2) time using

II' into n using a visiting algorithm.

In the following we omit the details of the substeps, which can be found in [29]. In summary:

229

O(n2 +plogp+pn).

Step 2. Computing the dominant regions Finding the dominant regions requires to compare the sets of fully visible edges Ei of each region Zi. This process can be shortened observing that 1) A necessary condition for a region Zi of to be dominant is that Ej c Ei for all the regions Zj adjacent to Zi • or. in other words. all the positive crossing directions of the edges of Zi are toward the inside of the region (except for the edges of P). 2) If all the edges of Zi (except for the edges of P)are due to cases a) and b) of Table 1. i.e., they lie on lines supporting edges of P, condition 1) is also sufficient The fust statement is obvious. For the second, it is sufficient to observe that if the edges of Zi lie on the lines supporting the edges Ep, Eq,...Ek. no other region is able to observe this set of edges. Thus, the dominant regions are found as follows: - first visit all regions of and check condition 1) for selecting c candidate dominant regions in O(P) time. Regions also satisfying condition condition 2) are immediately recognized to be dominant - perform O(c2) comparisons in O(nc2) time for selecting d dominant zones. Adding up, Steps 1 and 2 of the algorithm require O(n2+plogp+pn+nc2) time. In Fig.13 we

n

n

n'

n

show both partition and for a polygon with 9 edges and one hole and the 5 resulting dominant regions.

Step 3. Finding an optimal solution An optimal (or minimum) solution consists of a set of regions Sj= (Zjl, Zj2, •••ZJ"k ••••) which covers E with the minimum number of members. Finding an optimal solution is an instance of the set covering problem. In general, given a set S and a number of subsets, an optimal cover is a set of subsets whose union is S and that minimizes the sum of the costs of the subsets. In our case all costs are equal. The corresponding decision problem ( there is a cover with k subsets or less?) has been shown to be NPcomplete(see [25]. pag 37). Numerous practical situations have been modeled as set covering problems, and a number of algorithms for set covering have been presented(see for instance[26], Chapter 13). When. as in our case, only one minimal solution is required, much pruning can be performed. Here we will briefly recall an algorithm, developed for the minimization of switching functions, which appears convenient for our case. Full details can be found in [27], Chapter 4, where the algorithm is presented in tabular form without complexity analysis. Here we will present the algorithm making reference to a data structure where each region has pointers to the edges covered, and each edge has pointers to the regions from which is covered. The algorithm consists of two parts; the first part is usually called the Quine-McCluskey algorithm. Part 1(Quine-M cCluskey algorithm) Perfonn (in any order) the following steps: Step 1) Select the essential regions, i.e., those which cover at least one edge not covered by any other zone. Update the data structure by deleting these regions and the edges covered. Step 2) Select and delete the dominated regions. A region Zi is dominated by another region Zj if the set of edges covered by Zi is equal to or a subset of the set of edges covered by Zj. Step 3) Select and delete the dominated edges. An edge Ei is dominated by an edge Ej if the set of regions which cover Ej is equal to or a subset of the set of regions covering Ei. Exit if all edges have been covered; go to Part 2 if none of the three steps reduces the data sttucture.

Fig.12-Partitions n'(a) and II (b) of a polygon. In II' the active segments are solid, the rest of the active lines is dotted. Five dominant regions result. Zl, Z3, Zs are immediately identified from the positive crossing directions of the edges.

Part 2) Apply the branch-and-bound technique as follows. Select arbitrarily one edge and one region covering the edge. Create two sub-cases: in the fIrSt case the

230

region is selected for the cover, in the second, the region is deleted from the structure without deleting the edges covered. Re-enter the Quine-McClusky algorithm for both cases. The bounding can be obtained by stopping the cover of a sub-case as soon as it going to have more regions of the best cover already found. In some cases an optimal cover can be found without branching, as for the polygon in Fig. 13. In this case, Step 1 (Fig.14 (a»fmds one essential region (Z5). Step 2

* * *

* * * * ** * * ** ** * * * * (a)

edge) a further branching is necessary before re-entering the Quine-McCluskey algorithm. Also in these cases(we omit the details), the Quine-McClusky algorithm supplies one cover without any further branching. All the covers obtained are optimal. Let us analyze the complexity of the algorithm. If no branching is required, O(n) steps of Quine-McClusky algorithm are performed. Straightforward implementations of Steps 1,2 and 3 are O(n), O(nd2) and O(dn2). Adding up, the algorithm without branching is O(n2d2 +dn3 ). In the worst case, branching is always necessary. Each branching is O(n) and a binary tree with depth O(d) and 0(2d) nodes is constructed, thus the overall complexity is O(n2d). A greedy near-optimlll solution

(b)

Fig. 14. A tabular representation of the selection algorithm for the polygon of Fig. 13. (Fig.14(b» deletes the dominated regions Zt, Z3, 24. Step 3 has no effect, and eventually Z2 is selected by Step 1. If we apply Step 3 immediately after Step 1, the edge E9 dominated by EI is deleted A subsequent application of Step 2 deletes again Zl, Z3, 24. Let us consider the case of Fig. 10, where some branching is required. No essential region is present since each edge is covered by three dominant regions. Thus we chose an arbitrary edge (EI) and an arbitrary region (Zl) covering EI, E2 and E3. In the frrst sub-

Although the above algorithm is likely to perfonn satisfactorily in most cases, we are not able to make precise statementsaboutits average behavior. Thus,anear-optimal solution obtained with a polynomial selection algorithm could be interesting. Such a solution can be obtained with a greedy heuristic, which selects each time the region which covers the largest number of uncovered edges. A straightforward implementation of this algorithm is O(np2). Although its perfonnance cannot be guaranteed to be data-independent, it does not depend on the number of edges n. Let GEEG(p) be the number of regions obtained by the greedy algorithm and let r be the largest number of edges observed by a dominant region of P. It can be shown (see [28], pag.466) that: GEEG(p)/GEE(p) S l+lg(r) Observe that r could be small even if n is large.

VI. SUMMARY AND DISCUSSION

IZz, Zs, Z7, Z9 I I Z3, Zs, Z7, ZIO I Fig. IS-The branching required by the polygon in Fig. 1O. At each leaf of the tree there is one of the solutions provided by the Quine-McCluskey algorithm. case(see Fig. 15), the Quine-McClusky algorithms obtains one cover without any further branching. It is easy to verify that: Step 2 deletes Z2, Z3, Z9, ZIO; Step 3 deletes E3, E4, E7; Step 1 selects Z4 and Zs; further applications of Steps 2 and 1 lead to the selection of ZS or Z6 or Z7. In the second case (deleteZI without deleting any

231

Many efforts have been made and many results obtained in the "Art Gallery" area, but the main practical problem of stationing a minimum set of guards for covering the interior of given polygon, is still open. Up to now, neither exact finite algorithms, nor approximate algorithms with guaranteed performance have been found able to cope with this elusive problem. In this paper we have explored the related problem of covering the edges of a polygon with a minimum set of guards, neglecting possible interior uncovered areas. The minimum edge and interior covers have been compared for a given polygon. In some case, a minimum set of edge guards also covers the interior. For polygons with holes however the interior cover could be much more requiring: we have found that the interior guards can be O(n) times the edge guards. On the contrary, for poly-

gons without holes the interior guards are at most 15 times the edge guards. For polygons such that the minimum numbers of edge and interior guards are different, no simple rule seems to exist for obtaining a minimum set of interior guards starting from a minimum set of edge guards or vice-versa. On the contrary, a guaranteed approximate solution for one problem can be easily obtained from a solution of the other problem for polygons without holes. Whether it be possible to obtain similar results for polygons with holes is an open question. The worst case numbers of guards have been found to be equal for edge and interior cover, and the edge covering problem to be NP-hard for polygons with and without holes. For the edge covering problem a restriction is possible which could make practical sense. The entire edge covering problem requires that each edge be entirely visible from at least one guard. Also this problem is NPhard. For polygons without holes, the worst case number of guards is Lnl3J as for the unrestricted problem. For polygons with one hole, we have found that at most L(n+2)13J guards are always sufficient and sometime required. For more than one hole, we conjecture that L(n+h)13J is the tight bound. For the entire edge covering problem we have described an algorithm which computes a set of polygonal regions where the guards of a minimum set can be independently located. The algorithm is also suitable for the "Fortress" or "external guarding" problem. The last step of the algorithm is an instance of the set covering problem, exponential in the worst case. However, a selection algorithm, well known in the area of switching functions minimization and aimed at finding only one minimum solution, could show a satisfactory average behavior. In any way, a greedy selection supplies in polynomial time near optimal solutions within a factor only dependent on the logarithm of the largest number of edges observed by a guard, and independent on n. In practice, placing visual sensors probably requires to face some additional constraint A feature of the algorithm described is that it can easily be modified for taking into account geometrical restrictions. For instance, a maximum and a minimum distance from each point observed could be required. This constrains the guards required for observing each edge into a region whose boundary lines can be used for obtaining a modified parti-

We have shown that a solution for the entire visibility problem is not an approximate guaranteed solution of the unrestricted edge covering problem. However, the observed difficulties of transforming a solution of the edge covering problems into a solution of the interior covering problem and vice-versa suggests some hope that for edge covering it be possible to solve some of the unsolved interior covering problems, as rmding exact algorithms or approximate algorithms with guaranteed performance.

n

tion * of P. It is easy to see(we omit the straightforward details) how the sets Ef" of entirely visible edges of each

n

region Zi* of * can be obtained. The rest of the algorithm is unchanged.

232

REFERENCES [1] J. O'Rourke,"Art gallery theorems and algorithms," Oxford University Press, New York, 1987 [2] Thomas C. Shermer,"Recent results in art galleries,"IEEE Proc. Vo1.80, no.9, pp.1384-1399, Sepl1992 [3] V Chvatal,"A combinatorial theorem in plane geometry,"]. Combinatorial Theory, sere B, vol.18, pp39-41, 1975 [4] S. Fisk,"Short proof of Chvatal's Watchman Theorem,"J. Combinatorial Theory, sere B, vol.24, p. 374, 1978 [5] I. Bjorling-Sachs and D.L. Souvaine," An efficientalgorithm for guard placement in polygons with holes,"Discrete&Computational Geometry, Vol. 13, pp77-109, 1995 [6] F. Hoffmann, M. Kaufmann and K. Kriegel,"The art gallery theorem for polygons with holes,"Proc. Symp. of Foundations of Compo Science, pp39-48, 1991 [7] F. Hoffmann,''The art gallery theorem for rectilinear polygons with holes,"Intemal Rept Dec.1994 [8] D. Avis and G. T. Toussaint,"An efficient algorithm for decomposing a polygon into star-shaped polygons," Pattern Recognition, vol 13, pp.395-398, 1981 [9] J. O'Rourke and K. Supowit,"SomeNP-hard polygon decomposition problems," IEEE Trans. Inform. Theory, vol. IT-29, no.2, pp.181-190, March 1983 [10] D. Lee and A. Lin,"Computational complexity of art gallery problems," IEEE Trans. Inform. Theory, vol. IT-32, no.2, pp.276-282, March 1986 [11] S.Gosh,"Approximation algorithms for art gallery problems," Proc. Canadian Information Processing Society Congress, 1987 [12] B. Chazelle and D.Dobkin,"Optimal convex decomposition," in Computational Geometry, G. Touissant, Ed. New York: North-Holland, 1985 [13] A. Lingas, ''The power of non-rectilinear holes," in Proc. 9th Colloq. Automata, Languages, and Programnting,1982,pp.369-383

[14] J.M.Kail, "Decomposing a polygon into simpler components," SIAM J. Computing, Vol. 14, pp.799-814, 1985 [15] S. Ntafos,"On gallery watchmen in grids," Info. Proc. Let. Vo1.23, pp. 99-102, 1986 [16] A. Aggarwal, S. Ghosh and R. Shyamasundar, "Computational complexity of restricted polygon decomposition," in Computational Morphology, G. Touissant, Ed. New York: North-Holland, pp. 1-11 , 1988 [17] J.C. Culberson and R.A.Reckhow,"Covering polygons is hard,"Journal of Algorithms, Vol.17, pp.2-44, 1994 [18]F.Preparata and M.Shamos,"Computational geometry" ,Springer-Verlag,New Yark, 1985 [19] Z. Gigus, J. Canny and R.Seidel,"Efficiently computing and representing aspect graphs of polyhedral objects," IEEE Trans.Pattern Anal. Machine I ntell.•Vol. 13, pp 542-551, June 1991 [20] H.Plantinga and C.R.Dyer,"Visibility, occlusion and the aspect graph," Int. Journal ofComput. Vision, Vo1.5, No.2, pp.137-160, 1990

233

[21] M.Seibert and A.Waxman,"Adaptive 3-D object recognition from multiple views", IEEE Trans. Patte Anal. Machinelmell., vol.I4,no.2,pp.l07-124,February 1992 [22] J. A. Gualtieri et al., "The visual potential: one convex Polygon", Computer Vision. Graphics and Image Processing, Vol 46, pp. 96-130,1989 [23] S.Baase, Computer algorithms, Addison-Wesley, New York, 1988 [24] H.Edelsbrunner," Algorithms in combinatorial geometry", Springer-Verlag, Berlin Heidelberg, 1987 [25] R.G.Parker and RL. Rardin," Discrete Optimization", Academic Press, San Diego, 1988 [26] H.M. Salkin and K. Mathur,"Foundations ofInteger Programming", Elsevier, 1989 [27] S. Muroga,"Logic Design and Switching Theory", John Wiley & Sons, 1979 [28] G. Nemhauser and L.Wolsey ,"Integer and Combinatorial Optimization,"John Wiley& Sons, 1988 [29] ALaurentini,"Guarding the walls of an art gallery,"Int. Rept1995

On Rectangle Visibility Graphs III. External Visibility and Complexity extended abstract

Thomas C. Shermer * Simon Fraser University Burnaby, Be V5A 1S6

1

Introduction and Definitions

[!]

Let 'R, = {.R;} be a collection of pairwise disjoint closed rectangles in the plane. Two rectangles R; and Rj will be called 'Visible if there is a closed nondegenerate rectangular region Bij (called a band of 'Oisibility) such that one side of Bij is contained in a side of R;, the opposite side of Bij is contained in a side of Rj, and Bij does not intersect the interior of any rectangle in 1l. This type of visibility is equivalent to what Tamassia and Tollis have called e-visibility [8]. The 'Visibility graph of 1l is the graph of the visibility relation on vertex-set 'R,; a collection of rectangles and its visibility graph is shown in Figure 1. A graph is called a rectangle 'Visibility graph, or RVG, if it is the visibility graph of some collection 'R. of rectangles (1l is called the layout of the graph). A graph is called a weak RVG if it is a subgraph of an RVG. In weak layouts we are allowed to embed two nonadjacent vertices as rectangles that are visible; in non-weak layouts this is not allowed. For convenience, we will henceforth write the prefix e- to mean "non-weak" when we want to emphasize this aspect (e.g. an e-RVG is a (non-weak) RVG as defined above). We distinguish between two types of e-Iayouts of graphs: collinear and noncollinear. A layout is called collinear if there is a pair of rectangles that have collinear sides, and noncollinear otherwise. This distinction is unnecessary for weak RVGs, as any weak collinear layout can be converted to a weak noncollinear layout by perturbation. Observe that every noncollinear RVG is a collinear RVG, and every collinear RVG is a weak RVG. Rectangle visibility layouts of graphs are of interest for a variety of reasons. They naturally arise in

81~ Q (a)

d

9

~J 0

[Z]

b

e

(b)

Figure 1: A set of rectangles and its visibility graph

two-layer routing problems in VLSI or printed-circuit board design. In a more general setting, they can be used for labelled graph layouts, as vertex labels can be written inside the rectangles, and edge labels need only avoid horizontal and vertical obstacles (the sides of the rectangles and the visibility edges). Furthermore, all edge crossings in a rectangle visibility layout are perpendicular, and if the graph is an e-RVG, the crossings in the drawing can eliminated by simply not drawing the edges (the vertex placement defines the graph). RVGs are closely related to bar-visibility graphs (or BVGs): those graphs that can be drawn so that their vertices are represented by horizontal line segments, and their edges by vertical bands of visibility. Any BVG must be planar, as can be seen by shrinking the horizontal segments to points while deforming the rest of the plane, allowing the edges to bend. We use the modifiers E-, weak, collinear, and noncollinear on BVGs with the same meaning as for RVGs. Noncollinear BVGs were characterized by Luccio, Mazzone, and Wong [5] as ipo-triangular graphs: those graphs that can be transformed into • Supported by NSERC Research Grant No. OGP0046218. This work was completed while the author was a visitor at a triangulated planar multigraph by duplications of DIMACS, Rutgers University, Piscataway, NJ. existing edges. Collinear BVGs were characterized 234

by Wismath [9], and independently by Tamassia and Tollis [8], as those planar graphs that can be drawn in the plane with all cut-vertices on a single face. Deciding if a graph is a collinear BVG takes only linear time [8, 10]. Weak BVGs were characterized by Duchet et al. as planar graphs [3], and are thus also recognizable in linear time. RVGs do not seem to have such succinct characterizations. We proceed to survey what is known about RVGs; this review is interspersed with the necessary definitions. We will say that a graph G can be decomposed into graphs G 1 and G 2 if G, G 1 , and G 2 have the same vertex set, and the edge set of G is exactly the union of the edge sets of G1 and G2 • This can be viewed as coloring the edges of G with 2 colors so that one color class forms G 1 and one forms G2. We will use the concepts of decomposition and edge-coloring interchangably. By the term colored graph we mean a graph whose edges have been colored red and blue. Any RVG can be decomposed into two BVGs by finding a layout of the RVG and coloring edges corresponding to horizontal visibilities red and those corresponding to vertical visibilities blue. If we are given a colored graph, we will say that a rectangle visibility layout of the graph respects the coloring if the colors correspond to the directions of visibility as above. A graph is called thickness-two if it can be decomposed into two planar graphs. Any RVG is thicknesstwo, but not every thickness-two graph is an RVG. In fact, Hutchinson, Shermer, and Vince have shown that any type of RVG has at most 6n - 20 edges (whereas thickness-two graphs can have as many as 6n - 12) [4]. Dean and Hutchinson [2] established that the complete bipartite graphs K",q are noncollinear RVGs iff p < 3 or (p, q) (3,3) or (p, q) = (3,4), and that they are collinear iff p :5 4. They also show that a bipartite RVG can have at most 4n - 12 edges. Wismath has shown that all planar graphs are RVGs [10]. A caterpillar is a tree containing a simple path pea, b) such that every vertex not on pea, b) is distance one from pea, b). A caterpillar forest is a forest, where each tree of the forest is a caterpillar. Similarly, a linear forest is a forest where each tree is a path. The arboricity of a graph G is the minimum k such that G can be decomposed into lc forests. Similarly, the linear arboricty (or caterpillar arboricity) or a graph is the minimum k such that the graph can be decomposed into lc linear forests (or caterpillar forests). Note that a graph with linear arboricity k has caterpillar arboricity at most k. Bose et al. have shown that any graph with cater-

=

pillar arboricity 2 is a rectangle-visibility graph [1], and ask if such graphs are easily recognizable. Graphs with linear arboricity 2 are included in this result, but their layouts have special properties, and so recognizing this subclass is also of interest. Peroche [6] has proven that recognizing multigraphs with linear arboricity 2 is NP-complete, and here we show how to modify Peroche's proof to establish that recognizing graphs with linear arboricity 2 is NP-complete, and that recognizing graphs with caterpillar arboricity 2 is NP-complete. This settles the questions raised in [1]. Bose et al. also established that the class of noncollinear RVGs includes lc-trees, for lc :5 4, and partial 2-trees. Graphs with a maximum vertex degree of 3 have linear arboricity two, so the Bose et al. result also shows that these graphs are RVGs. Shermer extended this to show that graphs whose high-degree vertices (degree 4 or more) are far apart are RVGs, and also that maximum-degree 4 graphs are weak RVGs [7]. In this paper, we introduce the notion of external visibility for a BVG or RVG, and characterize some restricted classes of externally visibile BVGs and RVGs. One of these characterizations is essential for establishing our main result, which is that determining if a given graph is an RVG (of any sort-weak, collinear, or noncollinear) is NP-complete. One can view this result as justifying the current approach of trying to find large recognizable subclasses of RVGs rather than trying to find a recognition algorithm or characterization for all RVGs. As noted above, we also show that the problem of recognizing graphs with linear arboricity 2 is NP-complete, as is the problem of recognizing graphs with caterpillar arboricity 2.

2

Externally Visible RVGs

In this section, we study the graphs that are representable when the vertices of a layout are required to be visible from outside the layout in one or more directions; we call such graphs ezternally visible. In a bar-visibility layout, we will say that a horizontalline segment (Le. a vertex) w is N-visible if a line segment N placed above ("to the north of") the entire layout is visible to w. Similarly, we will say that w is S-visible if a line segment S placed below ("to the south of") the entire layout is visible to w. We give similar definitions of N-, E-, S-, and W-visible for RVGs. Let x be one of N, E, S, or W. If every vertex of a BVG or RVG layout is x-visible, we call the layout a x-layout, A BVG or RVG is called a x-BVG or x-RVG, respectively, if it has an x-layout. We can

235

[:::::::~::::::~ I

I I I I

,, ,, ,, , , -, W





II _

i

-I

,

t

G

GI D D CI

I I I I I I IE I I

, I I I

,,_I

I

II

C

.~. 6

_____ '

II

II

I •• I

T

G-'---,-.--

'II t"'1

II

111111'1

II",

"1'1'

• I

T --.-,. T'

I

' __ ~!_l.~!J

I

I

••

II



,.

I

T'- -r --

':" __ ~':'_~J __ t __

6

-:---H--H--~-·. ----- }-----E]--H--:-Hi I------ · --,.T-..... -_I-. -........,.T' ....... . ,.-'_._--'Q--,.-. -...... -- __

e

~ _ _.J



~

I

I



II

d

e

e

(b)

9

I

I

I'



e

I

a

-T I.



--~--

,--r -I



1'1 I

:::~:~-.---,::::t~::~::

_. -.. ---. . _-...--.. --:---1-:- -f -:-., -I

I

I

I

I

I

I

I

I

--:-rf~-:-r--:

I

II

I'

I

11'11

II

I'

g: ):::::::::fj::~Gl!:;:tt::;:::::~:::: g d : .: I d :::: :: :: I I

I

------~-.~--~ •

••

II

Gt-;.......-:----............ :-:--

-(- - - - - --:.... f i .. - r +.. -:- r : :: :: :: I

.

------ ..-- -- .... I I 1

....

II • I II II

II II II

--~..

I t I I II • 1'1 II I1I1 t I

I •• ,"'1

II

....-.

__

I

......... 11

1 ........ 1111

, i' 'e ' ,

J ''; ';

II

II



+~ - - ~ - :: : : : : : _ I I __ • I I t __ ..I _II II II

: :: :: :: H-H :: 1

:: I

.~~~-~~--~~-.~--~--

'1'111

I'II'IIII~I

repeat the above definitions for z being a subset of {N, E, S, W}, with conjunctive meaning; e.g. NEvisible means both N-visible and E-visible. Figure 2 shows an NE-Iayout and an NE-RVG. We now characterize N-BVGs and NS-BVGs. The proofs for N-BVGs are omitted.

-~

e

-I-------r-T'.-,.T-..... ,.T'-r,.-'~---'_._-Q--

I

Figure 2: An NE-Iayout and its visibility graph



h ..... - .... -- .. --

--:::~::f,--rt:

--- - - I-----G}·----:-T

--

h

I' I

f l ' I I I I"

h - }-----..-- ..... -- ....

e

~

-EJ. . . . -."8-'I

------:--H--H--HH-H-H---; -1-------.-T.,--r T--.-r-T,-.-r -

4:.

[:::::::§:::::::~ (&)



-1-------.-- '--r

'I I I I •• 1 I I II I I • IIIII

:::::

II • I ,......., 1..--......-.. I

'6 "

h "

~ 'g ,

Figure 3: an NSEW-layout of a graph with linear arboricity two

Theorem 2.4 A graph G is an NESW-RVG iff it has linear arboricity 2.

Theorem 2.1 A graph G is a weak or collinear N- PROOF IT G is an NESW-RVG, then it has linear BVG iff it is outerplanar. arboricity 2, by Theorem 2.3. On the other hand, if G has linear arboricity 2, then the algorithm of Bose et Theorem 2.2 A graph G is a non collinear N-B VG ale [1] will produce NESW-layout of G, if we require iff each of its two-connected components is a mazimal it to treat each path in the decomposition of G as a outerplanar graph. caterpillar with no feet. To obtain this layout, the The following theorem applies to all three types algorithm constructs a horizontal NS-layout for one linear forest (as in our proof of Theorem 2.3), and a (noncollinear, collinear, and weak) of NS-BVGs. vertical NS-Iayout for the other; each vertex then is Theorem 2.3 A graph G is an NS-B VG iff it is a laid out as a rectangle that is the cartesian product of its corresponding intervals in the horizontal and verlinear forest. tical layouts. Figure 3 shows an example of a graph PROOF (sketch) IT G is a NS-BVG, lay it out and G with linear arboricity two and an NSEW-Iayoutfor add N and S from the N- and S- visibility definitions. G. 0 The graph G contains no K3 because that along with N and S would form a Ks. Furthermore, it cannot We can also consider requiring that each vertex be contain a cycle because that would imply the exis{NS}-visible: either N-visible or S-visible. We can tence of a K3 homeomorph in the layout; thus G is a establish the following, but suspect that one cannot linear forest. The other direction is by construction; two examples are shown on the left and bottom sides obtain similar results for RVGs. of Figure 3b. 0 Theorem 2.5 A graph G is a (weale, collinear, or noncollinear) {NS}-BVG iff it is a (weak, collinear, The preceeding three theorems have ramifications or noncollinear, respectively) N-BVG. for z-RVGs; e.g. an NES-RVG can be decomposed into a linear forest (an NS-BVG) and an outerplanar Linear and Caterpillar Argraph (a N-BVG). We use this to help establish a 3 characterization for NESW-RVGs; this characterizaboricity tion will be used later in our proof that RVG recognition is NP-complete. We leave exact characterization Let Linear Arboricity 2 be the problem of determinof the other classes of z-RVGs as open problems. ing, for a given graph L, if the linear arboricity of L 236

not a subgraph of any caterpillar, so branching is disallowed; the caterpillar and linear arboricities must be the same. This establishes the following:

Theorem 3.2 Caterpillar Arboricity 2 is NPcomplete. (a)

(b)

(c)

Figure 4: The doubled-edge replacement, forbidden graph, and path component

4

Rectangle Visibility Graph Recognition

Let RVG Recognition be the problem of deciding if a given graph G is a rectangle visibility graph. In this section, we show that RVG Recognition is NPcomplete. The proof is by transformation from Linear Arboricity 2, and is fairly laborious. In the first subsection, we study a geometric configuration of four rectangles that we call a four-way, and show how to augment a graph so that in any layout, a given four element subset of vertices of the graph form a four-way. In the second subsection, we further constrain the situation to what we call cyclic four-ways, and show that under certain conditions, if a graph with a cyclic four-way has a layout, then the subgraph that is "inside" the cyclic four-way must have linear arboricity two. In the third subsection, we present an RVG with a maximal number of edges, and show how to augment it so that in any layout of the augmented graph, the favorable conditions exist for some cyclic four-way. In the final subsection, we Theorem 3.1 Linear Arboricity 2 is NP-complete. present the problem transformation and complete the We are also interested in the problem of determin- proof. ing if a given graph has caterpillar arboricity 2, which we denote Caterpillar Arboricity 2. This problem Four-ways. Four rectangles are said to form a fouris trivially in NP, and we will show that it is NP- way if there is some nondegenerate rectangular region complete by transformation from Linear Arboricity T of the plane with one of the four rectangles to each 1 . of its four sides; T is called the four-way rectangle for We note that a path is a caterpillar with no branch- the four rectangles. A four-way is called visible if the ing; if we somehow disallow branching in our caterpil- four rectangles can see a common subset of T. Suppose we have a subgraph G' with a layout, and lar arboricity coloring of a graph, then we are actually performing a linear arboricity coloring of the graph. a visible four-way S. We will say place G' in S to We will disallow branching by replacing each edge mean that we take some rectangle T' contained in uv in the Linear Arboricity 2 instance L with the the interior of the rectangular region that sees the component in Figure 4c. This component ensures four elements of the four-way, and scale the layout of that the edge wx is a "leg" edge of the caterpillar that G' so as to fit in T' and then to place it there. Since it is in, with the path edges of that caterpillar con- T' is properly contained in this four-way, this process tained in the K4'S containing w. Thus, the edges ux does not destroy any bands of visiblity, and so it does and vx must both have the opposite color; we have es- not destroy any visible four-ways. sentially subdivided each edge of L and required that A four-way enforcer for a 4-element subset S the two resulting edges have the same color. This {a, b, c, d} of the vertices of a graph is a collection means that if we have any branch point v in the col- of seventeen K4 's, where each of the 68 vertices in oring of L (i.e. vertex v with at least three incident these K 4 's is connected to a, b, c, and d. A fouredges of the same color), then there is a monochro- way enforcer has linear arboricity two, and thus has matic graph as in Figure 4b. However, this graph is a NESW-layout. is 2, and Linear Arboricity 2 for Multigrapns be the same problem for a given multigraph. By Theorem 2.4, Linear Arboricity 2 is equivalent to NESW-RVG Recognition, the problem of determining if a given graph is an NESW-RVG. Peroche has shown that Linear Arboricity 2 for Multigraphs is NP-complete [6], by transformation from 3-SAT. We transform an instance M of Linear Arboricity 2 for Multigraphs to an instance of Linear Arboricity 2 by replacing each doubled edge uv with the component shown in Figure 4a. Note that any other multiedge (e.g. a tripled edge) in M implies the existence of a monochromatic cycle and thus a "no" answer. We can argue that this component acts exactly like a doubled edge in that in any decomposition into two linear forests, it must consist of a red path and a blue path between u and v. We therefore obtain:

=

237

r -I 1 1

8-'--4-[::: :::]



I~ I

1

L_I

Figure 5: The layout of a cyclic four-way

Lemma 4.1 If G is a graph containing the vertices a, b, c, and d and a four-way enforcer for S = {a, b, c, d}, and there is a layout L for G, then the rectangles a, b, c, and d form a four-way.

Figure 6: The standard layout of M(5)

Cyclic Four-ways and Included Graphs. We will call a four-way {a, b, c, d} in a colored graph cyclic e4 around q2 rectangles vi,i placed as shown in Figure if it induces a K 4 , and the vertices can be relabeled 6 for q = 5. The figure shows what we call the stanso that the edges ab, ac, and cd colored blue, and ad, dard layout for this graph; none of the collinearities db, and bc colored red. The layout of cyclic four-ways in this layout are essential and they can be removed is quite constrained. by perturbation. Let M' (q) be the graph derived from M( q) by Lemma 4.2 If {a, b, c, d} is a cyclic four-way in a adding a four-way enforcer to M(q) for every visible graph G, and G is laid out in a way that respects its four-way in the standard layout of M(q). coloring, then the rectangles {a, b, c, d} must be laid If we have any layout of M(q) (and the correspondout as shown in Figure 50.. ing coloring), then we will call a vertex v special if Given a cyclic four-way {a, b, c, d}, we obtain a (I.) v is e1, e2, e3, or e4, or adjacent to any of these rectangle that we call the main area of the four-way vertices; (II.) v is on a nontriangular face of either by starting with the four-way rectangle and expand- BVG; or (III.) v is on the exterior face of either BVG. ing it until it encounters a, b, c, and d. A rectangle A vertex that is not special is called ordinary, and an that contains no points of the main area will be called ordinary vertex w is called le-ordinary if there is no an ezternal rectangle. An external rectangle will be special vertex within distance Ie of w in M (q). We can establish that there are at most 42 special called adjacent if it is visible to a, b, c, and d. vertices in any layout of M(q). This implies that for Lemma 4.3 Let {a, b, c, d} be a cyclic four-way in a any given le, if q is made large enough, then there colored graph M, and let G be the subgraph of M in- will be a le-ordinary vertex in M (q); in particular, if duced by those vertices that are adjacent to all four q ~ 54, there is a 2-ordinary vertex. Let Si,j be the four-way {vi,i' V;,;+l, Vi+1,j, elements of {a, b, c, d} (ezcluding a, b, c, and d). If M has a rectangle visibility layout that respects the Vi+1,;+1}' We can proceed to show that for any 1coloring, and such that are no adjacent ezternal rect- ordinary vertex 11, in any layout of M'(q), the neighangles for {a, b, c, d} in this layout, then G has linear borhood of 11 in M(q) must be colored exactly as it was in the standard layout, and show the following arboricity 2. lemma: The main point of the proof of this lemma is that M must have a NESW-Iayout, and we then apply Lemma 4.4 Let Mil be an supergraph of M'(q) and Theorem 2.4. 11 = Vi,j be a 2-0rdinary vertez of M'(q) in a layout of Mil (with the corresponding coloring). Then Si,j is a The Maximal Graph M(q). We use the construc- cyclic four-way with no adjacent external rectangles. tion of Hutchinson, Shermer, and Vince for an RVG M(q) on n = q2+4 vertices with the maximumnum- The Transformation. We are now ready to deber 6n - 20 of edges [4]. This graph is defined as the scribe how to transform an instance L of Linear RVG of the arrangement of 4 rectangles e1, e2, e3, and Arboricity 2 to an instance of RVG Recognition. 238

=

In closing, the author would like to thank James We start by constructing the maximal graph M Abello, Alice Dean, and Joan Hutchinson for many M(54), and M' M'(54), as described in the last section. Complete the construction by including a helpful discussions and suggestions. copy of L adjacent to all vertices of Si,i for each 1 :$ i, j :$ 49, giving a graph Mil. This transformation is polynomial: M has constant References size, M' also has constant size, and Mil is larger than [1] P. Bose, A. M. Dean, J. P. Hutchinson, and T. C. M' only by a constant times the size of L. Shermer. On rectangle visibility graphs I. k-trees and caterpillar forests. manuscript, 1996. Theorem 4.5 RVG Recognition is NP-complete. [2] A. M. Dean and J. P. Hutchinson. RectanglePROOF RVG Recognition is in NP, as one can guess visibility representations of bipartite graphs. a layout and verify it. Discrete Applied Mathematics, 1996, to appear. IT L has linear arboricity two, then construct a lay[3] P. Duchet, Y. Hamidoune, M. Las Vergnas, and out of Mil as follows. Layout M using its standard H. Meyniel. Representing a planar graph by verlayout. Next, place each four-way enforcer (using tical lines joining different levels. Discrete Mathits NESW-Iayout) in the visible four-way that it enematics, 46:319-321, 1983. forces. Finally, place each copy of L (using its NESWlayout) in the four-way for its four adjacent vertices. [4] J. P. Hutchinson, T. C. Shermer, and A. Vince. This gives a noncollinear layout for Mil. On representations of some thickness-two graphs IT Mil has a layout of any variety, then it has a (extended abstract). In F. Brandenburg, ediweak layout. There is some vertex ?Ji,i in M (and tor, Proc. of Workshop on Graph Drawing, volthus in Mil) that is 2-ordinary. By Lemma 4.4, the ume 1027 of Lecture Notes in Computer Science. four-way S',i is cyclic and has no adjacent external Springer-Verlag, 1995. rectangles. But an instance of L is included in M' adjacent to S',i; by Lemma 4.3, L must have linear [5] F. Luccio, S. Mazzone, and C. K. Wong. A arboricity two. 0 note on visibility graphs. Discrete Mathematics, 64:209-219, 1987.

=

5

[6] B. Peroche. Complexite de l'arboricite lineaire d 'un graphe. RAIRO Recherche Operationelle, 16(2):125-129, 1982.

Conclusion

In summary, we have introduced several classes of [7] T. C. Shermer. On rectangle visibility -graphs externally visible BVGs and RVGs, and have given II. k-hilly and maximum-degree 4. manuscript, characterizations of some of them. Of particular im1996. portance (to the current work, at least) is the charac[8] R. Tamassia and I.G. Tollis. A unified approach terization of NESW-RVGs as graphs with linear arto visibility representations of planar graphs. boricity at most 2. We have shown that the probDiscrete and Computational Geometry, 1:321lems Linear Arboricity 2 and Caterpillar Arboricity 341, 1986. 2, which are closely connected with RVGs, are NPcomplete. We have also established that RVG Recog[9] S. K. Wismath. Characterizing bar line-of-sight nition is NP-complete, for weak, collinear, or nongraphs. In Proc. 1st Symp. Compo Geom., pages collinear RVGs. 147-152. ACM, 1985. It is still open as to whether or not RVGs have a succinct graph-theoretical characterization; the NP- [10] S. K. Wismath. Bar-Representable Visibility completeness result here is somewhat discouraging Graphs and a Related Network Flow Problem. with regards to this. However, NESW-RVG RecogniPhD thesis, Department of Computer Science, tion being NP-complete does not stop one from estabUniversity of British Columbia, 1989. lishing a satisfying characterization of NESW-RVGs (Theorem 2.4), so there is still some hope that RVGs may be characterizable. The other problems that we have left open here are those concerning the different classes of externally visible RVGs that were presented in Section 2.

239

Maintaining Visibility of a Polygon with a Moving Point of View* Danny Z. Chen t

Abstract The following problem is studied in this paper: Given a scene with an n-vertex simple polygon and a trajectory path in the plane, construct a data structure for reporting the perspective view from a moving point along the trajectory. We present conceptually simple algorithms for the cases of this problem in which the trajectory path consists of several line segments or of a conic curve that contains the polygon. Our algorithms take O(nlogn) time and O(n) space. We also prove that the problem of reporting perspective views from successive points along a trajectory path takes !l(n log n) time in the worst case in the algebraic computation tree model. Our data structure reports the view from any query point on the trajectory in O( k + log n) time for a view of size k.

1

Introduction

In this paper, we study the following problem: Given a scene with an n-vertex simple polygon P and a trajectory path in the plane, report the perspective view from each of a sequence of successive points on the trajectory. We present conceptually simple and optimal algorithms for the cases of this problem in which the trajectory path consists of several line segments or of a conic curve that contains the polygon. Intuitively, the polygon P could represent the "opaque" walls of a building. The general problem of computing visibility information of a geometric scene along a trajectory arises in several application areas, such as computer animation, computer vision, image compression, and flight simulation. Bern et ale [2] and Mulmuley [11] studied a case of this problem in which the trajectory is a straight line and the scene consists of a set of polygons in the 3-dimensional (3-D) space. Lenbof and Smid [10] considered a related problem of computing the visibility -This research was supported in part by the National Science Foundation under Grant CCR-9623585. fDept. of Computer Science & Engineering, University of Notre Dame, Notre Dame, IN 46556, USA. chen~cse.nd.edu. 'Dept. of Computer Science & Engineering, University of Notre Dame, Notre Dame, IN 46556, USA. odaescu~bach.helios.nd.edu.

240

Ovidiu Da.escu*

map for a 3-D scene consisting of disjoint spheres from a moving point on a circle at infinity. Note that the visibility from points along a trajectory path can be captured by a sequence of "similar" views in the sense that one view differs topologically from the next view only slightly. That is, at certain points along the path, topology changes occur to the view (e.g., a newly seen object emerges in the view or a previously visible object disappears from the view). We call these points on the trajectory its critical points. The solutions of Bern et al. [2] and Mulmuley [11], for a more complicated 3-D version of the problem, use persistent data structures [5, 13] to capture the topological changes of the visibility from points along the trajectory. However, their data structures support only ray shooting queries and it is not immediately clear how these data structures can be modified to report the complete view from a query point in an outputsensitive manner. We also use a persistent data structure to maintain visibility from points along a trajectory for a simpler (planar) scene. Our data structure requires O(nlogn) time and O(n) space to construct. This data structure reports the view from any query point on the trajectory in an output-sensitive fashion (Le., in O(k+logn) time for a view of size k). Further, we prove that reporting all critical points in the order along the trajectory (at which topological changes of the visibility occur) requires O(nlogn) time in the worst case in the algebraic computation tree model. Hence we solve optimally the problem of reporting the view from a moving point along a trajectory path. Our algorithms are quite simple conceptually. Note that the visibility of a moving point along a trajectory path is closely related to the weak visibility of the path. With the boundary of the polygon P being the only "opaque" object, a point p is said to be weakly visible from the trajectory if and only if p is visible from some point (depending on p) on the trajectory. Many algorithms have been developed for computing the weak visibility of a polygon from a line segment [4,6-9,14]. Our solutions will make substantial use of several structures of the weak visibility of P from the trajectory. The rest of the paper consists of 3 sections. Section 2

reviews some notations and preliminary results needed by our algorithms. Sections 3 describes in detail our algorithm for the case with the trajectory path being a line segment inside P. Section 4 extends our solution to several other cases of the problem.

2

Preliminary

Let P be the input simple polygon, specified by the list of vertices V = (VI, V2, ••• , V n ) along the boundary bd(P) of P clockwise. Without loss of generality (WLOG), we assume that no three distinct vertices of P are collinear. We denote the x (resp., y) coordinate of a point p in the plane by x(P) (resp., y(P». It is well known that a triangulation of P can be obtained in linear time [3). In [7], it was proved that the weakly visible polygon of a triangulated polygon P from a line segment l that does not cross the boundary bd(P) of P can be computed in linear time. We will denote the weakly visible polygon of P from I as Vis(P,l). Consider the case in which the segment l is the input trajectory. Observe that for each point x on I, the visible portion of P from x, denoted by Vis(P, x), is completely contained in Vis(P, l) (Le., Vis(P, x) ~ Vis(P,I». Hence the visibility of a moving point along the segment I is concerned only with points in Vis(P, l). WLOG, we assume that for a segment I in P, we have computed Vis(P, l) (in linear time). From now on, our discussion will fOCllS on Vis(P, I). We denote Vis(P, l) still by P and denote the number of vertices of P as

IPI=n. Consider Vi.!I(P, x) for a given point x E I. Vis(P, x) is said to be star-shaped and it is well known that when traversing the boundary of Vis(P, x), its vertices and edges are visited in the sorted order by their polar angles with respect to x [12]. The edges e of Vis(P, x) can be classified into two types: (i) e is either part of an edge of P, or (ii) e is not on bd(P) except its end vertices. We call the edges of the first type real edges (because they are part of some edges of P), and the edges of the second type false edges. It is easy to see that the vertices of Vis(P,x) are all on bd(P). Let l be the line segment from which weak visibility of the input polygon was computed, and let a and b be the endpoints of I. Suppose a point x traverses along l from a to b. At certain "moments" of this traversing, the visibility of P from the point x, Vis(P, x), may change its topology as some edge of Vis(P, x) becomes no longer visible from x or a "new" edge becomes visible from x. These special "moments" correspond to certain points on 1, called critical points. One of our main tasks is to characterize the critical points on I. This characterization is done by exploiting the relation between a weakly visible polygon and certain shortest paths inside it.

241

It is known [1] that the shortest path tree inside P rooted at an end point .'J of l can be computed in linear time (since P is weakly visible from I). The algorithm for computing such a shortest path tree is based on the outward convexity of the shortest paths to s whose vertices are also vertices of P. Figure 1 gives an example of such an outward convex path from V to b. a false edge of Vis(P.x)

a real edge of Vis(P,x)

Vis(P,I) - _ "....AI

Vis(P.x)

Figure 1: illustrating Vis(P, l), Vis(P,x), and a shortest v-to-b path in P. To maintain the visibility information for points on the segment l, we make use of persistent data structures [5,13]. Ordinary data structures are "ephemeral" because any change to the structure destroys the old version. In contrast, a "persistent" data structure allows accesses to the current version as well as to the old versions that had occurred in a past time. A time in our problem corresponds to a point on the segment I visited during the traversing of l. Techniques for designing persistent versions of binary search trees that support logarithmic time operations of search, insertion, and deletion were presented in [5,13]. In particular, a persistent red-black tree was used in (13) to maintain a sorted list. Let m be the total number of update operations on the list. The persistent data structure in [13] implements update and search queries (even in the past) in O(logm) time each. The space used by this data structure is 0(1) per update operation amortizedly (and hence O( m.) total space in the worst case). We will reduce the computation for maintaining the visibility from points along the segment 1 to a sequence of O(n) update operations (Le., insertion and deletion) that can be handled by the data structure in [13].

3

The Basic Algorithm

In this section, we present an algorithm for the basic case with the trajectory path being the line segment 1 inside P. This algorithm, nevertheless, illustrates our key ideas. The algorithm takes 0 (nlog n) time and

o (n)

space to build the persistent data structure for our visibility problem. We also prove that sorting all critical points in the order along the trajectory requires O(n logn) time in the worst case in the algebraic computation tree model. This implies that we solve optimally the problem of reporting the view from a moving point along a trajectory path. Our algorithm consists of the following three steps: Step 1: Let a and b be the starting and ending points of I. Compute shortest paths inside P from the vertices of P to each of a and b. Use this shortest path information to characterize the critical points of I. Step 2: Partition I into a set S of O(n) intervals such that the view from a point moving along such an interval of S is topologically unchanged. Step 3: Build a persistent data structure to store the visibility information along I. The data structure will support a fast report of Vis(P, x) for any query point x E l. We first show in Section 3.1 how to perform Steps 1 and 2. In Section 3.2, we present the persistent data structure that stores the visibility information along I (Step 3). We prove in Section 3.3 an O(nlogn) worst case lower bound in the algebraic computation tree model for sorting the critical points along I.

3.1

Computing the Changes in Visibility

Topological

,

. b

,

... ,

I



242

1 1 1 1 I

I

"

"..

I

,

y"

I

......

.J1

.... -- .. I

..

.

y"

x

~

p

Figure 2: illustrating various types of critical points on the trajectory I.

that is not U c (e*), called the farther vertex U f (e*) of e*, changes its actual location on bd(P) (the location of uc(e*) remains the same). The changes to each real edge e are in fact caused by the changes to one or two false edges of Vis(P, x) whose farther vertex defines an end vertex of e. Now consider a real edge e and a false edge e' of Vis(P, x) such that the farther vertex uf(e') of e' defines an end vertex of e. Let e be contained by the edge ei ViVi+l of P and WLOG let the farther vertex u/(e') of e' falls in the interior of ei. Suppose the point x passes x' and continues moving to the end point b of l. Then u f (e') also continues to move towards the vertex Vi+l of P, maybe tmtil the edge e' encounters a vertex v of P. There are two possible cases for e' encountering a vertex v of P: (i) v = Vi+l, and (ii) v # Vi+l. When v :F Vi+b v must occur in the interior of e'. In case (i) (i.e., v 11,+1), a topological change may (but does not have to) occllr to Vis(P,x) when u/(e') is at Vi+l. This is the situation if at this "moment" of x, the real edge e "shrinks" into a single vertex of Vis(P, x). An example of this situation is given in Figure 2 for x being at the position y'. Furthermore, if the vertex Vi+ 1 of P was also the closer vertex of another false edge e" of Vis(P,x) just before x moved onto the position y', then when x is at y', the two false edges e' and e" of V is (P, x) "merge" into a single false edge of Vis(P, x), also a topological change to Vis(P, x). IT the real edge e does not shrink into a single vertex of Vis(P, x), then when x continues to move such that uf(e') passes Vi+l, a topological change occurs to Vis(P, x). This is the situation when a "new" real edge that begins at Vi+l appears in Vis(P, x). An example of this situation is given in Figure 2 for x being at the position y" (illustrated with the edge ej =VjVj+l of P).

=

Since we assumed (WLOG) that the polygon P is weakly visible from the segment l, the shortest paths in P from all vertices of P to the endpoints of I can be computed in O(n) time [1]. Hence we only need to discuss the characterization of the critical points of l. We will first show how to identify the critical points on l and how to use them to obtain a partition S of I. We will then prove that O(nlogn) is a worst case lower bound in the algebraic computation tree model for sorting the critical points along I. Let x be a point moving on I by starting at its end point a and consider how Vis(P, x) changes correspondingly (see Figure 2). Recall that the boundary bd(Vis(P, consists of real edges and false edges, as defined in Section 2. Suppose that when x is moving towards a position x' E l, the topology of Vis(P, x) remains tmchanged. But nevertheless, other changes can occur to some real and false edges of Vis(P, x) during this movement of x to x', as follows. The changes to a real edge e of V is (P, x) may be that e becomes longer or shorter, and one or even both of its end verticp..8 change their actual locations on bd(P). Note that a ral~e edge e* of Vis(P,x) is always collinear with x, and that the end vertex of e* that is closer to x than the other end vertex of e*, called the closer vertex uc(e*) of e*, is always a vertex of P. The change to a false edge c* of Vis(P, x) may be t.hat the end vertex of e*

/11

. . .. ,

=

In case (ii) (i.e., v =1= Vi+l), the false edge e' of 3.2 Building the Persistent Data StrucVis(P, x) is "split" into two false edges of Vis(P, x) ture (one has 11 as its closer vertex), a topological change to Vis(P, x). An example of this situation is given in There are two facts that enable us to use the persistent Figure 2 for x being at the position z (e.g., the false data structure of [13] to maintain visibility information edge of Vis(P, x) at the position z' results into two from points along the segment I. false edges at Zll). If x continues to move and passes z, 1. The order of the vertices and edges of Vis(P, x) then a "new" real edge of Vis(P,x) that begins with based on their polar angles with respect to any v emerges in Vis(P, x), also a topological change to point x E I is consistent with the order of the verVis(P,x). tices and edges of P along bd(P). From the above discussion, it is clear that a topo2. Each critical point in C can be associated with logical change to Vis(P, x) occurs when the point x 0(1) operations on Vis(P, x) such as "delete an becomes collinear with and is visible from two differedge" (e.g., when a real edge shrinks into a vertex ent vertices 11 and w of P simultaneously such that v or two false edges merge into one) and "insert an and w are on the same side of I. The following lemedge" (e.g., when a "new" real edge emerges or mas summarize the useful geometric structures of this a false edge is "split" into two false edges). For situation. example, when an existing false edge e' is "split" Lemma 1 Let a point x be moving along the segment into two false edges because a vertex v of P touches I. A topological change to Vi.~(P, x) occurs or is about the interior of e' (with one of the two false edges to occur if and only if x is at a position that is collinear having vas its closer vertex), what we can actually with and i.~ vi.t;ible from two different vertices v and w do is the following 0(1) operations on Vis(P, x): of P simultaneously such that v and w are on the same (a) delete e' (since its farther vertex changes), (b) ,t;ide of 1. Such a position is a critical point of l. insert each of the two "new" false edges, and (3) insert a "new" real edge that begins at the vertex Proof. Followed from the above discussion. • v of P. IT we associate the two collinear vertices v Lemma 2 Let a and b be the two end points of l. Let v and w of P with their corresponding critical point and w be two different vertices of P such that (1) they p on l, then it is easy to decide what operations are on the same side of I, and (2) there is a critical to perform on Vis(P,p) based on the position of point x of I that is collinear with and is visible to both p and the edges of P adjacent to each of v and w. of them simultaneo1L.t;ly. Then the segment vw is an From the above facts, we maintain Vis(P,x) as a edge on a shortest path from one of v and w to one of (circular) list of real and false edges sorted by their a and b in P. polar angles with respect to x. In the list Vis(P, x), Proof. Easy and omitted. • we represent each real edge e by the "name" ei if e is The characterization of the critical points of I follows contained by the edge ei of P, and represent each false from Lemmas 1 and 2. To identify the critical points, edge by its closer vertex. The following facts are also we do the following. For each vertex v of P, let vv(a) useful: (resp., vV(b» be the first edge on the v-to-a (resp., • In the sorted list Vis(P,x), two different false v-to-b) shortest path inside P. Let the ray originating edges cannot be consecutive to each other unless from v and along vv(a) (resp., vv(b)) cross the segment they are collinear. IT two real edges are consecuI at a point ev(a) (resp., cv(b». Then when a point x tive to each other in the list, then the two edges are travels along I from a to b, ev(a) (resp., cv(b» is the first also adjacent to each other on bd(P) (and hence (resp., last) position at which v is visible from x, and v their common vertex in P belongs to Vis(P, x». is visible from x while x is in the interval cv(a)ev(b) on l. The set C of critical points of I is then {cv(a), cv(b) above facts imply that there is a vertex of P I v is a vertex of Pl. It is clear that ICI = O(n) and in The every (at most) two edges of Vis(P, x). These verthat given the shortest paths from the vertices of P to tices of P in V i.9 (P, x) enable us to perform a binary a and b, C can be easily obtained in O(n) time. search in Vi.9(P, x) based on a polar angle with respect The set S of intervals on I is obtained by first sorting to x. This property also enables us to compute, in in 0 (nlog n) time the points of C along I and then using O(lVis(P, x)D time, the actual edges of Vis(P, x) once these sorted points to divide I into intervals. H several we are given these vertices of P that are on Vis(P, x), critical points coincide at some position of I, then we the ordered list Vise P, x) containing the "names" of its break the tie arbitrarily and let the interval between edges, and the position of x. two such points be of zero length. We are now ready to describe the construction of It is PA"y to see that the computation in this subsecour persistent data structure based on the technique tion takes 0 (n log n) time and O( n) space.

243

of [13]. First we compute Vis(P, a) from the starting point a of I; this takes O(n) time [12]. Then using the sorted sequence C of critical points along I, we perform appropriate insertion/deletion operations on Vis(P, x) at each critical point, corresponding to the traveling of a point x along l. The insertion/deletion of an edge in Vi.~(P, x) is guided by binary search based on the angular information of an appropriate vertex of P with respect to x. Our construction of the persistent data structure requires O(nlog n) time and O(n) space, because totally O(n) update operations are done (for O(n) critical points, each causing 0(1) such operations). This data structure enables us to do binary search in Vis(P, x) (based on angular information) in O(logn) time. In fact, it allows us to compute all edges of Vis(P, x) between two polar angles with respect to x in O(k+logn) time, where k is the number of edges reported [13]. Hence with this data structure, we can report Vis(P, x) for any query point x E l in an output-sensitive O(lVis(P, x)1 + logn) time.

3.3

Lower Bound of Sorting the Critical Points along a Trajectory

Since P is a weakly visible polygon from the segment l and since the critical points of l are obtained by "projecting" onto l the vertices of P along their first edges on the shortest paths to the end points a and b of I, one could suspect that it might be possible to sort the set of critical points along I in less than O(nlog n) time. But the following lemma shows that this is not the case. Lemma 3 The problem of reporting all the critical point.~ in their order along the segment I requires O(nlogn) time in the worst case in the algebraic computation tree model.

Proof. The lemma is proved by reducing, in linear time, the problem of sorting arbitrary integers to that of reporting all the critical points in their order along I. Note that from Yao's results in [15], sorting n integers in an arbitrary range requires O(nlogn) time in the worst case in the algebraic computation tree model. Further, note that it is easy to red nce, in linear time, the problem of sorting n arbitrary integers to the case of sorting n positive integers in an arbitrary range. Actually, we reduce the problem of sorting n positive integers (in an arbitrary range) to that of reporting the critical points along l. Also, it is sufficient to consider only those critical points that are generated by using the shortest paths in P from the vertices of P to the .starting end point a of l. Our reduction works as follows. Given a set AI of n arbitrary positive integers al, a2, . •. , an, we first create a polygonal chain PI = (WI, W2, ••• ,W2n) of 2n vertices that is monotone to the x-axis. The vertices W2i-l of

244

=

PI are at points (i, n-i+ 1) in the plane, i 1,2, ... , n. Each vertex W2i of PI is at the point in the first quad-

rant of the point W2i-l such that the length of the edge of PI is 0.5 and the slope of W2i-lW2i is ai (see Figure 3). PI so obtained is clearly monotone to the

W2i-lW2i

y-axis

a

Figure 3: Reducing the integer sorting problem to that of sorting critical points along RI.

x axis. Now consider an almost vertical ray RI (slant slightly to the right) that is to the right of PI and that originates from a point a on the x-axis (we will choose a later). Observe that PI is weakly visible from RI (provided that RI is long enough) since the ray from every vertex W2i-l and along the edge W2i-l W2i of PI hits a point hi on RI. Also, note that hi is the critical point on Rr for the vertex W2i-l of PI generated by the edge W2i -1 W2i on the shortest W2i-l-to-a path that is inside the region enclosed by RI and PI. Observe that if RI is sufficiently far to the right of PI (because of its starting point a), then the following will hold: For any i,j E {I, 2, ... , n} with i < j, (i) ai ~ aj if and only if y(hi) > y(hj), and (ii) ai < aj if and only if y(h i ) < y(h j ). But the sorted order of the critical points hi based on their y coordinates is the same as their order along RI. Therefore, for an appropriate ray RI, the sorted sequence of AI can be obtained in O(n) time from the sorted sequence of the critical points hi (for the vertices W2i-l of PI) along RI· The only thing left is to show how to choose the ray RI (Le., choose the starting point a for RI). Find the smallest integer in AI; let it be ai. Let L be the line passing the vertex of PI at the point (n, 1) and with slope ai, and L' be the line passing the vertex at the point (1, n) and with slope ai - 1 (ai - 1 is the largest integer that is smaller than ai). Then the intersection point of the ray from each vertex W2k-l of PI and along the edge W2k-lW2k with the ray from any other vertex W2j -1 and along the edge 1I)2j -1 W2j is to the left of the intersection point of L and L'. The starting point a of RI can be obtained by finding the intersection point of

Land L' and then projecting this point vertically onto the x axis. Note that it is easy to construct a weakly visible polygon P from RI with the chain PI as part of bd(P). This finishes the linear time reduction. • The above lemma immediately implies that the problem of reporting all critical points in the order along a trajectory path requires n(n log n) time in the worst case in the algebraic computation tree model. Since we can use the 0 (nlog n) time algorithm in this section to solve the case of the problem with the trajectory being a line segment, our solution for this case is optimal.

4

Extensions

We can easily extend our algorithm in the previous section to several other cases of maintaining visibility information of a polygon P along a trajectory path. Note that in this section, we do not assume that P is weakly visible from the trajectory path. The first case is that the trajectory path consists of h

> 1 line segments inside the polygon P. In this case, a direct application of our algorithm in Section 3 to each of the h segments on the path results in a solution that requires O(hnlogn) time and O(hn) space. The case in which the h-segment trajectory path is outside P can also be handled in a similar way.

References [1] D. Avis and G.T. Toussaint. An optimal algorithm for determining the visibility polygon from an edge. IEEE 7rans. Comput., pages 910-914, C-30 (12), 1981. [2] M. Bern, D. Dobkin, D. Eppstein, and R. Grossman. Visibility with a moving point of view. Algorithmica, 11:360-378, 1994. [3] B. Chazelle. Triangulating a simple polygon in linear time. Discrete and Computational Geometry, pages 485-524, 1991. [4] B. Chazelle and L. Guibas. Visibility and intersection problems in plane geometry. Discrete and Computational Geometry, 4:551-581, 1989. [5] J.R. Driscoll, N. Sarnak, D.D. Sleator, and R.E. Tarjan. Making data structures persistent. Communications of the ACM, 5:109-121, 1986. [6] H. EIGindy. Hierarchical decomposition of polygon with applications. Ph.D. thesis, McGill University, 1985. [7] L. Guibas, J. Hershberger, D. Leven, M.E. Sharir, and R.E. Tarjan. Linear-time algorithms for visibility and shortest path problems inside triangulated simple poligons. Algorithmica, 2:209-233, 1987. [8] P.J. Heffernan and J.S.B. Mitchell. Structured visibility profiles with applications to problems in simple polygons. Proc. 6th Anual ACM Symp. Computational Geometry, pages 53-62, 1990. [9] D.T. Lee and A.K. Lin. Computing the visibility poly-

Another case is that the trajectory path is a conic gon from an edge. Computer Vision, Graphics, and curve that contains the polygon P. We sketch below Image Processing, 34:1-19, 1986. only the algorithm for the case in which the trajectory [10] H.P. Lehhof and M. Smid. Maintaining the visibility path is a circle C containing P (other conic curves can map of spheres while moving the viewpoint on a circle be processed in a similar manner). at infinity. MPI-I, pages 92-102, 1992. We first compute the convex hull CH(P) of P in linear time [12]. Note that the circle C contains CH(P) because C contains P. Now consider each connected region that is enclosed between the convex hull CH(P) and bd(P). Let R be such a region. Then R forms a simple polygon and the boundary bd(R) of R consists of exactly one edge from C H (P) and the rest of edges from bd(P). We denote the edge of R from CH(P) by e(R). Note that each edge of bd(P) belongs to at most one such region. We next compute, for each sllch region R, its weakly visible portion Vis(R, e(R» from the edge e(R). Then we apply our algorithm in Section 3 to Vis(R, e(R» and e(R) for each region R, with one modification. The modification is that instead of obtaining critical points by "projecting" vertices of V is(R, e(R» onto the edge e(R), the "projections" are onto C. It is easy to show that there are O(n) critical points on C (this is the same as the case with the trajectory being a segment). Then the rest of the algorithm follows as in Section 3. The complexity bounds of the algorithm for the conic curve case are O(nlogn) time and 0 (n) space.

245

[11} K. Mulmuley. Hidden surface removal with respect to a moving view point. Proc. 23rd ACM Symp. on Theory of Computing, pages 512-522, 1991. [12] F.P. Preparata and M.1. Shamos. Oomputational Geometry: An Introduction. Springer-Verlag, New York, 1985. [13} N. Sarnak and R.E. Tarjan. Planar point location using persistent search trees. Communications of the ACM, 29(7):669-679, 1986. [14} G.T. Toussaint. A linear-time algorithm for solving the strong hidden-line problem in simple polygon. Pattern Recognition letters, 4:449-451, 1986. [15] A.C.-C. Yao. Lower bounds for algebraic computation trees with integer inputs. SIAM Journal on Computing, pages 655-668, 1991.

Visibility graph of a set of line segments: A· dynamic sequential algorithm and its parallel versio~ Yosser ATASSI CRIN-CNRS BP 239 54506 Vandoeuvre-les-Nancy Cedex France (e-mail: atassi@loriaJr)

I Introduction The visibility graph of a set of nonintersecting line segments G in the plane is a graph whose vertices are the endpoints of the segments and whose edges are the pairs of endpoints (u, v) such that the open line segment between u and v does not intersect any of the line segments of G. Asano et ale [AGHI86] and Welzl [We185] presented optimal algorithms for constructing the visibility graph for n line segments in 0(n 2 ) time. Hershberger [Her89] studied the visibility graph of triangulated simple polygon with n sides. He described an algorithm that finds the visibility graph in O(m) time where m is the number of edges in the visibility graph. Because m can be as small as O(n). Vegter [Veg91] presented an algorithm to maintain dynamically the visibility graph of a set of n line segments in the plane in 0(10g2 n + K10g n) time, where K is the total number of arcs of the visibility graph that are destroyed or created upon insertion or deletion of a line segment. Goodrich et al. [GSG92] presented an algorithm for computing the shortest path between two vertices .in a simple polygon by constructing the visibility graph in O(n) time using O( nlog n + 10';n) processors, where m is the number of edges of the resulted visibility graph. . In this paper, an on-line algorithm and its parallel version to construct the visibility graph of a set of line segments using the dynamic data structure I-DAG are developed. This algorithm is simple, easy to code and efficient in practice.

III-DAG (Influence Directed Acyclic Graph) Randomised incremental construction is a new paradigm. in computational geometry that has been successfully applied to a variety of problems [CS89] [BDS+92] [BY95] [Dev96]. These algorithms are rather simple, easy to code and efficient in practice. Moreover, they do not require that the input data satisfy some probabilistic distribution but that they are inserted in random order.

246

In this structure, geometrical problems are stated in terms of objects, regions and conflicts between objects and regions. The objects are member of a universe U and are the input data of the problem. The regions are defined by subsets of the universe U of cardinality less than a constant b. The definition of conflicts between objects and regions has to be made precise for each specific problem. The subset of objects of U which are in conflict with a region is called' the influence range of the region. For a finite set of objects G we denote F( G) the set of regions defined by the objects in G. We call the number of objects of G that belong to the influence range of a region width with respect to G. Let Fi ( G) be the subset of F( G) consisting of the regions that have width j with respect to G. Let G be the set of objects which have already been introduced. At a given stage, the incremental algorithm inserts a new object in G and updates the set Fo(G) of regions of zero width defined by G. This is performed through the maintenance of a dynamic structure called Influence DAG (I-DAG) described below. The I-DAG is a rooted directed acyclic graph whose nodes are associated with regions that at some stage of the algorithm have appeared as regions of zero width defined by the set of objects that have been introduced at that stage.

The construction of I-DAG can be sketched as follows: • We initialise G with the first b objects. A node of the I-DAG is created for each region of Fo(G) and made a child of the root of I-DAG. • At each subsequent step, a new object 0 is added to G and the I-DAG is updated. The two following substeps are performed: - Location substep. This substep finds all the nodes of the I-DAG whose regions h~ve

zero width and are in conflict with O.

- Creation substep. From the information collected during the location substep,

the creation substep creates a new node for each region FoC G u {O} ) - Fo( G) and links the new nodes to already-existing nodes in the structure. We have the following main theorem [BDS+92]: Theorem 1 If the set of already-inserted objects G has cardinality n, the I-DAG of G requires 0(E7=1 JO(l!J,G») expected memory space. The insertion of a new object can be Jo(P~J,G») . . O(E~-l 1n 1 expected up date tzme. done zn

III A sequential algorithm for constructing the visibility graph of a set of line segments We present in this section a sequential on-line algorithm for constructing the visibility graph of a set G of n line segments in the plane.

247

The objects are the segments of G. A region is an angular sector QPR defined by three endpoints P, Q, and R such that PQ ~ G and P R ~ G (see Figure 1), the angle QPR can be more than IT. The region corresponding to an angular sector QPR is called PQR. When QR E G and the angle QPR is less than IT, the region PQR is bounded by the line segment QR. A line segment S is in conflict with a region PQR if and only if it intersects t his region. A region of I-DAG has zero width if and only if PQ and PR are

A Region2 PRQ corresponding to the sector QPR

V Regionl PRQ corresponding to the complement sector QPR

Figure 1: The region of the I-DAG edges of the visibility graph of G. So computing the visibility graph of G is equivalent to computing the zero width regions. Let us describe the algorithm. Suppose that I-DAG has been constructed for the subset 5[ (5[ c G) and that we want to insert a new segment S (5 = Vi \12). The location substep gives the regions LT of Fo(5[) intersected by 5. The I-DAG is modified in the following manner: 1. The width of selected regions LT is incremented.

2. For every region T E LT and T in the form of 1i:J V4 Vs do: (a) If 5 intersects the line segments 1i:J V4 and 1i:J Vs then (see Figure 2.a):

(a)

(b)

(c)

Figure 2: The relations between the line segment 5 and the region T

248

Let Vi be the first endpoint of S[ U {S} met while rotating V3 Vt around 113 in the inverse direction of lis. Let V; be the first endpoint of S[ U {S} met while rotating Va lis around Va in the inverse direction of 'V4. We add the region Va ViVj as a child of T if this region has not been added before; else T has.no child. ' (b) Else, if S intersects only Va V4 then (see Figure 2. b ): Let Vi be the first endpoint of S[ U {S} met while rotating 113 lis around 113 in the direction of'V4. Let Vi be the first endpoint of S[ U {S} met while rotating Va Vi around Va in the direction of the other endpoint of S. We add the regions 113 lis Vi and 113ViVj as children of T if these regions have not been added before. (c) Else, if S intersects only 113 lis then: Similar to the preceding case. (d) Else, if S is in T then (see Figure 2.c): Let Vi be the first endpoint of 8 [ U {8} met while rotating 113 V4 around 113 in the direction of Vs. Let Vi be the first endpoint of S[U{S} met while rotating V3 Vs around 113 in the direction of V4. We add the regions 113 V4 Vi, V3 Vi Vi and V3 Vj lis as children of T if these regions have not been added before. 3. For every endpoint

V3 of T

E LT do:

Let Vi be the first endpoint of S[ met while rotating Vi Va around Vi counterclockwise. We add the region Vi V3 Vi as a child of the I-DAG. 4. For every endpoint

V3 of T

E LT do:

Let Vi be the first endpoint of 8[ met while rotating 112 Va around 112 counterclockwise. We add the region 112 V3 Vi as a child of the I-DAG.

IV A parallel algorithm for constructing the visibility graph of a set of line segments We use the same definitions of object, region and conflict relation used in the preceding section. Suppose that I-DAG has been constructed for the subset 8[ (8[ c G) and that we want to insert a new segment S (8 = Vi 112). We associate every endpoint Vi with a pro~essor Pi which is responsible of regions whose first endpoint is Vi. At the location substep, every processor Pi tests if one of its regions of zero width has been influenced by the insertion of S, then Pi constructs the list of influenced ~egions LTi. At the creation substep, every processor Pi performs the sequential algorithm in the following manner: 1. The width of selected regions LTi is incremented.

11 E LTi and Ti in the form of Va Vt lis, the processor P3 (Pi V3 realises the following operations:

2. For every region

associated to

249

= P3 )

(a) If S intersects the line segments Va V4 and Va lis then (see Figure 2.a) Let Vk be the first endpoint of 8[ U is} met while rotating Va V4 around lis in the inverse direction of Vs. Let Vi be the first endpoint of S [ U {S} met while rotating' Va Vs around Va in the inverse direction of V4. The processor P3 adds the region lis Vic V; as a child of Ti if this region has not been added before,else Ti has no child. (b) Else, if S intersects only Va V4 then (see Figure 2.b): Let Vk be the first endpoint of S[ U is} met while rotating lis lis around Va in the direction of 'V4. Let V; be the first endpoint 9f S] U is} met while rotating lis Vk around lis in the direction of the other endpoint of S. The processor P3 adds the regions Va Vs Vic and Va Vic V; as children of Ti if these regions have not been added before. (c) Else, if 8 intersects only lis Vs then: Similar to the preceding case. (d) Else, if S in n then (see Figure 2.c): Let Vk be the first endpoint of S[ u {S} met while rotating Va V4 around V3 in the direction of lis. Let V; be the first endpoint of S[ U is} met while rotating Va Vs around V3 in the direction of 'V4. The processor P3 adds the regions Va V4 Vic, Va Vic V; and lis Vi lis as children of Ti if these regions have not been added before. 3. Two new processors PI and P2 are used. They are associated respectively to the endpoints Vi and V2. 4. For every endpoint Va of Ti E LTi do: Let Vk be the first endpoint of S[ met while rotating V1 lis around V1 counterclockwise. The processor PI adds the region Vi 113 Vk as a ~hild of the I-DAG. 5. For every endpoint

lis of Ti E LTi do:

Let Vic be the first endpoint of 8[ met while rotating V2 lis around V2. counterclockwise. The processor P2 adds the region V2 Va Vic as a child of the 1-DAG. At last, every processor Pi goes over the list of its regions in the form of Vi Vi VIc of zero width and gives as edges of the visibility graph, the line segments ViV; and ViVk.

V Average analysis Here fo(r, G) is the expected size of the visibility graph of r segments, which is clearly OCr), so applying Theorem 1 we deduce: Proposition 1: the visibility graph of a set G of n segments in the plane can be computed sequentially with Oem * log n) expected memory space and Oem) expected update time where m is the number of edges of the resulted visibility graph. Proposition 2: the visibility graph of a set G of n segments in the plane can be computed in parallel with Oem * log n) expected memory space and O(~) expected

250

update time where m is the number of edges of the resulted visibility graph and P the number of processors.

VI Conclusion We have presented two new on-line algorithms for computing the visibility graph of a set G of line segments using the dynamic data structure I-DAG. We can easily implement the parallel algorithm on machines with SPMD architecture. The communication among the processors is almost negligible, so this algorithm is efficient and faster than the sequential one. These algorithms can be generalised easily to treat the case of a set of polygons.

References [AGHI86] T. Asano, L. Guibas, J. Hershberger, and H. rami. Visibility disjoint polygons. Algorithmica, 1:49-63, 1986. [BDS+92] J.D. Boissonnat, O. Devillers, R. Schott, M. Teillaud, and M. Yvinec. Application of random sampling to on-line algorithms in computational geometry. Discrete Comput. Geom., 8:51-71, 1992. [BY95]

J.D. Boissonnat and M. Yvinec. Geometrie Algorithmique. Ediscience international, Paris, 1995.

[CS89]

K.L. Clarkson and P.W. Shore Applications of random sampling in computational geometry. .Discrete and computational geometry, 4:49-63, 1989.

[Dev96]

O. Devillers. A· comprehensive introduction to randomization in computational geometry. Theoret. Comput. Sci., 157, 1996.

[GSG92]

M.T. Goodrich, S.B. Shank, and S. Guha. Parallel methode for visibility and shortest-path problems in simple polygons. algorithmica, 8:461-486, 1992.

[Her89]

J. Hershberger. An optimal visibility graph algorithm for triangulated simple polygons. Algorithmica, 4:141-155, 1989.

[Veg91]

G. Vegter. Dynamically maintaining the visibility graph. In Proc. 2nd Workshop Algorithms Data Struct., LNCS 519, pages 425-436, 1991.

[WeI85]

E. WelzL Constructing the visibility graph for n line segments in O(n2) time. Information Processing Letters, 20:167-171, 1985.

251

Dynamic' algorithms for approximate neighbor searching (Extended abstract) Sergei N. Bespamyatnikh Department of 1vlathematics and Mechanics~ Ural State University, 51 Lenin St., Ekaterinburg 620083, Russia. e-mail: Sergei.Bespamyatnikh0usu.ru.

1

Introduction

vVe consider the dynamic problems of computing • approximate nearest neighbor, • approximate k-nearest neighbor, • approximate range searching, • approximate furthest neighbor and • approximate diameter.

1.1

Approximate problem

nearest

neighbor

The nearest neighbor searching is one of the fundamental problems in computational geometry. We are given a set S of n points in R d, d ~ 2, and a distance metric Lh 1 ::; t ::; 00. It is assumed that the dimension d is a constant independent of n. Each point p is given as a d-tuple of real numbers (PI, ... , Pd). Let dist(p, q) denote the distance between points p and q. Definition 1.1 Given any c > 0 and any query point q E R d , a point pES is a (1 + c)approximate nearest neighbor of q if, for any r E S\ {q}, dist(p,q):5 (1 +c)dist(r,q). Kapoor and Smid [14] presented the dynamic data structure of size O( n logd-l n) with an amortized update time O(logd-l n log log n) and query time O(logd-I nloglogn). In [7] the author gave the data structure of size 0(nlog d - 2 n) with query and update times of O(logd+l n log log n). Arya et al. [4] used the

252

box-decomposition tree (with midpoint decomposition) and the topology trees of Frederickson [13] to solve the approximate nearest neighbor problem. This data structure has size O( n) and update time of O(log n). The query time is 0((1 + l/c)dlog n). In Section 3, we present a dynamic algorithm that computes an approximate neighbor in (log n + 1/ cd-I) time. This algorithm is based on the fair split tree. To maintain the fair split tree we apply the dynamic trees of Sleator and Tarjan [16]. These trees have linear space and logarithmic update time.

o

1.2

Approximate problem

range

searching

Arya and Mount [5] introduced the approximate range searching problem and showed that the approximate queries can be answered in o (log n + 1/cd) time (for convex ranges time is o(log n+ l/c d- 1 )). In Section 4, we extend these results to the dynamic version of the problem.

1.3

Approximate furthest problem

neighbor

The situation with the furthest neighbor searching is similar to that with the nearest neighbor searching. In planar case the static version of the problem can be solved optimally by using

furthest-neighbor Voronoi diagram [15]. In planar case and dynamic version of the problem, Agarwal et al.[I] obtained a data structure of size O( nl+~), for" any c > 0, so that points can be inserted into or deleted from S in time 0 (nE) per update, and a furthest-neighbor query, under any Lt-metric, can be answered in O(log n) time. It is natural to consider the approximate

furthest-neighbor problem. Definition 1. 2 Given any e > 0 and any query point q E Rd, a point pES is a (1 + c)approximate furthest neighbor of q if~ for any r E S~ dist(r,q) ~ (1 + c)dist(p,q). Agarwal et al. [2] proposed an algorithm that computes, for each point pES, approximate furthest neighbor in O( ne(1-d)/2) time. In Section .5 we modify the fair split tree and give an dynamic algorithm for finding (1 + E )- approximate furthest neighbor in 0 (1/ cd-I) time. Note that the query time is independent of n.

1.4

Approximate diameter problem

=

The diameter of S is defined as diam(S) max{dist(p,q) : p,q E S}. It is well known that the diameter of n-point set in plane can be found in 0 ( n log n) time. Using parametric searching, Chazelle et al. [12] showed that the diameter in 3-space can be computed in O(nl+'Y) time, for any I > O. In Section 6, we consider the dynamic version of the problem and show that (l+£)-approximate diameter can be computed in 0((1 + 1/.:-)2(d-I)) time.

in subdivision of space for dynamic problem, because a split of cube by a hyperplane Xi = const does not give cubes. Another way is the using of the almost cubical boxes (or c- boxes for brevity) [8] and a fair split [9, 10, 11] or an almost middle cut [8]. The almost middle cut is similar to the fair split (but there is the difference of the definitions). In this paper, for the split of boxes. we shall use the definition as in [8] but we shall call its the fair split. The constant factors in the update and query time are exponential in the dimension. To decrease the constant factors we generalize the fair split by introducing a separator s > 1. In fact both the fair split [9, 10, 11] and the almost middle cut [8] use the separator that is equal 2. We establish geometric criteria for the fair split with separator to be suitable for maintenance of the fair split tree. The separator must be at least Golden Ratio ~ 1.62. Definition 2.1 Let [a, a') be an interval in Rand b be a point in this interval. The split of the interval into the intervals [a, b) and [b, a') is fair split if b E [~, s]. Definition 2.2 Let B = lab al') x ... x [ad, ad') be a box and Ci E (ai, a/) be a real number for some i. The split of B by the hyperplane Xi Ci is fair split of B if the split of the interval [ai, a/) by Ci is fair split. The fair-spli t operation generates a relation on the set of boxes. Definition 2.3 Let A and B be d-dimensional boxes. The box A is said to be a s-sub-box of B if A can be constructed from B by applying a (possibly empty) sequence of fair cuts. We shall write B,.".... .4. For d 1, we shall say that A is s-sub-interval of B. The second definition of s-sub-interval [8] can be generalized. Definition 2.4 Let [a, a') and [b, b') be intervals in R. Let [a, a') is the sub-interval of [b, b'), i.e. b ~ a $ a' ~ b'. The interval [a~ a') is called s-sub-interval of the interval [b, b') if one of the following conditions holds 1. [a, a') [b, b')~ or 2. a = b and la' - al ~ s~llb' - bl, or 3. a' = b' and la' - al ~ s~llb' - bl, or

¥

:,:.a

=

=

2

The fair split tree

The fair split tree is a hierarchical subdivision of the space into boxes. We define a box to be the product [al~ al') x ... x [ad, al) of d semi closed intervals. i-th side of this box is the interval [ai, a/). If all sides have the same length, we say that the box is a d-cube. The cubes are useful in some proximity algorithms (for example, all-nearest-neighbors algorithm of Vaidya [17]). Unfortunately we cannot directly use the cubes

253

=

4.

la' -bl :5

s~llb' -bl and lal-al

:5

s~llal-bl,

or

.s. Ib' -al:5

s~llb'-bl and la'-al:5 s~llb'-al· This definition allows us to retrieve the se· quence of fair cuts for two boxes A and B if B "-'" A. The following Theorem gives the con· dition for separator when definitions 2.3 and 2.4 are equivalent.

Theorem 2.5 The definitions 2.3 and 2.4 definf the same relation of s-sub-interval if and only if the separator is at least Golden Ratio, i. e

~

¥

~ 1.62 The dependence of the constant factors in the query answering efficiency is O«s + 1 )d). The decreasing of the separator reduces these factors. Definition 2.6 Let B be a box with sides 81, ... ,Sk· The box B is said to be a c-box if~ for any i,j E {I, ... , k}, ;; E [l!S' 1 + s]. The fair split tree is the binary tree T. With each node v of the tree T, we store a box B( v) and a shrunken box SB( v). The boxes satisfy the following conditions. 1. For any node 1', the boxes B( v) and S B( v) are c·boxes. 2. For any node 11, the box S B( v) is a s·sub· box of B( v). 3. For any node v, SB(v) n S B(v) n S. 4. If Ui has two children u and v, then boxes B(u) and B(v) are the results of an fair split of the box SB(w). 5. If v is a leaf, then IS n B(v)1 1 and

s

=

SB(v)

= S n B(v).

=

For a point pES corresponding to the leaf v. let B(p) denotes the box B( v). Let parent(v), lson(v), and rson(v) denote parent, left son, and right son of the node v of T. vVe omit the description of the dynamic tree for brevity. It can be found in [6, 16, 8].

3

The approximate neighbor queries

nearest

To find an approximate nearest neighbor we shall use dynamic tree. (It is easy to see that the depth of fair split tree can be linear in the worst case. ) \Ve apply the technique similar to the finding

254

the sets Ep and A( v) [8]. We give two algorithms. The code of the first algorithm is simple but the second algorithm has better computational com· plexity. Both algorithms use a set V. An element of V is a node of the fair split tree or a node of a path tree. With each node v E V we associate a domain D( v) C Rd. To define a domain D( v) we consider three cases. Case 1. v is a node of fair split tree. D( v) SB(v). In the next two cases v is a node of a path tree PT. Case 2. v is a leaf of a path tree. v corresponds to a node Vi of T. vVe replace v in V wi th a node of T which is determined as follows. Note that Vi is an internal node of T. Let u and w be sons of v'. If u and ware linked to Vi by dashed edges then we replace v with Vi. If the edge (v', u) is dashed and the edge (v'w) is solid then we replace v with u. Case 3. v is an internal node of a path tree. The node v covers nodes VI,'" , Vk of solid path where parent( Vi+l) Vi for i 1, ... , k - 1. If Vk is the bottommost node of path tree then D(v) SB(Vl) (VI btail(v»). Otherwise Vk has a son Vk+l linked to it by a solid edge. The domain D(v) SB(vd \ SB(Vk+l)' To process domains D( v) for internal nodes of path trees we store two boxes Bout ( v) and Bin ( v) (possibly empty) such that D(v) Bout(v) \ Bin ( v). This information allows us, for a node v E V, • compute dmin(q,D(v» and dmax(q,D(v») in Oed) time • compute D( vd and D( V2) where Vl and V2 appear when we traverse the node v. The variable R contains an upper bound of the distance from query point q to (1 + c)approximate nearest neighbor. In fact this bound is R mini dmax ( q, D( v)) I v is traversed in search step}. Let VR be a node such that R = dmax(q,D(VR». The procedure refresh_R computes this node and R after updates of V.

=

=

=

=

=

=

=

=

proced ure ref resh_R( v ) R' := dmax(q, D(v)) if R > R' then R:= R': end ref resh_R;

VR

:=

v fi

Now we describe the first algorithm. Initially 1/ {Vroot}, VR Vroot and R dmax(q,D(VR)). Vle repeat the search step while V # 0. SEARCH STEP. Take any v E V. Remove v from V. If dmin(q, D(v)) > I~& then return (start new search step). If v is a leaf of T then return. If v is a leaf of path tree then we replace it with a node of T (see Case 2 above). If t' is an internal node of T and v is linked to sons u and u; by dashed edges then add u, W to V. If v is a topmost node of a solid path that contains more than one node then add sons u. w of pLroot( t~) (in the path tree) to V. If v is an internal node of path tree then add sons u, tv of l' to V. Refresh_R( u) and Refresh_R( w). After all search steps (v' 0) any point in D(VR) is the (1 + c)-approximate nearest neighbor and can be found in O(log n) time. It is clear that the algorithm is correct. One can prove that the number of visited nodes is O((log n)/e d - 1 ). The second algorithm has three phases. In the first phase, we compute (1 +eo)-approximate distance from query point to nearest neighbor. To do this, we apply the first algorithm. eo is a constant and we assign eo 1. Our goal in the second phase is to obtain the set 1/ of nodes of T such that • for distinct nodes u and v, B( u) n B( v) == 0 • the boxes B( v), t' E V contain points of S that are \vithin distance at most R, i.e. {p E S,dist(p,q)::; R} C UVEvB(v). • for a node v E V, diam( B( v)) < R and (if v has a parent) diam(B(pa1'ent(v)) ~ R. To construct such a set of nodes we apply the search that is similar to the first algorithm. In the third phase, we compute an (1 + e)approximate nearest neighbor of query point. The algorithm has O(log(l + .:)) iterations. At the beginning of iteration • compute R minvEv dmax(q,D(v)). Note that rET and computing dmax is simple. • compute r = minvEvdmin(q,D(v)). • compute dl = maxvEvdiam(SB(v). • remove v from V if dmin(q,D(v) > R. If R ::; (1 + .: )1' then any point in D( e). dmin(q. D(v}) 7' is the (1 + ,:-)approximate nearest neighbor and can be found

=

=

=

=

=

=

=

255

in O(log n) time. Set U = 0. We repeat the search step while V # 0. SEARCH STEP. Take any v E V. Remove v from V. Ifvis aleafofTordmin(q,SB(v)) > R then return. If diam(SB(v) < dl /2 then add v to U and return. Add sons u, w of v to V and Refresh-R( u) and Refresh-R( w). After the iteration we set V [j. Note that each iteration decreases maximal diameter dl of SB( v), v E V at least to d1 /2. The first and second phases take o (log n) time. The third phase without final finding of the (1 + c)-approximate nearest neighbor (in Section 5 it is shm.... n that the sampling a point can be done in O( 1) time) takes 0((1 + l/c)d-l) time. Theorem 3.1 Using the fair split tree and dynamic tree, for query point q, any c > 0 and metric L t , (1 + c)-approximate nearest neighbor query can be answered in 0((1 + 1/~)d-1 + log n) time.

=

3.1

The approximate k-nearest neighbor queries

Consider the problem of computing approxima· tions to the k nearest neighbors of a query point. Definition 3.2 Given any e > 0 and any query point q E Rd, a point pES is a (1 + e)approximate k-th nearest neighbor of q if, for a true k-th nearest neighbor of q, ~~:!~~:~: 1 +~. We can use the dynamic algorithm for approximate nearest neighbor searching. Let ann(q~~~t) be the function that returns (1 + e)-approximate nearest neighbor of query point q under Lt metric. The procedure aknn( q, e, t) returns a list of points PI, ... , Pk that is an answer for (1 + e)approximate k-nearest neighbor query. procedure aknn( q. c. t) for i := 1~ ... ~ k Pi:= ann(q,e,t) delete(pd (* from S *)

:;

rof for i := 1, ... , k insert(Pi) (* to S *) rof end aknn; It is clear that the running time of the algorithm is O( k( (1 + 1/e )d-l +log n»). In fact (1 +t)

approximate k-nearest neighbor problem can be solved O(k + (1 + l/c)d-l + logn) time but the space restriction does not allow us to describe such algorithm. .

The approximate searching

4

range

We assume that the points have been assigned weights. In precise range searching, given any query range Q, we have to compute the accumulated weight of the points in SnQ, weight(SnQ), under some commutative semigroup. Definition 4.1 Given any c > 0 and any query range Q of diameter d 1 define Q- to be the locus of points whose distance from a point exterior to Q is at least de ~ and Q+ to be the locus of points whose distance from a point interior to Q is at most de. Define a legal answer to an (l+e)-approximate range query to be weight(S') for any subset S' such that SnQ- c 5' c SnQ+. We can adapt the algorithm of Arya and Mount [5] to fair split tree and dynamic tree. The cells cell( v) correspond to the domains D( v). vVith each node of path trees we shall store weight( v) = weight(D( v)). We can maintain weights of nodes in O(log n) time per update of

S. Theorem 4.2 [ising the fair split tree and modified dynamic tree, for a spherical query range~ any £ > 0 and metric L t , (1 + c)approximate range count can be computed in 0((1 + l/c)d) time.

The approximate neighbor queries

5

furthest 6

In this Section we shall give an algorithm for approximate furthest neighbor searching. The algorithm has simple code. The algorithm uses a set V of nodes of T. The variable r contains a lower bound for distance to (1 + c)-approximate furthest neighbor and the box B( t~7') contains it. Initialization: V = {vroot}, r dmin( q~ S B( vrood), and Vr Vroot·

=

The procedure Refresh_rO is analog of Refresh_R() in Section 3. procedure refreshs( v) r':= dmin(q,SB(v)) ifr < r' then r:= r'; Vr := v fi end refresh_r; We apply the scaling technique of phase 3 of approximate nearest neighbor algorithm in Section 3. The algorithm has O(lg(l + l/e)) iterations. At the beginning of iteration • compute d1 = maxvEV diam(5B(v)). • set U = 0. We carry out the search step while the set V is non-empty. SEARCH STEP. Take any node v E V. Remove v from V. If dmax(q~SB(v)) $; (1 + e)r then return. If diam( 5 B( v)) :5 d1 /2 then add v to U and return. Let u and w be sons of v (in T). Add u and w to V. Refresh_r(u) and Refreshs(w). After iteration we assign V = U. This algorithm without final finding of the (1 + c)-approximate furthest neighbor takes O( (1 + l/~)d-l) time. \Ve can compute the approximate furthest neighbor using the point location. However the point location has 0 (log n) time in worst case. VVe modify the fair split tree such that the final finding can be performed in constant time. We add the pointer point() to nodes of V. For a node v E V, point( v) is a point in S n B( v) if the edge (v, parente v)) of A(T) is dashed. We can maintain this pointer in O(1og n) time per update of S. To find any point in B( vr ) we choose a son u of v such that the edge (u, v) is dashed (if v is a leaf then the finding is trivial). pointe u) points to required point of S.

=

256

The approximate diameter

In this Section we shall give an algorithm for approximate diameter searching. The algorithm uses a set V of nodes of T. We apply the scaling technique. The algorithm has 0(lg(1 + 1/.:)) iterations. At the beginning of iteration • compute r = maxu,vEv dmin(SB(u),SB(v)) and nodes U r and Vr such that r dmin(S B( u r ), S B( vr )).

=

• for any node v E V, compute Rv = dmax(SB( u), SB( v)). If Rv ::; (1 + c)r then remove node v from V. • If y' = 0 then' (1 + £ )-approximate diameter is dist(p,q) where pES n SB(u r ) and q E S n S B( vr ) and the algorithm stops. • compute d1 = maxvE\l diam{SB(v)). • set U = 0. We carry out the scaling step while the set V is non-empty. SEARCHING STEP. Take any node v E V. Remove t' from V. If diam(SB(v» ::::; d1 /2 then add v to U and return. Let u and w be sons of v (in T). Add u and w to V. After iteration we assign V = U. As in the preceding Section we use pointers pointO to determine the pair (p, q) that gives approximate diameter. The number of nodes in \;' is at most 0((1 + 1/c)d-l). The running time of an iteration (Le. searching steps) is 0((1 + l/c)d-l). The part before an iteration (i.e. computing 1'~ R t .) takes 0((1 + 1/c)2(d-l)) time. One can prove that the running time of the algorithm is within a constant factor of this time. maxuEV

[5] S. Arya and D. M. Mount. Approximate Range Searching. Proc. 11th Annual ACM Symp. Comput. Geom., 1995, pp. 172-18l. [6] S. W. Bent, D. D. Sleator and R.E. Tarjan Biased Search Trees. SIAM Journal of Computing, 1985, 14, pp. 545-568 [7] S. ~. Bespamyatnikh. The Region Approach for Some Dynamic Closest-Point Problems. Proe. 6th Canadian Conf. Comput. Geom., 1994. [8] S. N. Bespamyatnikh. An optimal algorithm for closest pair maintenance. Proc. 11th Ann. Symp. Comput. Geom., 1995. pp. 152-161. (9] P. B. Callahan and S. R. Kosaraju. A. Decom-

position of M'ulti-Dimensional Point-Sets with Applications to k-Nearest-Neighbors and n-Body Potential Fields, Proe. 24th Annual AMC Symposium on the Theory of Computing, 1992, pp. 546-556. [10] P. B. Callahan and S. R. Kosaraju. Algorithms

for Dynamic Closest Pair and n-Body Potential Fields. Proe. 6th Ann. Symp. on Discrete Algorithms, 1995. [11] P. B. Callahan, M. T. Goodrich and K. Ramaiyer. Topology B- Trees and Their Applications. WADS conference. [12] B. Chazelle, H. Edelsbrunner, and L. J. Guibas.

References

Diameter, Width, Closest Line Pair, and Parametric Searching. Proe. 8th Annual ACM Symp.

[lJ P. K. Agarwal, A. Efrat, and M. Sharir. \lertical Decomposition of Shallow Levels in 3Dimensional A rrangements and Its Applications. Proc. 11th Annual ACM Symp. Comput. Geom., 1995, pp. 39-50.

Comput. Geom., 1992, pp. 120-129. [13] G. N. Frederickson. A Data Structure for Dynamically .M:aintaining Rooted Trees. Proc. 4th Annual ACM-SIAM Symp. on Discrete Algorithms, 1993, pp. 175-194.

[2] P. K. Agarwal. J. Matousek, and S. Suri. Far-

[14] S. Kapoor and M. Smid. J.Vew Techniques for

thest IVeighbors, .Maximum Spanning Trees and Related Problems in Higher Dimensions. Com-

Exact and Approximate Dynamic Closest-Point Problems. Proc. 10th Annual ACM Symp. Com-

putational Geometry: Theory and Applications, 1992, pp. 189-201.

put. Geom., 1994, pp. 165-174.

[3] S. Arya, D. M. Mount, N. S. Netanyahu, R. Silverman, and A. VVu. An Optimal Algorithm for Approximate Nearest-1Veighbor Searching. Proe. 5th Annual Symposium on Discrete Algorithms, 1994, pp. 573-582. [4] S. Arya. D. M. Mount, N. S. Netanyahu, R. Silverman. and A. Wu. An Optimal Algorithm for A.pproximate Nearest-Neighbor Searching. (revised version), 1994.

257

[15] D. T. Lee. Farthest neighbor Voronoi diagrams and applications. Tech. Rept. No. 80-11-FC-04, Dpt. EEjCS, Northwestern University,1980. [16] D. D. Sleator and R. E. Tarjan. A Data Structure for Dynamic Trees. Journal of Computer and System Sciences, 26: 1983. [17] P. M. Vaidya. An O(nlogn) Algorithm for AllNearest-Neighbors Problem. Discrete Comput. Geom., 1989, pp. 101-115

Thee-Dimensional Restricted~Orientation Convexity 1 Derick Wood3

Eugene Fink2

Abstract A restricted-orientation convex set is a set of points whose intersection with lines from

some fixed set is empty or connected. This notion generalizes both standard convexity and orthogonal convexity. We explore basic properties of restricted-orientation convex sets in three dimensions. In particular, we establish analogs of the following properties of standard convex sets: • The intersection of a convex set with every line is empty or connected • The intersection of a collection of convex sets is a convex set • For every two points of a convex set, the straight segment joining them is contained in the set • Convex sets are contractable

1 Introduction The study of convex sets is a branch of geometry that has numerous connections with other areas of mathematics, including analysis, linear algebra, statistics, and combinatorics [4]. Its importance stems from the fact that convex sets arise in many areas of mathematics and are often amenable to rather elementary reasoning. The concept of convexity serves to unify a wide range of mathematical phenomena. The application of convexity theory to practical problems led to the exploration of nontraditional notions of convexity, such as orthogonal convexity [6], finitely oriented convexity [5], and link convexity [1, 9]. These nontraditional convexities are used in pixel graphics, VLSI design, motion planning, and other areas. Rawlins introduced the notion of restricted-orientation convexity as a generalization of standard convexity and orthogonal convexity [7]. Rawlins, Wood, and Schuierer studied restricted-orientation convex sets and demonstrated that their properties are similar to the properties of standard convex sets [8, 9]. The research' on nontraditional convexities has so far been restricted to two dimensions. Our goal is to study nontraditional convexities in three and higher dimensions. We have generaiized two different types of restricted-orientation convexity, called strong convexity and V-convexity [7], to higher-dimensional spaces and presented an extensive study of restricted-orientation convex sets in higher dimensions [2, 3]. In this paper, we describe O-convex sets in three dimensions and give some of their basic properties. In particular, we establish analogs of the following properties of standard convex sets: • Line intersection The intersection of a convex set with every line is empty or connected • Intersection The intersection of a collection of convex sets is a convex set • Visibility For every two points of a convex set, the straight segment joining them is in the set • Contractability Convex sets are contractable We restrict our attention to the exploration ofclosed sets. We conjecture that most of the results presented in the paper hold for nonclosed sets as well; however, some of our proofs work only for closed sets. We should give a word of warning here. The results are not completely unexpected, yet their proofs are sometimes surprisingly complex; intuition serves us badly. We give only a few proof sketches and present complete proofs in the full paper [3].

2

V-convexity in two and three dimensions

We begin by reviewing the notion of O-convexity in two dimensions [7] and presenting b~ic properties of planar V-convex sets. lThis work was supported under grants from the Natural Sciences and Engineering Research Council of Canada, the Infonnation Technology Research Centre of Ontario, and the Research Grant Committee of Hong Kong. 2School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213, U. S. A. E-mail: eugene@cs. emu. edu. 3Department of Computer Science, Hong Kong University of Science & Technology, Oear Water Bay, Kowloon, Hong Kong. E-mail: [email protected] . 258

e

.~ (a)

,

g

, .... ....- ;:.-.:-,....- - .

, .. .. ,,- ~, ..-

(b)

(c)

-w. (d)

" "'D .. ..

'0 " (e)

Figure 1: Planar V-convexity.

(b)

(a)

Figure 2: Orientation sets. We can describe standard convex sets in tenns of their intersection with straight lines: a set of points is convex if its intersection with every line is either empty or connected. We define V-convexity by considering the intersection of a set of points with lines from a certain set (rather than all lines). In other words, we select some collection of lines and say that a set is V-convex if its intersection with every line from this collection is empty or connected. To define this restricted collection of lines, we first introduce the notion of an orientation set. An orientation set V is a (finite or infinite) closed set of lines through some fixed point o. An example of a finite orientation set is shown in Figure l(a). A straight line is called an V-line if it is parallel to one of the lines of V. Note that every translation of an V-line is also an V-line. We use the collection of all V-lines in defining V-convexity. Definition 1 (V-convexity) A set is V-convex ifits intersection with every V-line is empty or connected. For the orientation set in Figure 1(a), the sets shown in Figures 1(b) and I (c) are V-convex (some V-lines intersecting these sets are shown by dashed lines). On the other hand, the set in Figure 1(d) is not V-convex, since its intersection with the dashed V-line is disconnected. This example demonstrates that rotations do not preserve V-convexity, since the set in Figure l(d) is a rotation of that in Figure l(c). Unlike standard convex sets, V-convex sets may be disconnected. We show a disconnected V-convex set in Figures l(e). The following properties of V-convex sets readily follow from the definition [8].

Lemma 1 1. Every translation of an V-convex set is V-convex. 2. Every standard convex set is O-convex. 3. If C is a collection of V-convex sets, then the intersection C of these sets is also V-convex. 4. A disconnected set is V-convex if and only if every connected component of the set is V-convex and no V-line intersects two components.

n

We now extend the notion of V-convexity to three dimensions. An orientation set 0 in three dimensions is a (finite or infinite) closed set of planes through a fixed point o. A plane parallel to one of the elements of 0 is called an V-plane. In Figure 2, we show two finite orientation sets. The first set contains three mutually orthogonal planes; we call it an orthogonal-orientation set. The second set consists of four planes. V-lines in three dimensions are fonned by the intersections of O-planes. In other words, a straight line is an V-line if it is the intersection of two O-planes. Note that every translation of an O-plane is an O-plane and, hence, every translation of an V-line is an O-line. We define V-convexity in three dimensions in the same way as in two dimensions: a set is O-convex if its intersection with every O-line is empty or connected. For example, the sets in Figures 3(b)-(d) are 259

--~(a)

(b)

(c)

(d)

(e)

Figure 3: O-convexity in three dimensions.

--~-. :-~ I

I __

I ~

(a)

(b)

(c)

(d)

____ I

(e)

Figure 4: V-connectedness in three dimensions. V-convex for the orthogonal-orientation set shown in Figure 3(a). On the other hand, the set in Figure 3(e) is not O-convex, because its intersection with the dashed O-line is disconnected. The properties of O-convex sets given in Lemma 1 hold in three dimensions as well. We next characterize three-dimensional O-convex sets in tenns of their ~ntersection with O-planes. Theorem 2 A set is O-convex if and only ifits intersection with every O-plane is O-convex. Sketch of a proof. Since all planes are V-convex, the intersection of an V-convex set with every O-plane is O-convex. Suppose, conversely, that the intersection of a set P with every O-plane is O-convex. To demonstrate that the intersection of P with every O-line I is empty or connected, we choose some 0plane H that contains I. Since P n H is O-convex, P n H n I is empty or connected. We next note that P n H n I = P n I and, hence, P n I is empty or connected. 0

3

C?-co~ecterlUless

We have seen that O-convex sets may be disconnected (see Figure 3d), whereas all standard convex sets are connected. We now describe a subclass of V-convex sets that has the connectedness property: all sets of this subclass are connected, just like standard convex sets. We define sets of this subclass in tenns of path-connectedness of their intersection with V-planes. A set is path-connected if every two points of the set can be connected by a curve that is wholly contained in the set. (This property is stronger than usual connectedness.) Definition 2 (V-connectedness) A set is O-connected if it is path-connected and V-convex, and its intersection with every V-plane is empty or path-connected. For example, the set in Figure 4(b) is V-connected for the orthogonal-orientation set shown in Figure 4(a). On the other hand, the set in Figure 4(c) is not V-connected because it is disconnected, the set in Figure 4(d) is not O-connected because it is not V-convex, and the set in Figure 4(e) is not V-connected because its intersection with the dashed V-plane is disconnected.

Lemma 3 1. Every translation ofan V-connected set is O-connected. 2. Every standard convex set is V-connected. We can characterize V-connected sets in tenns of their intersection with O-planes, much in the same way as we characterized O":convex sets (see Theorem 2). 260

Figure 5: The contraction of a set to a point.

(a)

(b)

Figure 6: Sets that are not contractable. Theorem 4 A set is V-connected if and only if it is path-connected and its intersection with every V-plane is V-connected. Sketch of a proof. Suppose that P is a path-connected set whose intersection with every V-plane is V-connected. Then, by Theorem 2, P is V-convex. Since the intersection of P with every V-plane is path-connected, P is V-connected. Suppose, conversely, that P is V-connected. We show that the intersection of P with an arbitrary V-plane H is V-connected. We note that P n H is path-connected (by the definition of C)-connectedness) and V-convex (by Theorem 2). To show that the intersection of P n H with every C)-plane H' =f:. H is empty or path-connected, we observe that H n H' is empty or an V-line. Therefore, P n H n H' is empty 0 or the intersection of P with an V-line; in the latter case, P n H n H' is empty or path-connected.

The intersection of V-connected sets may not be V-connected. For example, the intersection of the set in Figure 4(b) with some straight lines is disconnected, even though this set and all lines are V-connected. Because of this "drawback," we do not consider V-connectedness a "true" generalization of convexity. We next establish contractability of V-connected sets. Intuitively, a set is contractable if it is connected and does not have holes. For example, lines, planes, and balls are contractable. A hollow sphere is not contractable, because it has a cavity inside. A doughnut (torus) is not contractable either, because it has a hole through it. To put it more fonnally, a set is contractable if it can be continuously transfonned (contracted) to a point in such a way that all intennediate stages of the transfonnation are in the original set (see Figure 5). All convex sets are contractable. Connected V-convex sets in two dimensions are also contractable, if the orientation set V contains at least one line [8, 3]. This property of V-convex sets does not hold in three dimensions. In Figure 6(a), we provide an example of a connected V-convex set that is not contractable. If the orientation set V is empty or contains only one plain, then even V-connected sets may not be contractable. For example, consider the set shown in Figure 6(b). If a horizontal plane is the only element of V, then this set is V-connected; however, it is not contractable. If the orientation set V contains more than one plane, then V-connected sets are contractable. Theorem 5 If V comprises at least two planes, then every V-connected set is contractable. Sketch of a proof. The intersection of two elements of V is an V-line and every translation of this line is also an V-line. If P is not contractable, then either the intersection of P with one of these V-lines is disconnected (Figure 7a) or one of the V-lines, say 1, is through a hole in P (Figure 7b). In the latter case, the intersection of P with some V-plane H containing 1is disconnected (Figure 7c). In either case, P is not V-connected. 0

4 Visibility We present two notions of generalized visibility and characterize V-convex and V-connected sets in terms of this generalized visibility. 261

r~.';

-1

--i',',-' ':', ',:.

(a)

(b)

I'

__I

-I

H

(c)

Figure 7: Proof of Theorem 5.

P~: q (b)

(a)

Figure 8: Generalized visibility. In standard convexity, two points of a set are visible to each other if the straight segment joining them is wholly contained in the set. For example, the points p and x of the set in Figure 8(b) are visible to each other, whereas p and q are not. We can characterize convex sets in terms of visibility: a set is convex if and only if every two points of the set are visible to each other. We define a weaker visibility, which enables us to characterize of O-convex sets, by replacing straight segments with simple O-convex curves. A curve c is simple if, for every two points p and q of c, the shortest path from p to q that is wholly contained in c is a segment of c. Infonnally, this definition says that the shortest way to reach p from q while remaining in c is to follow c. Self-intersecting curves are not simple: if p and q are points on different sides of a loop, the shortest path from p to q does not traverse the loop. Some unusual curves are not simple even though they are not self-intersecting. For example, a Peano curve that covers all points of a square is not simple, even though it may not be self-intersecting.. We say that two points of a set are weakly visible to each other if there is a simple O-convex curve joining them that is wholly in the set. For example, we can join the points p and q in Figure 8(b) by the O-convex polygonal line (p, x, y, z, q), which is contained in the set. We characterize path-connected O-convex sets in terms of this generalized visibility.

Theorem 6 A path-connected set is O-convex if and only if every two points of the set can be joined by a simple V-convex curve that is wholly in the set. Sketch of a proof. Suppose that every two points of a set P can be joined by a simple V-convex curve. If the line through two points is an O-line, then the only simple V-convex curve joining them is the straight segment. Therefore, the intersection of every O-line with P is empty or connected and, thus, P is O-convex. The proof of the converse is trickier. To demonstrate that every two points p and q of a path-connected O-convex set P can be joined by an O-convex curve, we consider a shortest curve joining p and q in P. (Since P is assumed closed, there exists a shortest curve.) Then, we can show that this curve is O-convex. 0 We can characterize V-connected sets in a similar way, if we define visibility in terms of simple 0connected curves joining points of a set. This visibility is stronger than O-convex visibility: two points sometimes cannot be joined by an V-connected curve even when they can be joined by an O-convex curve. For example, the points p and q in Figure 8(b) cannot be joined by an O-connected curve contained in the set, because the intersection of the O-plane H (Figure 8c) with every curve joining them is disconnected.

Theorem 7 A set is V-connected if and only if every two points of the set can be joined by a simple O-connected curve that is wholly in the set.

262

Sketch of a proof. Suppose that every two points of a set P can be joined by an V-connected curve. If two points of P are in some V-plane, then an V-connected curve that joins these points is contained in this V-plane; therefore, the intersection of P with every V-plane is path-connected. We next note that P is O-convex (by Theorem 6) and path-connected. Therefore, P is V-connected. The proof that every two points P and q of an V-connected set P can be joined by a simple V-connected curve is quite complex. We can demonstrate it in the following three steps. First, we show that there exists an V-plane H and points PI ,Ql E P n H such that p can be joined with PI by an V-connected curve contained in P and q can be joined with ql. Second, we show that PI and ql can be joined with each other. Finally, we 0 show that the concatenation of these three curves is an V-connected curve, which joins P and q.

5 Conclusions We described a generalization of convexity, called V-convexity, and demonstrated that the properties of V-convex sets are similar to that of standard convex sets. The main property of convex sets that we lose in Vconvexity is connectedness: every convex set is connected, whereas an V-convex set may be disconnected. To bridge this difference, we introduced V-connected sets, which are always connected. The following list summarizes the properties of V-convex and V-connected sets generalized from standard convexity: • Line intersection The intersection of an V-convex set with every V-line is empty or connected • Intersection The intersection of a collection of V-convex sets is an V-convex set • Visibility For every two points of an V-convex set, there exists an O-convex curve, contained in the set, that joins these two points. Similarly, every two points of an V-connected set can be joined by an O-connected curve within the set • Contractability If 0 comprises at least two planes, then O-connected sets are contractable The results of this paper, except for contractability, hold not only in three dimensions but also in higher dimensions [3]. The generalization of the contractability result to higher dimensions is still an open problem. The work presented here leaves some unanswered questions. For example, we have not characterized the boundaries of O-convex polytopes. In two dimensions, if the orientation set contains n lines, the boundary of every V-convex polytope can be partitioned into at most n V-convex polygonal lines [7]. We conjecture that, for every orientation set V in three dimensions, there is some fixed number n such that the boundary of every V-convex polytope can be partitioned into at most n connected V-convex regions. We also plan to address computational aspects of V-convexity, such as verifying V-convexity and V-connectedness of a polytope and computing the O-convex hull.

References [1] C. K. Bruckner and J. B. Bruckner. On Ln-sets, the Hausdorff metric, and connectedness. Proceedings o/the American Mathematical Society, 13:765-767, 1962. [2] E. Fink and D. Wood. Three-dimensional strong convexity and visibility. Proceedings of the Vision Geometry IV Conference, 1995. [3] E. Fink and D. Wood. Fundamentals of restricted-orientation convexity. Information Sciences, 1996. To appear. [4] B. Oriinbaum, V. Klee, M. A. Pedes, and G. C. Shephard. Convex Polytopes. John Wiley & Sons, NY, 1967. [5] R. H. Outing. Stabbing C-oriented polygons. Information Processing Letters, 16:35-40,1983. [6] D. Y. Montuno and A. Fournier. Finding the x-y convex hull of a set of x-y polygons. Technical Report 148, University of Toronto, Toronto, Ontario, 1982. [7] G. J. E. Rawlins. Explorations in Restricted-Orientation Geometry. PhD thesis, University of Waterloo, 1987. Technical Report CS-89-48. [8] G. J. E. Rawlins and Derick Wood. Restricted-orientation convex sets. Information Sciences, 54:263-281, 1991. [9] S. Schuierer. On Generalized Visibility. PhD thesis, UniversWit Freiburg, Gennany, 1991. 263

Efficient Algorithms for the Smallest Enclosing Cylinder Problem (Extended Abstract)

Elmar Schomer*

Jiirgen Sellen t

Abstract This paper addresses the complexity of computing the smallest-radius infinite cylinder that encloses an input set of n points in 3-space. We show that the problem can be solved in time 0(n4 IogO(1) n) in an algebraic complexity model. We also achieve a time of 0(n4 L . Jl(L)) in a bit complexity model. These and several other results highlight a general linearization technique which transforms non-linear problems into some higher dimensional but linear problems. The technique is reminiscent of the use of Plucker coordinates, and is used here in conjunction with Megiddo's parametric searching.

1

Marek Teichmann;

problem has many applications. We give one example from an area of importance to modern high precision engineering, dimensional tolerancing and metrology (see [SV, Ya)). Here the task is, given a physical object, to verify its conformance to tolerance specifications by taking probes of its surface. In industry, highly specialized, expensive equipment (called Coordinate Measurement Machines) is used to perform these probes automatically. Hence, high numerical accuracy is important, and any exact solution is preferable to the frequently used heuristic approaches. To illustrate the intrinsic complexity of (PI) and the optimization technique used, we shall also consider the following subproblem: Smallest Anchored Cylinder Problem (P2): Let I be a given set of n points in 3-space. Find a line l through the origin which minimizes max{ d(l, c) : c E I }.

Introduction

1.1

Motivation and Problem Statement

A major topic of geometric optimization is to approximate point sets by simple geometric figures. This includes extensively studied planar problems such as smallest enclosing circles, the minimum width annulus, and the minimum width slab. In higher dimensions, there are few non-trivial complexity results for geometric figures beyond hyperplanes or spheres. In this paper, we consider the following:

Smallest Cylinder Problem (PI): Let I be a given set of n points in 3-space. Find a line i which minimizes max{ d(t, c) : eEl}. Here, d(t, c) denotes the minimum Euclidean distance between c and a point of t. Since cylinders constitute an important primitive shape in computer-aided design and manufacturing, this • schoemerCDcs. uni -sb . de, Universitit des Saarlandes. t sellenCDcs. uni -sb .de, U niversitit des Saarlandes lteichmanCDcs.nyu.edu, Courant Institute, NYU § yapCDcs . nyu . edu, Courant Institute, NYU

Chee Yap§

1.2

Outline of Results

We summarize two areas of contribution of this paper. (See [SSTY] for the full version.) (I) We design efficient algorithms for the smallest cylinder problem in both an algebraic and a bit model of computing. Most geometric algorithms are developed within one of two distinct computational frameworks. In the algebraic framework, the complexity of an algorithm is measured by the number of algebraic operations on realvalued variables, assuming exact computations. The input size corresponds to the number n of input values. In the bit framework, the complexity is measured by the number of bitwise boolean operations on binary strings. The input generally consists of integers, and the parameter n is supplemented by an additional parameter L that bounds the maximal bit-size of any input value (in our application, the coordinates of the points in I).

264

While the size of the input is measured differently in the algebraic and in the bit model, the output can often be treated in a uniform way by asking for a combinatorial solution to the problem. In the case of (PI), we may assume the required output to be a list of those input points that determine the optimal cylinder(s).

problem (D) can be solved in O(nlk/2J) in the algebraic model. (ii) In the bit model, if each input coordinate has L bits, the problem (D) can be solved in O(Jl(L)n lk / 2J ).

1.3

Problem (P 1) belongs to a class of problems that have been considered from a complexity-theoretic viewpoint in [KG]. Although problem (PI) is routinely solved in engineering applications using numerical optimization techniques, few complexity theoretic results have been published. Concrete geometrical properties have first been investigated in [Pa], with focus on the decision problem to determine if there exists a cylinder with radius r = 1 (a unit cylinder) which encloses the input points.

Theorem 1 Problem (P 1) can be solved in time (i) O(n 4 10gO(1) n) in an algebraic model; and (ii) O(LJl(L )n 4 ) in a bit model.

=

Here, J.l (L) O( L log L log log L) denotes the complexity of multiplying two L-bit integers. Result (i) is obtained by using Megiddo's parametric search [Me]. Result (ii) is based on "exact approximation" and a bit complexity analysis that uses multivariate root bounds. While parametric search provides a clean dependency of running time on the number n of input points, the bit complexity approach is more suitable if accuracy is the main goal to achieve. This gets increasingly important as the algebraic source of complexity comes into play.

Proposition 1 ([Pal) (a) If there exists a unit cylinder that encloses all input points, then there also exists a unit enclosing cylinder which touches 4 of the input points, or whose axis is parallel to an edge of the convex hull of I. (b) There is only a finite number of unit cylinders that touch 4 non-collinear points in 3-space.

(II) We highlight a linearization technique for geometric optimization problems.

With these (geometrically non-trivial) results, the decision problem for fixed radius can be solved by enumerating all cylinders through choices of 4 points, and by checking if one of these encloses the input points. This algorithm has complexity O(n 5 ). With this, it is not hard to see that the optimization problem can be solved in time O(n 5 Iogn) by a straightforward application of parametric search. (The same time bound can also be achieved by computing all locally smallest enclosing cylinders for up to 5 input points, sorting them by radius, and using binary search to find the smallest enclosing among them.) We shall improve this bound by using linearization.

The heart of both approximation and parametric search algorithms is a decision scheme for a fixed optimization parameter. To obtain efficient decision algorithms that lend themselves to parametric search, it is often possible to exploit geometric duality transformations. Examples in the recent literature include inversion (as in [FSS]) and Plucker coordinates (as in [ST]). In this paper, we extend these principles to a more general framework known as linearization. We give this an abstract formulation. Let P(x, y) be a polynomial in the real variables x = (Xl! ... , Xl) and y = (yl! ... , Ym).

The linearization technique appears to have been used first by Yao [YY]. More recently, Agarwal and Matousek [AM] use linearization in the context of range searching with semialgebraic sets. They also give a simple procedure for finding the optimal linearization for a given polynomial. In this paper, linearization is used directly and is combined with the new parallel convex hull algorithm in [AGR] to allow the application of parametric search.

Abstract Decision Problem (D): Given a set I ~ R m of n points, decide if there exists a point c E Rt such that for allp E I, P(c,p) $ O. We say P(x, y) has an order k linearization if there exists 2k +1 polynomials, Xi = Xi(X) (i = 1, ... , k) and 1'£ = Yi(y) (for i = 0, ... , k), such that k

P(x,y)

Related Work

= Yo + EXiYi.

1.4

;=1

Theorem 2 (i) If P(x, y) has an order k linearization, the decision

Notes on Complexity

Problem (P2) can serve to illustrate the complexity of the smallest cylinder problem: already this problem

265

can be shown to be neither convex nor LP-type. In the following paragraph, we give a quadratic lower bound on the number of possible local minima of (P2) (the bound can easily be extended to (P 1) ) : Consider an even number n of points that are arranged on the unit sphere 52, n/2 on the circle C1 (C2) of intersection with the plane z 0 (y 0). We assume that the points on each circle are uniformly stepped and diametrically opposed. Further, let each line through the origin be parameterized by its intersection with the sphere 52. Now let us ask for the set of cylinders with distance 2: 1 - e to one input point c. This set corresponds to a thin stripe on 52, and describes the forbidden cylinders with respect to c. The set of enclosing cylinders with radius ::; 1 - e is the complement of the union of the stripes for all c E I. For e sufficiently small, this set has quadratic complexity.

=

=

Our optimization technique yields a running time of O(n 2 ) for the decision problem for (P2), assuming the algebraic model. Due to the possible number of minima, this result may be optimal. It is an open question whether (P2) belongs to the class of n 2 -hard problems introduced in [GO]. Finally, it is noteworthy that a variant of (P2) where we ask for an enclosing silo instead of a cylinder can be solved in time O( n log3 n log log n) [Fo].

Now, let Rl(X, y, z) be the squared radius of the circumcircle of ci, c2, c; in E, and R2(X, y, z) the squared radius of the circumcircle of ci, ca, c4. Then the set C( Cl, ... ,C4) can be interpreted as a 2-dimensional surface in 3-space, defined by Rl (x, y, z) = R2 (x, y, z). This condition is equivalent to P(x, y, z) 0, with

=

P(x, y, z) = ~1,2,4(xz2 + x 2 z) + ~1,3,4(yz2 + y2 z) + ~1,2,3(xy2 + x 2y)

+ (~112,4 + ~1,3,4 + ~112,3 -

=

where ~i,j,k Ci(Cj x Ck). With z l-x-y, P can also be interpreted as a polynomial in the 2 variables x and y, or as I-dimensional curve in the x-y-plane. We note that the total degree of P is 3, and the degree in each variable is 2. In order to compute the cylinders with fixed radius r in the set C(Cl, ... , C4), the additional condition Rl (x, y, z) r has to be satisfied. Unfortunately, this leads to a significantly more complicated polynomial equation Q(x, y) 0, with total degree 6. The set C,(Cl, ... , C4, r) of all cylinders with radius r that pass through Cl, •.• ,C4 is given by the set of so0, P(x, y) 0 }, and lutions of the system { Q(x, y) can be obtained algebraically by computing the roots of the resultants Fx Res(P,Q,y) and Fy Res(P,Q,x). These resultants have degree 12.

=

= =

=

=

2 2.1

Preliminaries Algebraic Formulation

A cylinder C in 3-space is specified by 5 real parameters: its axis line l and its radius r. We follow the approach suggested by Proposition 1, and first specify the set C( C1, ••• ,C4) of cylinders that touch 4 given points C1,···, C4 E I. By translation of the coordinate system, we can assume Cl (0, 0, 0). Let u E R 3 be any direction vector of i. Let E be the plane passing through the origin and orthogonal to u, and let ci, ... ,c4be the orthogonal projection of the input points Cl, •.• , C4 onto E. Then the cylinder C passes through C1, •.. , C4 if and only if ci , ... ,C4 are cocircular. The first problem that we face in the algebraic computation of solutions is to find a suitable parametrization for the direction vector u. We shall treat the case when u is not parallel to the plane containing C2, C3, C4. (Otherwise, we have a simpler subproblem.) Let

=

u

= XC2 + YC3 + ZC4,

with Z = 1- x - y. The parameters x, y, Z are also called the barycentric coordinates of u with respect to C2, C3, C4.

~213,4)(XYZ),

=

=

Lemma 1 If Cl, •.. , C4 are not collinear, the set C,(Cl, ... , C4, r) contains at most 12 cylinders. Assuming Ci are rational points, each cylinder is specified uniquely by algebraic numbers of degree at most 12.

2.2

Bit Complexity

Lemma 1 implicates a simple decision algorithm for the fixed-radius problem (PI), and hence an approximation algorithm for the optimization problem. Byexploiting ideas from the theory of exact computation, such approximation algorithms can be made "exact" in the sense of determining the combinatorial solution (see 1.2). What is needed is a gap theorem that relates qualitative changes of the solution to quantitative changes in the optimization parameter (here, r). In the following, it is useful to consider the optimization function (the radius r of a smallest enclosing cylinder) as a function of the axis direction, and thus as a surface in R3. (Note that for any fixed axis direction there exists a unique smallest enclosing cylinder !) This surface is given by 2-dimensional surface patches (corresponding to cylinders that touch 3 points), I-dimensional

266

ridges (corresponding to cylinders that touch 4 points), and vertices (defined by tuples of 5 points). Now assume that rf, i = 1,2, denotes a local minimum of a surface patch, a local minimum of a ridge, or the "height" of a vertex. Further, let ~ be a separation gap between any two values r~ and r~ that are not equal, i.e., Ir1- r~1 2:: 0 for all rl #- r~. Then the combinatorial solution of (PI) can easily be derived from a o-approximate solution of (PI). The computation of the gap ~ is non-trivial, requiring an algebraic characterization of the local minima above, and the application of multivariate root bounds. In the sequel, we shall focus on the computation of ~ for the most complicated case, when ri and r~ are the local minima of ridges. Let Cl, •.• ,C4 be an arbitrary choice of input points. Our goal is to compute a discrete set of values which contains r~, a local minimum value with respect to Cl , .•• , C4. Following subsection 2.1, let RI (x, y) be the squared radius of the circumcircle of ci, ci, ca, and Pl(X, y) the polynomial which defines the cylinder with direction parameters (x, y) passing through Cl, ... , C4. Then the candidates for r 1 are the local minimum valO. ues of JR1(x,y) under the side condition Pl(X,y) By the rule of Lagrange, there exists a parameter A such that the following 2 conditions hold at the minima:

=

(1) aRl

ax

+

AaPI

-

0

ax - ,

(2)

8~, + A8::

= o.

Eliminating A in these equations, let Ql(X, y) be the numerator of the expression

aRl _ aR l BPI (BPI)-l

8x

= .J

ay ax

ay

Then ri RI (x~ , yi), where (x~, Yl) is a solution of the system { PI(X, y) 0, Ql(X, y) 0 }. Analogously, let r~ be a minimum candidate for a different choice of input points, and P2, Q2, R2 the corresponding defining formulas. Then the needed separation gap can be obtained as a lower bound for 101 in the system of equations

=

number of new candidates. Now, a bound for ~ can be obtained from the gap-theorem of Canny [Cal. Proposition 2 ([Cal) Let It, ... ,In be n polynomials in n variables, with degree ~ d and coefficient magnitude :5 c. Assume that the system {It 0, ... , In = O} has only a finite number of solutions when homogenized. If (0'1, ... ,O'n) is a solution with O'j =1= 0, then 100j I > (3dc)-nd

=

ft



=

=

With C 2L, d const and n 2- 0 (L). This gives us:

= 5,

we get

101

=

Lemma 2 Let C be a smallest enclosing cylinder for input set I, with radius r*. Then any cylinder C' #- C that touches a different set of points than C has radius r = r* or r 2:: r* + 2- cL , for a suitable constant c. Remark 1 The use of the general gap-theorem (proposition 2) gives constants that are far beyond from being practical. It would be desirable to derive sharper bounds for special cases of this theorem.

Optimization Algorithms

3

3.1

Linearization

In order to illustrate the basic idea of the linearization technique, we first consider the anchored problem (P2). Our focus is the fixed-parameter problem to decide whether there exists an anchored cylinder of given radius r that encloses all input points. Let lab be the line through the points a, bE R3. We fix a at the origin and w.l.o.g. require b to lie on the plane z 1:

=

=

a = (0,0,0), b = (b:r:, by, 1).

=

Further, let c (c:r:, cy , cz ) be an arbitrary input point. We call lab admissible with respect to c if (1)

with

Pt{Xl' yt} = 0, Ql(Xl, yd = 0, P2(X2, Y2) = 0, Q2(X2, Y2) = 0, (5) .JRl (Xl, yd - .JR2(X2, Y2) = ~. (1) (2) (3) (4)

d(lab, c)2

=((c; + c;)b; + (c; + c;)b; -2c:r:cyb:r:by - 2c:r:czb:r: - 2cycz by (b; + + 1).

+(c; + c;)) /

By repeated squaring, formula (5) can be transformed 0 such into a polynomial equation R(Xl' YlJ X2, Y2, 0) that the set of solutions is only increased by a finite

=

b;

We embed our problem into a higher-dimensional space by setting Xl

267

= b:r:,X2 = by ,X3 = b;,X4 = b;,Xs = b:r:by.

(2)

Then lab is admissible with respect to c and given radius r iff

Now, equation (1) is true if and only if

Pc(Xl, ... , Xs) :5 0,

= (C,1:, cY ' cz )

(3)

where Pc is the linear equation with

Pc(X I , ... , Xs)

= (-2C,1:Cz )Xl + (-2CyCz )X2

Pc (a,1:, ay, b,1:, by) c;(b~ + 1) + c~(b;

=

+(c; + c; - r2)Xs + {c; + c; - r2)X4

+c,1:cy(-2b~by)

+( -2c,1:cy)Xs + (c; + c~ - r2).

Q(Xl, .. . ,Xs) = (Xl - XS)2 +

(xi - X4)2 + (Xs -

XIX2)2.

For the set I of input points, the fixed-parameter problem has a solution if and only if there exists a line lab which is admissible with respect to each c E I. This is equivalent to the existence of a common intersection of the halfspaces H c and the manifold M. The intersection

c;(b; + b~)

+ c~cz(-2b,1:) + cycz {-2by)

+Cz (2byay + 2b,1:a:r;) +C,1:( -2a z - 2a:r;b~ + 2bz byay)

According to this equation, Pc defines a hyperplane in R S , and inequality (3) a halfspace Hc. The set of equations (2) defines a 2-dimensional manifold which can be written as

with

+ 1) +

+cy( -2ay - 2ayb; + 2b,1:a z by) 2b2 + a 2 + a 2 +(a,21: by2 + ay,1: Y -r2(b; + b~) - 2b,1:a z byay) _r2. ~

At first glance, Pc has an order 10 linearization. However, we can save one variable by grouping the terms with factors c; and c; differently:

c;,

Now, the linearization is given by Xl Xs

= b,1:,X2 = by,Xs = b;,X4 = b~,X5 =b,1:by,

= byay + bz a,1:, X 7 = -a,1: - a,1:b~ + bzbyay,

is a convex polytope of complexity O(n 2 ), and can be constructed in the same time bound by Chazelle's result [Ch]. In order to intersect H with M, we triangulate H into O(n2) simplices. Each of these simplices can be tested for intersection with M separately in constant time if we assume an algebraic model of computing, and in time O{JL(L)) if we assume a bit model [Re]. (Note here that M is a semi-algebraic set and the above test corresponds to deciding the satisfiability for a system of polynomial equations and inequalities.) Concluding, we get a decision algorithm that runs in time 0 (n 2 ) (respectively 0 {p (L ) n 2 )) in an algebraic (respectively bit) model. This argument generalizes in a straightforward way to proving the general theorem 2. To apply the linearization technique to the problem (PI), we consider - w.l.o.g. - axis lines that are not parallel to the plane z O. Let lab be the line through the points a, bE RS, with

=

Xs = -ay - ayb; + b~a,1:by, X9 = a;(b; + 1) + a;(b; + 1) - r2(b; + b~) -2b~a,1:byay.

Applying theorem 2, we conclude that the fixedparameter problem for (P 1) can be decided in time O(n4) in an algebraic model, and in time O(JL(L)n 4 ) in a bit model.

Remark 2 If Pc has an order 8 linearization, this fact would not improve the asymptotic complexity of the problem. But it means we could use some of the O(nP~/21) convex hull algorithms to achieve the same complexity bounds.

3.2

Parametric Search vs. Exact Approximation

In this subsection we shall apply parametric search and "exact approximation" to problem (PI), based on the decision algorithm from the previous subsection.

268

Note that the presented techniques apply as well to the restricted setting (P2). We shall use the parametric search paradigm in its general form (see ego [AST] for a detailed description) . Let Ts denote the running time of a sequential decision algorithm for the fixed-parameter problem, and Tp (resp., P) the time (resp., number of processors) of a parallel decision algorithm, then the optimal value (here, r*). can be computed in sequential time O(PTp + T$Tp log P). It remains to give a parallel version of the decision algorithm. Here we exploit the new parallel algorithm for convex hulls in [AGR]: For dimension d ~ 4, there is an algorithm with time O(logn) and work 0(nld/2J logc Hd/21-Ld/2J) n), for some constant c > O. Further, with 0(nld/2J) processors, the test for intersection of H with M can be done in constant time in an algebraic model (resp., a real RAM, see [ReD. Plugging this into the parametric search paradigm, and observing that - in an algebraic model - the combinatorial solution of (PI) can easily be constructed from the computed optimum value r*, we obtain: Lemma 3 A combinatorial solution of (P 1) can be computed via parametric search in time 0(n4logk n), for a fixed constant k > o. Turning our attention to the bit model, as shown in subsection 2.2, the combinatorial solution of (PI) can be obtained from an e:-approximate solution for r* if e: 2-0(L). To compute this approximate solution, it suffices to run the decision algorithm for the fixedparameter problem O{£) times, with radii of bit-size O(L) as input. This yields:

=

Lemma 4 A combinatorial solution of (Pl) can be computed in the bit model in time 0{Lp{L)n4 ).

4

Final Remarks

As the field of geometric optimization matures, it treats problems of increasingly non-trivial algebraic complexity. The traditional neglect of bit complexity is no longer justified. The smallest cylinder problem is one of these problems. By combining the general linearization technique with parametric search and multivariate root bounds, we developed efficient algorithms in both an algebraic and a bit model.

References [AGR] N. Amato, M. Goodrich, E. Ramos, "Parallel algorithms for higher-dimensional convex hulls", IEEE FOCS, 1995.

[AM] P. K. Agarwal, J. Matousek, "On range searching with semialgebraic sets" , Discrete Comput. Geom., 11, 1994, pp. 393-418. [AST] P. Agarwal, M. Sharir, S. Toledo, "Applications of parametric searching in geometric optimization", Journal of Algorithms, 17, 1994, pp. 292-318. [Cal J. Canny, The Complexity oj Robot Motion Planning, MIT Press, 1987. [Ch] B. Chazelle, "An optimal convex hull algorithm in any fixed dimension" Discrete Comput. Geom., 10, 1993, pp. 377-409. [Fo] F. Follert, "Maxmin location of an anchored ray in 3space and related problems", 7th Canadian Conf. on Compo Geom., Quebec, 1995, pp. 7-12. [PSS] F. Follert, E. Schomer, J. Sellen, "Subquadratic algorithms for the weighted maximin facility location problem", 7th Canadian ConJ. on Compo Geom., Quebec, 1995, pp. 1-6. [GO] A. Gajentaan, M. Overmars, "n 2 -hard problems in computational geometry", Tech. Report RUU-CS-9315, Dept. Comput. Science, Utrecht Univ., Utrecht, The Netherlands, 1993. [KG] P. Gritzmann, V. Klee, "Computational complexity of inner and outer j-radii of polytopes in finitedimensional normed spaces", Math. Program., Vol. 59, 1993, pp. 163-213. [Me] N. Megiddo. "Applying parallel computation algorithms in the design of serial algorithms", Journal of the A CM, 30, 1983, pp. 852-865. [Pal J. Pach, unpublished notes. [Re] J. Renegar, "Recent progress on the complexity of the decision problem for the reals" , DIMACS Series in Discr. Math. and Th. Compo Sc., Vol. 6, 1991, pp. 287-308. [SSTY] E. Schomer, J. Sellen, M. Teichmann, C.K. Yap, "Smallest Enclosing Cylinders", Technical Report, Courant Inst, New York University, 1996, http://vvv.cs.nyu.eda [ST] E. Schomer, Ch. Thiel, "Efficient collision detection for moving polyhedra", 11th ACM Symposium on Compo Geom., Vancouver, 1995, pp. 51-60. [SV] V. Srinivasan, H. B. Voelcker. Dimensional Tolerancing and Metrology, The American Society of Mechanical Engineers, 345 East 47th Street, New York, NY 10017, CRTD-Vol. 27, 1993. [YY] A.C. Yao, F.F. Yao, "A general approach to Ddimensional geometric queries", Proc. 17th Annu. ACM Sympos. Theory Comput., 1985, pp. 163-168. [Ya] C. Yap, "Exact Computational Geometry and Tolerancing Metrology", in Snapshots of Computational and Discrete Geometry, Vol. 3, eds. David A vis and Jit Bose, McGill School of Comp.Sci, Tech. Rep. No.SOCS-94.50, A Volume Dedicated to Godfried Toussaint, 1994.

269

On the O(n4/3) Weak Lower Bounds for Some 3D Geometric Problems * Binhai Zhu Group C-3, MS K987 Los Alamos National Laboratory Los Alamos, NlVI 87545 USA

Abstract

have n( n log n) lower bounds by a reduction from sorting, element uniqueness, set disjointness, etc [PS85]. Similarly, most of the NP-hard results in computational geometry are obtained via problem reduction. Another important technique is combinatorial counting, i.e., computing the combinatorial complexity of the problem. For instance, we can simply obtain the n( n2 ) lower bound for constructing the arrangement of n lines in the plane. A nontrivial technique in this respect is to use the Davenport-Schinzel sequence [DS65, HS86] to establish the lower bound of (the space complexity of) some geometric problems. An example is the O(na(n)) lower bound for constructing the lower envelope of a set of n line segments. The probablistic argument method is largely used to prove the lower bounds of range queries, simplex queries, etc [Cha89, Cha90a, Cha90b, CR92].

In this paper, we establish the n( n 4 / 3 ) lower bounds constructively for some 3D geometric problems. The model we are using is essentially that of [ES93]. However, besides the primitive which can be used to solve a specific problem directly (with a bruteforce method) we also allow the primitive "Is this point to the left or right of (above or below) the intersection of these two lines?", which has been used to divide some similar problems into subproblems and obtain good upper bounds. Our problems include computing the shortest red/blue vertical distance between a set of red and blue line segments in 3D and computing the depth order of a set of line segments in 3D, etc.

1

Introduction

Besides the above standard lower bound techniques, Gajentaan and Overmars recently defined a class of 3SUM-hard problems [G093]. They showed that unless the 3SUM problem can be solved in o(n 2 ) time there is no hope to solve this class of geometric problems in o( n 2 ) time. Erickson and Seidel proved, with an adversary argument, that the problem of testing whether a set of points in d-dimension is degenerate requires O( nd ) sideness queries [ES93]. The model of Erickson and Seidel, which will be called ES-model throughout this paper, restricts any algorithm to have only a fixed primitive which "seems" of direct use for solving a specific problem. (Usually such a primitive enables us to solve the problem with an easy bruteforth algorithm.) For the problem of testing whether a set of points in d-dimension is degenerate, it is clear that such a primitive is the sideness query, i.e., testing whether d + 1 points are coplanar on ad-hyperplane [ES93].

Proving the lower bounds of problems is one of the central part in algorithm theory. Established lower bound for a specific problem usually convinces people not to try obtaining better algorithms unless under a different model of computation or when some extra primitives are allowed. In computational geometry (as well as in the general algorithm design area) lower bound is usually obtained via problem reduction, probablistic argument, combinatorial counting. However, in general the lower bound results are very sparse compared with the vast upper bound results in computational geometry [Cha94]. We briefly mention three techniques for proving lower bounds in computational geometry. The most fundamental technique is problem reduction. Many fundamental problems in two and three dimensions, like convex hull, Voronoi Diagram, Euclidean Minimum Spanning Tree, closest pair, etc., can be shown to

In the field of computational geometry there are a list of problems whose best known upper bounds are a little bit higher than O( n 4 / 3 ) and most of these

-This research is supported by Los Alamos National Laboratory.

270

results are obtained via randomized divide and conquer. A typical example is the famous Hopcroft's problem: Given n points and n lines in the plane, does any point lie on any line? Another example, which has application in computer graphics, is the following: Given n line segments (lines) in space, compute the depth order of these line segments (lines). The best O(n 4 / 3 20 (log· n») upper bound for Hopcroft's problem is obtained in [Mat93]. The best O( n 4 / 3+t:) upper bound for computing the depth order of a set of lines is due to Chazelle et al. [CEG+90]. The same upper bound for computing the depth order of a set of line segments is due to de Berg et al. [dBOS92]. Although great effort has been made, no upper bound better than O(n4 / 3 ) has been achieved. Consequently, it is meaningful to study the lower bounds for these problems. As with Hopcroft's problem, Erickson recently established an Q(n4/3) lower bound for all the partitioning algorithms solving this problem [Eri95a]. With respect to the ES-model, if the only allowed primitive is "On which side of this line does this point lie?" then it is easy to prove the Q(n 2 ) lower bound for Hopcroft's problem. Since Hopcroft's problem has already been solved in o(n 2 ) time this implies that the ES-model is too weak (for most of these geometric problems). However, if either of the primitives "Is this point to the left or right of (above or below) the intersection of these two lines?" and "Is the slope of this line larger or smaller than the slope of the line connecting these two points", which have been used to obtain some of those o( n 2 ) randomized divide and conquer algorithms, is also allowed then it is not known whether nontrivial lower bounds can be obtained on the ES-model. In this paper, we establish the O(n 4 / 3) weak lower bounds 1 for several geometric problems which are closely related to Hopcroft's problem. An enhanced ES-model is used throughout this paper, i.e., besides the primitives seemingly of direct use for these problems the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" is allowed. (Since this model is not a general one, we use the term "weak" to distinguish the lower bounds under this model from the standard lower bounds under the algebraic computation tree model. For the ease of presentation we mix the use of "lower bound" and "weak lower bound" and from now on any lower bound mentioned will be under the above enhanced ES-model, unless otherwise specified.) The four problems we consider are as follows.

(1) Given n red line segments and n blue line segments in 2D, decide whether there is a red/blue intersection. (2) Given n red line segments and n blue line segments in 3D, compute the shortest red/blue vertical distance between them. (3) Given n red line segments and n blue line segments in 3D, decide whether all the red segments are above the blue segments. (4) Given n line segments 3D, compute the depth order of these segments. The first and the third problem are special cases of the second problem. Therefore we will mainly study the second and the fourth problem. As with the second problem, it can clearly be solved in O(n 2 ) time with a brute-force method. The primitive of such a bruteforce algorithm is the red/blue vertical distance: given a pair of red and blue line segments in 3D, return the vertical distance between them. We prove that with the red/blue vertical distance function, together with the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" O(n4/3) is the lower bound for this problem. The technique used is mainly combinatorial counting and an adversary argument similar to [ES93]. The lower bound of the fourth problem can be established similarly with a more complex proof.

2

Preliminaries

In this section we present some known results which are the basis for our lower bound results in the subsequent sections. We first introduce the following lemma.

Lemma 1. Let ¢(j) denote Euler's function: (j) Hill ~ i ~ j and gcd(i,j) I}I. Then (1) Lj;sm ¢(j) m 2 + O(m log m), and (2) I:j;sm j¢(j) ~m3 + O(m 2 ).

= ;2

=

=

=

This lemma is proved in [HW65] (page 268) and is used in [Fre8I]. Suppose we have a set of m 2 points defined by M = {(i, j)II :::; i,j ~ m}. Given a line I in the Euclidean plane, we refer to the number of points of M through which I passes as the rank of I with respect to M. The following lemma is proved in [Fre81] and since it is crucial to our result we also rewrite the proof.

Lemma 2 [Fre81]. There exists O(m 2 ) distinct lines in the Euclidean plane so that their sum of ranks with

1 The

best mown lower bound for these problems under the algebraic computation tree model is O(nlogn).

271

respect to M is O(mS/3).

O(n4/3) time to compute the shortest red/blue ver-

tical distance between these line segments even if the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" , besides RBVD, is allowed.

Proof. Let lei, j, a, b) denote the line passing through the points (i,j) and (i + a,j + b). First we define a class of lines Fm = {1(i,j,a,b)ll ~ a ~ Lm 1 / 3 J, 1 ~ i ~ a,l :5 j :$ m/2,1 :5 b :5 a, and gcd(a,b) I} , Second we show that all lines in Fm are disl tinct, Suppose that l(i,j,a,b) l(i',j',al,b ). Since lei, j, a, b) l(i', j', ai, b), b/a bl/a' and consegcd(a, b) 1, gcd(a', b) 1 we have quently; since l l ,I J" ,a'b a = a1 ,b =/ b , S'IDce l( z, , ) passes t hrough ('z, J') and gcd(a , b') 1, i' i(MoDa), and therefore; since 1 :5 i, i' ~ a, it follows that i = i'. Similarly we have

=

=

=

=



= =

Proof. Let sex, y, Xli Yl) be a line segment connecting (x, y) and (x + XlJ Y + Yl) in the Euclidean plane. We construct a set of 2D line segments Gm {s( i+Qij, j +Pij, Qij, 0) 11 :5 i, j :5 m and Qij, Pij > O}. In other words, the line segments in G m are all horizontal, tiny and are at the upper right corner of the points in M. aij, f3ij can be made very very small. It is clear that IGml = m 2 •

=

=

=

,I

J =J '

The set of 3D blue line segments :Fm is obtained by taking an arbitrary set of 3D lines whose vertical projections corresponding the set of lines in Fm. For each point (i, j) in M we associate a set S( i, j) which contains all the lines in :Fm whose planar projection pass through (i, j). Clearly, following Lemma 2, Ei,j IS(i,j)1 ~ m S / 3 .

The

number of lines in Fm is given by l 1/3J Lm/2J EO::l a¢(a) :5 m 2/;r2+0(m 5 / 3 ) :5 m 2 (when m is sufficiently large). The rank of l(i,j, a, b) with respect to M is at least MIN(m/a, m/2b) ~ m/2a. Therefore the sum of ranks of the lines in Fm with relm 1 / 3 J a(a) spect to M, is at least (m/2a) x Lm/2J EO=1 =(m/2)lm/2J E~::~/3J (a) = Q(mS / 3 ). 0

=

We construct a set of 3D red line segments gm {Sij = [sci + Qij,j + Pij, aij, O),Z = ZijJll :5 i,j ~ m, and Qij, Pij, Zij > O}. In other words, the line segments in 9m are obtained by elevating the segments in Gm vertically to 3D.

In the subsequent sections, we establish our lower bound results based on Lemma 2.

3

Weak lower bound for the shortest red/blue vertical distance problem

Now the adversary controls the red line segments 9m by selecting suitable aij, Pij, for all i, j, so that the shortest vertical distance between the red/blue segments is infinity. To report this shortest vertical distance, any algorithm must compute, for all i, j, the vertical distance between all the line segments in S( i, j) and Sij. If an algorithm fails to check the distance between some segments in S( i, j) and Sij, the adversary perturbs aij, Pij so that the distance between some unchecked line segments in S(i,j) and Sij becomes the minimum (Le., finite). This holds for all S( i, j) since Sij (consequently Qij, Pij) are independent with each other for all i, j, and moreover, after this perturbation the algorithm can not distinguish the two input with the RBVD function and the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" 2. Consequently, computing the shortest vertical distance between the blue segments in :Fm and the red segments in gm takes at least Li,j IS(i,j)1 ~ m S/3

The vertical distance between a pair of red and blue segments in 3D is defined as the length of the vertical line segment connecting the two segments and if such a vertical connecting line segment does not exist then the distance is defined as +00. The problem of computing the shortest red/blue vertical distance between a set of n red segments and a set of n blue segments can clearly be solved in O(n 2 ) time with a brute-force method. The primitive of such a brute-force algorithm is the red/blue vertical distance (RBVD): given a pair of red and blue line segments in 3D, return the vertical distance between them. If the only primitive allowed is RBVD then it is easy to prove that Q(n 2 ) is the lower bound for this problem. We show that if the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" is also allowed then Q(n4 / 3 ) is the lower bound of this problem,

2However, if the primitive "Is the slope of this line larger or smaller than the slope of the line connecting these two points" is allowed then the algorithm can detect the perturbation and therefore this proof fails,

Theorem 3. There exist O( n) distinct red and blue line segments in the Euclidean space so that it takes

272

5

time. Finally, to complete the proof of the theorem we simply set n = m 2 and make the lines in :Fm into line segments. 0

In this section, we prove the lower bound for computing the depth order of a set of n line segments in 3D. A depth order of a set of 3D line segments is an order such that segment SI comes before S2 if S2 is above SI' It is easy to see that a depth order of a set of segments in 3D does not always exist since there can be cyclic overlap among segments. The best known upper bound for computing the depth order of a set of line segments is due to de Berg et al. [dBOS92]. Clearly, the aboveness testing function is the primitive which can be applied to solve this problem directly. (The aboveness testing function: given a pair of 3D segments (rods) SI and S2, it returns YES if SI is above S2, it returns NO if SI is below S2 and it returns NIL if the vertical projections of SI, S2 have no intersection (or equivalently, if the vertical distance of the two segments is +00).) We prove that the lower bound of this problem is O(n4/3) even an extra primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" is allowed. In fact we prove a stronger result that even checking whether the n rods have a cyclic overlap takes n( n 4 / 3 ) time with these two primitives.

We can apply the above proof immediately to establish the lower bound for detecting the red/blue intersection among a set of red segments and a set of blue segments in 2D.

4

Weak lower bound for computing the depth order of a set of line segments

Weak lower bound for testing the towering property of red/blue segments

It should be note that the above proof can be directly used to prove the lower bound of testing the "towering property of red/blue segments": given n red segments and n blue segments, does there exist a red segment above some blue segments? Clearly the primitive of direct use to this problem is the red/blue aboveness testing function: given a pair of red and blue segments, it returns YES if the red segment is above the blue one, it returns NO if the red segment is below the blue one and it returns NIL if the vertical projections of the two segments have no intersection (or equivalently, if the vertical distance of the two segments is +00). We simply state the result as follows.

Theorem 5. There exist O(n) distinct line segments in the Euclidean space so that it takes O( n 4 / 3 ) time to compute the depth order of these segments even if the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" , besides the red/blue aboveness testing function, is allowed.

Corollary 4. There exist O( n) distinct red and blue line segments in the Euclidean space so that it takes O(n4/3) time to decide whether there exists a red segment above some blue segments even if the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?", besides the red/blue aboveness testing function, is allowed.

Proof. Let sex, Y, Xl, yt} be a line segment connecting (x, y) and (x + Xl, y + Yl) in the Euclidean plane. We construct a set of 2D line segments Gm {s~jls~j sCi + CX~j,j + ,6;j,")';j,6;j)11 ~ i,j :5 m " (. ". and (Xij' Pij , ")'ij' 0ij > 0 U Sij 1Sij S Z + O:ij, J + " ".. . . d " ti' "{:" O} • ,8ij,")'ij,6ij )11 ~ Z,J ~ m an CXijllJij''')'ij,Uij> Moreover we can choose (X~j' /3;j , ")';j, 6~j' CX~j' /3ij , 1ij and 6ij so that S;j intersects S~j' In other words, at the upper right corner of each point in M there are two tiny intersecting segments. (cx~j' ,8;j' i~j' 6;j, O:;j , ,8~j ,i~i and 6ij can all be made very very small.) It is clear that IGml 2m 2 •

=

=

A closely related problem of testing the "towering property of red/blue lines": given n red lines and n blue lines, does there exist a red line above some blue lines? (or equivalently, are all blue lines above all red lines?) can be solved in O(n 4 / 3 +£) time [CEGS89]. This problem has been used to obtain the O(n 4 / 3+£) upper bounds for computing the shortest vertical distance between two terrains [CEGS89], computing the depth order of n lines [CEG+90] and computing the longest vertical distance between n lines [GP92]. However, the above lower bound result on testing the towering property of red/blue segments can not be claimed on lines.

I

I

I

I

}

{"

=

=

We construct a set of 3D line segments :Fm by first taking an arbitrary set of 3D lines whose vertical pro-

273

jections corresponding the set of lines in Fm and then we translate these segments one by one along the Z direction so that there is no cyclic overlap among these segments. For each point (i, j) in M we associate a set SCi, j) which contains all the lines in :Fm whose planar projection pass through (i,j). Clearly, 8 3 Li,j IS(i,j)1 ~ m / .

segments. 0 It should be noted that similar to the claim in the last section, this proof can not be immediately generalized to prove the lower bound of computing the depth order of a set of lines in 3D.

6

Let s( x, y, Z, xl, YI, Zl) be a 3D line segment connecting (x, y, z) and (x + Xl! y+ YI: Z + zd in the Euclidean space. We construct another set of 3D line segments 9m by mapping each S;j to s( i + a~j' j + Pij , zI ij , lij' Oij' z2 ij ) and each Sij to S Z + aij' J + 2' 1" 2" Pij,zIij'lij,Oij,z2ij)' where zIij,z ij' Z ij'Z ij are arbitrary reals. The set gm contains all these mapped segments. Clearly the vertical projections of the line segments in gm correspond to those 2D segments in Gm • ,

I

,

"

" ( . "

"

U

J1I

" "

We mention some related problems as a closing remark. An interesting question is whether one can establish the lower bounds (better than O( n log n)) for these problems under a stronger model, e.g., byallowing more primitives. Although the ultimate objective is to establish these lower bounds under the algebraic decision tree model we feel this is a very hard problem. Another question is whether we can prove other closely related problems under the model used in this paper. With respect to the result of Theorem 3, it should be noted that the constructive proof can not be immediately generalized to establish the lower bounds for the following related problems. (1) Compute the longest red/blue vertical distance between two sets of red and blue line segments each with size O(n). (2) Compute the shortest red/blue vertical distance between two sets of red and blue lines each with size O(n). (3) Compute the shortest red/blue vertical distance between a pair of red and blue polyhedral terrains each with size O( n). These problems are very closely related to the problem we study in Theorem 3; in fact, the best known upper bounds for solving these problems are either O( n 4/3+f ) or a little bit higher. Therefore it is interesting to ask whether one can find the lower bound proof for the above problems (and those mentioned in Section 4 and 5: testing the towering property of red/blue lines and computing the depth order of 3D lines) under the model used in this paper. Very recently Erickson used the method of [G093] to attack the lower bounds of some related geometric problems [Eri95b]. He showed that many of the problems are "harder than" or "almost harder than" some others. But there is no single base problem to which all t.hose problems can be reduced. We note that our model is hence different from that of [Eri95b].



I

The input to the original problems is set as :FmUgm . Now the adversary controls the segments gm by sed 6" lecting suitable aij, Pij , lij' Oij' aij' Pij '/ij an ij' for all i,j, so that no segment in:Fm is above or below those in gm (i.e., their vertical projections have no intersection). To report this, any algorithm must compute for all i, j, the aboveness testing functions between s( i+aij, j + Pij' zI ij , lij' 0ij, z2ij ) s z+aij,) + ".. , zI·· "I)' I'·, "~,, . {3') U", Z 2")) .• an d a11 th e l'me segment s In ') ') ') S(i,j). If an algorithm fails to comput~ an~ of,the~e functions, the adversary first perturbs aij' P ij , lij' 0ij , " " " h ' an d" or·· .. " 'Y •• and 0·· s.)· a11'Int ersect s ') , {3I)' I,) ') so t at s.)' • • with the vertical projection of this line segment l;j in S(i,j). Then, the adversary perturbs zl~j,z2;j' "" . ' . {3' , 'c' 2') zlij,z2ij so that s(t + (Xij,) + ij,zIij,lij,Uij'Z ij , . " . {3" " "~" 2") d /* s ( t+ori·' J+ ij' zI ij , lij' Uij' Z ij an ij so10rms a cyc l'IC overla~ (Figure 1). This holds for all i, j since all the values perturbed are independent with each other for all i, j, and moreover, after this perturbation the algorithm can not distinguish the two input with the aboveness testing function and the primitive "Is this point to the left or right of (above or below) the intersection of these two line segments?" 3. Consequently, computing the depth order of a set of O(m 2 ) segments in :Fm U 9m takes at least Li,j IS(i,j)1 ~ m 8/3 time. I

,

,

,

' "

I

I

"

I

II

"

'(

(.

"

Concluding Remarks



Finally, to complete the proof of the theorem we simply set n m 2 and make the lines in :Fm into line

=

3 Again, if the primitive "Is the slope of this line larger or smaller than the slope of the line connecting these two points" is allowed then the algorithm can detect the perturbation and therefore this proof fails.

References [CEG+90] B. Chazelle, H. Edelsbrunner, L. Guibas, 274

R. Pollack, R. Seidel, J. Snoeyink, and M. Sharir. Counting and cutting cycles of lines and rods in space. In Proc. 91st FOGS, pages 242-251, 1990.

[ES93]

[CEGS89] B. Chazelle, H. Edelsbrunner, L. Guibas, and M. Sharir. Line in space-combinatorics, algorithms and applications. In Proc. 21st STOG, pages 382-393,1989.

[Fre81]

M. L. Fredman. Lower bounds on the complexity of some optimal data structures. SIAM J. Comput., 10:1-10, 1981.

[G093]

A. Gajentaan and M. Overmars. On a class ofO(n2) problems in computational geometry. Report 1993-15, Department of Comput. Sci., Utrecht Univ., 1993.

[GP92]

L. Guibas and M. Pellegrini. Newalgorithmic results for lines-in-3-space problems. Technical Report TR-92-005, International Computer Science Institute, 1992.

[Cha89]

B. Chazelle. Lower bounds on the complexity of polytope range searching. J. Amer. Math. Soc., 2:637-666, 1989.

Canadian Conf on Comput. Geom., pages 127-137, 1995.

J. Erickson and R. Seidel. Better lower bounds on detecting affine and spherical degeneracies. In Proc. 94th Annu. IEEE Sympos. Found. Comput. Sci. (FOGS 99), pages 528-536, 1993.

[Cha90a]

B. Chazelle. Lower bounds for orthogonal range searching, I: the reporting case. J. AGM, 37:200-212, 1990.

[Cha90b]

B. Chazelle. Lower bounds for orthogonal range searching, II: the arithmetic model. J. AGM, 37:439-463, 1990.

[Cha94]

B. Chazelle. Computational geometry: A retrospective. In Proc. 26th Annu. AGM Sympos. Theory Comput., pages 75-94, 1994.

[HS86]

S. Hart and M. Sharir. Nonlinearity of Davenport-Schinzel sequences and of generalized path compression schemes. Gombinatorica, 6:151-177, 1986.

[CR92]

B. Chazelle and B. Rosenberg. Lower bounds on the complexity of simplex range reporting on a pointer machine. In Proc. 19th International Colloquium on A utomata, Languages, and Programming, volume 623 of Lecture Notes in Computer Science, pages 439-449. Springer-Verlag, 1992. Also to appear in Gomput. Geom. Theory Appl.

[HW65]

G. Hardy and E. Wright. The Theory of Numbers, Fourth Edition. Oxford University Press, London, 1965.

[Mat93]

J. MatouSek. Range searching with efficient hierarchical cuttings. Discrete Gomput. Geom., 10(2):157-182, 1993.

[PS85]

F.P. Preparata and M.l. Shamos. Computational Geometry: An Introduction. Springer-Verlag, 1985.

[dBOS92] M. de Berg, M. Overmars, and O. Schwarzkopf. Computing and verifying depth orders. In Proc. 8th Annu. ACM Sympos. Comput. Geom., pages 138-145, 1992. [DS65]

[Eri95a]

[Eri95b]

H. Davenport and A. Schinzel. A combinatorial problem connected with differential equations. Amer. J. Math., 87:684689,1965.

J. Erickson.

New lower bounds for Hopcroft's problem. In Proc. 11th Annu. ACM Sympos. Gomput. Geom., pages 127137,1995.

J. Erickson. On the relative complexities of some geometric problems. In Proc. 7th

275

After perturbation

~

Figure 1. Illustration for the proof of Theorem 5.

Computational Geometry Impact Potential: A Business and Industrial Perspective PrabhakarRaghavan Department K53, IBM Almaden Research Center 650 Harry Road, San Jose CA 95120 [email protected]

Abstract The computational geometry impact task force (Chazelle et al.) has done an outstanding and comprehensive job of reviewing a number of potential application areas for geometric computing. Their report identifies a number of areas where geometric computing has potential for impact, as well as techniques in computational geometry that could be invoked for these applications. This talk will view these areas from a business and industrial perspective, pointing out where we believe the biggest impact will be outside of the research community.

References http://www.cs.princeton.edu/-chazelle/taskforce/CGreport.ps.Z

276

Probabilistic algorithms for efficient grasping and fixturing Marek Teichmann*

Abstract Given an object with n points on its boundary where fingers can be placed, we give algorithms to select a "strong" grasp with a minimal number c of fingers (up to a logarithmic factor) for several measures of goodness. Along similar lines, given an integer c, we find the "best" K:C log c finger grasp for a small constant K:. Furthermore, we generalize existing measures for the case of frictionless assemblies of many objects in contact. Depending on the measure, the algorithms run in expected time O(c2 nl+O) or O((nc)l+O +c4 10gnlog3 c). Here is any positive constant. This setting generalizes to higher dimensions in the context of finding sets of fixtures. These problems translate into a collection of convex set covering problems. We are given a convex set L, and a set of points U with L C conv U in dimension d. There are two basic questions: (1) what is the smallest subset C of U or cover with L C conv C, and (2) given an integer c, what is the largest A with AL C conv C among all C C U of c points. We present an algorithmic framework which handles these problems in a uniform way and give approximation algorithms for specific instances of L including convex polytopes and balls. It generalizes an algorithm for polytope covering and approximation by Clarkson [Cla93] in several different directions: we show it can be used not only for minimizing cover size, but also maximizing the scaling factor A (see above), and further more it is valid for smaller cover sizes than previously possible, with appropriate modifications.

a

1

Introduction

Consider an idealized robot hand, consisting of several independently movable force-sensing fingers; this hand is used to grasp a rigid object B. Each finger contacts the object only at one point on B and can apply a positive force. We assume that at that point the normal to B is unique, and that the contact is frictionless. We wish to find a grasp: a set of points on the boundary of B. The fingers will then apply forces at these points to grasp the object. In general, we want the number of fingers to be small. Another desirable characteristic of a grasp is that by varying these forces within certain • Courant Institute, New York University, New York, NY 10012 USA. Supported by an NSF Grant CDA-9018673 and by FCAR and NSERC, Canada.

limits, we can resist an arbitrary external force-torque or wrench of the largest possible magnitude. See for example [MNP90, MSS87, FC92] for a more detailed description. Most existing grasp synthesis algorithms either do not attempt to optimize the grasps found with respect to grasp strength, or do so for very specific situations such as small numbers of fingers, or planar objects. The algorithmic situation for fixturing assemblies is similar. Here we address both of these issues and present an algorithm which works in general dimension for an aritrary number of fingers. We first describe the geometric formulation of grasping and fixturing theory, and grasp efficiency measures. We generalize these measures for the case of fixturing, and then exhibit a collection of related geometric optimization problems which arise, along with some connections to existing results in geometry.

1.1

Grasping Theory

The finger-body contacts being frictionless, a finger can only apply force f on the body in the direction of the inward pointing normal n(p) at a point p on the boundary of B. With each point p we associate a sixdimensional force-torque:

r(p)

= [n(p),p x n(p)].

This represents the effect of a unit force applied at p in the direction of n(p). For an illustration of the wrench map for planar objects, see Figure 1. We assume that we can select the grasp points from a finite set S of n points on the boundary of B. In practice this restriction is circumvented by providing a grid of points on the polygon faces. Thus we obtain an n-point set U r(S) in force-torque space. For a set G C S of c points, we call G a c-finger closure grasp if the interior of conv {r(p) : pEG} contains the origin o. It is shown in [MSS87] that for all but a certain class of objects having a boundary defined by an exceptional surface (a surface of revolution, for example) there is such a set of size c ~ 12. For polyhedral objects [MSS87] give an algorithm for find such a grasp in linear time. However there is no guarantee on the "quality" of the grasp. In [KMY92] such a measure of efficiency is proposed. It measures the amount of external force and torque that can be resisted by applying at most a unit force distributed among the grasp

277

=

Wrench Map

[MinCover-L]: Given Po, we wish to find the smallest set C C U or cover of size c* with p(conv C) ~ Po.

.............................................. .......

Since this problem is difficult (see section 2), we will solve a corresponding approximation problem: that of finding a cover of size O(c*dlogc*). We will call this a d log c* -approximation of the optimal cover. The companion problem is: given a maximum number of fingers c, which grasp G of size c maximizes p(r(G))? The geometric version of this problem is:

(. ~:. ·:~ ~t~,· ;1·~ . -~ n ~.~

Object

......................................... (:~:~

[MaxScale-L]: Given an integer c, find the set C C U of size c which maximizes p(G). Let p* ( c) be this maximum.

~!

.......................................... Its Image under the Wrench Map

Figure 1: The wrench map. points. This is measured by the radius of the largest ball, centered at the origin and contained in conv reG). See also [FC92]. Let 8(p) be the ball of radius P centered at the origin. For a set A C JRd, denote the largest radius of such a ball in conv A by rd(A) and call it the residual radius of A. When the dimension is given by the context we shall simply write r(A). Also denote by fJB the boundary of the object B. The efficiency of a grasp G is then r(r(G)). Note that it cannot be greater than r(r(fJB)). It is also of interest (see section 1.3) to replace the ball by a certain convex polytope. We would like to obtain grasps of high efficiency but with few fingers. These are two conflicting goals [KMY92], so in this paper we provide algorithms for optimizing one quantity or the other.

1.2

Optimization problems.

At this point let us describe the setting for the optimization algorithms in their full generality. Let p(.) be some grasp efficiency measure, generalized to higher dimension (see below). It has an associated geometric object L containing 0, which can be scaled about o. We define p(U) max{A : AL S; U}.

=

=

=

For p(.) r(.), L 8(1) in the appropriate dimension. Let a set of points G be a cover for L if L ~ conv G. One class of problems is: for a desired grasp efficiency Po, select a smallest possible set G out of n points on fJ B such that p(r(G)) ~ Po. This translates to the following purely geometric problem (valid in any dimension): let U be a set of n points in Ii d such that the origin is contained in the interior of its convex hull.

In the approximation version, we ask for a d log c· approximation of the best cover G. In the sequel, we will replace L by various convex sets. We present an algorithmic framework derived from an algorithm by Clarkson [Cla93] for polytope covering that yields efficient randomized approximation algorithms for the above problems for various types of the set L. In fact, this approach works for any set L for which we can determine whether it lies entirely on one side of a query hyperplane. When L is a ball centered at the origin, the corresponding optimization problems will be MaxScale-B and MinCover-B, and when Lis a polytope containing the origin, "-L" will be replaced by"-P". Let 'Y 1/ld/2J and be any positive constant. The approximation versions of MaxScale-B and MinCover-B can be solved in expected time O«n 1 +cS + (nc)l/(l+"Y/(l+cS») + clog(n/c)(clogc)ld/2J) when d is fixed, using sophisticated data structures. Here c represents the optimal cover size for MinCover-B and the desired cover size for MaxScale-B. In both cases a cover of size 4cd log c is returned. For a polytope P of £ vertices, the MinCover-P dlogcapproximation problem was already solved by Clarkson's algorithm in expected time O(n 1 +cS + c£l+cS + c(lC)l/(l+"Y/(l+cS» + (nc)l/(l+"Y/(l+cS») or O(£clogc + n)c log(n/c) using a simpler version of the algorithm. In the same time bound, we can solve the approximation version of MaxScale-P (with c an input parameter), and MinCover-P (with c the optimal cover size.)

=

1.3

a

Further applications.

Other efficiency measures closely related to the previous one have been proposed, see for example [FC92] for a measure based on Minkowski sums instead of convex hulls. Yet another measure was proposed by W. Meyer and was described in [Mis94] - see this paper for a survey of grasp efficiency measures. Imagine an adversarial external finger capable of applying a force of

278

an arbitrary magnitude on the grasped object. Define rnasty( G) to be the magnitude of the least amount of force the "nasty" finger must apply to break the grasp. Then rna'ty(G) = max{,X : 'xr(8B) ~ conv -r(G)}. It turns out that the image of any set S C 8 B by r is a set of points in non-strictly-convex position, that is they all lie on the boundary of conv r(S). In addition, if the object B is polyhedral, then r(8B) is a set of two-dimensional polygons in ]R6, hence conv r(8B) is also polyhedral [Tei95]. The corresponding optimization problems are then simply MinCover-P and MaxScale-P. Fixturing. We now consider the case of grasping several objects that are possibly in contact with each other, using a set of fingers, or fixture elements. This problem arises in manufacturing where many assembly tasks require a set of contacting objects to be held firmly. Fixture elements or fixtures are positioned in contact with the objects to achieve this. Often there is only a finite set of possible placements due to the construction of the workholding table [ZGW94]. In this setting, forces applied to an object are due both to contacts between objects, and between objects and fixtures. As in grasping, it is desirable to use a small number of fixtures, and/or limit the forces they must apply on the objects. The previous framework generalizes to this case byessentially concatenating the force-torque vectors for each object and working in ]R 6k where k is the number of objects [BMK94]. Let mi be the center of mass of object i. In the following definitions is the 6 dimensional zero vector. For each object Bi and contact point p let r i (p) = [n(p), (p - mil x n(p)]. A fixture applied at p to Bi generates the generalized force-torque

(or 3). The definition of residual radius still applies. Hence the measure will be defined as r6k(conv r.(G)). As is the case in grasping a single object, here we assume that the sum of the magnitudes of all wrenches due either to the fingers or inter-object contacts must be bounded by 1. If a generalized wrench WEIR 6k is outside of conv r. (G), then W cannot be expressed as a convex combination of finger and inter-object contact wrenches, and the fixture is broken if W is applied to the assembly, Le. the component of W corresponding to each object is applied to that object. Other geometric objects can be used for L with slightly different geometric interpretations. For example, consider the nasty finger measure. For the inscribed set L, we simply take the direct product ®i conv r(8Bi)' For the set U, we take -L. The corresponding optimization problems are MaxScale-P and MinCover-P.

2

Related Results

Exact algorithms for the problems mentioned in the previous section that run in polynomial time seem unlikely. In fact problems similar to these have been shown to be NP-hard [BMK94] or NP-complete [DJ90]. We therefore consider approximation algorithms for the MinCover and MaxScale problems. The MinCover-P problem arises in a dual form in the context of separating two nested polyhedra [MS92, Cla93]. These problems can in turn be cast as Hitting Set problems [MS92]. There is also a deterministic analogue of Clarkson's algorithm which solves this problem and which provides a O(dlogc)-approximation [BG94] in time 0 ( n Ld/2J + cdnlogd(dc)) clog(n/c). r.(p) [0, ... ,0,ri(p),0, ... ,0] E ]R6k. "--v--" It is easy to verify that these hitting set techniques i-I also apply to our MinCover-B problem as well as more The i-th position contains ri(p). A contact between general versions. It is unclear however whether these object Bi and object Bj generates techniques can be applied to yield approximation algorithms for MaxScale-B or MaxScale-P, as they depend r. (p) [0, ... , 0, r i (p), 0, ... , 0, r j (p), 0, ... , 0] . "--v--" "--v--" on the fact that the set L is fixed. i-I j-i-l For the MaxScale-B problem, Kirkpatrick et In this context force-torque closure can be defined al. [KMY92] give an algorithm that finds a cover analogously to the previous one-object case: a set G of C of size c containing a ball of radius r(C) fixtures (Le. of these generalized force-torque vectors) [1- 3d (2d 2/c)2/(d-l)] r(U), for n ~ c ~ 13 dd(d+3)/2 is a force/torque closure fixture set if and only if 0 is in in time O(LP(n, d)c). The radius found is almost opthe interior of conv r. (G). Fixture quality measures. We now introduce new timal for that cover size. Here LP(n, d) is the time regrasp efficiency measures for the case of several objects. quired to solve a linear program of size n and dimenInformally the goal again is to keep the boundary of sion d. Currently the best deterministic algorithm runs 7d o conv r. (G) bounded away from the origin for all ob- in O(d + (d)n) time [CM93] and the best randomized jects. In fact the above grasp efficiency measures gen- algorithm in time O(d2 n + eO(v'dlogd»). See [GoI95] eralize quite naturally to this case, but we work in di- for this bound and a recent survey. Unfortunately this mension 6k (or 3k for planar objects) instead of d = 6 result applies only for large cover sizes.

°

=

=

=

279

The Computational Framework

3

Consider a set U of n points in lR d, and a convex set L with 0 E L C conv U. We will use a routine FIND COVER which, for a given cover size c outputs a cover of L of size 4cdlogc, if a cover of size cexists, otherwise it fails. Let c· be the size of the smallest cover C C U for L. If we wish to find c· for fixed, un-scaled L, we use OPTIMAL COVER. In OPTIMAL COVER, we simply call FIND COVER with cover sizes c = (~)i, with i 19 d, 19 d + 1, . . .. This loop finds an approximation of c· up to a factor of 5/4, without increasing the asymptotic running time. The algorithm FIND COVER is defined below. It takes as input the desired cover size c, and uses another routine FIND BAD FACET. Given a half space h with a positive side, FIND BAD FACET determines whether L lies entirely in the positive half-space defined by h. In fact for the MaxScale problems we will need more: given a direction U, we will need the supporting hyperplane for L with normal U which is the furthest in that direction. The algorithm goes as follows. We repeatedly take a random sample R, of expected size s = 4cdlogc, and test whether L (or some scaled version of L) is contained in conv R using FIND BAD FACET.

=

FIND COVER Input: Size c of desired optimal cover; Maximum number I of iterations. Output: Cover of size c4dlog c. 1.

2. 3. 4. 5. 6. 7.

8. 9. 10.

s

= c4dlnc, {the expected size of cover}

for all p E U, let wp = 1 repeat for I successful iterations: Choose R C U at random. (see text) FIND BAD FACET F of conv R. if no bad facet, return R. Let UF = points of U seeing F if W(UF) :5 w(U)/(kc) then for all p E U let Wp = 2wp I

{reweight} else {not a successful iteration}

picking each point p of U independently with probability Pr(p) 1 - (1 - wp/w(U»$ :5 swp/w(U). The expected size of R is LpEU Pr(p) :5 LpEU sw'(fJ) s. Finally the heart of the work is done in FIND BAD FACET whose variations are described in the next section. The correctness of the general algorithm follows from a series of lemmas. The following lemmas were shown in [Cla93] for L a convex polytope, but the proofs do not use the fact that L is polyhedral and actually apply to any set L. We state them here for completeness, and also to bound some constants explicitly.

=

=

Lemma 3.1 (Clarkson) Let L be any convex set not contained in conv R, with a point pEL on the negative side of some facet F of conv R. Let Up be the set of points of U that see F. Then there is a point of the optimal cover C of L among the points of UF. This lemma is the basis of this algorithm, and its derivatives. It essentially says that by finding a set UF, we have gained some information about C since one of its members must be in the relatively small set UF. We restrict the size of this set to be bounded by the condition w(Up) :5 w(U)/(kc). We say that a facet F of a polytope P is visible from a point q if for every p E F, the segment pq does not meet P. Here P will be conv R. Following [Cla93], we define an L-facet to be a facet visible from of point of L. Then we have the following lemma, which is a slightly modified version of Clarkson's lemma 2.2.

Lemma 3.2 Given that an L-facet F is found, the probability that an iteration of FIND COVER will be successful (i.e. the set Up satisfies W(UF) :5 w(U)/(kc»), is at least 1/2. Proof. The proof follows Clarkson's closely, but is addition we note that the probability that an iteration of FIND COVER will be not be successful is bounded above by 1/2 for k = 2,d > 2 and c > 43; or for k = 1.501, d> 2 and c> 6. See [Tei95] for details. 0

end{FIND COVER}.

Finally, to obtain a bound on the running time, we need to bound the number of iterations of the loop in Let k be a constant to be specified later. Call an iter- FIND COVER. Again this lemma is a slight variation of ation of the loop in FIND COVER successful if the weights Clarkson's and a similar lemma also appears in [BG94]. were doubled, i.e. if w(Up) :5 w(U)/(kc). We also require that IRI ~ 4cd In c. This can be ensured by tak- Lemma 3.3 The number of successful iterations of the ing new random samples if necessary. This additional loop in FIND COVER before a cover is found is bounded requirement does not change the expected asymptotic above by 2;:3clg(n/c) which is 4clg(n/c) for k = 2, 1501c 19(n/c) for k 1.501. running time. If a cover of size c is not found in the number of Proof. See [Tei95] for details. 0 iterations specified, FIND COVER fails; otherwise, it returns a cover of expected size 4cd log c. This number This implies together with Lemma 3.2 that the exis chosen in Lemma 3.3 to guarantee success if a cover pected number of iterations of the loop in FIND COVER of size c exists. The random selection of R is done by is 0 (c 19( n/ c». It is interesting to note the tradeoff in

=

280

the constants between the constant in the running time, and the constant k, which in turn determines the minimum cover size for which these lemmas are valid. Note also that these lemmas hold for small values of c, which makes the algorithm useful for small size covers. Of course e > d, since we cannot have a cover of any smaller size unless the input is highly degenerate.

contained in conv R. This is done using linear programming. Each such step can be done in 0 (LP (4ed log c, d) ) time. For variable d, the entire algorithm runs in expected time

o (nedlog(n/c) + ic2 d3 10ge 10g(nJe) + i.c log( nJ c)eO ( J d log d) )



For fixed d, we can also use linear programming queries using the recent batched version of In this section we describe several versions of Chan [Cha95] to improve slightly the running time for large I. If i = O( n), a much simplified expression of the FIND BAD FACET and give the corresponding running running time is O(n 1+cS + c2nlognloge). times of the entire algorithms.

4

Particular Measures

MinCover-B: We are given a ball B(r) of radius r centered at the origin, and we would like to find an approximation of its minimal cover among the points of U. To do this, we use OPTIMAL COVER, but we define FIND BAD FACET to test whether the ball is contained in the convex hull of the random sample R. This can be done by computing the convex hull of R and finding a facet that is at a distance of less than r to the origin. This takes time O(IRI Ld/2J) for fixed d ~ 4 (or O( IRl10g IRI) if d ~ 3) [Cha93]. For variable d, we can use the algorithm in [AF92], which finds / facets of the convex hull of n points in dimension d in time O(ndf). Let 'Y = 1/ld/2J and 0 be any positive constant. Since the expected number of iterations is O(elog(n/e)) and the expected size of R is 4ed In c, the expected running time of OPTIMAL COVER for B( r) is:

O(n 1+6 + (ne)1/(1+"Y/(1+6» + clog(n/e)(eloge)Ld/2J) for fixed d, or

o (ncdlog(n/c) + cd22d log(n/c)(4cd loge) Ld/2J+l )

MaxScale-B: Let r* (s) be the radius of the largest ball centered at the origin and contained in a cover of size s. In this problem we are given a desired cover size e, and we would like to find r*(e). We will not use OPTIMAL COVER but skip directly to FIND COVER. Here again we get only an O(dlogc) approximation to this cover. The corresponding version of FIND BAD FACET will be to use FIND BAD FACET as for the MinCover-B problem, but always return the facet closest to the origin, i.e. never say that a ball of some radius has been covered. We also remember the maximum distance to the origin of the closest facet at each iteration, and the corresponding cover. Here again we do only 4c 19(n/e) successful iterations, i.e. O(clog(n/c)) calls to FIND BAD FACET. This will guarantee that the version of FIND COVER for MaxScale-B finds a cover of size at most 4edlne containing a ball of radius r*(e). This can be seen as follows. By Lemma 3.3 we are certain to find a cover if it exists. Hence if B(r* (e)) is the largest ball in covers of size e, a cover of size 4cdlne containing B(r*(e)) must be found. The running time is the same as for the MinCover-B approximation.

MaxScale-P: The solution to this problem is very similar to the prefor any d (and non-degenerate convex hull of the covers) vious case. Here FIND BAD FACET finds the largest using the result in [AF92] and the crude bound on the possible scaling factor A such that AP ~ conv R using complexity of the convex hull of d2dvL~J (derived from linear programming queries as for MinCover-P. We the Upper Bound Theorem [MS71].) summarize both results in MinCover-P: Theorem 4.1 The versions O/FIND COVER for The geometric object to be covered is a fixed polytope P MaxScale-B (resp. MaxScale-P) find a cover of size at with i. vertices containing the origin. Clarkson's original most 4ed In c containing a ball 0/ radius r* (e) (resp. P algorithm solves this approximation problem for fixed d scaled by A* (e)) in time identical to their MinCover-B in expected time O(n 1+cS + ci.1+6 + c(ie)l/(l+"Y/(l+cS)) + and -P counterparts. (ne)1/(1+"Y/(1+6») or O(icloge + n)clog(n/e) using a simpler version of the algorithm. Let the positive side Similar techniques can be used for other sets L. of a facet of a polytope be the side containing the poly- 4.1 Speeding up MinCover-B and MaxScale-B tope. Here FIND BAD FACET finds a facet F of conv R such that there is a vertex of P on the side of F not conTo avoid taking the expensive convex hull of R to taining the origin, i. e. on its negative side, if P is not find a facet closest to the origin, we can approximate

281

r*(c). We sample conv R by performing the ray shoot- [Cla93] ing queries described above for the case of polytopes, along equally distributed rays on the set of directions (or points on a sphere.) We can use the upper bound contruction of [KMY92] to find such a set of points or [CM93] rays. We get Theorem 4.2 The optimal radius (for a eover of size c) for both MaxScale-B and MinCover-B can be 1 - ~ approximated in expected time O(n 1+cS +

d-2]

(nc)1/(1+'Y/(1+0)) + [ 1:1;2 (~) - 2 - c2 10g ~ loge) using a 2

Concluding remarks

It is possible to extend the framework to the following case: instead of a set of points U, we have a set of planar polygons. This corresponds to the situation in grasping where we allow fingers to be placed anywhere on BB. However we no not know how to analyze the performance of this modification in terms of optimality of cover size. On a different note, the physical interpretation of the fixturing metrics do not seem to be as natural as the corresponding ones for a single object. Finally, we are in the process of implementing this algorithm. This might shed some light on whether the special structure of the point sets in our application has any impact on the efficiency. We wish to thank Bud Mishra, Ken Clarkson and Chee Yap for helpful discussions on this subject.

References D. Avis and K. Fukuda. A pivoting algorithm for convex hulls and vertex enumeration of arrangements and polyhedra. Discrete Comput. Geom., 8:295-313, 1992. [BG94] H. Bronnimann and M. T. Goodrich. Almost optimal set covers in finite vc-dimension. In Proc. 10th Annu. ACM Sympos. Comput. Geom., pages 293-302, 1994. [BMK94] O. Baraff, R. Mattikalli, and P. Khosla. Minimal fixturing of frictionless assemblies: Complexity and algorithms. Report CMU-RI-TR-94-08, The Robotics Inst., Carnegie Mellon University, Pittsburgh, PA, 1994. [Cha93] B. Chazelle. An optimal convex hull algorithm in any fixed dimension. Discrete Comput. Geom., 10:377-409, 1993. [Cha95] Timothy M. Y. Chan. Output-sensitive results on convex hulls, extreme points, and related problems. In Proc. 11th Annu. ACM Sympos. Comput. Geom., pages 10-19, 1995.

B. Chazelle and J. MatouSek. On linear-time deterministic algorithms for optimization problems in fixed dimension. In Proc. 4th ACMSIAM Sympos. Discrete Algorithms, pages 281290, 1993.

[OJ 90]

G. Oas and D. Joseph. The complexity of minimum convex nested polyhedra. In Proc. 2nd Canad. Conf. Comput. Geom., pages 296-301, 1990.

[FC92]

C. Ferrari and J. Canny. Planning optimal grasps. In 1992 IEEE International Conference on Robotics and A utomation, pages 2290-2295, Nice, France, 1992.

[GoI95]

M. Goldwasser. A sW'Vey of linear programming in randomized sub exponential time. SIGACT News, 26(2):96-104, 1995.

simplified version of expression for the running time.

5

Kenneth L. Clarkson. Algorithms for polytope covering and approximation. In Proc. 3rd Workshop Algorithms Data Struct., volume 709 of Lecture Notes in Computer Science, pages 246-252, 1993.

[KMY92] D. Kirkpatrick, B. Mishra, and C.-K. Yap. Quantitative Steinitz's theorems with applications to multifingered grasping. Discrete Comput. Geom., 7:295-318, 1992. [Mis94]

B. Mishra. Grasp metrics: Optimality and complexity. In K. Goldberg, O. Halperin, J.C. Latombe, and R. Wilson, editors, Algorithmic Foundations of Robotics, pages 137-166. A.K. Peters, 1994.

[MNP90] Xanthippi Markenscoff, Luqun Ni, and Christoph H. Papadimitriou. The Geometry of Grasping. The International Journal of Robotics Research, 9(1), February 1990. [MS71]

P. McMullen and G. C. Shephard. Convex Polytopes and the Upper Bound Conjecture. Cambridge University Press, Cambridge, England, 1971.

[MS92]

J. S. B. Mitchell and S. Suri. Separation and approximation of polyhedral surfaces. In Proc. 3rd ACM-SIAM Sympos. Discrete Algorithms, pages 296-306, 1992.

[MSS87]

B. Mishra, J.T. Schwartz, and M. Sharir. On the Existence and Synthesis of Multifinger Positive Grips. Algorithmica, 2:541-558, 1987.

[Tei95]

M. Teichmann. Grasping and Fixturing: A Geometric Analysis and an Implementation. Ph.D. thesis, New York Univ., New York, NY, 1995.

[AF92]

[ZGW94] Y. Zhuang, K.Y. Goldberg, and Y.-C. Wong. On the existence of modular fixtures. In IEEE International Conference on Robotics and A utomation, pages 543-549, San Diego, CA, 1994.

282

On a problem of immobilizing polygons. Jurek CZYZOWICZ 1

Ivan STOJMENOVIC2

Tomasz Szy'MACHA3

d'informatique, Universite du Quebec aHull, Hull, Quebec, Canada of Computer Science, Ottawa Univ., Ottawa, Onto Canada 3 Institute of Informatics, Warsaw University, Warsaw, Poland

1 Dept.

2 Dept.

Abstract: For a given polygon P and a set I of points (pins) in the plane, we say that I immobilizes P if any rigid motion of P in the plane forces at least one pin of I to penetrate the interior of P. We give an O(n) algorithm checking whether a given set of n pins, different from convex vertices ofP, immobilizes it. We also prove that from any set of immobilizing pins we can choose four of them which will also immobilize P.

1.Introduction. Let P be a polygon and I a set of n points (pins) in the plane. We say that I immobilizes P if any rigid motion of P in the plane forces at least one of the pins of I to penetrate the interior of P. As for small motion only pins from the boundary of P may penetrate it, we will suppose that all pins actually belong to the boundary of the polygon. A rigid motion of polygon P in the plane is a mapping M (different from identity) from the set txP (t represents time) to the plane, continuous with respect to its first coordinate, such that for every pair of points u, VE P the distance between their images remains constant for all t and M(O, u)=u for every element of P. A set of points I immobilizes the shape P if the only motion of P which does not allow the penetration of some element of I to the interior of P is the identity M(t, u)=u for all t and u. Problems of immobilization were introduced by W. Kuperberg [K] and some of them were later reported in [0]. These problems generally concerned two classes of figures: shapes and polygons. We call a shape any figure bounded by a Jordan curve which is different from a circle. The circle is obviously excluded from consideration since any number of pins on its boundary leave it free to rotate. For polygons, some interesting algorithmic questions arise. - Are four pins sufficient to immobilize any shape? - Do three pins suffice for all smooth convex shapes? - Find all classes of convex shapes for which three pins are not sufficient. - Design an algorithm finding a set of immobilizing pins for a given polygon. - Design an algorithm deciding whether a set of n given pins immobilizes a given polygon. Some of this questions may be partially answered using known results from grasping. For piecewise smooth shape P, Mishra, Schwartz and Sharir [MSS] as well as Markenscoff, Ni and Papadimitriou [MNP] studied the problem of closure grasp, i.e. the ability to respond to any external force or torque

by applying appropriate forces at the grasp points. They proved that there exists the force-torque closure grasp of the shape P, using a minimal set S of four finger points. The set S may be found in O(k) time, for the shape S being a polygon of k vertices, see [MSS]. It follows that any rigid velocity of P causes at least one of point of S to have an instantaneous velocity strictly directed towards the interior ofP (see [MS]). As a consequence, the set S of four pins would immobilize P. However, such set S of four grasping fingers is not the smallest possible for the immobilizing purpose. Czyzowicz, Stojmenovic and Urrutia [CSU2] proved that for most polygons, including all polygons without parallel sides, three immobilizing pins may be always found. They propose an O(n) algorithm finding these three pins. They also have exact combinatorial bounds for higher dimensions. For the case of smooth and convex shapes, using tools of differential geometry, Montejano and Urrutia [MU] proved that three immobilizing pins are always sufficient. Finally Czyzowicz, Stojmenovic and Urrutia [CSUI] settled the question for general shapes, proving that four immobilizing pins are always sufficient. In this paper we propose an algorithm determining whether a given set of n pins immobilizes the polygon P. If the positions of the pins are different from convex vertices of P we have an O(n) algorithm to check whether I immobilizes P. If I does not immobilize P this algorithm may also output a possible motion ofP so that no pin of I penetrates the polygon. When k pins are situated at the convex vertices ofP, this algorithm must be adjusted correspondingly and, it may be proved, that its complexity increases to 0(n2 ), 0(n'2 k) or 0«n+k2) log n). If the set I immobilizes P we prove that we can choose four pins of I which will also immobilize P. The idea of the main algorithm is the following. Any position of the polygon P may be expressed as a composition of a translation and a rotation, applied to the original position ofP. This new position of the polygon may be expressed as the point in

283

the three-dimensional spaqe. A motion ofP is then represented as a curve in this space (called motion space). For each pin Pi, we compute the region (called feasible region) of the motion space representing the positions of P when Pi does not penetrate the interior of P. If the intersection of such regions computed for all the pins of I is not degenerated to a single point (i.e. the original position of P) then there exists a motion of P. In most cases, it is not necessary to compute the intersection of all feasible regions. The algorithm will determine first, whether this intersection is a zero-, one-, two- or three-dimensional set. Then, depending on the case, the algorithm will act accordingly.

1. Preliminaries. Theorem 1.1. (Meggido [Me83]): Two dimensional linear programming can be solved in linear time with respect to the number of constrains. Meggido's theorem implies the following:

Corollary 1.1. Given a set H of n halfplanes in the plane we can check in O(n) time whether their intersection is: a) empty. b) a point. c) one-dimensional (segment, semiline or line). d) non-degenerated two dimensional convex region. Theorem 1.2. ([CSU]). Let be given a polygon P and three points X, Y and Z belonging to the interior of three edges x, y and z of P, respectively. X, Y and Z immobilize P, if and only if two following conditions are verified: 1) perpendiculars to x, y and z at X, Y and Z respectively, meet at a common point, 2) three halfplanes bounded by x, y and z, containing the interior ofP in the neighborhood of X, Y and Z respectively, have a nonempty, finite intersection. From the proof of this theorem it followed

Corollary 1.2. If the three perpendiculars do not meet at a common point and no two of them are parallel then there exists a rotation of P, such that no pin penetrates the interior of P. Theorem 1.3. (Helly [H]) There exists a point which intersects a finite family of convex sets in Ed if and only if the intersection of every d+ 1 sets is non-empty. 2. Releasing motions and feasible regions. In order to decide whether a set of pins immobilize a given polygon we have to check if there exists a releasing motion, i.e. a motion with no pin penetrating the interior of the polygon. In this section we will observe some facts concerning these motions, essential to find an efficient algorithm.

For polygon P and a set I of pins on its boundary we choose as e(P,I) a value smaller than a distance between any two pins of I and smaller than a distance between any pin and any side of P not meeting this pin. As P is simple, we can always choose e(P,I»O. A motion ofP will be called small if the distance between any point of P and its image after the motion is smaller that e(P,I). In the sequel a motion refers to a small motion. Indeed, as motion any of P is a continuous function, the existence of a motion for given I implies the existence of a small motion. For small motions, a pin may penetrate the interior of polygon P only through the side of P containing it; penetration of the interior ofP by a pin is then equivalent to the penetration of the halfplane determined by the side ofP containing the pin. The complement of such halfplane of penetration will be called halfplane of release. The definition of motion M in the introduction implies, that for every t, the mapping M(t,.) is an even isometry of the plane. As every even isometry of the plane is a composition of a rotation around any point 0 and some translation, we may consider the following alternative definition of motion. Choose a point 0 in the plane. Motion in the plane is a mappingF(t)= (cI>(t), X(t), Y(t»; tE [0 .. 1], where F(O)=(O,O,O), and cI>(t), X(t) and Y(t» are continuous functions. F(t') represents here the position P' of the polygon at the time moment t'. The position P' is obtained, by applying to the original position Po' a rotation around 0 by an angle CoP(t'), O~cI>(t')~1t, followed by the translation by a vector (X(t'), Y(t'». F(t) will be called a motion curve in the three-dimensional motion space M. Obviously, the mapping M(t,.) is continuous if and only if CoP(t), X(t) and Y(t» are all continuous. We start by few lemmas. Their are either easy, or they are omitted in this abstract.

Lemma 2.1. Let be given n points on the boundary of a given polygon P but not at the convex vertices of P. In O(n) time we can decide if there exists a releasing translation of P. Lemma 2.2.Suppose that there exists a releasing (small) motion of the polygon P moving it to the new position P' . If P' is the image of some translation of P then this translation is also a releasing motion. For any particular pin on the boundary of a given polygon consider the motions of this polygon to the new positions with the pin not penetrating its interior. All such positions form a region in the motion space M which we will call the feasible region. Any releasing motion for a particular pin must be represented by a motion curve belonging entirely to this region. To find the feasible region for a pin P suppose that the polygon is given as a sequence of sides oriented clockwise, and P belongs to the interior of a side of the polygon. Let (X be the vector of this side and (X..L vector orthogonal to a, oriented towards the exterior of the polygon. Let 'II denote an angle, 284

I

r

~ ..,. "' ..,. "'

..,.r.,.

" I

"'

..-

p'

Figure 2a.

dist(P.'~, p')

a:

This lemma will pennit to extend the consideration from pins placed in the interior of polygon edges to pins which may be placed at reflex vertices as well. When checking immobilization by a set of pins, a pin at a reflex vertex is equivalent to two pins, one on each of the two adjacent sides.

= p(sin'l'-sin(4>+'I'»

The following two lemmas relate to the special cases of the placement of the set of pins.

Figure 1. oriented counterclockwise, between a and the vector (O,p) and p= (O,p) Rotate the pinp counterclockwise around the point by an angle 4> (see Fig. 1). This may be interpreted as the rotation of the polygon clockwise by

+'I'». Observe that this value is positive when p' is inside the polygon and negative when it is outside, independently on the position of 0 with respect to the pin p and the side containing it. The feasible region R(P) is now given by

I

I.

°

Figure 2b.

I

I.

I I

I I),

R(P) =(4), (p(sin'l'-sin(0 or $2

=0 0 0

=1 1 0

>2

2 1

2

1

2

2

0

2

2 2

1 0

Table 1: Correction terms for a simple block B where v

sl

1 0

=0 0 0 1 0

=1 1 1 2 2

>2 1 1 2

2

= parent(B) is defined.

We distinguish these different kinds of blocks as follows. are the blocks, where i is the bound for the critical cutvertices (i 0,1,2), and j is the bound for the number of ve~tices (j 4,5,6). Furthermore, we distinguish ~,2 and ~,3 by the degree of the parent-vertex. lI; is the cardinality of If a subscript/superscript is missing, we count over all possible subscripts/superscripts.

=

=

sf.

Lemma 3.4 Assume G has a vertez v with deg(v) ~ 3 on the outer-face. Then (1) b2 :$ bo - 1, (~) 2b4 + 4b5 + 5b6 ~ n -1, (9) if G has no bridge, tken b5 ,3 ~ 1. Proof: The first claim is shown by counting the number of edges in the blocktree in two different ways. For the second claim, we assign the vertices that are not the parent-vertex to each block. This assigns the appropriate number of vertices to each block, counts every vertex at most once, and does not count the parent-vertex of the root. The third claim holds since two blocks in S5,3 imply that one of them is incident to a bridge. 0

309

Lemma 3.5 A88ume G has no bridge. If a l1enez of degree • EBES(G) 9tD(B) ~ 'i - 1, ESES(G) 9h(B) ~ i - 1, • EBE8(G)

9t(B) ~

'i -

~, and EBE8(G) ~,(B)

~

3 is on the outer-face, then

:s in - i·

Proof: For space reasons, we show only the argument for ~l. By Table 1, we have E CJl ~ -2b3 - b~,2 + b~,2 + 2b~,3 + 2bf + 2b2 ~ b~,2 + 2b~,3 + 2bg - 2 + b~,2 + 2b~,3 + 2bt b5 + b5 ,3 + 2b6 - 2 ~ b5 + 2b6 -1 ~ i(n -1) -1, by the claims of Lemma 3.4. 0

:s

If every vertex on the outer-face has degree 4, then these estimations have to be increased somewhat. By applying Lemma 2.2, and by induction on the number of bridges, one can show the following result.

Theorem 2 Let G be a simple plane 4-graph. Then in linear time, it can be embedded in a grid of width and height ~n, and with min{2m - ~n + m + in + 2} bends. If a l1ertez of degree ~ 3 is on the outer-face, G can be embedded in a grid of width and height ~n 2 with min{2m m+ bends.

t,

-In - i,

-

4

in - i}

Remarks

In this paper, we presented a heuristic that gives an orthogonal drawing of any connected plane graph, while exactly reflecting the given planar drawing. No linear-time heuristic was known before. We produce at most a in x In-grid. The number of bends is bound by m + in + 2, which is at most lin + 2. It is also bound by 2m - ~(n -1), which is smaller if m ~gn. We also presented a scheme of how an algorithm for biconnected graphs gives an algorithm that draws connected graphs. The algorithm must fulfill two conditions; however, the second condition can be dropped if it is not required that the resulting drawing reflects the planar embedding. In fact, this merging scheme does not use planarity at all, and can thus be also applied for heuristics for non-planar graphs. We got a formula how one can compute the grid-sizes and bends, by considering the grid-size and the bends achieved with the algorithm for biconnected graphs. This scheme should be useful to apply to other heuristics as well. We have the following remarks:

:s

• We are very close to optimality in all cases (the lower bounds are from [3]). For simple graphs, the graph shown in Figure 3.a has 2n - 2 edges and needs a grid of width and height ~n - 151 and 1; n - ~7 bends in any drawing exactly reflecting the plane drawing. For multi-graphs, there exists a multi-graph with 2n edges which needs a (2n - 3) x (2n - 3)grid and 4n - 4 bends in any drawing exactly reflecting the plane drawing. For graphs with loops, there exists a graph with 2n edges which needs a (2n+ 1) x (2n+ 1)-grid and 4n + 4 bends in any drawing exactly reflecting the plane drawing. • For simple graphs, we bounded the number of bends by 2m- ~n+!. This is almost optimal, since the graph Ci shown in Figure 3.b needs 2m- ~n-! bends. Namely, let C1 be a triangle, and let Ci result from Ci-l by adding two new vertices, and a triangle that encloses Ci-l. Then n(C.) 2i + 1, and m(Ci) 3i + 1. One can show that Ci needs a width and height of 2i - 1, and 3i - 2 bends, in any drawing that exactly reflects the embedding.

=

=

tn i,

• The bound of min{2m + m + in + 2} bends can be used to show bounds for the grid-size of Tamassia's algorithm [7]. With the tools presented in [2], one can show that 1 the width and height is at most min{ ~n 15 n - T} for connected plane graphs. The half-perimeter is at most min{~ + m lin}.

i,

!,

• One open problem concerns plane graphs of maximum degree 3. With the scheme of Kant [5] we can obtain a 'i x i-grid with ~ + 1 bends. But this algorithm does not reflect the planar drawing, as can be seen since the graph of Figure 3.e needs a bigger grid in any plane drawing. What algorithms exists for such graphs? 310

Figure 3: Three graphs for lower bounds for plane drawings. The first graph needs a width and 7 15 bends. The second graph needs 2m - ~n bends. The third height of tn - 151 , and graph has maximum degree 3 and needs a width and height of in - 1, and in -1 bends.

lin -

!

References [1] T. Biedl, Optimal Orthogonal Drawings of Connected Plane Graphs, Rutcor Research Report 10-96. 1

[2] T. Biedl, Optimal Orthogonal Drawings of Triconnected Plane Graphs, Rutcor Research Report 8-96. 1

[3] T. Biedl, New Lower Bounds for Orthogonal Graph Drawing, Proc. Graph Drawing '95, Lecture Notes in Compo Science 1027, Springer-Verlag (1995), pp. 28-39. Also: Rutcor Research Report 19-95. 1 [4] T. Biedl, and G. Kant, A better heuristic for orthogonal graph drawings, Proc. of the 2nd European Symp. on Algorithms (ESA 94), Lecture Notes in Compo Science 855, SpringerVerlag (1994), pp. 124-135. Also: Rutcor Research Report 12-95. 1

[5] G. Kant, Drawing planar graphs using the lme-ordering, Extended Abstract in: Proc.39th Ann. IEEE Symp. on Found. of Compo Science 1992, pp. 101-110. Extended and revised version to appear in Algorithmica, special issue on Graph Drawing. [6] J. Storer, On minimal node-cost planar embeddings, Networks 14 (1984), 181-212.

[7] R. Tamassia, On embedding a graph in the grid with the minimum number of bends, SIAM J. Compo 16 (1987), pp. 421-444.

[8] R. Tamassia, and loG. Tollis, Efficient embedding of planar graphs in linear time, Proc. IEEE Int. Symp. on Circuits and Systems (1987), pp. 495-498.

[9] R. Tamassia, and I.G. Tollis, Planar grid embedding in linear time, IEEE Trans. Cire. Syst. 36 (9), 1989, pp. 1230-1234.

1 Rutcor Research Reports are available via anonymous FTP from ndcor.rutger,.edu, directory /pub/rrr; or on the WWW at http://rutcor.rutger,.edu/''-Jrrr. For a comprised version of these four papers, see T. Biedl, Orthogonal Graph Drawing', Algorithm' and Lower Bound" Diploma Thesis TU Berlin, December 1996. Available on the WWW at http://rutcor. rutger,.edu/"-J therele.

311

Straight Line Embeddings of Planar Graphs on Point Sets Netzahualcoyotl Castaneda, Department of Applied Mathematics Universidad Nacional Autonoma de Mexico and Jorge Urrutia, Department of Computer Science University of Ottawa

Abstract Given a finite point set P n of n points in the plane in general position, we say that Pn supports an n vertex planar graph G if there is a rectilinear embedding of G such that all the vertices of G lie on the elements of Pn . G is called universal if any point set Pn supports it. In this paper we prove that the set of universal graphs is exactly the set of outerplanar graphs. We also give an O(n)2 time algorithm that produces planar embeddings of outerplanar graphs on point sets.

Keywords: Universal graphs; finite pOints in the plane; geometric graphs

1

Introduction.

Let Pn be a set of points on the plane in general position, and G a graph with n vertices. We say that Pn supports G if there is an embedding of G on the plane in such a way that the vertices of G are mapped to the elements of Pn , and its edges to non-intersecting open straight line segments joining pairs of elements of Pn which correspond to pairs of adjacent vertices in G. We call any such embedding a straight-line embedding of G on Pn • In 1990, Perles introduced the problem of embedding rooted trees on point sets with the root of the tree located at a specific element of the point set. In [3] it is shown that this embedding is always possible. FUrther results on this topic are presented in [4] and [1] where an optimal O(nlogn) time algorithm to obtain such embeddings is presented. A graph G is called

312

outerplanar if there is a straight line embedding of G on the vertices of a convex polygon. In this paper, we extend the results in [3] as follows: We call a planar graph G on n vertices a universal graph if any n point set supports G. By the results in [3]it follows that trees are universal. Notice that if we choose Pn to be the set of vertices of a convex polygon, it follows right away that if a graph G is universal, then it is outerplanar. In this paper we prove that the set of universal graphs is exactly the set of outerplanar graphs. We also give an algorithm to produce embeddings of n vertex planar graphs on n point set Pn in general position in O(n)2 time.

2

Terminology and definitions

An embedding of a graph G on the plane is called a straight-line embedding if all the edges of G are represented by line segments. A graph G is called outerplanar if there is a straight-line embedding of G on the vertices of a convex polygon. All point sets considered here will be assumed to be in general position and Pn will be used to denote such sets.

3

Outerplanar graphs are universal

In this section we prove the following result: Theorem 1 The set of universal graphs is exactly the set of outerplanar graphs.

Some lemmas and results will be needed to prove Theorem 1. Without loss of generality, we will assume that G is a maximal outerplanar graph. We further assume that the vertices of G are labeled VQ, ••• , Vn-l such that Vi is adjacent to Vi-I, i = 1, ... , n-l addition taken mod n, i.e. the unique Hamiltonean cycle of G is given by the ordered labeling of its vertices. The edge Vi - Vi+l will be called an external edge of G, i = 1, ... , n -l. Consider three mutually adjacent vertices u, V and w of G. We say that the triangle u, V, w is an external triangle of G if at least one of its edges is on the hamiltonean cycle of G. We call uvw an (r, s) - triangle of G if the components of G - u, v, w have rand s vertices respectively. We will allow either one of r or s to be 0; this allows us to cover the case when u, V, w contains two consecutive edges of the Hamiltonean cycle of G.

313

Consider a n point set Pn , two integers rand s such that r + s = n - 3, and a triangle tea, b, c) with a and b consecutive vertices of Conv{Pn ), and c E Pn . We say that tea, b, c) is an (r, s) - triangle of Pn if:

i) No element of Pn lies in the interior of tea, b, c) ii) There is a line l through c that intersects the interior of tea, b, c) such that there are r elements of Pn - {a, b, c} on the same side of l as a, and s elements of Pn - {a, b, c} on the other side of l. See Figure 1.





• a b A 6,2-triangle of P8 Figure 1 We denote by lea) the subset of elements of Pn on the same side of l as a and including also point c. Similarly, we define l(b).

Lemma 1 Let a and b be two consecutive points in Conv(Pn ), and two

integers rand s such that r + s = n - 3. Then there always exists a point c in Pn such that tea, b, c) is an (r, s) - triangle of Pn .

Proof. Consider all the points of Pn such that each of them together with a and b are the vertices of a triangle containing no point of P - n in its interior. Assume that these points are labeled Ul, ... , Uk in the counterclockwise direction around a. Associate to each 'Ui a weight Wi equal to the number of points in Pn - {a, b, Ui}, to the right of the line connecting a to Ui, i = 1, ... ,k. See Figure 2.

314

o

b Figure 2

C

Let m be the index such that Wm-l < sand s ~ W m • If Wm = stake = Um and let l be a line through Urn obtained by a slight counter-clockwise

rotation around U m of the line joining a to Urn. Suppose then that s < W m • We observe now that the number of pOints to the right of the line joining b to Urn-l is at least Wm - 1. Furthermore, the triangle bounded by the line segment ab and the lines joining a and b to Urn contains no element of Pn in its interior, otherwise Urn-I and Urn would not be consecutive vertices that generate empty triangles with a and b! It now follows that there is a line through Urn-l intersecting the interior of the triangle t(a, b, Urn-I) leaving exactly s elements of Pn - {a, b, Urn-l} to its right. Our result now follows. In Figure 2 we show the case when s = 4 and

m=3. Proof of Theorem 1. Let G be a universal graph and Pn be the set of vertices of a convex polygon. Since G is universal, Pn supports G; hence there is a planar straight-line embedding of G on Pn and G is outerplanar.

315

We now prove that any point set Pn supports any outerplanar graph G. Recall that the vertices of G are labeled {va, ... , Vn-l} such that Vi is adjacent to Vi+}, i = 0, ... , n - 1 addition taken mod n. We will actually prove an even stronger result, i.e. we prove that given two consecutive points a and b in Conv(Pn ) and any external edge Vi - Vi+l of G, there is an embedding of G on Pn such that Vi lies on a and Vi+l lies on b. Our result holds trivially if G has three vertices. Consider now any outerplanar graph on n vertices and any n point set Pn • Take an external edge Vi -Vi+l of G and two consecutive vertices a and b in Conv(Pn ). Since G is outerplanar, there is a unique vertex Vk of G adjacent to both Vi and Vi+l. Thus ViVi+lVk is an external triangle of G. Assume without loss of generality that i+l < k and that k-(i+l)-l = s. Then the components of G - {Vi, 'Ui+l, Vk} have cardinalities rand s respectively such that r+s = n-3 and Vi'Ui+IVk is an (r, s) - triangle of G. See Figure 3.

Figure 3 By Lemma 1, there is an (r, s) - triangle t( a, b, c) of Pn • Let l be a line through c as in ii) and consider the subsets l(a) and l(b) of Pn as defined above. Notice that a and c lie on Conv(l(a» and band c lie on Conv(l(b». Let Hl and H2 be the subgrapbs of G induced by {Vk,"" Vi} and {Vi+l, ••• , Vk} respectively, addition taken mod n. Clearly, Vi - Vk and Vk - Vi+l are external edges of HI and H2 respectively. Thus by induction there is an embedding of Hl on l(a) such that Vi lies on a and Vk lies on c. Similarly there is an embedding of H2 on l(b) such that Vi+l lies on band

316

Vk lies on c. Combining these embeddings of HI and H2 we can obtain an embedding of G on Pn such that the edge Vi - Vi+l lies on the line segment joining a and b. Our result now follows. We now present an algorithm that given a maximal outerplanar graph G and a point set Pn , obtains a rectilinear embedding of G on Pn in O(n)2 time. In our initial step, for each element a of Pn we sort the slopes of all the edges connecting a to all other elements of Pn . This can be done in O(n? using well known techniques in computational geometry [2]. Assume then that these orders are available at all the elements of Pn • We now show that having these orders available, we can implement the construction of Lemma 1 in linear time. This will prove our result. As in the proof of Lemma 1, let {Ul,"" Uk} be the elements of Pn -{a, b} that form empty triangles with a and b. We now prove:

Lemma 2 Given two consecutive points a and b in Conv(Pn ), and two integers rand s such that r + s = n - 3 we can find an (r, s) - triangle t( a, b, c) of Pn in linear time. Proof. We show first that {UI,' .. , Uk} and {WI, ... , W n } as described in Lemma 1 can be found in linear time. Let p be any element of Pn - {a, b}. Assign to p two integer coordinates, corresponding to the position of p when sorting the elements of Pn - {a, b} around a and b in the counter-clockwise and clockwise direction respectively. For example point U2 in Figure 2 would receive coordinates (2,5). This maps the points of Pn - {a, b} to points on the plane with integer coordinates, and points generating empty triangles correspond to minimal elements under vector dominance. Using techniques in [5] it follows that {UI' ... ,Uk} can be found in linear time. We now notice that if Ui is in position k in the sorted order of the elements of Pn - {a, b} around a, Wi is exactly k - 1. Using this, we can now easily determine c, I, lea) and l(b) as in Lemma 1 in linear time. Our result follows. We now have: Theorem 2 Given a maximal outerplanar graph G and a point set Pn we can find an embedding of G on Pn in O(n)2 time.

References [1] P. Bose, M. McAllister, and J. Snoeyink, Optimal algorithms to embed trees in a point set, In Graph Drawing 1995.

317

[2] H. Edelsbrunner and L. Guibas, Topologically sweeping an arrangement. Proc. 4th ACM Symposium. Computational Geometry 1988,4455. [3] Y. Ibeke, M. Perles, A. Tamura, and S. Tokunaga, The rooted tree embedding problem into points on the plane. Discrete and Computational Geometry, 11:51-63, 1994. [4] J. Pach and J. Torocsik, Layout of rooted trees. Technical report CSTR-369-92, Princeton, Feb. 1992. [5] F. P. Preparata and M. 1. Shamos. Computational Geometry: An introduction. Springer-Verlag, New York 1985.

318

Extending Rectangular Range Reporting with Query Sensitive Analysis Robin Y. Flatland and Charles V. Stewart Department of Computer Science Rensselaer Polytechnic Institute Troy, NY, 12180

Abstract We present algorithms for reporting the new points incorporated by on-line sequences of nested rectangular range queries where the rectangular regions in a sequence may be aligned with any arbitrary axis. For each larger rectangular query, our algorithm performs partially ordered searches of a box-decomposition subdivision using information acquired from processing previous queries in the sequence. We provide a query sensitive analysis showing that our algorithm is most efficient for "targeted" queries, queries that generally target space containing a high density of data relative to the space immediately surrounding the query, such as are found in region growing surface reconstruction techniques in computer vision.

1 Introduction

ing problem either requires a large amount of space or has large query time. In partiCUlar, as shown in [3], anyalgorithm with o(logC N + k) query time, for c arbitrarily large, would require O(Nd-E) space, for all fixed € > O. In many applications, however, "hard" point sets and queries causing these pessimistic time or space bounds may seldom if ever arise. In such situations, the worst case analysis is not a representative measure of an algorithm's true query time. Expected case analysis is one alternative, but for many applications it is often difficult to derive realistic statistical models of the input. A second alternative is query sensitive analysis where the running time is expressed in terms of parameters capturing the local geometric complexity of the query. This has been successfully applied to other "hard" problems such as ray shooting [8] and high dimensional nearest neighbor queries [9].

We present an algorithm for reporting the new points incorporated by on-line sequences of nested rectangular range queries. We assume the rectangular regions in a sequence have the same orientation but this orientation may be different for each sequence and is not known in advance (see Figure 1). The problem is formally stated as follows:

Extending Rectangular Range Reporting Problem: Given a set of N points in Rd and an on-line sequence of d-dimensional rectangular query regions Ql, ... , QE aligned with some arbitrary orthogonal coordinate system and each Qi completely containing Qi-l, for the i(th) extended query, report the points in Q i that are not in Q i-l. Here we consider the problem in two and three dimensions. Because we expect many sequences of extending queries on a static point set, our solution includes a preprocessing stage to organize the points into a search structure which facilitates the processing of extending queries. Efficient solutions to a restricted version of this problem where all sequences of nested rectangular queries are aligned with a fixed coordinate system are found in [7]. Efficient solutions to the less restrictive problem considered here, however, appear unlikely. Rectangular range reporting (Le. reporting the points inside a (single) rectangular query region with arbitrary orientation) reduces immediately to the extending rectangular range reporting problem by setting E = 1. Lower bound results [3] indicate that any solution to the rectangular range report-

319

Figure 1: For the query sensitive analysis, we characterize a query Q by three parameters k, a, and l: k is the number of data points inside Q, a is the distance to the point outside Q that is k(th) farthest from its boundary, and lis Q's diameter. We characterize a sequence of extending rectangular queries by the parameters k, a, and l of the final query. For d = 2, 3, using linear space, the overall time for our algorithm to process a sequence of E extending range queries is o (log N + Clog C + E), where C = O(k+l / a) whend=2 and C=O(k+ (1/0)2) whend=3. As aspecial case, our algorithm processes single queries (E = 1) in O(logN + C) time. From the definition of C in the query time, our algorithm is most effective for what we call "targeted" queries. These are queries that target space containing a sufficiently large number of data points relative to the space immediately surrounding the query, making C = O(k). In Section 3, we show further that when the point density is the same both inside and outside Q, C = O(k) in the

expected case as long as Q is not extremely narrow. One application encountering targeted queries is surface reconstruction techniques in computer vision that incrementally "grow" surfaces in three dimensional point data acquired from a range sensor. A surface is grown by collecting the new points included in an incrementally enlarging region which tightly "hugs" a set of points from a (approximately) planar surface. (Figure 1 is a two dimensional example of the type of queries made by region growing techniques.) Typically the free space immediately surrounding the region contains very few points. We suspect that targeted report queries arise in other applications as well since it is not uncommon that apriori infonnation is available to direct queries to interesting data clusters.

2 Box-decomposition Subdivision Our algorithm processes extending queries using partially ordered searches of a box-decomposition of space into rectilinear regions. The basic concept of boxdecompositions was introduced by [4] and has since appeared in many different forms (see [2] for a review). We begin by describing the construction of a relatively simple box-decomposition tree adapted from [2] whose leaves define a box-decomposition (BD) subdivision. WLOG, we assume all data points are contained within an axis-aligned, d dimensional, unit hypercube. The structure ofBD subdivisions is defined in terms of boxes. A box is any hypercube obtained by recursively partitioning the unit hypercube into 2d smaller hypercubes with d orthogonal hyperplanes each parallel to one of the coordinate axis (e.g., when d =2, any square obtained by recursively applying the quadtree splitting rule to the unit square is a box). The length of a box's sides will be 1/2;, for some j ~O.

The BD tree is built by recursively applying split and shrink operations to the unit hypercube. A split operation partitions a box b into 2d smaller boxes with d hyperplanes. A shrink operation partitions a box b into an inner box and a doughnut region; the inner box is some smaller box contained inside b and the doughnut is the set difference of b and the inner box. b is the outer box of the doughnut. The root of the BD tree is associated with the unit hypercube and all points contained inside it. Building the tree begins by recursively splitting box b associated with node v into 2d smaller boxes. v, in this case a splitting node, is assigned 2d children nodes, each associated with one of the smaller boxes and the points contained inside it. If, however, splitting b will result in all but one of the smaller boxes containing zero points, then a shrink operation is applied instead. The inner box of the shrink operation is chosen to be the smallest box inside b containing all of b's points; the doughnut region contains no points. v, in this case a shrinking node, is assigned two children nodes, one associated with the inner box and containing the points inside and the other associated with the doughnut and con320

taining zero points. Splitting and shrinking stops when a node contains one or zero points. The leaves of the BD tree partition the unit square into boxes and doughnuts, called the cells of the subdivision; each cell contains zero or one data points. For uniformity, every cell is thought of as the set difference of an outer box and zero or one inner boxes; for box celis, the outer box is the cell itself and it has no inner box, whereas doughnut cells have an outer box and one inner box. The size of a box is the length of one of its sides. The size of a cell is the size of its outer box. For fixed d, this BD subdivision has the following five properties. (See [2] for proofs of similar properties.) These properties are common to many BD subdivisions with the only differences being in the constant factors. We have therefore expressed them more generally than necessary for this subdivision so that they may be attributed to other BD subdivisions as well.

PI The BD subdivision is of size O(N). P2 Every cell is the set theoretic difference of a unique outer box and up to a constant number of inner boxes. P3 There exists a many-to-one mapping from cells to data points such that a cell of size s maps to a data point located within distance Cl s of its outer box, where Cl is a constant, such that at most a constant number of cells map to each data point. P4 The number of cells of size at least s intersecting the boundary of a convex region of diameter 1 is at most C3 rz / s1d-l, where C3 is a constant. P5 Every cell of size s occupies a region that includes a box of size at least S/C2, where C2 is a constant. Note that for property [P5], in the BD subdivision described above, the region occupied by a box cell of size s (obviously) includes a box of size s; the region occupied by a doughnut cell of size s includes three boxes of size s/2 since its inner box is of size s /2 or smaller. For our asymptotic analysis, we require the additional bounded adjacency property below, which is not guaranteed for the simple BD subdivision described above, but is for the more sophisticated, "smoothed" versions of the subdivision found in [8] and [6]. P6 Every cell is adjacent to at most a constant number of other cells.

The smoothed subdivision in [8] is only given for d = 2, but generalizes to higher dimensions (see [2], revised paper). When d = 2, both smoothed subdivisions may be constructed in O(N log N) time; when d = 3, to our knowledge, the best known bound on their preprocessing is O(N2). For our asymptotic analysis, we also require a linear space structure for processing O(log N) point location queries in the smoothed BD subdivision. For d = 2, (log N) point location queries in a planar subdivision can be done with a linear space data structure requiring O(N log N) preprocessing (see [10]). For d =3, we first

o

further partition each doughnut cell into at most a constant number of rectangular regions and use the linear space data structure in [5] for o (log N) point location queries in 3D rectangular subdivisions requiring O(N log N) expected preprocessing time. In practice, one would probably prefer the balanced version of the BD tree and the subdivision defined by its leaves as introduced in [2]. For fixed d, it satisfies properties [Pl]-[P5] above, can be built in O(N log N) time, and handles point location queries in O(log N) time. Although it does not satisfy property [P6], the average number of adjacent cells is bounded by a constant (see [6]).

3

Two Dimensional Extending Queries

In this section we describe the two dimensional version of our extending rectangular range reporting algorithm. We assume that during a preprocessing stage an adjacency graph representation of a two dimensional, smoothed boxdecomposition subdivision and a point location data structure satisfying all the properties of the previous section are constructed. We describe our algorithm inductively, concentrating on how to process the i(th) extension following the completion of the (i-I )(th) and concluding briefly with a discussion of the initial case. Let Ci be the set of cells intersecting query Qi, and let Bi be the set of cells adjacent to cells in Ci but not themselves in Ci. We call the cells in Bi the surrounding cells. To process the i(th) extension, we assume inductively that having completed the (i -I)(th) extension we have a data structure 82 (described below) containing all edges of cells B i - l and all points located in cells Ci-I not yet reported (in other words, points contained in cells Ci-l but not located in Qi-I). In the i(th) extension, we extract from 82 points it contains that are in Qi and edges it contains whose cells intersect Qi. The extracted points are just reported. The edges extracted are used to start searches of the BD adjacency graph. These searches (collectively) visit each cell in Ci - Ci - I and report its point if it is located in Q i - Q i-I. Since every point in Q i - Q i-l is either a previously unreported point located in a cell of Ci - l or a point located in a cell of Ci -Ci - l , all the appropriate points are reported. In the remainder of this section we detail this algorithm and analyze it. We begin by describing the searches started from cells Bi-I intersecting Qi. Prior to starting the searches in the i(th) extension, only cells in Ci-l have been visited. For each cell c in B i - I intersecting Qi, c's search is a pruned depth first search of the adjacency graph, starting at c and stopping at visited cells and cells not in Ci - Ci-I. (Note that c must be in Cr-Ci-l.) Since each cell has 0 (1) edges (due to property [P2]), it is easy to determine in constant time if a cell is in Ci-Ci - l by just checking if it intersects Q i but not Qi-I. Upon completing these searches it is not too difficult to see that every cell in Ci - Ci - l is visited since there must exist a path in the adjacency graph from each cell in Ci-I - Ci to some cell in Bi-l that intersects

Qi. 321

The heart of our algorithm is the structure of 8 2 , but before describing it, we first motivate why we need it. An obvious solution to the extending rectangle reporting problem is, in the i(th) extension, to start from any cell intersecting the boundary of Qi-I and search the adjacency graph visiting all cells intersecting Qi - Qi-I and report their points if they are located in Qi - Q i-l. This solution, however, is inefficient when queries grow by small enough increments to cause the same cells to be visited on many extensions. Our data structure 8 2 avoids this problem by imposing a partial order on the search so that only the new cells (and new points) intersecting the current query are examined. It is not immediately obvious how to order the search since each query in the sequence may have a different aspect ratio and hence there is no single distance function for ordering the cells. 82 is organized to efficiently find the cells Bi-l intersecting Qi in the i(th) extension. Since cells B i - I do not intersect Qi-l, if they intersect Qi then some part of their boundary (one or more of their edges) must intersect Qi. Therefore, we only need to determine the edges of cells Bi-l that intersect Qi. Let x' and y' be the axes of a coordinate system aligned with the sequence of queries (see Figure 2), and let Pzt(r) be the projection of any region r C R2 onto the axis x', let Pyt(r) be r's projection onto y', and let Pe(r) be r's projection onto a line with orientation 8. The following lemma will help us find these edges and therefore dictate the organization of 8 2 •

Lemma 3.1 An edge e with orientation 8 + 7r /2 intersects rectangular query Qi iff 1. Pzt (e)

n Pzt (Qi) =F 0,

n Pyt (Qi) =F 0, and 3. Pe(e) n Pe(Qi) =F 0.

2. Pyt (e)

Proof: Proving that the three conditions hold if e intersects Qi is trivial. Now suppose (for the sake of contradiction) that the three conditions hold but e does not intersect Qi. Conditions 1 and 2 imply that e has at least one point in region Ryt ,u or Ryt ,l and at least one point in region Rzt ,u or Rzt ,l (see Figure 2 where e has a point in Rut ,u and one in Rzt ,1) and the closest point to e in Qi is the comer of Qi, call it c, located on the border of both regions (again, see Figure 2). c is located at some distance o > 0 from e. No point of Qi may be located less than distance 0 from the line containing e (or else c would not be the closest point to e). But then condition 3 must not hold, resulting in a contradiction. 0 Now we can define 8 2 • It is a three stage "pipeline," each stage corresponding to one of the three conditions above. We assume inductively that having processed the (i-I)(th) extension, 82 contains the edges of cells Bi-lt and these edges are stored in 8 2 as follows: The first stage of 8 2 , call it Hlt holds all edges whose projections on the x' axis do not intersect the projection of Qi-l. It consists of two heaps of edges; one heap holds those edges whose

..: ............/

x'

'. Figure 2: projections have smaller x' coordinates than the projection of the centroid of QI; the other heap holds those with larger x' coordinate. Both heaps are ordered by the minimum distance of the projected edges to the projection of Q1 's centroid. The second stage of 82, call it H2, is analogous except that it holds all edges not in HI whose projections on the y' axis do not intersect the projection of Qi-1' The third stage of 82, call it H3 , is also analogous except that it holds all edges not in HI or H 2 whose projections onto a line perpendicular to their orientations do not intersect the projection of Qi-I onto that line. For each of the two edge orientations, two heaps (as described for HI but w.r.t. this projection) are required. Only two edge orientations are possible since each edge of a box-decomposition is aligned with one of the two (original) coordinate axes. In the i(th) extension, to determine those cells in 8 2 intersecting Qi, we propagate edges though 82 • First, all edges whose projections on the x' axis intersect Q i are removed from HI and inserted into H2. For the heap in HI containing edges whose projections have smaller x' coordinates than the projection of QI 's centroid, removing these edges just involves repeatedly removing the minimum item until the minimum item is farther from the projection of Q1 's centroid than the projected point of Qi with smallest x' value; the other heap is handled similarly. Second, all edges whose projections on the y' axis intersect Q i are removed from H2 and inserted into H3. And finally, all edges whose projections on a line orthogonal to their orientation intersect the projection of Qi on that line are removed from H3. Edges removed from 8 2 had to satisfy conditions 1-3 for some queries Qj, j :5 i. But, it is easy to see that if a condition is satisfied for Qi' then it is also satisfied for Q i. Hence, if e is removed from 8 2 in the i(th) extension, then it satisfies the three conditions for Qi and by Lemma 3.1 the edge, and hence its cell, intersects Q i. We have described how the intersecting cells are found, but we have not mentioned how the previously unreported points in cells Ci - 1 located in Qi are reported. It is not difficult to see that they can be propagated though 8 2 just as the edges are since a lemma similar to Lemma 3.1 but using only conditions 1 and 2 applies to points. The third stage of 82 is then not actually necessary for points, and 322

points can be removed from 82 as soon as they are removed from the second stage of 82. To update 8 2 in preparation for the (i + l)(th) extension, observe first that for any cell that is in both Bi-1 and Bi, all its edges will still be in 82 after processing the i(th) extension. For any edge removed from 8 2 during the i(th) extension, we remove from 8 2 all other edges associated with its cell. Therefore the edges of every cell in Bi-1 that is not in Bi (because it intersects Qi) will not be in 8 2 after the i(th) extension. Any cell bin Bi - B i - 1 must be adjacent to a cell c in Ci - Ci - I so it is easy to insert b's edges into 8 2 when c is visited during the i(th) extension's depth first searches. Any still unreported point in a cell Ci-1 wiIl still be in 82. Points in cells Ci - Ci-1 not reported in the i(th) extension are found when the cells are visited and they are added to 82. Whenever a cell edge or an unreported point is added to 82, the proper stage of 82 to add it is easy to determine in constant time. Query Q1 is handled uniquely. Using the point location data structure for the subdivision, a cell intersecting Q I is determined in O(log N) time. Starting from that cell, a pruned depth first search like those described above visits all cells in C 1 , reports the appropriate points contained in cells C1 , and builds 8 2 appropriately.

3.1

Asymptotic Analysis

We now bound asymptotically the overall time to process a sequence of two dimensional extending rectangular queries in terms of N, E and the number of cells C intersecting query QE. Theorem 3.1 With O(N) storage, an on-line sequence of E extending two dimensional rectangular range reporting queries can be processed in O(log N +C log C +E) time, where C is the total number ofsubdivision cells intersecting Q E. As a special case, a single query ( E = 1) can be processed in O(logN + C) time. Proof: We first bound the total number of cell edges and points inserted into (and extracted from) 82 over the course of all E extensions. Each cell intersecting Q E can have its point inserted into 8 2 at most one time making the total number of points inserted into 8 2 O( C). A cell's edges are only inserted into 82 when the cell first becomes a surrounding cell for one of the E queries. Any cell considered a surrounding cell at some time during the E extensions must either intersect QE or be adjacent to a cell in Q E, thus there are 0 (C) surrounding cells and, since each cell's boundary can be represented by 0(1) edges (following from property [P2]), O(C) edges are inserted into 8 2 • Hence, the size of each heap comprising 8 2 is 0 (C) and each heap operation takes 0 (log C) time. The total amount of time spent in propagating each of the O(C) edges and points through 8 2 is O(log C) since it is inserted into (and removed from) at most 3 heaps. Determining which heaps in 8 2 require processing takes only constant time per extension. For the searches started from cells in B i - 1 intersecting Qi, only a constant amount of

time is spent at each cell in Ci - ai-l determining if its point should be reported or added to S2, checking its 0(1) neighboring cells to see if their edges should be added to S2, and determining the a1!acent cells from which to continue the search. Since Li=l ICi - Ci-ll this takes O(C) time. An additional (log N) is required by the first query to identify a cell to begin the search. Therefore, the total time spent performing all E extensions is O(log N + C log + E). In the special case when E 1, the first query takes only O(log N + a) time since S2 does not have to be built. The storage is bounded by O(N) since the boxdecomposition is of size O(N), the point location data structure is of size O(N), and S2 consists of 8 heaps each of size O( a) which is also O(N). 0

o

a

3.2

= a,

=

Query Sensitive Analysis

Our goal here is to express the number of cells C intersecting QE in terms of QE 's characterizing parameters k, a, and I. This analysis is similar to the analysis of the approximate range searching algorithm in [1] which performs a partial top down search of a box-decomposition tree. Our analysis depends only on the subdivision's properties listed in Section 2. Lemma 3.2 The number of BD subdivision cells inter-

secting any d-dimensional rectangular region Q characterized by k, a and I is O(k + (l/a)d-l). Proof: By property [P3], there exists an association (or a mapping) between cells and data points such that a cell of size S is associated with a data point located within distance CI S of the cell's outer box, where CI is a constant, and at most a constant number of cells are associated with each data point. For the following proof, we do not actually need to know the association, just that it exists. The cells intersecting Q can be partitioned into two types: type (1) cells intersect Q and have associated data points in Q or within distance a of Q's boundary, and type (2) cells intersect Q and have associated data points located farther than a from Q's boundary. For type (1) cells, since there are 2k data points located in Q or within distance a of Q's boundary and every data point is associated with at most a constant number of cells, the number of type (1) cells is O(k). For type (2) cells, we first observe that their outer boxes must be larger than a/(ci + Vd) for their cells (and thus their outer boxes) to intersect Q and their associated data points (contained within CI s of their outer boxes) to be farther than a from Q's boundary. To count cells of type (2), we partition them into those that intersect Q's boundary and those that do not. Because they are of size at least a/(ci + Vd), the number of type (2) cells intersecting Q's boundary is at most C3 rl(CI + Vd)/a)l d - 1 O«l/a)d-l) by property [P4]. Now consider type (2) cells not intersecting Q's boundary. These cells, located entirely inside Q, cannot be too

=

323

far from Q's boundary since their associated points are located outside Q. Specifically, for cells of size s, their outer boxes cannot be farther than CIS from Q's boundary. Therefore, their outer boxes (and hence the cells themselves) are located completely within CIS + .../ds of Q's boundary. But this means all these cells are packed within a volume A of size A ~ P(CIS + Vds), where P is Q's surface area. Since P ~ 2dl d - l , we have A ~ 2dl d- I (CIS + Vds). Cells of size S are pairwise disjoint and each cell occupies a volume of at least Sd /4 by property [P5], so at most A4/sd ~ 2dl d- I (CIS + Vds)4,/sd = c4(I/s)d-1 cells can be packed into A, where C4 2d4, (CI + Vd) is a constant. Therefore, c4(I/s)d-1 bounds the number of type (2) cells not intersecting the boundary of Q and of size s. This bound applies specifically to cells of size s so we now sum over all possible sizes of s. Noting that s = 1/2 i forsomeintegeri, s ~ a/(cI+v'd), and s cannot be larger than 1 since the largest box, the unit hypercube, is of size 1, we have the following geometric series,

=

llog«ct +Vd)/Ct)J

l:

c4(12 i )d-1

(1)

i=O

which is O«l/a)d-l). Therefore the total number of type (2) cells not intersecting Q's boundary is O«l/a)d-I). Combining this with the number of type (2) cells intersecting Q's boundary and the number of type (1) cells gives us our result. 0

=

Our bound on C is obtained by substituting d 2 into the preceding lemma. With any type of query, we cannot avoid the k term in the definition of since we must report the points in Q, so ideally we would like the l/ a term to be O(k). For what we might think of as a worst case targeted query - when the data points inside and outside Q have the same density - we have k ~ 1/ a for reasonable values of k. To see this, for query Q, let hI ~ h2 be the lengths of its two sides. Suppose the data points outside Q but within a of its boundary are uniformly distributed with density k / hI h2, the same as the average density of data points in Q. In this case, we can show that for any k and I, the expected value of a is larger than hI/B. Hence, l/a < Sl/h l ~ SV2h 2/h l . Therefore, if k ~ SV2h2/hb then k ~ l/a and C = O(k). Note that for a more typical targeted query where the density outside Q is much less than the average density of points inside Q, Q may contain fewer data points and still C = 0 (k).

a

4 Three Dimensional Extending Queries Processing extending rectangular queries in three dimensions is similar to that in two dimensions. The main difference is that instead of propagating cell edges through S2, we propagate cell faces through a data structure we call S3. As before, we assume that during a preprocessing stage an adjacency graph representation of a three dimensional, smoothed box-decomposition subdivision and

a point location data structure satisfying all the properties of Section 2 are constructed. To process the i(th) extension, we assume inductively that having completed the (i-1)(th) extension we have a data structure 8 s (described below) containing all points located in cells Ci-l that have not yet been reported and all faces of cells Bi-l. Analogous to the case of two dimensions, in the i(th) extension, we extract from Ss points it contains that are in Qi and faces it contains whose cells intersect Qi. Extracted points are just reported. Faces extracted are used to start pruned depth first searches of the BD adjacency graph (analogous to those in two dimensions) which (collectively) visit each cell in Ci-Ci-I and report its point if it is located in Qi - Qi-I. Ss is organized to efficiently find the cells B i - I intersecting Qi in the i(th) extension. Since cells Bi-l do not intersect Qi-b if they intersect Qi then some part of their boundary (one or more of their faces) must intersect Q i. Therefore, we only need to determine the faces of cells Bi-l that intersect Qi. Let x', y', and z' be the axes of a coordinate system aligned with the sequence of queries, let Pz'y,(r) be the projection of any region r C R S onto the x' ,y' plane, and let Pz , z' (r) and P y' z, (r) be defined similarly. Let Pe,q,(r) be r's projection onto a line with orientation determined by angles (J and ¢J. The following lemma determines the structure of Ss; we omit the proof since it is similar to Lemma 3.1.

f with normal direction sects rectangular query Qi iff

Lemma 4.1 A face

((J, ¢J)

inter-

1. PZ'y' (f) n PZ'y' (Qi) :I: 0, 2. Pz,z,(f) npz,z,(Qi):I: 0,

a one-dimensional problem since the projection is onto a line, consists of three sets (one for each face orientation) of two heaps analogous to those used in the stages of S2. In the i(th) extension, to determine those cells in Sa intersecting Qit we propagate faces though Ss similarly as was done in two dimensions. Unreported points contained in cells Ci-I are handled similarly but may be removed after stage 2 of Ss. Sa is updated in preparation for the next extension when the cells in Ci - Ci - 1 are visited. Query Ql is handled uniquely, as was done in two dimensions. The following theorem summarizes the asymptotic analysis; we omit the proof since it is similar to to Theorem 3.1. Theorem 4.1 With O(N) storage, an on-line sequence of

E extending three dimensional rectangular range reporting queries can be processed in O(Iog N + Clog C + E) time, where C is the total number of subdivision cells intersecting QE. As a special case, a single query (E =1) can be processed in O(log N + C) time. By substituting d = 3 into Lemma 3.2, we obtain C = O(k + (l/a?). Generalizing the analysis at the end of Section 3, if hI ~ h2 ~ hs are the lengths of Q's sides, we can show that (under conditions defined in Section 3) when k ~ 3(8)2h§/h~, we have C = O(k).

References [1] S. Arya and D. M. Mount. Approximate range searching. In Proc. llth Annu. ACM Sympos. Comput. Geom.• pages 172-181. 1995. [2] S. Arya, D. M. Mount, N. S. Netanyahu. R. Silvennan. and A. Wu. An optimal algorithm for approximate nearest neighbor searching. In Proc. 5th ACM·SIAM Sympos. Discrete Algorithms. pages 573-582. 1994. In revised fonn at ftp://ftp.cs.umd.eduipub/faculty/mountIPapersldist.ps.gz.

3. Py,z,(f) n Py,z,(Qi) :I: 0, and 4. Pe,t/>(f) n Pe,q,(Qi) :I: 0. Ss is a four stage pipeline, each stage corresponding to one of the four conditions above. The first stage of Sa holds all faces whose projections on the x' , y' plane do not intersect the projection of Qi-l. Since three dimensional BD subdivision cells are aligned with the three original coordinate axes, the face of any cell is a planar polygon with sides parallel to two of three orthogonal directions (in RS). Parallel projection preserves incidence and parallelism, so the face's projection onto the x', y' plane is also a polygon with sides parallel to two directions (although not necessarily orthogonal). The sequence of E nested, three dimensional, rectangular queries projected onto the x' , y' plane is just a sequence of nested, two dimensional, rectangular queries. In the i(th) extension, we will want to determine those faces contained in the first stage of Ss that intersect the projection of Q i so that they may be propagated to stage 2. But then we canjust implement the first stage as an instance of S2 for the x' , y' plane, the projected queries, and the projected faces. (Note that the last stage of this instance of S2 requires three sets of heaps, two for each of the three possible face's edge orientations.) The next two stages are analogous. The last stage, which is

[3] B. Chazelle and B. Rosenberg. Lower bounds on the complexity of simplex range reponing on a pointer machine. In Proc. 19th Inti. Colloq. on Automata. Lang.• and Prog.• volume 623 of Lect. Notes in Compo Sci.• pages 439-449. Springer-Verlag. 1992. [4] K. L. Clarkson. Fast algorithms for the all nearest neighbors problem. In Proc. 24th Annu. IEEE Sympos. Found. Comput. Sci.. pages 226-232, 1983. [5] M. de Berg. M. van Kreveld. and J. Snoeyink. Two- and three-

dimensional point location in rectangular subdivisions. J. Algorithms. 18:256-277, 1995. [6] R. Y. Flatland. PhD dissertation. Deparunent of Computer Science.

Rensselaer Polytechnic Institute. To appear 1996. [7] R. Y. Flatland and C. V. Stewan. Extending range queries and nearest neighbors. In Proc. of the Seventh Canad. Con! on Comput. Geom .• pages 267-272. 1995. [8] J. S. B. Mitchell. D. M. Mount, and S. Suri. Query-sensitive ray shooting. To appear in Inti. Journal of Compo Geom. and App. [9] D. M. Mount, N. S. Netanyahu. R. Silvennan, and A. Wu. Chromatic nearest neighbour searching: a query sensitive approach. In Proc. 7th Canml. Conj. Comput. Geom., pages 261-266,1995. [10] F. P. Preparata and M. I. Shamos. Computational Geometry: An Introduction. Springer-Verlag, 1985.

324 .

The Complexity of Rivers in Triangulated Terrains Mark de Berg! Prosenjit Bose2 Katrin Dobrint3 Marc van Kreveld 1 Mark Overmars! Marko de Groot! . Thomas Roos4 Jack Snoeyink5 Sidi Yu6

Abstract Triangulated surfaces are often used to represent terrains in "Geographic Information Systems (GIS); one of the primary computations on terrains is determining drainage networks. Under natural definitions of the flow of water on a terrain represented by n triangles, we show that the river network has 9(n 3 ) worst-case complexity, where complexity is measured in the number of line segments that make up the network.

1

Introduction

Terrain drainage characteristics provide important information on water resources, possible flood areas, erosion and other natural processes. In natural resource management, for example, the basic management unit is the watershed, the area around a stream that drains into the stream. Road building, logging, or other activities carried out in a watershed all have the potential to affect the defining stream. Manual quantification of terrain drainage characteristics is a tedious and time consuming job. Fortunately, through spatial analysis of digital representations of surfaces, they can be, by and large, inferred automatically. In this note, we survey some of the literature on computing drainage information in digital terrain models and look carefully at the definitions of drainage networks. Under our defi~ition, we prove a tight cubic bound on the complexity (measured in number of line segments) of a drainage network. We conclude with a number of open practical and theoretical questions.

2

Terrain Models

There are three main forms of digital terrain representations: digital contours, gridded DEM (digital elevation model storing elevations at points of a regular grid), and TINs (triangulated irregular networks). Generally, the drainage netwo~k has been computed on a gridded models of the. surface [2, 6, 7, 11, 16; 18, 21, 23], often using local filters to detect potential pits, peaks and channels, much as in raster image processing. Even researchers who define drainage networks in contours [5, 11, 24] may compute them in DEMs. As with image processing, there are inherent ambiguities with the local raster approach, because the global nature of drainage on a mathematical surface is not adequately reflected. lUtrecht University, 2Universite du Quebec a Trois-Rivieres, 4ETH Zurich, and 5University of British Columbia, Departments of Computer Science, and 3Microsoft. The authors thank the Dutch Organization for Scientific Research (N.W.O.) for the PIONEER grant that supported the Utrecht Workshop on Computational Geometry and GIS, at which this work was begun. Various authors received partial support from N.W.D., Canada's NSERC, the Swiss National Science Foundation (SNF grant 21-45610.95), and the B.C. Advanced Systems Institute.

325

We choose to concentrate on the TIN model because it specifies an explicit mathematical surface on which fluid can flow. Even so, previous work on drainage in TINs does not always respect the physics of (non-inertial) flow on a surface: Researchers typically r~strict flow to triangle edges or consider fluid to flow from triangle centroid to triangle centroid based on triangle neighbor relations [25, 22, 17, 8]. We will allow cross-triangle flows, which are important for connectivity and duality properties of the network. The study of the drainage network on smooth mathematical surfaces has a long history, including mathematicians such as Cayley in 1859 [1] and Maxwell in 1870 [13]. Koenderink and van Doorn [9, 10] credit Rothe [20] with publishing the first solution in 1915; Koenderink and van Doorn's work expresses this solution in the terminology of modern differential geometry and includes examples of why other attempts at a solution (before and since) are inadequate. The fact that TINs are not smooth makes flows more combinatorial. For example, junctions can be identified as discrete critical points rather than happening in the limit. Related to drainage networks are the so-called surface networks by Mark [12], Pfaltz [19], and Wolf [27, 28]. Also worth mentioning as related work is the computation of terrain data from hydrological information [14, 24]; hydrologists use complex models that differentiate between surface flow and subsurface flow, and therefore are also dependent on permeability of the ground, rainfall, and other quantities [22, 26]. .

3

Definitions for Drainage Networks

In the Geographic Information System (GIS) literature, it is difficult to find precise definitions of the drainage network and its component rivers and ridges. In many works, the drainage network is defined only implicitly as the output of some algorithm on terrain data. Definitions that are given often depend on a certain terrain model (e.g., a grid) and cannot be translated to other terrain models. Frank et al. [4] point out that formal definitions should be used to define terrain-specific features so that properties of the structure can be established mathematically and contradictory definitions (or at least those in disagreement with other related research) can be avoided. In this paper we use simple and general definitions that extend those of Frank et al. [4]. More details and consequences can be found in the paper by Yu et al. [29]. First, two assumptions about the downhill path traced by a drop of water: Al At any point, water follows the steepest descent. A2 At any point, the steepest descent is unique. Assumption Al is standard for viscous flow. A2 is plausible for non-horizontal faces; for horizontal faces and edges, and for edges and vertices with more than one steepest descent, we assume that some canonical choice is made, perhaps by perturbing the input data. These assumptions imply that the starting point determines the path taken by a drop of water and that two paths that join never separate. D 1 The trickle path of a point p on a surface S is the path that begins at p and follows the steepest descent until it reaches a local minimum or the boundary of S. D2 The watershed of a point p is the set of all points whose trickle paths contain p. D3 The drainage network consists of all points whose watersheds have non-zero area (more precisely, have two-dimensional Lebesgue measure). We use two more definitions from Frank that are specific to.a TIN:

326

D4 A pit is a local minimum of the surface; a vertex where none of the incident edges and triangles have lower elevation. D5 A local channel (or cofluent edge) is a triangulation edge for which both adjacent triangles contain interior points whose trickle paths, intersect the edge. See figure l. We can now show that the drainage network does have a network structure, even though it has been defined as a set of points. Lemma 3.1 The drainage network in a TIN is a forest of disjoint trees. The leaves of these trees are local channels. Proof: The trickle path from any point on the drainage network is contained in the drainage network. Since a trickle path can only end at a pit or at the region boundary, the drainage network has the structure of a forest of trees whose branches are trickle paths. We consider where these trickle paths can start to characterize the leaves of these trees. Points on the relative interior of local channels have watersheds that include positive area in both adjacent triangles, so they are clearly on the drainage network. On the other hand, a point p inside a triangle collects flow only from the points immediately "above" (along the steepest ascent); Figure 1: A point p is on the drainage network only if points "above" are on the drainage local channel network. Similarly, a vertex p of the TIN collects flow from a finite number of (cofluent edge) steepest ascent directions in adjacent triangles and edges and is on the drainage network only if points "above" are on the drainage network. Thus, the leaves of the drainage network are edges that collect flow, which are the local channels .• 4

An Upper Bound on Drainage Network Complexity

For computation and storage of the drainage network, we would like to know its complexity, which we define as the number of line segments that are needed to represent the network. Since trickle paths in a TIN are composed of line segments, the network can indeed be represented with segments. By Euler's relation, we know that the number of edges of an n-vertex TIN is at most 3n. Thus, Lemma 3.1 implies that the drainage network consists of a tree with O(n) leaves, paths, and junctions. We must determine how many triangles (or, equivalently, triangulation edges) the drainage network can cross. Under our definitions, a trickle path can cross an edge of an n-vertex TIN a linear number of times. This may seem like a weak upper bound, but the next section will show that it is tight. Lemma 4.1 In a terrain represented by a TIN with n vertices, a trickle path meets any edge of the TIN at most O(n) times. Proof: Break the trickle path into at most n subpaths by cutting at the elevation of each vertex of the TIN; let p denote one of these subpaths. We will show that p hits each edge of the TIN at most twice. Path p visits a sequence of triangles and edges. Within each triangle, p's direction is determined by the steepest descent. Thus, if p visits a triangle a second time, then it repeats th~ sequence that it visited before until it ends at the elevation of a vertex, as illustrated in figure 2. (N ote: This proof implies that figure 2 cannot be drawn accurately-each quadrilateral should be bounded by parallel dotted edges that are perpendicular to the path.)

327

Consider now the edge in the repeating sequence that has the shallowest slope, where the slope of a segment in ------ ......................... . . 3-d is the ratio of the positive difference in z coordinates with the length of the projection in the xy plane. If p visits this edge first at point p and lower at point q, then we can derive a con~radiction: The segment pq is shorter than the subpath of p from p down to q. .This subpath, however is steeper than pq-hecause p follows the steepest descent, each triangle on which the subpath flows must be steeper ........ than the preceding edge, and all must be steeper than pq ......... ~', ....... ---_ .... on the shallowest edge. A longer path from p having a steeper slope than pq, however, cannot end at q. Figure 2: Repeating a triangle Since the shallowest edge cannot be visited twice, no repeats the subsequent sequence. other edge can be visited more· than twice.• As a corollary, we can bound the c~mplexity of the entire drainage network. Corollary 4.2 The complexity of the drainage network in a TIN with n vertices is O(n 3 ). Proof: The drainage network is the union of trickle paths from O(n) local channels. Each path has at most quadratic complexity; the total complexity of the paths bounds the complexity of the union.•

5

A Worst-case Example

The cubic upper bound on complexity af the drainage network in a TIN with n vertices can actually be achieved by an ancient Egyptian construction technique shown in figure 3. n initial channels

ii ~ I

jl,-~ • I

i!



.: ..•

........ - .. Figure 3: A construction of a TIN with O(n) vertices in which n paths each have n 2 complexity. Some edges of the TIN have been omitted to increase clarity. We describe this construction qualitatively. Start with the frustrum of a pyramid. Along one edge of the pyramid, form a scree (a term meaning "rocky slope") of n long triangles. On the top, carve n local channels that will catch water and thus start n trickle paths in the drainage network. Call these trickle paths "rivers"; each of the n rivers will cross the scree n times.

328

Form n gently-sloping helical channels that meet the rivers after the scree, carry them around the pyramid and back to the scree. Each channel begins with a nearly-flat top whose steepest descent angles slightly away from the pyramid face, so that rivers that join the channel separately remain separate. At a turn; the two top triangles of the channel share a vertex at the outside corner and a small, near-vertical triangle interpolates between them, forming separate waterfalls for separate rivers. With these segments defined, one can complete the triangulation of their endpoints to form a TIN having O(n) vertices and edges. Counting only the intersections between rivers and scree triangles, we obtain the following theorem. Theorem 5.1 In a TIN with n vertices, the worst-case complexity of a trickle path is 9(n2 ) and of the drainage network is 9(n3 ).

6

Directions for Future Research

While a 9(71. 3 ) worst-case bound may sound discouraging for algorithm development, it is clear that our pyramid example is unlikely to arise in real data. In conjunction with Facet Decision Systems of Vancouver, we are addressing the question of the empirical complexity of the drainage networks in terrain data provided by the B.C. Ministry of Environment. Even if complex networks do arise, data structuring ideas such as persistent structures for similar lists [3] or Mount's "bundling" [15] can reduce the storage demands. Interesting from a theoretical viewpoint is the question of whether special triangulations can guarantee better drainage network complexities. Is it pO$sible to prove an O(n2 ) bound for the complexity of a drainage network in a Delaunay triangulation or in some other triangulation with well-shaped triangles? Our drainage model can be extended to take into account the absorption of water by different ground types, that rivers can divide, and that water has volUme and can collect-one clearly should do so in terrains because errors in data or in sampling can create spurious local minima that are shallow pits. Any significant volume of water would collect to fill these and then spill over the lowest pass to rejoin the main network. Also, rivers whose flow is less than a certain volume can be pruned from the network. Can one compute the rivers that remain in time proportional to their complexity-Le., can one compute the main rivers without inspecting all the tributaries?

References [1] A. Cayley. On contour and slope liiles. Lond. Edin. Dublin Phil. Mag. and J. of Sci., 18(120):264-268, 1859.

[2] D. H. Douglas. Experiments to locate ridges and channels to create a new type of digital elevation model. The Canadian Surveyer, 41(3):373-406, Autumn 1986. [3] J. R. Driscoll, N. Sarnak, D. D. Sleator, and R. E. Tarjan. Making data structures persistent. J. Compo Sys. Sci., 38:86-124, 1989.

[4] A. U. Frank, B. Palmer, and V. B.Robinson. Formal methods for the accurate definition of some fundamental terms in physical geography. In Proc. 2nd Intl. Symp. Spatial Data Handling, pages 585599,1986.

[5] M. F. Hutchinson. Calculation of hydrologically sound digital elevation models. In Proc. 3rd Intl. Symp. Spatial Data Handling, pages 117-133, 1988. [6] S. K. Jenson. Automated derivation of hydrologic basin characteristics from digital elevation model data. In Proc. AUTO-CARTa 7, pages 301-310. ASP/ACSM, 1985.

329

[7] S. K. Jenson and J. O. Domingue. Extracting topographic structure from digital elevation data for geographic information system analysis. Photogrammetric Engineering and Remote .Sensing, 54(11):15931600, Nov. 1988. . [8] N. L. Jones, S. G. Wright, and D. R. Maidment. Watershed delineation with triangle-based terrain models. Journal of Hydraulic Engineering, 116(10):1232-1251, Oct. 1990. [9] J. J. Koenderink and A. J. van Doorn. Local features of smooth shapes: Ridges and courses. In Geometric Methods in Computer Vision II, volume 2031, pages 2-13. SPIE, 1993. [10] J. J. Koenderink and A. J. van Doorn. Two-plus-one-dimensional differential geometry. Pat. Recog. Letters, 15:439-443, May 1994. [11] I. S. Kweon and T. Kanade. Extracting topological terrain features from elevation maps. Compo Vis. Graph. Image Proc., 59(2):171-182, Mar. 1994. [12] D. M. Mark. Topological properties of geographic surfaces: Applications in computer cartography. In G. Dutton, editor, First Int'l Adv. Study Symp. on Topol. Data Struc. for GIS, vol 5. Harvard, 1978. [13] J. C. Maxwell. On hills and dales. Lond. Edin. Dublin Phil. Mag. and J. of Sci., 40(269):421-425, 1870. [14] D. G. Morris and R. W. Flavin. A digital terrain model for hydrology. In Proc. 4th Inti. Symp. Spatial Data Handling, pages 250-262, 1990. [15] D. M. Mount. Storing the subdivision of a polyhedral surface. Disc. & Compo Geom., 2:153-174, 1987. [16] J. F. O'Callaghan and D. M. Mark. The extraction of drainage networks .from digital elevation data. Compo Vis. Graph. Image Proc., 28:323-344, 1984. [17] O. L. Palacios-Velez and B. Cuevas-Renaud. Automated river-course, ridge and basin delineation from . digital elevation data. Journal of Hydrology, 86:299-314, 1986. [181 T. K. Peucker and N. Chrisman. Cartographic data structures. Amer. Cartog., 2(1):55-69, 1975. [19] J. L. Pfaltz. Surface networks. Geog. Anal., 8:77-93, 1976. [20] R. Rothe. Zum problem des talwegs. Sitz. ber. d. Berliner Math. Gesellschajt, 14:51-69, 1915. [21] W. W. Seemuller. The extraction of ordered vector drainage networks from elevation data. Compo Vis. Graph. Image Proc., 47:45-58, 1989. [22] A. T. Silfer, G. J. Kinn, and J. M. Hassett. A geographic information system utilizing the triangulated irregular network as a basis for hydrologic modeling. In Proc. Auto-Carto 8, pages 129-136, 1987. [231 S. Takahashi, T. Ikeda, Y. Shinagawa, T. L. Kunii, and M. Ueda. Algorithms for extracting correct critical points and constructing topological graphs from discrete geographical elevation data. In F. Post and M. Gobel, editors, Eurographics '95, volume 14, pages C-181-C-192. Blackwell Publishers, 1995. [24]' L. Tang. Automatic extraction of specific geomorphological elements from contours. In Proc. 5th Inti. Symp. Spatial Data Handling, pages 554-566, 1992. . [25] D. M. Theobald and M. F. Goodchild. Artifacts of tin-based surface flow modeling. In Proc. GIS/LIS '90, pages 955-964, 1990. [261 A. K. Thrner. The role of 3-d gis in subsurface characterization for hydrological applications. In J. F. Raper, editor, Three Dimensional Applications in GI$, pages 115-127. Taylor & Francis, Bristol, 1989. [271 G. W. Wolf. Metric surface networks. In Proc. 5th Inti. Symp. Sp. Data Hand., pages 844-856, 1990. [28] G. W. Wolf. Hydrologic applications of weighted surface networks. In Proc. 5th Inti. Symp. Spatial Data Handling, pages 567-579. IGU Commision on GIS, 1992. [29] S. Yu, M. van Kreveld, and J. Snoeyink. Drainage queries in TINs: From local to global and back again. In Proc. 7th Inti. Symp. Spatial Data Handling. IGU Commission on GIS, 1996. Accepted.

330

Computing the Angularity Tolerance* (extended abstract)

Mark de Berg t

Hellk Meijer ~

Mark Overnlars t

Gordon Wilfong

§

April 18, 1996

1

Introduction

Manufactured objects are always approximations to some ideal object: parts that are supposed to be flat will not be perfectly flat, round parts will not be perfectly round, and so on. In many situations, however, it is important that the manufactured object is very close to the ideal object. In such cases the specification of an object includes a description of how far the manufactured object is allowed to deviate from the ideal one. The field of dimensional tolerancing [2] provides the language for this. Given a specification, one must test whether the manufactured object meets it, which is the area of study called computational metrology. The objects are often tested as follows. Suppose for simplicity that we want to manufacture a flat surface. First, a socalled Coordinate Measuring System (GMS) 'measures' the manufactured surface. The output of the eMS is a set of points in a-dimensional space that are on the manufactured surface. The second step is to compute two parallel planes at minimum distance to each other that have all the measured points in between them. In other words, one wants to compute the width of the point set. The surface meets the requirement if the width is below the specified threshold. Computing the width of a point set can be done in O( n log n) time ill the plane [3] and in 0(n 3 / 2+&) expected time in 3-dimensional space [1]. We study another problem from computational metrology, which arises when one wants to manufacture an object with two flat surfaces that make a -Tlus work was partially supported by the Netherlands Organisation for Scientific Research (N.W.O.) and by NSERC Canada. We also tballk Bellairs Research Institute in Barbados for tile use of their facilities. tDepartment of Computer Science, Utrecht University. P.O.Box 80.089,23508 TB Utrecht, tbe Netberlands. l Department of Computing and Illfonllation Science, Queen's University, Kingston, Ontario, Canada. SBell Labs, 600 Mowltain Ave .• Murray Hill, NJ 07974. U.S.A.

331

specified angle with each other. Testing whether the manufactured object meets the specifications leads to the angularity problem: given a set of points, compute a thinnest wedge whose legs make a given angle with each other and that contains all the points. We show that in the plane this problem can be solved in 0(n 2 10g n) time. In 3-dimensional space we study a simpler variant, where all the meaSlued points come from one of the two surfaces; the other surface, the so-called datum plane, is assumed to be in a known orientation. The problem is now to find the thinnest 'sandwich' (that is, two parallel planes) that makes a given angle with the datum plane and contains all the points. In other words, we want to compute the width under the restriction that the planE'S make a given angle with the datum plane. Vve solve this problem in O( n log n) time. Both in the planar case and in the 3-dimensional case we also study variants where the points have uncertainty regions associated with them.

2

Point sets in two dimensions

We start by studying the angularity problem in the plane. In the simplest version we are given a datum line, a set of n points (which are on one side of the line), and an angle (J. The problem then is to compute the thinnest strip (or, sandwich) that contains all the points and makes an angle 9 with the datum line. In the plane this simple version is not so interesting; it can easily be solved ill linear time by computing the extrema of the point set in the direction perpendicular to 8. Therefore we concentrate on the case where the datum plane is not given. In this set.ting we are only given a set S of n points and an angle 8, and we want to compute the thinnest 9-wedge that contains all the points, where a 9-wedge is defined as follows:

Definition 1 A 8-wedge of width 6 is the closed are.a bounde.d by four directed half lines bl1 b2 , 11

and 12 such that • b1 is parallel to and to the right of 62 and 11 is parallel to and to left of 12 • b1 and 11, as well as b2 and 12 have a common starting point • the angle measured in counter clockwise direction between b1 and 11 is equal to 9

starting point of b2 and 12 of wedge W (4)), and define the inner curve I C as the collection of all points B( ¢). Our algorithm to compute the thinnest 9wedge containing S starts by computing the curves DC and I C. The next two lemmas state how these curves look, and how much time we need to compute them. The proof of these lemmas is omitted in this extended abstract.

LeWlua 1 The collection OC is a closed curve of

• the distance between b1 and b2 and between 11 and 12 is 6

piece-wise circular arcs, has a linear combinatorial complexity, and can be computed in O( n log n) time.

Figure 1 shows a wedge containing all points shown. The minimum 6 such that there is a 9-wedge of

LeWlua 2 The collection I C is a closed curve of piece-wise circular arcs, has a combinatorial complexity of 0(n 2 ), and can be computed in 0(n 2 10gn) time.

After computing OC and IC it is easy to compute the thinnest wedge: We split the range [0 : 271'] of possible orientations of the wedge into subranges where both the outer curve and the inner curve are attained by a single (piece of a) circular arc. The previous two lemmas imply that there are 0(n 2 ) subranges. (In facti the subranges correspond exactly to the arcs of IC.) For each subrange we can then compute the thinnest wedge in constant time. This leads to the following result.

Theol'eUl 1 Given an angle 9 and a set of n points 8, the thinnest 9-wedge containing" can be found in 0(n 2 10gn) time.

Figure 1: A 9-wedge of width 6. width 0 containing S is called the tolerance of S (with respect to 9-wedges). Toussaint and Ramaswami [6] have solved a simpler variant of the problem, where it is known in which of the two 'legs' of the wedge each input point lies: one is given an angle 9 and two sets of points, each of which has to be enclosed in a strip such that the angle between the two strips is 9. Let W(¢) be a 9-wedge of minimal width, such that the bisector of b1 and 11 has direction ¢ and the wedge contains S. If there is no point of Son 61 we can move W(¢) so that· at least one point of S is on bl, while S remains contained in W(¢). So without loss of generality we may assume that there is at least one point of Son 61 and, similarly, at least one on It. It is now easy to see that W ( ¢) is unique for each value of ¢. Let A(¢) be the apex of W(¢). Let DC, the outer curve, be the collection of all points A(4)) for 0 :5 4> :5 271'. Let B(4)) be the common

332

The running time of our algorithm is dominated by the time to compute IC. One might hope to improve this by showing a better bound on the complexity of IC. The next theorem shows that this is not possible. The example proving the theorem is omitted in this extended abstract.

Theorenl 2 The worst-case complexity of IC is 6(n 2).

3

Uncertainty regions in two dimensions

In computational metrology the sample points normally are not exact but come with some uncertainty: rather than a set of points, we get a set U of uncertainty regions {Ut, ... , Un}. For each region Ui there is a point Pi E Ui that lies on the surface of the manufactured object, but due to the inaccuracy

in the measuring process the point Pi is not known. In this case one would like to compute upper and lower bounds on the tolerance. To illustrate the definitions, we first look at the simple version of the problem, where we are given a datum line, a set U of uncertainty regions, and an angle 9. Define a 9-sandwich to be a sandwich (that is, a strip) that makes an angle 9 with the datum line. For a set S of points, define 0(9, S) to be the tolerance of S, that is, 0(9, S) is the width of the thinnest 9-sandwich (strip) that contains S. An upper bound on the tolerance of any {PI, ... , Pn} of points within the uncerset S tainty regions of U {UI, ... , un} is given by the quantity

=

positive x-axis but with the negative x-axis. In the planar case one could argue that the angle of the flipped sandwich is not 9 but 1r-8. In 3-dimensional space, however, a similar example applies, and there it is natural to allow 'rotating' the sandwich while keeping the angle with the datum plane fixed.) I

I, I

I

I

..

.....

,','

" , ,,""-..

,','

,',' I

,

,',' I

=

,

,

,

,

... "-' ....

. .. . ......13

...... 2+

.........

........ 2/3

........

......

,

... ... ........

I

I

"

...

I,, , ", ,

max{o(9, S) : Pi

e Ui

for 1 :::; i :::; n}.

(1)

,

Unfortunately this quantity is hard to compute. Therefore we compute a more conservative upper bound, omax(9, U), defined as follows:

((

omax(9, U)

I

,

,

,,

,

I

,

'(\e,

1.'1

,',' ,

,

,

"

I

.......,,',' , ,,,,

,

I

"

I

,

1n

-3

, «

Figure 2: Two regions of uncertainty

= minimum

width of any 9-sand wich containing all uncertainty regions in ll.

The value omax (9, U) is called the maximum tolerance of U. Notice that omax(9, U) is also the width of the thinnest 9-sandwich that is guaranteed to contain all points of any set S {PI, ... , Pn} with Pi e Ui. At first glance it might seem that omax(9, U) is the same as the upper bound given by equation (1), but this is not true.

=

Theorem 3 For some sets U, the value omax(9, U) is greater than the upper bound on the tolerance. as given by equation (1J. Proof: We get a trivial example by taking a set U consisting of only one region, say the unit circle. In this case we have omax(9, U) = 2 and max 0(9, S) O. But also for a larger number of uncertainty regions omax (9, [1) can be greater than maxcS(9, S).

=

Consider the example with two regions shown in Figure 2. In the example 9 7r /:3 and U consists of two unit circles. In this example omax(8, U) 2 + J3. However, 0(9, S) :::; 2J3 for all choices of S. (If we place the points of S where the thinnest sandwich for U touches the two cirde's, then we can obtain a thinner 9-sandwich by 'flipping' the sandwich, so that the angle with the datum line (here the x-axis) is no longer given by the angle with the

=

,

,',' I

,

,

,

I

,

,

I

I

I

,

"

"'"

...........

=

333

When we define a lower bound on the tolerance, then we do not get these problems; we define omin(9, 1I)

= min{o(9, S) : Pi e Ui for 1 :::; i :::; n}.

The value omin(9, U) is called the minimum tolerance of U. The minimum tolerance is the same as the width of the thinnest sandwich which contains at least one point from each uncertainty region Ui. In order to compute sandwiches containing uncertainty regions, we make the assumption that given a direction ¢ and an uncertainty region Ui, we can compute the two tangents of Ui with direction ¢ in constant time. Computing the maximum and minimum tolerance of a given set of uncertainty regions, when we are given a datum line and an angle e is trivial to do in linear time. Now consider the case where no datum line is given. The definitions of maximum and minimum tolerance readily carryover. In order to compute the thinnest wedge containing a set of uncertainty regions, we can proceed as in the previous section. The combinatorial complexity of the curves OC and IC depends on the shape of the uncertainty regions. For example if all regions are equal size circles, the curve Ie does not consist of circular arcs, but it has at most a quadratic complexity.

i) All circles lie to the left of or on 11.

Theorem 4 Given a set of n uncertainty regions U consisting of equal size circles and an angle 0, the value 8max (0, U) can be found in O(n210g n) time.

ii) No circle completely lies to the left of 12 • iii) Among all pairs of lines that satisfy i) and ii) the distance between 11 and 12 is minimal.

It is an open problem to determine which other shapes of uncertainty regions permit an O(n210g n) algorithm.

4

It is easy to verify that this is indeed the same problem. Figure 3 shows an example of a solution for such a 2-dimensional problem. We can now solve

Point sets in three dimensions

In the 3-dimensional setting we only study the simple variant of the angularity problem, where a datum plane is given. We assume without loss of generality that the datum plane is the zy-plane. The set of points, which we assume lie above the x-plane, is denoted by S. We want to compute the thinnest O-sandwich containing all points in S, where 0 is a given angle. (Similar to the planar case, a 0sandwich is defined to be the closed region between two parallel planes that make an angle 0 with the datum plane.) The width of the sandwich is the distance between the two planes. We denote the plane bounding the sandwich from above by hI and the plane bounding it from below by h 2 • To find the pair 11.1 and h2 bounding the thinn~.st sandwich, we transform the problem into a 2dimensional problem as follows. (We could also work directly in 3-space, but we feel that the transformation makes the algorithm easier to understand, especially in the case of uncertainty regions, which is studied later.) For a point Pi E S let Ci be the cone pointing upwards with apex Pi (thus, Pi is the highest point of the cone) and apex angle 1r-20, that is, the sides make an angle of 0 with the zy-plane. Now Pi lies below or on hI if and only if Ci lies below or on hI. Similarly, Pi lies above 112 if and only if Ci does not lie completely below or on h 2 • Each cone Ci intersects the zy-plane in a cirde Ci·

Let hI and h2 be the two planes that form a 0sandwich containing S. The plane 11.1 intersects the zy-plane in a line II, and 112 intersects it in a line 12 parallel to 11. We direct the lines 11 and 12 so that 12 is to the left of 11' The cone Ci lies below hI if and only if the circle Ci lies to the left of 11. Similarly Ci lies below h2 if and only if circle Ci is to the left of 12 • This leads to the following 2-dimensional reformulation of the the problem: Given a set of circles {Cl, .. " cn}, determine two parallel directed lines 11 and 12 such that

334

Figure 3: Solution to the planar problem. the problem as follows. Consider a valid pair of lines of minimum width, where we fix the slope of the lines to be, say, zero. For each region, take the lowest point on its boundary. Now the lines 11 and 12 go through the lowest and the highest point, respectively, of all sllch lowest points. When we start increasing the slope of the lines from zero to 21t', then the extreme points defining 11 and 12 move along the boundaries of the regions on which they lie. At some point they will switch from one region to another one. Which two regions define the two extreme points for a given slope ¢ can be determined by computing suitably defined lower and upper envelopes. The thinn~.st sandwich is then determined by the minimum distance between these two envelopes. Details are given in the full paper. This leads to the following r~sult. Theorem 5 Given a set of points S in 9-space and an angle 0: the minimum width O-sandwich that contains S can be found in O( n log n) time.

5

Uncertainty regions in three dimensions

We define the maximum and minimum tolerance of a set U of uncertainty regions with respect to

8-sandwiches similar to the planar case-see Section 3. We first show how the thinnest 8-sandwich can be computed that contains a set of uncertainty regions U. As before we can transform the 3dimensional problem into a 2-dimensional problem. Let P be a plane that has an angle 8 with the zy-plane (which is again assumed to be the datum plane) and is tangent to region Ui, such that Ui is below P. We define the generalised cone Ci as the intersection of the half spaces below all such planes P. The intersection of Ci and the xy-plane is the region Ci. For example, if Ui is a sphere with positive z-coordinates, then Ci is an upwards pointing cone and Ci is a circle, as shown in Figure 4. Similarly, let Q be a plane which has an angle 8

in constant time. • The boundaries of two intersecting regions intersect each other at most Ie times where Ie is a constant and their common outer tangents can be computed in 0(1) time. • For any connected part C of the boundary of a region Ci and any connected part d of the boundary of a region dj we can find in constant time two parallel tangents through a point of c and d respectively which have minimal distance to each other. Any two parallel planes that have an angle 8 with the xy-plane and that are guaranteed to contain all points from U correspond to two directed parallel lines 1711 and 1712, such that the following holds:

i) All regions

Ci

lie to the left of or on

ml,

ii) No region di is completely to the left of m2. We can now find the thinnest 8-sandwich that contains all regions in U, that is, the maximum tolerance of U, with an algorithm that is similar to the algorithm we used for points. A similar approach can be used to compute the ~in­ imum tolerance of U. We get the following result. Figure 4: Turning 3-dimensional regions into 2dimensional convex objects with the zy-plane and is tangent to Ui, such that is above Q. The generalised cone Di is the intersection of the half spaces below all such planes Q. The intersection of Di and the xy-plane is the region di. So for all i we have eli C Ci. Without loss of generality we can assume that all regions Ui have sufficiently large z-coordinates so that none of the regions di is empty.

Theorenl 6 Given a set of n uncertainty regions U and an angle fJ, lite maximum and the minimum tolerance of U with respect to 8-sandwiches can be found in O(Ak(n) logn) time.

Ui

Notice that an uncertainty region Ci or di in the xyplane is convex and has exactly one tangent through each point on its boundary. \Ve assume that the uncertainty regions Ci and di satisfy the following properties. • Given a direction ¢ in the xy-plane and a region we can compute the two tangents of the region with direction ¢ in constant time. • Given two non-intersecting regions, their common inner and outer tangents can be computed

335

6

Conclusions

We solved the sandwich problems in two and three dimensions, for point sets as well as uncertainty regions. The problem of finding a thinnest wedge is only solved for the 2-dimensional case. Solving the wedge problems for uncertainty regions and for point sets in 3-space dimensions remains open.

7

Acknowledgements

We thanks Godfried Toussaint for organising the 1995 Workshop on Computational Metrology at the McGill University's Bellairs Research Institute, where this work was started. We also thank the participants of this workshop for their help.

References [1] P.K. Agar'Yal and M. Sharir. Efficient randomized algorithms for some geometric optimization problems. In Proc. 11th A nnu. A CM Sympos. Comput. Geom., pages 326-335, 1995. [2] ASME YI4.5M-1994, Dimensioning and Tolerancing, The American Society of Mechanical Engineers, New York, 1994.

[3] M.E. Houle and G.T. Toussaint. Computing the width of a set. IEEE Trans. Pattern Anal. Mach. Intel!. 5:761-765, 1988. [4] M. Sharir and P.K. Agarwal. DavenportSchinzel Sequences and Their Geometric Applications. Cambridge University Press, 1995. [5] T.C. Schermer, C. Yap, Probing for nearcenters and approximate relative roundness, ASME Workshop on Tolerancing & Metrology (invited talk), University of North Carolina at Charlotte, June 21-23, 1995. [6] G. Toussaint and S. Ramaswami, Personal Communication, 1995.

336

The Complexity of Illuminating Polygons by a-Flood-Lights Jay Bagga

1,

Laxmi Gewali

2,

and David Glasser

2

Abstract: The Flood-light Illumination Problem (FIP) is the determination of the minimum number of vertex a-lights to illuminate a given polygon. For simple polygons, we show that this problem is NP-hard for any fixed 0' in the range 0 < 0' ::; 3600 . Furthermore, the problem remains NP-hard even when a-lights are required to be flush with the edges of the polygon. Our technique is based on the construction of beam-machines.

1. Introduction In most illumination problems, visibility from a point is allowed in all directions (360° angular aperture). Recently, several researchers have considered illumination problems that restrict visibility to within a certain angular aperture [3,4,5]. A light source whose illumination angle is restricted to a-degrees is called an a-flood-light (or simply a-light). A simple polygon may remain unilluminated even if we place a 90 0-flood-light at each vertex; and this holds true even if the polygon is restricted to be monotone [4]. Estivill-Castro et. al. [5] presented a surprise on polygon illumination: there are simple polygons (called logarithmic spirals) that can not be illuminated by placing a-lights on all of its vertices for any fixed 0' < 180°. An open problem posed in [3] is the determination of the minimum number of a-lights required to illuminate a simple polygon. This problem is known to be NP-hard when visibility is allowed in all directions (i.e., 0' 360°) [1,2]; the problem is also known to be NP-hard when a 90° [6]. In this paper, an approach based on beam-machines is used to show that the problem of illuminating a simple polygon by the minimum number of a-lights is NP-hard for any fixed 0' in range 0 < 0' ::; 3600 • We further show that the problem remains NP-hard (in fact, it is NP-Complete) even if a-lights are required to be flush with the edges of the polygon.

=

=

2. Preliminaries The notation < Vb V2, ••• , Vn > is used to denote the polygonal chain connecting vertices in the order A simple polygon is specified by the polygonal chain describing its boundary. In a polygonal chain, all vertices are distinct and hence the first vertex and the last vertex in the chain are not connected. However, when a polygonal chain < VI, V2, ••• , Vn > is used for representing a simple polygon then it is considered to be closed, i.e., the first vertex and the last vertex are understood to be connected. We require that a-lights can be placed only on the vertices and that at most one a-light can be placed on a vertex. VI, V2, V3, ••• , Vn .

The Flood-light TIlumination Problem (FIP) Instance: A simple polygon P of n sides, a positive integer m, and angular aperture Question: Can P be illuminated by at most m a-lights?

0'.

The Satisfiability Problem (SAT) Instance: A collection W ={C1 , C2, C3, ... , Ck} of clauses of a finite set of boolean variables X {Xl,X2,X3, ••• ,x r }; variable Xi occurs kil times as Xi and ki2 times as Xi. Question: Is there a truth assignment for variables in X that satisfies all the clauses?

=

Given an instance h of SAT, we convert it in polynomial time to an instance 12 = (P, m) of FIP such that h is satisfiable if and only if the interior of P can be illuminated by m or fewer a-lights, where m can be expressed in terms of the number of clauses k and the number of literals r in 11' Our reduction is similar in spirit to the construction developed by Culberson and Reckhow [7], where an approach based on beam-machines is used to reduce the satisfiability problem to the problem of covering a simple polygon by the minimum number of convex polygons. 1

2

Department of Computer Science, Ball State University, Muncie, Indiana. email: [email protected] Department of Computer Science, University of Nevada, Las Vegas, Nevada. e-mail: [email protected]. For this research, Laxmi P Gewali was supported in part by a grant from US department of energy (NVOO).

337

3. Illumination by 45°-lights For the purpose of clarity of exposition we first examine the complexity of FIP when the angular aperture of flood-lights is restricted to 45°. One of the polygonal structures used in the reduction is the beam-machine. Beam-Machine: A beam-machine is a polygonal chain used for generating a thin illumination beam by the placement of the minimum number of 45°-lights in its interior. Corresponding to each literal in the given SAT expression we will construct a beam-machine. Specifically, it is a nineteen sided polygonal chain < a, b, c, ... ,j,i', i', ... a' > (Figure la) which can be viewed as a simple polygon with a tiny opening < a, a' > on its boundary. The interior of a beam-machine is considered to be the interior of the polygon formed by closing its opening. The interior of a beam-machine consist of four parts: (i) the left-wing < d, e, j, g, h, i, j >, (ii) the right-wing < d',e',/',g',h',i',j' >, (iii) the body (quadrilateral with vertices d,j,j', and d'), and (iv) the mouth < d, c, b, a, a', b', c', d' >. A beam-machine satisfies the visibility properties listed in Table 1. Table 1

Pr.# 1 2 3 4 5

Property Interior angles at e and e' are at most 45 u each. Vertex e (respectively, e') is the only vertex from which the entire left-wing (respectively, right-wing) can be illuminated by a 45°-light. (a) Edges (o,b), (c.d), and (c/,b / ) are parallel to each other and their extensions meet near its middle. (b) Analogous properties hold for the edges (o/.b / ). (c/,d / ), and (c,b). The mouth is visible only from vertices j or j'. The angles subtended by segment (d, d/) at vertices j and j' are less than 45 u each.

(i,;)

Due to space limitation proofs of lemmas/theorems and other details are omitted. Lemma 1: Three 45°-lights are necessary and sufficient to illuminate a beam-machine. A beam-machine can be illuminated by three 45°-lights by placing them either at vertices (1) e, e', and j, or at vertices (2) e, e/ , and j'; we refer to these placements as placement-j and placement-j', respectively. Observation 1 (Beam Formation): Consider the illumination of a beam-machine by placement-j. In addition to the illumination of the interior of the beam-machine, it produces a thin beam of light in the exterior extending from the opening of the mouth and inclined to the right side (Figure la). Similarly, placement-j' produces a thin beam extending to the left. Beam Adjustment: It is desirable to be able to adjust the width and orientation of a beam without changing the visibility properties of the corresponding beam-machine. The width of the beam can be adjusted by narrowing or widening the opening in the mouth of the beam-machine, which can be done by adjusting the lengths of the edges (a, b) and (a', b/). It is easily seen that the visibility properties listed in Table 1 do not change by adjusting the lengths of these edges. To rotate the beam to the right, we slightly shift vertex j to the left along the edge (i', j) and adjust the chain < j, g, h, i, j > so that the left-wing is still visible from vertex e. The adjustment is shown by dashed chain in Figure lb. Since the angle subtended by the edge (d, dl ) at vertex j is slightly less than 45° (property 5 in Table 1), the mouth of the beam-machine remains illuminated from the 45°-light appropriately placed at the new position of j. To rotate the beam to the left we slightly shift j to the right along the edge (i, j) . The Background of Variable Generators (BVG): BVG is a twenty two sided polygonal chain < VI, V2, .•. , V23 > (Figure 2a) whose interior can be partitioned into five polygonal regions: (i) left-wing < V2, V3, ... , Vi >, (ii) right-wing < V22,V2I,· .• ,V17 >, (iii) left-arm < Vi,VS, ... ,V12 >, (iv) right-arm < V12,VI3, •.• VIi >, and (v) body < Vb V2, V7, V12, VI7, V22, V23 >. BVG satisfies the visibility properties enumerated in Table 2. VBG can be systematically constructed by first constructing its skeleton. The skeleton is then modified to obtain BVG (Figure 2b). (details omitted)

338

Table 2 Pr.#

1 2 3 4 5 6

Property Interior angles at V4, Vn, VI3, and V20 are at most 45 u each. Vertex Vn (respectively VI3) is the only vertex from which the entire left-arm (respectively, right-arm) can be illuminated by a 45°-light. (a) Both wings can be illuminated by one 45U-light placed at V4 or V20. (b) No other placement of a single 45°-light can illuminate both wings. (a) Vertices V4, V6, V7 are collinear and the line through them meets the edge ("16' "17) in its interior. (b) Similar properties hold for vertices VI7, VIS, and V20 and edge (117. "8) (a) VI9 is not visible from vs, V6, and V7. (b) Vs is not visible from vl7, VIS, and VI9. (a) V2I is not visible from V2 and V3. (b) V3 is not visible from V2I and V22.

Variable Generator: We construct variable generator Vi corresponding to each variable Xi in the SAT instance. A variable generator is obtained by attaching beam-machines and spikes on the arms of BVG. (It may be recalled that variable Xi occurs kil times as Xi and ki2 times as Xi.) We attach kil beam-machines db d2 , ••• , dkil on the edge (vn, VI2) of the left-arm and ki2 beam-machines bI, b2, ... , bki2 on the edge (VI2' VI3) of the right-arm (Figure 3a). Corresponding to ki 1 beam-machines we attach k i 1 triangular spikes QI, Q2, ••• , Qkil on the edge (V7, vs). Similarly, we attach ki2 triangular spikes S1, S2, ... , Ski2 on the edge (VI7' VIS). Lemma 2: Three 45°-lights are are necessary and sufficient to illuminate BVG. Lemma 3: (a) 3(ki 1 +ki2 + 1) 45°-lights are necessary and sufficient to illuminate the interior of the variable generator Vi, (b) In addition to the illumination of the interior of Vi, 3( kil + ki2 + 1) 45°·lights can generate kil or ki2 beams extending away from the mouth of Vi. Formation of Shadow-region: When the background of a variable generator (say, Vi) is illuminated by the minimum number (three) of 45°·lights, a shadow-region bounded by two illuminated region is formed in its exterior (Figure 3b). There is a critical role of such shadow·regions in the final construction of polygon P. The 45°-lights placed at vertices Vn and VI3 generate two illumination regions in the exterior of Vi, one inclined to the left and the other to the right. The region bounded by these two illumination regions is the shadow-region (shaded in the figure) induced by the background of Vi, Polygon Construction: We start with a quadrilateral < A, B, C, D > whose interior angles at B, C, and Dare 90°, 90°, and 45 0 , respectively. We at tach two thin triangular spikes TI and T2 on the side (B, C) such that D is the only vertex from which both of them are visible. For each variable Xi, we construct variable generator Vi containing kil + ki ., beam-machines and attach them on the side (A, B). We also attach k triangular spikes on the side (D, C) corresponding to k clauses in the given SAT instance. Triangular spikes lying on the side (D, C) are the clause checkers which can be illuminated by beams comming from the variable generators. The size of the quadrilateral is made large enough (compared to the size of variable generators) so that all clause checkers lie in the intersection of shadow-regions induced by variable generators. The beam-machines are adjusted so that the beams escaping from the variable generators can be focussed on respective clause checkers to illuminate them. It is easily seen that this construction takes polynomial time. Lemma 4: All clauses in Ware satisfiable if and only if P can be illuminated by m or fewer 45°·lights, where m can be expressed in term of the number of literals and the number of clauses. Theorem 1: FIP is NP-hard when

Q

= 45°.

4. Illumination by a-lights In this section we show how to generalize the reduction of Section 3 when the angular aperture Q is in the range 0 < Q ~ 360°. If Q is greater than 45° then we can simply use the construction for 45°-lights from the previous section. When Q is smaller than 45° then we need modified structures. We prefix by Q the

339

terms/notations used in the previous section to indicate the context of illumination by a-lights. For example, beam-machines, skeleton, BVG, and variable generator Vi are referred to as a-beam-machines, a-skeleton, a-BVG, and a-Vi, respectively. The structure of a-beam-machine is similar to the structure of 45 0-beam-machine except that (a) the angles at e and e' are a each and (b) the angle sub tended by (d, d') at j and i' is slightly less than a. An a-beam-machine satisfying the properties in Table 1 and Lemma 1 (obtained by replacing 45 0 with a) can be constructed easily. To construct a-BVG, we start with the 45 0 -skeleton and stretch its wings and arms by moving away vertices V4, Vll, V13, and V:w (Figure 5) so that the interior angles at Vll and V13 are reduced to a-{) each and that at V4 and V20 are reduced to a-f each, where f and {) are small positive angles. It can be proved that a-BVG can be constructed from a-skeleton to satisfy the analogous properties listed in Table 2. Variable generator a- Vi and the final polygon P are constructed in the similar way as in the previous section. (details is omitted.) Lemma 5: The shadow-region induced by a-lights placed at vertices a-BVG.

VII

and

Vl3

lies in the exterior of

Lemma 6: (a) 3(kil + ki2 + 1) a-lights are necessary and sufficient to illuminate the interior of the variable generator 0'- Vi. (b) In addition to the illumination of the interior of a- Vi, 3( ki 1 + ki'J + 1) a-lights can generate ki 1 or ki'J beams extending away from the mouth of a- Vi. Theorem 2: FIP is NP-hard. Remark 1: When an a-light L is placed on a polygon's vertex v with interior angle {3 (13 > a), the interior region of P illuminated by L depends on the orientation of L, and L can be oriented in infinitely many directions. Thus, in general, we can not check in polynomial time whether or not m a-lights can illuminate P. This implies that FIP does not belong to the class NP. Hence FIP is NP-hard and not NP-complete.

5. Discussion We showed that the problem of illuminating a simple polygon with the minimum number of a-lights is NP-hard for any a in the range 0 < a 5 360 0 • The construction can be modified to show that the problem remains NP-hard even if a-lights are required to be flush with the edges of the polygon. It may be noted that our construction is such that, excepting the a-lights placed inside the a-beam-machines, all other a-lights are flush with the edges of the polygon. We have been able to construct a modified a-hearn-machine where a-lights are forced to be flush with the edges. When the flushing condition is required we can check in polynomial time whether or not a given set of vertex a-lights can illuminate the polygon (there are at most two distinct orientations per vertex), implying that the problem is in the class NP. Theorem 3: FIP is NP-complete even if a-lights are required to be flush with the edges of the polygon. The FIP problem becomes the well known art gallery problem when the visibility is allowed in all directions, i.e., when a 360 0 • Although the art gallery problem for simple polygons is known to be NP-hard [1,2], it is still open for simple orthogonal polygons. We believe that an approach based on beam-machine construction might be helpful to settle this issue. For simple orthogonal polygons, it may be possible to solve FIP in polynomial time when a-lights are required to be flush with the edges.

=

References [1 ] J. O'Rourke,Art Gallery Theorems and Algorithms, Oxford University Press, 1987. [2 ] T.C. Shermer, Recent Results in Art Galleries, Proceedings of the IEEE, Sept. (1992), pp. 1384-1399.

[3 ] V. Estivill-Castro, and J. Urrutia, Optimal Floodlight Illumination of Art Galleries, Proceedings of the Sixth Canadian Conference on Computational Geometry, (1994), pp. 81-86.

340

[4 ] J. O'Rourke and D. Xu, Illumination of Polygons with 90° Vertex Lights, Snapshots of Computational and Discrete Geometry, Edited by: D. Avis and P. Bose, McGill University, (1994), pp. 108-117. [5 ] V. Estivill-Castro, J. O'Rourke, J. Urrutia, and D. Xu, Illumination of Polygons with Vertex lights, Information Processing Letters, 56 (1995) pp. 9-13.

[6 ] J. Bagga, L. Gewali, and D. Glasser, Illuminating Simple Polygon by Flood-lights, Proceedings of SPIE (Vision Geometry IV), (1995), pp. 108-115. [7 ] J.C. Culberson and Robert A. Reckhow, Covering Polygons is Hard, Journal of Algorithms, 17, (1994), pp. 2-44.

;-------------~e· C a ' c·

c'--------------

,il

\\ \\ \\ \\

\ \

(a): Beam-machine

\ \ \ \ \ \

,

\

(b): Beam Rotation \ \

Figure 1: Illustrating beam generated from a beam machine

- - - - - -Y--.....v~21

- - - -"

v 23

(b): Backgroung of Variable Generator (BVG)

(a) Skeleton of BVG

Figure 2: Illustrating the Construction of the Background of the Variable Generator

341

"tl

/

'20

,,

\ \ I

,

/

/ /

,,

\

\

/

,,

,,

\

,

\

(a)

(b): The Shadow Region of the Variable Generator Figure 3: The Variable Generator

r variable generators

A

B

I," , I, I ,

,

I

,'

/~

14-

, I I I /VIY

f"

,~

,

/ /

I I

/

/

}'

/.

I

,, " , I

I

, I

,, I

I

I I

I

""" ~

D'-----------------------~r-

Figure 5: Stretching the Skeleton

c

k ckause checkers

Figure 4: The Final Polygon P

342

AUTHOR INDEX Amenta, N. 80 Atassi, Y. 246 Auer, T. 38 Avis, D. 56 Bagga, J. 337 Bajaj, C. 99 Barequet, G. 32 Barrera, A.H. 289 Bespamyatnikh, S.N. 101, 252 Bhadury, J. 26 Bhattacharya, B.B. 93 Biedl, T. 295, 306 Bieri, H. 179 Boissonnat, J .-D. 14, 173 Bose, P. 68, 143, 217, 325 Cai, L. 300 Castaneda, N. 312 Chadzelek, T. 131, 167 Chandrasekaran, R. 26 Chen, D.Z. 155, 240 Czyzowicz, J. 173, 185, 283 Daescu, O. 240 Daniels, K.M. 196 Das, G. 155 de Berg, M. 325, 331 de Groot, M. 325 Devillers, O. 173 68 Devroye, L. Dobrint, K. 325 Eckstein, J. 131, 167 Evans, W. 68, 143 Everett, H. 74 Fink, E. 211, 258 319 Flatland, R.Y. Floriani, L. 190 Follert, F. 137 Gewali, L.P. 337 337 Glasser, D. 50 Goldak, J. 8 Gupta, P. 38 Held, M. Hert, S. 125

343

Hurtado, F. Imai, T. Jackson, L. Janardan, R. Kedem, K. Kirkpatrick, D. Kong, C.M. Kranakis, E. Krizanc, D. Krithivasan, K. Laurentini, A. Lazard, S. Le, N.-M. Li, Z. Liotta, G. Lumelsky, V. McAllister, M. Magillo, P. Martynchik, V. Metelski, N. Meijer, H. Milenkovic, V.J. Mirzaian, A. Mukhopadhyaya,K. Nandy, S.C. Nielsen, F. Noy, M. Olariu, S. Overmars, M. Pei, N. Preparata, F .P. Puppo, E. Raghavan, P. Rema, A. Roos, T. Schirra, S. Schmidt, P.-M. Schomer, E. Segal, M. Sellen, J. Shermer, T.e. Smid, M. Stojmenovic, I. Snoeyik, J.

74 107 44

8 20 143,217 56 185 185 149 223 14 113 217 1 125 143 190 2 2 331 196 62 93 93 87 74 119 325, 331 161 1 202 276 149 325 149 179 131, 167, 264 20 264 234 8, 155 119,283 143,325

Stewart, C.V. Szymacha, T. Tamassia, R. Teichmann, M. Urrutia, J. van Kreveld, M. Vijaykumar, P.I. Wang, C.A. Wang, D. Whitesides, S. Wilfong, G. Wismath, S. Wolfers, B. Wood,D. Xu, Y.-F. Yap,C. Yu, S. Yvinec, M. Zhu, B. Zomaya, A. Y.

319 283 1 264, 277

173, 185, 312 325 149 62

50 161 331 44

32 2, 211, 258 62

264 325

173 270

119

344