please a simple example
what does this mean [ cos a sin a ]
multiply cos(a) with sin(a) ?, i cant just put two number after each other?
Hmmm, I guess the way I wrote that is a bit incorrect (even from a mathematical point of view now that I look at it) and seeing as I can't really make a matrix in this text editor, I'm gonna rephrase that in code (C++).
The givens rotator is a matrix, in our case it's 2x2 because we're working with 2-d space
Therefore we have
float angle = PI;
float givens[2][2];
float coordinates[2];
float transcoords[2];
coordinates[0]=0;
coordinates[1]=1;
givens[0][0]=cos(angle);
givens[0][1]=sin(angle);
givens[1][0]=-sin(angle);//or you could use sin(-angle) here because sin(-x)=-sin(x)
givens[1][1]=cos(angle);
transcoords[0]=givens[0][0]*coordinates[0]+givens[0][1]*coordinates[1];
transcoords[1]=givens[1][0]*coordinates[0]+givens[1][1]*coordinates[1];
So in this example x=0 and y=1 and we want to rotate them by PI radians which would mean that x=0 and y=-1
So we have
x'=cos(PI)*0 + sin(PI)*1 = 0 and
y'=-sin(PI)*0 + cos(PI)*1 = -1 because sin(PI)=0 and cos(PI)=-1
Let's take another easy example and rotate x and y just by PI/2 radians
This time we have
x'=cos(PI/2)*0 + sin(PI/2)*1 = 1 and
y'=-sin(PI/2)*0 + cos(PI/2)*1 = 0Also,it looks like the rotation is clockwise not counterclockwise, my bad.