flame_channel_parser 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ class TestInterpolator < Test::Unit::TestCase
16
16
  end
17
17
  end
18
18
 
19
- def assert_same_interpolation(range, ref_channel, sample_channel)
19
+ def assert_same_interpolation(range, ref_channel, sample_channel, custom_delta = DELTA)
20
20
  ref_i, sample_i = [ref_channel, sample_channel].map{|c| FlameChannelParser::Interpolator.new(c) }
21
21
 
22
22
  value_tuples = range.map do |f|
@@ -25,7 +25,7 @@ class TestInterpolator < Test::Unit::TestCase
25
25
 
26
26
  begin
27
27
  value_tuples.each do | frame, ref, actual |
28
- assert_in_delta ref, actual, DELTA, "At #{frame} interpolated value should be in delta"
28
+ assert_in_delta ref, actual, custom_delta, "At #{frame} interpolated value should be in delta"
29
29
  end
30
30
  rescue Test::Unit::AssertionFailedError => e
31
31
  STDERR.puts "Curves were not the same so I will now copy the two curves to the clipboard"
@@ -158,4 +158,28 @@ class TestInterpolator < Test::Unit::TestCase
158
158
  assert_in_delta 379, interp.sample_at(41), DELTA
159
159
  assert_in_delta 683.772, interp.sample_at(1), DELTA
160
160
  end
161
+
162
+
163
+ def test_cycle_extrapolation
164
+ data = File.open(File.dirname(__FILE__) + "/snaps/Cycle_and_revcycle.action")
165
+ channels_in_ac = FlameChannelParser.parse(data)
166
+ chan = channels_in_ac.find{|c| c.path == "axis1_Cycle/position/y"}
167
+ chan_baked = channels_in_ac.find{|c| c.path == "axis1_Cycle/position/x"}
168
+
169
+ # We use a bigger delta since extrapolations can create BIG jumps
170
+ # in the function
171
+ assert_same_interpolation(1..400, chan_baked, chan, delta = 36)
172
+ end
173
+
174
+ def test_cycle_and_rev_extrapolation
175
+ data = File.open(File.dirname(__FILE__) + "/snaps/Cycle_and_revcycle.action")
176
+ channels_in_ac = FlameChannelParser.parse(data)
177
+ chan = channels_in_ac.find{|c| c.path == "axis1_Revcycle/position/y"}
178
+ chan_baked = channels_in_ac.find{|c| c.path == "axis1_Revcycle/position/x"}
179
+
180
+ # We use a bigger delta since extrapolations can create BIG jumps
181
+ # in the function
182
+ assert_same_interpolation(1..400, chan_baked, chan, delta = 1)
183
+ end
184
+
161
185
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flame_channel_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 2
10
- version: 1.3.2
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julik Tarkhanov
@@ -76,6 +76,7 @@ files:
76
76
  - lib/segments.rb
77
77
  - test/channel_with_constants.dat
78
78
  - test/sample_channel.dat
79
+ - test/snaps/Cycle_and_revcycle.action
79
80
  - test/snaps/FLEM_BrokenTangents.action
80
81
  - test/snaps/FLEM_advanced_curve.png
81
82
  - test/snaps/FLEM_advanced_curve_example_FL2012.action
@@ -92,6 +93,7 @@ files:
92
93
  - test/snaps/RefT_Steadicam_TwoKFs_HermiteAtBegin.timewarp
93
94
  - test/snaps/TW.timewarp
94
95
  - test/snaps/TW_SingleFrameExtrapolated_from2011.timewarp
96
+ - test/snaps/timewarp_where_interp_fails_at_end.timewarp
95
97
  - test/test_extractor.rb
96
98
  - test/test_flame_channel_parser.rb
97
99
  - test/test_interpolator.rb