Improve radius level math

This commit is contained in:
Victor Shcherb 2019-07-07 15:15:49 +02:00
parent 84fdb9b6db
commit 727b6ba399

View file

@ -747,12 +747,20 @@ public class SearchPhrase {
}
}
public int getRadiusSearch(int meters, int radiusLevel) {
int res = meters;
for(int k = 0; k < radiusLevel; k++) {
res = res * (k % 2 == 0 ? 2 : 3);
}
return res;
}
public int getRadiusSearch(int meters) {
return (1 << (getRadiusLevel() - 1)) * meters;
return getRadiusSearch(meters, getRadiusLevel() - 1);
}
public int getNextRadiusSearch(int meters) {
return (1 << (getRadiusLevel())) * meters;
return getRadiusSearch(meters, getRadiusLevel());
}
public static int icompare(int x, int y) {