Sha256: 7395a4120541e8887ea40cbb7173f3bf592e20651472a98e54c29ea719d51404

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 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
  
  # Integer frame where this keyframe is placed, 0-based
  attr_accessor :frame
  
  # Float X value of the point, zero is lower left
  attr_accessor :abs_x
  
  # Float Y value of the point, zero is lower left
  attr_accessor :abs_y
  
  # 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

18 entries across 18 versions & 1 rubygems

Version Path
tracksperanto-3.5.9 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.8 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.7 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.6 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.5 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.4 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.2 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.1 lib/tracksperanto/keyframe.rb
tracksperanto-3.5.0 lib/tracksperanto/keyframe.rb
tracksperanto-3.4.1 lib/tracksperanto/keyframe.rb
tracksperanto-3.4.0 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.13 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.12 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.11 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.10 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.9 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.8 lib/tracksperanto/keyframe.rb
tracksperanto-3.3.7 lib/tracksperanto/keyframe.rb