# derivative of bezier curve

This topic is 4409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I'm using de casteljau's algorithm to evaluate the point for a given u value on the curve. For this u value I also need the derivative. I know that after n-1 (where n is the degree of the curve) subdivisions I get two points which give me the tangent vector. My question is how this tangent vector is related to the derivative and how I can get the derivative. thanks, quak

##### Share on other sites
The Bezier curve is X(t) = sum_{i=0}^{n} B[n,i](t)*P, where P are the control points and B[n,i](t) are the Bernstein polynomials. The derivative of the Bernstein polynomials are dB[n,i](t)/dt = n*(B[n-1,i-1](t) - B[n-1,i](t)). This allows you to represent the curve derivative as X'(t) = n*sum_{i=0}^{n-1} B[n-1,i](t)*(P[i+1] - P).

##### Share on other sites
Yes, I know how to calculate the derivative with the Bernstein polynomials but I wonder how to calculate it with the de casteljau algorithm, as I already use it to evaluate points on the curve.

##### Share on other sites
The derivative is a degree n-1 Bezier curve with control points Q = n*(P[i+1] - P). Just apply the de Casteljau method to this curve.

##### Share on other sites
Is this equal to subdividing the original curve n-1 times and then using the two remaining points to calculate the derivative like this: du = n*(P1-P0) where P1 and P0 are not the original control points but interpolated control points ?

##### Share on other sites
Yes, what you mention is equivalent. For example, de Casteljau method applied to a quadratic Bezier curve produces two values just before the final one, namely, P0' = (1-t)*P0+t*P1 and P1' = (1-t)*P1+t*P2. The derivative is 2*(P1'-P0'). When applied to a cubic Bezier curve, the two values just before the final one are P0' = (1-t)^2*P0+2*(1-t)*t*P1+t^2*P2 and P1' = (1-t)^2*P1+2*(1-t)*t*P2+t^3*P3. The derivative is 3*(P1'-P0').

Using my previous suggestion of applying de Casteljau to the degree n-1 curve with control points Q = n*(P[i+1] - P), you can apply de Casteljau to the P term to get P' just before the final term. Doing the same to the P[i+1] term, you get P'[i+1] just before the final term. The derivative is n*(P'[i+1]-P').

##### Share on other sites
Thanks a lot for your explanations, Wasting Time.

Now that I know how to get the derivatives of a curve, I'd just like to check if I got it right for surfaces as well:
Assuming I want to evaluate the partial derivative du at u0,v0 on the surface, I first evaluate all rail curves in v direction at v0 and then use the resulting intermediate points as the control points for a curve in u direction, which I evaluate at u0. I then use n*(P1'-P0') to calculate du, right?

##### Share on other sites
A rectangle patch is X(s,t) = sum_{i=0}^n sum_{j=0}^m B[n,i](s)*B[m,j](t)*P[j]. Set Q = sum_{j=0}^m B[m,j](t)*P[j], which is what I believe you are calling the "rail curves". Then X(s,t) = sum_{i=0}^n B[n,i](s)*Q, so you can use the curve result: dX/ds = sum_{i=0}^{n-1} B[n-1,i](s)*(n*(Q[i+1]-Q))). (That is, I believe the answer to your question is "yes".)

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633295
• Total Posts
3011244
• ### Who's Online (See full list)

There are no registered users currently online

×