page logo, three tetrahedra
intersecting a sphere
home
research gallery
  • origami
  • programming
  • biology inspired
  • photography
  • number notes
  • linear interpolation
    origami: fold math
    penny histogram
  • rants
  • games
  • misc


  •   Number Notes

    Linear Interpolation

    The objective is to determine the value of a function at a point, when the function is only described by a set of existing points. If the only points you were interested in happened to fall on the points you already had, then there would be no problem. Likely you want to know the value of the function at points other than the ones you already have. Interpolation is the name for the process of guessing values for the function that fall between the known values in a somewhat educated manner. The more accurate methods of interpolation, like bicubic interpolation, produce a very good fit to the original function but are difficult to calculate by hand. Linear interpolation usually will produce acceptable results with the minnimum of hand work.

    The X and Y values are known for two points, A(on left) and B(on right). The X value for point C is between the X values for A and B. You're trying to find the Y value for point C.

                 (Cx - Ax)
      Cy = Ay - ----------- * (Ay - By)
                 (Bx - Ax)
    
                 (Cx - Ax)
      Cy = Ay + ----------- * (By - Ay)
                 (Bx - Ax)
    
      |
      |
    Ay+-----A
      |     |
      |     |
    ? +-----+------C
      |     |      |
    By+-----+------+-----B
      |     |      |     |
      |     |      |     |
      |     |      |     |
     -+-----+------+-----+---------
      |     Ax     Cx    B
    
      |
      |
    By+------------------B
      |                  |
      |                  |
    ? +----------C       |
      |          |       |
    Ay+-----A    |       |
      |     |    |       |
      |     |    |       |
      |     |    |       |
     -+-----+----+-------+---------
      |     Ax   Cx      Bx
    
    Copyright © Darren Abbey.