I made a function that rotates my 4 vertices in a rectangle.

However the origin seemes to be (0, 0), which is the top left corner.

How could i change the origin to be in the middle of the rectangle?

rotate():

1 2 3 4 5 6 7 8 9 10 11 12 | void rotate(float radian) { objPosData[0] = ((x * cos(radian)) - (y * sin(radian))); objPosData[4] = (x * cos(radian)) - ((y + h) * sin(radian)); objPosData[8] = ((x + w) * cos(radian)) - ((y + h) * sin(radian)); objPosData[12] = ((x + w) * cos(radian)) - (y * sin(radian)); objPosData[1] = (x * sin(radian)) + (y * cos(radian)); objPosData[5] = (x * sin(radian)) + ((y + h) * cos(radian)); objPosData[9] = ((x + w) * sin(radian)) + ((y + h) * cos(radian)); objPosData[13] = ((x + w) * sin(radian)) + (y * cos(radian)); } |