Sha256: 25ecf6d14a39179328457ab64cd5407375e1579dfc4fc732e413ae2de391569f

Contents?: true

Size: 1.24 KB

Versions: 24

Compression:

Stored size: 1.24 KB

Contents

# -*- encoding : utf-8 -*-
# Internal representation of a keyframe, that carries info on the frame location in the clip, x y and residual.
#
# Franme numbers are zero-based (frame 0 is first frame of the clip).
# X-coordinate (abs_x) is absolute pixels from lower left corner of the comp to the right
# Y-coordinate (abs_y) is absolute pixels from lower left corner of the comp up
# Residual is how far in pixels the tracker strolls away, and is the inverse of
# correlation (with total correlation of one the residual excursion becomes zero).
class Tracksperanto::Keyframe
  include Tracksperanto::Casts, Tracksperanto::BlockInit, Comparable
  
  # Absolute integer frame where this keyframe is placed, 0 based
  attr_accessor :frame
  
  # Absolute float X value of the point, zero is lower left
  attr_accessor :abs_x
  
  # Absolute float Y value of the point, zero is lower left
  attr_accessor :abs_y
  
  # Absolute float residual (0 is "spot on")
  attr_accessor :residual
  
  cast_to_float :abs_x, :abs_y, :residual
  cast_to_int :frame
  
  def inspect
    '#< %.1fx%.1f @%d ~%.2f) >' %  [abs_x, abs_y, frame, residual]
  end
  
  def <=>(another)
    [frame, abs_x, abs_y, residual] <=> [another.frame, another.abs_x, another.abs_y, another.residual]
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
tracksperanto-3.3.6 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.0.pre lib/tracksperanto/keyframe.rb
tracksperanto-3.2.2 lib/tracksperanto/keyframe.rb
tracksperanto-3.2.1 lib/tracksperanto/keyframe.rb
tracksperanto-3.2.0 lib/tracksperanto/keyframe.rb
tracksperanto-3.1.0 lib/tracksperanto/keyframe.rb
tracksperanto-3.0.1 lib/tracksperanto/keyframe.rb
tracksperanto-3.0.0 lib/tracksperanto/keyframe.rb
tracksperanto-2.12.0 lib/tracksperanto/keyframe.rb
tracksperanto-2.11.3 lib/tracksperanto/keyframe.rb
tracksperanto-2.11.2 lib/tracksperanto/keyframe.rb
tracksperanto-2.11.1 lib/tracksperanto/keyframe.rb
tracksperanto-2.11.0 lib/tracksperanto/keyframe.rb
tracksperanto-2.10.0 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.9 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.8 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.7 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.6 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.5 lib/tracksperanto/keyframe.rb
tracksperanto-2.9.4 lib/tracksperanto/keyframe.rb