Understanding Bezier curve equations

Papabravo

Joined Feb 24, 2006
21,225
You know how this works. Tell us what you know, then ask about the parts you don't know. You keep wanting us to do all the heavy lifting. When are you going to show some industry?
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your attention. In the book its "P(u)" instead of "C(u)". It says:
:
Suppose we are given n+1 control -point positions: pK=(xK, xk, zk) with k varying from 0 to n. These coordinate points can be blended to produce the position vector P(u) (in the image its C(u)) which describes the path of an approximating Bezier polynomial function between p0 and pn.


(At some other slide i found that the curve passes through p0 and pn)


I cant understand:
" These coordinate points can be blended to produce the position vector"


At one another slide I found curves and blended functions in the context of Bezier Curve. I am attaching this image.

Plz guide me.

Zulfi.
 

Attachments

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I like this visual though the 5 point Bezier is not clear. (Note youtube is not accessible in my area). But it does not say anything about the blending function . I still cant understand the blending function specially w.r.t the image which i have uploaded. Any way thanks for your help. Some body plz provide me more insight into the blending functions.

Zulfi.
 

nsaspook

Joined Aug 27, 2009
13,273
Hi,
I like this visual though the 5 point Bezier is not clear. (Note youtube is not accessible in my area). But it does not say anything about the blending function . I still cant understand the blending function specially w.r.t the image which i have uploaded. Any way thanks for your help. Some body plz provide me more insight into the blending functions.

Zulfi.
The visual shows how the curve points are derived from the ratio between points on each line segment as time moves from 0 to 1. Look at the line segment formed from the control points. Wish you could see the video as the Professor explains the equations step by step.

I have a frame grab that I hope might help.
 

Attachments

Last edited:

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I have tried to solve this eq. for n=1 (straight line):


P(u) = Σ Pk BEZk,n (u)
k=0 to n
BEZk,n(u) = C(n, k) uk (1-u)n-k, For n=1
BEZ0,1(u) = C(1, 0)u0 (1-u)1-0 = C(1,0) * (1-u) = 1!/(0!(1-0)! ) * (1-u) = 1-u)
BEZ1,1(u) = C(1,1)u1 (1-u)1-1 = C(1,1) u * (1-u)0 = 1!/(1! (1-1)!) * u = u
Now

P(u) = P0 BEZ0,1(u) + P1 BEZ1,1 (u) = (1-u)P0 + uP1


Plz guide me what this answer tells me??

Zulfi.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I mean how it helps me in plotting the Bezier curve. Plz tell how can i use these equations to plot the Bezier curve??

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,058
Zulfi,

You still haven't given us much to work with in terms of letting us know how much of this you have any kind of a handle on. That leaves us shooting in the dark.

So let's see if we can get a handle on that.

If I have two points, P1 and P2, can you come up with a set of equations that will give you the coordinates along the straight line connecting them such that if a=0 you get the coordinates for P1 and if a=1 you get the coordinates for P2? Let's keep things simple and work in just two dimensions, so

P1 = <x1,y1>
P2 = <x2,y2>

What are the equations for

x(a) = ?
y(a) = ?

If you can get this, then you are 95% of the way to being able to plot a Bezier curve of any order.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your replies. My teachers i have solved an eq in post 7. Plz tell me if its right or not. If its right plz tell me how to plot this on graph paper. What would be the x & y values for this. Thanks for the program. I would try to execute it today, however i have not yet checked the associated links. Actually I have not read beyond post #10.

Zulfi.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I am providing the solutions:

If I have two points, P1 and P2, can you come up with a set of equations that will give you the coordinates along the straight line connecting them such that if a=0 you get the coordinates for P1 and if a=1 you get the coordinates for P2? Let's keep things simple and work in just two dimensions, so

P1 = <x1,y1>
P2 = <x2,y2>

What are the equations for

x(a) = ?
y(a) = ?
The eq are:
Rich (BB code):
  P(a)=(1-a)P0 + aP1
Plz check my answer.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,058
Hi,
I am providing the solutions:


The eq are:
Rich (BB code):
  P(a)=(1-a)P0 + aP1
Plz check my answer.

Zulfi.
But I asked you for the equations for x and y. Remember, you are trying to figure out how to plot the curve, which means you need to figure out how to get the coordinates for the points you are trying to plot.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your efforts.

x(a) = (1-a)P1 + aP2
y(a) = (1-a)P1 + aP2
At a=0

x(0), y(0)= P1
At a=1

x(1), y(1)= P2


P1 and P2 are any arbitrary points and the curve passes through them.
Zulfi.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your program link (provided by nsaspook). I ran your program but i am getting a straight line instead of curve. The output is attached in a file.
I gave following values and then called Bezier function witout any change:
Rich (BB code):
        x[0]=10; y[0]=100;
	x[1]=110; y[1]=200;
	x[2]=210; y[2]=300;
	x[3]=310; y[3]=400;
    bezier (x, y, pDC);
Plz guide me why i am getting a straight line instead of a curve.

Zulfi.
 

Attachments

WBahn

Joined Mar 31, 2012
30,058
Hi,
Thanks for your efforts.

x(a) = (1-a)P1 + aP2
y(a) = (1-a)P1 + aP2
At a=0

x(0), y(0)= P1
At a=1

x(1), y(1)= P2


P1 and P2 are any arbitrary points and the curve passes through them.
Zulfi.
According to this, all points lie on the line y=x. They must, since you have the exact same equation for x(a) as for y(a).

Break the problem into two independent problems -- one for the x-coordinate and one for the y-coordinate.
 

WBahn

Joined Mar 31, 2012
30,058
Hi,

Is the following correct:
x(a) = (1-a)P1
y(a) = aP2
At a=0

x(0)= P1

At a=1

y(1)= P2

Zulfi.
No!

Your problem is that you do not have any kind of a grasp on the fundamentals of how to represent the quantities you are working with. You can't hope to work with those quantities successfully until you do!

P1 and P2 are POINTS. They consist of multiple dimensions (two, in our case). A point is an ORDERED LIST of values, one for each dimension.

So you have

P1 = <x1,y1>
P2 = <x2,y2>

It is meaningless to say something like

x(a) = P1

x is a coordinate in one of the dimensions, 'a' is a parameter, and P1 is a fixed point in two dimensions.

The equations you are struggling to bump into are

x(a) = a*x1 + (1-a)*x2

y(a) = a*y1 + (1-a)*y2

With these, you define a set of points as

P(a) = <x(a), y(a)>

P(a) = <a*x1 + (1-a)*x2, a*y1 + (1-a)*y2>

Before you try to go any further, make sure that you fully understand all of this. Then, pick a couple of points, say P1=<-1,6> and P2=<4,-3> and then plot the points for values of a going from 0.0 to 1.0 in increments of 0.2 to see how as you sweep 'a' through that range you sweep out the line from P1 to P2.
 
Top