How to build the path between adjacent spatial keyframes derived from their values and tangents
Problem:
1. Calculate TwoD_SPATIAL property path between adjacent keyframes and convert it to a set of "hold" OR "linear" keyframes set to each frame on the distance
Restrictions:
1. We cannot use the api (like property.getValueAtTime(t)), only adjacent keyframes as an input
Input:
- Adjacent keyframes for TwoD_SPATIAL property with some bezier spatial interpolation
- Temporal interpolation for these keyframes can be of any type

My assumption was to:
- Build the curve using cubic bezier function based on 4 points: Keyframe1, Keyframe1 Out Tangent, Keyframe 2 In Tangent and Keyframe 2 value
- Somehow apply the temporal interpolation, if it's not linear (not solved yet)
What I observed:
1. The temporal interpolation was set to Linear just to begin with just defining the curve
2. The points I took for calculation:
P1 = 1st Kf value [x1, y1]
P2 = 1st Kf value - 1st Kf Out tangent = [x1, y1] - [xtn1, ytn1]
P3 = 2nd Kf value - 2nd Kf In tangent = [x2, y2] - [xtn2, ytn2]
P4 = 2nd Kf value = [x2, y2]
3. The formula to build the curve:
x(t) = (1−t)^3 * x1 + 3(1−t)^2 * t * x2 + 3(1−t)* t^2 * x3 + t^3 * x4
y(t) = (1−t)^3 * y1 + 3(1−t)^2 * t * y2 + 3(1−t)* t^2 * y3 + t^3 * y4For convenience I just calculated values for t = 0.5, but the result didn't match what we have actually in AE in the middle of the path
So have next questions:
1. Probably you guys can advice me what's wrong in the assumption that I can build the path curve via creating cubic bezier path (maybe smth with base points to choose)
2. What is the proper way to take into account the temporal interpolation when the path is finally derived
Thanks in advance!
