class Musicality::Function::Linear
Attributes
intercept[R]
slope[R]
Public Class Methods
new(p1,p2)
click to toggle source
Calls superclass method
Musicality::Function::new
# File lib/musicality/notation/util/function.rb, line 61 def initialize p1,p2 @slope = (p2[1] - p1[1])/(p2[0] - p1[0]).to_f @intercept = p1[1] - @slope * p1[0] super() {|x| x * @slope + @intercept } end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
Musicality::Function#==
# File lib/musicality/notation/util/function.rb, line 68 def ==(other) super(other) && @slope == other.slope && @intercept == other.intercept end