Vector Rotation [SOLVED]
Posted: Wed Oct 30, 2013 10:12 am
Hello.
I'm trying to rotate two vectors around the origin.
I continue to get very strange numbers that don't make any sense.
Is there anything notably incorrect about this rotation function?
Thanks,
Benjamin
I'm trying to rotate two vectors around the origin.
I continue to get very strange numbers that don't make any sense.
Is there anything notably incorrect about this rotation function?
Code: Select all
void rotateVectors(double rad) //Rotation must be in radians.
{
va[0]= cos(rad)*va[0] -sin(rad)*va[1] ; //vector a, x coordinate.
va[1]= sin(rad)*va[0] +cos(rad)*va[1];
vb[0]= cos(rad)*vb[0] -sin(rad)*vb[1]; //vector b, x coordinate.
vb[1]= sin(rad)*vb[0] +cos(rad)*vb[1];
}
Benjamin