Nixit Patel
Nixit Patel

Reputation: 4445

point traking on rotating Image - android

In my application I have one Image which can be rotated... The rotation part is done.

now what I need to do is keep track of that rotation, if Part of the image is on certain angle there will be certain callback, So, the question is How can i track only one point of image which keeps rotating? Is there any workarroung? which can help me to solve this problem.

Thanks for reading.

Upvotes: 0

Views: 148

Answers (1)

D-rk
D-rk

Reputation: 5919

I assume you used the Matrix class from android.graphics.Matrix to rotate your image.

The matrix then holds all info you need and you can transform 2d points by the matrix like this:

float[] src = {x0,y0,x1,y1};
float[] dist = new float[4];
Matrix matrix = new Matrix();
matrix.preRotate(90.0f);
matrix.mapPoints(dist,src);

this should rotate all points by 90 degrees for example.

Upvotes: 2

Related Questions