|
1 | 1 | """ |
2 | | -Ramer–Douglas–Peucker polyline simplification algorithm. |
| 2 | +Ramer-Douglas-Peucker polyline simplification algorithm. |
3 | 3 |
|
4 | 4 | Given a sequence of 2-D points and a tolerance epsilon, the algorithm |
5 | 5 | reduces the number of points while preserving the overall shape of the curve. |
@@ -43,7 +43,7 @@ def _perpendicular_distance( |
43 | 43 | When the projection falls outside the segment, the distance to the nearest |
44 | 44 | endpoint is returned instead (projection clamped to [0, 1]). |
45 | 45 |
|
46 | | - This is the correct distance measure for the Ramer–Douglas–Peucker |
| 46 | + This is the correct distance measure for the Ramer-Douglas-Peucker |
47 | 47 | algorithm: using the infinite-line distance can incorrectly discard points |
48 | 48 | whose projection lies beyond a segment endpoint. |
49 | 49 |
|
@@ -80,7 +80,7 @@ def ramer_douglas_peucker( |
80 | 80 | pts: list[tuple[float, float]], |
81 | 81 | epsilon: float, |
82 | 82 | ) -> list[tuple[float, float]]: |
83 | | - """Simplify a polyline using the Ramer–Douglas–Peucker algorithm. |
| 83 | + """Simplify a polyline using the Ramer-Douglas-Peucker algorithm. |
84 | 84 |
|
85 | 85 | Given a sequence of 2-D points and a maximum allowable deviation |
86 | 86 | *epsilon* (>= 0), returns a simplified list of points such that no |
@@ -117,10 +117,10 @@ def ramer_douglas_peucker( |
117 | 117 | [(0.0, 0.0)] |
118 | 118 | >>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.0)], epsilon=1.0) |
119 | 119 | [(0.0, 0.0), (1.0, 0.0)] |
120 | | - >>> # middle point is within epsilon – it is discarded |
| 120 | + >>> # middle point is within epsilon - it is discarded |
121 | 121 | >>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.1), (2.0, 0.0)], epsilon=0.5) |
122 | 122 | [(0.0, 0.0), (2.0, 0.0)] |
123 | | - >>> # middle point exceeds epsilon – it is kept |
| 123 | + >>> # middle point exceeds epsilon - it is kept |
124 | 124 | >>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 1.0), (2.0, 0.0)], epsilon=0.5) |
125 | 125 | [(0.0, 0.0), (1.0, 1.0), (2.0, 0.0)] |
126 | 126 | >>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.5), (2.0, 0.0)], epsilon=-1.0) |
|
0 commit comments