i'm trying to create a 2d rotation without any luck, here's the code!

public void render(int xPos, int yPos, double a, BitMap data){ double angle = Math.toRadians(a); int xScr = 0; int yScr = 0; int CenterX = data.getWidth() / 2; int CenterY = data.getHeight() / 2; for(int y = 0; y < data.getHeight(); y++){ yScr = (y + yPos); if(yScr < 0){ continue; } else if(yScr >= height){ return; } for(int x = 0; x < data.getWidth(); x++){ xScr = (x + xPos); if(xScr < 0){ continue; } if(yScr >= width){ return; } int dataX = (int)(CenterX + (x - CenterX) * Math.cos(angle) - (y - CenterY) *Math.sin(angle)); int dataY = (int)(CenterY + (x - CenterX) * Math.sin(angle) + (y - CenterY) * Math.cos(angle)); if(dataX > 0 && dataX < data.getWidth()){ if(dataY > 0 && dataY < data.getHeight()){ screenPixels.setValue(dataX, dataY, data.getValue(x, y)); } } } } }

The cube is rendering and is rotating, but it's leaving holes. I know it's because dataX and dataY is rounding of and there for there will be pixels left. I don't really know where to get started, and I would be really happy if someone could code write the code that's is missing, because i'm going to participate in Ludumdare this weekend and haven't still figured out this. Please, help me!