I've been trying to get wolfram alpha to solve these equations and leave the coefficients alone (Bezier control points), but I can't figure it out!

I want to eliminate t and u, but leave all other coefficients alone

u = t - 1

y = A*u^3 + 3*B*u^2*t + 3*C*u*t^2 + D*t^3

x = E*u^3 + 3*F*u^2*t + 3*G*u*t^2 + H*t^3

Any help is appreciated, thanks

  • 1
    $\begingroup$ See here but the result(ant) is too long to copy. $\endgroup$ – dxiv Mar 16 '17 at 20:40
  • $\begingroup$ @dxiv that looks close, but y is inside of the function, and yea.... way too long $\endgroup$ – neaumusic Mar 16 '17 at 20:51
  • $\begingroup$ but y is inside of the function What did you expect? Eliminating $u,t$ between the $3$ equations can only give an equation in $x,y$ (and the other coefficients). $\endgroup$ – dxiv Mar 16 '17 at 20:53
  • $\begingroup$ well, my understanding is that t is along the curve between y and x axis (with those 4 x and y control points), and that we should be able to eliminate t and directly map from x to y, not just t to y and t to x. im hoping for an equation y(x) with a,b,c,d,e,f,g,h and x as inputs $\endgroup$ – neaumusic Mar 16 '17 at 20:55
  • $\begingroup$ i just meant that i was hoping for y(x) = something without y in it, not just 0 = all variables convoluted $\endgroup$ – neaumusic Mar 16 '17 at 20:57

It's impossible, in general, to get an equation of the form $y=f(x)$, because, for a given $x$, there might be more than one point $(x,y)$ that is on the curve.

There are a few different approaches ...

You can eliminate $u$ and $t$, and this will give you an equation of the form $g(x,y)=0$. To do this, you need to learn a little about implicitization and resultants. You can find a good introduction in these notes.

Alternatively, use root-finding. Substitute $u = 1-t$ in your third equation. Now you have an equation that gives $x$ as a function of $t$. Given a value of $x= k$, you can find the corresponding value of $t$ by solving the equation $x(t) = k$. The equation will be cubic. So, you either solve it by using one of the available formulae, or you can use numerical methods. If you decide to use the formulae, beware that a naïve implementation will often lead to round-off and overflow problems, so some care is needed. Better to find and use well-tested code, or use numerical methods.

Once you've found $t$, you substitute into your second equation to get $y$.

Finally, you could just approximate the Bezier curve by a simple curve of the form $y=f(x)$. For example, you could calculate a series of points $\mathbf{P}_i = \big(x(t_i),y(t_i)\big)$ and fit these points with a polynomial $y=f(x)$. This would only be an approximation of your original curve, but you can make the approximation as close as you like by using more points. You will have trouble if the original curve has a vertical tangent at any place. If you want to allow vertical tangents, you may have to approximate by a rational function, rather than a polynomial, which is much harder. Once you have the function, computing $y$ for a given $x$ is easy.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.