ok, I have a project where i have to do a rotation of a line without using any gl methods, all work has to be done with the base formulas :

x’ = x cosq – y sinq
y’ = x sinq + y cosq

these formulas work from the origin, but the line can be from/to anypoint on the screen, it has to be rotated around its midpoint 5 degrees. If anyone can start me off id be greatly appreciative.

Rotations and scaling all assume the object is center at the origin. The only way to rotate or scale an object which is not centered at the origin is to center it at the origin, rotate or scale it, then recenter the object where it normally would be. Obviously, if the object shouldn’t rotate around it’s center, you’d want to “center” it off center, so to speak. For instance, assume a line has the starting point start=(x1,y1,z1) and the ending point end=(x2,y2,z2). Then, the rotation algorithm would be:

midpoint = (start+end)/2 OR
{
midx = (x1+x2)/2
midy = (y1+y2)/2
midz = (z1+z2)/2
}
translate by -midpoint (-midx, -midy, -midz)
rotate by (theta, phi, psi)
translate by midpoint (midx, midy, midz)
draw line

I’m not 100% sure how transformations are applied in OpenGL or else I’d give you working code, but I think the above algorithm can be converted directly into code without causing a major problem for OpenGL.