## Services on Demand

## Journal

## Article

## Indicators

- Cited by SciELO
- Access statistics

## Related links

- Cited by Google
- Similars in SciELO
- Similars in Google

## Share

## Journal of the Brazilian Computer Society

##
*Print version* ISSN 0104-6500

### J. Braz. Comp. Soc. vol.9 no.3 Campinas Apr. 2004

#### http://dx.doi.org/10.1590/S0104-65002004000100006

**The Douglas-peucker algorithm: sufficiency conditions for non-self-intersections ^{1}**

**Shin-Ting Wu; Adler C. G. da Silva; Mercedes R. G. Márquez**

Universidade Estadual de Campinas (UNICAMP), Faculdade de Engenharia Elétrica e Computação (FEEC), Departamento de Engenharia de Computação e Automação Industrial (DCA), ting@dca.fee.unicamp.br, acardoso@dca.fee.unicamp.br, meche@dca.fee.unicamp.br

**ABSTRACT**

The classic Douglas-Peucker line-simplification algorithm is recognized as the one that delivers the best perceptual representations of the original lines. It may, however, produce simplified polyline that is not topologically equivalent to the original one consisting of all vertex samples. On the basis of properties of the polyline hulls, Saalfeld devised a simple rule for detecting topological inconsistencies and proposed to solve them by carrying additional refinements. In this paper, we present an alternative form for the classic Douglas-Peucker to produce a simplified polyline which is homeomorphic to the original one. Our modified Douglas-Peucker algorithm is based on two propositions: (1) when an original polyline is star-shaped, its simplification from the Douglas-Peucker procedure cannot self-intersect; and (2) for any polyline, two of its star-shaped sub-polylines may only intersect if there is a vertex of one simplified sub-polyline inside the other's corresponding region.

**Keywords:** Topological Consistency; Line Simplification; Douglas-Peucker Algorithm; GIS.

**1 Introduction**

Often the geometric resolution of a polyline is much higher than the resolution supported by the application, such as visualization of geographic map boundaries or visualization of curves approximated by sampling a parametric curve at regular small intervals in a raster display. For the sake of efficiency, we search for algorithms that can extract essential features from detailed data of the original polyline and represent them on a simple one having fewer vertices, sufficient for the specified resolution. Many of them have been pursued by the researchers in different contexts [5, 6, 8, 11, 12, 14].

A simple line-simplification algorithm consists in constructing a polyline with line segments larger than an accepted tolerance. It may be achieved by discarding recursively the subsequent vertices whose distance from a prior initial vertex is less than some specified maximum distance. The vertex that is farther away than that maximum distance is accepted as part of the new simplified polyline, and it becomes the new initial vertex for further simplification [10].

From detailed study of mathematical similarity and discrepancy measures, the Douglas-Peucker algorithm is pointed out as the most visually effective line simplification algorithm [1, 7]. Whereas vertex reduction uses closeness of vertices as a rejection criterion, the Douglas-Peucker algorithm uses the closeness of a vertex to the simplified polyline. It is a recursive procedure that starts with a line segment whose extreme vertices coincide with the extreme vertices v_{1} and v_{n} of the polyline given as a list of n vertices in sorted order. Each segment v_{k}v_{j} is split at the farthest vertex v_{i} to it, where k < i < j, until the distance between the sequence of vertices v_{k}...v_{i}. and v_{k}, v_{i} and the distance between the sequence of vertices v_{i}....v_{j}. and v_{i}v_{j} are less than a fixed tolerance.

Saalfeld performed a thorough analysis of the Douglas-Peucker algorithm and listed in [9] a set of its key properties. Besides, on the basis of the hull property of the simplified polyline obtained from the Douglas-Peucker algorithm, he proposed, with proof, to use a point-on-convex hull test and the sidedness concept for detecting possible topological conflicts. He used the dynamic convex hull algorithm presented by Hershberger and Snoeyink [3] to efficiently maintain and access the current convex hull at each refinement stage.

This paper presents yet three contributions to deal with the self-intersection problem in the Douglas-Peucker algorithm. The first is a proof for the fact that the simplification of a star-shaped polyline by the Douglas-Peucker method will never result in a self-intersecting polyline. The second is a procedure for trivially discarding segments of a simplified polyline that do not intersect. And finally, on the basis of the first and the second contributions we propose a non-self-intersecting Douglas-Peucker algorithm for any polyline.

In Section __2__, the Douglas-Peucker algorithm is briefly described for completeness. The proof of the sufficiency conditions for non-self-intersections is presented in Section __3__. Section __4__ gives a strategy for eliminating possible conflicts between simplified sub-polylines. In Section __5__, we describe our polyline simplification algorithm that integrates these two properties into the classic Douglas-Peucker to ensure topological equivalence between the original and the simplified polylines for any specified tolerance. Section __6__ details a complexity analysis of the algorithm. Afterwards, some results are shown in Section __7__. Finally, in Section __8__, our future research directions are presented.

**2 The Douglas-Peucker Algorithm**

Besides its good visual results, the Douglas-Peucker algorithm is very simple to program and works for any dimension, once it only relies on the distance between points and lines. Several implementations are available at sites of the Internet [2, 10]. Its basic rule is that the approximation must contain (a subset of) the original data points and all the original data points must lie within a certain predefined distance to the approximation.

Given a polyline P and a tolerance e as depicted in Figure 1.a. The Douglas-Peucker algorithm has a hierarchical structure starting with the single line segment e joining the first v_{1} and last v_{n} vertices of the original polyline (Figure 1.b). Then the remaining vertices are tested for closeness to its approximating segment. If there are vertices farther than some specified tolerance away from the segment, then the vertex v_{i} farthest from it is added to the previously simplified polyline. This creates a new approximation for the original polyline (Figure 1.c). Recursively this process continues for each approximating line segment (Figures 1.d,e) until all vertices of the original polyline satisfy the closeness condition (Figure 1.f).

This algorithm has O(mn) worst-case time complexity and O(nlog n) expected time, where n is the number of input vertices and m is the number of the vertices of the simplified polyline. This is an output dependent algorithm and it will be very fast when m is small, that is when the approximation is coarser.

On the other hand, if the tolerance has a larger value, then the simplified polyline may intersect itself. Figure 2 illustrates a case for which three splittings on the initial segment e were sufficient for satisfying the tolerance condition, but could not avoid self-intersection. The trivial solution is to reduce the value of the tolerance, which may lead to a unnecessarily finer approximation.

An alternative for solving this problem is to keep on applying the Douglas-Peucker procedure only on the part of the simplified polyline that presents topological conflicts. More specifically, Saalfeld [9] proposed the following procedure for detecting and solving topological conflicts in relation to each segment e_{ij} approximating a sub-polyline P_{ij} which is, in its turn, a subset of the original polyline P:

1. Identify all vertices v

_{k}(Figure 3.a), where k < i or k > j, of the simplified polyline that lie in the region R_{ij}bordered by the sequence of vertices belonging to the sub-polyline P_{ij}and the segment e_{ij}(Figure 3.b).2. Recursively split e

_{ij}until every vertex, such as v_{k}, is out the region limited by the simplified and the original polylines, as shown in Figure 3.c.

**3 Sufficiency for Non-Self-Intersections**

Before demonstrating the sufficiency conditions for a simplified polyline generated by the Douglas-Peucker algorithm to be non-self-intersecting, we introduce some definitions.

Definition 3.1 The convex hull H of a set of points S is the smallest set containing S that satisfies the following convexity property: for any pair of points p,q ∈ H the line segment pq is completely contained in H.

Definition 3.2 Let P be an open polyline as a list of n vertices v_{1},v_{2},...,v_{n} in sorted order, and r a point on the segment v_{1}v_{n}, excluding the extreme vertices. We say that P is star-shaped with respect to r, if, for any point p∈P, the ray

-→rp intersects P only at p (Figure 4).

Observe that the line segments rv_{i}, where i ∈{1,2,..,n}, build with (n - 1) segments of a star-shaped polyline a set of edge-adjacent, but non-overlapping, triangles. Based on this, we are able to present the following proposition.

Proposition 3.1 Given a star-shaped polyline P as a list of n vertices v_{1},v_{2},...,v_{n} in sorted order, its simplification from the Douglas-Peucker procedure cannot self-intersect.

Proof: We prove the proposition by induction on m output vertices in the simplified polyline. When m = 3, the simplified polyline consists of the two extreme points, v_{1} and v_{n}, and a vertex v_{k}, where 1 < k < n, farthest from the line segment v_{1}v_{n} . Trivially, the simplified polyline v_{1}v_{k}v_{n} does not self-intersect.

When m > 3 and assume that the proposition is true for all values less than m. Let v_{b} be the newly inserted vertex and is farthest from the line segment v_{a}v_{c}, where a < b < c; the line segments vav_{b} and v_{b}v_{c} only intersect at v_{b} and cannot intersect the simplified sub-polylines v_{1}...v_{a} and v_{c}...v_{n} , because such an intersection implies that the triangle rv_{a}v_{b} and/or rv_{c}v_{b} overlap another triangle rv_{k}v|, where k/=l and k,l = 1,..,a,c,...,n, contradicting the star-shapeness property. Hence, the simplified polyline consisting of m vertices cannot self-intersect.

**4 Sufficiency for Non-Intersection between Sub-Polylines**

The sidedness of a vertex with respect to the simplified and original polylines may not be preserved by the Douglas-Peucker algorithm. In his work, Saalfeld concluded that topological conflicts always occur when vertices of the simplified polyline change their sidedness. He also suggested to use the data structure presented by Hershberger and Snoeyink [3] for reducing the search space of potential conflicts at each refinement recursion as well.

We showed in Section __3__ that, by applying the Douglas-Peucker algorithm on a star-shaped polyline, the simplified polyline never self-intersects. So a possible approach for simplifying a non-star-shaped polyline would be to first decompose it into star-shaped sub-polylines and then apply the Douglas-Peucker algorithm on each sub-polyline. Nevertheless, this approach cannot ensure that non-self-intersecting piecewise simplified sub-polylines do not cross. In this section, we present a sufficient condition for non-intersections between two sub-polylines. Before this, let us introduce the following definition, which is useful to distinguish the two sides of a polyline on a plane.

Definition 4.1 A polyline P = {v_{1},v_{2},_,v_{n}> is orientable if there exists a simply-connected region R whose boundary is the closed sequence v_{1},v_{2},_,v_{n},v_{1}. If the sorted order of the vertices is in the clockwise sense along the boundary of R, P is said to be clockwise oriented with respect to R (Figure 5.a); otherwise, it is counter-clockwise oriented (Figure 5.b). The region R is called polyline region.

From the spatial relationship between the corresponding regions of two orientable polylines, we may derive a condition for trivially discarding pairs of sub-polylines that do not self-intersect. It is worth noting that the results are applicable to the star-shaped polylines, once a star-shaped polyline is an orientable polyline. This is because that the union of a set of edge-adjacent and non-overlapping triangles with a common vertex is a simply-connected region and a star-shaped polyline is the boundary of this set of triangles.

Proposition 4.1 Let P and Q be two orientable polylines that have at most some points in common. Let R and S be the respective polyline regions that have only these points in common. Let P_{s} and Q_{s} be the corresponding simplifications of P and Q. If P_{s} ∈ R, where Q_{s} ∈ S, then P_{s} and Q_{s} have at most those points in common.

Proof: If P_{s} and Q_{s} have other points in common, then R and S must have more common points, because P_{s} ∈R and Q_{s} ∈S. This contradicts the supposition. Hence, P_{s} and Q_{s} can share at most the common points of P and Q.

Proposition __4.1__ tells us that if a polyline is partitioned into a set of orientable sub-polylines, such that their regions have at most the extreme or the boundary points in common, then we may restrict the search space for potential topological conflicts to the simplified sub-polylines that do not lie entirely in the region of their corresponding original sub-polylines. Figure 6 presents two cases: (a) P_{s} ∈R, Q_{s} ∈S; and (b) P_{s}∈/R, Q_{s}∈/S. Conflicts may only occur in the second case.

Let us introduce one more definition before presenting a practical corollary.

Definition 4.2 Two orientable polylines are called separable, if their polyline regions have at most the extreme or boundary points in common (Figure 7).

Corollary 4.1 The simplified polylines of two separable polylines cannot intersect at their interior points if the simplified polylines lie entirely in the corresponding polyline regions.

Proof: If the simplified polylines intersect at their interior points, the corresponding polyline regions must intersect at some interior points, which violates the definition of separable polylines.

**5 A Non-Self-Intersecting Douglas-Peucker Algorithm**

Based on the properties presented in Sections __3__ and __4__, we present a modified Douglas-Peucker simplification method that may avoid self-intersections along the recursive refinements of a polyline P with n input vertices v_{1},v_{2},_,v_{n} and that can detect the potential topological conflicts with a simple sidedness test. The algorithm comprises three steps:

- Partition P into a set C of separable star-shaped sub-polylines.
- Apply the Douglas-Peucker algorithm for every sub-polyline C
_{i}∈C. - Beside topological conflicts between the sub-polylines.

**5.1 Partition into separable star-shaped polylines**

According to Corollary __4.1__, the simplified polylines of two separable star-shaped polylines cannot intersect except at the boundary vertices of their polyline regions, if they lie entirely in the corresponding polyline regions. Moreover, Proposition __3.1__ tells us that the simplified polyline of any star-shaped polyline cannot self-intersect. This motivates us to decompose an input polyline P into a set of separable star-shaped polylines before carrying out the Douglas-Peucker procedure at each one.

We devised a two-step procedure for partitioning any open polyline P. In the first step, P is partitioned into a set of separable sub-polylines; and, in the second step, we apply a visibility algorithm to decompose each orientable sub-polyline into non-overlapping star-shaped pieces.

**5.1.1 First Step**

The support line of the vector

-- → v1vn divides P in two parts: its left side and its right side (Figure 8.a). We determine the intersection points u_{1}u_{2}...,u_{r}. Then, they are sorted along the direction of the vector

-- → v1vn , and P is split at them into subsequences of vertices, as shown in Figure 8.b. For instance, u_{1} -u_{2} and u_{5} -u_{6} are two distinct subsequences of P.

We can determine all regions, R_{1},R_{2}...,R_{i} by simply tracing along the support line twice: one turn in the direction

-v-1→vn and another turn in the direction

-v-n→v1 . This is because the side of a region alternates between in (I) and out (O) at each intersection point, as depicted in Figure 8.c. Hence, we may link the intersection points in sorted order to build the separable polylines on the left side, in the case P_{2}, and, analogously on the right side, to obtain P_{1} and P_{3} (Figure 8.d).

**5.1.2 Second Step**

To determine a star-shaped sub-polyline of a polyline with respect to a point r is similar to the classic problem of computing a visibility polygon from r. Our implementation is based on the Hipke's linear time algorithm [4]. For decomposing a polyline with n vertices P = {v_{1},v_{2},...,v_{n}} into a set of star-shaped polylines, we apply the algorithm on P to obtain a visibility polygon V; then we replace P by P-V and apply the algorithm recursively until no vertex remains.

For the sake of completeness, an outline of Hipke's algorithm is given in this section. The algorithm scans the n vertices of the polyline P in sorted order and chooses the visible ones on the basis of the tracking sense at each vertex and on the mode of operation, which depends only on the current and previous tracking senses.

According to the signal of the turn angle φ, that is the angle between the segments rvi_{-1} and rv_{i}, two senses are distinguished: forward or positive (Figure 9.a), and backward or negative (Figure 9.b).

Backward trackings are further subdivided into inward (the segment v_{i}-_{1}v_{i} lies between the segment v_{i}_{-}_{2}v_{i-1} and the point r, as shows Figure 10.a) and outward (the segment v_{i-2}v_{i}_{-}_{1} lies between the segment v_{i}_{-}_{1} v_{i} and the point r, as illustrates Figure 10.b).

Three modes are distinguished: normal, skip and curl. In the normal mode, the current vertex is inside the scanned star-shaped polyline V. In both skip and curl modes, the current vertex is not visible and the algorithm waits to come back into the area of V. Switching from the normal mode to one of these two modes depends on the way how the tracking tends to progress when it passes from a visible to a non-visible vertex: when it seems to advance spirally, as shown in Figure 11.a, the vertices will be further scanned in the curl mode; otherwise, we enter the skip mode (Figure 11.b).

For distinguishing correctly the visible from non-visible vertices, the algorithm demands a stack of skip segments that grows, whenever the skip mode is activated, or shrinks, if any skip segment becomes obscured. Each skip segment is represented by its first point s and its end point q. The points at which the polyline starts curling are also represented as curl points.

The procedure starts at v_{i} = v_{2} in the normal operation mode. It also considers that the previous tracking sense was forward. The vertices are scanned sequentially from i = 2 to n. We may be in one of the three modes of operation at each vertex v_{i}:

1. normal mode: if the tracking sense is

oforward: if the previous sense was in-backward and rv_{i}intersects the support line of v_{i}_{-}_{2}v_{i}_{-}_{1}, set v_{i}_{-}_{1}as the curl point, skip vi and switch to the curl mode; otherwise, v_{i}is inserted in the output list V.

oout-backward: pile v_{i-}_{1}as the initial point of a skip segment, skip v_{i}and switch to the skip mode.

oin-backward: if the segment v_{i-1}v_{i}crosses any skip segment, remove from the output list V all vertices v_{j}, with j < i, until v_{k}(the first visible vertex after the skip segment), pop out all skip segments with end points v_{l}where l > k, and switch to the skip mode; otherwise, remove from the output list V all vertices v_{j}, with j < i, until a segment in V intersects the ray beginning at r and passing through v_{i}, and insert vertex v_{i}in V.2. skip mode: if the segment v

_{i-1}v_{i}intersects the ray beginning at r and passing through s (the first point of the current skip segment), then determine the intersection point q, set it as the end point of the current skip segment, add v_{i}in the output list V, and switch to the normal mode; otherwise, skip vertex v_{i}and keep on the skip mode.3. curl mode: if the segment v

_{i-1}v_{i}intersects the ray beginning at r and passing through c (the curl point), then add v_{i}in the output list V and switch to the normal mode; otherwise, skip v_{i}, and keep on the curl mode.

Figure 12 illustrates an application of this procedure to the polyline P in Figure 12.a. In the figure, the current vertex is highlighted with a black square, the intersection points are indicated by the white circles, and the current tracking sense is pointed out by a curved arrow.

The algorithm starts in the normal mode at the vertex v_{2}. The (current) tracking sense from v_{1} to v_{2} is forward (Figure 12.b). It continues moving forward, until it finds the out-backward tracking from v_{6} to v_{7}, (Figure 12.c). It then sets v_{6} as the current skip point s and enters the skip mode. It begins skipping vertices, until it reaches the end point q - the intersection between the ray rs and the segment v_{11}v_{12} - of the current skip segment (Figure 12.d). In consequence, it returns to the normal mode.

The algorithm moves further forward until the in-backward tracking is detected at v_{15} (Figure 12.e). It begins removing vertices previously inserted in the output list, until it finds the intersection between the segment v_{12} v_{13} , and the ray rv_{15} (Figure 12.f). As the movement from v_{15} to v_{16} is in-backward (Figure 12.g), it pops out the skip segment sq and discards all vertices from the output list, until it finds an intersection between the ray rv_{16} and the segment v_{5}v_{6} (Figure 12.h). At v_{17} the spiral movement is identified, then v_{16} is assigned as the curl point c and the procedure enters the curl mode (Figure 12.i).

In consequence, all subsequent vertices are ignored, until the intersection between rc and v_{18}v_{19} is reached. The normal mode is then restored.

The procedure reevaluates the state of the output list with regard to v_{19}. As the tracking from v_{18} to v_{19} is in-backward, it have to remove all the vertices from the output list till the intersection between rv_{19} and v_{4}v_{5} (Figure 12.k). Further forward progress until the end vertex v_{21} results in the star-shaped polyline V (Figure 12.l).

**5.2 Beside Topological Conflicts**

As already stated, the intersections may only occur among the simplified sub-polylines belonging to the distinct polyline regions. Hence, we propose to include in the Douglas-Peucker algorithm the test whether a simplified polyline is outside of the corresponding polyline regions.

If we consider that each star-shaped polyline is clockwise oriented, this sidedness test is equivalent to the condition that there is a sample v_{j} between v_{i} and v_{k} , where i < j < k, for which the third coordinate (z-coordinate) of the cross product (v_{k}v_{j} x v_{j}v_{i}) is equal to or greater than zero

This allows us to reduce the search space for the topological conflicts and to carry out the intersection test only between the star-shaped polylines that violate Eq. __1__

Figure 13 illustrates the proposed procedure. Figure 13.a presents three segments (d_{1}, d_{2} and d_{3}) that do not lie in the corresponding polyline region. There is only a vertex that violates Eq. __1__ with regard to d_{1}. Hence, d_{1} is further refined until Eq. __1__ is satisfied (Figure 13.b).

**6 Complexity Analysis**

There is a variety of ways to implement our algorithm, since a number of algorithms is available for solving each subproblem. In this section we present a time complexity analysis of our algorithm as we implemented it.

For partitioning an input polyline with n vertices into a set of separable polylines, we first find all points that intersect the support line. This is performed in O(n) time. After then, we sort r intersection points in O(r log r) time. We finally join the pieces to build a set of separable simple polylines with O(r) time. Therefore, the worst-case time complexity of this step is O(n + r log r + r), or simply O(n + r log r).

The worst case for partitioning any polyline with n vertices into a set of l star-shaped ones occurs when it is already separable, that is r = 1. Since the algorithm for determining a star-shaped polyline we used is linear, the worst-case complexity of the whole partitioning is O(ln). However, the number of star-shaped polylines l is always less than the number of output vertices m. So, we can upperbound its complexity to O(mn).

We know as well that the algorithm for finding the farthest vertex of a sequence, used exhaustively in Douglas-Peucker simplification, is linear. Then, the Douglas-Peucker algorithm runs for each star-shaped polyline in O(kj) time, where k and j are, respectively, the number of input and output vertices. Since the worst case happens whenever we have a unique star-shaped polyline with n vertices, the worst-case complexity of this step is also O(mn).

For handling the topological conflicts between the star-shaped polylines, we have to verify every external segment of a simplified polyline against all segments of the others. In the worst case, this check is performed in O(m^{2}) time.

Finally, for regrouping the separable polylines, built in preprocessing, into one sequence as the output, we have just to pass through every output vertex sequentially, what takes O(m) time.

For computing the whole complexity, we add together the worst-case complexity of each step, that results in

Since the number of input vertices n is always greater than or equal to the number of output vertices m, the three last terms of the sum in Eq. __2__ fulfills the inequality

2 mn +m + m __<__mn + mn + mn.

In addition, once the preceding vertex and the subsequent vertex of the intersection points are always included in the simplified polyline, the number of output vertices m is greater than the number of intersection points r. Thus, for the first two terms of the sum in Eq. __2__, we have

n+ r logr < n+ m logm < n + mn < mn + mn.

Summarizing, the worst-case complexity of our algorithm is O(mn), which is equivalent to the time complexity of the original Douglas-Peucker algorithm we used in our implementation.

**7 Results**

To evaluate the algorithm we implemented, we present in this section some results we obtained on the simplification of the outlines of the continents from the atlas data available at [13]. Comparisons with the results from the original Douglas-Peucker algorithm [1] are also provided.

Figure 14.a illustrates a Europe's outline with 53,626 vertices. Its Douglas-Peucker simplification with a tolerance of 4.0 contains 18 vertices and two self-intersections, which are encircled by the dashed line in Figure 14.b. The reduced outline from our algorithm (Figure 14.c) has no self-intersections, although it possesses much more vertices (46), 22 of which were inserted during the partition into separable polylines and 24 were added for splitting them into star-shaped ones. It is worth noting that in Figure 14.c the shape of Scandinavian Peninsula is much more distorted than in Figure 14.b. It is due to the partition of the original outline into star-shaped polylines before performing the Douglas-Peucker algorithm.

with tolerance of 4.0.

Figure 15.a shows an Asia's outline with 87,337 vertices. Figures 15.b and 15.c are respectively the simplified outlines, with tolerance of 8.6, from the Douglas-Peucker and our algorithm. Because of high tolerance and wavy outline, the original Douglas-Peucker algorithm delivers self-intersections (encircled by the dashed line) in a very reduced outline, with only 13 vertices. As expected, the result of our algorithm is self-intersection free, at cost of more vertices (35) in the output: 15 of them were inserted while the original polyline was splitted into star-shaped sub-polylines.

Figures 16.a and 16.b present, respectively, the simplifications with tolerance of 0.3 of the North America's outline from the Douglas-Peucker and our proposal. The number of vertices in the original outline is 105,499. The Douglas-Peucker algorithm reduces it to 993 vertices, but because of highly wavy borderline 54 self-intersections were resulted. Although our algorithm delivers much more number of vertices in the output (1,717), it contains no self-intersections. Visually, the results are much alike.

Figures 17.a illustrates an Oceania's outline with 27,577 vertices. The tolerance of 4.2 was used for simplifications. From the Douglas-Peucker algorithm 9 vertices were yielded, two of which are very closely laid in the position pointed in Figure 17.b. Figure 17.c shows our simplification with 27 vertices, where 16 vertices introduced in preprocessing are laid closely in the position indicated by the arrow in Figure 17.c. As expected, for avoiding self-intersections, low tolerance may lead to an excessive number of star-shaped sub-polylines in the protruding polyline.

Figure 18.a illustrates an Africa's outline with 28,653 vertices. Its Douglas-Peucker simplification, with tolerance of 4.5, contains 11 vertices, as depicted in Figure 18.b. Because its undulations are relatively larger with respect to the specified tolerance, the number of vertices in the output of our algorithm is almost the same: 19. Moreover, the reduced outlines in Figure 18.b and Figure 18.c are very similar.

Table 1 summarizes the results obtained with the use of the Douglas-Peucker algorithm and our algorithm. The column "Input" contains the number of input vertices. The simplification tolerance is given in the column "ε". The output is recorded in the column "Output". The number of occurrences of self-intersections is in the column "S-I". We also show the number of inserted vertices in the preprocessing ("Pre") and during the partition into the star-shaped polylines and the elimination of topological conflicts ("Post"). Additionally, the processing time for each simplification is given in seconds in the column "t(s)".

Observe that our procedure has a simplification ratio comparable to the Douglas-Peucker procedure with the advantage that no self-intersection appears. We did not perform detailed measurements for analyzing the visual effect of our algorithm. However, the simplified polylines we obtained are fair from our subjective judgment, once most of extra vertices that our procedure introduced are in the portion of the simplified polyline that has a large variation in the curvature.

**8 Concluding Remarks**

In this paper, we present yet an improvement to the classic Douglas-Peucker line simplification algorithm in terms of preventing self-intersections. We derive, with proof, two sufficient conditions. On the basis of these conditions, we also propose a way to integrate them into the Douglas-Peucker algorithm and to reduce the search space for the topological violations. The concept of polyline region was not only useful for trivially discarding star-shaped sub-polylines that cannot cause any topological conflicts, but also for controlling further local refinements as well.

Another contribution of our work is the decomposition of the problem into a set of sub-problems whose solutions are well-known. This facilitated the implementation of our algorithm and the validation of our idea. From the experiments we carried out, the results of our algorithm are similar to the ones produced by the classic Douglas-Peucker algorithm, except in the vicinity of the connecting vertices of the star-shaped polylines.

Our algorithm tends to refine much more. The focus of this work is the robustness of simplification, and not the efficiency. Hence, we did not investigate its performance thoroughly. From a quick analysis, our implemented algorithm has, like the classic Douglas-Peucker algorithm, O(mn) worst-case time, where m is the number of output vertices, and n the number of input vertices. This performance is output dependent.

As further work, we may improve the performance of our algorithm by optimizing the decomposition of the input polyline into a set of separable polylines. It is also interesting to compare the performance of the optimized algorithm with the existing ones.

Another point of our interest is to reduce the unnecessary refinements in the vicinity of connecting vertices of the star-shaped polylines. Finally, we would like to extend our algorithm to a multiresolution version that enables a fast description of an object at different levels of details.

**Acknowledgments**

We would like to acknowledge the State of São Paulo Research Foundation (FAPESP, Grant Nº 00/10913-3) and the Coordination for the Improvement of Higher Education Personnel Foundation (CAPES) for financial support.

**References**

1. D. Douglas and T. Peucker. Algorithms for the reduction of the number of points required for represent a digitzed line or its caricature. Canadian Cartographer, 10(2):112-122, 1973. [ Links ]

2. J. De Halleux. An C++ implementation of Douglas-Peucker line approximation algorithm, 2003. http://www.codeproject.com/useritems/dphull.asp. [ Links ]

3. J. Hershberger and J. Snoeyink. Speeding up the Douglas-Peucker line simplification algorithm. In The 5th International Symposium on Spatial Data Handling, volume 1, pages 134-143, 1992. [ Links ]

4. C. A. Hipke. Computing visibility polygons with LEDA, 1996. [ Links ]

5. G. F. Jenks. Lines, computers and human frailties. In Annals of the Association of American Geographers, pages 1-10, 1981. [ Links ]

6. T. Lang. Rules for robot draughtsmen. Geographical Magazine, 22:50-51, 1969. [ Links ]

7. U. Ramer. An iterative procedure for the polygonal approximation of plane curves. Computer Graphics and Image Processing, 1:224-256, 1972. [ Links ]

8. K. Reumann and A. P. M. Witkam. Optimizing curve segmentation in computer graphics. In Proceedings of the International Computing Symposium, pages 467-472, 1974. [ Links ]

9. A. Saalfeld. Topologically consistent line simplification with the Douglas Peucker algorithm. Cartography and Geographic Information Science, 26(1):7-18, 1999. [ Links ]

10. Dan Sunday. Geometric algorithms. http://geometryalgorithms.com/Archive/algorithm0205/algorithm0205.htm. [ Links ]

11. W. R. Tobler. An experiment in the computer generalization of map. Technical report, Office of Naval Research, Geography Branch, 1964. [ Links ]

12. M. Visvalingam and J. D. Whyatt. Line generalisation by repeated elimination of points. Cartographic Journal, 30(1):46-51, 1993. [ Links ]

13. P. Wessel and W. H. F. Smith. A global self-consistent, hierarchical, high-resolution shoreline database. Journal of Geophysical Research, 101:8741-8743, 1996. [ Links ]

14. Z. Zhao and A. Saalfeld. Linear-time sleeve-fitting polyline simplification algorithms. In Proceedings of AutoCarto 13, pages 214-223, 1997. [ Links ]

1 Based on "A non-self-intersection Douglas-Peucker Algorithm", by Wu, Shin-Ting and Márquez, Mercedes R. G. which appeared in Proceedings of Sibgrapi 2003. © 2004 IEEE.