• Bezire curve generalization formula (choose?)
    3 replies, posted
Hi, so im trying to write a java applet to draw a bezier curve with an undefined amount of points. As in, not a quadratic or cubic one. I have looked at [url="http://en.wikipedia.org/wiki/B%C3%A9zier_curve"]bezier curve formula[/url] but i am confused about one thing. the (n) (i) or the so called "binomial coefficent" Can someone explain this to me, and how I can use it? Thanks :) PS: if this is in the wrong section or something, would a mod move it and PM me about it, as its not really a programming question, but theres no math section. Is there? :ninja:
The [url=http://en.wikipedia.org/wiki/Binomial_coefficient]binomial coefficient[/url] C(n, i) (which is the same as n on top of i) is basically the ith coefficient from the nth row of the Pascal triangle, where the first row is row 0: [code] 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ... [/code] [editline]20th November 2010[/editline] That is, the ith number from the left [editline]20th November 2010[/editline] You probably want to see the multiplicative and/or recursive formulas on that wikipedia page I linked
When I did this I used following steps: Have a float ranging from 0.0 to 1.0 have a line struct that has a method which returns a point. It should take one argument and that's your float. If the number is 0.0 it returns the first point in the line, if the number is 1.0 it returns the second one. If it's something like 0.5, it returns the point right between those two (simple math). Then make lines connecting the n number of points you have defining the curve. Run your function on all of them to get the same number of points - 1 (if I'm not mistaken) Make lines out of those new points and repeat until you have one one point store it somewhere as it's the first point in your curve. Increase that var from the begging and repeat the process. If you increase it by less, you'll get a smoother curve but it will take longer to calculate it. As I said, that's what I did. Don't know if it's the best way. [editline]20th November 2010[/editline] And that's the recursive way.
[QUOTE=esalaka;26165514]The [url=http://en.wikipedia.org/wiki/Binomial_coefficient]binomial coefficient[/url] C(n, i) (which is the same as n on top of i) is basically the ith coefficient from the nth row of the Pascal triangle, where the first row is row 0: [code] 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ... [/code] [editline]20th November 2010[/editline] That is, the ith number from the left [editline]20th November 2010[/editline] You probably want to see the multiplicative and/or recursive formulas on that wikipedia page I linked[/QUOTE] I can't use the factorial formula, which looks like the easiest on? Edit: it looks like I can just do n^k/k! but why is the n^[u]k[/u] underlined? @Darwin thank you, that'll be helpful for me :)
Sorry, you need to Log In to post a reply to this thread.