Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How do I convert a segment of parabola to a cubic Bezier curve?

The parabola segment is given as a polynomial with two x values for the edges.

My target is to convert a quadratic piecewise polynomial to a Bezier path (a set of concatenated Bezier curves).

share|improve this question
    
The title does not reflect the question. –  lhf Mar 20 '13 at 19:36
    
Fixed that. Thanks. –  Ben-Uri Mar 20 '13 at 20:17
    
    
See also ams.org/samplings/feature-column/fcarc-bezier –  lhf Mar 20 '13 at 22:13
    
Just minor correction - I had submitted an edit but it was rejected for not being "substantive," and I don't have the rep to comment. To calculate the first control point the formula should be: $C=(\frac{x_1+x_2}{2},f(x_1)+f'(x_1)\cdot \frac{x_2-x_1}{2})$ Note the minor difference in computing the point's Y component, without which the formula results in an incorrect control point for segments of the parabola where $x1 \neq 0$. The conversion to a cubic Bezier works fine. –  Roland Nov 19 '13 at 19:03

1 Answer 1

You can do this in two steps, first convert the parabola segment to a quadratic Bezier curve (with a single control point), then convert it to a cubic Bezier curve (with two control points).

Let $f(x)=Ax^2+Bx+C$ be the parabola and let $x_1$ and $x_2$ be the edges of the segment on which the parabola is defined.

Then $P_1=(x_1,f(x_1))$ and $P_2=(x_2,f(x_2))$ are the Bezier curve start and end points and $C=(\frac{x_1+x_2}{2},f(x_1)+f'(x_1)\cdot \frac{x_1+x_2}{2})$ is the control point for the quadratic Bezier curve.

Now you can convert this quadratic Bezier curve to a cubic Bezier curve by define the two control points as: $C_1=\frac{2}{3}C+\frac{1}{3}P_1$ and $C_2=\frac{2}{3}C+\frac{1}{3}P_2$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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