getExtremumAlongDim method

double getExtremumAlongDim({
  1. List<Vector3>? points,
  2. int dim = 0,
  3. int key = 0,
})

Implementation

double getExtremumAlongDim(
    {List<Vector3>? points, int dim = 0, int key = 0}) {
  points ??= getPointsDefiningBoundary();

  var values = [for (var point in points) point.getComponent(dim)];

  if (key < 0) {
    return values.reduce(min);
  } else if (key == 0) {
    var minVal = values.reduce(min);
    var maxVal = values.reduce(max);
    return (minVal + maxVal) / 2;
  } else {
    return values.reduce(max);
  }
}