Guest User

Untitled

a guest
May 28th, 2018
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. double setAlfa(BigLatern bigLatern) {
  2. int modulus = abs(bigLatern.x) + abs(bigLatern.y);
  3. double result;
  4.  
  5. if ((bigLatern.x == 0) && (bigLatern.y == 0)) {
  6. result = 0;
  7. }
  8. if ((bigLatern.x >= 0) && (bigLatern.y >= 0)) {
  9. result = (double)bigLatern.y / modulus;
  10. }
  11. if ((bigLatern.x < 0) && (bigLatern.y >= 0)) {
  12. result = 2 - ((double)bigLatern.y / modulus);
  13. }
  14. if ((bigLatern.x < 0) && (bigLatern.y < 0)) {
  15. result = 2 + ((double)abs(bigLatern.y) / modulus);
  16. }
  17. if ((bigLatern.x >= 0) && (bigLatern.y < 0)) {
  18. result = 4 - ((double)abs(bigLatern.y) / modulus);
  19. }
  20. return result;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment