From 12b0b74d43b7d93eee82ae6fa3dced499cd8a1f6 Mon Sep 17 00:00:00 2001 From: KT Date: Tue, 19 Oct 2021 14:03:28 -0500 Subject: Publish a4 --- dev/a4-dance/motion_clip.cc | 157 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 dev/a4-dance/motion_clip.cc (limited to 'dev/a4-dance/motion_clip.cc') diff --git a/dev/a4-dance/motion_clip.cc b/dev/a4-dance/motion_clip.cc new file mode 100644 index 0000000..f239aec --- /dev/null +++ b/dev/a4-dance/motion_clip.cc @@ -0,0 +1,157 @@ +#include "motion_clip.h" + +#include + +#include "amc_util.h" +#include "simple_parser.h" + +MotionClip::MotionClip() { +} + +MotionClip::~MotionClip() { +} + +int MotionClip::size() const { + return (int)frames_.size(); +} + +Pose MotionClip::pose(int frame_num) const { + return frames_[frame_num]; +} + +Pose& MotionClip::pose(int frame_num) { + return frames_[frame_num]; +} + +void MotionClip::TrimFront(int num_frames) { + frames_.erase(frames_.begin(), frames_.begin() + num_frames); +} + +void MotionClip::TrimBack(int num_frames) { + frames_.erase(frames_.end()-num_frames-1, frames_.end()-1); +} + +void MotionClip::PrependPose(const Pose &pose) { + frames_.insert(frames_.begin(), pose); +} + +void MotionClip::AppendPose(const Pose &pose) { + frames_.push_back(pose); +} + + +void MotionClip::PrependClip(const MotionClip &clip, int num_blend_frames) { + for (int i=0; i < clip.size()-num_blend_frames; i++) { + frames_.insert(frames_.begin(), clip[i]); + } + for (int i=0; i