Search code examples
mathcomputer-visioncurve

How to define transformation of curve using single parameter?


Let's assume I have a curve defined by 4 points and I have 2 'states' of curve, like on this picture:

enter image description here

I want to control the deformation of the curve by single parameter in range [0, 1], 0 is corresponding to upper curve and 1 corresponding to lower curve, intermediate values like 0.5 should represent some intermediate transformation from upper curve to lower curve. How it can be done?


Solution

  • Do you know how to parametrize the motion of one point?

    Suppose you have a point that can move on a vertical line, its position varying between two extremes, y0 and y1.

    Now assign a parameter t, which varies from 0 t0 1, so that y(t=0) = y0 and y(t=1) = y1.

    Now make y a linear function of t: y(t) = y0 + t(y1-y0)

    Now look at your curves. The only motion of the points to get from one state to the other appears to be vertical. So each of the four points moves like an example of the y(t) above, but with different values of x, y0 and y1. (From your drawing, it looks as if the two end points are stationary and the two middle points move the same way, but that's just a special case.)