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)); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | void rotate(float radian) { float baseX = 0 - w/2; float baseY = 0 - h/2; float baseW = baseX + w; float baseH = baseY + h; float n0X = (baseX * cos(radian)) - (baseY * sin(radian)); float n4X = (baseX * cos(radian)) - (baseH * sin(radian)); float n8X = (baseW * cos(radian)) - (baseH * sin(radian)); float n12X = (baseW * cos(radian)) - (baseY * sin(radian)); float n1Y = (baseX * sin(radian)) + (baseY * cos(radian)); float n5Y = (baseX * sin(radian)) + (baseH * cos(radian)); float n9Y = (baseW * sin(radian)) + (baseH * cos(radian)); float n13Y = (baseW * sin(radian)) + (baseY * cos(radian)); objPosData[0] = n0X + x; objPosData[4] = n4X + x; objPosData[8] = n8X + x + w; objPosData[12] = n12X + x + w; objPosData[1] = n1Y + y; objPosData[5] = n5Y + y + h; objPosData[9] = n9Y + y + h; objPosData[13] = n13Y + y } |
1 2 3 4 5 6 7 8 9 | objPosData[0] = n0X + x; objPosData[4] = n4X + x; objPosData[8] = n8X + x; objPosData[12] = n12X + x; objPosData[1] = n1Y + y; objPosData[5] = n5Y + y; objPosData[9] = n9Y + y; objPosData[13] = n13Y + y; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | void rotate(float radian) { float baseX = 0 - w/2; float baseY = 0 - h/2; float baseW = baseX + w; float baseH = baseY + h; float n0X = (baseX * cos(radian)) - (baseY * sin(radian)); float n4X = (baseX * cos(radian)) - (baseH * sin(radian)); float n8X = (baseW * cos(radian)) - (baseH * sin(radian)); float n12X = (baseW * cos(radian)) - (baseY * sin(radian)); float n1Y = (baseX * sin(radian)) + (baseY * cos(radian)); float n5Y = (baseX * sin(radian)) + (baseH * cos(radian)); float n9Y = (baseW * sin(radian)) + (baseH * cos(radian)); float n13Y = (baseW * sin(radian)) + (baseY * cos(radian)); objPosData[0] = n0X + x + (w/2); objPosData[4] = n4X + x + (w/2); objPosData[8] = n8X + x + (w/2); objPosData[12] = n12X + x + (w/2); objPosData[1] = n1Y + y + (h/2); objPosData[5] = n5Y + y + (h/2); objPosData[9] = n9Y + y + (h/2); objPosData[13] = n13Y + y + (h/2); } |