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

196 Views Asked by At

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.

1

There are 1 best solutions below

2
On

Short answer: what you’re suggesting makes sense, and could be done. I’m not sure how useful it is, but that’s for you to decide.

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.