See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/220855601 Constant-Time Convexity Problems on Reconfigurable Meshes. Conference Paper · January 1994 Source: DBLP CITATIONS READS 10 166 4 authors, including: James Schwing Central Washington University 70 PUBLICATIONS 626 CITATIONS SEE PROFILE All content following this page was uploaded by James Schwing on 28 May 2014. The user has requested enhancement of the downloaded file. Constant-Time Convexity Problems on Recon gurable Meshes V. Bokka H. Gurla S. Olariu J. L. Schwing Department of Computer Science Old Dominion University Norfolk, VA 23529-0162 U.S.A. email: [email protected] Abstract The purpose of this paper is to demonstrate that the versatility of the recon gurable mesh can be exploited to devise constant-time algorithms for a number of important computational tasks relevant to robotics, computer graphics, image processing, and computer vision. In all our algorithms, we assume that one or two n-vertex (convex) polygons are ppretiled, p one vertex per processor, onto a recon gurable mesh of size n n. In this setup, we propose constant-time solutions for testing an arbitrary polygon for convexity, solving the point location problem, solving the supporting lines problem, solving the stabbing problem, determining the minimum area/perimeter corner triangle for a convex polygon, determining the k-maximal vertices of a restricted class of convex polygons, constructing the common tangents of two separable convex polygons, deciding whether two convex polygons intersect, answering queries concerning two convex polygons, and computing the smallest distance between the boundaries of two convex polygons. To the best of our knowledge, this is the rst time that O(1) time algorithms to solve dense instances of these problems are proposed on recon gurable meshes. Keywords: recon gurable meshes, convex polygons, supporting lines, computational geometry, robotics, computer graphics, image processing, convexity, query processing, constant-time algorithms Work supported by NASA grant NCC1-99 and by NSF grant CCR-8909996; preliminary versions of this work have appeared in Proc. of Canada{France Conference on Parallel Processing, Montreal, Canada, May 1994 and in Proc. of International Conference on Parallel Processing, St. Charles, Illinois, August 1994. 1 1 Introduction The mesh-connected architecture has emerged as one of the most popular choices for solving a number of computational tasks in image processing, robotics, pattern recognition, computational geometry, and computer vision [2, 18]. This is due, in part, to its simple interconnection topology and to the fact that many problems feature input data that maps naturally onto the mesh. In addition, the mesh topology is particularly well suited for VLSI implementation [5]. At the same time, due to its large communication diameter, the mesh tends to be slow when it comes to handling data transfer operations over long distances. In an attempt to alleviate this problem, mesh-connected machines have been enhanced by the addition of various bus systems. For example, Aggarwal [1] and Bokhari [7] consider meshes augmented with a single global bus. Yet another such system has been adopted by the DAP family of computers [33], and involves reducing the communication diameter of the mesh architecture by the addition of row and column buses. In [35] an abstraction of such a system is referred to as a mesh with multiple broadcasting. A common feature of these bus structures is that they are static in nature, which means that the communication patterns among processors cannot be modi ed during the execution of the algorithm. Typical computer and robot vision tasks, found nowadays in industrial, medical, and military applications, involve digitized images featuring millions of pixels. The large amount of data contained in these images, combined with real-time processing requirements have motivated researchers to consider adding recon gurable features to high-performance computers. Along this line of thought, a number of bus systems whose con guration can change, under program control, have been proposed in the literature. Examples include the bus automaton [40], the recon gurable mesh [26], the mesh with bypass capability [16], the content addressable array processor [52], the recon gurable network [6], the recon gurable bus with shift switching [21], the polymorphic torus [19, 24], and the polymorphic processor array [23, 25]. Among these, the recon gurable mesh has emerged as a very attractive and versatile architecture. The recon gurable mesh combines two desirable features of massively parallel architectures, namely, constant diameter and a dynamically recon gurable bus system. The notion of convexity is fundamental in image processing, computer graphics, pattern recognition, robotics, and computational geometry. In image processing, for example, convexity is a simple and important shape 2 descriptor for objects in the image space [4, 13, 34, 39]. In pattern recognition, convexity appears in clustering, and computing similarities between sets [13]. In robotics, convexity is essential in motion planning where, in the process of building a navigational course for a mobile robot, it is customary to approximate obstacles by convex polygons [17, 22, 50]. In computational morphology, convexity is used as a primary descriptor of the shape of a set of points [12, 42, 49]. In computational geometry, convexity is often a valuable tool in designing ecient algorithms for a number of seemingly unrelated problems [37, 43, 48]. In this work, we are interested in devising simple constant-time algorithms for performing a number of tasks involving planar (convex) polygons. First, given an arbitrary polygon P we determine whether P is convex. Next, we address query-related problems including point location, supporting-lines, and stabbing. Then, we solve two problems involving the computation of the minimal area corner triangle and of determining the kmaximal vertices (if any) of a restricted class of convex polygons. Further, given two convex polygons we address the problems of deciding whether they intersect and that of computing the common tangents of the two polygons, in case they are separable. Finally, we address the problem of computing the minimum distance between the boundaries of the two polygons. These tasks are motivated by, and nd applications to, problems in image processing, computer vision, path planning, VLSI design, and computer graphics [2, 4, 9, 13, 22, 34, 36, 47, 50]. Computational geometry problems are a recurring theme in a large number of contexts in computer science, computer and industrial engineering, statistics, and social sciences. It comes as no surprise, therefore, that these problems have received a great deal of attention [13, 37, 47]. In particular, geometric algorithms on the recon gurable mesh and its variants have been proposed in the literature [8, 20, 15, 27, 28, 30, 31, 32, 51]. For example, a number of workers including Reisis [38], Olariu et al. [29] and Wang and Chen [51] have proposed constant time recon gurable mesh algorithms to compute the convex hull of a set of points in the plane. As pointed out in [27] the algorithm in [38] is not guaranteed to work in all cases. Jang and Prasanna [15] have proposed constant time solutions to the problems of computing all nearest neighbors of a set of points in the plane, 2-dominance counting, and computing the maximal elements in 3-d. Olariu et al. [32] have proposed a number of constant time algorithms for problems involving convex polygons. Speci cally, they show that the tasks of testing an arbitrary polygon for convexity, computing the union and intersection of two 3 convex polygons, testing whether two convex polygons are separable and determining the separating line, solving the polygon containment problem for convex polygons, can all be solved in constant time. Quite recently, Nigam and Sahni [27] have proposed constant time algorithms for the problems of computing the convex hull of a set of points in the plane, smallest enclosing box, ECDF search, and triangulation. Quite recently, [8] have proposes constant time algorithms for a number of other problems including computing the minimum area enclosing triangle and a novel triangulation algorithm. In all these papers however, the input is of size n, while the recon gurable mesh on which the problem is solved is of size n n. By contrast, in all our algorithms we consider the \dense" case, whereby of size n are p p instances being processed on recon gurable meshes of size n n. To the best of our knowledge, this is the rst time that O(1) time algorithms are proposed for these problems in the dense case. The key technique used to solve dense instances of the problems involvingpn-vertex (convex) polygons mentioned above is to extract a sample of size npof the original polygon andpto solve p the problem at hand on the resulting n-vertex polygon on the n n recon gurable mesh available. The resulting \approximate" solution is then p re ned into the desired solution by solving the problem on yet another nvertex polygon. The remainder of this work is organized as follows: Section 2 introduces the computational model used throughout the paper; Section 3 presents a number of preliminaries needed in later sections; Section 4 proposes algorithms to solve the problems mentioned. Speci cally, subsection 4.1 addresses problems involving one convex polygon, while subsection 4.2 discusses problems involving two convex polygons. Finally, Section 5 summarizes the results and poses a number of open problems. 2 The Computational Model The computational model used throughout this work is the recon gurable mesh.1 A recon gurable mesh of size M N consists of MN identical processors positioned on a rectangular array with M rows and N columns. As usual, it is assumed that every processor knows its coordinates within the mesh. We let P (i; j ) denote the processor placed in row i and column j , with P (1; 1) in the north-west corner of the mesh. Every processor P (i; j ) 1 When no confusion is possible a recon gurable mesh will be referred to simply as a mesh. 4 1 2 3 4 5 1 N 2 W E 3 S 4 Figure 1: A recon gurable mesh of size 4 5 is connected to its four neighbors P (i ? 1; j ), P (i + 1; j ), P (i; j ? 1), and P (i; j + 1), provided they exist, and is endowed with 4 ports denoted by N, S, E, and W as illustrated in Figure 1. Local connections between these ports can be established, under program control, creating a powerful bus system that changes dynamically to accommodate various computational needs. Our computational model allows at most two connections to be set in each processor at any one time. Furthermore, these two connections must involve disjoint pairs of ports as demonstrated in Figure 2. It is worth noting that in the absence of local connections, the recon gurable mesh is functionally equivalent to the mesh connected computer. For practical reasons, at any given time, only one processor can broadcast a value onto a bus. Processors, if instructed to do so, read the bus: if no value is being transmitted on the bus, the read operation has no result. We assume that the processors have a constant number of registers of O(log MN ) bits and a very basic instruction set. Each instruction can consist of setting local connections, performing a simple arithmetic or boolean operation, broadcasting a value on a bus, or reading a value from a speci ed bus. More sophisticated operations including oor and modulo computation are speci cally excluded. As it turns out, these operations can, in fact, be added to the repertoire with very little overhead, thus setting the stage for a very powerful computing environment [29]. We assume a SIMD model: 5 1 2 3 4 5 1 2 3 4 Figure 2: Examples of allowed connections in each time unit the same instruction is broadcast to all processors, which execute it and wait for the next instruction. Its low wiring cost and regular structure make the recon gurable mesh suitable for VLSI implementation [19, 24, 25]. In addition, it is not hard to see that the recon gurable mesh can be used as a universal chip capable of simulating any equivalent-area architecture without loss of time. It is worth mentioning that at least three recent VLSI implementations have demonstrated the feasibility and bene ts of the recon gurable mesh: these are YUPPIE chip [19, 24], GCN chip [44, 45], and the PPA [25]. These implementations suggested that the broadcast delay, although not constant, is very small. For example, only 16 machine cycles are required to broadcast on a 106 -processor YUPPIE. The GCN has further shortened the broadcast delay by adopting pre-charged circuits. Recently, it has been shown [41] that the broadcast delay can be reduced even further if the recon gurable bus system is implemented using optical bers as the underlying global bus system and using electrically controlled directional coupler switches for connecting or disconnecting two bers [14]. Due to these new developments, the recon gurable mesh is likely to become commercially available in the near future. Consequently, algorithms developed on this platform will become of 6 practical relevance. 3 Preliminaries Data movement operations constitute the basic building blocks that lay the foundations of many ecient algorithms for parallel machines constructed as an interconnection network of processors. The purpose of this section is to review a number of data movement techniques as well as geometric preliminaries that will be instrumental in the design of our algorithms. Given a sequence b1 ; b2 ; : : : ; bn of n bits, the OR problem asks for computing their logical OR. The OR problem turns out to be a very useful ingredient in a number of di erent contexts. In addition, Miller et al. [26] have proved the following result. Proposition 3.1. An arbitrary instance of size n of the p ORp problem stored one bit per processor in a recon gurable mesh of size n n can be solved in O(1) time. Specifying an n-vertex polygon P in the plane amounts to enumerating its vertices in counterclockwise order as p1 ; p2 ; : : : ; pn (n 3). Here, pi pi+1 (1 i n ? 1) and pnp1 de ne the edges of P . This representation is also known as the vertex representation of P . We note that the vertex representation of a polygon can be easily converted into an edge representation: namely, P is represented by a sequence e1 ; e2 ; : : : ; en of edges, with ei (1 i n ? 1) having pi and pi+1 as its endpoints, and en having pn and p1 as its endpoints. A polygon is termed simple if no two of its non-consecutive edges intersect. Recall that the Jordan Curve Theorem [37] guarantees that a simple polygon partitions the plane into two disjoint regions, the interior (bounded) and the exterior (unbounded), separated by the boundary of the polygon. A simple polygon is convex if its interior is a convex set [37]. An arbitrary polygon (not necessarily simple) P = p1 ; p2 ; : : : ; pn is said to be in standard form if the following conditions are satis ed: p1 is the rightmost vertex with least y-coordinate; all the vertices are distinct; no three consecutive vertices are collinear; the vertices are speci ed in counterclockwise order. 7 The convex hull of a set of planar points is the smallest convex polygon containing the given set. Quite recently, Olariu et al. [31], Wang and Chen [51], and Nigam and Sahni [27] have proposed constant-time algorithms to compute the convex hull of a set of points in the plane. More precisely, they all proved the following result. Proposition 3.2. The convex hull of m points in the plane, stored one item per processor in one row or one column of a recon gurable mesh of size m m can be computed in O(1) time. Upper hull pj +1 pj pi Lower hull pi+1 Figure 3: Illustrating upper and lower hulls Given a convex polygon P = p1 ; p2 ; : : : ; pn , let pi and pj stand for the points of P with the smallest and largest x-coordinate, respectively. It is customary [2, 37] to refer to the chain pi ; pi+1 ; : : : ; pj as the lower hull of P and to the chain pj ; pj +1 ; : : : ; pi as the upper hull as illustrated in Figure 3. Let P = p1 ; p2 ; : : : ; pn be a convex polygon and let q be an arbitrary point outside P . A line qpi is said to be supporting if the interior of P lies in one halfplane determined by qpi . The supporting line of two non-overlapping upper hulls U and V is the unique line with the following properties: (1) is determined by a pair of vertices of U and V , and (2) all the vertices of U and V lie in the same halfplane determined by . Refer to Figure 4 for an illustration. A key ingredient in our algorithms is reducing dense computations pn pton sparse ones. More precisely, given a recon gurable mesh of size p computations involving n items stored in one row or column of the platform will be referred to as sparse. We shall now present a number of simple algorithms whose solution, presented in the sparse context, will turn out to 8 vj d vj+1 vj–1 ui ui–1 V ui+1 U u2 u√n u1 v2 v√n v1 Figure 4: Illustrating the supporting line of two upper hulls be crucial in our algorithms. We begin by presenting the details of a simple routine that nds the supporting line of two upper hulls U = u1 ; u2 ; : : : ; upn and V = v1 ; v2 ; : : : ; vpn that do not overlap in the x direction. A similar algorithm that works in the more restrictive context of pixels in a digitized image has been presented in [26]. Since the approach of [26] is di erent, we now give the details of our algorithm. We assume that the vertices of U and V are sorted by x-coordinate; since U and V are non-overlapping, we may assume without loss of generality that all the vertices of U have smaller x coordinates than those of Vp. To compute p the supporting line we shall use a recon gurable mesh of size n n. We assume that the vertices of V are stored, one p per processor, in the rst row of the mesh such that for every j (1 j n), processor P (1; j ) stores vj . Likewise, the vertices of U are stored, one per processor, in the rst column p with processor P (i; 1) storing ui for all 1 i n. We begin by replicating V in every row of the mesh by broadcasting along vertical buses established in all columns. Similarly, after having created horizontal buses in all rows of the mesh, U is replicated in every column of the platform. As a result of this data movement every processor P (i; j ) p (1 i; j n) stores the pair (ui ; vj ). 9 p Next, every processor P (i; j ) in row i (1 i n) checks whether the hull vertices vj ?1 and vj +1 (provided they exist) lie below the line determined by ui and vj . Clearly, in every row of the mesh, at most two adjacent processors detect this condition. By using suitably constructed horizontal buses, the leftmost processor P (i; j ) detecting the condition above sends vj to P (i; i). In turn, P (i; i) broadcasts the ordered pair (ui ,vj ) vertically, to all the processors in column i of the mesh: recall that these processors store the vertices of the upper hull U . Now every processor in column i checks whether the hull vertex in U it stores lies below the line determined by ui and vj . It is easy to see that ui vj is a supporting line if and only if every processor in column i detects this condition. This amounts to solving a simple instance of the OR problem restricted to column i. Clearly, there exists exactly one such supporting line for the hulls U and V . By Proposition 3.1 the entire computation is performed in O(1) time. Therefore, we state the following result. Lemma 3.3. Consider a recon gurable mesh of size pnp pn and let U and V be two non-overlapping upper hulls of size at most n. The supporting line of U and V can be computed in O(1) time. p Next, given two simple polygons P and Q of n vertices each, we are interested in determining whether P and Q intersect. We assume that P and Q are stored one vertex per processor pin thep rst row and column, respectively, of a recon gurable mesh of size n n. In preparation for solving the task at hand, we convert P and Q to edge form. Trivially, this can be done in O(1) time. After having mandated every processor to connect its ports N and S, we replicate the rst row throughout the mesh. Next, we establish horizontal buses in every row of the mesh. Every processor in the rst column broadcasts the edge it stores horizontally. Any processor that detects an intersection sets up a local ag. It is now an easy task to inform processor P (1; 1) that an intersection was detected. Finally, if no intersection is detected, then we need to test whether P is included in polygon Q by testing one vertex from P for inclusion in Q, or vice versa. This task can be performed in O(1) time as follows. let pi be an arbitrary vertex of P . Draw a horizontal line through pi in the positive x-direction and count the number of intersections of with P . pThis task reduces to counting the number of 1's in a binarypsequence of size n stored p in the rst row of a recon gurable mesh of size n n. Consequently, we have the following result. Lemma 3.4. The task of testing whether two pn-vertex simple polygons, 10 stored one vertex per processor p inpthe rst row and the rst column of a recon gurable mesh of size n n, intersect can be performed in O(1) time. Consider an arbitrary sequence a1 ; a2 ; : : : ; apn stored one p itempper processor in the rst column of a recon gurable mesh of size n n and a sorted sequence b1 ; b2 ; : : : ; bpn stored one item per processor inpthe rst row of the mesh. The goal is to compute for every i (1 i p n) its rank in the second sequence, i.e. the unique integer j (0 j n) such that bj ai bj+1. To handle boundary conditions we augment the second sequence with values b0 = ?1 and bpn+1 = +1. The task at hand can be solved in O(1) time as follows. After having established vertical buses in all columns of the mesh the sequence b1 ; b2 ; : : : ; bpn is replicated in all rows of the platform. Next, having established horizontal buses in all rows of the mesh, every processor P (i; 1), broadcasts ai along the bus in its own row. The unique processor P (i; j ) detecting the desired condition broadcasts j back to P (i; 1). Therefore, we have the following result. Lemma 3.5. The task of computing the rank of every element of an arbitrary sequence a1 ; a2 ; : : : ; apn stored onepitem pper processor in the rst column of a recon gurable mesh of size n n in a sorted sequence b1 ; b2 ; : : : ; bpn stored one item per processor in the rst row of the mesh can be solved in O(1) time. 4 The Algorithms The problems that we address in this paper are stated as follows. CONVEXITY: given an n-vertex polygon, decide whether it is convex. INCLUSION: given an n-vertex convex polygon P and a query point q, does q belong to the interior of P ? SUPPORTING-LINES: given an n-vertex convex polygon P and a query point q, in case q lies outside P , compute the supporting lines from q to P . STABBING: given an n-vertex convex polygon P and a query line , does intersect P ? MINIMAL AREA CORNER TRIANGLE: given an n-vertex convex polygon P in the rst quadrant of a coordinate system, compute the smallest area triangle determined by the x and y axes with a supporting line to P , that contains all the vertices of P . k-MAXIMAL ELEMENT: given an n-vertex special convex polygon P , determine the vertices (if any) of P that are dominated by exactly k vertices 11 of P . INTERSECTION: given two n-vertex convex polygons decide whether they intersect. COMMON-TANGENT: given two separable n-vertex convex polygons determine their common tangents. PRIVATE-POINT: given two n-vertex convex polygons return a point in the plane that belongs to precisely one of them. MIN-DISTANCE: given two n-vertex non-intersecting convex polygons, nd the smallest Euclidian distance between them. 4.1 Problems Involving One Polygon p p Consider a recon gurable mesh of size n n. The input is a polygon P = p1 ; p2 ; : : : ; pn , in standard form, stored in row-major order in the mesh, one vertex per processor. To be more speci c, let ri and ci stand for d pin e p and (i ? 1) mod n +1, respectively. In this notation, for every i (1 i n) vertex pi of P is stored by processor P (ri ; ci ). In preparation for solving CONVEXITY, we point out that the \naive" solution of testing all angles 6 pi?1 pi pi+1 for being at most 2 does not work. Figure 5 illustrates this common misconception. The reader will have no diculty con rming that the polygon featured in Figure 5 has all angles less than 2, yet the polygon is not convex. In fact, the polygon is self-intersecting. Our solution to the CONVEXITY problem relies on the following proposition which is an adaptation of a result in Shamos ([43], page 28). Here, by edge angles we mean the angles determined by the edges of the polygon with the positive direction of the x axis, as illustrated in Figure 6. Proposition 4.1. A polygon P in standard form is convex if and only if its edge angles are monotonic. To check for the condition speci ed in Proposition 4.1, every processor P (ri ; ci ) (1 i n ? 1) computes the edge angle i determined by the vector pi pi+1 and the positive direction of the x axis. By Proposition 4.1, P is a convex polygon if and only if the sequence 1 ; 2 ; : : : ; n is monotonic. The test for monotonicity can be reduced to an instance of the OR problem as follows. By checking the edge angles of its neighbors in the polygon, every processor P (ri ; ci ) (1 i n) determines whether i is local maximum or local minimum. Every processor is mandated to connect its ports N and S, thus creating vertical buses in every column of the mesh. A processor storing vertex pj with j 6= 1 that detects a local maximum or minimum in 12 pi+1 pi pi–1 Figure 5: A non-simple polygon all of whose angles are less than 2 the previous computation removes its N{S connection. Next, every processor that has removed its connection broadcasts a signal northbound. It is easy to con rm that in O(1) time processor P (1; 1) can determine if the polygon is convex by solving a suitable instance of the OR problem. Thus, we have the following result. Theorem 4.2. Consider an arbitrary n-vertex polygon P stored in rowp p major order in one row/column of a recon gurable mesh of size n n. The task of testing P for convexity can be solved in O(1) time. Next, we present a constant time algorithm to solve the INCLUSION problem. As before, consider an n-vertex convex polygon Pp= p1p ; p2 ; : : : ; p n , stored in row-major order in a recon gurable mesh of size n n, and let q be an arbitrary query point in the same plane as P . Begin by broadcasting the coordinates of q to all the processors in the mesh. Upon receiving this information, every processor P (ri ; ci ) determines whether q lies in the positive or negative halfplane determined by the in nite line collinear with the edge pi pi+1 . It is easy to see that q lies in the interior of P if and only if it lies in the positive halfplane of every edge (see Figure 7). This clearly reduces to solving a suitable instance of the OR problem. By Proposition 3.1, the entire computation takes constant time. Thus, we have proved the following result. Theorem 4.3. Let P be an n-vertex pconvexppolygon stored in row-major order in a recon gurable mesh of size n n. Given an arbitrary query 13 q5 p5 q4 q6 p6 p4 q7 q3 p7 p3 q2 p2 q1 p1 x-axis Figure 6: Illustrating edge angles point q in the same plane as P , the task of testing whether q lies in the interior of P can be solved in O(1) time. Our solution to the SUPPORTING-LINES problem proceeds similarly. Given an n-vertex convex polygon P and a query point q as above, we rst determine whether q lies outside of P . By Theorem 4.3 this can be done in O(1) time. Next, we broadcast the coordinates of q to all the processors in the mesh. Every processor P (ri ; ci ) checks whether both pi?1 and pi+1 lie to the same side of the line determined by q and pi. Referring to Figure 8, we note that the processor holding pk nds out that pk?1 and pk+1 are to opposite sides of the line qpk , and so qpk is not a supporting line. By contrast, the processor storing pj detects that the line qpj is a supporting line. Since the polygon is assumed to be in standard form, at most four processors detect that the points they store achieve a supporting line. A simple data movement operation informs processor P (1; 1) in O(1) time of the iden14 ÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉ ÉÉÉÉÉ ÉÉÉÉÉÉÉ ÉÉÉÉÉ c c d d b b q e e a a q q lies outside the polygon since it lies in the negative half plane determined by the edges ea and ab q lies inside the polygon since it lies in the positive half plane of all the edges of the polygon Figure 7: Illustration of the point inclusion problem tity of the supporting lines. Consequently, we have the following result. Theorem 4.4. Let P be an n-vertex pconvexppolygon stored in row-major order in a recon gurable mesh of size n n. Given an arbitrary query point q in the same plane as P , the task of determining the supporting lines to P from q can be solved in O(1) time. We are now in a position to provide a solution to the STABBING problem. We are given an n-vertex convex polygon P and a query line . The problem is to detect whether the query line intersects the polygon. Our solution uses the solutions to INCLUSION and SUPPORTING-LINES problems developed above. Speci cally, after having selected an arbitrary point q on , we proceed to test whether q is interior to P . If so, must intersect P (see Figure 9.a). In case q lie outside of P we nd the supporting lines d1 and d2 to P from q. Finally, we test whether lies in the wedge determined by d1 and d2 (see Figures 9.b and 9.c). By virtue of Theorems 4.3 and 4.4, the whole algorithm runs in constant time. Therefore, we have proved the following result. Theorem 4.5. Let P be an n-vertex pconvexppolygon stored in row-major order in a recon gurable mesh of size n n. Given an arbitrary query line in the same plane as P , the task of testing whether q intersects the 15 pj pj–1 V pj+1 pk+1 pk q pk–1 pn p1 Figure 8: Illustration of the supporting line problem interior of P can be solved in O(1) time. For further reference we now observe that the intersection (if any) of line and polygon P can be determined within the same time complexity. The details of the simple algorithm are omitted. Corollary 4.6. Let P be an n-vertex convex p ppolygon stored in row-major order in a recon gurable mesh of size n n. The line segment corresponding to the intersection of P with a query line in the same plane as P can be computed in O(1) time. Many problems of practical relevance involve nding an object that optimizes a certain objective function while, at the same time, satisfying a number of given constraints. Such problems are commonly referred to as optimization problems. One such optimization problem with a geometric avor that occurs in linear programming and statistics is the MINIMUM AREA CORNER TRIANGLE [10]. The problem is stated as follows: consider a convex polygon P with its n vertices p1 ; p2 ; : : : ; pn , in the north-east quadrant of a coordinate system as illustrated in Figure 10. We are interested in determining a triangle T satisfying the following conditions: (1) every vertex of P belongs to T ; (2) two of the edges of T are collinear with the axes; (3) T has the smallest area among all triangles satisfying (1) and 16 P P q l q q lies inside P, thus l stabs P. l (a) q lies outside P and l lies outside the wedge formed by the supporting lines from q to P, thus it does not stab P. (b) P l q lies outside P and l lies within the wedge formed by the supporting lines from q to P, thus it stabs P. q (c) Figure 9: Illustration of the stabbing problem 17 (2). Y b py P ey pt ex px a X o Figure 10: Illustration of the minimal corner triangle problem Recently Chang [10] has shown that the problem of computing the minimum area/perimeter corner triangle for a set S of n points in the plane can be solved sequentially in O(n log n) time. The key observation of the algorithm in [10] is that the third side of T is a supporting line to the polygon P . Incidentally, this also implies that the third side of T is a supporting line to the convex hull of S . Let P stand for the convex hull of S . For a generic triangle T satisfying conditions (1) and (2) above we write T = aob, with a and b standing for the vertices of T lying on the x and y axis, respectively, and with o standing for the origin of the coordinate system. The line segment ab is said to be balanced if the midpoint m of the segment ab touches P . Failing this, the segment ab is referred to as low or high, depending on whether or not ab \ P am. The terminology above is ported to the triangle T itself. We are now in a position to state the main result in [10]. Proposition 4.7. The minimum area corner triangle is balanced. Moreover, such a triangle can be obtained sequentially in O(n log n) time. In the remainder of this subsection we demonstrate an O(1) time solution to the smallest area corner triangle problem on a recon gurable mesh of size 18 pn pn. A supporting line to P is said to be ush with P if it is collinear with an edge of P . Let e1 ; e2 ; : : : ; en be an enumeration of the edges of P in counterclockwise order. The following technical result [10] will make the O(1) time implementation possible. Here, px and py , are the vertices of P with largest x and y coordinates, respectively. Proposition 4.8. The sequence of ush supporting lines [ex ; : : : ; ey ] of P consists of a sequence of low supporting lines, followed by at most one balanced supporting line, followed by a sequence of high supporting lines. Propositions 4.7 and 4.8 motivate the following algorithmic approach: Step 1. Determine the vertices px and py of P with maximum x and y coordinates, respectively. Step 2. Consider the vertices of P between px; py in counterclockwise order; determine the balanced supporting line (if any) amongst the corresponding edges of P . If such a supporting line exists, return the area of the corresponding triangle. Step 3. If a balanced supporting line is not found, then traversing P counterclockwise retain the last low edge et?1 and the rst high edge et . Let pt be the common vertex of et?1 and et . Return the triangle T whose third edge is the balanced supporting line to P at pt (see Figure 10). The correctness of this simple algorithm being obvious, we now discuss the complexity. Step 1 can also be performed in O(1) time. Converting P to edge form takes O(1) time. Now, a processor holding an edge of P determines the status (low, high, or balanced) of the corresponding edge. Thus, Step 2 runs in O(1) time. Finally, the condition of Step 3 involves a simple algebraic computation that also takes O(1) time. Thus we have the following result. Theorem 4.9. The minimum area corner triangle problem for a n-vertex convex can be solved in O(1) time on a recon gurable mesh of size pn ppolygon n. A perfectly similar approach, whose details are omitted, leads to an O(1) time algorithm for the smallest corner triangle problem with the perimeter as the metric. See [10] for details. For completeness, we state the result here. Theorem 4.10. The minimum perimeter corner triangle problem for a nvertex convex p ppolygon can be solved in O(1) time on a recon gurable mesh of size n n. We say that a point u(xu ; yu ) dominates a point v(xv ; yv ) (u 6= v) whenever xv xu and yv yu . Refer to Figure 11 for an illustration of this concept. A point u is maximal with respect to a set S if u is dominated 19 y6 cs d s a O s vs us bs ws - x .. Figure 11: Illustrating point domination by none of the points in S . For example, the maximal points in Figure 11 are u, w, and c. A point u is said to be k-maximal if there exist exactly k points in S that dominate u. Referring, again, to Figure 11 we note that the points u, w, and c are 0-maximal (they are dominated by no points in the set), v and b are 1-maximal (each of them is dominated by exactly one point), d is 3-maximal, and a is 5-maximal. The problem of computing the k-maximal elements of a planar set of points is a well-known problem in computational geometry [46]. Besides being interesting in its own right, it nds important applications to compaction in VLSI design [36, 37], nite element method, and point-location problems [37], to name a few. An n-vertex convex polygon is termed special if it has an edge, say p1 pn , such that the chain p1 ; p2 ; : : : ; pn is monotone in the x direction and lies in the right half-plane determined by p1 pn . Figure 12 features a special convex polygon. In this work, we address the problem of computing the k-maximal vertices of a special convex polygon. Consider an n-vertex special convex polygon P stored in row-major orp p der, one vertex per processor, in a recon gurable mesh of size n n. As the rst step, determine the extreme vertex s0 = z0 of P in the y-direction, and refer to Figure 12. The vertex s0 partitions the polygon P into two chains Cp and Cq , as shown in the Figure 12. We now state a result that plays a signi cant role in the algorithm. Lemma 4.11. Fix an integer k 1. No special convex polygon contains more than one k-maximal vertex. Proof. For k 1, it is clear that no vertex on the chain Cq is dominated by 20 s0 =z0 z1 s1 Cq Cp s2 z2 pn =sk/√n p1 =zk/√n Figure 12: A special convex polygon any other vertex and thus cannot be k-maximal. Vertices on the chain Cp may be dominated by vertices in their own chain with greater y-coordinate and by vertices in the chain Cq . Note, however, that for any pair of adjacent vertices, pi and pi+1 , enumerated in counterclockwise order on the chain Cp , the number of vertices dominating pi is at least one less than the number of vertices dominating pi+1 . Therefore, at most one vertex on Cp is k-maximal and the conclusion follows. Let pk = (xp ; yp) be the kth vertex on Cp starting from s0 in counterclockwise order, and let qk = (xq ; yq ) be the kth vertex on Cq starting from s0 in clockwise order. It is easy to con rm that any vertex on the chain Cp having a y-coordinate less than max(yp; yq ) is guaranteed to be dominated by more than k vertices in both chains together and, therefore, cannot be 21 k-maximal. Let the vertices s0 ; s1 ; : : : ; s p divide the chain Cp into d pkn e pockets p each of size n except, perhaps, for the last one. From now on, for simplicity we assume that pkn is an integer. Similarly, let z0 ; z1 ; z2 ; : : : ; z p divide the p chain Cq into pkn pockets of size n. Since the polygon P is stored in rowmajor order, we may assume without loss of generality that the vertices si and zj (0 i; j pkn ) are stored by the rightmost processor in every row of the mesh. Partition the set [?p1; +1) into non-overlapping intervals of the type p Ia = [a n ? 1; (a + 1) n ? 1) with a = 0; 1; 2; : : : . Clearly, k must lie in exactly one such interval. Put di erently, there exists a unique integer for which pn ? 1 k < ( + 1)pn ? 1: (1) It is important to note that the value of satisfying (1) can be determined by all the processors in the mesh in O(1) time using the techniques of [29]. For every vertex si (0 i pkn ) on the chain Cp determine the unique value m(si ) for which the y-coordinate of si is greater than the y-coordinate p of zm(s )+1 and less than that of zm(s ) . The intuition is that m(si ) n provides a lower bound on the number p of vertices in the chain Cq that dominate si ; likewise, (m(si ) + 1) n is an upper bound on the number of vertices in the chain Cq that dominate si . Since the sequence z0 ; z1 ; : : : ; z p is sorted, Lemma 3.5 guarantees that this computation can be performed in O(1) time. Further, for every si , let rank(si) denote the number of vertices of the polygon that dominate si. We note that our choice of vertices si guarantees that for every i (1 i pkn ), k n k n i i k n rank(si ) ? rank(si?1 ) and that pn; (2) p p (m(si ) + i) n ? 1 rank(si ) < (m(si ) + i + 1) n ? 1: (3) In other words, (3) tells us that for every i (0 i pkn ) on the chain Cp the number of vertices that dominate si lie in the interval Im(s )+i . As a consequence of (2) and (3), if Im(s )+i = I then no other sj has Im(s )+i = I . This, in turn, implies that the only pockets that contain candidates for the k-maximal vertex are (si?1 ; si ) and (si ; si+1 ). It is also important to note i i j 22 that in O(1) time one can determine the exact value of rank(si ). (To see this, note that the exact value of rank(si) is known as soon as we know the number of vertices in the pocket (zm(s ) ; zm(s )+1 ) that dominate si. Since the sequence of these vertices lies in one row of the mesh and are sorted due to the monotonicity of the polygon, it is easy to see that Lemma 3.5 applies.) As a result, we eliminate one of the pockets (si?1 ; si ) and (si ; si+1 ) from further consideration. On the other hand, if no vertex si satis es Im(s )+i = I then we nd a unique subscript r such that m(sr ) + r < and m(sr+1 ) + r + 1 > . In this case the only candidates for the k-maximal vertex lie in the pocket (sr ; sr+1 ). Furthermore, the computation of the subscript r takes O(1) time. From now on we shall assume, without loss of generality, that the kmaximal vertex (if any), lies in the pocket (sr ; sr+1 ). Enumerate the vertices lying in the pocket (sr ; sr+1 ) as sr = v1 ; v2 ; : : : ; vpn = sr+1 . For each vertex vj determine m(vj ) in O(1) time as described previously. It is not hard to see that the value of rank(vj ) satis es the following double inequality: i i i p p (m(vj ) + r) n + j ? 1 rank(vj ) < (m(vj ) + r + 1) n + j ? 1: (4) From the vertices v1 ; v2 ; : : : ; vpn we retain the vertices vj satisfying p p I \ [(m(vj ) + r) n + j ? 1; (m(vj ) + r + 1) n + j ? 1) 6= ;: (5) Observepthat (4) guarantees that for every vj , rank(vj ) lies in an interval of length n. This, combined with (5) guarantees that for the vertices retained as described above m(vj ) can take on only two values. Put di erently, the exact rank of the retained vertices can be determined by examining vertices in two rows of the mesh (i.e. two pockets). This can be done in O(1) time by an easy variant of Lemma 3.5. We thus have the following result. Theorem 4.12. For any k, the k-maximal vertex of a n-vertex special convex polygon can be determined in O(1) time on a recon gurable mesh of p p size n n. 4.2 Computations Involving Two Polygons We now develop a constant time solution for the COMMON-TANGENT problem. Consider separable convex polygons 2 P = p1 ; p2 ; : : : ; pn and Q = q1 ; q2 ; : : : ; qn, with P and Q stored in row-major order in a recon gurable 2 In this subsection we assume clockwise ordering of the vertices of the polygons 23 p p mesh of size n n. We only show how the upper common tangent is computed, the lower tangent and the \separating" tangents are computed similarly. In the sequel we consider upper hulls only. For convenience we shall continue to refer to them as P and Q. A sample of P is simply a subset of vertices of P enumerated in the same order as those in P . Upper hull edge Edge between sample points Edge in the pocket Ai pu Actual supporting line Ai+1 Supporting line for the samples ai bj ai+1 Ai Bj P Bj+1 Q Ai+2 ai–1 qv bj+1 bj–1 Figure 13: Illustrating Proposition 4.13 To simplify the notation we shall assume without loss of generality that the upper hull of P is (p1 ; p2 ; : : : ; pk ). Consider an arbitrary sample A = (p1 = a0 ; a1 ; : : : ; as = pk ) of P . It is easy to see that the sample A partitions P into s pockets A1 , A2 , : : :, As , such that Ai involves the vertices in P lying between ai?1 and ai (we assume that ai?1 belongs to Ai and that ai does not). Similarly, consider a sample B = (q1 = b0 ; b1 ; : : : ; bt = ql ) of Q. As noted, these two samples determine pockets A1 , A2 , : : :, As and B1 , B2 , : : :, Bt in P and Q, respectively. Referring to Figure 12, let the supporting line of A and B be achieved by ai and bj , and let the supporting line of P 24 and Q be achieved by pu and qv . The following technical result has been established in [3]. Proposition 4.13. (Lemma 1 in [3]) At least one of the following statements is true: (a) pu 2 Ai ; (b) pu 2 Ai+1 ; (c) qv 2 Bj ; (d) qv 2 Bj +1 . The samples A and B will be chosen to contain all the vertices in the last column of the mesh. Speci cally, our assumption about the layout of the two polygons guarantees that the psamples are vertices in the two polygons whose subscripts are a multiple of n. By Lemma 3.3, computing a supporting line for A and B takes O(1) time. As before, let the supporting line of A and B be achieved by ai and bj . Detecting which of the conditions (a){(d) in Proposition 4.13 holds is easy. For example, condition (b) holds only if pu lies to the right of ai and to the left of ai+1 . To check (b), the supporting lines l and l0 from ai and ai+1 to Q are computed in O(1) time using Theorem 4.4. Once these supporting lines are available, the processor holding ai+1 detects in constant time whether the left neighbor of ai+1 in P lies above l0 . Similarly, the processor holding ai checks whether the right neighbor of ai in P lies above l. It is easy to con rm that pu belongs to Ai+1 if and only if both these conditions hold. The other conditions are checked similarly. Suppose, without loss of generality, that (b) holds. Our next task is to compute a supporting line for Ai+1 and Q. This is done in two steps as follows. First, the supporting line between Ai+1 and B is computed. The main point to note is that in order to apply Lemma 3.3, the vertices in pocket Ai+1 have to be moved to one row (or column) of the mesh. Our way of de ning samples guarantees that this task takes O(1) time. Second, convexity guarantees that if the supporting line of Ai+1 and B is not a supporting line for P and Q, then in O(1) time we can determine a pocket Bk such that the supporting line of Ai+1 and Bk is the desired supporting line. (In Figure 12, Bk is Bj +1 .) Therefore, computing the supporting lines of P and Q takes O(1) time. To summarize our ndings, we state the following result. Theorem 4.14. Computing the common tangents of two separable n-vertex convex stored in row-major order in a recon gurable mesh of size pn ppolygons n takes O(1) time. Next, we are interested in devising a simple constant-time algorithm to 25 decide whether two n-vertex convex polygons intersect. To this end, let the convex polygons be P = p1 ; p2 ; : : : ; pn and Q = q1 ; q2 ; : : : ; qnp, withpP and Q stored in row-major order in a recon gurable mesh of size n n. Consider arbitrary samples A = (ppn = a0 ; a1 ; : : : ; ak = pn ) and B = (qpn = b0 ; b1 ; : : : ; bt = qn) of P and Q, respectively, obtained by retaining the vertices in the last column only. Our INTERSECTION algorithm proceeds to determine whether A and B intersect. Notice that A and B are convex polygons. Now Lemma 3.4 guarantees that the previous task can be computed in O(1) time. In case A and B intersect, the answer to INTERSECTION is \yes". a i A +1 i b ?1 j a +1 i B b +1 j j B +1 j b j Figure 14: Illustrating separating tangents Therefore, from now on we shall assume that A and B do not intersect, and so A and B are separable. Now the algorithm detailed in Theorem 4.14 can be used to compute a separating line of A and B . Let the samples A and B partition P and Q into pockets A1 , A2 , : : :, As and B1 , B2 , : : :, Bt , such that Ai (resp. Bi ) involves the vertices in P (resp. Q) lying between 26 ai?1 and ai (resp. bi?1 and bi ). Referring to Figure 14, let the separating line of A and B be achieved by ai and bj , and let the supporting line of P and Q be achieved by pu and qv . To extend the separating line to a separating line of P and Q (if any) we need to establish the following technical result. that of Proposition 4.13. Lemma 4.15. At least one of the following statements is true: (a) pu 2 Ai [ Ai+1 ; (b) qv 2 Bj [ Bj +1 . Proof. If the line is not the separating line of P and Q and it must intersect at least one of these polygons. Convexity guarantees that in case intersects P it will intersect exactly one of the pockets Ai or Ai+1 . Assume, without loss of generality that intersects Ai+1 . Now at least one of (the two) separating tangents joins a vertex in Ai+1 with some vertex in Q. Condition (b) is veri ed similarly. Now proceeding as in the proof of Theorem 4.14 we can either construct a separating line for the two polygons or, failing that, we discover that the two polygons intersect. Consequently, we have the following result. Theorem 4.16. The task of deciding whether two n-vertexpconvex polygons p stored in row-major order in a recon gurable mesh of size n n intersect can be solved in O(1) time. A number of applications in pattern recognition, image processing, facility location, optimization, given two n-vertex convex polygons P and Q ask for points in the plane that belong to either both of the polygons or to precisely one of them. First, as a byproduct of Theorem 4.16, we can determine a point q that lies in both P and Q. As usual, P and Q assumed to be speci ed in standard form, pare pretiled in row-major order onto a recon gurable mesh of size p n n as described in Section 3. To begin compute the samples as in the proof of Theorem 4.16. In case the samples A and B intersect, any one of the points of intersection can play the role of q. Otherwise, the algorithm above yields a point lying on both P and Q. The result can be stated more formally as follows. Theorem 4.17. The task of determining a point q common to two n-vertex convex stored in row-major order in a recon gurable mesh of size pn ppolygons n can be solved in O(1) time. Further, consider the problem PRIVATE-POINT, that is, the problem of returning a point that belongs to precisely one of P or Q. Begin by computing the extreme vertices of P and Q in the x and y direction. Let these points be in counterclockwise order p1 , pi , pj , pk , and q1 , qi0 , qj 0 , qk0 , 27 respectively. It is easy to see that in case p1 and q1 are di erent, the one that does not belong to the other polygon can be returned as the desired point. Therefore, we assume that p1 and q1 coincide. Now the assumption that the polygons are stored in standard form guarantees that we can nd the rst subscript t for which vertices pt and qt are di erent. If such a subscript exists, one of the pt and qt is the desired point. Furthermore the point to return among them is determined by testing inclusion in the opposite polygon. On the other hand, if no such subscript exists, then the two polygons are congruent and no point in the plane satis es the required predicate. Consequently, we have the following result. Theorem 4.18. The task of determining a point q that belongs to exactly one of two n-vertex convex polygons stored in row-major order in a p p recon gurable mesh of size n n can be solved in O(1) time. p1 Tu q1 CP CQ qs Tl pr Figure 15: Illustration of the problem of nding the minimum distance between the boundaries of two convex polygons 28 Next, we consider the MIN-DISTANCE problem. Consider separable convex polygons P = p1 ; p2 ; : : : ; pn and Q = q1 ; q2 ; : : : ; qpn , with P and Q p stored in row-major order in a recon gurable mesh of size n n. We propose to show that in this setup, the task of computing the smallest distance between the boundaries of P and Q can be solved in O(1) time. To make the exposition easier to follow, we assume without loss of generality that the two polygons are separable in the x direction, with P to the left of Q. Referring to Figure 14, let Tu and Tl be the upper and lower common tangent of P and Q. Let Tu touch P and Q at p1 and q1 , respectively, and let Tl touch P and Q at pr and qs. Let CP and CQ be the mutually visible chains in P and Q respectively. In other words, CQ involves vertices q1 ; q2 ; : : : ; qs , while the chain CP involves the vertices p1 ; p2 ; : : : ; pr . The convexity of P and Q implies that to compute the minimum distance between P and Q we only need examine the distance from vertices in CP to CQ . Now a result in [11] guarantees that the distance function of vertices in these chains is unimodal. Speci cally, for every vertex u in CP , the distance to any point v (not necessarily a vertex) of CQ rst decreases and then increases, as v moves from q1 to qs, with the minimum achieved by either a vertex of Q or by the perpendicular projection of u on the boundary of Q. A mirror property holds for vertices in CQ and their distance function to CP . Once the minimum distance is computed for every point in the chains CP and CQ, the minimum distance between the two polygons can be determined in O(1) time by exploiting the convexity of the two polygons. We now present the details of our algorithm. To begin, the upper and lower tangents Tu and Tl are computed in O(1) time by using the algorithm detailed in Theorem 4.14. Once Tu and Tl have been computed, identifying the chains CP and CQ is achieved by a simple broadcasting and marking operation. Consider arbitrary samples A = (p1 = a0 ; a1 ; : : : ; ak = pr ) and B = (q1 = b0 ; b1 ; : : : ; bt = qs ) of CP and CQ , respectively. It is easy to see that the sample A partitions P into k pockets A1 , A2 , : : :, Ak , such that Ai involves the vertices in P lying between ai?1 and ai (we assume that ai?1 belongs to Ai and that ai does not). Similarly, consider a sample B = (q1 = b0 ; b1 ; : : : ; bt = ql ) of Q. As noted, these two samples determine pockets A1 , A2 , : : :, Ak and B1 , B2 , : : :, Bt in P and Q, respectively. We assume that the vertices of sample A are stored in the rst column of the mesh while the vertices in B are stored in the rst row of the mesh. We now show how the minimum distance from a vertex ai in A to B is computed in one row of the mesh. Of course, the same computation is performed, in 29 parallel, in all rows in which P (i; 1) stores a vertex in A. Begin by setting up vertical buses and replicate the contents of the rst row throughout the mesh. Processor P (i; 1) broadcasts ai horizontally to the whole row i. Every processor in row i (1 i n), storing a vertex bj in B computes the distance d(ai ; bj ). Notice that a unique processor P (i; k) detects that d(ai ; bk ) < d(ai ; bk?1 ) and that d(ai ; bk ) d(ai ; bk+1 ). In addition, this processor computes the intersection points of each of the edges bk?1 bk and bk bk+1 with the perpendiculars from ai to these two edges. If one of these points is interior to one of the edges bk?1 bk or bk bk+1 , then P (i; k) reports the corresponding perpendicular distance back to P (i; 1). Otherwise, P (i; k) reports d(ai ; bk ). Now every processor in the rst column of the mesh that contains a vertex in A compares the minimum distance achieved by its own vertex with the minimum distances achieved by the vertices stored by its two neighbors. Convexity guarantees that exactly one of them will detect the minimum distance. Now an argument similar to Lemma 2 in [3] guarantees that to compute the minimum distance between CP and CQ we can restrict our attention to one of the pockets adjacent to ai and bj . The previous steps are then repeated at most four times, thus obtaining the minimum distance between CP and CQ . To summarize our ndings we state the following result. Theorem 4.19. The MIN-DISTANCE problem involving two separable n-vertex polygons stored in row major order in a recon gurable mesh of size p p n n can be solved in O(1) time. 5 Conclusions and Open Problems In an attempt to reduce their communication diameter, mesh-connected computers have recently been augmented by the addition of various types of bus systems. One of the most interesting such systems, referred to as recon gurable mesh involves augmenting the basic mesh-connected computer by the addition of a dynamically recon gurable bus system. In this paper, we have demonstrated that the versatility of the recongurable mesh can be exploited for the purpose of devising constant time algorithms for a number of important computational geometry tasks relevant to image processing, computer graphics, and computer vision. In all our algorithms we assumed that one or two n-vertex (convex) polygons are pretiled, one vertex per processor, onto a recon gurable mesh of size 30 pn pn. In this setup, we proposed constant-time solutions for testing an arbitrary polygon for convexity, solving the point location problem, solving the supporting lines problems, solving the stabbing problem, determining the minimal area/perimeter corner triangle, determining all the k-maximal vertices of a special class of convex polygons, constructing the common tangents for separable convex polygons, deciding whether two convex polygons intersect, and computing the smallest distance between the boundaries of two convex polygons. To the best of our knowledge this is the rst time that O(1) time algorithms are proposed for these problems on this architecture in the \dense" case. A number of problems seem to be harder. For example, we do not know how to compute the diameter, width, and modality of an n-vertex convex polygon in spite of the fact that there are (n) sequential solutions for these problems. Next, we don't know how to determine the largest inscribed triangle in a given convex polygon. There exists a well-known (n) time sequential algorithm for this latter problem, but it does not seem to be parallelizable to run in O(1) time. Next, it would be of interest to solve the symmetric problems of computing the smallest-area enclosing triangle as well as the largest enscribed circle and rectangle. A very important problem that we cannot solve in O(1) time is that of computing the Voronoi diagram of a convex polygon. It is well-known that an O(n) time sequential solution exists [37]. Since Voronoi diagrams are very powerful tools for solving proximity problems and motion planning problems, an optimal solution to the Voronoi diagram problem will lead to optimal solution to many other problems. Recently, Olariu et al. [31] have proposed an ecient algorithm p topcompute the sum of all the entries of a binary matrix of size n n in O(log log n) time. It is easy to see that the same algorithm applies, within the same time complexity, to geometric problems in which the computation results in a binary value being stored at each processor. For example, the point location problem in a simple polygon falls into this category. It would be interesting to see whether the point location problem for a simple polygon can be solved faster. In a number of contexts in digital geometry, computer graphics and image processing, one is interested in special classes of (convex) polygons, namely polygons all of whose vertices have integer coordinates. The result in [31] yields an immediate O(log log n) algorithm for the problem of determining the number of integer-coordinate points lying inside an n-vertex such p p polygon stored in row major order in a recon gurable mesh of size n n. 31 Yet another intriguing problem with applications to facility location and interpolation involves solving queries of the following type: given a convex polygon and a query point in the plane, determine the vertex of the polygon that lies closest to the query point. It is not hard to see that this problem can be solved in O(log log n) time, using the technique of [31]. Is it possible to obtain an O(1) time algorithm for these problems? Acknowledgement: The authors are indebted to Professor Prasanna and to three anonymous referees for many constructive comments. We wish to thank Professor Sahni for his timely and professional handling of our submission. References [1] A. Aggarwal, Optimal bounds for nding maximum on array of processors with k global buses, IEEE Transactions on Computers, C-35, (1986), 62{64. [2] S. G. Akl and K. A. Lyons, Parallel computational geometry, PrenticeHall, Englewood Cli s, New Jersey, 1989. [3] M. J. Atallah and M. T. Goodrich, Parallel algorithms for some functions of two convex polygons, Algorithmica 3, (1988), 535{548. [4] D. H. Ballard and C. M. Brown, Computer vision, Prentice-Hall, Englewood Cli s, New Jersey, 1982. [5] K. E. Batcher, Design of massively parallel processor, IEEE Transactions on Computers, C-29, (1980), 836{840. [6] Y. Ben-Asher, D. Peleg, R. Ramaswani, and A. Schuster, The power of recon guration, Journal of Parallel and Distributed Computing, 13, (1991), 139{153. [7] S. H. Bokhari, Finding maximum on an array processor with a global bus, IEEE Transactions on Computers C-33, (1984), 133{139. [8] V. Bokka, H. Gurla, R. Lin, S. Olariu, J. L. Schwing, and J. Zhang, Constant-time algorithms for point sets on recon gurable meshes, Proc. IEEE Workshop on Recon gurable Architectures, Cancun, Mexico, April 1994. 32 [9] R. Cahn, R. Poulsen, and G. Toussaint, Segmentation of cervical cell images, Journal of Histochemistry and Cytochemistry, 25, (1977), 681{ 688. [10] J.-S. Chang, Polygon optimization problems, New York University, Courant Institute of Mathematical Sciences, Technical Report No. 240, August 1986. [11] F. Chin and C. A. Wang, Optimal algorithms for the minimum distance between two separated convex polygons, University of Alberta, Tech. Report, January 1983. [12] E. R. Dougherty, An introduction to morphological image processing, SPIE Optical Engineering Press, Bellingham, WA, 1992. [13] R. O. Duda and P. E. Hart, Pattern classi cation and scene analysis, Wiley and Sons, New York, 1973. [14] D. G. Feitelson, Optical computing, MIT Press, Cambridge, Massachusetts, 1988. [15] J. Jang and V. Prasanna, Parallel geometric problems on the recon gurable mesh, Proc. of the International Conference of Parallel Processing, St. Charles, Illinois, III, 1992, 127{130. [16] D. Kim and K. Hwang, Mesh-connected array processors with bypass capability for signal/image processing, Proceedings of the HICSS, 1988. [17] J.-P. Laumond, Obstacle growing in a non-polygonal world, Information Processing Letters, 25, (1987), 41{50. [18] F. Thomson Leighton, Introduction to parallel algorithms and architectures: arrays, trees, hypercubes, Morgan Kaufmann Publishers, San Mateo, California, 1992. [19] H. Li and M. Maresca, Polymorphic-torus network, IEEE Transactions on Computers, 38, (1989), 1345{1351. [20] H. Li and Q. F. Stout, Eds, Recon gurable massively parallel computers, Prentice-Hall, Englewood Cli s, New Jersey, 1991. [21] R. Lin and S. Olariu, Recon gurable buses with shift switching { concepts and applications, IEEE Transactions on Parallel and Distributed Systems, to appear 1994. 33 [22] T. Lozano-Perez, Spatial planning: a con gurational space approach, IEEE Transactions on Computers, 32, (1983), 108{119. [23] M. Maresca, Polymorphic processor arrays, IEEE Transactions on Parallel and Distributed Systems, 4, (1993), 490{506. [24] M. Maresca and H. Li, Connection autonomy and SIMD computers: a VLSI implementation, Journal of Parallel and Distributed Computing, 7, (1989), 302{320. [25] M. Maresca, H. Li, and P. Baglietto, Hardware support for fast recon gurability in processor arrays, Proc. International Conference on Parallel Processing, St. Charles, Illinois, I, 1993, 282{289. [26] R. Miller, V. K. P. Kumar, D. Reisis, and Q. F. Stout, Parallel computations on recon gurable meshes, IEEE Transactions on Computers, C-42, (1993), 678{692. [27] M. Nigam and S. Sahni, Computational geometry on a recon gurable mesh, Proc. 8th International Parallel Processing Symposium, Cancun, Mexico, April 1994, 86{93. [28] M. Nigam and S. Sahni, Triangulation on a recon gurable mesh with buses, Proc. International Conference on Parallel Processing, St. Charles, Illinois, August 1994, III, 251{257. [29] S. Olariu, J. L. Schwing, and J. Zhang, Fundamental data movement for recon gurable meshes, Proc. of the International Phoenix Conf. on Computers and Communications, Scottsdale, Arizona, April 1992, 472{ 480. [30] S. Olariu, J. L. Schwing, and J. Zhang, Time-optimal convex hull algorithms on enhanced meshes, BIT, 33, (1993), 396{410. [31] S. Olariu, J. L. Schwing, and J. Zhang, Fast computer vision algorithms on recon gurable meshes, Image and Vision Computing Journal, 10, (1992), 610{616. [32] S. Olariu, J. L. Schwing, and J. Zhang, Constant time computational geometry on recon gurable meshes, SPIE Conference on Vision Geometry, Boston, November 1992, SPIE Vol. 1832, 111{121. 34 [33] D. Parkinson, D. J. Hunt, and K. S. MacQueen, The AMT DAP 500, 33rd IEEE Comp. Soc. International Conf., 1988, 196{199. [34] T. Pavlidis, Computer graphics, Computer Science Press, Potomac, MD, 1978. [35] V. K. Prasanna and C. S. Raghavendra, Array processor with multiple broadcasting, Journal of Parallel and Distributed Computing, 2, (1987), 173-190. [36] B. Preas and M. Lorenzetti, Eds., Physical design and automation of VLSI systems, Benjamin/Cummings, Menlo Park, California, 1988. [37] F. P. Preparata and M.I. Shamos, Computational geometry: an introduction, Springer-Verlag, Berlin, 1985. [38] D.I. Reisis, An ecient convex hull computation on the recon gurable mesh, Proc. International Parallel Processing Symposium, 1992, 142{ 145. [39] A. Rosenfeld and A. Kak, Digital picture processing, Academic Press, New York, 1982. [40] J. Rothstein, Bus automata, brains, and mental models, IEEE Transactions on Systems Man, and Cybernetics 18, (1988), 522{531. [41] A. Schuster and Y. Ben-Asher, Algorithms and optic implementation for recon gurable networks, Proc. of the 5th Jerusalem Conference on Information Technology, October 1990. [42] J. Serra, Image analysis and mathematical morphology, Academic Press, New York, 1982. [43] M. I. Shamos, Computational geometry, Doctoral Dissertation, Yale University, 1979. [44] D. B. Shu, L. W. Chow, and J. G. Nash, A content addressable, bit serial associate processor, Proceedings of the IEEE Workshop on VLSI Signal Processing, Monterey, California, November 1988. [45] D. B. Shu and J. G. Nash, The gated interconnection network for dynamic programming, S. K. Tewsburg et al. (Eds.), Concurrent Computations, Plenum Publishing, 1988. 35 [46] I. Stojmenovic and M. Miyakawa, An optimal parallel algorithm for solving the maximal elements problem in the plane, Parallel Computing, 7, (1988), 249{251. [47] G. T. Toussaint, Movable separability of sets, in G.T. Toussaint ed., Computational Geometry, Elsevier Science Publishers, North-Holland, Amsterdam, 1985. [48] G. T. Toussaint Ed., Computational geometry, Elsevier Science Publishers, North-Holland, Amsterdam, 1985. [49] G. T. Toussaint, Computational morphology, North-Holland, Amsterdam, 1988. [50] D. Vernon, Machine vision, automated visual inspection and robot vision, Prentice-Hall, Englewood Cli s, New Jersey, 1991. [51] B. F. Wang and G. H. Chen, Sorting and computing convex hulls on processor arrays with recon gurable bus systems, Information Sciences, to appear 1994. [52] C. C. Weems, S. P. Levitan, A. R. Hanson, E. M. Riseman, J. G. Nash, and D. B. Sheu, The image understanding architecture, International Journal of Computer Vision, 2, (1989), 251{282. 36 View publication stats