// id++;
} while (increment(pos, nextpos));
}
public List<Integer> getChildren(Shape shape) {
Region mbr = (Region) getShape();
Region childMBR = shape.getMBR();
int dims = mbr.getDimension();
int[] gridminindex = new int[dims];
for (int i = 0; i < gridminindex.length; i++) {
if (childMBR.getLow(i) <= mbr.getLow(i)) {
gridminindex[i] = 0;
} else {
gridminindex[i] = (int) Math.floor((childMBR.getLow(i) - mbr.getLow(i))/ tiles_size);
}
}
int[] gridmaxindex = new int[dims];
for (int i = 0; i < gridminindex.length; i++) {
if (childMBR.getHigh(i) >= mbr.getHigh(i)) {
gridmaxindex[i] = tiles_number[i] - 1;
} else {
gridmaxindex[i] = (int) Math.floor((childMBR.getHigh(i) - mbr.getLow(i))/ tiles_size);
}
}
// want to iterate from gridminindex to gridmaxindex
int current[] = gridminindex.clone();