Created
December 20, 2023 13:00
-
-
Save tarjeihsch/1ec8d9d0303529c9d5d55ce374abbbf3 to your computer and use it in GitHub Desktop.
Hermite Interpolation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://en.wikipedia.org/wiki/Hermite_interpolation | |
| inline FVector HermiteInterpolation(const FVector& P0, const FVector& P1, const FVector& V0, const FVector& V1, const float Alpha) | |
| { | |
| const float H1 = 2 * FMath::Pow(Alpha, 3) - 3 * FMath::Pow(Alpha, 2) + 1; | |
| const float H2 = -2 * FMath::Pow(Alpha, 3) + 3 * FMath::Pow(Alpha, 2); | |
| const float H3 = FMath::Pow(Alpha, 3) - 2 * FMath::Pow(Alpha, 2) + Alpha; | |
| const float H4 = FMath::Pow(Alpha, 3) - FMath::Pow(Alpha, 2); | |
| return H1 * P0 + H2 * P1 + H3 * V0 + H4 * V1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment