From f30fcc505dc3ce2df25dce16b329c90c32049862 Mon Sep 17 00:00:00 2001 From: Jessie Speert Date: Mon, 8 Mar 2021 19:09:55 -0800 Subject: Uploading Assignment 4 --- 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