Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. private double getAlpha(double x, double y)
  2. {
  3. /* Calculates alpha value according to given (x, y) coordinates using trigonometry.
  4. Defines a special case for when x's value is 0. */
  5.  
  6. if (x != 0)
  7. {
  8. double alpha = Math.atan(y / x) / Math.PI * 180;
  9. return Math.round(alpha * 10000) / (double) 10000;
  10. }
  11. else
  12. return 90.0;
  13. } // End of private method getAlpha
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement