Page 1 of 1

What is vectoradd?

PostPosted: Wed Jan 09, 2013 4:48 am
by Hblade
I just discovered this o.O

Re: What is vectoradd?

PostPosted: Wed Jan 09, 2013 5:03 am
by skydereign
Do you know what vectors are? Visually think of them as arrows to a point (starting at the origin). All vectoradd does is add the second vector to the first one. Visually this is the same thing as moving the start of the second arrow from (0,0) to the end of the first vector. Now the first vector is set equal to the new end point.
For example... adding vectors (1,1) and (2, 0). Putting the end of (2,0) to (1,1) would make it (3,1).

Mathematically is actually easier in this case. Just add the two x values together, and the two y values together. So vector one will now be set equal to (2+1, 1+0) = (3, 1). You probably noticed the function uses double* for the first two values. This allows the function to actually change the values of the first two numbers within the function. The script reference has a good demo of what you might use it for.

Re: What is vectoradd?

PostPosted: Wed Jan 09, 2013 5:07 am
by Hblade
Ahh ok, thanks!