change getQuadrant to getRegion

This commit is contained in:
yugecin
2017-05-26 17:18:44 +02:00
parent e408fd9607
commit c8df3d5b57
2 changed files with 18 additions and 9 deletions

View File

@@ -475,11 +475,20 @@ public class Utils {
} catch (Exception e) {}
}
public static int getQuadrant(double x, double y) {
if (x < displayContainer.width / 2d) {
return y < displayContainer.height / 2d ? 2 : 3;
}
return y < displayContainer.height / 2d ? 1 : 4;
/**
* Gets the region where the given point is in.
* First bit is set if x > half
* Second bit is set if y > half
*
* 2 | 3
* --+--
* 0 | 1
*/
public static int getRegion(double x, double y) {
int q = 0;
if (y < displayContainer.height / 2d) q = 2;
if (x < displayContainer.width / 2d) q |= 1;
return q;
}
/*