centerEdges method

recenters the points of a constant distance towards the center

@param y bottom most point @param z left most point @param x right most point @param t top most point @return ResultPoint describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost

Implementation

List<ResultPoint> centerEdges(
  ResultPoint y,
  ResultPoint z,
  ResultPoint x,
  ResultPoint t,
) {
  //
  //       t            t
  //  z                      x
  //        x    OR    z
  //   y                    y
  //

  final yi = y.x;
  final yj = y.y;
  final zi = z.x;
  final zj = z.y;
  final xi = x.x;
  final xj = x.y;
  final ti = t.x;
  final tj = t.y;

  if (yi < _width / 2.0) {
    return [
      ResultPoint(ti - _corr, tj + _corr),
      ResultPoint(zi + _corr, zj + _corr),
      ResultPoint(xi - _corr, xj - _corr),
      ResultPoint(yi + _corr, yj - _corr)
    ];
  } else {
    return [
      ResultPoint(ti + _corr, tj + _corr),
      ResultPoint(zi + _corr, zj - _corr),
      ResultPoint(xi - _corr, xj + _corr),
      ResultPoint(yi - _corr, yj - _corr)
    ];
  }
}