Class GridNdHelper

java.lang.Object
org.ddogleg.chainrule.grid.GridNdHelper

public class GridNdHelper extends Object
Helper/utility class for different operations on a GridCoefND
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Grid coordinate point is inside
    double
    Fractional coordinate inside the grid cell
    double
    Fractional coordinate inside the grid cell
    int
    Input image shape
    int[]
    Location of knot offsets
    int
    Grid coordinate point is inside
    double
    Range the spline's samples are spread across, evenly.
    double
    Range the spline's samples are spread across, evenly.
    double
    Blending weights for bilinear interpolation
    double
    Blending weights for bilinear interpolation
    double
    Blending weights for bilinear interpolation
    double
    Blending weights for bilinear interpolation
    int
    Input image shape
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    blendPoly(double value, int outputIdx)
    Blends the four knots for one output.
    double
    blendPolyDeriv(double value, int outputIdx)
    Derivative of blendPoly(double, int) with respect to the value
    double
    blendSpline(double value, int outputIdx)
    blendPoly(double, int) with the knots read as splines instead
    void
    configure(GridCoefND grid, int width, int height)
     
    configureSpline(double valueMin, double valueMax)
    Range the *Spline methods spread a knot's coefficients across.
    void
    coorToGrid(double x, double y)
     
    double
    evaluatePoly(double value, int offset)
    Evaluates a polynomial which starts at the offset
    double
    evaluatePolyDeriv(double value, int offset)
    Derivative of evaluatePoly(double, int) with respect to the value
    double
    evaluateSpline(double value, int offset)
    Evaluates a spline which starts at the offset.
    void
    Bilinear weights for the cell found by coorToGrid(double, double), along with where that cell's knots live.

    Methods inherited from class Object

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

    • width

      public int width
      Input image shape
    • height

      public int height
      Input image shape
    • col

      public int col
      Grid coordinate point is inside
    • row

      public int row
      Grid coordinate point is inside
    • fracCol

      public double fracCol
      Fractional coordinate inside the grid cell
    • fracRow

      public double fracRow
      Fractional coordinate inside the grid cell
    • w0

      public double w0
      Blending weights for bilinear interpolation
    • w1

      public double w1
      Blending weights for bilinear interpolation
    • w2

      public double w2
      Blending weights for bilinear interpolation
    • w3

      public double w3
      Blending weights for bilinear interpolation
    • knotOffsets

      public int[] knotOffsets
      Location of knot offsets
    • valueMin

      public double valueMin
      Range the spline's samples are spread across, evenly. Only the *Spline methods read it
    • valueMax

      public double valueMax
      Range the spline's samples are spread across, evenly. Only the *Spline methods read it
  • Constructor Details

    • GridNdHelper

      public GridNdHelper()
  • Method Details

    • configure

      public void configure(GridCoefND grid, int width, int height)
    • configureSpline

      public GridNdHelper configureSpline(double valueMin, double valueMax)
      Range the *Spline methods spread a knot's coefficients across. The grid itself says nothing about it, so whatever configured the fit has to say it again here or the samples are read at the wrong places
    • coorToGrid

      public void coorToGrid(double x, double y)
    • gridToWeights

      public void gridToWeights()
      Bilinear weights for the cell found by coorToGrid(double, double), along with where that cell's knots live. Both depend only on the point, so blendPoly(double, int) can be called once per output without redoing them
    • evaluatePoly

      public double evaluatePoly(double value, int offset)
      Evaluates a polynomial which starts at the offset
    • evaluatePolyDeriv

      public double evaluatePolyDeriv(double value, int offset)
      Derivative of evaluatePoly(double, int) with respect to the value
    • evaluateSpline

      public double evaluateSpline(double value, int offset)
      Evaluates a spline which starts at the offset. The coefficients are samples spread evenly from valueMin to valueMax, so coefs of them make coefs - 1 buckets, and a value outside that range is clamped to the nearest end rather than extrapolated
      See Also:
    • blendPoly

      public double blendPoly(double value, int outputIdx)
      Blends the four knots for one output. The knots are the same for every output of a point, so their locations are found once by gridToWeights() and only stepped along here
    • blendPolyDeriv

      public double blendPolyDeriv(double value, int outputIdx)
      Derivative of blendPoly(double, int) with respect to the value
    • blendSpline

      public double blendSpline(double value, int outputIdx)
      blendPoly(double, int) with the knots read as splines instead