Module: Astronoby::Util::Maths
- Defined in:
- lib/astronoby/util/maths.rb
Class Method Summary collapse
-
.interpolate(values, factor) ⇒ Float
Interpolated value.
Class Method Details
.interpolate(values, factor) ⇒ Float
Returns Interpolated value.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/astronoby/util/maths.rb', line 16 def interpolate(values, factor) unless factor.between?(0, 1) raise IncompatibleArgumentsError, "Interpolation factor must be between 0 and 1, got #{factor}" end if values.length == 3 return interpolate_3_terms(values, factor) elsif values.length == 5 return interpolate_5_terms(values, factor) end raise IncompatibleArgumentsError, "Only 3 or 5 terms are supported for interpolation" end |