expandToInclude method

void expandToInclude(
  1. double x,
  2. double y
)

Enlarges this Envelope so that it contains the given point. Has no effect if the point is already on or within the envelope.

@param x the value to lower the minimum x to or to raise the maximum x to @param y the value to lower the minimum y to or to raise the maximum y to

Implementation

void expandToInclude(double x, double y) {
  if (isNull()) {
    _minx = x;
    _maxx = x;
    _miny = y;
    _maxy = y;
  } else {
    if (x < _minx) {
      _minx = x;
    }
    if (x > _maxx) {
      _maxx = x;
    }
    if (y < _miny) {
      _miny = y;
    }
    if (y > _maxy) {
      _maxy = y;
    }
  }
}