Understanding Bezier curve equations

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your work . I never new that i have to specify it in terms of x & y because the main eq which i mentioned in my first post doesnot say anythink about x & y.

Still i am not clear about P1 & P2. But i have tried to solve the eq and i want to show you the results before plotting:
P(a) =<-5a+4, 9a-3>
P(0) = <4, -3>
P(0.2) = <3, 1.2>
P(0.4) = <6, 0.6>
P(0.6) = <1, 2.4>
P(0.8) = <0, 4.2>
P(1) = <-1, 6>

Is P(1) same as P1?

Kindly tell me about the above results.

Zulfi.
 

WBahn

Joined Mar 31, 2012
29,979
You did fine.

The equations as I gave them to you go from P2 to P1 as 'a' goes from 0 to 1. It should go the other way (though in practice it wouldn't matter as long as we are consistent throughout). That was a goof on my part, but can you see how to modify the equations so that P(0) = P1 and P(1) = P2?
 

WBahn

Joined Mar 31, 2012
29,979
Hi,
I drew it on a piece of paper. Its not a straight line. If you want i can show you the scanned image.

Zulfi.
Oh, I believe you.

I didn't look closely enough at your individual numbers.

Your y-values are fine except for one in which you forgot the minus sign.

Your x-values are fine except for one in which you added instead of subtracted.

You need to start checking your own work. It needs to be routine.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I have drawn the line. The correct points are:
P(0)= (4, -3)
P(0.2) = (3, -1.2)
P(0.4) = (2, 0.6)
P(0.6) = (1, 2.4)
P(0.8) = (0, 4.2)
P(1) = (-1, 6).

I am attaching the file. I dont know what you mean by the P(0) & P1 as far as the formula is concerned which i wrote in my first post.

Zulfi.
 

Attachments

WBahn

Joined Mar 31, 2012
29,979
P1 and P2 are just the names of specific points.

P(0) means exactly what you used it to mean, the point associated with a=0.

Okay, now that you can generate the set of points that go between two points, let's correct the goof I made earlier and get them going in the right direction.

I has said:

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

But it should be

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

This will make it so that P(0)=P1 and P(1)=P2

So now let's add a third point (our first control point) at some point not on the line between P1 and P2. Let's call this point C1 and put it at <9,5>.

So now come up with two sets of points, one that goes from P1 to C1 and another that goes from C1 to P2.

Plot those two sets of points.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
You are right:

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
P(a) = <a*x1 + (1-a)*x2, a*y1 + (1-a)*y2>
In the above case , if a=0 we get coordinates for P2(x2,y2) which is against your assumption. So the correct eq is (as stated by you)

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

Zulfi.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I have plotted the two points and shown the control points also.

First set:
P(a) = <10a -1, -a+6>
P(0) = <-1, 6>
P(0.2) = <1, 5.8>
P(0.4) = <3, 5.6>
P(0.6) = <5, 5.4>
P(0.8) = <7, 5.2>
P(1) = <9, 5>

Second set:
P(a) = <5a+4, 8a-3>
P(0) = <4, -3>
p(0.2) = <5, -1.4>
P(0.4) = <6, 0.2>
P(0.6) = <7, 1.8>
P(0.8) = <8, 3.4>
P(1) = 9, 5>
Plz check this.
Plz tell me whether my solution in post#7 is correct or not?


Zulfi.
 

Attachments

Last edited:

WBahn

Joined Mar 31, 2012
29,979
Hi,
I have plotted the two points and shown the control points also.

First set:
P(a) = <10a -1, -a+6>
P(0) = <-1, 6>
P(0.2) = <1, 5.8>
P(0.4) = <3, 5.6>
P(0.6) = <5, 5.4>
P(0.8) = <7, 5.2>
P(1) = <9, 5>

Second set:
P(a) = <5a+4, 8a-3>
P(0) = <4, -3>
p(0.2) = <5, -1.4>
P(0.4) = <6, 0.2>
P(0.6) = <7, 1.8>
P(0.8) = <8, 3.4>
P(1) = 9, 5>
Plz check this.
Plz tell me whether my solution in post#7 is correct or not?


Zulfi.
The first is right and the second is backwards.

The first set should start at P1 and end at C1.

The second set should start at C1 and end at P2.

When you redo it and regenerate your plot, put the value of 'a' next to each point. We will need to be able to identify which points on each line correspond to the same value for 'a'.

Also, you don't need to include the line from P1 to P2, just the two from P1 to C1 and from C1 to P2.

I don't understand your notation in Post #7, so I don't know if it is correct or not and, even if it is, I would be far from certain that you understood it. But, believe it or not, we are making a lot of progress and you will soon see some magic happen.
 

Thread Starter

zulfi100

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

Form these set of points one thing is evident that P(0) is the first point of the line and P(1) is the end-point of line.
As the books says:
A Bezeir curve always passes through the first and last control points. That is the boundary conditions at the two ends of curve are:
P(0) = p0
P(1) = pn
Now
I don't understand your notation in Post #7
Can you plz guide which notation are you talking about? Do you want me to use Latex?
Rich (BB code):
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
Also i cant understand what difference would occur if i start from C1. Will it change
P(a) = <5a+4, 8a-3>
Plz guide me.
Zulfi.
 
Last edited:

WBahn

Joined Mar 31, 2012
29,979
You need the first set to start at P1 and the last set to end at P2. Otherwise the curve we are almost ready to start plotting will not start of P1 and end at P2.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your response.
You need the first set to start at P1 and the last set to end at P2. Otherwise the curve we are almost ready to start plotting will not start of P1 and end at P2.
Sorry I cant understand how it will change the values of points i.e P(0) , P(0.2) , P(0.4), P(0.6) & P(0.8)if i am going to use the same eq. i.e

P(a) = <5a+4, 8a-3>
Any way I would try.
What software you are using to draw your graphs?
I am using MS Visio 2003.
Zulfi.
 

WBahn

Joined Mar 31, 2012
29,979
It won't change the value of the points, but it will change the order in which they are produced.

Remember, our points are

#1: P1 = <-1,6>
#2: C1 = <9,5>
#3: P2 = <4,-3>

So we want two sets of points, one going FROM #1 TO #2 and one going FROM #2 TO #3.

The next step we are going to take is to connect the corresponding points on the two lines, so connect the a=0.2 point on one line to the a=0.2 point on the other line.




P1 and P2 are just the names of specific points.

P(0) means exactly what you used it to mean, the point associated with a=0.

Okay, now that you can generate the set of points that go between two points, let's correct the goof I made earlier and get them going in the right direction.

I has said:

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

But it should be

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

This will make it so that P(0)=P1 and P(1)=P2

So now let's add a third point (our first control point) at some point not on the line between P1 and P2. Let's call this point C1 and put it at <9,5>.

So now come up with two sets of points, one that goes from P1 to C1 and another that goes from C1 to P2.

Plot those two sets of points.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your guidance. The new points are:
P(a) = <-5a+9, -8a + 5>
P(0) = <9, 5>
P(0.2) = <8, 3.4>
P(0.4) = <7, 1.8>
P(0.6) = <6, 0.2>
P(0.8) = <5, -1.4>
P(1) = <4, -3>

Kindly guide me further and let me know specifically about the problem related to post#7. Do you need LaTex?.

Waiting for your response. As far as i know with 2 points it wont be a curve. Note I have submitted the image again in my next reply. The attached image is not upto date.

Zulfi.
 

Attachments

Last edited:

WBahn

Joined Mar 31, 2012
29,979
Hi,
I am again submitting the image.

Zulfi.
Getting close. But we need the P(a) labels on the P1 to C line, too.

The next step, which you can go ahead and do, is to connect the P(0.2) points together and the P(0.4) points together and so forth. Then, on each of the connecting lines, treat that line as a line going from the point on the P1->C1 to the point on the C1->P2 lines but only put one point on it which is the point using the same value of 'a' that was used to generate the two end points.

As for Post #7, as I've said before, I don't understand the notation you are using. I can guess at some of it, but I'm not into guessing these days. You need to clearly define what the various pieces of the notation mean.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I have evaluated the points as you said:
P(0.2) (P1->C1) = <1, 5.8>
P(0.2) (C1->P2) = <8, 3.4>
P(a) = <7a+1, -2.4a + 5.8>, Now P(0.2) = <2.4, 5.3>
================
P(0.4)(P1->C1)=<3, 5.6>
P(0.4)(C1->P2)=<7, 1.8>
P(a) = <4a+3, -3.8a + 5.6>, Now P(0.4) = <4.6, 4.08>
========================
P(0.6) (P1->C1) = <5, 5.4>
P(0.6)(C1->P2) = <6, 0.2>
P(a) = <a+5, -5.2a + 5.4>, Now P(0.6) =<5.6, 2.3>
=========================
P(0.8) (P1->C1) = <7, 5.2>
P(0.8) (C1->P2) = <5, -1.4>
P(a) = <-2a+7, -6.6a+5.2> , Now P(0.8) = <5.4, 0>

The points are shown in the image

Let me know about the outcome of this experiment if my points are correct.

Zulfi.
 

Attachments

WBahn

Joined Mar 31, 2012
29,979
They sure look like they are correct. Good job.

Now do you see the curve that you get is you connect the final set of points together and how, if you sweep 'a' smoothly from 0 to 1 you will get a smooth curve? That's a first order Bezier curve!

To get a second order curve, you just add an additional control point and an additional layer to this process.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Thanks. I see the curve. Thanks for your guidance. I would try to draw the curve if possible. But now how you discovered the control point? Where should i put the second control point (i.e on the same side adjacent to C1 or on the opposite side of C1??)?

Also the question related to my solution remains unsolved (i.e post# 7). I have already specified what i know. I would try to find a link for it.

Zulfi.
 
Top