Class: FlameChannelParser::Segments::BezierSegment
- Inherits:
-
LinearSegment
- Object
- ConstantSegment
- LinearSegment
- FlameChannelParser::Segments::BezierSegment
- Defined in:
- lib/segments.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Pt
Constant Summary
Constants inherited from ConstantSegment
ConstantSegment::NEG_INF, ConstantSegment::POS_INF
Instance Attribute Summary
Attributes inherited from ConstantSegment
Instance Method Summary collapse
-
#initialize(x1, x2, y1, y2, t1x, t1y, t2x, t2y) ⇒ BezierSegment
constructor
A new instance of BezierSegment.
- #value_at(frame) ⇒ Object
Methods inherited from ConstantSegment
Constructor Details
#initialize(x1, x2, y1, y2, t1x, t1y, t2x, t2y) ⇒ BezierSegment
Returns a new instance of BezierSegment.
98 99 100 101 102 103 |
# File 'lib/segments.rb', line 98 def initialize(x1, x2, y1, y2, t1x, t1y, t2x, t2y) @start_frame, @end_frame = x1, x2 @a = Pt.new(x1, y1, t1x, t1y) @b = Pt.new(x2, y2, t2x, t2y) end |
Instance Method Details
#value_at(frame) ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/segments.rb', line 105 def value_at(frame) return @a.y if frame == @start_frame # Solve T from X. This determines the correlation between X and T. t = approximate_t(frame, @a.x, @a.tanx, @b.tanx, @b.x) vy = bezier(t, @a.y, @a.tany, @b.tany, @b.y) end |