public class DiscreteCurveEvolution extends Object
The shape relevance of a vertex is calculated based on its turn angle and the lengths of its neighboring line segments. Vertices with larger turn angles and neighboring segment lengths contribute more to the overall shape of the curve and are thus more likely to be preserved during the simplification process.
This class uses an efficient implementation that reduces the time complexity from O(n^2) to O(n log n), making it suitable for processing large datasets. It can handle both closed and open curves.
Constructor and Description |
---|
DiscreteCurveEvolution(int vertices)
Initialises an instance of the DiscreteCurveEvolution class.
|
Modifier and Type | Method and Description |
---|---|
org.locationtech.jts.geom.Coordinate[] |
process(org.locationtech.jts.geom.Coordinate[] coords)
Processes an array of coordinates and applies the Discrete Curve Evolution
algorithm.
|
org.locationtech.jts.geom.Coordinate[] |
process(org.locationtech.jts.geom.LineString lineString) |
public DiscreteCurveEvolution(int vertices)
vertices
- The number of vertices to be preserved. These vertices are
chosen based on their shape relevance, which is calculated
from their turn angle and the lengths of neighboring line
segments. Larger relative lengths and turn angles make a
vertex more likely to be preserved.public org.locationtech.jts.geom.Coordinate[] process(org.locationtech.jts.geom.LineString lineString)
lineString
- a closed or unclosed LineStringpublic org.locationtech.jts.geom.Coordinate[] process(org.locationtech.jts.geom.Coordinate[] coords)
Note: The vertices removed are always the least relevant vertices, those with the smallest turn angles and neighboring line segments.
coords
- The original coordinates of the shape, an array of Coordinates
defining the polygonal curve.Copyright © 2023. All rights reserved.