// test the sorting with respect to the minimal values
{
ModifiableHyperBoundingBox mbr1 = mbr(minSorting, 0, minEntries - 1);
for(int i = 0; i <= size - 2 * minEntries; i++) {
mbr1.extend(getter.get(entries, minSorting[minEntries + i - 1].second));
HyperBoundingBox mbr2 = mbr(minSorting, minEntries + i, size);
double currentOverlap = SpatialUtil.relativeOverlap(mbr1, mbr2);
if(currentOverlap <= minOverlap) {
double vol = SpatialUtil.volume(mbr1) + SpatialUtil.volume(mbr2);
if(currentOverlap < minOverlap || vol < volume) {
minOverlap = currentOverlap;
volume = vol;
splitPoint = minEntries + i;
bestSorting = minSorting;
}
}
}
}
// test the sorting with respect to the maximal values
{
ModifiableHyperBoundingBox mbr1 = mbr(maxSorting, 0, minEntries - 1);
for(int i = 0; i <= size - 2 * minEntries; i++) {
mbr1.extend(getter.get(entries, maxSorting[minEntries + i - 1].second));
HyperBoundingBox mbr2 = mbr(maxSorting, minEntries + i, size);
double currentOverlap = SpatialUtil.relativeOverlap(mbr1, mbr2);
if(currentOverlap <= minOverlap) {
double vol = SpatialUtil.volume(mbr1) + SpatialUtil.volume(mbr2);
if(currentOverlap < minOverlap || vol < volume) {
minOverlap = currentOverlap;