Thread: Beiser Curves
View Single Post
  #2  
Old 01-19-2011, 01:30 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Well first off, throw temp in front of variables that are only going to be used locally otherwise they're declared globally which is just annoying.

You should modify it so you can call the function and get the result from it. I.e:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.val calc(12);
  
player.chat temp.val;
}

function 
calc(ab) {
  
temp.result b;
  return 
temp.result;

After you modify your formulas to work with coordinates since p1...4 = {x, y} and calculate using the respective coordinate in each formula. I.e:

PHP Code:
temp.nx = (t)^a[0] + * (t)^b[0] + * (t) * t^c[0] + t^d[0];
temp.ny = (t)^a[1] + * (t)^b[1] + * (t) * t^c[1] + t^d[1];
return {
temp.nxtemp.ny}; 
The parameters for this will probably be something like..

PHP Code:
function calc_bezier(tabcd) {
  
// your calculations

Also check out the diagrams here:
http://en.wikipedia.org/wiki/Bézier_curve
__________________
Quote:
Reply With Quote