Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUBICSPLINE resample #4

Open
kzhsw opened this issue May 19, 2023 · 0 comments
Open

CUBICSPLINE resample #4

kzhsw opened this issue May 19, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@kzhsw
Copy link
Owner

kzhsw commented May 19, 2023

Defined in gltf spec, or rendered

// tc be the current (requested) timestamp, tk<tc<tk+1;
// (tc−tk)/td be the segment-normalized interpolation factor.
_In_ float amount;
// td=tk+1−tk be the duration of the interpolation segment;
_In_ float td;
// ak, vk, and bk be the in-tangent, the property value, and the out-tangent of the k-th frame respectively.

float squared = amount * amount;
float cubed = amount * squared;
float part2 = -2.0 * cubed + 3.0 * squared;
float part1 = -part2 + 1.0;
float part3 = cubed - 2.0 * squared + amount;
float part4 = cubed - squared;

part3 *= td;
part4 *= td;

return vec_k * part1 + vec_k1 * part2 + outTangent_k * part3 + inTangent_k1 * part4;

Quaternions should be normalized after this.

@kzhsw kzhsw added the enhancement New feature or request label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant