How to get tilt along Bezier curve using python


(BigEfrom84) #1

I have a 4 segment Bezier curve with 5 control points.
image
Control point 3 has a tilt of 45 deg, control point 4 has a tilt of -45 deg. I want to get the tilt between these points as i iterate along the curve. I have attached the blend file with the python scipt.
PythonAnimation03.blend (543.5 KB)
I am using scripts written by Jeremy Behreandt
from here https://medium.com/@behreajj/scripting-curves-in-blender-with-python-c487097efd13
Here is the printout i get as i move along the curve.
Seg----------- u ------- X Loc ---- Tilt a ------ Tilt b
0.000000 0.020101 9.182628 0.000000 0.000000
0.000000 0.160804 11.303356 0.000000 0.000000
0.000000 0.301508 13.507077 0.000000 0.000000
0.000000 0.442211 15.882545 0.000000 0.000000
0.000000 0.582915 18.518522 0.000000 0.000000
0.000000 0.723618 21.503763 0.000000 0.000000
0.000000 0.864322 24.927032 0.000000 0.000000
1.000000 0.005025 28.875708 0.000000 0.003947
1.000000 0.145729 32.346092 0.000000 0.114455
1.000000 0.286432 34.716576 0.000000 0.224963
1.000000 0.427136 36.424007 0.000000 0.335472
1.000000 0.567839 37.905216 0.000000 0.445980
1.000000 0.708543 39.597042 0.000000 0.556488
1.000000 0.849246 41.936325 0.000000 0.666996
1.000000 0.989950 45.359901 0.000000 0.777505
2.000000 0.130653 49.092384 0.682783 -0.102615
2.000000 0.271357 51.921741 0.572275 -0.213123
2.000000 0.412060 54.186626 0.461767 -0.323631
2.000000 0.552764 56.232796 0.351258 -0.434140
2.000000 0.693467 58.405987 0.240750 -0.544648
2.000000 0.834171 61.051960 0.130242 -0.655156
2.000000 0.974874 64.516464 0.019734 -0.765665
3.000000 0.115578 68.372124 -0.694624 0.000000
3.000000 0.256281 71.365768 -0.584115 0.000000
3.000000 0.396985 73.780533 -0.473607 0.000000
3.000000 0.537688 75.946640 -0.363099 0.000000
3.000000 0.678392 78.194321 -0.252590 0.000000
3.000000 0.819095 80.853790 -0.142082 0.000000
3.000000 0.959799 84.255310 -0.031574 0.000000

Can someone give some advice on how to interpolate the tilt from handle a to handle b along the curve.