Sha256: b9d057df3e4e3db4376b9c6fcefc6c7fdb1a24a38fbdc28c68aed746d44c47a8

Contents?: true

Size: 294 Bytes

Versions: 3

Compression:

Stored size: 294 Bytes

Contents

module SPCore
class Interpolation
  # Linear Interpolation Equation:
  #
  #        (x3 - x1)(y2 - y1)
  #  y3 =  ------------------  + y1
  #            (x2 - x1)
  #
  def self.linear x1, y1, x2, y2, x3
    y3 = ((x3 - x1) * (y2 - y1)) / (x2 - x1);
    y3 += y1;
    return y3;
  end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spcore-0.1.2 lib/spcore/lib/interpolation.rb
spcore-0.1.1 lib/spcore/lib/interpolation.rb
spcore-0.1.0 lib/spcore/lib/interpolation.rb