Class LinearInterpolation


  • public class LinearInterpolation
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double linearInterp​(double xa, double ya, double xb, double yb, double x)
      solves the equation (yb-ya)/(xb-xa) = (y-ya)/(x-xa) for y given x.
      static double[] slopeIntercept​(double xa, double ya, double xb, double yb)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LinearInterpolation

        public LinearInterpolation()
    • Method Detail

      • linearInterp

        public static double linearInterp​(double xa,
                                          double ya,
                                          double xb,
                                          double yb,
                                          double x)
        solves the equation (yb-ya)/(xb-xa) = (y-ya)/(x-xa) for y given x. Useful for finding the pixel for a value given the dimension of the area and the range of values it is supposed to cover. Note, this does not check for xa == xb, in which case a divide by zero would occur.
      • slopeIntercept

        public static double[] slopeIntercept​(double xa,
                                              double ya,
                                              double xb,
                                              double yb)