Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Bezier Curves

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    Bezier Curves

    I'm creating a function to make basis functions for bezier parametric curves. I realise that bezier curves go through the first and control points but none of the others. So far my function does output the correct first point but when it gets to the last point the result as always zero.

    I use the formula Bi(t)=C(k, i)t(power of i)(1-t)(power of k-i)

    C being the coefficiant and k and i being the row and element index values for pascals triangle.

    Im using the parametric range[0, 1] and as you can see when you input 1 the result would always have to be 0 and therefore my last sample point wouldnt = the last control point.

    Its a long winded explanation but I must be working something out wrong or maybe I'm doing it right and i just dont know it.

    Any help??

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    U.S.
    Posts
    149

    Re: Bezier Curves

    Originally posted by Mungo:

    I use the formula Bi(t)=C(k, i)t(power of i)(1-t)(power of k-i)

    Im using the parametric range[0, 1] and as you can see when you input 1 the result would always have to be 0
    If you input 1 you should get: Bn,n = t(power of n).

    C(n,n)=1 and (1-1)(power of n-n)=1. Rememeber anything to zeroth power is 1.

    I assume by C you meant binomial coefficient function.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    Re: Bezier Curves

    Even 0 to the power 0 is 1?? Eeee if so thats something i never knew.

    Yup C was the binomial coefficient function.

    Thanks very much for your help.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Bezier Curves

    No, 0^0 is undefined, it should give NaN on standard floating point units...

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    Re: Bezier Curves

    see thats my problem im going to have 1-1 to a power which will always either give an error or just equal 0 when i need it to equal 1

  6. #6
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    U.S.
    Posts
    149

    Re: Bezier Curves

    Originally posted by Overmind:
    No, 0^0 is undefined, it should give NaN on standard floating point units...
    Mathematically 0^0 = 1. Consult your CRC handbook.

    Your compiler may throw an exception with the pow(x,y) function when x,y=0. If so, you'll need to check the values rather than computing the function.

    Visual C++ 6.0 and gcc3.2-7 (on RH8) handle pow(0,0) just fine.

    #include <math.h>
    #include <stdio.h>
    int main(void)
    {
    printf("pow(0,0)=%f\n", pow(0,0));
    }

    pow(0,0)=1.000000

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    Re: Bezier Curves

    ive got it to work now. turned out the 1-1^0 wasnt the problem like i thought it was because as you were saying it does equal 1. Thanks for all your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •