So I'm working on my computer graphics project and i came up with this problem. I'm drawing Bezier curves on the screen, however, currently I'm limited to only drawing Bezier curves with 2,3,4 control points. How do i draw a Bezier curve for N control points? I need a formula for this curve. Splitting the whole curve into separate segments of Bezier curves is not going to work for me because i can break these control points and add them in the middle of each other. Any ideas? -Thanks!
1 Answer
Using higher order Beziers is not recommended because the influence of the control points is less and less strong and control becomes difficult.
The formula is given by the Bernstein polynomials https://en.wikipedia.org/wiki/Bernstein_polynomial#Definition that you use as the coefficients of a linear combinations of the given points. You already know these polynomials for degrees $2, 3$ and $4$. They are in fact the terms of the binomial development of $(t+(1-t))^n$.
Depending on exactly what you need to achieve, other kinds of freeform curves might be a better choice.
-
$\begingroup$ Im drawing lines with points and i have the ability to insert a point in between other 2 given points. Any ideas on how i should approach this? Thanks! $\endgroup$– matkenisOct 30, 2017 at 15:33
-
$\begingroup$ @matkenis: as long as you don't state what this is used for or what the requirements are for these curves, impossible to tell. $\endgroup$– user65203Oct 30, 2017 at 15:34
-
$\begingroup$ Okay, sorry, let's just say you have 10 control points. You want to INSERT a new control in between 3rd and 4rth control points. Whole curve should change. Do i use nth degree formula of Bezier curve to solve my problem? Thanks! $\endgroup$– matkenisOct 30, 2017 at 15:51
-
$\begingroup$ @matkenis: I have understood this from the beginning, yet no sufficient input, sorry. Read my answer. $\endgroup$– user65203Oct 30, 2017 at 16:11
-
$\begingroup$ Im drawing these lines by hand, a line is drawn, then i manipulate it as a curve after inserting a middle point and making a 3rd degree Bezier Curve. I have a line that i want to reflect of a curve. $\endgroup$– matkenisOct 30, 2017 at 16:30