Created
November 29, 2016 04:07
-
-
Save enginebai/e00b887d547a6a4ef9a53eab223f71de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private double convertTouchEventPointToAngle(float xPos, float yPos) { | |
// transform touch coordinate into component coordinate | |
float x = xPos - mTranslateX; | |
float y = yPos - mTranslateY; | |
x = (mClockwise) ? x : -x; | |
double angle = Math.toDegrees(Math.atan2(y, x) + (Math.PI / 2)); | |
angle = (angle < 0) ? (angle + 360) : angle; | |
return angle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment