getRectMinMax method

void getRectMinMax(
  1. int iMinX,
  2. int iMinY,
  3. int iMaxX,
  4. int iMaxY,
  5. List<double> result,
)

Get max/min in a rectangle in the matrix data @param result An array to store the results in. @return The result array, if it was passed in. Minimum will be at position 0 and max at 1.

Implementation

void getRectMinMax(int iMinX, int iMinY, int iMaxX, int iMaxY,List<double> result) {
  result.clear();
  // Get max and min of the data
  final data = this.data; // Set first value

  double max = minValue!;
  for (int i = iMinX; i <= iMaxX; i++) {
    for (int j = iMinY; j <= iMaxY; j++) {
      final height = data[i][j];
      if (height > max) {
        max = height;
      }
    }
  }

  result.addAll([minValue!,max]);
}