raygeo.geo.algo.simplify
Polyline simplification using the Ramer-Douglas-Peucker algorithm.
Reduces the number of points in a polyline while preserving the overall shape within a given tolerance.
Functions
simplify_polyline()
simplify_polyline(
points: Sequence[types.Point],
tolerance: float,
) -> types.Polygon
Simplify a 2D polyline using the Ramer-Douglas-Peucker algorithm.
Reduces the number of points while preserving shape within tolerance.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[types.Point] | Sequence of (x, y) points. |
tolerance | float | Simplification tolerance. |
| Returns | types.Polygon | Simplified 2D point sequence. |
| Complexity | O(n log n) average time, O(n) space |
simplify_polyline_3d()
simplify_polyline_3d(
points: Sequence[types.Point3D],
tolerance: float,
) -> types.Polygon3D
Simplify a 3D polyline using the Ramer-Douglas-Peucker algorithm.
The simplification uses XY distance, but preserves Z coordinates of kept points.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[types.Point3D] | Sequence of (x, y, z) points. |
tolerance | float | Simplification tolerance. |
| Returns | types.Polygon3D | Simplified 3D point sequence. |
| Complexity | O(n log n) average time, O(n) space |

Simplify and linearize

3D polyline simplification preserving Z coordinates