|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Douglas-Peucker polyline simplification. More...
#include <geom_algorithms.H>
Public Member Functions | |
| Array< Point > | operator() (const Array< Point > &polyline, const Geom_Number &epsilon) const |
| Simplify an open polyline. | |
| Array< Point > | operator() (const DynList< Point > &polyline, const Geom_Number &epsilon) const |
| Overload accepting DynList. | |
| Polygon | simplify_polygon (const Polygon &poly, const Geom_Number &epsilon) const |
| Simplify a closed polygon. | |
Static Private Member Functions | |
| static void | dp_recurse (const Array< Point > &pts, const size_t first, const size_t last, const Geom_Number &eps2, Array< bool > &keep) |
Douglas-Peucker polyline simplification.
Recursively splits the polyline at the vertex farthest from the line connecting the current endpoints. Vertices closer than epsilon to the connecting line are discarded.
Complexity: O(n log n) average, O(n²) worst case.
Definition at line 12421 of file geom_algorithms.H.
|
inlinestaticprivate |
Definition at line 12423 of file geom_algorithms.H.
References Aleph::Segment::distance_to(), Aleph::divide_and_conquer_partition_dp(), and dp_recurse().
Referenced by dp_recurse(), and operator()().
|
inline |
Simplify an open polyline.
First and last vertices are always kept.
| polyline | Ordered sequence of vertices. |
| epsilon | Maximum perpendicular distance tolerance. |
polyline). Definition at line 12463 of file geom_algorithms.H.
References Aleph::Array< T >::append(), Aleph::divide_and_conquer_partition_dp(), and dp_recurse().
|
inline |
Overload accepting DynList.
Definition at line 12489 of file geom_algorithms.H.
References Aleph::Array< T >::append(), Aleph::divide_and_conquer_partition_dp(), and Aleph::HTList::Iterator::has_curr().
|
inline |
Simplify a closed polygon.
Splits the polygon ring at the vertex farthest from vertex 0, simplifies each open chain, and merges the results.
| poly | The closed polygon. |
| epsilon | Maximum perpendicular distance tolerance. |
Definition at line 12510 of file geom_algorithms.H.
References Aleph::Polygon::add_vertex(), Aleph::Array< T >::append(), Aleph::Polygon::close(), Aleph::divide_and_conquer_partition_dp(), and Aleph::GeomPolygonUtils::extract_vertices().