Area.fromRanges constructor

Area.fromRanges({
  1. double? x,
  2. double? y,
  3. double? z,
  4. double? dx,
  5. double? dy,
  6. double? dz,
  7. Map<String, double> ranges = const {},
})

fromRanges is a constructor to construct an Area within a defined Range of a Location(Works like fill or clone).

Implementation

Area.fromRanges({
  double? x,
  double? y,
  double? z,
  double? dx,
  double? dy,
  double? dz,
  Map<String, double> ranges = const {},
}) {
  x = x ?? ranges['x'];
  y = y ?? ranges['y'];
  z = z ?? ranges['z'];

  dx = dx ?? ranges['dx'];
  dy = dy ?? ranges['dy'];
  dz = dz ?? ranges['dz'];

  final x2 = x != null && dx != null ? x + dx : null;
  final y2 = y != null && dy != null ? y + dy : null;
  final z2 = z != null && dz != null ? z + dz : null;

  loc1 = Location.glob(x: _min(x, x2), y: _min(y, y2), z: _min(z, z2));
  loc2 = Location.glob(x: _max(x, x2), y: _max(y, y2), z: _max(z, z2));
  _setDifferences();
}