Pawr,¢ Recognition, Vol. 20, No. 1, pp. 65-74. 1987. Printed in Chest Britain. 0031-3203/87 S3.00÷ .00 Perllamon Journah L~, Pattern aecolmtion Society AN ALGORITHM TO DETERMINE THE DIRECTIONAL RELATIONSHIP BETWEEN ARBITRARILY-SHAPED POLYGONS IN THE PLANE DONNA J. PEUQUET* and ZHAN CI-X1ANG'~ (Received 5 November 1985; in revisedform 10 June 1986) Abstract--The directional relationship between two polygons (e.g. left, above, beside, east, north) is an important spatial property and can also be used as a selection criterion for retrieving objects from a spatial database. If the database is large, this could help significantly in speeding search by reducing the size of the necessary search space. This paper builds upon past work to develop a model for determining the directional relationship in 2-D space between two simply-connected polygons of arbitrary shape, size and distance from each other. The model is based on visual interpretation and is data structure independent. The model is also stated in algorithmic terms, and is found to have a computational complexity of O(n), where n is the total number of vertices or cells used to represent the two polygons. Spatial relationships Direction Geometric algorithms Computer vision Geographic information systems 1. INTRODUCTION The storage, display, manipulation and analysis of geographic data via integrated computer systems called geographic information systems (GIS) is now becoming common practice in private and govern- mental organizations. This approach has been commonly perceived as an obvious extension of the concept of database and information systems for business (i.e. non-spatial) applications. There is a rapidly growing need to use GIg to manage databases that are extremely large (national or global in scope) and are to be shared by a wide variety of applications. However, current GIS have consistently exhibited severe problems with response times, as well as with rigidity and narrowness in their range of applications. GIS technology requires operation on a predefined data set with 'built-in' relationships. These problems are directly attributable to some unique characteristics of geographic data. Among these is that the boundaries of geographic features tend to be convoluted and irregular. These data do not lend themselves to compact definition and quickly become extremely large and inefficient to use as a result. Much work is currently underway to develop new methods for representing geographic data in an extremely efficient and flexible mannerJ :' 2~Neverthe- * Department of Geography, The Pennsylvania State University, University Park, PA 16801, U.S.A. 1" Department of Geography, University of California at Santa Barbara, Santa Barbara, CA 93106, U.S.A. less, relatively little is being done on the necessary counterpart of this work; to increase the efficiency and flexibility of search techniques that operate on these geographic data representations. This is therefore the overall goal of the research reported upon here. For the purpose of database retrieval, any spatially- oriented database query can be described as: find the given spatial object(s) which satisfy the given spatial constraints. These spatial constraints can ultimately include a locational window and any combination of spatial relationships with other objects. These con- straints help to increase retrieval efficiency by rapidly reducing the required search space. Given the extremely large volumes of data currently being incorporated into geographic information systems, this application of spatial relationships in general has a major impact on the overall power and performance of these systems. In current systems, the spatial relationships used as query constraints are limited to: distance from a point or other object, containment and adjacency. The directional relationship between two polygons (e.g. left, above, beside, east, north) is an important spatial property that can also be used as a powerful search constraint. Unlike other spatial relationships such as distance, adjacency or containment however, direction is a fuzzy concept and is thus often dependent on human interpretation. The problem is also made more complex in the case of arbitrary polygons because of the effects that relative size, distance and shape have on the perceived directional relationship. Relative direction is consequently difficult to encode