protected Comparator<NS> doChooseSplitAxis(List<DBTreeRecord<?, ? extends NS>> children) {
		Comparator<NS> bestAxis = null;
		double bestMarginValue = Double.MAX_VALUE;
		// CSA1
		for (Comparator<NS> axis : getSplitAxes()) {
			children.sort(Comparator.comparing(DBTreeRecord::getBounds, axis));

			// Distributions as desribed in Section 4.2.
			// In the paper, S is defined as "the sum of all margin-values of the different distributions"
			// While the margin-value is defined as a sum. So just sum it all. No need to collect the groups,
			// or even pair their values.

			// Compute each area, incrementally, and sum them.
			// ************X (M = 12)
			// mmm-------mmm (m = 3)
			// 8 distributions : 12 - 2*3 + 2
			NS boundsFirstKChildren =
				unionStream(children.subList(0, minChildren).stream().map(DBTreeRecord::getBounds));
			NS boundsLastKChildren =
				unionStream(children.subList(maxChildren + 1 - minChildren, maxChildren + 1)
						.stream()
						.map(DBTreeRecord::getBounds));
			int maxK = maxChildren + 1 - minChildren * 2;

			double marginValue = 0;
			marginValue += boundsFirstKChildren.getMargin();
			marginValue += boundsLastKChildren.getMargin();
			for (int k = 0; k <= maxK; k++) { // NOTE: Our k is 0-up. Paper defines using 1-up.
				NS forFirst = children.get(minChildren + k).getBounds();
				NS forSecond = children.get(maxChildren - minChildren - k).getBounds();

				boundsFirstKChildren = boundsFirstKChildren.unionBounds(forFirst);
				boundsLastKChildren = boundsLastKChildren.unionBounds(forSecond);

				marginValue += boundsFirstKChildren.getMargin();
				marginValue += boundsLastKChildren.getMargin();
			}

			// CSA2
			if (bestAxis == null || marginValue < bestMarginValue) {
				bestAxis = axis;
				bestMarginValue = marginValue;
			}
		}
		assert bestAxis != null;
		return bestAxis;
	}
The Split algorithm as defined in Section 4.2 of the paper.

@param n the node to split
@return the new node (containing the second group)
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/spatial/AbstractRStarConstraintsTree.java