Cubic Bezier interpolation (2D tangents)
CS major here and I'm having a heck of a time trying to figure out how to do bezier interpolation.
I'm given some values, say V1 and V2 and my current value that I want to calculate lies inbetween V1 and V2.
I'm also given an outtangent and intangent that are each 2D (x, y)
I believe that the 4 control points c0, c1, c2, c3 can be calculated as follows (but only for 1D tangents)
c0 = v1
c1 = v1 + (outTangent/3)
c2 = v2 - (inTangent/3)
c3 = v2
So the problem is that if v1 and v2 are scalar values and outTangent and inTangent are 2D, this above equations do not hold (as adding a scalar and vector does not make sense). If the tangents are 1D it does hold.
I've read through 10 different text books about bezier curves and cannot find one that mentions how to calculate the control points from the tangents.
Any help is appreciated!