简体   繁体   English

旋转图像上的点跟踪 - android

[英]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. 我假设您使用了android.graphics.Matrix中的Matrix类来旋转图像。

The matrix then holds all info you need and you can transform 2d points by the matrix like this: 矩阵然后保存您需要的所有信息,您可以通过矩阵转换2d点,如下所示:

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. 这应该将所有点旋转90度,例如。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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