Patterll Rccoqnilio~i Vol 16, No 6. pp 587 592. 19b,3 Printed m Great Britain 1~131 32(3 8~ S:~01 -, 00 Pergamon Press Lid ,c 1983 Pat'tcrn Recognition S,Jciet3 A LINEAR TIME ALGORITHM FOR OBTAINING THE CONVEX HULL OF A SIMPLE POLYGON S. K. GHosrt Speech and Digital Systems Group, Tata Institute of Fundamental Research, Bombay 400 005, India and R. K. SH'~ AMAY, t!NI)AR* National Centre for Software Development and Computing Techniques, Tara Institute of Fundamental Research, Bombay 400 005, India (Received 23 April 1982; in revised form 22 April 1983; received for publication 16 May 1983) Abstract--In this paper, a linear time algorithm is described for finding the convex hull of a simple (i.e. non- self intersecting) polygon. Convex hull algorithm Computational complexity Simple polygon Convex polygon Ordered crossing polygon I. INTRODUCTION The convex hull of a finite set is defined as the minimum area convex set containing the original set. It has been shown that the complexity of finding the convex hull of a set of points (given by their coord- inates) is 007 log ~1). ~ This paper is concerned with the problem of finding the convex hull of a polygon P = (Pl, P2..... p,,), i.e. a list ofvertices in order along with their Cartesian coordinates, with the restriction that no two non-adjacent edges of the polygon intersect. In other words, we are concerned with the problem of finding the convex hull of a non-intersecting polygon (simple polygon). As this problem has more structure than the general problem of finding the convex hull of a given set of points, one expects a simple solution for this problem. Sklansky(2~ was the first to report a linear-time algorithm for this problem. However, it has been shown recently that the above algorithm fails for some types of simple polygonsJ 3~ Toussaint and Avis~3~ established that Sklansky's algorithm (2~ works for a subclass of simple polygons known as externally visible polygons. In this paper, we describe a simple linear time algorithm for obtaining the convex hull of a simple polygon and establish its correctness. Further, we make a comparative evaluation of our algorithm with reference to other algorithms. ~'~ v) 1. Xma x and X,,~,~are the points with the largest x- coordinate (X .... )and least x-coordinate (X,,,,) of the polygon, respectively. For any polygonal point k, x k and Yk denote the x-coordinate and y-coordinate, respectively, of k. 2. For any given triples of consecutive points (say k, k + 1, k + 2) in clockwise order, one can compute whether or not a reflex angle is defined by them by computing S = (Yk+l - Yk) (xk+2 - xk+l) + (-xk -- -xk+l) (3'~รท2 -- Yk+l). Based upon the value of S we can assert (a) S > 0 implies that the angle subtended is not reflex ; this is referred to as right turn in the sequel. (b) S = 0 implies collinear points. (c) S < 0 implies that the angle subtended is reflex; this is referred to as left turn in the sequel. The argument for the above assertations can be found in Sklansky.(2~ We use the guarded commands of Dijkstra in our algorithmic descriptions. Guarded commands used in the algorithm are mentioned below. The general form of the alternative command is /f B~ ---, S 1 B: ~ S2 2. ALGORITHM FOR OBTAINING THE CONVEX HULL OF A SIMPLE POLYGON Before we begin the algorithm, it is in order to fix the notations used in the sequel. * To whom correspondence should be addressed. - Bo-,S. Here, if any guard Bi is not well-defined in the state in which execution begins, abortion may occur. This is because nothing is assumed about the order of evalu- 587