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
- APPROXIMATION_EPSILON =
1.0e-09- VERYSMALL =
1.0e-20- MAXIMUM_ITERATIONS =
100
Constants inherited from ConstantSegment
ConstantSegment::NEG_INF, ConstantSegment::POS_INF
Instance Attribute Summary
Attributes inherited from ConstantSegment
Instance Method Summary (collapse)
-
- (BezierSegment) initialize(x1, x2, y1, y2, t1x, t1y, t2x, t2y)
constructor
A new instance of BezierSegment.
- - (Object) value_at(frame)
Methods inherited from ConstantSegment
Constructor Details
- (BezierSegment) initialize(x1, x2, y1, y2, t1x, t1y, t2x, t2y)
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
- (Object) value_at(frame)
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 |