Registered Member
|
I'm trying to find some specifications for how a click-and-drag on Bezier curves can reshape them - specifically, in Krita in a vector drawing layer, I can click on a segment and drag my mouse / stylus and the Bezier handles move to place the control points in the right place so the curve passes through the place I selected.
Looking at the basic maths of bezier has led me to a place where I think what I'm missing is a set of assumptions that make the maths solvable. And I'm hoping that someone here can enlighten me. In summary -- I have P0 and P3 fixed. I know the starting values of P1 and P2. I click on a point B in the segment - and that is t% into the segment - and I drag B... I am struggling to calculate new values for P1 and P2 based on the required movement of B -- any relevant help (pointer to the specification or source code file; a simple "you're missing this"; "it only works if you assume this") would be most gratefully received. |
Registered Member
|
Hi!
did you check the utilities at KisBezierUtils.h it seems
does what you need In case it doesn't be sure to check the other methods available. If there is none I come with the next reasoning: A cubic bezier can be expressed as a polinomial in the form
Hope it helps!
Blog http://colorathis.wordpress.com, Deviantart http://ghevan.deviantart.com/
|
Registered Member
|
Thanks - I found the code you referenced -- but it says "It is not used anywhere is Krita yet (was developed as part of testing
for free patch deform action)." -- even so I'll take a good long look at what's there. I'm aware of the bezier polynomial - but, as you point out, that ends up with two unknowns (P1, P2) for which the resolution seems to be to make them somehow interdependent based on t? |
Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]