简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM