Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double setAlfa(BigLatern bigLatern) {
- int modulus = abs(bigLatern.x) + abs(bigLatern.y);
- double result;
- if ((bigLatern.x == 0) && (bigLatern.y == 0)) {
- result = 0;
- }
- if ((bigLatern.x >= 0) && (bigLatern.y >= 0)) {
- result = (double)bigLatern.y / modulus;
- }
- if ((bigLatern.x < 0) && (bigLatern.y >= 0)) {
- result = 2 - ((double)bigLatern.y / modulus);
- }
- if ((bigLatern.x < 0) && (bigLatern.y < 0)) {
- result = 2 + ((double)abs(bigLatern.y) / modulus);
- }
- if ((bigLatern.x >= 0) && (bigLatern.y < 0)) {
- result = 4 - ((double)abs(bigLatern.y) / modulus);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment