Pattern RecognitionLetters 14 (1993) 747-748 North-Holland
September 1993
PATREC 1164
A unimodal counterexample to a diameter algorithm Nikos Tsikopoulos Athens Universityof Economics. Athens, Greece Received 13 April 1993
Abstract Tsikopoulos, N., A unimodai counte~example to a diameter algorithm, Pattern Recognition Letters 14 (1993) 747-748. Dobkin and Snyder [ 1] proposed an algorithm for finding the diameter of a convex polygon. Avis et al. [2,3] constructed convex polygons for which this algorithm fails to deliver the diameter. Nevertheless, the algorithm works correctly for polygons which are both convex and unimodal [4 ]. We now show that the algorithm also fails for polygons which are just unimodal.
Introduction A real function ./'defined on the integers 1, 2, ..., n is said to be t~.;~.~'-':~clalif there exist two integers J, j where 1 < J ~
tain area and distance functions in convex polygons - a property on which the method of Dobkin and Snyder depends - does not hold for distances between vertices. This observation led them into constructing convex polygons for which this algorithm fails to deliver the diameter [2,3]. Nevertheless, the algorithm works correctly for polygons which are both convex and unimodal [4]. Hence, it is interesting to know whether it works for polygons which are just unimodal. To this question we give a negative answer by constructing a counterexample.
d#(j)de=fd(p~,pj), j = i , i+ l .... , i - l, i , is a unimodal function for every vertex p~ of P. Dobkin and Snyder [ I ] proposed a general algorithm for finding the maximum area k-gon which is inscribed in a convex polygon. For the case k = 2 the problem reduces into finding the diameter of the polygon. As observed by Avis, Toussaint and Bhattacharya [ 2 ], the 'unimodality' property for cer-
Correspondence to: N. Tsikopoulos, Athens University of Economics, Athens,Greece. ElsevierSciencePublishers B.V.
-
The algorithm For completeness in the presentation we reproduce the algorithm here. Input. Unimodal polygon P = {Pi, P2, ..., pn }. Output. Vertices A, B of the diameter. All additions are performed modulo n. begin A:=Pl; B:=P2; a:= 1 ; b:=2; 1. whiled(pa, pb)<~d(pa, Pb+m) d o b ' = b + 1; 747
Volume !4. Number 9
PA'lq'ERN RECOGNITION LETTERS
Proof
ifd(A, B )
By following the lines of the construction simplicity becomes obvious. Unimodality may be questioned only at vertex p~. Note though that p~ p2 < p~ P4 and p~ Pz =P~ P~, hence
if a = b then b := b + I ;
if a # 1 then go to 1, end.
PIP2 =PIP3
The ¢ounterexample The polygon we shall construct contains 6 vertices. Let Ps, P~ be distinct points. Let P4, Ps lie on the perpendicular to the midpoint m ofthe segment PsP6, on the same side ofpsp~, so that p4ps>~psp~
and
September 1993
which implies unimodality at p~. By construction we have that PsP2 and P6P3 are the only candidates for the diameter. On the other hand PsP2 =PsPl +PIP2 =P6Pl +PIP2 =p6pi +PIP3 > PbP3
P~P4>P4P6.
Let p2 be a point which lies on the extension of the line through PsP~ beyond p~ and such that
hence PsP2 is the diameter. To prove that the algorithm will fail to record it we only need to prove P4P3 > P4p2 ,
PlP~
Let finally C~ be the circle centered at pt and having radius P~P2, and let P3 be a point which belongs to that arc of C~ which is delimited by the extensions of the lines through mp~ and P6Pt beyond p~, The polygon P= {p~, P2, PJ, P~, Ps, P6 } is simple, unimodal, and the algorithm fails to deliver the diameter when initiated at p~ (see Figure I ).
( 1)
Note that the algorithm starts by finding the candidate P~P6, passingps; so ( 1 ) would imply that when - during execution- the index a advances from P4 to Ps, the index b has already skipped P2 and sopsp2 will never be examined. Let x be the point where C~ intersects with mp~ beyond p~, that is, PtP~ =p~x. Consider the circle C4 which has center P4 and radius P4P2. We have P4P2
.
Therefore x is exterior to C4 and so is p~ which also lies on the arc of C'~, between the intersection points of C~ and C'4, outside C4. Hence ( 1 ) holds true, When the algorithm starts at vertex pj the following pairs of vertices are recorded as candidates: (Pl, P6 ), (P2, P6 ), (PJ, P6 ), (P4, P3 ), (Ps, P~ ). The pair (Ps, P2) which constitutes the diameter is bypassed and the algorithm fails.
References
\
/J \
J
/
[ I ] Dobkin, D.P. and L. Snyder (1979). On a general method for maximizing and minimizingamong certain geometric problems. Proc. 20th Annual 5"ymposium on Foundationsof Compuwr Science: San Juan, Puerto Rico, Oct. i 979, 9-17. [ 2 ] Avis,D., G. Toussaintand B. Bhattacharya ( 1982). On the multimodality of distances in convex polygons. Comput.Math. Appl. 8 (2), 153- ! 56. [31 Bhattacharya, B. and G. Toussaint (1982). A countcrcxampleto a diameteralgorithmfor convexpolygons. IEEE Trans. Pattern Anal. Machine lntell, 4 ( 3 ).
Figure I. 748
[4] Toussaint, G. (1984). Complexity, convexity, and unimodality. Internal. J, Comput. Inform. Sci. 13 (3).