1
$\begingroup$

I should apply some kind of curve, let be a simple function or parametric curve. As it connects to another curve at $x_0$, let's call it $g(x)$, is an already known, differentiable function $$g(x)=[1/(1-1/2*(2-2*x_0)^2)]*(1-1/2*(2-2*x)^2)$$ In fact it is the second segment of a piecewise defined bezier curve, I took its equation from here: https://easings.net/#easeInOutQuad However I applied a constant multiplier: $1/(1-1/2*(2-2*x_0)^2)$ denoted by square brackets in the definition of $g(x)$, to satisfy that $g(x)$ reaches 1.0 at $x_0$. So $f(x)$ should satisfy two conditions at the $x_0$ point:

$$f'(x_0)= g'(x_0)$$ for smooth connection, and also $$f(x_0)=g(x_0)=1.0$$

Furthermore it should reach the $x_1$ coordinate, which is always 1.0, with a given value, what is a bit more than 1.0, for example 1.05-1.1, or generally $1+z$, and preferably, with a maxima, so two other conditions should be satisfied: $$f(x_1)= 1.0+z$$ and $$f'(x_1)=0.0$$ At $x_1$ $f(x)$ should have a maxima.

One further condition is, the $f(x)$ curve should be monotonically increasing in the $x_0-x_1$ interval, similarly like a sigmoidal curve, or a saturation curve. It would also be allowed to reach $1+z$ only asymptotically in the $+inf$. In this case only the first two equation should be satisfied.

$x_0$ is usually 0.6-0.8, while $x_1$ is always at 1.0

enter image description here

I have already tried curves with the form of $$f(x)=a*x^2+b*x+c$$ and even $$f(x)=a*x^3+b*x^2+c*x+d$$ but none of them worked.

In the first case I had only 3 parameters (a,b,c) so I had to omit one of the conditions to solve the system of equations for the a,b,c parameters. I omitted $f'(x_1)=0$ Even with that, I get a 2nd degree polynomial curve segment which wasn't monotonically increasing in $x_0-x_1$.

Same happened in the later case: after solving the resulting equation system for a,b,c,d parameters I got a 3nd degree polynomial curve segment which unfortunately was not monotonic, it contained a local maxima somewhere between $x_0$ and $x_1$:

enter image description here

On the picture can be seen that all criteria is met, except the monotonity.

Of course the form of $f(x)$ should be simple enough, to get a solvable equation system for its parameters. For example I also tried $f(x)=a+b/(c+exp(x-d))$ but the resulting system wasn't solvable by Sage Math.

Maybe a parametric curve should be used in form: $[f_x(t), f_y(t)]$ ?

I would need such functions to be easing-functions for video zooming, reaching $1+z$ thus resulting a smooth "overzoom":

https://www.youtube.com/watch?v=65ovA9G4go0

https://www.youtube.com/watch?v=74XsPTWtHzA

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Finally I was able to solve the problem with a 2nd degree parametric function, as it contains 6 parameters in total, and also yields a system of 6 equations to solve. The steps in Sage Math to reproduce:

var("x0 z ax bx cx ay by cy")
h(x)=1-1/2*(2-2*x)^2
g(x)=1/h(x0)*h(x)
fx(t)=ax*t^2 + bx*t + cx
fy(t)=ay*t^2 + by*t + cy
eq=[derivative(g(x),x).subs(x=x0)==derivative(fy(t),t).subs(t=x0)/derivative(fx(t),t).subs(t=x0),fx(x0)==x0,fy(x0)==1,fx(1)==1,fy(1)==1+z,derivative(fy(t),t).subs(t=1)==0]
#[4*(x0 - 1)/(2*(x0 - 1)^2 - 1) == (2*ay*x0 + by)/(2*ax*x0 + bx), ax*x0^2 + bx*x0 + cx == x0, ay*x0^2 + by*x0 + cy == 1, ax + bx + cx == 1, ay + by + cy == z + 1, 2*ay + by == 0]
s=solve(eq,ax,bx,cx,ay,by,cy)
#[[ax == -1/2*(2*x0^2*(z + 1) - 4*x0*(z + 1) + z + 2)/(x0^3 - 3*x0^2 + 3*x0 - 1), bx == 1/2*(2*x0^3*(z + 2) - 2*x0^2*(z + 4) - x0*(3*z - 4) + z)/(x0^3 - 3*x0^2 + 3*x0 - 1), cx == -1/2*(2*x0^3*(z + 1) - 4*x0^2*(z + 1) + x0*(z + 2))/(x0^3 - 3*x0^2 + 3*x0 - 1), ay == -z/(x0^2 - 2*x0 + 1), by == 2*z/(x0^2 - 2*x0 + 1), cy == (x0^2*(z + 1) - 2*x0*(z + 1) + 1)/(x0^2 - 2*x0 + 1)]]
results=list(map(lambda x: x.subs(x0=0.68,z=0.1),s[0]))
#[ax == 1.91162109374999, bx == -2.21152343750000, cx == 1.29990234374999, ay == -0.976562500000000, by == 1.95312500000000, cy == 0.123437499999999]
fu(t)=(fx(t),fy(t))
f=fu(t).subs(results)
plot0=parametric_plot(f,(t,0.5,0.68),color='lightgreen',linestyle="-.")
plot1=parametric_plot(f(t),(t,0.68,1.0),color='green')
plot2=parametric_plot((x,g(x).subs(x0=0.68)),(x,0.5,1.0))
plot0+plot1+plot2

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .