Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Differential of Bezier curve

  1. Apr 16, 2007 #1
    Hi guys,
    I am plotting a Bezier curve in a computer program I've written. The curve is created using four control points to generate the coefficients to the following equations:

    x = ax*t^3 + bx*t^2 + cx * t + dx
    y = ay*t^3 + by*t^2 + cy * t + dy

    Where t a value between 0 - 1 to evaluate along the Bezier curve.

    However, I need to know what the differential of this curve is, not with respect to t, but with respect to x. i.e. dy/dx at a value of x that you choose.

    The reason for this is that I'm plotting a Bezier through some experiemental data and I need a mathematical representation of that data so I can get a smooth differential and double differential. But I've now come across this problem.
    The only way I've thought of to do this so far is to, at your given x value, involves solving the cubic for t, which is quite expensive and diffucult.

    Any suggestions?
  2. jcsd
  3. Apr 16, 2007 #2


    User Avatar
    Science Advisor

    If x= f(t) and y= g(t), then dx/dt= f'(t), dy/dt= g'(t) and, by the chain rule,
    dy/dx= (dy/dt)/(dx/dt)= g'(t)/f'(t).
  4. Apr 18, 2007 #3
    Thanks Halls, thats the stuff I was looking for.
    Furthermore, in order to calculate the differentials, I need to find t. I used the method illustrated over at www.nr.com[/url] (specifically [url]http://www.nrbook.com/a/bookcpdf/c5-6.pdf[/URL]) which seems to work well. It may be quicker to solve using bisection or something, but I didnt want to enter the realm of tolerance limits and the like. Explicit is better and performance is quite reasonable.
    Last edited by a moderator: Apr 22, 2017
  5. Apr 18, 2007 #4


    User Avatar
    Homework Helper

    I'm also trying to fit a Bezier (cubic) to data points, but have so far not been able to figure it out. I'm trying a least squares approach but can't figure out how to formulate the problem. It is easy if the x-values of the 4 control points are already known, but in general they aren't.

    Can you tell me how you are doing it?

    By the way, in terms of finding the value of t for a specific x, Newton-Raphson works well (the higher derivative methods even better).
    Last edited: Apr 18, 2007
  6. Apr 18, 2007 #5
    I'm taking a slightly perculiar approach to this one; the cubic Bezier fitting is all done interactively with the user. The user clicks the mouse to add/delete Bezier knots. Each knot can be moved and each knot also has handles to change the Bezier shape. Its not mathematically rigorous, but I think its the best way to do it, at least for my particular case.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook