dilevin / computer-graphics-kinematics

Computer Graphics Assignment about Kinematics
3 stars 4 forks source link

Handling edge cases in catmull_rom_interpolation #20

Open sheepf75 opened 4 years ago

sheepf75 commented 4 years ago

Hi,

In the catmull_rom_interpolation() code, it mentions how we need to interpolate the theta positions of a given t; however, when I ran it, sometimes the parameter t goes beyond the maximum time in keyframes, and initially keyframes is empty. I wasn't able to find the information in the header docs, readme, and the textbook.

Thus, do you know what should the function should do when:

Thank you!

honglin-c commented 4 years ago
  1. If t > keyframes.back().first or t < keyframes.front().first, you can return keyframes.back().second or keyframes.front().second respectively.
  2. If keyframe.size() == 0, you can simply return a vector of (0,0,0).
RajarupanSampanthan commented 4 years ago
1. If t > keyframes.back().first or t < keyframes.front().first, you can return keyframes.back().second or keyframes.front().second respectively.

2. If keyframe.size() == 0, you can simply return a vector of (0,0,0).

I'd advise against this because then you wouldn't get looping animation

honglin-c commented 4 years ago
1. If t > keyframes.back().first or t < keyframes.front().first, you can return keyframes.back().second or keyframes.front().second respectively.

2. If keyframe.size() == 0, you can simply return a vector of (0,0,0).

I'd advise against this because then you wouldn't get looping animation

Just to clarify, we don't require looping animation. The animation in the Readme seems to be looping since it's a gif. And if you need to replay the animation, you can press 'R' to reset bone transformations to rest.