Class Interpolator2D
- java.lang.Object
-
- gov.nasa.worldwindx.applications.antenna.Interpolator2D
-
public class Interpolator2D extends java.lang.Object
Represents a 2D function defined by sample points and interpolates values within the domain of the samples. Each sample is defined by two coordinates, (s, t) and a function value, r, such that f(s,t) = r. Once the function's sample points are added to the interpolator, the interpolator determines values at any coordinate within the sample domain. An option exists to interpolate outside the sample domain by wrapping from maximum back to minimum values. SeesetWrapS(boolean)
for a description of this option.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.TreeMap<java.lang.Double,java.util.TreeMap<java.lang.Double,java.lang.Double>>
map
protected java.lang.Double
maxS
protected java.lang.Double
maxT
protected java.lang.Double
maxValue
protected java.lang.Double
minS
protected java.lang.Double
minT
protected java.lang.Double
minValue
protected boolean
wrapS
protected boolean
wrapT
-
Constructor Summary
Constructors Constructor Description Interpolator2D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFromFile(java.io.File file)
void
addFromStream(java.io.InputStream is)
void
addValue(double s, double t, double r)
Adds a value to this interpolator.java.lang.Double
getMaxS()
Returns the maximum first coordinate within this interpolator.java.lang.Double
getMaxT()
Returns the maximum second coordinate within this interpolator.java.lang.Double
getMaxValue()
Returns the maximum value within this interpolator.java.lang.Double
getMinS()
Returns the minimum first coordinate within this interpolator.java.lang.Double
getMinT()
Returns the minimum second coordinate within this interpolator.java.lang.Double
getMinValue()
Returns the minimum value within this interpolator.java.lang.Double
getValue(double s, double t)
Determines and returns a value from this interpolator using bi-linear interpolation.boolean
isWrapS()
Indicates whether this interpolator interpolates between maximum and minimum first coordinates if a first coordinate outside the current range of first coordinates is specified.boolean
isWrapT()
Indicates whether this interpolator interpolates between maximum and minimum second coordinates if a second coordinate outside the current range of second coordinates is specified.void
setWrapS(boolean wrapS)
Specifies whether this interpolator interpolates between maximum and minimum first coordinates if a first coordinate outside the current range of first coordinates is specified.void
setWrapT(boolean wrapT)
Specifies whether this interpolator interpolates between maximum and minimum second coordinates if a second coordinate outside the current range of second coordinates is specified.
-
-
-
Field Detail
-
wrapS
protected boolean wrapS
-
wrapT
protected boolean wrapT
-
minS
protected java.lang.Double minS
-
maxS
protected java.lang.Double maxS
-
minT
protected java.lang.Double minT
-
maxT
protected java.lang.Double maxT
-
minValue
protected java.lang.Double minValue
-
maxValue
protected java.lang.Double maxValue
-
map
protected java.util.TreeMap<java.lang.Double,java.util.TreeMap<java.lang.Double,java.lang.Double>> map
-
-
Method Detail
-
isWrapS
public boolean isWrapS()
Indicates whether this interpolator interpolates between maximum and minimum first coordinates if a first coordinate outside the current range of first coordinates is specified. SeesetWrapS(boolean)
for a description of wrapping and the use of this flag.- Returns:
- the first coordinate's wrap flag.
-
setWrapS
public void setWrapS(boolean wrapS)
Specifies whether this interpolator interpolates between maximum and minimum first coordinates if a first coordinate outside the current range of first coordinates is specified. For example, if the first coordinate represents a circular angle, and the minimum first coordinate is 0 while the maximum first coordinate is 350, when a value at a first coordinate of 355 is requested, interpolation should likely be performed between 350 and 0. If the wrap flag is true, interpolation is performed. If it is false, null is returned fromgetValue(double, double)
.The default wrap S flag is
false
.- Parameters:
wrapS
- the first coordinate's wrap flag.- See Also:
setWrapS(boolean)
-
isWrapT
public boolean isWrapT()
Indicates whether this interpolator interpolates between maximum and minimum second coordinates if a second coordinate outside the current range of second coordinates is specified. SeesetWrapS(boolean)
for a description of wrapping and the use of wrap flags.- Returns:
- the second coordinate's wrap flag.
- See Also:
setWrapS(boolean)
-
setWrapT
public void setWrapT(boolean wrapT)
Specifies whether this interpolator interpolates between maximum and minimum second coordinates if a second coordinate outside the current range of second coordinates is specified. SeesetWrapS(boolean)
for a description of wrapping and the use of wrap flags.The default T wrap flag is
false
.- Parameters:
wrapT
- the second coordinate's wrap flag.- See Also:
setWrapS(boolean)
-
addValue
public void addValue(double s, double t, double r)
Adds a value to this interpolator.- Parameters:
s
- the value's first coordinate.t
- the value's second coordinate.r
- the value to add.
-
getMinValue
public java.lang.Double getMinValue()
Returns the minimum value within this interpolator.- Returns:
- this interpolator's minimum value, or null if the interpolator contains no values.
-
getMaxValue
public java.lang.Double getMaxValue()
Returns the maximum value within this interpolator.- Returns:
- this interpolator's maximum value, or null if the interpolator contains no values.
-
getMinS
public java.lang.Double getMinS()
Returns the minimum first coordinate within this interpolator.- Returns:
- this interpolator's minimum first coordinate, or null if the interpolator contains no values.
-
getMaxS
public java.lang.Double getMaxS()
Returns the maximum first coordinate within this interpolator.- Returns:
- this interpolator's maximum first coordinate, or null if the interpolator contains no values.
-
getMinT
public java.lang.Double getMinT()
Returns the minimum second coordinate within this interpolator.- Returns:
- this interpolator's minimum second coordinate, or null if the interpolator contains no values.
-
getMaxT
public java.lang.Double getMaxT()
Returns the maximum second coordinate within this interpolator.- Returns:
- this interpolator's maximum second coordinate, or null if the interpolator contains no values.
-
getValue
public java.lang.Double getValue(double s, double t)
Determines and returns a value from this interpolator using bi-linear interpolation.- Parameters:
s
- the first coordinate.t
- the second coordinate.- Returns:
- the value at the specified coordinates, or null if a specified coordinate is outside the range of this interpolator and the corresponding wrap flag is false.
- See Also:
setWrapS(boolean)
,setWrapT(boolean)
-
addFromStream
public void addFromStream(java.io.InputStream is)
-
addFromFile
public void addFromFile(java.io.File file) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
-