# Can a cubic Bézier curve be accurately represented by a series of $f(x)$ functions (i.e. traditional non-parametric)?

Please forgive my naive assumptions, if these come across as such -- I am not a mathematician by the standards of this community.

Allow me to elaborate: for what's it worth, intuitively I feel convinced that if we divide a cubic Bézier spline $$B(t)$$ into distinct segments at the values of $$t$$ where the derivative (tangent) of the curve is parallel to the vertical axis and the curve thus about to "loop back on itself", each such segment may thus only have one and only one $$y$$ for any given $$x$$ since it does not feature any change of direction along the $$x$$ axis within it, and there should thus in the very least exist some non-parametric function $$f_i(x)$$ (codomain $$y$$) defining that segment $$i$$, for each segment.

Is that a sensible assumption, or is does my intuition mislead me?

Furthermore, perhaps such sets of $$f_i(x)$$ exist for every cubic Bézier curve at least, but we have no means to calculate them, or they incorporate imaginary numbers or what not, or are otherwise immensely complex, even for curves with rational coefficients (control points)? Perhaps they exhibit too large error (deviate from the original curve segment) and may only approximate the original curve, altogether?

If such functions can exist and can be more or less trivially calculated (I guess I would have seen plenty of examples of such calculations if that were the case), can someone point me in the right direction as to how I could figure these out, at least? Unless I am punching way above my weight here.

Again, intuitively, I figure a cubic Bézier curve may at most change direction along the $$x$$ axis at most twice, so I thought there will be at most 3 segments divided by the points where the curve loops back, and thus at most 3 such $$f_i(x)$$ for the curve.

If my question is unclear, I will gladly spend time on some illustrations.

Longer answer: Suppose we take a “monotone” portion of a Bézier curve (i.e. one where $$x$$ values always increase or decrease as $$t$$ increases). Then, within this portion, the curve defines a real-valued function: given any $$x$$ value within a suitable interval, you can draw a vertical line, there will be a single intersection with the curve portion, and that gives you a unique $$y$$ value. So, we have a function $$x \mapsto y=f(x)$$. The only possible problem with this function is that getting $$y$$ for a given $$x$$ involves a line/curve intersection calculation, which in turn requires that we solve a cubic equation. This is not difficult, conceptually, but it’s surprisingly tricky to write code that solves cubics quickly and reliably.
If you want a function that you can evaluate quickly, you should construct a simple approximation of the function $$f$$ described above. The most common technique is approximation by a polynomial, but this won’t work very well because our function $$f$$ has vertical tangents at its end-points. Approximation by a rational function (e.g. Padé approximation) would presumably work OK.
• Hi bubba, thank you for your answer -- I've read some other answers on related issues, several of them incidentally by you, so I appreciate your input. An idea I had regarding computation of a non-parametric $f(x)$ function for a x/y-monotonical segment of a cubic Bézier, is to use affine transformations to see if a parabola function can be had. That's as far as I have come with regard to this. Ideally I want zero error, but if that's not feasible for a computer driven approach, I can accept an approximation. Commented Jul 28, 2021 at 12:53
• You won’t get zero error unless you use the line intersection approach. A parabola will never have a vertical tangent unless you rotate it, and then you no longer have an equation in the form $y=f(x)$. Rational functions are your best bet for approximation. You can probably find some code for doing rational function approximations. Commented Jul 29, 2021 at 0:29