Class: Kamelopard::Functions::Constant
- Inherits:
-
Cubic
- Object
- Function
- Function1D
- Cubic
- Kamelopard::Functions::Constant
- Defined in:
- lib/kamelopard/function.rb
Instance Attribute Summary
Attributes inherited from Cubic
Attributes inherited from Function
#append, #compose, #end, #max, #min, #start, #verbose
Class Method Summary collapse
-
.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.
Instance Method Summary collapse
-
#initialize(c0 = 0.0, min = 0.0, max = 1.0) ⇒ Constant
constructor
A new instance of Constant.
Methods inherited from Cubic
Methods inherited from Function1D
Methods inherited from 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 |