Class: FlameChannelParser::Segments::LinearPrepolate
- Inherits:
-
LinearSegment
- Object
- ConstantSegment
- LinearSegment
- FlameChannelParser::Segments::LinearPrepolate
- Defined in:
- lib/segments.rb
Overview
This segment does prepolation with a linear coefficient
Constant Summary
Constants inherited from ConstantSegment
ConstantSegment::NEG_INF, ConstantSegment::POS_INF
Instance Attribute Summary
Attributes inherited from ConstantSegment
Instance Method Summary collapse
-
#initialize(upto_frame, base_value, tangent) ⇒ LinearPrepolate
constructor
:nodoc:.
- #value_at(frame) ⇒ Object
Methods inherited from ConstantSegment
Constructor Details
#initialize(upto_frame, base_value, tangent) ⇒ LinearPrepolate
:nodoc:
200 201 202 203 204 205 |
# File 'lib/segments.rb', line 200 def initialize(upto_frame, base_value, tangent) @value = base_value @end_frame = upto_frame @start_frame = NEG_INF @tangent = tangent.to_f end |
Instance Method Details
#value_at(frame) ⇒ Object
207 208 209 210 |
# File 'lib/segments.rb', line 207 def value_at(frame) frame_diff = (frame - @end_frame) @value + (@tangent * frame_diff) end |