I am developing an android game. and in this I want to move an object along a Bezier path.
my object is rotating with some angle on this curve.
I used this piece of code:
public void update() {
// check collision with bottom wall if heading down
if (droid.getSpeed().getyDirection() == Speed.DIRECTION_DOWN
&& droid.getY() + droid.getBitmap().getHeight() / 2 >= getHeight()/2 &&
droid.getY() + droid.getBitmap().getHeight() / 2 <= getHeight()/2+ 100 ) {
int pointX[], pointY[];
pointX = new int[4];
pointY = new int[4];
int X , Y;
pointX[0] = getWidth()/2;
pointX[1] = getWidth()/2 + 50;
pointX[2] = getWidth()/2 + 25;
pointX[3] = getWidth()/2;
pointY[0] = getHeight()/2;
pointY[1] = getHeight()/2 + 25;
pointY[2] = getHeight()/2 + 50;
pointY[3] = getHeight()/2 + 100;
Log.i(TAG, "In the While Zone of Last Half Zone");
X = (int) ((pointX[3] * u * u * u) + (3 * pointX[2] * u * u * (1-u)) + (3 * pointX[1] * u * (1-u) * (1-u)) +
(pointX[0] * (1-u) * (1-u) * (1-u)));
Y = (int) ((pointY[3] * u * u * u) + (3 * pointY[2] * u * u * (1-u)) + (3 * pointY[1] * u * (1-u) * (1-u)) +
(pointY[0] * (1-u) * (1-u) * (1-u)));
Log.i(TAG+" Value of X: ", Double.toString(X));
Log.i(TAG+" Value of Y: ", Double.toString(Y));
double deltaX = X - droid.getX();
double deltaY = Y - droid.getY();
Log.i("deltaX :", Double.toString(deltaX));
Log.i("deltaY :", Double.toString(deltaY));
double angle = Math.atan2(deltaY, deltaX) ;
Log.i(TAG+" Angle: ", Double.toString(angle));
Matrix mtx = new Matrix();
mtx.preRotate((float) angle);
mtx.postScale(1, 1);
Bitmap rotatedBMP = Bitmap.createBitmap(droid.getBitmap(), droid.getX(), droid.getY(), X - droid.getX(), Y - droid.getY(), mtx, true);
droid.setBitmap(rotatedBMP);
droid.curveUpdate(X, Y);
u = u + 0.001;
Log.i(TAG+" Value of U: ", Double.toString(u));
}
// check collision with top wall if heading up
// Update the lone droid
else{
droid.update();
}
}
my object is moving and rotating as i supposed but image is getting blur. am not getting why is so.
Please suggest what can be the problem.
Thanks.

. You only need a quadrant worth of rotation pre-calculated. It saves memory and you can rotate on the fly to 90/180/270 without loosing quality to cover the other 4 quadrant (going back to the first figure, notice that the grids will align perfectly with rotations of 90/180/270 degrees).