// Path: src/main/java/com/github/davidmoten/rtree3d/geometry/HasGeometry.java
// public interface HasGeometry {
// 
//     Geometry geometry();
// }
// 
// Path: src/main/java/com/github/davidmoten/rtree3d/geometry/ListPair.java
// public final class ListPair<T extends HasGeometry> {
//     private final Group<T> group1;
//     private final Group<T> group2;
//     // these non-final variable mean that this class is not thread-safe
//     // because access to them is not synchronized
//     private float areaSum = -1;
//     private final float marginSum;
// 
//     public ListPair(List<T> list1, List<T> list2) {
//         this.group1 = new Group<T>(list1);
//         this.group2 = new Group<T>(list2);
//         this.marginSum = group1.geometry().mbb().surfaceArea() + group2.geometry().mbb().surfaceArea();
//     }
// 
//     public Group<T> group1() {
//         return group1;
//     }
// 
//     public Group<T> group2() {
//         return group2;
//     }
// 
//     public float volumeSum() {
//         if (areaSum == -1)
//             areaSum = group1.geometry().mbb().volume() + group2.geometry().mbb().volume();
//         return areaSum;
//     }
// 
//     public float marginSum() {
//         return marginSum;
//     }
// 
// }


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.davidmoten.rtree3d.geometry.HasGeometry;
import com.github.davidmoten.rtree3d.geometry.ListPair;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import rx.functions.Func1;
package com.github.davidmoten.rtree3d;




public final class SplitterRStar implements Splitter {

    private final Comparator<ListPair<?>> comparator;

    @SuppressWarnings("unchecked")
    public SplitterRStar() {
        this.comparator = Comparators.compose(Comparators.overlapListPairComparator,
                Comparators.volumePairComparator);
    }

    @Override
// Path: src/main/java/com/github/davidmoten/rtree3d/geometry/HasGeometry.java
// public interface HasGeometry {
// 
//     Geometry geometry();
// }
// 
// Path: src/main/java/com/github/davidmoten/rtree3d/geometry/ListPair.java
// public final class ListPair<T extends HasGeometry> {
//     private final Group<T> group1;
//     private final Group<T> group2;
//     // these non-final variable mean that this class is not thread-safe
//     // because access to them is not synchronized
//     private float areaSum = -1;
//     private final float marginSum;
// 
//     public ListPair(List<T> list1, List<T> list2) {
//         this.group1 = new Group<T>(list1);
//         this.group2 = new Group<T>(list2);
//         this.marginSum = group1.geometry().mbb().surfaceArea() + group2.geometry().mbb().surfaceArea();
//     }
// 
//     public Group<T> group1() {
//         return group1;
//     }
// 
//     public Group<T> group2() {
//         return group2;
//     }
// 
//     public float volumeSum() {
//         if (areaSum == -1)
//             areaSum = group1.geometry().mbb().volume() + group2.geometry().mbb().volume();
//         return areaSum;
//     }
// 
//     public float marginSum() {
//         return marginSum;
//     }
// 
// }


// Path: src/main/java/com/github/davidmoten/rtree3d/SplitterRStar.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.davidmoten.rtree3d.geometry.HasGeometry;
import com.github.davidmoten.rtree3d.geometry.ListPair;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import rx.functions.Func1;

package com.github.davidmoten.rtree3d;




public final class SplitterRStar implements Splitter {

    private final Comparator<ListPair<?>> comparator;

    @SuppressWarnings("unchecked")
    public SplitterRStar() {
        this.comparator = Comparators.compose(Comparators.overlapListPairComparator,
                Comparators.volumePairComparator);
    }

    @Override
    public <T extends HasGeometry> ListPair<T> split(List<T> items, int minSize) {