filter method

void filter(
  1. CoordinateSequence seq,
  2. int index
)
override

Performs an operation on a coordinate in a {@link CoordinateSequence}.

@param seq the CoordinateSequence to which the filter is applied @param i the index of the coordinate to apply the filter to

Implementation

void filter(CoordinateSequence seq, int index) {
  /**
   * This logic also handles skipping Point geometries
   */
  if (index == 0) return;

  Coordinate p0 = seq.getCoordinate(index - 1);
  Coordinate p1 = seq.getCoordinate(index);

  double delx = (p1.x - p0.x) / numSubSegs;
  double dely = (p1.y - p0.y) / numSubSegs;

  for (int i = 0; i < numSubSegs; i++) {
    double x = p0.x + i * delx;
    double y = p0.y + i * dely;
    Coordinate pt = new Coordinate(x, y);
    minPtDist.initialize();
    DistanceToPoint.computeDistance(geom, pt, minPtDist);
    maxPtDist.setMaximum(minPtDist);
  }
}