get 2nd and 3rd control points of a Cubic Bezier Curve fit in a rectangle

137 Views Asked by At

I would like to fit a Cubic Bezier Curve in a rectangle, and wondering how to get the 2nd and 3rd control points's Y value, illustrated below:

enter image description here

(Sorry the rectangle is bit distorted.) Basically, given the position of first point (x1, y1), fourth point (x4, y4), and the height of middle point h, how can I get the y2 and y3 from this curve?

curve generated using: http://demofox.org/bezcubic.html

Thank you for any reply in advance.

1

There are 1 best solutions below

0
On

$$ \vec{B}(1/2)=\Sigma_{i=0}^3 \phi_{3,i}\vec{b_i} $$ $$ B_y(t=1/2)=\phi_{3,0}*b_{0,y}+\phi_{3,1}*b_{1,y}+\phi_{3,2}*b_{2,y}+\phi_{3,3}*b_{3,y}\\ =\phi_{3,1}*b_{1,y}+\phi_{3,2}*b_{2,y}\\ =\binom{3}{1}t^1(1-t)^{3-1}*b_{1,y}+\binom{3}{2}t^2(1-t)^{3-2}*b_{2,y} \\ =3*(1/2)^3*b_{1,y}+3*(1/2)^3*b_{2,y}=3*(1/2)^2*b_{1,y}=50 $$ $$ b_{1,y}=b_{2,y}=200/3 $$