Class: FlameChannelParser::Segments::LinearPrepolate

Inherits:
LinearSegment show all
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

#end_frame, #start_frame

Instance Method Summary collapse

Methods inherited from ConstantSegment

#defines?

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