Reputation: 157
I need to adjust the length of a (cubic) Bezier curve to match that of another one, without disturbing its overall shape. This involves, I guess, proportionately scaling it recursively until the length is of the right magnitude (or is there any better approach?).
I have got the function that calculates the length. For scaling, I am stuck at calculating the coordinates of the new control points. There is this question that seems to have the answer but I am unable to figure out to what the variables a, b etc. refer in the answer. Also, I need to write a function from scratch, without having recourse to any API library (except python math).
Any help is appreciated.
Upvotes: 0
Views: 1345
Reputation: 1169
Denoting the length of your curve by L and the desired length D, it seems to me that you just need to scale your curve (D/L)-times. Thanks to affine invariance, it should be enough to scale all your control points. That is, multiply each coordinate of each of your control points by D/L.
Or did I miss something?
Upvotes: 3