While going through a cubic beizer curve program
I found it uses end points as(10,10,0) and (0,1,0) and other control points as(5,10,2) and (-10,-5,-2).I am not able to understand how did they get this other control points
please help me with any formula or method to fins them
Edit:-
if you want to put a Bézier curve smoothly through N points with N>2, how do you get the intermediate control points.
-
2Mmm ... the control points are the _input parms_ for a Bezier curve. Perhaps you should explain more ... – Dr. belisarius May 09 '11 at 12:39
-
the curve is pass through two control points 10,10,0 and 0,1,0..but to define the shape of our curve we have two more control point 5,10,2 and -10,-5,-2 ...can we compute the other two control point – Tarun May 09 '11 at 12:41
-
2There is really no answer to this question. One possible question that _could be answered_ would be "if you want to put a Bézier curve _smoothly_ through N points with N>2, how do you get the intermediate control points". But as your question is worded, it is like asking "when I draw a line from A to B, how do I know the points A and B". A Bézier curve is _defined_ as going from the first to the last control point, and having tangents at P0 and P3 pass through P1 and P2, respectively. So, the points define the curve shape, not the other way around. – Damon May 09 '11 at 12:50
-
@fluty What are the inputs you have for calculating the control points? – Dr. belisarius May 09 '11 at 12:50
-
@Damon Excellent analogy _"when I draw a line from A to B, how do I know the points A and B"_ – Dr. belisarius May 09 '11 at 12:51
-
1i have a set of points..and i want to draw a curve passing through those points(knots) but to draw a curve i need control points as well but dont know how should i get them – Tarun May 09 '11 at 12:53
-
Damon you are right..thats what i wanted to ask "if i want to put a Bézier curve smoothly through N points with N>2, how do you get the intermediate control points" – Tarun May 09 '11 at 12:54
-
1If you use your input points as the "odd" control points, you already have C0 continuity no matter what (i.e. curve passes through these points). For C1 continuity ("no edges"), the tangents at each interpolated point must match. There is an infinite amount of solutions for that. In the simplest case, if you have no other constraints (minimal curvature etc.), you can in principle pick a point on one side and reflect it around the interpolated point (that guarantees that the tangents meet). The further away from a straight line you pick the point, the more the curve will "bulge". – Damon May 09 '11 at 13:20
-
1If you have higher requirements than just "no edges at interpolated points", the theory behind it becomes much more involved. You may want to read up on "hermite curves" which are kind of similar (except they use tangents, not points) at Wikipedia, which will point you to Catmull-Rom and Kochanek-Bartels, which are two well-known schemens for addressing this. – Damon May 09 '11 at 13:23
3 Answers
As belisarius said in his comment, the control points are actually input parameters for a Bézier curve. The wikipedia article has some nice animations that visualize the process of drawing the curve and how the control points are used for it.
As a summary, a cubic Bézier curve consists of 4 points. Let's name them Start
, End
, Control1
and Control2
. The curve starts at Start
, following the line from Start
to Control1
. But to reach the end point End
, it has to deviate from that path and approaches the line from Control2
to End
until it reaches the End
point.
So you can "calculate" the control points you'll need for a specific curve f.e. by drawing the desired curve on a piece of paper. The control points have to lie somewhere on the curve tangents at the start and end point to create a Bézier curve similar to your sketch.
Here is a illustration I've done with Paint (which is actually good for playing with this because it has a tool to create cubic Bézier curves). On the left side I've drawn a rough freehand sketch of the curve (black), then added my estimate of the tangents (gray). Finally I chose two points on the lines to be the control points (green). On the right side you see the same, but the curve has been created using Paint's Bézier tool drawing a line from the start to the end point and then clicking the two control points.
Playing around with this should give you a better feeling about how the control points build your curve. For example, if you choose control points farther away from the start/end point of your curve, it will run "tighter" along the gray "control lines".

- 49,103
- 10
- 104
- 136
-
Ah, I've just seen you edited the question. This is a slightly different problem and as Damon said, there is an infinite amount of solutions for it. You can try an easy solutions: Take the "odd" points (1st, 3rd, 5th...) as start/end points and the "even" points (2nd, 4th, 6th...) as both control points (effectively creating quadric instead of a cubic Bézier curves). Note that this won't look very smooth and the curve won't go through the "even" points, but is still better than linear interpolation. – schnaader May 09 '11 at 13:42
-
The general formula for an n-point "Bezier" with n > 4 is generally called a [Bernstein polynomial](http://en.wikipedia.org/wiki/Bernstein_polynomial). The formula is a very simple binomial expansion using t and (1-t). – bobobobo Apr 03 '13 at 13:44
-
How does it work in 3D i can find bezier curves for flat curves, but a curve with changing degree of slope is very confusing for me. – WDUK May 07 '20 at 20:37
I found that, I hope that helps ..
http://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-wit

- 197
- 2
- 9
-
1Welcome to StckOverflow, could please provide some context for your link? Also see the help - [how to answer](http://stackoverflow.com/help/how-to-answer) "Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there." – Jos Vinke Nov 04 '13 at 13:01
-
@JosVinke Sorry for late, Thank you for advice, I'll follow that in my next replies. – amt Nov 12 '13 at 07:43
If you have n
points in your curve, you can find up to n-1
points using a Least Squared Optimization.
See the python code provided by @Aklelka in this post

- 308
- 2
- 6