I have a cubic bezier curve that is always drawn from a source to a destination. but its not always drawn on a horizontal line. anyway ideally it looks like this:
but the PEEK of the curve should touch the height of the black line.
info: i will always know the start point and the end point. but my issue is the max curve height. it should always be the height of the black line i called starting point. so the Y length of the black line should be he height of the curve. the reason this is not easy for me is the dark green line can bend at different angles.lets take a look at an example ?
sorry for the bad drawing ..but you see how the baseline is at a steep angle, now i still want the height of the bezier curve to match the black vertical line. The vertical line length is given to me and its constant.
so to be clear, given a bezier curve with two control points, how to make the height of the curve equal to the height of a constant vertical line.
I wanted to inform you my coordinate system looks like this:




While you haven't directly answered my questions, I think the information is implicit in your responses to other answers, so I will answer on the basis that you require a cubic Bézier with the first and last control points, the tangents at those points, and the maximum distance from their baseline fixed. (Note that it's standard to call the endpoints "control points" as well as the intermediate ones).
Let the control points be $(0, 0)$, $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, 0)$ under the constraints $x_1 = \alpha y_1$, $x_2 = x_3 - \beta y_2$ and the assumption that the maximum y-coordinate obtained in $0 < t < 1$ is $h > 0$.
Then we have $$p(t) = (1-t)^3 \begin{pmatrix}0 \\ 0\end{pmatrix} + 3(1-t)^2t \begin{pmatrix}x_1 \\ y_1\end{pmatrix} + 3(1-t)t^2\begin{pmatrix}x_2 \\ y_2\end{pmatrix} + t^3 \begin{pmatrix}x_3 \\ 0\end{pmatrix}$$
In particular, $$y(t) = 3(1-t)^2t y_1 + 3(1-t)t^2 y_2$$
At its maximum, $\frac{\textrm{d}}{\textrm{d}t}y(t) = 0$, so $$ 3(1-t)(1-3t) y_1 + 3t(2-3t) y_2 = 0 \\ 3(y_1 - y_2)t^2 + 2(y_2 - 2 y_1)t + y_1 = 0$$
Note that under Hagen's assumption $y_1 = y_2$ we get $t = \frac12$, justifying the statement without proof that the endpoints of the two subdivided curves are their "peaks". If we don't make that assumption then we have an under-constrained system. If you pick a value of $t$, $t_{max}$, at which the maximum occurs then the aforementioned equations for $y(t)$ and its derivative give
$$\begin{eqnarray} (1-t_{max})^2t_{max} &y_1 + (1-t_{max})t_{max}{}^2 &y_2 &= \frac h3 \\ (1-t_{max})(1-3t_{max}) &y_1 + t_{max}(2-3t_{max}) &y_2 &= 0 \end{eqnarray}$$
whence
$$y_1 = \frac{2-3t_{max}}{(1-t_{max})^2 t_{max}} \frac h3 \\ y_2 = \frac{3t_{max}-1}{(1-t_{max})t_{max}{}^2} \frac h3$$
Note that since we have a cubic, the two extremes go to opposite infinities; if $h \neq 0$ then we must have a maximum and a minimum, and if $h > 0$ then it must be the maximum.
You probably want $y_1 > 0$, $y_2 > 0$, in which case we can infer
$$\frac{2-3t_{max}}{(1-t_{max})^2 t_{max}} > 0 \\ \frac{3t_{max}-1}{(1-t_{max})t_{max}{}^2} > 0$$ Since $0 < t_{max} < 1$, both $t_{max}$ and $1 - t_{max}$ are positive and we can multiply through:
$$2-3t_{max} > 0 \\ 3t_{max}-1 > 0$$
finding that $\frac13 < t_{max} < \frac23$.