HOME

TheInfoList



OR:

The Visvalingam–Whyatt algorithm, also known as the Visvalingam's algorithm, is an algorithm that decimates a curve composed of line segments to a similar curve with fewer points.


Idea

Given a
polygonal chain In geometry, a polygonal chain is a connected series of line segments. More formally, a polygonal chain is a curve specified by a sequence of points (A_1, A_2, \dots, A_n) called its vertices. The curve itself consists of the line segments co ...
(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 algorithm, the importance is related to the triangular area added by each point.


Algorithm

Given a chain of 2d points \left\ = \left\, the importance of each interior point is computed by finding the area of the triangle formed by it and its immediate neighbors. This can be done quickly using a matrix
determinant In mathematics, the determinant is a scalar value that is a function of the entries of a square matrix. It characterizes some properties of the matrix and the linear map represented by the matrix. In particular, the determinant is nonzero if and ...
. Alternatively, the equivalent formula below can be used : A_i = \frac \left, x_ y_ + x_i y_ + x_ y_ - x_ y_ - x_i y_ - x_ y_i \ The minimum importance point p_i is located and marked for removal (note that A_ and A_ will need to be recomputed). This process is repeated until either the desired number of points is reached, or the contribution of the least important point is large enough to not neglect.


Advantages

* The algorithm is easy to understand and explain, but is often competitive with much more complex approaches. * With the use of a
priority queue In computer science, a priority queue is an abstract data-type similar to a regular queue or stack data structure in which each element additionally has a ''priority'' associated with it. In a priority queue, an element with high priority is se ...
, the algorithm is performant on large inputs, since the importance of each point can be computed using only its neighbors, and removing a point only requires recomputing the importance of two other points. * It is simple to generalize to higher dimensions, since the area of the triangle between points has a consistent meaning.


Disadvantages

* The algorithm does not differentiate between sharp spikes and shallow features, meaning that it will clean up sharp spikes that may be important. * The algorithm simplifies the entire length of the curve evenly, meaning that curves with high and low detail areas will likely have their fine details eroded.


See also

*
Curve fitting Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points, possibly subject to constraints. Curve fitting can involve either interpolation, where an exact fit to the data is ...
Alternative algorithms for line simplification include: * Ramer–Douglas–Peucker * Reumann–Witkam * Opheim simplification * Lang simplification * Zhao–Saalfeld algorithm


References


External links


1992 Paper proposing the method.
{{DEFAULTSORT:Visvalingam-Whyatt algorithm Geometric algorithms Digital signal processing Computer graphics algorithms Articles with example pseudocode