Bezier curve formula in C++ - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Bezier curve formula in C++ (/showthread.php?tid=82682) Bezier curve formula in C++ by Reaper on 03-26-2008 at 06:26 PM
I need to use a formula and output a variable in C++ but I have an issue. Im using the variable in the forumla but I want the formula to ouput the value of the variable. Sounds complicated so here is my code: code:Basically, the "t" in the formula is what I want. I need the output to be in terms of "t". Its kinda hard to explain. RE: Bezier curve formula in C++ by Adeptus on 03-26-2008 at 10:16 PM
The statement that computes your formula doesn't alter "t", so you can simply "cout << t" before or after "ans", or do whatever you want with it. It's just a variable. RE: Bezier curve formula in C++ by Choli on 03-26-2008 at 10:42 PM
I think he wants to output the result of that expression after simplifying it using symbolic calculus. That can't be done automatically in C++ (you can do it in Maple, Mathematica or Matlab). So what you have to do is: simplify it by hand, using v1, v2 and v3 as symbolic variables, and after that, susbtitute them by the numbers. ie: code: Note how i've used parenthesis in the expression around the calculated values of 3*vc2, etc... to make mathematically correct the expression in the case where vc2 is a negative number RE: Bezier curve formula in C++ by mezzanine on 03-26-2008 at 11:01 PM The cubic Bézier curve formula resolves to a cubic equation in terms of t, which is quite difficult to solve. If you're really brave, you can write the equation in depressed form and make use of the Chebyshev radicals to find the roots. RE: Bezier curve formula in C++ by Choli on 03-26-2008 at 11:19 PM
quote:but he has a cubic formula in terms of t, but he equals it to "ans" which is undefined, so he can't solve anything Anyway, cubic equations do have a formula to find their roots, however it's quite complex (it uses several square and cubic roots and the imaginary number i). You can find the exact formula clicking here, typing "ax^3+bx^2+cx+d= 0" (without quotes) in the text area next to where it says "solve" and pressing the button Solve |