Abstract
The classic DouglasPeucker linesimplification 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 DouglasPeucker to produce a simplified polyline which is homeomorphic to the original one. Our modified DouglasPeucker algorithm is based on two propositions: (1) when an original polyline is starshaped, its simplification from the DouglasPeucker procedure cannot selfintersect; and (2) for any polyline, two of its starshaped subpolylines may only intersect if there is a vertex of one simplified subpolyline inside the other's corresponding region.
Topological Consistency; Line Simplification; DouglasPeucker Algorithm; GIS
The Douglaspeucker algorithm: sufficiency conditions for nonselfintersections^{1} 1 Based on "A nonselfintersection DouglasPeucker Algorithm", by Wu, ShinTing and Márquez, Mercedes R. G. which appeared in Proceedings of Sibgrapi 2003. © 2004 IEEE.
ShinTing 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 DouglasPeucker linesimplification 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 DouglasPeucker to produce a simplified polyline which is homeomorphic to the original one. Our modified DouglasPeucker algorithm is based on two propositions: (1) when an original polyline is starshaped, its simplification from the DouglasPeucker procedure cannot selfintersect; and (2) for any polyline, two of its starshaped subpolylines may only intersect if there is a vertex of one simplified subpolyline inside the other's corresponding region.
Keywords: Topological Consistency; Line Simplification; DouglasPeucker 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 linesimplification 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 DouglasPeucker 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 DouglasPeucker 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 DouglasPeucker 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 DouglasPeucker algorithm, he proposed, with proof, to use a pointonconvex 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 selfintersection problem in the DouglasPeucker algorithm. The first is a proof for the fact that the simplification of a starshaped polyline by the DouglasPeucker method will never result in a selfintersecting 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 nonselfintersecting DouglasPeucker algorithm for any polyline.
In Section 2, the DouglasPeucker algorithm is briefly described for completeness. The proof of the sufficiency conditions for nonselfintersections is presented in Section 3. Section 4 gives a strategy for eliminating possible conflicts between simplified subpolylines. In Section 5, we describe our polyline simplification algorithm that integrates these two properties into the classic DouglasPeucker 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 DouglasPeucker Algorithm
Besides its good visual results, the DouglasPeucker 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 DouglasPeucker 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) worstcase 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 selfintersection. 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 DouglasPeucker 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 subpolyline 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 subpolyline 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 NonSelfIntersections
Before demonstrating the sufficiency conditions for a simplified polyline generated by the DouglasPeucker algorithm to be nonselfintersecting, 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 starshaped 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 starshaped polyline a set of edgeadjacent, but nonoverlapping, triangles. Based on this, we are able to present the following proposition.
Proposition 3.1 Given a starshaped polyline P as a list of n vertices v_{1},v_{2},...,v_{n} in sorted order, its simplification from the DouglasPeucker procedure cannot selfintersect.
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 selfintersect.
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 subpolylines 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 starshapeness property. Hence, the simplified polyline consisting of m vertices cannot selfintersect.
4 Sufficiency for NonIntersection between SubPolylines
The sidedness of a vertex with respect to the simplified and original polylines may not be preserved by the DouglasPeucker 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 DouglasPeucker algorithm on a starshaped polyline, the simplified polyline never selfintersects. So a possible approach for simplifying a nonstarshaped polyline would be to first decompose it into starshaped subpolylines and then apply the DouglasPeucker algorithm on each subpolyline. Nevertheless, this approach cannot ensure that nonselfintersecting piecewise simplified subpolylines do not cross. In this section, we present a sufficient condition for nonintersections between two subpolylines. 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 simplyconnected 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 counterclockwise 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 subpolylines that do not selfintersect. It is worth noting that the results are applicable to the starshaped polylines, once a starshaped polyline is an orientable polyline. This is because that the union of a set of edgeadjacent and nonoverlapping triangles with a common vertex is a simplyconnected region and a starshaped 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 subpolylines, 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 subpolylines that do not lie entirely in the region of their corresponding original subpolylines. 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 NonSelfIntersecting DouglasPeucker Algorithm
Based on the properties presented in Sections 3 and 4, we present a modified DouglasPeucker simplification method that may avoid selfintersections 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 starshaped subpolylines.

Apply the DouglasPeucker algorithm for every subpolyline C
_{i}∈C.

Beside topological conflicts between the subpolylines.
5.1 Partition into separable starshaped polylines
According to Corollary 4.1, the simplified polylines of two separable starshaped 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 starshaped polyline cannot selfintersect. This motivates us to decompose an input polyline P into a set of separable starshaped polylines before carrying out the DouglasPeucker procedure at each one.
We devised a twostep procedure for partitioning any open polyline P. In the first step, P is partitioned into a set of separable subpolylines; and, in the second step, we apply a visibility algorithm to decompose each orientable subpolyline into nonoverlapping starshaped 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
v1→vn and another turn in the direction
vn→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 starshaped subpolyline 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 starshaped polylines, we apply the algorithm on P to obtain a visibility polygon V; then we replace P by PV 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_{i1} and the point r, as shows Figure 10.a) and outward (the segment vi_{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 starshaped 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 nonvisible 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 nonvisible 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
o forward: if the previous sense was inbackward 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.
o outbackward: pile v_{i}_{1} as the initial point of a skip segment, skip v_{i} and switch to the skip mode.
o inbackward: if the segment v_{i1}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_{i1}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_{i1}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 outbackward 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 inbackward 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 inbackward (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 inbackward, 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 starshaped polyline V (Figure 12.l).
5.2 Beside Topological Conflicts
As already stated, the intersections may only occur among the simplified subpolylines belonging to the distinct polyline regions. Hence, we propose to include in the DouglasPeucker algorithm the test whether a simplified polyline is outside of the corresponding polyline regions.
If we consider that each starshaped 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 (zcoordinate) 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 starshaped 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 worstcase 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 starshaped ones occurs when it is already separable, that is r = 1. Since the algorithm for determining a starshaped polyline we used is linear, the worstcase complexity of the whole partitioning is O(ln). However, the number of starshaped 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 DouglasPeucker simplification, is linear. Then, the DouglasPeucker algorithm runs for each starshaped 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 starshaped polyline with n vertices, the worstcase complexity of this step is also O(mn).
For handling the topological conflicts between the starshaped 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 worstcase 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 worstcase complexity of our algorithm is O(mn), which is equivalent to the time complexity of the original DouglasPeucker 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 DouglasPeucker algorithm [1] are also provided.
Figure 14.a illustrates a Europe's outline with 53,626 vertices. Its DouglasPeucker simplification with a tolerance of 4.0 contains 18 vertices and two selfintersections, which are encircled by the dashed line in Figure 14.b. The reduced outline from our algorithm (Figure 14.c) has no selfintersections, 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 starshaped 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 starshaped polylines before performing the DouglasPeucker 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 DouglasPeucker and our algorithm. Because of high tolerance and wavy outline, the original DouglasPeucker algorithm delivers selfintersections (encircled by the dashed line) in a very reduced outline, with only 13 vertices. As expected, the result of our algorithm is selfintersection free, at cost of more vertices (35) in the output: 15 of them were inserted while the original polyline was splitted into starshaped subpolylines.
Figures 16.a and 16.b present, respectively, the simplifications with tolerance of 0.3 of the North America's outline from the DouglasPeucker and our proposal. The number of vertices in the original outline is 105,499. The DouglasPeucker algorithm reduces it to 993 vertices, but because of highly wavy borderline 54 selfintersections were resulted. Although our algorithm delivers much more number of vertices in the output (1,717), it contains no selfintersections. 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 DouglasPeucker 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 selfintersections, low tolerance may lead to an excessive number of starshaped subpolylines in the protruding polyline.
Figure 18.a illustrates an Africa's outline with 28,653 vertices. Its DouglasPeucker 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 DouglasPeucker 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 selfintersections is in the column "SI". We also show the number of inserted vertices in the preprocessing ("Pre") and during the partition into the starshaped 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 DouglasPeucker procedure with the advantage that no selfintersection 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 DouglasPeucker line simplification algorithm in terms of preventing selfintersections. We derive, with proof, two sufficient conditions. On the basis of these conditions, we also propose a way to integrate them into the DouglasPeucker algorithm and to reduce the search space for the topological violations. The concept of polyline region was not only useful for trivially discarding starshaped subpolylines 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 subproblems whose solutions are wellknown. 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 DouglasPeucker algorithm, except in the vicinity of the connecting vertices of the starshaped 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 DouglasPeucker algorithm, O(mn) worstcase 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 starshaped 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/109133) and the Coordination for the Improvement of Higher Education Personnel Foundation (CAPES) for financial support.

^{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):112122, 1973.

^{2}J. De Halleux. An C++ implementation of DouglasPeucker line approximation algorithm, 2003. http://www.codeproject.com/useritems/dphull.asp

^{3}J. Hershberger and J. Snoeyink. Speeding up the DouglasPeucker line simplification algorithm. In The 5th International Symposium on Spatial Data Handling, volume 1, pages 134143, 1992.

^{4}C. A. Hipke. Computing visibility polygons with LEDA, 1996.

^{5}G. F. Jenks. Lines, computers and human frailties. In Annals of the Association of American Geographers, pages 110, 1981.

^{6}T. Lang. Rules for robot draughtsmen. Geographical Magazine, 22:5051, 1969.

^{7}U. Ramer. An iterative procedure for the polygonal approximation of plane curves. Computer Graphics and Image Processing, 1:224256, 1972.

^{8}K. Reumann and A. P. M. Witkam. Optimizing curve segmentation in computer graphics. In Proceedings of the International Computing Symposium, pages 467472, 1974.

^{9}A. Saalfeld. Topologically consistent line simplification with the Douglas Peucker algorithm. Cartography and Geographic Information Science, 26(1):718, 1999.

^{10}Dan Sunday. Geometric algorithms. http://geometryalgorithms.com/Archive/algorithm0205/algorithm0205.htm

^{11}W. R. Tobler. An experiment in the computer generalization of map. Technical report, Office of Naval Research, Geography Branch, 1964.

^{12}M. Visvalingam and J. D. Whyatt. Line generalisation by repeated elimination of points. Cartographic Journal, 30(1):4651, 1993.

^{13}P. Wessel and W. H. F. Smith. A global selfconsistent, hierarchical, highresolution shoreline database. Journal of Geophysical Research, 101:87418743, 1996.

^{14}Z. Zhao and A. Saalfeld. Lineartime sleevefitting polyline simplification algorithms. In Proceedings of AutoCarto 13, pages 214223, 1997.
Publication Dates

Publication in this collection
25 May 2010 
Date of issue
Apr 2004