What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Bezier curve formula in C++

Bezier curve formula in C++
Author: Message:
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: Bezier curve formula in C++
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:

(v1 * ((1-t)*(1-t)*(1-t))) + vc1 * (3 * ((1-t)*(1-t))) * t + vc2 * ( 3 * ((1-t) * (t*t)))+ (v2 * (t*t*t))

that is equal to:

(v1 * ((1-t)*(1-t)*(1-t))) + 3 * vc1 * t*(1-t)*(1-t) + 3 * vc2 * t * t * (1-t) + v2*t*t*t

so now, you do the "cout <<" thing but only with the v1, v2, vc1, vc2 variables and the rest of the expression you keep it as a string:

code:
cout << "Answer = " << v1 << " * (1 - t) * (1 - t) * (1 - t) + (" << 3 * vc1 << ") * t * (1 - t) * (1 - t) + (" << 3 * vc2 << ") * t *t * (1 - t) + (" << v2 << ") * t * t * t" << endl;

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 :P
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
03-26-2008 10:42 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Bezier curve formula in C++ - by Reaper on 03-26-2008 at 06:26 PM
RE: Bezier curve formula in C++ - by Adeptus on 03-26-2008 at 10:16 PM
RE: Bezier curve formula in C++ - by Choli on 03-26-2008 at 10:42 PM
RE: Bezier curve formula in C++ - by mezzanine on 03-26-2008 at 11:01 PM
RE: Bezier curve formula in C++ - by Choli on 03-26-2008 at 11:19 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On