A Fast Convex Hull Algorithm
A Fast Convex Hull Algorithm
Convexhid, &orithm .
Several algorithms for determining the convex These are the four points with minimum and maxi;
hull of a set of points in two and three dimensions mum X and Y coordinates: say XMIN, Xl%kX,
have been published recently [l-6). It has also been YMIN, YMAX, respectively. From Fig. 1, two facts
established [3] that the complexity of the ‘L&men- are obvious,
sional convex hull problem is O(n log n). In this note (a) The extremal points must belong to the con-
we describe a new algorithm for obtaining the con- vex hull.
vex hull of a set of points in the plane and empiri- (b) Any point intericr to the cc Jvex quadrilateral
cally compare it to one of the best known algorithms. whose comers are the extremal pcints cannot belong
The simplicity and speed of the proposed algorithm to the convex hull,
make it worG reporting, It follows that by identifying the extremal points
one adds these points to the convex hull and discards
all points falling inside the quadrilateral the form.
The basic ideas We call this tie “throw-away” principle.
If there are several candidates with the same ei-
The algorithm is based on the fLllowing simple
ideas:
(1) Determining the four extremal points of the YMAX
.
set and discard@ all points interior to the convex .
e
(3) Using the vector cross-product to find the .
e
.
convex path in each problem. . l
e
L./
* This research was supported by the National Research YM!N
Council of Catlada under grants NRC-A9293 and NRC-
A3599. Fig. I.
219
Vobme 7, number 5 INFORMATION PiKWSSING LE’M’ERS August 1978
.I
3. Vector cross-pivot
fuct
c
REGION 1 REGION 2
--Y
___-_--Y-
s
I’ f While examining the points in one of the regions
for inclusion in (or exclusion from) the convex hull,
assume that we are advancing along an edge of the
quadrilateral such that the region is at our left, as
shown in Fig. 2. A&nprnefirrther that we are looking
at three consecutive points k, k + 1, and k + 2. Ob-
viously if point k + 1 is as shown in Fig. 3(a) it is to
be kept temporarily, while it is to be discarded from
further consideration if it is as in Fig. 3(b).
If a, b and 8 are as shown in Fig. 3(a) and (b),
then the cross-product of the two vectors is given by
S=ubsinO
treme x ory values their endpoints are kept as extre- Fig. 3(a), S is positive and in Fig. 3(b) it is negative.
In
mal points. For example, if several points have the We thus have the following simple ri.le:
same maxirn~*my coordinates only the leftmost and
If S > 0 keep point (k + 1) ,
rightmost of these are kept as YMAXextrema thus
yielding a possibly pentagonal “throw-away” region. else delete point (k + 1) .
Before presenting the algorithm we point out &at in
some cases two extremal points may coincide as
2. S~bpblerns
shown in Fig. 4. The sole effect of these situations
is that the number of subproblems is reduced.
Once the four extremal points have been deter-
mined, and some points eventually discarded, one
can break the remaining, set of points into four The algorithm
re$ir)ns,as shown in Fig. 2. All that remains is to
fn,ti a convex “path” from one extremal point tc the Step 1. Find the extremal points and delete all
other in the same region. other points falling inside the polygon they form.
s>o s<o
Fig. 3(a). Fig. 3(b).
220
VoIume7, numberS INFORMATION
PROCESSING
LETTERS August1978
Worst-caseant#ysi$
YMIN
Cbmparisonwith the al’rith~;! of Jawis
YMAX YMAX
P 3 REGIONS
lateral or one of the subregions using the point-in- Note that Step 3 in the above algorithm differs
polygon algorithm described in [ 10,ll ]I.Since at from Step 5 in Graham’s algorithm [l] in that, tlot
every iteration of S&p 3(l) a finite q-umber of points only are angles not computed, but the endpoints in
is removed, convergence of the algorithm is guaran- the convex path in each subregion are kno~~~ thus
teed. The remaining points :km the convex hull of yielding a simpler: termination criterion than that
the original set. suggested ti [ 161.
Voim 7, number 5 INFGRMATIGN PRIXESSING LETTERS August 1978
222