0

I am required to interpolate weighted Hermite splines and I am having difficulty coming up with a formula that correctly calculates this with varying tangent angles.

Does anyone have a formula to calculate weighted tangents in python ideally without using scipy or numpy? Or perhaps a link to a pdf that explains the mathematics behind it? Thank you in advance to any advice given.

The data is coming from Autodesk Maya animation curves that need to be worked with outside of Maya. And yes I have worked with the animEngine.c that is included but it does not correctly calculate keys with tangents set to 'auto'

Here is some example data:

point:  0
time(x): 14
value(y): 8.535
inAngle:  -48.7059321223
inX:  0.583333313465
inY:  -15.9391937256
inWeight:  7.07152271271
outAngle:  -48.7059355374
outX:  0.33333337307
outY:  -9.10811233521
outWeight:  4.0408706665
point:  1
time(x): 22
value(y): -12.131
inAngle:  -26.318250542
inX:  0.33333337307
inY:  -3.95701789856
inWeight:  2.97504448891
outAngle:  -26.318250542
outX:  0.416666686535
outY:  -4.94627189636
outWeight:  3.71880531311
point:  2
time(x): 32
value(y): -0.369
inAngle:  -1.40329438149
inX:  0.416666686535
inY:  -0.244970053434
inWeight:  3.3343334198
outAngle:  -2.02149523016
outX:  0.763025164604
outY:  -0.646368861198
outWeight:  6.10800218582

And the same curve as non-weighted:

point:  0
time(x): 14
value(y): 8.535
inAngle:  -48.7059321223
inX:  0.583333313465
inY:  -15.9391937256
inWeight:  7.07152271271
outAngle:  -48.7059355374
outX:  0.33333337307
outY:  -9.10811233521
outWeight:  4.0408706665
point:  1
time(x): 22
value(y): -12.131
inAngle:  -26.318250542
inX:  0.33333337307
inY:  -3.95701789856
inWeight:  2.97504448891
outAngle:  -26.318250542
outX:  0.416666686535
outY:  -4.94627189636
outWeight:  3.71880531311
point:  2
time(x): 32
value(y): -0.369
inAngle:  -1.40329438149
inX:  0.416666686535
inY:  -0.244970053434
inWeight:  3.3343334198
outAngle:  -2.02149523016
outX:  0.763025164604
outY:  -0.646368861198
outWeight:  6.10800218582
Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
  • I know Hermite splines, especially cubic Hermite splines. But I had never heard about "weighted Hermite spline" before. – fang Jan 28 '15 at 17:22
  • Basically it is a TCB spline but the curve is controlled with a tangent at each point, meaning you can get the results of a hermite spline with only two points, I did find this: https://www.siggraph.org/education/materials/HyperGraph/modeling/splines/hermite.htm But am having trouble converting it to python – Alex Telford Jan 29 '15 at 02:58
  • The link you refer to basically is talking about cubic Hermite spline. There is nothing there talking about weighted Hermite spline. BTW, the first sentence of that article "The hermite form is sometimes called a cubic spline" is really confusing as Hermite form can be of any odd degree, not just cubic. – fang Jan 29 '15 at 03:49
  • Thank you, yeah i know, i thought maybe i could get it working with tangents first and then deal with the weights later – Alex Telford Jan 29 '15 at 04:06

0 Answers0