Class: Range

Inherits:
Object
  • Object
show all
Defined in:
lib/chingu/core_ext/range.rb

Instance Method Summary collapse

Instance Method Details

#interpolate(t) ⇒ Object

Linearly interpolates a value between begin and end.



6
7
8
9
10
11
# File 'lib/chingu/core_ext/range.rb', line 6

def interpolate(t)
  # TODO possibly allow geometric or arbitrary interpolation
  a,  b  = self.begin, self.end
  ta, tb = (1.0 - t), t
  a * ta  + b * tb
end