Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created November 29, 2016 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enginebai/e00b887d547a6a4ef9a53eab223f71de to your computer and use it in GitHub Desktop.
Save enginebai/e00b887d547a6a4ef9a53eab223f71de to your computer and use it in GitHub Desktop.
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