compareCoordinate static method

int compareCoordinate(
  1. CoordinateSequence s1,
  2. CoordinateSequence s2,
  3. int i,
  4. int dimension,
)

Compares the same coordinate of two {@link CoordinateSequence}s along the given number of dimensions.

@param s1 a {@link CoordinateSequence} @param s2 a {@link CoordinateSequence} @param i the index of the coordinate to test @param dimension the number of dimensions to test @return -1, 0, or 1 depending on whether s1i is less than, equal to, or greater than s2i

Implementation

static int compareCoordinate(
    CoordinateSequence s1, CoordinateSequence s2, int i, int dimension) {
  for (int d = 0; d < dimension; d++) {
    double ord1 = s1.getOrdinate(i, d);
    double ord2 = s2.getOrdinate(i, d);
    int comp = compareStatic(ord1, ord2);
    if (comp != 0) return comp;
  }
  return 0;
}