Journal of Computing and Information Technology - CIT 8, 2000, 4, 319–331 319

A Contribution to Algorithms for Simple

Marko Lamot1, Borut Zalikˇ 2

1Hermes Softlab, Ljubljana, Slovenia 2Borut Zalik,ˇ University of Maribor, Faculty of Electrical Engineering and Computer Sciences, Maribor, Slovenia

Decomposing simple into simpler components widely used for tessellating curved geometries, is one of the basic tasks in and such as those described by spline. its applications. The most important de- composition is triangulation. The known algorithms for The paper gives a brief summary of existing polygon triangulation can be classified into three groups: triangulation techniques and a comparison be- algorithms based on inserting, algorithms based on , and the algorithms using tween them. It is organized into eight sections. Steiner points. The paper briefly explains the most The second chapter introduces the fundamen- popular algorithms from each group and summarizes tal terminology, and in the third chapter diag- the common features of the groups. After that four onal inserting algorithms are dealt with. The algorithms based on insertion are tested: a recursive diagonal inserting algorithm, an ear cutting fourth section explains the constrained Delau- algorithm, Kong’s Graham scan algorithm, and Seidel’s nay triangulation. The fifth section describes randomized incremental algorithm. An analysis con- triangulation techniques that use Steiner points. cerning speed, the quality of the output and the ability to handle holes is done at the end. The sixth section summarizes the common fea- tures of all three groups of polygon triangula- Keywords: simple polygons, simple polygon triangula- tion algorithms. The seventh section contains tion, Steiner points, constrained Delaunay triangulation the comparison of triangulation methods based on the diagonal insertion. An analysis concern- ing speed, the quality of the output triangles, and the ability to handle holes is done. The last section summarizes the work. 1. Introduction

Polygons are very convenient for computer rep- 2. Background resentation of the boundary of the objects from

the real world. Because polygons can be very Every simple polygon P a polygon is simple if

complex they can include a few thousand ver- its edges cross only in their endpoints — ver-

tices, they may be concave and may include tices with n vertices has a triangulation. The

nested holes, often there is the need to decom- key for proving the existence of the triangula- pose the polygons into simpler components that tion is the fact that every polygon has a diagonal,

can be easily and rapidly handled. There are which exists if the polygon has at least one con-  many ideas how to perform this decomposition. vex vertex. We can conclude that  OROU94 : Planar polygons can be, for example, decom- every polygon has at least one strictly convex posed into triangles, or even star- vertex,

shaped polygons. Computing the triangulation of a polygon is a fundamental algorithm in the every polygon with n 4 vertices has a di- computational geometry. It is also the most agonal,

investigated partitioning method. In computer every polygon P of n vertices may be parti- graphics, polygon triangulation algorithms are tioned into triangles by adding the diagonals.

320 A Contribution to Triangulation Algorithms for Simple Polygons

Fig. 1. a Low quality triangulation; b High quality triangulation; c Triangulation with Steiner’s Points.

There is a large number of different ways how triangulation can be considered as a low qual- to triangulate a given polygon. What all these ity, because there are a lot of sliver triangles.

possibilities have in common is that the number The algorithms based on Delaunay triangula-

 of diagonals is n 3 and the number of the tri- tion ensure better triangulation Figure 1b . The

being generated is n 2. For details and quality can be significantly improved by using

  proofs see  OROU94 . so-called Steiner’s points Figure 1c . Following the fact of existence of the diagonal, a basic triangulation algorithm can be constructed 3. Polygon triangulation algorithms based as follows: on diagonal inserting Find a diagonal, cut the polygon into two

pieces, and recurs each. History of the polygon triangulation algorithms  began in 1911  LENN11 . In that year Lennes Finding diagonals is a simple task, which is re- proposed the “algorithm” which worked by re- peated until all diagonals of the polygon are cursively inserting diagonals between pairs of

determined. This can be described as follows: 2  vertices of P and ran in On . At that time For every edge e of the polygon not inci- mathematicians were interested in constructive dent to either end of the potential diagonal proofs of existence of triangulation for simple s, check if e intersects s. As soon as an polygons. Since then, this type of algorithm intersection is detected, it is known that reappeared in many papers and books. Induc-

s is not a diagonal. If no polygon edge tive proof for the existence of triangulation was  intersects s, then s is a diagonal. proposed by Meisters  MEIS75 . He proposed an ear searching method and then cutting them

A rough analysis shows that such algorithm  off. Vertex vi of simple polygon P is a principal

4 n

 takes O n time. Namely there are 2  vertex if no other vertex of P lies in the interior

2

of the vi1, vi, vi 1 or in the interior 

On diagonal candidates. Testing each of

of the diagonal vi1, vi 1. A principal vertex  them with all polygon edges costs On time.

3 vi of simple polygon P is an ear if the diago- 

Repeating this On process for each of the nal vi1, vi 1 lies entirely in P. We say that n 3 diagonals gives us an algorithm with at

4 two ears vi, vj are non-overlapping if interior 

most On running time. Such a direct ap-

   

v v v v v v 0 see Figure proach is, of course, too inefficient and therefore i 1 i i 1 j 1 j j 1 2. many authors proposed much faster triangula- tion algorithms.

There are different possibilities how to triangu-  late a given polygon see Fig. 1 . For some applications it is essential that the minimum in- terior of a triangle of the computed tri- angulation is as large as possible which defines quality. How the algorithms triangulated a sim- ple polygon depended on the technique used by Fig. 2. Triangle v1v2v3 is an ear of polygon. the algorithm. In Figure 1a for example, the

A Contribution to Triangulation Algorithms for Simple Polygons 321

    Meisters proved the next theorem  MEIS75 : achieves O n log n running time CHAZ82 . Except for triangles, every simple poly- Very complicated data structures are used in

gon P has at least two non-overlapping Tarjan and Van Wyk’s algorithm running in

   ears. On log log n time TARJ89 . However, Kirk- patrik introduced an algorithm with the same A direct implementation of this idea leads to a but with simple data structures

3

  complexity of O n . But in 1990 it was dis-  KIRK90 . covered that prune and search technique finds

Next improvement of speed was gained by algo- 

an ear in the linear time  GIND93 . It is based

  on the following observation: rithms with time complexity On log n . Such algorithms were not just faster but also sim- A good subpolygon P1 of a simple poly- pler to implement. They all have in common

gon P is a subpolygon whose boundary  a randomized “Las Vegas” approach. The differs from that of P in one edge at the best known algorithm was suggested by Seidel

most.   SEID91 . His algorithm runs in practice almost The basic observation here is that a good sub- in linear time for the majority simple polygons. polygon P1 has at least one proper ear. Strategy The algorithm has three steps: is as follows: trapezoidal decomposition of the polygon, Split the polygon P of n vertices into two

determination of ’s chains,  subpolygons in On time such that one

of these subpolygons is a good subpoly- and finally,

b  c  gon with at most n 2 1 vertices. Each the triangulation of these monotone poly- subpolygon is then solved recursively. gon’s chains.

The worst case running time of the algorithm is The efficiency of Seidel’s algorithm is achieved

  b  c  

T n cn T n 2 1 , where c is a constant. by very efficient trapezoidal decomposition,

  This recurrence has solution T n O n . That which works in two steps: leads to implementation of Meisters’s algorithm

2 first a random permutation of edges is deter-  with the complexity of On . mined, and Garey, Johnson, Preparata and Tarjan proposed

a divide — and — conquer algorithm which first these edges are inserted incrementally into

2

  

broke On time complexity 1978 GARE78 . trapezoidal decomposition.  Algorithm runs in On log n time. Their ap- With two corresponding structures containing proach includes two steps: the first one de- current decomposition and search structure pre-

composes simple polygon into monotone sub-  

sented algorithm runs in On log n time.  polygons in On log n . The second step tri- angulates these monotone sub-polygons, which Researches also searched for classes of poly- can be done in a linear time. A different divide gons that can be triangulated in a linear time.

— and — conquer approach by Chazelle also They determined that monotone polygons Fig.

  Fig. 3. Star polygons a , edge visible polygons b and monotone polygons c can be triangulated in linear time.

322 A Contribution to Triangulation Algorithms for Simple Polygons

3c, star-shaped polygons each point in the the vertical position in a clockwise counter-



polygon can be connected to star point p that clockwise manner we decrement increment

no edge of polygon boundary is intersected a winding counter by one. L is spiraling anti-

 

Fig. 3a , spiral polygons, L-convex polygons, spiraling if the winding counter is never decre-

 edge visible polygons each point in the poly- mented incremented twice in succession. A gon can be connected to one point of edge e that new polygonal chain is restarted only when the

no edge of polygon boundary is intersected previous chain ceases to be spiraling or anti- Fig. 3b, intersection-free polygons and palm- spiraling.

shaped polygons could be triangulated in linear  Toussaint proposed in  TOUS91 another adap-

time

   tive algorithm which runs in On 1 t0 ; t0 Some researches designed adaptive algorithms n. The quantity t0 measures the shape-comple- that run fast in many situations. Hertel and xity of the triangulation delivered by the algo- Mehlhorn described a sweep-line based algo- rithm. More precisely, t0 is the number of tri-

rithm that runs faster if a polygon has fewer angles contained in the triangulation that share  concave vertices  HERT83 . Algorithm’s run- zero edges with the input polygon. The algo-

2

   ning time is On r log r where r denotes the rithm runs in O n in the worst case, but for number of concave vertices of P. several classes of polygons it runs in the linear time. The algorithm is very simple to imple- Chazelle and Incerpi also presented algorithm ment, because it does not require sorting or the

where time complexity depends on shape of the use of balanced tree structures. 

polygon  CHAZ84 . They describe a triangula- 

tion algorithm that runs in On log s time where Kong, Everett and Toussaint algorithm is based

  s  n. The quantity s measures the sinuosity of on the Graham scan KONG90 . The Graham the polygon representing how many times the scan is a fundamental backtracking technique polygon’s boundary alternates between com- in computational geometry. It has been shown

plete spirals of opposite orientation. In practice, how to use the Graham scan for triangulating

 quantity s is very small or a constant, even for simple polygon in Okn time where k 1is

very winding polygons. Consider the m otion of the number of concave vertices in P. Although

  the worst case algorithm’s time complexity is a straight line L vi vi1 passing through edge

2

  

vi, vi1 where 0 i n. Every time L reaches O n , it is easy to be implemented and there-

Time complexity Author Year Technique/Algorithm

2  On Lennes 1911 Recursive diagonal insertion

3  On Meisters 1975 Ear cutting

2 

On ElGindy, Everrett, Toussaint 1990 Prune and search 

On log n Garey, Johnson, Preparata, Tarjan 1978 Decomp. into monotone polygons 

On log n Chazelle 1982 Divide and conquer

 

On r log r Hertel & Mehlhorn 1983 Sweep — line 

On log s Chazelle & Incerpi 1983 —

 

On 1 t0 Toussaint 1988 — 

Okn Kong, Everett, Toussaint 1990 Graham scan 

On log log n Tarjan, Van Wyk 1987 — 

On log log n Kirkpatrik 1990 —

 

On log n Clarkson, Tarjan, Van Wyk 1989 Randomized incremental

 

On log n Kirkpatrik, Klawe, Tarjan 1990 Using bounded integer coordinates

 

On log n Seidel 1990 Randomized incremental  On Chazelle 1990 —

Table 1. Algorithms for computing triangulation of simple polygon based on diagonal inserting. A Contribution to Triangulation Algorithms for Simple Polygons 323

fore it is useful in practice. The algorithm adapts 4. Polygon triangulation algorithms based the Graham scan as following: on Delaunay triangulation The vertices of polygon P are scanned in order starting with v2. At each step the Triangulation of the simple polygons can also be

current vertex is tested to determine if it achieved by the well-known Delaunay triangu-  is the top of an ear. If it is not, the current lation  FLOR92 on a set of points. Namely, the vertex is advanced, otherwise it is an ear vertices of a polygon can be considered as indi- and can be cut off. In that case current vidual input points in the plane. When comput- vertex is not advanced, except for a spe- ing the Delaunay triangulation we have to con-

cial case where the next vertex following sider that some line segments edges of poly-

cut ear is v0. gon must exist at the output. That problem is

known as a constrained Delaunay triangulation 

Finally, in 1991 Chazelle presented On worst- 

CDT .  case algorithm  CHAZ91 . Basic idea is in deterministic algorithm that computes structure Let V be a set of points in the plane and L called visibility map. This structure is a gener- set of non-intersecting line segments having

alization of a trapezoidation horizontal chords their extreme vertices at points of V. The pair

 towards both sides of each vertex in a polygonal G V L defines a constraint graph.

chain are drawn. His algorithm mimics merge sort. The polygon of n vertices is partitioned Two vertices PiPj V are said to be mutually visible if either segment P P does not intersect into chains with n2 vertices, and these into i j any constraint segment or P P is a subsegment chains of n4 vertices, and so on. The visibility i j

map of a chain is found by merging the maps of a constraint segment of L.  of its subchains. This actually takes On log n Now the visibility graph of G is a pair Gv 

time at the most. But Chazelle improves the

   f  j Vv Ev ; Vv V and Ev Pi Pj Pi Pj process by dividing it into two phases. The Vv and Pi Pj are mutually visible with respect

first phase includes computing coarse approx-

 to set Lg see Fig. 4b . imations of the visibility maps. This visibility maps are coarse enough that merging can be ac- An edge in Ev joins a pair of mutually visible complished in a linear time. The second phase points of V with respect to all straight-line seg- refines the coarse map into a complete visibility ments belonging to L. map, also in the linear time. A triangulation is So, triangulation of V constrained by L is de-

then produced from the trapezoidation defined

    fined as a graph T V; L V E ; V V by the visibility map. The algorithm has a lot t t t

and E is a maximal subset of E L such that of details and therefore it remains open to find t v

L E , and no two edges of E intersect, except a simple and fast algorithm for triangulating a t t at their endpoints.

polygon in the linear time. All mentioned algo-  rithms are summarized in Table 1. A CDT T V; L of set of points V with respect to

a set of straight-line segments L is a constrained

Fig. 4. a Empty circle property; b Visibility map; c Constrained Delaunay triangulation. 324 A Contribution to Triangulation Algorithms for Simple Polygons

triangulation of V in which the circumcircle of can be found in a linear time such that segment each triangle t of T does not contain in its in- t1t2 is completely internal to P. Each of the

terior any other vertex P of T which is visible two simple subpolygons resulting from the cut

  from the three vertices of t see Fig. 4c . An- of P by t1t2 has at least n 3 vertices. Lee and other characterization of CDT is given by the Lin’s algorithm subdivides the given polygon Q empty circle property: a triangle t in a con- into two subpolygons Ql and Qr and recursively strained triangulation T is a Delaunay triangle computes the constrained Delaunay triangula- if there does not exist any ot her vertex of T tions Tl and Tr. The resulting triangulation T

inside the circumcircle of t and visible from all of Q is obtained by merging Tl and Tr. They  three vertices of t see Fig. 4a . See details in also proposed a similar algorithm for general

2

   FLOR92 . constraint graph which runs in On . The Delaunay triangulation of simple polygon can be generally computed as follows: the first 4.2. Constrained Delaunay triangulation step computes CDT of edges of simple polygon algorithms for general constraint and the second step removes triangles that are graphs in exterior of simple polygon. The information

that input is a simple polygon not just general  Chew describes an On log n algorithm for the constraint graph could be useful in step one and CDT based on the divide-and-conquer approach.

therefore algorithms for building a CDT can be

 The constraint graph G  V L is assumed

subdivided into two groups: to be contained in a , which is subdi-

  algorithms for computing the CDT when the vided into vertical strips CHEW87 . In each constraint graph is a simple polygon, strip there is exactly one vertex. The CDT is computed for each strip and adjacent strips are algorithms for computing a CDT for general recursively merged together. After last merge constraint graph. we got the final CDT. The major problem here is merging those strips that contain edges, which 4.1. Constrained Delaunay triangulation cross some strip having no endpoint in it. algorithms for simple polygons Algorithm for computing CDT, which includes

preprocessing on the constraint segments, is 

2   Lewis and Robinson described an On al- proposed by Bossiant BOIS88 . By prepro- gorithm based on divide-and-conquer approach cessing CDT, the problem is transformed into

standard Delaunay problem on a set of points.  with internal points of simple polygon  LEWI79 . The boundary polygon is recursively subdivided The idea is to modify the input data by adding into almost equally sized subpolygons that are points lying on the constraint segments in such separately triangulated together with their inter- a way that resulting Delaunay triangulation is nal points. The resulting triangulation is then guaranteed to contain such segments. Con- optimized to produce CDT. straint segment e is a Delaunay edge if the circle having e as diameter does not intersect any other

2  A recursive On algorithm for CDT based constraint segment. If the circle attached to e

on visibility approach is described by Floriani intersects some other segment, then e is split   FLOR85 . The algorithm computes the visibil- into a finite number of subsegments such that ity graph of the vertices of the simple polygon none of the circles attached to those segments

2 

Q in On time and the Voronoi diagram P of intersect any constraint. When two constraint  set of its vertices in On log n . The resulting segments intersect at an endpoint, one new point Delaunay triangulation is built by joining each is inserted into both segments. The circumcircle vertex Q of P to those vertices that are both of the triangle defined by the common endpoint visible from Q and Voronoi neighbors of Q. and by the two new points does not intersect any

other constraint segment. This algorithm takes 

Another On log n algorithm was described by 

at most On log n time and generates at most 

Lee and Lin in  FLOR92 . The algorithm is  based on Chazelle’s polygon cutting theorem. On additional points. Chazelle has shown that for any simple poly- For CDT all the above algorithms require that gon P with n vertices, two vertices t1 and t2 of P all points are defined at the beginning of the A Contribution to Triangulation Algorithms for Simple Polygons 325

triangulation process. An algorithm proposed In that case the number of output triangles is in-  by Floriani and Puppo  FLOR92 resolves CDT creased regarding the minimum number of tri- problem by incrementally updating CDT as new angles in output triangulation. In other words,

points and constraints are added. The problem we want to provide shape guarantee minimum

of incrementally building of CDT is reduced to interior angle is as high as possible with mini-

the following three subproblems: mum triangles in the output triangulation size

– computation of an initial triangulation of the guarantee. domain, One of such techniques of triangulation points – insertion of a point, and straight-lines is Delaunay refinement tech- nique. Chew presented a Delaunay refinement – insertion of a straight-line segment. algorithm that triangulates a given polygon into An initial triangulation of the domain can be a mesh. In mesh all triangles are between 30 obtained by different approaches. For example, and 120 . The algorithm produces a uniform

we can determine a triangle or rectangle made mesh to obtain all triangles of the roughly the

  of two triangles, which contain the whole do- same size CHEW89 .

main. Then, points and straight-lines are in-  crementally inserted. After each insertion we Ruppert extended Chew’s work  RUPP94 by get new CDT which has more elements than the giving an algorithm such that all triangles in the

previous one. After inserting the last point or output have angles between π 2α. Parame-  straight-line, the bounding triangle is removed. ter α can be chosen between 0 and 20 . The

2 triangulation maintained here is a Delaunay tri-  Algorithm runs at most in Oln where n is number of points and l the number of straight- angulation set of points which is computed at line segments in the final CDT. the beginning. Vertices for Delaunay triangu- lation are in that case endpoints of segments Table 2 shows the algorithms for computing tri- and possible isolated vertices. After comput- angulation of a simple polygon based on Delau- ing Delaunay triangulation, vertices are added nay triangulation. for two reasons: to improve triangle shape, and to ensure that all input segments are presented in Delaunay triangulation. Two basic opera- 5. Polygon triangulation algorithms by tions in the algorithm are splitting a segment using Steiner points by adding a vertex at its midpoint, and splitting a triangle with a vertex at its circumcenter. In Finally, the algorithms that care also about the each case, the new vertex is added to set of ver- quality of triangulation are considered. The tices. When a segment is split, it is replaced in quality is checked regarding the minimum in- set of segments by two subsegments. Such algo-

2  terior angle of triangles in the output triangula- rithms runs in OM time, where M is number tion. Generally, that feature is possible only if of vertices at the output, but in practice are very the use of so-called Steiner points is allowed. fast.

Time complexity Author Year Input

2 

On Lewis, Robinson 1979 Simple polygon 

On log n Floriani 1985 Simple polygon  On log n Lee, Lin 1980 Simple polygon

2 

On Lee, Lin 1980 General 

On log n Chew 1987 General  On log n Boissonnat 1988 General

2  Oln Floriani, Puppo 1992 General

Table 2. Triangulation algorithms based on Delaunay triangulation. 326 A Contribution to Triangulation Algorithms for Simple Polygons

Time complexity Author Year Input

 

On log n k Bern, Eppstein 1991 General 

On log n Bern, Dobkin 1995 Simple polygon  On log 2n Bern, Mitchell 1995 Simple polygon

2  OM Chew 1989 Simple polygon

2  OM Ruppert 1994 General

Table 3. Triangulation algorithms based on using Steiner points.

Some other algorithms that give shape guaran- each other and to sides of the domain. Disk tees are available. They are more complicated packing is such that each region not covered

to implement and are not based on Delaunay has at most four sides. The algorithm then adds  triangulation. Baker  BAKE88 has given an edges between ce ntres of disks and points of algorithm to triangulate the interior of a simple tangency on their boundaries, thereby dividing

polygon with elements whose angles are be- the domain into small polygons. Second stage  tween 13 and 90 . The number of triangles triangulates the small polygons using Steiner used by their algorithm may be unnecessarily points located only interior to the polygons or large. But they suggested that quadtrees might on the domain boundary.

improve the size of the triangulation. Bern, Table 3 shows algorithms and their time com-  Eppstein and Gilbert  BERN92 followed up plexities described in this section. this suggestion, as well as giving a new size bound. They showed how to triangulate a pla- nar point set or poligonally bounded domain 6. Common features of groups of

with triangles of bounded aspect ratio. Trian- algorithms for polygon triangulation  gulation has size number of triangles within a constant factor of optimal and runs in opti-

In this section, general properties of all three

  mal time On log n k with input of size n and output of size k. Bern, Dobkin, and Eppstein groups of the algorithms for polygon triangula-

tion algorithms based on diagonal insertion,   BERN95 showed how to triangulate polygonal regions with triangles of guaranteed quality. Al- algorithms based on Delaunay triangulation,

and algorithms using Steiner points are con-  gorithm guarantees, using On triangles, that

sidered. Attributes interesting for comparisons 

the smallest height shortest dimension of a tri- 

angle in a triangulation of an n-vertex polygon are  SHEW :



with holes is a constant factor of the largest quality of a triangulation,  possible. Using On log n triangles for sim-

number of output triangles, and

32

  ple polygons O n for polygons with holes

they guarantee the largest angle is not greater the possibility of triangulating polygons with

than 150 . Such triangulation can be obtained holes.

  

in On log n time O n log n k for polygons

  Figure 5 shows extended figure from RUPP94

with holes. Another algorithm presented by how different triangulation is obtained while tri-  Bern, Mitchell and Ruppert  BEMI95 consid- angulating the same polygon by different algo- ers triangulation of n-vertex polygonal regions rithms: so that no angle in the final triangulation mea-

triangulation in Fig. 5a has been generated by sures more than π 2. The number of triangles in

Seidel’s randomized incremental algorithm 

the triangulation is only On and the running 

2 generates the output in Fig. 5a  SEID91 ba-  time is On log n . Algorithm also considers holes in polygons. Basic new technique used in sed on diagonal inserting,

the algorithm is recursive subdivision by disks De Floriani and Puppo’s constrained Delau-

and consists of two stages: first stage packs the nay triangulation generated the Fig. 5b

  domain with non-overlapping disks, tangent to  FLOR92 based on Delaunay triangulation ,

A Contribution to Triangulation Algorithms for Simple Polygons 327

 

Fig. 5. a Diagonal inserting Seidel ;b Constrained Delaunay triangulation De Floriani & Puppo ;c Delaunay refinement Ruppert .

Fig. 5c shows the output of Ruppert’s Delau- The algorithms based on Delaunay triangulation

 nay refinement algorithm  RUPP94 using and those using Steiner points handle polygons

Steiner points. with holes very easily. They triangulate also the holes, but because we know which edges of the It is obvious; the algorithms that use Steiner polygon belong to the holes, the triangles inside points achieve the best output triangulation. the holes can be easily removed. The majority They have built-in mechanism ensuring the qual- of algorithms based on diagonal insertion can- ity of the output triangulation. However, they produced also the larger number of triangles. not perform the triangulation of polygons con- Delaunay-based algorithms provide the highest taining holes. One of the exceptions is Seidel’s

randomized incremental algorithm. Originally,  quality possible on the original vertices Fig. 5c . During the construction of the triangulation, it has not being designed to handle polygons they consider so-called Delaunay empty-circle with holes, but it turned out that this extension property already mentioned in Section 4. Al- is very simple. The solution is described in the gorithms based on the diagonal insertion do not next section. care at all about the quality of the triangula- Concerning speed of the algorithms it is re- tion and because of this, different outputs are ally difficult to compare them. In each group

obtained by different algorithms see section 7  there are the solutions working in On log n where four algorithms from this group are com-

time we do not take into account Chazelle’s pared. However, Delaunay-based algorithms algorithm which has not yet been successfully and the algorithms based on diagonal insertion

implemented. However, concerning the im- always generate exactly n 2 triangles. If we plementation, the algorithms based on diagonal want to obtain the smallest number of trian- inserting are the easiest to implement. gles possible, and we want to be sure about the quality of the triangulation, then one of the al- gorithms based on Delaunay triangulation has to be used.

328 A Contribution to Triangulation Algorithms for Simple Polygons 

7. Comparison of triangulation algorithms ham scan algorithm  KONG90 , and Seidel’s  based on diagonal insertion randomized incremental algorithm  SEID91 . All the algorithms have been implemented in

C using the same data structures. Figure 6 We have already mentioned that the algorithms shows how different output is generated by these based on diagonal insertion do not use any cri- four algorithms. teria regarding the quality of the generated tri- angulation and therefore they produce also very We tested the speed of the algorithms on two different results. This is the reason why in this types of polygons: concave polygons and con- section some algorithms based on diagonal in- vex polygons. We also took convex polygons to sertion are analyzed. determine how fast the algorithms are on poly-

The following algorithms have been chosen: a gons where triangulation can be obtained in lin-



recursive diagonal inserting algorithm  TOUS91 , ear time with the simple algorithm see table 4,

 

an ear cutting algorithm  MEIS75 , Kong’s Gra- column Actual Running Time .

Fig. 6. a Diagonal inserting; b Ear cutting; c Graham scan; d Randomized incremental.

Actual running time Running Average Algorithm in ms for 5000 points Holes time angle Convex Concave

2 

  Recursive diagonal inserting On 3 40 5523 5671 No

3 

 

Ear cutting On 2 45 10285 10325 No



 

Kong’s Graham scan Okn 4 06 6970 6950 No





  Seidel’s rand. Incremental On log n 7 94 330 331 Yes

Table 4. Comparison of algorithms based on diagonal insertion.

A Contribution to Triangulation Algorithms for Simple Polygons 329 Fig. 7. Speed of algorithms left — concave polygon; right — .

Fig. 7 presents the graph showing the running dation we only construct monotone polygons, time of the considered algorithms. For each which are lying in the polygons but not in holes. type of polygons we measured the speed when As shown from Table 4 the Seidel’s algorithm polygons contain from 3 to 2000 vertices with is the best regarding all other three algorithms. step 50. It is clearly seen that Seidel’s random- The price for this is more complicated imple- ized algorithm is in practice the fastest algo- mentation. rithm among all compared algorithms. Seidel’s algorithm is also not sensitive to on the type of the input polygon. Other three algorithms are 8. Conclusions considerably slower and their run-time depends

on the shape of the input polygon compare left Triangulation of a simple polygon is the fre- and right Fig. 7. quent task in computational geometry and its

As we already said, the algorithms from this applications geographic information systems,

group do not contain any mechanism for ensur- finite element mesh generation and today, a ing the quality, and because of different tech- large number of different algorithms are known. niques used, the algorithms provide different These algorithms can be classified into three quality of the output triangles. Table 4 shows major groups: methods based on diagonal inser- the average minimum interior angle of obtained tion, constrained Delaunay approaches, and al- triangles for concave polygons with 500 vertices gorithms using Steiner points. All three groups

test was repeated 100 times on different poly- are considered in the paper and the most pop-

gons with 500 vertices. Again, the Seidel’s ular algorithms are briefly described. We have randomized incremental algorithm provides the pointed on the most important characteristics of best result. The reason is that Seidel’s algo- each group regarding the number of output tri- rithms first decompose the input polygon into angles, the quality of the triangulation, and the monotone polygons followed by partitioning of possibility to handle the algorithms with holes. polygons into triangles. Because algorithms based on diagonal insertion do not include any strategy for optimization Only Seidel’s algorithm is capable to solve situ- their output, the resulting triangulations differ

ations when the polygons containing holes are noticeably. Because of this we compared four  considered see Table 4, column holes . This is algorithms from this group regarding the run possible because Seidel’s randomized algorithm time, the quality of the output triangulation, and takes edges randomly on input and builds trape- the ability of solving the polygons with holes. zoidation. Therefore, we can also add edges of We have shown that Seidel’s algorithm is the holes on input. After building such trapezoi- best in this category.

330 A Contribution to Triangulation Algorithms for Simple Polygons  The development of polygon triangulation algo-  10 L. P. CHEW, Constrained Delaunay triangulation.

rithms is still attractive research topic in com- Presented at the Proceedings, Third ACM Sympo- sium on Computational Geometry, 1987 , Water-

putational geometry. The real challenge is loo, 216-222. 

Chazelle diagonal inserting algorithm  CHAZ91 .   11 L. P. CHEW, Guaranteed — quality triangular Although theoretically known from 1991, up meshes. Technical report, No. TR-89-983, Cornell to now there is no any successful implemen- University, 1989.

tation. The new algorithms are still expected   12 L. DE FLORIANI,B.FALCIDIENO,C.A.PIENOVI, among the constraint Delaunay triangulation al- Delaunay-based representation of surfaces defined

gorithms and especially among the algorithms over arbitrarily-shaped domains. Comput. Vision

using Steiner points. Graphics Image Processing. 32 1985 , 127-140.   13 L. DE FLORIANI,E.PUPPO, An On-Line Algorithm

for Constrained Delaunay Triangulation, Graphical Models and Image Processing, 3 1992 , 290-300.

9. Acknowledgement   14 M. R. GAREY,D.S.JOHNSON,F.P.PREPARATA,R.

E. TARJAN, Triangulating a simple polygon, Inform.

This work has been carried out within a Valva- Process., 7 1978 , 175-180.

  sorALIS program supported by British Coun- 15 H. ELGINDY,H.EVERETT,G.T.TOUSSAINT, Slicing an ear in linear time. Pattern Recognition Letters,

cil title of the project Computational geometry 14 1993 , 719-722.

and its applications in medical visualization.   16 S. HERTEL,K.MEHLHORN, Fast triangulation of

simple polygons. Presented at Proceedings 4th In- ternat. Conf. Theory, 1983 pp. 207-215.

References 

 17 D. G. KIRKOATRICK,M.M.KLAWE,R.E.TAR- JAN, On log log n polygon triangulation with sim-

ple data structures. Presented at ACM Symposium

on Computational Geometry,61990 pp. 34-43,   1 B. BAKER,E.GROSSE,C.RAFFERTY Nonobtuse Berkeley, California.

triangulation of polygons. Discrete and Comp. Ge-

  ometry, 3 1988 , 147-168. 18 X. KONG,H.EVERETT,G.T.TOUSSAINT, The gra-

ham scan triangulates simple polygons. Pattern

  2 M. BERN,S.MITCHELL,J.RUPPERT Linear-Size Recognition Letters, 11 1990 , 713-716.

Nonobtuse Triangulation of Polygons. Discrete 

 19 N. J. LENNES, Theorems on the simple finite polygon Comput. Geometry, 14 1995 , 411-428.

and polyhedron. American Journal of Mathematics,

33 1911 , 37-62.   3 M. BERG,M.KREVELD,M.OVERMARS,O.

SCHWARZKOPF, Computational Geometry, Algo-   20 B. A. LEWIS,J.S.ROBINSO, Triangulating of planar

rithms and Application. Springer Verlog, 1997. regions with applications. Comput. J., 4 1979 ,

324-332. 

 4 M. BERN,D.EPPSTEIN,J.R.GILBERT, Provably  good mesh generation. Presented at the Proceed-  21 G. H. MEISTERS, Polygons have ears. American

st

ings of the 31 Annual Symposium on Foundation Mathematical Monthly, 82 1975 , 648-651.

of Computer Science, 1990 , 231-241.   22 J. O’ROURKE, Computational Geometry in C. Cam-

bridge University Press, 1994.   5 M. BERN,D.DOBKIN,D.EPPSTEIN, Triangulating

polygons without large Angles. Computationl Ge- 

 23 J. RUPPERT, A Delaunay Refinemt Algo- ometry & Applications, 5 1995 , 171-192. rithm for Quality 2-Dimensional Mesh Gen-

eration. NASA Arnes Research Center, Sub- 

 6 J. D. BOISSONNAT, Shape reconstruction from pla- mission to Journal of Algorithms, 1994 ,

nar cross sections. Comput. Vision Graphics Image

httpjitarcnasagovnasabshtml

Process., 44 1988 , 1-29. 

 24 R. SEIDEL, A simple and fast incremental random-   7 B. A. CHAZELLE, Theorem on polygon cutting with ized algorithm for computing trapezoidal decom- applications. Presented at the Proceedings of the positions and for triangulating polygons. Compu-

23rd IEEE Symposium on Foundation of Computer tational Geometry: Theory and Applications, 1

1991 , 51-64.

Science, 1982 , Chicago, 339-349. 

 25 J. R. SHEWCHUK, Triangle: Engieering a 2D Qual-   8 B. CHAZELLE,J.INCERPI, Triangulation and shape ity Mesh Generator and Delaunay Triangulator. complexity. ACM Transactions on Graphics, 3

Carnegie Mellon University, ftpcscmuedu

1984 , 135-152.

 

 26 R. E. TARJAN,C.J.VA N WYK,AnO n log log n —   9 B. CHAZELLE, Triangulating a simple polygon in time algorithm for a simple polygon triangulation

linear time. Discrete Computational Geometry, 6 and its evaluation. IEICE Technical report, No. 1991 , 485-524. PRU89-41, September 1989.

A Contribution to Triangulation Algorithms for Simple Polygons 331 

 27 G. T. TOUSSAINT, Efficient triangulation of simple polygons. The Visual Computer, 7 1991 , 280-295.

Received: October, 2000 Accepted: November, 2000

Contact address: Marko Lamot Hermes Softlab Litijska 51 1000 Ljubljana Slovenia

Tel: 386 61 1865 815;

Fax: 386 61 1865 816;

e-mail: markolamothermessi Borut Zalikˇ University of Maribor Faculty of Electrical Engineering and Computer Sciences Smetanova 17 2000 Maribor Slovenia

MARKO LAMOT currently works for at Hermes SoftLab computer com- pany, Ljubljana, Slovenia. He received his BSc in computer engineering in 1996 from the University of Maribor, Slovenia. Currently he is work- ing on his PhD degree at University of Maribor. His research interests include computational geometry especially triangulating algorithms and uniform grids.

BORUT Zˇ ALIK is currently an associate professor at the Faculty of Elec- trical Engineering and Computer Science at the University of Maribor, Slovenia. He also has a position of a senior research fellow at De Mont- fort University, U. K. He received his BSc in electrical engineering in 1985, MSc and PhD in computer science, both from the University of Maribor in 1989 and 1993, respectively. His research interests include computational geometry, geometric modeling, GIS applications, and multimedia applications.