Bezier uses 2 control points for all of the internal points on the curve. In 2D, it means 4 independent numerical parameters at all internal points (2 at the open ends of the curve). Moho is using cubic Bezier curves, but calculated from only one parameter, the "Curvature" (see my topic at Scripting: http://www.lostmarble.com/forum/viewtopic.php?t=4462).
What if you add 3 new parameters to this system at each points, keeping the Curvature, to fully match with cubic Bezier curves? The control points are calculated in Moho on a line, parallel with the line between the two neighbouring points of the actual point. Currently the distance of the control point (from the actual point, P1) is the distance of the neighbouring point (P0 or P2), multiplied by the Curvature:
(I mark the vector values with a beginning _underscore)
_M1= _P1 + Mag(_P1 - _P0) * _Norm(_P1 - _P2) * Curvature
_M2= _P1 - Mag(_P2 - _P0) * _Norm(_P1 - _P2) * Curvature
You can modify this with an independent Weight value:
_c1= _P1 + Mag(_P1 - _P0) * _Norm(_P1 - _P2) * Curvature * Weight
_c2= _P1 - Mag(_P2 - _P0) * _Norm(_P1 - _P2) * Curvature * (2.0 - Weight)
Default value for Weight is 1.0.
If the Weight is 1.0, this calculation is exactly the same as what Moho is using now.
To put the control points outside of the line, anywhere on the 2D space, you need two additional, perpendicular parameters. These could be, for example PCurvature and PWeight, working in the same way as Curvature and Weight:
_T1= perpendicular vector (y, -x) of Mag(_P1 - _P0) * Norm(_P1 - _P2)
_T2= perpendicular vector (y, -x) of Mag(_P2 - _P0) * Norm(_P1 - _P2)
_C1= _c1 + _T1 * PCurvature * PWeight
_C2= _c2 + _T2 * PCurvature * (2.0 - PWeight)
Default value for PCurvature is 0.0, for PWeight is 1.0.
In this case the calculation is exactly the same as what Moho is using now.
So if Weight= 1.0, and PCurvature= 0.0, you can use the old algorythms (even users' Lua files), file formats etc. But if you use these things correctly, you will get FULL CUBIC BEZIER SUPPORT. This solution is not redundant and fully compatible with the old system.
The only problem if any two of P0, P1, P2 are equal, this must be tested and processed (translating a point with a very-very small vector).
Now I'm making a Lua toy to try this, how these things are behaving when the points are moving.
