/** * Finds a point in a list of points which is not contained in another list of points * @param testPts the {@link Coordinate}s to test * @param pts an array of {@link Coordinate}s to test the input points against * @return a {@link Coordinate} from <code>testPts</code> which is not in <code>pts</code>, ' * or <code>null</code> */ public static Coordinate ptNotInList(Coordinate[] testPts, Coordinate[] pts) { for (int i = 0; i < testPts.length; i++) { Coordinate testPt = testPts[i]; if (CoordinateArrays.indexOf(testPt, pts) < 0) return testPt; } return null; }
/** * Shifts the positions of the coordinates until <code>firstCoordinate</code> * is first. * *@param coordinates the array to rearrange *@param firstCoordinate the coordinate to make first */ public static void scroll(Coordinate[] coordinates, Coordinate firstCoordinate) { int i = indexOf(firstCoordinate, coordinates); if (i < 0) return; Coordinate[] newCoordinates = new Coordinate[coordinates.length]; System.arraycopy(coordinates, i, newCoordinates, 0, coordinates.length - i); System.arraycopy(coordinates, 0, newCoordinates, coordinates.length - i, i); System.arraycopy(newCoordinates, 0, coordinates, 0, coordinates.length); }