for(u_int i = 0; i < 4; ++i) { vertex.x -= center.x; vertex.y -= center.y; tempX = cos(angle) * vertex.x - sin(angle) * vertex.y; tempY = sin(angle) * vertex.x + cos(angle) * vertex.y; vertex.x = center.x + tempX; vertex.y = center.y + tempY;}
This appears to work sometimes, and other times it goes completely wrong. I am drawing points at each vertex, so I can see where the box is. What seems to be happening is the vertexes progressively get an incorrect value, which alter the computations of center, which increase the inaccuracy, etc etc. I am not sure where it is going wrong.
If I rotate around a vertex, things look fine, but are offset a variable amount (depending on the angle). I tried for a while to find some existing help, and I couldn't find anything but I might have missed it. Thanks in advanced.