Does anybody know the algorithm behind the “reduce” component?
It is
Douglas-Peucker
The Ramer–Douglas–Peucker algorithm, also known as the Douglas–Peucker algorithm and iterative end-point fit algorithm, is an algorithm that decimates a curve composed of line segments to a similar curve with fewer points. It was one of the earliest successful algorithms developed for cartographic generalization. It produces the most accurate generalization, but it is also more time-consuming.
The starting curve is an ordered set of points or lines and the distance dimension ε > 0.
The algorith...
see this thread and go to MyJetBrain
When dealing with terrain data, often it is in the form of polylines, and depending on what data source it is from and how it has been scaled, they can be very, very dense. There is a component in Grasshopper that reduces polyline point count within a given tolerance (using the Douglas-Peucker algorithm if I’m not mistaken); it has also been implemented as a method in RhinoCommon - Rhino.Geometry. Polyline.ReduceSegments(tolerance). I have implemented several scripts here that use this.
My wi…
implemented it in C# because I needed it in an other application and I just implemented (2h ago !) a very poor version of the other one
Visvalingam Whyatt
The Visvalingam–Whyatt algorithm, or simply the Visvalingam algorithm, is an algorithm that decimates a curve composed of line segments to a similar curve with fewer points, primarily for usage in cartographic generalisation.
Given a polygonal chain (often called a polyline), the algorithm attempts to find a similar chain composed of fewer points.
Points are assigned an importance based on local conditions, and points are removed from the least important to most important.
In Visvalingam's alg...
4 Likes
I’m really grateful for your response. It confirmed my suspicions that it is the Douglas Peucker Algorithm
Mohammadrezaaalaei:
Douglas Peucker
If you are that suspicious (and you can read code) see what exactly DP does (and PlanB (Reumann) as well).
Reduce_curve_DP_or_R_V1.gh (134.7 KB)
3 Likes