private int partitionItems(int left, int right, int pivot, double[] origin) {
		double pivotDistance = distance(origin, items[pivot]);
		listSwap(items, pivot, right - 1);
		listSwap(indexes, pivot, right - 1);
		int storeIndex = left;
		for (int i = left; i < right - 1; i++) {
			if (distance(origin, items[i]) <= pivotDistance) {
				listSwap(items, i, storeIndex);
				listSwap(indexes, i, storeIndex);
				storeIndex++;
			}
		}
		listSwap(items, storeIndex, right - 1);
		listSwap(indexes, storeIndex, right - 1);
		return storeIndex;
	}
private int partitionItems ( int left , int right , int pivot , double [ ] origin ) { double pivotDistance = distance ( origin , items [ pivot ] ) ; listSwap ( items , pivot , right - 1 ) ; listSwap ( indexes , pivot , right - 1 ) ; int storeIndex = left ; for ( int i = left ; i < right - 1 ; i ++ ) { if ( distance ( origin , items [ i ] ) <= pivotDistance ) { listSwap ( items , i , storeIndex ) ; listSwap ( indexes , i , storeIndex ) ; storeIndex ++ ; } } listSwap ( items , storeIndex , right - 1 ) ; listSwap ( indexes , storeIndex , right - 1 ) ; return storeIndex ; }
Partition the points based on their distance to origin around the selected pivot.
@param left range start
@param right range end (exclusive)
@param pivot pivot for the partition
@param origin origin to compute the distance to
@return index of the pivot