Class Interpolate1D_F32

java.lang.Object
boofcv.alg.interpolate.array.Interpolate1D_F32
Direct Known Subclasses:
PolynomialNeville_F32

public abstract class Interpolate1D_F32
extends Object
Provides much of the basic house keeping needed for interpolating 1D data. Interpolation is done using sample points y[i] = f(x[i]) where x is a monotonically increasing or decreasing function.
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected boolean ascend  
    protected int index0  
    protected int M  
    protected int size  
    protected float[] x  
    protected float[] y  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected Interpolate1D_F32​(int degree)  
    protected Interpolate1D_F32​(int degree, float[] x, float[] y, int size)  
  • Method Summary

    Modifier and Type Method Description
    protected void bisectionSearch​(float val, int lowerLimit, int upperLimit)
    Searches the x array by bisecting it.
    void changeDegree​(int degree)
    Changes the number of points used in the interpolation.
    protected abstract float compute​(float testX)
    This is where the specific implementation of the interpolation is done.
    protected void hunt​(float val)
    To speed up finding the appropriate indexes to use in the interpolation it can use its previous results to search a smaller region than it would otherwise.
    float process​(float testX)
    Performs interpolation at the sample point.
    float process​(int index0, float testX)
    Performs an interpolation using sample data starting at index0.
    void setInput​(float[] x, float[] y, int size)
    Sets the data that is being interpolated.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • size

      protected int size
    • x

      protected float[] x
    • y

      protected float[] y
    • M

      protected int M
    • index0

      protected int index0
    • ascend

      protected boolean ascend
  • Constructor Details

    • Interpolate1D_F32

      protected Interpolate1D_F32​(int degree)
      Parameters:
      degree - The number of points used in the interpolation minus one
    • Interpolate1D_F32

      protected Interpolate1D_F32​(int degree, float[] x, float[] y, int size)
      Parameters:
      degree - The number of points used in the interpolation minus one
      x - Where the points are sample at. Not modifed. Reference saved.
      y - The value at the sample points. Not modifed. Reference saved.
      size - The number of points used.
  • Method Details

    • setInput

      public void setInput​(float[] x, float[] y, int size)
      Sets the data that is being interpolated.
      Parameters:
      x - Where the points are sample at. Not modifed. Reference saved.
      y - The value at the sample points. Not modifed. Reference saved.
      size - The number of points used.
    • process

      public float process​(float testX)
      Performs interpolation at the sample point.
      Parameters:
      testX - Where the interpolated value is done at.
      Returns:
      The interpolated value at sampleX.
    • process

      public float process​(int index0, float testX)
      Performs an interpolation using sample data starting at index0. Little checking is done and it is assumed the user knows what he is doing. Interpolation is done using points from index0 to index0 + M - 1
      Parameters:
      index0 - first sample point used in the interpolation.
      testX - Where the interpolated value is done at.
      Returns:
      The interpolated value at sampleX.
    • compute

      protected abstract float compute​(float testX)
      This is where the specific implementation of the interpolation is done. It should use points index0 to index0 + M - 1 in its interpolation
      Parameters:
      testX - Where the interpolated value is done at.
      Returns:
      The interpolated value at sampleX.
    • changeDegree

      public void changeDegree​(int degree)
      Changes the number of points used in the interpolation.
      Parameters:
      degree - Number of points used minus one.
    • hunt

      protected void hunt​(float val)
      To speed up finding the appropriate indexes to use in the interpolation it can use its previous results to search a smaller region than it would otherwise.
      Parameters:
      val - The value that is to be interpolated.
    • bisectionSearch

      protected void bisectionSearch​(float val, int lowerLimit, int upperLimit)
      Searches the x array by bisecting it. This takes advantage of the data being monotonic. This finds a center index which has the following property: x[center] ≤ val < x[center+1] From that it selects index0 which is center - M/2.
      Parameters:
      val - The value that is to be interpolated.
      lowerLimit - Lower limit for x index.
      upperLimit - The largest possible index of x