Asked • 03/26/19

Determining the quadrant of a point?

I need to determine the quadrant of point, in a faster way. I am only aware of "determine using the signs" method. I am looking for a good approach, if any. If not any fixes to my code would help. Assume there are 4 quads on the plane. My code- int x = scan.nextInt() > 0 ? 1 : 0;    int y = scan.nextInt() > 0 ? 1 : 0;    switch (x) {    case 1:     switch (y) {     case 1:      quad = 1;      break;     case 0:      quad = 4;      break;     }     break;    case 0:     switch (y) {     case 1:      quad = 2;      break;     case 0:      quad = 3;      break;     }     break;    }

1 Expert Answer

By:

Milad G. answered • 04/25/20

Tutor
5 (13)

Software Engineer + Computer Science Degree | Crypto/Meta Consultant

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.