[ieee 2009 ieee-rivf international conference on computing and communication technologies - danang...

4
A fast algorithm for constructing constrained Delaunay triangulation Nguyen Minh Nam GIS Department Vietbando Company Ho Chi Minh city, Vietnam [email protected] Hoang Van Kiem University of Information Technology National University of HCMC Ho Chi Minh city, Vietnam [email protected] Nguyen Vinh Nam GIS Deparment Vietbando Company Ho Chi Minh city, Vietnam [email protected] Abstract - This paper presents a fast incremental insertion algorithm for constructing constrained Delaunay triangulation. Constraints are considered any kind of polylgonal lines. The bottleneck of incremental Delaunay triangulation algorithm is the search for a triangle containing current integrating point. The advantage of our algorithm over the others is that we used an efficient Skvortsov’s algorithm, dynamic uniform grid. It is used to insert point into an existing triangulation. A Topology model is used to represent a triangle network so that we can easily and fast locate a point in a triangulation. The rest of algorithm presents a method for constrained edges, already proposed by Anglada. The algorithm is fast and easy to implement. Keywords - Computation Geometry; Triangulated Irregular Network; Delaunay Triangulation; Constrained Delaunay Triangulation; Uniform Grid I. INTRODUCTION AND RELATED WORK Delaunay Triangulation and Constrained Delaunay Triangulation are popular tools used for the representation of planar domains. Several applications in the fields of nearest neighbor search, data visualization, mesh generation, and geographic information system. A triangulation T(V) of a set of vertices V in the R 2 is a set of edges E such that: No two edges in E intersect at a vertex not in V and The edges in E divide the convex hull of V into trian- gles. Triangulation T(V) is Delaunay triangulation DT(P) if the circumcircle of any triangle does not contain any vertex of V in its interior. The constrained Delaunay triangulation (CDT) is an extension of the Delaunay triangulation (DT) to handle constraints. This work presents the implementation of incremental algorithm permitting to efficiently update CDT’s constraints. II. BACKGROUND AND PROBLEM DEFINITION Let V be a finite set of vertices in R 2 . Let E be a set of edges where each edge has as its endpoints vertices in V. Edges are closed line segments. A triangulation T = (V, E) is a planar graph such that: no edge contains a vertex other than its endpoints, no two edges cross, and all faces are triangles with their union being the convex hull of V. Let T = (V, E) be a triangulation. An edge еE, with endpoints a, bV, is a Delaunay edge if there exists a circle through a and b so that no points of V lie inside this circle. If T has only Delaunay edges, T is called a Delaunay Triangulation (DT) of V. Let S = {C 0 , C 1 , ..., C m-1 } be a set of m constraints, such that for each i{0,1, ,..., m-1}, constraint C i is defined as a finite sequence of points in R 2 . C i represents a polygonal line. Polygonal lines are allowed to be of any form: open or closed, with self-intersections, with overlapped portions or with duplicated points. For simplicity of notation, we call the segments or points of all the constraints in S by simply the segments or points in S. Let S be a set of constraints as defined above. T(S) = (V, E) is a Constrained Delaunay Triangulation (CDT) of S if: For each segment sS, there is a number of edges in E such that their union is equal to s. Such edges are called constrained. For every non-constrained edge eE, e is a Delaunay edge with respect only to the vertices connected with edges to the endpoints of e. Figure 1. Left: a set of constraints S composed of a square, a triangle, a non- simple polygon, and a polyline. Right: CDT(S) III. THE ALGORITHM Given a constraint to be inserted in a CDT, we incrementally insert all its points and then all its edges, as shown in the following routine: Incremental insertion algorithm for DT, Segment Insertion. 978-1-4244-4568-4/09/$25.00 ©2009 IEEE 1

Upload: nguyen-vinh

Post on 09-Mar-2017

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: [IEEE 2009 IEEE-RIVF International Conference on Computing and Communication Technologies - Danang City, Viet Nam (2009.07.13-2009.07.17)] 2009 IEEE-RIVF International Conference on

A fast algorithm for constructing constrained Delaunay triangulation

Nguyen Minh Nam GIS Department

Vietbando Company Ho Chi Minh city, Vietnam

[email protected]

Hoang Van Kiem University of Information Technology

National University of HCMC Ho Chi Minh city, Vietnam

[email protected]

Nguyen Vinh Nam GIS Deparment

Vietbando Company Ho Chi Minh city, Vietnam

[email protected] Abstract - This paper presents a fast incremental insertion algorithm for constructing constrained Delaunay triangulation. Constraints are considered any kind of polylgonal lines. The bottleneck of incremental Delaunay triangulation algorithm is the search for a triangle containing current integrating point. The advantage of our algorithm over the others is that we used an efficient Skvortsov’s algorithm, dynamic uniform grid. It is used to insert point into an existing triangulation. A Topology model is used to represent a triangle network so that we can easily and fast locate a point in a triangulation. The rest of algorithm presents a method for constrained edges, already proposed by Anglada. The algorithm is fast and easy to implement.

Keywords - Computation Geometry; Triangulated Irregular Network; Delaunay Triangulation; Constrained Delaunay Triangulation; Uniform Grid

I. INTRODUCTION AND RELATED WORK Delaunay Triangulation and Constrained Delaunay

Triangulation are popular tools used for the representation of planar domains. Several applications in the fields of nearest neighbor search, data visualization, mesh generation, and geographic information system.

A triangulation T(V) of a set of vertices V in the R2 is a set of edges E such that:

• No two edges in E intersect at a vertex not in V and

• The edges in E divide the convex hull of V into trian-gles.

Triangulation T(V) is Delaunay triangulation DT(P) if the circumcircle of any triangle does not contain any vertex of V in its interior.

The constrained Delaunay triangulation (CDT) is an extension of the Delaunay triangulation (DT) to handle constraints. This work presents the implementation of incremental algorithm permitting to efficiently update CDT’s constraints.

II. BACKGROUND AND PROBLEM DEFINITION Let V be a finite set of vertices in R2. Let E be a set of

edges where each edge has as its endpoints vertices in V. Edges are closed line segments. A triangulation T = (V, E) is a planar graph such that: no edge contains a vertex other than its

endpoints, no two edges cross, and all faces are triangles with their union being the convex hull of V.

Let T = (V, E) be a triangulation. An edge е∈E, with endpoints a, b∈V, is a Delaunay edge if there exists a circle through a and b so that no points of V lie inside this circle. If T has only Delaunay edges, T is called a Delaunay Triangulation (DT) of V.

Let S = {C0, C1, ..., Cm-1} be a set of m constraints, such that for each i∈{0,1, ,..., m-1}, constraint Ci is defined as a finite sequence of points in R2. Ci represents a polygonal line. Polygonal lines are allowed to be of any form: open or closed, with self-intersections, with overlapped portions or with duplicated points. For simplicity of notation, we call the segments or points of all the constraints in S by simply the segments or points in S.

Let S be a set of constraints as defined above. T(S) = (V, E) is a Constrained Delaunay Triangulation (CDT) of S if:

• For each segment s∈S, there is a number of edges in E such that their union is equal to s. Such edges are called constrained.

• For every non-constrained edge e∈E, e is a Delaunay edge with respect only to the vertices connected with edges to the endpoints of e.

Figure 1. Left: a set of constraints S composed of a square, a triangle, a non-simple polygon, and a polyline. Right: CDT(S)

III. THE ALGORITHM Given a constraint to be inserted in a CDT, we

incrementally insert all its points and then all its edges, as shown in the following routine:

• Incremental insertion algorithm for DT,

• Segment Insertion.

978-1-4244-4568-4/09/$25.00 ©2009 IEEE1

Page 2: [IEEE 2009 IEEE-RIVF International Conference on Computing and Communication Technologies - Danang City, Viet Nam (2009.07.13-2009.07.17)] 2009 IEEE-RIVF International Conference on

A. Incremental insertion algorithm for DT The incremental insertion algorithms for Delaunay

triangulation are the simplest to implement and are therefore used most frequently. They consist of the following steps:

Initialization. An artificial figure (also called a super-figure) is created to unify the implementation. It covers the whole area being triangulated. Different simple heuristics for its construction are available. For example, the three artificial points P0, P1, and P2 are determined as follows:

P0 = (3М,0), P1 = (0,3М), and P2 = (-3М,-3М), where M is the maximum absolute value of any coordinate of a vertex in V. This ensures that triangle ΔP0P1P2 contains the whole set V (Fig. 2).

Triangulation. Points are incrementally inserted into the current DT(V) by the following actions:

• A triangle containing the inserted point is determined. The obtained triangle is split into three (four) new triangles.

• To assure the new triangulation is DT(V), the generated triangles are compared with the empty circle property using neighboring triangles. If the empty circle property is violated, the common edge of the neighboring triangles is swapped and becomes a Delaunay edge. Two new triangles are obtained and recursively checked for the empty circle property.

Finalization. Triangles defined by the vertices of the super figure are eliminated.

Figure 2. The artificial triangle

The most time consuming part of the incremental insertion algorithm is determining which triangle contains the inserted point.

Our approach of determining a point in a triangulation

There is a flat partition in R0 (a triangulation in this case) and a point (x, y). How to determine a member r0(j) (a triangle) of R0 containing the given point. The uniform grid approach has been applied by Fang, T.P., and L. Piegl [3] to fast detect a triangle containing an inserted point. In this approach, information stored in each cell is quite large. A significant improvement for the above approach is the 2-level uniform grid has been presented in [2] by B. Zalik and I. Kolingerova. The chosen structure gives the algorithm complexity approximately O(N1.1). The estimation of the grid cell based on the number of input points at the beginning can still lead to each cell handles a lot of triangles, even each cell in first level

will be divided into 9 sub-cells in the second level. Because of that inconvenient, we applied Skvortsov’s approach to build CDT [4]. This approach is more convenient when constructing CDT in case the number of inserted points increasing by the intersection of constrained edges. This algorithm ensures that from a cell we can fast determine the triangle containing the inserted point, at all time. For this purpose, we need to build a partition R1 simplifier than R0 and cover R0. And then set the relation between r1(i) of R1 and r0(j) of R0 so that r0(j) is nearest to r1(i). Start from r1(i), through the chain of neighbor elements, we will get the destination element r0(target). After finding r0(target) successfully, we can replace r1(i)→r0(target) instead of r1(i)→r0(j). And the finding process will be faster and faster. Now, we will choose a R1 as good as possible. This paper suggests R1 should be a dynamic uniform grid. For example, there is a partition completely cover the [0,1]×[0,1] square can be divided into m2 square cells. Numbering those cell with i, j ∈ [0,m-1] ⊂ N : r1(ij). With a given point (x,y), we can immediately determine a square r1([x/m],[y/m]) ([…]: integer part). One of significant improvement is the size of grid will increase depend on the number of inserted point at any time, so each cell will handle a small number of triangle to find the neighbor as little as possible. For example, when grid size increases twice for each dimension, we need to copy information from each old cell to new ones as follow:

( ) ( ) ( ) ( ) ( )jioldjinewjinewjinewjinew

old

RRRRRmji

,112,1212,12112,212,21 ,,,:1,0:,

←−∀

++++

The initial grid size m = 1. Initialize the value of the only one grid cell reference to the first triangle of triangulation that is a super-figure.

Figure 3. Localization of points inside triangle based on the uniform grid

From the inserted point, we immediately determine R1(j), in which the inserted point contained. Then, from R1(j), we reference to R0(i). If it is not triangle containing the inserted point, we will go to the next triangle base on topology relationship to the target R0(target).

Triangle references to the cell containing the inserted point

Triangle contains the inserted point Inserted point

M

(0,3M)

(-3M,-3M)

(3M,0)

P1

P2

P0

R0(j) R1(i)

step 2

step 1

R0(taget)

2

Page 3: [IEEE 2009 IEEE-RIVF International Conference on Computing and Communication Technologies - Danang City, Viet Nam (2009.07.13-2009.07.17)] 2009 IEEE-RIVF International Conference on

B. Segment insertion The final task of the insert constraint routine is to insert

segment s defined by a pair of already inserted vertices. Our implementation follows the approach taken by Anglada [1].

Figure 4. a) Example of the insertion of a segment s = {v1,v2}. b) Crossing constrained edges (in bold) are subdivided and

the intersection points are inserted. c) Remaining crossing edges are removed. d) Finally, s sub-segments are inserted, and the non-triangular faces are

retriangulated.

Let v1 and v2 be the two vertices which are the endpoints of the segment s to insert. The pseudo-code of routine InsertSegment can be summarized as follows: Procedure InsertSegment(T: CDT, s: Segment) edge_list = all constrained edges crossed by segment s = {v1,v2} For all edges e in edge_list p = intersection point between e and s InsertPointOnEdge (p, e) EndFor edge_list=all edges crossed by s For all edges e in edge_list remove edge e from the CDT EndFor vertex_list=all vertices crossed by s For all vertices v in vertex_list If (v is not the last element in vertex_list) vs = successor vertex of v in vertex_list If (if v and vs are connected by an edge) e = edge connecting v and vs Else e = add new edge in the CDT connecting v and vs UpdateDelaunayFromFace(e.left_face) UpdateDelaunayFromFace(e.right_face) EndIf EndIf EndFor EndProc

IV. DATA STRUCTURES USED The algorithms we present below require the triangulation

to be represented by an efficient data structure, i.e. capable to give all adjacency relations in constant time. We used a winged-edge topology data model [5]. There are three geometric primitives: nodes, edges, and faces.

Figure 5. Winged-edge components

We sign below geometric primitives as follows: LE: left edge, RE: right edge, LF: left face, RF: right face, FE: first edge, Pt: point.

Figure 6. Data structure of Delaunay triangulation

We used only a single linked list to store all edges of the topology model. The topology information of each edge allows the query and retrieval of nodes and faces. The proposed algorithm for constructing DT is necessary to choose the number m and make 2-dimensional array [0,m-1] [0,m-1] linking to the triangles of the triangulation. Initially, the array must be filled by referencing to the first triangle (super-figure). Then, after the next search, which was found a triangle T, starting from cell (i,j), it is necessary to update the information of the grid: r1(i, j) = a reference to T.

V. ANALYSIS OF THE ALGORITHM Algorithm Complexity:

The complexity of the constructing DT algorithm depends on some stages as below:

• Determine the triangle containing the inserted point.

• Rebuild the triangulation so that it satisfies Delaunay after disintegrating a triangle.

v2v1 a)

FE Ptnode

FEface

SN EN LE RE LF RF

edge

FE Pt

node

FE

face

SN EN LE RE LF RF

edge

SN EN LE RE LF RF

edge

NULL

SN EN LE RE LF RF

edgeT T T T T T T T

T T T T T T T T

T T T T T T T T

T T T T T T T T

T T T T T T T T

T T T T T T T T

T T T T T T T T

T T T T T T T T

start node

end node

right edge

left edge

right face

left face

v2v1 i2

i1

o2

o1 b)

v2v1 i2

i1

o2

o1 c)

v2v1 i2

i1

o2 o1

d)

3

Page 4: [IEEE 2009 IEEE-RIVF International Conference on Computing and Communication Technologies - Danang City, Viet Nam (2009.07.13-2009.07.17)] 2009 IEEE-RIVF International Conference on

• Increasing the grid size.

As we have know that the cost for rebuilding all triangulation to satisfy the Delaunay is O(N). To determine the complexity of the remaining stages, we need use the following theorems below:

Theorem 1. Given a DT of an uniform distributed point set in a square. Given 2 triangles belong to the DT. The straight move from a triangle to the other take

( ) NcNO .= operations in average, c is a constant.

Theorem 2. Given N points uniform distributed in a basic square. Assume that the grid size increases twice when the number of points in triangulation reach to 2mrn ⋅= , where r – the increasing coefficient of grid size, and m – the grid size. Then the complexity of the algorithm for constructing DT is O(N).

Proof. Consider the chain of inserted points with a fixed size of the grid pm 2= . Assume that in the last size increasing, we copy information from each old grid cell to 4 new ones. So, we need to find in 4 new cells, it mean that we must take

mic

mic =2 move operations, where i – the ith inserted point

and c is a constant. When the grid size increases twice in each dimension and the number of points in grid is 2mr ⋅ , it will satisfy the 2MrN ⋅≤ , where M – the max size of grid. Set

PM 2= . Then, the total of move operation when finding triangle is:

( ) ( )( )

∑ ∑∑−

=

+⋅=

−+⋅

⋅=⎟⎟⎠

⎞⎜⎜⎝

⎛⋅+⋅=≤

+

+

+1

1

2

22

122

21

12

12

12

2 222,,

P

p

r

rip

r

rip

p

pp

pp

p

icicrNRrNR

Replace the sum formula with the integral formula, we get the following:

( ) ( )( )

( )

( ) ( ) ( )

( )( )

( )( ) ( ) ( ) NrcrNRMcrcr

PcrPrc

Prrrc

Pr

rxcr

rxc

dpdxxcdxxcrNRrNR

P

pp

p

ppppp

pp

p

pp

pp

p

P

p

r

rp

r

rp

p

pp

pp

p

212

23

23

4223

2312

122322

312

12

122

3

2

122

3

2

22

122

21

316,4

31642

316

132

12

232

122222

232

1222

232

222

234

222,,

23

12

12

12

2

⋅=≈−⋅=−⋅=

⎟⎟

⎜⎜

⎛ ⋅=⎟⎠

⎞⎜⎝

⎛ ⋅⋅

⎟⎠

⎞⎜⎝

⎛⎟⎠⎞⎜

⎝⎛ ⋅+⋅−+⋅

⋅=

⎟⎟⎠

⎞⎜⎜⎝

+⋅⋅

⋅+

⋅+⋅

⋅=

⎟⎟⎠

⎞⎜⎜⎝

⎛⋅+⋅=≤

++

++

+

++

+⋅

−+⋅

⋅∫ ∫∫

+

+

+

In the above formula, we can see that the total of move is O(N).

The complexity of the increasing grid size algorithm is:

( ) ( )NOOO PP

p

p =−=⎟⎟⎠

⎞⎜⎜⎝

⎛ +

=∑ 122 1

1

In totally, the complexity of algorithm for constructing DT using dynamic uniform grid algorithm is O(N) in average, and O(N2) in worst case. The complexity of the algorithm for

constructing CDT in worst case O(M2), where M- number of points in the CDT after construction. Assessing the complexity on the average very much depends on the distribution of structural lines. If their number is small and they have little overlap between them, the overall assessment of the complexity approximate O(N).

VI. RESULTS The implementation was in C++ using a Intel® CPU Core

2 Dual 2.66 GHz machine with 2 GB RAM. The operating system was Windows XP. In the experiments, we tested the algorithm, using different numbers of points and edges. The performance of this algorithm greatly depends on the size of input constraints. Table 1 gives some performance data of our algorithm.

TABLE I. MEASSURED CPU TIME FOR TESTED EXAMPLES

Triangulates CPU time (ms)

Data Points Edges Cuts Insert point

Insert edge Total

world 403268 3797 0 5828 3141 8969

vietnam 2024591 162773 11174 26453 20203 46656

Figure 7. Some tested examples

VII. CONCLUSION This paper presents a fast algorithm for CDT based on an

incremental insertion approach. The most time-consuming task-the location of a triangle containing a currently inserted point-is solved by using dynamic uniform grid combined with a walking approach based on topology model. The algorithm is no more memory demanding than other approaches, and its implementation is relatively simple. All these features make the proposed algorithm very attractive for practical implementation.

REFERENCES [1] Anglada, M. V., An improved incremental algorithm for constructing

restricted Delaunay triangulations, Computers & Graphics, vol. 21, p. 215-223, 1997.

[2] Zalik, B., Kolingerova I., An incremental construction algorithm for Delaunay triangulation using the nearest-point paradigm, Int. J. Geographical information science, vol. 17, no. 2, pp. 119-138, 2003

[3] Fang T-P, Piegl L (1993) Delaunay triangulation using a uniform grid. Comput Graph Appl 13(3):36–47

[4] Скворцов А.В., Костюк Ю.Л. Эффективные алгоритмы построения триангуляции Делоне // Геоинформатика. Теория и практика. Вып. 1. Томск: Изд-во Том. ун-та, 1998. С. 22–47.

[5] http://164.214.2.59/vpfproto, “Vector Product Format Overview”.

4