Class SmoothingFilter
- java.lang.Object
-
- org.tinfour.utils.SmoothingFilter
-
- All Implemented Interfaces:
IVertexValuator
public class SmoothingFilter extends Object implements IVertexValuator
An implementation of the vertex valuator that processes the vertices in a Constrained Delaunay Triangulation and applies a low-pass filter over the data.Note that this class modifies the index values of the vertices stored in the TIN. It also depends on the modified values as a way of tracking vertices. Therefore, calling applications should not modify these values while the smoothing filter is being used.
-
-
Constructor Summary
Constructors Constructor Description SmoothingFilter(IIncrementalTin tin)Construct a smoothing filter.SmoothingFilter(IIncrementalTin tin, int nPass)Construct a smoothing filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetMaxZ()Gets the maximum value from the set of possible values.doublegetMinZ()Gets the minimum value from the set of possible values.doublegetTimeToConstructFilter()Gets the time required to construct the filter, in milliseconds.double[]getVertexAdjustments()Gets the array of adjustment for vertices.voidsetVertexAdjustments(double[] adjustments)Sets the array of adjustments for verticesdoublevalue(Vertex v)Given a vertex v, obtain its value
-
-
-
Constructor Detail
-
SmoothingFilter
public SmoothingFilter(IIncrementalTin tin)
Construct a smoothing filter. Note that this class modifies the index values of the vertices stored in the TIN.Important usage note: this constructor modifies the index values of the vertices stored in the TIN. It also depends on the modified values as a way of tracking vertices. Therefore, calling applications should not modify these values while the smoothing filter is being used.
The vertices belonging to constraints are not smoothed, but are represented with their original values by the smoothing filter.
- Parameters:
tin- a valid Delaunay Triangulation
-
SmoothingFilter
public SmoothingFilter(IIncrementalTin tin, int nPass)
Construct a smoothing filter. Note that this class modifies the index values of the vertices stored in the TIN.Important usage note: this constructor modifies the index values of the vertices stored in the TIN. It also depends on the modified values as a way of tracking vertices. Therefore, calling applications should not modify these values while the smoothing filter is being used.
The vertices belonging to constraints are not smoothed, but are represented with their original values by the smoothing filter.
The number of passes determines the degree to which features are smoothed. The best choice for this value depends on the requirements of the application. Values in the range 5 to 40 are good candidates for investigation.
- Parameters:
tin- a valid Delaunay TriangulationnPass- the number of passes the filter performs over the vertices during smoothing.
-
-
Method Detail
-
getTimeToConstructFilter
public double getTimeToConstructFilter()
Gets the time required to construct the filter, in milliseconds. Intended for diagnostic and development purposes.- Returns:
- a value in milliseconds.
-
value
public double value(Vertex v)
Description copied from interface:IVertexValuatorGiven a vertex v, obtain its value- Specified by:
valuein interfaceIVertexValuator- Parameters:
v- a vertex- Returns:
- a value interpreted from vertex v.
-
getVertexAdjustments
public double[] getVertexAdjustments()
Gets the array of adjustment for vertices.- Returns:
- a valid array.
-
setVertexAdjustments
public void setVertexAdjustments(double[] adjustments)
Sets the array of adjustments for vertices- Parameters:
adjustments- a valid array of same length as internal storage
-
getMinZ
public double getMinZ()
Gets the minimum value from the set of possible values. Due to the smoothing, this value may be larger than the minimum input value.- Returns:
- a valid floating-point value.
-
getMaxZ
public double getMaxZ()
Gets the maximum value from the set of possible values. Due to the smoothing, this value may be smaller than the maximum input value.- Returns:
- a valid floating-point value.
-
-