Class: Kamelopard::Functions::Constant

Inherits:
Cubic show all
Defined in:
lib/kamelopard/function.rb

Instance Attribute Summary

Attributes inherited from Cubic

#c0, #c1, #c2, #c3

Attributes inherited from Function

#append, #compose, #end, #max, #min, #start, #verbose

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Cubic

#run_function

Methods inherited from Function1D

#compose=

Methods inherited from Function

#get_value, #run_function

Constructor Details

#initialize(c0 = 0.0, min = 0.0, max = 1.0) ⇒ Constant

Returns a new instance of Constant.


162
163
164
# File 'lib/kamelopard/function.rb', line 162

def initialize(c0 = 0.0, min = 0.0, max = 1.0)
    super(0, 0, 0, c0, min, max)
end

Class Method Details

.interpolate(a, b) ⇒ Object

Interpolation isn't terribly useful for constants; to avoid using some superclass's interpolation accidentally, we'll just interpolate to the average of the two values


169
170
171
# File 'lib/kamelopard/function.rb', line 169

def self.interpolate(a, b)
    return Constant.new((b.to_f - a.to_f) / 0.0)
end