Class GridNdHelper
java.lang.Object
org.ddogleg.chainrule.grid.GridNdHelper
Helper/utility class for different operations on a
GridCoefND-
Field Summary
FieldsModifier and TypeFieldDescriptionintGrid coordinate point is insidedoubleFractional coordinate inside the grid celldoubleFractional coordinate inside the grid cellintInput image shapeint[]Location of knot offsetsintGrid coordinate point is insidedoubleRange the spline's samples are spread across, evenly.doubleRange the spline's samples are spread across, evenly.doubleBlending weights for bilinear interpolationdoubleBlending weights for bilinear interpolationdoubleBlending weights for bilinear interpolationdoubleBlending weights for bilinear interpolationintInput image shape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleblendPoly(double value, int outputIdx) Blends the four knots for one output.doubleblendPolyDeriv(double value, int outputIdx) Derivative ofblendPoly(double, int)with respect to the valuedoubleblendSpline(double value, int outputIdx) blendPoly(double, int)with the knots read as splines insteadvoidconfigure(GridCoefND grid, int width, int height) configureSpline(double valueMin, double valueMax) Range the*Splinemethods spread a knot's coefficients across.voidcoorToGrid(double x, double y) doubleevaluatePoly(double value, int offset) Evaluates a polynomial which starts at the offsetdoubleevaluatePolyDeriv(double value, int offset) Derivative ofevaluatePoly(double, int)with respect to the valuedoubleevaluateSpline(double value, int offset) Evaluates a spline which starts at the offset.voidBilinear weights for the cell found bycoorToGrid(double, double), along with where that cell's knots live.
-
Field Details
-
width
public int widthInput image shape -
height
public int heightInput image shape -
col
public int colGrid coordinate point is inside -
row
public int rowGrid coordinate point is inside -
fracCol
public double fracColFractional coordinate inside the grid cell -
fracRow
public double fracRowFractional coordinate inside the grid cell -
w0
public double w0Blending weights for bilinear interpolation -
w1
public double w1Blending weights for bilinear interpolation -
w2
public double w2Blending weights for bilinear interpolation -
w3
public double w3Blending weights for bilinear interpolation -
knotOffsets
public int[] knotOffsetsLocation of knot offsets -
valueMin
public double valueMinRange the spline's samples are spread across, evenly. Only the*Splinemethods read it -
valueMax
public double valueMaxRange the spline's samples are spread across, evenly. Only the*Splinemethods read it
-
-
Constructor Details
-
GridNdHelper
public GridNdHelper()
-
-
Method Details
-
configure
-
configureSpline
Range the*Splinemethods 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 bycoorToGrid(double, double), along with where that cell's knots live. Both depend only on the point, soblendPoly(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 ofevaluatePoly(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 fromvalueMintovalueMax, socoefsof them makecoefs - 1buckets, 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 bygridToWeights()and only stepped along here -
blendPolyDeriv
public double blendPolyDeriv(double value, int outputIdx) Derivative ofblendPoly(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
-