//This is a rotate function that is passed an angle
cx = sin(angle);
cz = -cos(angle); //->Why negative Cosine?
gluPerspective(45, ratio, 1, 1000);
gluLookAt(x,y,z, /Camera Position/ x+cx,y+cy,z+cz, 0,1,0); /*Up Vector */
This code works perfectly for rotating the view in a 3D world. I pass in angle to my function and this code updates the view accordingly. I don’t understand why you can take the cosine/sine of the angle when the center is not the origin (0,0,0). I mean, I could be anywhere in my 3D world and this code works. Also, why do you take NEGATIVE cosine. I thought you take the value of cos(theta) to get the “x” value and sine(theta) to get the “z” value?
Does the gluLookAt() translate to the origin, rotate, and then translate back? (behind the scene?)
I just want to understand this fragment.
Any help would be appreciated.