Class: Bvh
- Inherits:
-
Object
- Object
- Bvh
- Defined in:
- lib/bvh.rb,
lib/bvh/motion.rb,
lib/bvh/parser.rb,
lib/bvh/exporter.rb,
lib/bvh/skeleton.rb,
lib/bvh/motion/frame.rb,
lib/bvh/motion/channel_data.rb
Defined Under Namespace
Classes: Exporter, Motion, Parser, Skeleton
Instance Attribute Summary collapse
-
#motion ⇒ Object
readonly
The motion capture data associated with this BVH.
-
#skeletons ⇒ Object
readonly
The array of skeletons associated with this BVH.
Class Method Summary collapse
-
.import(file) ⇒ Object
Instantiates a new BVH and imports its data from the specified file.
Instance Method Summary collapse
-
#create_skeleton! ⇒ Object
Creates a new skeleton, adds it to the #skeletons array, and returns it.
-
#export(file) ⇒ Object
Exports this BVH into the specified file.
-
#frame_count ⇒ Object
Returns the number of frames in the motion capture data.
-
#frame_time ⇒ Object
Returns the amount of time, in seconds, each frame occupies.
-
#frame_time=(a) ⇒ Object
Sets the amount of time, in seconds, each frame occupies.
-
#frames ⇒ Object
Returns the frame data associated with this BVH file.
-
#frames_per_second ⇒ Object
Returns the frames per second calculated by (1 / frame_time).
-
#frames_per_second=(a) ⇒ Object
Assigns the frame_time by calculating it from (1 / frames_per_second).
-
#initialize ⇒ Bvh
constructor
A new instance of Bvh.
-
#last_frame ⇒ Object
Returns the last frame associated with this animation.
-
#root ⇒ Object
Returns the root bone in #skeleton.
-
#root=(a) ⇒ Object
Assigns the root bone in #skeleton.
-
#skeleton ⇒ Object
Returns the first (and usually the only) skeleton in the #skeletons array.
Constructor Details
Instance Attribute Details
#motion ⇒ Object (readonly)
The motion capture data associated with this BVH.
16 17 18 |
# File 'lib/bvh.rb', line 16 def motion @motion end |
#skeletons ⇒ Object (readonly)
The array of skeletons associated with this BVH.
13 14 15 |
# File 'lib/bvh.rb', line 13 def skeletons @skeletons end |
Class Method Details
Instance Method Details
#create_skeleton! ⇒ Object
Creates a new skeleton, adds it to the #skeletons array, and returns it.
56 |
# File 'lib/bvh.rb', line 56 def create_skeleton!; (@skeletons << Bvh::Skeleton.new).last; end |
#export(file) ⇒ Object
Exports this BVH into the specified file.
69 70 71 72 73 |
# File 'lib/bvh.rb', line 69 def export(file) exporter = Bvh::Exporter.new(file) exporter.export(self) self end |
#frame_count ⇒ Object
Returns the number of frames in the motion capture data.
50 |
# File 'lib/bvh.rb', line 50 def frame_count; motion.frame_count; end |
#frame_time ⇒ Object
Returns the amount of time, in seconds, each frame occupies. Most BVH files have this set to 0.333333, which is equal to 30 frames per second.
37 |
# File 'lib/bvh.rb', line 37 def frame_time; motion.frame_time; end |
#frame_time=(a) ⇒ Object
Sets the amount of time, in seconds, each frame occupies. Most BVH files have this set to 0.333333, which is equal to 30 frames per second.
41 |
# File 'lib/bvh.rb', line 41 def frame_time=(a); motion.frame_time = a; end |
#frames ⇒ Object
Returns the frame data associated with this BVH file.
30 |
# File 'lib/bvh.rb', line 30 def frames; motion.frames; end |
#frames_per_second ⇒ Object
Returns the frames per second calculated by (1 / frame_time)
44 |
# File 'lib/bvh.rb', line 44 def frames_per_second; motion.frames_per_second; end |
#frames_per_second=(a) ⇒ Object
Assigns the frame_time by calculating it from (1 / frames_per_second)
47 |
# File 'lib/bvh.rb', line 47 def frames_per_second=(a); motion.frames_per_second = a; end |
#last_frame ⇒ Object
Returns the last frame associated with this animation.
33 |
# File 'lib/bvh.rb', line 33 def last_frame; frames.last; end |
#root ⇒ Object
Returns the root bone in #skeleton
27 |
# File 'lib/bvh.rb', line 27 def root; skeleton.root; end |
#root=(a) ⇒ Object
Assigns the root bone in #skeleton
24 |
# File 'lib/bvh.rb', line 24 def root=(a); skeleton.root = a; end |
#skeleton ⇒ Object
Returns the first (and usually the only) skeleton in the #skeletons array.
53 |
# File 'lib/bvh.rb', line 53 def skeleton; @skeletons.first; end |