I've been working on python Curve Deformation tool. I need some help with the math. Possibly someone can help here. I cannot find correct UpVec for my custom curve.
Here are the screens which explain the problem:
Here is my tool in action: https://youtu.be/Nxu6-0xm3Io
Here is the code I did but it's buggy in some angles. It inverts to 180 degrees on some angles: https://github.com/mifth/mifthtools/blob/96e73eb3a2613b3f1396ddd7c4bdd9d0419ca5e3/blender/addons/mira_tools/mi_curve_guide.py#L515-L537
All I do is just cross direction of the point to global X and Y axis. Any help will be appreciated to get the quality of upVec as in Blender Curves.
And you can get the tool here: https://github.com/mifth/mifthtools http://blenderartists.org/forum/showthread.php?366107-MiraTools