Class TriangularFacetSpecialInterpolator
- java.lang.Object
-
- org.tinfour.interpolation.TriangularFacetSpecialInterpolator
-
- All Implemented Interfaces:
IProcessUsingTin,IInterpolatorOverTin
public class TriangularFacetSpecialInterpolator extends Object implements IInterpolatorOverTin
Provides interpolation based on treating the surface as a collection of triangular facets with special handling for regions outside the domain of the Delaunay triangulation.
-
-
Constructor Summary
Constructors Constructor Description TriangularFacetSpecialInterpolator(IIncrementalTin tin)Construct an interpolator that operates on the specified TIN.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMethod()Gets a string describing the interpolation method that can be used for labeling graphs and printouts.double[]getSurfaceNormal()Gets the unit normal to the surface at the position of the most recent interpolation.doubleinterpolate(double x, double y, IVertexValuator valuator)Performs an interpolation with special handling to provide values for regions to the exterior of the Delaunay Triangulation.booleanisSurfaceNormalSupported()Indicates whether the interpolation class supports the computation of surface normals through the getUnitNormal() method.voidresetForChangeToTin()Used by an application to reset the state data within the interpolator when the content of the TIN may have changed.
-
-
-
Constructor Detail
-
TriangularFacetSpecialInterpolator
public TriangularFacetSpecialInterpolator(IIncrementalTin tin)
Construct an interpolator that operates on the specified TIN. Because the interpolator will access the TIN on a read-only basis, it is possible to construct multiple instances of this class and allow them to operate in parallel threads.This class uses logic similar to the TriangularFacetInterpolator, but clips input coordinates to the domain of the Delaunay triangulation.
Important Synchronization Issue
To improve performance, the classes in this package frequently maintain state-data about the TIN that can be reused for query to query. They also avoid run-time overhead by not implementing any kind of Java synchronization or or even the concurrent-modification testing provided by the Java collection classes. If an application modifies the TIN, instances of this class will not be aware of the change. In such cases, interpolation methods may fail by either throwing an exception or, worse, returning an incorrect value. The onus is on the calling application to manage the use of this class and to ensure that no modifications are made to the TIN between interpolation operations. If the TIN is modified, the internal state data for this class must be reset using a call to resetForChangeToTIN().
- Parameters:
tin- a valid instance of an incremental TIN.
-
-
Method Detail
-
resetForChangeToTin
public void resetForChangeToTin()
Used by an application to reset the state data within the interpolator when the content of the TIN may have changed. Reseting the state data unnecessarily may result in a minor performance reduction when processing a large number of interpolations, but is otherwise harmless.- Specified by:
resetForChangeToTinin interfaceIProcessUsingTin
-
isSurfaceNormalSupported
public boolean isSurfaceNormalSupported()
Description copied from interface:IInterpolatorOverTinIndicates whether the interpolation class supports the computation of surface normals through the getUnitNormal() method.- Specified by:
isSurfaceNormalSupportedin interfaceIInterpolatorOverTin- Returns:
- true if the class implements the ability to compute surface normals; otherwise, false.
-
getSurfaceNormal
public double[] getSurfaceNormal()
Gets the unit normal to the surface at the position of the most recent interpolation. The unit normal is computed based on the partial derivatives of the surface polynomial evaluated at the coordinates of the query point. Note that this method assumes that the vertical and horizontal coordinates of the input sample points are isotropic.- Specified by:
getSurfaceNormalin interfaceIInterpolatorOverTin- Returns:
- if defined, a valid array of dimension 3 giving the x, y, and z components of the normal, respectively; otherwise, a zero-sized array.
-
getMethod
public String getMethod()
Description copied from interface:IInterpolatorOverTinGets a string describing the interpolation method that can be used for labeling graphs and printouts. Because this string may be used as a column header in a table, its length should be kept short.- Specified by:
getMethodin interfaceIInterpolatorOverTin- Returns:
- A valid string
-
interpolate
public double interpolate(double x, double y, IVertexValuator valuator)Performs an interpolation with special handling to provide values for regions to the exterior of the Delaunay Triangulation. If the query point (x,y) lies inside the triangulation, the interpolation will is performed using the coordinates of the enclosing triangle. If the query point (x,y) lies to the exterior, it will be projected down to the nearest edge and a value will be interpolated between the values of the edge-defining vertices (v0, v1).When the query point is outside the TIN, the normal vector is computed based on the behavior of the plane generated by the z values in the region adjacent to the perimeter edge.
This method does not perform an extrapolation. Instead, the computed value is assigned the value of the nearest point on the convex hull of the TIN. Consequently, the valid domain for input coordinates covers the full range of finite floating-point values.
Note that this method can still return a NaN value if the TIN is not populated with at least one non-trivial triangle.
- Specified by:
interpolatein interfaceIInterpolatorOverTin- Parameters:
x- the planar x coordinate of the interpolation pointy- the planar y coordinate of the interpolation pointvaluator- a valid valuator for interpreting the z value of each vertex or a null value to use the default.- Returns:
- if successful, a valid floating point value; otherwise, NaN.
-
-