Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate control points in cubic beizer curve

Tags:

math

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.

like image 915
Tarun Avatar asked May 09 '11 12:05

Tarun


People also ask

How are Bezier curve control points calculated?

To find any point P along a line, use the formula: P = (1-t)P0 + (t)P1 , where t is the percentage along the line the point lies and P0 is the start point and P1 is the end point. Knowing this, we can now solve for the unknown control point.

How many control points do you need for a cubic Bezier curve?

Any series of 4 distinct points can be converted to a cubic Bézier curve that goes through all 4 points in order. Given the starting and ending point of some cubic Bézier curve, and the points along the curve corresponding to t = 1/3 and t = 2/3, the control points for the original Bézier curve can be recovered.

How many control points are needed to define a 3d cubic Bezier surface patch?

Similarly, three dimensional Bezier surface patches can be defined by a grid of sixteen control points.

What are control points of a curve?

In computer-aided geometric design a control point is a member of a set of points used to determine the shape of a spline curve or, more generally, a surface or higher-dimensional object. are nonnegative and sum to one. This property implies that the curve lies within the convex hull of its control points.


1 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".

Bezier curve image

like image 161
schnaader Avatar answered Oct 16 '22 09:10

schnaader