From this page I know that a Bezier curve of degree $N$ has a derivative which is a Bezier curve of degree $N-1$, and I know how to calculate the control points of it: Derivatives of a Bezier Curve

However, how would i get the partial derivatives of X and Y to calculate a gradient, when I have a multivariate quadratic curve such as this:

$X = f(t) = 3.0*(1-t)^2+2.0*(1-t)t+4.0*t^2$
$Y = g(t) = 9.0*(1-t)^2+1.0*(1-t)t+3.0*t^2$

Where the above describe $(X,Y)$ points in a two dimensional space.

  • $\begingroup$ A Bezier curve is not multivariate. So, there is no partial derivatvies. Its derivative is computed as (dX/dt, dY/dt). $\endgroup$ – fang Aug 5 '15 at 21:15
  • $\begingroup$ Bummer. Is there no (reasonably easy) way to calculate the gradient then? $\endgroup$ – Alan Wolfe Aug 5 '15 at 21:17
  • $\begingroup$ The "gradient" I know of is the partial derivatives of a multivariate scalar function. But Bezier curve is actually a univariate vector function. So, I really don't know how to compute its gradient. The closest thing would be the derivative vector, which is computed as (dX/dt, dY/dt). $\endgroup$ – fang Aug 6 '15 at 0:31

When you say "gradient", I assume you mean the slope $dy/dx$.

First you get the derivative vector: $$ \left( \frac{dx}{dt}, \frac{dy}{dt} \right) $$ and then $$ \frac{dy}{dx} = \frac{\frac{dy}{dt} }{\frac{dx}{dt} } $$ As you might expect, this formula has problems when $dx/dt=0$, because this means you have a vertical tangent vector, so infinite slope.

From the general theory of Bezier curves, we know that the curve $$ f(t) = (1-t)^2 A + 2t(1-t) B + t^2 C $$ has derivative $$ \frac{df}{dt} = 2(1-t)(B-A) + 2t(C-B) $$ So, in your example $$ \frac{dX}{dt} = 2(1-t)(-1) + 2t(2) = 6t-2 $$ $$ \frac{dY}{dt} = 2(1-t)(-8) + 2t(2) = 20t - 16 $$ and so $$ \frac{dY}{dX} = \frac{\frac{dY}{dt} }{\frac{dX}{dt} } = \frac{20t-16}{6t-2} $$

Your reference to partial derivatives is confusing; partial derivatives make sense only when you have a function of several independent variables. In the case we're considering here, there is only a single variable, namely the parameter $t$.


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.