Can someone explain `Vector2.cubic_interpolate()`?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dlean Jeans

The docs for this function:

  • Vector2 cubic_interpolate( Vector2 b, Vector2 pre_a, Vector2 post_b, float t )

Cubicly interpolates between this Vector and “b”, using “pre_a” and
“post_b” as handles, and returning the result at position “t”. “t”
should be a float of 0.0-1.0, a percentage of how far along the
interpolation is.

I’m not sure what to pass for pre_a and post_b.
There’s not much on this on Google.

I think it has something to do with bezier curves. You know, you need 4 points to do a cubic interpolation. May be that are the 2 missing points. IDK, but i vote up your question because it would be nice to have explanation.

p7f | 2019-01-03 18:02

:bust_in_silhouette: Reply From: p7f

Hi, as i commented, i was not sure, so i asked in IRC… this was the answer:

[15:17] <bojidar_bg> p7f: pre_a and post_b are handles, indeed similar
to those for a besier curve
[15:17] <bojidar_bg> the result curve will be tangential to the pre_a - a line at a, I assume
[15:18]<bojidar_bg> best way to choose them is to try with some values first, see what result it produces, then proceeding from there
[15:18] bojidar_bg: so it should be also tangencial to b - post_b?
[15:19]<bojidar_bg> yeah, at b
[15:19] bojidar_bg: thanks a lot!

Is not my merit this answer, but i post so others can see anyway.

:bust_in_silhouette: Reply From: Dlean Jeans

So I created a scene so you can test out the function with drag and drop.
Click on the image below to see the .tscn file on GitHub.