0% found this document useful (0 votes)
30 views

Algorithms For The Decomposition of A Polygon Into Convex Polygons

Uploaded by

y z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Algorithms For The Decomposition of A Polygon Into Convex Polygons

Uploaded by

y z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

European Journal of Operational Research 121 (2000) 330±342

www.elsevier.com/locate/orms

Theory and Methodology

Algorithms for the decomposition of a polygon into convex


polygons
J. Fernandez, L. C
anovas, B. Pelegrõn *

Departamento de Estadõstica e Investigaci


on Operativa, Universidad de Murcia, Campus de Espinardo, 30100 Espinardo (Murcia), Spain
Received 1 July 1997; accepted 1 December 1998

Abstract

Decomposing a non-convex polygon into simpler subsets has been a recurrent theme in the literature due to its many
applications. In this paper, we present di€erent algorithms for decomposing a polygon into convex polygons without
adding new vertices as well as a procedure, which can be applied to any partition, to remove the unnecessary edges of a
partition by merging the polygons whose union remains a convex polygon. Although the partitions produced by the
algorithms may not have minimal cardinality, their easy implementation and their quick CPU times even for polygons
with many vertices make them very suitable to be used when optimal decompositions are not required, as for instance,
in constrained optimization problems having as feasible set a non-convex polygon (optimization problems are usually
easier to solve in convex regions and making use of a branch and bound process or other techniques, it is not necessary
to ®nd the optimal solution in all the subsets, so ®nding convex decomposition with minimal cardinality may be time-
wasting). Computational experiments are presented and analyzed. Ó 2000 Elsevier Science B.V. All rights reserved.

Keywords: Polygon decomposition; Approximation; Facility location

1. Introduction cations. For instance, it is of great interest in ob-


ject representation since complex geometric
A convex decomposition of a polygon P is a set structures are more easily handled when decom-
of convex polygons whose union gives P, and such posed into simpler structures. Other examples are
that the intersection of any two of them, if non- pattern recognition [6], database systems [14] and
empty, consists totally of edges and vertices. The graphics [16]. For further motivation on decom-
problem of decomposing a simple polygon into position problems see [2,6,21]. For di€erent but
convex polygons has been an important theme in related problems see [17,18] or [20].
the literature due to its many and diverse appli- The problem that led us to consider it was the
de®nition of the feasible set in constrained planar
location problems, i.e., given a set of points in the
*
Corresponding author. Tel.: +34 968 363635; fax: +34 968 plane (representing the location of cities or cus-
364182. tomers) where a new point (representing a facility)
E-mail address: [email protected] (B. Pelegrõn). should be located in the feasible set so as to

0377-2217/00/$ - see front matter Ó 2000 Elsevier Science B.V. All rights reserved.
PII: S 0 3 7 7 - 2 2 1 7 ( 9 9 ) 0 0 0 3 3 - 8
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 331

optimize a given function. To model the di€erent is time consuming and needs much storage space,
aspects that must be taken into account, many specially for polygons like those which appear in
facility location problems are being considered location problems, with many vertices.
nowadays. The interested reader is referred to the On the other hand, we should remember that in
excellent books of Drezner [4], Francis et al. [10] or order to obtain the decomposition of a polygon
Love et al. [15]. But to adapt a location model to a into the minimum number of convex polygons
given region, it is necessary that the points to be additional (Steiner) points must be introduced as
located belong to a particular geographical area. vertices of newly generated polygons. This other
That area may have a more or less complicated problem was recently proved in [2] to be doable in
shape, but it can always be approximated by a polynomial time, contrary to what was thought,
polygon, whose number of vertices will depend on although in that article the authors admitted that
the desired accuracy of the approximation. Un- the algorithm they proposed to show is ``inherently
fortunately, those polygons, usually non-convex, intricate and implementing it in its most elaborate
cannot be written in an analytical way through a form is certainly a formidable task''. Unfortu-
set of linear constraints. So, in order to get an nately, that is true for most of the decomposition
analytical expression of the feasible set the poly- algorithms in the literature. As pointed out in [19],
gon must be decomposed into simpler sets. The the researchers involved in this kind of problems
location problem then, will be solved in some have usually pursued asymptotically optimal al-
(usually not all) of those sets. The most appro- gorithms and it is now when greater emphasis is
priate kind of sets into which the polygon can be being placed on computationally robust algo-
decomposed is convex polygons, for both their rithms, on approximations and on the need for
easy analytical writing and good optimization simple, practical algorithms.
properties. Furthermore, from the optimization The aim of this paper is to present fast and easy
point of view, it is not advisable to add new to implement algorithms to do convex decompo-
(Steiner) vertices in the partition because in many sitions with low cardinality and with the additional
location problems vertices must be treated with requirement that new vertices cannot be intro-
special attention since they may be local (some- duced in the partition. The algorithms generalize
times global) optimal points or give information those in [9] and an actual implementation of all of
about optimal points, and adding new vertices will them can be obtained in the O.R.S.E.P. section of
cause extra work in fathoming them. There are the European Journal of Operational Research
algorithms to triangulate a polygon, i.e., to sub- 102, no. 2 [8]. The algorithms follow a ``divide and
divide it into triangles without adding new vertices conquer'' scheme. They start with the whole
[1] but they produce partitions into many subsets. polygon to be decomposed. Then, given an initial
If, in addition to this, we have procedures that to vertex, a convex polygon of the partition is gen-
be applied only require convexity properties (and erated using a procedure and is cut o€ from the
not necessarily triangles), as is the case in most initial polygon. This process is repeated with the
optimization algorithms, then it is advisable to use remaining polygon until it is convex, in which case
decompositions into as big as possible convex sets. it will be the last polygon of the partition. Al-
Keil [12] presented an exact algorithm to de- though it is not guaranteed that the algorithms
compose a polygon into the minimum number of yield minimal size decompositions, their quick
convex polygons without adding new vertices. running times, the low number of convex polygons
Nevertheless, it is a dynamic programming algo- they produce and their easy implementation make
rithm and although he used the concept of equiv- them very suitable to be used when a (non-opti-
alent states, as introduced in [5], to reduce the size mal) decomposition of a polygon is needed. A
of a state space in order to achieve a polynomial good example is in constrained optimization prob-
algorithm, it has like other dynamic programming lems where the feasible set is a non-convex polygon.
algorithms the problem known as the curse of A common method to cope with these problems is
dimensionality [3], i.e., when run on a computer it to solve them in the convex subpolygons (what is
332 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

an easier problem), and because of the use of a ginning, P is the initial polygon, but as the algo-
branch and bound process or other techniques it is rithms go on, P will be the polygon obtained from
usually not necessary to ®nd the optimal solution the initial one by cutting o€ the convex polygons
in all of them, so ®nding convex decomposition already generated.
with the minimum number of convex polygons The vertices of the next future convex polygon
may be time-wasting. For other algorithms with of the partition are stored in a list, L, initially with
the same aim see [11] or [21]. only one vertex. From it, the convex polygon with
The rest of the article is organized as follows. In the highest possible number of vertices of P is
the following section, three di€erent algorithms for generated by adding to L consecutive (in clockwise
the decomposition of a polygon into convex order) adjacent vertices of P while possible, and
polygons are presented. In Section 3, a procedure then removing backward some of them if neces-
to merge all the convex polygons of a partition sary. The ®nal convex polygon is obtained by
whose union remains a convex polygon is given. drawing the diagonal joining the last and ®rst
This merging process can be applied not only to vertices of L, which is the only arti®cial edge we
our algorithms, which may generate partitions add. The detailed process is as follows.
containing unnecessary edges, but to any other Initially, the list L consists of one vertex, say v1 .
partitioning process which produces unnecessary Then, we add the next consecutive vertex of P , v2 ,
edges (for instance the algorithms given in [21]). In to L. If the last vertex we have already added to L
Section 4 the results of some computational ex- is vi then we provisionally add vi‡1 to L if ang viÿ1 ;
periments are presented and analyzed to show the vi ; vi‡1 † is not re¯ex (to avoid vi to become a notch)
performance of the algorithms, including a com- and if both ang vi ; vi‡1 ; v1 † and ang vi‡1 ; v1 ; v2 † are
parison with Hertel and Mehlhorn's algorithm not re¯ex (to make sure the diagonal vi‡1 v1 close in
[11], and in the last section we give conclusions and fact a convex polygon, preventing vi‡1 and v1 from
directions for further research. being notches, respectively). Both conditions are
Throughout this paper, the following conven- necessary and independent, as shown in the poly-
tion on the representation of angles is used. Let gons of Fig. 1.
a; b and c be three di€erent points, ang a; b; c† We go on adding new vertices to L until all the
denotes the angle between 0° and 360° swept by a vertices of P are in L or until we ®rst ®nd a vertex
counterclockwise rotation from line segment ba to failing one of the two conditions. In the ®rst case,
line segment bc. The vertices of a polygon dis- the convex polygon generated is the whole polygon
playing a re¯ex angle, that is, greater than 180° are P , that is, it was convex, and the algorithms stop,
called notches. being P the last convex polygon of the decompo-
sition of the initial polygon. So, let us suppose that
the ®nal provisional list is L ˆ fv1 ; . . . ; vr g; 2 6
2. Algorithms r < n. If r ˆ 2 then L produces the edge v1 v2 , which
is not considered as polygon of the ®nal partition,
In this section, three di€erent algorithms for the and the procedure stops. This happens for instance
decomposition of a polygon into convex polygons when both vi and vi‡1 are notches. The other
are presented. All of them follow the divide and possibility is 2 < r < n. In this case, we have to
conquer scheme, their only di€erence being the check whether the convex polygon generated by
procedure used to generate the convex polygons of the diagonal vr v1 contains in its interior vertices of
the partitions. Since the three procedures, which P n L (see Fig. 2(a)).
will be called MP1, MP2 and MP3, used in Al- Since there might be many vertices to be
gorithm 1, 2 and 3, respectively, follow the same checked and those checkings must be done every
ideas only the ®rst one will be described in detail. time the procedure is called in the algorithm and
Let P denote the simple polygon to which we generates a list L as in the case described above, a
want to apply the procedure MP1, given by its method to save time is needed. First, notice that if
vertices v1 ; . . . ; vn , in clockwise order. At the be- there are vertices of P n L inside the convex poly-
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 333

Fig. 1. Non-convex polygons generated when one of the angles is not considered.

Fig. 2. Removing vertices of L until the convex polygon does not contain vertices of P.

gon, then at least one of them must be a notch. So checking to see whether v is inside the convex
we can reduce the checking to the notches of P n L. polygon generated by L is done by studying
When the checking starts, we ®rst generate the whether v veri®es all the linear constraints de®ning
smallest rectangle R with sides parallel to the axes the polygon.
containing all the vertices of L; ‰minfvi;x : vi 2 Lg; If a notch v is found to be certainly inside the
maxfvi;x : vi 2 LgŠ  ‰minfvi;y : vi 2 Lg; maxfvi;y : vi 2 polygon generated by L, then we remove from L its
LgŠ; vi ˆ vi;x ; vi;y †; i ˆ 1; . . . ; r. If v is a notch of P n last vertex vr , and all the vertices of L in the
L we ®rst check whether v is inside R. Observe that semiplane generated by v1 v containing vr . This
if v is not inside R then it cannot be inside the process is repeated with the new L until no notch is
polygon generated by L either, so the checking to inside the polygon generated by L. If L has then
see whether a notch of P n L is inside the convex more than two vertices, it generates one of the
polygon can be reduced to the notches found in the polygons of the partition, else the procedure does
rectangle. This test can be done very quickly and is not generate a polygon in this call. We can see an
specially useful for polygons with many vertices example of this process in Fig. 2. There, the initial
(and notches) since it may avoid the checking of diagonal (see 2a) is v7 v1 , but the notch v8 is found
many notches. Finally, if v is a notch inside R the inside R and inside the convex polygon generated
334 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

by L (in grey). So the line v1 v8 is drawn (see 2b) contain any diagonal which connects two vertices
and after removing the vertices of L in the semi- which are not notches. Those partitions are known
plane generated by v1 v8 containing v7 , the new to be non-optimal since those diagonals can al-
diagonal to be considered is v6 v1 . But the notch ways be removed without creating non-convex
v10 is found inside the new R (see 2c) and also pieces. In the polygons of Fig. 3 is shown the
inside the convex polygon generated by the new L. convex polygon generated by the procedures when
After drawing the line v1 v10 (see 2d) and removing the initial vertex considered is v1 . Observe that
vertices, the new diagonal is v5 v1 . This time no when using MP3 the ®rst diagonal v4 v16 and the
notch is inside the new convex polygon (see 2e), second one v7 v4 are not chosen as diagonals of the
so v5 v1 is a diagonal of the partition. The convex partition.
polygon it generates is cut o€ from the main Below the steps of the ®rst algorithm are de-
polygon and the process is repeated with the re- tailed. Lm will denote the list L containing the
maining polygon (see 2f). vertices of the convex polygon at the mth iteration.
Notice that a similar procedure MP10 can be
done going counterclockwise instead of clockwise, Algorithm 1
as we have done. We also want to point out that it 1. Read in clockwise order the vertices vi and store
is possible to mix both kinds of search to get a them in a cyclical list P ˆ fv1 ; . . . ; vn g.
more powerful one: we begin generating a list L 2. L0 fv1 g; m 1.
with MP1 and then, so as to get a bigger polygon, 3. While n > 3 do (Begin MP1)
we try to expand L by adding consecutive, in 3.1. v 1† Last‰Lmÿ1 Š; v 2† Next‰P ; v 1† Š.
m
counterclockwise order, adjacent vertices to it in 3.2. L fv ; v g; i 2; v i‡1† Next‰P ; v i† Š.
1† 2†

its ®rst position, i.e., we use MP10 with L as initial 3.3. While angf v iÿ1† ; v i† ; v i‡1† †; v i† ; v i‡1† ; v 1† †;
list. This is in fact our procedure MP2. A di€erent v i‡1† ; v 1† ; v 2† †g 6 180 and jLm j < n do
procedure MP20 can be obtained going ®rstly 3.3.1. Lm Lm [ fv i‡1† g; i i ‡ 1; v i‡1†

counterclockwise with MP10 and then clockwise Next‰P ; v Š.
with MP1. Our last procedure MP3 works like 3.4. If jLm j 6ˆ jP j then
MP2 but only chooses a convex polygon as a 3.4.1. Obtain the list LPVS with the vertices
convex polygon of the partition if one (or both) of vi 2 P n Lm which are notches.
the vertices of the diagonal is a notch; if it is not 3.4.2. While jLPVSj > 0 do
the case, the convex polygon is not considered as a Obtain the smallest rectangle R with
convex polygon of the partition and the procedure sides parallel to the axes containing all
MP2 is called again considering as initial vertex the vertices of Lm .
the last vertex of the previous not considered Backward false.
convex polygon. Using this third procedure, it is While not Backward and jLPVSj > 0 do
guaranteed that the partitions obtained do not Repeat

Fig. 3. Polygon generated from vertex v1 with the procedures MP1, MP2 and MP3.
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 335

v First‰LPVSŠ. obtained by the algorithm when the initial vertex


If v 62 R then LPVS LPVS fvg considered is vs and Ps is the ®rst convex polygon
Until v 2 R or jLPVSj ˆ 0. obtained in Ds .
If jLPVSj > 0 then
If v is inside the polygon generated Vertex dependency process
by Lm then 1. OS ;; CARD 1; s 1.
Obtain the set VTR of vertices of 2. While s 6 n do
Lm in the semiplane generated by 2.1. Decompose the polygon into convex poly-
v 1† v containing Last‰Lm Š. gons using vs as initial vertex.
Lm Lm VTR; Backward true: 2.2. If jDs j ˆ CARD then OS OS [ Ds
LPVS LPVS n fvg.(End MP1) else if jDs j < CARD then
3.5. If Last‰Lm Š 6ˆ v 2† then OS fDs g; CARD jDs j.
3.5.1. Write Lm as a convex polygon of the 2.3. s s ‡ 1; NewFirstPolygon false.
partition. 2.4. While not NewFirstPolygon and s 6 n do
3.5.2. P P n Lm † [ fFirst‰Lm Š; Last‰Lm Šg; 2.4.1. Generate Ps .
n n ÿ jLm j ‡ 2; 2.4.2. If Ps 6ˆ Psÿ1 then NewFirstPolygon
3.6. m m ‡ 1. true else s s ‡ 1.

The algorithm calls the procedure MP1 until At the end of the process, OS contains all the
the polygon to be decomposed into convex poly- minimal decompositions obtained by the algo-
gons is in fact convex. The ®rst vertex in the lists rithms. Algorithm i, i ˆ 1; 2; 3, together with the
storing the vertices of the convex polygons of the vertex dependency process, will be called Algo-
partition is chosen as the next vertex (in clockwise rithm i/D.
order) of P from which we can generate a new
convex polygon. Observe that sometimes it may
happen that no convex polygon is generated from 3. The merging process
the initial vertex v 1† . In this case, we skip that
vertex and try to generate a convex polygon A diagonal d is said to be essential for vertex v
considering the next vertex as the ®rst one in the if removal of d creates a piece that is non-convex
list. at v. Observe that if d is essential for v then it must
Observe that we initially set L0 ˆ fv1 g, but we be incident to v and v must be re¯ex. A diagonal
could also have chosen any other vertex. In fact, that is not essential for any vertex is called ines-
this choice a€ects the ®nal solution, i.e., di€erent sential.
initial vertices may produce di€erent partitions, The algorithms presented above produce good
even with di€erent cardinality. To take into ac- partitions but like other partitioning algorithms
count this fact, we can modify the algorithms as (see [21]), the partitions may sometimes contain
follows. Observe that if two vertices generate the inessential diagonals, i.e., two convex polygons
same ®rst convex polygon, then the ®nal partition sharing a diagonal can be merged to generate a
will be the same too. So, we only need to generate single one. To prevent this, we have developed a
a partition with a new initial vertex if the ®rst merging process which can be used after any par-
convex polygon generated (before the merging titioning process producing inessential diagonals.
process) is di€erent from the ®rst polygons of the Everyone of the diagonals of the partition is con-
partitions already generated. After reading the sidered in order and it is checked whether it can be
vertices of the polygon, we now do the vertex de- removed, taking into account that if the polygons
pendency process described below in which OS Ps and Pt sharing a given diagonal have already
denotes the set with the minimal decompositions been merged to other polygons Ps and Pt then the
obtained by the algorithm, CARD their cardinality, polygons to be considered when checking whether
Ds denotes the convex polygon decomposition that diagonal can be removed are the merged
336 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

polygons Ps [ Ps and Pt [ Pt , and not the single


polygons Ps and Pt sharing the diagonal. Algo-
rithm i, i ˆ 1; 2; 3, together with the merging pro-
cess will be called Algorithm i/M. The steps of the
merging process are given below.
We will use the following lists: (1) LLE is a list
containing the diagonals of the partition, (2) for
every vertex vj , LPvj is a list containing pairs k; vr †
where k is the index of a polygon containing vj as
one of its vertices and vr is the next vertex to vj in
that polygon k, but these pairs are in LPvj only if vr Fig. 4. Check to see whether the diagonal v s† v t† can be re-
is not the consecutive vertex of vj in the initial moved.
polygon, i.e., if vj vr is a diagonal, (3) LDP is an
ordered list of boolean ¯ags, LDP ‰iŠ ˆ true mean- For h ˆ 1 to NP ÿ 1 do
ing that the polygon with index i is one of the If LUP ‰hŠ ˆ j or LUP ‰hŠ ˆ u then
de®nitive polygons of the partition after the LUP ‰hŠ NP .
merging process and (4) LUP is an ordered list of To evaluate the eciency of the algorithms, we
integer, LUP ‰iŠ ˆ j meaning that the polygon with need bounds on the best possible partition by di-
index i is part of the polygon with index j. Let m be agonals. Let OPT be the fewest number of convex
the number of diagonals in the partition to which subpolygons into which a polygon may be parti-
we want to apply the merging process and NP the tioned. If the polygon has r notches, then
number of convex polygons used in the merging OPT P dr=2e ‡ 1 since at most two re¯ex angles
process. can be resolved by a single diagonal (see Fig. 5(a)).
To obtain an upper bound, observe that to resolve
Merging process any re¯ex angle we need at least one diagonal d
1. NP m ‡ 1. incident to the notch v producing the re¯ex angle.
2. LDP ‰iŠ true, LUP ‰iŠ i; i ˆ 1; . . . ; NP . But d resolves the re¯ex angle if and only if d is in
3. For j ˆ 1 to m do the cone formed by extending the polygonal edges
3.1. v s† ; v t† † LLE‰jŠ. ending at v toward the interior of the polygon (see
3.2. If (jLPv s† j > 2 and jLPv t† j > 2) or Fig. 6(a)). However, it is not sure whether for a
(jLPv s† j > 2 and v t† is convex) or given notch there will be a visible vertex within the
(jLPv t† j > 2 and v s† is convex) or (v s† is corresponding cone allowing us to draw such a
convex and v t† is convex) then diagonal (see Fig. 6(b)). What we can guarantee in
3.2.1. j2 v t† ; i2 v s† ; j3 Next‰Pj ; v t† Š; those cases is that v can be resolved with at most

i1 Previous‰Pj ; v Š. two diagonals, the ones obtained connecting v to
3.2.2. Find in LPv t† the only pair u; v s† † the visible vertices to the immediate right and left
containing v s† . of its cone. So OPT 6 2r ‡ 1. As Fig. 5(b)) shows,
3.2.3. j1 Previous‰Pu ; v t† Š; i3 Next‰Pu ; that bound can be attained for some polygons.

v Š. Now, since at most two diagonals are essential

3.2.4. If angf i1 ; i2 ; i3 †; j1 ; j2 ; j3 †g 6 180 for any re¯ex vertex (see [11]), it follows that any
then (*see Fig. 4*) decomposition without inessential diagonals is
NP NP ‡ 1. within four times of the minimum decomposition
Write as NP th polygon the polygon (2r ‡ 1 < 2r ‡ 4 6 4 dr=2e ‡ 1†). In particular, this
obtained merging the polygons holds for the partitions generated with Algorithm
with indices LUP ‰jŠ and LUP ‰uŠ. i/M, i ˆ 1; 2; 3. Nevertheless, we think that the
LDP ‰jŠ false; LDP ‰uŠ false; bound on the absolute quality of an algorithm is
LDP ‰NP Š true. not a good representative measure of its perfor-
LUP ‰jŠ NP ; LUP ‰uŠ NP . mance since the bound must take the worst
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 337

Fig. 5. Optimal convex decompositions. In (a), OPT ˆ dr=2e ‡ 1: r ˆ 6, 4 pieces. In (b), OPT ˆ 2r ‡ 1: r ˆ 6, 13 pieces.

Fig. 6. A re¯ex angle and its cone. In (a) one diagonal can resolve the re¯ex angle. In (b) two diagonals are required.

possible case into account, which hardly appears have complicated shapes, making them appropri-
in practice. Computational studies as the one ate to test decomposition algorithms. Notice that
presented in the next section may better help to the complexity of a polygon not only depends on
give an idea of the performance of an algorithm. its number of notches but also on its shape. This
intuitive fact is corroborated by our empirical
studies where, for instance, using the same algo-
4. Computational experiments rithm a polygon with 100 vertices, 43 of them
notches, was decomposed into 49 polygons while
To the extent of our knowledge, there are no another polygon with the same number of vertices,
articles dealing with convex decompositions which 47 of them notches, was decomposed into only 31
include computational experiments. This is due, in polygons. These test problems can be obtained
part, to the fact that some of the algorithms pro- under request [7].
posed are theoretical, their only purpose being to We have decomposed the polygons using the
o€er low complexity but that in practice are ex- twelve di€erent algorithms obtained by combining
tremely dicult, if not impossible, to implement in the three basic procedures MP1, MP2 and MP3 to
any language programming (see [2]). Another generate the polygons of the partitions and the
reason is that there are no published test problems merging and vertex dependency processes. For the
with which to compare running times and cardi- sake of brevity, we do not present the results in-
nality of the partitions when the algorithms are not dividually for everyone of the 250 polygons but
exact. On the other hand, to generate polygons is a grouped according to the number of vertices.
tedious task. Furthermore, we only present that sumarized in-
To carry out our study, we have generated in all formation for 5 of the algorithms since they are
250 polygons, ®fty for everyone of the number of sucient to explain our conclusions. All the codes
vertices n ˆ50, 75, 100, 125 and 150, utilizing a were implemented on Turbo Pascal V. 6.0 [8] and
program that allows to draw the polygon on the run on a PC with a processor Intel Pentium with a
PC screen and store the co-ordinates of the vertices CPU speed of 133 MHz.
in an ASCII ®le. We implemented that program in In Table 1 are shown the results obtained with
such a way that a polygon has to ®t on a single Algorithms 1, 2 and 3. For everyone of the groups
screen (‰0; 640Š  ‰0; 480Š pixels). So the polygons of polygons the minimum, mean, maximum and
338 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

Table 1
Computational results for Algorithms 1, 2 and 3 (the given values are (minimum, mean, maximum; standard deviation))
Vertices Notches Polygons Time
Algorithm 1
50 (6, 15.72, 25; 4.84) (8, 17.96, 31; 5.93) (0, 0.009, 0.06; 0.02)
75 (16, 28.10, 38; 4.75) (17, 29.86, 45; 6.38) (0, 0.017, 0.11; 0.02)
100 (25, 40.08, 50; 5.28) (22, 41.34, 64; 7.05) (0, 0.023, 0.06; 0.02)
125 (34, 51.76, 62; 6.25) (34, 54.80, 69; 8.15) (0, 0.040, 0.06; 0.02)
150 (48, 64.62, 77; 6.48) (47, 68.70, 93; 10.22) (0, 0.061, 0.16; 0.03)

Algorithm 2
50 (6, 15.72, 25; 4.84) (5, 15.76, 29; 5.66) (0, 0.009, 0.06; 0.02)
75 (16, 28.10, 38; 4.75) (14, 27.06, 40; 5.72) (0, 0.022, 0.06; 0.02)
100 (25, 40.08, 50; 5.28) (22, 37.68, 59; 6.73) (0, 0.028, 0.11; 0.03)
125 (34, 51.76, 62; 6.25) (24, 48.74, 67; 7.67) (0, 0.042, 0.11; 0.02)
150 (48, 64.62, 77; 6.48) (45, 62.12, 82; 9.11) (0, 0.062, 0.11; 0.02)

Algorithm 3
50 (6, 15.72, 25; 4.84) (5, 15.50, 28; 5.44) (0, 0.014, 0.06; 0.02)
75 (16, 28.10, 38; 4.75) (14, 26.94, 40; 5.52) (0, 0.019, 0.06; 0.02)
100 (25, 40.08, 50; 5.28) (22, 37.66, 58; 6.67) (0, 0.028, 0.06; 0.02)
125 (34, 51.76, 62; 6.25) (24, 48.74, 67; 7.67) (0, 0.039, 0.11; 0.02)
150 (48, 64.62, 77; 6.48) (45, 61.92, 81; 8.87) (0, 0.061, 0.11; 0.02)

standard deviation of the number of notches, one another being under 4%, that is, the merging
number of polygons of the decomposition and process makes the use of MP1 not as bad as it was
CPU time are given. Notice that the running times without the merging process. On the other hand, it
are similar for the three algorithms, but the de- is natural for the merging process to be more ef-
compositions obtained by Algorithms 2 and 3 are fective with MP1 since it is the procedure pro-
much more better than those obtained by Algo- ducing worse partitions. These algorithms are fast.
rithm 1. For instance, the improvement when For instance, the mean time for Algorithm 3/M for
using Algorithm 3 as contrasted with Algorithm 1 polygons with 150 vertices is 0.205 seconds, 0.144
attains a considerable of which are for the merging process (although
most of that CPU time is employed in opening and
No:pol†Alg1 ÿ No:pol†Alg3 closing auxiliary ®les and not in calculations). For
Imp50
Alg1;Alg3 ˆ 100
No:pol†Alg1 Algorithm 1/M the CPU times are higher, the
ˆ 13:69% mean for polygons with 150 vertices being 0.286
seconds, 28.32% slower than Algorithm 3/M. This
for the polygons with 50 vertices. is due to the fact that the merging process has to
Table 2 shows the results obtained when using check more diagonals when applied to partitions
Algorithm 3/M. As we see, the merging process obtained with MP1.
is very useful since it reduces the number of poly- Of course, the best partitions of the polygons
gons considerably. For instance, Imp150Alg3;Alg3=M ˆ are obtained when the merging process is used
16:69%. Similar improvements are obtained when together with the vertex dependency process.
Algorithms 2 and 2/M are compared. When Al- Nevertheless, the improvements upon Algorithm i/
gorithm 1 and 1/M are compared the improve- M are slight, varying from Imp150 Alg1=M;Alg1=M=D ˆ
ments are higher, around 25%. In fact, Algorithm 2:70% to Imp100Alg3=M;Alg3=M=D ˆ 8:38%, whereas the
1/M is as good as Algorithm 2/M or 3/M, the running times increase very much, so their use is
improvements of one of them as contrasted with not recommended. In Table 3, where the results
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 339

Table 2
Computational results for Algorithm 3/M (the given values are (mean; standard deviation))
Vertices Notches Polygons Time Merg. pol. Merg. time
50 (15.72; 4.84) (13.44; 4.39) (0.038; 0.02) (2.06; 1.73) (0.023; 0.02)
75 (28.10; 4.75) (23.14; 4.44) (0.063; 0.03) (3.80; 1.85) (0.049; 0.03)
100 (40.08; 5.28) (31.98; 5.22) (0.097; 0.04) (5.68; 2.36) (0.075; 0.03)
125 (51.76; 6.25) (40.74; 5.65) (0.147; 0.04) (8.00; 3.23) (0.107; 0.04)
150 (64.62; 6.48) (51.58; 6.33) (0.205; 0.07) (10.34; 4.02) (0.144; 0.05)

Table 3
Computational results for Algorithm 3/M/D (the given values are (mean; standard deviation) or mean)
Vertices Polygons Time Merg. pol. Merg. time No. partit. No. best
50 (12.52; 4.35) 0.48 (1.78; 1.80) 0.28 (10.60; 3.22) 3.82
75 (21.30; 4.25) 1.24 (3.76; 2.03) 0.81 (15.96; 3.75) 3.26
100 (29.30; 5.64) 2.41 (5.24; 2.61) 1.63 (21.08; 3.68) 2.84
125 (37.62; 5.19) 4.16 (7.04; 3.17) 2.87 (26.02; 4.01) 2.22
150 (48.04; 6.81) 7.43 (9.76; 3.93) 5.19 (32.70; 4.15) 2.58

for Algorithm 3/M/D are shown, we can see that to be decomposed and then remove inessential
the mean time for decomposing polygons with 150 diagonals. To triangulate we have used the qua-
vertices is 7.43 seconds. This is due to the great dratic algorithm outlined in [18], chapter 1 and to
number of di€erent partitions (the mean for remove inessential diagonals we have used the
polygons with 150 vertices is 32.7) that the algo- merging process described in the previous section.
rithm must carry out, although only 2 or 3 of them The results are summarized in Table 4. For ev-
(the mean for polygons with 150 vertices is 2.58) eryone of the groups of polygons the mean and
are optimal. standard deviation of the number of notches,
Finally, the performance of the algorithms with number of polygons, total CPU time and part of
the vertex dependency process but without the the CPU time employed in the merging process are
merging process is very bad since they need much given. As we can see, the partitions produced by
more time and produce worse partitions than Hertel and Mehlhorn's algorithm (AlgHM) are
Algorithm i/M. For instance, Imp150 Alg1=D;Alg3=M ˆ worse than those produced by the algorithms
22:31% and Imp150 Alg3=D;Alg3=M ˆ 9:15%. presented in this paper. Even the algorithms
We have also decomposed the polygons fol- without the merging process and without the ver-
lowing the idea of Hertel and Mehlhorn's algo- tex dependency process produce partitions with
rithm (see [11]), another simple practical algorithm lower cardinality (see Table 1). For instance, the
for decomposing polygons into convex subpoly- improvement when using Algorithm 3 as con-
gons without adding new vertices. The idea of that trasted with AlgHM is over 11% for everyone of
algorithm is basically this: triangulate the polygon the groups of polygons. For the algorithms which

Table 4
Computational results using Hertel and Mehlhorn's algorithm (the given values are (mean; standard deviation))
Vertices Notches Polygons Time Merg. time
50 (15.72; 4.84) (18.32; 5.34) (0.069; 0.02) (0.068; 0.02)
75 (28.10; 4.75) (31.78; 5.20) (0.163; 0.02) (0.158; 0.02)
100 (40.08; 5.28) (43.88; 6.15) (0.277; 0.03) (0.267; 0.03)
125 (51.76; 6.25) (56.60; 6.92) (0.416; 0.03) (0.407; 0.03)
150 (64.62; 6.48) (70.06; 7.14) (0.587; 0.04) (0.564; 0.03)
340 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

use the merging process the improvements are initial vertex chosen to generate the ®rst polygon
higher, always over 25%. This is not surprising. of the partition. Computational experiments show
The algorithms presented in this paper try to that the procedures to generate convex polygons
generate convex polygons with as many vertices as MP2 and MP3 produce partitions with similar
possible and so the partitions they produce have cardinality and that they both are better than
low cardinality. On the other hand, Hertel and MP1. The procedure MP3 has in addition the
Mehlhorn's algorithm does not follow any strategy property that the partitions it produces have no
with that aim apart from the one of the merging diagonals joining two vertices which are not
process, i.e., to try to remove in chronological notches, which are known to be non-optimal. It is
order of their generation the inessential diagonals recommended the use of the merging process since
of the triangulation. Concerning the CPU times, it is a quick process and can reduce the number of
although triangulating a polygon is quicker than polygons considerably. Moreover, since after the
decomposing it into convex subpolygons using any merging process the partitions do not contain
of the procedures MP1, MP2 or MP3, the total unnecessary edges it is theoretically guaranteed
CPU times using Hertel and Mehlhorn's algorithm that they are within four times the optimal solu-
are much higher than those of Algorithm i/M, i ˆ tion, although the computational studies carried
1; 2; 3 (and of course, than those of Algorithm i, out show that the performance is in practice much
i ˆ 1; 2; 3). This is due to the fact that now the better. The merging process described can be ap-
merging process has to try to remove the n ÿ 3 plied to any partition, not only to the ones pro-
diagonals required to triangulate any polygon with duced by our algorithms. On the other hand, the
n vertices, whereas the number of diagonals gen- vertex dependency process is time consuming and
erated with any of the procedures MP1, MP2 or the number of polygons it reduces after the
MP3 and to be checked then by the merging merging process is low, varying (from 1 to 3) de-
process is much lower. For instance, the mean pending on the number of vertices of the polygon
number of diagonals for polygons with 150 verti- (from 50 to 150). So the user must decide whether
ces using the procedure MP3 is 60.92, whereas the the great increase of time compensates the reduc-
number of diagonals of any triangulation is 147, tion of the number of polygons. A comparison
that is, 58.55% less, and the corresponding savings between the algorithms presented in this paper and
in time when using Algorithm 3/M as contrasted Hertel and Mehlhorn's algorithm, another simple
with AlgHM are 74.48% for the merging process practical algorithm, shows that the performance of
and 65.10% for the total time. So we can conclude the algorithms presented in this paper is better
that the algorithms presented in this paper are since the cardinality of the partitions they produce
much better than the one of Hertel and Mehlhorn is lower and their CPU times are quicker.
for both the cardinality of the partitions they For constrained location problems, where using
produce and the CPU times they use. techniques such as branch and bound the location
problem has then to be solved in some (usually not
all) of the subpolygons, we recommend the use of
5. Conclusions Algorithm 3/M, which can decompose a polygon
with 150 vertices in 0.2 seconds. As a case study, in
In this paper we have presented di€erent algo- Fig. 7 is presented the decomposition given by that
rithms for decomposing a polygon into convex algorithm when the polygon considered is a non-
polygons without adding new vertices. They di€er convex polygon with 57 vertices, 27 of them
in the way the polygons of the partition are gen- notches, approximating the shape of the Autono-
erated and in two additional processes, one of mous Region of Murcia, a region in the south-east
them to improve the partitions by merging the of Spain. The number of polygons of the partition
polygons of the partition whose union remains a is 20 and the CPU time was 0.047 seconds. When
convex polygon, and the other one to take into using Algorithm 3/M/D, the number of polygons
account the dependency of the partition on the was 19 and the CPU time 0.710 seconds.
J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342 341

Fig. 7. Partition of the Autonomous Region of Murcia using Algorithm 3/M.

Observe that the algorithms we have presented and Hertel and Mehlhorn's algorithm was sug-
can only be used to decompose polygons without gested by one of the referees. This work has been
holes. Nevertheless, in many problems it is neces- supported by the Consejerõa de Cultura y Ed-
sary to consider holes inside the polygons. De- ucaci
on de la Regi on de Murcia under grant
composing a polygonal region with polygonal ``COM-23/96 MAT. Ayud. Compl. Inv. 1996'' and
holes into the minimum number of convex sub- Fundacion Seneca under grant PB/11/FS/97.
polygons is known to be a problem NP-hard [13].
A direction for future research is to adapt the
procedures generating the convex polygons of the References
partition and the merging process described in this
paper to the problem with holes so as to design a [1] B. Chazelle, Triangulating a simple polygon in linear
quick practical algorithm producing partitions time, Discrete and Computational Geometry 6 (1991) 485±
with low cardinality suitable to be used when op- 524.
[2] B. Chazelle, D.P. Dobkin, Optimal convex decomposi-
timal decompositions are not required. Another tions. in: Computational Geometry, Elsevier Science
area for future research is to ®nd rules to decide Publishers, North-Holland, 1985, pp. 63±133.
the order in which the diagonals of a partition [3] E.V. Denardo, Dynamic Programming: Models and Ap-
should be checked by the merging process so as to plications. Prentice-Hall, Englewood Cli€s, NJ, 1982.
remove as many diagonals as possible. [4] Z. Drezner (Ed.), Facility Location. A Survey of Appli-
cations and Methods, Springer Series in Operations
Research, Springer, New York, 1995.
[5] S.E. Elmaghraby, The concept of State in discrete dynamic
Acknowledgements programming, Journal of Mathematical Analysis and
Applications 29 (1970) 523±557.
[6] H. Feng, T. Pavlidis, Decomposition of polygons into
We wish to thank the referees for making sev- simpler components: Feature generation for syntactic
eral comments to improve the presentation of the pattern recognition, IEEE Transactions on Computers
paper. The comparison between our algorithms 24 (1975) 636±650.
342 J. Fern
andez et al. / European Journal of Operational Research 121 (2000) 330±342

[7] J. Fernandez, L. Canovas, B. Pelegrõn, Two hundred and [14] W. Lipski, E. Lodi, F. Luccio, C. Mugnai, L. Pagli, On
®fty nonconvex polygons, Internal Report, 1997. two-dimensional data organization II, Fundamenta In-
[8] J. Fernandez, L. C anovas, B. Pelegrõn, DECOPOL ± formaticae 2 (1979) 245±260.
Codes for decomposing a polygon into convex subpoly- [15] R.F. Love, J.G. Morris, G.O. Wesolowsky, Facilities
gons, European Journal of Operational Research Location: Models and Methods, North-Holland, New
(O.R.S.E.P. section) 102 (1997) 242±243. York, 1988.
[9] J. Fernandez, L. C
anovas, B. Pelegrõn, Un algoritmo para [16] W. Newman, K.J. Sproull, Principles of Interactive
la descomposici on de polõgonos en polõgonos convexos, Computer Graphics, 2nd ed., McGraw-Hill, New York,
XXIII Congreso Nacional de Estadõstica e Investigaci on 1979.
Operativa, Valencia (1997) 34.9-34.10. [17] J. O'Rourke, Art Gallery Theorems and Algorithms,
[10] R.L. Francis, L.F. McGinnis, J.A. White, Facility Layout International Series of Monographs on Computes Science,
and Location: An Analytical Approach, 2nd ed., Interna- Oxford University Press, New York, 1987.
tional Series in Industrial and Systems Engineering, [18] J. O'Rourke, Computational Geometry in C, Cambridge
Prentice-Hall, Englewood Cli€s, NJ, 1992. University Press, Cambridge, 1994.
[11] S. Hertel, K. Mehlhorn, Fast triangulation of simple [19] J. O'Rourke, Computational geometry column 29, Inter-
polygons, in: Proc. 4th Internat. Conf. Found. Comput. national Journal of Computational Geometry and Appli-
Theory, in Lecture Notes in Computer Science, vol. 158, cations 6 (1996) 507±511.
Springer, New York, 1983, pp. 207±218. [20] F.P. Preparata, M.I. Shamos, Computational Geometry:
[12] J.M. Keil, Decomposing a polygon into simpler compo- An Introduction, Springer, New York, 1985 (Corrected
nents, SIAM Journal on Computing 14 (1985) 799±817. and expanded second printing, 1988).
[13] A. Lingas, The power of non-rectilinear holes, in: Auto- [21] B. Schachter, Decomposition of polygons into convex
mata, Languages and Programming (Aarhus, 1982), sets, IEEE Transactions on Computers 27 (1978)
Springer, Berlin, 1982, pp. 369±383. 1078±1082.

You might also like