insideSlotsOrMostly function

bool insideSlotsOrMostly(
  1. Rect cand,
  2. List<Rect> slots, {
  3. double minCover = 0.95,
})

Implementation

@pragma('vm:prefer-inline')
bool insideSlotsOrMostly(Rect cand, List<Rect> slots,
    {double minCover = 0.95}) {
  if (slots.isEmpty) return true;
  final total = cand.width * cand.height;
  if (total <= 0) return false;
  double covered = 0;
  for (final s in slots) {
    covered += cand.intersectionArea(s);
    if (covered >= minCover * total) return true;
  }
  return covered >= minCover * total;
}