Understanding Bezier curve equations

Discussion in 'Homework Help' started by zulfi100, Feb 3, 2014.

  1. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    I want to understand the Bezier curve equation. Can some body plz guide me. I have attached a slide as a file.

    Zulfi.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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?
     
  3. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    Thanks for your attention. In the book its "P(u)" instead of "C(u)". It says:
    :


    (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.
     
  4. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,165
  5. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  6. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,165
    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.
     
    Last edited: Feb 5, 2014
  7. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  8. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,165
    Last edited: Feb 6, 2014
  9. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    What order of Bezier curve are you trying to plot?
     
  11. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,165
  12. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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.
     
  13. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  14. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    I am providing the solutions:

    The eq are:
    Code ( (Unknown Language)):
    1.   P(a)=(1-a)P0 + aP1  
    Plz check my answer.

    Zulfi.
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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.
     
  16. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  17. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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:
    Code ( (Unknown Language)):
    1.  
    2.         x[0]=10; y[0]=100;
    3.     x[1]=110; y[1]=200;
    4.     x[2]=210; y[2]=300;
    5.     x[3]=310; y[3]=400;
    6.     bezier (x, y, pDC);
    7.  
    8.  
    Plz guide me why i am getting a straight line instead of a curve.

    Zulfi.
     
  18. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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.
     
  19. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    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.
     
  20. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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.
     
Loading...