views:

481

answers:

2

I have a quadratic bezier curve and I want to calculate the slope of the tangent in a given point. For example, let it be the middlepoint of the quadratic bezier curve, therefore t=0.5 (please see the link below for a picture of this). I've calculated the first derivative of the formula for the quadratic bezier curve; however I get 400 as value for the slope, though it should be 0. Maybe I'm using the first derivative in a wrong way? I know I could also calculate the tangents using trigonometric functions; however I'd like to do it using the first derivative, shouldn't this be possible? Thanks for any hint!

For clarification / please note: I'm interested in a general way to get the slope in a arbitrary given point on a quadratic bezier curve, not only to get the tangent in the start- and end point.

A picture of my problem including the text above: http://cid-0432ee4cfe9c26a0.skydrive.live.com/self.aspx/%c3%96ffentlich/Quadratic%20Bezier%20Curve.pdf

Thank you very much for any hint!

+3  A: 

Using your formula for B'(t), evaluated at t=1/2, we get

B'(1/2) = -P0 + P2

From the look of your graph, P0 = (0,0) and P2 = (400,0). So

B'(1/2) = (400,0).

This is the "velocity" of a point traveling along B(t) at t=1/2.

(400,0) is a horizontal vector, with magnitude 400.

So all is as it should be. Since B'(t) is horizontal, it does have "slope" 0.

unutbu
thank you very much for your reply, but the "t" is always erased from the equition 2t*(0)+400 because it's multiplied with 0. so the slope in every point would be 0, which isn't true!?
stefan.at.wpf
@stefan: It is true that the x-component of B'(t) is always 400, but this is not true of the y-component. Try y0=0, y1=100, y2=0 for the y-components of P0, P1, P2, and computing y'(t). You should find y'(t) does depend on t.
unutbu
@Since slope is rise over run, the slope is not x'(t), but rather y'(t)/x'(t).
unutbu
Thanks, got it why B'(t) is 400. And y'(t)/x'(t) works fine. Thank you very much for your help!
stefan.at.wpf