Package org.tinfour.utils
Class VisvalingamLineSimplification
- java.lang.Object
-
- org.tinfour.utils.VisvalingamLineSimplification
-
public class VisvalingamLineSimplification extends Object
Provides an implementation of Visvalingam's algorithm for simplifying lines by repeated elimination of the smallest area features.This class is based on the algorithm described in Visvalingam, M. & Whyatt, Duncan. (1993). Line generalisation by repeated elimination of points. Cartographic Journal, The. 30. 46-51. 10.1179/000870493786962263.
-
-
Constructor Summary
Constructors Constructor Description VisvalingamLineSimplification()Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreport(PrintStream ps)Print summary information about the line simplification.intsimplify(int nPoints, double[] xy, double areaThreshold)Simplify the geometry of the input line or polygon by progressively removing points related to small-area features.
-
-
-
Method Detail
-
simplify
public int simplify(int nPoints, double[] xy, double areaThreshold)Simplify the geometry of the input line or polygon by progressively removing points related to small-area features. The algorithm repeatedly inspects a chain of points to identify the set of three sequential points that forms the smallest area, it eliminates then, and continues.Coordinates are given as an array in the order (x0, y0, x1, y1, etc.).
- Parameters:
nPoints- the number of points in the feature.xy- the coordinates of the featureareaThreshold- the area threshold to be used as a reduction criterion.- Returns:
- the number of points remaining after the thinning operation.
-
report
public void report(PrintStream ps)
Print summary information about the line simplification.- Parameters:
ps- a valid instance.
-
-