Class: Tracksperanto::Export::PFTrack

Inherits:
Base
  • Object
show all
Defined in:
lib/export/pftrack.rb

Overview

Export for PFTrack .2dt files

Constant Summary collapse

KEYFRAME_TEMPLATE =
"%s %.3f %.3f %.3f"

Instance Attribute Summary

Attributes inherited from Base

#io

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#end_export, inherited, #initialize, #start_export

Constructor Details

This class inherits a constructor from Tracksperanto::Export::Base

Class Method Details

.desc_and_extensionObject



6
7
8
# File 'lib/export/pftrack.rb', line 6

def self.desc_and_extension
  "pftrack.2dt"
end

.human_nameObject



10
11
12
# File 'lib/export/pftrack.rb', line 10

def self.human_name
  "PFTrack .2dt file"
end

Instance Method Details

#end_tracker_segmentObject



20
21
22
23
24
25
26
# File 'lib/export/pftrack.rb', line 20

def end_tracker_segment
  block = [ "\n",
    @tracker_name.inspect, # "autoquotes"
    @prev_tracker.length,
    @prev_tracker.join("\n") ]
  @io.puts block.join("\n")
end

#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object



28
29
30
31
# File 'lib/export/pftrack.rb', line 28

def export_point(frame, abs_float_x, abs_float_y, float_residual)
  line = KEYFRAME_TEMPLATE % [frame, abs_float_x, abs_float_y, float_residual / 8]
  @prev_tracker << line
end

#start_tracker_segment(tracker_name) ⇒ Object



14
15
16
17
18
# File 'lib/export/pftrack.rb', line 14

def start_tracker_segment(tracker_name)
  # Setup for the next tracker
  @prev_tracker = []
  @tracker_name = tracker_name
end