middlePoint static method

Point<int> middlePoint({
  1. required Point<int> from,
  2. required Point<int> to,
})

Implementation

static Point<int> middlePoint({
  required Point<int> from,
  required Point<int> to,
}) {
  final int p0 = from.x;
  final int p1 = from.y;
  final int q0 = to.x;
  final int q1 = to.y;

  return Point<int>(
    (p0 + q0) ~/ 2,
    (p1 + q1) ~/ 2,
  );
}