rectToCircle static method

bool rectToCircle(
  1. RectangleShape a,
  2. CircleShape b
)

Implementation

static bool rectToCircle(RectangleShape a, CircleShape b) {
  if (!rectToRect(a, b.rect)) return false;

  final points = [
    a.leftTop,
    a.rightTop,
    a.rightBottom,
    a.leftBottom,
    a.leftTop,
  ];
  for (var i = 0; i < points.length - 1; i++) {
    final distance = getNearestDistance(points[i], points[i + 1], b.center);
    if (_getFixDouble(distance) <= b.radius) return true;
  }

  return false;
}