On computing the closest boundary point on the convex hull

4
Information Processing Letters 31(1989) 311-314 North-Holland 19 June 1989 ON COMRWIING THE -SEST BOUNDARY POINT ON THE Cohiw~~ HULL Alok AGGARWAL IBM Research Diuision, Thomas J. Watmn Center, P.O. Box 214 Yorktown Heights, NY 105’9& U.S.A. Michael HAWRYLYCZ Demment of Applied Mathematics, Mcssachussetts Institute of Technology, Cambridge, MA 02139, U.S.A. Communicated by David Gries Received 11 January 1889 We observe a somewhat surpisiq result: Given a set S of n points in 1F2 and a point q B S, 6(n) time is sufficient to determine a point on the convex hull, CH(S), that is nearest to q when q is exterior to CH(S). However, if q lies in the interior of CH(S), then 9(n log n) time is both mcesswy and sufficient to determine such a point. We also observe that e(n) time suffices to de-e whether or not the point q lies inside U?(S). Keywords: Closest, boundary point, -vex hull, geometric algorithms, optimal bounds Let S be a set of n points in the E2 and q a point not in S. Suppose that q is known to be exterior to the convex hull CH(S) of S. We claim that e(n) time is sufficient to find a point on CH(S) which is closest to q. The desired point, of course, need not be an extreme point of S and can lie on an edge of CH(S). This point will be called the closest boun&uy point to q. Propo&i~ 1. If q B S is exterior to CH( S), then the closest boun&ry point to q can be found in 9(n) time. Fmof. (Lower Bound): Let S = xi 2 0 be a set of strictly positive real numbers. Form the set A = ((xi, 0)) of points in E2. The origin 0 lies exterior to CH(S). Ry choosing q = 0 it is easy to see that Ending a closest boundary point to q b e@valent to finding the minimum value of the. set S which requires O(n) time. Although t&s construction gives a degenerate convex polygon, it can be read- ily converted into a nondegenerate convex poly- gon if desired. * ‘(Upper Bound): We now show that the closest boundary point to q can be found in O(n) be. Kirkpatrick and Seidel[3] have shown that, given a set S and a line L that partitions S into S’ and S” where ] S’ 1, ] S” ] 3 1, the prune-and-search technique can be used to determine the two “bridges” that connect CH(S’) and CH(S”) in 0( IS I) be. Furthermore, the same technique can be used to find whether or not a given point of S is an extreme point of CH(S). Consequently, in O(n) time, we first find the closest point to q among the given set S. Let this point be denoted by p. Next, using Kirkpatrick and !95del’s tech- nique, we check if p is an extreme point in O( ]S 1) time. If p is an extreme point, then either p is closest to q or the point that is closest to q lies on one of the two hull-edges to which p belongs. Now, both the hull edges incident on p can be readily Determined in linear time. Furthermore, given an edge, the point that lies on this edge and that is closest to q can be determined in constant 0020-0190/89/S3.50 Q 1989, Elsevier science Publishers B.V. (North-Holland) 311

Transcript of On computing the closest boundary point on the convex hull

Page 1: On computing the closest boundary point on the convex hull

Information Processing Letters 31(1989) 311-314 North-Holland

19 June 1989

ON COMRWIING THE -SEST BOUNDARY POINT ON THE Cohiw~~ HULL

Alok AGGARWAL IBM Research Diuision, Thomas J. Watmn Center, P.O. Box 214 Yorktown Heights, NY 105’9& U.S.A.

Michael HAWRYLYCZ Demment of Applied Mathematics, Mcssachussetts Institute of Technology, Cambridge, MA 02139, U.S.A.

Communicated by David Gries Received 11 January 1889

We observe a somewhat surpisiq result: Given a set S of n points in 1F2 and a point q B S, 6(n) time is sufficient to determine a point on the convex hull, CH(S), that is nearest to q when q is exterior to CH(S). However, if q lies in the interior of CH(S), then 9(n log n) time is both mcesswy and sufficient to determine such a point. We also observe that e(n) time suffices to de-e whether or not the point q lies inside U?(S).

Keywords: Closest, boundary point, -vex hull, geometric algorithms, optimal bounds

Let S be a set of n points in the E2 and q a point not in S. Suppose that q is known to be exterior to the convex hull CH(S) of S. We claim that e(n) time is sufficient to find a point on CH(S) which is closest to q. The desired point, of course, need not be an extreme point of S and can lie on an edge of CH(S). This point will be called the closest boun&uy point to q.

Propo&i~ 1. If q B S is exterior to CH( S), then the closest boun&ry point to q can be found in 9(n) time.

Fmof. (Lower Bound): Let S = xi 2 0 be a set of strictly positive real numbers. Form the set A = ((xi, 0)) of points in E2. The origin 0 lies exterior to CH(S). Ry choosing q = 0 it is easy to see that Ending a closest boundary point to q b e@valent to finding the minimum value of the. set S which requires O(n) time. Although t&s construction gives a degenerate convex polygon, it can be read-

ily converted into a nondegenerate convex poly- gon if desired. *

‘(Upper Bound): We now show that the closest boundary point to q can be found in O(n) be. Kirkpatrick and Seidel[3] have shown that, given a set S and a line L that partitions S into S’ and S” where ] S’ 1, ] S” ] 3 1, the prune-and-search technique can be used to determine the two “bridges” that connect CH(S’) and CH(S”) in 0( IS I) be. Furthermore, the same technique can be used to find whether or not a given point of S is an extreme point of CH(S). Consequently, in O(n) time, we first find the closest point to q among the given set S. Let this point be denoted by p. Next, using Kirkpatrick and !95del’s tech- nique, we check if p is an extreme point in O( ] S 1) time. If p is an extreme point, then either p is closest to q or the point that is closest to q lies on one of the two hull-edges to which p belongs. Now, both the hull edges incident on p can be readily Determined in linear time. Furthermore, given an edge, the point that lies on this edge and that is closest to q can be determined in constant

0020-0190/89/S3.50 Q 1989, Elsevier science Publishers B.V. (North-Holland) 311

Page 2: On computing the closest boundary point on the convex hull

Volume 31,Numb 6 INFORMATIONPROCESSINGLETT=RS 19Junel989

Fig. 1. The closest point to q must lie on bridge B.

time; this proves Proposition 1. On the other hand, if p lies inside the convex hull, then observe that the line z partitions S into two sets S’ and S” such that 1 S’ I,1 S” 1 >, 1. Hence, by using [3],

fmd the bridge B (i.e., a line segment) that prop- erly inter~2s the edge Fq, in O(n) time (see Fig.

1). We claim that the point on CH(S) that is

closest to q must lie on the bridge B. First, note that the bridge B separates all points of S from q as shown in Fig. 1. If not, there would be an extreme point other than s1 and s2 to the left of B contradicting the fact that B is a bridge. Suppose now that the closest point of CH(S) is c’B B and that c“ lies on edge e of CH(S). Then F does not intersect B and 3 is orthogonal to edge e. (If it were not orthogonal to e then by moving c’ along e we can cbtain a closer boundary point.) Without loss of generality, assume that q is closer to si than to s2. It follows that the exterior angle 9 from q ts s1 would be greater than 90 degrees, and that the distance d(q, sl) would be greater than the distance d(q, c’). But then the distance from q to any point on the line containing the edge e must be greater than d(q, c’). In particu- lar, the distance from q to the intersection of line @ with the line containing the edge e would be greater than d(q, 0. Hem=, d(q, p)’ d(q, ~1)

which is a contradiction. It follows that the ciosest point on CH(S) lies on B and, hens, can be determined in O(n) time. CI

If the point q is kx10w11 to lie in the interior of CH(S) theme the closest boundary point cannot

always be found in linear time and we have the following proposition.

Propositiora 2. If q 4 S is interior to CH( S), then finding the boundary point that is closest to q re- quires Q( n log n) t&e in the algebraic decision tree model.

Proof. (Upper Bound ): Since CH(S) for a set S of n points can be found in 8(rp log n) time, the boundary point that is closest to q may be easily computed from CH(S) by computing in linear time the minimum distance from q to each edge of CH( S).

(Lower Bound): Given n points (x,, yl), . . . , (x,, u,) on the first quadrant of the unit circle, the MAX-GAP-• N-A-G problem requires the determination of the maximum straight line dis- tance between neighboring points on the circle. Lee -and Wu [4] have shown that solving the MAX-GAP-ON-A-CIRCLE problem requires 8( n log n) time in the algebraic computation tree mod& To show that n(n log n) time is required for finding the closest boundary point, we give the following reduction from the IMAX-GAP-ON-A=

CIRCLE problem. Givenaninstanceofthe IMAX-GAP-ON-A-CIRCLE

problem, in linear time, compute the points that subtend. the smallest and the largest angles at the origin; denote these points by (x~, y,& and

&ax9 y_) respectively. (To determine such points, we can simply compare the sines of the angles subtended at the origin rather than com- paring the angles themselves. Since the sine of the angle subtended by a point (x, y) is simply y/(x2 +y2)i j2, the operations used in finding these points are those allowed in the algebraic computa- tion tree model.) Next, compute lines that are tangential to the unit circle and that contain (J%@ yti) and (x-, y-); caU these lines I, and 12, respectively. Finally, compute three points pl, p2, and p3 such that p1 denotes the point that lies on !i and kas the y-coordinate equal to -1, p2 denotes the point that lies on I, and has the x-coordinate equal to -1, and p3 denotes the point (-1, -1) (see Fig. 2). [A simple analysis shows that pl, p2, and ps can be computed in

312

Page 3: On computing the closest boundary point on the convex hull

Volume 31, Number 6 INFORMATION I’ROCESSING LETI’ERS 19 June 1989

Fis 2. Reduction from the MAX-GAP-ON-A-CIRCLE problem.

Let the point q be the center of the unit ,&cle and let pl, pz, p3 and the n given points foraa, the @$t !Qf in@& @I$&& for t,& cdG&c& ____*&rj l-E%.& L~~%?dn _- &&- lem. CGarly~ all these n + 3 points lie 07~ C&ir convex hull. Now, suppose the pair of g&&s (xik_,p Yk, ,h (%ik* Yi,) occur next to each C&X on the boundary of the unit circle and suppose this is also true for the pair (Xi,_,, r,_,), (Xi,, yi,). Then, a simple analysis shows that the gap be- tween the first pair is larger than that between the second pair if and only if then the distance from the origin to the line segment defined by the first pair is smaller than the distance from the origin to the line segment defined by the second pair. Con- sequently, if an algorithm returns some point p as the closest boundary point, then, using Kirkpatrick and S&el’s linear time algorithm, we can find the extreme vertiw of the segment on which p lies, and this yields the required maximum gap* Fi- nally, since the complexity of the MMC-GAP-ON-A- CYRCLE problem i? Sl(n log n) in the algebraic computation tree model, the same also holds for the closest boundary problem. 0

Finally, we can determine whether or not a point is interior or exterior to the convex hull srf P set of points in linear time. A similar observation has also been made in [2].

proposition 3. Given a point q and a set S in EZ, we can decide whether or not q is interior to CH(S) in linear time.

RIM& We may determine if q is interior to CH(S) by constructing a vertical line I through q and by checking if S lies entirely to one side of 1. If S lies on one side of I, then q lies in the exterior and Proposition 3 holds trivially. Otherwise, we use the technique given by Kirkpatrick md Seidel [3] to find the upper and lower bridges B, and Bt of S. These bridges are two edges of the convex hull with hig%zst and lowest y-coordinates respec- tively, such tit one point on each bridge lies on each side of J. Using [3], B,, and Bb can be constructed in O(n) time. Now if q lks between B,, and B4, then q lies inside CH(S); otherwise, it lies outside CH(S). 0

24 I?inal remarks

i’t is interesting to note that the time required to find the closest boundary point from a point q to a b$t S depends on whether q lies interior or exterior to CH(S). The two problems seem quite similar and one would have expected the same time complexity independent of the location of q. We conjecture that finding the closest extreme vertex to a given point q takes e(n log n) time,

irrespective of the location of q.

Acknowledgment

The authors wish to thank Kenneth Berman, Daniel Kleitman, and Prasoon Tiwari for helpful conversations. The authors are particularly thank- ful to one of the referees for pointing out a fallacy in an earlier version of this paper.

References

[l] M.E. Dyer, Linear time algorithm for two- ad th!!+aria- ble linear p-m, SIAM J. Cornput. 13 (1984) 31-45.

[2] M. Kallay, Convex hull made easy, hfom process. Ldt. 22 (1986) 161.

313

Page 4: On computing the closest boundary point on the convex hull

Volume 31, Number 6 INFORMATION PROCESSING LETI’ERS 19 June 1989

[3] D.G. Kirkpatrick and R Seidel, The ultimate planar con- vex hull algorithm?, SIAM J. Comput. IS (1986) 287-299.

[4] D.T. Lee and Y.F. Wu, Geometric complexity of some location problems, Algorithmicu l(l986) 193-212.

[5] N. Megiddo, Linear time algorithm for linear programming in 3-dimensions and related problems, SIAM J. Comprit. 12 (1983) 759-776.

314