Skip to content

Commit f3e1a56

Browse files
Update ramer_douglas_peucker.py
1 parent b8d87e6 commit f3e1a56

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

geometry/ramer_douglas_peucker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
RamerDouglasPeucker polyline simplification algorithm.
2+
Ramer-Douglas-Peucker polyline simplification algorithm.
33
44
Given a sequence of 2-D points and a tolerance epsilon, the algorithm
55
reduces the number of points while preserving the overall shape of the curve.
@@ -43,7 +43,7 @@ def _perpendicular_distance(
4343
When the projection falls outside the segment, the distance to the nearest
4444
endpoint is returned instead (projection clamped to [0, 1]).
4545
46-
This is the correct distance measure for the RamerDouglasPeucker
46+
This is the correct distance measure for the Ramer-Douglas-Peucker
4747
algorithm: using the infinite-line distance can incorrectly discard points
4848
whose projection lies beyond a segment endpoint.
4949
@@ -80,7 +80,7 @@ def ramer_douglas_peucker(
8080
pts: list[tuple[float, float]],
8181
epsilon: float,
8282
) -> list[tuple[float, float]]:
83-
"""Simplify a polyline using the RamerDouglasPeucker algorithm.
83+
"""Simplify a polyline using the Ramer-Douglas-Peucker algorithm.
8484
8585
Given a sequence of 2-D points and a maximum allowable deviation
8686
*epsilon* (>= 0), returns a simplified list of points such that no
@@ -117,10 +117,10 @@ def ramer_douglas_peucker(
117117
[(0.0, 0.0)]
118118
>>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.0)], epsilon=1.0)
119119
[(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
121121
>>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.1), (2.0, 0.0)], epsilon=0.5)
122122
[(0.0, 0.0), (2.0, 0.0)]
123-
>>> # middle point exceeds epsilon it is kept
123+
>>> # middle point exceeds epsilon - it is kept
124124
>>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 1.0), (2.0, 0.0)], epsilon=0.5)
125125
[(0.0, 0.0), (1.0, 1.0), (2.0, 0.0)]
126126
>>> ramer_douglas_peucker([(0.0, 0.0), (1.0, 0.5), (2.0, 0.0)], epsilon=-1.0)

0 commit comments

Comments
 (0)